From 71cbb369b6a718466159590107daad47df3e8747 Mon Sep 17 00:00:00 2001 From: taekchef Date: Fri, 10 Jul 2026 04:26:29 +0800 Subject: [PATCH 01/36] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=86=85=E5=AE=B9=E8=BD=A8=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/WeiBei/Resources/Editor/editor.js | 620 +++++++++--------- Sources/WeiBei/Stores/WorkspaceStore.swift | 15 + Sources/WeiBei/Views/ContentRailView.swift | 427 ++++++++++++ Sources/WeiBei/Views/ContentView.swift | 219 ++++++- Sources/WeiBei/Views/NotesAgentView.swift | 306 +++++++-- Sources/WeiBei/Views/ReaderView.swift | 581 +++++++++++++++- .../WeiBei/Views/RichMarkdownEditorView.swift | 12 + Sources/WeiBei/WebEditor/src/editor.js | 40 ++ Sources/WeiBeiCore/WorkspaceModels.swift | 10 + Sources/WeiBeiSelfCheck/main.swift | 53 +- 10 files changed, 1866 insertions(+), 417 deletions(-) create mode 100644 Sources/WeiBei/Views/ContentRailView.swift diff --git a/Sources/WeiBei/Resources/Editor/editor.js b/Sources/WeiBei/Resources/Editor/editor.js index 4213d2c89..a34aaba91 100644 --- a/Sources/WeiBei/Resources/Editor/editor.js +++ b/Sources/WeiBei/Resources/Editor/editor.js @@ -1,6 +1,6 @@ -(()=>{var Iit=Object.create;var fP=Object.defineProperty;var Mit=Object.getOwnPropertyDescriptor;var Nit=Object.getOwnPropertyNames;var Dit=Object.getPrototypeOf,Oit=Object.prototype.hasOwnProperty;var W=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Qo=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Tr=(e,t)=>{for(var r in t)fP(e,r,{get:t[r],enumerable:!0})},Pit=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Nit(t))!Oit.call(e,i)&&i!==r&&fP(e,i,{get:()=>t[i],enumerable:!(n=Mit(t,i))||n.enumerable});return e};var Ro=(e,t,r)=>(r=e!=null?Iit(Dit(e)):{},Pit(t||!e||!e.__esModule?fP(r,"default",{value:e,enumerable:!0}):r,e));var qle=Qo((hgr,Gle)=>{"use strict";var _E=Object.prototype.hasOwnProperty,zle=Object.prototype.toString,Dle=Object.defineProperty,Ole=Object.getOwnPropertyDescriptor,Ple=function(t){return typeof Array.isArray=="function"?Array.isArray(t):zle.call(t)==="[object Array]"},Ble=function(t){if(!t||zle.call(t)!=="[object Object]")return!1;var r=_E.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&_E.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||_E.call(t,i)},Fle=function(t,r){Dle&&r.name==="__proto__"?Dle(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},$le=function(t,r){if(r==="__proto__")if(_E.call(t,r)){if(Ole)return Ole(t,r).value}else return;return t[r]};Gle.exports=function e(){var t,r,n,i,a,s,o=arguments[0],l=1,u=arguments.length,h=!1;for(typeof o=="boolean"&&(h=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l{odt=typeof global=="object"&&global&&global.Object===Object&&global,R7=odt});var ldt,cdt,wa,mu=W(()=>{uz();ldt=typeof self=="object"&&self&&self.Object===Object&&self,cdt=R7||ldt||Function("return this")(),wa=cdt});var udt,Ns,Y1=W(()=>{mu();udt=wa.Symbol,Ns=udt});function ddt(e){var t=hdt.call(e,LT),r=e[LT];try{e[LT]=void 0;var n=!0}catch{}var i=fdt.call(e);return n&&(t?e[LT]=r:delete e[LT]),i}var Vde,hdt,fdt,LT,Wde,Hde=W(()=>{Y1();Vde=Object.prototype,hdt=Vde.hasOwnProperty,fdt=Vde.toString,LT=Ns?Ns.toStringTag:void 0;Wde=ddt});function gdt(e){return mdt.call(e)}var pdt,mdt,Ude,Yde=W(()=>{pdt=Object.prototype,mdt=pdt.toString;Ude=gdt});function xdt(e){return e==null?e===void 0?vdt:ydt:Xde&&Xde in Object(e)?Wde(e):Ude(e)}var ydt,vdt,Xde,il,Up=W(()=>{Y1();Hde();Yde();ydt="[object Null]",vdt="[object Undefined]",Xde=Ns?Ns.toStringTag:void 0;il=xdt});function bdt(e){return e!=null&&typeof e=="object"}var Fa,nh=W(()=>{Fa=bdt});function kdt(e){return typeof e=="symbol"||Fa(e)&&il(e)==wdt}var wdt,Ec,X1=W(()=>{Up();nh();wdt="[object Symbol]";Ec=kdt});function Tdt(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r{Qh=Tdt});var Cdt,wn,Ya=W(()=>{Cdt=Array.isArray,wn=Cdt});function Zde(e){if(typeof e=="string")return e;if(wn(e))return Qh(e,Zde)+"";if(Ec(e))return Kde?Kde.call(e):"";var t=e+"";return t=="0"&&1/e==-Sdt?"-0":t}var Sdt,jde,Kde,Qde,Jde=W(()=>{Y1();IT();Ya();X1();Sdt=1/0,jde=Ns?Ns.prototype:void 0,Kde=jde?jde.toString:void 0;Qde=Zde});function Adt(e){for(var t=e.length;t--&&Edt.test(e.charAt(t)););return t}var Edt,e0e,t0e=W(()=>{Edt=/\s/;e0e=Adt});function Rdt(e){return e&&e.slice(0,e0e(e)+1).replace(_dt,"")}var _dt,r0e,n0e=W(()=>{t0e();_dt=/^\s+/;r0e=Rdt});function Ldt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Pi,Ac=W(()=>{Pi=Ldt});function Odt(e){if(typeof e=="number")return e;if(Ec(e))return i0e;if(Pi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Pi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=r0e(e);var r=Mdt.test(e);return r||Ndt.test(e)?Ddt(e.slice(2),r?2:8):Idt.test(e)?i0e:+e}var i0e,Idt,Mdt,Ndt,Ddt,MT,hz=W(()=>{n0e();Ac();X1();i0e=NaN,Idt=/^[-+]0x[0-9a-f]+$/i,Mdt=/^0b[01]+$/i,Ndt=/^0o[0-7]+$/i,Ddt=parseInt;MT=Odt});function Bdt(e){if(!e)return e===0?e:0;if(e=MT(e),e===a0e||e===-a0e){var t=e<0?-1:1;return t*Pdt}return e===e?e:0}var a0e,Pdt,Ox,fz=W(()=>{hz();a0e=1/0,Pdt=17976931348623157e292;Ox=Bdt});function Fdt(e){var t=Ox(e),r=t%1;return t===t?r?t-r:t:0}var s0e,o0e=W(()=>{fz();s0e=Fdt});function $dt(e){return e}var zl,Yp=W(()=>{zl=$dt});function Wdt(e){if(!Pi(e))return!1;var t=il(e);return t==Gdt||t==qdt||t==zdt||t==Vdt}var zdt,Gdt,qdt,Vdt,Jh,NT=W(()=>{Up();Ac();zdt="[object AsyncFunction]",Gdt="[object Function]",qdt="[object GeneratorFunction]",Vdt="[object Proxy]";Jh=Wdt});var Hdt,L7,l0e=W(()=>{mu();Hdt=wa["__core-js_shared__"],L7=Hdt});function Udt(e){return!!c0e&&c0e in e}var c0e,u0e,h0e=W(()=>{l0e();c0e=(function(){var e=/[^.]+$/.exec(L7&&L7.keys&&L7.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();u0e=Udt});function jdt(e){if(e!=null){try{return Xdt.call(e)}catch{}try{return e+""}catch{}}return""}var Ydt,Xdt,Yd,dz=W(()=>{Ydt=Function.prototype,Xdt=Ydt.toString;Yd=jdt});function n0t(e){if(!Pi(e)||u0e(e))return!1;var t=Jh(e)?r0t:Zdt;return t.test(Yd(e))}var Kdt,Zdt,Qdt,Jdt,e0t,t0t,r0t,f0e,d0e=W(()=>{NT();h0e();Ac();dz();Kdt=/[\\^$.*+?()[\]{}|]/g,Zdt=/^\[object .+?Constructor\]$/,Qdt=Function.prototype,Jdt=Object.prototype,e0t=Qdt.toString,t0t=Jdt.hasOwnProperty,r0t=RegExp("^"+e0t.call(t0t).replace(Kdt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");f0e=n0t});function i0t(e,t){return e?.[t]}var p0e,m0e=W(()=>{p0e=i0t});function a0t(e,t){var r=p0e(e,t);return f0e(r)?r:void 0}var Gl,Xp=W(()=>{d0e();m0e();Gl=a0t});var s0t,I7,g0e=W(()=>{Xp();mu();s0t=Gl(wa,"WeakMap"),I7=s0t});var y0e,o0t,v0e,x0e=W(()=>{Ac();y0e=Object.create,o0t=(function(){function e(){}return function(t){if(!Pi(t))return{};if(y0e)return y0e(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),v0e=o0t});function l0t(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var b0e,w0e=W(()=>{b0e=l0t});function c0t(){}var k0e,T0e=W(()=>{k0e=c0t});function u0t(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r{M7=u0t});function p0t(e){var t=0,r=0;return function(){var n=d0t(),i=f0t-(n-r);if(r=n,i>0){if(++t>=h0t)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var h0t,f0t,d0t,C0e,S0e=W(()=>{h0t=800,f0t=16,d0t=Date.now;C0e=p0t});function m0t(e){return function(){return e}}var ql,mz=W(()=>{ql=m0t});var g0t,Px,gz=W(()=>{Xp();g0t=(function(){try{var e=Gl(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Px=g0t});var y0t,E0e,A0e=W(()=>{mz();gz();Yp();y0t=Px?function(e,t){return Px(e,"toString",{configurable:!0,enumerable:!1,value:ql(t),writable:!0})}:zl,E0e=y0t});var v0t,N7,yz=W(()=>{A0e();S0e();v0t=C0e(E0e),N7=v0t});function x0t(e,t){for(var r=-1,n=e==null?0:e.length;++r{D7=x0t});function b0t(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a{O7=b0t});function w0t(e){return e!==e}var _0e,R0e=W(()=>{_0e=w0t});function k0t(e,t,r){for(var n=r-1,i=e.length;++n{L0e=k0t});function T0t(e,t,r){return t===t?L0e(e,t,r):O7(e,_0e,r)}var M0e,N0e=W(()=>{xz();R0e();I0e();M0e=T0t});function C0t(e,t){var r=e==null?0:e.length;return!!r&&M0e(e,t,0)>-1}var D0e,O0e=W(()=>{N0e();D0e=C0t});function A0t(e,t){var r=typeof e;return t=t??S0t,!!t&&(r=="number"||r!="symbol"&&E0t.test(e))&&e>-1&&e%1==0&&e{S0t=9007199254740991,E0t=/^(?:0|[1-9]\d*)$/;jp=A0t});function _0t(e,t,r){t=="__proto__"&&Px?Px(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Kp,OT=W(()=>{gz();Kp=_0t});function R0t(e,t){return e===t||e!==e&&t!==t}var gu,j1=W(()=>{gu=R0t});function M0t(e,t,r){var n=e[t];(!(I0t.call(e,t)&&gu(n,r))||r===void 0&&!(t in e))&&Kp(e,t,r)}var L0t,I0t,Zp,PT=W(()=>{OT();j1();L0t=Object.prototype,I0t=L0t.hasOwnProperty;Zp=M0t});function N0t(e,t,r,n){var i=!r;r||(r={});for(var a=-1,s=t.length;++a{PT();OT();ef=N0t});function D0t(e,t,r){return t=P0e(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=P0e(n.length-t,0),s=Array(a);++i{w0e();P0e=Math.max;P7=D0t});function O0t(e,t){return N7(P7(e,t,zl),e+"")}var Qp,BT=W(()=>{Yp();bz();yz();Qp=O0t});function B0t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=P0t}var P0t,Fx,B7=W(()=>{P0t=9007199254740991;Fx=B0t});function F0t(e){return e!=null&&Fx(e.length)&&!Jh(e)}var Ds,tf=W(()=>{NT();B7();Ds=F0t});function $0t(e,t,r){if(!Pi(r))return!1;var n=typeof t;return(n=="number"?Ds(r)&&jp(t,r.length):n=="string"&&t in r)?gu(r[t],e):!1}var Xd,FT=W(()=>{j1();tf();DT();Ac();Xd=$0t});function z0t(e){return Qp(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,s&&Xd(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++n{BT();FT();B0e=z0t});function q0t(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||G0t;return e===r}var G0t,Jp,$T=W(()=>{G0t=Object.prototype;Jp=q0t});function V0t(e,t){for(var r=-1,n=Array(e);++r{$0e=V0t});function H0t(e){return Fa(e)&&il(e)==W0t}var W0t,wz,G0e=W(()=>{Up();nh();W0t="[object Arguments]";wz=H0t});var q0e,U0t,Y0t,X0t,ih,$x=W(()=>{G0e();nh();q0e=Object.prototype,U0t=q0e.hasOwnProperty,Y0t=q0e.propertyIsEnumerable,X0t=wz((function(){return arguments})())?wz:function(e){return Fa(e)&&U0t.call(e,"callee")&&!Y0t.call(e,"callee")},ih=X0t});function j0t(){return!1}var V0e,W0e=W(()=>{V0e=j0t});var Y0e,H0e,K0t,U0e,Z0t,Q0t,ah,zx=W(()=>{mu();W0e();Y0e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,H0e=Y0e&&typeof module=="object"&&module&&!module.nodeType&&module,K0t=H0e&&H0e.exports===Y0e,U0e=K0t?wa.Buffer:void 0,Z0t=U0e?U0e.isBuffer:void 0,Q0t=Z0t||V0e,ah=Q0t});function Tpt(e){return Fa(e)&&Fx(e.length)&&!!Yi[il(e)]}var J0t,ept,tpt,rpt,npt,ipt,apt,spt,opt,lpt,cpt,upt,hpt,fpt,dpt,ppt,mpt,gpt,ypt,vpt,xpt,bpt,wpt,kpt,Yi,X0e,j0e=W(()=>{Up();B7();nh();J0t="[object Arguments]",ept="[object Array]",tpt="[object Boolean]",rpt="[object Date]",npt="[object Error]",ipt="[object Function]",apt="[object Map]",spt="[object Number]",opt="[object Object]",lpt="[object RegExp]",cpt="[object Set]",upt="[object String]",hpt="[object WeakMap]",fpt="[object ArrayBuffer]",dpt="[object DataView]",ppt="[object Float32Array]",mpt="[object Float64Array]",gpt="[object Int8Array]",ypt="[object Int16Array]",vpt="[object Int32Array]",xpt="[object Uint8Array]",bpt="[object Uint8ClampedArray]",wpt="[object Uint16Array]",kpt="[object Uint32Array]",Yi={};Yi[ppt]=Yi[mpt]=Yi[gpt]=Yi[ypt]=Yi[vpt]=Yi[xpt]=Yi[bpt]=Yi[wpt]=Yi[kpt]=!0;Yi[J0t]=Yi[ept]=Yi[fpt]=Yi[tpt]=Yi[dpt]=Yi[rpt]=Yi[npt]=Yi[ipt]=Yi[apt]=Yi[spt]=Yi[opt]=Yi[lpt]=Yi[cpt]=Yi[upt]=Yi[hpt]=!1;X0e=Tpt});function Cpt(e){return function(t){return e(t)}}var em,zT=W(()=>{em=Cpt});var K0e,GT,Spt,kz,Ept,jd,F7=W(()=>{uz();K0e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,GT=K0e&&typeof module=="object"&&module&&!module.nodeType&&module,Spt=GT&>.exports===K0e,kz=Spt&&R7.process,Ept=(function(){try{var e=GT&>.require&>.require("util").types;return e||kz&&kz.binding&&kz.binding("util")}catch{}})(),jd=Ept});var Z0e,Apt,tm,qT=W(()=>{j0e();zT();F7();Z0e=jd&&jd.isTypedArray,Apt=Z0e?em(Z0e):X0e,tm=Apt});function Lpt(e,t){var r=wn(e),n=!r&&ih(e),i=!r&&!n&&ah(e),a=!r&&!n&&!i&&tm(e),s=r||n||i||a,o=s?$0e(e.length,String):[],l=o.length;for(var u in e)(t||Rpt.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||jp(u,l)))&&o.push(u);return o}var _pt,Rpt,$7,Tz=W(()=>{z0e();$x();Ya();zx();DT();qT();_pt=Object.prototype,Rpt=_pt.hasOwnProperty;$7=Lpt});function Ipt(e,t){return function(r){return e(t(r))}}var z7,Cz=W(()=>{z7=Ipt});var Mpt,Q0e,J0e=W(()=>{Cz();Mpt=z7(Object.keys,Object),Q0e=Mpt});function Opt(e){if(!Jp(e))return Q0e(e);var t=[];for(var r in Object(e))Dpt.call(e,r)&&r!="constructor"&&t.push(r);return t}var Npt,Dpt,Gx,G7=W(()=>{$T();J0e();Npt=Object.prototype,Dpt=Npt.hasOwnProperty;Gx=Opt});function Ppt(e){return Ds(e)?$7(e):Gx(e)}var ka,Kd=W(()=>{Tz();G7();tf();ka=Ppt});function Bpt(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var epe,tpe=W(()=>{epe=Bpt});function zpt(e){if(!Pi(e))return epe(e);var t=Jp(e),r=[];for(var n in e)n=="constructor"&&(t||!$pt.call(e,n))||r.push(n);return r}var Fpt,$pt,rpe,npe=W(()=>{Ac();$T();tpe();Fpt=Object.prototype,$pt=Fpt.hasOwnProperty;rpe=zpt});function Gpt(e){return Ds(e)?$7(e,!0):rpe(e)}var Vl,rm=W(()=>{Tz();npe();tf();Vl=Gpt});function Wpt(e,t){if(wn(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ec(e)?!0:Vpt.test(e)||!qpt.test(e)||t!=null&&e in Object(t)}var qpt,Vpt,qx,q7=W(()=>{Ya();X1();qpt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vpt=/^\w*$/;qx=Wpt});var Hpt,Zd,VT=W(()=>{Xp();Hpt=Gl(Object,"create"),Zd=Hpt});function Upt(){this.__data__=Zd?Zd(null):{},this.size=0}var ipe,ape=W(()=>{VT();ipe=Upt});function Ypt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var spe,ope=W(()=>{spe=Ypt});function Zpt(e){var t=this.__data__;if(Zd){var r=t[e];return r===Xpt?void 0:r}return Kpt.call(t,e)?t[e]:void 0}var Xpt,jpt,Kpt,lpe,cpe=W(()=>{VT();Xpt="__lodash_hash_undefined__",jpt=Object.prototype,Kpt=jpt.hasOwnProperty;lpe=Zpt});function emt(e){var t=this.__data__;return Zd?t[e]!==void 0:Jpt.call(t,e)}var Qpt,Jpt,upe,hpe=W(()=>{VT();Qpt=Object.prototype,Jpt=Qpt.hasOwnProperty;upe=emt});function rmt(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Zd&&t===void 0?tmt:t,this}var tmt,fpe,dpe=W(()=>{VT();tmt="__lodash_hash_undefined__";fpe=rmt});function Vx(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{ape();ope();cpe();hpe();dpe();Vx.prototype.clear=ipe;Vx.prototype.delete=spe;Vx.prototype.get=lpe;Vx.prototype.has=upe;Vx.prototype.set=fpe;Sz=Vx});function nmt(){this.__data__=[],this.size=0}var mpe,gpe=W(()=>{mpe=nmt});function imt(e,t){for(var r=e.length;r--;)if(gu(e[r][0],t))return r;return-1}var nm,WT=W(()=>{j1();nm=imt});function omt(e){var t=this.__data__,r=nm(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():smt.call(t,r,1),--this.size,!0}var amt,smt,ype,vpe=W(()=>{WT();amt=Array.prototype,smt=amt.splice;ype=omt});function lmt(e){var t=this.__data__,r=nm(t,e);return r<0?void 0:t[r][1]}var xpe,bpe=W(()=>{WT();xpe=lmt});function cmt(e){return nm(this.__data__,e)>-1}var wpe,kpe=W(()=>{WT();wpe=cmt});function umt(e,t){var r=this.__data__,n=nm(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Tpe,Cpe=W(()=>{WT();Tpe=umt});function Wx(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{gpe();vpe();bpe();kpe();Cpe();Wx.prototype.clear=mpe;Wx.prototype.delete=ype;Wx.prototype.get=xpe;Wx.prototype.has=wpe;Wx.prototype.set=Tpe;im=Wx});var hmt,am,V7=W(()=>{Xp();mu();hmt=Gl(wa,"Map"),am=hmt});function fmt(){this.size=0,this.__data__={hash:new Sz,map:new(am||im),string:new Sz}}var Spe,Epe=W(()=>{ppe();HT();V7();Spe=fmt});function dmt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Ape,_pe=W(()=>{Ape=dmt});function pmt(e,t){var r=e.__data__;return Ape(t)?r[typeof t=="string"?"string":"hash"]:r.map}var sm,UT=W(()=>{_pe();sm=pmt});function mmt(e){var t=sm(this,e).delete(e);return this.size-=t?1:0,t}var Rpe,Lpe=W(()=>{UT();Rpe=mmt});function gmt(e){return sm(this,e).get(e)}var Ipe,Mpe=W(()=>{UT();Ipe=gmt});function ymt(e){return sm(this,e).has(e)}var Npe,Dpe=W(()=>{UT();Npe=ymt});function vmt(e,t){var r=sm(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Ope,Ppe=W(()=>{UT();Ope=vmt});function Hx(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{Epe();Lpe();Mpe();Dpe();Ppe();Hx.prototype.clear=Spe;Hx.prototype.delete=Rpe;Hx.prototype.get=Ipe;Hx.prototype.has=Npe;Hx.prototype.set=Ope;K1=Hx});function Ez(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(xmt);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var s=e.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(Ez.Cache||K1),r}var xmt,Bpe,Fpe=W(()=>{W7();xmt="Expected a function";Ez.Cache=K1;Bpe=Ez});function wmt(e){var t=Bpe(e,function(n){return r.size===bmt&&r.clear(),n}),r=t.cache;return t}var bmt,$pe,zpe=W(()=>{Fpe();bmt=500;$pe=wmt});var kmt,Tmt,Cmt,Gpe,qpe=W(()=>{zpe();kmt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tmt=/\\(\\)?/g,Cmt=$pe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(kmt,function(r,n,i,a){t.push(i?a.replace(Tmt,"$1"):n||r)}),t}),Gpe=Cmt});function Smt(e){return e==null?"":Qde(e)}var H7,Az=W(()=>{Jde();H7=Smt});function Emt(e,t){return wn(e)?e:qx(e,t)?[e]:Gpe(H7(e))}var om,YT=W(()=>{Ya();q7();qpe();Az();om=Emt});function _mt(e){if(typeof e=="string"||Ec(e))return e;var t=e+"";return t=="0"&&1/e==-Amt?"-0":t}var Amt,rf,Ux=W(()=>{X1();Amt=1/0;rf=_mt});function Rmt(e,t){t=om(t,e);for(var r=0,n=t.length;e!=null&&r{YT();Ux();lm=Rmt});function Lmt(e,t,r){var n=e==null?void 0:lm(e,t);return n===void 0?r:n}var Vpe,Wpe=W(()=>{XT();Vpe=Lmt});function Imt(e,t){for(var r=-1,n=t.length,i=e.length;++r{Yx=Imt});function Mmt(e){return wn(e)||ih(e)||!!(Hpe&&e&&e[Hpe])}var Hpe,Upe,Ype=W(()=>{Y1();$x();Ya();Hpe=Ns?Ns.isConcatSpreadable:void 0;Upe=Mmt});function Xpe(e,t,r,n,i){var a=-1,s=e.length;for(r||(r=Upe),i||(i=[]);++a0&&r(o)?t>1?Xpe(o,t-1,r,n,i):Yx(i,o):n||(i[i.length]=o)}return i}var Xx,Y7=W(()=>{U7();Ype();Xx=Xpe});function Nmt(e){var t=e==null?0:e.length;return t?Xx(e,1):[]}var yu,_z=W(()=>{Y7();yu=Nmt});function Dmt(e){return N7(P7(e,void 0,yu),e+"")}var jpe,Kpe=W(()=>{_z();bz();yz();jpe=Dmt});var Omt,jx,X7=W(()=>{Cz();Omt=z7(Object.getPrototypeOf,Object),jx=Omt});function Gmt(e){if(!Fa(e)||il(e)!=Pmt)return!1;var t=jx(e);if(t===null)return!0;var r=$mt.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Zpe.call(r)==zmt}var Pmt,Bmt,Fmt,Zpe,$mt,zmt,Qpe,Jpe=W(()=>{Up();X7();nh();Pmt="[object Object]",Bmt=Function.prototype,Fmt=Object.prototype,Zpe=Bmt.toString,$mt=Fmt.hasOwnProperty,zmt=Zpe.call(Object);Qpe=Gmt});function Kmt(e){return jmt.test(e)}var qmt,Vmt,Wmt,Hmt,Umt,Ymt,Xmt,jmt,eme,tme=W(()=>{qmt="\\ud800-\\udfff",Vmt="\\u0300-\\u036f",Wmt="\\ufe20-\\ufe2f",Hmt="\\u20d0-\\u20ff",Umt=Vmt+Wmt+Hmt,Ymt="\\ufe0e\\ufe0f",Xmt="\\u200d",jmt=RegExp("["+Xmt+qmt+Umt+Ymt+"]");eme=Kmt});function Zmt(e,t,r,n){var i=-1,a=e==null?0:e.length;for(n&&a&&(r=e[++i]);++i{rme=Zmt});function Qmt(){this.__data__=new im,this.size=0}var ime,ame=W(()=>{HT();ime=Qmt});function Jmt(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var sme,ome=W(()=>{sme=Jmt});function egt(e){return this.__data__.get(e)}var lme,cme=W(()=>{lme=egt});function tgt(e){return this.__data__.has(e)}var ume,hme=W(()=>{ume=tgt});function ngt(e,t){var r=this.__data__;if(r instanceof im){var n=r.__data__;if(!am||n.length{HT();V7();W7();rgt=200;fme=ngt});function Kx(e){var t=this.__data__=new im(e);this.size=t.size}var nf,jT=W(()=>{HT();ame();ome();cme();hme();dme();Kx.prototype.clear=ime;Kx.prototype.delete=sme;Kx.prototype.get=lme;Kx.prototype.has=ume;Kx.prototype.set=fme;nf=Kx});function igt(e,t){return e&&ef(t,ka(t),e)}var pme,mme=W(()=>{Bx();Kd();pme=igt});function agt(e,t){return e&&ef(t,Vl(t),e)}var gme,yme=W(()=>{Bx();rm();gme=agt});function ogt(e,t){if(t)return e.slice();var r=e.length,n=bme?bme(r):new e.constructor(r);return e.copy(n),n}var wme,vme,sgt,xme,bme,j7,Rz=W(()=>{mu();wme=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vme=wme&&typeof module=="object"&&module&&!module.nodeType&&module,sgt=vme&&vme.exports===wme,xme=sgt?wa.Buffer:void 0,bme=xme?xme.allocUnsafe:void 0;j7=ogt});function lgt(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r{K7=lgt});function cgt(){return[]}var Z7,Iz=W(()=>{Z7=cgt});var ugt,hgt,kme,fgt,Zx,Q7=W(()=>{Lz();Iz();ugt=Object.prototype,hgt=ugt.propertyIsEnumerable,kme=Object.getOwnPropertySymbols,fgt=kme?function(e){return e==null?[]:(e=Object(e),K7(kme(e),function(t){return hgt.call(e,t)}))}:Z7,Zx=fgt});function dgt(e,t){return ef(e,Zx(e),t)}var Tme,Cme=W(()=>{Bx();Q7();Tme=dgt});var pgt,mgt,J7,Mz=W(()=>{U7();X7();Q7();Iz();pgt=Object.getOwnPropertySymbols,mgt=pgt?function(e){for(var t=[];e;)Yx(t,Zx(e)),e=jx(e);return t}:Z7,J7=mgt});function ggt(e,t){return ef(e,J7(e),t)}var Sme,Eme=W(()=>{Bx();Mz();Sme=ggt});function ygt(e,t,r){var n=t(e);return wn(e)?n:Yx(n,r(e))}var e8,Nz=W(()=>{U7();Ya();e8=ygt});function vgt(e){return e8(e,ka,Zx)}var KT,Dz=W(()=>{Nz();Q7();Kd();KT=vgt});function xgt(e){return e8(e,Vl,J7)}var Ame,_me=W(()=>{Nz();Mz();rm();Ame=xgt});var bgt,t8,Rme=W(()=>{Xp();mu();bgt=Gl(wa,"DataView"),t8=bgt});var wgt,r8,Lme=W(()=>{Xp();mu();wgt=Gl(wa,"Promise"),r8=wgt});var kgt,cm,Oz=W(()=>{Xp();mu();kgt=Gl(wa,"Set"),cm=kgt});var Ime,Tgt,Mme,Nme,Dme,Ome,Cgt,Sgt,Egt,Agt,_gt,Z1,_c,Q1=W(()=>{Rme();V7();Lme();Oz();g0e();Up();dz();Ime="[object Map]",Tgt="[object Object]",Mme="[object Promise]",Nme="[object Set]",Dme="[object WeakMap]",Ome="[object DataView]",Cgt=Yd(t8),Sgt=Yd(am),Egt=Yd(r8),Agt=Yd(cm),_gt=Yd(I7),Z1=il;(t8&&Z1(new t8(new ArrayBuffer(1)))!=Ome||am&&Z1(new am)!=Ime||r8&&Z1(r8.resolve())!=Mme||cm&&Z1(new cm)!=Nme||I7&&Z1(new I7)!=Dme)&&(Z1=function(e){var t=il(e),r=t==Tgt?e.constructor:void 0,n=r?Yd(r):"";if(n)switch(n){case Cgt:return Ome;case Sgt:return Ime;case Egt:return Mme;case Agt:return Nme;case _gt:return Dme}return t});_c=Z1});function Igt(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&Lgt.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Rgt,Lgt,Pme,Bme=W(()=>{Rgt=Object.prototype,Lgt=Rgt.hasOwnProperty;Pme=Igt});var Mgt,Qx,Pz=W(()=>{mu();Mgt=wa.Uint8Array,Qx=Mgt});function Ngt(e){var t=new e.constructor(e.byteLength);return new Qx(t).set(new Qx(e)),t}var Jx,n8=W(()=>{Pz();Jx=Ngt});function Dgt(e,t){var r=t?Jx(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var Fme,$me=W(()=>{n8();Fme=Dgt});function Pgt(e){var t=new e.constructor(e.source,Ogt.exec(e));return t.lastIndex=e.lastIndex,t}var Ogt,zme,Gme=W(()=>{Ogt=/\w*$/;zme=Pgt});function Bgt(e){return Vme?Object(Vme.call(e)):{}}var qme,Vme,Wme,Hme=W(()=>{Y1();qme=Ns?Ns.prototype:void 0,Vme=qme?qme.valueOf:void 0;Wme=Bgt});function Fgt(e,t){var r=t?Jx(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var i8,Bz=W(()=>{n8();i8=Fgt});function i1t(e,t,r){var n=e.constructor;switch(t){case Ygt:return Jx(e);case $gt:case zgt:return new n(+e);case Xgt:return Fme(e,r);case jgt:case Kgt:case Zgt:case Qgt:case Jgt:case e1t:case t1t:case r1t:case n1t:return i8(e,r);case Ggt:return new n;case qgt:case Hgt:return new n(e);case Vgt:return zme(e);case Wgt:return new n;case Ugt:return Wme(e)}}var $gt,zgt,Ggt,qgt,Vgt,Wgt,Hgt,Ugt,Ygt,Xgt,jgt,Kgt,Zgt,Qgt,Jgt,e1t,t1t,r1t,n1t,Ume,Yme=W(()=>{n8();$me();Gme();Hme();Bz();$gt="[object Boolean]",zgt="[object Date]",Ggt="[object Map]",qgt="[object Number]",Vgt="[object RegExp]",Wgt="[object Set]",Hgt="[object String]",Ugt="[object Symbol]",Ygt="[object ArrayBuffer]",Xgt="[object DataView]",jgt="[object Float32Array]",Kgt="[object Float64Array]",Zgt="[object Int8Array]",Qgt="[object Int16Array]",Jgt="[object Int32Array]",e1t="[object Uint8Array]",t1t="[object Uint8ClampedArray]",r1t="[object Uint16Array]",n1t="[object Uint32Array]";Ume=i1t});function a1t(e){return typeof e.constructor=="function"&&!Jp(e)?v0e(jx(e)):{}}var a8,Fz=W(()=>{x0e();X7();$T();a8=a1t});function o1t(e){return Fa(e)&&_c(e)==s1t}var s1t,Xme,jme=W(()=>{Q1();nh();s1t="[object Map]";Xme=o1t});var Kme,l1t,Zme,Qme=W(()=>{jme();zT();F7();Kme=jd&&jd.isMap,l1t=Kme?em(Kme):Xme,Zme=l1t});function u1t(e){return Fa(e)&&_c(e)==c1t}var c1t,Jme,ege=W(()=>{Q1();nh();c1t="[object Set]";Jme=u1t});var tge,h1t,rge,nge=W(()=>{ege();zT();F7();tge=jd&&jd.isSet,h1t=tge?em(tge):Jme,rge=h1t});function s8(e,t,r,n,i,a){var s,o=t&f1t,l=t&d1t,u=t&p1t;if(r&&(s=i?r(e,n,i,a):r(e)),s!==void 0)return s;if(!Pi(e))return e;var h=wn(e);if(h){if(s=Pme(e),!o)return M7(e,s)}else{var f=_c(e),d=f==age||f==x1t;if(ah(e))return j7(e,o);if(f==sge||f==ige||d&&!i){if(s=l||d?{}:a8(e),!o)return l?Sme(e,gme(s,e)):Tme(e,pme(s,e))}else{if(!Bi[f])return i?e:{};s=Ume(e,f,o)}}a||(a=new nf);var p=a.get(e);if(p)return p;a.set(e,s),rge(e)?e.forEach(function(y){s.add(s8(y,t,r,y,e,a))}):Zme(e)&&e.forEach(function(y,v){s.set(v,s8(y,t,r,v,e,a))});var m=u?l?Ame:KT:l?Vl:ka,g=h?void 0:m(e);return D7(g||e,function(y,v){g&&(v=y,y=e[v]),Zp(s,v,s8(y,t,r,v,e,a))}),s}var f1t,d1t,p1t,ige,m1t,g1t,y1t,v1t,age,x1t,b1t,w1t,sge,k1t,T1t,C1t,S1t,E1t,A1t,_1t,R1t,L1t,I1t,M1t,N1t,D1t,O1t,P1t,B1t,Bi,o8,$z=W(()=>{jT();vz();PT();mme();yme();Rz();pz();Cme();Eme();Dz();_me();Q1();Bme();Yme();Fz();Ya();zx();Qme();Ac();nge();Kd();rm();f1t=1,d1t=2,p1t=4,ige="[object Arguments]",m1t="[object Array]",g1t="[object Boolean]",y1t="[object Date]",v1t="[object Error]",age="[object Function]",x1t="[object GeneratorFunction]",b1t="[object Map]",w1t="[object Number]",sge="[object Object]",k1t="[object RegExp]",T1t="[object Set]",C1t="[object String]",S1t="[object Symbol]",E1t="[object WeakMap]",A1t="[object ArrayBuffer]",_1t="[object DataView]",R1t="[object Float32Array]",L1t="[object Float64Array]",I1t="[object Int8Array]",M1t="[object Int16Array]",N1t="[object Int32Array]",D1t="[object Uint8Array]",O1t="[object Uint8ClampedArray]",P1t="[object Uint16Array]",B1t="[object Uint32Array]",Bi={};Bi[ige]=Bi[m1t]=Bi[A1t]=Bi[_1t]=Bi[g1t]=Bi[y1t]=Bi[R1t]=Bi[L1t]=Bi[I1t]=Bi[M1t]=Bi[N1t]=Bi[b1t]=Bi[w1t]=Bi[sge]=Bi[k1t]=Bi[T1t]=Bi[C1t]=Bi[S1t]=Bi[D1t]=Bi[O1t]=Bi[P1t]=Bi[B1t]=!0;Bi[v1t]=Bi[age]=Bi[E1t]=!1;o8=s8});function $1t(e){return o8(e,F1t)}var F1t,zz,oge=W(()=>{$z();F1t=4;zz=$1t});function q1t(e){return o8(e,z1t|G1t)}var z1t,G1t,Gz,lge=W(()=>{$z();z1t=1,G1t=4;Gz=q1t});function W1t(e){return this.__data__.set(e,V1t),this}var V1t,cge,uge=W(()=>{V1t="__lodash_hash_undefined__";cge=W1t});function H1t(e){return this.__data__.has(e)}var hge,fge=W(()=>{hge=H1t});function l8(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new K1;++t{W7();uge();fge();l8.prototype.add=l8.prototype.push=cge;l8.prototype.has=hge;c8=l8});function U1t(e,t){for(var r=-1,n=e==null?0:e.length;++r{dge=U1t});function Y1t(e,t){return e.has(t)}var u8,Vz=W(()=>{u8=Y1t});function K1t(e,t,r,n,i,a){var s=r&X1t,o=e.length,l=t.length;if(o!=l&&!(s&&l>o))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,d=!0,p=r&j1t?new c8:void 0;for(a.set(e,t),a.set(t,e);++f{qz();pge();Vz();X1t=1,j1t=2;h8=K1t});function Z1t(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var mge,gge=W(()=>{mge=Z1t});function Q1t(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var eb,f8=W(()=>{eb=Q1t});function fyt(e,t,r,n,i,a,s){switch(r){case hyt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case uyt:return!(e.byteLength!=t.byteLength||!a(new Qx(e),new Qx(t)));case tyt:case ryt:case ayt:return gu(+e,+t);case nyt:return e.name==t.name&&e.message==t.message;case syt:case lyt:return e==t+"";case iyt:var o=mge;case oyt:var l=n&J1t;if(o||(o=eb),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;n|=eyt,s.set(e,t);var h=h8(o(e),o(t),n,i,a,s);return s.delete(e),h;case cyt:if(Hz)return Hz.call(e)==Hz.call(t)}return!1}var J1t,eyt,tyt,ryt,nyt,iyt,ayt,syt,oyt,lyt,cyt,uyt,hyt,yge,Hz,vge,xge=W(()=>{Y1();Pz();j1();Wz();gge();f8();J1t=1,eyt=2,tyt="[object Boolean]",ryt="[object Date]",nyt="[object Error]",iyt="[object Map]",ayt="[object Number]",syt="[object RegExp]",oyt="[object Set]",lyt="[object String]",cyt="[object Symbol]",uyt="[object ArrayBuffer]",hyt="[object DataView]",yge=Ns?Ns.prototype:void 0,Hz=yge?yge.valueOf:void 0;vge=fyt});function gyt(e,t,r,n,i,a){var s=r&dyt,o=KT(e),l=o.length,u=KT(t),h=u.length;if(l!=h&&!s)return!1;for(var f=l;f--;){var d=o[f];if(!(s?d in t:myt.call(t,d)))return!1}var p=a.get(e),m=a.get(t);if(p&&m)return p==t&&m==e;var g=!0;a.set(e,t),a.set(t,e);for(var y=s;++f{Dz();dyt=1,pyt=Object.prototype,myt=pyt.hasOwnProperty;bge=gyt});function xyt(e,t,r,n,i,a){var s=wn(e),o=wn(t),l=s?Tge:_c(e),u=o?Tge:_c(t);l=l==kge?d8:l,u=u==kge?d8:u;var h=l==d8,f=u==d8,d=l==u;if(d&&ah(e)){if(!ah(t))return!1;s=!0,h=!1}if(d&&!h)return a||(a=new nf),s||tm(e)?h8(e,t,r,n,i,a):vge(e,t,l,r,n,i,a);if(!(r&yyt)){var p=h&&Cge.call(e,"__wrapped__"),m=f&&Cge.call(t,"__wrapped__");if(p||m){var g=p?e.value():e,y=m?t.value():t;return a||(a=new nf),i(g,y,r,n,a)}}return d?(a||(a=new nf),bge(e,t,r,n,i,a)):!1}var yyt,kge,Tge,d8,vyt,Cge,Sge,Ege=W(()=>{jT();Wz();xge();wge();Q1();Ya();zx();qT();yyt=1,kge="[object Arguments]",Tge="[object Array]",d8="[object Object]",vyt=Object.prototype,Cge=vyt.hasOwnProperty;Sge=xyt});function Age(e,t,r,n,i){return e===t?!0:e==null||t==null||!Fa(e)&&!Fa(t)?e!==e&&t!==t:Sge(e,t,r,n,Age,i)}var p8,Uz=W(()=>{Ege();nh();p8=Age});function kyt(e,t,r,n){var i=r.length,a=i,s=!n;if(e==null)return!a;for(e=Object(e);i--;){var o=r[i];if(s&&o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++i{jT();Uz();byt=1,wyt=2;_ge=kyt});function Tyt(e){return e===e&&!Pi(e)}var m8,Yz=W(()=>{Ac();m8=Tyt});function Cyt(e){for(var t=ka(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,m8(i)]}return t}var Lge,Ige=W(()=>{Yz();Kd();Lge=Cyt});function Syt(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var g8,Xz=W(()=>{g8=Syt});function Eyt(e){var t=Lge(e);return t.length==1&&t[0][2]?g8(t[0][0],t[0][1]):function(r){return r===e||_ge(r,e,t)}}var Mge,Nge=W(()=>{Rge();Ige();Xz();Mge=Eyt});function Ayt(e,t){return e!=null&&t in Object(e)}var Dge,Oge=W(()=>{Dge=Ayt});function _yt(e,t,r){t=om(t,e);for(var n=-1,i=t.length,a=!1;++n{YT();$x();Ya();DT();B7();Ux();y8=_yt});function Ryt(e,t){return e!=null&&y8(e,t,Dge)}var v8,Kz=W(()=>{Oge();jz();v8=Ryt});function Myt(e,t){return qx(e)&&m8(t)?g8(rf(e),t):function(r){var n=Vpe(r,e);return n===void 0&&n===t?v8(r,e):p8(t,n,Lyt|Iyt)}}var Lyt,Iyt,Pge,Bge=W(()=>{Uz();Wpe();Kz();q7();Yz();Xz();Ux();Lyt=1,Iyt=2;Pge=Myt});function Nyt(e){return function(t){return t?.[e]}}var x8,Zz=W(()=>{x8=Nyt});function Dyt(e){return function(t){return lm(t,e)}}var Fge,$ge=W(()=>{XT();Fge=Dyt});function Oyt(e){return qx(e)?x8(rf(e)):Fge(e)}var zge,Gge=W(()=>{Zz();$ge();q7();Ux();zge=Oyt});function Pyt(e){return typeof e=="function"?e:e==null?zl:typeof e=="object"?wn(e)?Pge(e[0],e[1]):Mge(e):zge(e)}var Po,Qd=W(()=>{Nge();Bge();Yp();Ya();Gge();Po=Pyt});function Byt(e){return function(t,r,n){for(var i=-1,a=Object(t),s=n(t),o=s.length;o--;){var l=s[e?o:++i];if(r(a[l],l,a)===!1)break}return t}}var qge,Vge=W(()=>{qge=Byt});var Fyt,tb,b8=W(()=>{Vge();Fyt=qge(),tb=Fyt});function $yt(e,t){return e&&tb(e,t,ka)}var rb,w8=W(()=>{b8();Kd();rb=$yt});function zyt(e,t){return function(r,n){if(r==null)return r;if(!Ds(r))return e(r,n);for(var i=r.length,a=t?i:-1,s=Object(r);(t?a--:++a{tf();Wge=zyt});var Gyt,um,ZT=W(()=>{w8();Hge();Gyt=Wge(rb),um=Gyt});var qyt,hm,Qz=W(()=>{mu();qyt=function(){return wa.Date.now()},hm=qyt});function Uyt(e,t,r){var n,i,a,s,o,l,u=0,h=!1,f=!1,d=!0;if(typeof e!="function")throw new TypeError(Vyt);t=MT(t)||0,Pi(r)&&(h=!!r.leading,f="maxWait"in r,a=f?Wyt(MT(r.maxWait)||0,t):a,d="trailing"in r?!!r.trailing:d);function p(k){var S=n,E=i;return n=i=void 0,u=k,s=e.apply(E,S),s}function m(k){return u=k,o=setTimeout(v,t),h?p(k):s}function g(k){var S=k-l,E=k-u,I=t-S;return f?Hyt(I,a-E):I}function y(k){var S=k-l,E=k-u;return l===void 0||S>=t||S<0||f&&E>=a}function v(){var k=hm();if(y(k))return x(k);o=setTimeout(v,g(k))}function x(k){return o=void 0,d&&n?p(k):(n=i=void 0,s)}function w(){o!==void 0&&clearTimeout(o),u=0,n=l=i=o=void 0}function C(){return o===void 0?s:x(hm())}function T(){var k=hm(),S=y(k);if(n=arguments,i=this,l=k,S){if(o===void 0)return m(l);if(f)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return T.cancel=w,T.flush=C,T}var Vyt,Wyt,Hyt,Jz,Uge=W(()=>{Ac();Qz();hz();Vyt="Expected a function",Wyt=Math.max,Hyt=Math.min;Jz=Uyt});var Yge,Yyt,Xyt,eG,Xge=W(()=>{BT();j1();FT();rm();Yge=Object.prototype,Yyt=Yge.hasOwnProperty,Xyt=Qp(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&Xd(t[0],t[1],i)&&(n=1);++r{OT();j1();QT=jyt});function Kyt(e){return Fa(e)&&Ds(e)}var k8,rG=W(()=>{tf();nh();k8=Kyt});function Zyt(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var JT,nG=W(()=>{JT=Zyt});function Qyt(e){return ef(e,Vl(e))}var jge,Kge=W(()=>{Bx();rm();jge=Qyt});function Jyt(e,t,r,n,i,a,s){var o=JT(e,r),l=JT(t,r),u=s.get(l);if(u){QT(e,r,u);return}var h=a?a(o,l,r+"",e,t,s):void 0,f=h===void 0;if(f){var d=wn(l),p=!d&&ah(l),m=!d&&!p&&tm(l);h=l,d||p||m?wn(o)?h=o:k8(o)?h=M7(o):p?(f=!1,h=j7(l,!0)):m?(f=!1,h=i8(l,!0)):h=[]:Qpe(l)||ih(l)?(h=o,ih(o)?h=jge(o):(!Pi(o)||Jh(o))&&(h=a8(l))):f=!1}f&&(s.set(l,h),i(h,l,n,a,s),s.delete(l)),QT(e,r,h)}var Zge,Qge=W(()=>{tG();Rz();Bz();pz();Fz();$x();Ya();rG();zx();NT();Ac();Jpe();qT();nG();Kge();Zge=Jyt});function Jge(e,t,r,n,i){e!==t&&tb(t,function(a,s){if(i||(i=new nf),Pi(a))Zge(e,t,s,r,Jge,n,i);else{var o=n?n(JT(e,s),a,s+"",e,t,i):void 0;o===void 0&&(o=a),QT(e,s,o)}},Vl)}var e1e,t1e=W(()=>{jT();tG();b8();Qge();Ac();rm();nG();e1e=Jge});function evt(e,t,r){for(var n=-1,i=e==null?0:e.length;++n{r1e=evt});function tvt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var fm,i1e=W(()=>{fm=tvt});function rvt(e){return typeof e=="function"?e:zl}var nb,T8=W(()=>{Yp();nb=rvt});function nvt(e,t){var r=wn(e)?D7:um;return r(e,nb(t))}var ft,iG=W(()=>{vz();ZT();T8();Ya();ft=nvt});var a1e=W(()=>{iG()});function ivt(e,t){var r=[];return um(e,function(n,i,a){t(n,i,a)&&r.push(n)}),r}var s1e,o1e=W(()=>{ZT();s1e=ivt});function avt(e,t){var r=wn(e)?K7:s1e;return r(e,Po(t,3))}var al,l1e=W(()=>{Lz();o1e();Qd();Ya();al=avt});function svt(e){return function(t,r,n){var i=Object(t);if(!Ds(t)){var a=Po(r,3);t=ka(t),r=function(o){return a(i[o],o,i)}}var s=e(t,r,n);return s>-1?i[a?t[s]:s]:void 0}}var c1e,u1e=W(()=>{Qd();tf();Kd();c1e=svt});function lvt(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var i=r==null?0:s0e(r);return i<0&&(i=ovt(n+i,0)),O7(e,Po(t,3),i)}var ovt,h1e,f1e=W(()=>{xz();Qd();o0e();ovt=Math.max;h1e=lvt});var cvt,ib,d1e=W(()=>{u1e();f1e();cvt=c1e(h1e),ib=cvt});function uvt(e,t){var r=-1,n=Ds(e)?Array(e.length):[];return um(e,function(i,a,s){n[++r]=t(i,a,s)}),n}var C8,aG=W(()=>{ZT();tf();C8=uvt});function hvt(e,t){var r=wn(e)?Qh:C8;return r(e,Po(t,3))}var Kn,p1e=W(()=>{IT();Qd();aG();Ya();Kn=hvt});function fvt(e,t){return e==null?e:tb(e,nb(t),Vl)}var sG,m1e=W(()=>{b8();T8();rm();sG=fvt});function dvt(e,t){return e&&rb(e,nb(t))}var oG,g1e=W(()=>{w8();T8();oG=dvt});function pvt(e,t){return e>t}var y1e,v1e=W(()=>{y1e=pvt});function yvt(e,t){return e!=null&&gvt.call(e,t)}var mvt,gvt,x1e,b1e=W(()=>{mvt=Object.prototype,gvt=mvt.hasOwnProperty;x1e=yvt});function vvt(e,t){return e!=null&&y8(e,t,x1e)}var e5,w1e=W(()=>{b1e();jz();e5=vvt});function bvt(e){return typeof e=="string"||!wn(e)&&Fa(e)&&il(e)==xvt}var xvt,k1e,T1e=W(()=>{Up();Ya();nh();xvt="[object String]";k1e=bvt});function wvt(e,t){return Qh(t,function(r){return e[r]})}var C1e,S1e=W(()=>{IT();C1e=wvt});function kvt(e){return e==null?[]:C1e(e,ka(e))}var Rc,E1e=W(()=>{S1e();Kd();Rc=kvt});function Avt(e){if(e==null)return!0;if(Ds(e)&&(wn(e)||typeof e=="string"||typeof e.splice=="function"||ah(e)||tm(e)||ih(e)))return!e.length;var t=_c(e);if(t==Tvt||t==Cvt)return!e.size;if(Jp(e))return!Gx(e).length;for(var r in e)if(Evt.call(e,r))return!1;return!0}var Tvt,Cvt,Svt,Evt,S8,A1e=W(()=>{G7();Q1();$x();Ya();tf();zx();$T();qT();Tvt="[object Map]",Cvt="[object Set]",Svt=Object.prototype,Evt=Svt.hasOwnProperty;S8=Avt});function _vt(e){return e===void 0}var Si,_1e=W(()=>{Si=_vt});function Rvt(e,t){return e{E8=Rvt});function Lvt(e,t){var r={};return t=Po(t,3),rb(e,function(n,i,a){Kp(r,i,t(n,i,a))}),r}var J1,R1e=W(()=>{OT();w8();Qd();J1=Lvt});function Ivt(e,t,r){for(var n=-1,i=e.length;++n{X1();ab=Ivt});function Mvt(e){return e&&e.length?ab(e,zl,y1e):void 0}var Wl,L1e=W(()=>{A8();v1e();Yp();Wl=Mvt});var Nvt,sb,I1e=W(()=>{t1e();F0e();Nvt=B0e(function(e,t,r){e1e(e,t,r)}),sb=Nvt});function Dvt(e){return e&&e.length?ab(e,zl,E8):void 0}var Jd,M1e=W(()=>{A8();lG();Yp();Jd=Dvt});function Ovt(e,t){return e&&e.length?ab(e,Po(t,2),E8):void 0}var ey,N1e=W(()=>{A8();Qd();lG();ey=Ovt});function Pvt(e,t,r,n){if(!Pi(e))return e;t=om(t,e);for(var i=-1,a=t.length,s=a-1,o=e;o!=null&&++i{PT();YT();DT();Ac();Ux();D1e=Pvt});function Bvt(e,t,r){for(var n=-1,i=t.length,a={};++n{XT();O1e();YT();P1e=Bvt});function Fvt(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var F1e,$1e=W(()=>{F1e=Fvt});function $vt(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,a=Ec(e),s=t!==void 0,o=t===null,l=t===t,u=Ec(t);if(!o&&!u&&!a&&e>t||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&e{X1();z1e=$vt});function zvt(e,t,r){for(var n=-1,i=e.criteria,a=t.criteria,s=i.length,o=r.length;++n=o)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return e.index-t.index}var q1e,V1e=W(()=>{G1e();q1e=zvt});function Gvt(e,t,r){t.length?t=Qh(t,function(a){return wn(a)?function(s){return lm(s,a.length===1?a[0]:a)}:a}):t=[zl];var n=-1;t=Qh(t,em(Po));var i=C8(e,function(a,s,o){var l=Qh(t,function(u){return u(a)});return{criteria:l,index:++n,value:a}});return F1e(i,function(a,s){return q1e(a,s,r)})}var W1e,H1e=W(()=>{IT();XT();Qd();aG();$1e();zT();V1e();Yp();Ya();W1e=Gvt});var qvt,U1e,Y1e=W(()=>{Zz();qvt=x8("length"),U1e=qvt});function e2t(e){for(var t=X1e.lastIndex=0;X1e.test(e);)++t;return t}var j1e,Vvt,Wvt,Hvt,Uvt,Yvt,Xvt,cG,uG,jvt,K1e,Z1e,Q1e,Kvt,J1e,eye,Zvt,Qvt,Jvt,X1e,tye,rye=W(()=>{j1e="\\ud800-\\udfff",Vvt="\\u0300-\\u036f",Wvt="\\ufe20-\\ufe2f",Hvt="\\u20d0-\\u20ff",Uvt=Vvt+Wvt+Hvt,Yvt="\\ufe0e\\ufe0f",Xvt="["+j1e+"]",cG="["+Uvt+"]",uG="\\ud83c[\\udffb-\\udfff]",jvt="(?:"+cG+"|"+uG+")",K1e="[^"+j1e+"]",Z1e="(?:\\ud83c[\\udde6-\\uddff]){2}",Q1e="[\\ud800-\\udbff][\\udc00-\\udfff]",Kvt="\\u200d",J1e=jvt+"?",eye="["+Yvt+"]?",Zvt="(?:"+Kvt+"(?:"+[K1e,Z1e,Q1e].join("|")+")"+eye+J1e+")*",Qvt=eye+J1e+Zvt,Jvt="(?:"+[K1e+cG+"?",cG,Z1e,Q1e,Xvt].join("|")+")",X1e=RegExp(uG+"(?="+uG+")|"+Jvt+Qvt,"g");tye=e2t});function t2t(e){return eme(e)?tye(e):U1e(e)}var nye,iye=W(()=>{Y1e();tme();rye();nye=t2t});function r2t(e,t){return P1e(e,t,function(r,n){return v8(e,n)})}var aye,sye=W(()=>{B1e();Kz();aye=r2t});var n2t,ty,oye=W(()=>{sye();Kpe();n2t=jpe(function(e,t){return e==null?{}:aye(e,t)}),ty=n2t});function s2t(e,t,r,n){for(var i=-1,a=a2t(i2t((t-e)/(r||1)),0),s=Array(a);a--;)s[n?a:++i]=e,e+=r;return s}var i2t,a2t,lye,cye=W(()=>{i2t=Math.ceil,a2t=Math.max;lye=s2t});function o2t(e){return function(t,r,n){return n&&typeof n!="number"&&Xd(t,r,n)&&(r=n=void 0),t=Ox(t),r===void 0?(r=t,t=0):r=Ox(r),n=n===void 0?t{cye();FT();fz();uye=o2t});var l2t,vu,fye=W(()=>{hye();l2t=uye(),vu=l2t});function c2t(e,t,r,n,i){return i(e,function(a,s,o){r=n?(n=!1,a):t(r,a,s,o)}),r}var dye,pye=W(()=>{dye=c2t});function u2t(e,t,r){var n=wn(e)?rme:dye,i=arguments.length<3;return n(e,Po(t,4),r,i,um)}var af,mye=W(()=>{nme();ZT();Qd();pye();Ya();af=u2t});function d2t(e){if(e==null)return 0;if(Ds(e))return k1e(e)?nye(e):e.length;var t=_c(e);return t==h2t||t==f2t?e.size:Gx(e).length}var h2t,f2t,hG,gye=W(()=>{G7();Q1();tf();T1e();iye();h2t="[object Map]",f2t="[object Set]";hG=d2t});var p2t,sf,yye=W(()=>{Y7();H1e();BT();FT();p2t=Qp(function(e,t){if(e==null)return[];var r=t.length;return r>1&&Xd(e,t[0],t[1])?t=[]:r>2&&Xd(t[0],t[1],t[2])&&(t=[t[0]]),W1e(e,Xx(t,1),[])}),sf=p2t});var m2t,g2t,vye,xye=W(()=>{Oz();T0e();f8();m2t=1/0,g2t=cm&&1/eb(new cm([,-0]))[1]==m2t?function(e){return new cm(e)}:k0e,vye=g2t});function v2t(e,t,r){var n=-1,i=D0e,a=e.length,s=!0,o=[],l=o;if(r)s=!1,i=r1e;else if(a>=y2t){var u=t?null:vye(e);if(u)return eb(u);s=!1,i=u8,l=new c8}else l=t?[]:o;e:for(;++n{qz();O0e();n1e();Vz();xye();f8();y2t=200;bye=v2t});var x2t,fG,kye=W(()=>{Y7();BT();wye();rG();x2t=Qp(function(e){return bye(Xx(e,1,k8,!0))}),fG=x2t});function w2t(e){var t=++b2t;return H7(e)+t}var b2t,ry,Tye=W(()=>{Az();b2t=0;ry=w2t});function k2t(e,t,r){for(var n=-1,i=e.length,a=t.length,s={};++n{Cye=k2t});function T2t(e,t){return Cye(e||[],t||[],Zp)}var _8,Eye=W(()=>{PT();Sye();_8=T2t});var si=W(()=>{oge();lge();mz();Uge();Xge();a1e();l1e();d1e();_z();iG();m1e();g1e();w1e();Ya();A1e();NT();_1e();Kd();i1e();p1e();R1e();L1e();I1e();M1e();N1e();Qz();oye();fye();mye();gye();yye();kye();Tye();E1e();Eye();});var m2e,b,wm,hr=W(()=>{m2e=Object.defineProperty,b=(e,t)=>m2e(e,"name",{value:t,configurable:!0}),wm=(e,t)=>{for(var r in t)m2e(e,r,{get:t[r],enumerable:!0})}});var hA=Qo((wq,kq)=>{(function(e,t){typeof wq=="object"&&typeof kq<"u"?kq.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(wq,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",a="minute",s="hour",o="day",l="week",u="month",h="quarter",f="year",d="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(R){var A=["th","st","nd","rd"],N=R%100;return"["+R+(A[(N-20)%10]||A[N]||A[0])+"]"}},v=function(R,A,N){var M=String(R);return!M||M.length>=A?R:""+Array(A+1-M.length).join(N)+R},x={s:v,z:function(R){var A=-R.utcOffset(),N=Math.abs(A),M=Math.floor(N/60),D=N%60;return(A<=0?"+":"-")+v(M,2,"0")+":"+v(D,2,"0")},m:function R(A,N){if(A.date()1)return R(P[0])}else{var $=A.name;C[$]=A,D=$}return!M&&D&&(w=D),D||!M&&w},E=function(R,A){if(k(R))return R.clone();var N=typeof A=="object"?A:{};return N.date=R,N.args=arguments,new L(N)},I=x;I.l=S,I.i=k,I.w=function(R,A){return E(R,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var L=(function(){function R(N){this.$L=S(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[T]=!0}var A=R.prototype;return A.parse=function(N){this.$d=(function(M){var D=M.date,B=M.utc;if(D===null)return new Date(NaN);if(I.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var P=D.match(m);if(P){var $=P[2]-1||0,F=(P[7]||"0").substring(0,3);return B?new Date(Date.UTC(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)):new Date(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)}}return new Date(D)})(N),this.init()},A.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},A.$utils=function(){return I},A.isValid=function(){return this.$d.toString()!==p},A.isSame=function(N,M){var D=E(N);return this.startOf(M)<=D&&D<=this.endOf(M)},A.isAfter=function(N,M){return E(N){hr();g2e=Ro(hA(),1),o0={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},se={trace:b((...e)=>{},"trace"),debug:b((...e)=>{},"debug"),info:b((...e)=>{},"info"),warn:b((...e)=>{},"warn"),error:b((...e)=>{},"error"),fatal:b((...e)=>{},"fatal")},d5=b(function(e="fatal"){let t=o0.fatal;typeof e=="string"?e.toLowerCase()in o0&&(t=o0[e]):typeof e=="number"&&(t=e),se.trace=()=>{},se.debug=()=>{},se.info=()=>{},se.warn=()=>{},se.error=()=>{},se.fatal=()=>{},t<=o0.fatal&&(se.fatal=console.error?console.error.bind(console,wu("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",wu("FATAL"))),t<=o0.error&&(se.error=console.error?console.error.bind(console,wu("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",wu("ERROR"))),t<=o0.warn&&(se.warn=console.warn?console.warn.bind(console,wu("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",wu("WARN"))),t<=o0.info&&(se.info=console.info?console.info.bind(console,wu("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",wu("INFO"))),t<=o0.debug&&(se.debug=console.debug?console.debug.bind(console,wu("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",wu("DEBUG"))),t<=o0.trace&&(se.trace=console.debug?console.debug.bind(console,wu("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",wu("TRACE")))},"setLogLevel"),wu=b(e=>`%c${(0,g2e.default)().format("ss.SSS")} : ${e} : `,"format")});var fA,y2e,v2e=W(()=>{fA={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{let t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<.16666666666666666?e+(t-e)*6*r:r<.5?t:r<.6666666666666666?e+(t-e)*(.6666666666666666-r)*6:e),hsl2rgb:({h:e,s:t,l:r},n)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;let i=r<.5?r*(1+t):r+t-r*t,a=2*r-i;switch(n){case"r":return fA.hue2rgb(a,i,e+.3333333333333333)*255;case"g":return fA.hue2rgb(a,i,e)*255;case"b":return fA.hue2rgb(a,i,e-.3333333333333333)*255}},rgb2hsl:({r:e,g:t,b:r},n)=>{e/=255,t/=255,r/=255;let i=Math.max(e,t,r),a=Math.min(e,t,r),s=(i+a)/2;if(n==="l")return s*100;if(i===a)return 0;let o=i-a,l=s>.5?o/(2-i-a):o/(i+a);if(n==="s")return l*100;switch(i){case e:return((t-r)/o+(t{_bt={clamp:(e,t,r)=>t>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},x2e=_bt});var Rbt,w2e,k2e=W(()=>{Rbt={dec2hex:e=>{let t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},w2e=Rbt});var Lbt,Cr,pf=W(()=>{v2e();b2e();k2e();Lbt={channel:y2e,lang:x2e,unit:w2e},Cr=Lbt});var l0,ps,p5=W(()=>{pf();l0={};for(let e=0;e<=255;e++)l0[e]=Cr.unit.dec2hex(e);ps={ALL:0,RGB:1,HSL:2}});var Tq,T2e,C2e=W(()=>{p5();Tq=class{constructor(){this.type=ps.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=ps.ALL}is(t){return this.type===t}},T2e=Tq});var Cq,S2e,E2e=W(()=>{pf();C2e();p5();Cq=class{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new T2e}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=ps.ALL,this}_ensureHSL(){let t=this.data,{h:r,s:n,l:i}=t;r===void 0&&(t.h=Cr.channel.rgb2hsl(t,"h")),n===void 0&&(t.s=Cr.channel.rgb2hsl(t,"s")),i===void 0&&(t.l=Cr.channel.rgb2hsl(t,"l"))}_ensureRGB(){let t=this.data,{r,g:n,b:i}=t;r===void 0&&(t.r=Cr.channel.hsl2rgb(t,"r")),n===void 0&&(t.g=Cr.channel.hsl2rgb(t,"g")),i===void 0&&(t.b=Cr.channel.hsl2rgb(t,"b"))}get r(){let t=this.data,r=t.r;return!this.type.is(ps.HSL)&&r!==void 0?r:(this._ensureHSL(),Cr.channel.hsl2rgb(t,"r"))}get g(){let t=this.data,r=t.g;return!this.type.is(ps.HSL)&&r!==void 0?r:(this._ensureHSL(),Cr.channel.hsl2rgb(t,"g"))}get b(){let t=this.data,r=t.b;return!this.type.is(ps.HSL)&&r!==void 0?r:(this._ensureHSL(),Cr.channel.hsl2rgb(t,"b"))}get h(){let t=this.data,r=t.h;return!this.type.is(ps.RGB)&&r!==void 0?r:(this._ensureRGB(),Cr.channel.rgb2hsl(t,"h"))}get s(){let t=this.data,r=t.s;return!this.type.is(ps.RGB)&&r!==void 0?r:(this._ensureRGB(),Cr.channel.rgb2hsl(t,"s"))}get l(){let t=this.data,r=t.l;return!this.type.is(ps.RGB)&&r!==void 0?r:(this._ensureRGB(),Cr.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(ps.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(ps.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(ps.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(ps.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(ps.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(ps.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}},S2e=Cq});var Ibt,km,m5=W(()=>{E2e();Ibt=new S2e({r:0,g:0,b:0,a:0},"transparent"),km=Ibt});var A2e,oy,Sq=W(()=>{m5();p5();A2e={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;let t=e.match(A2e.re);if(!t)return;let r=t[1],n=parseInt(r,16),i=r.length,a=i%4===0,s=i>4,o=s?1:17,l=s?8:4,u=a?0:-1,h=s?255:15;return km.set({r:(n>>l*(u+3)&h)*o,g:(n>>l*(u+2)&h)*o,b:(n>>l*(u+1)&h)*o,a:a?(n&h)*o/255:1},e)},stringify:e=>{let{r:t,g:r,b:n,a:i}=e;return i<1?`#${l0[Math.round(t)]}${l0[Math.round(r)]}${l0[Math.round(n)]}${l0[Math.round(i*255)]}`:`#${l0[Math.round(t)]}${l0[Math.round(r)]}${l0[Math.round(n)]}`}},oy=A2e});var dA,g5,_2e=W(()=>{pf();m5();dA={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{let t=e.match(dA.hueRe);if(t){let[,r,n]=t;switch(n){case"grad":return Cr.channel.clamp.h(parseFloat(r)*.9);case"rad":return Cr.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Cr.channel.clamp.h(parseFloat(r)*360)}}return Cr.channel.clamp.h(parseFloat(e))},parse:e=>{let t=e.charCodeAt(0);if(t!==104&&t!==72)return;let r=e.match(dA.re);if(!r)return;let[,n,i,a,s,o]=r;return km.set({h:dA._hue2deg(n),s:Cr.channel.clamp.s(parseFloat(i)),l:Cr.channel.clamp.l(parseFloat(a)),a:s?Cr.channel.clamp.a(o?parseFloat(s)/100:parseFloat(s)):1},e)},stringify:e=>{let{h:t,s:r,l:n,a:i}=e;return i<1?`hsla(${Cr.lang.round(t)}, ${Cr.lang.round(r)}%, ${Cr.lang.round(n)}%, ${i})`:`hsl(${Cr.lang.round(t)}, ${Cr.lang.round(r)}%, ${Cr.lang.round(n)}%)`}},g5=dA});var pA,Eq,R2e=W(()=>{Sq();pA={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();let t=pA.colors[e];if(t)return oy.parse(t)},stringify:e=>{let t=oy.stringify(e);for(let r in pA.colors)if(pA.colors[r]===t)return r}},Eq=pA});var L2e,y5,I2e=W(()=>{pf();m5();L2e={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{let t=e.charCodeAt(0);if(t!==114&&t!==82)return;let r=e.match(L2e.re);if(!r)return;let[,n,i,a,s,o,l,u,h]=r;return km.set({r:Cr.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Cr.channel.clamp.g(s?parseFloat(a)*2.55:parseFloat(a)),b:Cr.channel.clamp.b(l?parseFloat(o)*2.55:parseFloat(o)),a:u?Cr.channel.clamp.a(h?parseFloat(u)/100:parseFloat(u)):1},e)},stringify:e=>{let{r:t,g:r,b:n,a:i}=e;return i<1?`rgba(${Cr.lang.round(t)}, ${Cr.lang.round(r)}, ${Cr.lang.round(n)}, ${Cr.lang.round(i)})`:`rgb(${Cr.lang.round(t)}, ${Cr.lang.round(r)}, ${Cr.lang.round(n)})`}},y5=L2e});var Mbt,ms,c0=W(()=>{Sq();_2e();R2e();I2e();p5();Mbt={format:{keyword:Eq,hex:oy,rgb:y5,rgba:y5,hsl:g5,hsla:g5},parse:e=>{if(typeof e!="string")return e;let t=oy.parse(e)||y5.parse(e)||g5.parse(e)||Eq.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(ps.HSL)||e.data.r===void 0?g5.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?y5.stringify(e):oy.stringify(e)},ms=Mbt});var Nbt,mA,Aq=W(()=>{pf();c0();Nbt=(e,t)=>{let r=ms.parse(e);for(let n in t)r[n]=Cr.channel.clamp[n](t[n]);return ms.stringify(r)},mA=Nbt});var Dbt,$a,_q=W(()=>{pf();m5();c0();Aq();Dbt=(e,t,r=0,n=1)=>{if(typeof e!="number")return mA(e,{a:t});let i=km.set({r:Cr.channel.clamp.r(e),g:Cr.channel.clamp.g(t),b:Cr.channel.clamp.b(r),a:Cr.channel.clamp.a(n)});return ms.stringify(i)},$a=Dbt});var Obt,ly,M2e=W(()=>{pf();c0();Obt=(e,t)=>Cr.lang.round(ms.parse(e)[t]),ly=Obt});var Pbt,N2e,D2e=W(()=>{pf();c0();Pbt=e=>{let{r:t,g:r,b:n}=ms.parse(e),i=.2126*Cr.channel.toLinear(t)+.7152*Cr.channel.toLinear(r)+.0722*Cr.channel.toLinear(n);return Cr.lang.round(i)},N2e=Pbt});var Bbt,O2e,P2e=W(()=>{D2e();Bbt=e=>N2e(e)>=.5,O2e=Bbt});var Fbt,ci,B2e=W(()=>{P2e();Fbt=e=>!O2e(e),ci=Fbt});var $bt,gb,gA=W(()=>{pf();c0();$bt=(e,t,r)=>{let n=ms.parse(e),i=n[t],a=Cr.channel.clamp[t](i+r);return i!==a&&(n[t]=a),ms.stringify(n)},gb=$bt});var zbt,st,F2e=W(()=>{gA();zbt=(e,t)=>gb(e,"l",t),st=zbt});var Gbt,ot,$2e=W(()=>{gA();Gbt=(e,t)=>gb(e,"l",-t),ot=Gbt});var qbt,yA,z2e=W(()=>{gA();qbt=(e,t)=>gb(e,"a",-t),yA=qbt});var Vbt,me,G2e=W(()=>{c0();Aq();Vbt=(e,t)=>{let r=ms.parse(e),n={};for(let i in t)t[i]&&(n[i]=r[i]+t[i]);return mA(e,n)},me=Vbt});var Wbt,q2e,V2e=W(()=>{c0();_q();Wbt=(e,t,r=50)=>{let{r:n,g:i,b:a,a:s}=ms.parse(e),{r:o,g:l,b:u,a:h}=ms.parse(t),f=r/100,d=f*2-1,p=s-h,g=((d*p===-1?d:(d+p)/(1+d*p))+1)/2,y=1-g,v=n*g+o*y,x=i*g+l*y,w=a*g+u*y,C=s*f+h*(1-f);return $a(v,x,w,C)},q2e=Wbt});var Hbt,Je,W2e=W(()=>{c0();V2e();Hbt=(e,t=100)=>{let r=ms.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,q2e(r,e,t)},Je=Hbt});var H2e=W(()=>{_q();M2e();B2e();F2e();$2e();z2e();G2e();W2e()});var Ka=W(()=>{H2e()});function U2e(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?r-1:0),i=1;i2&&arguments[2]!==void 0?arguments[2]:w5;if(Y2e&&Y2e(e,null),!Cm(t))return e;let n=t.length;for(;n--;){let i=t[n];if(typeof i=="string"){let a=r(i);a!==i&&(Zbt(t)||(t[n]=a),i=a)}e[i]=!0}return e}function s4t(e){for(let t=0;t0&&arguments[0]!==void 0?arguments[0]:T4t(),t=Gt=>lxe(Gt);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==mf.document||!e.Element)return t.isSupported=!1,t;let r=e.document,n=r,i=n.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,s=e.Node,o=e.Element,l=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let h=e.DOMParser,f=e.trustedTypes,d=o.prototype,p=gf(d,"cloneNode"),m=gf(d,"remove"),g=gf(d,"nextSibling"),y=gf(d,"childNodes"),v=gf(d,"parentNode"),x=gf(d,"shadowRoot"),w=gf(d,"attributes"),C=s&&s.prototype?gf(s.prototype,"nodeType"):null,T=s&&s.prototype?gf(s.prototype,"nodeName"):null;if(typeof a=="function"){let Gt=r.createElement("template");Gt.content&&Gt.content.ownerDocument&&(r=Gt.content.ownerDocument)}let k,S="",E,I=!1,L=0,O=function(){if(L>0)throw cy('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},R=function($e){O(),L++;try{return k.createHTML($e)}finally{L--}},A=function($e){O(),L++;try{return k.createScriptURL($e)}finally{L--}},N=function(){return I||(E=C4t(f,i),I=!0),E},M=r,D=M.implementation,B=M.createNodeIterator,P=M.createDocumentFragment,$=M.getElementsByTagName,F=n.importNode,q=axe();t.isSupported=typeof sxe=="function"&&typeof v=="function"&&D&&D.createHTMLDocument!==void 0;let G=h4t,z=f4t,H=d4t,j=p4t,J=m4t,U=g4t,le=y4t,ee=x4t,ue=nxe,ae=null,oe=$n({},[...J2e,...Iq,...Mq,...Nq,...exe]),Re=null,Te=$n({},[...txe,...Dq,...rxe,...vA]),Oe=Object.seal(vb(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),qe=null,Ge=null,fe=Object.seal(vb(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ce=!0,_e=!0,de=!1,ie=!0,Q=!1,he=!0,xe=!1,ce=!1,ge=null,Ie=null,ye=!1,ne=!1,V=!1,pe=!1,K=!0,ve=!1,Z="user-content-",je=!0,Ne=!1,ze={},Fe=null,Ke=$n({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Ve=null,tt=$n({},["audio","video","img","source","image","track"]),We=null,rt=$n({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Se="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",De="http://www.w3.org/1999/xhtml",mt=De,Tt=!1,jt=null,_t=$n({},[Se,Et,De],Lq),Rt=ro(["mi","mo","mn","ms","mtext"]),bt=$n({},Rt),ke=ro(["annotation-xml"]),yt=$n({},ke),xt=$n({},["title","style","font","a","script"]),it=null,Me=["application/xhtml+xml","text/html"],ut="text/html",at=null,dt=null,tr=r.createElement("form"),Vt=function($e){return $e instanceof RegExp||$e instanceof Function},rr=function(){let $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(dt&&dt===$e)return;(!$e||typeof $e!="object")&&($e={}),$e=ul($e),it=Me.indexOf($e.PARSER_MEDIA_TYPE)===-1?ut:$e.PARSER_MEDIA_TYPE,at=it==="application/xhtml+xml"?Lq:w5,ae=Tm($e,"ALLOWED_TAGS",oe,{transform:at}),Re=Tm($e,"ALLOWED_ATTR",Te,{transform:at}),jt=Tm($e,"ALLOWED_NAMESPACES",_t,{transform:Lq}),We=Tm($e,"ADD_URI_SAFE_ATTR",rt,{transform:at,base:rt}),Ve=Tm($e,"ADD_DATA_URI_TAGS",tt,{transform:at,base:tt}),Fe=Tm($e,"FORBID_CONTENTS",Ke,{transform:at}),qe=Tm($e,"FORBID_TAGS",ul({}),{transform:at}),Ge=Tm($e,"FORBID_ATTR",ul({}),{transform:at}),ze=Os($e,"USE_PROFILES")?$e.USE_PROFILES&&typeof $e.USE_PROFILES=="object"?ul($e.USE_PROFILES):$e.USE_PROFILES:!1,Ce=$e.ALLOW_ARIA_ATTR!==!1,_e=$e.ALLOW_DATA_ATTR!==!1,de=$e.ALLOW_UNKNOWN_PROTOCOLS||!1,ie=$e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=$e.SAFE_FOR_TEMPLATES||!1,he=$e.SAFE_FOR_XML!==!1,xe=$e.WHOLE_DOCUMENT||!1,ne=$e.RETURN_DOM||!1,V=$e.RETURN_DOM_FRAGMENT||!1,pe=$e.RETURN_TRUSTED_TYPE||!1,ye=$e.FORCE_BODY||!1,K=$e.SANITIZE_DOM!==!1,ve=$e.SANITIZE_NAMED_PROPS||!1,je=$e.KEEP_CONTENT!==!1,Ne=$e.IN_PLACE||!1,ue=l4t($e.ALLOWED_URI_REGEXP)?$e.ALLOWED_URI_REGEXP:nxe,mt=typeof $e.NAMESPACE=="string"?$e.NAMESPACE:De,bt=Os($e,"MATHML_TEXT_INTEGRATION_POINTS")&&$e.MATHML_TEXT_INTEGRATION_POINTS&&typeof $e.MATHML_TEXT_INTEGRATION_POINTS=="object"?ul($e.MATHML_TEXT_INTEGRATION_POINTS):$n({},Rt),yt=Os($e,"HTML_INTEGRATION_POINTS")&&$e.HTML_INTEGRATION_POINTS&&typeof $e.HTML_INTEGRATION_POINTS=="object"?ul($e.HTML_INTEGRATION_POINTS):$n({},ke);let nt=Os($e,"CUSTOM_ELEMENT_HANDLING")&&$e.CUSTOM_ELEMENT_HANDLING&&typeof $e.CUSTOM_ELEMENT_HANDLING=="object"?ul($e.CUSTOM_ELEMENT_HANDLING):vb(null);if(Oe=vb(null),Os(nt,"tagNameCheck")&&Vt(nt.tagNameCheck)&&(Oe.tagNameCheck=nt.tagNameCheck),Os(nt,"attributeNameCheck")&&Vt(nt.attributeNameCheck)&&(Oe.attributeNameCheck=nt.attributeNameCheck),Os(nt,"allowCustomizedBuiltInElements")&&typeof nt.allowCustomizedBuiltInElements=="boolean"&&(Oe.allowCustomizedBuiltInElements=nt.allowCustomizedBuiltInElements),no(Oe),Q&&(_e=!1),V&&(ne=!0),ze&&(ae=$n({},exe),Re=vb(null),ze.html===!0&&($n(ae,J2e),$n(Re,txe)),ze.svg===!0&&($n(ae,Iq),$n(Re,Dq),$n(Re,vA)),ze.svgFilters===!0&&($n(ae,Mq),$n(Re,Dq),$n(Re,vA)),ze.mathMl===!0&&($n(ae,Nq),$n(Re,rxe),$n(Re,vA))),fe.tagCheck=null,fe.attributeCheck=null,Os($e,"ADD_TAGS")&&(typeof $e.ADD_TAGS=="function"?fe.tagCheck=$e.ADD_TAGS:Cm($e.ADD_TAGS)&&(ae===oe&&(ae=ul(ae)),$n(ae,$e.ADD_TAGS,at))),Os($e,"ADD_ATTR")&&(typeof $e.ADD_ATTR=="function"?fe.attributeCheck=$e.ADD_ATTR:Cm($e.ADD_ATTR)&&(Re===Te&&(Re=ul(Re)),$n(Re,$e.ADD_ATTR,at))),Os($e,"ADD_URI_SAFE_ATTR")&&Cm($e.ADD_URI_SAFE_ATTR)&&$n(We,$e.ADD_URI_SAFE_ATTR,at),Os($e,"FORBID_CONTENTS")&&Cm($e.FORBID_CONTENTS)&&(Fe===Ke&&(Fe=ul(Fe)),$n(Fe,$e.FORBID_CONTENTS,at)),Os($e,"ADD_FORBID_CONTENTS")&&Cm($e.ADD_FORBID_CONTENTS)&&(Fe===Ke&&(Fe=ul(Fe)),$n(Fe,$e.ADD_FORBID_CONTENTS,at)),je&&(ae["#text"]=!0),xe&&$n(ae,["html","head","body"]),ae.table&&($n(ae,["tbody"]),delete qe.tbody),$e.TRUSTED_TYPES_POLICY){if(typeof $e.TRUSTED_TYPES_POLICY.createHTML!="function")throw cy('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw cy('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let Ht=k;k=$e.TRUSTED_TYPES_POLICY;try{S=R("")}catch(er){throw k=Ht,er}}else $e.TRUSTED_TYPES_POLICY===null?(k=void 0,S=""):(k===void 0&&(k=N()),k&&typeof S=="string"&&(S=R("")));ro&&ro($e),dt=$e},Dr=$n({},[...Iq,...Mq,...c4t]),vr=$n({},[...Nq,...u4t]),Qt=function($e,nt,Ht){return nt.namespaceURI===De?$e==="svg":nt.namespaceURI===Se?$e==="svg"&&(Ht==="annotation-xml"||bt[Ht]):!!Dr[$e]},yr=function($e,nt,Ht){return nt.namespaceURI===De?$e==="math":nt.namespaceURI===Et?$e==="math"&&yt[Ht]:!!vr[$e]},lt=function($e,nt,Ht){return nt.namespaceURI===Et&&!yt[Ht]||nt.namespaceURI===Se&&!bt[Ht]?!1:!vr[$e]&&(xt[$e]||!Dr[$e])},pt=function($e){let nt=v($e);(!nt||!nt.tagName)&&(nt={namespaceURI:mt,tagName:"template"});let Ht=w5($e.tagName),er=w5(nt.tagName);return jt[$e.namespaceURI]?$e.namespaceURI===Et?Qt(Ht,nt,er):$e.namespaceURI===Se?yr(Ht,nt,er):$e.namespaceURI===De?lt(Ht,nt,er):!!(it==="application/xhtml+xml"&&jt[$e.namespaceURI]):!1},St=function($e){yb(t.removed,{element:$e});try{v($e).removeChild($e)}catch{if(m($e),!v($e))throw cy("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ir=function($e){let nt=y($e);if(nt){let er=[];v5(nt,yn=>{yb(er,yn)}),v5(er,yn=>{try{m(yn)}catch{}})}let Ht=w($e);if(Ht)for(let er=Ht.length-1;er>=0;--er){let yn=Ht[er],xn=yn&&yn.name;if(typeof xn=="string")try{$e.removeAttribute(xn)}catch{}}},ur=function($e,nt){try{yb(t.removed,{attribute:nt.getAttributeNode($e),from:nt})}catch{yb(t.removed,{attribute:null,from:nt})}if(nt.removeAttribute($e),$e==="is")if(ne||V)try{St(nt)}catch{}else try{nt.setAttribute($e,"")}catch{}},gn=function($e){let nt=w($e);if(nt)for(let Ht=nt.length-1;Ht>=0;--Ht){let er=nt[Ht],yn=er&&er.name;if(!(typeof yn!="string"||Re[at(yn)]))try{$e.removeAttribute(yn)}catch{}}},Fn=function($e){let nt=[$e];for(;nt.length>0;){let Ht=nt.pop();(C?C(Ht):Ht.nodeType)===mf.element&&gn(Ht);let yn=y(Ht);if(yn)for(let xn=yn.length-1;xn>=0;--xn)nt.push(yn[xn])}},jr=function($e){let nt=null,Ht=null;if(ye)$e=""+$e;else{let xn=j2e($e,/^[\r\n\t ]+/);Ht=xn&&xn[0]}it==="application/xhtml+xml"&&mt===De&&($e=''+$e+"");let er=k?R($e):$e;if(mt===De)try{nt=new h().parseFromString(er,it)}catch{}if(!nt||!nt.documentElement){nt=D.createDocument(mt,"template",null);try{nt.documentElement.innerHTML=Tt?S:er}catch{}}let yn=nt.body||nt.documentElement;return $e&&Ht&&yn.insertBefore(r.createTextNode(Ht),yn.childNodes[0]||null),mt===De?$.call(nt,xe?"html":"body")[0]:xe?nt.documentElement:yn},Ft=function($e){return B.call($e.ownerDocument||$e,$e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},kt=function($e){return $e=x5($e,G," "),$e=x5($e,z," "),$e=x5($e,H," "),$e},zt=function($e){var nt;$e.normalize();let Ht=B.call($e.ownerDocument||$e,$e,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),er=Ht.nextNode();for(;er;)er.data=kt(er.data),er=Ht.nextNode();let yn=(nt=$e.querySelectorAll)===null||nt===void 0?void 0:nt.call($e,"template");yn&&v5(yn,xn=>{wt(xn.content)&&zt(xn.content)})},Wt=function($e){let nt=T?T($e):null;return typeof nt!="string"||at(nt)!=="form"?!1:typeof $e.nodeName!="string"||typeof $e.textContent!="string"||typeof $e.removeChild!="function"||$e.attributes!==w($e)||typeof $e.removeAttribute!="function"||typeof $e.setAttribute!="function"||typeof $e.namespaceURI!="string"||typeof $e.insertBefore!="function"||typeof $e.hasChildNodes!="function"||$e.nodeType!==C($e)||$e.childNodes!==y($e)},wt=function($e){if(!C||typeof $e!="object"||$e===null)return!1;try{return C($e)===mf.documentFragment}catch{return!1}},wr=function($e){if(!C||typeof $e!="object"||$e===null)return!1;try{return typeof C($e)=="number"}catch{return!1}};function Le(Gt,$e,nt){Gt.length!==0&&v5(Gt,Ht=>{Ht.call(t,$e,nt,dt)})}let Ri=function($e,nt){return!!(he&&$e.hasChildNodes()&&!wr($e.firstElementChild)&&to(ixe,$e.textContent)&&to(ixe,$e.innerHTML)||he&&$e.namespaceURI===De&&nt==="style"&&wr($e.firstElementChild)||$e.nodeType===mf.processingInstruction||he&&$e.nodeType===mf.comment&&to(b4t,$e.data))},Pe=function($e,nt){if(!qe[nt]&&Ad(nt)&&(Oe.tagNameCheck instanceof RegExp&&to(Oe.tagNameCheck,nt)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck(nt)))return!1;if(je&&!Fe[nt]){let Ht=v($e),er=y($e);if(er&&Ht){let yn=er.length;for(let xn=yn-1;xn>=0;--xn){let ii=Ne?er[xn]:p(er[xn],!0);Ht.insertBefore(ii,g($e))}}}return St($e),!0},qr=function($e){if(Le(q.beforeSanitizeElements,$e,null),Wt($e))return St($e),!0;let nt=at(T?T($e):$e.nodeName);if(Le(q.uponSanitizeElement,$e,{tagName:nt,allowedTags:ae}),Ri($e,nt))return St($e),!0;if(qe[nt]||!(fe.tagCheck instanceof Function&&fe.tagCheck(nt))&&!ae[nt])return Pe($e,nt);if((C?C($e):$e.nodeType)===mf.element&&!pt($e)||(nt==="noscript"||nt==="noembed"||nt==="noframes")&&to(w4t,$e.innerHTML))return St($e),!0;if(Q&&$e.nodeType===mf.text){let er=kt($e.textContent);$e.textContent!==er&&(yb(t.removed,{element:$e.cloneNode()}),$e.textContent=er)}return Le(q.afterSanitizeElements,$e,null),!1},Ha=function($e,nt,Ht){if(Ge[nt]||K&&(nt==="id"||nt==="name")&&(Ht in r||Ht in tr))return!1;let er=Re[nt]||fe.attributeCheck instanceof Function&&fe.attributeCheck(nt,$e);if(!(_e&&to(j,nt))){if(!(Ce&&to(J,nt))){if(er){if(!We[nt]){if(!to(ue,x5(Ht,le,""))){if(!((nt==="src"||nt==="xlink:href"||nt==="href")&&$e!=="script"&&K2e(Ht,"data:")===0&&Ve[$e])){if(!(de&&!to(U,x5(Ht,le,"")))){if(Ht)return!1}}}}}else if(!(Ad($e)&&(Oe.tagNameCheck instanceof RegExp&&to(Oe.tagNameCheck,$e)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck($e))&&(Oe.attributeNameCheck instanceof RegExp&&to(Oe.attributeNameCheck,nt)||Oe.attributeNameCheck instanceof Function&&Oe.attributeNameCheck(nt,$e))||nt==="is"&&Oe.allowCustomizedBuiltInElements&&(Oe.tagNameCheck instanceof RegExp&&to(Oe.tagNameCheck,Ht)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck(Ht))))return!1}}return!0},Ku=$n({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ad=function($e){return!Ku[w5($e)]&&to(ee,$e)},Sp=function($e,nt,Ht,er){if(k&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Ht)switch(f.getAttributeType($e,nt)){case"TrustedHTML":return R(er);case"TrustedScriptURL":return A(er)}return er},X2=function($e,nt,Ht,er){try{Ht?$e.setAttributeNS(Ht,nt,er):$e.setAttribute(nt,er),Wt($e)?St($e):X2e(t.removed)}catch{ur(nt,$e)}},ta=function($e){Le(q.beforeSanitizeAttributes,$e,null);let nt=$e.attributes;if(!nt||Wt($e))return;let Ht={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Re,forceKeepAttr:void 0},er=nt.length,yn=at($e.nodeName);for(;er--;){let xn=nt[er],ii=xn.name,Da=xn.namespaceURI,_o=xn.value,Rs=at(ii),Ep=_o,Wi=ii==="value"?Ep:r4t(Ep);if(Ht.attrName=Rs,Ht.attrValue=Wi,Ht.keepAttr=!0,Ht.forceKeepAttr=void 0,Le(q.uponSanitizeAttribute,$e,Ht),Wi=Ht.attrValue,ve&&(Rs==="id"||Rs==="name")&&K2e(Wi,Z)!==0&&(ur(ii,$e),Wi=Z+Wi),he&&to(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Wi)){ur(ii,$e);continue}if(Rs==="attributename"&&j2e(Wi,"href")){ur(ii,$e);continue}if(!Ht.forceKeepAttr){if(!Ht.keepAttr){ur(ii,$e);continue}if(!ie&&to(k4t,Wi)){ur(ii,$e);continue}if(Q&&(Wi=kt(Wi)),!Ha(yn,Rs,Wi)){ur(ii,$e);continue}Wi=Sp(yn,Rs,Da,Wi),Wi!==Ep&&X2($e,ii,Da,Wi)}}Le(q.afterSanitizeAttributes,$e,null)},Zo=function($e){let nt=null,Ht=Ft($e);for(Le(q.beforeSanitizeShadowDOM,$e,null);nt=Ht.nextNode();)if(Le(q.uponSanitizeShadowNode,nt,null),qr(nt),ta(nt),wt(nt.content)&&Zo(nt.content),(C?C(nt):nt.nodeType)===mf.element){let yn=x(nt);wt(yn)&&(_d(yn),Zo(yn))}Le(q.afterSanitizeShadowDOM,$e,null)},_d=function($e){let nt=[{node:$e,shadow:null}];for(;nt.length>0;){let Ht=nt.pop();if(Ht.shadow){Zo(Ht.shadow);continue}let er=Ht.node,xn=(C?C(er):er.nodeType)===mf.element,ii=y(er);if(ii)for(let Da=ii.length-1;Da>=0;--Da)nt.push({node:ii[Da],shadow:null});if(xn){let Da=T?T(er):null;if(typeof Da=="string"&&at(Da)==="template"){let _o=er.content;wt(_o)&&nt.push({node:_o,shadow:null})}}if(xn){let Da=x(er);wt(Da)&&nt.push({node:null,shadow:Da},{node:Da,shadow:null})}}};return t.sanitize=function(Gt){let $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},nt=null,Ht=null,er=null,yn=null;if(Tt=!Gt,Tt&&(Gt=""),typeof Gt!="string"&&!wr(Gt)&&(Gt=o4t(Gt),typeof Gt!="string"))throw cy("dirty is not a string, aborting");if(!t.isSupported)return Gt;ce?(ae=ge,Re=Ie):rr($e),(q.uponSanitizeElement.length>0||q.uponSanitizeAttribute.length>0)&&(ae=ul(ae)),q.uponSanitizeAttribute.length>0&&(Re=ul(Re)),t.removed=[];let xn=Ne&&typeof Gt!="string"&&wr(Gt);if(xn){let _o=T?T(Gt):Gt.nodeName;if(typeof _o=="string"){let Rs=at(_o);if(!ae[Rs]||qe[Rs])throw cy("root node is forbidden and cannot be sanitized in-place")}if(Wt(Gt))throw cy("root node is clobbered and cannot be sanitized in-place");try{_d(Gt)}catch(Rs){throw Ir(Gt),Rs}}else if(wr(Gt))nt=jr(""),Ht=nt.ownerDocument.importNode(Gt,!0),Ht.nodeType===mf.element&&Ht.nodeName==="BODY"||Ht.nodeName==="HTML"?nt=Ht:nt.appendChild(Ht),_d(Ht);else{if(!ne&&!Q&&!xe&&Gt.indexOf("<")===-1)return k&&pe?R(Gt):Gt;if(nt=jr(Gt),!nt)return ne?null:pe?S:""}nt&&ye&&St(nt.firstChild);let ii=Ft(xn?Gt:nt);try{for(;er=ii.nextNode();)qr(er),ta(er),wt(er.content)&&Zo(er.content)}catch(_o){throw xn&&Ir(Gt),_o}if(xn)return v5(t.removed,_o=>{_o.element&&Fn(_o.element)}),Q&&zt(Gt),Gt;if(ne){if(Q&&zt(nt),V)for(yn=P.call(nt.ownerDocument);nt.firstChild;)yn.appendChild(nt.firstChild);else yn=nt;return(Re.shadowroot||Re.shadowrootmode)&&(yn=F.call(n,yn,!0)),yn}let Da=xe?nt.outerHTML:nt.innerHTML;return xe&&ae["!doctype"]&&nt.ownerDocument&&nt.ownerDocument.doctype&&nt.ownerDocument.doctype.name&&to(v4t,nt.ownerDocument.doctype.name)&&(Da=" -`+Da),Q&&(Da=kt(Da)),k&&pe?R(Da):Da},t.setConfig=function(){let Gt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};rr(Gt),ce=!0,ge=ae,Ie=Re},t.clearConfig=function(){dt=null,ce=!1,ge=null,Ie=null,k=E,S=""},t.isValidAttribute=function(Gt,$e,nt){dt||rr({});let Ht=at(Gt),er=at($e);return Ha(Ht,er,nt)},t.addHook=function(Gt,$e){typeof $e=="function"&&Os(q,Gt)&&yb(q[Gt],$e)},t.removeHook=function(Gt,$e){if(Os(q,Gt)){if($e!==void 0){let nt=e4t(q[Gt],$e);return nt===-1?void 0:t4t(q[Gt],nt,1)[0]}return X2e(q[Gt])}},t.removeHooks=function(Gt){Os(q,Gt)&&(q[Gt]=[])},t.removeAllHooks=function(){q=axe()},t}var sxe,Y2e,Zbt,Qbt,Jbt,ro,no,vb,oxe,Oq,Pq,v5,e4t,X2e,yb,t4t,Cm,w5,Lq,j2e,x5,K2e,r4t,n4t,i4t,Z2e,Q2e,Os,b5,to,cy,J2e,Iq,Mq,c4t,Nq,u4t,exe,txe,Dq,rxe,vA,h4t,f4t,d4t,p4t,m4t,nxe,g4t,y4t,v4t,x4t,ixe,b4t,w4t,k4t,mf,T4t,C4t,axe,Tm,Ul,xb=W(()=>{sxe=Object.entries,Y2e=Object.setPrototypeOf,Zbt=Object.isFrozen,Qbt=Object.getPrototypeOf,Jbt=Object.getOwnPropertyDescriptor,ro=Object.freeze,no=Object.seal,vb=Object.create,oxe=typeof Reflect<"u"&&Reflect,Oq=oxe.apply,Pq=oxe.construct;ro||(ro=function(t){return t});no||(no=function(t){return t});Oq||(Oq=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a1?r-1:0),i=1;i"u"?null:Za(BigInt.prototype.toString),Q2e=typeof Symbol>"u"?null:Za(Symbol.prototype.toString),Os=Za(Object.prototype.hasOwnProperty),b5=Za(Object.prototype.toString),to=Za(RegExp.prototype.test),cy=a4t(TypeError);J2e=ro(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Iq=ro(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mq=ro(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),c4t=ro(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Nq=ro(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),u4t=ro(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),exe=ro(["#text"]),txe=ro(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Dq=ro(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),rxe=ro(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),vA=ro(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),h4t=no(/{{[\w\W]*|^[\w\W]*}}/g),f4t=no(/<%[\w\W]*|^[\w\W]*%>/g),d4t=no(/\${[\w\W]*/g),p4t=no(/^data-[\-\w.\u00B7-\uFFFF]+$/),m4t=no(/^aria-[\-\w]+$/),nxe=no(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),g4t=no(/^(?:\w+script|data):/i),y4t=no(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),v4t=no(/^html$/i),x4t=no(/^[a-z][.\w]*(-[.\w]+)+$/i),ixe=no(/<[/\w!]/g),b4t=no(/<[/\w]/g),w4t=no(/<\/no(script|embed|frames)/i),k4t=no(/\/>/i),mf={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},T4t=function(){return typeof window>"u"?null:window},C4t=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null,i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(n=r.getAttribute(i));let a="dompurify"+(n?"#"+n:"");try{return t.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},axe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Tm=function(t,r,n,i){return Os(t,r)&&Cm(t[r])?$n(i.base?ul(i.base):{},t[r],i.transform):n};Ul=lxe()});var Wbe={};Tr(Wbe,{ParseError:()=>Bt,SETTINGS_SCHEMA:()=>IA,__defineFunction:()=>nr,__defineMacro:()=>Ee,__defineSymbol:()=>Y,__domTree:()=>Vbe,__parse:()=>$be,__renderToDomTree:()=>QA,__renderToHTMLTree:()=>Gbe,__setFontMetrics:()=>jxe,default:()=>dkt,render:()=>IV,renderToString:()=>Fbe,version:()=>qbe});function I4t(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function M4t(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return I4t(t)}function N4t(e,t,r,n){var i=r[t];e[t]=i!==void 0?n.processor?n.processor(i):i:M4t(n)}function z4t(e){for(var t=0;t=i[0]&&e<=i[1])return r.name}return null}function Wxe(e){for(var t=0;t=LA[t]&&e<=LA[t+1])return!0;return!1}function Z4t(e){return"toText"in e}function twt(e){if(e instanceof dl)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function rwt(e){if(e instanceof Rm)return e;throw new Error("Expected span but got "+String(e)+".")}function jxe(e,t){xf[e]=t}function xV(e,t,r){if(!xf[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),i=xf[t][n];if(!i&&e[0]in uxe&&(n=uxe[e[0]].charCodeAt(0),i=xf[t][n]),!i&&r==="text"&&Wxe(n)&&(i=xf[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}function iwt(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Bq[t]){var r=Bq[t]={cssEmPerMu:xA.quad[t]/18};for(var n in xA)xA.hasOwnProperty(n)&&(r[n]=xA[n][t])}return Bq[t]}function Y(e,t,r,n,i,a){ia[e][i]={font:t,group:r,replace:n},a&&n&&(ia[e][n]=ia[e][i])}function nr(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l0&&(a.push(SA(s,t)),s=[]),a.push(n[o]));s.length>0&&a.push(SA(s,t));var u;r?(u=SA(ys(r,t,!0),t),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=Dt(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=Yt(h.height+h.depth),h.depth&&(f.style.verticalAlign=Yt(-h.depth))}return h}function nbe(e){return new Am(e)}function zq(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Ca&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof Ca&&r.text===","}else return!1}function bxe(e,t,r,n,i){var a=Oc(e,r),s;a.length===1&&a[0]instanceof Pt&&xwt.has(a[0].type)?s=a[0]:s=new Pt("mrow",a);var o=new Pt("annotation",[new Ca(t)]);o.setAttribute("encoding","application/x-tex");var l=new Pt("semantics",[s,o]),u=new Pt("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return Dt([h],[u])}function Lwt(e){return e in _wt}function Tn(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function HA(e){var t=UA(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function UA(e){return e&&(e.type==="atom"||Rwt.hasOwnProperty(e.type))?e:null}function lbe(e,t){var r=ys(e.body,t,!0);return Dt([e.mclass],r,t)}function cbe(e,t){var r,n=Oc(e.body,t);return e.mclass==="minner"?r=new Pt("mpadded",n):e.mclass==="mord"?e.isCharacterBox?(r=n[0],r.type="mi"):r=new Pt("mi",n):(e.isCharacterBox?(r=n[0],r.type="mo"):r=new Pt("mo",n),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}function Dwt(e,t,r){var n=Mwt[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},s=r.callFunction("\\Big",[a],[]),o=r.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[i,s,o]};return r.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Owt(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new Bt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var n=[],i=[n],a=0;aAV".includes(u))for(var f=0;f<2;f++){for(var d=!0,p=l+1;pAV=|." after @',s[l]);var m=Dwt(u,h,e),g={type:"styling",body:[m],mode:"math",style:"display",resetFont:!0};n.push(g),o=Txe()}a%2===0?n.push(o):n.shift(),n=[],i.push(n)}e.gullet.endGroup(),e.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}function Exe(e){return"isMiddle"in e}function XA(e,t){var r=UA(e);if(r&&Uwt.has(r.text))return r;throw r?new Bt("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new Bt("Invalid delimiter type '"+e.type+"'",e)}function Axe(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}function wf(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l1||!h)&&g.pop(),v.length{Bt=class e extends Error{constructor(t,r){var n="KaTeX parse error: "+t,i,a,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;i=s.start,a=s.end,i===o.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=o.slice(i,a).replace(/[^]/g,"$&\u0332"),u;i>15?u="\u2026"+o.slice(i-15,i):u=o.slice(0,i);var h;a+15e.replace(S4t,"-$1").toLowerCase(),A4t={"&":"&",">":">","<":"<",'"':""","'":"'"},_4t=/[&><"']/g,zo=e=>String(e).replace(_4t,t=>A4t[t]),RA=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?RA(e.body[0]):e:e.type==="font"?RA(e.body):e,R4t=new Set(["mathord","textord","atom"]),d0=e=>R4t.has(RA(e).type),L4t=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},IA={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};E5=class{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r of Object.keys(IA)){var n=IA[r];n&&N4t(this,r,t,n)}}reportNonstrict(t,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(t,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new Bt("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,n){var i=this.strict;if(typeof i=="function")try{i=i(t,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var r=L4t(t.url);if(r==null)return!1;t.protocol=r}var n=typeof this.trust=="function"?this.trust(t):this.trust;return!!n}},yf=class{constructor(t,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=n}sup(){return vf[D4t[this.id]]}sub(){return vf[O4t[this.id]]}fracNum(){return vf[P4t[this.id]]}fracDen(){return vf[B4t[this.id]]}cramp(){return vf[F4t[this.id]]}text(){return vf[$4t[this.id]]}isTight(){return this.size>=2}},yV=0,MA=1,wb=2,f0=3,A5=4,ku=5,kb=6,fl=7,vf=[new yf(yV,0,!1),new yf(MA,0,!0),new yf(wb,1,!1),new yf(f0,1,!0),new yf(A5,2,!1),new yf(ku,2,!0),new yf(kb,3,!1),new yf(fl,3,!0)],D4t=[A5,ku,A5,ku,kb,fl,kb,fl],O4t=[ku,ku,ku,ku,fl,fl,fl,fl],P4t=[wb,f0,A5,ku,kb,fl,kb,fl],B4t=[f0,f0,ku,ku,fl,fl,fl,fl],F4t=[MA,MA,f0,f0,ku,ku,fl,fl],$4t=[yV,MA,wb,f0,wb,f0,wb,f0],pn={DISPLAY:vf[yV],TEXT:vf[wb],SCRIPT:vf[A5],SCRIPTSCRIPT:vf[kb]},Zq=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];LA=[];Zq.forEach(e=>e.blocks.forEach(t=>LA.push(...t)));gs=e=>e+" "+e,bb=80,G4t=function(t,r){return"M95,"+(622+t+r)+` +(()=>{var Oit=Object.create;var pP=Object.defineProperty;var Pit=Object.getOwnPropertyDescriptor;var Bit=Object.getOwnPropertyNames;var Fit=Object.getPrototypeOf,$it=Object.prototype.hasOwnProperty;var W=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Jo=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Tr=(e,t)=>{for(var r in t)pP(e,r,{get:t[r],enumerable:!0})},zit=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bit(t))!$it.call(e,i)&&i!==r&&pP(e,i,{get:()=>t[i],enumerable:!(n=Pit(t,i))||n.enumerable});return e};var Ro=(e,t,r)=>(r=e!=null?Oit(Fit(e)):{},zit(t||!e||!e.__esModule?pP(r,"default",{value:e,enumerable:!0}):r,e));var Wle=Jo((ggr,Vle)=>{"use strict";var _E=Object.prototype.hasOwnProperty,qle=Object.prototype.toString,Ple=Object.defineProperty,Ble=Object.getOwnPropertyDescriptor,Fle=function(t){return typeof Array.isArray=="function"?Array.isArray(t):qle.call(t)==="[object Array]"},$le=function(t){if(!t||qle.call(t)!=="[object Object]")return!1;var r=_E.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&_E.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||_E.call(t,i)},zle=function(t,r){Ple&&r.name==="__proto__"?Ple(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},Gle=function(t,r){if(r==="__proto__")if(_E.call(t,r)){if(Ble)return Ble(t,r).value}else return;return t[r]};Vle.exports=function e(){var t,r,n,i,a,s,o=arguments[0],l=1,u=arguments.length,h=!1;for(typeof o=="boolean"&&(h=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l{hdt=typeof global=="object"&&global&&global.Object===Object&&global,R7=hdt});var fdt,ddt,wa,mu=W(()=>{fz();fdt=typeof self=="object"&&self&&self.Object===Object&&self,ddt=R7||fdt||Function("return this")(),wa=ddt});var pdt,Ns,Y1=W(()=>{mu();pdt=wa.Symbol,Ns=pdt});function ydt(e){var t=mdt.call(e,LT),r=e[LT];try{e[LT]=void 0;var n=!0}catch{}var i=gdt.call(e);return n&&(t?e[LT]=r:delete e[LT]),i}var Hde,mdt,gdt,LT,Ude,Yde=W(()=>{Y1();Hde=Object.prototype,mdt=Hde.hasOwnProperty,gdt=Hde.toString,LT=Ns?Ns.toStringTag:void 0;Ude=ydt});function bdt(e){return xdt.call(e)}var vdt,xdt,Xde,jde=W(()=>{vdt=Object.prototype,xdt=vdt.toString;Xde=bdt});function Tdt(e){return e==null?e===void 0?kdt:wdt:Kde&&Kde in Object(e)?Ude(e):Xde(e)}var wdt,kdt,Kde,al,Up=W(()=>{Y1();Yde();jde();wdt="[object Null]",kdt="[object Undefined]",Kde=Ns?Ns.toStringTag:void 0;al=Tdt});function Cdt(e){return e!=null&&typeof e=="object"}var Fa,nh=W(()=>{Fa=Cdt});function Edt(e){return typeof e=="symbol"||Fa(e)&&al(e)==Sdt}var Sdt,Ec,X1=W(()=>{Up();nh();Sdt="[object Symbol]";Ec=Edt});function Adt(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r{Qh=Adt});var _dt,wn,Ya=W(()=>{_dt=Array.isArray,wn=_dt});function Jde(e){if(typeof e=="string")return e;if(wn(e))return Qh(e,Jde)+"";if(Ec(e))return Qde?Qde.call(e):"";var t=e+"";return t=="0"&&1/e==-Rdt?"-0":t}var Rdt,Zde,Qde,e0e,t0e=W(()=>{Y1();IT();Ya();X1();Rdt=1/0,Zde=Ns?Ns.prototype:void 0,Qde=Zde?Zde.toString:void 0;e0e=Jde});function Idt(e){for(var t=e.length;t--&&Ldt.test(e.charAt(t)););return t}var Ldt,r0e,n0e=W(()=>{Ldt=/\s/;r0e=Idt});function Ndt(e){return e&&e.slice(0,r0e(e)+1).replace(Mdt,"")}var Mdt,i0e,a0e=W(()=>{n0e();Mdt=/^\s+/;i0e=Ndt});function Ddt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Pi,Ac=W(()=>{Pi=Ddt});function $dt(e){if(typeof e=="number")return e;if(Ec(e))return s0e;if(Pi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Pi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=i0e(e);var r=Pdt.test(e);return r||Bdt.test(e)?Fdt(e.slice(2),r?2:8):Odt.test(e)?s0e:+e}var s0e,Odt,Pdt,Bdt,Fdt,MT,dz=W(()=>{a0e();Ac();X1();s0e=NaN,Odt=/^[-+]0x[0-9a-f]+$/i,Pdt=/^0b[01]+$/i,Bdt=/^0o[0-7]+$/i,Fdt=parseInt;MT=$dt});function Gdt(e){if(!e)return e===0?e:0;if(e=MT(e),e===o0e||e===-o0e){var t=e<0?-1:1;return t*zdt}return e===e?e:0}var o0e,zdt,Ox,pz=W(()=>{dz();o0e=1/0,zdt=17976931348623157e292;Ox=Gdt});function qdt(e){var t=Ox(e),r=t%1;return t===t?r?t-r:t:0}var l0e,c0e=W(()=>{pz();l0e=qdt});function Vdt(e){return e}var Gl,Yp=W(()=>{Gl=Vdt});function Xdt(e){if(!Pi(e))return!1;var t=al(e);return t==Hdt||t==Udt||t==Wdt||t==Ydt}var Wdt,Hdt,Udt,Ydt,Jh,NT=W(()=>{Up();Ac();Wdt="[object AsyncFunction]",Hdt="[object Function]",Udt="[object GeneratorFunction]",Ydt="[object Proxy]";Jh=Xdt});var jdt,L7,u0e=W(()=>{mu();jdt=wa["__core-js_shared__"],L7=jdt});function Kdt(e){return!!h0e&&h0e in e}var h0e,f0e,d0e=W(()=>{u0e();h0e=(function(){var e=/[^.]+$/.exec(L7&&L7.keys&&L7.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();f0e=Kdt});function Jdt(e){if(e!=null){try{return Qdt.call(e)}catch{}try{return e+""}catch{}}return""}var Zdt,Qdt,Yd,mz=W(()=>{Zdt=Function.prototype,Qdt=Zdt.toString;Yd=Jdt});function o0t(e){if(!Pi(e)||f0e(e))return!1;var t=Jh(e)?s0t:t0t;return t.test(Yd(e))}var e0t,t0t,r0t,n0t,i0t,a0t,s0t,p0e,m0e=W(()=>{NT();d0e();Ac();mz();e0t=/[\\^$.*+?()[\]{}|]/g,t0t=/^\[object .+?Constructor\]$/,r0t=Function.prototype,n0t=Object.prototype,i0t=r0t.toString,a0t=n0t.hasOwnProperty,s0t=RegExp("^"+i0t.call(a0t).replace(e0t,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");p0e=o0t});function l0t(e,t){return e?.[t]}var g0e,y0e=W(()=>{g0e=l0t});function c0t(e,t){var r=g0e(e,t);return p0e(r)?r:void 0}var ql,Xp=W(()=>{m0e();y0e();ql=c0t});var u0t,I7,v0e=W(()=>{Xp();mu();u0t=ql(wa,"WeakMap"),I7=u0t});var x0e,h0t,b0e,w0e=W(()=>{Ac();x0e=Object.create,h0t=(function(){function e(){}return function(t){if(!Pi(t))return{};if(x0e)return x0e(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),b0e=h0t});function f0t(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var k0e,T0e=W(()=>{k0e=f0t});function d0t(){}var C0e,S0e=W(()=>{C0e=d0t});function p0t(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r{M7=p0t});function v0t(e){var t=0,r=0;return function(){var n=y0t(),i=g0t-(n-r);if(r=n,i>0){if(++t>=m0t)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var m0t,g0t,y0t,E0e,A0e=W(()=>{m0t=800,g0t=16,y0t=Date.now;E0e=v0t});function x0t(e){return function(){return e}}var Vl,yz=W(()=>{Vl=x0t});var b0t,Px,vz=W(()=>{Xp();b0t=(function(){try{var e=ql(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Px=b0t});var w0t,_0e,R0e=W(()=>{yz();vz();Yp();w0t=Px?function(e,t){return Px(e,"toString",{configurable:!0,enumerable:!1,value:Vl(t),writable:!0})}:Gl,_0e=w0t});var k0t,N7,xz=W(()=>{R0e();A0e();k0t=E0e(_0e),N7=k0t});function T0t(e,t){for(var r=-1,n=e==null?0:e.length;++r{D7=T0t});function C0t(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a{O7=C0t});function S0t(e){return e!==e}var L0e,I0e=W(()=>{L0e=S0t});function E0t(e,t,r){for(var n=r-1,i=e.length;++n{M0e=E0t});function A0t(e,t,r){return t===t?M0e(e,t,r):O7(e,L0e,r)}var D0e,O0e=W(()=>{wz();I0e();N0e();D0e=A0t});function _0t(e,t){var r=e==null?0:e.length;return!!r&&D0e(e,t,0)>-1}var P0e,B0e=W(()=>{O0e();P0e=_0t});function I0t(e,t){var r=typeof e;return t=t??R0t,!!t&&(r=="number"||r!="symbol"&&L0t.test(e))&&e>-1&&e%1==0&&e{R0t=9007199254740991,L0t=/^(?:0|[1-9]\d*)$/;jp=I0t});function M0t(e,t,r){t=="__proto__"&&Px?Px(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Kp,OT=W(()=>{vz();Kp=M0t});function N0t(e,t){return e===t||e!==e&&t!==t}var gu,j1=W(()=>{gu=N0t});function P0t(e,t,r){var n=e[t];(!(O0t.call(e,t)&&gu(n,r))||r===void 0&&!(t in e))&&Kp(e,t,r)}var D0t,O0t,Zp,PT=W(()=>{OT();j1();D0t=Object.prototype,O0t=D0t.hasOwnProperty;Zp=P0t});function B0t(e,t,r,n){var i=!r;r||(r={});for(var a=-1,s=t.length;++a{PT();OT();ef=B0t});function F0t(e,t,r){return t=F0e(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=F0e(n.length-t,0),s=Array(a);++i{T0e();F0e=Math.max;P7=F0t});function $0t(e,t){return N7(P7(e,t,Gl),e+"")}var Qp,BT=W(()=>{Yp();kz();xz();Qp=$0t});function G0t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=z0t}var z0t,Fx,B7=W(()=>{z0t=9007199254740991;Fx=G0t});function q0t(e){return e!=null&&Fx(e.length)&&!Jh(e)}var Ds,tf=W(()=>{NT();B7();Ds=q0t});function V0t(e,t,r){if(!Pi(r))return!1;var n=typeof t;return(n=="number"?Ds(r)&&jp(t,r.length):n=="string"&&t in r)?gu(r[t],e):!1}var Xd,FT=W(()=>{j1();tf();DT();Ac();Xd=V0t});function W0t(e){return Qp(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,s&&Xd(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++n{BT();FT();$0e=W0t});function U0t(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||H0t;return e===r}var H0t,Jp,$T=W(()=>{H0t=Object.prototype;Jp=U0t});function Y0t(e,t){for(var r=-1,n=Array(e);++r{G0e=Y0t});function j0t(e){return Fa(e)&&al(e)==X0t}var X0t,Tz,V0e=W(()=>{Up();nh();X0t="[object Arguments]";Tz=j0t});var W0e,K0t,Z0t,Q0t,ih,$x=W(()=>{V0e();nh();W0e=Object.prototype,K0t=W0e.hasOwnProperty,Z0t=W0e.propertyIsEnumerable,Q0t=Tz((function(){return arguments})())?Tz:function(e){return Fa(e)&&K0t.call(e,"callee")&&!Z0t.call(e,"callee")},ih=Q0t});function J0t(){return!1}var H0e,U0e=W(()=>{H0e=J0t});var j0e,Y0e,ept,X0e,tpt,rpt,ah,zx=W(()=>{mu();U0e();j0e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Y0e=j0e&&typeof module=="object"&&module&&!module.nodeType&&module,ept=Y0e&&Y0e.exports===j0e,X0e=ept?wa.Buffer:void 0,tpt=X0e?X0e.isBuffer:void 0,rpt=tpt||H0e,ah=rpt});function Apt(e){return Fa(e)&&Fx(e.length)&&!!Yi[al(e)]}var npt,ipt,apt,spt,opt,lpt,cpt,upt,hpt,fpt,dpt,ppt,mpt,gpt,ypt,vpt,xpt,bpt,wpt,kpt,Tpt,Cpt,Spt,Ept,Yi,K0e,Z0e=W(()=>{Up();B7();nh();npt="[object Arguments]",ipt="[object Array]",apt="[object Boolean]",spt="[object Date]",opt="[object Error]",lpt="[object Function]",cpt="[object Map]",upt="[object Number]",hpt="[object Object]",fpt="[object RegExp]",dpt="[object Set]",ppt="[object String]",mpt="[object WeakMap]",gpt="[object ArrayBuffer]",ypt="[object DataView]",vpt="[object Float32Array]",xpt="[object Float64Array]",bpt="[object Int8Array]",wpt="[object Int16Array]",kpt="[object Int32Array]",Tpt="[object Uint8Array]",Cpt="[object Uint8ClampedArray]",Spt="[object Uint16Array]",Ept="[object Uint32Array]",Yi={};Yi[vpt]=Yi[xpt]=Yi[bpt]=Yi[wpt]=Yi[kpt]=Yi[Tpt]=Yi[Cpt]=Yi[Spt]=Yi[Ept]=!0;Yi[npt]=Yi[ipt]=Yi[gpt]=Yi[apt]=Yi[ypt]=Yi[spt]=Yi[opt]=Yi[lpt]=Yi[cpt]=Yi[upt]=Yi[hpt]=Yi[fpt]=Yi[dpt]=Yi[ppt]=Yi[mpt]=!1;K0e=Apt});function _pt(e){return function(t){return e(t)}}var em,zT=W(()=>{em=_pt});var Q0e,GT,Rpt,Cz,Lpt,jd,F7=W(()=>{fz();Q0e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,GT=Q0e&&typeof module=="object"&&module&&!module.nodeType&&module,Rpt=GT&>.exports===Q0e,Cz=Rpt&&R7.process,Lpt=(function(){try{var e=GT&>.require&>.require("util").types;return e||Cz&&Cz.binding&&Cz.binding("util")}catch{}})(),jd=Lpt});var J0e,Ipt,tm,qT=W(()=>{Z0e();zT();F7();J0e=jd&&jd.isTypedArray,Ipt=J0e?em(J0e):K0e,tm=Ipt});function Dpt(e,t){var r=wn(e),n=!r&&ih(e),i=!r&&!n&&ah(e),a=!r&&!n&&!i&&tm(e),s=r||n||i||a,o=s?G0e(e.length,String):[],l=o.length;for(var u in e)(t||Npt.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||jp(u,l)))&&o.push(u);return o}var Mpt,Npt,$7,Sz=W(()=>{q0e();$x();Ya();zx();DT();qT();Mpt=Object.prototype,Npt=Mpt.hasOwnProperty;$7=Dpt});function Opt(e,t){return function(r){return e(t(r))}}var z7,Ez=W(()=>{z7=Opt});var Ppt,epe,tpe=W(()=>{Ez();Ppt=z7(Object.keys,Object),epe=Ppt});function $pt(e){if(!Jp(e))return epe(e);var t=[];for(var r in Object(e))Fpt.call(e,r)&&r!="constructor"&&t.push(r);return t}var Bpt,Fpt,Gx,G7=W(()=>{$T();tpe();Bpt=Object.prototype,Fpt=Bpt.hasOwnProperty;Gx=$pt});function zpt(e){return Ds(e)?$7(e):Gx(e)}var ka,Kd=W(()=>{Sz();G7();tf();ka=zpt});function Gpt(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var rpe,npe=W(()=>{rpe=Gpt});function Wpt(e){if(!Pi(e))return rpe(e);var t=Jp(e),r=[];for(var n in e)n=="constructor"&&(t||!Vpt.call(e,n))||r.push(n);return r}var qpt,Vpt,ipe,ape=W(()=>{Ac();$T();npe();qpt=Object.prototype,Vpt=qpt.hasOwnProperty;ipe=Wpt});function Hpt(e){return Ds(e)?$7(e,!0):ipe(e)}var Wl,rm=W(()=>{Sz();ape();tf();Wl=Hpt});function Xpt(e,t){if(wn(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ec(e)?!0:Ypt.test(e)||!Upt.test(e)||t!=null&&e in Object(t)}var Upt,Ypt,qx,q7=W(()=>{Ya();X1();Upt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ypt=/^\w*$/;qx=Xpt});var jpt,Zd,VT=W(()=>{Xp();jpt=ql(Object,"create"),Zd=jpt});function Kpt(){this.__data__=Zd?Zd(null):{},this.size=0}var spe,ope=W(()=>{VT();spe=Kpt});function Zpt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var lpe,cpe=W(()=>{lpe=Zpt});function tmt(e){var t=this.__data__;if(Zd){var r=t[e];return r===Qpt?void 0:r}return emt.call(t,e)?t[e]:void 0}var Qpt,Jpt,emt,upe,hpe=W(()=>{VT();Qpt="__lodash_hash_undefined__",Jpt=Object.prototype,emt=Jpt.hasOwnProperty;upe=tmt});function imt(e){var t=this.__data__;return Zd?t[e]!==void 0:nmt.call(t,e)}var rmt,nmt,fpe,dpe=W(()=>{VT();rmt=Object.prototype,nmt=rmt.hasOwnProperty;fpe=imt});function smt(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Zd&&t===void 0?amt:t,this}var amt,ppe,mpe=W(()=>{VT();amt="__lodash_hash_undefined__";ppe=smt});function Vx(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{ope();cpe();hpe();dpe();mpe();Vx.prototype.clear=spe;Vx.prototype.delete=lpe;Vx.prototype.get=upe;Vx.prototype.has=fpe;Vx.prototype.set=ppe;Az=Vx});function omt(){this.__data__=[],this.size=0}var ype,vpe=W(()=>{ype=omt});function lmt(e,t){for(var r=e.length;r--;)if(gu(e[r][0],t))return r;return-1}var nm,WT=W(()=>{j1();nm=lmt});function hmt(e){var t=this.__data__,r=nm(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():umt.call(t,r,1),--this.size,!0}var cmt,umt,xpe,bpe=W(()=>{WT();cmt=Array.prototype,umt=cmt.splice;xpe=hmt});function fmt(e){var t=this.__data__,r=nm(t,e);return r<0?void 0:t[r][1]}var wpe,kpe=W(()=>{WT();wpe=fmt});function dmt(e){return nm(this.__data__,e)>-1}var Tpe,Cpe=W(()=>{WT();Tpe=dmt});function pmt(e,t){var r=this.__data__,n=nm(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Spe,Epe=W(()=>{WT();Spe=pmt});function Wx(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{vpe();bpe();kpe();Cpe();Epe();Wx.prototype.clear=ype;Wx.prototype.delete=xpe;Wx.prototype.get=wpe;Wx.prototype.has=Tpe;Wx.prototype.set=Spe;im=Wx});var mmt,am,V7=W(()=>{Xp();mu();mmt=ql(wa,"Map"),am=mmt});function gmt(){this.size=0,this.__data__={hash:new Az,map:new(am||im),string:new Az}}var Ape,_pe=W(()=>{gpe();HT();V7();Ape=gmt});function ymt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Rpe,Lpe=W(()=>{Rpe=ymt});function vmt(e,t){var r=e.__data__;return Rpe(t)?r[typeof t=="string"?"string":"hash"]:r.map}var sm,UT=W(()=>{Lpe();sm=vmt});function xmt(e){var t=sm(this,e).delete(e);return this.size-=t?1:0,t}var Ipe,Mpe=W(()=>{UT();Ipe=xmt});function bmt(e){return sm(this,e).get(e)}var Npe,Dpe=W(()=>{UT();Npe=bmt});function wmt(e){return sm(this,e).has(e)}var Ope,Ppe=W(()=>{UT();Ope=wmt});function kmt(e,t){var r=sm(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Bpe,Fpe=W(()=>{UT();Bpe=kmt});function Hx(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{_pe();Mpe();Dpe();Ppe();Fpe();Hx.prototype.clear=Ape;Hx.prototype.delete=Ipe;Hx.prototype.get=Npe;Hx.prototype.has=Ope;Hx.prototype.set=Bpe;K1=Hx});function _z(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Tmt);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var s=e.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(_z.Cache||K1),r}var Tmt,$pe,zpe=W(()=>{W7();Tmt="Expected a function";_z.Cache=K1;$pe=_z});function Smt(e){var t=$pe(e,function(n){return r.size===Cmt&&r.clear(),n}),r=t.cache;return t}var Cmt,Gpe,qpe=W(()=>{zpe();Cmt=500;Gpe=Smt});var Emt,Amt,_mt,Vpe,Wpe=W(()=>{qpe();Emt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Amt=/\\(\\)?/g,_mt=Gpe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Emt,function(r,n,i,a){t.push(i?a.replace(Amt,"$1"):n||r)}),t}),Vpe=_mt});function Rmt(e){return e==null?"":e0e(e)}var H7,Rz=W(()=>{t0e();H7=Rmt});function Lmt(e,t){return wn(e)?e:qx(e,t)?[e]:Vpe(H7(e))}var om,YT=W(()=>{Ya();q7();Wpe();Rz();om=Lmt});function Mmt(e){if(typeof e=="string"||Ec(e))return e;var t=e+"";return t=="0"&&1/e==-Imt?"-0":t}var Imt,rf,Ux=W(()=>{X1();Imt=1/0;rf=Mmt});function Nmt(e,t){t=om(t,e);for(var r=0,n=t.length;e!=null&&r{YT();Ux();lm=Nmt});function Dmt(e,t,r){var n=e==null?void 0:lm(e,t);return n===void 0?r:n}var Hpe,Upe=W(()=>{XT();Hpe=Dmt});function Omt(e,t){for(var r=-1,n=t.length,i=e.length;++r{Yx=Omt});function Pmt(e){return wn(e)||ih(e)||!!(Ype&&e&&e[Ype])}var Ype,Xpe,jpe=W(()=>{Y1();$x();Ya();Ype=Ns?Ns.isConcatSpreadable:void 0;Xpe=Pmt});function Kpe(e,t,r,n,i){var a=-1,s=e.length;for(r||(r=Xpe),i||(i=[]);++a0&&r(o)?t>1?Kpe(o,t-1,r,n,i):Yx(i,o):n||(i[i.length]=o)}return i}var Xx,Y7=W(()=>{U7();jpe();Xx=Kpe});function Bmt(e){var t=e==null?0:e.length;return t?Xx(e,1):[]}var yu,Lz=W(()=>{Y7();yu=Bmt});function Fmt(e){return N7(P7(e,void 0,yu),e+"")}var Zpe,Qpe=W(()=>{Lz();kz();xz();Zpe=Fmt});var $mt,jx,X7=W(()=>{Ez();$mt=z7(Object.getPrototypeOf,Object),jx=$mt});function Hmt(e){if(!Fa(e)||al(e)!=zmt)return!1;var t=jx(e);if(t===null)return!0;var r=Vmt.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Jpe.call(r)==Wmt}var zmt,Gmt,qmt,Jpe,Vmt,Wmt,eme,tme=W(()=>{Up();X7();nh();zmt="[object Object]",Gmt=Function.prototype,qmt=Object.prototype,Jpe=Gmt.toString,Vmt=qmt.hasOwnProperty,Wmt=Jpe.call(Object);eme=Hmt});function egt(e){return Jmt.test(e)}var Umt,Ymt,Xmt,jmt,Kmt,Zmt,Qmt,Jmt,rme,nme=W(()=>{Umt="\\ud800-\\udfff",Ymt="\\u0300-\\u036f",Xmt="\\ufe20-\\ufe2f",jmt="\\u20d0-\\u20ff",Kmt=Ymt+Xmt+jmt,Zmt="\\ufe0e\\ufe0f",Qmt="\\u200d",Jmt=RegExp("["+Qmt+Umt+Kmt+Zmt+"]");rme=egt});function tgt(e,t,r,n){var i=-1,a=e==null?0:e.length;for(n&&a&&(r=e[++i]);++i{ime=tgt});function rgt(){this.__data__=new im,this.size=0}var sme,ome=W(()=>{HT();sme=rgt});function ngt(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var lme,cme=W(()=>{lme=ngt});function igt(e){return this.__data__.get(e)}var ume,hme=W(()=>{ume=igt});function agt(e){return this.__data__.has(e)}var fme,dme=W(()=>{fme=agt});function ogt(e,t){var r=this.__data__;if(r instanceof im){var n=r.__data__;if(!am||n.length{HT();V7();W7();sgt=200;pme=ogt});function Kx(e){var t=this.__data__=new im(e);this.size=t.size}var nf,jT=W(()=>{HT();ome();cme();hme();dme();mme();Kx.prototype.clear=sme;Kx.prototype.delete=lme;Kx.prototype.get=ume;Kx.prototype.has=fme;Kx.prototype.set=pme;nf=Kx});function lgt(e,t){return e&&ef(t,ka(t),e)}var gme,yme=W(()=>{Bx();Kd();gme=lgt});function cgt(e,t){return e&&ef(t,Wl(t),e)}var vme,xme=W(()=>{Bx();rm();vme=cgt});function hgt(e,t){if(t)return e.slice();var r=e.length,n=kme?kme(r):new e.constructor(r);return e.copy(n),n}var Tme,bme,ugt,wme,kme,j7,Iz=W(()=>{mu();Tme=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bme=Tme&&typeof module=="object"&&module&&!module.nodeType&&module,ugt=bme&&bme.exports===Tme,wme=ugt?wa.Buffer:void 0,kme=wme?wme.allocUnsafe:void 0;j7=hgt});function fgt(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r{K7=fgt});function dgt(){return[]}var Z7,Nz=W(()=>{Z7=dgt});var pgt,mgt,Cme,ggt,Zx,Q7=W(()=>{Mz();Nz();pgt=Object.prototype,mgt=pgt.propertyIsEnumerable,Cme=Object.getOwnPropertySymbols,ggt=Cme?function(e){return e==null?[]:(e=Object(e),K7(Cme(e),function(t){return mgt.call(e,t)}))}:Z7,Zx=ggt});function ygt(e,t){return ef(e,Zx(e),t)}var Sme,Eme=W(()=>{Bx();Q7();Sme=ygt});var vgt,xgt,J7,Dz=W(()=>{U7();X7();Q7();Nz();vgt=Object.getOwnPropertySymbols,xgt=vgt?function(e){for(var t=[];e;)Yx(t,Zx(e)),e=jx(e);return t}:Z7,J7=xgt});function bgt(e,t){return ef(e,J7(e),t)}var Ame,_me=W(()=>{Bx();Dz();Ame=bgt});function wgt(e,t,r){var n=t(e);return wn(e)?n:Yx(n,r(e))}var e8,Oz=W(()=>{U7();Ya();e8=wgt});function kgt(e){return e8(e,ka,Zx)}var KT,Pz=W(()=>{Oz();Q7();Kd();KT=kgt});function Tgt(e){return e8(e,Wl,J7)}var Rme,Lme=W(()=>{Oz();Dz();rm();Rme=Tgt});var Cgt,t8,Ime=W(()=>{Xp();mu();Cgt=ql(wa,"DataView"),t8=Cgt});var Sgt,r8,Mme=W(()=>{Xp();mu();Sgt=ql(wa,"Promise"),r8=Sgt});var Egt,cm,Bz=W(()=>{Xp();mu();Egt=ql(wa,"Set"),cm=Egt});var Nme,Agt,Dme,Ome,Pme,Bme,_gt,Rgt,Lgt,Igt,Mgt,Z1,_c,Q1=W(()=>{Ime();V7();Mme();Bz();v0e();Up();mz();Nme="[object Map]",Agt="[object Object]",Dme="[object Promise]",Ome="[object Set]",Pme="[object WeakMap]",Bme="[object DataView]",_gt=Yd(t8),Rgt=Yd(am),Lgt=Yd(r8),Igt=Yd(cm),Mgt=Yd(I7),Z1=al;(t8&&Z1(new t8(new ArrayBuffer(1)))!=Bme||am&&Z1(new am)!=Nme||r8&&Z1(r8.resolve())!=Dme||cm&&Z1(new cm)!=Ome||I7&&Z1(new I7)!=Pme)&&(Z1=function(e){var t=al(e),r=t==Agt?e.constructor:void 0,n=r?Yd(r):"";if(n)switch(n){case _gt:return Bme;case Rgt:return Nme;case Lgt:return Dme;case Igt:return Ome;case Mgt:return Pme}return t});_c=Z1});function Ogt(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&Dgt.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Ngt,Dgt,Fme,$me=W(()=>{Ngt=Object.prototype,Dgt=Ngt.hasOwnProperty;Fme=Ogt});var Pgt,Qx,Fz=W(()=>{mu();Pgt=wa.Uint8Array,Qx=Pgt});function Bgt(e){var t=new e.constructor(e.byteLength);return new Qx(t).set(new Qx(e)),t}var Jx,n8=W(()=>{Fz();Jx=Bgt});function Fgt(e,t){var r=t?Jx(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var zme,Gme=W(()=>{n8();zme=Fgt});function zgt(e){var t=new e.constructor(e.source,$gt.exec(e));return t.lastIndex=e.lastIndex,t}var $gt,qme,Vme=W(()=>{$gt=/\w*$/;qme=zgt});function Ggt(e){return Hme?Object(Hme.call(e)):{}}var Wme,Hme,Ume,Yme=W(()=>{Y1();Wme=Ns?Ns.prototype:void 0,Hme=Wme?Wme.valueOf:void 0;Ume=Ggt});function qgt(e,t){var r=t?Jx(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var i8,$z=W(()=>{n8();i8=qgt});function l1t(e,t,r){var n=e.constructor;switch(t){case Zgt:return Jx(e);case Vgt:case Wgt:return new n(+e);case Qgt:return zme(e,r);case Jgt:case e1t:case t1t:case r1t:case n1t:case i1t:case a1t:case s1t:case o1t:return i8(e,r);case Hgt:return new n;case Ugt:case jgt:return new n(e);case Ygt:return qme(e);case Xgt:return new n;case Kgt:return Ume(e)}}var Vgt,Wgt,Hgt,Ugt,Ygt,Xgt,jgt,Kgt,Zgt,Qgt,Jgt,e1t,t1t,r1t,n1t,i1t,a1t,s1t,o1t,Xme,jme=W(()=>{n8();Gme();Vme();Yme();$z();Vgt="[object Boolean]",Wgt="[object Date]",Hgt="[object Map]",Ugt="[object Number]",Ygt="[object RegExp]",Xgt="[object Set]",jgt="[object String]",Kgt="[object Symbol]",Zgt="[object ArrayBuffer]",Qgt="[object DataView]",Jgt="[object Float32Array]",e1t="[object Float64Array]",t1t="[object Int8Array]",r1t="[object Int16Array]",n1t="[object Int32Array]",i1t="[object Uint8Array]",a1t="[object Uint8ClampedArray]",s1t="[object Uint16Array]",o1t="[object Uint32Array]";Xme=l1t});function c1t(e){return typeof e.constructor=="function"&&!Jp(e)?b0e(jx(e)):{}}var a8,zz=W(()=>{w0e();X7();$T();a8=c1t});function h1t(e){return Fa(e)&&_c(e)==u1t}var u1t,Kme,Zme=W(()=>{Q1();nh();u1t="[object Map]";Kme=h1t});var Qme,f1t,Jme,ege=W(()=>{Zme();zT();F7();Qme=jd&&jd.isMap,f1t=Qme?em(Qme):Kme,Jme=f1t});function p1t(e){return Fa(e)&&_c(e)==d1t}var d1t,tge,rge=W(()=>{Q1();nh();d1t="[object Set]";tge=p1t});var nge,m1t,ige,age=W(()=>{rge();zT();F7();nge=jd&&jd.isSet,m1t=nge?em(nge):tge,ige=m1t});function s8(e,t,r,n,i,a){var s,o=t&g1t,l=t&y1t,u=t&v1t;if(r&&(s=i?r(e,n,i,a):r(e)),s!==void 0)return s;if(!Pi(e))return e;var h=wn(e);if(h){if(s=Fme(e),!o)return M7(e,s)}else{var f=_c(e),d=f==oge||f==T1t;if(ah(e))return j7(e,o);if(f==lge||f==sge||d&&!i){if(s=l||d?{}:a8(e),!o)return l?Ame(e,vme(s,e)):Sme(e,gme(s,e))}else{if(!Bi[f])return i?e:{};s=Xme(e,f,o)}}a||(a=new nf);var p=a.get(e);if(p)return p;a.set(e,s),ige(e)?e.forEach(function(y){s.add(s8(y,t,r,y,e,a))}):Jme(e)&&e.forEach(function(y,v){s.set(v,s8(y,t,r,v,e,a))});var m=u?l?Rme:KT:l?Wl:ka,g=h?void 0:m(e);return D7(g||e,function(y,v){g&&(v=y,y=e[v]),Zp(s,v,s8(y,t,r,v,e,a))}),s}var g1t,y1t,v1t,sge,x1t,b1t,w1t,k1t,oge,T1t,C1t,S1t,lge,E1t,A1t,_1t,R1t,L1t,I1t,M1t,N1t,D1t,O1t,P1t,B1t,F1t,$1t,z1t,G1t,Bi,o8,Gz=W(()=>{jT();bz();PT();yme();xme();Iz();gz();Eme();_me();Pz();Lme();Q1();$me();jme();zz();Ya();zx();ege();Ac();age();Kd();rm();g1t=1,y1t=2,v1t=4,sge="[object Arguments]",x1t="[object Array]",b1t="[object Boolean]",w1t="[object Date]",k1t="[object Error]",oge="[object Function]",T1t="[object GeneratorFunction]",C1t="[object Map]",S1t="[object Number]",lge="[object Object]",E1t="[object RegExp]",A1t="[object Set]",_1t="[object String]",R1t="[object Symbol]",L1t="[object WeakMap]",I1t="[object ArrayBuffer]",M1t="[object DataView]",N1t="[object Float32Array]",D1t="[object Float64Array]",O1t="[object Int8Array]",P1t="[object Int16Array]",B1t="[object Int32Array]",F1t="[object Uint8Array]",$1t="[object Uint8ClampedArray]",z1t="[object Uint16Array]",G1t="[object Uint32Array]",Bi={};Bi[sge]=Bi[x1t]=Bi[I1t]=Bi[M1t]=Bi[b1t]=Bi[w1t]=Bi[N1t]=Bi[D1t]=Bi[O1t]=Bi[P1t]=Bi[B1t]=Bi[C1t]=Bi[S1t]=Bi[lge]=Bi[E1t]=Bi[A1t]=Bi[_1t]=Bi[R1t]=Bi[F1t]=Bi[$1t]=Bi[z1t]=Bi[G1t]=!0;Bi[k1t]=Bi[oge]=Bi[L1t]=!1;o8=s8});function V1t(e){return o8(e,q1t)}var q1t,qz,cge=W(()=>{Gz();q1t=4;qz=V1t});function U1t(e){return o8(e,W1t|H1t)}var W1t,H1t,Vz,uge=W(()=>{Gz();W1t=1,H1t=4;Vz=U1t});function X1t(e){return this.__data__.set(e,Y1t),this}var Y1t,hge,fge=W(()=>{Y1t="__lodash_hash_undefined__";hge=X1t});function j1t(e){return this.__data__.has(e)}var dge,pge=W(()=>{dge=j1t});function l8(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new K1;++t{W7();fge();pge();l8.prototype.add=l8.prototype.push=hge;l8.prototype.has=dge;c8=l8});function K1t(e,t){for(var r=-1,n=e==null?0:e.length;++r{mge=K1t});function Z1t(e,t){return e.has(t)}var u8,Hz=W(()=>{u8=Z1t});function eyt(e,t,r,n,i,a){var s=r&Q1t,o=e.length,l=t.length;if(o!=l&&!(s&&l>o))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,d=!0,p=r&J1t?new c8:void 0;for(a.set(e,t),a.set(t,e);++f{Wz();gge();Hz();Q1t=1,J1t=2;h8=eyt});function tyt(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var yge,vge=W(()=>{yge=tyt});function ryt(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var eb,f8=W(()=>{eb=ryt});function gyt(e,t,r,n,i,a,s){switch(r){case myt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case pyt:return!(e.byteLength!=t.byteLength||!a(new Qx(e),new Qx(t)));case ayt:case syt:case cyt:return gu(+e,+t);case oyt:return e.name==t.name&&e.message==t.message;case uyt:case fyt:return e==t+"";case lyt:var o=yge;case hyt:var l=n&nyt;if(o||(o=eb),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;n|=iyt,s.set(e,t);var h=h8(o(e),o(t),n,i,a,s);return s.delete(e),h;case dyt:if(Yz)return Yz.call(e)==Yz.call(t)}return!1}var nyt,iyt,ayt,syt,oyt,lyt,cyt,uyt,hyt,fyt,dyt,pyt,myt,xge,Yz,bge,wge=W(()=>{Y1();Fz();j1();Uz();vge();f8();nyt=1,iyt=2,ayt="[object Boolean]",syt="[object Date]",oyt="[object Error]",lyt="[object Map]",cyt="[object Number]",uyt="[object RegExp]",hyt="[object Set]",fyt="[object String]",dyt="[object Symbol]",pyt="[object ArrayBuffer]",myt="[object DataView]",xge=Ns?Ns.prototype:void 0,Yz=xge?xge.valueOf:void 0;bge=gyt});function byt(e,t,r,n,i,a){var s=r&yyt,o=KT(e),l=o.length,u=KT(t),h=u.length;if(l!=h&&!s)return!1;for(var f=l;f--;){var d=o[f];if(!(s?d in t:xyt.call(t,d)))return!1}var p=a.get(e),m=a.get(t);if(p&&m)return p==t&&m==e;var g=!0;a.set(e,t),a.set(t,e);for(var y=s;++f{Pz();yyt=1,vyt=Object.prototype,xyt=vyt.hasOwnProperty;kge=byt});function Tyt(e,t,r,n,i,a){var s=wn(e),o=wn(t),l=s?Sge:_c(e),u=o?Sge:_c(t);l=l==Cge?d8:l,u=u==Cge?d8:u;var h=l==d8,f=u==d8,d=l==u;if(d&&ah(e)){if(!ah(t))return!1;s=!0,h=!1}if(d&&!h)return a||(a=new nf),s||tm(e)?h8(e,t,r,n,i,a):bge(e,t,l,r,n,i,a);if(!(r&wyt)){var p=h&&Ege.call(e,"__wrapped__"),m=f&&Ege.call(t,"__wrapped__");if(p||m){var g=p?e.value():e,y=m?t.value():t;return a||(a=new nf),i(g,y,r,n,a)}}return d?(a||(a=new nf),kge(e,t,r,n,i,a)):!1}var wyt,Cge,Sge,d8,kyt,Ege,Age,_ge=W(()=>{jT();Uz();wge();Tge();Q1();Ya();zx();qT();wyt=1,Cge="[object Arguments]",Sge="[object Array]",d8="[object Object]",kyt=Object.prototype,Ege=kyt.hasOwnProperty;Age=Tyt});function Rge(e,t,r,n,i){return e===t?!0:e==null||t==null||!Fa(e)&&!Fa(t)?e!==e&&t!==t:Age(e,t,r,n,Rge,i)}var p8,Xz=W(()=>{_ge();nh();p8=Rge});function Eyt(e,t,r,n){var i=r.length,a=i,s=!n;if(e==null)return!a;for(e=Object(e);i--;){var o=r[i];if(s&&o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++i{jT();Xz();Cyt=1,Syt=2;Lge=Eyt});function Ayt(e){return e===e&&!Pi(e)}var m8,jz=W(()=>{Ac();m8=Ayt});function _yt(e){for(var t=ka(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,m8(i)]}return t}var Mge,Nge=W(()=>{jz();Kd();Mge=_yt});function Ryt(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var g8,Kz=W(()=>{g8=Ryt});function Lyt(e){var t=Mge(e);return t.length==1&&t[0][2]?g8(t[0][0],t[0][1]):function(r){return r===e||Lge(r,e,t)}}var Dge,Oge=W(()=>{Ige();Nge();Kz();Dge=Lyt});function Iyt(e,t){return e!=null&&t in Object(e)}var Pge,Bge=W(()=>{Pge=Iyt});function Myt(e,t,r){t=om(t,e);for(var n=-1,i=t.length,a=!1;++n{YT();$x();Ya();DT();B7();Ux();y8=Myt});function Nyt(e,t){return e!=null&&y8(e,t,Pge)}var v8,Qz=W(()=>{Bge();Zz();v8=Nyt});function Pyt(e,t){return qx(e)&&m8(t)?g8(rf(e),t):function(r){var n=Hpe(r,e);return n===void 0&&n===t?v8(r,e):p8(t,n,Dyt|Oyt)}}var Dyt,Oyt,Fge,$ge=W(()=>{Xz();Upe();Qz();q7();jz();Kz();Ux();Dyt=1,Oyt=2;Fge=Pyt});function Byt(e){return function(t){return t?.[e]}}var x8,Jz=W(()=>{x8=Byt});function Fyt(e){return function(t){return lm(t,e)}}var zge,Gge=W(()=>{XT();zge=Fyt});function $yt(e){return qx(e)?x8(rf(e)):zge(e)}var qge,Vge=W(()=>{Jz();Gge();q7();Ux();qge=$yt});function zyt(e){return typeof e=="function"?e:e==null?Gl:typeof e=="object"?wn(e)?Fge(e[0],e[1]):Dge(e):qge(e)}var Po,Qd=W(()=>{Oge();$ge();Yp();Ya();Vge();Po=zyt});function Gyt(e){return function(t,r,n){for(var i=-1,a=Object(t),s=n(t),o=s.length;o--;){var l=s[e?o:++i];if(r(a[l],l,a)===!1)break}return t}}var Wge,Hge=W(()=>{Wge=Gyt});var qyt,tb,b8=W(()=>{Hge();qyt=Wge(),tb=qyt});function Vyt(e,t){return e&&tb(e,t,ka)}var rb,w8=W(()=>{b8();Kd();rb=Vyt});function Wyt(e,t){return function(r,n){if(r==null)return r;if(!Ds(r))return e(r,n);for(var i=r.length,a=t?i:-1,s=Object(r);(t?a--:++a{tf();Uge=Wyt});var Hyt,um,ZT=W(()=>{w8();Yge();Hyt=Uge(rb),um=Hyt});var Uyt,hm,eG=W(()=>{mu();Uyt=function(){return wa.Date.now()},hm=Uyt});function Kyt(e,t,r){var n,i,a,s,o,l,u=0,h=!1,f=!1,d=!0;if(typeof e!="function")throw new TypeError(Yyt);t=MT(t)||0,Pi(r)&&(h=!!r.leading,f="maxWait"in r,a=f?Xyt(MT(r.maxWait)||0,t):a,d="trailing"in r?!!r.trailing:d);function p(k){var S=n,E=i;return n=i=void 0,u=k,s=e.apply(E,S),s}function m(k){return u=k,o=setTimeout(v,t),h?p(k):s}function g(k){var S=k-l,E=k-u,I=t-S;return f?jyt(I,a-E):I}function y(k){var S=k-l,E=k-u;return l===void 0||S>=t||S<0||f&&E>=a}function v(){var k=hm();if(y(k))return x(k);o=setTimeout(v,g(k))}function x(k){return o=void 0,d&&n?p(k):(n=i=void 0,s)}function w(){o!==void 0&&clearTimeout(o),u=0,n=l=i=o=void 0}function C(){return o===void 0?s:x(hm())}function T(){var k=hm(),S=y(k);if(n=arguments,i=this,l=k,S){if(o===void 0)return m(l);if(f)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return T.cancel=w,T.flush=C,T}var Yyt,Xyt,jyt,tG,Xge=W(()=>{Ac();eG();dz();Yyt="Expected a function",Xyt=Math.max,jyt=Math.min;tG=Kyt});var jge,Zyt,Qyt,rG,Kge=W(()=>{BT();j1();FT();rm();jge=Object.prototype,Zyt=jge.hasOwnProperty,Qyt=Qp(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&Xd(t[0],t[1],i)&&(n=1);++r{OT();j1();QT=Jyt});function evt(e){return Fa(e)&&Ds(e)}var k8,iG=W(()=>{tf();nh();k8=evt});function tvt(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var JT,aG=W(()=>{JT=tvt});function rvt(e){return ef(e,Wl(e))}var Zge,Qge=W(()=>{Bx();rm();Zge=rvt});function nvt(e,t,r,n,i,a,s){var o=JT(e,r),l=JT(t,r),u=s.get(l);if(u){QT(e,r,u);return}var h=a?a(o,l,r+"",e,t,s):void 0,f=h===void 0;if(f){var d=wn(l),p=!d&&ah(l),m=!d&&!p&&tm(l);h=l,d||p||m?wn(o)?h=o:k8(o)?h=M7(o):p?(f=!1,h=j7(l,!0)):m?(f=!1,h=i8(l,!0)):h=[]:eme(l)||ih(l)?(h=o,ih(o)?h=Zge(o):(!Pi(o)||Jh(o))&&(h=a8(l))):f=!1}f&&(s.set(l,h),i(h,l,n,a,s),s.delete(l)),QT(e,r,h)}var Jge,e1e=W(()=>{nG();Iz();$z();gz();zz();$x();Ya();iG();zx();NT();Ac();tme();qT();aG();Qge();Jge=nvt});function t1e(e,t,r,n,i){e!==t&&tb(t,function(a,s){if(i||(i=new nf),Pi(a))Jge(e,t,s,r,t1e,n,i);else{var o=n?n(JT(e,s),a,s+"",e,t,i):void 0;o===void 0&&(o=a),QT(e,s,o)}},Wl)}var r1e,n1e=W(()=>{jT();nG();b8();e1e();Ac();rm();aG();r1e=t1e});function ivt(e,t,r){for(var n=-1,i=e==null?0:e.length;++n{i1e=ivt});function avt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var fm,s1e=W(()=>{fm=avt});function svt(e){return typeof e=="function"?e:Gl}var nb,T8=W(()=>{Yp();nb=svt});function ovt(e,t){var r=wn(e)?D7:um;return r(e,nb(t))}var ft,sG=W(()=>{bz();ZT();T8();Ya();ft=ovt});var o1e=W(()=>{sG()});function lvt(e,t){var r=[];return um(e,function(n,i,a){t(n,i,a)&&r.push(n)}),r}var l1e,c1e=W(()=>{ZT();l1e=lvt});function cvt(e,t){var r=wn(e)?K7:l1e;return r(e,Po(t,3))}var sl,u1e=W(()=>{Mz();c1e();Qd();Ya();sl=cvt});function uvt(e){return function(t,r,n){var i=Object(t);if(!Ds(t)){var a=Po(r,3);t=ka(t),r=function(o){return a(i[o],o,i)}}var s=e(t,r,n);return s>-1?i[a?t[s]:s]:void 0}}var h1e,f1e=W(()=>{Qd();tf();Kd();h1e=uvt});function fvt(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var i=r==null?0:l0e(r);return i<0&&(i=hvt(n+i,0)),O7(e,Po(t,3),i)}var hvt,d1e,p1e=W(()=>{wz();Qd();c0e();hvt=Math.max;d1e=fvt});var dvt,ib,m1e=W(()=>{f1e();p1e();dvt=h1e(d1e),ib=dvt});function pvt(e,t){var r=-1,n=Ds(e)?Array(e.length):[];return um(e,function(i,a,s){n[++r]=t(i,a,s)}),n}var C8,oG=W(()=>{ZT();tf();C8=pvt});function mvt(e,t){var r=wn(e)?Qh:C8;return r(e,Po(t,3))}var Kn,g1e=W(()=>{IT();Qd();oG();Ya();Kn=mvt});function gvt(e,t){return e==null?e:tb(e,nb(t),Wl)}var lG,y1e=W(()=>{b8();T8();rm();lG=gvt});function yvt(e,t){return e&&rb(e,nb(t))}var cG,v1e=W(()=>{w8();T8();cG=yvt});function vvt(e,t){return e>t}var x1e,b1e=W(()=>{x1e=vvt});function wvt(e,t){return e!=null&&bvt.call(e,t)}var xvt,bvt,w1e,k1e=W(()=>{xvt=Object.prototype,bvt=xvt.hasOwnProperty;w1e=wvt});function kvt(e,t){return e!=null&&y8(e,t,w1e)}var e5,T1e=W(()=>{k1e();Zz();e5=kvt});function Cvt(e){return typeof e=="string"||!wn(e)&&Fa(e)&&al(e)==Tvt}var Tvt,C1e,S1e=W(()=>{Up();Ya();nh();Tvt="[object String]";C1e=Cvt});function Svt(e,t){return Qh(t,function(r){return e[r]})}var E1e,A1e=W(()=>{IT();E1e=Svt});function Evt(e){return e==null?[]:E1e(e,ka(e))}var Rc,_1e=W(()=>{A1e();Kd();Rc=Evt});function Ivt(e){if(e==null)return!0;if(Ds(e)&&(wn(e)||typeof e=="string"||typeof e.splice=="function"||ah(e)||tm(e)||ih(e)))return!e.length;var t=_c(e);if(t==Avt||t==_vt)return!e.size;if(Jp(e))return!Gx(e).length;for(var r in e)if(Lvt.call(e,r))return!1;return!0}var Avt,_vt,Rvt,Lvt,S8,R1e=W(()=>{G7();Q1();$x();Ya();tf();zx();$T();qT();Avt="[object Map]",_vt="[object Set]",Rvt=Object.prototype,Lvt=Rvt.hasOwnProperty;S8=Ivt});function Mvt(e){return e===void 0}var Si,L1e=W(()=>{Si=Mvt});function Nvt(e,t){return e{E8=Nvt});function Dvt(e,t){var r={};return t=Po(t,3),rb(e,function(n,i,a){Kp(r,i,t(n,i,a))}),r}var J1,I1e=W(()=>{OT();w8();Qd();J1=Dvt});function Ovt(e,t,r){for(var n=-1,i=e.length;++n{X1();ab=Ovt});function Pvt(e){return e&&e.length?ab(e,Gl,x1e):void 0}var Hl,M1e=W(()=>{A8();b1e();Yp();Hl=Pvt});var Bvt,sb,N1e=W(()=>{n1e();z0e();Bvt=$0e(function(e,t,r){r1e(e,t,r)}),sb=Bvt});function Fvt(e){return e&&e.length?ab(e,Gl,E8):void 0}var Jd,D1e=W(()=>{A8();uG();Yp();Jd=Fvt});function $vt(e,t){return e&&e.length?ab(e,Po(t,2),E8):void 0}var ey,O1e=W(()=>{A8();Qd();uG();ey=$vt});function zvt(e,t,r,n){if(!Pi(e))return e;t=om(t,e);for(var i=-1,a=t.length,s=a-1,o=e;o!=null&&++i{PT();YT();DT();Ac();Ux();P1e=zvt});function Gvt(e,t,r){for(var n=-1,i=t.length,a={};++n{XT();B1e();YT();F1e=Gvt});function qvt(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var z1e,G1e=W(()=>{z1e=qvt});function Vvt(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,a=Ec(e),s=t!==void 0,o=t===null,l=t===t,u=Ec(t);if(!o&&!u&&!a&&e>t||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&e{X1();q1e=Vvt});function Wvt(e,t,r){for(var n=-1,i=e.criteria,a=t.criteria,s=i.length,o=r.length;++n=o)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return e.index-t.index}var W1e,H1e=W(()=>{V1e();W1e=Wvt});function Hvt(e,t,r){t.length?t=Qh(t,function(a){return wn(a)?function(s){return lm(s,a.length===1?a[0]:a)}:a}):t=[Gl];var n=-1;t=Qh(t,em(Po));var i=C8(e,function(a,s,o){var l=Qh(t,function(u){return u(a)});return{criteria:l,index:++n,value:a}});return z1e(i,function(a,s){return W1e(a,s,r)})}var U1e,Y1e=W(()=>{IT();XT();Qd();oG();G1e();zT();H1e();Yp();Ya();U1e=Hvt});var Uvt,X1e,j1e=W(()=>{Jz();Uvt=x8("length"),X1e=Uvt});function i2t(e){for(var t=K1e.lastIndex=0;K1e.test(e);)++t;return t}var Z1e,Yvt,Xvt,jvt,Kvt,Zvt,Qvt,hG,fG,Jvt,Q1e,J1e,eye,e2t,tye,rye,t2t,r2t,n2t,K1e,nye,iye=W(()=>{Z1e="\\ud800-\\udfff",Yvt="\\u0300-\\u036f",Xvt="\\ufe20-\\ufe2f",jvt="\\u20d0-\\u20ff",Kvt=Yvt+Xvt+jvt,Zvt="\\ufe0e\\ufe0f",Qvt="["+Z1e+"]",hG="["+Kvt+"]",fG="\\ud83c[\\udffb-\\udfff]",Jvt="(?:"+hG+"|"+fG+")",Q1e="[^"+Z1e+"]",J1e="(?:\\ud83c[\\udde6-\\uddff]){2}",eye="[\\ud800-\\udbff][\\udc00-\\udfff]",e2t="\\u200d",tye=Jvt+"?",rye="["+Zvt+"]?",t2t="(?:"+e2t+"(?:"+[Q1e,J1e,eye].join("|")+")"+rye+tye+")*",r2t=rye+tye+t2t,n2t="(?:"+[Q1e+hG+"?",hG,J1e,eye,Qvt].join("|")+")",K1e=RegExp(fG+"(?="+fG+")|"+n2t+r2t,"g");nye=i2t});function a2t(e){return rme(e)?nye(e):X1e(e)}var aye,sye=W(()=>{j1e();nme();iye();aye=a2t});function s2t(e,t){return F1e(e,t,function(r,n){return v8(e,n)})}var oye,lye=W(()=>{$1e();Qz();oye=s2t});var o2t,ty,cye=W(()=>{lye();Qpe();o2t=Zpe(function(e,t){return e==null?{}:oye(e,t)}),ty=o2t});function u2t(e,t,r,n){for(var i=-1,a=c2t(l2t((t-e)/(r||1)),0),s=Array(a);a--;)s[n?a:++i]=e,e+=r;return s}var l2t,c2t,uye,hye=W(()=>{l2t=Math.ceil,c2t=Math.max;uye=u2t});function h2t(e){return function(t,r,n){return n&&typeof n!="number"&&Xd(t,r,n)&&(r=n=void 0),t=Ox(t),r===void 0?(r=t,t=0):r=Ox(r),n=n===void 0?t{hye();FT();pz();fye=h2t});var f2t,vu,pye=W(()=>{dye();f2t=fye(),vu=f2t});function d2t(e,t,r,n,i){return i(e,function(a,s,o){r=n?(n=!1,a):t(r,a,s,o)}),r}var mye,gye=W(()=>{mye=d2t});function p2t(e,t,r){var n=wn(e)?ime:mye,i=arguments.length<3;return n(e,Po(t,4),r,i,um)}var af,yye=W(()=>{ame();ZT();Qd();gye();Ya();af=p2t});function y2t(e){if(e==null)return 0;if(Ds(e))return C1e(e)?aye(e):e.length;var t=_c(e);return t==m2t||t==g2t?e.size:Gx(e).length}var m2t,g2t,dG,vye=W(()=>{G7();Q1();tf();S1e();sye();m2t="[object Map]",g2t="[object Set]";dG=y2t});var v2t,sf,xye=W(()=>{Y7();Y1e();BT();FT();v2t=Qp(function(e,t){if(e==null)return[];var r=t.length;return r>1&&Xd(e,t[0],t[1])?t=[]:r>2&&Xd(t[0],t[1],t[2])&&(t=[t[0]]),U1e(e,Xx(t,1),[])}),sf=v2t});var x2t,b2t,bye,wye=W(()=>{Bz();S0e();f8();x2t=1/0,b2t=cm&&1/eb(new cm([,-0]))[1]==x2t?function(e){return new cm(e)}:C0e,bye=b2t});function k2t(e,t,r){var n=-1,i=P0e,a=e.length,s=!0,o=[],l=o;if(r)s=!1,i=i1e;else if(a>=w2t){var u=t?null:bye(e);if(u)return eb(u);s=!1,i=u8,l=new c8}else l=t?[]:o;e:for(;++n{Wz();B0e();a1e();Hz();wye();f8();w2t=200;kye=k2t});var T2t,pG,Cye=W(()=>{Y7();BT();Tye();iG();T2t=Qp(function(e){return kye(Xx(e,1,k8,!0))}),pG=T2t});function S2t(e){var t=++C2t;return H7(e)+t}var C2t,ry,Sye=W(()=>{Rz();C2t=0;ry=S2t});function E2t(e,t,r){for(var n=-1,i=e.length,a=t.length,s={};++n{Eye=E2t});function A2t(e,t){return Eye(e||[],t||[],Zp)}var _8,_ye=W(()=>{PT();Aye();_8=A2t});var si=W(()=>{cge();uge();yz();Xge();Kge();o1e();u1e();m1e();Lz();sG();y1e();v1e();T1e();Ya();R1e();NT();L1e();Kd();s1e();g1e();I1e();M1e();N1e();D1e();O1e();eG();cye();pye();yye();vye();xye();Cye();Sye();_1e();_ye();});var y2e,b,wm,hr=W(()=>{y2e=Object.defineProperty,b=(e,t)=>y2e(e,"name",{value:t,configurable:!0}),wm=(e,t)=>{for(var r in t)y2e(e,r,{get:t[r],enumerable:!0})}});var hA=Jo((Tq,Cq)=>{(function(e,t){typeof Tq=="object"&&typeof Cq<"u"?Cq.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(Tq,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",a="minute",s="hour",o="day",l="week",u="month",h="quarter",f="year",d="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(R){var A=["th","st","nd","rd"],N=R%100;return"["+R+(A[(N-20)%10]||A[N]||A[0])+"]"}},v=function(R,A,N){var M=String(R);return!M||M.length>=A?R:""+Array(A+1-M.length).join(N)+R},x={s:v,z:function(R){var A=-R.utcOffset(),N=Math.abs(A),M=Math.floor(N/60),D=N%60;return(A<=0?"+":"-")+v(M,2,"0")+":"+v(D,2,"0")},m:function R(A,N){if(A.date()1)return R(P[0])}else{var $=A.name;C[$]=A,D=$}return!M&&D&&(w=D),D||!M&&w},E=function(R,A){if(k(R))return R.clone();var N=typeof A=="object"?A:{};return N.date=R,N.args=arguments,new L(N)},I=x;I.l=S,I.i=k,I.w=function(R,A){return E(R,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var L=(function(){function R(N){this.$L=S(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[T]=!0}var A=R.prototype;return A.parse=function(N){this.$d=(function(M){var D=M.date,B=M.utc;if(D===null)return new Date(NaN);if(I.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var P=D.match(m);if(P){var $=P[2]-1||0,F=(P[7]||"0").substring(0,3);return B?new Date(Date.UTC(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)):new Date(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)}}return new Date(D)})(N),this.init()},A.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},A.$utils=function(){return I},A.isValid=function(){return this.$d.toString()!==p},A.isSame=function(N,M){var D=E(N);return this.startOf(M)<=D&&D<=this.endOf(M)},A.isAfter=function(N,M){return E(N){hr();v2e=Ro(hA(),1),o0={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},se={trace:b((...e)=>{},"trace"),debug:b((...e)=>{},"debug"),info:b((...e)=>{},"info"),warn:b((...e)=>{},"warn"),error:b((...e)=>{},"error"),fatal:b((...e)=>{},"fatal")},d5=b(function(e="fatal"){let t=o0.fatal;typeof e=="string"?e.toLowerCase()in o0&&(t=o0[e]):typeof e=="number"&&(t=e),se.trace=()=>{},se.debug=()=>{},se.info=()=>{},se.warn=()=>{},se.error=()=>{},se.fatal=()=>{},t<=o0.fatal&&(se.fatal=console.error?console.error.bind(console,wu("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",wu("FATAL"))),t<=o0.error&&(se.error=console.error?console.error.bind(console,wu("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",wu("ERROR"))),t<=o0.warn&&(se.warn=console.warn?console.warn.bind(console,wu("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",wu("WARN"))),t<=o0.info&&(se.info=console.info?console.info.bind(console,wu("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",wu("INFO"))),t<=o0.debug&&(se.debug=console.debug?console.debug.bind(console,wu("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",wu("DEBUG"))),t<=o0.trace&&(se.trace=console.debug?console.debug.bind(console,wu("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",wu("TRACE")))},"setLogLevel"),wu=b(e=>`%c${(0,v2e.default)().format("ss.SSS")} : ${e} : `,"format")});var fA,x2e,b2e=W(()=>{fA={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{let t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<.16666666666666666?e+(t-e)*6*r:r<.5?t:r<.6666666666666666?e+(t-e)*(.6666666666666666-r)*6:e),hsl2rgb:({h:e,s:t,l:r},n)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;let i=r<.5?r*(1+t):r+t-r*t,a=2*r-i;switch(n){case"r":return fA.hue2rgb(a,i,e+.3333333333333333)*255;case"g":return fA.hue2rgb(a,i,e)*255;case"b":return fA.hue2rgb(a,i,e-.3333333333333333)*255}},rgb2hsl:({r:e,g:t,b:r},n)=>{e/=255,t/=255,r/=255;let i=Math.max(e,t,r),a=Math.min(e,t,r),s=(i+a)/2;if(n==="l")return s*100;if(i===a)return 0;let o=i-a,l=s>.5?o/(2-i-a):o/(i+a);if(n==="s")return l*100;switch(i){case e:return((t-r)/o+(t{Mbt={clamp:(e,t,r)=>t>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},w2e=Mbt});var Nbt,T2e,C2e=W(()=>{Nbt={dec2hex:e=>{let t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},T2e=Nbt});var Dbt,Cr,pf=W(()=>{b2e();k2e();C2e();Dbt={channel:x2e,lang:w2e,unit:T2e},Cr=Dbt});var l0,ps,p5=W(()=>{pf();l0={};for(let e=0;e<=255;e++)l0[e]=Cr.unit.dec2hex(e);ps={ALL:0,RGB:1,HSL:2}});var Sq,S2e,E2e=W(()=>{p5();Sq=class{constructor(){this.type=ps.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=ps.ALL}is(t){return this.type===t}},S2e=Sq});var Eq,A2e,_2e=W(()=>{pf();E2e();p5();Eq=class{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new S2e}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=ps.ALL,this}_ensureHSL(){let t=this.data,{h:r,s:n,l:i}=t;r===void 0&&(t.h=Cr.channel.rgb2hsl(t,"h")),n===void 0&&(t.s=Cr.channel.rgb2hsl(t,"s")),i===void 0&&(t.l=Cr.channel.rgb2hsl(t,"l"))}_ensureRGB(){let t=this.data,{r,g:n,b:i}=t;r===void 0&&(t.r=Cr.channel.hsl2rgb(t,"r")),n===void 0&&(t.g=Cr.channel.hsl2rgb(t,"g")),i===void 0&&(t.b=Cr.channel.hsl2rgb(t,"b"))}get r(){let t=this.data,r=t.r;return!this.type.is(ps.HSL)&&r!==void 0?r:(this._ensureHSL(),Cr.channel.hsl2rgb(t,"r"))}get g(){let t=this.data,r=t.g;return!this.type.is(ps.HSL)&&r!==void 0?r:(this._ensureHSL(),Cr.channel.hsl2rgb(t,"g"))}get b(){let t=this.data,r=t.b;return!this.type.is(ps.HSL)&&r!==void 0?r:(this._ensureHSL(),Cr.channel.hsl2rgb(t,"b"))}get h(){let t=this.data,r=t.h;return!this.type.is(ps.RGB)&&r!==void 0?r:(this._ensureRGB(),Cr.channel.rgb2hsl(t,"h"))}get s(){let t=this.data,r=t.s;return!this.type.is(ps.RGB)&&r!==void 0?r:(this._ensureRGB(),Cr.channel.rgb2hsl(t,"s"))}get l(){let t=this.data,r=t.l;return!this.type.is(ps.RGB)&&r!==void 0?r:(this._ensureRGB(),Cr.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(ps.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(ps.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(ps.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(ps.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(ps.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(ps.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}},A2e=Eq});var Obt,km,m5=W(()=>{_2e();Obt=new A2e({r:0,g:0,b:0,a:0},"transparent"),km=Obt});var R2e,oy,Aq=W(()=>{m5();p5();R2e={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;let t=e.match(R2e.re);if(!t)return;let r=t[1],n=parseInt(r,16),i=r.length,a=i%4===0,s=i>4,o=s?1:17,l=s?8:4,u=a?0:-1,h=s?255:15;return km.set({r:(n>>l*(u+3)&h)*o,g:(n>>l*(u+2)&h)*o,b:(n>>l*(u+1)&h)*o,a:a?(n&h)*o/255:1},e)},stringify:e=>{let{r:t,g:r,b:n,a:i}=e;return i<1?`#${l0[Math.round(t)]}${l0[Math.round(r)]}${l0[Math.round(n)]}${l0[Math.round(i*255)]}`:`#${l0[Math.round(t)]}${l0[Math.round(r)]}${l0[Math.round(n)]}`}},oy=R2e});var dA,g5,L2e=W(()=>{pf();m5();dA={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{let t=e.match(dA.hueRe);if(t){let[,r,n]=t;switch(n){case"grad":return Cr.channel.clamp.h(parseFloat(r)*.9);case"rad":return Cr.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Cr.channel.clamp.h(parseFloat(r)*360)}}return Cr.channel.clamp.h(parseFloat(e))},parse:e=>{let t=e.charCodeAt(0);if(t!==104&&t!==72)return;let r=e.match(dA.re);if(!r)return;let[,n,i,a,s,o]=r;return km.set({h:dA._hue2deg(n),s:Cr.channel.clamp.s(parseFloat(i)),l:Cr.channel.clamp.l(parseFloat(a)),a:s?Cr.channel.clamp.a(o?parseFloat(s)/100:parseFloat(s)):1},e)},stringify:e=>{let{h:t,s:r,l:n,a:i}=e;return i<1?`hsla(${Cr.lang.round(t)}, ${Cr.lang.round(r)}%, ${Cr.lang.round(n)}%, ${i})`:`hsl(${Cr.lang.round(t)}, ${Cr.lang.round(r)}%, ${Cr.lang.round(n)}%)`}},g5=dA});var pA,_q,I2e=W(()=>{Aq();pA={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();let t=pA.colors[e];if(t)return oy.parse(t)},stringify:e=>{let t=oy.stringify(e);for(let r in pA.colors)if(pA.colors[r]===t)return r}},_q=pA});var M2e,y5,N2e=W(()=>{pf();m5();M2e={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{let t=e.charCodeAt(0);if(t!==114&&t!==82)return;let r=e.match(M2e.re);if(!r)return;let[,n,i,a,s,o,l,u,h]=r;return km.set({r:Cr.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Cr.channel.clamp.g(s?parseFloat(a)*2.55:parseFloat(a)),b:Cr.channel.clamp.b(l?parseFloat(o)*2.55:parseFloat(o)),a:u?Cr.channel.clamp.a(h?parseFloat(u)/100:parseFloat(u)):1},e)},stringify:e=>{let{r:t,g:r,b:n,a:i}=e;return i<1?`rgba(${Cr.lang.round(t)}, ${Cr.lang.round(r)}, ${Cr.lang.round(n)}, ${Cr.lang.round(i)})`:`rgb(${Cr.lang.round(t)}, ${Cr.lang.round(r)}, ${Cr.lang.round(n)})`}},y5=M2e});var Pbt,ms,c0=W(()=>{Aq();L2e();I2e();N2e();p5();Pbt={format:{keyword:_q,hex:oy,rgb:y5,rgba:y5,hsl:g5,hsla:g5},parse:e=>{if(typeof e!="string")return e;let t=oy.parse(e)||y5.parse(e)||g5.parse(e)||_q.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(ps.HSL)||e.data.r===void 0?g5.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?y5.stringify(e):oy.stringify(e)},ms=Pbt});var Bbt,mA,Rq=W(()=>{pf();c0();Bbt=(e,t)=>{let r=ms.parse(e);for(let n in t)r[n]=Cr.channel.clamp[n](t[n]);return ms.stringify(r)},mA=Bbt});var Fbt,$a,Lq=W(()=>{pf();m5();c0();Rq();Fbt=(e,t,r=0,n=1)=>{if(typeof e!="number")return mA(e,{a:t});let i=km.set({r:Cr.channel.clamp.r(e),g:Cr.channel.clamp.g(t),b:Cr.channel.clamp.b(r),a:Cr.channel.clamp.a(n)});return ms.stringify(i)},$a=Fbt});var $bt,ly,D2e=W(()=>{pf();c0();$bt=(e,t)=>Cr.lang.round(ms.parse(e)[t]),ly=$bt});var zbt,O2e,P2e=W(()=>{pf();c0();zbt=e=>{let{r:t,g:r,b:n}=ms.parse(e),i=.2126*Cr.channel.toLinear(t)+.7152*Cr.channel.toLinear(r)+.0722*Cr.channel.toLinear(n);return Cr.lang.round(i)},O2e=zbt});var Gbt,B2e,F2e=W(()=>{P2e();Gbt=e=>O2e(e)>=.5,B2e=Gbt});var qbt,ci,$2e=W(()=>{F2e();qbt=e=>!B2e(e),ci=qbt});var Vbt,gb,gA=W(()=>{pf();c0();Vbt=(e,t,r)=>{let n=ms.parse(e),i=n[t],a=Cr.channel.clamp[t](i+r);return i!==a&&(n[t]=a),ms.stringify(n)},gb=Vbt});var Wbt,st,z2e=W(()=>{gA();Wbt=(e,t)=>gb(e,"l",t),st=Wbt});var Hbt,ot,G2e=W(()=>{gA();Hbt=(e,t)=>gb(e,"l",-t),ot=Hbt});var Ubt,yA,q2e=W(()=>{gA();Ubt=(e,t)=>gb(e,"a",-t),yA=Ubt});var Ybt,me,V2e=W(()=>{c0();Rq();Ybt=(e,t)=>{let r=ms.parse(e),n={};for(let i in t)t[i]&&(n[i]=r[i]+t[i]);return mA(e,n)},me=Ybt});var Xbt,W2e,H2e=W(()=>{c0();Lq();Xbt=(e,t,r=50)=>{let{r:n,g:i,b:a,a:s}=ms.parse(e),{r:o,g:l,b:u,a:h}=ms.parse(t),f=r/100,d=f*2-1,p=s-h,g=((d*p===-1?d:(d+p)/(1+d*p))+1)/2,y=1-g,v=n*g+o*y,x=i*g+l*y,w=a*g+u*y,C=s*f+h*(1-f);return $a(v,x,w,C)},W2e=Xbt});var jbt,Je,U2e=W(()=>{c0();H2e();jbt=(e,t=100)=>{let r=ms.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,W2e(r,e,t)},Je=jbt});var Y2e=W(()=>{Lq();D2e();$2e();z2e();G2e();q2e();V2e();U2e()});var Ka=W(()=>{Y2e()});function X2e(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r1?r-1:0),i=1;i2&&arguments[2]!==void 0?arguments[2]:w5;if(j2e&&j2e(e,null),!Cm(t))return e;let n=t.length;for(;n--;){let i=t[n];if(typeof i=="string"){let a=r(i);a!==i&&(t4t(t)||(t[n]=a),i=a)}e[i]=!0}return e}function u4t(e){for(let t=0;t0&&arguments[0]!==void 0?arguments[0]:A4t(),t=Gt=>uxe(Gt);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==mf.document||!e.Element)return t.isSupported=!1,t;let r=e.document,n=r,i=n.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,s=e.Node,o=e.Element,l=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let h=e.DOMParser,f=e.trustedTypes,d=o.prototype,p=gf(d,"cloneNode"),m=gf(d,"remove"),g=gf(d,"nextSibling"),y=gf(d,"childNodes"),v=gf(d,"parentNode"),x=gf(d,"shadowRoot"),w=gf(d,"attributes"),C=s&&s.prototype?gf(s.prototype,"nodeType"):null,T=s&&s.prototype?gf(s.prototype,"nodeName"):null;if(typeof a=="function"){let Gt=r.createElement("template");Gt.content&&Gt.content.ownerDocument&&(r=Gt.content.ownerDocument)}let k,S="",E,I=!1,L=0,O=function(){if(L>0)throw cy('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},R=function($e){O(),L++;try{return k.createHTML($e)}finally{L--}},A=function($e){O(),L++;try{return k.createScriptURL($e)}finally{L--}},N=function(){return I||(E=_4t(f,i),I=!0),E},M=r,D=M.implementation,B=M.createNodeIterator,P=M.createDocumentFragment,$=M.getElementsByTagName,F=n.importNode,q=oxe();t.isSupported=typeof lxe=="function"&&typeof v=="function"&&D&&D.createHTMLDocument!==void 0;let G=m4t,z=g4t,H=y4t,j=v4t,J=x4t,U=b4t,le=w4t,ee=T4t,ue=axe,ae=null,oe=$n({},[...txe,...Nq,...Dq,...Oq,...rxe]),Re=null,Te=$n({},[...nxe,...Pq,...ixe,...vA]),Oe=Object.seal(vb(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),qe=null,Ge=null,fe=Object.seal(vb(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ce=!0,_e=!0,de=!1,ie=!0,Q=!1,he=!0,xe=!1,ce=!1,ge=null,Ie=null,ye=!1,ne=!1,V=!1,pe=!1,K=!0,ve=!1,Z="user-content-",je=!0,Ne=!1,ze={},Fe=null,Ke=$n({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Ve=null,tt=$n({},["audio","video","img","source","image","track"]),We=null,rt=$n({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Se="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",De="http://www.w3.org/1999/xhtml",mt=De,Tt=!1,jt=null,_t=$n({},[Se,Et,De],Mq),Rt=ro(["mi","mo","mn","ms","mtext"]),bt=$n({},Rt),ke=ro(["annotation-xml"]),yt=$n({},ke),xt=$n({},["title","style","font","a","script"]),it=null,Me=["application/xhtml+xml","text/html"],ut="text/html",at=null,dt=null,tr=r.createElement("form"),Vt=function($e){return $e instanceof RegExp||$e instanceof Function},rr=function(){let $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(dt&&dt===$e)return;(!$e||typeof $e!="object")&&($e={}),$e=hl($e),it=Me.indexOf($e.PARSER_MEDIA_TYPE)===-1?ut:$e.PARSER_MEDIA_TYPE,at=it==="application/xhtml+xml"?Mq:w5,ae=Tm($e,"ALLOWED_TAGS",oe,{transform:at}),Re=Tm($e,"ALLOWED_ATTR",Te,{transform:at}),jt=Tm($e,"ALLOWED_NAMESPACES",_t,{transform:Mq}),We=Tm($e,"ADD_URI_SAFE_ATTR",rt,{transform:at,base:rt}),Ve=Tm($e,"ADD_DATA_URI_TAGS",tt,{transform:at,base:tt}),Fe=Tm($e,"FORBID_CONTENTS",Ke,{transform:at}),qe=Tm($e,"FORBID_TAGS",hl({}),{transform:at}),Ge=Tm($e,"FORBID_ATTR",hl({}),{transform:at}),ze=Os($e,"USE_PROFILES")?$e.USE_PROFILES&&typeof $e.USE_PROFILES=="object"?hl($e.USE_PROFILES):$e.USE_PROFILES:!1,Ce=$e.ALLOW_ARIA_ATTR!==!1,_e=$e.ALLOW_DATA_ATTR!==!1,de=$e.ALLOW_UNKNOWN_PROTOCOLS||!1,ie=$e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=$e.SAFE_FOR_TEMPLATES||!1,he=$e.SAFE_FOR_XML!==!1,xe=$e.WHOLE_DOCUMENT||!1,ne=$e.RETURN_DOM||!1,V=$e.RETURN_DOM_FRAGMENT||!1,pe=$e.RETURN_TRUSTED_TYPE||!1,ye=$e.FORCE_BODY||!1,K=$e.SANITIZE_DOM!==!1,ve=$e.SANITIZE_NAMED_PROPS||!1,je=$e.KEEP_CONTENT!==!1,Ne=$e.IN_PLACE||!1,ue=f4t($e.ALLOWED_URI_REGEXP)?$e.ALLOWED_URI_REGEXP:axe,mt=typeof $e.NAMESPACE=="string"?$e.NAMESPACE:De,bt=Os($e,"MATHML_TEXT_INTEGRATION_POINTS")&&$e.MATHML_TEXT_INTEGRATION_POINTS&&typeof $e.MATHML_TEXT_INTEGRATION_POINTS=="object"?hl($e.MATHML_TEXT_INTEGRATION_POINTS):$n({},Rt),yt=Os($e,"HTML_INTEGRATION_POINTS")&&$e.HTML_INTEGRATION_POINTS&&typeof $e.HTML_INTEGRATION_POINTS=="object"?hl($e.HTML_INTEGRATION_POINTS):$n({},ke);let nt=Os($e,"CUSTOM_ELEMENT_HANDLING")&&$e.CUSTOM_ELEMENT_HANDLING&&typeof $e.CUSTOM_ELEMENT_HANDLING=="object"?hl($e.CUSTOM_ELEMENT_HANDLING):vb(null);if(Oe=vb(null),Os(nt,"tagNameCheck")&&Vt(nt.tagNameCheck)&&(Oe.tagNameCheck=nt.tagNameCheck),Os(nt,"attributeNameCheck")&&Vt(nt.attributeNameCheck)&&(Oe.attributeNameCheck=nt.attributeNameCheck),Os(nt,"allowCustomizedBuiltInElements")&&typeof nt.allowCustomizedBuiltInElements=="boolean"&&(Oe.allowCustomizedBuiltInElements=nt.allowCustomizedBuiltInElements),no(Oe),Q&&(_e=!1),V&&(ne=!0),ze&&(ae=$n({},rxe),Re=vb(null),ze.html===!0&&($n(ae,txe),$n(Re,nxe)),ze.svg===!0&&($n(ae,Nq),$n(Re,Pq),$n(Re,vA)),ze.svgFilters===!0&&($n(ae,Dq),$n(Re,Pq),$n(Re,vA)),ze.mathMl===!0&&($n(ae,Oq),$n(Re,ixe),$n(Re,vA))),fe.tagCheck=null,fe.attributeCheck=null,Os($e,"ADD_TAGS")&&(typeof $e.ADD_TAGS=="function"?fe.tagCheck=$e.ADD_TAGS:Cm($e.ADD_TAGS)&&(ae===oe&&(ae=hl(ae)),$n(ae,$e.ADD_TAGS,at))),Os($e,"ADD_ATTR")&&(typeof $e.ADD_ATTR=="function"?fe.attributeCheck=$e.ADD_ATTR:Cm($e.ADD_ATTR)&&(Re===Te&&(Re=hl(Re)),$n(Re,$e.ADD_ATTR,at))),Os($e,"ADD_URI_SAFE_ATTR")&&Cm($e.ADD_URI_SAFE_ATTR)&&$n(We,$e.ADD_URI_SAFE_ATTR,at),Os($e,"FORBID_CONTENTS")&&Cm($e.FORBID_CONTENTS)&&(Fe===Ke&&(Fe=hl(Fe)),$n(Fe,$e.FORBID_CONTENTS,at)),Os($e,"ADD_FORBID_CONTENTS")&&Cm($e.ADD_FORBID_CONTENTS)&&(Fe===Ke&&(Fe=hl(Fe)),$n(Fe,$e.ADD_FORBID_CONTENTS,at)),je&&(ae["#text"]=!0),xe&&$n(ae,["html","head","body"]),ae.table&&($n(ae,["tbody"]),delete qe.tbody),$e.TRUSTED_TYPES_POLICY){if(typeof $e.TRUSTED_TYPES_POLICY.createHTML!="function")throw cy('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw cy('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let Ht=k;k=$e.TRUSTED_TYPES_POLICY;try{S=R("")}catch(er){throw k=Ht,er}}else $e.TRUSTED_TYPES_POLICY===null?(k=void 0,S=""):(k===void 0&&(k=N()),k&&typeof S=="string"&&(S=R("")));ro&&ro($e),dt=$e},Dr=$n({},[...Nq,...Dq,...d4t]),vr=$n({},[...Oq,...p4t]),Qt=function($e,nt,Ht){return nt.namespaceURI===De?$e==="svg":nt.namespaceURI===Se?$e==="svg"&&(Ht==="annotation-xml"||bt[Ht]):!!Dr[$e]},yr=function($e,nt,Ht){return nt.namespaceURI===De?$e==="math":nt.namespaceURI===Et?$e==="math"&&yt[Ht]:!!vr[$e]},lt=function($e,nt,Ht){return nt.namespaceURI===Et&&!yt[Ht]||nt.namespaceURI===Se&&!bt[Ht]?!1:!vr[$e]&&(xt[$e]||!Dr[$e])},pt=function($e){let nt=v($e);(!nt||!nt.tagName)&&(nt={namespaceURI:mt,tagName:"template"});let Ht=w5($e.tagName),er=w5(nt.tagName);return jt[$e.namespaceURI]?$e.namespaceURI===Et?Qt(Ht,nt,er):$e.namespaceURI===Se?yr(Ht,nt,er):$e.namespaceURI===De?lt(Ht,nt,er):!!(it==="application/xhtml+xml"&&jt[$e.namespaceURI]):!1},St=function($e){yb(t.removed,{element:$e});try{v($e).removeChild($e)}catch{if(m($e),!v($e))throw cy("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ir=function($e){let nt=y($e);if(nt){let er=[];v5(nt,yn=>{yb(er,yn)}),v5(er,yn=>{try{m(yn)}catch{}})}let Ht=w($e);if(Ht)for(let er=Ht.length-1;er>=0;--er){let yn=Ht[er],xn=yn&&yn.name;if(typeof xn=="string")try{$e.removeAttribute(xn)}catch{}}},ur=function($e,nt){try{yb(t.removed,{attribute:nt.getAttributeNode($e),from:nt})}catch{yb(t.removed,{attribute:null,from:nt})}if(nt.removeAttribute($e),$e==="is")if(ne||V)try{St(nt)}catch{}else try{nt.setAttribute($e,"")}catch{}},gn=function($e){let nt=w($e);if(nt)for(let Ht=nt.length-1;Ht>=0;--Ht){let er=nt[Ht],yn=er&&er.name;if(!(typeof yn!="string"||Re[at(yn)]))try{$e.removeAttribute(yn)}catch{}}},Fn=function($e){let nt=[$e];for(;nt.length>0;){let Ht=nt.pop();(C?C(Ht):Ht.nodeType)===mf.element&&gn(Ht);let yn=y(Ht);if(yn)for(let xn=yn.length-1;xn>=0;--xn)nt.push(yn[xn])}},jr=function($e){let nt=null,Ht=null;if(ye)$e=""+$e;else{let xn=Z2e($e,/^[\r\n\t ]+/);Ht=xn&&xn[0]}it==="application/xhtml+xml"&&mt===De&&($e=''+$e+"");let er=k?R($e):$e;if(mt===De)try{nt=new h().parseFromString(er,it)}catch{}if(!nt||!nt.documentElement){nt=D.createDocument(mt,"template",null);try{nt.documentElement.innerHTML=Tt?S:er}catch{}}let yn=nt.body||nt.documentElement;return $e&&Ht&&yn.insertBefore(r.createTextNode(Ht),yn.childNodes[0]||null),mt===De?$.call(nt,xe?"html":"body")[0]:xe?nt.documentElement:yn},Ft=function($e){return B.call($e.ownerDocument||$e,$e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},kt=function($e){return $e=x5($e,G," "),$e=x5($e,z," "),$e=x5($e,H," "),$e},zt=function($e){var nt;$e.normalize();let Ht=B.call($e.ownerDocument||$e,$e,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),er=Ht.nextNode();for(;er;)er.data=kt(er.data),er=Ht.nextNode();let yn=(nt=$e.querySelectorAll)===null||nt===void 0?void 0:nt.call($e,"template");yn&&v5(yn,xn=>{wt(xn.content)&&zt(xn.content)})},Wt=function($e){let nt=T?T($e):null;return typeof nt!="string"||at(nt)!=="form"?!1:typeof $e.nodeName!="string"||typeof $e.textContent!="string"||typeof $e.removeChild!="function"||$e.attributes!==w($e)||typeof $e.removeAttribute!="function"||typeof $e.setAttribute!="function"||typeof $e.namespaceURI!="string"||typeof $e.insertBefore!="function"||typeof $e.hasChildNodes!="function"||$e.nodeType!==C($e)||$e.childNodes!==y($e)},wt=function($e){if(!C||typeof $e!="object"||$e===null)return!1;try{return C($e)===mf.documentFragment}catch{return!1}},wr=function($e){if(!C||typeof $e!="object"||$e===null)return!1;try{return typeof C($e)=="number"}catch{return!1}};function Le(Gt,$e,nt){Gt.length!==0&&v5(Gt,Ht=>{Ht.call(t,$e,nt,dt)})}let Ri=function($e,nt){return!!(he&&$e.hasChildNodes()&&!wr($e.firstElementChild)&&to(sxe,$e.textContent)&&to(sxe,$e.innerHTML)||he&&$e.namespaceURI===De&&nt==="style"&&wr($e.firstElementChild)||$e.nodeType===mf.processingInstruction||he&&$e.nodeType===mf.comment&&to(C4t,$e.data))},Pe=function($e,nt){if(!qe[nt]&&Ad(nt)&&(Oe.tagNameCheck instanceof RegExp&&to(Oe.tagNameCheck,nt)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck(nt)))return!1;if(je&&!Fe[nt]){let Ht=v($e),er=y($e);if(er&&Ht){let yn=er.length;for(let xn=yn-1;xn>=0;--xn){let ii=Ne?er[xn]:p(er[xn],!0);Ht.insertBefore(ii,g($e))}}}return St($e),!0},qr=function($e){if(Le(q.beforeSanitizeElements,$e,null),Wt($e))return St($e),!0;let nt=at(T?T($e):$e.nodeName);if(Le(q.uponSanitizeElement,$e,{tagName:nt,allowedTags:ae}),Ri($e,nt))return St($e),!0;if(qe[nt]||!(fe.tagCheck instanceof Function&&fe.tagCheck(nt))&&!ae[nt])return Pe($e,nt);if((C?C($e):$e.nodeType)===mf.element&&!pt($e)||(nt==="noscript"||nt==="noembed"||nt==="noframes")&&to(S4t,$e.innerHTML))return St($e),!0;if(Q&&$e.nodeType===mf.text){let er=kt($e.textContent);$e.textContent!==er&&(yb(t.removed,{element:$e.cloneNode()}),$e.textContent=er)}return Le(q.afterSanitizeElements,$e,null),!1},Ha=function($e,nt,Ht){if(Ge[nt]||K&&(nt==="id"||nt==="name")&&(Ht in r||Ht in tr))return!1;let er=Re[nt]||fe.attributeCheck instanceof Function&&fe.attributeCheck(nt,$e);if(!(_e&&to(j,nt))){if(!(Ce&&to(J,nt))){if(er){if(!We[nt]){if(!to(ue,x5(Ht,le,""))){if(!((nt==="src"||nt==="xlink:href"||nt==="href")&&$e!=="script"&&Q2e(Ht,"data:")===0&&Ve[$e])){if(!(de&&!to(U,x5(Ht,le,"")))){if(Ht)return!1}}}}}else if(!(Ad($e)&&(Oe.tagNameCheck instanceof RegExp&&to(Oe.tagNameCheck,$e)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck($e))&&(Oe.attributeNameCheck instanceof RegExp&&to(Oe.attributeNameCheck,nt)||Oe.attributeNameCheck instanceof Function&&Oe.attributeNameCheck(nt,$e))||nt==="is"&&Oe.allowCustomizedBuiltInElements&&(Oe.tagNameCheck instanceof RegExp&&to(Oe.tagNameCheck,Ht)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck(Ht))))return!1}}return!0},Ku=$n({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ad=function($e){return!Ku[w5($e)]&&to(ee,$e)},Sp=function($e,nt,Ht,er){if(k&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Ht)switch(f.getAttributeType($e,nt)){case"TrustedHTML":return R(er);case"TrustedScriptURL":return A(er)}return er},X2=function($e,nt,Ht,er){try{Ht?$e.setAttributeNS(Ht,nt,er):$e.setAttribute(nt,er),Wt($e)?St($e):K2e(t.removed)}catch{ur(nt,$e)}},ta=function($e){Le(q.beforeSanitizeAttributes,$e,null);let nt=$e.attributes;if(!nt||Wt($e))return;let Ht={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Re,forceKeepAttr:void 0},er=nt.length,yn=at($e.nodeName);for(;er--;){let xn=nt[er],ii=xn.name,Da=xn.namespaceURI,_o=xn.value,Rs=at(ii),Ep=_o,Wi=ii==="value"?Ep:s4t(Ep);if(Ht.attrName=Rs,Ht.attrValue=Wi,Ht.keepAttr=!0,Ht.forceKeepAttr=void 0,Le(q.uponSanitizeAttribute,$e,Ht),Wi=Ht.attrValue,ve&&(Rs==="id"||Rs==="name")&&Q2e(Wi,Z)!==0&&(ur(ii,$e),Wi=Z+Wi),he&&to(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Wi)){ur(ii,$e);continue}if(Rs==="attributename"&&Z2e(Wi,"href")){ur(ii,$e);continue}if(!Ht.forceKeepAttr){if(!Ht.keepAttr){ur(ii,$e);continue}if(!ie&&to(E4t,Wi)){ur(ii,$e);continue}if(Q&&(Wi=kt(Wi)),!Ha(yn,Rs,Wi)){ur(ii,$e);continue}Wi=Sp(yn,Rs,Da,Wi),Wi!==Ep&&X2($e,ii,Da,Wi)}}Le(q.afterSanitizeAttributes,$e,null)},Qo=function($e){let nt=null,Ht=Ft($e);for(Le(q.beforeSanitizeShadowDOM,$e,null);nt=Ht.nextNode();)if(Le(q.uponSanitizeShadowNode,nt,null),qr(nt),ta(nt),wt(nt.content)&&Qo(nt.content),(C?C(nt):nt.nodeType)===mf.element){let yn=x(nt);wt(yn)&&(_d(yn),Qo(yn))}Le(q.afterSanitizeShadowDOM,$e,null)},_d=function($e){let nt=[{node:$e,shadow:null}];for(;nt.length>0;){let Ht=nt.pop();if(Ht.shadow){Qo(Ht.shadow);continue}let er=Ht.node,xn=(C?C(er):er.nodeType)===mf.element,ii=y(er);if(ii)for(let Da=ii.length-1;Da>=0;--Da)nt.push({node:ii[Da],shadow:null});if(xn){let Da=T?T(er):null;if(typeof Da=="string"&&at(Da)==="template"){let _o=er.content;wt(_o)&&nt.push({node:_o,shadow:null})}}if(xn){let Da=x(er);wt(Da)&&nt.push({node:null,shadow:Da},{node:Da,shadow:null})}}};return t.sanitize=function(Gt){let $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},nt=null,Ht=null,er=null,yn=null;if(Tt=!Gt,Tt&&(Gt=""),typeof Gt!="string"&&!wr(Gt)&&(Gt=h4t(Gt),typeof Gt!="string"))throw cy("dirty is not a string, aborting");if(!t.isSupported)return Gt;ce?(ae=ge,Re=Ie):rr($e),(q.uponSanitizeElement.length>0||q.uponSanitizeAttribute.length>0)&&(ae=hl(ae)),q.uponSanitizeAttribute.length>0&&(Re=hl(Re)),t.removed=[];let xn=Ne&&typeof Gt!="string"&&wr(Gt);if(xn){let _o=T?T(Gt):Gt.nodeName;if(typeof _o=="string"){let Rs=at(_o);if(!ae[Rs]||qe[Rs])throw cy("root node is forbidden and cannot be sanitized in-place")}if(Wt(Gt))throw cy("root node is clobbered and cannot be sanitized in-place");try{_d(Gt)}catch(Rs){throw Ir(Gt),Rs}}else if(wr(Gt))nt=jr(""),Ht=nt.ownerDocument.importNode(Gt,!0),Ht.nodeType===mf.element&&Ht.nodeName==="BODY"||Ht.nodeName==="HTML"?nt=Ht:nt.appendChild(Ht),_d(Ht);else{if(!ne&&!Q&&!xe&&Gt.indexOf("<")===-1)return k&&pe?R(Gt):Gt;if(nt=jr(Gt),!nt)return ne?null:pe?S:""}nt&&ye&&St(nt.firstChild);let ii=Ft(xn?Gt:nt);try{for(;er=ii.nextNode();)qr(er),ta(er),wt(er.content)&&Qo(er.content)}catch(_o){throw xn&&Ir(Gt),_o}if(xn)return v5(t.removed,_o=>{_o.element&&Fn(_o.element)}),Q&&zt(Gt),Gt;if(ne){if(Q&&zt(nt),V)for(yn=P.call(nt.ownerDocument);nt.firstChild;)yn.appendChild(nt.firstChild);else yn=nt;return(Re.shadowroot||Re.shadowrootmode)&&(yn=F.call(n,yn,!0)),yn}let Da=xe?nt.outerHTML:nt.innerHTML;return xe&&ae["!doctype"]&&nt.ownerDocument&&nt.ownerDocument.doctype&&nt.ownerDocument.doctype.name&&to(k4t,nt.ownerDocument.doctype.name)&&(Da=" +`+Da),Q&&(Da=kt(Da)),k&&pe?R(Da):Da},t.setConfig=function(){let Gt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};rr(Gt),ce=!0,ge=ae,Ie=Re},t.clearConfig=function(){dt=null,ce=!1,ge=null,Ie=null,k=E,S=""},t.isValidAttribute=function(Gt,$e,nt){dt||rr({});let Ht=at(Gt),er=at($e);return Ha(Ht,er,nt)},t.addHook=function(Gt,$e){typeof $e=="function"&&Os(q,Gt)&&yb(q[Gt],$e)},t.removeHook=function(Gt,$e){if(Os(q,Gt)){if($e!==void 0){let nt=i4t(q[Gt],$e);return nt===-1?void 0:a4t(q[Gt],nt,1)[0]}return K2e(q[Gt])}},t.removeHooks=function(Gt){Os(q,Gt)&&(q[Gt]=[])},t.removeAllHooks=function(){q=oxe()},t}var lxe,j2e,t4t,r4t,n4t,ro,no,vb,cxe,Bq,Fq,v5,i4t,K2e,yb,a4t,Cm,w5,Mq,Z2e,x5,Q2e,s4t,o4t,l4t,J2e,exe,Os,b5,to,cy,txe,Nq,Dq,d4t,Oq,p4t,rxe,nxe,Pq,ixe,vA,m4t,g4t,y4t,v4t,x4t,axe,b4t,w4t,k4t,T4t,sxe,C4t,S4t,E4t,mf,A4t,_4t,oxe,Tm,Yl,xb=W(()=>{lxe=Object.entries,j2e=Object.setPrototypeOf,t4t=Object.isFrozen,r4t=Object.getPrototypeOf,n4t=Object.getOwnPropertyDescriptor,ro=Object.freeze,no=Object.seal,vb=Object.create,cxe=typeof Reflect<"u"&&Reflect,Bq=cxe.apply,Fq=cxe.construct;ro||(ro=function(t){return t});no||(no=function(t){return t});Bq||(Bq=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a1?r-1:0),i=1;i"u"?null:Za(BigInt.prototype.toString),exe=typeof Symbol>"u"?null:Za(Symbol.prototype.toString),Os=Za(Object.prototype.hasOwnProperty),b5=Za(Object.prototype.toString),to=Za(RegExp.prototype.test),cy=c4t(TypeError);txe=ro(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Nq=ro(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Dq=ro(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),d4t=ro(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Oq=ro(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),p4t=ro(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),rxe=ro(["#text"]),nxe=ro(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Pq=ro(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ixe=ro(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),vA=ro(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),m4t=no(/{{[\w\W]*|^[\w\W]*}}/g),g4t=no(/<%[\w\W]*|^[\w\W]*%>/g),y4t=no(/\${[\w\W]*/g),v4t=no(/^data-[\-\w.\u00B7-\uFFFF]+$/),x4t=no(/^aria-[\-\w]+$/),axe=no(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),b4t=no(/^(?:\w+script|data):/i),w4t=no(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),k4t=no(/^html$/i),T4t=no(/^[a-z][.\w]*(-[.\w]+)+$/i),sxe=no(/<[/\w!]/g),C4t=no(/<[/\w]/g),S4t=no(/<\/no(script|embed|frames)/i),E4t=no(/\/>/i),mf={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},A4t=function(){return typeof window>"u"?null:window},_4t=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null,i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(n=r.getAttribute(i));let a="dompurify"+(n?"#"+n:"");try{return t.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},oxe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Tm=function(t,r,n,i){return Os(t,r)&&Cm(t[r])?$n(i.base?hl(i.base):{},t[r],i.transform):n};Yl=uxe()});var Ube={};Tr(Ube,{ParseError:()=>Bt,SETTINGS_SCHEMA:()=>IA,__defineFunction:()=>nr,__defineMacro:()=>Ee,__defineSymbol:()=>Y,__domTree:()=>Hbe,__parse:()=>Gbe,__renderToDomTree:()=>QA,__renderToHTMLTree:()=>Vbe,__setFontMetrics:()=>Zxe,default:()=>ykt,render:()=>NV,renderToString:()=>zbe,version:()=>Wbe});function O4t(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function P4t(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return O4t(t)}function B4t(e,t,r,n){var i=r[t];e[t]=i!==void 0?n.processor?n.processor(i):i:P4t(n)}function W4t(e){for(var t=0;t=i[0]&&e<=i[1])return r.name}return null}function Uxe(e){for(var t=0;t=LA[t]&&e<=LA[t+1])return!0;return!1}function twt(e){return"toText"in e}function awt(e){if(e instanceof pl)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function swt(e){if(e instanceof Rm)return e;throw new Error("Expected span but got "+String(e)+".")}function Zxe(e,t){xf[e]=t}function wV(e,t,r){if(!xf[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),i=xf[t][n];if(!i&&e[0]in fxe&&(n=fxe[e[0]].charCodeAt(0),i=xf[t][n]),!i&&r==="text"&&Uxe(n)&&(i=xf[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}function lwt(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!$q[t]){var r=$q[t]={cssEmPerMu:xA.quad[t]/18};for(var n in xA)xA.hasOwnProperty(n)&&(r[n]=xA[n][t])}return $q[t]}function Y(e,t,r,n,i,a){ia[e][i]={font:t,group:r,replace:n},a&&n&&(ia[e][n]=ia[e][i])}function nr(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l0&&(a.push(SA(s,t)),s=[]),a.push(n[o]));s.length>0&&a.push(SA(s,t));var u;r?(u=SA(ys(r,t,!0),t),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=Dt(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=Yt(h.height+h.depth),h.depth&&(f.style.verticalAlign=Yt(-h.depth))}return h}function abe(e){return new Am(e)}function qq(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Ca&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof Ca&&r.text===","}else return!1}function kxe(e,t,r,n,i){var a=Oc(e,r),s;a.length===1&&a[0]instanceof Pt&&Twt.has(a[0].type)?s=a[0]:s=new Pt("mrow",a);var o=new Pt("annotation",[new Ca(t)]);o.setAttribute("encoding","application/x-tex");var l=new Pt("semantics",[s,o]),u=new Pt("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return Dt([h],[u])}function Dwt(e){return e in Mwt}function Tn(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function HA(e){var t=UA(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function UA(e){return e&&(e.type==="atom"||Nwt.hasOwnProperty(e.type))?e:null}function ube(e,t){var r=ys(e.body,t,!0);return Dt([e.mclass],r,t)}function hbe(e,t){var r,n=Oc(e.body,t);return e.mclass==="minner"?r=new Pt("mpadded",n):e.mclass==="mord"?e.isCharacterBox?(r=n[0],r.type="mi"):r=new Pt("mi",n):(e.isCharacterBox?(r=n[0],r.type="mo"):r=new Pt("mo",n),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}function Fwt(e,t,r){var n=Pwt[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},s=r.callFunction("\\Big",[a],[]),o=r.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[i,s,o]};return r.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function $wt(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new Bt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var n=[],i=[n],a=0;aAV".includes(u))for(var f=0;f<2;f++){for(var d=!0,p=l+1;pAV=|." after @',s[l]);var m=Fwt(u,h,e),g={type:"styling",body:[m],mode:"math",style:"display",resetFont:!0};n.push(g),o=Sxe()}a%2===0?n.push(o):n.shift(),n=[],i.push(n)}e.gullet.endGroup(),e.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}function _xe(e){return"isMiddle"in e}function XA(e,t){var r=UA(e);if(r&&Kwt.has(r.text))return r;throw r?new Bt("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new Bt("Invalid delimiter type '"+e.type+"'",e)}function Rxe(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}function wf(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l1||!h)&&g.pop(),v.length{Bt=class e extends Error{constructor(t,r){var n="KaTeX parse error: "+t,i,a,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;i=s.start,a=s.end,i===o.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=o.slice(i,a).replace(/[^]/g,"$&\u0332"),u;i>15?u="\u2026"+o.slice(i-15,i):u=o.slice(0,i);var h;a+15e.replace(R4t,"-$1").toLowerCase(),I4t={"&":"&",">":">","<":"<",'"':""","'":"'"},M4t=/[&><"']/g,zo=e=>String(e).replace(M4t,t=>I4t[t]),RA=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?RA(e.body[0]):e:e.type==="font"?RA(e.body):e,N4t=new Set(["mathord","textord","atom"]),d0=e=>N4t.has(RA(e).type),D4t=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},IA={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};E5=class{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r of Object.keys(IA)){var n=IA[r];n&&B4t(this,r,t,n)}}reportNonstrict(t,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(t,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new Bt("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,n){var i=this.strict;if(typeof i=="function")try{i=i(t,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var r=D4t(t.url);if(r==null)return!1;t.protocol=r}var n=typeof this.trust=="function"?this.trust(t):this.trust;return!!n}},yf=class{constructor(t,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=n}sup(){return vf[F4t[this.id]]}sub(){return vf[$4t[this.id]]}fracNum(){return vf[z4t[this.id]]}fracDen(){return vf[G4t[this.id]]}cramp(){return vf[q4t[this.id]]}text(){return vf[V4t[this.id]]}isTight(){return this.size>=2}},xV=0,MA=1,wb=2,f0=3,A5=4,ku=5,kb=6,dl=7,vf=[new yf(xV,0,!1),new yf(MA,0,!0),new yf(wb,1,!1),new yf(f0,1,!0),new yf(A5,2,!1),new yf(ku,2,!0),new yf(kb,3,!1),new yf(dl,3,!0)],F4t=[A5,ku,A5,ku,kb,dl,kb,dl],$4t=[ku,ku,ku,ku,dl,dl,dl,dl],z4t=[wb,f0,A5,ku,kb,dl,kb,dl],G4t=[f0,f0,ku,ku,dl,dl,dl,dl],q4t=[MA,MA,f0,f0,ku,ku,dl,dl],V4t=[xV,MA,wb,f0,wb,f0,wb,f0],pn={DISPLAY:vf[xV],TEXT:vf[wb],SCRIPT:vf[A5],SCRIPTSCRIPT:vf[kb]},Jq=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];LA=[];Jq.forEach(e=>e.blocks.forEach(t=>LA.push(...t)));gs=e=>e+" "+e,bb=80,H4t=function(t,r){return"M95,"+(622+t+r)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 @@ -11,7 +11,7 @@ c5.3,-9.3,12,-14,20,-14 H400000v`+(40+t)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},q4t=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 +M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},U4t=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+t/2.084+" -"+t+` @@ -21,7 +21,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5, c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},V4t=function(t,r){return"M983 "+(10+t+r)+` +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Y4t=function(t,r){return"M983 "+(10+t+r)+` l`+t/3.13+" -"+t+` c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 @@ -30,7 +30,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},W4t=function(t,r){return"M424,"+(2398+t+r)+` +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},X4t=function(t,r){return"M424,"+(2398+t+r)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 @@ -40,18 +40,18 @@ v`+(40+t)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+r+` -h400000v`+(40+t)+"h-400000z"},H4t=function(t,r){return"M473,"+(2713+t+r)+` +h400000v`+(40+t)+"h-400000z"},j4t=function(t,r){return"M473,"+(2713+t+r)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},U4t=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},Y4t=function(t,r,n){var i=n-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` +606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},K4t=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},Z4t=function(t,r,n){var i=n-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},X4t=function(t,r,n){r=1e3*r;var i="";switch(t){case"sqrtMain":i=G4t(r,bb);break;case"sqrtSize1":i=q4t(r,bb);break;case"sqrtSize2":i=V4t(r,bb);break;case"sqrtSize3":i=W4t(r,bb);break;case"sqrtSize4":i=H4t(r,bb);break;case"sqrtTall":i=Y4t(r,bb,n)}return i},j4t=function(t,r){switch(t){case"\u239C":return gs("M291 0 H417 V"+r+" H291z");case"\u2223":return gs("M145 0 H188 V"+r+" H145z");case"\u2225":return gs("M145 0 H188 V"+r+" H145z")+gs("M367 0 H410 V"+r+" H367z");case"\u239F":return gs("M457 0 H583 V"+r+" H457z");case"\u23A2":return gs("M319 0 H403 V"+r+" H319z");case"\u23A5":return gs("M263 0 H347 V"+r+" H263z");case"\u23AA":return gs("M384 0 H504 V"+r+" H384z");case"\u23D0":return gs("M312 0 H355 V"+r+" H312z");case"\u2016":return gs("M257 0 H300 V"+r+" H257z")+gs("M478 0 H521 V"+r+" H478z");default:return""}},cxe={doubleleftarrow:`M262 157 +219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},Q4t=function(t,r,n){r=1e3*r;var i="";switch(t){case"sqrtMain":i=H4t(r,bb);break;case"sqrtSize1":i=U4t(r,bb);break;case"sqrtSize2":i=Y4t(r,bb);break;case"sqrtSize3":i=X4t(r,bb);break;case"sqrtSize4":i=j4t(r,bb);break;case"sqrtTall":i=Z4t(r,bb,n)}return i},J4t=function(t,r){switch(t){case"\u239C":return gs("M291 0 H417 V"+r+" H291z");case"\u2223":return gs("M145 0 H188 V"+r+" H145z");case"\u2225":return gs("M145 0 H188 V"+r+" H145z")+gs("M367 0 H410 V"+r+" H367z");case"\u239F":return gs("M457 0 H583 V"+r+" H457z");case"\u23A2":return gs("M319 0 H403 V"+r+" H319z");case"\u23A5":return gs("M263 0 H347 V"+r+" H263z");case"\u23AA":return gs("M384 0 H504 V"+r+" H384z");case"\u23D0":return gs("M312 0 H355 V"+r+" H312z");case"\u2016":return gs("M257 0 H300 V"+r+" H257z")+gs("M478 0 H521 V"+r+" H478z");default:return""}},hxe={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 @@ -222,7 +222,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z` 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`},K4t=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 v84 h347 v-84 +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},ewt=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 v84 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+r+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 @@ -250,15 +250,15 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};Am=class{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;r{if(Z4t(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}},Qq={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Q4t={ex:!0,em:!0,mu:!0},Hxe=function(t){return typeof t!="string"&&(t=t.unit),t in Qq||t in Q4t||t==="ex"},ga=function(t,r){var n;if(t.unit in Qq)n=Qq[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,t.unit==="ex")n=i.fontMetrics().xHeight;else if(t.unit==="em")n=i.fontMetrics().quad;else throw new Bt("Invalid unit: '"+t.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*n,r.maxSize)},Yt=function(t){return+t.toFixed(4)+"em"},_m=function(t){return t.filter(r=>r).join(" ")},vV=function(t){var r="";for(var n of Object.keys(t)){var i=t[n];i!==void 0&&(r+=E4t(n)+":"+i+";")}return r},Uxe=function(t,r,n){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},Yxe=function(t){var r=document.createElement(t);r.className=_m(this.classes),Object.assign(r.style,this.style);for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i/=\x00-\x1f]/,Xxe=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+zo(_m(this.classes))+'"');var n=vV(this.style);n&&(r+=' style="'+zo(n)+'"');for(var i of Object.keys(this.attributes)){if(J4t.test(i))throw new Bt("Invalid attribute name '"+i+"'");r+=" "+i+'="'+zo(this.attributes[i])+'"'}r+=">";for(var a=0;a",r},Rm=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,Uxe.call(this,t,n,i),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return Yxe.call(this,"span")}toMarkup(){return Xxe.call(this,"span")}},Tb=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Uxe.call(this,r,i),this.children=n||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return Yxe.call(this,"a")}toMarkup(){return Xxe.call(this,"a")}},Jq=class{constructor(t,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t=''+zo(this.alt)+'0&&(r=document.createElement("span"),r.style.marginRight=Yt(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=_m(this.classes)),Object.keys(this.style).length>0&&(r=r||document.createElement("span"),Object.assign(r.style,this.style)),r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="0&&(n+="margin-right:"+Yt(this.italic)+";"),n+=vV(this.style),n&&(t=!0,r+=' style="'+zo(n)+'"');var i=zo(this.text);return t?(r+=">",r+=i,r+="",r):i}},oh=class{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i':''}},_5=class{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var t="e instanceof Rm||e instanceof Tb||e instanceof Am,xf={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],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:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],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:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],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:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],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:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],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:[0,.44444,0,0,.63889],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:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],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:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],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:[0,.68611,.17208,0,.8961],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:[0,.69444,.06709,0,.59111],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:[.19444,.44444,.105,0,.53222],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:[.19444,.44444,.105,0,.53222],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:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],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:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],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:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],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:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],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:[0,.68333,.16389,0,.74333],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:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],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:[0,.68333,.16389,0,.74333],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:[0,.69444,.06646,0,.51111],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:[.19444,.43056,.08847,0,.46],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:[.19444,.43056,.08847,0,.46],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:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],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:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],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:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],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:[0,.43056,0,0,.55556],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:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],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:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],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:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],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:[0,.69444,0,0,.66759],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:[0,.44444,0,0,.58472],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:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],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:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],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:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],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:[0,.68333,.08125,.05556,.83125],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:[0,.68333,.02778,.08334,.76278],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:[0,.43056,0,.05556,.48472],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:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],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:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],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:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],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:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],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:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],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:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],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:[0,.69444,.07816,0,.27778],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:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],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:[0,.69444,0,0,.66667],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:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],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:[0,.69444,.0799,0,.5],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:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],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:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],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:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],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:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],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:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},xA={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],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:[.25,.25,.25],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],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},uxe={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\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"};Bq={};ia={math:{},text:{}};re="math",Mt="text",we="main",Ue="ams",aa="accent-token",lr="bin",pl="close",Eb="inner",Fr="mathord",Ja="op-token",Dc="open",L5="punct",Xe="rel",p0="spacing",Qe="textord";Y(re,we,Xe,"\u2261","\\equiv",!0);Y(re,we,Xe,"\u227A","\\prec",!0);Y(re,we,Xe,"\u227B","\\succ",!0);Y(re,we,Xe,"\u223C","\\sim",!0);Y(re,we,Xe,"\u22A5","\\perp");Y(re,we,Xe,"\u2AAF","\\preceq",!0);Y(re,we,Xe,"\u2AB0","\\succeq",!0);Y(re,we,Xe,"\u2243","\\simeq",!0);Y(re,we,Xe,"\u2223","\\mid",!0);Y(re,we,Xe,"\u226A","\\ll",!0);Y(re,we,Xe,"\u226B","\\gg",!0);Y(re,we,Xe,"\u224D","\\asymp",!0);Y(re,we,Xe,"\u2225","\\parallel");Y(re,we,Xe,"\u22C8","\\bowtie",!0);Y(re,we,Xe,"\u2323","\\smile",!0);Y(re,we,Xe,"\u2291","\\sqsubseteq",!0);Y(re,we,Xe,"\u2292","\\sqsupseteq",!0);Y(re,we,Xe,"\u2250","\\doteq",!0);Y(re,we,Xe,"\u2322","\\frown",!0);Y(re,we,Xe,"\u220B","\\ni",!0);Y(re,we,Xe,"\u221D","\\propto",!0);Y(re,we,Xe,"\u22A2","\\vdash",!0);Y(re,we,Xe,"\u22A3","\\dashv",!0);Y(re,we,Xe,"\u220B","\\owns");Y(re,we,L5,".","\\ldotp");Y(re,we,L5,"\u22C5","\\cdotp");Y(re,we,L5,"\u22C5","\xB7");Y(Mt,we,Qe,"\u22C5","\xB7");Y(re,we,Qe,"#","\\#");Y(Mt,we,Qe,"#","\\#");Y(re,we,Qe,"&","\\&");Y(Mt,we,Qe,"&","\\&");Y(re,we,Qe,"\u2135","\\aleph",!0);Y(re,we,Qe,"\u2200","\\forall",!0);Y(re,we,Qe,"\u210F","\\hbar",!0);Y(re,we,Qe,"\u2203","\\exists",!0);Y(re,we,Qe,"\u2207","\\nabla",!0);Y(re,we,Qe,"\u266D","\\flat",!0);Y(re,we,Qe,"\u2113","\\ell",!0);Y(re,we,Qe,"\u266E","\\natural",!0);Y(re,we,Qe,"\u2663","\\clubsuit",!0);Y(re,we,Qe,"\u2118","\\wp",!0);Y(re,we,Qe,"\u266F","\\sharp",!0);Y(re,we,Qe,"\u2662","\\diamondsuit",!0);Y(re,we,Qe,"\u211C","\\Re",!0);Y(re,we,Qe,"\u2661","\\heartsuit",!0);Y(re,we,Qe,"\u2111","\\Im",!0);Y(re,we,Qe,"\u2660","\\spadesuit",!0);Y(re,we,Qe,"\xA7","\\S",!0);Y(Mt,we,Qe,"\xA7","\\S");Y(re,we,Qe,"\xB6","\\P",!0);Y(Mt,we,Qe,"\xB6","\\P");Y(re,we,Qe,"\u2020","\\dag");Y(Mt,we,Qe,"\u2020","\\dag");Y(Mt,we,Qe,"\u2020","\\textdagger");Y(re,we,Qe,"\u2021","\\ddag");Y(Mt,we,Qe,"\u2021","\\ddag");Y(Mt,we,Qe,"\u2021","\\textdaggerdbl");Y(re,we,pl,"\u23B1","\\rmoustache",!0);Y(re,we,Dc,"\u23B0","\\lmoustache",!0);Y(re,we,pl,"\u27EF","\\rgroup",!0);Y(re,we,Dc,"\u27EE","\\lgroup",!0);Y(re,we,lr,"\u2213","\\mp",!0);Y(re,we,lr,"\u2296","\\ominus",!0);Y(re,we,lr,"\u228E","\\uplus",!0);Y(re,we,lr,"\u2293","\\sqcap",!0);Y(re,we,lr,"\u2217","\\ast");Y(re,we,lr,"\u2294","\\sqcup",!0);Y(re,we,lr,"\u25EF","\\bigcirc",!0);Y(re,we,lr,"\u2219","\\bullet",!0);Y(re,we,lr,"\u2021","\\ddagger");Y(re,we,lr,"\u2240","\\wr",!0);Y(re,we,lr,"\u2A3F","\\amalg");Y(re,we,lr,"&","\\And");Y(re,we,Xe,"\u27F5","\\longleftarrow",!0);Y(re,we,Xe,"\u21D0","\\Leftarrow",!0);Y(re,we,Xe,"\u27F8","\\Longleftarrow",!0);Y(re,we,Xe,"\u27F6","\\longrightarrow",!0);Y(re,we,Xe,"\u21D2","\\Rightarrow",!0);Y(re,we,Xe,"\u27F9","\\Longrightarrow",!0);Y(re,we,Xe,"\u2194","\\leftrightarrow",!0);Y(re,we,Xe,"\u27F7","\\longleftrightarrow",!0);Y(re,we,Xe,"\u21D4","\\Leftrightarrow",!0);Y(re,we,Xe,"\u27FA","\\Longleftrightarrow",!0);Y(re,we,Xe,"\u21A6","\\mapsto",!0);Y(re,we,Xe,"\u27FC","\\longmapsto",!0);Y(re,we,Xe,"\u2197","\\nearrow",!0);Y(re,we,Xe,"\u21A9","\\hookleftarrow",!0);Y(re,we,Xe,"\u21AA","\\hookrightarrow",!0);Y(re,we,Xe,"\u2198","\\searrow",!0);Y(re,we,Xe,"\u21BC","\\leftharpoonup",!0);Y(re,we,Xe,"\u21C0","\\rightharpoonup",!0);Y(re,we,Xe,"\u2199","\\swarrow",!0);Y(re,we,Xe,"\u21BD","\\leftharpoondown",!0);Y(re,we,Xe,"\u21C1","\\rightharpoondown",!0);Y(re,we,Xe,"\u2196","\\nwarrow",!0);Y(re,we,Xe,"\u21CC","\\rightleftharpoons",!0);Y(re,Ue,Xe,"\u226E","\\nless",!0);Y(re,Ue,Xe,"\uE010","\\@nleqslant");Y(re,Ue,Xe,"\uE011","\\@nleqq");Y(re,Ue,Xe,"\u2A87","\\lneq",!0);Y(re,Ue,Xe,"\u2268","\\lneqq",!0);Y(re,Ue,Xe,"\uE00C","\\@lvertneqq");Y(re,Ue,Xe,"\u22E6","\\lnsim",!0);Y(re,Ue,Xe,"\u2A89","\\lnapprox",!0);Y(re,Ue,Xe,"\u2280","\\nprec",!0);Y(re,Ue,Xe,"\u22E0","\\npreceq",!0);Y(re,Ue,Xe,"\u22E8","\\precnsim",!0);Y(re,Ue,Xe,"\u2AB9","\\precnapprox",!0);Y(re,Ue,Xe,"\u2241","\\nsim",!0);Y(re,Ue,Xe,"\uE006","\\@nshortmid");Y(re,Ue,Xe,"\u2224","\\nmid",!0);Y(re,Ue,Xe,"\u22AC","\\nvdash",!0);Y(re,Ue,Xe,"\u22AD","\\nvDash",!0);Y(re,Ue,Xe,"\u22EA","\\ntriangleleft");Y(re,Ue,Xe,"\u22EC","\\ntrianglelefteq",!0);Y(re,Ue,Xe,"\u228A","\\subsetneq",!0);Y(re,Ue,Xe,"\uE01A","\\@varsubsetneq");Y(re,Ue,Xe,"\u2ACB","\\subsetneqq",!0);Y(re,Ue,Xe,"\uE017","\\@varsubsetneqq");Y(re,Ue,Xe,"\u226F","\\ngtr",!0);Y(re,Ue,Xe,"\uE00F","\\@ngeqslant");Y(re,Ue,Xe,"\uE00E","\\@ngeqq");Y(re,Ue,Xe,"\u2A88","\\gneq",!0);Y(re,Ue,Xe,"\u2269","\\gneqq",!0);Y(re,Ue,Xe,"\uE00D","\\@gvertneqq");Y(re,Ue,Xe,"\u22E7","\\gnsim",!0);Y(re,Ue,Xe,"\u2A8A","\\gnapprox",!0);Y(re,Ue,Xe,"\u2281","\\nsucc",!0);Y(re,Ue,Xe,"\u22E1","\\nsucceq",!0);Y(re,Ue,Xe,"\u22E9","\\succnsim",!0);Y(re,Ue,Xe,"\u2ABA","\\succnapprox",!0);Y(re,Ue,Xe,"\u2246","\\ncong",!0);Y(re,Ue,Xe,"\uE007","\\@nshortparallel");Y(re,Ue,Xe,"\u2226","\\nparallel",!0);Y(re,Ue,Xe,"\u22AF","\\nVDash",!0);Y(re,Ue,Xe,"\u22EB","\\ntriangleright");Y(re,Ue,Xe,"\u22ED","\\ntrianglerighteq",!0);Y(re,Ue,Xe,"\uE018","\\@nsupseteqq");Y(re,Ue,Xe,"\u228B","\\supsetneq",!0);Y(re,Ue,Xe,"\uE01B","\\@varsupsetneq");Y(re,Ue,Xe,"\u2ACC","\\supsetneqq",!0);Y(re,Ue,Xe,"\uE019","\\@varsupsetneqq");Y(re,Ue,Xe,"\u22AE","\\nVdash",!0);Y(re,Ue,Xe,"\u2AB5","\\precneqq",!0);Y(re,Ue,Xe,"\u2AB6","\\succneqq",!0);Y(re,Ue,Xe,"\uE016","\\@nsubseteqq");Y(re,Ue,lr,"\u22B4","\\unlhd");Y(re,Ue,lr,"\u22B5","\\unrhd");Y(re,Ue,Xe,"\u219A","\\nleftarrow",!0);Y(re,Ue,Xe,"\u219B","\\nrightarrow",!0);Y(re,Ue,Xe,"\u21CD","\\nLeftarrow",!0);Y(re,Ue,Xe,"\u21CF","\\nRightarrow",!0);Y(re,Ue,Xe,"\u21AE","\\nleftrightarrow",!0);Y(re,Ue,Xe,"\u21CE","\\nLeftrightarrow",!0);Y(re,Ue,Xe,"\u25B3","\\vartriangle");Y(re,Ue,Qe,"\u210F","\\hslash");Y(re,Ue,Qe,"\u25BD","\\triangledown");Y(re,Ue,Qe,"\u25CA","\\lozenge");Y(re,Ue,Qe,"\u24C8","\\circledS");Y(re,Ue,Qe,"\xAE","\\circledR");Y(Mt,Ue,Qe,"\xAE","\\circledR");Y(re,Ue,Qe,"\u2221","\\measuredangle",!0);Y(re,Ue,Qe,"\u2204","\\nexists");Y(re,Ue,Qe,"\u2127","\\mho");Y(re,Ue,Qe,"\u2132","\\Finv",!0);Y(re,Ue,Qe,"\u2141","\\Game",!0);Y(re,Ue,Qe,"\u2035","\\backprime");Y(re,Ue,Qe,"\u25B2","\\blacktriangle");Y(re,Ue,Qe,"\u25BC","\\blacktriangledown");Y(re,Ue,Qe,"\u25A0","\\blacksquare");Y(re,Ue,Qe,"\u29EB","\\blacklozenge");Y(re,Ue,Qe,"\u2605","\\bigstar");Y(re,Ue,Qe,"\u2222","\\sphericalangle",!0);Y(re,Ue,Qe,"\u2201","\\complement",!0);Y(re,Ue,Qe,"\xF0","\\eth",!0);Y(Mt,we,Qe,"\xF0","\xF0");Y(re,Ue,Qe,"\u2571","\\diagup");Y(re,Ue,Qe,"\u2572","\\diagdown");Y(re,Ue,Qe,"\u25A1","\\square");Y(re,Ue,Qe,"\u25A1","\\Box");Y(re,Ue,Qe,"\u25CA","\\Diamond");Y(re,Ue,Qe,"\xA5","\\yen",!0);Y(Mt,Ue,Qe,"\xA5","\\yen",!0);Y(re,Ue,Qe,"\u2713","\\checkmark",!0);Y(Mt,Ue,Qe,"\u2713","\\checkmark");Y(re,Ue,Qe,"\u2136","\\beth",!0);Y(re,Ue,Qe,"\u2138","\\daleth",!0);Y(re,Ue,Qe,"\u2137","\\gimel",!0);Y(re,Ue,Qe,"\u03DD","\\digamma",!0);Y(re,Ue,Qe,"\u03F0","\\varkappa");Y(re,Ue,Dc,"\u250C","\\@ulcorner",!0);Y(re,Ue,pl,"\u2510","\\@urcorner",!0);Y(re,Ue,Dc,"\u2514","\\@llcorner",!0);Y(re,Ue,pl,"\u2518","\\@lrcorner",!0);Y(re,Ue,Xe,"\u2266","\\leqq",!0);Y(re,Ue,Xe,"\u2A7D","\\leqslant",!0);Y(re,Ue,Xe,"\u2A95","\\eqslantless",!0);Y(re,Ue,Xe,"\u2272","\\lesssim",!0);Y(re,Ue,Xe,"\u2A85","\\lessapprox",!0);Y(re,Ue,Xe,"\u224A","\\approxeq",!0);Y(re,Ue,lr,"\u22D6","\\lessdot");Y(re,Ue,Xe,"\u22D8","\\lll",!0);Y(re,Ue,Xe,"\u2276","\\lessgtr",!0);Y(re,Ue,Xe,"\u22DA","\\lesseqgtr",!0);Y(re,Ue,Xe,"\u2A8B","\\lesseqqgtr",!0);Y(re,Ue,Xe,"\u2251","\\doteqdot");Y(re,Ue,Xe,"\u2253","\\risingdotseq",!0);Y(re,Ue,Xe,"\u2252","\\fallingdotseq",!0);Y(re,Ue,Xe,"\u223D","\\backsim",!0);Y(re,Ue,Xe,"\u22CD","\\backsimeq",!0);Y(re,Ue,Xe,"\u2AC5","\\subseteqq",!0);Y(re,Ue,Xe,"\u22D0","\\Subset",!0);Y(re,Ue,Xe,"\u228F","\\sqsubset",!0);Y(re,Ue,Xe,"\u227C","\\preccurlyeq",!0);Y(re,Ue,Xe,"\u22DE","\\curlyeqprec",!0);Y(re,Ue,Xe,"\u227E","\\precsim",!0);Y(re,Ue,Xe,"\u2AB7","\\precapprox",!0);Y(re,Ue,Xe,"\u22B2","\\vartriangleleft");Y(re,Ue,Xe,"\u22B4","\\trianglelefteq");Y(re,Ue,Xe,"\u22A8","\\vDash",!0);Y(re,Ue,Xe,"\u22AA","\\Vvdash",!0);Y(re,Ue,Xe,"\u2323","\\smallsmile");Y(re,Ue,Xe,"\u2322","\\smallfrown");Y(re,Ue,Xe,"\u224F","\\bumpeq",!0);Y(re,Ue,Xe,"\u224E","\\Bumpeq",!0);Y(re,Ue,Xe,"\u2267","\\geqq",!0);Y(re,Ue,Xe,"\u2A7E","\\geqslant",!0);Y(re,Ue,Xe,"\u2A96","\\eqslantgtr",!0);Y(re,Ue,Xe,"\u2273","\\gtrsim",!0);Y(re,Ue,Xe,"\u2A86","\\gtrapprox",!0);Y(re,Ue,lr,"\u22D7","\\gtrdot");Y(re,Ue,Xe,"\u22D9","\\ggg",!0);Y(re,Ue,Xe,"\u2277","\\gtrless",!0);Y(re,Ue,Xe,"\u22DB","\\gtreqless",!0);Y(re,Ue,Xe,"\u2A8C","\\gtreqqless",!0);Y(re,Ue,Xe,"\u2256","\\eqcirc",!0);Y(re,Ue,Xe,"\u2257","\\circeq",!0);Y(re,Ue,Xe,"\u225C","\\triangleq",!0);Y(re,Ue,Xe,"\u223C","\\thicksim");Y(re,Ue,Xe,"\u2248","\\thickapprox");Y(re,Ue,Xe,"\u2AC6","\\supseteqq",!0);Y(re,Ue,Xe,"\u22D1","\\Supset",!0);Y(re,Ue,Xe,"\u2290","\\sqsupset",!0);Y(re,Ue,Xe,"\u227D","\\succcurlyeq",!0);Y(re,Ue,Xe,"\u22DF","\\curlyeqsucc",!0);Y(re,Ue,Xe,"\u227F","\\succsim",!0);Y(re,Ue,Xe,"\u2AB8","\\succapprox",!0);Y(re,Ue,Xe,"\u22B3","\\vartriangleright");Y(re,Ue,Xe,"\u22B5","\\trianglerighteq");Y(re,Ue,Xe,"\u22A9","\\Vdash",!0);Y(re,Ue,Xe,"\u2223","\\shortmid");Y(re,Ue,Xe,"\u2225","\\shortparallel");Y(re,Ue,Xe,"\u226C","\\between",!0);Y(re,Ue,Xe,"\u22D4","\\pitchfork",!0);Y(re,Ue,Xe,"\u221D","\\varpropto");Y(re,Ue,Xe,"\u25C0","\\blacktriangleleft");Y(re,Ue,Xe,"\u2234","\\therefore",!0);Y(re,Ue,Xe,"\u220D","\\backepsilon");Y(re,Ue,Xe,"\u25B6","\\blacktriangleright");Y(re,Ue,Xe,"\u2235","\\because",!0);Y(re,Ue,Xe,"\u22D8","\\llless");Y(re,Ue,Xe,"\u22D9","\\gggtr");Y(re,Ue,lr,"\u22B2","\\lhd");Y(re,Ue,lr,"\u22B3","\\rhd");Y(re,Ue,Xe,"\u2242","\\eqsim",!0);Y(re,we,Xe,"\u22C8","\\Join");Y(re,Ue,Xe,"\u2251","\\Doteq",!0);Y(re,Ue,lr,"\u2214","\\dotplus",!0);Y(re,Ue,lr,"\u2216","\\smallsetminus");Y(re,Ue,lr,"\u22D2","\\Cap",!0);Y(re,Ue,lr,"\u22D3","\\Cup",!0);Y(re,Ue,lr,"\u2A5E","\\doublebarwedge",!0);Y(re,Ue,lr,"\u229F","\\boxminus",!0);Y(re,Ue,lr,"\u229E","\\boxplus",!0);Y(re,Ue,lr,"\u22C7","\\divideontimes",!0);Y(re,Ue,lr,"\u22C9","\\ltimes",!0);Y(re,Ue,lr,"\u22CA","\\rtimes",!0);Y(re,Ue,lr,"\u22CB","\\leftthreetimes",!0);Y(re,Ue,lr,"\u22CC","\\rightthreetimes",!0);Y(re,Ue,lr,"\u22CF","\\curlywedge",!0);Y(re,Ue,lr,"\u22CE","\\curlyvee",!0);Y(re,Ue,lr,"\u229D","\\circleddash",!0);Y(re,Ue,lr,"\u229B","\\circledast",!0);Y(re,Ue,lr,"\u22C5","\\centerdot");Y(re,Ue,lr,"\u22BA","\\intercal",!0);Y(re,Ue,lr,"\u22D2","\\doublecap");Y(re,Ue,lr,"\u22D3","\\doublecup");Y(re,Ue,lr,"\u22A0","\\boxtimes",!0);Y(re,Ue,Xe,"\u21E2","\\dashrightarrow",!0);Y(re,Ue,Xe,"\u21E0","\\dashleftarrow",!0);Y(re,Ue,Xe,"\u21C7","\\leftleftarrows",!0);Y(re,Ue,Xe,"\u21C6","\\leftrightarrows",!0);Y(re,Ue,Xe,"\u21DA","\\Lleftarrow",!0);Y(re,Ue,Xe,"\u219E","\\twoheadleftarrow",!0);Y(re,Ue,Xe,"\u21A2","\\leftarrowtail",!0);Y(re,Ue,Xe,"\u21AB","\\looparrowleft",!0);Y(re,Ue,Xe,"\u21CB","\\leftrightharpoons",!0);Y(re,Ue,Xe,"\u21B6","\\curvearrowleft",!0);Y(re,Ue,Xe,"\u21BA","\\circlearrowleft",!0);Y(re,Ue,Xe,"\u21B0","\\Lsh",!0);Y(re,Ue,Xe,"\u21C8","\\upuparrows",!0);Y(re,Ue,Xe,"\u21BF","\\upharpoonleft",!0);Y(re,Ue,Xe,"\u21C3","\\downharpoonleft",!0);Y(re,we,Xe,"\u22B6","\\origof",!0);Y(re,we,Xe,"\u22B7","\\imageof",!0);Y(re,Ue,Xe,"\u22B8","\\multimap",!0);Y(re,Ue,Xe,"\u21AD","\\leftrightsquigarrow",!0);Y(re,Ue,Xe,"\u21C9","\\rightrightarrows",!0);Y(re,Ue,Xe,"\u21C4","\\rightleftarrows",!0);Y(re,Ue,Xe,"\u21A0","\\twoheadrightarrow",!0);Y(re,Ue,Xe,"\u21A3","\\rightarrowtail",!0);Y(re,Ue,Xe,"\u21AC","\\looparrowright",!0);Y(re,Ue,Xe,"\u21B7","\\curvearrowright",!0);Y(re,Ue,Xe,"\u21BB","\\circlearrowright",!0);Y(re,Ue,Xe,"\u21B1","\\Rsh",!0);Y(re,Ue,Xe,"\u21CA","\\downdownarrows",!0);Y(re,Ue,Xe,"\u21BE","\\upharpoonright",!0);Y(re,Ue,Xe,"\u21C2","\\downharpoonright",!0);Y(re,Ue,Xe,"\u21DD","\\rightsquigarrow",!0);Y(re,Ue,Xe,"\u21DD","\\leadsto");Y(re,Ue,Xe,"\u21DB","\\Rrightarrow",!0);Y(re,Ue,Xe,"\u21BE","\\restriction");Y(re,we,Qe,"\u2018","`");Y(re,we,Qe,"$","\\$");Y(Mt,we,Qe,"$","\\$");Y(Mt,we,Qe,"$","\\textdollar");Y(re,we,Qe,"%","\\%");Y(Mt,we,Qe,"%","\\%");Y(re,we,Qe,"_","\\_");Y(Mt,we,Qe,"_","\\_");Y(Mt,we,Qe,"_","\\textunderscore");Y(re,we,Qe,"\u2220","\\angle",!0);Y(re,we,Qe,"\u221E","\\infty",!0);Y(re,we,Qe,"\u2032","\\prime");Y(re,we,Qe,"\u25B3","\\triangle");Y(re,we,Qe,"\u0393","\\Gamma",!0);Y(re,we,Qe,"\u0394","\\Delta",!0);Y(re,we,Qe,"\u0398","\\Theta",!0);Y(re,we,Qe,"\u039B","\\Lambda",!0);Y(re,we,Qe,"\u039E","\\Xi",!0);Y(re,we,Qe,"\u03A0","\\Pi",!0);Y(re,we,Qe,"\u03A3","\\Sigma",!0);Y(re,we,Qe,"\u03A5","\\Upsilon",!0);Y(re,we,Qe,"\u03A6","\\Phi",!0);Y(re,we,Qe,"\u03A8","\\Psi",!0);Y(re,we,Qe,"\u03A9","\\Omega",!0);Y(re,we,Qe,"A","\u0391");Y(re,we,Qe,"B","\u0392");Y(re,we,Qe,"E","\u0395");Y(re,we,Qe,"Z","\u0396");Y(re,we,Qe,"H","\u0397");Y(re,we,Qe,"I","\u0399");Y(re,we,Qe,"K","\u039A");Y(re,we,Qe,"M","\u039C");Y(re,we,Qe,"N","\u039D");Y(re,we,Qe,"O","\u039F");Y(re,we,Qe,"P","\u03A1");Y(re,we,Qe,"T","\u03A4");Y(re,we,Qe,"X","\u03A7");Y(re,we,Qe,"\xAC","\\neg",!0);Y(re,we,Qe,"\xAC","\\lnot");Y(re,we,Qe,"\u22A4","\\top");Y(re,we,Qe,"\u22A5","\\bot");Y(re,we,Qe,"\u2205","\\emptyset");Y(re,Ue,Qe,"\u2205","\\varnothing");Y(re,we,Fr,"\u03B1","\\alpha",!0);Y(re,we,Fr,"\u03B2","\\beta",!0);Y(re,we,Fr,"\u03B3","\\gamma",!0);Y(re,we,Fr,"\u03B4","\\delta",!0);Y(re,we,Fr,"\u03F5","\\epsilon",!0);Y(re,we,Fr,"\u03B6","\\zeta",!0);Y(re,we,Fr,"\u03B7","\\eta",!0);Y(re,we,Fr,"\u03B8","\\theta",!0);Y(re,we,Fr,"\u03B9","\\iota",!0);Y(re,we,Fr,"\u03BA","\\kappa",!0);Y(re,we,Fr,"\u03BB","\\lambda",!0);Y(re,we,Fr,"\u03BC","\\mu",!0);Y(re,we,Fr,"\u03BD","\\nu",!0);Y(re,we,Fr,"\u03BE","\\xi",!0);Y(re,we,Fr,"\u03BF","\\omicron",!0);Y(re,we,Fr,"\u03C0","\\pi",!0);Y(re,we,Fr,"\u03C1","\\rho",!0);Y(re,we,Fr,"\u03C3","\\sigma",!0);Y(re,we,Fr,"\u03C4","\\tau",!0);Y(re,we,Fr,"\u03C5","\\upsilon",!0);Y(re,we,Fr,"\u03D5","\\phi",!0);Y(re,we,Fr,"\u03C7","\\chi",!0);Y(re,we,Fr,"\u03C8","\\psi",!0);Y(re,we,Fr,"\u03C9","\\omega",!0);Y(re,we,Fr,"\u03B5","\\varepsilon",!0);Y(re,we,Fr,"\u03D1","\\vartheta",!0);Y(re,we,Fr,"\u03D6","\\varpi",!0);Y(re,we,Fr,"\u03F1","\\varrho",!0);Y(re,we,Fr,"\u03C2","\\varsigma",!0);Y(re,we,Fr,"\u03C6","\\varphi",!0);Y(re,we,lr,"\u2217","*",!0);Y(re,we,lr,"+","+");Y(re,we,lr,"\u2212","-",!0);Y(re,we,lr,"\u22C5","\\cdot",!0);Y(re,we,lr,"\u2218","\\circ",!0);Y(re,we,lr,"\xF7","\\div",!0);Y(re,we,lr,"\xB1","\\pm",!0);Y(re,we,lr,"\xD7","\\times",!0);Y(re,we,lr,"\u2229","\\cap",!0);Y(re,we,lr,"\u222A","\\cup",!0);Y(re,we,lr,"\u2216","\\setminus",!0);Y(re,we,lr,"\u2227","\\land");Y(re,we,lr,"\u2228","\\lor");Y(re,we,lr,"\u2227","\\wedge",!0);Y(re,we,lr,"\u2228","\\vee",!0);Y(re,we,Qe,"\u221A","\\surd");Y(re,we,Dc,"\u27E8","\\langle",!0);Y(re,we,Dc,"\u2223","\\lvert");Y(re,we,Dc,"\u2225","\\lVert");Y(re,we,pl,"?","?");Y(re,we,pl,"!","!");Y(re,we,pl,"\u27E9","\\rangle",!0);Y(re,we,pl,"\u2223","\\rvert");Y(re,we,pl,"\u2225","\\rVert");Y(re,we,Xe,"=","=");Y(re,we,Xe,":",":");Y(re,we,Xe,"\u2248","\\approx",!0);Y(re,we,Xe,"\u2245","\\cong",!0);Y(re,we,Xe,"\u2265","\\ge");Y(re,we,Xe,"\u2265","\\geq",!0);Y(re,we,Xe,"\u2190","\\gets");Y(re,we,Xe,">","\\gt",!0);Y(re,we,Xe,"\u2208","\\in",!0);Y(re,we,Xe,"\uE020","\\@not");Y(re,we,Xe,"\u2282","\\subset",!0);Y(re,we,Xe,"\u2283","\\supset",!0);Y(re,we,Xe,"\u2286","\\subseteq",!0);Y(re,we,Xe,"\u2287","\\supseteq",!0);Y(re,Ue,Xe,"\u2288","\\nsubseteq",!0);Y(re,Ue,Xe,"\u2289","\\nsupseteq",!0);Y(re,we,Xe,"\u22A8","\\models");Y(re,we,Xe,"\u2190","\\leftarrow",!0);Y(re,we,Xe,"\u2264","\\le");Y(re,we,Xe,"\u2264","\\leq",!0);Y(re,we,Xe,"<","\\lt",!0);Y(re,we,Xe,"\u2192","\\rightarrow",!0);Y(re,we,Xe,"\u2192","\\to");Y(re,Ue,Xe,"\u2271","\\ngeq",!0);Y(re,Ue,Xe,"\u2270","\\nleq",!0);Y(re,we,p0,"\xA0","\\ ");Y(re,we,p0,"\xA0","\\space");Y(re,we,p0,"\xA0","\\nobreakspace");Y(Mt,we,p0,"\xA0","\\ ");Y(Mt,we,p0,"\xA0"," ");Y(Mt,we,p0,"\xA0","\\space");Y(Mt,we,p0,"\xA0","\\nobreakspace");Y(re,we,p0,"","\\nobreak");Y(re,we,p0,"","\\allowbreak");Y(re,we,L5,",",",");Y(re,we,L5,";",";");Y(re,Ue,lr,"\u22BC","\\barwedge",!0);Y(re,Ue,lr,"\u22BB","\\veebar",!0);Y(re,we,lr,"\u2299","\\odot",!0);Y(re,we,lr,"\u2295","\\oplus",!0);Y(re,we,lr,"\u2297","\\otimes",!0);Y(re,we,Qe,"\u2202","\\partial",!0);Y(re,we,lr,"\u2298","\\oslash",!0);Y(re,Ue,lr,"\u229A","\\circledcirc",!0);Y(re,Ue,lr,"\u22A1","\\boxdot",!0);Y(re,we,lr,"\u25B3","\\bigtriangleup");Y(re,we,lr,"\u25BD","\\bigtriangledown");Y(re,we,lr,"\u2020","\\dagger");Y(re,we,lr,"\u22C4","\\diamond");Y(re,we,lr,"\u22C6","\\star");Y(re,we,lr,"\u25C3","\\triangleleft");Y(re,we,lr,"\u25B9","\\triangleright");Y(re,we,Dc,"{","\\{");Y(Mt,we,Qe,"{","\\{");Y(Mt,we,Qe,"{","\\textbraceleft");Y(re,we,pl,"}","\\}");Y(Mt,we,Qe,"}","\\}");Y(Mt,we,Qe,"}","\\textbraceright");Y(re,we,Dc,"{","\\lbrace");Y(re,we,pl,"}","\\rbrace");Y(re,we,Dc,"[","\\lbrack",!0);Y(Mt,we,Qe,"[","\\lbrack",!0);Y(re,we,pl,"]","\\rbrack",!0);Y(Mt,we,Qe,"]","\\rbrack",!0);Y(re,we,Dc,"(","\\lparen",!0);Y(re,we,pl,")","\\rparen",!0);Y(Mt,we,Qe,"<","\\textless",!0);Y(Mt,we,Qe,">","\\textgreater",!0);Y(re,we,Dc,"\u230A","\\lfloor",!0);Y(re,we,pl,"\u230B","\\rfloor",!0);Y(re,we,Dc,"\u2308","\\lceil",!0);Y(re,we,pl,"\u2309","\\rceil",!0);Y(re,we,Qe,"\\","\\backslash");Y(re,we,Qe,"\u2223","|");Y(re,we,Qe,"\u2223","\\vert");Y(Mt,we,Qe,"|","\\textbar",!0);Y(re,we,Qe,"\u2225","\\|");Y(re,we,Qe,"\u2225","\\Vert");Y(Mt,we,Qe,"\u2225","\\textbardbl");Y(Mt,we,Qe,"~","\\textasciitilde");Y(Mt,we,Qe,"\\","\\textbackslash");Y(Mt,we,Qe,"^","\\textasciicircum");Y(re,we,Xe,"\u2191","\\uparrow",!0);Y(re,we,Xe,"\u21D1","\\Uparrow",!0);Y(re,we,Xe,"\u2193","\\downarrow",!0);Y(re,we,Xe,"\u21D3","\\Downarrow",!0);Y(re,we,Xe,"\u2195","\\updownarrow",!0);Y(re,we,Xe,"\u21D5","\\Updownarrow",!0);Y(re,we,Ja,"\u2210","\\coprod");Y(re,we,Ja,"\u22C1","\\bigvee");Y(re,we,Ja,"\u22C0","\\bigwedge");Y(re,we,Ja,"\u2A04","\\biguplus");Y(re,we,Ja,"\u22C2","\\bigcap");Y(re,we,Ja,"\u22C3","\\bigcup");Y(re,we,Ja,"\u222B","\\int");Y(re,we,Ja,"\u222B","\\intop");Y(re,we,Ja,"\u222C","\\iint");Y(re,we,Ja,"\u222D","\\iiint");Y(re,we,Ja,"\u220F","\\prod");Y(re,we,Ja,"\u2211","\\sum");Y(re,we,Ja,"\u2A02","\\bigotimes");Y(re,we,Ja,"\u2A01","\\bigoplus");Y(re,we,Ja,"\u2A00","\\bigodot");Y(re,we,Ja,"\u222E","\\oint");Y(re,we,Ja,"\u222F","\\oiint");Y(re,we,Ja,"\u2230","\\oiiint");Y(re,we,Ja,"\u2A06","\\bigsqcup");Y(re,we,Ja,"\u222B","\\smallint");Y(Mt,we,Eb,"\u2026","\\textellipsis");Y(re,we,Eb,"\u2026","\\mathellipsis");Y(Mt,we,Eb,"\u2026","\\ldots",!0);Y(re,we,Eb,"\u2026","\\ldots",!0);Y(re,we,Eb,"\u22EF","\\@cdots",!0);Y(re,we,Eb,"\u22F1","\\ddots",!0);Y(re,we,Qe,"\u22EE","\\varvdots");Y(Mt,we,Qe,"\u22EE","\\varvdots");Y(re,we,aa,"\u02CA","\\acute");Y(re,we,aa,"\u02CB","\\grave");Y(re,we,aa,"\xA8","\\ddot");Y(re,we,aa,"~","\\tilde");Y(re,we,aa,"\u02C9","\\bar");Y(re,we,aa,"\u02D8","\\breve");Y(re,we,aa,"\u02C7","\\check");Y(re,we,aa,"^","\\hat");Y(re,we,aa,"\u20D7","\\vec");Y(re,we,aa,"\u02D9","\\dot");Y(re,we,aa,"\u02DA","\\mathring");Y(re,we,Fr,"\uE131","\\@imath");Y(re,we,Fr,"\uE237","\\@jmath");Y(re,we,Qe,"\u0131","\u0131");Y(re,we,Qe,"\u0237","\u0237");Y(Mt,we,Qe,"\u0131","\\i",!0);Y(Mt,we,Qe,"\u0237","\\j",!0);Y(Mt,we,Qe,"\xDF","\\ss",!0);Y(Mt,we,Qe,"\xE6","\\ae",!0);Y(Mt,we,Qe,"\u0153","\\oe",!0);Y(Mt,we,Qe,"\xF8","\\o",!0);Y(Mt,we,Qe,"\xC6","\\AE",!0);Y(Mt,we,Qe,"\u0152","\\OE",!0);Y(Mt,we,Qe,"\xD8","\\O",!0);Y(Mt,we,aa,"\u02CA","\\'");Y(Mt,we,aa,"\u02CB","\\`");Y(Mt,we,aa,"\u02C6","\\^");Y(Mt,we,aa,"\u02DC","\\~");Y(Mt,we,aa,"\u02C9","\\=");Y(Mt,we,aa,"\u02D8","\\u");Y(Mt,we,aa,"\u02D9","\\.");Y(Mt,we,aa,"\xB8","\\c");Y(Mt,we,aa,"\u02DA","\\r");Y(Mt,we,aa,"\u02C7","\\v");Y(Mt,we,aa,"\xA8",'\\"');Y(Mt,we,aa,"\u02DD","\\H");Y(Mt,we,aa,"\u25EF","\\textcircled");Kxe={"--":!0,"---":!0,"``":!0,"''":!0};Y(Mt,we,Qe,"\u2013","--",!0);Y(Mt,we,Qe,"\u2013","\\textendash");Y(Mt,we,Qe,"\u2014","---",!0);Y(Mt,we,Qe,"\u2014","\\textemdash");Y(Mt,we,Qe,"\u2018","`",!0);Y(Mt,we,Qe,"\u2018","\\textquoteleft");Y(Mt,we,Qe,"\u2019","'",!0);Y(Mt,we,Qe,"\u2019","\\textquoteright");Y(Mt,we,Qe,"\u201C","``",!0);Y(Mt,we,Qe,"\u201C","\\textquotedblleft");Y(Mt,we,Qe,"\u201D","''",!0);Y(Mt,we,Qe,"\u201D","\\textquotedblright");Y(re,we,Qe,"\xB0","\\degree",!0);Y(Mt,we,Qe,"\xB0","\\degree");Y(Mt,we,Qe,"\xB0","\\textdegree",!0);Y(re,we,Qe,"\xA3","\\pounds");Y(re,we,Qe,"\xA3","\\mathsterling",!0);Y(Mt,we,Qe,"\xA3","\\pounds");Y(Mt,we,Qe,"\xA3","\\textsterling",!0);Y(re,Ue,Qe,"\u2720","\\maltese");Y(Mt,Ue,Qe,"\u2720","\\maltese");hxe='0123456789/@."';for(bA=0;bA{var t=e.charCodeAt(0),r=e.charCodeAt(1),n=(t-55296)*1024+(r-56320)+65536;if(119808<=n&&n<120484){var i=Math.floor((n-119808)/26);return xxe[i]}else if(120782<=n&&n<=120831){var a=Math.floor((n-120782)/10);return swt[a]}else{if(n===120485||n===120486)return xxe[0];if(120486{if(_m(e.classes)!==_m(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n of Object.keys(e.style))if(e.style[n]!==t.style[n])return!1;for(var i of Object.keys(t.style))if(e.style[i]!==t.style[i])return!1;return!0},Zxe=e=>{for(var t=0;tr&&(r=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}t.height=r,t.depth=n,t.maxFontSize=i},Dt=function(t,r,n,i){var a=new Rm(t,r,n,i);return wV(a),a},Lm=(e,t,r,n)=>new Rm(e,t,r,n),Cb=function(t,r,n){var i=Dt([t],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=Yt(i.height),i.maxFontSize=1,i},uwt=function(t,r,n,i){var a=new Tb(t,r,n,i);return wV(a),a},m0=function(t){var r=new Am(t);return wV(r),r},Sb=function(t,r){return t instanceof Am?Dt([],[t],r):t},hwt=function(t){if(t.positionType==="individualShift"){for(var r=t.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,s=1;s{var r=Dt(["mspace"],[],t),n=ga(e,t);return r.style.marginRight=Yt(n),r},CA=(e,t,r)=>{var n,i;switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return t==="textbf"&&r==="textit"?i="BoldItalic":t==="textbf"?i="Bold":r==="textit"?i="Italic":i="Regular",n+"-"+i},aV={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Jxe={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},ebe=function(t,r){var[n,i,a]=Jxe[t],s=new bf(n),o=new oh([s],{width:Yt(i),height:Yt(a),style:"width:"+Yt(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),l=Lm(["overlay"],[o],r);return l.height=a,l.style.height=Yt(a),l.style.width=Yt(i),l},ma={number:3,unit:"mu"},uy={number:4,unit:"mu"},h0={number:5,unit:"mu"},fwt={mord:{mop:ma,mbin:uy,mrel:h0,minner:ma},mop:{mord:ma,mop:ma,mrel:h0,minner:ma},mbin:{mord:uy,mop:uy,mopen:uy,minner:uy},mrel:{mord:h0,mop:h0,mopen:h0,minner:h0},mopen:{},mclose:{mop:ma,mbin:uy,mrel:h0,minner:ma},mpunct:{mord:ma,mop:ma,mrel:h0,mopen:ma,mclose:ma,mpunct:ma,minner:ma},minner:{mord:ma,mop:ma,mbin:uy,mrel:h0,mopen:ma,mpunct:ma,minner:ma}},dwt={mord:{mop:ma},mop:{mord:ma,mop:ma},mbin:{},mrel:{},mopen:{},mclose:{mop:ma},mpunct:{},minner:{mop:ma}},tbe={},DA={},OA={};PA=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Qa=function(t){return t.type==="ordgroup"?t.body:[t]},pwt=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),mwt=new Set(["rightmost","mrel","mclose","mpunct"]),gwt={display:pn.DISPLAY,text:pn.TEXT,script:pn.SCRIPT,scriptscript:pn.SCRIPTSCRIPT},ywt={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ys=function(t,r,n,i){i===void 0&&(i=[null,null]);for(var a=[],s=0;s{var y=g.classes[0],v=m.classes[0];y==="mbin"&&mwt.has(v)?g.classes[0]="mord":v==="mbin"&&pwt.has(y)&&(m.classes[0]="mord")},{node:f},d,p),sV(a,(m,g)=>{var y,v,x=lV(g),w=lV(m),C=x&&w?m.hasClass("mtight")?(y=dwt[x])==null?void 0:y[w]:(v=fwt[x])==null?void 0:v[w]:null;if(C)return Qxe(C,u)},{node:f},d,p),a},sV=function(t,r,n,i,a){i&&t.push(i);for(var s=0;sd=>{t.splice(f+1,0,d),s++})(s)}i&&t.pop()},rbe=function(t){return t instanceof Am||t instanceof Tb||t instanceof Rm&&t.hasClass("enclosing")?t:null},oV=function(t,r){var n=rbe(t);if(n){var i=n.children;if(i.length){if(r==="right")return oV(i[i.length-1],"right");if(r==="left")return oV(i[0],"left")}}return t},lV=function(t,r){if(!t)return null;r&&(t=oV(t,r));var n=t.classes[0];return ywt[n]||null},R5=function(t,r){var n=["nulldelimiter"].concat(t.baseSizingClasses());return Dt(r.concat(n))},hi=function(t,r,n){if(!t)return Dt();if(DA[t.type]){var i=DA[t.type](t,r);if(n&&r.size!==n.size){i=Dt(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new Bt("Got group of unknown type: '"+t.type+"'")};Pt=class{constructor(t,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=_m(this.classes));for(var n=0;n0&&(t+=' class ="'+zo(_m(this.classes))+'"'),t+=">";for(var n=0;n",t}toText(){return this.children.map(t=>t.toText()).join("")}},Ca=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return zo(this.toText())}toText(){return this.text}},BA=class{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character="\u200A":t>=.1666&&t<=.1667?this.character="\u2009":t>=.2222&&t<=.2223?this.character="\u2005":t>=.2777&&t<=.2778?this.character="\u2005\u200A":t>=-.05556&&t<=-.05555?this.character="\u200A\u2063":t>=-.1667&&t<=-.1666?this.character="\u2009\u2063":t>=-.2223&&t<=-.2222?this.character="\u205F\u2063":t>=-.2778&&t<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Yt(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}},vwt=new Set(["\\imath","\\jmath"]),xwt=new Set(["mrow","mtable"]),Tu=function(t,r,n){return ia[r][t]&&ia[r][t].replace&&t.charCodeAt(0)!==55349&&!(Kxe.hasOwnProperty(t)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(t=ia[r][t].replace),new Ca(t)},kV=function(t){return t.length===1?t[0]:new Pt("mrow",t)},bwt={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},TV=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var r=t.font;if(!r||r==="mathnormal")return null;var n=e.mode,i=bwt[r];if(i)return typeof i=="function"?i(e):i;var a=e.text;if(vwt.has(a))return null;if(ia[n][a]){var s=ia[n][a].replace;s&&(a=s)}var o=aV[r].fontName;return xV(a,o,n)?aV[r].variant:null};Oc=function(t,r,n){if(t.length===1){var i=Mi(t[0],r);return n&&i instanceof Pt&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],s,o=0;o=1&&(s.type==="mn"||zq(s))){var u=l.children[0];u instanceof Pt&&u.type==="mn"&&(u.children=[...s.children,...u.children],a.pop())}else if(s.type==="mi"&&s.children.length===1){var h=s.children[0];if(h instanceof Ca&&h.text==="\u0338"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var f=l.children[0];f instanceof Ca&&f.text.length>0&&(f.text=f.text.slice(0,1)+"\u0338"+f.text.slice(1),a.pop())}}}a.push(l),s=l}return a},Im=function(t,r,n){return kV(Oc(t,r,n))},Mi=function(t,r){if(!t)return new Pt("mrow");if(OA[t.type])return OA[t.type](t,r);throw new Bt("Got group of unknown type: '"+t.type+"'")};wwt=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],wxe=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],kxe=function(t,r){return r.size<2?t:wwt[t-1][r.size-1]},FA=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=wxe[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(r,t),new e(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:kxe(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:wxe[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=kxe(e.BASESIZE,t);return this.size===r&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==e.BASESIZE?["sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=iwt(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};FA.BASESIZE=6;ibe=function(t){return new FA({style:t.displayMode?pn.DISPLAY:pn.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},abe=function(t,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),t=Dt(n,[t])}return t},kwt=function(t,r,n){var i=ibe(n),a;if(n.output==="mathml")return bxe(t,r,i,n.displayMode,!0);if(n.output==="html"){var s=cV(t,i);a=Dt(["katex"],[s])}else{var o=bxe(t,r,i,n.displayMode,!1),l=cV(t,i);a=Dt(["katex"],[o,l])}return abe(a,n)},Twt=function(t,r,n){var i=ibe(n),a=cV(t,i),s=Dt(["katex"],[a]);return abe(s,n)},Cwt={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",underbracket:"\u23B5",overbracket:"\u23B4",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",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},VA=function(t){var r=new Pt("mo",[new Ca(Cwt[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},Swt={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"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,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"],"\\cdlongequal":[["longequal"],3,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],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["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],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ewt=new Set(["widehat","widecheck","widetilde","utilde"]),WA=function(t,r){function n(){var o=4e5,l=t.label.slice(1);if(Ewt.has(l)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,h,f,d;if(u>5)l==="widehat"||l==="widecheck"?(h=420,o=2364,d=.42,f=l+"4"):(h=312,o=2340,d=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][p],h=[0,239,300,360,420][p],d=[0,.24,.3,.3,.36,.42][p],f=l+p):(o=[0,600,1033,2339,2340][p],h=[0,260,286,306,312][p],d=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var m=new bf(f),g=new oh([m],{width:"100%",height:Yt(d),viewBox:"0 0 "+o+" "+h,preserveAspectRatio:"none"});return{span:Lm([],[g],r),minWidth:0,height:d}}else{var y=[],v=Swt[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[x,w,C]=v,T=C/1e3,k=x.length,S,E;if(k===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');S=["hide-tail"],E=[v[3]]}else if(k===2)S=["halfarrow-left","halfarrow-right"],E=["xMinYMin","xMaxYMin"];else if(k===3)S=["brace-left","brace-center","brace-right"],E=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+k+" children.");for(var I=0;I0&&(i.style.minWidth=Yt(a)),i},Awt=function(t,r,n,i,a){var s,o=t.height+t.depth+n+i;if(/fbox|color|angl/.test(r)){if(s=Dt(["stretchy",r],[],a),r==="fbox"){var l=a.color&&a.getColor();l&&(s.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new _5({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new _5({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new oh(u,{width:"100%",height:Yt(o)});s=Lm([],[h],a)}return s.height=o,s.style.height=Yt(o),s},_wt={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Rwt={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};sbe=e=>{if(e instanceof dl)return e;if(nwt(e)&&e.children.length===1)return sbe(e.children[0])},CV=(e,t)=>{var r,n,i;e&&e.type==="supsub"?(n=Tn(e.base,"accent"),r=n.base,e.base=r,i=rwt(hi(e,t)),e.base=n):(n=Tn(e,"accent"),r=n.base);var a=hi(r,t.havingCrampedStyle()),s=n.isShifty&&d0(r),o=0;if(s){var l,u;o=(l=(u=sbe(a))==null?void 0:u.skew)!=null?l:0}var h=n.label==="\\c",f=h?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),d;if(n.isStretchy)d=WA(n,t),d=ui({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+Yt(2*o)+")",marginLeft:Yt(2*o)}:void 0}]});else{var p,m;n.label==="\\vec"?(p=ebe("vec",t),m=Jxe.vec[1]):(p=qA({type:"textord",mode:n.mode,text:n.label},t,"textord"),p=twt(p),p.italic=0,m=p.width,h&&(f+=p.depth)),d=Dt(["accent-body"],[p]);var g=n.label==="\\textcircled";g&&(d.classes.push("accent-full"),f=a.height);var y=o;g||(y-=m/2),d.style.left=Yt(y),n.label==="\\textcircled"&&(d.style.top=".2em"),d=ui({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-f},{type:"elem",elem:d}]})}var v=Dt(["mord","accent"],[d],t);return i?(i.children[0]=v,i.height=Math.max(v.height,i.height),i.classes[0]="mord",i):v},obe=(e,t)=>{var r=e.isStretchy?VA(e.label):new Pt("mo",[Tu(e.label,e.mode)]),n=new Pt("mover",[Mi(e.base,t),r]);return n.setAttribute("accent","true"),n},Iwt=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));nr({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=PA(t[0]),n=!Iwt.test(e.funcName),i=!n||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:CV,mathmlBuilder:obe});nr({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],n=e.parser.mode;return n==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:CV,mathmlBuilder:obe});nr({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(e,t)=>{var r=hi(e.base,t),n=WA(e,t),i=e.label==="\\utilde"?.12:0,a=ui({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]});return Dt(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var r=VA(e.label),n=new Pt("munder",[Mi(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});EA=e=>{var t=new Pt("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};nr({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n,funcName:i}=e;return{type:"xArrow",mode:n.mode,label:i,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,n=t.havingStyle(r.sup()),i=Sb(hi(e.body,n,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var s;e.below&&(n=t.havingStyle(r.sub()),s=Sb(hi(e.below,n,t),t),s.classes.push(a+"-arrow-pad"));var o=WA(e,t),l=-t.fontMetrics().axisHeight+.5*o.height,u=-t.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(s){var f=-t.fontMetrics().axisHeight+s.height+.5*o.height+.111;h=ui({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:s,shift:f}]})}else h=ui({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return Dt(["mrel","x-arrow"],[h],t)},mathmlBuilder(e,t){var r=VA(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(e.body){var i=EA(Mi(e.body,t));if(e.below){var a=EA(Mi(e.below,t));n=new Pt("munderover",[r,a,i])}else n=new Pt("mover",[r,i])}else if(e.below){var s=EA(Mi(e.below,t));n=new Pt("munder",[r,s])}else n=EA(),n=new Pt("mover",[r,n]);return n}});nr({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:Qa(i),isCharacterBox:d0(i)}},htmlBuilder:lbe,mathmlBuilder:cbe});YA=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};nr({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:YA(t[0]),body:Qa(t[1]),isCharacterBox:d0(t[1])}}});nr({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:n}=e,i=t[1],a=t[0],s;n!=="\\stackrel"?s=YA(i):s="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:Qa(i)},l={type:"supsub",mode:a.mode,base:o,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:s,body:[l],isCharacterBox:d0(l)}},htmlBuilder:lbe,mathmlBuilder:cbe});nr({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:YA(t[0]),body:Qa(t[0])}},htmlBuilder(e,t){var r=ys(e.body,t,!0),n=Dt([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=Oc(e.body,t),n=new Pt("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});Mwt={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Txe=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),Cxe=e=>e.type==="textord"&&e.text==="@",Nwt=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;nr({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=Sb(hi(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=Yt(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new Pt("mrow",[Mi(e.label,t)]);return r=new Pt("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new Pt("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});nr({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=Sb(hi(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new Pt("mrow",[Mi(e.fragment,t)])}});nr({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,n=Tn(t[0],"ordgroup"),i=n.body,a="",s=0;s=1114111)throw new Bt("\\@char with invalid code point "+a);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});ube=(e,t)=>{var r=ys(e.body,t.withColor(e.color),!1);return m0(r)},hbe=(e,t)=>{var r=Oc(e.body,t.withColor(e.color)),n=new Pt("mstyle",r);return n.setAttribute("mathcolor",e.color),n};nr({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,n=Tn(t[0],"color-token").color,i=t[1];return{type:"color",mode:r.mode,color:n,body:Qa(i)}},htmlBuilder:ube,mathmlBuilder:hbe});nr({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:n}=e,i=Tn(t[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:ube,mathmlBuilder:hbe});nr({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:n}=e,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&Tn(i,"size").value}},htmlBuilder(e,t){var r=Dt(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=Yt(ga(e.size,t)))),r},mathmlBuilder(e,t){var r=new Pt("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",Yt(ga(e.size,t)))),r}});uV={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},fbe=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Bt("Expected a control sequence",e);return t},Pwt=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},dbe=(e,t,r,n)=>{var i=e.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,i,n)};nr({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var n=t.fetch();if(uV[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=uV[n.text]),Tn(t.parseFunction(),"internal");throw new Bt("Invalid token after macro prefix",n)}});nr({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=t.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new Bt("Expected a control sequence",n);for(var a=0,s,o=[[]];t.gullet.future().text!=="{";)if(n=t.gullet.popToken(),n.text==="#"){if(t.gullet.future().text==="{"){s=t.gullet.future(),o[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new Bt('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new Bt('Argument number "'+n.text+'" out of order');a++,o.push([])}else{if(n.text==="EOF")throw new Bt("Expected a macro definition");o[a].push(n.text)}var{tokens:l}=t.gullet.consumeArg();return s&&l.unshift(s),(r==="\\edef"||r==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(i,{tokens:l,numArgs:a,delimiters:o},r===uV[r]),{type:"internal",mode:t.mode}}});nr({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=fbe(t.gullet.popToken());t.gullet.consumeSpaces();var i=Pwt(t);return dbe(t,n,i,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});nr({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=fbe(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return dbe(t,n,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});C5=function(t,r,n){var i=ia.math[t]&&ia.math[t].replace,a=xV(i||t,r,n);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},SV=function(t,r,n,i){var a=n.havingBaseStyle(r),s=Dt(i.concat(a.sizingClasses(n)),[t],n),o=a.sizeMultiplier/n.sizeMultiplier;return s.height*=o,s.depth*=o,s.maxFontSize=a.sizeMultiplier,s},pbe=function(t,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Yt(a),t.height-=a,t.depth+=a},Bwt=function(t,r,n,i,a,s){var o=hl(t,"Main-Regular",a,i),l=SV(o,r,i,s);return n&&pbe(l,i,r),l},Fwt=function(t,r,n,i){return hl(t,"Size"+r+"-Regular",n,i)},mbe=function(t,r,n,i,a,s){var o=Fwt(t,r,a,i),l=SV(Dt(["delimsizing","size"+r],[o],i),pn.TEXT,i,s);return n&&pbe(l,i,pn.TEXT),l},Gq=function(t,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=Dt(["delimsizinginner",i],[Dt([],[hl(t,r,n)])]);return{type:"elem",elem:a}},qq=function(t,r,n){var i=xf["Size4-Regular"][t.charCodeAt(0)]?xf["Size4-Regular"][t.charCodeAt(0)][4]:xf["Size1-Regular"][t.charCodeAt(0)][4],a=new bf("inner",j4t(t,Math.round(1e3*r))),s=new oh([a],{width:Yt(i),height:Yt(r),style:"width:"+Yt(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),o=Lm([],[s],n);return o.height=r,o.style.height=Yt(r),o.style.width=Yt(i),{type:"elem",elem:o}},hV=.008,AA={type:"kern",size:-1*hV},$wt=new Set(["|","\\lvert","\\rvert","\\vert"]),zwt=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),gbe=function(t,r,n,i,a,s){var o,l,u,h,f="",d=0;o=u=h=t,l=null;var p="Size1-Regular";t==="\\uparrow"?u=h="\u23D0":t==="\\Uparrow"?u=h="\u2016":t==="\\downarrow"?o=u="\u23D0":t==="\\Downarrow"?o=u="\u2016":t==="\\updownarrow"?(o="\\uparrow",u="\u23D0",h="\\downarrow"):t==="\\Updownarrow"?(o="\\Uparrow",u="\u2016",h="\\Downarrow"):$wt.has(t)?(u="\u2223",f="vert",d=333):zwt.has(t)?(u="\u2225",f="doublevert",d=556):t==="["||t==="\\lbrack"?(o="\u23A1",u="\u23A2",h="\u23A3",p="Size4-Regular",f="lbrack",d=667):t==="]"||t==="\\rbrack"?(o="\u23A4",u="\u23A5",h="\u23A6",p="Size4-Regular",f="rbrack",d=667):t==="\\lfloor"||t==="\u230A"?(u=o="\u23A2",h="\u23A3",p="Size4-Regular",f="lfloor",d=667):t==="\\lceil"||t==="\u2308"?(o="\u23A1",u=h="\u23A2",p="Size4-Regular",f="lceil",d=667):t==="\\rfloor"||t==="\u230B"?(u=o="\u23A5",h="\u23A6",p="Size4-Regular",f="rfloor",d=667):t==="\\rceil"||t==="\u2309"?(o="\u23A4",u=h="\u23A5",p="Size4-Regular",f="rceil",d=667):t==="("||t==="\\lparen"?(o="\u239B",u="\u239C",h="\u239D",p="Size4-Regular",f="lparen",d=875):t===")"||t==="\\rparen"?(o="\u239E",u="\u239F",h="\u23A0",p="Size4-Regular",f="rparen",d=875):t==="\\{"||t==="\\lbrace"?(o="\u23A7",l="\u23A8",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(o="\u23AB",l="\u23AC",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lgroup"||t==="\u27EE"?(o="\u23A7",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\rgroup"||t==="\u27EF"?(o="\u23AB",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lmoustache"||t==="\u23B0"?(o="\u23A7",h="\u23AD",u="\u23AA",p="Size4-Regular"):(t==="\\rmoustache"||t==="\u23B1")&&(o="\u23AB",h="\u23A9",u="\u23AA",p="Size4-Regular");var m=C5(o,p,a),g=m.height+m.depth,y=C5(u,p,a),v=y.height+y.depth,x=C5(h,p,a),w=x.height+x.depth,C=0,T=1;if(l!==null){var k=C5(l,p,a);C=k.height+k.depth,T=2}var S=g+w+C,E=Math.max(0,Math.ceil((r-S)/(T*v))),I=S+E*T*v,L=i.fontMetrics().axisHeight;n&&(L*=i.sizeMultiplier);var O=I/2-L,R=[];if(f.length>0){var A=I-g-w,N=Math.round(I*1e3),M=K4t(f,Math.round(A*1e3)),D=new bf(f,M),B=Yt(d/1e3),P=Yt(N/1e3),$=new oh([D],{width:B,height:P,viewBox:"0 0 "+d+" "+N}),F=Lm([],[$],i);F.height=N/1e3,F.style.width=B,F.style.height=P,R.push({type:"elem",elem:F})}else{if(R.push(Gq(h,p,a)),R.push(AA),l===null){var q=I-g-w+2*hV;R.push(qq(u,q,i))}else{var G=(I-g-w-C)/2+2*hV;R.push(qq(u,G,i)),R.push(AA),R.push(Gq(l,p,a)),R.push(AA),R.push(qq(u,G,i))}R.push(AA),R.push(Gq(o,p,a))}var z=i.havingBaseStyle(pn.TEXT),H=ui({positionType:"bottom",positionData:O,children:R});return SV(Dt(["delimsizing","mult"],[H],z),pn.TEXT,i,s)},Vq=80,Wq=.08,Hq=function(t,r,n,i,a){var s=X4t(t,i,n),o=new bf(t,s),l=new oh([o],{width:"400em",height:Yt(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return Lm(["hide-tail"],[l],a)},Gwt=function(t,r){var n=r.havingBaseSizing(),i=wbe("\\surd",t*n.sizeMultiplier,bbe,n),a=n.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),o,l,u,h,f;return i.type==="small"?(h=1e3+1e3*s+Vq,t<1?a=1:t<1.4&&(a=.7),l=(1+s+Wq)/a,u=(1+s)/a,o=Hq("sqrtMain",l,h,s,r),o.style.minWidth="0.853em",f=.833/a):i.type==="large"?(h=(1e3+Vq)*S5[i.size],u=(S5[i.size]+s)/a,l=(S5[i.size]+s+Wq)/a,o=Hq("sqrtSize"+i.size,l,h,s,r),o.style.minWidth="1.02em",f=1/a):(l=t+s+Wq,u=t+s,h=Math.floor(1e3*t+s)+Vq,o=Hq("sqrtTall",l,h,s,r),o.style.minWidth="0.742em",f=1.056),o.height=u,o.style.height=Yt(l),{span:o,advanceWidth:f,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*a}},ybe=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"]),qwt=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"]),vbe=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),S5=[0,1.2,1.8,2.4,3],xbe=function(t,r,n,i,a){if(t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle"),ybe.has(t)||vbe.has(t))return mbe(t,r,!1,n,i,a);if(qwt.has(t))return gbe(t,S5[r],!1,n,i,a);throw new Bt("Illegal delimiter: '"+t+"'")},Vwt=[{type:"small",style:pn.SCRIPTSCRIPT},{type:"small",style:pn.SCRIPT},{type:"small",style:pn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Wwt=[{type:"small",style:pn.SCRIPTSCRIPT},{type:"small",style:pn.SCRIPT},{type:"small",style:pn.TEXT},{type:"stack"}],bbe=[{type:"small",style:pn.SCRIPTSCRIPT},{type:"small",style:pn.SCRIPT},{type:"small",style:pn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Hwt=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var r=t.type;throw new Error("Add support for delim type '"+r+"' here.")},wbe=function(t,r,n,i){for(var a=Math.min(2,3-i.style.size),s=a;sr)return o}return n[n.length-1]},fV=function(t,r,n,i,a,s){t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle");var o;vbe.has(t)?o=Vwt:ybe.has(t)?o=bbe:o=Wwt;var l=wbe(t,r,o,i);return l.type==="small"?Bwt(t,l.style,n,i,a,s):l.type==="large"?mbe(t,l.size,n,i,a,s):gbe(t,r,n,i,a,s)},Uq=function(t,r,n,i,a,s){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-o,n+o),f=Math.max(h/500*l,2*h-u);return fV(t,f,!0,i,a,s)},Sxe={"\\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}},Uwt=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);nr({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=XA(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Sxe[e.funcName].size,mclass:Sxe[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?Dt([e.mclass]):xbe(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Tu(e.delim,e.mode));var r=new Pt("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=Yt(S5[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});nr({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new Bt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:XA(t[0],e).text,color:r}}});nr({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=XA(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=Tn(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{Axe(e);for(var r=ys(e.body,t,!0,["mopen","mclose"]),n=0,i=0,a=!1,s=0;s{Axe(e);var r=Oc(e.body,t);if(e.left!=="."){var n=new Pt("mo",[Tu(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(e.right!=="."){var i=new Pt("mo",[Tu(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),r.push(i)}return kV(r)}});nr({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=XA(t[0],e);if(!e.parser.leftrightDepth)throw new Bt("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;return e.delim==="."?r=R5(t,[]):(r=xbe(e.delim,1,t,e.mode,[]),r.isMiddle={delim:e.delim,options:t}),r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?Tu("|","text"):Tu(e.delim,e.mode),n=new Pt("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});jA=(e,t)=>{var r=Sb(hi(e.body,t),t),n=e.label.slice(1),i=t.sizeMultiplier,a,s,o=d0(e.body);if(n==="sout")a=Dt(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,s=-.5*t.fontMetrics().xHeight;else if(n==="phase"){var l=ga({number:.6,unit:"pt"},t),u=ga({number:.35,unit:"ex"},t),h=t.havingBaseSizing();i=i/h.sizeMultiplier;var f=r.height+r.depth+l+u;r.style.paddingLeft=Yt(f/2+l);var d=Math.floor(1e3*f*i),p=U4t(d),m=new oh([new bf("phase",p)],{width:"400em",height:Yt(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=Lm(["hide-tail"],[m],t),a.style.height=Yt(f),s=r.depth+l+u}else{/cancel/.test(n)?o||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var g,y,v=0;/box/.test(n)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),g=t.fontMetrics().fboxsep+(n==="colorbox"?0:v),y=g):n==="angl"?(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),g=4*v,y=Math.max(0,.25-r.depth)):(g=o?.2:0,y=g),a=Awt(r,n,g,y,t),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=Yt(v)):n==="angl"&&v!==.049&&(a.style.borderTopWidth=Yt(v),a.style.borderRightWidth=Yt(v)),s=r.depth+y,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var x;if(e.backgroundColor)x=ui({positionType:"individualShift",children:[{type:"elem",elem:a,shift:s},{type:"elem",elem:r,shift:0}]});else{var w=/cancel|phase/.test(n)?["svg-align"]:[];x=ui({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:s,wrapperClasses:w}]})}return/cancel/.test(n)&&(x.height=r.height,x.depth=r.depth),/cancel/.test(n)&&!o?Dt(["mord","cancel-lap"],[x],t):Dt(["mord"],[x],t)},KA=(e,t)=>{var r,n=new Pt(e.label.includes("colorbox")?"mpadded":"menclose",[Mi(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+Yt(i)+" solid "+e.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};nr({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=Tn(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:s}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=Tn(t[0],"color-token").color,s=Tn(t[1],"color-token").color,o=t[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,borderColor:a,body:o}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});nr({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e;r.mode==="math"&&r.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});kbe={};Tbe={};Yl=class e{constructor(t,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=r,this.end=n}static range(t,r){return r?!t||!t.loc||!r.loc||t.loc.lexer!==r.loc.lexer?null:new e(t.loc.lexer,t.loc.start,r.loc.end):t&&t.loc}},Nc=class e{constructor(t,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=r}range(t,r){return new e(r,Yl.range(this,t))}};ZA=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Bt("{"+e.envName+"} can be used only in display mode.")},Ywt=new Set(["gather","gather*"]);kf=function(t,r){var n,i,a=t.body.length,s=t.hLinesBeforeRow,o=0,l=new Array(a),u=[],h=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),f=1/r.fontMetrics().ptPerEm,d=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var p=r.havingStyle(pn.SCRIPT).sizeMultiplier;d=.2778*(p/r.sizeMultiplier)}var m=t.colSeparationType==="CD"?ga({number:3,unit:"ex"},r):12*f,g=3*f,y=t.arraystretch*m,v=.7*y,x=.3*y,w=0;function C(Ie){for(var ye=0;ye0&&(w+=.25),u.push({pos:w,isDashed:Ie[ye]})}for(C(s[0]),n=0;n0&&(O+=x,SIe))for(n=0;n=o)){var ee=void 0;if(i>0||t.hskipBeforeAndAfter){var ue,ae;ee=(ue=(ae=z)==null?void 0:ae.pregap)!=null?ue:d,ee!==0&&(M=Dt(["arraycolsep"],[]),M.style.width=Yt(ee),N.push(M))}var oe=[];for(n=0;n0){for(var de=Cb("hline",r,h),ie=Cb("hdashline",r,h),Q=[{type:"elem",elem:_e,shift:0}];u.length>0;){var he=u.pop(),xe=he.pos-R;he.isDashed?Q.push({type:"elem",elem:ie,shift:xe}):Q.push({type:"elem",elem:de,shift:xe})}_e=ui({positionType:"individualShift",children:Q})}if(B.length===0)return Dt(["mord"],[_e],r);var ce=ui({positionType:"individualShift",children:B}),ge=Dt(["tag"],[ce],r);return m0([_e,ge])},Xwt={c:"center ",l:"left ",r:"right "},Tf=function(t,r){for(var n=[],i=new Pt("mtd",[],["mtr-glue"]),a=new Pt("mtd",[],["mml-eqn-num"]),s=0;s0){var m=t.cols,g="",y=!1,v=0,x=m.length;m[0].type==="separator"&&(d+="top ",v=1),m[m.length-1].type==="separator"&&(d+="bottom ",x-=1);for(var w=v;w0?"left ":"",d+=I[I.length-1].length>0?"right ":"";for(var L=1;L0&&p&&(y=1),n[m]={type:"align",align:g,pregap:y,postgap:0}}return s.colSeparationType=p?"align":"alignat",s};wf({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=UA(t[0]),n=r?[t[0]]:Tn(t[0],"ordgroup").body,i=n.map(function(s){var o=HA(s),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Bt("Unknown column alignment: "+l,s)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Mm(e.parser,a,AV(e.envName))},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,!"lcr".includes(r))throw new Bt("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=Mm(e.parser,n,AV(e.envName)),s=Math.max(0,...a.body.map(o=>o.length));return a.cols=new Array(s).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=Mm(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=UA(t[0]),n=r?[t[0]]:Tn(t[0],"ordgroup").body,i=n.map(function(o){var l=HA(o),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new Bt("Unknown column alignment: "+u,o)});if(i.length>1)throw new Bt("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5},s=Mm(e.parser,a,"script");if(s.body.length>0&&s.body[0].length>1)throw new Bt("{subarray} can contain only one column");return s},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Mm(e.parser,t,AV(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Cbe,htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){Ywt.has(e.envName)&&ZA(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:EV(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Mm(e.parser,t,"display")},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Cbe,htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){ZA(e);var t={autoTag:EV(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Mm(e.parser,t,"display")},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["CD"],props:{numArgs:0},handler(e){return ZA(e),Owt(e.parser)},htmlBuilder:kf,mathmlBuilder:Tf});Ee("\\nonumber","\\gdef\\@eqnsw{0}");Ee("\\notag","\\nonumber");nr({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Bt(e.funcName+" valid only within array environment")}});Rxe=kbe;nr({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];if(i.type!=="ordgroup")throw new Bt("Invalid environment name",i);for(var a="",s=0;s{var r=e.font,n=t.withFont(r);return hi(e.body,n)},Ebe=(e,t)=>{var r=e.font,n=t.withFont(r);return Mi(e.body,n)},Lxe={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};nr({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=PA(t[0]),a=n;return a in Lxe&&(a=Lxe[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:Sbe,mathmlBuilder:Ebe});nr({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"mclass",mode:r.mode,mclass:YA(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:d0(n)}}});nr({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,breakOnTokenText:i}=e,{mode:a}=r,s=r.parseExpression(!0,i);return{type:"font",mode:a,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:s}}},htmlBuilder:Sbe,mathmlBuilder:Ebe});jwt=(e,t)=>{var r=t.style,n=r.fracNum(),i=r.fracDen(),a;a=t.havingStyle(n);var s=hi(e.numer,a,t);if(e.continued){var o=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height0?m=3*d:m=7*d,g=t.fontMetrics().denom1):(f>0?(p=t.fontMetrics().num2,m=d):(p=t.fontMetrics().num3,m=3*d),g=t.fontMetrics().denom2);var y;if(h){var x=t.fontMetrics().axisHeight;p-s.depth-(x+.5*f){var r=new Pt("mfrac",[Mi(e.numer,t),Mi(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var n=ga(e.barSize,t);r.setAttribute("linethickness",Yt(n))}if(e.leftDelim!=null||e.rightDelim!=null){var i=[];if(e.leftDelim!=null){var a=new Pt("mo",[new Ca(e.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}if(i.push(r),e.rightDelim!=null){var s=new Pt("mo",[new Ca(e.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}return kV(i)}return r},Abe=(e,t)=>{if(!t)return e;var r={type:"styling",mode:e.mode,style:t,body:[e]};return r};nr({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1],s,o=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,o="(",l=")";break;case"\\\\bracefrac":s=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var u=n==="\\cfrac",h=null;return u||n.startsWith("\\d")?h="display":n.startsWith("\\t")&&(h="text"),Abe({type:"genfrac",mode:r.mode,numer:i,denom:a,continued:u,hasBarLine:s,leftDelim:o,rightDelim:l,barSize:null},h)},htmlBuilder:jwt,mathmlBuilder:Kwt});nr({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:n}=e,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:n}}});Ixe=["display","text","script","scriptscript"],Mxe=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};nr({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,n=t[4],i=t[5],a=PA(t[0]),s=a.type==="atom"&&a.family==="open"?Mxe(a.text):null,o=PA(t[1]),l=o.type==="atom"&&o.family==="close"?Mxe(o.text):null,u=Tn(t[2],"size"),h,f=null;u.isBlank?h=!0:(f=u.value,h=f.number>0);var d=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var m=Tn(p.body[0],"textord");d=Ixe[Number(m.text)]}}else p=Tn(p,"textord"),d=Ixe[Number(p.text)];return Abe({type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:f,leftDelim:s,rightDelim:l},d)}});nr({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:n,token:i}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Tn(t[0],"size").value,token:i}}});nr({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=Tn(t[1],"infix").size;if(!a)throw new Error("\\\\abovefrac expected size, but got "+String(a));var s=t[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:s,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null}}});_be=(e,t)=>{var r=t.style,n,i;e.type==="supsub"?(n=e.sup?hi(e.sup,t.havingStyle(r.sup()),t):hi(e.sub,t.havingStyle(r.sub()),t),i=Tn(e.base,"horizBrace")):i=Tn(e,"horizBrace");var a=hi(i.base,t.havingBaseStyle(pn.DISPLAY)),s=WA(i,t),o;if(i.isOver?o=ui({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):o=ui({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:a}]}),n){var l=Dt(["minner",i.isOver?"mover":"munder"],[o],t);i.isOver?o=ui({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):o=ui({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Dt(["minner",i.isOver?"mover":"munder"],[o],t)},Zwt=(e,t)=>{var r=VA(e.label);return new Pt(e.isOver?"mover":"munder",[Mi(e.base,t),r])};nr({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:t[0]}},htmlBuilder:_be,mathmlBuilder:Zwt});nr({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[1],i=Tn(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:Qa(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=ys(e.body,t,!1);return uwt(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=Im(e.body,t);return r instanceof Pt||(r=new Pt("mrow",[r])),r.setAttribute("href",e.href),r}});nr({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=Tn(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a{var{parser:r,funcName:n,token:i}=e,a=Tn(t[0],"raw").string,s=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(n){case"\\htmlClass":l.class=a,o={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,o={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,o={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h{var r=ys(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var i=Dt(n,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>Im(e.body,t)});nr({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:Qa(t[0]),mathml:Qa(t[1])}},htmlBuilder:(e,t)=>{var r=ys(e.html,t,!1);return m0(r)},mathmlBuilder:(e,t)=>Im(e.mathml,t)});Yq=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new Bt("Invalid size: '"+t+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!Hxe(n))throw new Bt("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};nr({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:n}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},s={number:0,unit:"em"},o="";if(r[0])for(var l=Tn(r[0],"raw").string,u=l.split(","),h=0;h{var r=ga(e.height,t),n=0;e.totalheight.number>0&&(n=ga(e.totalheight,t)-r);var i=0;e.width.number>0&&(i=ga(e.width,t));var a={height:Yt(r+n)};i>0&&(a.width=Yt(i)),n>0&&(a.verticalAlign=Yt(-n));var s=new Jq(e.src,e.alt,a);return s.height=r,s.depth=n,s},mathmlBuilder:(e,t)=>{var r=new Pt("mglyph",[]);r.setAttribute("alt",e.alt);var n=ga(e.height,t),i=0;if(e.totalheight.number>0&&(i=ga(e.totalheight,t)-n,r.setAttribute("valign",Yt(-i))),r.setAttribute("height",Yt(n+i)),e.width.number>0){var a=ga(e.width,t);r.setAttribute("width",Yt(a))}return r.setAttribute("src",e.src),r}});nr({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=Tn(t[0],"size");if(r.settings.strict){var a=n[1]==="m",s=i.value.unit==="mu";a?(s||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):s&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(e,t){return Qxe(e.dimension,t)},mathmlBuilder(e,t){var r=ga(e.dimension,t);return new BA(r)}});nr({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=Dt([],[hi(e.body,t)]),r=Dt(["inner"],[r],t)):r=Dt(["inner"],[hi(e.body,t)]);var n=Dt(["fix"],[]),i=Dt([e.alignment],[r,n],t),a=Dt(["strut"]);return a.style.height=Yt(i.height+i.depth),i.depth&&(a.style.verticalAlign=Yt(-i.depth)),i.children.unshift(a),i=Dt(["thinbox"],[i],t),Dt(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var r=new Pt("mpadded",[Mi(e.body,t)]);if(e.alignment!=="rlap"){var n=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});nr({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:n}=e,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",s=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",resetFont:!0,body:s}}});nr({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Bt("Mismatched "+e.funcName)}});Nxe=(e,t)=>{switch(t.style.size){case pn.DISPLAY.size:return e.display;case pn.TEXT.size:return e.text;case pn.SCRIPT.size:return e.script;case pn.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};nr({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:Qa(t[0]),text:Qa(t[1]),script:Qa(t[2]),scriptscript:Qa(t[3])}},htmlBuilder:(e,t)=>{var r=Nxe(e,t),n=ys(r,t,!1);return m0(n)},mathmlBuilder:(e,t)=>{var r=Nxe(e,t);return Im(r,t)}});Rbe=(e,t,r,n,i,a,s)=>{e=Dt([],[e]);var o=r&&d0(r),l,u;if(t){var h=hi(t,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var f=hi(r,n.havingStyle(i.sub()),n);l={elem:f,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-f.height)}}var d;if(u&&l){var p=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+s;d=ui({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Yt(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Yt(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var m=e.height-s;d=ui({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Yt(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(u){var g=e.depth+s;d=ui({positionType:"bottom",positionData:g,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Yt(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return e;var y=[d];if(l&&a!==0&&!o){var v=Dt(["mspace"],[],n);v.style.marginRight=Yt(a),y.unshift(v)}return Dt(["mop","op-limits"],y,n)},Lbe=new Set(["\\smallint"]),Ab=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=Tn(e.base,"op"),i=!0):a=Tn(e,"op");var s=t.style,o=!1;s.size===pn.DISPLAY.size&&a.symbol&&!Lbe.has(a.name)&&(o=!0);var l,u;if(a.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(f=a.name.slice(1),a.name=f==="oiint"?"\\iint":"\\iiint"),l=hl(a.name,h,"math",t,["mop","op-symbol",o?"large-op":"small-op"]),u=l.italic,f.length>0){var d=ebe(f+"Size"+(o?"2":"1"),t);l=ui({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:d,shift:o?.08:0}]}),a.name="\\"+f,l.classes.unshift("mop"),l.italic=u}}else if(a.body){var p=ys(a.body,t,!0);p.length===1&&p[0]instanceof dl?(l=p[0],l.classes[0]="mop"):l=Dt(["mop"],p,t)}else{for(var m=[],g=1;g{var r;if(e.symbol)r=new Pt("mo",[Tu(e.name,e.mode)]),Lbe.has(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new Pt("mo",Oc(e.body,t));else{r=new Pt("mi",[new Ca(e.name.slice(1))]);var n=new Pt("mo",[Tu("\u2061","text")]);e.parentIsSupSub?r=new Pt("mrow",[r,n]):r=nbe([r,n])}return r},Qwt={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};nr({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=n;return i.length===1&&(i=Qwt[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Ab,mathmlBuilder:I5});nr({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Qa(n)}},htmlBuilder:Ab,mathmlBuilder:I5});Jwt={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};nr({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Ab,mathmlBuilder:I5});nr({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Ab,mathmlBuilder:I5});nr({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:r}=e,n=r;return n.length===1&&(n=Jwt[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:Ab,mathmlBuilder:I5});Ibe=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=Tn(e.base,"operatorname"),i=!0):a=Tn(e,"operatorname");var s;if(a.body.length>0){for(var o=a.body.map(f=>{var d="text"in f?f.text:void 0;return typeof d=="string"?{type:"textord",mode:f.mode,text:d}:f}),l=ys(o,t.withFont("mathrm"),!0),u=0;u{for(var r=Oc(e.body,t.withFont("mathrm")),n=!0,i=0;ih.toText()).join("");r=[new Ca(o)]}var l=new Pt("mi",r);l.setAttribute("mathvariant","normal");var u=new Pt("mo",[Tu("\u2061","text")]);return e.parentIsSupSub?new Pt("mrow",[l,u]):nbe([l,u])};nr({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"operatorname",mode:r.mode,body:Qa(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Ibe,mathmlBuilder:ekt});Ee("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");fy({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?m0(ys(e.body,t,!1)):Dt(["mord"],ys(e.body,t,!0),t)},mathmlBuilder(e,t){return Im(e.body,t,!0)}});nr({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=hi(e.body,t.havingCrampedStyle()),n=Cb("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=ui({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]});return Dt(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new Pt("mo",[new Ca("\u203E")]);r.setAttribute("stretchy","true");var n=new Pt("mover",[Mi(e.body,t),r]);return n.setAttribute("accent","true"),n}});nr({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"phantom",mode:r.mode,body:Qa(n)}},htmlBuilder:(e,t)=>{var r=ys(e.body,t.withPhantom(),!1);return m0(r)},mathmlBuilder:(e,t)=>{var r=Oc(e.body,t);return new Pt("mphantom",r)}});Ee("\\hphantom","\\smash{\\phantom{#1}}");nr({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=Dt(["inner"],[hi(e.body,t.withPhantom())]),n=Dt(["fix"],[]);return Dt(["mord","rlap"],[r,n],t)},mathmlBuilder:(e,t)=>{var r=Oc(Qa(e.body),t),n=new Pt("mphantom",r),i=new Pt("mpadded",[n]);return i.setAttribute("width","0px"),i}});nr({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,n=Tn(t[0],"size").value,i=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(e,t){var r=hi(e.body,t),n=ga(e.dy,t);return ui({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Pt("mpadded",[Mi(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});nr({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});nr({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:n}=e,i=r[0],a=Tn(t[0],"size"),s=Tn(t[1],"size");return{type:"rule",mode:n.mode,shift:i&&Tn(i,"size").value,width:a.value,height:s.value}},htmlBuilder(e,t){var r=Dt(["mord","rule"],[],t),n=ga(e.width,t),i=ga(e.height,t),a=e.shift?ga(e.shift,t):0;return r.style.borderRightWidth=Yt(n),r.style.borderTopWidth=Yt(i),r.style.bottom=Yt(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=ga(e.width,t),n=ga(e.height,t),i=e.shift?ga(e.shift,t):0,a=t.color&&t.getColor()||"black",s=new Pt("mspace");s.setAttribute("mathbackground",a),s.setAttribute("width",Yt(r)),s.setAttribute("height",Yt(n));var o=new Pt("mpadded",[s]);return i>=0?o.setAttribute("height",Yt(i)):(o.setAttribute("height",Yt(i)),o.setAttribute("depth",Yt(-i))),o.setAttribute("voffset",Yt(i)),o}});Dxe=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],tkt=(e,t)=>{var r=t.havingSize(e.size);return Mbe(e.body,r,t)};nr({type:"sizing",names:Dxe,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:Dxe.indexOf(n)+1,body:a}},htmlBuilder:tkt,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=Oc(e.body,r),i=new Pt("mstyle",n);return i.setAttribute("mathsize",Yt(r.sizeMultiplier)),i}});nr({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:n}=e,i=!1,a=!1,s=r[0]&&Tn(r[0],"ordgroup");if(s)for(var o,l=0;l{var r=Dt([],[hi(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0),e.smashDepth&&(r.depth=0),e.smashHeight&&e.smashDepth)return Dt(["mord","smash"],[r],t);if(r.children)for(var n=0;n{var r=new Pt("mpadded",[Mi(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});nr({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n}=e,i=r[0],a=t[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(e,t){var r=hi(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=Sb(r,t);var n=t.fontMetrics(),i=n.defaultRuleThickness,a=i;t.style.idr.height+r.depth+s&&(s=(s+f-r.height-r.depth)/2);var d=l.height-r.height-s-u;r.style.paddingLeft=Yt(h);var p=ui({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:l},{type:"kern",size:u}]});if(e.index){var m=t.havingStyle(pn.SCRIPTSCRIPT),g=hi(e.index,m,t),y=.6*(p.height-p.depth),v=ui({positionType:"shift",positionData:-y,children:[{type:"elem",elem:g}]}),x=Dt(["root"],[v]);return Dt(["mord","sqrt"],[x,p],t)}else return Dt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:n}=e;return n?new Pt("mroot",[Mi(r,t),Mi(n,t)]):new Pt("msqrt",[Mi(r,t)])}});dV={display:pn.DISPLAY,text:pn.TEXT,script:pn.SCRIPT,scriptscript:pn.SCRIPTSCRIPT};nr({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!0,r),s=n.slice(1,n.length-5);if(!rkt(s))throw new Error("Unknown style: "+s);return{type:"styling",mode:i.mode,style:s,body:a}},htmlBuilder(e,t){var r=dV[e.style],n=t.havingStyle(r);return e.resetFont&&(n=n.withFont("")),Mbe(e.body,n,t)},mathmlBuilder(e,t){var r=dV[e.style],n=t.havingStyle(r);e.resetFont&&(n=n.withFont(""));var i=Oc(e.body,n),a=new Pt("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=s[e.style];return a.setAttribute("scriptlevel",o[0]),a.setAttribute("displaystyle",o[1]),a}});nkt=function(t,r){var n=t.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===pn.DISPLAY.size||n.alwaysHandleSupSub);return i?Ab:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===pn.DISPLAY.size||n.limits);return a?Ibe:null}else{if(n.type==="accent")return d0(n.base)?CV:null;if(n.type==="horizBrace"){var s=!t.sub;return s===n.isOver?_be:null}else return null}else return null};fy({type:"supsub",htmlBuilder(e,t){var r=nkt(e,t);if(r)return r(e,t);var{base:n,sup:i,sub:a}=e,s=hi(n,t),o,l,u=t.fontMetrics(),h=0,f=0,d=n&&d0(n);if(i){var p=t.havingStyle(t.style.sup());o=hi(i,p,t),d||(h=s.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var m=t.havingStyle(t.style.sub());l=hi(a,m,t),d||(f=s.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}var g;t.style===pn.DISPLAY?g=u.sup1:t.style.cramped?g=u.sup3:g=u.sup2;var y=t.sizeMultiplier,v=Yt(.5/u.ptPerEm/y),x=null;if(l){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(s instanceof dl||w){var C;x=Yt(-((C=s.italic)!=null?C:0))}}var T;if(o&&l){h=Math.max(h,g,o.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var k=u.defaultRuleThickness,S=4*k;if(h-o.depth-(l.height-f)0&&(h+=E,f-=E)}var I=[{type:"elem",elem:l,shift:f,marginRight:v,marginLeft:x},{type:"elem",elem:o,shift:-h,marginRight:v}];T=ui({positionType:"individualShift",children:I})}else if(l){f=Math.max(f,u.sub1,l.height-.8*u.xHeight);var L=[{type:"elem",elem:l,marginLeft:x,marginRight:v}];T=ui({positionType:"shift",positionData:f,children:L})}else if(o)h=Math.max(h,g,o.depth+.25*u.xHeight),T=ui({positionType:"shift",positionData:-h,children:[{type:"elem",elem:o,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var O=lV(s,"right")||"mord";return Dt([O],[s,Dt(["msupsub"],[T])],t)},mathmlBuilder(e,t){var r=!1,n,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(r=!0,n=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[Mi(e.base,t)];e.sub&&a.push(Mi(e.sub,t)),e.sup&&a.push(Mi(e.sup,t));var s;if(r)s=n?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===pn.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===pn.DISPLAY||u.limits)?s="munderover":s="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===pn.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===pn.DISPLAY)?s="munder":s="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===pn.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===pn.DISPLAY)?s="mover":s="msup"}return new Pt(s,a)}});fy({type:"atom",htmlBuilder(e,t){return bV(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new Pt("mo",[Tu(e.text,e.mode)]);if(e.family==="bin"){var n=TV(e,t);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});Nbe={mi:"italic",mn:"normal",mtext:"normal"};fy({type:"mathord",htmlBuilder(e,t){return qA(e,t,"mathord")},mathmlBuilder(e,t){var r=new Pt("mi",[Tu(e.text,e.mode,t)]),n=TV(e,t)||"italic";return n!==Nbe[r.type]&&r.setAttribute("mathvariant",n),r}});fy({type:"textord",htmlBuilder(e,t){return qA(e,t,"textord")},mathmlBuilder(e,t){var r=Tu(e.text,e.mode,t),n=TV(e,t)||"normal",i;return e.mode==="text"?i=new Pt("mtext",[r]):/[0-9]/.test(e.text)?i=new Pt("mn",[r]):e.text==="\\prime"?i=new Pt("mo",[r]):i=new Pt("mi",[r]),n!==Nbe[i.type]&&i.setAttribute("mathvariant",n),i}});Xq={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},jq={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};fy({type:"spacing",htmlBuilder(e,t){if(jq.hasOwnProperty(e.text)){var r=jq[e.text].className||"";if(e.mode==="text"){var n=qA(e,t,"textord");return n.classes.push(r),n}else return Dt(["mspace",r],[bV(e.text,e.mode,t)],t)}else{if(Xq.hasOwnProperty(e.text))return Dt(["mspace",Xq[e.text]],[],t);throw new Bt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(jq.hasOwnProperty(e.text))r=new Pt("mtext",[new Ca("\xA0")]);else{if(Xq.hasOwnProperty(e.text))return new Pt("mspace");throw new Bt('Unknown type of space "'+e.text+'"')}return r}});Oxe=()=>{var e=new Pt("mtd",[]);return e.setAttribute("width","50%"),e};fy({type:"tag",mathmlBuilder(e,t){var r=new Pt("mtable",[new Pt("mtr",[Oxe(),new Pt("mtd",[Im(e.body,t)]),Oxe(),new Pt("mtd",[Im(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});Pxe={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Bxe={"\\textbf":"textbf","\\textmd":"textmd"},ikt={"\\textit":"textit","\\textup":"textup"},Fxe=(e,t)=>{var r=e.font;if(r){if(Pxe[r])return t.withTextFontFamily(Pxe[r]);if(Bxe[r])return t.withTextFontWeight(Bxe[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(ikt[r])};nr({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"text",mode:r.mode,body:Qa(i),font:n}},htmlBuilder(e,t){var r=Fxe(e,t),n=ys(e.body,r,!0);return Dt(["mord","text"],n,r)},mathmlBuilder(e,t){var r=Fxe(e,t);return Im(e.body,r)}});nr({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=hi(e.body,t),n=Cb("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=ui({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]});return Dt(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new Pt("mo",[new Ca("\u203E")]);r.setAttribute("stretchy","true");var n=new Pt("munder",[Mi(e.body,t),r]);return n.setAttribute("accentunder","true"),n}});nr({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=hi(e.body,t),n=t.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return ui({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Pt("mpadded",[Mi(e.body,t)],["vcenter"]);return new Pt("mrow",[r])}});nr({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new Bt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=$xe(e),n=[],i=t.havingStyle(t.style.text()),a=0;ae.body.replace(/ /g,e.star?"\u2423":"\xA0"),Em=tbe,Dbe=`[ \r - ]`,akt="\\\\[a-zA-Z@]+",skt="\\\\[^\uD800-\uDFFF]",okt="("+akt+")"+Dbe+"*",lkt=`\\\\( +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};Am=class{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;r{if(twt(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}},eV={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},rwt={ex:!0,em:!0,mu:!0},Yxe=function(t){return typeof t!="string"&&(t=t.unit),t in eV||t in rwt||t==="ex"},ga=function(t,r){var n;if(t.unit in eV)n=eV[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,t.unit==="ex")n=i.fontMetrics().xHeight;else if(t.unit==="em")n=i.fontMetrics().quad;else throw new Bt("Invalid unit: '"+t.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*n,r.maxSize)},Yt=function(t){return+t.toFixed(4)+"em"},_m=function(t){return t.filter(r=>r).join(" ")},bV=function(t){var r="";for(var n of Object.keys(t)){var i=t[n];i!==void 0&&(r+=L4t(n)+":"+i+";")}return r},Xxe=function(t,r,n){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},jxe=function(t){var r=document.createElement(t);r.className=_m(this.classes),Object.assign(r.style,this.style);for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i/=\x00-\x1f]/,Kxe=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+zo(_m(this.classes))+'"');var n=bV(this.style);n&&(r+=' style="'+zo(n)+'"');for(var i of Object.keys(this.attributes)){if(nwt.test(i))throw new Bt("Invalid attribute name '"+i+"'");r+=" "+i+'="'+zo(this.attributes[i])+'"'}r+=">";for(var a=0;a",r},Rm=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,Xxe.call(this,t,n,i),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return jxe.call(this,"span")}toMarkup(){return Kxe.call(this,"span")}},Tb=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Xxe.call(this,r,i),this.children=n||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return jxe.call(this,"a")}toMarkup(){return Kxe.call(this,"a")}},tV=class{constructor(t,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t=''+zo(this.alt)+'0&&(r=document.createElement("span"),r.style.marginRight=Yt(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=_m(this.classes)),Object.keys(this.style).length>0&&(r=r||document.createElement("span"),Object.assign(r.style,this.style)),r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="0&&(n+="margin-right:"+Yt(this.italic)+";"),n+=bV(this.style),n&&(t=!0,r+=' style="'+zo(n)+'"');var i=zo(this.text);return t?(r+=">",r+=i,r+="",r):i}},oh=class{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i':''}},_5=class{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var t="e instanceof Rm||e instanceof Tb||e instanceof Am,xf={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],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:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],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:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],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:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],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:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],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:[0,.44444,0,0,.63889],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:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],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:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],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:[0,.68611,.17208,0,.8961],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:[0,.69444,.06709,0,.59111],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:[.19444,.44444,.105,0,.53222],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:[.19444,.44444,.105,0,.53222],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:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],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:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],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:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],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:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],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:[0,.68333,.16389,0,.74333],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:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],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:[0,.68333,.16389,0,.74333],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:[0,.69444,.06646,0,.51111],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:[.19444,.43056,.08847,0,.46],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:[.19444,.43056,.08847,0,.46],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:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],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:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],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:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],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:[0,.43056,0,0,.55556],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:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],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:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],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:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],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:[0,.69444,0,0,.66759],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:[0,.44444,0,0,.58472],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:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],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:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],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:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],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:[0,.68333,.08125,.05556,.83125],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:[0,.68333,.02778,.08334,.76278],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:[0,.43056,0,.05556,.48472],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:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],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:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],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:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],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:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],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:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],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:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],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:[0,.69444,.07816,0,.27778],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:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],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:[0,.69444,0,0,.66667],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:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],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:[0,.69444,.0799,0,.5],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:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],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:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],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:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],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:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],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:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},xA={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],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:[.25,.25,.25],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],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},fxe={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\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"};$q={};ia={math:{},text:{}};re="math",Mt="text",we="main",Ue="ams",aa="accent-token",lr="bin",ml="close",Eb="inner",Fr="mathord",Ja="op-token",Dc="open",L5="punct",Xe="rel",p0="spacing",Qe="textord";Y(re,we,Xe,"\u2261","\\equiv",!0);Y(re,we,Xe,"\u227A","\\prec",!0);Y(re,we,Xe,"\u227B","\\succ",!0);Y(re,we,Xe,"\u223C","\\sim",!0);Y(re,we,Xe,"\u22A5","\\perp");Y(re,we,Xe,"\u2AAF","\\preceq",!0);Y(re,we,Xe,"\u2AB0","\\succeq",!0);Y(re,we,Xe,"\u2243","\\simeq",!0);Y(re,we,Xe,"\u2223","\\mid",!0);Y(re,we,Xe,"\u226A","\\ll",!0);Y(re,we,Xe,"\u226B","\\gg",!0);Y(re,we,Xe,"\u224D","\\asymp",!0);Y(re,we,Xe,"\u2225","\\parallel");Y(re,we,Xe,"\u22C8","\\bowtie",!0);Y(re,we,Xe,"\u2323","\\smile",!0);Y(re,we,Xe,"\u2291","\\sqsubseteq",!0);Y(re,we,Xe,"\u2292","\\sqsupseteq",!0);Y(re,we,Xe,"\u2250","\\doteq",!0);Y(re,we,Xe,"\u2322","\\frown",!0);Y(re,we,Xe,"\u220B","\\ni",!0);Y(re,we,Xe,"\u221D","\\propto",!0);Y(re,we,Xe,"\u22A2","\\vdash",!0);Y(re,we,Xe,"\u22A3","\\dashv",!0);Y(re,we,Xe,"\u220B","\\owns");Y(re,we,L5,".","\\ldotp");Y(re,we,L5,"\u22C5","\\cdotp");Y(re,we,L5,"\u22C5","\xB7");Y(Mt,we,Qe,"\u22C5","\xB7");Y(re,we,Qe,"#","\\#");Y(Mt,we,Qe,"#","\\#");Y(re,we,Qe,"&","\\&");Y(Mt,we,Qe,"&","\\&");Y(re,we,Qe,"\u2135","\\aleph",!0);Y(re,we,Qe,"\u2200","\\forall",!0);Y(re,we,Qe,"\u210F","\\hbar",!0);Y(re,we,Qe,"\u2203","\\exists",!0);Y(re,we,Qe,"\u2207","\\nabla",!0);Y(re,we,Qe,"\u266D","\\flat",!0);Y(re,we,Qe,"\u2113","\\ell",!0);Y(re,we,Qe,"\u266E","\\natural",!0);Y(re,we,Qe,"\u2663","\\clubsuit",!0);Y(re,we,Qe,"\u2118","\\wp",!0);Y(re,we,Qe,"\u266F","\\sharp",!0);Y(re,we,Qe,"\u2662","\\diamondsuit",!0);Y(re,we,Qe,"\u211C","\\Re",!0);Y(re,we,Qe,"\u2661","\\heartsuit",!0);Y(re,we,Qe,"\u2111","\\Im",!0);Y(re,we,Qe,"\u2660","\\spadesuit",!0);Y(re,we,Qe,"\xA7","\\S",!0);Y(Mt,we,Qe,"\xA7","\\S");Y(re,we,Qe,"\xB6","\\P",!0);Y(Mt,we,Qe,"\xB6","\\P");Y(re,we,Qe,"\u2020","\\dag");Y(Mt,we,Qe,"\u2020","\\dag");Y(Mt,we,Qe,"\u2020","\\textdagger");Y(re,we,Qe,"\u2021","\\ddag");Y(Mt,we,Qe,"\u2021","\\ddag");Y(Mt,we,Qe,"\u2021","\\textdaggerdbl");Y(re,we,ml,"\u23B1","\\rmoustache",!0);Y(re,we,Dc,"\u23B0","\\lmoustache",!0);Y(re,we,ml,"\u27EF","\\rgroup",!0);Y(re,we,Dc,"\u27EE","\\lgroup",!0);Y(re,we,lr,"\u2213","\\mp",!0);Y(re,we,lr,"\u2296","\\ominus",!0);Y(re,we,lr,"\u228E","\\uplus",!0);Y(re,we,lr,"\u2293","\\sqcap",!0);Y(re,we,lr,"\u2217","\\ast");Y(re,we,lr,"\u2294","\\sqcup",!0);Y(re,we,lr,"\u25EF","\\bigcirc",!0);Y(re,we,lr,"\u2219","\\bullet",!0);Y(re,we,lr,"\u2021","\\ddagger");Y(re,we,lr,"\u2240","\\wr",!0);Y(re,we,lr,"\u2A3F","\\amalg");Y(re,we,lr,"&","\\And");Y(re,we,Xe,"\u27F5","\\longleftarrow",!0);Y(re,we,Xe,"\u21D0","\\Leftarrow",!0);Y(re,we,Xe,"\u27F8","\\Longleftarrow",!0);Y(re,we,Xe,"\u27F6","\\longrightarrow",!0);Y(re,we,Xe,"\u21D2","\\Rightarrow",!0);Y(re,we,Xe,"\u27F9","\\Longrightarrow",!0);Y(re,we,Xe,"\u2194","\\leftrightarrow",!0);Y(re,we,Xe,"\u27F7","\\longleftrightarrow",!0);Y(re,we,Xe,"\u21D4","\\Leftrightarrow",!0);Y(re,we,Xe,"\u27FA","\\Longleftrightarrow",!0);Y(re,we,Xe,"\u21A6","\\mapsto",!0);Y(re,we,Xe,"\u27FC","\\longmapsto",!0);Y(re,we,Xe,"\u2197","\\nearrow",!0);Y(re,we,Xe,"\u21A9","\\hookleftarrow",!0);Y(re,we,Xe,"\u21AA","\\hookrightarrow",!0);Y(re,we,Xe,"\u2198","\\searrow",!0);Y(re,we,Xe,"\u21BC","\\leftharpoonup",!0);Y(re,we,Xe,"\u21C0","\\rightharpoonup",!0);Y(re,we,Xe,"\u2199","\\swarrow",!0);Y(re,we,Xe,"\u21BD","\\leftharpoondown",!0);Y(re,we,Xe,"\u21C1","\\rightharpoondown",!0);Y(re,we,Xe,"\u2196","\\nwarrow",!0);Y(re,we,Xe,"\u21CC","\\rightleftharpoons",!0);Y(re,Ue,Xe,"\u226E","\\nless",!0);Y(re,Ue,Xe,"\uE010","\\@nleqslant");Y(re,Ue,Xe,"\uE011","\\@nleqq");Y(re,Ue,Xe,"\u2A87","\\lneq",!0);Y(re,Ue,Xe,"\u2268","\\lneqq",!0);Y(re,Ue,Xe,"\uE00C","\\@lvertneqq");Y(re,Ue,Xe,"\u22E6","\\lnsim",!0);Y(re,Ue,Xe,"\u2A89","\\lnapprox",!0);Y(re,Ue,Xe,"\u2280","\\nprec",!0);Y(re,Ue,Xe,"\u22E0","\\npreceq",!0);Y(re,Ue,Xe,"\u22E8","\\precnsim",!0);Y(re,Ue,Xe,"\u2AB9","\\precnapprox",!0);Y(re,Ue,Xe,"\u2241","\\nsim",!0);Y(re,Ue,Xe,"\uE006","\\@nshortmid");Y(re,Ue,Xe,"\u2224","\\nmid",!0);Y(re,Ue,Xe,"\u22AC","\\nvdash",!0);Y(re,Ue,Xe,"\u22AD","\\nvDash",!0);Y(re,Ue,Xe,"\u22EA","\\ntriangleleft");Y(re,Ue,Xe,"\u22EC","\\ntrianglelefteq",!0);Y(re,Ue,Xe,"\u228A","\\subsetneq",!0);Y(re,Ue,Xe,"\uE01A","\\@varsubsetneq");Y(re,Ue,Xe,"\u2ACB","\\subsetneqq",!0);Y(re,Ue,Xe,"\uE017","\\@varsubsetneqq");Y(re,Ue,Xe,"\u226F","\\ngtr",!0);Y(re,Ue,Xe,"\uE00F","\\@ngeqslant");Y(re,Ue,Xe,"\uE00E","\\@ngeqq");Y(re,Ue,Xe,"\u2A88","\\gneq",!0);Y(re,Ue,Xe,"\u2269","\\gneqq",!0);Y(re,Ue,Xe,"\uE00D","\\@gvertneqq");Y(re,Ue,Xe,"\u22E7","\\gnsim",!0);Y(re,Ue,Xe,"\u2A8A","\\gnapprox",!0);Y(re,Ue,Xe,"\u2281","\\nsucc",!0);Y(re,Ue,Xe,"\u22E1","\\nsucceq",!0);Y(re,Ue,Xe,"\u22E9","\\succnsim",!0);Y(re,Ue,Xe,"\u2ABA","\\succnapprox",!0);Y(re,Ue,Xe,"\u2246","\\ncong",!0);Y(re,Ue,Xe,"\uE007","\\@nshortparallel");Y(re,Ue,Xe,"\u2226","\\nparallel",!0);Y(re,Ue,Xe,"\u22AF","\\nVDash",!0);Y(re,Ue,Xe,"\u22EB","\\ntriangleright");Y(re,Ue,Xe,"\u22ED","\\ntrianglerighteq",!0);Y(re,Ue,Xe,"\uE018","\\@nsupseteqq");Y(re,Ue,Xe,"\u228B","\\supsetneq",!0);Y(re,Ue,Xe,"\uE01B","\\@varsupsetneq");Y(re,Ue,Xe,"\u2ACC","\\supsetneqq",!0);Y(re,Ue,Xe,"\uE019","\\@varsupsetneqq");Y(re,Ue,Xe,"\u22AE","\\nVdash",!0);Y(re,Ue,Xe,"\u2AB5","\\precneqq",!0);Y(re,Ue,Xe,"\u2AB6","\\succneqq",!0);Y(re,Ue,Xe,"\uE016","\\@nsubseteqq");Y(re,Ue,lr,"\u22B4","\\unlhd");Y(re,Ue,lr,"\u22B5","\\unrhd");Y(re,Ue,Xe,"\u219A","\\nleftarrow",!0);Y(re,Ue,Xe,"\u219B","\\nrightarrow",!0);Y(re,Ue,Xe,"\u21CD","\\nLeftarrow",!0);Y(re,Ue,Xe,"\u21CF","\\nRightarrow",!0);Y(re,Ue,Xe,"\u21AE","\\nleftrightarrow",!0);Y(re,Ue,Xe,"\u21CE","\\nLeftrightarrow",!0);Y(re,Ue,Xe,"\u25B3","\\vartriangle");Y(re,Ue,Qe,"\u210F","\\hslash");Y(re,Ue,Qe,"\u25BD","\\triangledown");Y(re,Ue,Qe,"\u25CA","\\lozenge");Y(re,Ue,Qe,"\u24C8","\\circledS");Y(re,Ue,Qe,"\xAE","\\circledR");Y(Mt,Ue,Qe,"\xAE","\\circledR");Y(re,Ue,Qe,"\u2221","\\measuredangle",!0);Y(re,Ue,Qe,"\u2204","\\nexists");Y(re,Ue,Qe,"\u2127","\\mho");Y(re,Ue,Qe,"\u2132","\\Finv",!0);Y(re,Ue,Qe,"\u2141","\\Game",!0);Y(re,Ue,Qe,"\u2035","\\backprime");Y(re,Ue,Qe,"\u25B2","\\blacktriangle");Y(re,Ue,Qe,"\u25BC","\\blacktriangledown");Y(re,Ue,Qe,"\u25A0","\\blacksquare");Y(re,Ue,Qe,"\u29EB","\\blacklozenge");Y(re,Ue,Qe,"\u2605","\\bigstar");Y(re,Ue,Qe,"\u2222","\\sphericalangle",!0);Y(re,Ue,Qe,"\u2201","\\complement",!0);Y(re,Ue,Qe,"\xF0","\\eth",!0);Y(Mt,we,Qe,"\xF0","\xF0");Y(re,Ue,Qe,"\u2571","\\diagup");Y(re,Ue,Qe,"\u2572","\\diagdown");Y(re,Ue,Qe,"\u25A1","\\square");Y(re,Ue,Qe,"\u25A1","\\Box");Y(re,Ue,Qe,"\u25CA","\\Diamond");Y(re,Ue,Qe,"\xA5","\\yen",!0);Y(Mt,Ue,Qe,"\xA5","\\yen",!0);Y(re,Ue,Qe,"\u2713","\\checkmark",!0);Y(Mt,Ue,Qe,"\u2713","\\checkmark");Y(re,Ue,Qe,"\u2136","\\beth",!0);Y(re,Ue,Qe,"\u2138","\\daleth",!0);Y(re,Ue,Qe,"\u2137","\\gimel",!0);Y(re,Ue,Qe,"\u03DD","\\digamma",!0);Y(re,Ue,Qe,"\u03F0","\\varkappa");Y(re,Ue,Dc,"\u250C","\\@ulcorner",!0);Y(re,Ue,ml,"\u2510","\\@urcorner",!0);Y(re,Ue,Dc,"\u2514","\\@llcorner",!0);Y(re,Ue,ml,"\u2518","\\@lrcorner",!0);Y(re,Ue,Xe,"\u2266","\\leqq",!0);Y(re,Ue,Xe,"\u2A7D","\\leqslant",!0);Y(re,Ue,Xe,"\u2A95","\\eqslantless",!0);Y(re,Ue,Xe,"\u2272","\\lesssim",!0);Y(re,Ue,Xe,"\u2A85","\\lessapprox",!0);Y(re,Ue,Xe,"\u224A","\\approxeq",!0);Y(re,Ue,lr,"\u22D6","\\lessdot");Y(re,Ue,Xe,"\u22D8","\\lll",!0);Y(re,Ue,Xe,"\u2276","\\lessgtr",!0);Y(re,Ue,Xe,"\u22DA","\\lesseqgtr",!0);Y(re,Ue,Xe,"\u2A8B","\\lesseqqgtr",!0);Y(re,Ue,Xe,"\u2251","\\doteqdot");Y(re,Ue,Xe,"\u2253","\\risingdotseq",!0);Y(re,Ue,Xe,"\u2252","\\fallingdotseq",!0);Y(re,Ue,Xe,"\u223D","\\backsim",!0);Y(re,Ue,Xe,"\u22CD","\\backsimeq",!0);Y(re,Ue,Xe,"\u2AC5","\\subseteqq",!0);Y(re,Ue,Xe,"\u22D0","\\Subset",!0);Y(re,Ue,Xe,"\u228F","\\sqsubset",!0);Y(re,Ue,Xe,"\u227C","\\preccurlyeq",!0);Y(re,Ue,Xe,"\u22DE","\\curlyeqprec",!0);Y(re,Ue,Xe,"\u227E","\\precsim",!0);Y(re,Ue,Xe,"\u2AB7","\\precapprox",!0);Y(re,Ue,Xe,"\u22B2","\\vartriangleleft");Y(re,Ue,Xe,"\u22B4","\\trianglelefteq");Y(re,Ue,Xe,"\u22A8","\\vDash",!0);Y(re,Ue,Xe,"\u22AA","\\Vvdash",!0);Y(re,Ue,Xe,"\u2323","\\smallsmile");Y(re,Ue,Xe,"\u2322","\\smallfrown");Y(re,Ue,Xe,"\u224F","\\bumpeq",!0);Y(re,Ue,Xe,"\u224E","\\Bumpeq",!0);Y(re,Ue,Xe,"\u2267","\\geqq",!0);Y(re,Ue,Xe,"\u2A7E","\\geqslant",!0);Y(re,Ue,Xe,"\u2A96","\\eqslantgtr",!0);Y(re,Ue,Xe,"\u2273","\\gtrsim",!0);Y(re,Ue,Xe,"\u2A86","\\gtrapprox",!0);Y(re,Ue,lr,"\u22D7","\\gtrdot");Y(re,Ue,Xe,"\u22D9","\\ggg",!0);Y(re,Ue,Xe,"\u2277","\\gtrless",!0);Y(re,Ue,Xe,"\u22DB","\\gtreqless",!0);Y(re,Ue,Xe,"\u2A8C","\\gtreqqless",!0);Y(re,Ue,Xe,"\u2256","\\eqcirc",!0);Y(re,Ue,Xe,"\u2257","\\circeq",!0);Y(re,Ue,Xe,"\u225C","\\triangleq",!0);Y(re,Ue,Xe,"\u223C","\\thicksim");Y(re,Ue,Xe,"\u2248","\\thickapprox");Y(re,Ue,Xe,"\u2AC6","\\supseteqq",!0);Y(re,Ue,Xe,"\u22D1","\\Supset",!0);Y(re,Ue,Xe,"\u2290","\\sqsupset",!0);Y(re,Ue,Xe,"\u227D","\\succcurlyeq",!0);Y(re,Ue,Xe,"\u22DF","\\curlyeqsucc",!0);Y(re,Ue,Xe,"\u227F","\\succsim",!0);Y(re,Ue,Xe,"\u2AB8","\\succapprox",!0);Y(re,Ue,Xe,"\u22B3","\\vartriangleright");Y(re,Ue,Xe,"\u22B5","\\trianglerighteq");Y(re,Ue,Xe,"\u22A9","\\Vdash",!0);Y(re,Ue,Xe,"\u2223","\\shortmid");Y(re,Ue,Xe,"\u2225","\\shortparallel");Y(re,Ue,Xe,"\u226C","\\between",!0);Y(re,Ue,Xe,"\u22D4","\\pitchfork",!0);Y(re,Ue,Xe,"\u221D","\\varpropto");Y(re,Ue,Xe,"\u25C0","\\blacktriangleleft");Y(re,Ue,Xe,"\u2234","\\therefore",!0);Y(re,Ue,Xe,"\u220D","\\backepsilon");Y(re,Ue,Xe,"\u25B6","\\blacktriangleright");Y(re,Ue,Xe,"\u2235","\\because",!0);Y(re,Ue,Xe,"\u22D8","\\llless");Y(re,Ue,Xe,"\u22D9","\\gggtr");Y(re,Ue,lr,"\u22B2","\\lhd");Y(re,Ue,lr,"\u22B3","\\rhd");Y(re,Ue,Xe,"\u2242","\\eqsim",!0);Y(re,we,Xe,"\u22C8","\\Join");Y(re,Ue,Xe,"\u2251","\\Doteq",!0);Y(re,Ue,lr,"\u2214","\\dotplus",!0);Y(re,Ue,lr,"\u2216","\\smallsetminus");Y(re,Ue,lr,"\u22D2","\\Cap",!0);Y(re,Ue,lr,"\u22D3","\\Cup",!0);Y(re,Ue,lr,"\u2A5E","\\doublebarwedge",!0);Y(re,Ue,lr,"\u229F","\\boxminus",!0);Y(re,Ue,lr,"\u229E","\\boxplus",!0);Y(re,Ue,lr,"\u22C7","\\divideontimes",!0);Y(re,Ue,lr,"\u22C9","\\ltimes",!0);Y(re,Ue,lr,"\u22CA","\\rtimes",!0);Y(re,Ue,lr,"\u22CB","\\leftthreetimes",!0);Y(re,Ue,lr,"\u22CC","\\rightthreetimes",!0);Y(re,Ue,lr,"\u22CF","\\curlywedge",!0);Y(re,Ue,lr,"\u22CE","\\curlyvee",!0);Y(re,Ue,lr,"\u229D","\\circleddash",!0);Y(re,Ue,lr,"\u229B","\\circledast",!0);Y(re,Ue,lr,"\u22C5","\\centerdot");Y(re,Ue,lr,"\u22BA","\\intercal",!0);Y(re,Ue,lr,"\u22D2","\\doublecap");Y(re,Ue,lr,"\u22D3","\\doublecup");Y(re,Ue,lr,"\u22A0","\\boxtimes",!0);Y(re,Ue,Xe,"\u21E2","\\dashrightarrow",!0);Y(re,Ue,Xe,"\u21E0","\\dashleftarrow",!0);Y(re,Ue,Xe,"\u21C7","\\leftleftarrows",!0);Y(re,Ue,Xe,"\u21C6","\\leftrightarrows",!0);Y(re,Ue,Xe,"\u21DA","\\Lleftarrow",!0);Y(re,Ue,Xe,"\u219E","\\twoheadleftarrow",!0);Y(re,Ue,Xe,"\u21A2","\\leftarrowtail",!0);Y(re,Ue,Xe,"\u21AB","\\looparrowleft",!0);Y(re,Ue,Xe,"\u21CB","\\leftrightharpoons",!0);Y(re,Ue,Xe,"\u21B6","\\curvearrowleft",!0);Y(re,Ue,Xe,"\u21BA","\\circlearrowleft",!0);Y(re,Ue,Xe,"\u21B0","\\Lsh",!0);Y(re,Ue,Xe,"\u21C8","\\upuparrows",!0);Y(re,Ue,Xe,"\u21BF","\\upharpoonleft",!0);Y(re,Ue,Xe,"\u21C3","\\downharpoonleft",!0);Y(re,we,Xe,"\u22B6","\\origof",!0);Y(re,we,Xe,"\u22B7","\\imageof",!0);Y(re,Ue,Xe,"\u22B8","\\multimap",!0);Y(re,Ue,Xe,"\u21AD","\\leftrightsquigarrow",!0);Y(re,Ue,Xe,"\u21C9","\\rightrightarrows",!0);Y(re,Ue,Xe,"\u21C4","\\rightleftarrows",!0);Y(re,Ue,Xe,"\u21A0","\\twoheadrightarrow",!0);Y(re,Ue,Xe,"\u21A3","\\rightarrowtail",!0);Y(re,Ue,Xe,"\u21AC","\\looparrowright",!0);Y(re,Ue,Xe,"\u21B7","\\curvearrowright",!0);Y(re,Ue,Xe,"\u21BB","\\circlearrowright",!0);Y(re,Ue,Xe,"\u21B1","\\Rsh",!0);Y(re,Ue,Xe,"\u21CA","\\downdownarrows",!0);Y(re,Ue,Xe,"\u21BE","\\upharpoonright",!0);Y(re,Ue,Xe,"\u21C2","\\downharpoonright",!0);Y(re,Ue,Xe,"\u21DD","\\rightsquigarrow",!0);Y(re,Ue,Xe,"\u21DD","\\leadsto");Y(re,Ue,Xe,"\u21DB","\\Rrightarrow",!0);Y(re,Ue,Xe,"\u21BE","\\restriction");Y(re,we,Qe,"\u2018","`");Y(re,we,Qe,"$","\\$");Y(Mt,we,Qe,"$","\\$");Y(Mt,we,Qe,"$","\\textdollar");Y(re,we,Qe,"%","\\%");Y(Mt,we,Qe,"%","\\%");Y(re,we,Qe,"_","\\_");Y(Mt,we,Qe,"_","\\_");Y(Mt,we,Qe,"_","\\textunderscore");Y(re,we,Qe,"\u2220","\\angle",!0);Y(re,we,Qe,"\u221E","\\infty",!0);Y(re,we,Qe,"\u2032","\\prime");Y(re,we,Qe,"\u25B3","\\triangle");Y(re,we,Qe,"\u0393","\\Gamma",!0);Y(re,we,Qe,"\u0394","\\Delta",!0);Y(re,we,Qe,"\u0398","\\Theta",!0);Y(re,we,Qe,"\u039B","\\Lambda",!0);Y(re,we,Qe,"\u039E","\\Xi",!0);Y(re,we,Qe,"\u03A0","\\Pi",!0);Y(re,we,Qe,"\u03A3","\\Sigma",!0);Y(re,we,Qe,"\u03A5","\\Upsilon",!0);Y(re,we,Qe,"\u03A6","\\Phi",!0);Y(re,we,Qe,"\u03A8","\\Psi",!0);Y(re,we,Qe,"\u03A9","\\Omega",!0);Y(re,we,Qe,"A","\u0391");Y(re,we,Qe,"B","\u0392");Y(re,we,Qe,"E","\u0395");Y(re,we,Qe,"Z","\u0396");Y(re,we,Qe,"H","\u0397");Y(re,we,Qe,"I","\u0399");Y(re,we,Qe,"K","\u039A");Y(re,we,Qe,"M","\u039C");Y(re,we,Qe,"N","\u039D");Y(re,we,Qe,"O","\u039F");Y(re,we,Qe,"P","\u03A1");Y(re,we,Qe,"T","\u03A4");Y(re,we,Qe,"X","\u03A7");Y(re,we,Qe,"\xAC","\\neg",!0);Y(re,we,Qe,"\xAC","\\lnot");Y(re,we,Qe,"\u22A4","\\top");Y(re,we,Qe,"\u22A5","\\bot");Y(re,we,Qe,"\u2205","\\emptyset");Y(re,Ue,Qe,"\u2205","\\varnothing");Y(re,we,Fr,"\u03B1","\\alpha",!0);Y(re,we,Fr,"\u03B2","\\beta",!0);Y(re,we,Fr,"\u03B3","\\gamma",!0);Y(re,we,Fr,"\u03B4","\\delta",!0);Y(re,we,Fr,"\u03F5","\\epsilon",!0);Y(re,we,Fr,"\u03B6","\\zeta",!0);Y(re,we,Fr,"\u03B7","\\eta",!0);Y(re,we,Fr,"\u03B8","\\theta",!0);Y(re,we,Fr,"\u03B9","\\iota",!0);Y(re,we,Fr,"\u03BA","\\kappa",!0);Y(re,we,Fr,"\u03BB","\\lambda",!0);Y(re,we,Fr,"\u03BC","\\mu",!0);Y(re,we,Fr,"\u03BD","\\nu",!0);Y(re,we,Fr,"\u03BE","\\xi",!0);Y(re,we,Fr,"\u03BF","\\omicron",!0);Y(re,we,Fr,"\u03C0","\\pi",!0);Y(re,we,Fr,"\u03C1","\\rho",!0);Y(re,we,Fr,"\u03C3","\\sigma",!0);Y(re,we,Fr,"\u03C4","\\tau",!0);Y(re,we,Fr,"\u03C5","\\upsilon",!0);Y(re,we,Fr,"\u03D5","\\phi",!0);Y(re,we,Fr,"\u03C7","\\chi",!0);Y(re,we,Fr,"\u03C8","\\psi",!0);Y(re,we,Fr,"\u03C9","\\omega",!0);Y(re,we,Fr,"\u03B5","\\varepsilon",!0);Y(re,we,Fr,"\u03D1","\\vartheta",!0);Y(re,we,Fr,"\u03D6","\\varpi",!0);Y(re,we,Fr,"\u03F1","\\varrho",!0);Y(re,we,Fr,"\u03C2","\\varsigma",!0);Y(re,we,Fr,"\u03C6","\\varphi",!0);Y(re,we,lr,"\u2217","*",!0);Y(re,we,lr,"+","+");Y(re,we,lr,"\u2212","-",!0);Y(re,we,lr,"\u22C5","\\cdot",!0);Y(re,we,lr,"\u2218","\\circ",!0);Y(re,we,lr,"\xF7","\\div",!0);Y(re,we,lr,"\xB1","\\pm",!0);Y(re,we,lr,"\xD7","\\times",!0);Y(re,we,lr,"\u2229","\\cap",!0);Y(re,we,lr,"\u222A","\\cup",!0);Y(re,we,lr,"\u2216","\\setminus",!0);Y(re,we,lr,"\u2227","\\land");Y(re,we,lr,"\u2228","\\lor");Y(re,we,lr,"\u2227","\\wedge",!0);Y(re,we,lr,"\u2228","\\vee",!0);Y(re,we,Qe,"\u221A","\\surd");Y(re,we,Dc,"\u27E8","\\langle",!0);Y(re,we,Dc,"\u2223","\\lvert");Y(re,we,Dc,"\u2225","\\lVert");Y(re,we,ml,"?","?");Y(re,we,ml,"!","!");Y(re,we,ml,"\u27E9","\\rangle",!0);Y(re,we,ml,"\u2223","\\rvert");Y(re,we,ml,"\u2225","\\rVert");Y(re,we,Xe,"=","=");Y(re,we,Xe,":",":");Y(re,we,Xe,"\u2248","\\approx",!0);Y(re,we,Xe,"\u2245","\\cong",!0);Y(re,we,Xe,"\u2265","\\ge");Y(re,we,Xe,"\u2265","\\geq",!0);Y(re,we,Xe,"\u2190","\\gets");Y(re,we,Xe,">","\\gt",!0);Y(re,we,Xe,"\u2208","\\in",!0);Y(re,we,Xe,"\uE020","\\@not");Y(re,we,Xe,"\u2282","\\subset",!0);Y(re,we,Xe,"\u2283","\\supset",!0);Y(re,we,Xe,"\u2286","\\subseteq",!0);Y(re,we,Xe,"\u2287","\\supseteq",!0);Y(re,Ue,Xe,"\u2288","\\nsubseteq",!0);Y(re,Ue,Xe,"\u2289","\\nsupseteq",!0);Y(re,we,Xe,"\u22A8","\\models");Y(re,we,Xe,"\u2190","\\leftarrow",!0);Y(re,we,Xe,"\u2264","\\le");Y(re,we,Xe,"\u2264","\\leq",!0);Y(re,we,Xe,"<","\\lt",!0);Y(re,we,Xe,"\u2192","\\rightarrow",!0);Y(re,we,Xe,"\u2192","\\to");Y(re,Ue,Xe,"\u2271","\\ngeq",!0);Y(re,Ue,Xe,"\u2270","\\nleq",!0);Y(re,we,p0,"\xA0","\\ ");Y(re,we,p0,"\xA0","\\space");Y(re,we,p0,"\xA0","\\nobreakspace");Y(Mt,we,p0,"\xA0","\\ ");Y(Mt,we,p0,"\xA0"," ");Y(Mt,we,p0,"\xA0","\\space");Y(Mt,we,p0,"\xA0","\\nobreakspace");Y(re,we,p0,"","\\nobreak");Y(re,we,p0,"","\\allowbreak");Y(re,we,L5,",",",");Y(re,we,L5,";",";");Y(re,Ue,lr,"\u22BC","\\barwedge",!0);Y(re,Ue,lr,"\u22BB","\\veebar",!0);Y(re,we,lr,"\u2299","\\odot",!0);Y(re,we,lr,"\u2295","\\oplus",!0);Y(re,we,lr,"\u2297","\\otimes",!0);Y(re,we,Qe,"\u2202","\\partial",!0);Y(re,we,lr,"\u2298","\\oslash",!0);Y(re,Ue,lr,"\u229A","\\circledcirc",!0);Y(re,Ue,lr,"\u22A1","\\boxdot",!0);Y(re,we,lr,"\u25B3","\\bigtriangleup");Y(re,we,lr,"\u25BD","\\bigtriangledown");Y(re,we,lr,"\u2020","\\dagger");Y(re,we,lr,"\u22C4","\\diamond");Y(re,we,lr,"\u22C6","\\star");Y(re,we,lr,"\u25C3","\\triangleleft");Y(re,we,lr,"\u25B9","\\triangleright");Y(re,we,Dc,"{","\\{");Y(Mt,we,Qe,"{","\\{");Y(Mt,we,Qe,"{","\\textbraceleft");Y(re,we,ml,"}","\\}");Y(Mt,we,Qe,"}","\\}");Y(Mt,we,Qe,"}","\\textbraceright");Y(re,we,Dc,"{","\\lbrace");Y(re,we,ml,"}","\\rbrace");Y(re,we,Dc,"[","\\lbrack",!0);Y(Mt,we,Qe,"[","\\lbrack",!0);Y(re,we,ml,"]","\\rbrack",!0);Y(Mt,we,Qe,"]","\\rbrack",!0);Y(re,we,Dc,"(","\\lparen",!0);Y(re,we,ml,")","\\rparen",!0);Y(Mt,we,Qe,"<","\\textless",!0);Y(Mt,we,Qe,">","\\textgreater",!0);Y(re,we,Dc,"\u230A","\\lfloor",!0);Y(re,we,ml,"\u230B","\\rfloor",!0);Y(re,we,Dc,"\u2308","\\lceil",!0);Y(re,we,ml,"\u2309","\\rceil",!0);Y(re,we,Qe,"\\","\\backslash");Y(re,we,Qe,"\u2223","|");Y(re,we,Qe,"\u2223","\\vert");Y(Mt,we,Qe,"|","\\textbar",!0);Y(re,we,Qe,"\u2225","\\|");Y(re,we,Qe,"\u2225","\\Vert");Y(Mt,we,Qe,"\u2225","\\textbardbl");Y(Mt,we,Qe,"~","\\textasciitilde");Y(Mt,we,Qe,"\\","\\textbackslash");Y(Mt,we,Qe,"^","\\textasciicircum");Y(re,we,Xe,"\u2191","\\uparrow",!0);Y(re,we,Xe,"\u21D1","\\Uparrow",!0);Y(re,we,Xe,"\u2193","\\downarrow",!0);Y(re,we,Xe,"\u21D3","\\Downarrow",!0);Y(re,we,Xe,"\u2195","\\updownarrow",!0);Y(re,we,Xe,"\u21D5","\\Updownarrow",!0);Y(re,we,Ja,"\u2210","\\coprod");Y(re,we,Ja,"\u22C1","\\bigvee");Y(re,we,Ja,"\u22C0","\\bigwedge");Y(re,we,Ja,"\u2A04","\\biguplus");Y(re,we,Ja,"\u22C2","\\bigcap");Y(re,we,Ja,"\u22C3","\\bigcup");Y(re,we,Ja,"\u222B","\\int");Y(re,we,Ja,"\u222B","\\intop");Y(re,we,Ja,"\u222C","\\iint");Y(re,we,Ja,"\u222D","\\iiint");Y(re,we,Ja,"\u220F","\\prod");Y(re,we,Ja,"\u2211","\\sum");Y(re,we,Ja,"\u2A02","\\bigotimes");Y(re,we,Ja,"\u2A01","\\bigoplus");Y(re,we,Ja,"\u2A00","\\bigodot");Y(re,we,Ja,"\u222E","\\oint");Y(re,we,Ja,"\u222F","\\oiint");Y(re,we,Ja,"\u2230","\\oiiint");Y(re,we,Ja,"\u2A06","\\bigsqcup");Y(re,we,Ja,"\u222B","\\smallint");Y(Mt,we,Eb,"\u2026","\\textellipsis");Y(re,we,Eb,"\u2026","\\mathellipsis");Y(Mt,we,Eb,"\u2026","\\ldots",!0);Y(re,we,Eb,"\u2026","\\ldots",!0);Y(re,we,Eb,"\u22EF","\\@cdots",!0);Y(re,we,Eb,"\u22F1","\\ddots",!0);Y(re,we,Qe,"\u22EE","\\varvdots");Y(Mt,we,Qe,"\u22EE","\\varvdots");Y(re,we,aa,"\u02CA","\\acute");Y(re,we,aa,"\u02CB","\\grave");Y(re,we,aa,"\xA8","\\ddot");Y(re,we,aa,"~","\\tilde");Y(re,we,aa,"\u02C9","\\bar");Y(re,we,aa,"\u02D8","\\breve");Y(re,we,aa,"\u02C7","\\check");Y(re,we,aa,"^","\\hat");Y(re,we,aa,"\u20D7","\\vec");Y(re,we,aa,"\u02D9","\\dot");Y(re,we,aa,"\u02DA","\\mathring");Y(re,we,Fr,"\uE131","\\@imath");Y(re,we,Fr,"\uE237","\\@jmath");Y(re,we,Qe,"\u0131","\u0131");Y(re,we,Qe,"\u0237","\u0237");Y(Mt,we,Qe,"\u0131","\\i",!0);Y(Mt,we,Qe,"\u0237","\\j",!0);Y(Mt,we,Qe,"\xDF","\\ss",!0);Y(Mt,we,Qe,"\xE6","\\ae",!0);Y(Mt,we,Qe,"\u0153","\\oe",!0);Y(Mt,we,Qe,"\xF8","\\o",!0);Y(Mt,we,Qe,"\xC6","\\AE",!0);Y(Mt,we,Qe,"\u0152","\\OE",!0);Y(Mt,we,Qe,"\xD8","\\O",!0);Y(Mt,we,aa,"\u02CA","\\'");Y(Mt,we,aa,"\u02CB","\\`");Y(Mt,we,aa,"\u02C6","\\^");Y(Mt,we,aa,"\u02DC","\\~");Y(Mt,we,aa,"\u02C9","\\=");Y(Mt,we,aa,"\u02D8","\\u");Y(Mt,we,aa,"\u02D9","\\.");Y(Mt,we,aa,"\xB8","\\c");Y(Mt,we,aa,"\u02DA","\\r");Y(Mt,we,aa,"\u02C7","\\v");Y(Mt,we,aa,"\xA8",'\\"');Y(Mt,we,aa,"\u02DD","\\H");Y(Mt,we,aa,"\u25EF","\\textcircled");Qxe={"--":!0,"---":!0,"``":!0,"''":!0};Y(Mt,we,Qe,"\u2013","--",!0);Y(Mt,we,Qe,"\u2013","\\textendash");Y(Mt,we,Qe,"\u2014","---",!0);Y(Mt,we,Qe,"\u2014","\\textemdash");Y(Mt,we,Qe,"\u2018","`",!0);Y(Mt,we,Qe,"\u2018","\\textquoteleft");Y(Mt,we,Qe,"\u2019","'",!0);Y(Mt,we,Qe,"\u2019","\\textquoteright");Y(Mt,we,Qe,"\u201C","``",!0);Y(Mt,we,Qe,"\u201C","\\textquotedblleft");Y(Mt,we,Qe,"\u201D","''",!0);Y(Mt,we,Qe,"\u201D","\\textquotedblright");Y(re,we,Qe,"\xB0","\\degree",!0);Y(Mt,we,Qe,"\xB0","\\degree");Y(Mt,we,Qe,"\xB0","\\textdegree",!0);Y(re,we,Qe,"\xA3","\\pounds");Y(re,we,Qe,"\xA3","\\mathsterling",!0);Y(Mt,we,Qe,"\xA3","\\pounds");Y(Mt,we,Qe,"\xA3","\\textsterling",!0);Y(re,Ue,Qe,"\u2720","\\maltese");Y(Mt,Ue,Qe,"\u2720","\\maltese");dxe='0123456789/@."';for(bA=0;bA{var t=e.charCodeAt(0),r=e.charCodeAt(1),n=(t-55296)*1024+(r-56320)+65536;if(119808<=n&&n<120484){var i=Math.floor((n-119808)/26);return wxe[i]}else if(120782<=n&&n<=120831){var a=Math.floor((n-120782)/10);return uwt[a]}else{if(n===120485||n===120486)return wxe[0];if(120486{if(_m(e.classes)!==_m(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n of Object.keys(e.style))if(e.style[n]!==t.style[n])return!1;for(var i of Object.keys(t.style))if(e.style[i]!==t.style[i])return!1;return!0},Jxe=e=>{for(var t=0;tr&&(r=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}t.height=r,t.depth=n,t.maxFontSize=i},Dt=function(t,r,n,i){var a=new Rm(t,r,n,i);return TV(a),a},Lm=(e,t,r,n)=>new Rm(e,t,r,n),Cb=function(t,r,n){var i=Dt([t],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=Yt(i.height),i.maxFontSize=1,i},pwt=function(t,r,n,i){var a=new Tb(t,r,n,i);return TV(a),a},m0=function(t){var r=new Am(t);return TV(r),r},Sb=function(t,r){return t instanceof Am?Dt([],[t],r):t},mwt=function(t){if(t.positionType==="individualShift"){for(var r=t.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,s=1;s{var r=Dt(["mspace"],[],t),n=ga(e,t);return r.style.marginRight=Yt(n),r},CA=(e,t,r)=>{var n,i;switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return t==="textbf"&&r==="textit"?i="BoldItalic":t==="textbf"?i="Bold":r==="textit"?i="Italic":i="Regular",n+"-"+i},oV={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},tbe={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},rbe=function(t,r){var[n,i,a]=tbe[t],s=new bf(n),o=new oh([s],{width:Yt(i),height:Yt(a),style:"width:"+Yt(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),l=Lm(["overlay"],[o],r);return l.height=a,l.style.height=Yt(a),l.style.width=Yt(i),l},ma={number:3,unit:"mu"},uy={number:4,unit:"mu"},h0={number:5,unit:"mu"},gwt={mord:{mop:ma,mbin:uy,mrel:h0,minner:ma},mop:{mord:ma,mop:ma,mrel:h0,minner:ma},mbin:{mord:uy,mop:uy,mopen:uy,minner:uy},mrel:{mord:h0,mop:h0,mopen:h0,minner:h0},mopen:{},mclose:{mop:ma,mbin:uy,mrel:h0,minner:ma},mpunct:{mord:ma,mop:ma,mrel:h0,mopen:ma,mclose:ma,mpunct:ma,minner:ma},minner:{mord:ma,mop:ma,mbin:uy,mrel:h0,mopen:ma,mpunct:ma,minner:ma}},ywt={mord:{mop:ma},mop:{mord:ma,mop:ma},mbin:{},mrel:{},mopen:{},mclose:{mop:ma},mpunct:{},minner:{mop:ma}},nbe={},DA={},OA={};PA=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Qa=function(t){return t.type==="ordgroup"?t.body:[t]},vwt=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),xwt=new Set(["rightmost","mrel","mclose","mpunct"]),bwt={display:pn.DISPLAY,text:pn.TEXT,script:pn.SCRIPT,scriptscript:pn.SCRIPTSCRIPT},wwt={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ys=function(t,r,n,i){i===void 0&&(i=[null,null]);for(var a=[],s=0;s{var y=g.classes[0],v=m.classes[0];y==="mbin"&&xwt.has(v)?g.classes[0]="mord":v==="mbin"&&vwt.has(y)&&(m.classes[0]="mord")},{node:f},d,p),lV(a,(m,g)=>{var y,v,x=uV(g),w=uV(m),C=x&&w?m.hasClass("mtight")?(y=ywt[x])==null?void 0:y[w]:(v=gwt[x])==null?void 0:v[w]:null;if(C)return ebe(C,u)},{node:f},d,p),a},lV=function(t,r,n,i,a){i&&t.push(i);for(var s=0;sd=>{t.splice(f+1,0,d),s++})(s)}i&&t.pop()},ibe=function(t){return t instanceof Am||t instanceof Tb||t instanceof Rm&&t.hasClass("enclosing")?t:null},cV=function(t,r){var n=ibe(t);if(n){var i=n.children;if(i.length){if(r==="right")return cV(i[i.length-1],"right");if(r==="left")return cV(i[0],"left")}}return t},uV=function(t,r){if(!t)return null;r&&(t=cV(t,r));var n=t.classes[0];return wwt[n]||null},R5=function(t,r){var n=["nulldelimiter"].concat(t.baseSizingClasses());return Dt(r.concat(n))},hi=function(t,r,n){if(!t)return Dt();if(DA[t.type]){var i=DA[t.type](t,r);if(n&&r.size!==n.size){i=Dt(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new Bt("Got group of unknown type: '"+t.type+"'")};Pt=class{constructor(t,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=_m(this.classes));for(var n=0;n0&&(t+=' class ="'+zo(_m(this.classes))+'"'),t+=">";for(var n=0;n",t}toText(){return this.children.map(t=>t.toText()).join("")}},Ca=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return zo(this.toText())}toText(){return this.text}},BA=class{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character="\u200A":t>=.1666&&t<=.1667?this.character="\u2009":t>=.2222&&t<=.2223?this.character="\u2005":t>=.2777&&t<=.2778?this.character="\u2005\u200A":t>=-.05556&&t<=-.05555?this.character="\u200A\u2063":t>=-.1667&&t<=-.1666?this.character="\u2009\u2063":t>=-.2223&&t<=-.2222?this.character="\u205F\u2063":t>=-.2778&&t<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Yt(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}},kwt=new Set(["\\imath","\\jmath"]),Twt=new Set(["mrow","mtable"]),Tu=function(t,r,n){return ia[r][t]&&ia[r][t].replace&&t.charCodeAt(0)!==55349&&!(Qxe.hasOwnProperty(t)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(t=ia[r][t].replace),new Ca(t)},CV=function(t){return t.length===1?t[0]:new Pt("mrow",t)},Cwt={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},SV=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var r=t.font;if(!r||r==="mathnormal")return null;var n=e.mode,i=Cwt[r];if(i)return typeof i=="function"?i(e):i;var a=e.text;if(kwt.has(a))return null;if(ia[n][a]){var s=ia[n][a].replace;s&&(a=s)}var o=oV[r].fontName;return wV(a,o,n)?oV[r].variant:null};Oc=function(t,r,n){if(t.length===1){var i=Mi(t[0],r);return n&&i instanceof Pt&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],s,o=0;o=1&&(s.type==="mn"||qq(s))){var u=l.children[0];u instanceof Pt&&u.type==="mn"&&(u.children=[...s.children,...u.children],a.pop())}else if(s.type==="mi"&&s.children.length===1){var h=s.children[0];if(h instanceof Ca&&h.text==="\u0338"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var f=l.children[0];f instanceof Ca&&f.text.length>0&&(f.text=f.text.slice(0,1)+"\u0338"+f.text.slice(1),a.pop())}}}a.push(l),s=l}return a},Im=function(t,r,n){return CV(Oc(t,r,n))},Mi=function(t,r){if(!t)return new Pt("mrow");if(OA[t.type])return OA[t.type](t,r);throw new Bt("Got group of unknown type: '"+t.type+"'")};Swt=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Txe=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Cxe=function(t,r){return r.size<2?t:Swt[t-1][r.size-1]},FA=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=Txe[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(r,t),new e(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:Cxe(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:Txe[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=Cxe(e.BASESIZE,t);return this.size===r&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==e.BASESIZE?["sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=lwt(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};FA.BASESIZE=6;sbe=function(t){return new FA({style:t.displayMode?pn.DISPLAY:pn.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},obe=function(t,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),t=Dt(n,[t])}return t},Ewt=function(t,r,n){var i=sbe(n),a;if(n.output==="mathml")return kxe(t,r,i,n.displayMode,!0);if(n.output==="html"){var s=hV(t,i);a=Dt(["katex"],[s])}else{var o=kxe(t,r,i,n.displayMode,!1),l=hV(t,i);a=Dt(["katex"],[o,l])}return obe(a,n)},Awt=function(t,r,n){var i=sbe(n),a=hV(t,i),s=Dt(["katex"],[a]);return obe(s,n)},_wt={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",underbracket:"\u23B5",overbracket:"\u23B4",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",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},VA=function(t){var r=new Pt("mo",[new Ca(_wt[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},Rwt={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"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,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"],"\\cdlongequal":[["longequal"],3,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],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["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],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Lwt=new Set(["widehat","widecheck","widetilde","utilde"]),WA=function(t,r){function n(){var o=4e5,l=t.label.slice(1);if(Lwt.has(l)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,h,f,d;if(u>5)l==="widehat"||l==="widecheck"?(h=420,o=2364,d=.42,f=l+"4"):(h=312,o=2340,d=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][p],h=[0,239,300,360,420][p],d=[0,.24,.3,.3,.36,.42][p],f=l+p):(o=[0,600,1033,2339,2340][p],h=[0,260,286,306,312][p],d=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var m=new bf(f),g=new oh([m],{width:"100%",height:Yt(d),viewBox:"0 0 "+o+" "+h,preserveAspectRatio:"none"});return{span:Lm([],[g],r),minWidth:0,height:d}}else{var y=[],v=Rwt[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[x,w,C]=v,T=C/1e3,k=x.length,S,E;if(k===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');S=["hide-tail"],E=[v[3]]}else if(k===2)S=["halfarrow-left","halfarrow-right"],E=["xMinYMin","xMaxYMin"];else if(k===3)S=["brace-left","brace-center","brace-right"],E=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+k+" children.");for(var I=0;I0&&(i.style.minWidth=Yt(a)),i},Iwt=function(t,r,n,i,a){var s,o=t.height+t.depth+n+i;if(/fbox|color|angl/.test(r)){if(s=Dt(["stretchy",r],[],a),r==="fbox"){var l=a.color&&a.getColor();l&&(s.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new _5({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new _5({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new oh(u,{width:"100%",height:Yt(o)});s=Lm([],[h],a)}return s.height=o,s.style.height=Yt(o),s},Mwt={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Nwt={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};lbe=e=>{if(e instanceof pl)return e;if(owt(e)&&e.children.length===1)return lbe(e.children[0])},EV=(e,t)=>{var r,n,i;e&&e.type==="supsub"?(n=Tn(e.base,"accent"),r=n.base,e.base=r,i=swt(hi(e,t)),e.base=n):(n=Tn(e,"accent"),r=n.base);var a=hi(r,t.havingCrampedStyle()),s=n.isShifty&&d0(r),o=0;if(s){var l,u;o=(l=(u=lbe(a))==null?void 0:u.skew)!=null?l:0}var h=n.label==="\\c",f=h?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),d;if(n.isStretchy)d=WA(n,t),d=ui({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+Yt(2*o)+")",marginLeft:Yt(2*o)}:void 0}]});else{var p,m;n.label==="\\vec"?(p=rbe("vec",t),m=tbe.vec[1]):(p=qA({type:"textord",mode:n.mode,text:n.label},t,"textord"),p=awt(p),p.italic=0,m=p.width,h&&(f+=p.depth)),d=Dt(["accent-body"],[p]);var g=n.label==="\\textcircled";g&&(d.classes.push("accent-full"),f=a.height);var y=o;g||(y-=m/2),d.style.left=Yt(y),n.label==="\\textcircled"&&(d.style.top=".2em"),d=ui({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-f},{type:"elem",elem:d}]})}var v=Dt(["mord","accent"],[d],t);return i?(i.children[0]=v,i.height=Math.max(v.height,i.height),i.classes[0]="mord",i):v},cbe=(e,t)=>{var r=e.isStretchy?VA(e.label):new Pt("mo",[Tu(e.label,e.mode)]),n=new Pt("mover",[Mi(e.base,t),r]);return n.setAttribute("accent","true"),n},Owt=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));nr({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=PA(t[0]),n=!Owt.test(e.funcName),i=!n||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:EV,mathmlBuilder:cbe});nr({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],n=e.parser.mode;return n==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:EV,mathmlBuilder:cbe});nr({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(e,t)=>{var r=hi(e.base,t),n=WA(e,t),i=e.label==="\\utilde"?.12:0,a=ui({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]});return Dt(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var r=VA(e.label),n=new Pt("munder",[Mi(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});EA=e=>{var t=new Pt("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};nr({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n,funcName:i}=e;return{type:"xArrow",mode:n.mode,label:i,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,n=t.havingStyle(r.sup()),i=Sb(hi(e.body,n,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var s;e.below&&(n=t.havingStyle(r.sub()),s=Sb(hi(e.below,n,t),t),s.classes.push(a+"-arrow-pad"));var o=WA(e,t),l=-t.fontMetrics().axisHeight+.5*o.height,u=-t.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(s){var f=-t.fontMetrics().axisHeight+s.height+.5*o.height+.111;h=ui({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:s,shift:f}]})}else h=ui({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return Dt(["mrel","x-arrow"],[h],t)},mathmlBuilder(e,t){var r=VA(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(e.body){var i=EA(Mi(e.body,t));if(e.below){var a=EA(Mi(e.below,t));n=new Pt("munderover",[r,a,i])}else n=new Pt("mover",[r,i])}else if(e.below){var s=EA(Mi(e.below,t));n=new Pt("munder",[r,s])}else n=EA(),n=new Pt("mover",[r,n]);return n}});nr({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:Qa(i),isCharacterBox:d0(i)}},htmlBuilder:ube,mathmlBuilder:hbe});YA=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};nr({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:YA(t[0]),body:Qa(t[1]),isCharacterBox:d0(t[1])}}});nr({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:n}=e,i=t[1],a=t[0],s;n!=="\\stackrel"?s=YA(i):s="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:Qa(i)},l={type:"supsub",mode:a.mode,base:o,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:s,body:[l],isCharacterBox:d0(l)}},htmlBuilder:ube,mathmlBuilder:hbe});nr({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:YA(t[0]),body:Qa(t[0])}},htmlBuilder(e,t){var r=ys(e.body,t,!0),n=Dt([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=Oc(e.body,t),n=new Pt("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});Pwt={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Sxe=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),Exe=e=>e.type==="textord"&&e.text==="@",Bwt=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;nr({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=Sb(hi(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=Yt(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new Pt("mrow",[Mi(e.label,t)]);return r=new Pt("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new Pt("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});nr({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=Sb(hi(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new Pt("mrow",[Mi(e.fragment,t)])}});nr({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,n=Tn(t[0],"ordgroup"),i=n.body,a="",s=0;s=1114111)throw new Bt("\\@char with invalid code point "+a);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});fbe=(e,t)=>{var r=ys(e.body,t.withColor(e.color),!1);return m0(r)},dbe=(e,t)=>{var r=Oc(e.body,t.withColor(e.color)),n=new Pt("mstyle",r);return n.setAttribute("mathcolor",e.color),n};nr({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,n=Tn(t[0],"color-token").color,i=t[1];return{type:"color",mode:r.mode,color:n,body:Qa(i)}},htmlBuilder:fbe,mathmlBuilder:dbe});nr({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:n}=e,i=Tn(t[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:fbe,mathmlBuilder:dbe});nr({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:n}=e,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&Tn(i,"size").value}},htmlBuilder(e,t){var r=Dt(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=Yt(ga(e.size,t)))),r},mathmlBuilder(e,t){var r=new Pt("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",Yt(ga(e.size,t)))),r}});fV={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},pbe=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Bt("Expected a control sequence",e);return t},zwt=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},mbe=(e,t,r,n)=>{var i=e.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,i,n)};nr({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var n=t.fetch();if(fV[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=fV[n.text]),Tn(t.parseFunction(),"internal");throw new Bt("Invalid token after macro prefix",n)}});nr({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=t.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new Bt("Expected a control sequence",n);for(var a=0,s,o=[[]];t.gullet.future().text!=="{";)if(n=t.gullet.popToken(),n.text==="#"){if(t.gullet.future().text==="{"){s=t.gullet.future(),o[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new Bt('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new Bt('Argument number "'+n.text+'" out of order');a++,o.push([])}else{if(n.text==="EOF")throw new Bt("Expected a macro definition");o[a].push(n.text)}var{tokens:l}=t.gullet.consumeArg();return s&&l.unshift(s),(r==="\\edef"||r==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(i,{tokens:l,numArgs:a,delimiters:o},r===fV[r]),{type:"internal",mode:t.mode}}});nr({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=pbe(t.gullet.popToken());t.gullet.consumeSpaces();var i=zwt(t);return mbe(t,n,i,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});nr({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=pbe(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return mbe(t,n,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});C5=function(t,r,n){var i=ia.math[t]&&ia.math[t].replace,a=wV(i||t,r,n);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},AV=function(t,r,n,i){var a=n.havingBaseStyle(r),s=Dt(i.concat(a.sizingClasses(n)),[t],n),o=a.sizeMultiplier/n.sizeMultiplier;return s.height*=o,s.depth*=o,s.maxFontSize=a.sizeMultiplier,s},gbe=function(t,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Yt(a),t.height-=a,t.depth+=a},Gwt=function(t,r,n,i,a,s){var o=fl(t,"Main-Regular",a,i),l=AV(o,r,i,s);return n&&gbe(l,i,r),l},qwt=function(t,r,n,i){return fl(t,"Size"+r+"-Regular",n,i)},ybe=function(t,r,n,i,a,s){var o=qwt(t,r,a,i),l=AV(Dt(["delimsizing","size"+r],[o],i),pn.TEXT,i,s);return n&&gbe(l,i,pn.TEXT),l},Vq=function(t,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=Dt(["delimsizinginner",i],[Dt([],[fl(t,r,n)])]);return{type:"elem",elem:a}},Wq=function(t,r,n){var i=xf["Size4-Regular"][t.charCodeAt(0)]?xf["Size4-Regular"][t.charCodeAt(0)][4]:xf["Size1-Regular"][t.charCodeAt(0)][4],a=new bf("inner",J4t(t,Math.round(1e3*r))),s=new oh([a],{width:Yt(i),height:Yt(r),style:"width:"+Yt(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),o=Lm([],[s],n);return o.height=r,o.style.height=Yt(r),o.style.width=Yt(i),{type:"elem",elem:o}},dV=.008,AA={type:"kern",size:-1*dV},Vwt=new Set(["|","\\lvert","\\rvert","\\vert"]),Wwt=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),vbe=function(t,r,n,i,a,s){var o,l,u,h,f="",d=0;o=u=h=t,l=null;var p="Size1-Regular";t==="\\uparrow"?u=h="\u23D0":t==="\\Uparrow"?u=h="\u2016":t==="\\downarrow"?o=u="\u23D0":t==="\\Downarrow"?o=u="\u2016":t==="\\updownarrow"?(o="\\uparrow",u="\u23D0",h="\\downarrow"):t==="\\Updownarrow"?(o="\\Uparrow",u="\u2016",h="\\Downarrow"):Vwt.has(t)?(u="\u2223",f="vert",d=333):Wwt.has(t)?(u="\u2225",f="doublevert",d=556):t==="["||t==="\\lbrack"?(o="\u23A1",u="\u23A2",h="\u23A3",p="Size4-Regular",f="lbrack",d=667):t==="]"||t==="\\rbrack"?(o="\u23A4",u="\u23A5",h="\u23A6",p="Size4-Regular",f="rbrack",d=667):t==="\\lfloor"||t==="\u230A"?(u=o="\u23A2",h="\u23A3",p="Size4-Regular",f="lfloor",d=667):t==="\\lceil"||t==="\u2308"?(o="\u23A1",u=h="\u23A2",p="Size4-Regular",f="lceil",d=667):t==="\\rfloor"||t==="\u230B"?(u=o="\u23A5",h="\u23A6",p="Size4-Regular",f="rfloor",d=667):t==="\\rceil"||t==="\u2309"?(o="\u23A4",u=h="\u23A5",p="Size4-Regular",f="rceil",d=667):t==="("||t==="\\lparen"?(o="\u239B",u="\u239C",h="\u239D",p="Size4-Regular",f="lparen",d=875):t===")"||t==="\\rparen"?(o="\u239E",u="\u239F",h="\u23A0",p="Size4-Regular",f="rparen",d=875):t==="\\{"||t==="\\lbrace"?(o="\u23A7",l="\u23A8",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(o="\u23AB",l="\u23AC",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lgroup"||t==="\u27EE"?(o="\u23A7",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\rgroup"||t==="\u27EF"?(o="\u23AB",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lmoustache"||t==="\u23B0"?(o="\u23A7",h="\u23AD",u="\u23AA",p="Size4-Regular"):(t==="\\rmoustache"||t==="\u23B1")&&(o="\u23AB",h="\u23A9",u="\u23AA",p="Size4-Regular");var m=C5(o,p,a),g=m.height+m.depth,y=C5(u,p,a),v=y.height+y.depth,x=C5(h,p,a),w=x.height+x.depth,C=0,T=1;if(l!==null){var k=C5(l,p,a);C=k.height+k.depth,T=2}var S=g+w+C,E=Math.max(0,Math.ceil((r-S)/(T*v))),I=S+E*T*v,L=i.fontMetrics().axisHeight;n&&(L*=i.sizeMultiplier);var O=I/2-L,R=[];if(f.length>0){var A=I-g-w,N=Math.round(I*1e3),M=ewt(f,Math.round(A*1e3)),D=new bf(f,M),B=Yt(d/1e3),P=Yt(N/1e3),$=new oh([D],{width:B,height:P,viewBox:"0 0 "+d+" "+N}),F=Lm([],[$],i);F.height=N/1e3,F.style.width=B,F.style.height=P,R.push({type:"elem",elem:F})}else{if(R.push(Vq(h,p,a)),R.push(AA),l===null){var q=I-g-w+2*dV;R.push(Wq(u,q,i))}else{var G=(I-g-w-C)/2+2*dV;R.push(Wq(u,G,i)),R.push(AA),R.push(Vq(l,p,a)),R.push(AA),R.push(Wq(u,G,i))}R.push(AA),R.push(Vq(o,p,a))}var z=i.havingBaseStyle(pn.TEXT),H=ui({positionType:"bottom",positionData:O,children:R});return AV(Dt(["delimsizing","mult"],[H],z),pn.TEXT,i,s)},Hq=80,Uq=.08,Yq=function(t,r,n,i,a){var s=Q4t(t,i,n),o=new bf(t,s),l=new oh([o],{width:"400em",height:Yt(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return Lm(["hide-tail"],[l],a)},Hwt=function(t,r){var n=r.havingBaseSizing(),i=Tbe("\\surd",t*n.sizeMultiplier,kbe,n),a=n.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),o,l,u,h,f;return i.type==="small"?(h=1e3+1e3*s+Hq,t<1?a=1:t<1.4&&(a=.7),l=(1+s+Uq)/a,u=(1+s)/a,o=Yq("sqrtMain",l,h,s,r),o.style.minWidth="0.853em",f=.833/a):i.type==="large"?(h=(1e3+Hq)*S5[i.size],u=(S5[i.size]+s)/a,l=(S5[i.size]+s+Uq)/a,o=Yq("sqrtSize"+i.size,l,h,s,r),o.style.minWidth="1.02em",f=1/a):(l=t+s+Uq,u=t+s,h=Math.floor(1e3*t+s)+Hq,o=Yq("sqrtTall",l,h,s,r),o.style.minWidth="0.742em",f=1.056),o.height=u,o.style.height=Yt(l),{span:o,advanceWidth:f,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*a}},xbe=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"]),Uwt=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"]),bbe=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),S5=[0,1.2,1.8,2.4,3],wbe=function(t,r,n,i,a){if(t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle"),xbe.has(t)||bbe.has(t))return ybe(t,r,!1,n,i,a);if(Uwt.has(t))return vbe(t,S5[r],!1,n,i,a);throw new Bt("Illegal delimiter: '"+t+"'")},Ywt=[{type:"small",style:pn.SCRIPTSCRIPT},{type:"small",style:pn.SCRIPT},{type:"small",style:pn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Xwt=[{type:"small",style:pn.SCRIPTSCRIPT},{type:"small",style:pn.SCRIPT},{type:"small",style:pn.TEXT},{type:"stack"}],kbe=[{type:"small",style:pn.SCRIPTSCRIPT},{type:"small",style:pn.SCRIPT},{type:"small",style:pn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],jwt=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var r=t.type;throw new Error("Add support for delim type '"+r+"' here.")},Tbe=function(t,r,n,i){for(var a=Math.min(2,3-i.style.size),s=a;sr)return o}return n[n.length-1]},pV=function(t,r,n,i,a,s){t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle");var o;bbe.has(t)?o=Ywt:xbe.has(t)?o=kbe:o=Xwt;var l=Tbe(t,r,o,i);return l.type==="small"?Gwt(t,l.style,n,i,a,s):l.type==="large"?ybe(t,l.size,n,i,a,s):vbe(t,r,n,i,a,s)},Xq=function(t,r,n,i,a,s){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-o,n+o),f=Math.max(h/500*l,2*h-u);return pV(t,f,!0,i,a,s)},Axe={"\\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}},Kwt=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);nr({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=XA(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Axe[e.funcName].size,mclass:Axe[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?Dt([e.mclass]):wbe(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Tu(e.delim,e.mode));var r=new Pt("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=Yt(S5[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});nr({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new Bt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:XA(t[0],e).text,color:r}}});nr({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=XA(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=Tn(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{Rxe(e);for(var r=ys(e.body,t,!0,["mopen","mclose"]),n=0,i=0,a=!1,s=0;s{Rxe(e);var r=Oc(e.body,t);if(e.left!=="."){var n=new Pt("mo",[Tu(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(e.right!=="."){var i=new Pt("mo",[Tu(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),r.push(i)}return CV(r)}});nr({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=XA(t[0],e);if(!e.parser.leftrightDepth)throw new Bt("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;return e.delim==="."?r=R5(t,[]):(r=wbe(e.delim,1,t,e.mode,[]),r.isMiddle={delim:e.delim,options:t}),r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?Tu("|","text"):Tu(e.delim,e.mode),n=new Pt("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});jA=(e,t)=>{var r=Sb(hi(e.body,t),t),n=e.label.slice(1),i=t.sizeMultiplier,a,s,o=d0(e.body);if(n==="sout")a=Dt(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,s=-.5*t.fontMetrics().xHeight;else if(n==="phase"){var l=ga({number:.6,unit:"pt"},t),u=ga({number:.35,unit:"ex"},t),h=t.havingBaseSizing();i=i/h.sizeMultiplier;var f=r.height+r.depth+l+u;r.style.paddingLeft=Yt(f/2+l);var d=Math.floor(1e3*f*i),p=K4t(d),m=new oh([new bf("phase",p)],{width:"400em",height:Yt(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=Lm(["hide-tail"],[m],t),a.style.height=Yt(f),s=r.depth+l+u}else{/cancel/.test(n)?o||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var g,y,v=0;/box/.test(n)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),g=t.fontMetrics().fboxsep+(n==="colorbox"?0:v),y=g):n==="angl"?(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),g=4*v,y=Math.max(0,.25-r.depth)):(g=o?.2:0,y=g),a=Iwt(r,n,g,y,t),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=Yt(v)):n==="angl"&&v!==.049&&(a.style.borderTopWidth=Yt(v),a.style.borderRightWidth=Yt(v)),s=r.depth+y,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var x;if(e.backgroundColor)x=ui({positionType:"individualShift",children:[{type:"elem",elem:a,shift:s},{type:"elem",elem:r,shift:0}]});else{var w=/cancel|phase/.test(n)?["svg-align"]:[];x=ui({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:s,wrapperClasses:w}]})}return/cancel/.test(n)&&(x.height=r.height,x.depth=r.depth),/cancel/.test(n)&&!o?Dt(["mord","cancel-lap"],[x],t):Dt(["mord"],[x],t)},KA=(e,t)=>{var r,n=new Pt(e.label.includes("colorbox")?"mpadded":"menclose",[Mi(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+Yt(i)+" solid "+e.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};nr({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=Tn(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:s}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=Tn(t[0],"color-token").color,s=Tn(t[1],"color-token").color,o=t[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,borderColor:a,body:o}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});nr({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e;r.mode==="math"&&r.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:jA,mathmlBuilder:KA});nr({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});Cbe={};Sbe={};Xl=class e{constructor(t,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=r,this.end=n}static range(t,r){return r?!t||!t.loc||!r.loc||t.loc.lexer!==r.loc.lexer?null:new e(t.loc.lexer,t.loc.start,r.loc.end):t&&t.loc}},Nc=class e{constructor(t,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=r}range(t,r){return new e(r,Xl.range(this,t))}};ZA=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Bt("{"+e.envName+"} can be used only in display mode.")},Zwt=new Set(["gather","gather*"]);kf=function(t,r){var n,i,a=t.body.length,s=t.hLinesBeforeRow,o=0,l=new Array(a),u=[],h=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),f=1/r.fontMetrics().ptPerEm,d=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var p=r.havingStyle(pn.SCRIPT).sizeMultiplier;d=.2778*(p/r.sizeMultiplier)}var m=t.colSeparationType==="CD"?ga({number:3,unit:"ex"},r):12*f,g=3*f,y=t.arraystretch*m,v=.7*y,x=.3*y,w=0;function C(Ie){for(var ye=0;ye0&&(w+=.25),u.push({pos:w,isDashed:Ie[ye]})}for(C(s[0]),n=0;n0&&(O+=x,SIe))for(n=0;n=o)){var ee=void 0;if(i>0||t.hskipBeforeAndAfter){var ue,ae;ee=(ue=(ae=z)==null?void 0:ae.pregap)!=null?ue:d,ee!==0&&(M=Dt(["arraycolsep"],[]),M.style.width=Yt(ee),N.push(M))}var oe=[];for(n=0;n0){for(var de=Cb("hline",r,h),ie=Cb("hdashline",r,h),Q=[{type:"elem",elem:_e,shift:0}];u.length>0;){var he=u.pop(),xe=he.pos-R;he.isDashed?Q.push({type:"elem",elem:ie,shift:xe}):Q.push({type:"elem",elem:de,shift:xe})}_e=ui({positionType:"individualShift",children:Q})}if(B.length===0)return Dt(["mord"],[_e],r);var ce=ui({positionType:"individualShift",children:B}),ge=Dt(["tag"],[ce],r);return m0([_e,ge])},Qwt={c:"center ",l:"left ",r:"right "},Tf=function(t,r){for(var n=[],i=new Pt("mtd",[],["mtr-glue"]),a=new Pt("mtd",[],["mml-eqn-num"]),s=0;s0){var m=t.cols,g="",y=!1,v=0,x=m.length;m[0].type==="separator"&&(d+="top ",v=1),m[m.length-1].type==="separator"&&(d+="bottom ",x-=1);for(var w=v;w0?"left ":"",d+=I[I.length-1].length>0?"right ":"";for(var L=1;L0&&p&&(y=1),n[m]={type:"align",align:g,pregap:y,postgap:0}}return s.colSeparationType=p?"align":"alignat",s};wf({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=UA(t[0]),n=r?[t[0]]:Tn(t[0],"ordgroup").body,i=n.map(function(s){var o=HA(s),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Bt("Unknown column alignment: "+l,s)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Mm(e.parser,a,RV(e.envName))},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,!"lcr".includes(r))throw new Bt("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=Mm(e.parser,n,RV(e.envName)),s=Math.max(0,...a.body.map(o=>o.length));return a.cols=new Array(s).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=Mm(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=UA(t[0]),n=r?[t[0]]:Tn(t[0],"ordgroup").body,i=n.map(function(o){var l=HA(o),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new Bt("Unknown column alignment: "+u,o)});if(i.length>1)throw new Bt("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5},s=Mm(e.parser,a,"script");if(s.body.length>0&&s.body[0].length>1)throw new Bt("{subarray} can contain only one column");return s},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Mm(e.parser,t,RV(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Ebe,htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){Zwt.has(e.envName)&&ZA(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:_V(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Mm(e.parser,t,"display")},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Ebe,htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){ZA(e);var t={autoTag:_V(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Mm(e.parser,t,"display")},htmlBuilder:kf,mathmlBuilder:Tf});wf({type:"array",names:["CD"],props:{numArgs:0},handler(e){return ZA(e),$wt(e.parser)},htmlBuilder:kf,mathmlBuilder:Tf});Ee("\\nonumber","\\gdef\\@eqnsw{0}");Ee("\\notag","\\nonumber");nr({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Bt(e.funcName+" valid only within array environment")}});Ixe=Cbe;nr({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];if(i.type!=="ordgroup")throw new Bt("Invalid environment name",i);for(var a="",s=0;s{var r=e.font,n=t.withFont(r);return hi(e.body,n)},_be=(e,t)=>{var r=e.font,n=t.withFont(r);return Mi(e.body,n)},Mxe={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};nr({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=PA(t[0]),a=n;return a in Mxe&&(a=Mxe[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:Abe,mathmlBuilder:_be});nr({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"mclass",mode:r.mode,mclass:YA(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:d0(n)}}});nr({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,breakOnTokenText:i}=e,{mode:a}=r,s=r.parseExpression(!0,i);return{type:"font",mode:a,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:s}}},htmlBuilder:Abe,mathmlBuilder:_be});Jwt=(e,t)=>{var r=t.style,n=r.fracNum(),i=r.fracDen(),a;a=t.havingStyle(n);var s=hi(e.numer,a,t);if(e.continued){var o=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height0?m=3*d:m=7*d,g=t.fontMetrics().denom1):(f>0?(p=t.fontMetrics().num2,m=d):(p=t.fontMetrics().num3,m=3*d),g=t.fontMetrics().denom2);var y;if(h){var x=t.fontMetrics().axisHeight;p-s.depth-(x+.5*f){var r=new Pt("mfrac",[Mi(e.numer,t),Mi(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var n=ga(e.barSize,t);r.setAttribute("linethickness",Yt(n))}if(e.leftDelim!=null||e.rightDelim!=null){var i=[];if(e.leftDelim!=null){var a=new Pt("mo",[new Ca(e.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}if(i.push(r),e.rightDelim!=null){var s=new Pt("mo",[new Ca(e.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}return CV(i)}return r},Rbe=(e,t)=>{if(!t)return e;var r={type:"styling",mode:e.mode,style:t,body:[e]};return r};nr({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1],s,o=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,o="(",l=")";break;case"\\\\bracefrac":s=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var u=n==="\\cfrac",h=null;return u||n.startsWith("\\d")?h="display":n.startsWith("\\t")&&(h="text"),Rbe({type:"genfrac",mode:r.mode,numer:i,denom:a,continued:u,hasBarLine:s,leftDelim:o,rightDelim:l,barSize:null},h)},htmlBuilder:Jwt,mathmlBuilder:ekt});nr({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:n}=e,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:n}}});Nxe=["display","text","script","scriptscript"],Dxe=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};nr({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,n=t[4],i=t[5],a=PA(t[0]),s=a.type==="atom"&&a.family==="open"?Dxe(a.text):null,o=PA(t[1]),l=o.type==="atom"&&o.family==="close"?Dxe(o.text):null,u=Tn(t[2],"size"),h,f=null;u.isBlank?h=!0:(f=u.value,h=f.number>0);var d=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var m=Tn(p.body[0],"textord");d=Nxe[Number(m.text)]}}else p=Tn(p,"textord"),d=Nxe[Number(p.text)];return Rbe({type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:f,leftDelim:s,rightDelim:l},d)}});nr({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:n,token:i}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Tn(t[0],"size").value,token:i}}});nr({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=Tn(t[1],"infix").size;if(!a)throw new Error("\\\\abovefrac expected size, but got "+String(a));var s=t[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:s,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null}}});Lbe=(e,t)=>{var r=t.style,n,i;e.type==="supsub"?(n=e.sup?hi(e.sup,t.havingStyle(r.sup()),t):hi(e.sub,t.havingStyle(r.sub()),t),i=Tn(e.base,"horizBrace")):i=Tn(e,"horizBrace");var a=hi(i.base,t.havingBaseStyle(pn.DISPLAY)),s=WA(i,t),o;if(i.isOver?o=ui({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):o=ui({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:a}]}),n){var l=Dt(["minner",i.isOver?"mover":"munder"],[o],t);i.isOver?o=ui({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):o=ui({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Dt(["minner",i.isOver?"mover":"munder"],[o],t)},tkt=(e,t)=>{var r=VA(e.label);return new Pt(e.isOver?"mover":"munder",[Mi(e.base,t),r])};nr({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:t[0]}},htmlBuilder:Lbe,mathmlBuilder:tkt});nr({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[1],i=Tn(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:Qa(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=ys(e.body,t,!1);return pwt(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=Im(e.body,t);return r instanceof Pt||(r=new Pt("mrow",[r])),r.setAttribute("href",e.href),r}});nr({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=Tn(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a{var{parser:r,funcName:n,token:i}=e,a=Tn(t[0],"raw").string,s=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(n){case"\\htmlClass":l.class=a,o={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,o={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,o={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h{var r=ys(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var i=Dt(n,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>Im(e.body,t)});nr({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:Qa(t[0]),mathml:Qa(t[1])}},htmlBuilder:(e,t)=>{var r=ys(e.html,t,!1);return m0(r)},mathmlBuilder:(e,t)=>Im(e.mathml,t)});jq=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new Bt("Invalid size: '"+t+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!Yxe(n))throw new Bt("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};nr({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:n}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},s={number:0,unit:"em"},o="";if(r[0])for(var l=Tn(r[0],"raw").string,u=l.split(","),h=0;h{var r=ga(e.height,t),n=0;e.totalheight.number>0&&(n=ga(e.totalheight,t)-r);var i=0;e.width.number>0&&(i=ga(e.width,t));var a={height:Yt(r+n)};i>0&&(a.width=Yt(i)),n>0&&(a.verticalAlign=Yt(-n));var s=new tV(e.src,e.alt,a);return s.height=r,s.depth=n,s},mathmlBuilder:(e,t)=>{var r=new Pt("mglyph",[]);r.setAttribute("alt",e.alt);var n=ga(e.height,t),i=0;if(e.totalheight.number>0&&(i=ga(e.totalheight,t)-n,r.setAttribute("valign",Yt(-i))),r.setAttribute("height",Yt(n+i)),e.width.number>0){var a=ga(e.width,t);r.setAttribute("width",Yt(a))}return r.setAttribute("src",e.src),r}});nr({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=Tn(t[0],"size");if(r.settings.strict){var a=n[1]==="m",s=i.value.unit==="mu";a?(s||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):s&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(e,t){return ebe(e.dimension,t)},mathmlBuilder(e,t){var r=ga(e.dimension,t);return new BA(r)}});nr({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=Dt([],[hi(e.body,t)]),r=Dt(["inner"],[r],t)):r=Dt(["inner"],[hi(e.body,t)]);var n=Dt(["fix"],[]),i=Dt([e.alignment],[r,n],t),a=Dt(["strut"]);return a.style.height=Yt(i.height+i.depth),i.depth&&(a.style.verticalAlign=Yt(-i.depth)),i.children.unshift(a),i=Dt(["thinbox"],[i],t),Dt(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var r=new Pt("mpadded",[Mi(e.body,t)]);if(e.alignment!=="rlap"){var n=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});nr({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:n}=e,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",s=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",resetFont:!0,body:s}}});nr({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Bt("Mismatched "+e.funcName)}});Oxe=(e,t)=>{switch(t.style.size){case pn.DISPLAY.size:return e.display;case pn.TEXT.size:return e.text;case pn.SCRIPT.size:return e.script;case pn.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};nr({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:Qa(t[0]),text:Qa(t[1]),script:Qa(t[2]),scriptscript:Qa(t[3])}},htmlBuilder:(e,t)=>{var r=Oxe(e,t),n=ys(r,t,!1);return m0(n)},mathmlBuilder:(e,t)=>{var r=Oxe(e,t);return Im(r,t)}});Ibe=(e,t,r,n,i,a,s)=>{e=Dt([],[e]);var o=r&&d0(r),l,u;if(t){var h=hi(t,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var f=hi(r,n.havingStyle(i.sub()),n);l={elem:f,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-f.height)}}var d;if(u&&l){var p=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+s;d=ui({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Yt(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Yt(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var m=e.height-s;d=ui({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Yt(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(u){var g=e.depth+s;d=ui({positionType:"bottom",positionData:g,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Yt(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return e;var y=[d];if(l&&a!==0&&!o){var v=Dt(["mspace"],[],n);v.style.marginRight=Yt(a),y.unshift(v)}return Dt(["mop","op-limits"],y,n)},Mbe=new Set(["\\smallint"]),Ab=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=Tn(e.base,"op"),i=!0):a=Tn(e,"op");var s=t.style,o=!1;s.size===pn.DISPLAY.size&&a.symbol&&!Mbe.has(a.name)&&(o=!0);var l,u;if(a.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(f=a.name.slice(1),a.name=f==="oiint"?"\\iint":"\\iiint"),l=fl(a.name,h,"math",t,["mop","op-symbol",o?"large-op":"small-op"]),u=l.italic,f.length>0){var d=rbe(f+"Size"+(o?"2":"1"),t);l=ui({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:d,shift:o?.08:0}]}),a.name="\\"+f,l.classes.unshift("mop"),l.italic=u}}else if(a.body){var p=ys(a.body,t,!0);p.length===1&&p[0]instanceof pl?(l=p[0],l.classes[0]="mop"):l=Dt(["mop"],p,t)}else{for(var m=[],g=1;g{var r;if(e.symbol)r=new Pt("mo",[Tu(e.name,e.mode)]),Mbe.has(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new Pt("mo",Oc(e.body,t));else{r=new Pt("mi",[new Ca(e.name.slice(1))]);var n=new Pt("mo",[Tu("\u2061","text")]);e.parentIsSupSub?r=new Pt("mrow",[r,n]):r=abe([r,n])}return r},rkt={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};nr({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=n;return i.length===1&&(i=rkt[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Ab,mathmlBuilder:I5});nr({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Qa(n)}},htmlBuilder:Ab,mathmlBuilder:I5});nkt={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};nr({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Ab,mathmlBuilder:I5});nr({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Ab,mathmlBuilder:I5});nr({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:r}=e,n=r;return n.length===1&&(n=nkt[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:Ab,mathmlBuilder:I5});Nbe=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=Tn(e.base,"operatorname"),i=!0):a=Tn(e,"operatorname");var s;if(a.body.length>0){for(var o=a.body.map(f=>{var d="text"in f?f.text:void 0;return typeof d=="string"?{type:"textord",mode:f.mode,text:d}:f}),l=ys(o,t.withFont("mathrm"),!0),u=0;u{for(var r=Oc(e.body,t.withFont("mathrm")),n=!0,i=0;ih.toText()).join("");r=[new Ca(o)]}var l=new Pt("mi",r);l.setAttribute("mathvariant","normal");var u=new Pt("mo",[Tu("\u2061","text")]);return e.parentIsSupSub?new Pt("mrow",[l,u]):abe([l,u])};nr({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"operatorname",mode:r.mode,body:Qa(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Nbe,mathmlBuilder:ikt});Ee("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");fy({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?m0(ys(e.body,t,!1)):Dt(["mord"],ys(e.body,t,!0),t)},mathmlBuilder(e,t){return Im(e.body,t,!0)}});nr({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=hi(e.body,t.havingCrampedStyle()),n=Cb("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=ui({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]});return Dt(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new Pt("mo",[new Ca("\u203E")]);r.setAttribute("stretchy","true");var n=new Pt("mover",[Mi(e.body,t),r]);return n.setAttribute("accent","true"),n}});nr({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"phantom",mode:r.mode,body:Qa(n)}},htmlBuilder:(e,t)=>{var r=ys(e.body,t.withPhantom(),!1);return m0(r)},mathmlBuilder:(e,t)=>{var r=Oc(e.body,t);return new Pt("mphantom",r)}});Ee("\\hphantom","\\smash{\\phantom{#1}}");nr({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=Dt(["inner"],[hi(e.body,t.withPhantom())]),n=Dt(["fix"],[]);return Dt(["mord","rlap"],[r,n],t)},mathmlBuilder:(e,t)=>{var r=Oc(Qa(e.body),t),n=new Pt("mphantom",r),i=new Pt("mpadded",[n]);return i.setAttribute("width","0px"),i}});nr({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,n=Tn(t[0],"size").value,i=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(e,t){var r=hi(e.body,t),n=ga(e.dy,t);return ui({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Pt("mpadded",[Mi(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});nr({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});nr({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:n}=e,i=r[0],a=Tn(t[0],"size"),s=Tn(t[1],"size");return{type:"rule",mode:n.mode,shift:i&&Tn(i,"size").value,width:a.value,height:s.value}},htmlBuilder(e,t){var r=Dt(["mord","rule"],[],t),n=ga(e.width,t),i=ga(e.height,t),a=e.shift?ga(e.shift,t):0;return r.style.borderRightWidth=Yt(n),r.style.borderTopWidth=Yt(i),r.style.bottom=Yt(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=ga(e.width,t),n=ga(e.height,t),i=e.shift?ga(e.shift,t):0,a=t.color&&t.getColor()||"black",s=new Pt("mspace");s.setAttribute("mathbackground",a),s.setAttribute("width",Yt(r)),s.setAttribute("height",Yt(n));var o=new Pt("mpadded",[s]);return i>=0?o.setAttribute("height",Yt(i)):(o.setAttribute("height",Yt(i)),o.setAttribute("depth",Yt(-i))),o.setAttribute("voffset",Yt(i)),o}});Pxe=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],akt=(e,t)=>{var r=t.havingSize(e.size);return Dbe(e.body,r,t)};nr({type:"sizing",names:Pxe,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:Pxe.indexOf(n)+1,body:a}},htmlBuilder:akt,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=Oc(e.body,r),i=new Pt("mstyle",n);return i.setAttribute("mathsize",Yt(r.sizeMultiplier)),i}});nr({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:n}=e,i=!1,a=!1,s=r[0]&&Tn(r[0],"ordgroup");if(s)for(var o,l=0;l{var r=Dt([],[hi(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0),e.smashDepth&&(r.depth=0),e.smashHeight&&e.smashDepth)return Dt(["mord","smash"],[r],t);if(r.children)for(var n=0;n{var r=new Pt("mpadded",[Mi(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});nr({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n}=e,i=r[0],a=t[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(e,t){var r=hi(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=Sb(r,t);var n=t.fontMetrics(),i=n.defaultRuleThickness,a=i;t.style.idr.height+r.depth+s&&(s=(s+f-r.height-r.depth)/2);var d=l.height-r.height-s-u;r.style.paddingLeft=Yt(h);var p=ui({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:l},{type:"kern",size:u}]});if(e.index){var m=t.havingStyle(pn.SCRIPTSCRIPT),g=hi(e.index,m,t),y=.6*(p.height-p.depth),v=ui({positionType:"shift",positionData:-y,children:[{type:"elem",elem:g}]}),x=Dt(["root"],[v]);return Dt(["mord","sqrt"],[x,p],t)}else return Dt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:n}=e;return n?new Pt("mroot",[Mi(r,t),Mi(n,t)]):new Pt("msqrt",[Mi(r,t)])}});mV={display:pn.DISPLAY,text:pn.TEXT,script:pn.SCRIPT,scriptscript:pn.SCRIPTSCRIPT};nr({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!0,r),s=n.slice(1,n.length-5);if(!skt(s))throw new Error("Unknown style: "+s);return{type:"styling",mode:i.mode,style:s,body:a}},htmlBuilder(e,t){var r=mV[e.style],n=t.havingStyle(r);return e.resetFont&&(n=n.withFont("")),Dbe(e.body,n,t)},mathmlBuilder(e,t){var r=mV[e.style],n=t.havingStyle(r);e.resetFont&&(n=n.withFont(""));var i=Oc(e.body,n),a=new Pt("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=s[e.style];return a.setAttribute("scriptlevel",o[0]),a.setAttribute("displaystyle",o[1]),a}});okt=function(t,r){var n=t.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===pn.DISPLAY.size||n.alwaysHandleSupSub);return i?Ab:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===pn.DISPLAY.size||n.limits);return a?Nbe:null}else{if(n.type==="accent")return d0(n.base)?EV:null;if(n.type==="horizBrace"){var s=!t.sub;return s===n.isOver?Lbe:null}else return null}else return null};fy({type:"supsub",htmlBuilder(e,t){var r=okt(e,t);if(r)return r(e,t);var{base:n,sup:i,sub:a}=e,s=hi(n,t),o,l,u=t.fontMetrics(),h=0,f=0,d=n&&d0(n);if(i){var p=t.havingStyle(t.style.sup());o=hi(i,p,t),d||(h=s.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var m=t.havingStyle(t.style.sub());l=hi(a,m,t),d||(f=s.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}var g;t.style===pn.DISPLAY?g=u.sup1:t.style.cramped?g=u.sup3:g=u.sup2;var y=t.sizeMultiplier,v=Yt(.5/u.ptPerEm/y),x=null;if(l){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(s instanceof pl||w){var C;x=Yt(-((C=s.italic)!=null?C:0))}}var T;if(o&&l){h=Math.max(h,g,o.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var k=u.defaultRuleThickness,S=4*k;if(h-o.depth-(l.height-f)0&&(h+=E,f-=E)}var I=[{type:"elem",elem:l,shift:f,marginRight:v,marginLeft:x},{type:"elem",elem:o,shift:-h,marginRight:v}];T=ui({positionType:"individualShift",children:I})}else if(l){f=Math.max(f,u.sub1,l.height-.8*u.xHeight);var L=[{type:"elem",elem:l,marginLeft:x,marginRight:v}];T=ui({positionType:"shift",positionData:f,children:L})}else if(o)h=Math.max(h,g,o.depth+.25*u.xHeight),T=ui({positionType:"shift",positionData:-h,children:[{type:"elem",elem:o,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var O=uV(s,"right")||"mord";return Dt([O],[s,Dt(["msupsub"],[T])],t)},mathmlBuilder(e,t){var r=!1,n,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(r=!0,n=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[Mi(e.base,t)];e.sub&&a.push(Mi(e.sub,t)),e.sup&&a.push(Mi(e.sup,t));var s;if(r)s=n?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===pn.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===pn.DISPLAY||u.limits)?s="munderover":s="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===pn.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===pn.DISPLAY)?s="munder":s="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===pn.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===pn.DISPLAY)?s="mover":s="msup"}return new Pt(s,a)}});fy({type:"atom",htmlBuilder(e,t){return kV(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new Pt("mo",[Tu(e.text,e.mode)]);if(e.family==="bin"){var n=SV(e,t);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});Obe={mi:"italic",mn:"normal",mtext:"normal"};fy({type:"mathord",htmlBuilder(e,t){return qA(e,t,"mathord")},mathmlBuilder(e,t){var r=new Pt("mi",[Tu(e.text,e.mode,t)]),n=SV(e,t)||"italic";return n!==Obe[r.type]&&r.setAttribute("mathvariant",n),r}});fy({type:"textord",htmlBuilder(e,t){return qA(e,t,"textord")},mathmlBuilder(e,t){var r=Tu(e.text,e.mode,t),n=SV(e,t)||"normal",i;return e.mode==="text"?i=new Pt("mtext",[r]):/[0-9]/.test(e.text)?i=new Pt("mn",[r]):e.text==="\\prime"?i=new Pt("mo",[r]):i=new Pt("mi",[r]),n!==Obe[i.type]&&i.setAttribute("mathvariant",n),i}});Kq={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Zq={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};fy({type:"spacing",htmlBuilder(e,t){if(Zq.hasOwnProperty(e.text)){var r=Zq[e.text].className||"";if(e.mode==="text"){var n=qA(e,t,"textord");return n.classes.push(r),n}else return Dt(["mspace",r],[kV(e.text,e.mode,t)],t)}else{if(Kq.hasOwnProperty(e.text))return Dt(["mspace",Kq[e.text]],[],t);throw new Bt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(Zq.hasOwnProperty(e.text))r=new Pt("mtext",[new Ca("\xA0")]);else{if(Kq.hasOwnProperty(e.text))return new Pt("mspace");throw new Bt('Unknown type of space "'+e.text+'"')}return r}});Bxe=()=>{var e=new Pt("mtd",[]);return e.setAttribute("width","50%"),e};fy({type:"tag",mathmlBuilder(e,t){var r=new Pt("mtable",[new Pt("mtr",[Bxe(),new Pt("mtd",[Im(e.body,t)]),Bxe(),new Pt("mtd",[Im(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});Fxe={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},$xe={"\\textbf":"textbf","\\textmd":"textmd"},lkt={"\\textit":"textit","\\textup":"textup"},zxe=(e,t)=>{var r=e.font;if(r){if(Fxe[r])return t.withTextFontFamily(Fxe[r]);if($xe[r])return t.withTextFontWeight($xe[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(lkt[r])};nr({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"text",mode:r.mode,body:Qa(i),font:n}},htmlBuilder(e,t){var r=zxe(e,t),n=ys(e.body,r,!0);return Dt(["mord","text"],n,r)},mathmlBuilder(e,t){var r=zxe(e,t);return Im(e.body,r)}});nr({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=hi(e.body,t),n=Cb("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=ui({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]});return Dt(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new Pt("mo",[new Ca("\u203E")]);r.setAttribute("stretchy","true");var n=new Pt("munder",[Mi(e.body,t),r]);return n.setAttribute("accentunder","true"),n}});nr({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=hi(e.body,t),n=t.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return ui({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Pt("mpadded",[Mi(e.body,t)],["vcenter"]);return new Pt("mrow",[r])}});nr({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new Bt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=Gxe(e),n=[],i=t.havingStyle(t.style.text()),a=0;ae.body.replace(/ /g,e.star?"\u2423":"\xA0"),Em=nbe,Pbe=`[ \r + ]`,ckt="\\\\[a-zA-Z@]+",ukt="\\\\[^\uD800-\uDFFF]",hkt="("+ckt+")"+Pbe+"*",fkt=`\\\\( |[ \r ]+ -?)[ \r ]*`,pV="[\u0300-\u036F]",ckt=new RegExp(pV+"+$"),ukt="("+Dbe+"+)|"+(lkt+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(pV+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(pV+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+okt)+("|"+skt+")"),$A=class{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(ukt,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Nc("EOF",new Yl(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new Bt("Unexpected character: '"+t[r]+"'",new Nc(t[r],new Yl(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(` -`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Nc(i,new Yl(this,r,this.tokenRegex.lastIndex))}},mV=class{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Bt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}},hkt=Tbe;Ee("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Ee("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Ee("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Ee("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Ee("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});Ee("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Ee("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});zxe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ee("\\char",function(e){var t=e.popToken(),r,n=0;if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Bt("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=zxe[t.text],n==null||n>=r)throw new Bt("Invalid base-"+r+" digit "+t.text);for(var i;(i=zxe[e.future().text])!=null&&i{var i=e.consumeArg().tokens;if(i.length!==1)throw new Bt("\\newcommand's first argument must be a macro name");var a=i[0].text,s=e.isDefined(a);if(s&&!t)throw new Bt("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!s&&!r)throw new Bt("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var o=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Bt("Invalid number of arguments: "+l);o=parseInt(l),i=e.consumeArg().tokens}return s&&n||e.macros.set(a,{tokens:i,numArgs:o}),""};Ee("\\newcommand",e=>_V(e,!1,!0,!1));Ee("\\renewcommand",e=>_V(e,!0,!1,!1));Ee("\\providecommand",e=>_V(e,!0,!0,!0));Ee("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});Ee("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});Ee("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),Em[r],ia.math[r],ia.text[r]),""});Ee("\\bgroup","{");Ee("\\egroup","}");Ee("~","\\nobreakspace");Ee("\\lq","`");Ee("\\rq","'");Ee("\\aa","\\r a");Ee("\\AA","\\r A");Ee("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");Ee("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Ee("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");Ee("\u212C","\\mathscr{B}");Ee("\u2130","\\mathscr{E}");Ee("\u2131","\\mathscr{F}");Ee("\u210B","\\mathscr{H}");Ee("\u2110","\\mathscr{I}");Ee("\u2112","\\mathscr{L}");Ee("\u2133","\\mathscr{M}");Ee("\u211B","\\mathscr{R}");Ee("\u212D","\\mathfrak{C}");Ee("\u210C","\\mathfrak{H}");Ee("\u2128","\\mathfrak{Z}");Ee("\\Bbbk","\\Bbb{k}");Ee("\\llap","\\mathllap{\\textrm{#1}}");Ee("\\rlap","\\mathrlap{\\textrm{#1}}");Ee("\\clap","\\mathclap{\\textrm{#1}}");Ee("\\mathstrut","\\vphantom{(}");Ee("\\underbar","\\underline{\\text{#1}}");Ee("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Ee("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");Ee("\\ne","\\neq");Ee("\u2260","\\neq");Ee("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");Ee("\u2209","\\notin");Ee("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");Ee("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");Ee("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");Ee("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");Ee("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");Ee("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");Ee("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");Ee("\u27C2","\\perp");Ee("\u203C","\\mathclose{!\\mkern-0.8mu!}");Ee("\u220C","\\notni");Ee("\u231C","\\ulcorner");Ee("\u231D","\\urcorner");Ee("\u231E","\\llcorner");Ee("\u231F","\\lrcorner");Ee("\xA9","\\copyright");Ee("\xAE","\\textregistered");Ee("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Ee("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Ee("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Ee("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Ee("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Ee("\u22EE","\\vdots");Ee("\\varGamma","\\mathit{\\Gamma}");Ee("\\varDelta","\\mathit{\\Delta}");Ee("\\varTheta","\\mathit{\\Theta}");Ee("\\varLambda","\\mathit{\\Lambda}");Ee("\\varXi","\\mathit{\\Xi}");Ee("\\varPi","\\mathit{\\Pi}");Ee("\\varSigma","\\mathit{\\Sigma}");Ee("\\varUpsilon","\\mathit{\\Upsilon}");Ee("\\varPhi","\\mathit{\\Phi}");Ee("\\varPsi","\\mathit{\\Psi}");Ee("\\varOmega","\\mathit{\\Omega}");Ee("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Ee("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Ee("\\boxed","\\fbox{$\\displaystyle{#1}$}");Ee("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Ee("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Ee("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Ee("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Ee("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");Gxe={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},fkt=new Set(["bin","rel"]);Ee("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Gxe?t=Gxe[r]:(r.slice(0,4)==="\\not"||r in ia.math&&fkt.has(ia.math[r].group))&&(t="\\dotsb"),t});RV={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ee("\\dotso",function(e){var t=e.future().text;return t in RV?"\\ldots\\,":"\\ldots"});Ee("\\dotsc",function(e){var t=e.future().text;return t in RV&&t!==","?"\\ldots\\,":"\\ldots"});Ee("\\cdots",function(e){var t=e.future().text;return t in RV?"\\@cdots\\,":"\\@cdots"});Ee("\\dotsb","\\cdots");Ee("\\dotsm","\\cdots");Ee("\\dotsi","\\!\\cdots");Ee("\\dotsx","\\ldots\\,");Ee("\\DOTSI","\\relax");Ee("\\DOTSB","\\relax");Ee("\\DOTSX","\\relax");Ee("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Ee("\\,","\\tmspace+{3mu}{.1667em}");Ee("\\thinspace","\\,");Ee("\\>","\\mskip{4mu}");Ee("\\:","\\tmspace+{4mu}{.2222em}");Ee("\\medspace","\\:");Ee("\\;","\\tmspace+{5mu}{.2777em}");Ee("\\thickspace","\\;");Ee("\\!","\\tmspace-{3mu}{.1667em}");Ee("\\negthinspace","\\!");Ee("\\negmedspace","\\tmspace-{4mu}{.2222em}");Ee("\\negthickspace","\\tmspace-{5mu}{.277em}");Ee("\\enspace","\\kern.5em ");Ee("\\enskip","\\hskip.5em\\relax");Ee("\\quad","\\hskip1em\\relax");Ee("\\qquad","\\hskip2em\\relax");Ee("\\tag","\\@ifstar\\tag@literal\\tag@paren");Ee("\\tag@paren","\\tag@literal{({#1})}");Ee("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Bt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Ee("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Ee("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Ee("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Ee("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Ee("\\newline","\\\\\\relax");Ee("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");Obe=Yt(xf["Main-Regular"][84][1]-.7*xf["Main-Regular"][65][1]);Ee("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Obe+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ee("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Obe+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Ee("\\hspace","\\@ifstar\\@hspacer\\@hspace");Ee("\\@hspace","\\hskip #1\\relax");Ee("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Ee("\\ordinarycolon",":");Ee("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Ee("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Ee("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Ee("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Ee("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Ee("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Ee("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Ee("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Ee("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Ee("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Ee("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Ee("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Ee("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Ee("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Ee("\u2237","\\dblcolon");Ee("\u2239","\\eqcolon");Ee("\u2254","\\coloneqq");Ee("\u2255","\\eqqcolon");Ee("\u2A74","\\Coloneqq");Ee("\\ratio","\\vcentcolon");Ee("\\coloncolon","\\dblcolon");Ee("\\colonequals","\\coloneqq");Ee("\\coloncolonequals","\\Coloneqq");Ee("\\equalscolon","\\eqqcolon");Ee("\\equalscoloncolon","\\Eqqcolon");Ee("\\colonminus","\\coloneq");Ee("\\coloncolonminus","\\Coloneq");Ee("\\minuscolon","\\eqcolon");Ee("\\minuscoloncolon","\\Eqcolon");Ee("\\coloncolonapprox","\\Colonapprox");Ee("\\coloncolonsim","\\Colonsim");Ee("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ee("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ee("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ee("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ee("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");Ee("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Ee("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Ee("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Ee("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Ee("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Ee("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Ee("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Ee("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Ee("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");Ee("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");Ee("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");Ee("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");Ee("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");Ee("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");Ee("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");Ee("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");Ee("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");Ee("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");Ee("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");Ee("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");Ee("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");Ee("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");Ee("\\imath","\\html@mathml{\\@imath}{\u0131}");Ee("\\jmath","\\html@mathml{\\@jmath}{\u0237}");Ee("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");Ee("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");Ee("\u27E6","\\llbracket");Ee("\u27E7","\\rrbracket");Ee("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");Ee("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");Ee("\u2983","\\lBrace");Ee("\u2984","\\rBrace");Ee("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");Ee("\u29B5","\\minuso");Ee("\\darr","\\downarrow");Ee("\\dArr","\\Downarrow");Ee("\\Darr","\\Downarrow");Ee("\\lang","\\langle");Ee("\\rang","\\rangle");Ee("\\uarr","\\uparrow");Ee("\\uArr","\\Uparrow");Ee("\\Uarr","\\Uparrow");Ee("\\N","\\mathbb{N}");Ee("\\R","\\mathbb{R}");Ee("\\Z","\\mathbb{Z}");Ee("\\alef","\\aleph");Ee("\\alefsym","\\aleph");Ee("\\Alpha","\\mathrm{A}");Ee("\\Beta","\\mathrm{B}");Ee("\\bull","\\bullet");Ee("\\Chi","\\mathrm{X}");Ee("\\clubs","\\clubsuit");Ee("\\cnums","\\mathbb{C}");Ee("\\Complex","\\mathbb{C}");Ee("\\Dagger","\\ddagger");Ee("\\diamonds","\\diamondsuit");Ee("\\empty","\\emptyset");Ee("\\Epsilon","\\mathrm{E}");Ee("\\Eta","\\mathrm{H}");Ee("\\exist","\\exists");Ee("\\harr","\\leftrightarrow");Ee("\\hArr","\\Leftrightarrow");Ee("\\Harr","\\Leftrightarrow");Ee("\\hearts","\\heartsuit");Ee("\\image","\\Im");Ee("\\infin","\\infty");Ee("\\Iota","\\mathrm{I}");Ee("\\isin","\\in");Ee("\\Kappa","\\mathrm{K}");Ee("\\larr","\\leftarrow");Ee("\\lArr","\\Leftarrow");Ee("\\Larr","\\Leftarrow");Ee("\\lrarr","\\leftrightarrow");Ee("\\lrArr","\\Leftrightarrow");Ee("\\Lrarr","\\Leftrightarrow");Ee("\\Mu","\\mathrm{M}");Ee("\\natnums","\\mathbb{N}");Ee("\\Nu","\\mathrm{N}");Ee("\\Omicron","\\mathrm{O}");Ee("\\plusmn","\\pm");Ee("\\rarr","\\rightarrow");Ee("\\rArr","\\Rightarrow");Ee("\\Rarr","\\Rightarrow");Ee("\\real","\\Re");Ee("\\reals","\\mathbb{R}");Ee("\\Reals","\\mathbb{R}");Ee("\\Rho","\\mathrm{P}");Ee("\\sdot","\\cdot");Ee("\\sect","\\S");Ee("\\spades","\\spadesuit");Ee("\\sub","\\subset");Ee("\\sube","\\subseteq");Ee("\\supe","\\supseteq");Ee("\\Tau","\\mathrm{T}");Ee("\\thetasym","\\vartheta");Ee("\\weierp","\\wp");Ee("\\Zeta","\\mathrm{Z}");Ee("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Ee("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Ee("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Ee("\\bra","\\mathinner{\\langle{#1}|}");Ee("\\ket","\\mathinner{|{#1}\\rangle}");Ee("\\braket","\\mathinner{\\langle{#1}\\rangle}");Ee("\\Bra","\\left\\langle#1\\right|");Ee("\\Ket","\\left|#1\\right\\rangle");Pbe=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.macros.get("|"),o=t.macros.get("\\|");t.macros.beginGroup();var l=f=>d=>{e&&(d.macros.set("|",s),i.length&&d.macros.set("\\|",o));var p=f;if(!f&&i.length){var m=d.future();m.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};t.macros.set("|",l(!1)),i.length&&t.macros.set("\\|",l(!0));var u=t.consumeArg().tokens,h=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};Ee("\\bra@ket",Pbe(!1));Ee("\\bra@set",Pbe(!0));Ee("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Ee("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Ee("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Ee("\\angln","{\\angl n}");Ee("\\blue","\\textcolor{##6495ed}{#1}");Ee("\\orange","\\textcolor{##ffa500}{#1}");Ee("\\pink","\\textcolor{##ff00af}{#1}");Ee("\\red","\\textcolor{##df0030}{#1}");Ee("\\green","\\textcolor{##28ae7b}{#1}");Ee("\\gray","\\textcolor{gray}{#1}");Ee("\\purple","\\textcolor{##9d38bd}{#1}");Ee("\\blueA","\\textcolor{##ccfaff}{#1}");Ee("\\blueB","\\textcolor{##80f6ff}{#1}");Ee("\\blueC","\\textcolor{##63d9ea}{#1}");Ee("\\blueD","\\textcolor{##11accd}{#1}");Ee("\\blueE","\\textcolor{##0c7f99}{#1}");Ee("\\tealA","\\textcolor{##94fff5}{#1}");Ee("\\tealB","\\textcolor{##26edd5}{#1}");Ee("\\tealC","\\textcolor{##01d1c1}{#1}");Ee("\\tealD","\\textcolor{##01a995}{#1}");Ee("\\tealE","\\textcolor{##208170}{#1}");Ee("\\greenA","\\textcolor{##b6ffb0}{#1}");Ee("\\greenB","\\textcolor{##8af281}{#1}");Ee("\\greenC","\\textcolor{##74cf70}{#1}");Ee("\\greenD","\\textcolor{##1fab54}{#1}");Ee("\\greenE","\\textcolor{##0d923f}{#1}");Ee("\\goldA","\\textcolor{##ffd0a9}{#1}");Ee("\\goldB","\\textcolor{##ffbb71}{#1}");Ee("\\goldC","\\textcolor{##ff9c39}{#1}");Ee("\\goldD","\\textcolor{##e07d10}{#1}");Ee("\\goldE","\\textcolor{##a75a05}{#1}");Ee("\\redA","\\textcolor{##fca9a9}{#1}");Ee("\\redB","\\textcolor{##ff8482}{#1}");Ee("\\redC","\\textcolor{##f9685d}{#1}");Ee("\\redD","\\textcolor{##e84d39}{#1}");Ee("\\redE","\\textcolor{##bc2612}{#1}");Ee("\\maroonA","\\textcolor{##ffbde0}{#1}");Ee("\\maroonB","\\textcolor{##ff92c6}{#1}");Ee("\\maroonC","\\textcolor{##ed5fa6}{#1}");Ee("\\maroonD","\\textcolor{##ca337c}{#1}");Ee("\\maroonE","\\textcolor{##9e034e}{#1}");Ee("\\purpleA","\\textcolor{##ddd7ff}{#1}");Ee("\\purpleB","\\textcolor{##c6b9fc}{#1}");Ee("\\purpleC","\\textcolor{##aa87ff}{#1}");Ee("\\purpleD","\\textcolor{##7854ab}{#1}");Ee("\\purpleE","\\textcolor{##543b78}{#1}");Ee("\\mintA","\\textcolor{##f5f9e8}{#1}");Ee("\\mintB","\\textcolor{##edf2df}{#1}");Ee("\\mintC","\\textcolor{##e0e5cc}{#1}");Ee("\\grayA","\\textcolor{##f6f7f7}{#1}");Ee("\\grayB","\\textcolor{##f0f1f2}{#1}");Ee("\\grayC","\\textcolor{##e3e5e6}{#1}");Ee("\\grayD","\\textcolor{##d6d8da}{#1}");Ee("\\grayE","\\textcolor{##babec2}{#1}");Ee("\\grayF","\\textcolor{##888d93}{#1}");Ee("\\grayG","\\textcolor{##626569}{#1}");Ee("\\grayH","\\textcolor{##3b3e40}{#1}");Ee("\\grayI","\\textcolor{##21242c}{#1}");Ee("\\kaBlue","\\textcolor{##314453}{#1}");Ee("\\kaGreen","\\textcolor{##71B307}{#1}");Bbe={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},gV=class{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new mV(hkt,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new $A(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new Nc("EOF",n.loc)),this.pushTokens(i),new Nc("",Yl.range(r,n))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,s=0,o=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++s;else if(a.text==="}"){if(--s,s===-1)throw new Bt("Extra }",a)}else if(a.text==="EOF")throw new Bt("Unexpected end of input in a macro argument, expected '"+(t&&n?t[o]:"}")+"'",a);if(t&&n)if((s===0||s===1&&t[o]==="{")&&a.text===t[o]){if(++o,o===t.length){r.splice(-o,o);break}}else o=0}while(s!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new Bt("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;ithis.settings.maxExpand)throw new Bt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new Bt("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,s=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var o=a.length-1;o>=0;--o){var l=a[o];if(l.text==="#"){if(o===0)throw new Bt("Incomplete placeholder at end of macro body",l);if(l=a[--o],l.text==="#")a.splice(o+1,1);else if(/^[1-9]$/.test(l.text))a.splice(o,2,...s[+l.text-1]);else throw new Bt("Not a valid argument number",l)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Nc(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.includes("#"))for(var s=i.replace(/##/g,"");s.includes("#"+(a+1));)++a;for(var o=new $A(i,this.settings),l=[],u=o.lex();u.text!=="EOF";)l.push(u),u=o.lex();l.reverse();var h={tokens:l,numArgs:a};return h}return i}isDefined(t){return this.macros.has(t)||Em.hasOwnProperty(t)||ia.math.hasOwnProperty(t)||ia.text.hasOwnProperty(t)||Bbe.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Em.hasOwnProperty(t)&&!Em[t].primitive}},qxe=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,_A=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),Kq={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Vxe={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},zA=class e{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new gV(t,r,this.mode),this.settings=r,this.leftrightDepth=0,this.nextToken=null}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new Bt("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new Nc("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.has(i.text)||r&&i.text===r||t&&Em[i.text]&&Em[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i=128)this.settings.strict&&(Wxe(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),s={type:"textord",mode:"text",loc:Yl.range(t),text:r};else return null;if(this.consume(),a)for(var h=0;h{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Ul.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}function s9(e){return[...e.cssRules].map(t=>t.cssText).join(` -`)}var MV,Xi,Sf,Ef,Zr,pkt,mkt,gkt,ykt,vkt,Go,xkt,bkt,wkt,kkt,Tkt,Ckt,Skt,Ekt,Akt,_kt,Rkt,Lkt,Ikt,Mkt,Nkt,Dkt,Cf,io,Kbe,Zbe,Okt,Lr,Pkt,Bkt,N5,DV,py,Cu,Xl,t9,dy,M5,n9,Qbe,Jbe,e4e,OV,PV,qt,t4e,r4e,D5,Fkt,Ube,n4e,i4e,i9,zn,BV,_b,$kt,FV,Nm,O5,a9,a4e,s4e,my,zkt,Gkt,l4e,Ybe,Mr,qkt,Vkt,Wkt,Hkt,c4e,gy,Ukt,Ykt,Af,NV,Xkt,jkt,Xbe,JA,sa,Rb,Kkt,Lb,Ct,Zkt,Qkt,vn,_f,e9,Jkt,eTt,u4e,o9,$V,zV,GV,qV,Nr,Yr,Qr,Jr,en,ln,tn,jbe,tTt,Be,P5,l9,c9,B5,rTt,r9,F5,u9,nTt,_r=W(()=>{Rr();hr();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();xb();MV=b((e,t,{depth:r=2,clobber:n=!1}={})=>{let i={depth:r,clobber:n};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(a=>MV(e,a,i)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(a=>{e.includes(a)||e.push(a)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(a=>{typeof t[a]=="object"&&t[a]!==null&&(e[a]===void 0||typeof e[a]=="object")?(e[a]===void 0&&(e[a]=Array.isArray(t[a])?[]:{}),e[a]=MV(e[a],t[a],{depth:r-1,clobber:n})):(n||typeof e[a]!="object"&&typeof t[a]!="object")&&(e[a]=t[a])}),e)},"assignWithDepth"),Xi=MV,Sf="#ffffff",Ef="#f2f2f2",Zr=b((e,t)=>t?me(e,{s:-40,l:10}):me(e,{s:-40,l:-10}),"mkBorder"),pkt=class{static{b(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||ot(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||ot(this.mainBkg,10)):(this.rowOdd=this.rowOdd||st(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||st(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},mkt=b(e=>{let t=new pkt;return t.calculate(e),t},"getThemeVariables"),gkt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=ot("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=ot(this.sectionBkgColor,10),this.taskBorderColor=$a(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=$a(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||st(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||ot(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){this.secondBkg=st(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=st(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=st(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=Je(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=me(this.primaryColor,{h:64}),this.fillType3=me(this.secondaryColor,{h:64}),this.fillType4=me(this.primaryColor,{h:-64}),this.fillType5=me(this.secondaryColor,{h:-64}),this.fillType6=me(this.primaryColor,{h:128}),this.fillType7=me(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330});for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},ykt=b(e=>{let t=new gkt;return t.calculate(e),t},"getThemeVariables"),vkt=class{static{b(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=me(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=$a(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||ot(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||ot(this.tertiaryColor,40);for(let e=0;e{this[r]==="calculated"&&(this[r]=void 0)}),typeof e!="object"){this.updateColors();return}let t=Object.keys(e);t.forEach(r=>{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Go=b(e=>{let t=new vkt;return t.calculate(e),t},"getThemeVariables"),xkt=class{static{b(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=st("#cde498",10),this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.primaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){this.actorBorder=ot(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||ot(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||ot(this.tertiaryColor,40);for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},bkt=b(e=>{let t=new xkt;return t.calculate(e),t},"getThemeVariables"),wkt=class{static{b(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=st(this.contrast,55),this.background="#ffffff",this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||st(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){this.secondBkg=st(this.contrast,55),this.border2=this.contrast,this.actorBorder=st(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},kkt=b(e=>{let t=new wkt;return t.calculate(e),t},"getThemeVariables"),Tkt=class{static{b(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;let e="#ECECFE",t="#E9E9F1",r=me(e,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||st(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||e,this.cScale1=this.cScale1||t,this.cScale2=this.cScale2||r,this.cScale3=this.cScale3||me(e,{h:30}),this.cScale4=this.cScale4||me(e,{h:60}),this.cScale5=this.cScale5||me(e,{h:90}),this.cScale6=this.cScale6||me(e,{h:120}),this.cScale7=this.cScale7||me(e,{h:150}),this.cScale8=this.cScale8||me(e,{h:210,l:150}),this.cScale9=this.cScale9||me(e,{h:270}),this.cScale10=this.cScale10||me(e,{h:300}),this.cScale11=this.cScale11||me(e,{h:330}),this.darkMode)for(let i=0;i{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Ckt=b(e=>{let t=new Tkt;return t.calculate(e),t},"getThemeVariables"),Skt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor=Je(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Ekt=b(e=>{let t=new Skt;return t.calculate(e),t},"getThemeVariables"),Akt=class{static{b(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Zr("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;let e="#ECECFE",t="#E9E9F1",r=me(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||st(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let i=0;i{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},_kt=b(e=>{let t=new Akt;return t.calculate(e),t},"getThemeVariables"),Rkt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor=Je(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Lkt=b(e=>{let t=new Rkt;return t.calculate(e),t},"getThemeVariables"),Ikt=class{static{b(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;let e="#ECECFE",t="#E9E9F1",r=me(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||st(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let i=0;i{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Mkt=b(e=>{let t=new Ikt;return t.calculate(e),t},"getThemeVariables"),Nkt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor=Je(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Dkt=b(e=>{let t=new Nkt;return t.calculate(e),t},"getThemeVariables"),Cf={base:{getThemeVariables:mkt},dark:{getThemeVariables:ykt},default:{getThemeVariables:Go},forest:{getThemeVariables:bkt},neutral:{getThemeVariables:kkt},neo:{getThemeVariables:Ckt},"neo-dark":{getThemeVariables:Ekt},redux:{getThemeVariables:_kt},"redux-dark":{getThemeVariables:Lkt},"redux-color":{getThemeVariables:Mkt},"redux-dark-color":{getThemeVariables:Dkt}},io={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Kbe={...io,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:Cf.default.getThemeVariables(),sequence:{...io.sequence,messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:b(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:b(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...io.gantt,tickInterval:void 0,useWidth:void 0},c4:{...io.c4,useWidth:void 0,personFont:b(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...io.flowchart,inheritDir:!1},external_personFont:b(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:b(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:b(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:b(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:b(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:b(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:b(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:b(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:b(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:b(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:b(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:b(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:b(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:b(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:b(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:b(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:b(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:b(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:b(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:b(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...io.pie,useWidth:984},xyChart:{...io.xyChart,useWidth:void 0},requirement:{...io.requirement,useWidth:void 0},packet:{...io.packet},eventmodeling:{...io.eventmodeling},treeView:{...io.treeView,useWidth:void 0},radar:{...io.radar},railroad:{...io.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...io.ishikawa},sankey:{...io.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...io.venn},cynefin:{...io.cynefin}},Zbe=b((e,t="")=>Object.keys(e).reduce((r,n)=>Array.isArray(e[n])?r:typeof e[n]=="object"&&e[n]!==null?[...r,t+n,...Zbe(e[n],"")]:[...r,t+n],[]),"keyify"),Okt=new Set(Zbe(Kbe,"")),Lr=Kbe,Pkt={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},Bkt=b((e,t)=>{for(let r of Object.keys(e)){let n=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof n!="string"||!t.test(n))&&(se.debug("sanitize deleting dictionary entry:",r,n),delete e[r])}},"sanitizeDictionaryConfig"),N5=b(e=>{if(se.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>N5(t));return}for(let t of Object.keys(e)){if(se.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!Okt.has(t)||e[t]==null){se.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){let n=Pkt[t];n?Bkt(e[t],n):(se.debug("sanitizing object",t),N5(e[t]));continue}let r=["themeCSS","fontFamily","altFontFamily"];for(let n of r)t.includes(n)&&(se.debug("sanitizing css option",t),e[t]=DV(e[t]))}if(e.themeVariables)for(let t of Object.keys(e.themeVariables)){let r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}se.debug("After sanitization",e)}},"sanitizeDirective"),DV=b(e=>{let t=0,r=0;for(let n of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),Xl=Xi({},py),dy=[],M5=Xi({},py),n9=b((e,t)=>{let r=Xi({},e),n={};for(let i of t)t4e(i),n=Xi(n,i);if(r=Xi(r,n),n.theme&&n.theme in Cf){let i=Xi({},t9),a=Xi(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in Cf&&(r.themeVariables=Cf[r.theme].getThemeVariables(a))}return M5=r,i4e(M5),M5},"updateCurrentConfig"),Qbe=b(e=>(Xl=Xi({},py),Xl=Xi(Xl,e),e.theme&&Cf[e.theme]&&(Xl.themeVariables=Cf[e.theme].getThemeVariables(e.themeVariables)),n9(Xl,dy),Xl),"setSiteConfig"),Jbe=b(e=>{t9=Xi({},e)},"saveConfigFromInitialize"),e4e=b(e=>(Xl=Xi(Xl,e),n9(Xl,dy),Xl),"updateSiteConfig"),OV=b(()=>Xi({},Xl),"getSiteConfig"),PV=b(e=>(i4e(e),Xi(M5,e),qt()),"setConfig"),qt=b(()=>Xi({},M5),"getConfig"),t4e=b(e=>{e&&(["secure",...Xl.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(se.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&t4e(e[t])}))},"sanitize"),r4e=b(e=>{N5(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),dy.push(e),n9(Xl,dy)},"addDirective"),D5=b((e=Xl)=>{dy=[],n9(e,dy)},"reset"),Fkt={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},Ube={},n4e=b(e=>{Ube[e]||(se.warn(Fkt[e]),Ube[e]=!0)},"issueWarning"),i4e=b(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&n4e("LAZY_LOAD_DEPRECATED")},"checkConfig"),i9=b(()=>{let e={};t9&&(e=Xi(e,t9));for(let t of dy)e=Xi(e,t);return e},"getUserDefinedConfig"),zn=b(e=>(e.flowchart?.htmlLabels!=null&&n4e("FLOWCHART_HTML_LABELS_DEPRECATED"),Cu(e.htmlLabels??e.flowchart?.htmlLabels??!0)),"getEffectiveHtmlLabels"),BV=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,_b=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,$kt=/\s*%%.*\n/gm,FV=class extends Error{static{b(this,"UnknownDiagramError")}constructor(e){super(e),this.name="UnknownDiagramError"}},Nm={},O5=b(function(e,t){e=e.replace(BV,"").replace(_b,"").replace($kt,` -`);for(let[r,{detector:n}]of Object.entries(Nm))if(n(e,t))return r;throw new FV(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),a9=b((...e)=>{for(let{id:t,detector:r,loader:n}of e)a4e(t,r,n)},"registerLazyLoadedDiagrams"),a4e=b((e,t,r)=>{Nm[e]&&se.warn(`Detector with key ${e} already exists. Overwriting.`),Nm[e]={detector:t,loader:r},se.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),s4e=b(e=>Nm[e].loader,"getDiagramLoader"),my=//gi,zkt=b(e=>e?c4e(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),Gkt=(()=>{let e=!1;return()=>{e||(o4e(),e=!0)}})();b(o4e,"setupDompurifyHooks");l4e=b(e=>(Gkt(),Ul.sanitize(e)),"removeScript"),Ybe=b((e,t)=>{if(zn(t)){let r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=l4e(e):r!=="loose"&&(e=c4e(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=Hkt(e))}return e},"sanitizeMore"),Mr=b((e,t)=>e&&(t.dompurifyConfig?e=Ul.sanitize(Ybe(e,t),t.dompurifyConfig).toString():e=Ul.sanitize(Ybe(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),qkt=b((e,t)=>typeof e=="string"?Mr(e,t):e.flat().map(r=>Mr(r,t)),"sanitizeTextOrArray"),Vkt=b(e=>my.test(e),"hasBreaks"),Wkt=b(e=>e.split(my),"splitBreaks"),Hkt=b(e=>e.replace(/#br#/g,"
"),"placeholderToBreak"),c4e=b(e=>e.replace(my,"#br#"),"breakToPlaceholder"),gy=b(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),Ukt=b(function(...e){let t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),Ykt=b(function(...e){let t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),Af=b(function(e){let t=e.split(/(,)/),r=[];for(let n=0;n0&&n+1Math.max(0,e.split(t).length-1),"countOccurrence"),Xkt=b((e,t)=>{let r=NV(e,"~"),n=NV(t,"~");return r===1&&n===1},"shouldCombineSets"),jkt=b(e=>{let t=NV(e,"~"),r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);let n=[...e],i=n.indexOf("~"),a=n.lastIndexOf("~");for(;i!==-1&&a!==-1&&i!==a;)n[i]="<",n[a]=">",i=n.indexOf("~"),a=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),Xbe=b(()=>window.MathMLElement!==void 0,"isMathMLSupported"),JA=/\$\$(.*?)\$\$/g,sa=b(e=>(e.match(JA)?.length??0)>0,"hasKatex"),Rb=b(async(e,t)=>{let r=document.createElement("div");r.innerHTML=await Lb(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);let i={width:r.clientWidth,height:r.clientHeight};return r.remove(),i},"calculateMathMLDimensions"),Kkt=b(async(e,t)=>{if(!sa(e))return e;if(!(Xbe()||t.legacyMathML||t.forceLegacyMathML))return e.replace(JA,"MathML is unsupported in this environment.");{let{default:r}=await Promise.resolve().then(()=>(Hbe(),Wbe)),n=t.forceLegacyMathML||!Xbe()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(my).map(i=>sa(i)?`
${i}
`:`
${i}
`).join("").replace(JA,(i,a)=>r.renderToString(a,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(//g,""))}return e.replace(JA,"Katex is not supported in @mermaid-js/tiny. Please use the full mermaid library.")},"renderKatexUnsanitized"),Lb=b(async(e,t)=>Mr(await Kkt(e,t),t),"renderKatexSanitized"),Ct={getRows:zkt,sanitizeText:Mr,sanitizeTextOrArray:qkt,hasBreaks:Vkt,splitBreaks:Wkt,lineBreakRegex:my,removeScript:l4e,getUrl:gy,evaluate:Cu,getMax:Ukt,getMin:Ykt},Zkt=b(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),Qkt=b(function(e,t,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${t}px;`)):(n.set("height",e),n.set("width",t)),n},"calculateSvgSizeAttrs"),vn=b(function(e,t,r,n){let i=Qkt(t,r,n);Zkt(e,i)},"configureSvgSize"),_f=b(function(e,t,r,n){let i=t.node().getBBox(),a=i.width,s=i.height;se.info(`SVG bounds: ${a}x${s}`,i);let o=0,l=0;se.info(`Graph bounds: ${o}x${l}`,e),o=a+r*2,l=s+r*2,se.info(`Calculated bounds: ${o}x${l}`),vn(t,l,o,n);let u=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;t.attr("viewBox",u)},"setupGraphViewbox"),e9={};b(s9,"cssStyleSheetToString");Jkt=b((e,t,r,n)=>{let i="";return e in e9&&e9[e]?i=e9[e]({...r,svgId:n}):se.warn(`No theme found for ${e}`),` & { +?)[ \r ]*`,gV="[\u0300-\u036F]",dkt=new RegExp(gV+"+$"),pkt="("+Pbe+"+)|"+(fkt+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(gV+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(gV+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+hkt)+("|"+ukt+")"),$A=class{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(pkt,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Nc("EOF",new Xl(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new Bt("Unexpected character: '"+t[r]+"'",new Nc(t[r],new Xl(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(` +`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Nc(i,new Xl(this,r,this.tokenRegex.lastIndex))}},yV=class{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Bt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}},mkt=Sbe;Ee("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Ee("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Ee("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Ee("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Ee("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});Ee("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Ee("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});qxe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ee("\\char",function(e){var t=e.popToken(),r,n=0;if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Bt("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=qxe[t.text],n==null||n>=r)throw new Bt("Invalid base-"+r+" digit "+t.text);for(var i;(i=qxe[e.future().text])!=null&&i{var i=e.consumeArg().tokens;if(i.length!==1)throw new Bt("\\newcommand's first argument must be a macro name");var a=i[0].text,s=e.isDefined(a);if(s&&!t)throw new Bt("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!s&&!r)throw new Bt("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var o=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Bt("Invalid number of arguments: "+l);o=parseInt(l),i=e.consumeArg().tokens}return s&&n||e.macros.set(a,{tokens:i,numArgs:o}),""};Ee("\\newcommand",e=>LV(e,!1,!0,!1));Ee("\\renewcommand",e=>LV(e,!0,!1,!1));Ee("\\providecommand",e=>LV(e,!0,!0,!0));Ee("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});Ee("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});Ee("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),Em[r],ia.math[r],ia.text[r]),""});Ee("\\bgroup","{");Ee("\\egroup","}");Ee("~","\\nobreakspace");Ee("\\lq","`");Ee("\\rq","'");Ee("\\aa","\\r a");Ee("\\AA","\\r A");Ee("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");Ee("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Ee("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");Ee("\u212C","\\mathscr{B}");Ee("\u2130","\\mathscr{E}");Ee("\u2131","\\mathscr{F}");Ee("\u210B","\\mathscr{H}");Ee("\u2110","\\mathscr{I}");Ee("\u2112","\\mathscr{L}");Ee("\u2133","\\mathscr{M}");Ee("\u211B","\\mathscr{R}");Ee("\u212D","\\mathfrak{C}");Ee("\u210C","\\mathfrak{H}");Ee("\u2128","\\mathfrak{Z}");Ee("\\Bbbk","\\Bbb{k}");Ee("\\llap","\\mathllap{\\textrm{#1}}");Ee("\\rlap","\\mathrlap{\\textrm{#1}}");Ee("\\clap","\\mathclap{\\textrm{#1}}");Ee("\\mathstrut","\\vphantom{(}");Ee("\\underbar","\\underline{\\text{#1}}");Ee("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Ee("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");Ee("\\ne","\\neq");Ee("\u2260","\\neq");Ee("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");Ee("\u2209","\\notin");Ee("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");Ee("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");Ee("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");Ee("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");Ee("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");Ee("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");Ee("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");Ee("\u27C2","\\perp");Ee("\u203C","\\mathclose{!\\mkern-0.8mu!}");Ee("\u220C","\\notni");Ee("\u231C","\\ulcorner");Ee("\u231D","\\urcorner");Ee("\u231E","\\llcorner");Ee("\u231F","\\lrcorner");Ee("\xA9","\\copyright");Ee("\xAE","\\textregistered");Ee("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Ee("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Ee("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Ee("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Ee("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Ee("\u22EE","\\vdots");Ee("\\varGamma","\\mathit{\\Gamma}");Ee("\\varDelta","\\mathit{\\Delta}");Ee("\\varTheta","\\mathit{\\Theta}");Ee("\\varLambda","\\mathit{\\Lambda}");Ee("\\varXi","\\mathit{\\Xi}");Ee("\\varPi","\\mathit{\\Pi}");Ee("\\varSigma","\\mathit{\\Sigma}");Ee("\\varUpsilon","\\mathit{\\Upsilon}");Ee("\\varPhi","\\mathit{\\Phi}");Ee("\\varPsi","\\mathit{\\Psi}");Ee("\\varOmega","\\mathit{\\Omega}");Ee("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Ee("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Ee("\\boxed","\\fbox{$\\displaystyle{#1}$}");Ee("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Ee("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Ee("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Ee("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Ee("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");Vxe={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},gkt=new Set(["bin","rel"]);Ee("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Vxe?t=Vxe[r]:(r.slice(0,4)==="\\not"||r in ia.math&&gkt.has(ia.math[r].group))&&(t="\\dotsb"),t});IV={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ee("\\dotso",function(e){var t=e.future().text;return t in IV?"\\ldots\\,":"\\ldots"});Ee("\\dotsc",function(e){var t=e.future().text;return t in IV&&t!==","?"\\ldots\\,":"\\ldots"});Ee("\\cdots",function(e){var t=e.future().text;return t in IV?"\\@cdots\\,":"\\@cdots"});Ee("\\dotsb","\\cdots");Ee("\\dotsm","\\cdots");Ee("\\dotsi","\\!\\cdots");Ee("\\dotsx","\\ldots\\,");Ee("\\DOTSI","\\relax");Ee("\\DOTSB","\\relax");Ee("\\DOTSX","\\relax");Ee("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Ee("\\,","\\tmspace+{3mu}{.1667em}");Ee("\\thinspace","\\,");Ee("\\>","\\mskip{4mu}");Ee("\\:","\\tmspace+{4mu}{.2222em}");Ee("\\medspace","\\:");Ee("\\;","\\tmspace+{5mu}{.2777em}");Ee("\\thickspace","\\;");Ee("\\!","\\tmspace-{3mu}{.1667em}");Ee("\\negthinspace","\\!");Ee("\\negmedspace","\\tmspace-{4mu}{.2222em}");Ee("\\negthickspace","\\tmspace-{5mu}{.277em}");Ee("\\enspace","\\kern.5em ");Ee("\\enskip","\\hskip.5em\\relax");Ee("\\quad","\\hskip1em\\relax");Ee("\\qquad","\\hskip2em\\relax");Ee("\\tag","\\@ifstar\\tag@literal\\tag@paren");Ee("\\tag@paren","\\tag@literal{({#1})}");Ee("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Bt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Ee("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Ee("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Ee("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Ee("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Ee("\\newline","\\\\\\relax");Ee("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");Bbe=Yt(xf["Main-Regular"][84][1]-.7*xf["Main-Regular"][65][1]);Ee("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Bbe+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ee("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Bbe+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Ee("\\hspace","\\@ifstar\\@hspacer\\@hspace");Ee("\\@hspace","\\hskip #1\\relax");Ee("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Ee("\\ordinarycolon",":");Ee("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Ee("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Ee("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Ee("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Ee("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Ee("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Ee("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Ee("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Ee("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Ee("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Ee("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Ee("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Ee("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Ee("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Ee("\u2237","\\dblcolon");Ee("\u2239","\\eqcolon");Ee("\u2254","\\coloneqq");Ee("\u2255","\\eqqcolon");Ee("\u2A74","\\Coloneqq");Ee("\\ratio","\\vcentcolon");Ee("\\coloncolon","\\dblcolon");Ee("\\colonequals","\\coloneqq");Ee("\\coloncolonequals","\\Coloneqq");Ee("\\equalscolon","\\eqqcolon");Ee("\\equalscoloncolon","\\Eqqcolon");Ee("\\colonminus","\\coloneq");Ee("\\coloncolonminus","\\Coloneq");Ee("\\minuscolon","\\eqcolon");Ee("\\minuscoloncolon","\\Eqcolon");Ee("\\coloncolonapprox","\\Colonapprox");Ee("\\coloncolonsim","\\Colonsim");Ee("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ee("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ee("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ee("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ee("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");Ee("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Ee("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Ee("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Ee("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Ee("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Ee("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Ee("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Ee("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Ee("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");Ee("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");Ee("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");Ee("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");Ee("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");Ee("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");Ee("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");Ee("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");Ee("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");Ee("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");Ee("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");Ee("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");Ee("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");Ee("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");Ee("\\imath","\\html@mathml{\\@imath}{\u0131}");Ee("\\jmath","\\html@mathml{\\@jmath}{\u0237}");Ee("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");Ee("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");Ee("\u27E6","\\llbracket");Ee("\u27E7","\\rrbracket");Ee("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");Ee("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");Ee("\u2983","\\lBrace");Ee("\u2984","\\rBrace");Ee("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");Ee("\u29B5","\\minuso");Ee("\\darr","\\downarrow");Ee("\\dArr","\\Downarrow");Ee("\\Darr","\\Downarrow");Ee("\\lang","\\langle");Ee("\\rang","\\rangle");Ee("\\uarr","\\uparrow");Ee("\\uArr","\\Uparrow");Ee("\\Uarr","\\Uparrow");Ee("\\N","\\mathbb{N}");Ee("\\R","\\mathbb{R}");Ee("\\Z","\\mathbb{Z}");Ee("\\alef","\\aleph");Ee("\\alefsym","\\aleph");Ee("\\Alpha","\\mathrm{A}");Ee("\\Beta","\\mathrm{B}");Ee("\\bull","\\bullet");Ee("\\Chi","\\mathrm{X}");Ee("\\clubs","\\clubsuit");Ee("\\cnums","\\mathbb{C}");Ee("\\Complex","\\mathbb{C}");Ee("\\Dagger","\\ddagger");Ee("\\diamonds","\\diamondsuit");Ee("\\empty","\\emptyset");Ee("\\Epsilon","\\mathrm{E}");Ee("\\Eta","\\mathrm{H}");Ee("\\exist","\\exists");Ee("\\harr","\\leftrightarrow");Ee("\\hArr","\\Leftrightarrow");Ee("\\Harr","\\Leftrightarrow");Ee("\\hearts","\\heartsuit");Ee("\\image","\\Im");Ee("\\infin","\\infty");Ee("\\Iota","\\mathrm{I}");Ee("\\isin","\\in");Ee("\\Kappa","\\mathrm{K}");Ee("\\larr","\\leftarrow");Ee("\\lArr","\\Leftarrow");Ee("\\Larr","\\Leftarrow");Ee("\\lrarr","\\leftrightarrow");Ee("\\lrArr","\\Leftrightarrow");Ee("\\Lrarr","\\Leftrightarrow");Ee("\\Mu","\\mathrm{M}");Ee("\\natnums","\\mathbb{N}");Ee("\\Nu","\\mathrm{N}");Ee("\\Omicron","\\mathrm{O}");Ee("\\plusmn","\\pm");Ee("\\rarr","\\rightarrow");Ee("\\rArr","\\Rightarrow");Ee("\\Rarr","\\Rightarrow");Ee("\\real","\\Re");Ee("\\reals","\\mathbb{R}");Ee("\\Reals","\\mathbb{R}");Ee("\\Rho","\\mathrm{P}");Ee("\\sdot","\\cdot");Ee("\\sect","\\S");Ee("\\spades","\\spadesuit");Ee("\\sub","\\subset");Ee("\\sube","\\subseteq");Ee("\\supe","\\supseteq");Ee("\\Tau","\\mathrm{T}");Ee("\\thetasym","\\vartheta");Ee("\\weierp","\\wp");Ee("\\Zeta","\\mathrm{Z}");Ee("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Ee("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Ee("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Ee("\\bra","\\mathinner{\\langle{#1}|}");Ee("\\ket","\\mathinner{|{#1}\\rangle}");Ee("\\braket","\\mathinner{\\langle{#1}\\rangle}");Ee("\\Bra","\\left\\langle#1\\right|");Ee("\\Ket","\\left|#1\\right\\rangle");Fbe=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.macros.get("|"),o=t.macros.get("\\|");t.macros.beginGroup();var l=f=>d=>{e&&(d.macros.set("|",s),i.length&&d.macros.set("\\|",o));var p=f;if(!f&&i.length){var m=d.future();m.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};t.macros.set("|",l(!1)),i.length&&t.macros.set("\\|",l(!0));var u=t.consumeArg().tokens,h=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};Ee("\\bra@ket",Fbe(!1));Ee("\\bra@set",Fbe(!0));Ee("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Ee("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Ee("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Ee("\\angln","{\\angl n}");Ee("\\blue","\\textcolor{##6495ed}{#1}");Ee("\\orange","\\textcolor{##ffa500}{#1}");Ee("\\pink","\\textcolor{##ff00af}{#1}");Ee("\\red","\\textcolor{##df0030}{#1}");Ee("\\green","\\textcolor{##28ae7b}{#1}");Ee("\\gray","\\textcolor{gray}{#1}");Ee("\\purple","\\textcolor{##9d38bd}{#1}");Ee("\\blueA","\\textcolor{##ccfaff}{#1}");Ee("\\blueB","\\textcolor{##80f6ff}{#1}");Ee("\\blueC","\\textcolor{##63d9ea}{#1}");Ee("\\blueD","\\textcolor{##11accd}{#1}");Ee("\\blueE","\\textcolor{##0c7f99}{#1}");Ee("\\tealA","\\textcolor{##94fff5}{#1}");Ee("\\tealB","\\textcolor{##26edd5}{#1}");Ee("\\tealC","\\textcolor{##01d1c1}{#1}");Ee("\\tealD","\\textcolor{##01a995}{#1}");Ee("\\tealE","\\textcolor{##208170}{#1}");Ee("\\greenA","\\textcolor{##b6ffb0}{#1}");Ee("\\greenB","\\textcolor{##8af281}{#1}");Ee("\\greenC","\\textcolor{##74cf70}{#1}");Ee("\\greenD","\\textcolor{##1fab54}{#1}");Ee("\\greenE","\\textcolor{##0d923f}{#1}");Ee("\\goldA","\\textcolor{##ffd0a9}{#1}");Ee("\\goldB","\\textcolor{##ffbb71}{#1}");Ee("\\goldC","\\textcolor{##ff9c39}{#1}");Ee("\\goldD","\\textcolor{##e07d10}{#1}");Ee("\\goldE","\\textcolor{##a75a05}{#1}");Ee("\\redA","\\textcolor{##fca9a9}{#1}");Ee("\\redB","\\textcolor{##ff8482}{#1}");Ee("\\redC","\\textcolor{##f9685d}{#1}");Ee("\\redD","\\textcolor{##e84d39}{#1}");Ee("\\redE","\\textcolor{##bc2612}{#1}");Ee("\\maroonA","\\textcolor{##ffbde0}{#1}");Ee("\\maroonB","\\textcolor{##ff92c6}{#1}");Ee("\\maroonC","\\textcolor{##ed5fa6}{#1}");Ee("\\maroonD","\\textcolor{##ca337c}{#1}");Ee("\\maroonE","\\textcolor{##9e034e}{#1}");Ee("\\purpleA","\\textcolor{##ddd7ff}{#1}");Ee("\\purpleB","\\textcolor{##c6b9fc}{#1}");Ee("\\purpleC","\\textcolor{##aa87ff}{#1}");Ee("\\purpleD","\\textcolor{##7854ab}{#1}");Ee("\\purpleE","\\textcolor{##543b78}{#1}");Ee("\\mintA","\\textcolor{##f5f9e8}{#1}");Ee("\\mintB","\\textcolor{##edf2df}{#1}");Ee("\\mintC","\\textcolor{##e0e5cc}{#1}");Ee("\\grayA","\\textcolor{##f6f7f7}{#1}");Ee("\\grayB","\\textcolor{##f0f1f2}{#1}");Ee("\\grayC","\\textcolor{##e3e5e6}{#1}");Ee("\\grayD","\\textcolor{##d6d8da}{#1}");Ee("\\grayE","\\textcolor{##babec2}{#1}");Ee("\\grayF","\\textcolor{##888d93}{#1}");Ee("\\grayG","\\textcolor{##626569}{#1}");Ee("\\grayH","\\textcolor{##3b3e40}{#1}");Ee("\\grayI","\\textcolor{##21242c}{#1}");Ee("\\kaBlue","\\textcolor{##314453}{#1}");Ee("\\kaGreen","\\textcolor{##71B307}{#1}");$be={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},vV=class{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new yV(mkt,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new $A(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new Nc("EOF",n.loc)),this.pushTokens(i),new Nc("",Xl.range(r,n))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,s=0,o=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++s;else if(a.text==="}"){if(--s,s===-1)throw new Bt("Extra }",a)}else if(a.text==="EOF")throw new Bt("Unexpected end of input in a macro argument, expected '"+(t&&n?t[o]:"}")+"'",a);if(t&&n)if((s===0||s===1&&t[o]==="{")&&a.text===t[o]){if(++o,o===t.length){r.splice(-o,o);break}}else o=0}while(s!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new Bt("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;ithis.settings.maxExpand)throw new Bt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new Bt("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,s=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var o=a.length-1;o>=0;--o){var l=a[o];if(l.text==="#"){if(o===0)throw new Bt("Incomplete placeholder at end of macro body",l);if(l=a[--o],l.text==="#")a.splice(o+1,1);else if(/^[1-9]$/.test(l.text))a.splice(o,2,...s[+l.text-1]);else throw new Bt("Not a valid argument number",l)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Nc(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.includes("#"))for(var s=i.replace(/##/g,"");s.includes("#"+(a+1));)++a;for(var o=new $A(i,this.settings),l=[],u=o.lex();u.text!=="EOF";)l.push(u),u=o.lex();l.reverse();var h={tokens:l,numArgs:a};return h}return i}isDefined(t){return this.macros.has(t)||Em.hasOwnProperty(t)||ia.math.hasOwnProperty(t)||ia.text.hasOwnProperty(t)||$be.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Em.hasOwnProperty(t)&&!Em[t].primitive}},Wxe=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,_A=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),Qq={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Hxe={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},zA=class e{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new vV(t,r,this.mode),this.settings=r,this.leftrightDepth=0,this.nextToken=null}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new Bt("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new Nc("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.has(i.text)||r&&i.text===r||t&&Em[i.text]&&Em[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i=128)this.settings.strict&&(Uxe(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),s={type:"textord",mode:"text",loc:Xl.range(t),text:r};else return null;if(this.consume(),a)for(var h=0;h{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Yl.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}function s9(e){return[...e.cssRules].map(t=>t.cssText).join(` +`)}var DV,Xi,Sf,Ef,Zr,vkt,xkt,bkt,wkt,kkt,Go,Tkt,Ckt,Skt,Ekt,Akt,_kt,Rkt,Lkt,Ikt,Mkt,Nkt,Dkt,Okt,Pkt,Bkt,Fkt,Cf,io,Qbe,Jbe,$kt,Lr,zkt,Gkt,N5,PV,py,Cu,jl,t9,dy,M5,n9,e4e,t4e,r4e,BV,FV,qt,n4e,i4e,D5,qkt,Xbe,a4e,s4e,i9,zn,$V,_b,Vkt,zV,Nm,O5,a9,o4e,l4e,my,Wkt,Hkt,u4e,jbe,Mr,Ukt,Ykt,Xkt,jkt,h4e,gy,Kkt,Zkt,Af,OV,Qkt,Jkt,Kbe,JA,sa,Rb,eTt,Lb,Ct,tTt,rTt,vn,_f,e9,nTt,iTt,f4e,o9,GV,qV,VV,WV,Nr,Yr,Qr,Jr,en,ln,tn,Zbe,aTt,Be,P5,l9,c9,B5,sTt,r9,F5,u9,oTt,_r=W(()=>{Rr();hr();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();Ka();xb();DV=b((e,t,{depth:r=2,clobber:n=!1}={})=>{let i={depth:r,clobber:n};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(a=>DV(e,a,i)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(a=>{e.includes(a)||e.push(a)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(a=>{typeof t[a]=="object"&&t[a]!==null&&(e[a]===void 0||typeof e[a]=="object")?(e[a]===void 0&&(e[a]=Array.isArray(t[a])?[]:{}),e[a]=DV(e[a],t[a],{depth:r-1,clobber:n})):(n||typeof e[a]!="object"&&typeof t[a]!="object")&&(e[a]=t[a])}),e)},"assignWithDepth"),Xi=DV,Sf="#ffffff",Ef="#f2f2f2",Zr=b((e,t)=>t?me(e,{s:-40,l:10}):me(e,{s:-40,l:-10}),"mkBorder"),vkt=class{static{b(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||ot(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||ot(this.mainBkg,10)):(this.rowOdd=this.rowOdd||st(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||st(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},xkt=b(e=>{let t=new vkt;return t.calculate(e),t},"getThemeVariables"),bkt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=ot("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=ot(this.sectionBkgColor,10),this.taskBorderColor=$a(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=$a(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||st(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||ot(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){this.secondBkg=st(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=st(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=st(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=Je(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=me(this.primaryColor,{h:64}),this.fillType3=me(this.secondaryColor,{h:64}),this.fillType4=me(this.primaryColor,{h:-64}),this.fillType5=me(this.secondaryColor,{h:-64}),this.fillType6=me(this.primaryColor,{h:128}),this.fillType7=me(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330});for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},wkt=b(e=>{let t=new bkt;return t.calculate(e),t},"getThemeVariables"),kkt=class{static{b(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=me(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=$a(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||ot(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||ot(this.tertiaryColor,40);for(let e=0;e{this[r]==="calculated"&&(this[r]=void 0)}),typeof e!="object"){this.updateColors();return}let t=Object.keys(e);t.forEach(r=>{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Go=b(e=>{let t=new kkt;return t.calculate(e),t},"getThemeVariables"),Tkt=class{static{b(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=st("#cde498",10),this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.primaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){this.actorBorder=ot(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||ot(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||ot(this.tertiaryColor,40);for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Ckt=b(e=>{let t=new Tkt;return t.calculate(e),t},"getThemeVariables"),Skt=class{static{b(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=st(this.contrast,55),this.background="#ffffff",this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.lineColor=Je(this.background),this.textColor=Je(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||st(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){this.secondBkg=st(this.contrast,55),this.border2=this.contrast,this.actorBorder=st(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Ekt=b(e=>{let t=new Skt;return t.calculate(e),t},"getThemeVariables"),Akt=class{static{b(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;let e="#ECECFE",t="#E9E9F1",r=me(e,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||st(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||e,this.cScale1=this.cScale1||t,this.cScale2=this.cScale2||r,this.cScale3=this.cScale3||me(e,{h:30}),this.cScale4=this.cScale4||me(e,{h:60}),this.cScale5=this.cScale5||me(e,{h:90}),this.cScale6=this.cScale6||me(e,{h:120}),this.cScale7=this.cScale7||me(e,{h:150}),this.cScale8=this.cScale8||me(e,{h:210,l:150}),this.cScale9=this.cScale9||me(e,{h:270}),this.cScale10=this.cScale10||me(e,{h:300}),this.cScale11=this.cScale11||me(e,{h:330}),this.darkMode)for(let i=0;i{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},_kt=b(e=>{let t=new Akt;return t.calculate(e),t},"getThemeVariables"),Rkt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor=Je(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Lkt=b(e=>{let t=new Rkt;return t.calculate(e),t},"getThemeVariables"),Ikt=class{static{b(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Zr("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;let e="#ECECFE",t="#E9E9F1",r=me(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||st(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let i=0;i{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Mkt=b(e=>{let t=new Ikt;return t.calculate(e),t},"getThemeVariables"),Nkt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor=Je(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||me(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||me(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Dkt=b(e=>{let t=new Nkt;return t.calculate(e),t},"getThemeVariables"),Okt=class{static{b(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Zr(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;let e="#ECECFE",t="#E9E9F1",r=me(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||st(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let i=0;i{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Pkt=b(e=>{let t=new Okt;return t.calculate(e),t},"getThemeVariables"),Bkt=class{static{b(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=st(this.primaryColor,16),this.tertiaryColor=me(this.primaryColor,{h:-160}),this.primaryBorderColor=Je(this.background),this.secondaryBorderColor=Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Zr(this.tertiaryColor,this.darkMode),this.primaryTextColor=Je(this.primaryColor),this.secondaryTextColor=Je(this.secondaryColor),this.tertiaryTextColor=Je(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=st(Je("#323D47"),10),this.border1="#ccc",this.border2=$a(255,255,255,.25),this.arrowheadColor=Je(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Zr(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Zr(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Zr(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Zr(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Je(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Je(this.tertiaryColor),this.lineColor=this.lineColor||Je(this.background),this.arrowheadColor=this.arrowheadColor||Je(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?ot(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||ot(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Je(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||st(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Fkt=b(e=>{let t=new Bkt;return t.calculate(e),t},"getThemeVariables"),Cf={base:{getThemeVariables:xkt},dark:{getThemeVariables:wkt},default:{getThemeVariables:Go},forest:{getThemeVariables:Ckt},neutral:{getThemeVariables:Ekt},neo:{getThemeVariables:_kt},"neo-dark":{getThemeVariables:Lkt},redux:{getThemeVariables:Mkt},"redux-dark":{getThemeVariables:Dkt},"redux-color":{getThemeVariables:Pkt},"redux-dark-color":{getThemeVariables:Fkt}},io={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Qbe={...io,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:Cf.default.getThemeVariables(),sequence:{...io.sequence,messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:b(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:b(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...io.gantt,tickInterval:void 0,useWidth:void 0},c4:{...io.c4,useWidth:void 0,personFont:b(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...io.flowchart,inheritDir:!1},external_personFont:b(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:b(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:b(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:b(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:b(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:b(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:b(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:b(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:b(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:b(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:b(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:b(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:b(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:b(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:b(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:b(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:b(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:b(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:b(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:b(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...io.pie,useWidth:984},xyChart:{...io.xyChart,useWidth:void 0},requirement:{...io.requirement,useWidth:void 0},packet:{...io.packet},eventmodeling:{...io.eventmodeling},treeView:{...io.treeView,useWidth:void 0},radar:{...io.radar},railroad:{...io.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...io.ishikawa},sankey:{...io.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...io.venn},cynefin:{...io.cynefin}},Jbe=b((e,t="")=>Object.keys(e).reduce((r,n)=>Array.isArray(e[n])?r:typeof e[n]=="object"&&e[n]!==null?[...r,t+n,...Jbe(e[n],"")]:[...r,t+n],[]),"keyify"),$kt=new Set(Jbe(Qbe,"")),Lr=Qbe,zkt={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},Gkt=b((e,t)=>{for(let r of Object.keys(e)){let n=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof n!="string"||!t.test(n))&&(se.debug("sanitize deleting dictionary entry:",r,n),delete e[r])}},"sanitizeDictionaryConfig"),N5=b(e=>{if(se.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>N5(t));return}for(let t of Object.keys(e)){if(se.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!$kt.has(t)||e[t]==null){se.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){let n=zkt[t];n?Gkt(e[t],n):(se.debug("sanitizing object",t),N5(e[t]));continue}let r=["themeCSS","fontFamily","altFontFamily"];for(let n of r)t.includes(n)&&(se.debug("sanitizing css option",t),e[t]=PV(e[t]))}if(e.themeVariables)for(let t of Object.keys(e.themeVariables)){let r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}se.debug("After sanitization",e)}},"sanitizeDirective"),PV=b(e=>{let t=0,r=0;for(let n of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),jl=Xi({},py),dy=[],M5=Xi({},py),n9=b((e,t)=>{let r=Xi({},e),n={};for(let i of t)n4e(i),n=Xi(n,i);if(r=Xi(r,n),n.theme&&n.theme in Cf){let i=Xi({},t9),a=Xi(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in Cf&&(r.themeVariables=Cf[r.theme].getThemeVariables(a))}return M5=r,s4e(M5),M5},"updateCurrentConfig"),e4e=b(e=>(jl=Xi({},py),jl=Xi(jl,e),e.theme&&Cf[e.theme]&&(jl.themeVariables=Cf[e.theme].getThemeVariables(e.themeVariables)),n9(jl,dy),jl),"setSiteConfig"),t4e=b(e=>{t9=Xi({},e)},"saveConfigFromInitialize"),r4e=b(e=>(jl=Xi(jl,e),n9(jl,dy),jl),"updateSiteConfig"),BV=b(()=>Xi({},jl),"getSiteConfig"),FV=b(e=>(s4e(e),Xi(M5,e),qt()),"setConfig"),qt=b(()=>Xi({},M5),"getConfig"),n4e=b(e=>{e&&(["secure",...jl.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(se.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&n4e(e[t])}))},"sanitize"),i4e=b(e=>{N5(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),dy.push(e),n9(jl,dy)},"addDirective"),D5=b((e=jl)=>{dy=[],n9(e,dy)},"reset"),qkt={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},Xbe={},a4e=b(e=>{Xbe[e]||(se.warn(qkt[e]),Xbe[e]=!0)},"issueWarning"),s4e=b(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&a4e("LAZY_LOAD_DEPRECATED")},"checkConfig"),i9=b(()=>{let e={};t9&&(e=Xi(e,t9));for(let t of dy)e=Xi(e,t);return e},"getUserDefinedConfig"),zn=b(e=>(e.flowchart?.htmlLabels!=null&&a4e("FLOWCHART_HTML_LABELS_DEPRECATED"),Cu(e.htmlLabels??e.flowchart?.htmlLabels??!0)),"getEffectiveHtmlLabels"),$V=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,_b=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Vkt=/\s*%%.*\n/gm,zV=class extends Error{static{b(this,"UnknownDiagramError")}constructor(e){super(e),this.name="UnknownDiagramError"}},Nm={},O5=b(function(e,t){e=e.replace($V,"").replace(_b,"").replace(Vkt,` +`);for(let[r,{detector:n}]of Object.entries(Nm))if(n(e,t))return r;throw new zV(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),a9=b((...e)=>{for(let{id:t,detector:r,loader:n}of e)o4e(t,r,n)},"registerLazyLoadedDiagrams"),o4e=b((e,t,r)=>{Nm[e]&&se.warn(`Detector with key ${e} already exists. Overwriting.`),Nm[e]={detector:t,loader:r},se.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),l4e=b(e=>Nm[e].loader,"getDiagramLoader"),my=//gi,Wkt=b(e=>e?h4e(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),Hkt=(()=>{let e=!1;return()=>{e||(c4e(),e=!0)}})();b(c4e,"setupDompurifyHooks");u4e=b(e=>(Hkt(),Yl.sanitize(e)),"removeScript"),jbe=b((e,t)=>{if(zn(t)){let r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=u4e(e):r!=="loose"&&(e=h4e(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=jkt(e))}return e},"sanitizeMore"),Mr=b((e,t)=>e&&(t.dompurifyConfig?e=Yl.sanitize(jbe(e,t),t.dompurifyConfig).toString():e=Yl.sanitize(jbe(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),Ukt=b((e,t)=>typeof e=="string"?Mr(e,t):e.flat().map(r=>Mr(r,t)),"sanitizeTextOrArray"),Ykt=b(e=>my.test(e),"hasBreaks"),Xkt=b(e=>e.split(my),"splitBreaks"),jkt=b(e=>e.replace(/#br#/g,"
"),"placeholderToBreak"),h4e=b(e=>e.replace(my,"#br#"),"breakToPlaceholder"),gy=b(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),Kkt=b(function(...e){let t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),Zkt=b(function(...e){let t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),Af=b(function(e){let t=e.split(/(,)/),r=[];for(let n=0;n0&&n+1Math.max(0,e.split(t).length-1),"countOccurrence"),Qkt=b((e,t)=>{let r=OV(e,"~"),n=OV(t,"~");return r===1&&n===1},"shouldCombineSets"),Jkt=b(e=>{let t=OV(e,"~"),r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);let n=[...e],i=n.indexOf("~"),a=n.lastIndexOf("~");for(;i!==-1&&a!==-1&&i!==a;)n[i]="<",n[a]=">",i=n.indexOf("~"),a=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),Kbe=b(()=>window.MathMLElement!==void 0,"isMathMLSupported"),JA=/\$\$(.*?)\$\$/g,sa=b(e=>(e.match(JA)?.length??0)>0,"hasKatex"),Rb=b(async(e,t)=>{let r=document.createElement("div");r.innerHTML=await Lb(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);let i={width:r.clientWidth,height:r.clientHeight};return r.remove(),i},"calculateMathMLDimensions"),eTt=b(async(e,t)=>{if(!sa(e))return e;if(!(Kbe()||t.legacyMathML||t.forceLegacyMathML))return e.replace(JA,"MathML is unsupported in this environment.");{let{default:r}=await Promise.resolve().then(()=>(Ybe(),Ube)),n=t.forceLegacyMathML||!Kbe()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(my).map(i=>sa(i)?`
${i}
`:`
${i}
`).join("").replace(JA,(i,a)=>r.renderToString(a,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(//g,""))}return e.replace(JA,"Katex is not supported in @mermaid-js/tiny. Please use the full mermaid library.")},"renderKatexUnsanitized"),Lb=b(async(e,t)=>Mr(await eTt(e,t),t),"renderKatexSanitized"),Ct={getRows:Wkt,sanitizeText:Mr,sanitizeTextOrArray:Ukt,hasBreaks:Ykt,splitBreaks:Xkt,lineBreakRegex:my,removeScript:u4e,getUrl:gy,evaluate:Cu,getMax:Kkt,getMin:Zkt},tTt=b(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),rTt=b(function(e,t,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${t}px;`)):(n.set("height",e),n.set("width",t)),n},"calculateSvgSizeAttrs"),vn=b(function(e,t,r,n){let i=rTt(t,r,n);tTt(e,i)},"configureSvgSize"),_f=b(function(e,t,r,n){let i=t.node().getBBox(),a=i.width,s=i.height;se.info(`SVG bounds: ${a}x${s}`,i);let o=0,l=0;se.info(`Graph bounds: ${o}x${l}`,e),o=a+r*2,l=s+r*2,se.info(`Calculated bounds: ${o}x${l}`),vn(t,l,o,n);let u=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;t.attr("viewBox",u)},"setupGraphViewbox"),e9={};b(s9,"cssStyleSheetToString");nTt=b((e,t,r,n)=>{let i="";return e in e9&&e9[e]?i=e9[e]({...r,svgId:n}):se.warn(`No theme found for ${e}`),` & { font-family: ${r.fontFamily}; font-size: ${r.fontSize}; fill: ${r.textColor} @@ -379,44 +379,44 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, } ${t} -`},"getStyles"),eTt=b((e,t)=>{t!==void 0&&(e9[e]=t)},"addStylesForDiagram"),u4e=Jkt,o9={};wm(o9,{clear:()=>Nr,getAccDescription:()=>en,getAccTitle:()=>Qr,getDiagramTitle:()=>tn,setAccDescription:()=>Jr,setAccTitle:()=>Yr,setDiagramTitle:()=>ln});$V="",zV="",GV="",qV=b(e=>Mr(e,qt()),"sanitizeText"),Nr=b(()=>{$V="",GV="",zV=""},"clear"),Yr=b(e=>{$V=qV(e).replace(/^\s+/g,"")},"setAccTitle"),Qr=b(()=>$V,"getAccTitle"),Jr=b(e=>{GV=qV(e).replace(/\n\s+/g,` -`)},"setAccDescription"),en=b(()=>GV,"getAccDescription"),ln=b(e=>{zV=qV(e)},"setDiagramTitle"),tn=b(()=>zV,"getDiagramTitle"),jbe=se,tTt=d5,Be=qt,P5=PV,l9=py,c9=b(e=>Mr(e,Be()),"sanitizeText"),B5=_f,rTt=b(()=>o9,"getCommonDb"),r9={},F5=b((e,t,r)=>{r9[e]&&jbe.warn(`Diagram with id ${e} already registered. Overwriting.`),r9[e]=t,r&&a4e(e,r),eTt(e,t.styles),t.injectUtils?.(jbe,tTt,Be,c9,B5,rTt(),()=>{})},"registerDiagram"),u9=b(e=>{if(e in r9)return r9[e];throw new nTt(e)},"getDiagram"),nTt=class extends Error{static{b(this,"DiagramNotFoundError")}constructor(e){super(`Diagram ${e} not found.`)}}});function yy(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}var VV=W(()=>{});function WV(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}var h4e=W(()=>{});function vy(e){let t,r,n;e.length!==2?(t=yy,r=(o,l)=>yy(e(o),l),n=(o,l)=>e(o)-l):(t=e===yy||e===WV?e:iTt,r=e,n=e);function i(o,l,u=0,h=o.length){if(u>>1;r(o[f],l)<0?u=f+1:h=f}while(u>>1;r(o[f],l)<=0?u=f+1:h=f}while(uu&&n(o[f-1],l)>-n(o[f],l)?f-1:f}return{left:i,center:s,right:a}}function iTt(){return 0}var HV=W(()=>{VV();h4e()});function UV(e){return e===null?NaN:+e}var f4e=W(()=>{});var d4e,p4e,aTt,sTt,YV,m4e=W(()=>{VV();HV();f4e();d4e=vy(yy),p4e=d4e.right,aTt=d4e.left,sTt=vy(UV).center,YV=p4e});function g4e({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function oTt({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function lTt({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function cTt(e){return e!==null&&typeof e=="object"?e.valueOf():e}var Ib,y4e=W(()=>{Ib=class extends Map{constructor(t,r=cTt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(g4e(this,t))}has(t){return super.has(g4e(this,t))}set(t,r){return super.set(oTt(this,t),r)}delete(t){return super.delete(lTt(this,t))}}});function h9(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),s=a>=uTt?10:a>=hTt?5:a>=fTt?2:1,o,l,u;return i<0?(u=Math.pow(10,-i)/s,o=Math.round(e*u),l=Math.round(t*u),o/ut&&--l,u=-u):(u=Math.pow(10,i)*s,o=Math.round(e/u),l=Math.round(t/u),o*ut&&--l),l0))return[];if(e===t)return[e];let n=t=i))return[];let o=a-i+1,l=new Array(o);if(n)if(s<0)for(let u=0;u{uTt=Math.sqrt(50),hTt=Math.sqrt(10),fTt=Math.sqrt(2)});function d9(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r=i)&&(r=i)}return r}var x4e=W(()=>{});function p9(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}var b4e=W(()=>{});function m9(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n{});var Dm=W(()=>{m4e();HV();x4e();b4e();w4e();v4e();y4e()});function k4e(e){return e}var T4e=W(()=>{});function dTt(e){return"translate("+e+",0)"}function pTt(e){return"translate(0,"+e+")"}function mTt(e){return t=>+e(t)}function gTt(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function yTt(){return!this.__axis}function S4e(e,t){var r=[],n=null,i=null,a=6,s=6,o=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=e===y9||e===g9?-1:1,h=e===g9||e===XV?"x":"y",f=e===y9||e===jV?dTt:pTt;function d(p){var m=n??(t.ticks?t.ticks.apply(t,r):t.domain()),g=i??(t.tickFormat?t.tickFormat.apply(t,r):k4e),y=Math.max(a,0)+o,v=t.range(),x=+v[0]+l,w=+v[v.length-1]+l,C=(t.bandwidth?gTt:mTt)(t.copy(),l),T=p.selection?p.selection():p,k=T.selectAll(".domain").data([null]),S=T.selectAll(".tick").data(m,t).order(),E=S.exit(),I=S.enter().append("g").attr("class","tick"),L=S.select("line"),O=S.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(I),L=L.merge(I.append("line").attr("stroke","currentColor").attr(h+"2",u*a)),O=O.merge(I.append("text").attr("fill","currentColor").attr(h,u*y).attr("dy",e===y9?"0em":e===jV?"0.71em":"0.32em")),p!==T&&(k=k.transition(p),S=S.transition(p),L=L.transition(p),O=O.transition(p),E=E.transition(p).attr("opacity",C4e).attr("transform",function(R){return isFinite(R=C(R))?f(R+l):this.getAttribute("transform")}),I.attr("opacity",C4e).attr("transform",function(R){var A=this.parentNode.__axis;return f((A&&isFinite(A=A(R))?A:C(R))+l)})),E.remove(),k.attr("d",e===g9||e===XV?s?"M"+u*s+","+x+"H"+l+"V"+w+"H"+u*s:"M"+l+","+x+"V"+w:s?"M"+x+","+u*s+"V"+l+"H"+w+"V"+u*s:"M"+x+","+l+"H"+w),S.attr("opacity",1).attr("transform",function(R){return f(C(R)+l)}),L.attr(h+"2",u*a),O.attr(h,u*y).text(g),T.filter(yTt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===XV?"start":e===g9?"end":"middle"),T.each(function(){this.__axis=C})}return d.scale=function(p){return arguments.length?(t=p,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(p){return arguments.length?(r=p==null?[]:Array.from(p),d):r.slice()},d.tickValues=function(p){return arguments.length?(n=p==null?null:Array.from(p),d):n&&n.slice()},d.tickFormat=function(p){return arguments.length?(i=p,d):i},d.tickSize=function(p){return arguments.length?(a=s=+p,d):a},d.tickSizeInner=function(p){return arguments.length?(a=+p,d):a},d.tickSizeOuter=function(p){return arguments.length?(s=+p,d):s},d.tickPadding=function(p){return arguments.length?(o=+p,d):o},d.offset=function(p){return arguments.length?(l=+p,d):l},d}function KV(e){return S4e(y9,e)}function ZV(e){return S4e(jV,e)}var y9,XV,jV,g9,C4e,E4e=W(()=>{T4e();y9=1,XV=2,jV=3,g9=4,C4e=1e-6});var A4e=W(()=>{E4e()});function R4e(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}function bTt(e,t){for(var r=0,n=e.length,i;r{vTt={value:()=>{}};v9.prototype=R4e.prototype={constructor:v9,on:function(e,t){var r=this._,n=xTt(e+"",r),i,a=-1,s=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n{L4e()});var x9,eW,tW=W(()=>{x9="http://www.w3.org/1999/xhtml",eW={svg:"http://www.w3.org/2000/svg",xhtml:x9,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function g0(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),eW.hasOwnProperty(t)?{space:eW[t],local:e}:e}var b9=W(()=>{tW()});function wTt(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===x9&&t.documentElement.namespaceURI===x9?t.createElement(e):t.createElementNS(r,e)}}function kTt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function w9(e){var t=g0(e);return(t.local?kTt:wTt)(t)}var rW=W(()=>{b9();tW()});function TTt(){}function xy(e){return e==null?TTt:function(){return this.querySelector(e)}}var k9=W(()=>{});function I4e(e){typeof e!="function"&&(e=xy(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i{lh();k9()});function nW(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}var N4e=W(()=>{});function CTt(){return[]}function z5(e){return e==null?CTt:function(){return this.querySelectorAll(e)}}var iW=W(()=>{});function STt(e){return function(){return nW(e.apply(this,arguments))}}function D4e(e){typeof e=="function"?e=STt(e):e=z5(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a{lh();N4e();iW()});function G5(e){return function(){return this.matches(e)}}function T9(e){return function(t){return t.matches(e)}}var q5=W(()=>{});function ATt(e){return function(){return ETt.call(this.children,e)}}function _Tt(){return this.firstElementChild}function P4e(e){return this.select(e==null?_Tt:ATt(typeof e=="function"?e:T9(e)))}var ETt,B4e=W(()=>{q5();ETt=Array.prototype.find});function LTt(){return Array.from(this.children)}function ITt(e){return function(){return RTt.call(this.children,e)}}function F4e(e){return this.selectAll(e==null?LTt:ITt(typeof e=="function"?e:T9(e)))}var RTt,$4e=W(()=>{q5();RTt=Array.prototype.filter});function z4e(e){typeof e!="function"&&(e=G5(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i{lh();q5()});function C9(e){return new Array(e.length)}var aW=W(()=>{});function q4e(){return new Sa(this._enter||this._groups.map(C9),this._parents)}function V5(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}var sW=W(()=>{aW();lh();V5.prototype={constructor:V5,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}}});function V4e(e){return function(){return e}}var W4e=W(()=>{});function MTt(e,t,r,n,i,a){for(var s=0,o,l=t.length,u=a.length;s=w&&(w=x+1);!(T=y[w])&&++w{lh();sW();W4e()});function Y4e(){return new Sa(this._exit||this._groups.map(C9),this._parents)}var X4e=W(()=>{aW();lh()});function j4e(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}var K4e=W(()=>{});function Z4e(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,s=Math.min(i,a),o=new Array(i),l=0;l{lh()});function J4e(){for(var e=this._groups,t=-1,r=e.length;++t=0;)(s=n[i])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}var ewe=W(()=>{});function twe(e){e||(e=PTt);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;at?1:e>=t?0:NaN}var rwe=W(()=>{lh()});function nwe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}var iwe=W(()=>{});function awe(){return Array.from(this)}var swe=W(()=>{});function owe(){for(var e=this._groups,t=0,r=e.length;t{});function cwe(){let e=0;for(let t of this)++e;return e}var uwe=W(()=>{});function hwe(){return!this.node()}var fwe=W(()=>{});function dwe(e){for(var t=this._groups,r=0,n=t.length;r{});function BTt(e){return function(){this.removeAttribute(e)}}function FTt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $Tt(e,t){return function(){this.setAttribute(e,t)}}function zTt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function GTt(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function qTt(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function mwe(e,t){var r=g0(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?FTt:BTt:typeof t=="function"?r.local?qTt:GTt:r.local?zTt:$Tt)(r,t))}var gwe=W(()=>{b9()});function S9(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}var oW=W(()=>{});function VTt(e){return function(){this.style.removeProperty(e)}}function WTt(e,t,r){return function(){this.style.setProperty(e,t,r)}}function HTt(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function ywe(e,t,r){return arguments.length>1?this.each((t==null?VTt:typeof t=="function"?HTt:WTt)(e,t,r??"")):Om(this.node(),e)}function Om(e,t){return e.style.getPropertyValue(t)||S9(e).getComputedStyle(e,null).getPropertyValue(t)}var lW=W(()=>{oW()});function UTt(e){return function(){delete this[e]}}function YTt(e,t){return function(){this[e]=t}}function XTt(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function vwe(e,t){return arguments.length>1?this.each((t==null?UTt:typeof t=="function"?XTt:YTt)(e,t)):this.node()[e]}var xwe=W(()=>{});function bwe(e){return e.trim().split(/^|\s+/)}function cW(e){return e.classList||new wwe(e)}function wwe(e){this._node=e,this._names=bwe(e.getAttribute("class")||"")}function kwe(e,t){for(var r=cW(e),n=-1,i=t.length;++n{wwe.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}}});function QTt(){this.textContent=""}function JTt(e){return function(){this.textContent=e}}function e5t(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ewe(e){return arguments.length?this.each(e==null?QTt:(typeof e=="function"?e5t:JTt)(e)):this.node().textContent}var Awe=W(()=>{});function t5t(){this.innerHTML=""}function r5t(e){return function(){this.innerHTML=e}}function n5t(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _we(e){return arguments.length?this.each(e==null?t5t:(typeof e=="function"?n5t:r5t)(e)):this.node().innerHTML}var Rwe=W(()=>{});function i5t(){this.nextSibling&&this.parentNode.appendChild(this)}function Lwe(){return this.each(i5t)}var Iwe=W(()=>{});function a5t(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Mwe(){return this.each(a5t)}var Nwe=W(()=>{});function Dwe(e){var t=typeof e=="function"?e:w9(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}var Owe=W(()=>{rW()});function s5t(){return null}function Pwe(e,t){var r=typeof e=="function"?e:w9(e),n=t==null?s5t:typeof t=="function"?t:xy(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}var Bwe=W(()=>{rW();k9()});function o5t(){var e=this.parentNode;e&&e.removeChild(this)}function Fwe(){return this.each(o5t)}var $we=W(()=>{});function l5t(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function c5t(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zwe(e){return this.select(e?c5t:l5t)}var Gwe=W(()=>{});function qwe(e){return arguments.length?this.property("__data__",e):this.node().__data__}var Vwe=W(()=>{});function u5t(e){return function(t){e.call(this,t,this.__data__)}}function h5t(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function f5t(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r{});function Uwe(e,t,r){var n=S9(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function p5t(e,t){return function(){return Uwe(this,e,t)}}function m5t(e,t){return function(){return Uwe(this,e,t.apply(this,arguments))}}function Ywe(e,t){return this.each((typeof t=="function"?m5t:p5t)(e,t))}var Xwe=W(()=>{oW()});function*jwe(){for(var e=this._groups,t=0,r=e.length;t{});function Sa(e,t){this._groups=e,this._parents=t}function Zwe(){return new Sa([[document.documentElement]],uW)}function g5t(){return this}var uW,y0,lh=W(()=>{M4e();O4e();B4e();$4e();G4e();U4e();sW();X4e();K4e();Q4e();ewe();rwe();iwe();swe();lwe();uwe();fwe();pwe();gwe();lW();xwe();Swe();Awe();Rwe();Iwe();Nwe();Owe();Bwe();$we();Gwe();Vwe();Hwe();Xwe();Kwe();uW=[null];Sa.prototype=Zwe.prototype={constructor:Sa,select:I4e,selectAll:D4e,selectChild:P4e,selectChildren:F4e,filter:z4e,data:H4e,enter:q4e,exit:Y4e,join:j4e,merge:Z4e,selection:g5t,order:J4e,sort:twe,call:nwe,nodes:awe,node:owe,size:cwe,empty:hwe,each:dwe,attr:mwe,style:ywe,property:vwe,classed:Cwe,text:Ewe,html:_we,raise:Lwe,lower:Mwe,append:Dwe,insert:Pwe,remove:Fwe,clone:zwe,datum:qwe,on:Wwe,dispatch:Ywe,[Symbol.iterator]:jwe};y0=Zwe});function ct(e){return typeof e=="string"?new Sa([[document.querySelector(e)]],[document.documentElement]):new Sa([[e]],uW)}var Qwe=W(()=>{lh()});var ch=W(()=>{q5();b9();Qwe();lh();k9();iW();lW()});var Jwe=W(()=>{});function by(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Nb(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}var hW=W(()=>{});function Pm(){}function tke(){return this.rgb().formatHex()}function C5t(){return this.rgb().formatHex8()}function S5t(){return lke(this).formatHsl()}function rke(){return this.rgb().formatRgb()}function hh(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=y5t.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?nke(t):r===3?new ao(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?E9(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?E9(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=v5t.exec(e))?new ao(t[1],t[2],t[3],1):(t=x5t.exec(e))?new ao(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=b5t.exec(e))?E9(t[1],t[2],t[3],t[4]):(t=w5t.exec(e))?E9(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=k5t.exec(e))?ske(t[1],t[2]/100,t[3]/100,1):(t=T5t.exec(e))?ske(t[1],t[2]/100,t[3]/100,t[4]):eke.hasOwnProperty(e)?nke(eke[e]):e==="transparent"?new ao(NaN,NaN,NaN,0):null}function nke(e){return new ao(e>>16&255,e>>8&255,e&255,1)}function E9(e,t,r,n){return n<=0&&(e=t=r=NaN),new ao(e,t,r,n)}function dW(e){return e instanceof Pm||(e=hh(e)),e?(e=e.rgb(),new ao(e.r,e.g,e.b,e.opacity)):new ao}function Ob(e,t,r,n){return arguments.length===1?dW(e):new ao(e,t,r,n??1)}function ao(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function ike(){return`#${wy(this.r)}${wy(this.g)}${wy(this.b)}`}function E5t(){return`#${wy(this.r)}${wy(this.g)}${wy(this.b)}${wy((isNaN(this.opacity)?1:this.opacity)*255)}`}function ake(){let e=R9(this.opacity);return`${e===1?"rgb(":"rgba("}${ky(this.r)}, ${ky(this.g)}, ${ky(this.b)}${e===1?")":`, ${e})`}`}function R9(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ky(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function wy(e){return e=ky(e),(e<16?"0":"")+e.toString(16)}function ske(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new uh(e,t,r,n)}function lke(e){if(e instanceof uh)return new uh(e.h,e.s,e.l,e.opacity);if(e instanceof Pm||(e=hh(e)),!e)return new uh;if(e instanceof uh)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),s=NaN,o=a-i,l=(a+i)/2;return o?(t===a?s=(r-n)/o+(r0&&l<1?0:s,new uh(s,o,l,e.opacity)}function cke(e,t,r,n){return arguments.length===1?lke(e):new uh(e,t,r,n??1)}function uh(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function oke(e){return e=(e||0)%360,e<0?e+360:e}function A9(e){return Math.max(0,Math.min(1,e||0))}function fW(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var W5,_9,Db,H5,Rf,y5t,v5t,x5t,b5t,w5t,k5t,T5t,eke,pW=W(()=>{hW();W5=.7,_9=1/W5,Db="\\s*([+-]?\\d+)\\s*",H5="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Rf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",y5t=/^#([0-9a-f]{3,8})$/,v5t=new RegExp(`^rgb\\(${Db},${Db},${Db}\\)$`),x5t=new RegExp(`^rgb\\(${Rf},${Rf},${Rf}\\)$`),b5t=new RegExp(`^rgba\\(${Db},${Db},${Db},${H5}\\)$`),w5t=new RegExp(`^rgba\\(${Rf},${Rf},${Rf},${H5}\\)$`),k5t=new RegExp(`^hsl\\(${H5},${Rf},${Rf}\\)$`),T5t=new RegExp(`^hsla\\(${H5},${Rf},${Rf},${H5}\\)$`),eke={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};by(Pm,hh,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tke,formatHex:tke,formatHex8:C5t,formatHsl:S5t,formatRgb:rke,toString:rke});by(ao,Ob,Nb(Pm,{brighter(e){return e=e==null?_9:Math.pow(_9,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?W5:Math.pow(W5,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ao(ky(this.r),ky(this.g),ky(this.b),R9(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ike,formatHex:ike,formatHex8:E5t,formatRgb:ake,toString:ake}));by(uh,cke,Nb(Pm,{brighter(e){return e=e==null?_9:Math.pow(_9,e),new uh(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?W5:Math.pow(W5,e),new uh(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ao(fW(e>=240?e-240:e+120,i,n),fW(e,i,n),fW(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new uh(oke(this.h),A9(this.s),A9(this.l),R9(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=R9(this.opacity);return`${e===1?"hsl(":"hsla("}${oke(this.h)}, ${A9(this.s)*100}%, ${A9(this.l)*100}%${e===1?")":`, ${e})`}`}}))});var uke,hke,fke=W(()=>{uke=Math.PI/180,hke=180/Math.PI});function vke(e){if(e instanceof Lf)return new Lf(e.l,e.a,e.b,e.opacity);if(e instanceof v0)return xke(e);e instanceof ao||(e=dW(e));var t=vW(e.r),r=vW(e.g),n=vW(e.b),i=mW((.2225045*t+.7168786*r+.0606169*n)/pke),a,s;return t===r&&r===n?a=s=i:(a=mW((.4360747*t+.3850649*r+.1430804*n)/dke),s=mW((.0139322*t+.0971045*r+.7141733*n)/mke)),new Lf(116*i-16,500*(a-i),200*(i-s),e.opacity)}function xW(e,t,r,n){return arguments.length===1?vke(e):new Lf(e,t,r,n??1)}function Lf(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}function mW(e){return e>A5t?Math.pow(e,1/3):e/yke+gke}function gW(e){return e>Pb?e*e*e:yke*(e-gke)}function yW(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function vW(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function _5t(e){if(e instanceof v0)return new v0(e.h,e.c,e.l,e.opacity);if(e instanceof Lf||(e=vke(e)),e.a===0&&e.b===0)return new v0(NaN,0{hW();pW();fke();L9=18,dke=.96422,pke=1,mke=.82521,gke=4/29,Pb=6/29,yke=3*Pb*Pb,A5t=Pb*Pb*Pb;by(Lf,xW,Nb(Pm,{brighter(e){return new Lf(this.l+L9*(e??1),this.a,this.b,this.opacity)},darker(e){return new Lf(this.l-L9*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=dke*gW(t),e=pke*gW(e),r=mke*gW(r),new ao(yW(3.1338561*t-1.6168667*e-.4906146*r),yW(-.9787684*t+1.9161415*e+.033454*r),yW(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));by(v0,U5,Nb(Pm,{brighter(e){return new v0(this.h,this.c,this.l+L9*(e??1),this.opacity)},darker(e){return new v0(this.h,this.c,this.l-L9*(e??1),this.opacity)},rgb(){return xke(this).rgb()}}))});var Bb=W(()=>{pW();bke()});function bW(e,t,r,n,i){var a=e*e,s=a*e;return((1-3*e+3*a-s)*t+(4-6*a+3*s)*r+(1+3*e+3*a-3*s)*n+s*i)/6}function wke(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],a=e[n+1],s=n>0?e[n-1]:2*i-a,o=n{});function kke(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],a=e[n%t],s=e[(n+1)%t],o=e[(n+2)%t];return bW((r-n/t)*t,i,a,s,o)}}var Tke=W(()=>{wW()});var Fb,kW=W(()=>{Fb=e=>()=>e});function Cke(e,t){return function(r){return e+r*t}}function R5t(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Ske(e,t){var r=t-e;return r?Cke(e,r>180||r<-180?r-360*Math.round(r/360):r):Fb(isNaN(e)?t:e)}function Eke(e){return(e=+e)==1?x0:function(t,r){return r-t?R5t(t,r,e):Fb(isNaN(t)?r:t)}}function x0(e,t){var r=t-e;return r?Cke(e,r):Fb(isNaN(e)?t:e)}var TW=W(()=>{kW()});function Ake(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),a=new Array(r),s,o;for(s=0;s{Bb();wW();Tke();TW();Ty=(function e(t){var r=Eke(t);function n(i,a){var s=r((i=Ob(i)).r,(a=Ob(a)).r),o=r(i.g,a.g),l=r(i.b,a.b),u=x0(i.opacity,a.opacity);return function(h){return i.r=s(h),i.g=o(h),i.b=l(h),i.opacity=u(h),i+""}}return n.gamma=e,n})(1);L5t=Ake(wke),I5t=Ake(kke)});function _ke(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;i{});function Ike(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),a=new Array(r),s;for(s=0;s{I9()});function Nke(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}var Dke=W(()=>{});function so(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Y5=W(()=>{});function Oke(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=Cy(e[i],t[i]):n[i]=t[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var Pke=W(()=>{I9()});function M5t(e){return function(){return e}}function N5t(e){return function(t){return e(t)+""}}function X5(e,t){var r=EW.lastIndex=SW.lastIndex=0,n,i,a,s=-1,o=[],l=[];for(e=e+"",t=t+"";(n=EW.exec(e))&&(i=SW.exec(t));)(a=i.index)>r&&(a=t.slice(r,a),o[s]?o[s]+=a:o[++s]=a),(n=n[0])===(i=i[0])?o[s]?o[s]+=i:o[++s]=i:(o[++s]=null,l.push({i:s,x:so(n,i)})),r=SW.lastIndex;return r{Y5();EW=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SW=new RegExp(EW.source,"g")});function Cy(e,t){var r=typeof t,n;return t==null||r==="boolean"?Fb(t):(r==="number"?so:r==="string"?(n=hh(t))?(t=n,Ty):X5:t instanceof hh?Ty:t instanceof Date?Nke:Rke(t)?_ke:Array.isArray(t)?Ike:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Oke:so)(e,t)}var I9=W(()=>{Bb();CW();Mke();Dke();Y5();Pke();AW();kW();Lke()});function _W(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var Bke=W(()=>{});function RW(e,t,r,n,i,a){var s,o,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*r+t*n)&&(r-=e*l,n-=t*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),e*n{Fke=180/Math.PI,M9={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}});function zke(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?M9:RW(t.a,t.b,t.c,t.d,t.e,t.f)}function Gke(e){return e==null?M9:(N9||(N9=document.createElementNS("http://www.w3.org/2000/svg","g")),N9.setAttribute("transform",e),(e=N9.transform.baseVal.consolidate())?(e=e.matrix,RW(e.a,e.b,e.c,e.d,e.e,e.f)):M9)}var N9,qke=W(()=>{$ke()});function Vke(e,t,r,n){function i(u){return u.length?u.pop()+" ":""}function a(u,h,f,d,p,m){if(u!==f||h!==d){var g=p.push("translate(",null,t,null,r);m.push({i:g-4,x:so(u,f)},{i:g-2,x:so(h,d)})}else(f||d)&&p.push("translate("+f+t+d+r)}function s(u,h,f,d){u!==h?(u-h>180?h+=360:h-u>180&&(u+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:so(u,h)})):h&&f.push(i(f)+"rotate("+h+n)}function o(u,h,f,d){u!==h?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:so(u,h)}):h&&f.push(i(f)+"skewX("+h+n)}function l(u,h,f,d,p,m){if(u!==f||h!==d){var g=p.push(i(p)+"scale(",null,",",null,")");m.push({i:g-4,x:so(u,f)},{i:g-2,x:so(h,d)})}else(f!==1||d!==1)&&p.push(i(p)+"scale("+f+","+d+")")}return function(u,h){var f=[],d=[];return u=e(u),h=e(h),a(u.translateX,u.translateY,h.translateX,h.translateY,f,d),s(u.rotate,h.rotate,f,d),o(u.skewX,h.skewX,f,d),l(u.scaleX,u.scaleY,h.scaleX,h.scaleY,f,d),u=h=null,function(p){for(var m=-1,g=d.length,y;++m{Y5();qke();LW=Vke(zke,"px, ","px)","deg)"),IW=Vke(Gke,", ",")",")")});function Hke(e){return function(t,r){var n=e((t=U5(t)).h,(r=U5(r)).h),i=x0(t.c,r.c),a=x0(t.l,r.l),s=x0(t.opacity,r.opacity);return function(o){return t.h=n(o),t.c=i(o),t.l=a(o),t.opacity=s(o),t+""}}}var MW,D5t,Uke=W(()=>{Bb();TW();MW=Hke(Ske),D5t=Hke(x0)});var $b=W(()=>{I9();Y5();Bke();AW();Wke();CW();Uke()});function e3(){return Sy||(jke(O5t),Sy=Q5.now()+P9)}function O5t(){Sy=0}function J5(){this._call=this._time=this._next=null}function B9(e,t,r){var n=new J5;return n.restart(e,t,r),n}function Kke(){e3(),++zb;for(var e=D9,t;e;)(t=Sy-e._time)>=0&&e._call.call(void 0,t),e=e._next;--zb}function Yke(){Sy=(O9=Q5.now())+P9,zb=K5=0;try{Kke()}finally{zb=0,B5t(),Sy=0}}function P5t(){var e=Q5.now(),t=e-O9;t>Xke&&(P9-=t,O9=e)}function B5t(){for(var e,t=D9,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:D9=r);Z5=e,NW(n)}function NW(e){if(!zb){K5&&(K5=clearTimeout(K5));var t=e-Sy;t>24?(e<1/0&&(K5=setTimeout(Yke,e-Q5.now()-P9)),j5&&(j5=clearInterval(j5))):(j5||(O9=Q5.now(),j5=setInterval(P5t,Xke)),zb=1,jke(Yke))}}var zb,K5,j5,Xke,D9,Z5,O9,Sy,P9,Q5,jke,DW=W(()=>{zb=0,K5=0,j5=0,Xke=1e3,O9=0,Sy=0,P9=0,Q5=typeof performance=="object"&&performance.now?performance:Date,jke=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};J5.prototype=B9.prototype={constructor:J5,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?e3():+r)+(t==null?0:+t),!this._next&&Z5!==this&&(Z5?Z5._next=this:D9=this,Z5=this),this._call=e,this._time=r,NW()},stop:function(){this._call&&(this._call=null,this._time=1/0,NW())}}});function F9(e,t,r){var n=new J5;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var Zke=W(()=>{DW()});var $9=W(()=>{DW();Zke()});function Bm(e,t,r,n,i,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;z5t(e,r,{name:t,index:n,group:i,on:F5t,tween:$5t,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:eTe})}function r3(e,t){var r=vs(e,t);if(r.state>eTe)throw new Error("too late; already scheduled");return r}function oo(e,t){var r=vs(e,t);if(r.state>z9)throw new Error("too late; already running");return r}function vs(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function z5t(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=B9(a,0,r.time);function a(u){r.state=Qke,r.timer.restart(s,r.delay,r.time),r.delay<=u&&s(u-r.delay)}function s(u){var h,f,d,p;if(r.state!==Qke)return l();for(h in n)if(p=n[h],p.name===r.name){if(p.state===z9)return F9(s);p.state===Jke?(p.state=t3,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete n[h]):+h{JV();$9();F5t=QV("start","end","cancel","interrupt"),$5t=[],eTe=0,Qke=1,G9=2,z9=3,Jke=4,q9=5,t3=6});function V9(e,t){var r=e.__transition,n,i,a=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((n=r[s]).name!==t){a=!1;continue}i=n.state>G9&&n.state{jl()});function rTe(e){return this.each(function(){V9(this,e)})}var nTe=W(()=>{tTe()});function G5t(e,t){var r,n;return function(){var i=oo(this,e),a=i.tween;if(a!==r){n=r=a;for(var s=0,o=n.length;s{jl()});function W9(e,t){var r;return(typeof t=="number"?so:t instanceof hh?Ty:(r=hh(t))?(t=r,Ty):X5)(e,t)}var OW=W(()=>{Bb();$b()});function V5t(e){return function(){this.removeAttribute(e)}}function W5t(e){return function(){this.removeAttributeNS(e.space,e.local)}}function H5t(e,t,r){var n,i=r+"",a;return function(){var s=this.getAttribute(e);return s===i?null:s===n?a:a=t(n=s,r)}}function U5t(e,t,r){var n,i=r+"",a;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===n?a:a=t(n=s,r)}}function Y5t(e,t,r){var n,i,a;return function(){var s,o=r(this),l;return o==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=o+"",s===l?null:s===n&&l===i?a:(i=l,a=t(n=s,o)))}}function X5t(e,t,r){var n,i,a;return function(){var s,o=r(this),l;return o==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=o+"",s===l?null:s===n&&l===i?a:(i=l,a=t(n=s,o)))}}function aTe(e,t){var r=g0(e),n=r==="transform"?IW:W9;return this.attrTween(e,typeof t=="function"?(r.local?X5t:Y5t)(r,n,Gb(this,"attr."+e,t)):t==null?(r.local?W5t:V5t)(r):(r.local?U5t:H5t)(r,n,t))}var sTe=W(()=>{$b();ch();n3();OW()});function j5t(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function K5t(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function Z5t(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&K5t(e,a)),r}return i._value=t,i}function Q5t(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&j5t(e,a)),r}return i._value=t,i}function oTe(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=g0(e);return this.tween(r,(n.local?Z5t:Q5t)(n,t))}var lTe=W(()=>{ch()});function J5t(e,t){return function(){r3(this,e).delay=+t.apply(this,arguments)}}function e3t(e,t){return t=+t,function(){r3(this,e).delay=t}}function cTe(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?J5t:e3t)(t,e)):vs(this.node(),t).delay}var uTe=W(()=>{jl()});function t3t(e,t){return function(){oo(this,e).duration=+t.apply(this,arguments)}}function r3t(e,t){return t=+t,function(){oo(this,e).duration=t}}function hTe(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?t3t:r3t)(t,e)):vs(this.node(),t).duration}var fTe=W(()=>{jl()});function n3t(e,t){if(typeof t!="function")throw new Error;return function(){oo(this,e).ease=t}}function dTe(e){var t=this._id;return arguments.length?this.each(n3t(t,e)):vs(this.node(),t).ease}var pTe=W(()=>{jl()});function i3t(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;oo(this,e).ease=r}}function mTe(e){if(typeof e!="function")throw new Error;return this.each(i3t(this._id,e))}var gTe=W(()=>{jl()});function yTe(e){typeof e!="function"&&(e=G5(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i{ch();Ey()});function xTe(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),s=new Array(n),o=0;o{Ey()});function a3t(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function s3t(e,t,r){var n,i,a=a3t(t)?r3:oo;return function(){var s=a(this,e),o=s.on;o!==n&&(i=(n=o).copy()).on(t,r),s.on=i}}function wTe(e,t){var r=this._id;return arguments.length<2?vs(this.node(),r).on.on(e):this.each(s3t(r,e,t))}var kTe=W(()=>{jl()});function o3t(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function TTe(){return this.on("end.remove",o3t(this._id))}var CTe=W(()=>{});function STe(e){var t=this._name,r=this._id;typeof e!="function"&&(e=xy(e));for(var n=this._groups,i=n.length,a=new Array(i),s=0;s{ch();Ey();jl()});function ATe(e){var t=this._name,r=this._id;typeof e!="function"&&(e=z5(e));for(var n=this._groups,i=n.length,a=[],s=[],o=0;o{ch();Ey();jl()});function RTe(){return new l3t(this._groups,this._parents)}var l3t,LTe=W(()=>{ch();l3t=y0.prototype.constructor});function c3t(e,t){var r,n,i;return function(){var a=Om(this,e),s=(this.style.removeProperty(e),Om(this,e));return a===s?null:a===r&&s===n?i:i=t(r=a,n=s)}}function ITe(e){return function(){this.style.removeProperty(e)}}function u3t(e,t,r){var n,i=r+"",a;return function(){var s=Om(this,e);return s===i?null:s===n?a:a=t(n=s,r)}}function h3t(e,t,r){var n,i,a;return function(){var s=Om(this,e),o=r(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(e),Om(this,e))),s===l?null:s===n&&l===i?a:(i=l,a=t(n=s,o))}}function f3t(e,t){var r,n,i,a="style."+t,s="end."+a,o;return function(){var l=oo(this,e),u=l.on,h=l.value[a]==null?o||(o=ITe(t)):void 0;(u!==r||i!==h)&&(n=(r=u).copy()).on(s,i=h),l.on=n}}function MTe(e,t,r){var n=(e+="")=="transform"?LW:W9;return t==null?this.styleTween(e,c3t(e,n)).on("end.style."+e,ITe(e)):typeof t=="function"?this.styleTween(e,h3t(e,n,Gb(this,"style."+e,t))).each(f3t(this._id,e)):this.styleTween(e,u3t(e,n,t),r).on("end.style."+e,null)}var NTe=W(()=>{$b();ch();jl();n3();OW()});function d3t(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function p3t(e,t,r){var n,i;function a(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&d3t(e,s,r)),n}return a._value=t,a}function DTe(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,p3t(e,t,r??""))}var OTe=W(()=>{});function m3t(e){return function(){this.textContent=e}}function g3t(e){return function(){var t=e(this);this.textContent=t??""}}function PTe(e){return this.tween("text",typeof e=="function"?g3t(Gb(this,"text",e)):m3t(e==null?"":e+""))}var BTe=W(()=>{n3()});function y3t(e){return function(t){this.textContent=e.call(this,t)}}function v3t(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&y3t(i)),t}return n._value=e,n}function FTe(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,v3t(e))}var $Te=W(()=>{});function zTe(){for(var e=this._name,t=this._id,r=H9(),n=this._groups,i=n.length,a=0;a{Ey();jl()});function qTe(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,s){var o={value:s},l={value:function(){--i===0&&a()}};r.each(function(){var u=oo(this,n),h=u.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(o),t._.interrupt.push(o),t._.end.push(l)),u.on=t}),i===0&&a()})}var VTe=W(()=>{jl()});function ml(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function WTe(e){return y0().transition(e)}function H9(){return++x3t}var x3t,b0,Ey=W(()=>{ch();sTe();lTe();uTe();fTe();pTe();gTe();vTe();bTe();kTe();CTe();ETe();_Te();LTe();NTe();OTe();BTe();$Te();GTe();n3();VTe();x3t=0;b0=y0.prototype;ml.prototype=WTe.prototype={constructor:ml,select:STe,selectAll:ATe,selectChild:b0.selectChild,selectChildren:b0.selectChildren,filter:yTe,merge:xTe,selection:RTe,transition:zTe,call:b0.call,nodes:b0.nodes,node:b0.node,size:b0.size,empty:b0.empty,each:b0.each,on:wTe,attr:aTe,attrTween:oTe,style:MTe,styleTween:DTe,text:PTe,textTween:FTe,remove:TTe,tween:iTe,delay:cTe,duration:hTe,ease:dTe,easeVarying:mTe,end:qTe,[Symbol.iterator]:b0[Symbol.iterator]}});function U9(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var HTe=W(()=>{});var PW=W(()=>{HTe()});function w3t(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function UTe(e){var t,r;e instanceof ml?(t=e._id,e=e._name):(t=H9(),(r=b3t).time=e3(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,a=0;a{Ey();jl();PW();$9();b3t={time:null,delay:0,duration:250,ease:U9}});var XTe=W(()=>{ch();nTe();YTe();y0.prototype.interrupt=rTe;y0.prototype.transition=UTe});var Y9=W(()=>{XTe()});var jTe=W(()=>{});var KTe=W(()=>{});var ZTe=W(()=>{});function QTe(e){return[+e[0],+e[1]]}function k3t(e){return[QTe(e[0]),QTe(e[1])]}function BW(e){return{type:e}}var ADr,_Dr,RDr,LDr,IDr,MDr,JTe=W(()=>{Y9();jTe();KTe();ZTe();({abs:ADr,max:_Dr,min:RDr}=Math);LDr={name:"x",handles:["w","e"].map(BW),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},IDr={name:"y",handles:["n","s"].map(BW),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},MDr={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(BW),input:function(e){return e==null?null:k3t(e)},output:function(e){return e}}});var e5e=W(()=>{JTe()});function t5e(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return t5e;let r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;i{FW=Math.PI,$W=2*FW,Ay=1e-6,T3t=$W-Ay;_y=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?t5e:C3t(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,a,s){this._append`C${+t},${+r},${+n},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,r,n,i,a){if(t=+t,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=n-t,u=i-r,h=s-t,f=o-r,d=h*h+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Ay)if(!(Math.abs(f*l-u*h)>Ay)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-s,m=i-o,g=l*l+u*u,y=p*p+m*m,v=Math.sqrt(g),x=Math.sqrt(d),w=a*Math.tan((FW-Math.acos((g+d-y)/(2*v*x)))/2),C=w/x,T=w/v;Math.abs(C-1)>Ay&&this._append`L${t+C*h},${r+C*f}`,this._append`A${a},${a},0,0,${+(f*p>h*m)},${this._x1=t+T*l},${this._y1=r+T*u}`}}arc(t,r,n,i,a,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(i),l=n*Math.sin(i),u=t+o,h=r+l,f=1^s,d=s?i-a:a-i;this._x1===null?this._append`M${u},${h}`:(Math.abs(this._x1-u)>Ay||Math.abs(this._y1-h)>Ay)&&this._append`L${u},${h}`,n&&(d<0&&(d=d%$W+$W),d>T3t?this._append`A${n},${n},0,1,${f},${t-o},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=h}`:d>Ay&&this._append`A${n},${n},0,${+(d>=FW)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};r5e.prototype=_y.prototype});var zW=W(()=>{n5e()});var i5e=W(()=>{});var a5e=W(()=>{});var s5e=W(()=>{});var o5e=W(()=>{});var l5e=W(()=>{});var c5e=W(()=>{});var u5e=W(()=>{});function h5e(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Ry(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}var i3=W(()=>{});function If(e){return e=Ry(Math.abs(e)),e?e[1]:NaN}var a3=W(()=>{i3()});function f5e(e,t){return function(r,n){for(var i=r.length,a=[],s=0,o=e[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),a.push(r.substring(i-=o,i+o)),!((l+=o+1)>n));)o=e[s=(s+1)%e.length];return a.reverse().join(t)}}var d5e=W(()=>{});function p5e(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var m5e=W(()=>{});function Fm(e){if(!(t=S3t.exec(e)))throw new Error("invalid format: "+e);var t;return new X9({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function X9(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}var S3t,GW=W(()=>{S3t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;Fm.prototype=X9.prototype;X9.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type}});function g5e(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var y5e=W(()=>{});function v5e(e,t){var r=Ry(e,t);if(!r)return s3=void 0,e.toPrecision(t);var n=r[0],i=r[1],a=i-(s3=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return a===s?n:a>s?n+new Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Ry(e,Math.max(0,t+a-1))[0]}var s3,qW=W(()=>{i3()});function VW(e,t){var r=Ry(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var x5e=W(()=>{i3()});var WW,b5e=W(()=>{i3();qW();x5e();WW={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:h5e,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>VW(e*100,t),r:VW,s:v5e,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)}});function HW(e){return e}var w5e=W(()=>{});function C5e(e){var t=e.grouping===void 0||e.thousands===void 0?HW:f5e(k5e.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?HW:p5e(k5e.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",o=e.minus===void 0?"\u2212":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function u(f,d){f=Fm(f);var p=f.fill,m=f.align,g=f.sign,y=f.symbol,v=f.zero,x=f.width,w=f.comma,C=f.precision,T=f.trim,k=f.type;k==="n"?(w=!0,k="g"):WW[k]||(C===void 0&&(C=12),T=!0,k="g"),(v||p==="0"&&m==="=")&&(v=!0,p="0",m="=");var S=(d&&d.prefix!==void 0?d.prefix:"")+(y==="$"?r:y==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),E=(y==="$"?n:/[%p]/.test(k)?s:"")+(d&&d.suffix!==void 0?d.suffix:""),I=WW[k],L=/[defgprs%]/.test(k);C=C===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function O(R){var A=S,N=E,M,D,B;if(k==="c")N=I(R)+N,R="";else{R=+R;var P=R<0||1/R<0;if(R=isNaN(R)?l:I(Math.abs(R),C),T&&(R=g5e(R)),P&&+R==0&&g!=="+"&&(P=!1),A=(P?g==="("?g:o:g==="-"||g==="("?"":g)+A,N=(k==="s"&&!isNaN(R)&&s3!==void 0?T5e[8+s3/3]:"")+N+(P&&g==="("?")":""),L){for(M=-1,D=R.length;++MB||B>57){N=(B===46?i+R.slice(M+1):R.slice(M))+N,R=R.slice(0,M);break}}}w&&!v&&(R=t(R,1/0));var $=A.length+R.length+N.length,F=$>1)+A+R+N+F.slice($);break;default:R=F+A+R+N;break}return a(R)}return O.toString=function(){return f+""},O}function h(f,d){var p=Math.max(-8,Math.min(8,Math.floor(If(d)/3)))*3,m=Math.pow(10,-p),g=u((f=Fm(f),f.type="f",f),{suffix:T5e[8+p/3]});return function(y){return g(m*y)}}return{format:u,formatPrefix:h}}var k5e,T5e,S5e=W(()=>{a3();d5e();m5e();GW();y5e();b5e();qW();w5e();k5e=Array.prototype.map,T5e=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"]});function UW(e){return j9=C5e(e),Mf=j9.format,K9=j9.formatPrefix,j9}var j9,Mf,K9,E5e=W(()=>{S5e();UW({thousands:",",grouping:[3],currency:["$",""]})});function YW(e){return Math.max(0,-If(Math.abs(e)))}var A5e=W(()=>{a3()});function XW(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(If(t)/3)))*3-If(Math.abs(e)))}var _5e=W(()=>{a3()});function jW(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,If(t)-If(e))+1}var R5e=W(()=>{a3()});var KW=W(()=>{E5e();GW();A5e();_5e();R5e()});var L5e=W(()=>{});function E3t(e){var t=0,r=e.children,n=r&&r.length;if(!n)t=1;else for(;--n>=0;)t+=r[n].value;e.value=t}function I5e(){return this.eachAfter(E3t)}var M5e=W(()=>{});function N5e(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}var D5e=W(()=>{});function O5e(e,t){for(var r=this,n=[r],i,a,s=-1;r=n.pop();)if(e.call(t,r,++s,this),i=r.children)for(a=i.length-1;a>=0;--a)n.push(i[a]);return this}var P5e=W(()=>{});function B5e(e,t){for(var r=this,n=[r],i=[],a,s,o,l=-1;r=n.pop();)if(i.push(r),a=r.children)for(s=0,o=a.length;s{});function $5e(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}var z5e=W(()=>{});function G5e(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,n=t.children,i=n&&n.length;--i>=0;)r+=n[i].value;t.value=r})}var q5e=W(()=>{});function V5e(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var W5e=W(()=>{});function H5e(e){for(var t=this,r=A3t(t,e),n=[t];t!==r;)t=t.parent,n.push(t);for(var i=n.length;e!==r;)n.splice(i,0,e),e=e.parent;return n}function A3t(e,t){if(e===t)return e;var r=e.ancestors(),n=t.ancestors(),i=null;for(e=r.pop(),t=n.pop();e===t;)i=e,e=r.pop(),t=n.pop();return i}var U5e=W(()=>{});function Y5e(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var X5e=W(()=>{});function j5e(){return Array.from(this)}var K5e=W(()=>{});function Z5e(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var Q5e=W(()=>{});function J5e(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}var e3e=W(()=>{});function*t3e(){var e=this,t,r=[e],n,i,a;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,n=e.children)for(i=0,a=n.length;i{});function qb(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=L3t)):t===void 0&&(t=R3t);for(var r=new o3(e),n,i=[r],a,s,o,l;n=i.pop();)if((s=t(n.data))&&(l=(s=Array.from(s)).length))for(n.children=s,o=l-1;o>=0;--o)i.push(a=s[o]=new o3(s[o])),a.parent=n,a.depth=n.depth+1;return r.eachBefore(M3t)}function _3t(){return qb(this).eachBefore(I3t)}function R3t(e){return e.children}function L3t(e){return Array.isArray(e)?e[1]:null}function I3t(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function M3t(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function o3(e){this.data=e,this.depth=this.height=0,this.parent=null}var n3e=W(()=>{M5e();D5e();P5e();F5e();z5e();q5e();W5e();U5e();X5e();K5e();Q5e();e3e();r3e();o3.prototype=qb.prototype={constructor:o3,count:I5e,each:N5e,eachAfter:B5e,eachBefore:O5e,find:$5e,sum:G5e,sort:V5e,path:H5e,ancestors:Y5e,descendants:j5e,leaves:Z5e,links:J5e,copy:_3t,[Symbol.iterator]:t3e}});function i3e(e){if(typeof e!="function")throw new Error;return e}var a3e=W(()=>{});function Vb(){return 0}function Wb(e){return function(){return e}}var s3e=W(()=>{});function o3e(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var l3e=W(()=>{});function c3e(e,t,r,n,i){for(var a=e.children,s,o=-1,l=a.length,u=e.value&&(n-t)/e.value;++o{});function h3e(e,t,r,n,i){for(var a=e.children,s,o=-1,l=a.length,u=e.value&&(i-r)/e.value;++o{});function D3t(e,t,r,n,i,a){for(var s=[],o=t.children,l,u,h=0,f=0,d=o.length,p,m,g=t.value,y,v,x,w,C,T,k;hx&&(x=u),k=y*y*T,w=Math.max(x/k,k/v),w>C){y-=u;break}C=w}s.push(l={value:y,dice:p{u3e();f3e();N3t=(1+Math.sqrt(5))/2;d3e=(function e(t){function r(n,i,a,s,o){D3t(t,n,i,a,s,o)}return r.ratio=function(n){return e((n=+n)>1?n:1)},r})(N3t)});function ZW(){var e=d3e,t=!1,r=1,n=1,i=[0],a=Vb,s=Vb,o=Vb,l=Vb,u=Vb;function h(d){return d.x0=d.y0=0,d.x1=r,d.y1=n,d.eachBefore(f),i=[0],t&&d.eachBefore(o3e),d}function f(d){var p=i[d.depth],m=d.x0+p,g=d.y0+p,y=d.x1-p,v=d.y1-p;y{l3e();p3e();a3e();s3e()});var g3e=W(()=>{n3e();m3e()});var y3e=W(()=>{});var v3e=W(()=>{});function $m(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var l3=W(()=>{});function Pc(){var e=new Ib,t=[],r=[],n=QW;function i(a){let s=e.get(a);if(s===void 0){if(n!==QW)return n;e.set(a,s=t.push(a)-1)}return r[s%r.length]}return i.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new Ib;for(let s of a)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return Pc(t,r).unknown(n)},$m.apply(i,arguments),i}var QW,JW=W(()=>{Dm();l3();QW=Symbol("implicit")});function Hb(){var e=Pc().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,a,s,o=!1,l=0,u=0,h=.5;delete e.unknown;function f(){var d=t().length,p=i{Dm();l3();JW()});function eH(e){return function(){return e}}var b3e=W(()=>{});function tH(e){return+e}var w3e=W(()=>{});function Ub(e){return e}function rH(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:eH(isNaN(t)?NaN:.5)}function O3t(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function P3t(e,t,r){var n=e[0],i=e[1],a=t[0],s=t[1];return i2?B3t:P3t,l=u=null,f}function f(d){return d==null||isNaN(d=+d)?a:(l||(l=o(e.map(n),t,r)))(n(s(d)))}return f.invert=function(d){return s(i((u||(u=o(t,e.map(n),so)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,tH),h()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),h()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=_W,h()},f.clamp=function(d){return arguments.length?(s=d?!0:Ub,h()):s!==Ub},f.interpolate=function(d){return arguments.length?(r=d,h()):r},f.unknown=function(d){return arguments.length?(a=d,f):a},function(d,p){return n=d,i=p,h()}}function c3(){return F3t()(Ub,Ub)}var k3e,nH=W(()=>{Dm();$b();b3e();w3e();k3e=[0,1]});function iH(e,t,r,n){var i=Mb(e,t,r),a;switch(n=Fm(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=XW(i,s))&&(n.precision=a),K9(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=jW(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=YW(i))&&(n.precision=a-(n.type==="%")*2);break}}return Mf(n)}var T3e=W(()=>{Dm();KW()});function $3t(e){var t=e.domain;return e.ticks=function(r){var n=t();return f9(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return iH(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,s=n[i],o=n[a],l,u,h=10;for(o0;){if(u=$5(s,o,r),u===l)return n[i]=s,n[a]=o,t(n);if(u>0)s=Math.floor(s/u)*u,o=Math.ceil(o/u)*u;else if(u<0)s=Math.ceil(s*u)/u,o=Math.floor(o*u)/u;else break;l=u}return e},e}function fh(){var e=c3();return e.copy=function(){return Z9(e,fh())},$m.apply(e,arguments),$3t(e)}var C3e=W(()=>{Dm();nH();l3();T3e()});function aH(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],s;return a{});function Ni(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{let s=i(a),o=i.ceil(a);return a-s(t(a=new Date(+a),s==null?1:Math.floor(s)),a),i.range=(a,s,o)=>{let l=[];if(a=i.ceil(a),o=o==null?1:Math.floor(o),!(a0))return l;let u;do l.push(u=new Date(+a)),t(a,o),e(a);while(uNi(s=>{if(s>=s)for(;e(s),!a(s);)s.setTime(s-1)},(s,o)=>{if(s>=s)if(o<0)for(;++o<=0;)for(;t(s,-1),!a(s););else for(;--o>=0;)for(;t(s,1),!a(s););}),r&&(i.count=(a,s)=>(sH.setTime(+a),oH.setTime(+s),e(sH),e(oH),Math.floor(r(sH,oH))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?s=>n(s)%a===0:s=>i.count(0,s)%a===0):i)),i}var sH,oH,w0=W(()=>{sH=new Date,oH=new Date});var Nf,E3e,lH=W(()=>{w0();Nf=Ni(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Nf.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ni(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Nf);E3e=Nf.range});var Bc,A3e,cH=W(()=>{w0();Bc=Ni(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),A3e=Bc.range});var k0,z3t,Q9,G3t,uH=W(()=>{w0();k0=Ni(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),z3t=k0.range,Q9=Ni(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),G3t=Q9.range});var T0,q3t,J9,V3t,hH=W(()=>{w0();T0=Ni(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),q3t=T0.range,J9=Ni(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),V3t=J9.range});var Su,W3t,h3,H3t,e_,U3t,fH=W(()=>{w0();Su=Ni(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),W3t=Su.range,h3=Ni(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),H3t=h3.range,e_=Ni(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),U3t=e_.range});function My(e){return Ni(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}function Ny(e){return Ni(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var dh,zm,t_,r_,Of,n_,i_,R3e,Y3t,X3t,j3t,K3t,Z3t,Q3t,Dy,Yb,L3e,I3e,Gm,M3e,N3e,D3e,J3t,eCt,tCt,rCt,nCt,iCt,dH=W(()=>{w0();dh=My(0),zm=My(1),t_=My(2),r_=My(3),Of=My(4),n_=My(5),i_=My(6),R3e=dh.range,Y3t=zm.range,X3t=t_.range,j3t=r_.range,K3t=Of.range,Z3t=n_.range,Q3t=i_.range;Dy=Ny(0),Yb=Ny(1),L3e=Ny(2),I3e=Ny(3),Gm=Ny(4),M3e=Ny(5),N3e=Ny(6),D3e=Dy.range,J3t=Yb.range,eCt=L3e.range,tCt=I3e.range,rCt=Gm.range,nCt=M3e.range,iCt=N3e.range});var C0,aCt,a_,sCt,pH=W(()=>{w0();C0=Ni(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),aCt=C0.range,a_=Ni(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),sCt=a_.range});var Fc,oCt,ph,lCt,mH=W(()=>{w0();Fc=Ni(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Fc.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ni(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});oCt=Fc.range,ph=Ni(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ph.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ni(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});lCt=ph.range});function P3e(e,t,r,n,i,a){let s=[[Bc,1,1e3],[Bc,5,5*1e3],[Bc,15,15*1e3],[Bc,30,30*1e3],[a,1,6e4],[a,5,5*6e4],[a,15,15*6e4],[a,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function o(u,h,f){let d=hy).right(s,d);if(p===s.length)return e.every(Mb(u/31536e6,h/31536e6,f));if(p===0)return Nf.every(Math.max(Mb(u,h,f),1));let[m,g]=s[d/s[p-1][2]{Dm();lH();cH();uH();hH();fH();dH();pH();mH();[uCt,hCt]=P3e(ph,a_,Dy,e_,J9,Q9),[gH,yH]=P3e(Fc,C0,dh,Su,T0,k0)});var s_=W(()=>{lH();cH();uH();hH();fH();dH();pH();mH();B3e()});function vH(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function xH(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function f3(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function bH(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,a=e.days,s=e.shortDays,o=e.months,l=e.shortMonths,u=d3(i),h=p3(i),f=d3(a),d=p3(a),p=d3(s),m=p3(s),g=d3(o),y=p3(o),v=d3(l),x=p3(l),w={a:B,A:P,b:$,B:F,c:null,d:V3e,e:V3e,f:DCt,g:WCt,G:UCt,H:ICt,I:MCt,j:NCt,L:X3e,m:OCt,M:PCt,p:q,q:G,Q:U3e,s:Y3e,S:BCt,u:FCt,U:$Ct,V:zCt,w:GCt,W:qCt,x:null,X:null,y:VCt,Y:HCt,Z:YCt,"%":H3e},C={a:z,A:H,b:j,B:J,c:null,d:W3e,e:W3e,f:ZCt,g:oSt,G:cSt,H:XCt,I:jCt,j:KCt,L:K3e,m:QCt,M:JCt,p:U,q:le,Q:U3e,s:Y3e,S:eSt,u:tSt,U:rSt,V:nSt,w:iSt,W:aSt,x:null,X:null,y:sSt,Y:lSt,Z:uSt,"%":H3e},T={a:L,A:O,b:R,B:A,c:N,d:G3e,e:G3e,f:ACt,g:z3e,G:$3e,H:q3e,I:q3e,j:TCt,L:ECt,m:kCt,M:CCt,p:I,q:wCt,Q:RCt,s:LCt,S:SCt,u:gCt,U:yCt,V:vCt,w:mCt,W:xCt,x:M,X:D,y:z3e,Y:$3e,Z:bCt,"%":_Ct};w.x=k(r,w),w.X=k(n,w),w.c=k(t,w),C.x=k(r,C),C.X=k(n,C),C.c=k(t,C);function k(ee,ue){return function(ae){var oe=[],Re=-1,Te=0,Oe=ee.length,qe,Ge,fe;for(ae instanceof Date||(ae=new Date(+ae));++Re53)return null;"w"in oe||(oe.w=1),"Z"in oe?(Te=xH(f3(oe.y,0,1)),Oe=Te.getUTCDay(),Te=Oe>4||Oe===0?Yb.ceil(Te):Yb(Te),Te=h3.offset(Te,(oe.V-1)*7),oe.y=Te.getUTCFullYear(),oe.m=Te.getUTCMonth(),oe.d=Te.getUTCDate()+(oe.w+6)%7):(Te=vH(f3(oe.y,0,1)),Oe=Te.getDay(),Te=Oe>4||Oe===0?zm.ceil(Te):zm(Te),Te=Su.offset(Te,(oe.V-1)*7),oe.y=Te.getFullYear(),oe.m=Te.getMonth(),oe.d=Te.getDate()+(oe.w+6)%7)}else("W"in oe||"U"in oe)&&("w"in oe||(oe.w="u"in oe?oe.u%7:"W"in oe?1:0),Oe="Z"in oe?xH(f3(oe.y,0,1)).getUTCDay():vH(f3(oe.y,0,1)).getDay(),oe.m=0,oe.d="W"in oe?(oe.w+6)%7+oe.W*7-(Oe+5)%7:oe.w+oe.U*7-(Oe+6)%7);return"Z"in oe?(oe.H+=oe.Z/100|0,oe.M+=oe.Z%100,xH(oe)):vH(oe)}}function E(ee,ue,ae,oe){for(var Re=0,Te=ue.length,Oe=ae.length,qe,Ge;Re=Oe)return-1;if(qe=ue.charCodeAt(Re++),qe===37){if(qe=ue.charAt(Re++),Ge=T[qe in F3e?ue.charAt(Re++):qe],!Ge||(oe=Ge(ee,ae,oe))<0)return-1}else if(qe!=ae.charCodeAt(oe++))return-1}return oe}function I(ee,ue,ae){var oe=u.exec(ue.slice(ae));return oe?(ee.p=h.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function L(ee,ue,ae){var oe=p.exec(ue.slice(ae));return oe?(ee.w=m.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function O(ee,ue,ae){var oe=f.exec(ue.slice(ae));return oe?(ee.w=d.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function R(ee,ue,ae){var oe=v.exec(ue.slice(ae));return oe?(ee.m=x.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function A(ee,ue,ae){var oe=g.exec(ue.slice(ae));return oe?(ee.m=y.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function N(ee,ue,ae){return E(ee,t,ue,ae)}function M(ee,ue,ae){return E(ee,r,ue,ae)}function D(ee,ue,ae){return E(ee,n,ue,ae)}function B(ee){return s[ee.getDay()]}function P(ee){return a[ee.getDay()]}function $(ee){return l[ee.getMonth()]}function F(ee){return o[ee.getMonth()]}function q(ee){return i[+(ee.getHours()>=12)]}function G(ee){return 1+~~(ee.getMonth()/3)}function z(ee){return s[ee.getUTCDay()]}function H(ee){return a[ee.getUTCDay()]}function j(ee){return l[ee.getUTCMonth()]}function J(ee){return o[ee.getUTCMonth()]}function U(ee){return i[+(ee.getUTCHours()>=12)]}function le(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var ue=k(ee+="",w);return ue.toString=function(){return ee},ue},parse:function(ee){var ue=S(ee+="",!1);return ue.toString=function(){return ee},ue},utcFormat:function(ee){var ue=k(ee+="",C);return ue.toString=function(){return ee},ue},utcParse:function(ee){var ue=S(ee+="",!0);return ue.toString=function(){return ee},ue}}}function Zn(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function mCt(e,t,r){var n=Ps.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function gCt(e,t,r){var n=Ps.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function yCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function vCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function xCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function $3e(e,t,r){var n=Ps.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function z3e(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function bCt(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function wCt(e,t,r){var n=Ps.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function kCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function G3e(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function TCt(e,t,r){var n=Ps.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function q3e(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function CCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function SCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function ECt(e,t,r){var n=Ps.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ACt(e,t,r){var n=Ps.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function _Ct(e,t,r){var n=fCt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function RCt(e,t,r){var n=Ps.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function LCt(e,t,r){var n=Ps.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function V3e(e,t){return Zn(e.getDate(),t,2)}function ICt(e,t){return Zn(e.getHours(),t,2)}function MCt(e,t){return Zn(e.getHours()%12||12,t,2)}function NCt(e,t){return Zn(1+Su.count(Fc(e),e),t,3)}function X3e(e,t){return Zn(e.getMilliseconds(),t,3)}function DCt(e,t){return X3e(e,t)+"000"}function OCt(e,t){return Zn(e.getMonth()+1,t,2)}function PCt(e,t){return Zn(e.getMinutes(),t,2)}function BCt(e,t){return Zn(e.getSeconds(),t,2)}function FCt(e){var t=e.getDay();return t===0?7:t}function $Ct(e,t){return Zn(dh.count(Fc(e)-1,e),t,2)}function j3e(e){var t=e.getDay();return t>=4||t===0?Of(e):Of.ceil(e)}function zCt(e,t){return e=j3e(e),Zn(Of.count(Fc(e),e)+(Fc(e).getDay()===4),t,2)}function GCt(e){return e.getDay()}function qCt(e,t){return Zn(zm.count(Fc(e)-1,e),t,2)}function VCt(e,t){return Zn(e.getFullYear()%100,t,2)}function WCt(e,t){return e=j3e(e),Zn(e.getFullYear()%100,t,2)}function HCt(e,t){return Zn(e.getFullYear()%1e4,t,4)}function UCt(e,t){var r=e.getDay();return e=r>=4||r===0?Of(e):Of.ceil(e),Zn(e.getFullYear()%1e4,t,4)}function YCt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Zn(t/60|0,"0",2)+Zn(t%60,"0",2)}function W3e(e,t){return Zn(e.getUTCDate(),t,2)}function XCt(e,t){return Zn(e.getUTCHours(),t,2)}function jCt(e,t){return Zn(e.getUTCHours()%12||12,t,2)}function KCt(e,t){return Zn(1+h3.count(ph(e),e),t,3)}function K3e(e,t){return Zn(e.getUTCMilliseconds(),t,3)}function ZCt(e,t){return K3e(e,t)+"000"}function QCt(e,t){return Zn(e.getUTCMonth()+1,t,2)}function JCt(e,t){return Zn(e.getUTCMinutes(),t,2)}function eSt(e,t){return Zn(e.getUTCSeconds(),t,2)}function tSt(e){var t=e.getUTCDay();return t===0?7:t}function rSt(e,t){return Zn(Dy.count(ph(e)-1,e),t,2)}function Z3e(e){var t=e.getUTCDay();return t>=4||t===0?Gm(e):Gm.ceil(e)}function nSt(e,t){return e=Z3e(e),Zn(Gm.count(ph(e),e)+(ph(e).getUTCDay()===4),t,2)}function iSt(e){return e.getUTCDay()}function aSt(e,t){return Zn(Yb.count(ph(e)-1,e),t,2)}function sSt(e,t){return Zn(e.getUTCFullYear()%100,t,2)}function oSt(e,t){return e=Z3e(e),Zn(e.getUTCFullYear()%100,t,2)}function lSt(e,t){return Zn(e.getUTCFullYear()%1e4,t,4)}function cSt(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Gm(e):Gm.ceil(e),Zn(e.getUTCFullYear()%1e4,t,4)}function uSt(){return"+0000"}function H3e(){return"%"}function U3e(e){return+e}function Y3e(e){return Math.floor(+e/1e3)}var F3e,Ps,fCt,dCt,Q3e=W(()=>{s_();F3e={"-":"",_:" ",0:"0"},Ps=/^\s*\d+/,fCt=/^%/,dCt=/[\\^$*+?|[\]().{}]/g});function wH(e){return Xb=bH(e),Oy=Xb.format,J3e=Xb.parse,eCe=Xb.utcFormat,tCe=Xb.utcParse,Xb}var Xb,Oy,J3e,eCe,tCe,rCe=W(()=>{Q3e();wH({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})});var kH=W(()=>{rCe()});function hSt(e){return new Date(e)}function fSt(e){return e instanceof Date?+e:+new Date(+e)}function nCe(e,t,r,n,i,a,s,o,l,u){var h=c3(),f=h.invert,d=h.domain,p=u(".%L"),m=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),x=u("%b %d"),w=u("%B"),C=u("%Y");function T(k){return(l(k){s_();kH();nH();l3();S3e()});var aCe=W(()=>{x3e();C3e();JW();iCe()});function sCe(e){for(var t=e.length/6|0,r=new Array(t),n=0;n{});var TH,lCe=W(()=>{oCe();TH=sCe("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab")});var cCe=W(()=>{lCe()});function oa(e){return function(){return e}}var l_=W(()=>{});function hCe(e){return e>1?0:e<-1?jb:Math.acos(e)}function SH(e){return e>=1?m3:e<=-1?-m3:Math.asin(e)}var CH,lo,qm,uCe,c_,mh,Py,Bs,jb,m3,Kb,u_=W(()=>{CH=Math.abs,lo=Math.atan2,qm=Math.cos,uCe=Math.max,c_=Math.min,mh=Math.sin,Py=Math.sqrt,Bs=1e-12,jb=Math.PI,m3=jb/2,Kb=2*jb});function h_(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new _y(t)}var EH=W(()=>{zW()});function dSt(e){return e.innerRadius}function pSt(e){return e.outerRadius}function mSt(e){return e.startAngle}function gSt(e){return e.endAngle}function ySt(e){return e&&e.padAngle}function vSt(e,t,r,n,i,a,s,o){var l=r-e,u=n-t,h=s-i,f=o-a,d=f*l-h*u;if(!(d*dN*N+M*M&&(E=L,I=O),{cx:E,cy:I,x01:-h,y01:-f,x11:E*(i/T-1),y11:I*(i/T-1)}}function Pf(){var e=dSt,t=pSt,r=oa(0),n=null,i=mSt,a=gSt,s=ySt,o=null,l=h_(u);function u(){var h,f,d=+e.apply(this,arguments),p=+t.apply(this,arguments),m=i.apply(this,arguments)-m3,g=a.apply(this,arguments)-m3,y=CH(g-m),v=g>m;if(o||(o=h=l()),pBs))o.moveTo(0,0);else if(y>Kb-Bs)o.moveTo(p*qm(m),p*mh(m)),o.arc(0,0,p,m,g,!v),d>Bs&&(o.moveTo(d*qm(g),d*mh(g)),o.arc(0,0,d,g,m,v));else{var x=m,w=g,C=m,T=g,k=y,S=y,E=s.apply(this,arguments)/2,I=E>Bs&&(n?+n.apply(this,arguments):Py(d*d+p*p)),L=c_(CH(p-d)/2,+r.apply(this,arguments)),O=L,R=L,A,N;if(I>Bs){var M=SH(I/d*mh(E)),D=SH(I/p*mh(E));(k-=M*2)>Bs?(M*=v?1:-1,C+=M,T-=M):(k=0,C=T=(m+g)/2),(S-=D*2)>Bs?(D*=v?1:-1,x+=D,w-=D):(S=0,x=w=(m+g)/2)}var B=p*qm(x),P=p*mh(x),$=d*qm(T),F=d*mh(T);if(L>Bs){var q=p*qm(w),G=p*mh(w),z=d*qm(C),H=d*mh(C),j;if(yBs?R>Bs?(A=f_(z,H,B,P,p,R,v),N=f_(q,G,$,F,p,R,v),o.moveTo(A.cx+A.x01,A.cy+A.y01),RBs)||!(k>Bs)?o.lineTo($,F):O>Bs?(A=f_($,F,q,G,d,-O,v),N=f_(B,P,z,H,d,-O,v),o.lineTo(A.cx+A.x01,A.cy+A.y01),O{l_();u_();EH()});function d_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}var fFr,AH=W(()=>{fFr=Array.prototype.slice});function dCe(e){this._context=e}function S0(e){return new dCe(e)}var _H=W(()=>{dCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}}});function pCe(e){return e[0]}function mCe(e){return e[1]}var gCe=W(()=>{});function Bf(e,t){var r=oa(!0),n=null,i=S0,a=null,s=h_(o);e=typeof e=="function"?e:e===void 0?pCe:oa(e),t=typeof t=="function"?t:t===void 0?mCe:oa(t);function o(l){var u,h=(l=d_(l)).length,f,d=!1,p;for(n==null&&(a=i(p=s())),u=0;u<=h;++u)!(u{AH();l_();_H();EH();gCe()});function vCe(e,t){return te?1:t>=e?0:NaN}var xCe=W(()=>{});function bCe(e){return e}var wCe=W(()=>{});function RH(){var e=bCe,t=vCe,r=null,n=oa(0),i=oa(Kb),a=oa(0);function s(o){var l,u=(o=d_(o)).length,h,f,d=0,p=new Array(u),m=new Array(u),g=+n.apply(this,arguments),y=Math.min(Kb,Math.max(-Kb,i.apply(this,arguments)-g)),v,x=Math.min(Math.abs(y)/u,a.apply(this,arguments)),w=x*(y<0?-1:1),C;for(l=0;l0&&(d+=C);for(t!=null?p.sort(function(T,k){return t(m[T],m[k])}):r!=null&&p.sort(function(T,k){return r(o[T],o[k])}),l=0,f=d?(y-u*w)/d:0;l0?C*f:0)+w,m[h]={data:o[h],index:l,value:C,startAngle:g,endAngle:v,padAngle:x};return m}return s.value=function(o){return arguments.length?(e=typeof o=="function"?o:oa(+o),s):e},s.sortValues=function(o){return arguments.length?(t=o,r=null,s):t},s.sort=function(o){return arguments.length?(r=o,t=null,s):r},s.startAngle=function(o){return arguments.length?(n=typeof o=="function"?o:oa(+o),s):n},s.endAngle=function(o){return arguments.length?(i=typeof o=="function"?o:oa(+o),s):i},s.padAngle=function(o){return arguments.length?(a=typeof o=="function"?o:oa(+o),s):a},s}var kCe=W(()=>{AH();l_();xCe();wCe();u_()});function g3(e){return new p_(e,!0)}function y3(e){return new p_(e,!1)}var p_,TCe=W(()=>{p_=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}});function Eu(){}var v3=W(()=>{});function Zb(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function x3(e){this._context=e}function Ff(e){return new x3(e)}var b3=W(()=>{x3.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Zb(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Zb(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}});function CCe(e){this._context=e}function LH(e){return new CCe(e)}var SCe=W(()=>{v3();b3();CCe.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Zb(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}});function ECe(e){this._context=e}function IH(e){return new ECe(e)}var ACe=W(()=>{b3();ECe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Zb(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}});function _Ce(e,t){this._basis=new x3(e),this._beta=t}var MH,RCe=W(()=>{b3();_Ce.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],i=t[0],a=e[r]-n,s=t[r]-i,o=-1,l;++o<=r;)l=o/r,this._basis.point(this._beta*e[o]+(1-this._beta)*(n+l*a),this._beta*t[o]+(1-this._beta)*(i+l*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};MH=(function e(t){function r(n){return t===1?new x3(n):new _Ce(n,t)}return r.beta=function(n){return e(+n)},r})(.85)});function Qb(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function m_(e,t){this._context=e,this._k=(1-t)/6}var w3,k3=W(()=>{m_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Qb(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Qb(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};w3=(function e(t){function r(n){return new m_(n,t)}return r.tension=function(n){return e(+n)},r})(0)});function g_(e,t){this._context=e,this._k=(1-t)/6}var NH,DH=W(()=>{v3();k3();g_.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Qb(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};NH=(function e(t){function r(n){return new g_(n,t)}return r.tension=function(n){return e(+n)},r})(0)});function y_(e,t){this._context=e,this._k=(1-t)/6}var OH,PH=W(()=>{k3();y_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Qb(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};OH=(function e(t){function r(n){return new y_(n,t)}return r.tension=function(n){return e(+n)},r})(0)});function T3(e,t,r){var n=e._x1,i=e._y1,a=e._x2,s=e._y2;if(e._l01_a>Bs){var o=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*o-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,i=(i*o-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>Bs){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,h=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*u+e._x1*e._l23_2a-t*e._l12_2a)/h,s=(s*u+e._y1*e._l23_2a-r*e._l12_2a)/h}e._context.bezierCurveTo(n,i,a,s,e._x2,e._y2)}function LCe(e,t){this._context=e,this._alpha=t}var C3,v_=W(()=>{u_();k3();LCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:T3(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};C3=(function e(t){function r(n){return t?new LCe(n,t):new m_(n,0)}return r.alpha=function(n){return e(+n)},r})(.5)});function ICe(e,t){this._context=e,this._alpha=t}var BH,MCe=W(()=>{DH();v3();v_();ICe.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:T3(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};BH=(function e(t){function r(n){return t?new ICe(n,t):new g_(n,0)}return r.alpha=function(n){return e(+n)},r})(.5)});function NCe(e,t){this._context=e,this._alpha=t}var FH,DCe=W(()=>{PH();v_();NCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:T3(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};FH=(function e(t){function r(n){return t?new NCe(n,t):new y_(n,0)}return r.alpha=function(n){return e(+n)},r})(.5)});function OCe(e){this._context=e}function $H(e){return new OCe(e)}var PCe=W(()=>{v3();OCe.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}}});function BCe(e){return e<0?-1:1}function FCe(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),o=(a*i+s*n)/(n+i);return(BCe(a)+BCe(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function $Ce(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function zH(e,t,r){var n=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-n)/3;e._context.bezierCurveTo(n+o,i+o*t,a-o,s-o*r,a,s)}function x_(e){this._context=e}function zCe(e){this._context=new GCe(e)}function GCe(e){this._context=e}function S3(e){return new x_(e)}function E3(e){return new zCe(e)}var qCe=W(()=>{x_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:zH(this,this._t0,$Ce(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,zH(this,$Ce(this,r=FCe(this,e,t)),r);break;default:zH(this,this._t0,r=FCe(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};(zCe.prototype=Object.create(x_.prototype)).point=function(e,t){x_.prototype.point.call(this,t,e)};GCe.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}}});function WCe(e){this._context=e}function VCe(e){var t,r=e.length-1,n,i=new Array(r),a=new Array(r),s=new Array(r);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t{WCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=VCe(e),i=VCe(t),a=0,s=1;s{b_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}}});var YCe=W(()=>{fCe();yCe();kCe();SCe();ACe();b3();TCe();RCe();DH();PH();k3();MCe();DCe();v_();PCe();_H();qCe();HCe();UCe()});var XCe=W(()=>{});var jCe=W(()=>{});function Vm(e,t,r){this.k=e,this.x=t,this.y=r}function qH(e){for(;!e.__zoom;)if(!(e=e.parentNode))return GH;return e.__zoom}var GH,VH=W(()=>{Vm.prototype={constructor:Vm,scale:function(e){return e===1?this:new Vm(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vm(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};GH=new Vm(1,0,0);qH.prototype=Vm.prototype});var KCe=W(()=>{});var ZCe=W(()=>{Y9();XCe();jCe();VH();KCe()});var QCe=W(()=>{ZCe();VH()});var fn=W(()=>{Dm();A4e();e5e();i5e();Bb();a5e();s5e();JV();Jwe();o5e();PW();l5e();u5e();KW();L5e();g3e();$b();zW();y3e();c5e();v3e();aCe();cCe();ch();YCe();s_();kH();$9();Y9();QCe()});var Qn,za=W(()=>{_r();hr();fn();Qn=b(e=>{let{securityLevel:t}=Be(),r=ct("body");if(t==="sandbox"){let a=ct(`#i${e}`).node()?.contentDocument??document;r=ct(a.body)}return r.select(`#${e}`)},"selectSvgElement")});function sU(e){return typeof e>"u"||e===null}function tSe(e){return typeof e=="object"&&e!==null}function rSe(e){return Array.isArray(e)?e:sU(e)?[]:[e]}function nSe(e,t){var r,n,i,a;if(t)for(a=Object.keys(t),r=0,n=a.length;r{t!==void 0&&(e9[e]=t)},"addStylesForDiagram"),f4e=nTt,o9={};wm(o9,{clear:()=>Nr,getAccDescription:()=>en,getAccTitle:()=>Qr,getDiagramTitle:()=>tn,setAccDescription:()=>Jr,setAccTitle:()=>Yr,setDiagramTitle:()=>ln});GV="",qV="",VV="",WV=b(e=>Mr(e,qt()),"sanitizeText"),Nr=b(()=>{GV="",VV="",qV=""},"clear"),Yr=b(e=>{GV=WV(e).replace(/^\s+/g,"")},"setAccTitle"),Qr=b(()=>GV,"getAccTitle"),Jr=b(e=>{VV=WV(e).replace(/\n\s+/g,` +`)},"setAccDescription"),en=b(()=>VV,"getAccDescription"),ln=b(e=>{qV=WV(e)},"setDiagramTitle"),tn=b(()=>qV,"getDiagramTitle"),Zbe=se,aTt=d5,Be=qt,P5=FV,l9=py,c9=b(e=>Mr(e,Be()),"sanitizeText"),B5=_f,sTt=b(()=>o9,"getCommonDb"),r9={},F5=b((e,t,r)=>{r9[e]&&Zbe.warn(`Diagram with id ${e} already registered. Overwriting.`),r9[e]=t,r&&o4e(e,r),iTt(e,t.styles),t.injectUtils?.(Zbe,aTt,Be,c9,B5,sTt(),()=>{})},"registerDiagram"),u9=b(e=>{if(e in r9)return r9[e];throw new oTt(e)},"getDiagram"),oTt=class extends Error{static{b(this,"DiagramNotFoundError")}constructor(e){super(`Diagram ${e} not found.`)}}});function yy(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}var HV=W(()=>{});function UV(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}var d4e=W(()=>{});function vy(e){let t,r,n;e.length!==2?(t=yy,r=(o,l)=>yy(e(o),l),n=(o,l)=>e(o)-l):(t=e===yy||e===UV?e:lTt,r=e,n=e);function i(o,l,u=0,h=o.length){if(u>>1;r(o[f],l)<0?u=f+1:h=f}while(u>>1;r(o[f],l)<=0?u=f+1:h=f}while(uu&&n(o[f-1],l)>-n(o[f],l)?f-1:f}return{left:i,center:s,right:a}}function lTt(){return 0}var YV=W(()=>{HV();d4e()});function XV(e){return e===null?NaN:+e}var p4e=W(()=>{});var m4e,g4e,cTt,uTt,jV,y4e=W(()=>{HV();YV();p4e();m4e=vy(yy),g4e=m4e.right,cTt=m4e.left,uTt=vy(XV).center,jV=g4e});function v4e({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function hTt({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function fTt({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function dTt(e){return e!==null&&typeof e=="object"?e.valueOf():e}var Ib,x4e=W(()=>{Ib=class extends Map{constructor(t,r=dTt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(v4e(this,t))}has(t){return super.has(v4e(this,t))}set(t,r){return super.set(hTt(this,t),r)}delete(t){return super.delete(fTt(this,t))}}});function h9(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),s=a>=pTt?10:a>=mTt?5:a>=gTt?2:1,o,l,u;return i<0?(u=Math.pow(10,-i)/s,o=Math.round(e*u),l=Math.round(t*u),o/ut&&--l,u=-u):(u=Math.pow(10,i)*s,o=Math.round(e/u),l=Math.round(t/u),o*ut&&--l),l0))return[];if(e===t)return[e];let n=t=i))return[];let o=a-i+1,l=new Array(o);if(n)if(s<0)for(let u=0;u{pTt=Math.sqrt(50),mTt=Math.sqrt(10),gTt=Math.sqrt(2)});function d9(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r=i)&&(r=i)}return r}var w4e=W(()=>{});function p9(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}var k4e=W(()=>{});function m9(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n{});var Dm=W(()=>{y4e();YV();w4e();k4e();T4e();b4e();x4e()});function C4e(e){return e}var S4e=W(()=>{});function yTt(e){return"translate("+e+",0)"}function vTt(e){return"translate(0,"+e+")"}function xTt(e){return t=>+e(t)}function bTt(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function wTt(){return!this.__axis}function A4e(e,t){var r=[],n=null,i=null,a=6,s=6,o=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=e===y9||e===g9?-1:1,h=e===g9||e===KV?"x":"y",f=e===y9||e===ZV?yTt:vTt;function d(p){var m=n??(t.ticks?t.ticks.apply(t,r):t.domain()),g=i??(t.tickFormat?t.tickFormat.apply(t,r):C4e),y=Math.max(a,0)+o,v=t.range(),x=+v[0]+l,w=+v[v.length-1]+l,C=(t.bandwidth?bTt:xTt)(t.copy(),l),T=p.selection?p.selection():p,k=T.selectAll(".domain").data([null]),S=T.selectAll(".tick").data(m,t).order(),E=S.exit(),I=S.enter().append("g").attr("class","tick"),L=S.select("line"),O=S.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(I),L=L.merge(I.append("line").attr("stroke","currentColor").attr(h+"2",u*a)),O=O.merge(I.append("text").attr("fill","currentColor").attr(h,u*y).attr("dy",e===y9?"0em":e===ZV?"0.71em":"0.32em")),p!==T&&(k=k.transition(p),S=S.transition(p),L=L.transition(p),O=O.transition(p),E=E.transition(p).attr("opacity",E4e).attr("transform",function(R){return isFinite(R=C(R))?f(R+l):this.getAttribute("transform")}),I.attr("opacity",E4e).attr("transform",function(R){var A=this.parentNode.__axis;return f((A&&isFinite(A=A(R))?A:C(R))+l)})),E.remove(),k.attr("d",e===g9||e===KV?s?"M"+u*s+","+x+"H"+l+"V"+w+"H"+u*s:"M"+l+","+x+"V"+w:s?"M"+x+","+u*s+"V"+l+"H"+w+"V"+u*s:"M"+x+","+l+"H"+w),S.attr("opacity",1).attr("transform",function(R){return f(C(R)+l)}),L.attr(h+"2",u*a),O.attr(h,u*y).text(g),T.filter(wTt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===KV?"start":e===g9?"end":"middle"),T.each(function(){this.__axis=C})}return d.scale=function(p){return arguments.length?(t=p,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(p){return arguments.length?(r=p==null?[]:Array.from(p),d):r.slice()},d.tickValues=function(p){return arguments.length?(n=p==null?null:Array.from(p),d):n&&n.slice()},d.tickFormat=function(p){return arguments.length?(i=p,d):i},d.tickSize=function(p){return arguments.length?(a=s=+p,d):a},d.tickSizeInner=function(p){return arguments.length?(a=+p,d):a},d.tickSizeOuter=function(p){return arguments.length?(s=+p,d):s},d.tickPadding=function(p){return arguments.length?(o=+p,d):o},d.offset=function(p){return arguments.length?(l=+p,d):l},d}function QV(e){return A4e(y9,e)}function JV(e){return A4e(ZV,e)}var y9,KV,ZV,g9,E4e,_4e=W(()=>{S4e();y9=1,KV=2,ZV=3,g9=4,E4e=1e-6});var R4e=W(()=>{_4e()});function I4e(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}function CTt(e,t){for(var r=0,n=e.length,i;r{kTt={value:()=>{}};v9.prototype=I4e.prototype={constructor:v9,on:function(e,t){var r=this._,n=TTt(e+"",r),i,a=-1,s=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n{M4e()});var x9,rW,nW=W(()=>{x9="http://www.w3.org/1999/xhtml",rW={svg:"http://www.w3.org/2000/svg",xhtml:x9,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function g0(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),rW.hasOwnProperty(t)?{space:rW[t],local:e}:e}var b9=W(()=>{nW()});function STt(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===x9&&t.documentElement.namespaceURI===x9?t.createElement(e):t.createElementNS(r,e)}}function ETt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function w9(e){var t=g0(e);return(t.local?ETt:STt)(t)}var iW=W(()=>{b9();nW()});function ATt(){}function xy(e){return e==null?ATt:function(){return this.querySelector(e)}}var k9=W(()=>{});function N4e(e){typeof e!="function"&&(e=xy(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i{lh();k9()});function aW(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}var O4e=W(()=>{});function _Tt(){return[]}function z5(e){return e==null?_Tt:function(){return this.querySelectorAll(e)}}var sW=W(()=>{});function RTt(e){return function(){return aW(e.apply(this,arguments))}}function P4e(e){typeof e=="function"?e=RTt(e):e=z5(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a{lh();O4e();sW()});function G5(e){return function(){return this.matches(e)}}function T9(e){return function(t){return t.matches(e)}}var q5=W(()=>{});function ITt(e){return function(){return LTt.call(this.children,e)}}function MTt(){return this.firstElementChild}function F4e(e){return this.select(e==null?MTt:ITt(typeof e=="function"?e:T9(e)))}var LTt,$4e=W(()=>{q5();LTt=Array.prototype.find});function DTt(){return Array.from(this.children)}function OTt(e){return function(){return NTt.call(this.children,e)}}function z4e(e){return this.selectAll(e==null?DTt:OTt(typeof e=="function"?e:T9(e)))}var NTt,G4e=W(()=>{q5();NTt=Array.prototype.filter});function q4e(e){typeof e!="function"&&(e=G5(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i{lh();q5()});function C9(e){return new Array(e.length)}var oW=W(()=>{});function W4e(){return new Sa(this._enter||this._groups.map(C9),this._parents)}function V5(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}var lW=W(()=>{oW();lh();V5.prototype={constructor:V5,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}}});function H4e(e){return function(){return e}}var U4e=W(()=>{});function PTt(e,t,r,n,i,a){for(var s=0,o,l=t.length,u=a.length;s=w&&(w=x+1);!(T=y[w])&&++w{lh();lW();U4e()});function j4e(){return new Sa(this._exit||this._groups.map(C9),this._parents)}var K4e=W(()=>{oW();lh()});function Z4e(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}var Q4e=W(()=>{});function J4e(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,s=Math.min(i,a),o=new Array(i),l=0;l{lh()});function twe(){for(var e=this._groups,t=-1,r=e.length;++t=0;)(s=n[i])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}var rwe=W(()=>{});function nwe(e){e||(e=zTt);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;at?1:e>=t?0:NaN}var iwe=W(()=>{lh()});function awe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}var swe=W(()=>{});function owe(){return Array.from(this)}var lwe=W(()=>{});function cwe(){for(var e=this._groups,t=0,r=e.length;t{});function hwe(){let e=0;for(let t of this)++e;return e}var fwe=W(()=>{});function dwe(){return!this.node()}var pwe=W(()=>{});function mwe(e){for(var t=this._groups,r=0,n=t.length;r{});function GTt(e){return function(){this.removeAttribute(e)}}function qTt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function VTt(e,t){return function(){this.setAttribute(e,t)}}function WTt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function HTt(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function UTt(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function ywe(e,t){var r=g0(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?qTt:GTt:typeof t=="function"?r.local?UTt:HTt:r.local?WTt:VTt)(r,t))}var vwe=W(()=>{b9()});function S9(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}var cW=W(()=>{});function YTt(e){return function(){this.style.removeProperty(e)}}function XTt(e,t,r){return function(){this.style.setProperty(e,t,r)}}function jTt(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function xwe(e,t,r){return arguments.length>1?this.each((t==null?YTt:typeof t=="function"?jTt:XTt)(e,t,r??"")):Om(this.node(),e)}function Om(e,t){return e.style.getPropertyValue(t)||S9(e).getComputedStyle(e,null).getPropertyValue(t)}var uW=W(()=>{cW()});function KTt(e){return function(){delete this[e]}}function ZTt(e,t){return function(){this[e]=t}}function QTt(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function bwe(e,t){return arguments.length>1?this.each((t==null?KTt:typeof t=="function"?QTt:ZTt)(e,t)):this.node()[e]}var wwe=W(()=>{});function kwe(e){return e.trim().split(/^|\s+/)}function hW(e){return e.classList||new Twe(e)}function Twe(e){this._node=e,this._names=kwe(e.getAttribute("class")||"")}function Cwe(e,t){for(var r=hW(e),n=-1,i=t.length;++n{Twe.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}}});function r5t(){this.textContent=""}function n5t(e){return function(){this.textContent=e}}function i5t(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _we(e){return arguments.length?this.each(e==null?r5t:(typeof e=="function"?i5t:n5t)(e)):this.node().textContent}var Rwe=W(()=>{});function a5t(){this.innerHTML=""}function s5t(e){return function(){this.innerHTML=e}}function o5t(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Lwe(e){return arguments.length?this.each(e==null?a5t:(typeof e=="function"?o5t:s5t)(e)):this.node().innerHTML}var Iwe=W(()=>{});function l5t(){this.nextSibling&&this.parentNode.appendChild(this)}function Mwe(){return this.each(l5t)}var Nwe=W(()=>{});function c5t(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dwe(){return this.each(c5t)}var Owe=W(()=>{});function Pwe(e){var t=typeof e=="function"?e:w9(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}var Bwe=W(()=>{iW()});function u5t(){return null}function Fwe(e,t){var r=typeof e=="function"?e:w9(e),n=t==null?u5t:typeof t=="function"?t:xy(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}var $we=W(()=>{iW();k9()});function h5t(){var e=this.parentNode;e&&e.removeChild(this)}function zwe(){return this.each(h5t)}var Gwe=W(()=>{});function f5t(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function d5t(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qwe(e){return this.select(e?d5t:f5t)}var Vwe=W(()=>{});function Wwe(e){return arguments.length?this.property("__data__",e):this.node().__data__}var Hwe=W(()=>{});function p5t(e){return function(t){e.call(this,t,this.__data__)}}function m5t(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function g5t(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r{});function Xwe(e,t,r){var n=S9(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function v5t(e,t){return function(){return Xwe(this,e,t)}}function x5t(e,t){return function(){return Xwe(this,e,t.apply(this,arguments))}}function jwe(e,t){return this.each((typeof t=="function"?x5t:v5t)(e,t))}var Kwe=W(()=>{cW()});function*Zwe(){for(var e=this._groups,t=0,r=e.length;t{});function Sa(e,t){this._groups=e,this._parents=t}function Jwe(){return new Sa([[document.documentElement]],fW)}function b5t(){return this}var fW,y0,lh=W(()=>{D4e();B4e();$4e();G4e();V4e();X4e();lW();K4e();Q4e();ewe();rwe();iwe();swe();lwe();uwe();fwe();pwe();gwe();vwe();uW();wwe();Awe();Rwe();Iwe();Nwe();Owe();Bwe();$we();Gwe();Vwe();Hwe();Ywe();Kwe();Qwe();fW=[null];Sa.prototype=Jwe.prototype={constructor:Sa,select:N4e,selectAll:P4e,selectChild:F4e,selectChildren:z4e,filter:q4e,data:Y4e,enter:W4e,exit:j4e,join:Z4e,merge:J4e,selection:b5t,order:twe,sort:nwe,call:awe,nodes:owe,node:cwe,size:hwe,empty:dwe,each:mwe,attr:ywe,style:xwe,property:bwe,classed:Ewe,text:_we,html:Lwe,raise:Mwe,lower:Dwe,append:Pwe,insert:Fwe,remove:zwe,clone:qwe,datum:Wwe,on:Uwe,dispatch:jwe,[Symbol.iterator]:Zwe};y0=Jwe});function ct(e){return typeof e=="string"?new Sa([[document.querySelector(e)]],[document.documentElement]):new Sa([[e]],fW)}var eke=W(()=>{lh()});var ch=W(()=>{q5();b9();eke();lh();k9();sW();uW()});var tke=W(()=>{});function by(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Nb(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}var dW=W(()=>{});function Pm(){}function nke(){return this.rgb().formatHex()}function _5t(){return this.rgb().formatHex8()}function R5t(){return uke(this).formatHsl()}function ike(){return this.rgb().formatRgb()}function hh(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=w5t.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?ake(t):r===3?new ao(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?E9(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?E9(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=k5t.exec(e))?new ao(t[1],t[2],t[3],1):(t=T5t.exec(e))?new ao(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=C5t.exec(e))?E9(t[1],t[2],t[3],t[4]):(t=S5t.exec(e))?E9(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=E5t.exec(e))?lke(t[1],t[2]/100,t[3]/100,1):(t=A5t.exec(e))?lke(t[1],t[2]/100,t[3]/100,t[4]):rke.hasOwnProperty(e)?ake(rke[e]):e==="transparent"?new ao(NaN,NaN,NaN,0):null}function ake(e){return new ao(e>>16&255,e>>8&255,e&255,1)}function E9(e,t,r,n){return n<=0&&(e=t=r=NaN),new ao(e,t,r,n)}function mW(e){return e instanceof Pm||(e=hh(e)),e?(e=e.rgb(),new ao(e.r,e.g,e.b,e.opacity)):new ao}function Ob(e,t,r,n){return arguments.length===1?mW(e):new ao(e,t,r,n??1)}function ao(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function ske(){return`#${wy(this.r)}${wy(this.g)}${wy(this.b)}`}function L5t(){return`#${wy(this.r)}${wy(this.g)}${wy(this.b)}${wy((isNaN(this.opacity)?1:this.opacity)*255)}`}function oke(){let e=R9(this.opacity);return`${e===1?"rgb(":"rgba("}${ky(this.r)}, ${ky(this.g)}, ${ky(this.b)}${e===1?")":`, ${e})`}`}function R9(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ky(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function wy(e){return e=ky(e),(e<16?"0":"")+e.toString(16)}function lke(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new uh(e,t,r,n)}function uke(e){if(e instanceof uh)return new uh(e.h,e.s,e.l,e.opacity);if(e instanceof Pm||(e=hh(e)),!e)return new uh;if(e instanceof uh)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),s=NaN,o=a-i,l=(a+i)/2;return o?(t===a?s=(r-n)/o+(r0&&l<1?0:s,new uh(s,o,l,e.opacity)}function hke(e,t,r,n){return arguments.length===1?uke(e):new uh(e,t,r,n??1)}function uh(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function cke(e){return e=(e||0)%360,e<0?e+360:e}function A9(e){return Math.max(0,Math.min(1,e||0))}function pW(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var W5,_9,Db,H5,Rf,w5t,k5t,T5t,C5t,S5t,E5t,A5t,rke,gW=W(()=>{dW();W5=.7,_9=1/W5,Db="\\s*([+-]?\\d+)\\s*",H5="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Rf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",w5t=/^#([0-9a-f]{3,8})$/,k5t=new RegExp(`^rgb\\(${Db},${Db},${Db}\\)$`),T5t=new RegExp(`^rgb\\(${Rf},${Rf},${Rf}\\)$`),C5t=new RegExp(`^rgba\\(${Db},${Db},${Db},${H5}\\)$`),S5t=new RegExp(`^rgba\\(${Rf},${Rf},${Rf},${H5}\\)$`),E5t=new RegExp(`^hsl\\(${H5},${Rf},${Rf}\\)$`),A5t=new RegExp(`^hsla\\(${H5},${Rf},${Rf},${H5}\\)$`),rke={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};by(Pm,hh,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:nke,formatHex:nke,formatHex8:_5t,formatHsl:R5t,formatRgb:ike,toString:ike});by(ao,Ob,Nb(Pm,{brighter(e){return e=e==null?_9:Math.pow(_9,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?W5:Math.pow(W5,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ao(ky(this.r),ky(this.g),ky(this.b),R9(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ske,formatHex:ske,formatHex8:L5t,formatRgb:oke,toString:oke}));by(uh,hke,Nb(Pm,{brighter(e){return e=e==null?_9:Math.pow(_9,e),new uh(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?W5:Math.pow(W5,e),new uh(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ao(pW(e>=240?e-240:e+120,i,n),pW(e,i,n),pW(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new uh(cke(this.h),A9(this.s),A9(this.l),R9(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=R9(this.opacity);return`${e===1?"hsl(":"hsla("}${cke(this.h)}, ${A9(this.s)*100}%, ${A9(this.l)*100}%${e===1?")":`, ${e})`}`}}))});var fke,dke,pke=W(()=>{fke=Math.PI/180,dke=180/Math.PI});function bke(e){if(e instanceof Lf)return new Lf(e.l,e.a,e.b,e.opacity);if(e instanceof v0)return wke(e);e instanceof ao||(e=mW(e));var t=bW(e.r),r=bW(e.g),n=bW(e.b),i=yW((.2225045*t+.7168786*r+.0606169*n)/gke),a,s;return t===r&&r===n?a=s=i:(a=yW((.4360747*t+.3850649*r+.1430804*n)/mke),s=yW((.0139322*t+.0971045*r+.7141733*n)/yke)),new Lf(116*i-16,500*(a-i),200*(i-s),e.opacity)}function wW(e,t,r,n){return arguments.length===1?bke(e):new Lf(e,t,r,n??1)}function Lf(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}function yW(e){return e>I5t?Math.pow(e,1/3):e/xke+vke}function vW(e){return e>Pb?e*e*e:xke*(e-vke)}function xW(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function bW(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function M5t(e){if(e instanceof v0)return new v0(e.h,e.c,e.l,e.opacity);if(e instanceof Lf||(e=bke(e)),e.a===0&&e.b===0)return new v0(NaN,0{dW();gW();pke();L9=18,mke=.96422,gke=1,yke=.82521,vke=4/29,Pb=6/29,xke=3*Pb*Pb,I5t=Pb*Pb*Pb;by(Lf,wW,Nb(Pm,{brighter(e){return new Lf(this.l+L9*(e??1),this.a,this.b,this.opacity)},darker(e){return new Lf(this.l-L9*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=mke*vW(t),e=gke*vW(e),r=yke*vW(r),new ao(xW(3.1338561*t-1.6168667*e-.4906146*r),xW(-.9787684*t+1.9161415*e+.033454*r),xW(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));by(v0,U5,Nb(Pm,{brighter(e){return new v0(this.h,this.c,this.l+L9*(e??1),this.opacity)},darker(e){return new v0(this.h,this.c,this.l-L9*(e??1),this.opacity)},rgb(){return wke(this).rgb()}}))});var Bb=W(()=>{gW();kke()});function kW(e,t,r,n,i){var a=e*e,s=a*e;return((1-3*e+3*a-s)*t+(4-6*a+3*s)*r+(1+3*e+3*a-3*s)*n+s*i)/6}function Tke(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],a=e[n+1],s=n>0?e[n-1]:2*i-a,o=n{});function Cke(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],a=e[n%t],s=e[(n+1)%t],o=e[(n+2)%t];return kW((r-n/t)*t,i,a,s,o)}}var Ske=W(()=>{TW()});var Fb,CW=W(()=>{Fb=e=>()=>e});function Eke(e,t){return function(r){return e+r*t}}function N5t(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Ake(e,t){var r=t-e;return r?Eke(e,r>180||r<-180?r-360*Math.round(r/360):r):Fb(isNaN(e)?t:e)}function _ke(e){return(e=+e)==1?x0:function(t,r){return r-t?N5t(t,r,e):Fb(isNaN(t)?r:t)}}function x0(e,t){var r=t-e;return r?Eke(e,r):Fb(isNaN(e)?t:e)}var SW=W(()=>{CW()});function Rke(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),a=new Array(r),s,o;for(s=0;s{Bb();TW();Ske();SW();Ty=(function e(t){var r=_ke(t);function n(i,a){var s=r((i=Ob(i)).r,(a=Ob(a)).r),o=r(i.g,a.g),l=r(i.b,a.b),u=x0(i.opacity,a.opacity);return function(h){return i.r=s(h),i.g=o(h),i.b=l(h),i.opacity=u(h),i+""}}return n.gamma=e,n})(1);D5t=Rke(Tke),O5t=Rke(Cke)});function Lke(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;i{});function Nke(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),a=new Array(r),s;for(s=0;s{I9()});function Oke(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}var Pke=W(()=>{});function so(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Y5=W(()=>{});function Bke(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=Cy(e[i],t[i]):n[i]=t[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var Fke=W(()=>{I9()});function P5t(e){return function(){return e}}function B5t(e){return function(t){return e(t)+""}}function X5(e,t){var r=_W.lastIndex=AW.lastIndex=0,n,i,a,s=-1,o=[],l=[];for(e=e+"",t=t+"";(n=_W.exec(e))&&(i=AW.exec(t));)(a=i.index)>r&&(a=t.slice(r,a),o[s]?o[s]+=a:o[++s]=a),(n=n[0])===(i=i[0])?o[s]?o[s]+=i:o[++s]=i:(o[++s]=null,l.push({i:s,x:so(n,i)})),r=AW.lastIndex;return r{Y5();_W=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,AW=new RegExp(_W.source,"g")});function Cy(e,t){var r=typeof t,n;return t==null||r==="boolean"?Fb(t):(r==="number"?so:r==="string"?(n=hh(t))?(t=n,Ty):X5:t instanceof hh?Ty:t instanceof Date?Oke:Ike(t)?Lke:Array.isArray(t)?Nke:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Bke:so)(e,t)}var I9=W(()=>{Bb();EW();Dke();Pke();Y5();Fke();RW();CW();Mke()});function LW(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var $ke=W(()=>{});function IW(e,t,r,n,i,a){var s,o,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*r+t*n)&&(r-=e*l,n-=t*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),e*n{zke=180/Math.PI,M9={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}});function qke(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?M9:IW(t.a,t.b,t.c,t.d,t.e,t.f)}function Vke(e){return e==null?M9:(N9||(N9=document.createElementNS("http://www.w3.org/2000/svg","g")),N9.setAttribute("transform",e),(e=N9.transform.baseVal.consolidate())?(e=e.matrix,IW(e.a,e.b,e.c,e.d,e.e,e.f)):M9)}var N9,Wke=W(()=>{Gke()});function Hke(e,t,r,n){function i(u){return u.length?u.pop()+" ":""}function a(u,h,f,d,p,m){if(u!==f||h!==d){var g=p.push("translate(",null,t,null,r);m.push({i:g-4,x:so(u,f)},{i:g-2,x:so(h,d)})}else(f||d)&&p.push("translate("+f+t+d+r)}function s(u,h,f,d){u!==h?(u-h>180?h+=360:h-u>180&&(u+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:so(u,h)})):h&&f.push(i(f)+"rotate("+h+n)}function o(u,h,f,d){u!==h?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:so(u,h)}):h&&f.push(i(f)+"skewX("+h+n)}function l(u,h,f,d,p,m){if(u!==f||h!==d){var g=p.push(i(p)+"scale(",null,",",null,")");m.push({i:g-4,x:so(u,f)},{i:g-2,x:so(h,d)})}else(f!==1||d!==1)&&p.push(i(p)+"scale("+f+","+d+")")}return function(u,h){var f=[],d=[];return u=e(u),h=e(h),a(u.translateX,u.translateY,h.translateX,h.translateY,f,d),s(u.rotate,h.rotate,f,d),o(u.skewX,h.skewX,f,d),l(u.scaleX,u.scaleY,h.scaleX,h.scaleY,f,d),u=h=null,function(p){for(var m=-1,g=d.length,y;++m{Y5();Wke();MW=Hke(qke,"px, ","px)","deg)"),NW=Hke(Vke,", ",")",")")});function Yke(e){return function(t,r){var n=e((t=U5(t)).h,(r=U5(r)).h),i=x0(t.c,r.c),a=x0(t.l,r.l),s=x0(t.opacity,r.opacity);return function(o){return t.h=n(o),t.c=i(o),t.l=a(o),t.opacity=s(o),t+""}}}var DW,F5t,Xke=W(()=>{Bb();SW();DW=Yke(Ake),F5t=Yke(x0)});var $b=W(()=>{I9();Y5();$ke();RW();Uke();EW();Xke()});function e3(){return Sy||(Zke($5t),Sy=Q5.now()+P9)}function $5t(){Sy=0}function J5(){this._call=this._time=this._next=null}function B9(e,t,r){var n=new J5;return n.restart(e,t,r),n}function Qke(){e3(),++zb;for(var e=D9,t;e;)(t=Sy-e._time)>=0&&e._call.call(void 0,t),e=e._next;--zb}function jke(){Sy=(O9=Q5.now())+P9,zb=K5=0;try{Qke()}finally{zb=0,G5t(),Sy=0}}function z5t(){var e=Q5.now(),t=e-O9;t>Kke&&(P9-=t,O9=e)}function G5t(){for(var e,t=D9,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:D9=r);Z5=e,OW(n)}function OW(e){if(!zb){K5&&(K5=clearTimeout(K5));var t=e-Sy;t>24?(e<1/0&&(K5=setTimeout(jke,e-Q5.now()-P9)),j5&&(j5=clearInterval(j5))):(j5||(O9=Q5.now(),j5=setInterval(z5t,Kke)),zb=1,Zke(jke))}}var zb,K5,j5,Kke,D9,Z5,O9,Sy,P9,Q5,Zke,PW=W(()=>{zb=0,K5=0,j5=0,Kke=1e3,O9=0,Sy=0,P9=0,Q5=typeof performance=="object"&&performance.now?performance:Date,Zke=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};J5.prototype=B9.prototype={constructor:J5,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?e3():+r)+(t==null?0:+t),!this._next&&Z5!==this&&(Z5?Z5._next=this:D9=this,Z5=this),this._call=e,this._time=r,OW()},stop:function(){this._call&&(this._call=null,this._time=1/0,OW())}}});function F9(e,t,r){var n=new J5;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var Jke=W(()=>{PW()});var $9=W(()=>{PW();Jke()});function Bm(e,t,r,n,i,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;W5t(e,r,{name:t,index:n,group:i,on:q5t,tween:V5t,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:rTe})}function r3(e,t){var r=vs(e,t);if(r.state>rTe)throw new Error("too late; already scheduled");return r}function oo(e,t){var r=vs(e,t);if(r.state>z9)throw new Error("too late; already running");return r}function vs(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function W5t(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=B9(a,0,r.time);function a(u){r.state=eTe,r.timer.restart(s,r.delay,r.time),r.delay<=u&&s(u-r.delay)}function s(u){var h,f,d,p;if(r.state!==eTe)return l();for(h in n)if(p=n[h],p.name===r.name){if(p.state===z9)return F9(s);p.state===tTe?(p.state=t3,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete n[h]):+h{tW();$9();q5t=eW("start","end","cancel","interrupt"),V5t=[],rTe=0,eTe=1,G9=2,z9=3,tTe=4,q9=5,t3=6});function V9(e,t){var r=e.__transition,n,i,a=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((n=r[s]).name!==t){a=!1;continue}i=n.state>G9&&n.state{Kl()});function iTe(e){return this.each(function(){V9(this,e)})}var aTe=W(()=>{nTe()});function H5t(e,t){var r,n;return function(){var i=oo(this,e),a=i.tween;if(a!==r){n=r=a;for(var s=0,o=n.length;s{Kl()});function W9(e,t){var r;return(typeof t=="number"?so:t instanceof hh?Ty:(r=hh(t))?(t=r,Ty):X5)(e,t)}var BW=W(()=>{Bb();$b()});function Y5t(e){return function(){this.removeAttribute(e)}}function X5t(e){return function(){this.removeAttributeNS(e.space,e.local)}}function j5t(e,t,r){var n,i=r+"",a;return function(){var s=this.getAttribute(e);return s===i?null:s===n?a:a=t(n=s,r)}}function K5t(e,t,r){var n,i=r+"",a;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===n?a:a=t(n=s,r)}}function Z5t(e,t,r){var n,i,a;return function(){var s,o=r(this),l;return o==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=o+"",s===l?null:s===n&&l===i?a:(i=l,a=t(n=s,o)))}}function Q5t(e,t,r){var n,i,a;return function(){var s,o=r(this),l;return o==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=o+"",s===l?null:s===n&&l===i?a:(i=l,a=t(n=s,o)))}}function oTe(e,t){var r=g0(e),n=r==="transform"?NW:W9;return this.attrTween(e,typeof t=="function"?(r.local?Q5t:Z5t)(r,n,Gb(this,"attr."+e,t)):t==null?(r.local?X5t:Y5t)(r):(r.local?K5t:j5t)(r,n,t))}var lTe=W(()=>{$b();ch();n3();BW()});function J5t(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function e3t(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function t3t(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&e3t(e,a)),r}return i._value=t,i}function r3t(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&J5t(e,a)),r}return i._value=t,i}function cTe(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=g0(e);return this.tween(r,(n.local?t3t:r3t)(n,t))}var uTe=W(()=>{ch()});function n3t(e,t){return function(){r3(this,e).delay=+t.apply(this,arguments)}}function i3t(e,t){return t=+t,function(){r3(this,e).delay=t}}function hTe(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?n3t:i3t)(t,e)):vs(this.node(),t).delay}var fTe=W(()=>{Kl()});function a3t(e,t){return function(){oo(this,e).duration=+t.apply(this,arguments)}}function s3t(e,t){return t=+t,function(){oo(this,e).duration=t}}function dTe(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?a3t:s3t)(t,e)):vs(this.node(),t).duration}var pTe=W(()=>{Kl()});function o3t(e,t){if(typeof t!="function")throw new Error;return function(){oo(this,e).ease=t}}function mTe(e){var t=this._id;return arguments.length?this.each(o3t(t,e)):vs(this.node(),t).ease}var gTe=W(()=>{Kl()});function l3t(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;oo(this,e).ease=r}}function yTe(e){if(typeof e!="function")throw new Error;return this.each(l3t(this._id,e))}var vTe=W(()=>{Kl()});function xTe(e){typeof e!="function"&&(e=G5(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i{ch();Ey()});function wTe(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),s=new Array(n),o=0;o{Ey()});function c3t(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function u3t(e,t,r){var n,i,a=c3t(t)?r3:oo;return function(){var s=a(this,e),o=s.on;o!==n&&(i=(n=o).copy()).on(t,r),s.on=i}}function TTe(e,t){var r=this._id;return arguments.length<2?vs(this.node(),r).on.on(e):this.each(u3t(r,e,t))}var CTe=W(()=>{Kl()});function h3t(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function STe(){return this.on("end.remove",h3t(this._id))}var ETe=W(()=>{});function ATe(e){var t=this._name,r=this._id;typeof e!="function"&&(e=xy(e));for(var n=this._groups,i=n.length,a=new Array(i),s=0;s{ch();Ey();Kl()});function RTe(e){var t=this._name,r=this._id;typeof e!="function"&&(e=z5(e));for(var n=this._groups,i=n.length,a=[],s=[],o=0;o{ch();Ey();Kl()});function ITe(){return new f3t(this._groups,this._parents)}var f3t,MTe=W(()=>{ch();f3t=y0.prototype.constructor});function d3t(e,t){var r,n,i;return function(){var a=Om(this,e),s=(this.style.removeProperty(e),Om(this,e));return a===s?null:a===r&&s===n?i:i=t(r=a,n=s)}}function NTe(e){return function(){this.style.removeProperty(e)}}function p3t(e,t,r){var n,i=r+"",a;return function(){var s=Om(this,e);return s===i?null:s===n?a:a=t(n=s,r)}}function m3t(e,t,r){var n,i,a;return function(){var s=Om(this,e),o=r(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(e),Om(this,e))),s===l?null:s===n&&l===i?a:(i=l,a=t(n=s,o))}}function g3t(e,t){var r,n,i,a="style."+t,s="end."+a,o;return function(){var l=oo(this,e),u=l.on,h=l.value[a]==null?o||(o=NTe(t)):void 0;(u!==r||i!==h)&&(n=(r=u).copy()).on(s,i=h),l.on=n}}function DTe(e,t,r){var n=(e+="")=="transform"?MW:W9;return t==null?this.styleTween(e,d3t(e,n)).on("end.style."+e,NTe(e)):typeof t=="function"?this.styleTween(e,m3t(e,n,Gb(this,"style."+e,t))).each(g3t(this._id,e)):this.styleTween(e,p3t(e,n,t),r).on("end.style."+e,null)}var OTe=W(()=>{$b();ch();Kl();n3();BW()});function y3t(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function v3t(e,t,r){var n,i;function a(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&y3t(e,s,r)),n}return a._value=t,a}function PTe(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,v3t(e,t,r??""))}var BTe=W(()=>{});function x3t(e){return function(){this.textContent=e}}function b3t(e){return function(){var t=e(this);this.textContent=t??""}}function FTe(e){return this.tween("text",typeof e=="function"?b3t(Gb(this,"text",e)):x3t(e==null?"":e+""))}var $Te=W(()=>{n3()});function w3t(e){return function(t){this.textContent=e.call(this,t)}}function k3t(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&w3t(i)),t}return n._value=e,n}function zTe(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,k3t(e))}var GTe=W(()=>{});function qTe(){for(var e=this._name,t=this._id,r=H9(),n=this._groups,i=n.length,a=0;a{Ey();Kl()});function WTe(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,s){var o={value:s},l={value:function(){--i===0&&a()}};r.each(function(){var u=oo(this,n),h=u.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(o),t._.interrupt.push(o),t._.end.push(l)),u.on=t}),i===0&&a()})}var HTe=W(()=>{Kl()});function gl(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function UTe(e){return y0().transition(e)}function H9(){return++T3t}var T3t,b0,Ey=W(()=>{ch();lTe();uTe();fTe();pTe();gTe();vTe();bTe();kTe();CTe();ETe();_Te();LTe();MTe();OTe();BTe();$Te();GTe();VTe();n3();HTe();T3t=0;b0=y0.prototype;gl.prototype=UTe.prototype={constructor:gl,select:ATe,selectAll:RTe,selectChild:b0.selectChild,selectChildren:b0.selectChildren,filter:xTe,merge:wTe,selection:ITe,transition:qTe,call:b0.call,nodes:b0.nodes,node:b0.node,size:b0.size,empty:b0.empty,each:b0.each,on:TTe,attr:oTe,attrTween:cTe,style:DTe,styleTween:PTe,text:FTe,textTween:zTe,remove:STe,tween:sTe,delay:hTe,duration:dTe,ease:mTe,easeVarying:yTe,end:WTe,[Symbol.iterator]:b0[Symbol.iterator]}});function U9(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var YTe=W(()=>{});var FW=W(()=>{YTe()});function S3t(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function XTe(e){var t,r;e instanceof gl?(t=e._id,e=e._name):(t=H9(),(r=C3t).time=e3(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,a=0;a{Ey();Kl();FW();$9();C3t={time:null,delay:0,duration:250,ease:U9}});var KTe=W(()=>{ch();aTe();jTe();y0.prototype.interrupt=iTe;y0.prototype.transition=XTe});var Y9=W(()=>{KTe()});var ZTe=W(()=>{});var QTe=W(()=>{});var JTe=W(()=>{});function e5e(e){return[+e[0],+e[1]]}function E3t(e){return[e5e(e[0]),e5e(e[1])]}function $W(e){return{type:e}}var MDr,NDr,DDr,ODr,PDr,BDr,t5e=W(()=>{Y9();ZTe();QTe();JTe();({abs:MDr,max:NDr,min:DDr}=Math);ODr={name:"x",handles:["w","e"].map($W),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},PDr={name:"y",handles:["n","s"].map($W),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},BDr={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map($W),input:function(e){return e==null?null:E3t(e)},output:function(e){return e}}});var r5e=W(()=>{t5e()});function n5e(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return n5e;let r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;i{zW=Math.PI,GW=2*zW,Ay=1e-6,A3t=GW-Ay;_y=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?n5e:_3t(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,a,s){this._append`C${+t},${+r},${+n},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,r,n,i,a){if(t=+t,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=n-t,u=i-r,h=s-t,f=o-r,d=h*h+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Ay)if(!(Math.abs(f*l-u*h)>Ay)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-s,m=i-o,g=l*l+u*u,y=p*p+m*m,v=Math.sqrt(g),x=Math.sqrt(d),w=a*Math.tan((zW-Math.acos((g+d-y)/(2*v*x)))/2),C=w/x,T=w/v;Math.abs(C-1)>Ay&&this._append`L${t+C*h},${r+C*f}`,this._append`A${a},${a},0,0,${+(f*p>h*m)},${this._x1=t+T*l},${this._y1=r+T*u}`}}arc(t,r,n,i,a,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(i),l=n*Math.sin(i),u=t+o,h=r+l,f=1^s,d=s?i-a:a-i;this._x1===null?this._append`M${u},${h}`:(Math.abs(this._x1-u)>Ay||Math.abs(this._y1-h)>Ay)&&this._append`L${u},${h}`,n&&(d<0&&(d=d%GW+GW),d>A3t?this._append`A${n},${n},0,1,${f},${t-o},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=h}`:d>Ay&&this._append`A${n},${n},0,${+(d>=zW)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};i5e.prototype=_y.prototype});var qW=W(()=>{a5e()});var s5e=W(()=>{});var o5e=W(()=>{});var l5e=W(()=>{});var c5e=W(()=>{});var u5e=W(()=>{});var h5e=W(()=>{});var f5e=W(()=>{});function d5e(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Ry(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}var i3=W(()=>{});function If(e){return e=Ry(Math.abs(e)),e?e[1]:NaN}var a3=W(()=>{i3()});function p5e(e,t){return function(r,n){for(var i=r.length,a=[],s=0,o=e[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),a.push(r.substring(i-=o,i+o)),!((l+=o+1)>n));)o=e[s=(s+1)%e.length];return a.reverse().join(t)}}var m5e=W(()=>{});function g5e(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var y5e=W(()=>{});function Fm(e){if(!(t=R3t.exec(e)))throw new Error("invalid format: "+e);var t;return new X9({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function X9(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}var R3t,VW=W(()=>{R3t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;Fm.prototype=X9.prototype;X9.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type}});function v5e(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var x5e=W(()=>{});function b5e(e,t){var r=Ry(e,t);if(!r)return s3=void 0,e.toPrecision(t);var n=r[0],i=r[1],a=i-(s3=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return a===s?n:a>s?n+new Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Ry(e,Math.max(0,t+a-1))[0]}var s3,WW=W(()=>{i3()});function HW(e,t){var r=Ry(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var w5e=W(()=>{i3()});var UW,k5e=W(()=>{i3();WW();w5e();UW={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:d5e,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>HW(e*100,t),r:HW,s:b5e,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)}});function YW(e){return e}var T5e=W(()=>{});function E5e(e){var t=e.grouping===void 0||e.thousands===void 0?YW:p5e(C5e.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?YW:g5e(C5e.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",o=e.minus===void 0?"\u2212":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function u(f,d){f=Fm(f);var p=f.fill,m=f.align,g=f.sign,y=f.symbol,v=f.zero,x=f.width,w=f.comma,C=f.precision,T=f.trim,k=f.type;k==="n"?(w=!0,k="g"):UW[k]||(C===void 0&&(C=12),T=!0,k="g"),(v||p==="0"&&m==="=")&&(v=!0,p="0",m="=");var S=(d&&d.prefix!==void 0?d.prefix:"")+(y==="$"?r:y==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),E=(y==="$"?n:/[%p]/.test(k)?s:"")+(d&&d.suffix!==void 0?d.suffix:""),I=UW[k],L=/[defgprs%]/.test(k);C=C===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function O(R){var A=S,N=E,M,D,B;if(k==="c")N=I(R)+N,R="";else{R=+R;var P=R<0||1/R<0;if(R=isNaN(R)?l:I(Math.abs(R),C),T&&(R=v5e(R)),P&&+R==0&&g!=="+"&&(P=!1),A=(P?g==="("?g:o:g==="-"||g==="("?"":g)+A,N=(k==="s"&&!isNaN(R)&&s3!==void 0?S5e[8+s3/3]:"")+N+(P&&g==="("?")":""),L){for(M=-1,D=R.length;++MB||B>57){N=(B===46?i+R.slice(M+1):R.slice(M))+N,R=R.slice(0,M);break}}}w&&!v&&(R=t(R,1/0));var $=A.length+R.length+N.length,F=$>1)+A+R+N+F.slice($);break;default:R=F+A+R+N;break}return a(R)}return O.toString=function(){return f+""},O}function h(f,d){var p=Math.max(-8,Math.min(8,Math.floor(If(d)/3)))*3,m=Math.pow(10,-p),g=u((f=Fm(f),f.type="f",f),{suffix:S5e[8+p/3]});return function(y){return g(m*y)}}return{format:u,formatPrefix:h}}var C5e,S5e,A5e=W(()=>{a3();m5e();y5e();VW();x5e();k5e();WW();T5e();C5e=Array.prototype.map,S5e=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"]});function XW(e){return j9=E5e(e),Mf=j9.format,K9=j9.formatPrefix,j9}var j9,Mf,K9,_5e=W(()=>{A5e();XW({thousands:",",grouping:[3],currency:["$",""]})});function jW(e){return Math.max(0,-If(Math.abs(e)))}var R5e=W(()=>{a3()});function KW(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(If(t)/3)))*3-If(Math.abs(e)))}var L5e=W(()=>{a3()});function ZW(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,If(t)-If(e))+1}var I5e=W(()=>{a3()});var QW=W(()=>{_5e();VW();R5e();L5e();I5e()});var M5e=W(()=>{});function L3t(e){var t=0,r=e.children,n=r&&r.length;if(!n)t=1;else for(;--n>=0;)t+=r[n].value;e.value=t}function N5e(){return this.eachAfter(L3t)}var D5e=W(()=>{});function O5e(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}var P5e=W(()=>{});function B5e(e,t){for(var r=this,n=[r],i,a,s=-1;r=n.pop();)if(e.call(t,r,++s,this),i=r.children)for(a=i.length-1;a>=0;--a)n.push(i[a]);return this}var F5e=W(()=>{});function $5e(e,t){for(var r=this,n=[r],i=[],a,s,o,l=-1;r=n.pop();)if(i.push(r),a=r.children)for(s=0,o=a.length;s{});function G5e(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}var q5e=W(()=>{});function V5e(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,n=t.children,i=n&&n.length;--i>=0;)r+=n[i].value;t.value=r})}var W5e=W(()=>{});function H5e(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var U5e=W(()=>{});function Y5e(e){for(var t=this,r=I3t(t,e),n=[t];t!==r;)t=t.parent,n.push(t);for(var i=n.length;e!==r;)n.splice(i,0,e),e=e.parent;return n}function I3t(e,t){if(e===t)return e;var r=e.ancestors(),n=t.ancestors(),i=null;for(e=r.pop(),t=n.pop();e===t;)i=e,e=r.pop(),t=n.pop();return i}var X5e=W(()=>{});function j5e(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var K5e=W(()=>{});function Z5e(){return Array.from(this)}var Q5e=W(()=>{});function J5e(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var e3e=W(()=>{});function t3e(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}var r3e=W(()=>{});function*n3e(){var e=this,t,r=[e],n,i,a;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,n=e.children)for(i=0,a=n.length;i{});function qb(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=D3t)):t===void 0&&(t=N3t);for(var r=new o3(e),n,i=[r],a,s,o,l;n=i.pop();)if((s=t(n.data))&&(l=(s=Array.from(s)).length))for(n.children=s,o=l-1;o>=0;--o)i.push(a=s[o]=new o3(s[o])),a.parent=n,a.depth=n.depth+1;return r.eachBefore(P3t)}function M3t(){return qb(this).eachBefore(O3t)}function N3t(e){return e.children}function D3t(e){return Array.isArray(e)?e[1]:null}function O3t(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function P3t(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function o3(e){this.data=e,this.depth=this.height=0,this.parent=null}var a3e=W(()=>{D5e();P5e();F5e();z5e();q5e();W5e();U5e();X5e();K5e();Q5e();e3e();r3e();i3e();o3.prototype=qb.prototype={constructor:o3,count:N5e,each:O5e,eachAfter:$5e,eachBefore:B5e,find:G5e,sum:V5e,sort:H5e,path:Y5e,ancestors:j5e,descendants:Z5e,leaves:J5e,links:t3e,copy:M3t,[Symbol.iterator]:n3e}});function s3e(e){if(typeof e!="function")throw new Error;return e}var o3e=W(()=>{});function Vb(){return 0}function Wb(e){return function(){return e}}var l3e=W(()=>{});function c3e(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var u3e=W(()=>{});function h3e(e,t,r,n,i){for(var a=e.children,s,o=-1,l=a.length,u=e.value&&(n-t)/e.value;++o{});function d3e(e,t,r,n,i){for(var a=e.children,s,o=-1,l=a.length,u=e.value&&(i-r)/e.value;++o{});function F3t(e,t,r,n,i,a){for(var s=[],o=t.children,l,u,h=0,f=0,d=o.length,p,m,g=t.value,y,v,x,w,C,T,k;hx&&(x=u),k=y*y*T,w=Math.max(x/k,k/v),w>C){y-=u;break}C=w}s.push(l={value:y,dice:p{f3e();p3e();B3t=(1+Math.sqrt(5))/2;m3e=(function e(t){function r(n,i,a,s,o){F3t(t,n,i,a,s,o)}return r.ratio=function(n){return e((n=+n)>1?n:1)},r})(B3t)});function JW(){var e=m3e,t=!1,r=1,n=1,i=[0],a=Vb,s=Vb,o=Vb,l=Vb,u=Vb;function h(d){return d.x0=d.y0=0,d.x1=r,d.y1=n,d.eachBefore(f),i=[0],t&&d.eachBefore(c3e),d}function f(d){var p=i[d.depth],m=d.x0+p,g=d.y0+p,y=d.x1-p,v=d.y1-p;y{u3e();g3e();o3e();l3e()});var v3e=W(()=>{a3e();y3e()});var x3e=W(()=>{});var b3e=W(()=>{});function $m(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var l3=W(()=>{});function Pc(){var e=new Ib,t=[],r=[],n=eH;function i(a){let s=e.get(a);if(s===void 0){if(n!==eH)return n;e.set(a,s=t.push(a)-1)}return r[s%r.length]}return i.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new Ib;for(let s of a)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return Pc(t,r).unknown(n)},$m.apply(i,arguments),i}var eH,tH=W(()=>{Dm();l3();eH=Symbol("implicit")});function Hb(){var e=Pc().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,a,s,o=!1,l=0,u=0,h=.5;delete e.unknown;function f(){var d=t().length,p=i{Dm();l3();tH()});function rH(e){return function(){return e}}var k3e=W(()=>{});function nH(e){return+e}var T3e=W(()=>{});function Ub(e){return e}function iH(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:rH(isNaN(t)?NaN:.5)}function $3t(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function z3t(e,t,r){var n=e[0],i=e[1],a=t[0],s=t[1];return i2?G3t:z3t,l=u=null,f}function f(d){return d==null||isNaN(d=+d)?a:(l||(l=o(e.map(n),t,r)))(n(s(d)))}return f.invert=function(d){return s(i((u||(u=o(t,e.map(n),so)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,nH),h()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),h()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=LW,h()},f.clamp=function(d){return arguments.length?(s=d?!0:Ub,h()):s!==Ub},f.interpolate=function(d){return arguments.length?(r=d,h()):r},f.unknown=function(d){return arguments.length?(a=d,f):a},function(d,p){return n=d,i=p,h()}}function c3(){return q3t()(Ub,Ub)}var C3e,aH=W(()=>{Dm();$b();k3e();T3e();C3e=[0,1]});function sH(e,t,r,n){var i=Mb(e,t,r),a;switch(n=Fm(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=KW(i,s))&&(n.precision=a),K9(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=ZW(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=jW(i))&&(n.precision=a-(n.type==="%")*2);break}}return Mf(n)}var S3e=W(()=>{Dm();QW()});function V3t(e){var t=e.domain;return e.ticks=function(r){var n=t();return f9(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return sH(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,s=n[i],o=n[a],l,u,h=10;for(o0;){if(u=$5(s,o,r),u===l)return n[i]=s,n[a]=o,t(n);if(u>0)s=Math.floor(s/u)*u,o=Math.ceil(o/u)*u;else if(u<0)s=Math.ceil(s*u)/u,o=Math.floor(o*u)/u;else break;l=u}return e},e}function fh(){var e=c3();return e.copy=function(){return Z9(e,fh())},$m.apply(e,arguments),V3t(e)}var E3e=W(()=>{Dm();aH();l3();S3e()});function oH(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],s;return a{});function Ni(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{let s=i(a),o=i.ceil(a);return a-s(t(a=new Date(+a),s==null?1:Math.floor(s)),a),i.range=(a,s,o)=>{let l=[];if(a=i.ceil(a),o=o==null?1:Math.floor(o),!(a0))return l;let u;do l.push(u=new Date(+a)),t(a,o),e(a);while(uNi(s=>{if(s>=s)for(;e(s),!a(s);)s.setTime(s-1)},(s,o)=>{if(s>=s)if(o<0)for(;++o<=0;)for(;t(s,-1),!a(s););else for(;--o>=0;)for(;t(s,1),!a(s););}),r&&(i.count=(a,s)=>(lH.setTime(+a),cH.setTime(+s),e(lH),e(cH),Math.floor(r(lH,cH))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?s=>n(s)%a===0:s=>i.count(0,s)%a===0):i)),i}var lH,cH,w0=W(()=>{lH=new Date,cH=new Date});var Nf,_3e,uH=W(()=>{w0();Nf=Ni(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Nf.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ni(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Nf);_3e=Nf.range});var Bc,R3e,hH=W(()=>{w0();Bc=Ni(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),R3e=Bc.range});var k0,W3t,Q9,H3t,fH=W(()=>{w0();k0=Ni(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),W3t=k0.range,Q9=Ni(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),H3t=Q9.range});var T0,U3t,J9,Y3t,dH=W(()=>{w0();T0=Ni(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),U3t=T0.range,J9=Ni(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),Y3t=J9.range});var Su,X3t,h3,j3t,e_,K3t,pH=W(()=>{w0();Su=Ni(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),X3t=Su.range,h3=Ni(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),j3t=h3.range,e_=Ni(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),K3t=e_.range});function My(e){return Ni(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}function Ny(e){return Ni(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var dh,zm,t_,r_,Of,n_,i_,I3e,Z3t,Q3t,J3t,eCt,tCt,rCt,Dy,Yb,M3e,N3e,Gm,D3e,O3e,P3e,nCt,iCt,aCt,sCt,oCt,lCt,mH=W(()=>{w0();dh=My(0),zm=My(1),t_=My(2),r_=My(3),Of=My(4),n_=My(5),i_=My(6),I3e=dh.range,Z3t=zm.range,Q3t=t_.range,J3t=r_.range,eCt=Of.range,tCt=n_.range,rCt=i_.range;Dy=Ny(0),Yb=Ny(1),M3e=Ny(2),N3e=Ny(3),Gm=Ny(4),D3e=Ny(5),O3e=Ny(6),P3e=Dy.range,nCt=Yb.range,iCt=M3e.range,aCt=N3e.range,sCt=Gm.range,oCt=D3e.range,lCt=O3e.range});var C0,cCt,a_,uCt,gH=W(()=>{w0();C0=Ni(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),cCt=C0.range,a_=Ni(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),uCt=a_.range});var Fc,hCt,ph,fCt,yH=W(()=>{w0();Fc=Ni(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Fc.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ni(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});hCt=Fc.range,ph=Ni(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ph.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ni(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});fCt=ph.range});function F3e(e,t,r,n,i,a){let s=[[Bc,1,1e3],[Bc,5,5*1e3],[Bc,15,15*1e3],[Bc,30,30*1e3],[a,1,6e4],[a,5,5*6e4],[a,15,15*6e4],[a,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function o(u,h,f){let d=hy).right(s,d);if(p===s.length)return e.every(Mb(u/31536e6,h/31536e6,f));if(p===0)return Nf.every(Math.max(Mb(u,h,f),1));let[m,g]=s[d/s[p-1][2]{Dm();uH();hH();fH();dH();pH();mH();gH();yH();[pCt,mCt]=F3e(ph,a_,Dy,e_,J9,Q9),[vH,xH]=F3e(Fc,C0,dh,Su,T0,k0)});var s_=W(()=>{uH();hH();fH();dH();pH();mH();gH();yH();$3e()});function bH(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function wH(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function f3(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function kH(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,a=e.days,s=e.shortDays,o=e.months,l=e.shortMonths,u=d3(i),h=p3(i),f=d3(a),d=p3(a),p=d3(s),m=p3(s),g=d3(o),y=p3(o),v=d3(l),x=p3(l),w={a:B,A:P,b:$,B:F,c:null,d:H3e,e:H3e,f:FCt,g:XCt,G:KCt,H:OCt,I:PCt,j:BCt,L:K3e,m:$Ct,M:zCt,p:q,q:G,Q:X3e,s:j3e,S:GCt,u:qCt,U:VCt,V:WCt,w:HCt,W:UCt,x:null,X:null,y:YCt,Y:jCt,Z:ZCt,"%":Y3e},C={a:z,A:H,b:j,B:J,c:null,d:U3e,e:U3e,f:tSt,g:hSt,G:dSt,H:QCt,I:JCt,j:eSt,L:Q3e,m:rSt,M:nSt,p:U,q:le,Q:X3e,s:j3e,S:iSt,u:aSt,U:sSt,V:oSt,w:lSt,W:cSt,x:null,X:null,y:uSt,Y:fSt,Z:pSt,"%":Y3e},T={a:L,A:O,b:R,B:A,c:N,d:V3e,e:V3e,f:ICt,g:q3e,G:G3e,H:W3e,I:W3e,j:ACt,L:LCt,m:ECt,M:_Ct,p:I,q:SCt,Q:NCt,s:DCt,S:RCt,u:bCt,U:wCt,V:kCt,w:xCt,W:TCt,x:M,X:D,y:q3e,Y:G3e,Z:CCt,"%":MCt};w.x=k(r,w),w.X=k(n,w),w.c=k(t,w),C.x=k(r,C),C.X=k(n,C),C.c=k(t,C);function k(ee,ue){return function(ae){var oe=[],Re=-1,Te=0,Oe=ee.length,qe,Ge,fe;for(ae instanceof Date||(ae=new Date(+ae));++Re53)return null;"w"in oe||(oe.w=1),"Z"in oe?(Te=wH(f3(oe.y,0,1)),Oe=Te.getUTCDay(),Te=Oe>4||Oe===0?Yb.ceil(Te):Yb(Te),Te=h3.offset(Te,(oe.V-1)*7),oe.y=Te.getUTCFullYear(),oe.m=Te.getUTCMonth(),oe.d=Te.getUTCDate()+(oe.w+6)%7):(Te=bH(f3(oe.y,0,1)),Oe=Te.getDay(),Te=Oe>4||Oe===0?zm.ceil(Te):zm(Te),Te=Su.offset(Te,(oe.V-1)*7),oe.y=Te.getFullYear(),oe.m=Te.getMonth(),oe.d=Te.getDate()+(oe.w+6)%7)}else("W"in oe||"U"in oe)&&("w"in oe||(oe.w="u"in oe?oe.u%7:"W"in oe?1:0),Oe="Z"in oe?wH(f3(oe.y,0,1)).getUTCDay():bH(f3(oe.y,0,1)).getDay(),oe.m=0,oe.d="W"in oe?(oe.w+6)%7+oe.W*7-(Oe+5)%7:oe.w+oe.U*7-(Oe+6)%7);return"Z"in oe?(oe.H+=oe.Z/100|0,oe.M+=oe.Z%100,wH(oe)):bH(oe)}}function E(ee,ue,ae,oe){for(var Re=0,Te=ue.length,Oe=ae.length,qe,Ge;Re=Oe)return-1;if(qe=ue.charCodeAt(Re++),qe===37){if(qe=ue.charAt(Re++),Ge=T[qe in z3e?ue.charAt(Re++):qe],!Ge||(oe=Ge(ee,ae,oe))<0)return-1}else if(qe!=ae.charCodeAt(oe++))return-1}return oe}function I(ee,ue,ae){var oe=u.exec(ue.slice(ae));return oe?(ee.p=h.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function L(ee,ue,ae){var oe=p.exec(ue.slice(ae));return oe?(ee.w=m.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function O(ee,ue,ae){var oe=f.exec(ue.slice(ae));return oe?(ee.w=d.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function R(ee,ue,ae){var oe=v.exec(ue.slice(ae));return oe?(ee.m=x.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function A(ee,ue,ae){var oe=g.exec(ue.slice(ae));return oe?(ee.m=y.get(oe[0].toLowerCase()),ae+oe[0].length):-1}function N(ee,ue,ae){return E(ee,t,ue,ae)}function M(ee,ue,ae){return E(ee,r,ue,ae)}function D(ee,ue,ae){return E(ee,n,ue,ae)}function B(ee){return s[ee.getDay()]}function P(ee){return a[ee.getDay()]}function $(ee){return l[ee.getMonth()]}function F(ee){return o[ee.getMonth()]}function q(ee){return i[+(ee.getHours()>=12)]}function G(ee){return 1+~~(ee.getMonth()/3)}function z(ee){return s[ee.getUTCDay()]}function H(ee){return a[ee.getUTCDay()]}function j(ee){return l[ee.getUTCMonth()]}function J(ee){return o[ee.getUTCMonth()]}function U(ee){return i[+(ee.getUTCHours()>=12)]}function le(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var ue=k(ee+="",w);return ue.toString=function(){return ee},ue},parse:function(ee){var ue=S(ee+="",!1);return ue.toString=function(){return ee},ue},utcFormat:function(ee){var ue=k(ee+="",C);return ue.toString=function(){return ee},ue},utcParse:function(ee){var ue=S(ee+="",!0);return ue.toString=function(){return ee},ue}}}function Zn(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function xCt(e,t,r){var n=Ps.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function bCt(e,t,r){var n=Ps.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function wCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function kCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function TCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function G3e(e,t,r){var n=Ps.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function q3e(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function CCt(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function SCt(e,t,r){var n=Ps.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function ECt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function V3e(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function ACt(e,t,r){var n=Ps.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function W3e(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function _Ct(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function RCt(e,t,r){var n=Ps.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function LCt(e,t,r){var n=Ps.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ICt(e,t,r){var n=Ps.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function MCt(e,t,r){var n=gCt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function NCt(e,t,r){var n=Ps.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function DCt(e,t,r){var n=Ps.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function H3e(e,t){return Zn(e.getDate(),t,2)}function OCt(e,t){return Zn(e.getHours(),t,2)}function PCt(e,t){return Zn(e.getHours()%12||12,t,2)}function BCt(e,t){return Zn(1+Su.count(Fc(e),e),t,3)}function K3e(e,t){return Zn(e.getMilliseconds(),t,3)}function FCt(e,t){return K3e(e,t)+"000"}function $Ct(e,t){return Zn(e.getMonth()+1,t,2)}function zCt(e,t){return Zn(e.getMinutes(),t,2)}function GCt(e,t){return Zn(e.getSeconds(),t,2)}function qCt(e){var t=e.getDay();return t===0?7:t}function VCt(e,t){return Zn(dh.count(Fc(e)-1,e),t,2)}function Z3e(e){var t=e.getDay();return t>=4||t===0?Of(e):Of.ceil(e)}function WCt(e,t){return e=Z3e(e),Zn(Of.count(Fc(e),e)+(Fc(e).getDay()===4),t,2)}function HCt(e){return e.getDay()}function UCt(e,t){return Zn(zm.count(Fc(e)-1,e),t,2)}function YCt(e,t){return Zn(e.getFullYear()%100,t,2)}function XCt(e,t){return e=Z3e(e),Zn(e.getFullYear()%100,t,2)}function jCt(e,t){return Zn(e.getFullYear()%1e4,t,4)}function KCt(e,t){var r=e.getDay();return e=r>=4||r===0?Of(e):Of.ceil(e),Zn(e.getFullYear()%1e4,t,4)}function ZCt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Zn(t/60|0,"0",2)+Zn(t%60,"0",2)}function U3e(e,t){return Zn(e.getUTCDate(),t,2)}function QCt(e,t){return Zn(e.getUTCHours(),t,2)}function JCt(e,t){return Zn(e.getUTCHours()%12||12,t,2)}function eSt(e,t){return Zn(1+h3.count(ph(e),e),t,3)}function Q3e(e,t){return Zn(e.getUTCMilliseconds(),t,3)}function tSt(e,t){return Q3e(e,t)+"000"}function rSt(e,t){return Zn(e.getUTCMonth()+1,t,2)}function nSt(e,t){return Zn(e.getUTCMinutes(),t,2)}function iSt(e,t){return Zn(e.getUTCSeconds(),t,2)}function aSt(e){var t=e.getUTCDay();return t===0?7:t}function sSt(e,t){return Zn(Dy.count(ph(e)-1,e),t,2)}function J3e(e){var t=e.getUTCDay();return t>=4||t===0?Gm(e):Gm.ceil(e)}function oSt(e,t){return e=J3e(e),Zn(Gm.count(ph(e),e)+(ph(e).getUTCDay()===4),t,2)}function lSt(e){return e.getUTCDay()}function cSt(e,t){return Zn(Yb.count(ph(e)-1,e),t,2)}function uSt(e,t){return Zn(e.getUTCFullYear()%100,t,2)}function hSt(e,t){return e=J3e(e),Zn(e.getUTCFullYear()%100,t,2)}function fSt(e,t){return Zn(e.getUTCFullYear()%1e4,t,4)}function dSt(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Gm(e):Gm.ceil(e),Zn(e.getUTCFullYear()%1e4,t,4)}function pSt(){return"+0000"}function Y3e(){return"%"}function X3e(e){return+e}function j3e(e){return Math.floor(+e/1e3)}var z3e,Ps,gCt,yCt,eCe=W(()=>{s_();z3e={"-":"",_:" ",0:"0"},Ps=/^\s*\d+/,gCt=/^%/,yCt=/[\\^$*+?|[\]().{}]/g});function TH(e){return Xb=kH(e),Oy=Xb.format,tCe=Xb.parse,rCe=Xb.utcFormat,nCe=Xb.utcParse,Xb}var Xb,Oy,tCe,rCe,nCe,iCe=W(()=>{eCe();TH({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})});var CH=W(()=>{iCe()});function mSt(e){return new Date(e)}function gSt(e){return e instanceof Date?+e:+new Date(+e)}function aCe(e,t,r,n,i,a,s,o,l,u){var h=c3(),f=h.invert,d=h.domain,p=u(".%L"),m=u(":%S"),g=u("%I:%M"),y=u("%I %p"),v=u("%a %d"),x=u("%b %d"),w=u("%B"),C=u("%Y");function T(k){return(l(k){s_();CH();aH();l3();A3e()});var oCe=W(()=>{w3e();E3e();tH();sCe()});function lCe(e){for(var t=e.length/6|0,r=new Array(t),n=0;n{});var SH,uCe=W(()=>{cCe();SH=lCe("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab")});var hCe=W(()=>{uCe()});function oa(e){return function(){return e}}var l_=W(()=>{});function dCe(e){return e>1?0:e<-1?jb:Math.acos(e)}function AH(e){return e>=1?m3:e<=-1?-m3:Math.asin(e)}var EH,lo,qm,fCe,c_,mh,Py,Bs,jb,m3,Kb,u_=W(()=>{EH=Math.abs,lo=Math.atan2,qm=Math.cos,fCe=Math.max,c_=Math.min,mh=Math.sin,Py=Math.sqrt,Bs=1e-12,jb=Math.PI,m3=jb/2,Kb=2*jb});function h_(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new _y(t)}var _H=W(()=>{qW()});function ySt(e){return e.innerRadius}function vSt(e){return e.outerRadius}function xSt(e){return e.startAngle}function bSt(e){return e.endAngle}function wSt(e){return e&&e.padAngle}function kSt(e,t,r,n,i,a,s,o){var l=r-e,u=n-t,h=s-i,f=o-a,d=f*l-h*u;if(!(d*dN*N+M*M&&(E=L,I=O),{cx:E,cy:I,x01:-h,y01:-f,x11:E*(i/T-1),y11:I*(i/T-1)}}function Pf(){var e=ySt,t=vSt,r=oa(0),n=null,i=xSt,a=bSt,s=wSt,o=null,l=h_(u);function u(){var h,f,d=+e.apply(this,arguments),p=+t.apply(this,arguments),m=i.apply(this,arguments)-m3,g=a.apply(this,arguments)-m3,y=EH(g-m),v=g>m;if(o||(o=h=l()),pBs))o.moveTo(0,0);else if(y>Kb-Bs)o.moveTo(p*qm(m),p*mh(m)),o.arc(0,0,p,m,g,!v),d>Bs&&(o.moveTo(d*qm(g),d*mh(g)),o.arc(0,0,d,g,m,v));else{var x=m,w=g,C=m,T=g,k=y,S=y,E=s.apply(this,arguments)/2,I=E>Bs&&(n?+n.apply(this,arguments):Py(d*d+p*p)),L=c_(EH(p-d)/2,+r.apply(this,arguments)),O=L,R=L,A,N;if(I>Bs){var M=AH(I/d*mh(E)),D=AH(I/p*mh(E));(k-=M*2)>Bs?(M*=v?1:-1,C+=M,T-=M):(k=0,C=T=(m+g)/2),(S-=D*2)>Bs?(D*=v?1:-1,x+=D,w-=D):(S=0,x=w=(m+g)/2)}var B=p*qm(x),P=p*mh(x),$=d*qm(T),F=d*mh(T);if(L>Bs){var q=p*qm(w),G=p*mh(w),z=d*qm(C),H=d*mh(C),j;if(yBs?R>Bs?(A=f_(z,H,B,P,p,R,v),N=f_(q,G,$,F,p,R,v),o.moveTo(A.cx+A.x01,A.cy+A.y01),RBs)||!(k>Bs)?o.lineTo($,F):O>Bs?(A=f_($,F,q,G,d,-O,v),N=f_(B,P,z,H,d,-O,v),o.lineTo(A.cx+A.x01,A.cy+A.y01),O{l_();u_();_H()});function d_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}var yFr,RH=W(()=>{yFr=Array.prototype.slice});function mCe(e){this._context=e}function S0(e){return new mCe(e)}var LH=W(()=>{mCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}}});function gCe(e){return e[0]}function yCe(e){return e[1]}var vCe=W(()=>{});function Bf(e,t){var r=oa(!0),n=null,i=S0,a=null,s=h_(o);e=typeof e=="function"?e:e===void 0?gCe:oa(e),t=typeof t=="function"?t:t===void 0?yCe:oa(t);function o(l){var u,h=(l=d_(l)).length,f,d=!1,p;for(n==null&&(a=i(p=s())),u=0;u<=h;++u)!(u{RH();l_();LH();_H();vCe()});function bCe(e,t){return te?1:t>=e?0:NaN}var wCe=W(()=>{});function kCe(e){return e}var TCe=W(()=>{});function IH(){var e=kCe,t=bCe,r=null,n=oa(0),i=oa(Kb),a=oa(0);function s(o){var l,u=(o=d_(o)).length,h,f,d=0,p=new Array(u),m=new Array(u),g=+n.apply(this,arguments),y=Math.min(Kb,Math.max(-Kb,i.apply(this,arguments)-g)),v,x=Math.min(Math.abs(y)/u,a.apply(this,arguments)),w=x*(y<0?-1:1),C;for(l=0;l0&&(d+=C);for(t!=null?p.sort(function(T,k){return t(m[T],m[k])}):r!=null&&p.sort(function(T,k){return r(o[T],o[k])}),l=0,f=d?(y-u*w)/d:0;l0?C*f:0)+w,m[h]={data:o[h],index:l,value:C,startAngle:g,endAngle:v,padAngle:x};return m}return s.value=function(o){return arguments.length?(e=typeof o=="function"?o:oa(+o),s):e},s.sortValues=function(o){return arguments.length?(t=o,r=null,s):t},s.sort=function(o){return arguments.length?(r=o,t=null,s):r},s.startAngle=function(o){return arguments.length?(n=typeof o=="function"?o:oa(+o),s):n},s.endAngle=function(o){return arguments.length?(i=typeof o=="function"?o:oa(+o),s):i},s.padAngle=function(o){return arguments.length?(a=typeof o=="function"?o:oa(+o),s):a},s}var CCe=W(()=>{RH();l_();wCe();TCe();u_()});function g3(e){return new p_(e,!0)}function y3(e){return new p_(e,!1)}var p_,SCe=W(()=>{p_=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}});function Eu(){}var v3=W(()=>{});function Zb(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function x3(e){this._context=e}function Ff(e){return new x3(e)}var b3=W(()=>{x3.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Zb(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Zb(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}});function ECe(e){this._context=e}function MH(e){return new ECe(e)}var ACe=W(()=>{v3();b3();ECe.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Zb(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}});function _Ce(e){this._context=e}function NH(e){return new _Ce(e)}var RCe=W(()=>{b3();_Ce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Zb(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}});function LCe(e,t){this._basis=new x3(e),this._beta=t}var DH,ICe=W(()=>{b3();LCe.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],i=t[0],a=e[r]-n,s=t[r]-i,o=-1,l;++o<=r;)l=o/r,this._basis.point(this._beta*e[o]+(1-this._beta)*(n+l*a),this._beta*t[o]+(1-this._beta)*(i+l*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};DH=(function e(t){function r(n){return t===1?new x3(n):new LCe(n,t)}return r.beta=function(n){return e(+n)},r})(.85)});function Qb(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function m_(e,t){this._context=e,this._k=(1-t)/6}var w3,k3=W(()=>{m_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Qb(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Qb(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};w3=(function e(t){function r(n){return new m_(n,t)}return r.tension=function(n){return e(+n)},r})(0)});function g_(e,t){this._context=e,this._k=(1-t)/6}var OH,PH=W(()=>{v3();k3();g_.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Qb(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};OH=(function e(t){function r(n){return new g_(n,t)}return r.tension=function(n){return e(+n)},r})(0)});function y_(e,t){this._context=e,this._k=(1-t)/6}var BH,FH=W(()=>{k3();y_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Qb(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};BH=(function e(t){function r(n){return new y_(n,t)}return r.tension=function(n){return e(+n)},r})(0)});function T3(e,t,r){var n=e._x1,i=e._y1,a=e._x2,s=e._y2;if(e._l01_a>Bs){var o=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*o-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,i=(i*o-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>Bs){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,h=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*u+e._x1*e._l23_2a-t*e._l12_2a)/h,s=(s*u+e._y1*e._l23_2a-r*e._l12_2a)/h}e._context.bezierCurveTo(n,i,a,s,e._x2,e._y2)}function MCe(e,t){this._context=e,this._alpha=t}var C3,v_=W(()=>{u_();k3();MCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:T3(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};C3=(function e(t){function r(n){return t?new MCe(n,t):new m_(n,0)}return r.alpha=function(n){return e(+n)},r})(.5)});function NCe(e,t){this._context=e,this._alpha=t}var $H,DCe=W(()=>{PH();v3();v_();NCe.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:T3(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};$H=(function e(t){function r(n){return t?new NCe(n,t):new g_(n,0)}return r.alpha=function(n){return e(+n)},r})(.5)});function OCe(e,t){this._context=e,this._alpha=t}var zH,PCe=W(()=>{FH();v_();OCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:T3(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};zH=(function e(t){function r(n){return t?new OCe(n,t):new y_(n,0)}return r.alpha=function(n){return e(+n)},r})(.5)});function BCe(e){this._context=e}function GH(e){return new BCe(e)}var FCe=W(()=>{v3();BCe.prototype={areaStart:Eu,areaEnd:Eu,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}}});function $Ce(e){return e<0?-1:1}function zCe(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),o=(a*i+s*n)/(n+i);return($Ce(a)+$Ce(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function GCe(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function qH(e,t,r){var n=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-n)/3;e._context.bezierCurveTo(n+o,i+o*t,a-o,s-o*r,a,s)}function x_(e){this._context=e}function qCe(e){this._context=new VCe(e)}function VCe(e){this._context=e}function S3(e){return new x_(e)}function E3(e){return new qCe(e)}var WCe=W(()=>{x_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qH(this,this._t0,GCe(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,qH(this,GCe(this,r=zCe(this,e,t)),r);break;default:qH(this,this._t0,r=zCe(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};(qCe.prototype=Object.create(x_.prototype)).point=function(e,t){x_.prototype.point.call(this,t,e)};VCe.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}}});function UCe(e){this._context=e}function HCe(e){var t,r=e.length-1,n,i=new Array(r),a=new Array(r),s=new Array(r);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t{UCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=HCe(e),i=HCe(t),a=0,s=1;s{b_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}}});var jCe=W(()=>{pCe();xCe();CCe();ACe();RCe();b3();SCe();ICe();PH();FH();k3();DCe();PCe();v_();FCe();LH();WCe();YCe();XCe()});var KCe=W(()=>{});var ZCe=W(()=>{});function Vm(e,t,r){this.k=e,this.x=t,this.y=r}function WH(e){for(;!e.__zoom;)if(!(e=e.parentNode))return VH;return e.__zoom}var VH,HH=W(()=>{Vm.prototype={constructor:Vm,scale:function(e){return e===1?this:new Vm(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vm(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};VH=new Vm(1,0,0);WH.prototype=Vm.prototype});var QCe=W(()=>{});var JCe=W(()=>{Y9();KCe();ZCe();HH();QCe()});var eSe=W(()=>{JCe();HH()});var fn=W(()=>{Dm();R4e();r5e();s5e();Bb();o5e();l5e();tW();tke();c5e();FW();u5e();f5e();QW();M5e();v3e();$b();qW();x3e();h5e();b3e();oCe();hCe();ch();jCe();s_();CH();$9();Y9();eSe()});var Qn,za=W(()=>{_r();hr();fn();Qn=b(e=>{let{securityLevel:t}=Be(),r=ct("body");if(t==="sandbox"){let a=ct(`#i${e}`).node()?.contentDocument??document;r=ct(a.body)}return r.select(`#${e}`)},"selectSvgElement")});function lU(e){return typeof e>"u"||e===null}function nSe(e){return typeof e=="object"&&e!==null}function iSe(e){return Array.isArray(e)?e:lU(e)?[]:[e]}function aSe(e,t){var r,n,i,a;if(t)for(a=Object.keys(t),r=0,n=a.length;ro&&(a=" ... ",t=n-o+a.length),r-n>o&&(s=" ...",r=n+o-s.length),{str:a+e.slice(t,r).replace(/\t/g,"\u2192")+s,pos:n-t+a.length}}function k_(e,t){return xs.repeat(" ",t-e.length)+e}function sSe(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],a,s=-1;a=r.exec(e.buffer);)i.push(a.index),n.push(a.index+a[0].length),e.position<=a.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var o="",l,u,h=Math.min(e.line+t.linesAfter,i.length).toString().length,f=t.maxLength-(t.indent+h+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)u=w_(e.buffer,n[s-l],i[s-l],e.position-(n[s]-n[s-l]),f),o=xs.repeat(" ",t.indent)+k_((e.line-l+1).toString(),h)+" | "+u.str+` +`+e.mark.snippet),n+" "+r):n}function t4(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=cU(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}function w_(e,t,r,n,i){var a="",s="",o=Math.floor(i/2)-1;return n-t>o&&(a=" ... ",t=n-o+a.length),r-n>o&&(s=" ...",r=n+o-s.length),{str:a+e.slice(t,r).replace(/\t/g,"\u2192")+s,pos:n-t+a.length}}function k_(e,t){return xs.repeat(" ",t-e.length)+e}function lSe(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],a,s=-1;a=r.exec(e.buffer);)i.push(a.index),n.push(a.index+a[0].length),e.position<=a.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var o="",l,u,h=Math.min(e.line+t.linesAfter,i.length).toString().length,f=t.maxLength-(t.indent+h+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)u=w_(e.buffer,n[s-l],i[s-l],e.position-(n[s]-n[s-l]),f),o=xs.repeat(" ",t.indent)+k_((e.line-l+1).toString(),h)+" | "+u.str+` `+o;for(u=w_(e.buffer,n[s],i[s],e.position,f),o+=xs.repeat(" ",t.indent)+k_((e.line+1).toString(),h)+" | "+u.str+` `,o+=xs.repeat("-",t.indent+h+3+u.pos)+`^ `,l=1;l<=t.linesAfter&&!(s+l>=i.length);l++)u=w_(e.buffer,n[s+l],i[s+l],e.position-(n[s]-n[s+l]),f),o+=xs.repeat(" ",t.indent)+k_((e.line+l+1).toString(),h)+" | "+u.str+` -`;return o.replace(/\n$/,"")}function oSe(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function lSe(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(ESt.indexOf(r)===-1)throw new Kl('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=oSe(t.styleAliases||null),ASt.indexOf(this.kind)===-1)throw new Kl('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}function HH(e,t){var r=[];return e[t].forEach(function(n){var i=r.length;r.forEach(function(a,s){a.tag===n.tag&&a.kind===n.kind&&a.multi===n.multi&&(i=s)}),r[i]=n}),r}function cSe(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function n(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(b(n,"collectType"),t=0,r=arguments.length;t=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}function CSe(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(xs.isNegativeZero(e))return"-0.0";return r=e.toString(10),BSt.test(r)?r.replace("e",".e"):r}function SSe(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||xs.isNegativeZero(e))}function RSe(e){return e===null?!1:ASe.exec(e)!==null||_Se.exec(e)!==null}function LSe(e){var t,r,n,i,a,s,o,l=0,u=null,h,f,d;if(t=ASe.exec(e),t===null&&(t=_Se.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(a=+t[4],s=+t[5],o=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(h=+t[10],f=+(t[11]||0),u=(h*60+f)*6e4,t[9]==="-"&&(u=-u)),d=new Date(Date.UTC(r,n,i,a,s,o,l)),u&&d.setTime(d.getTime()-u),d}function ISe(e){return e.toISOString()}function MSe(e){return e==="<<"||e===null}function NSe(e){if(e===null)return!1;var t,r,n=0,i=e.length,a=lU;for(r=0;r64)){if(t<0)return!1;n+=6}return n%8===0}function DSe(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,a=lU,s=0,o=[];for(t=0;t>16&255),o.push(s>>8&255),o.push(s&255)),s=s<<6|a.indexOf(n.charAt(t));return r=i%4*6,r===0?(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)):r===18?(o.push(s>>10&255),o.push(s>>2&255)):r===12&&o.push(s>>4&255),new Uint8Array(o)}function OSe(e){var t="",r=0,n,i,a=e.length,s=lU;for(n=0;n>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[n];return i=a%3,i===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):i===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):i===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}function PSe(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function BSe(e){if(e===null)return!0;var t=[],r,n,i,a,s,o=e;for(r=0,n=o.length;r>10)+55296,(e-65536&1023)+56320)}function cU(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[t]=r}function e6e(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||VSe,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function uU(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=SSt(r),new Kl(t,r)}function Sr(e,t){throw uU(e,t)}function I3(e,t){e.onWarning&&e.onWarning.call(null,uU(e,t))}function E0(e,t,r,n){var i,a,s,o;if(t1&&(e.result+=xs.repeat(` -`,t-1))}function t6e(e,t,r){var n,i,a,s,o,l,u,h,f=e.kind,d=e.result,p;if(p=e.input.charCodeAt(e.position),gl(p)||Fy(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=e.input.charCodeAt(e.position+1),gl(i)||r&&Fy(i)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,o=!1;p!==0;){if(p===58){if(i=e.input.charCodeAt(e.position+1),gl(i)||r&&Fy(i))break}else if(p===35){if(n=e.input.charCodeAt(e.position-1),gl(n))break}else{if(e.position===e.lineStart&&O3(e)||r&&Fy(p))break;if(gh(p))if(l=e.line,u=e.lineStart,h=e.lineIndent,Ga(e,!1,-1),e.lineIndent>=t){o=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=u,e.lineIndent=h;break}}o&&(E0(e,a,s,!1),L_(e,e.line-l),a=s=e.position,o=!1),Wm(p)||(s=e.position+1),p=e.input.charCodeAt(++e.position)}return E0(e,a,s,!1),e.result?!0:(e.kind=f,e.result=d,!1)}function r6e(e,t){var r,n,i;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(E0(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,i=e.position;else return!0;else gh(r)?(E0(e,n,i,!0),L_(e,Ga(e,!1,t)),n=i=e.position):e.position===e.lineStart&&O3(e)?Sr(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Sr(e,"unexpected end of the stream within a single quoted scalar")}function n6e(e,t){var r,n,i,a,s,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return E0(e,r,e.position,!0),e.position++,!0;if(o===92){if(E0(e,r,e.position,!0),o=e.input.charCodeAt(++e.position),gh(o))Ga(e,!1,t);else if(o<256&&QSe[o])e.result+=JSe[o],e.position++;else if((s=jSe(o))>0){for(i=s,a=0;i>0;i--)o=e.input.charCodeAt(++e.position),(s=XSe(o))>=0?a=(a<<4)+s:Sr(e,"expected hexadecimal character");e.result+=ZSe(a),e.position++}else Sr(e,"unknown escape sequence");r=n=e.position}else gh(o)?(E0(e,r,n,!0),L_(e,Ga(e,!1,t)),r=n=e.position):e.position===e.lineStart&&O3(e)?Sr(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Sr(e,"unexpected end of the stream within a double quoted scalar")}function i6e(e,t){var r=!0,n,i,a,s=e.tag,o,l=e.anchor,u,h,f,d,p,m=Object.create(null),g,y,v,x;if(x=e.input.charCodeAt(e.position),x===91)h=93,p=!1,o=[];else if(x===123)h=125,p=!0,o={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),x=e.input.charCodeAt(++e.position);x!==0;){if(Ga(e,!0,t),x=e.input.charCodeAt(e.position),x===h)return e.position++,e.tag=s,e.anchor=l,e.kind=p?"mapping":"sequence",e.result=o,!0;r?x===44&&Sr(e,"expected the node content, but found ','"):Sr(e,"missed comma between flow collection entries"),y=g=v=null,f=d=!1,x===63&&(u=e.input.charCodeAt(e.position+1),gl(u)&&(f=d=!0,e.position++,Ga(e,!0,t))),n=e.line,i=e.lineStart,a=e.position,zy(e,t,C_,!1,!0),y=e.tag,g=e.result,Ga(e,!0,t),x=e.input.charCodeAt(e.position),(d||e.line===n)&&x===58&&(f=!0,x=e.input.charCodeAt(++e.position),Ga(e,!0,t),zy(e,t,C_,!1,!0),v=e.result),p?$y(e,o,m,y,g,v,n,i,a):f?o.push($y(e,null,m,y,g,v,n,i,a)):o.push(g),Ga(e,!0,t),x=e.input.charCodeAt(e.position),x===44?(r=!0,x=e.input.charCodeAt(++e.position)):r=!1}Sr(e,"unexpected end of the stream within a flow collection")}function a6e(e,t){var r,n,i=WH,a=!1,s=!1,o=t,l=0,u=!1,h,f;if(f=e.input.charCodeAt(e.position),f===124)n=!1;else if(f===62)n=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)WH===i?i=f===43?JCe:KSt:Sr(e,"repeat of a chomping mode identifier");else if((h=KSe(f))>=0)h===0?Sr(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Sr(e,"repeat of an indentation width identifier"):(o=t+h-1,s=!0);else break;if(Wm(f)){do f=e.input.charCodeAt(++e.position);while(Wm(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!gh(f)&&f!==0)}for(;f!==0;){for(R_(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!s||e.lineIndento&&(o=e.lineIndent),gh(f)){l++;continue}if(e.lineIndent=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}function ESe(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(xs.isNegativeZero(e))return"-0.0";return r=e.toString(10),GSt.test(r)?r.replace("e",".e"):r}function ASe(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||xs.isNegativeZero(e))}function ISe(e){return e===null?!1:RSe.exec(e)!==null||LSe.exec(e)!==null}function MSe(e){var t,r,n,i,a,s,o,l=0,u=null,h,f,d;if(t=RSe.exec(e),t===null&&(t=LSe.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(a=+t[4],s=+t[5],o=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(h=+t[10],f=+(t[11]||0),u=(h*60+f)*6e4,t[9]==="-"&&(u=-u)),d=new Date(Date.UTC(r,n,i,a,s,o,l)),u&&d.setTime(d.getTime()-u),d}function NSe(e){return e.toISOString()}function DSe(e){return e==="<<"||e===null}function OSe(e){if(e===null)return!1;var t,r,n=0,i=e.length,a=uU;for(r=0;r64)){if(t<0)return!1;n+=6}return n%8===0}function PSe(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,a=uU,s=0,o=[];for(t=0;t>16&255),o.push(s>>8&255),o.push(s&255)),s=s<<6|a.indexOf(n.charAt(t));return r=i%4*6,r===0?(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)):r===18?(o.push(s>>10&255),o.push(s>>2&255)):r===12&&o.push(s>>4&255),new Uint8Array(o)}function BSe(e){var t="",r=0,n,i,a=e.length,s=uU;for(n=0;n>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[n];return i=a%3,i===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):i===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):i===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}function FSe(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function $Se(e){if(e===null)return!0;var t=[],r,n,i,a,s,o=e;for(r=0,n=o.length;r>10)+55296,(e-65536&1023)+56320)}function hU(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[t]=r}function r6e(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||HSe,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function fU(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=RSt(r),new Zl(t,r)}function Sr(e,t){throw fU(e,t)}function I3(e,t){e.onWarning&&e.onWarning.call(null,fU(e,t))}function E0(e,t,r,n){var i,a,s,o;if(t1&&(e.result+=xs.repeat(` +`,t-1))}function n6e(e,t,r){var n,i,a,s,o,l,u,h,f=e.kind,d=e.result,p;if(p=e.input.charCodeAt(e.position),yl(p)||Fy(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=e.input.charCodeAt(e.position+1),yl(i)||r&&Fy(i)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,o=!1;p!==0;){if(p===58){if(i=e.input.charCodeAt(e.position+1),yl(i)||r&&Fy(i))break}else if(p===35){if(n=e.input.charCodeAt(e.position-1),yl(n))break}else{if(e.position===e.lineStart&&O3(e)||r&&Fy(p))break;if(gh(p))if(l=e.line,u=e.lineStart,h=e.lineIndent,Ga(e,!1,-1),e.lineIndent>=t){o=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=u,e.lineIndent=h;break}}o&&(E0(e,a,s,!1),L_(e,e.line-l),a=s=e.position,o=!1),Wm(p)||(s=e.position+1),p=e.input.charCodeAt(++e.position)}return E0(e,a,s,!1),e.result?!0:(e.kind=f,e.result=d,!1)}function i6e(e,t){var r,n,i;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(E0(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,i=e.position;else return!0;else gh(r)?(E0(e,n,i,!0),L_(e,Ga(e,!1,t)),n=i=e.position):e.position===e.lineStart&&O3(e)?Sr(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Sr(e,"unexpected end of the stream within a single quoted scalar")}function a6e(e,t){var r,n,i,a,s,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return E0(e,r,e.position,!0),e.position++,!0;if(o===92){if(E0(e,r,e.position,!0),o=e.input.charCodeAt(++e.position),gh(o))Ga(e,!1,t);else if(o<256&&e6e[o])e.result+=t6e[o],e.position++;else if((s=ZSe(o))>0){for(i=s,a=0;i>0;i--)o=e.input.charCodeAt(++e.position),(s=KSe(o))>=0?a=(a<<4)+s:Sr(e,"expected hexadecimal character");e.result+=JSe(a),e.position++}else Sr(e,"unknown escape sequence");r=n=e.position}else gh(o)?(E0(e,r,n,!0),L_(e,Ga(e,!1,t)),r=n=e.position):e.position===e.lineStart&&O3(e)?Sr(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Sr(e,"unexpected end of the stream within a double quoted scalar")}function s6e(e,t){var r=!0,n,i,a,s=e.tag,o,l=e.anchor,u,h,f,d,p,m=Object.create(null),g,y,v,x;if(x=e.input.charCodeAt(e.position),x===91)h=93,p=!1,o=[];else if(x===123)h=125,p=!0,o={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),x=e.input.charCodeAt(++e.position);x!==0;){if(Ga(e,!0,t),x=e.input.charCodeAt(e.position),x===h)return e.position++,e.tag=s,e.anchor=l,e.kind=p?"mapping":"sequence",e.result=o,!0;r?x===44&&Sr(e,"expected the node content, but found ','"):Sr(e,"missed comma between flow collection entries"),y=g=v=null,f=d=!1,x===63&&(u=e.input.charCodeAt(e.position+1),yl(u)&&(f=d=!0,e.position++,Ga(e,!0,t))),n=e.line,i=e.lineStart,a=e.position,zy(e,t,C_,!1,!0),y=e.tag,g=e.result,Ga(e,!0,t),x=e.input.charCodeAt(e.position),(d||e.line===n)&&x===58&&(f=!0,x=e.input.charCodeAt(++e.position),Ga(e,!0,t),zy(e,t,C_,!1,!0),v=e.result),p?$y(e,o,m,y,g,v,n,i,a):f?o.push($y(e,null,m,y,g,v,n,i,a)):o.push(g),Ga(e,!0,t),x=e.input.charCodeAt(e.position),x===44?(r=!0,x=e.input.charCodeAt(++e.position)):r=!1}Sr(e,"unexpected end of the stream within a flow collection")}function o6e(e,t){var r,n,i=UH,a=!1,s=!1,o=t,l=0,u=!1,h,f;if(f=e.input.charCodeAt(e.position),f===124)n=!1;else if(f===62)n=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)UH===i?i=f===43?tSe:e6t:Sr(e,"repeat of a chomping mode identifier");else if((h=QSe(f))>=0)h===0?Sr(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Sr(e,"repeat of an indentation width identifier"):(o=t+h-1,s=!0);else break;if(Wm(f)){do f=e.input.charCodeAt(++e.position);while(Wm(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!gh(f)&&f!==0)}for(;f!==0;){for(R_(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!s||e.lineIndento&&(o=e.lineIndent),gh(f)){l++;continue}if(e.lineIndentt)&&l!==0)Sr(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(y&&(s=e.line,o=e.lineStart,l=e.position),zy(e,t,S_,!0,i)&&(y?m=e.result:g=e.result),y||($y(e,f,d,p,m,g,s,o,l),p=m=g=null),Ga(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&x!==0)Sr(e,"bad indentation of a mapping entry");else if(e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndent tag; it should be "scalar", not "'+e.kind+'"'),f=0,d=e.implicitTypes.length;f"),e.result!==null&&m.kind!==e.kind&&Sr(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Sr(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||h}function u6e(e){var t=e.position,r,n,i,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(Ga(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!gl(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&Sr(e,"directive name must not be less than one character in length");s!==0;){for(;Wm(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!gh(s));break}if(gh(s))break;for(r=e.position;s!==0&&!gl(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}s!==0&&R_(e),Hm.call(eSe,n)?eSe[n](e,n,i):I3(e,'unknown document directive "'+n+'"')}if(Ga(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Ga(e,!0,-1)):a&&Sr(e,"directives end mark is expected"),zy(e,e.lineIndent-1,S_,!1,!0),Ga(e,!0,-1),e.checkLineBreaks&&QSt.test(e.input.slice(t,e.position))&&I3(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&O3(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Ga(e,!0,-1));return}if(e.position"u"&&(r=t,t=null);var n=hU(e,r);if(typeof t!="function")return n;for(var i=0,a=n.length;it)&&l!==0)Sr(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(y&&(s=e.line,o=e.lineStart,l=e.position),zy(e,t,S_,!0,i)&&(y?m=e.result:g=e.result),y||($y(e,f,d,p,m,g,s,o,l),p=m=g=null),Ga(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&x!==0)Sr(e,"bad indentation of a mapping entry");else if(e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndent tag; it should be "scalar", not "'+e.kind+'"'),f=0,d=e.implicitTypes.length;f"),e.result!==null&&m.kind!==e.kind&&Sr(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Sr(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||h}function f6e(e){var t=e.position,r,n,i,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(Ga(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!yl(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&Sr(e,"directive name must not be less than one character in length");s!==0;){for(;Wm(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!gh(s));break}if(gh(s))break;for(r=e.position;s!==0&&!yl(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}s!==0&&R_(e),Hm.call(rSe,n)?rSe[n](e,n,i):I3(e,'unknown document directive "'+n+'"')}if(Ga(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Ga(e,!0,-1)):a&&Sr(e,"directives end mark is expected"),zy(e,e.lineIndent-1,S_,!1,!0),Ga(e,!0,-1),e.checkLineBreaks&&r6t.test(e.input.slice(t,e.position))&&I3(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&O3(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Ga(e,!0,-1));return}if(e.position"u"&&(r=t,t=null);var n=dU(e,r);if(typeof t!="function")return n;for(var i=0,a=n.length;i=55296&&r<=56319&&t+1=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function dU(e){var t=/^\n* /;return t.test(e)}function L6e(e,t,r,n,i,a,s,o){var l,u=0,h=null,f=!1,d=!1,p=n!==-1,m=-1,g=S6e(e4(e,0))&&E6e(e4(e,e.length-1));if(t||s)for(l=0;l=65536?l+=2:l++){if(u=e4(e,l),!r4(u))return Jb;g=g&&JH(u,h,o),h=u}else{for(l=0;l=65536?l+=2:l++){if(u=e4(e,l),u===M3)f=!0,p&&(d=d||l-m-1>n&&e[m+1]!==" ",m=l);else if(!r4(u))return Jb;g=g&&JH(u,h,o),h=u}d=d||p&&l-m-1>n&&e[m+1]!==" "}return!f&&!d?g&&!s&&!i(e)?A6e:a===N3?Jb:eU:r>9&&dU(e)?Jb:s?a===N3?Jb:eU:d?R6e:_6e}function I6e(e,t,r,n,i){e.dump=(function(){if(t.length===0)return e.quotingType===N3?'""':"''";if(!e.noCompatMode&&(v6t.indexOf(t)!==-1||x6t.test(t)))return e.quotingType===N3?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,r),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),o=n||e.flowLevel>-1&&r>=e.flowLevel;function l(u){return C6e(e,u)}switch(b(l,"testAmbiguity"),L6e(t,o,e.indent,s,l,e.quotingType,e.forceQuotes&&!n,i)){case A6e:return t;case eU:return"'"+t.replace(/'/g,"''")+"'";case _6e:return"|"+tU(t,e.indent)+rU(ZH(t,a));case R6e:return">"+tU(t,e.indent)+rU(ZH(M6e(t,s),a));case Jb:return'"'+N6e(t)+'"';default:throw new Kl("impossible error: invalid scalar style")}})()}function tU(e,t){var r=dU(e)?String(t):"",n=e[e.length-1]===` +`+xs.repeat(" ",e.indent*t)}function E6e(e,t){var r,n,i;for(r=0,n=e.implicitTypes.length;r=55296&&r<=56319&&t+1=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function mU(e){var t=/^\n* /;return t.test(e)}function M6e(e,t,r,n,i,a,s,o){var l,u=0,h=null,f=!1,d=!1,p=n!==-1,m=-1,g=A6e(e4(e,0))&&_6e(e4(e,e.length-1));if(t||s)for(l=0;l=65536?l+=2:l++){if(u=e4(e,l),!r4(u))return Jb;g=g&&tU(u,h,o),h=u}else{for(l=0;l=65536?l+=2:l++){if(u=e4(e,l),u===M3)f=!0,p&&(d=d||l-m-1>n&&e[m+1]!==" ",m=l);else if(!r4(u))return Jb;g=g&&tU(u,h,o),h=u}d=d||p&&l-m-1>n&&e[m+1]!==" "}return!f&&!d?g&&!s&&!i(e)?R6e:a===N3?Jb:rU:r>9&&mU(e)?Jb:s?a===N3?Jb:rU:d?I6e:L6e}function N6e(e,t,r,n,i){e.dump=(function(){if(t.length===0)return e.quotingType===N3?'""':"''";if(!e.noCompatMode&&(k6t.indexOf(t)!==-1||T6t.test(t)))return e.quotingType===N3?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,r),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),o=n||e.flowLevel>-1&&r>=e.flowLevel;function l(u){return E6e(e,u)}switch(b(l,"testAmbiguity"),M6e(t,o,e.indent,s,l,e.quotingType,e.forceQuotes&&!n,i)){case R6e:return t;case rU:return"'"+t.replace(/'/g,"''")+"'";case L6e:return"|"+nU(t,e.indent)+iU(JH(t,a));case I6e:return">"+nU(t,e.indent)+iU(JH(D6e(t,s),a));case Jb:return'"'+O6e(t)+'"';default:throw new Zl("impossible error: invalid scalar style")}})()}function nU(e,t){var r=mU(e)?String(t):"",n=e[e.length-1]===` `,i=n&&(e[e.length-2]===` `||e===` `),a=i?"+":n?"":"-";return r+a+` -`}function rU(e){return e[e.length-1]===` -`?e.slice(0,-1):e}function M6e(e,t){for(var r=/(\n+)([^\n]*)/g,n=(function(){var u=e.indexOf(` -`);return u=u!==-1?u:e.length,r.lastIndex=u,nU(e.slice(0,u),t)})(),i=e[0]===` +`}function iU(e){return e[e.length-1]===` +`?e.slice(0,-1):e}function D6e(e,t){for(var r=/(\n+)([^\n]*)/g,n=(function(){var u=e.indexOf(` +`);return u=u!==-1?u:e.length,r.lastIndex=u,aU(e.slice(0,u),t)})(),i=e[0]===` `||e[0]===" ",a,s;s=r.exec(e);){var o=s[1],l=s[2];a=l[0]===" ",n+=o+(!i&&!a&&l!==""?` -`:"")+nU(l,t),i=a}return n}function nU(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,i=0,a,s=0,o=0,l="";n=r.exec(e);)o=n.index,o-i>t&&(a=s>i?s:o,l+=` +`:"")+aU(l,t),i=a}return n}function aU(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,i=0,a,s=0,o=0,l="";n=r.exec(e);)o=n.index,o-i>t&&(a=s>i?s:o,l+=` `+e.slice(i,a),i=a+1),s=o;return l+=` `,e.length-i>t&&s>i?l+=e.slice(i,s)+` -`+e.slice(s+1):l+=e.slice(i),l.slice(1)}function N6e(e){for(var t="",r=0,n,i=0;i=65536?i+=2:i++)r=e4(e,i),n=Vo[r],!n&&r4(r)?(t+=e[i],r>=65536&&(t+=e[i+1])):t+=n||k6e(r);return t}function D6e(e,t,r){var n="",i=e.tag,a,s,o;for(a=0,s=r.length;a"u"&&$f(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function iU(e,t,r,n){var i="",a=e.tag,s,o,l;for(s=0,o=r.length;s"u"&&$f(e,t+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=A_(e,t)),e.dump&&M3===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=a,e.dump=i||"[]"}function O6e(e,t,r){var n="",i=e.tag,a=Object.keys(r),s,o,l,u,h;for(s=0,o=a.length;s1024&&(h+="? "),h+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),$f(e,t,u,!1,!1)&&(h+=e.dump,n+=h));e.tag=i,e.dump="{"+n+"}"}function P6e(e,t,r,n){var i="",a=e.tag,s=Object.keys(r),o,l,u,h,f,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Kl("sortKeys must be a boolean or a function");for(o=0,l=s.length;o1024,f&&(e.dump&&M3===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,f&&(d+=A_(e,t)),$f(e,t+1,h,!0,f)&&(e.dump&&M3===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,i+=d));e.tag=a,e.dump=i||"{}"}function aU(e,t,r){var n,i,a,s,o,l;for(i=r?e.explicitTypes:e.implicitTypes,a=0,s=i.length;a tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function $f(e,t,r,n,i,a,s){e.tag=null,e.dump=r,aU(e,r,!1)||aU(e,r,!0);var o=p6e.call(e.dump),l=n,u;n&&(n=e.flowLevel<0||e.flowLevel>t);var h=o==="[object Object]"||o==="[object Array]",f,d;if(h&&(f=e.duplicates.indexOf(r),d=f!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(i=!1),d&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(h&&d&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),o==="[object Object]")n&&Object.keys(e.dump).length!==0?(P6e(e,t,e.dump,i),d&&(e.dump="&ref_"+f+e.dump)):(O6e(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(o==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?iU(e,t-1,e.dump,i):iU(e,t,e.dump,i),d&&(e.dump="&ref_"+f+e.dump)):(D6e(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(o==="[object String]")e.tag!=="?"&&I6e(e,e.dump,t,a,l);else{if(o==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Kl("unacceptable kind of an object to dump "+o)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function B6e(e,t){var r=[],n=[],i,a;for(__(e,r,n),i=0,a=n.length;i{hr();b(sU,"isNothing");b(tSe,"isObject");b(rSe,"toArray");b(nSe,"extend");b(iSe,"repeat");b(aSe,"isNegativeZero");xSt=sU,bSt=tSe,wSt=rSe,kSt=iSe,TSt=aSe,CSt=nSe,xs={isNothing:xSt,isObject:bSt,toArray:wSt,repeat:kSt,isNegativeZero:TSt,extend:CSt};b(oU,"formatError");b(t4,"YAMLException$1");t4.prototype=Object.create(Error.prototype);t4.prototype.constructor=t4;t4.prototype.toString=b(function(t){return this.name+": "+oU(this,t)},"toString");Kl=t4;b(w_,"getLine");b(k_,"padStart");b(sSe,"makeSnippet");SSt=sSe,ESt=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],ASt=["scalar","sequence","mapping"];b(oSe,"compileStyleAliases");b(lSe,"Type$1");qo=lSe;b(HH,"compileList");b(cSe,"compileMap");b(T_,"Schema$1");T_.prototype.extend=b(function(t){var r=[],n=[];if(t instanceof qo)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new Kl("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(a){if(!(a instanceof qo))throw new Kl("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Kl("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Kl("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof qo))throw new Kl("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(T_.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=HH(i,"implicit"),i.compiledExplicit=HH(i,"explicit"),i.compiledTypeMap=cSe(i.compiledImplicit,i.compiledExplicit),i},"extend");_St=T_,RSt=new qo("tag:yaml.org,2002:str",{kind:"scalar",construct:b(function(e){return e!==null?e:""},"construct")}),LSt=new qo("tag:yaml.org,2002:seq",{kind:"sequence",construct:b(function(e){return e!==null?e:[]},"construct")}),ISt=new qo("tag:yaml.org,2002:map",{kind:"mapping",construct:b(function(e){return e!==null?e:{}},"construct")}),MSt=new _St({explicit:[RSt,LSt,ISt]});b(uSe,"resolveYamlNull");b(hSe,"constructYamlNull");b(fSe,"isNull");NSt=new qo("tag:yaml.org,2002:null",{kind:"scalar",resolve:uSe,construct:hSe,predicate:fSe,represent:{canonical:b(function(){return"~"},"canonical"),lowercase:b(function(){return"null"},"lowercase"),uppercase:b(function(){return"NULL"},"uppercase"),camelcase:b(function(){return"Null"},"camelcase"),empty:b(function(){return""},"empty")},defaultStyle:"lowercase"});b(dSe,"resolveYamlBoolean");b(pSe,"constructYamlBoolean");b(mSe,"isBoolean");DSt=new qo("tag:yaml.org,2002:bool",{kind:"scalar",resolve:dSe,construct:pSe,predicate:mSe,represent:{lowercase:b(function(e){return e?"true":"false"},"lowercase"),uppercase:b(function(e){return e?"TRUE":"FALSE"},"uppercase"),camelcase:b(function(e){return e?"True":"False"},"camelcase")},defaultStyle:"lowercase"});b(gSe,"isHexCode");b(ySe,"isOctCode");b(vSe,"isDecCode");b(xSe,"resolveYamlInteger");b(bSe,"constructYamlInteger");b(wSe,"isInteger");OSt=new qo("tag:yaml.org,2002:int",{kind:"scalar",resolve:xSe,construct:bSe,predicate:wSe,represent:{binary:b(function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},"binary"),octal:b(function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},"octal"),decimal:b(function(e){return e.toString(10)},"decimal"),hexadecimal:b(function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),PSt=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");b(kSe,"resolveYamlFloat");b(TSe,"constructYamlFloat");BSt=/^[-+]?[0-9]+e/;b(CSe,"representYamlFloat");b(SSe,"isFloat");FSt=new qo("tag:yaml.org,2002:float",{kind:"scalar",resolve:kSe,construct:TSe,predicate:SSe,represent:CSe,defaultStyle:"lowercase"}),ESe=MSt.extend({implicit:[NSt,DSt,OSt,FSt]}),$St=ESe,ASe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),_Se=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");b(RSe,"resolveYamlTimestamp");b(LSe,"constructYamlTimestamp");b(ISe,"representYamlTimestamp");zSt=new qo("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:RSe,construct:LSe,instanceOf:Date,represent:ISe});b(MSe,"resolveYamlMerge");GSt=new qo("tag:yaml.org,2002:merge",{kind:"scalar",resolve:MSe}),lU=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= -\r`;b(NSe,"resolveYamlBinary");b(DSe,"constructYamlBinary");b(OSe,"representYamlBinary");b(PSe,"isBinary");qSt=new qo("tag:yaml.org,2002:binary",{kind:"scalar",resolve:NSe,construct:DSe,predicate:PSe,represent:OSe}),VSt=Object.prototype.hasOwnProperty,WSt=Object.prototype.toString;b(BSe,"resolveYamlOmap");b(FSe,"constructYamlOmap");HSt=new qo("tag:yaml.org,2002:omap",{kind:"sequence",resolve:BSe,construct:FSe}),USt=Object.prototype.toString;b($Se,"resolveYamlPairs");b(zSe,"constructYamlPairs");YSt=new qo("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:$Se,construct:zSe}),XSt=Object.prototype.hasOwnProperty;b(GSe,"resolveYamlSet");b(qSe,"constructYamlSet");jSt=new qo("tag:yaml.org,2002:set",{kind:"mapping",resolve:GSe,construct:qSe}),VSe=$St.extend({implicit:[zSt,GSt],explicit:[qSt,HSt,YSt,jSt]}),Hm=Object.prototype.hasOwnProperty,C_=1,WSe=2,HSe=3,S_=4,WH=1,KSt=2,JCe=3,ZSt=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,QSt=/[\x85\u2028\u2029]/,JSt=/[,\[\]\{\}]/,USe=/^(?:!|!!|![a-z\-]+!)$/i,YSe=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;b(UH,"_class");b(gh,"is_EOL");b(Wm,"is_WHITE_SPACE");b(gl,"is_WS_OR_EOL");b(Fy,"is_FLOW_INDICATOR");b(XSe,"fromHexCode");b(jSe,"escapedHexLen");b(KSe,"fromDecimalCode");b(YH,"simpleEscapeSequence");b(ZSe,"charFromCodepoint");b(cU,"setProperty");QSe=new Array(256),JSe=new Array(256);for(By=0;By<256;By++)QSe[By]=YH(By)?1:0,JSe[By]=YH(By);b(e6e,"State$1");b(uU,"generateError");b(Sr,"throwError");b(I3,"throwWarning");eSe={YAML:b(function(t,r,n){var i,a,s;t.version!==null&&Sr(t,"duplication of %YAML directive"),n.length!==1&&Sr(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Sr(t,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&Sr(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&I3(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:b(function(t,r,n){var i,a;n.length!==2&&Sr(t,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],USe.test(i)||Sr(t,"ill-formed tag handle (first argument) of the TAG directive"),Hm.call(t.tagMap,i)&&Sr(t,'there is a previously declared suffix for "'+i+'" tag handle'),YSe.test(a)||Sr(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{Sr(t,"tag prefix is malformed: "+a)}t.tagMap[i]=a},"handleTagDirective")};b(E0,"captureSegment");b(XH,"mergeMappings");b($y,"storeMappingPair");b(R_,"readLineBreak");b(Ga,"skipSeparationSpace");b(O3,"testDocumentSeparator");b(L_,"writeFoldedLines");b(t6e,"readPlainScalar");b(r6e,"readSingleQuotedScalar");b(n6e,"readDoubleQuotedScalar");b(i6e,"readFlowCollection");b(a6e,"readBlockScalar");b(jH,"readBlockSequence");b(s6e,"readBlockMapping");b(o6e,"readTagProperty");b(l6e,"readAnchorProperty");b(c6e,"readAlias");b(zy,"composeNode");b(u6e,"readDocument");b(hU,"loadDocuments");b(h6e,"loadAll$1");b(f6e,"load$1");e6t=h6e,t6t=f6e,d6e={loadAll:e6t,load:t6t},p6e=Object.prototype.toString,m6e=Object.prototype.hasOwnProperty,fU=65279,r6t=9,M3=10,n6t=13,i6t=32,a6t=33,s6t=34,KH=35,o6t=37,l6t=38,c6t=39,u6t=42,g6e=44,h6t=45,E_=58,f6t=61,d6t=62,p6t=63,m6t=64,y6e=91,v6e=93,g6t=96,x6e=123,y6t=124,b6e=125,Vo={};Vo[0]="\\0";Vo[7]="\\a";Vo[8]="\\b";Vo[9]="\\t";Vo[10]="\\n";Vo[11]="\\v";Vo[12]="\\f";Vo[13]="\\r";Vo[27]="\\e";Vo[34]='\\"';Vo[92]="\\\\";Vo[133]="\\N";Vo[160]="\\_";Vo[8232]="\\L";Vo[8233]="\\P";v6t=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],x6t=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;b(w6e,"compileStyleMap");b(k6e,"encodeHex");b6t=1,N3=2;b(T6e,"State");b(ZH,"indentString");b(A_,"generateNextLine");b(C6e,"testImplicitResolving");b(D3,"isWhitespace");b(r4,"isPrintable");b(QH,"isNsCharOrWhitespace");b(JH,"isPlainSafe");b(S6e,"isPlainSafeFirst");b(E6e,"isPlainSafeLast");b(e4,"codePointAt");b(dU,"needIndentIndicator");A6e=1,eU=2,_6e=3,R6e=4,Jb=5;b(L6e,"chooseScalarStyle");b(I6e,"writeScalar");b(tU,"blockHeader");b(rU,"dropEndingNewline");b(M6e,"foldString");b(nU,"foldLine");b(N6e,"escapeString");b(D6e,"writeFlowSequence");b(iU,"writeBlockSequence");b(O6e,"writeFlowMapping");b(P6e,"writeBlockMapping");b(aU,"detectType");b($f,"writeNode");b(B6e,"getDuplicateReferences");b(__,"inspectNode");b(F6e,"dump$1");w6t=F6e,k6t={dump:w6t};b(I_,"renamed");Um=ESe,Ym=d6e.load,Azr=d6e.loadAll,_zr=k6t.dump,Rzr=I_("safeLoad","load"),Lzr=I_("safeLoadAll","loadAll"),Izr=I_("safeDump","dump");});var $6e,qy,T6t,P3,ar,cr,C6t,co=W(()=>{_r();hr();$6e=b(e=>{let{handDrawnSeed:t}=Be();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),qy=b(e=>{let t=T6t([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),T6t=b(e=>{let t=new Map;return e.forEach(r=>{let[n,i]=r.split(":");t.set(n.trim(),i?.trim())}),t},"styles2Map"),P3=b(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),ar=b(e=>{let{stylesArray:t}=qy(e),r=[],n=[],i=[],a=[];return t.forEach(s=>{let o=s[0];P3(o)?r.push(s.join(":")+" !important"):(n.push(s.join(":")+" !important"),o.includes("stroke")&&i.push(s.join(":")+" !important"),o==="fill"&&a.push(s.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:t,borderStyles:i,backgroundStyles:a}},"styles2String"),cr=b((e,t)=>{let{themeVariables:r,handDrawnSeed:n}=Be(),{nodeBorder:i,mainBkg:a}=r,{stylesMap:s}=qy(e);return Object.assign({roughness:.7,fill:s.get("fill")||a,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:s.get("stroke")||i,seed:n,strokeWidth:s.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:C6t(s.get("stroke-dasharray"))},t)},"userNodeOverrides"),C6t=b(e=>{if(!e)return[0,0];let t=e.trim().split(/\s+/).map(Number);if(t.length===1){let i=isNaN(t[0])?0:t[0];return[i,i]}let r=isNaN(t[0])?0:t[0],n=isNaN(t[1])?0:t[1];return[r,n]},"getStrokeDashArray")});var z6e=Qo(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.BLANK_URL=Fs.relativeFirstCharacters=Fs.whitespaceEscapeCharsRegex=Fs.urlSchemeRegex=Fs.ctrlCharactersRegex=Fs.htmlCtrlEntityRegex=Fs.htmlEntitiesRegex=Fs.invalidProtocolRegex=void 0;Fs.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im;Fs.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g;Fs.htmlCtrlEntityRegex=/&(newline|tab);/gi;Fs.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;Fs.urlSchemeRegex=/^.+(:|:)/gim;Fs.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;Fs.relativeFirstCharacters=[".","/"];Fs.BLANK_URL="about:blank"});var n4=Qo(pU=>{"use strict";Object.defineProperty(pU,"__esModule",{value:!0});pU.sanitizeUrl=_6t;var Wo=z6e();function S6t(e){return Wo.relativeFirstCharacters.indexOf(e[0])>-1}function E6t(e){var t=e.replace(Wo.ctrlCharactersRegex,"");return t.replace(Wo.htmlEntitiesRegex,function(r,n){return String.fromCharCode(n)})}function A6t(e){return URL.canParse(e)}function G6e(e){try{return decodeURIComponent(e)}catch{return e}}function _6t(e){if(!e)return Wo.BLANK_URL;var t,r=G6e(e.trim());do r=E6t(r).replace(Wo.htmlCtrlEntityRegex,"").replace(Wo.ctrlCharactersRegex,"").replace(Wo.whitespaceEscapeCharsRegex,"").trim(),r=G6e(r),t=r.match(Wo.ctrlCharactersRegex)||r.match(Wo.htmlEntitiesRegex)||r.match(Wo.htmlCtrlEntityRegex)||r.match(Wo.whitespaceEscapeCharsRegex);while(t&&t.length>0);var n=r;if(!n)return Wo.BLANK_URL;if(S6t(n))return n;var i=n.trimStart(),a=i.match(Wo.urlSchemeRegex);if(!a)return n;var s=a[0].toLowerCase().trim();if(Wo.invalidProtocolRegex.test(s))return Wo.BLANK_URL;var o=i.replace(/\\/g,"/");if(s==="mailto:"||s.includes("://"))return o;if(s==="http:"||s==="https:"){if(!A6t(o))return Wo.BLANK_URL;var l=new URL(o);return l.protocol=l.protocol.toLowerCase(),l.hostname=l.hostname.toLowerCase(),l.toString()}return o}});function q6e(e){return Array.isArray(e)}var V6e=W(()=>{});function M_(e){if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){let r=e[Symbol.toStringTag];return r==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var W6e=W(()=>{});function H6e(){}var U6e=W(()=>{});function N_(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var mU=W(()=>{});function A0(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var B3=W(()=>{});var D_,i4,a4,s4,o4,O_,P_,B_,F_,$_,z_,G_,q_,V_,W_,H_,U_,Y_,X_,j_,K_,Z_,Q_=W(()=>{D_="[object RegExp]",i4="[object String]",a4="[object Number]",s4="[object Boolean]",o4="[object Arguments]",O_="[object Symbol]",P_="[object Date]",B_="[object Map]",F_="[object Set]",$_="[object Array]",z_="[object ArrayBuffer]",G_="[object Object]",q_="[object DataView]",V_="[object Uint8Array]",W_="[object Uint8ClampedArray]",H_="[object Uint16Array]",U_="[object Uint32Array]",Y_="[object Int8Array]",X_="[object Int16Array]",j_="[object Int32Array]",K_="[object Float32Array]",Z_="[object Float64Array]"});var gU,Y6e=W(()=>{gU=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()});function l4(e){return typeof gU.Buffer<"u"&&gU.Buffer.isBuffer(e)}var J_=W(()=>{Y6e()});function X6e(e){return Number.isSafeInteger(e)&&e>=0}var j6e=W(()=>{});function eR(e){return e!=null&&typeof e!="function"&&X6e(e.length)}var yU=W(()=>{j6e()});function K6e(e){return e==="__proto__"}var Z6e=W(()=>{});function Xm(e){return e==null||typeof e!="object"&&typeof e!="function"}var F3=W(()=>{});function c4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}var tR=W(()=>{});function Q6e(e,t){return u4(e,void 0,e,new Map,t)}function u4(e,t,r,n=new Map,i=void 0){let a=i?.(e,t,r,n);if(a!==void 0)return a;if(Xm(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){let s=new Array(e.length);n.set(e,s);for(let o=0;o{F3();tR();mU();B3();Q_();J_()});function eEe(e,t){return Q6e(e,(r,n,i,a)=>{let s=t?.(r,n,i,a);if(s!==void 0)return s;if(typeof e=="object"){if(A0(e)==="[object Object]"&&typeof e.constructor!="function"){let o={};return a.set(e,o),Au(o,e,i,a),o}switch(Object.prototype.toString.call(e)){case a4:case i4:case s4:{let o=new e.constructor(e?.valueOf());return Au(o,e),o}case o4:{let o={};return Au(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}var tEe=W(()=>{B3();Q_();J6e()});function vU(e){return eEe(e)}var rEe=W(()=>{tEe()});function $3(e){return e!==null&&typeof e=="object"&&A0(e)==="[object Arguments]"}var xU=W(()=>{B3()});function z3(e){return typeof e=="object"&&e!==null}var bU=W(()=>{});function nEe(e){return z3(e)&&eR(e)}var iEe=W(()=>{yU();bU()});function Vy(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");let r=function(...n){let i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);let s=e.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(Vy.Cache||Map),r}var aEe=W(()=>{Vy.Cache=Map});function jm(e){return c4(e)}var rR=W(()=>{tR()});function sEe(e){let t=e?.constructor;return e===(typeof t=="function"?t.prototype:Object.prototype)}var oEe=W(()=>{});function kU(e){if(Xm(e))return e;let t=A0(e);if(!L6t(e))return{};if(q6e(e)){let n=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(n.index=e.index,n.input=e.input),n}if(jm(e)){let n=e,i=n.constructor;return new i(n.buffer,n.byteOffset,n.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){let n=e,i=n.buffer,a=n.byteOffset,s=n.byteLength,o=new ArrayBuffer(s),l=new Uint8Array(i,a,s);return new Uint8Array(o).set(l),new DataView(o)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){let n=e.constructor,i=new n(e.valueOf());return t==="[object String]"?M6t(i,e):wU(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){let n=e,i=new RegExp(n.source,n.flags);return i.lastIndex=n.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){let n=e,i=new Map;return n.forEach((a,s)=>{i.set(s,a)}),i}if(t==="[object Set]"){let n=e,i=new Set;return n.forEach(a=>{i.add(a)}),i}if(t==="[object Arguments]"){let n=e,i={};return wU(i,n),i.length=n.length,i[Symbol.iterator]=n[Symbol.iterator],i}let r={};return N6t(r,e),wU(r,e),I6t(r,e),r}function L6t(e){switch(A0(e)){case o4:case $_:case z_:case q_:case s4:case P_:case K_:case Z_:case Y_:case X_:case j_:case B_:case a4:case G_:case D_:case F_:case i4:case O_:case V_:case W_:case H_:case U_:return!0;default:return!1}}function wU(e,t){for(let r in t)Object.hasOwn(t,r)&&(e[r]=t[r])}function I6t(e,t){let r=Object.getOwnPropertySymbols(t);for(let n=0;n=r)&&(e[n]=t[n])}function N6t(e,t){let r=Object.getPrototypeOf(t);r!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,r)}var lEe=W(()=>{F3();B3();Q_();V6e();rR()});function cEe(e){if(Xm(e))return e;if(Array.isArray(e)||c4(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let n=new r(e);return n.lastIndex=e.lastIndex,n}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let n;return e instanceof AggregateError?n=new r(e.errors,e.message,{cause:e.cause}):n=new r(e.message,{cause:e.cause}),n.stack=e.stack,Object.assign(n,e),n}return typeof File<"u"&&e instanceof File?new r([e],e.name,{type:e.type,lastModified:e.lastModified}):typeof e=="object"?Object.assign(Object.create(t),e):e}var uEe=W(()=>{F3();tR()});function hEe(e,...t){let r=t.slice(0,-1),n=t[t.length-1],i=e;for(let a=0;a{F3();uEe();mU();J_();Z6e();W6e();rEe();xU();bU();iEe();rR()});function TU(e,...t){return hEe(e,...t,H6e)}var dEe=W(()=>{U6e();fEe()});function iR(e){if(e==null)return!0;if(eR(e))return typeof e.splice!="function"&&typeof e!="string"&&!l4(e)&&!jm(e)&&!$3(e)?!1:e.length===0;if(typeof e=="object"||typeof e=="function"){if(e instanceof Map||e instanceof Set)return e.size===0;let t=Object.keys(e);return sEe(e)?t.filter(r=>r!=="constructor").length===0:t.length===0}return!0}var pEe=W(()=>{J_();yU();xU();oEe();rR()});var aR=W(()=>{aEe();lEe();dEe();pEe()});function oR(e,t){if(!e)return t;let r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return D6t[r]??t}function bEe(e,t){let r=e.trim();if(r)return t.securityLevel!=="loose"?(0,yEe.sanitizeUrl)(r):r}function SU(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function wEe(e){let t,r=0;e.forEach(i=>{r+=SU(i,t),t=i});let n=r/2;return EU(e,n)}function kEe(e){return e.length===1?e[0]:wEe(e)}function TEe(e,t,r){let n=structuredClone(r);se.info("our points",n),t!=="start_left"&&t!=="start_right"&&n.reverse();let i=25+e,a=EU(n,i),s=10+e*.5,o=Math.atan2(n[0].y-a.y,n[0].x-a.x),l={x:0,y:0};return t==="start_left"?(l.x=Math.sin(o+Math.PI)*s+(n[0].x+a.x)/2,l.y=-Math.cos(o+Math.PI)*s+(n[0].y+a.y)/2):t==="end_right"?(l.x=Math.sin(o-Math.PI)*s+(n[0].x+a.x)/2-5,l.y=-Math.cos(o-Math.PI)*s+(n[0].y+a.y)/2-5):t==="end_left"?(l.x=Math.sin(o)*s+(n[0].x+a.x)/2-5,l.y=-Math.cos(o)*s+(n[0].y+a.y)/2-5):(l.x=Math.sin(o)*s+(n[0].x+a.x)/2,l.y=-Math.cos(o)*s+(n[0].y+a.y)/2),l}function lR(e){let t="",r="";for(let n of e)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":t=t+n+";");return{style:t,labelStyle:r}}function CEe(e){let t="",r="0123456789abcdef",n=r.length;for(let i=0;iMath.round(parseFloat(a)).toString());return i.includes(r.toString())||i.includes(n.toString())}var yEe,CU,D6t,O6t,P6t,vEe,xEe,B6t,F6t,mEe,EU,$6t,gEe,AU,_U,z6t,G6t,Wy,q6t,q3,V6t,sR,W6t,H6t,Zl,pr,SEe,$c,zf,Sn=W(()=>{_r();Rr();hr();yEe=Ro(n4(),1);fn();aR();CU="\u200B",D6t={curveBasis:Ff,curveBasisClosed:LH,curveBasisOpen:IH,curveBumpX:g3,curveBumpY:y3,curveBundle:MH,curveCardinalClosed:NH,curveCardinalOpen:OH,curveCardinal:w3,curveCatmullRomClosed:BH,curveCatmullRomOpen:FH,curveCatmullRom:C3,curveLinear:S0,curveLinearClosed:$H,curveMonotoneX:S3,curveMonotoneY:E3,curveNatural:A3,curveStep:_3,curveStepAfter:L3,curveStepBefore:R3},O6t=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,P6t=b(function(e,t){let r=vEe(e,/(?:init\b)|(?:initialize\b)/),n={};if(Array.isArray(r)){let s=r.map(o=>o.args);N5(s),n=Xi(n,[...s])}else n=r.args;if(!n)return;let i=O5(e,t),a="config";return n[a]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[a],delete n[a]),n},"detectInit"),vEe=b(function(e,t=null){try{let r=new RegExp(`[%]{2}(?![{]${O6t.source})(?=[}][%]{2}).* -`,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),se.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let n,i=[];for(;(n=_b.exec(e))!==null;)if(n.index===_b.lastIndex&&_b.lastIndex++,n&&!t||t&&n[1]?.match(t)||t&&n[2]?.match(t)){let a=n[1]?n[1]:n[2],s=n[3]?n[3].trim():n[4]?JSON.parse(n[4].trim()):null;i.push({type:a,args:s})}return i.length===0?{type:e,args:null}:i.length===1?i[0]:i}catch(r){return se.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),xEe=b(function(e){return e.replace(_b,"")},"removeDirectives"),B6t=b(function(e,t){for(let[r,n]of t.entries())if(n.match(e))return r;return-1},"isSubstringInArray");b(oR,"interpolateToCurve");b(bEe,"formatUrl");F6t=b((e,...t)=>{let r=e.split("."),n=r.length-1,i=r[n],a=window;for(let s=0;s{let r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),EU=b((e,t)=>{let r,n=t;for(let i of e){if(r){let a=SU(i,r);if(a===0)return r;if(a=1)return{x:i.x,y:i.y};if(s>0&&s<1)return{x:mEe((1-s)*r.x+s*i.x,5),y:mEe((1-s)*r.y+s*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),$6t=b((e,t,r)=>{se.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());let i=EU(t,25),a=e?10:5,s=Math.atan2(t[0].y-i.y,t[0].x-i.x),o={x:0,y:0};return o.x=Math.sin(s)*a+(t[0].x+i.x)/2,o.y=-Math.cos(s)*a+(t[0].y+i.y)/2,o},"calcCardinalityPosition");b(TEe,"calcTerminalLabelPosition");b(lR,"getStylesFromArray");gEe=0,AU=b(()=>(gEe++,"id-"+Math.random().toString(36).substr(2,12)+"-"+gEe),"generateId");b(CEe,"makeRandomHex");_U=b(e=>CEe(e.length),"random"),z6t=b(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),G6t=b(function(e,t){let r=t.text.replace(Ct.lineBreakRegex," "),[,n]=Zl(t.fontSize),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.style("text-anchor",t.anchor),i.style("font-family",t.fontFamily),i.style("font-size",n),i.style("font-weight",t.fontWeight),i.attr("fill",t.fill),t.class!==void 0&&i.attr("class",t.class);let a=i.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.attr("fill",t.fill),a.text(r),i},"drawSimpleText"),Wy=Vy((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
"},r),Ct.lineBreakRegex.test(e)))return e;let n=e.split(" ").filter(Boolean),i=[],a="";return n.forEach((s,o)=>{let l=uo(`${s} `,r),u=uo(a,r);if(l>t){let{hyphenatedStrings:d,remainingWord:p}=q6t(s,t,"-",r);i.push(a,...d),a=p}else u+l>=t?(i.push(a),a=s):a=[a,s].filter(Boolean).join(" ");o+1===n.length&&i.push(a)}),i.filter(s=>s!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),q6t=Vy((e,t,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);let i=[...e],a=[],s="";return i.forEach((o,l)=>{let u=`${s}${o}`;if(uo(u,n)>=t){let f=l+1,d=i.length===f,p=`${u}${r}`;a.push(d?u:p),s=""}else s=u}),{hyphenatedStrings:a,remainingWord:s}},(e,t,r="-",n)=>`${e}${t}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);b(G3,"calculateTextHeight");b(uo,"calculateTextWidth");q3=Vy((e,t)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=t;if(!e)return{width:0,height:0};let[,a]=Zl(r),s=["sans-serif",n],o=e.split(Ct.lineBreakRegex),l=[],u=ct("body");if(!u.remove)return{width:0,height:0,lineHeight:0};let h=u.append("svg");for(let d of s){let p=0,m={width:0,height:0,lineHeight:0};for(let g of o){let y=z6t();y.text=g||CU;let v=G6t(h,y).style("font-size",a).style("font-weight",i).style("font-family",d),x=(v._groups||v)[0][0].getBBox();if(x.width===0&&x.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,x.width)),p=Math.round(x.height),m.height+=p,m.lineHeight=Math.round(Math.max(m.lineHeight,p))}l.push(m)}h.remove();let f=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[f]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),V6t=class{constructor(e=!1,t){this.count=0,this.count=t?t.length:0,this.next=e?()=>this.count++:()=>Date.now()}static{b(this,"InitIDGenerator")}},W6t=b(function(e){return sR=sR||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),sR.innerHTML=e,unescape(sR.textContent)},"entityDecode");b(cR,"isDetailedError");H6t=b((e,t,r,n)=>{if(!n)return;let i=e.node()?.getBBox();i&&e.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",t)},"insertTitle"),Zl=b(e=>{if(typeof e=="number")return[e,e+"px"];let t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");b(Rn,"cleanAndMerge");pr={assignWithDepth:Xi,wrapLabel:Wy,calculateTextHeight:G3,calculateTextWidth:uo,calculateTextDimensions:q3,cleanAndMerge:Rn,detectInit:P6t,detectDirective:vEe,isSubstringInArray:B6t,interpolateToCurve:oR,calcLabelPosition:kEe,calcCardinalityPosition:$6t,calcTerminalLabelPosition:TEe,formatUrl:bEe,getStylesFromArray:lR,generateId:AU,random:_U,runFunc:F6t,entityDecode:W6t,insertTitle:H6t,isLabelCoordinateInPath:EEe,parseFontSize:Zl,InitIDGenerator:V6t},SEe=b(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){let n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"\uFB02\xB0\xB0"+n+"\xB6\xDF":"\uFB02\xB0"+n+"\xB6\xDF"}),t},"encodeEntities"),$c=b(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),zf=b((e,t,{counter:r=0,prefix:n,suffix:i},a)=>a||`${n?`${n}_`:""}${e}_${t}_${r}${i?`_${i}`:""}`,"getEdgeId");b(es,"handleUndefinedAttr");b(EEe,"isLabelCoordinateInPath")});async function V3(e,t){let r=e.getElementsByTagName("img");if(!r||r.length===0)return;let n=t.replace(/]*>/g,"").trim()==="";await Promise.all([...r].map(i=>new Promise(a=>{function s(){if(i.style.display="flex",i.style.flexDirection="column",n){let o=Be().fontSize?Be().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[u=Lr.fontSize]=Zl(o),h=u*l+"px";i.style.minWidth=h,i.style.maxWidth=h}else i.style.width="100%";a(i)}b(s,"setupImage"),setTimeout(()=>{i.complete&&s()}),i.addEventListener("error",s),i.addEventListener("load",s)})))}var yh,ho=W(()=>{Sn();_r();hr();yh=b(({flowchart:e})=>{let t=e?.subGraphTitleMargin?.top??0,r=e?.subGraphTitleMargin?.bottom??0,n=t+r;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins");b(V3,"configureLabelImages")});var U6t,h4,RU,AEe,uR=W(()=>{U6t=Object.freeze({left:0,top:0,width:16,height:16}),h4=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),RU=Object.freeze({...U6t,...h4}),AEe=Object.freeze({...RU,body:"",hidden:!1})});var Y6t,_Ee,REe=W(()=>{uR();Y6t=Object.freeze({width:null,height:null}),_Ee=Object.freeze({...Y6t,...h4})});var LU,hR,LEe=W(()=>{LU=(e,t,r,n="")=>{let i=e.split(":");if(e.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;n=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let o=i.pop(),l=i.pop(),u={provider:i.length>0?i[0]:n,prefix:l,name:o};return t&&!hR(u)?null:u}let a=i[0],s=a.split("-");if(s.length>1){let o={provider:n,prefix:s.shift(),name:s.join("-")};return t&&!hR(o)?null:o}if(r&&n===""){let o={provider:n,prefix:"",name:a};return t&&!hR(o,r)?null:o}return null},hR=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1});function IEe(e,t){let r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);let n=((e.rotate||0)+(t.rotate||0))%4;return n&&(r.rotate=n),r}var MEe=W(()=>{});function IU(e,t){let r=IEe(e,t);for(let n in AEe)n in h4?n in e&&!(n in r)&&(r[n]=h4[n]):n in t?r[n]=t[n]:n in e&&(r[n]=e[n]);return r}var NEe=W(()=>{uR();MEe()});function DEe(e,t){let r=e.icons,n=e.aliases||Object.create(null),i=Object.create(null);function a(s){if(r[s])return i[s]=[];if(!(s in i)){i[s]=null;let o=n[s]&&n[s].parent,l=o&&a(o);l&&(i[s]=[o].concat(l))}return i[s]}return(t||Object.keys(r).concat(Object.keys(n))).forEach(a),i}var OEe=W(()=>{});function PEe(e,t,r){let n=e.icons,i=e.aliases||Object.create(null),a={};function s(o){a=IU(n[o]||i[o],a)}return s(t),r.forEach(s),IU(e,a)}function MU(e,t){if(e.icons[t])return PEe(e,t,[]);let r=DEe(e,[t])[t];return r?PEe(e,t,r):null}var BEe=W(()=>{NEe();OEe()});function NU(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;let n=e.split(X6t);if(n===null||!n.length)return e;let i=[],a=n.shift(),s=j6t.test(a);for(;;){if(s){let o=parseFloat(a);isNaN(o)?i.push(a):i.push(Math.ceil(o*t*r)/r)}else i.push(a);if(a=n.shift(),a===void 0)return i.join("");s=!s}}var X6t,j6t,FEe=W(()=>{X6t=/(-?[0-9.]*[0-9]+[0-9.]*)/g,j6t=/^-?[0-9.]*[0-9]+[0-9.]*$/g});function K6t(e,t="defs"){let r="",n=e.indexOf("<"+t);for(;n>=0;){let i=e.indexOf(">",n),a=e.indexOf("",a);if(s===-1)break;r+=e.slice(i+1,a).trim(),e=e.slice(0,n).trim()+e.slice(s+1)}return{defs:r,content:e}}function Z6t(e,t){return e?""+e+""+t:t}function $Ee(e,t,r){let n=K6t(e);return Z6t(n.defs,t+n.content+r)}var zEe=W(()=>{});function DU(e,t){let r={...RU,...e},n={..._Ee,...t},i={left:r.left,top:r.top,width:r.width,height:r.height},a=r.body;[r,n].forEach(g=>{let y=[],v=g.hFlip,x=g.vFlip,w=g.rotate;v?x?w+=2:(y.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),y.push("scale(-1 1)"),i.top=i.left=0):x&&(y.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),y.push("scale(1 -1)"),i.top=i.left=0);let C;switch(w<0&&(w-=Math.floor(w/4)*4),w=w%4,w){case 1:C=i.height/2+i.top,y.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:y.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:C=i.width/2+i.left,y.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}w%2===1&&(i.left!==i.top&&(C=i.left,i.left=i.top,i.top=C),i.width!==i.height&&(C=i.width,i.width=i.height,i.height=C)),y.length&&(a=$Ee(a,'',""))});let s=n.width,o=n.height,l=i.width,u=i.height,h,f;s===null?(f=o===null?"1em":o==="auto"?u:o,h=NU(f,l/u)):(h=s==="auto"?l:s,f=o===null?NU(h,u/l):o==="auto"?u:o);let d={},p=(g,y)=>{Q6t(y)||(d[g]=y.toString())};p("width",h),p("height",f);let m=[i.left,i.top,l,u];return d.viewBox=m.join(" "),{attributes:d,viewBox:m,body:a}}var Q6t,GEe=W(()=>{uR();REe();FEe();zEe();Q6t=e=>e==="unset"||e==="undefined"||e==="none"});function eEt(e){e=e.replace(/[0-9]+$/,"")||"a";let t=qEe.get(e)||0;return qEe.set(e,t+1),t?`${e}${t}`:e}function OU(e){let t=[],r;for(;r=J6t.exec(e);)t.push(r[1]);if(!t.length)return e;let n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(i=>{let a=eEt(i),s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+s+')([")]|\\.[a-z])',"g"),"$1"+a+n+"$3")}),e=e.replace(new RegExp(n,"g"),""),e}var J6t,qEe,VEe=W(()=>{J6t=/\sid="(\S+)"/g,qEe=new Map});function PU(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(let n in t)r+=" "+n+'="'+t[n]+'"';return'"+e+""}var WEe=W(()=>{});var HEe=W(()=>{LEe();BEe();GEe();VEe();WEe()});var FU,BU,UEe,f4,YEe,XEe,zc,ts=W(()=>{_r();Rr();hr();HEe();FU={body:'?',height:80,width:80},BU=new Map,UEe=new Map,f4=b(e=>{for(let t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(se.debug("Registering icon pack:",t.name),"loader"in t)UEe.set(t.name,t.loader);else if("icons"in t)BU.set(t.name,t.icons);else throw se.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),YEe=b(async(e,t)=>{let r=LU(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);let n=r.prefix||t;if(!n)throw new Error(`Icon name must contain a prefix: ${e}`);let i=BU.get(n);if(!i){let s=UEe.get(n);if(!s)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await s(),prefix:n},BU.set(n,i)}catch(o){throw se.error(o),new Error(`Failed to load icon set: ${r.prefix}`)}}let a=MU(i,r.name);if(!a)throw new Error(`Icon not found: ${e}`);return a},"getRegisteredIconData"),XEe=b(async e=>{try{return await YEe(e),!0}catch{return!1}},"isIconAvailable"),zc=b(async(e,t,r)=>{let n;try{n=await YEe(e,t?.fallbackPrefix)}catch(s){se.error(s),n=FU}let i=DU(n,t),a=PU(OU(i.body),{...i.attributes,...r});return Mr(a,qt())},"getIconSVG")});function qU(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function t7e(e){Uy=e}function Jn(e,t=""){let r=typeof e=="string"?e:e.source,n={replace:(i,a)=>{let s=typeof a=="string"?a:a.source;return s=s.replace(yl.caret,"$1"),r=r.replace(i,s),n},getRegex:()=>new RegExp(r,t)};return n}function Gf(e,t){if(t){if(yl.escapeTest.test(e))return e.replace(yl.escapeReplace,ZEe)}else if(yl.escapeTestNoEncode.test(e))return e.replace(yl.escapeReplaceNoEncode,ZEe);return e}function QEe(e){try{e=encodeURI(e).replace(yl.percentDecode,"%")}catch{return null}return e}function JEe(e,t){let r=e.replace(yl.findPipe,(a,s,o)=>{let l=!1,u=s;for(;--u>=0&&o[u]==="\\";)l=!l;return l?"|":" |"}),n=r.split(yl.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0?-2:-1}function e7e(e,t,r,n,i){let a=t.href,s=t.title||null,o=e[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:a,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,l}function PEt(e,t,r){let n=e.match(r.other.indentCodeCompensation);if(n===null)return t;let i=n[1];return t.split(` +`+e.slice(s+1):l+=e.slice(i),l.slice(1)}function O6e(e){for(var t="",r=0,n,i=0;i=65536?i+=2:i++)r=e4(e,i),n=Vo[r],!n&&r4(r)?(t+=e[i],r>=65536&&(t+=e[i+1])):t+=n||C6e(r);return t}function P6e(e,t,r){var n="",i=e.tag,a,s,o;for(a=0,s=r.length;a"u"&&$f(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function sU(e,t,r,n){var i="",a=e.tag,s,o,l;for(s=0,o=r.length;s"u"&&$f(e,t+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=A_(e,t)),e.dump&&M3===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=a,e.dump=i||"[]"}function B6e(e,t,r){var n="",i=e.tag,a=Object.keys(r),s,o,l,u,h;for(s=0,o=a.length;s1024&&(h+="? "),h+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),$f(e,t,u,!1,!1)&&(h+=e.dump,n+=h));e.tag=i,e.dump="{"+n+"}"}function F6e(e,t,r,n){var i="",a=e.tag,s=Object.keys(r),o,l,u,h,f,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Zl("sortKeys must be a boolean or a function");for(o=0,l=s.length;o1024,f&&(e.dump&&M3===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,f&&(d+=A_(e,t)),$f(e,t+1,h,!0,f)&&(e.dump&&M3===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,i+=d));e.tag=a,e.dump=i||"{}"}function oU(e,t,r){var n,i,a,s,o,l;for(i=r?e.explicitTypes:e.implicitTypes,a=0,s=i.length;a tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function $f(e,t,r,n,i,a,s){e.tag=null,e.dump=r,oU(e,r,!1)||oU(e,r,!0);var o=g6e.call(e.dump),l=n,u;n&&(n=e.flowLevel<0||e.flowLevel>t);var h=o==="[object Object]"||o==="[object Array]",f,d;if(h&&(f=e.duplicates.indexOf(r),d=f!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(i=!1),d&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(h&&d&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),o==="[object Object]")n&&Object.keys(e.dump).length!==0?(F6e(e,t,e.dump,i),d&&(e.dump="&ref_"+f+e.dump)):(B6e(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(o==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?sU(e,t-1,e.dump,i):sU(e,t,e.dump,i),d&&(e.dump="&ref_"+f+e.dump)):(P6e(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(o==="[object String]")e.tag!=="?"&&N6e(e,e.dump,t,a,l);else{if(o==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Zl("unacceptable kind of an object to dump "+o)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function $6e(e,t){var r=[],n=[],i,a;for(__(e,r,n),i=0,a=n.length;i{hr();b(lU,"isNothing");b(nSe,"isObject");b(iSe,"toArray");b(aSe,"extend");b(sSe,"repeat");b(oSe,"isNegativeZero");TSt=lU,CSt=nSe,SSt=iSe,ESt=sSe,ASt=oSe,_St=aSe,xs={isNothing:TSt,isObject:CSt,toArray:SSt,repeat:ESt,isNegativeZero:ASt,extend:_St};b(cU,"formatError");b(t4,"YAMLException$1");t4.prototype=Object.create(Error.prototype);t4.prototype.constructor=t4;t4.prototype.toString=b(function(t){return this.name+": "+cU(this,t)},"toString");Zl=t4;b(w_,"getLine");b(k_,"padStart");b(lSe,"makeSnippet");RSt=lSe,LSt=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],ISt=["scalar","sequence","mapping"];b(cSe,"compileStyleAliases");b(uSe,"Type$1");qo=uSe;b(YH,"compileList");b(hSe,"compileMap");b(T_,"Schema$1");T_.prototype.extend=b(function(t){var r=[],n=[];if(t instanceof qo)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new Zl("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(a){if(!(a instanceof qo))throw new Zl("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Zl("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Zl("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof qo))throw new Zl("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(T_.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=YH(i,"implicit"),i.compiledExplicit=YH(i,"explicit"),i.compiledTypeMap=hSe(i.compiledImplicit,i.compiledExplicit),i},"extend");MSt=T_,NSt=new qo("tag:yaml.org,2002:str",{kind:"scalar",construct:b(function(e){return e!==null?e:""},"construct")}),DSt=new qo("tag:yaml.org,2002:seq",{kind:"sequence",construct:b(function(e){return e!==null?e:[]},"construct")}),OSt=new qo("tag:yaml.org,2002:map",{kind:"mapping",construct:b(function(e){return e!==null?e:{}},"construct")}),PSt=new MSt({explicit:[NSt,DSt,OSt]});b(fSe,"resolveYamlNull");b(dSe,"constructYamlNull");b(pSe,"isNull");BSt=new qo("tag:yaml.org,2002:null",{kind:"scalar",resolve:fSe,construct:dSe,predicate:pSe,represent:{canonical:b(function(){return"~"},"canonical"),lowercase:b(function(){return"null"},"lowercase"),uppercase:b(function(){return"NULL"},"uppercase"),camelcase:b(function(){return"Null"},"camelcase"),empty:b(function(){return""},"empty")},defaultStyle:"lowercase"});b(mSe,"resolveYamlBoolean");b(gSe,"constructYamlBoolean");b(ySe,"isBoolean");FSt=new qo("tag:yaml.org,2002:bool",{kind:"scalar",resolve:mSe,construct:gSe,predicate:ySe,represent:{lowercase:b(function(e){return e?"true":"false"},"lowercase"),uppercase:b(function(e){return e?"TRUE":"FALSE"},"uppercase"),camelcase:b(function(e){return e?"True":"False"},"camelcase")},defaultStyle:"lowercase"});b(vSe,"isHexCode");b(xSe,"isOctCode");b(bSe,"isDecCode");b(wSe,"resolveYamlInteger");b(kSe,"constructYamlInteger");b(TSe,"isInteger");$St=new qo("tag:yaml.org,2002:int",{kind:"scalar",resolve:wSe,construct:kSe,predicate:TSe,represent:{binary:b(function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},"binary"),octal:b(function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},"octal"),decimal:b(function(e){return e.toString(10)},"decimal"),hexadecimal:b(function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),zSt=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");b(CSe,"resolveYamlFloat");b(SSe,"constructYamlFloat");GSt=/^[-+]?[0-9]+e/;b(ESe,"representYamlFloat");b(ASe,"isFloat");qSt=new qo("tag:yaml.org,2002:float",{kind:"scalar",resolve:CSe,construct:SSe,predicate:ASe,represent:ESe,defaultStyle:"lowercase"}),_Se=PSt.extend({implicit:[BSt,FSt,$St,qSt]}),VSt=_Se,RSe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),LSe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");b(ISe,"resolveYamlTimestamp");b(MSe,"constructYamlTimestamp");b(NSe,"representYamlTimestamp");WSt=new qo("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:ISe,construct:MSe,instanceOf:Date,represent:NSe});b(DSe,"resolveYamlMerge");HSt=new qo("tag:yaml.org,2002:merge",{kind:"scalar",resolve:DSe}),uU=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= +\r`;b(OSe,"resolveYamlBinary");b(PSe,"constructYamlBinary");b(BSe,"representYamlBinary");b(FSe,"isBinary");USt=new qo("tag:yaml.org,2002:binary",{kind:"scalar",resolve:OSe,construct:PSe,predicate:FSe,represent:BSe}),YSt=Object.prototype.hasOwnProperty,XSt=Object.prototype.toString;b($Se,"resolveYamlOmap");b(zSe,"constructYamlOmap");jSt=new qo("tag:yaml.org,2002:omap",{kind:"sequence",resolve:$Se,construct:zSe}),KSt=Object.prototype.toString;b(GSe,"resolveYamlPairs");b(qSe,"constructYamlPairs");ZSt=new qo("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:GSe,construct:qSe}),QSt=Object.prototype.hasOwnProperty;b(VSe,"resolveYamlSet");b(WSe,"constructYamlSet");JSt=new qo("tag:yaml.org,2002:set",{kind:"mapping",resolve:VSe,construct:WSe}),HSe=VSt.extend({implicit:[WSt,HSt],explicit:[USt,jSt,ZSt,JSt]}),Hm=Object.prototype.hasOwnProperty,C_=1,USe=2,YSe=3,S_=4,UH=1,e6t=2,tSe=3,t6t=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,r6t=/[\x85\u2028\u2029]/,n6t=/[,\[\]\{\}]/,XSe=/^(?:!|!!|![a-z\-]+!)$/i,jSe=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;b(XH,"_class");b(gh,"is_EOL");b(Wm,"is_WHITE_SPACE");b(yl,"is_WS_OR_EOL");b(Fy,"is_FLOW_INDICATOR");b(KSe,"fromHexCode");b(ZSe,"escapedHexLen");b(QSe,"fromDecimalCode");b(jH,"simpleEscapeSequence");b(JSe,"charFromCodepoint");b(hU,"setProperty");e6e=new Array(256),t6e=new Array(256);for(By=0;By<256;By++)e6e[By]=jH(By)?1:0,t6e[By]=jH(By);b(r6e,"State$1");b(fU,"generateError");b(Sr,"throwError");b(I3,"throwWarning");rSe={YAML:b(function(t,r,n){var i,a,s;t.version!==null&&Sr(t,"duplication of %YAML directive"),n.length!==1&&Sr(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Sr(t,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&Sr(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&I3(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:b(function(t,r,n){var i,a;n.length!==2&&Sr(t,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],XSe.test(i)||Sr(t,"ill-formed tag handle (first argument) of the TAG directive"),Hm.call(t.tagMap,i)&&Sr(t,'there is a previously declared suffix for "'+i+'" tag handle'),jSe.test(a)||Sr(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{Sr(t,"tag prefix is malformed: "+a)}t.tagMap[i]=a},"handleTagDirective")};b(E0,"captureSegment");b(KH,"mergeMappings");b($y,"storeMappingPair");b(R_,"readLineBreak");b(Ga,"skipSeparationSpace");b(O3,"testDocumentSeparator");b(L_,"writeFoldedLines");b(n6e,"readPlainScalar");b(i6e,"readSingleQuotedScalar");b(a6e,"readDoubleQuotedScalar");b(s6e,"readFlowCollection");b(o6e,"readBlockScalar");b(ZH,"readBlockSequence");b(l6e,"readBlockMapping");b(c6e,"readTagProperty");b(u6e,"readAnchorProperty");b(h6e,"readAlias");b(zy,"composeNode");b(f6e,"readDocument");b(dU,"loadDocuments");b(d6e,"loadAll$1");b(p6e,"load$1");i6t=d6e,a6t=p6e,m6e={loadAll:i6t,load:a6t},g6e=Object.prototype.toString,y6e=Object.prototype.hasOwnProperty,pU=65279,s6t=9,M3=10,o6t=13,l6t=32,c6t=33,u6t=34,QH=35,h6t=37,f6t=38,d6t=39,p6t=42,v6e=44,m6t=45,E_=58,g6t=61,y6t=62,v6t=63,x6t=64,x6e=91,b6e=93,b6t=96,w6e=123,w6t=124,k6e=125,Vo={};Vo[0]="\\0";Vo[7]="\\a";Vo[8]="\\b";Vo[9]="\\t";Vo[10]="\\n";Vo[11]="\\v";Vo[12]="\\f";Vo[13]="\\r";Vo[27]="\\e";Vo[34]='\\"';Vo[92]="\\\\";Vo[133]="\\N";Vo[160]="\\_";Vo[8232]="\\L";Vo[8233]="\\P";k6t=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],T6t=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;b(T6e,"compileStyleMap");b(C6e,"encodeHex");C6t=1,N3=2;b(S6e,"State");b(JH,"indentString");b(A_,"generateNextLine");b(E6e,"testImplicitResolving");b(D3,"isWhitespace");b(r4,"isPrintable");b(eU,"isNsCharOrWhitespace");b(tU,"isPlainSafe");b(A6e,"isPlainSafeFirst");b(_6e,"isPlainSafeLast");b(e4,"codePointAt");b(mU,"needIndentIndicator");R6e=1,rU=2,L6e=3,I6e=4,Jb=5;b(M6e,"chooseScalarStyle");b(N6e,"writeScalar");b(nU,"blockHeader");b(iU,"dropEndingNewline");b(D6e,"foldString");b(aU,"foldLine");b(O6e,"escapeString");b(P6e,"writeFlowSequence");b(sU,"writeBlockSequence");b(B6e,"writeFlowMapping");b(F6e,"writeBlockMapping");b(oU,"detectType");b($f,"writeNode");b($6e,"getDuplicateReferences");b(__,"inspectNode");b(z6e,"dump$1");S6t=z6e,E6t={dump:S6t};b(I_,"renamed");Um=_Se,Ym=m6e.load,Mzr=m6e.loadAll,Nzr=E6t.dump,Dzr=I_("safeLoad","load"),Ozr=I_("safeLoadAll","loadAll"),Pzr=I_("safeDump","dump");});var G6e,qy,A6t,P3,ar,cr,_6t,co=W(()=>{_r();hr();G6e=b(e=>{let{handDrawnSeed:t}=Be();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),qy=b(e=>{let t=A6t([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),A6t=b(e=>{let t=new Map;return e.forEach(r=>{let[n,i]=r.split(":");t.set(n.trim(),i?.trim())}),t},"styles2Map"),P3=b(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),ar=b(e=>{let{stylesArray:t}=qy(e),r=[],n=[],i=[],a=[];return t.forEach(s=>{let o=s[0];P3(o)?r.push(s.join(":")+" !important"):(n.push(s.join(":")+" !important"),o.includes("stroke")&&i.push(s.join(":")+" !important"),o==="fill"&&a.push(s.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:t,borderStyles:i,backgroundStyles:a}},"styles2String"),cr=b((e,t)=>{let{themeVariables:r,handDrawnSeed:n}=Be(),{nodeBorder:i,mainBkg:a}=r,{stylesMap:s}=qy(e);return Object.assign({roughness:.7,fill:s.get("fill")||a,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:s.get("stroke")||i,seed:n,strokeWidth:s.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:_6t(s.get("stroke-dasharray"))},t)},"userNodeOverrides"),_6t=b(e=>{if(!e)return[0,0];let t=e.trim().split(/\s+/).map(Number);if(t.length===1){let i=isNaN(t[0])?0:t[0];return[i,i]}let r=isNaN(t[0])?0:t[0],n=isNaN(t[1])?0:t[1];return[r,n]},"getStrokeDashArray")});var q6e=Jo(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.BLANK_URL=Fs.relativeFirstCharacters=Fs.whitespaceEscapeCharsRegex=Fs.urlSchemeRegex=Fs.ctrlCharactersRegex=Fs.htmlCtrlEntityRegex=Fs.htmlEntitiesRegex=Fs.invalidProtocolRegex=void 0;Fs.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im;Fs.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g;Fs.htmlCtrlEntityRegex=/&(newline|tab);/gi;Fs.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;Fs.urlSchemeRegex=/^.+(:|:)/gim;Fs.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;Fs.relativeFirstCharacters=[".","/"];Fs.BLANK_URL="about:blank"});var n4=Jo(gU=>{"use strict";Object.defineProperty(gU,"__esModule",{value:!0});gU.sanitizeUrl=M6t;var Wo=q6e();function R6t(e){return Wo.relativeFirstCharacters.indexOf(e[0])>-1}function L6t(e){var t=e.replace(Wo.ctrlCharactersRegex,"");return t.replace(Wo.htmlEntitiesRegex,function(r,n){return String.fromCharCode(n)})}function I6t(e){return URL.canParse(e)}function V6e(e){try{return decodeURIComponent(e)}catch{return e}}function M6t(e){if(!e)return Wo.BLANK_URL;var t,r=V6e(e.trim());do r=L6t(r).replace(Wo.htmlCtrlEntityRegex,"").replace(Wo.ctrlCharactersRegex,"").replace(Wo.whitespaceEscapeCharsRegex,"").trim(),r=V6e(r),t=r.match(Wo.ctrlCharactersRegex)||r.match(Wo.htmlEntitiesRegex)||r.match(Wo.htmlCtrlEntityRegex)||r.match(Wo.whitespaceEscapeCharsRegex);while(t&&t.length>0);var n=r;if(!n)return Wo.BLANK_URL;if(R6t(n))return n;var i=n.trimStart(),a=i.match(Wo.urlSchemeRegex);if(!a)return n;var s=a[0].toLowerCase().trim();if(Wo.invalidProtocolRegex.test(s))return Wo.BLANK_URL;var o=i.replace(/\\/g,"/");if(s==="mailto:"||s.includes("://"))return o;if(s==="http:"||s==="https:"){if(!I6t(o))return Wo.BLANK_URL;var l=new URL(o);return l.protocol=l.protocol.toLowerCase(),l.hostname=l.hostname.toLowerCase(),l.toString()}return o}});function W6e(e){return Array.isArray(e)}var H6e=W(()=>{});function M_(e){if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){let r=e[Symbol.toStringTag];return r==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var U6e=W(()=>{});function Y6e(){}var X6e=W(()=>{});function N_(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var yU=W(()=>{});function A0(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var B3=W(()=>{});var D_,i4,a4,s4,o4,O_,P_,B_,F_,$_,z_,G_,q_,V_,W_,H_,U_,Y_,X_,j_,K_,Z_,Q_=W(()=>{D_="[object RegExp]",i4="[object String]",a4="[object Number]",s4="[object Boolean]",o4="[object Arguments]",O_="[object Symbol]",P_="[object Date]",B_="[object Map]",F_="[object Set]",$_="[object Array]",z_="[object ArrayBuffer]",G_="[object Object]",q_="[object DataView]",V_="[object Uint8Array]",W_="[object Uint8ClampedArray]",H_="[object Uint16Array]",U_="[object Uint32Array]",Y_="[object Int8Array]",X_="[object Int16Array]",j_="[object Int32Array]",K_="[object Float32Array]",Z_="[object Float64Array]"});var vU,j6e=W(()=>{vU=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()});function l4(e){return typeof vU.Buffer<"u"&&vU.Buffer.isBuffer(e)}var J_=W(()=>{j6e()});function K6e(e){return Number.isSafeInteger(e)&&e>=0}var Z6e=W(()=>{});function eR(e){return e!=null&&typeof e!="function"&&K6e(e.length)}var xU=W(()=>{Z6e()});function Q6e(e){return e==="__proto__"}var J6e=W(()=>{});function Xm(e){return e==null||typeof e!="object"&&typeof e!="function"}var F3=W(()=>{});function c4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}var tR=W(()=>{});function eEe(e,t){return u4(e,void 0,e,new Map,t)}function u4(e,t,r,n=new Map,i=void 0){let a=i?.(e,t,r,n);if(a!==void 0)return a;if(Xm(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){let s=new Array(e.length);n.set(e,s);for(let o=0;o{F3();tR();yU();B3();Q_();J_()});function rEe(e,t){return eEe(e,(r,n,i,a)=>{let s=t?.(r,n,i,a);if(s!==void 0)return s;if(typeof e=="object"){if(A0(e)==="[object Object]"&&typeof e.constructor!="function"){let o={};return a.set(e,o),Au(o,e,i,a),o}switch(Object.prototype.toString.call(e)){case a4:case i4:case s4:{let o=new e.constructor(e?.valueOf());return Au(o,e),o}case o4:{let o={};return Au(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}var nEe=W(()=>{B3();Q_();tEe()});function bU(e){return rEe(e)}var iEe=W(()=>{nEe()});function $3(e){return e!==null&&typeof e=="object"&&A0(e)==="[object Arguments]"}var wU=W(()=>{B3()});function z3(e){return typeof e=="object"&&e!==null}var kU=W(()=>{});function aEe(e){return z3(e)&&eR(e)}var sEe=W(()=>{xU();kU()});function Vy(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");let r=function(...n){let i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);let s=e.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(Vy.Cache||Map),r}var oEe=W(()=>{Vy.Cache=Map});function jm(e){return c4(e)}var rR=W(()=>{tR()});function lEe(e){let t=e?.constructor;return e===(typeof t=="function"?t.prototype:Object.prototype)}var cEe=W(()=>{});function CU(e){if(Xm(e))return e;let t=A0(e);if(!D6t(e))return{};if(W6e(e)){let n=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(n.index=e.index,n.input=e.input),n}if(jm(e)){let n=e,i=n.constructor;return new i(n.buffer,n.byteOffset,n.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){let n=e,i=n.buffer,a=n.byteOffset,s=n.byteLength,o=new ArrayBuffer(s),l=new Uint8Array(i,a,s);return new Uint8Array(o).set(l),new DataView(o)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){let n=e.constructor,i=new n(e.valueOf());return t==="[object String]"?P6t(i,e):TU(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){let n=e,i=new RegExp(n.source,n.flags);return i.lastIndex=n.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){let n=e,i=new Map;return n.forEach((a,s)=>{i.set(s,a)}),i}if(t==="[object Set]"){let n=e,i=new Set;return n.forEach(a=>{i.add(a)}),i}if(t==="[object Arguments]"){let n=e,i={};return TU(i,n),i.length=n.length,i[Symbol.iterator]=n[Symbol.iterator],i}let r={};return B6t(r,e),TU(r,e),O6t(r,e),r}function D6t(e){switch(A0(e)){case o4:case $_:case z_:case q_:case s4:case P_:case K_:case Z_:case Y_:case X_:case j_:case B_:case a4:case G_:case D_:case F_:case i4:case O_:case V_:case W_:case H_:case U_:return!0;default:return!1}}function TU(e,t){for(let r in t)Object.hasOwn(t,r)&&(e[r]=t[r])}function O6t(e,t){let r=Object.getOwnPropertySymbols(t);for(let n=0;n=r)&&(e[n]=t[n])}function B6t(e,t){let r=Object.getPrototypeOf(t);r!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,r)}var uEe=W(()=>{F3();B3();Q_();H6e();rR()});function hEe(e){if(Xm(e))return e;if(Array.isArray(e)||c4(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let n=new r(e);return n.lastIndex=e.lastIndex,n}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let n;return e instanceof AggregateError?n=new r(e.errors,e.message,{cause:e.cause}):n=new r(e.message,{cause:e.cause}),n.stack=e.stack,Object.assign(n,e),n}return typeof File<"u"&&e instanceof File?new r([e],e.name,{type:e.type,lastModified:e.lastModified}):typeof e=="object"?Object.assign(Object.create(t),e):e}var fEe=W(()=>{F3();tR()});function dEe(e,...t){let r=t.slice(0,-1),n=t[t.length-1],i=e;for(let a=0;a{F3();fEe();yU();J_();J6e();U6e();iEe();wU();kU();sEe();rR()});function SU(e,...t){return dEe(e,...t,Y6e)}var mEe=W(()=>{X6e();pEe()});function iR(e){if(e==null)return!0;if(eR(e))return typeof e.splice!="function"&&typeof e!="string"&&!l4(e)&&!jm(e)&&!$3(e)?!1:e.length===0;if(typeof e=="object"||typeof e=="function"){if(e instanceof Map||e instanceof Set)return e.size===0;let t=Object.keys(e);return lEe(e)?t.filter(r=>r!=="constructor").length===0:t.length===0}return!0}var gEe=W(()=>{J_();xU();wU();cEe();rR()});var aR=W(()=>{oEe();uEe();mEe();gEe()});function oR(e,t){if(!e)return t;let r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return F6t[r]??t}function kEe(e,t){let r=e.trim();if(r)return t.securityLevel!=="loose"?(0,xEe.sanitizeUrl)(r):r}function AU(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function TEe(e){let t,r=0;e.forEach(i=>{r+=AU(i,t),t=i});let n=r/2;return _U(e,n)}function CEe(e){return e.length===1?e[0]:TEe(e)}function SEe(e,t,r){let n=structuredClone(r);se.info("our points",n),t!=="start_left"&&t!=="start_right"&&n.reverse();let i=25+e,a=_U(n,i),s=10+e*.5,o=Math.atan2(n[0].y-a.y,n[0].x-a.x),l={x:0,y:0};return t==="start_left"?(l.x=Math.sin(o+Math.PI)*s+(n[0].x+a.x)/2,l.y=-Math.cos(o+Math.PI)*s+(n[0].y+a.y)/2):t==="end_right"?(l.x=Math.sin(o-Math.PI)*s+(n[0].x+a.x)/2-5,l.y=-Math.cos(o-Math.PI)*s+(n[0].y+a.y)/2-5):t==="end_left"?(l.x=Math.sin(o)*s+(n[0].x+a.x)/2-5,l.y=-Math.cos(o)*s+(n[0].y+a.y)/2-5):(l.x=Math.sin(o)*s+(n[0].x+a.x)/2,l.y=-Math.cos(o)*s+(n[0].y+a.y)/2),l}function lR(e){let t="",r="";for(let n of e)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":t=t+n+";");return{style:t,labelStyle:r}}function EEe(e){let t="",r="0123456789abcdef",n=r.length;for(let i=0;iMath.round(parseFloat(a)).toString());return i.includes(r.toString())||i.includes(n.toString())}var xEe,EU,F6t,$6t,z6t,bEe,wEe,G6t,q6t,yEe,_U,V6t,vEe,RU,LU,W6t,H6t,Wy,U6t,q3,Y6t,sR,X6t,j6t,Ql,pr,AEe,$c,zf,Sn=W(()=>{_r();Rr();hr();xEe=Ro(n4(),1);fn();aR();EU="\u200B",F6t={curveBasis:Ff,curveBasisClosed:MH,curveBasisOpen:NH,curveBumpX:g3,curveBumpY:y3,curveBundle:DH,curveCardinalClosed:OH,curveCardinalOpen:BH,curveCardinal:w3,curveCatmullRomClosed:$H,curveCatmullRomOpen:zH,curveCatmullRom:C3,curveLinear:S0,curveLinearClosed:GH,curveMonotoneX:S3,curveMonotoneY:E3,curveNatural:A3,curveStep:_3,curveStepAfter:L3,curveStepBefore:R3},$6t=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,z6t=b(function(e,t){let r=bEe(e,/(?:init\b)|(?:initialize\b)/),n={};if(Array.isArray(r)){let s=r.map(o=>o.args);N5(s),n=Xi(n,[...s])}else n=r.args;if(!n)return;let i=O5(e,t),a="config";return n[a]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[a],delete n[a]),n},"detectInit"),bEe=b(function(e,t=null){try{let r=new RegExp(`[%]{2}(?![{]${$6t.source})(?=[}][%]{2}).* +`,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),se.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let n,i=[];for(;(n=_b.exec(e))!==null;)if(n.index===_b.lastIndex&&_b.lastIndex++,n&&!t||t&&n[1]?.match(t)||t&&n[2]?.match(t)){let a=n[1]?n[1]:n[2],s=n[3]?n[3].trim():n[4]?JSON.parse(n[4].trim()):null;i.push({type:a,args:s})}return i.length===0?{type:e,args:null}:i.length===1?i[0]:i}catch(r){return se.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),wEe=b(function(e){return e.replace(_b,"")},"removeDirectives"),G6t=b(function(e,t){for(let[r,n]of t.entries())if(n.match(e))return r;return-1},"isSubstringInArray");b(oR,"interpolateToCurve");b(kEe,"formatUrl");q6t=b((e,...t)=>{let r=e.split("."),n=r.length-1,i=r[n],a=window;for(let s=0;s{let r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),_U=b((e,t)=>{let r,n=t;for(let i of e){if(r){let a=AU(i,r);if(a===0)return r;if(a=1)return{x:i.x,y:i.y};if(s>0&&s<1)return{x:yEe((1-s)*r.x+s*i.x,5),y:yEe((1-s)*r.y+s*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),V6t=b((e,t,r)=>{se.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());let i=_U(t,25),a=e?10:5,s=Math.atan2(t[0].y-i.y,t[0].x-i.x),o={x:0,y:0};return o.x=Math.sin(s)*a+(t[0].x+i.x)/2,o.y=-Math.cos(s)*a+(t[0].y+i.y)/2,o},"calcCardinalityPosition");b(SEe,"calcTerminalLabelPosition");b(lR,"getStylesFromArray");vEe=0,RU=b(()=>(vEe++,"id-"+Math.random().toString(36).substr(2,12)+"-"+vEe),"generateId");b(EEe,"makeRandomHex");LU=b(e=>EEe(e.length),"random"),W6t=b(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),H6t=b(function(e,t){let r=t.text.replace(Ct.lineBreakRegex," "),[,n]=Ql(t.fontSize),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.style("text-anchor",t.anchor),i.style("font-family",t.fontFamily),i.style("font-size",n),i.style("font-weight",t.fontWeight),i.attr("fill",t.fill),t.class!==void 0&&i.attr("class",t.class);let a=i.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.attr("fill",t.fill),a.text(r),i},"drawSimpleText"),Wy=Vy((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
"},r),Ct.lineBreakRegex.test(e)))return e;let n=e.split(" ").filter(Boolean),i=[],a="";return n.forEach((s,o)=>{let l=uo(`${s} `,r),u=uo(a,r);if(l>t){let{hyphenatedStrings:d,remainingWord:p}=U6t(s,t,"-",r);i.push(a,...d),a=p}else u+l>=t?(i.push(a),a=s):a=[a,s].filter(Boolean).join(" ");o+1===n.length&&i.push(a)}),i.filter(s=>s!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),U6t=Vy((e,t,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);let i=[...e],a=[],s="";return i.forEach((o,l)=>{let u=`${s}${o}`;if(uo(u,n)>=t){let f=l+1,d=i.length===f,p=`${u}${r}`;a.push(d?u:p),s=""}else s=u}),{hyphenatedStrings:a,remainingWord:s}},(e,t,r="-",n)=>`${e}${t}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);b(G3,"calculateTextHeight");b(uo,"calculateTextWidth");q3=Vy((e,t)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=t;if(!e)return{width:0,height:0};let[,a]=Ql(r),s=["sans-serif",n],o=e.split(Ct.lineBreakRegex),l=[],u=ct("body");if(!u.remove)return{width:0,height:0,lineHeight:0};let h=u.append("svg");for(let d of s){let p=0,m={width:0,height:0,lineHeight:0};for(let g of o){let y=W6t();y.text=g||EU;let v=H6t(h,y).style("font-size",a).style("font-weight",i).style("font-family",d),x=(v._groups||v)[0][0].getBBox();if(x.width===0&&x.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,x.width)),p=Math.round(x.height),m.height+=p,m.lineHeight=Math.round(Math.max(m.lineHeight,p))}l.push(m)}h.remove();let f=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[f]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),Y6t=class{constructor(e=!1,t){this.count=0,this.count=t?t.length:0,this.next=e?()=>this.count++:()=>Date.now()}static{b(this,"InitIDGenerator")}},X6t=b(function(e){return sR=sR||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),sR.innerHTML=e,unescape(sR.textContent)},"entityDecode");b(cR,"isDetailedError");j6t=b((e,t,r,n)=>{if(!n)return;let i=e.node()?.getBBox();i&&e.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",t)},"insertTitle"),Ql=b(e=>{if(typeof e=="number")return[e,e+"px"];let t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");b(Rn,"cleanAndMerge");pr={assignWithDepth:Xi,wrapLabel:Wy,calculateTextHeight:G3,calculateTextWidth:uo,calculateTextDimensions:q3,cleanAndMerge:Rn,detectInit:z6t,detectDirective:bEe,isSubstringInArray:G6t,interpolateToCurve:oR,calcLabelPosition:CEe,calcCardinalityPosition:V6t,calcTerminalLabelPosition:SEe,formatUrl:kEe,getStylesFromArray:lR,generateId:RU,random:LU,runFunc:q6t,entityDecode:X6t,insertTitle:j6t,isLabelCoordinateInPath:_Ee,parseFontSize:Ql,InitIDGenerator:Y6t},AEe=b(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){let n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"\uFB02\xB0\xB0"+n+"\xB6\xDF":"\uFB02\xB0"+n+"\xB6\xDF"}),t},"encodeEntities"),$c=b(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),zf=b((e,t,{counter:r=0,prefix:n,suffix:i},a)=>a||`${n?`${n}_`:""}${e}_${t}_${r}${i?`_${i}`:""}`,"getEdgeId");b(es,"handleUndefinedAttr");b(_Ee,"isLabelCoordinateInPath")});async function V3(e,t){let r=e.getElementsByTagName("img");if(!r||r.length===0)return;let n=t.replace(/]*>/g,"").trim()==="";await Promise.all([...r].map(i=>new Promise(a=>{function s(){if(i.style.display="flex",i.style.flexDirection="column",n){let o=Be().fontSize?Be().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[u=Lr.fontSize]=Ql(o),h=u*l+"px";i.style.minWidth=h,i.style.maxWidth=h}else i.style.width="100%";a(i)}b(s,"setupImage"),setTimeout(()=>{i.complete&&s()}),i.addEventListener("error",s),i.addEventListener("load",s)})))}var yh,ho=W(()=>{Sn();_r();hr();yh=b(({flowchart:e})=>{let t=e?.subGraphTitleMargin?.top??0,r=e?.subGraphTitleMargin?.bottom??0,n=t+r;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins");b(V3,"configureLabelImages")});var K6t,h4,IU,REe,uR=W(()=>{K6t=Object.freeze({left:0,top:0,width:16,height:16}),h4=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),IU=Object.freeze({...K6t,...h4}),REe=Object.freeze({...IU,body:"",hidden:!1})});var Z6t,LEe,IEe=W(()=>{uR();Z6t=Object.freeze({width:null,height:null}),LEe=Object.freeze({...Z6t,...h4})});var MU,hR,MEe=W(()=>{MU=(e,t,r,n="")=>{let i=e.split(":");if(e.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;n=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let o=i.pop(),l=i.pop(),u={provider:i.length>0?i[0]:n,prefix:l,name:o};return t&&!hR(u)?null:u}let a=i[0],s=a.split("-");if(s.length>1){let o={provider:n,prefix:s.shift(),name:s.join("-")};return t&&!hR(o)?null:o}if(r&&n===""){let o={provider:n,prefix:"",name:a};return t&&!hR(o,r)?null:o}return null},hR=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1});function NEe(e,t){let r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);let n=((e.rotate||0)+(t.rotate||0))%4;return n&&(r.rotate=n),r}var DEe=W(()=>{});function NU(e,t){let r=NEe(e,t);for(let n in REe)n in h4?n in e&&!(n in r)&&(r[n]=h4[n]):n in t?r[n]=t[n]:n in e&&(r[n]=e[n]);return r}var OEe=W(()=>{uR();DEe()});function PEe(e,t){let r=e.icons,n=e.aliases||Object.create(null),i=Object.create(null);function a(s){if(r[s])return i[s]=[];if(!(s in i)){i[s]=null;let o=n[s]&&n[s].parent,l=o&&a(o);l&&(i[s]=[o].concat(l))}return i[s]}return(t||Object.keys(r).concat(Object.keys(n))).forEach(a),i}var BEe=W(()=>{});function FEe(e,t,r){let n=e.icons,i=e.aliases||Object.create(null),a={};function s(o){a=NU(n[o]||i[o],a)}return s(t),r.forEach(s),NU(e,a)}function DU(e,t){if(e.icons[t])return FEe(e,t,[]);let r=PEe(e,[t])[t];return r?FEe(e,t,r):null}var $Ee=W(()=>{OEe();BEe()});function OU(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;let n=e.split(Q6t);if(n===null||!n.length)return e;let i=[],a=n.shift(),s=J6t.test(a);for(;;){if(s){let o=parseFloat(a);isNaN(o)?i.push(a):i.push(Math.ceil(o*t*r)/r)}else i.push(a);if(a=n.shift(),a===void 0)return i.join("");s=!s}}var Q6t,J6t,zEe=W(()=>{Q6t=/(-?[0-9.]*[0-9]+[0-9.]*)/g,J6t=/^-?[0-9.]*[0-9]+[0-9.]*$/g});function eEt(e,t="defs"){let r="",n=e.indexOf("<"+t);for(;n>=0;){let i=e.indexOf(">",n),a=e.indexOf("",a);if(s===-1)break;r+=e.slice(i+1,a).trim(),e=e.slice(0,n).trim()+e.slice(s+1)}return{defs:r,content:e}}function tEt(e,t){return e?""+e+""+t:t}function GEe(e,t,r){let n=eEt(e);return tEt(n.defs,t+n.content+r)}var qEe=W(()=>{});function PU(e,t){let r={...IU,...e},n={...LEe,...t},i={left:r.left,top:r.top,width:r.width,height:r.height},a=r.body;[r,n].forEach(g=>{let y=[],v=g.hFlip,x=g.vFlip,w=g.rotate;v?x?w+=2:(y.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),y.push("scale(-1 1)"),i.top=i.left=0):x&&(y.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),y.push("scale(1 -1)"),i.top=i.left=0);let C;switch(w<0&&(w-=Math.floor(w/4)*4),w=w%4,w){case 1:C=i.height/2+i.top,y.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:y.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:C=i.width/2+i.left,y.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}w%2===1&&(i.left!==i.top&&(C=i.left,i.left=i.top,i.top=C),i.width!==i.height&&(C=i.width,i.width=i.height,i.height=C)),y.length&&(a=GEe(a,'',""))});let s=n.width,o=n.height,l=i.width,u=i.height,h,f;s===null?(f=o===null?"1em":o==="auto"?u:o,h=OU(f,l/u)):(h=s==="auto"?l:s,f=o===null?OU(h,u/l):o==="auto"?u:o);let d={},p=(g,y)=>{rEt(y)||(d[g]=y.toString())};p("width",h),p("height",f);let m=[i.left,i.top,l,u];return d.viewBox=m.join(" "),{attributes:d,viewBox:m,body:a}}var rEt,VEe=W(()=>{uR();IEe();zEe();qEe();rEt=e=>e==="unset"||e==="undefined"||e==="none"});function iEt(e){e=e.replace(/[0-9]+$/,"")||"a";let t=WEe.get(e)||0;return WEe.set(e,t+1),t?`${e}${t}`:e}function BU(e){let t=[],r;for(;r=nEt.exec(e);)t.push(r[1]);if(!t.length)return e;let n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(i=>{let a=iEt(i),s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+s+')([")]|\\.[a-z])',"g"),"$1"+a+n+"$3")}),e=e.replace(new RegExp(n,"g"),""),e}var nEt,WEe,HEe=W(()=>{nEt=/\sid="(\S+)"/g,WEe=new Map});function FU(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(let n in t)r+=" "+n+'="'+t[n]+'"';return'"+e+""}var UEe=W(()=>{});var YEe=W(()=>{MEe();$Ee();VEe();HEe();UEe()});var zU,$U,XEe,f4,jEe,KEe,zc,ts=W(()=>{_r();Rr();hr();YEe();zU={body:'?',height:80,width:80},$U=new Map,XEe=new Map,f4=b(e=>{for(let t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(se.debug("Registering icon pack:",t.name),"loader"in t)XEe.set(t.name,t.loader);else if("icons"in t)$U.set(t.name,t.icons);else throw se.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),jEe=b(async(e,t)=>{let r=MU(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);let n=r.prefix||t;if(!n)throw new Error(`Icon name must contain a prefix: ${e}`);let i=$U.get(n);if(!i){let s=XEe.get(n);if(!s)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await s(),prefix:n},$U.set(n,i)}catch(o){throw se.error(o),new Error(`Failed to load icon set: ${r.prefix}`)}}let a=DU(i,r.name);if(!a)throw new Error(`Icon not found: ${e}`);return a},"getRegisteredIconData"),KEe=b(async e=>{try{return await jEe(e),!0}catch{return!1}},"isIconAvailable"),zc=b(async(e,t,r)=>{let n;try{n=await jEe(e,t?.fallbackPrefix)}catch(s){se.error(s),n=zU}let i=PU(n,t),a=FU(BU(i.body),{...i.attributes,...r});return Mr(a,qt())},"getIconSVG")});function WU(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n7e(e){Uy=e}function Jn(e,t=""){let r=typeof e=="string"?e:e.source,n={replace:(i,a)=>{let s=typeof a=="string"?a:a.source;return s=s.replace(vl.caret,"$1"),r=r.replace(i,s),n},getRegex:()=>new RegExp(r,t)};return n}function Gf(e,t){if(t){if(vl.escapeTest.test(e))return e.replace(vl.escapeReplace,JEe)}else if(vl.escapeTestNoEncode.test(e))return e.replace(vl.escapeReplaceNoEncode,JEe);return e}function e7e(e){try{e=encodeURI(e).replace(vl.percentDecode,"%")}catch{return null}return e}function t7e(e,t){let r=e.replace(vl.findPipe,(a,s,o)=>{let l=!1,u=s;for(;--u>=0&&o[u]==="\\";)l=!l;return l?"|":" |"}),n=r.split(vl.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0?-2:-1}function r7e(e,t,r,n,i){let a=t.href,s=t.title||null,o=e[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:a,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,l}function zEt(e,t,r){let n=e.match(r.other.indentCodeCompensation);if(n===null)return t;let i=n[1];return t.split(` `).map(a=>{let s=a.match(r.other.beginningSpace);if(s===null)return a;let[o]=s;return o.length>=i.length?a.slice(i.length):a}).join(` -`)}function fi(e,t){return Hy.parse(e,t)}var Uy,Y3,tEt,yl,rEt,nEt,iEt,X3,aEt,VU,r7e,n7e,sEt,WU,oEt,HU,lEt,cEt,gR,UU,uEt,i7e,hEt,YU,jEe,fEt,dEt,pEt,mEt,a7e,gEt,yR,XU,s7e,yEt,o7e,vEt,xEt,bEt,l7e,wEt,kEt,c7e,TEt,CEt,SEt,EEt,AEt,_Et,REt,dR,LEt,u7e,h7e,IEt,KEe,jU,MEt,$U,NEt,fR,W3,DEt,ZEe,pR,vh,mR,KU,xh,U3,BEt,Hy,Xqr,jqr,Kqr,Zqr,Qqr,Jqr,eVr,f7e=W(()=>{Uy=qU();Y3={exec:()=>null};tEt=(()=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},rEt=/^(?:[ \t]*(?:\n|$))+/,nEt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,iEt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,X3=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,aEt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,VU=/(?:[*+-]|\d{1,9}[.)])/,r7e=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,n7e=Jn(r7e).replace(/bull/g,VU).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),sEt=Jn(r7e).replace(/bull/g,VU).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),WU=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,oEt=/^[^\n]+/,HU=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,lEt=Jn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",HU).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cEt=Jn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,VU).getRegex(),gR="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",UU=/|$))/,uEt=Jn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",UU).replace("tag",gR).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),i7e=Jn(WU).replace("hr",X3).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gR).getRegex(),hEt=Jn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",i7e).getRegex(),YU={blockquote:hEt,code:nEt,def:lEt,fences:iEt,heading:aEt,hr:X3,html:uEt,lheading:n7e,list:cEt,newline:rEt,paragraph:i7e,table:Y3,text:oEt},jEe=Jn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",X3).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gR).getRegex(),fEt={...YU,lheading:sEt,table:jEe,paragraph:Jn(WU).replace("hr",X3).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",jEe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gR).getRegex()},dEt={...YU,html:Jn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",UU).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Y3,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Jn(WU).replace("hr",X3).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",n7e).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},pEt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mEt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,a7e=/^( {2,}|\\)\n(?!\s*$)/,gEt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",tEt?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),l7e=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,wEt=Jn(l7e,"u").replace(/punct/g,yR).getRegex(),kEt=Jn(l7e,"u").replace(/punct/g,o7e).getRegex(),c7e="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",TEt=Jn(c7e,"gu").replace(/notPunctSpace/g,s7e).replace(/punctSpace/g,XU).replace(/punct/g,yR).getRegex(),CEt=Jn(c7e,"gu").replace(/notPunctSpace/g,xEt).replace(/punctSpace/g,vEt).replace(/punct/g,o7e).getRegex(),SEt=Jn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,s7e).replace(/punctSpace/g,XU).replace(/punct/g,yR).getRegex(),EEt=Jn(/\\(punct)/,"gu").replace(/punct/g,yR).getRegex(),AEt=Jn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_Et=Jn(UU).replace("(?:-->|$)","-->").getRegex(),REt=Jn("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",_Et).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),dR=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,LEt=Jn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",dR).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),u7e=Jn(/^!?\[(label)\]\[(ref)\]/).replace("label",dR).replace("ref",HU).getRegex(),h7e=Jn(/^!?\[(ref)\](?:\[\])?/).replace("ref",HU).getRegex(),IEt=Jn("reflink|nolink(?!\\()","g").replace("reflink",u7e).replace("nolink",h7e).getRegex(),KEe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,jU={_backpedal:Y3,anyPunctuation:EEt,autolink:AEt,blockSkip:bEt,br:a7e,code:mEt,del:Y3,emStrongLDelim:wEt,emStrongRDelimAst:TEt,emStrongRDelimUnd:SEt,escape:pEt,link:LEt,nolink:h7e,punctuation:yEt,reflink:u7e,reflinkSearch:IEt,tag:REt,text:gEt,url:Y3},MEt={...jU,link:Jn(/^!?\[(label)\]\((.*?)\)/).replace("label",dR).getRegex(),reflink:Jn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",dR).getRegex()},$U={...jU,emStrongRDelimAst:CEt,emStrongLDelim:kEt,url:Jn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",KEe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Jn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},ZEe=e=>DEt[e];pR=class{options;rules;lexer;constructor(e){this.options=e||Uy}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:H3(r,` -`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],n=PEt(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let n=H3(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:H3(t[0],` +`)}function fi(e,t){return Hy.parse(e,t)}var Uy,Y3,aEt,vl,sEt,oEt,lEt,X3,cEt,HU,i7e,a7e,uEt,UU,hEt,YU,fEt,dEt,gR,XU,pEt,s7e,mEt,jU,ZEe,gEt,yEt,vEt,xEt,o7e,bEt,yR,KU,l7e,wEt,c7e,kEt,TEt,CEt,u7e,SEt,EEt,h7e,AEt,_Et,REt,LEt,IEt,MEt,NEt,dR,DEt,f7e,d7e,OEt,QEe,ZU,PEt,GU,BEt,fR,W3,FEt,JEe,pR,vh,mR,QU,xh,U3,GEt,Hy,Jqr,eVr,tVr,rVr,nVr,iVr,aVr,p7e=W(()=>{Uy=WU();Y3={exec:()=>null};aEt=(()=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},sEt=/^(?:[ \t]*(?:\n|$))+/,oEt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lEt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,X3=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,cEt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,HU=/(?:[*+-]|\d{1,9}[.)])/,i7e=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,a7e=Jn(i7e).replace(/bull/g,HU).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),uEt=Jn(i7e).replace(/bull/g,HU).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),UU=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,hEt=/^[^\n]+/,YU=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,fEt=Jn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",YU).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),dEt=Jn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,HU).getRegex(),gR="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",XU=/|$))/,pEt=Jn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",XU).replace("tag",gR).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),s7e=Jn(UU).replace("hr",X3).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gR).getRegex(),mEt=Jn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",s7e).getRegex(),jU={blockquote:mEt,code:oEt,def:fEt,fences:lEt,heading:cEt,hr:X3,html:pEt,lheading:a7e,list:dEt,newline:sEt,paragraph:s7e,table:Y3,text:hEt},ZEe=Jn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",X3).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gR).getRegex(),gEt={...jU,lheading:uEt,table:ZEe,paragraph:Jn(UU).replace("hr",X3).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ZEe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gR).getRegex()},yEt={...jU,html:Jn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",XU).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Y3,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Jn(UU).replace("hr",X3).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",a7e).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vEt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xEt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,o7e=/^( {2,}|\\)\n(?!\s*$)/,bEt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",aEt?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),u7e=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,SEt=Jn(u7e,"u").replace(/punct/g,yR).getRegex(),EEt=Jn(u7e,"u").replace(/punct/g,c7e).getRegex(),h7e="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AEt=Jn(h7e,"gu").replace(/notPunctSpace/g,l7e).replace(/punctSpace/g,KU).replace(/punct/g,yR).getRegex(),_Et=Jn(h7e,"gu").replace(/notPunctSpace/g,TEt).replace(/punctSpace/g,kEt).replace(/punct/g,c7e).getRegex(),REt=Jn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,l7e).replace(/punctSpace/g,KU).replace(/punct/g,yR).getRegex(),LEt=Jn(/\\(punct)/,"gu").replace(/punct/g,yR).getRegex(),IEt=Jn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),MEt=Jn(XU).replace("(?:-->|$)","-->").getRegex(),NEt=Jn("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",MEt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),dR=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,DEt=Jn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",dR).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),f7e=Jn(/^!?\[(label)\]\[(ref)\]/).replace("label",dR).replace("ref",YU).getRegex(),d7e=Jn(/^!?\[(ref)\](?:\[\])?/).replace("ref",YU).getRegex(),OEt=Jn("reflink|nolink(?!\\()","g").replace("reflink",f7e).replace("nolink",d7e).getRegex(),QEe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ZU={_backpedal:Y3,anyPunctuation:LEt,autolink:IEt,blockSkip:CEt,br:o7e,code:xEt,del:Y3,emStrongLDelim:SEt,emStrongRDelimAst:AEt,emStrongRDelimUnd:REt,escape:vEt,link:DEt,nolink:d7e,punctuation:wEt,reflink:f7e,reflinkSearch:OEt,tag:NEt,text:bEt,url:Y3},PEt={...ZU,link:Jn(/^!?\[(label)\]\((.*?)\)/).replace("label",dR).getRegex(),reflink:Jn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",dR).getRegex()},GU={...ZU,emStrongRDelimAst:_Et,emStrongLDelim:EEt,url:Jn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",QEe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Jn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},JEe=e=>FEt[e];pR=class{options;rules;lexer;constructor(e){this.options=e||Uy}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:H3(r,` +`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],n=zEt(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let n=H3(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:H3(t[0],` `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=H3(t[0],` `).split(` `),n="",i="",a=[];for(;r.length>0;){let s=!1,o=[],l;for(l=0;l=m||!d.trim())h+=` `+S.slice(m);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(f)||C.test(f)||x.test(f))break;h+=` `+d}!p&&!d.trim()&&(p=!0),u+=k+` -`,e=e.substring(k.length+1),f=S.slice(m)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(s=!0));let g=null,y;this.options.gfm&&(g=this.rules.other.listIsTask.exec(h),g&&(y=g[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:u,task:!!g,checked:y,loose:!1,text:h,tokens:[]}),i.raw+=u}let o=i.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l=0;lf.type==="space"),h=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=h}if(i.loose)for(let l=0;l({text:o,tokens:this.lexer.inline(o),header:!1,align:a.align[l]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===` -`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let a=H3(r.slice(0,-1),"\\");if((r.length-a.length)%2===0)return}else{let a=OEt(t[2],"()");if(a===-2)return;if(a>-1){let s=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(n);a&&(n=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),e7e(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[n.toLowerCase()];if(!i){let a=r[0].charAt(0);return{type:"text",raw:a,text:a}}return e7e(r,i,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!r||this.rules.inline.punctuation.exec(r))){let i=[...n[0]].length-1,a,s,o=i,l=0,u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(n=u.exec(t))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(s=[...a].length,n[3]||n[4]){o+=s;continue}else if((n[5]||n[6])&&i%3&&!((i+s)%3)){l+=s;continue}if(o-=s,o>0)continue;s=Math.min(s,s+o+l);let h=[...n[0]][0].length,f=e.slice(0,i+n.index+h+s);if(Math.min(i,s)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let d=f.slice(2,-2);return{type:"strong",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,n;return t[2]==="@"?(r=t[1],n="mailto:"+r):(r=t[1],n=r),{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,n;if(t[2]==="@")r=t[0],n="mailto:"+r;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);r=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},vh=class zU{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Uy,this.options.tokenizer=this.options.tokenizer||new pR,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:yl,block:fR.normal,inline:W3.normal};this.options.pedantic?(r.block=fR.pedantic,r.inline=W3.pedantic):this.options.gfm&&(r.block=fR.gfm,this.options.breaks?r.inline=W3.breaks:r.inline=W3.gfm),this.tokenizer.rules=r}static get rules(){return{block:fR,inline:W3}}static lex(t,r){return new zU(r).lex(t)}static lexInline(t,r){return new zU(r).inlineTokens(t)}lex(t){t=t.replace(yl.carriageReturn,` -`),this.blockTokens(t,this.tokens);for(let r=0;r(i=s.call({lexer:this},t,r))?(t=t.substring(i.raw.length),r.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let s=r.at(-1);i.raw.length===1&&s!==void 0?s.raw+=` +`,e=e.substring(k.length+1),f=S.slice(m)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(s=!0));let g=null,y;this.options.gfm&&(g=this.rules.other.listIsTask.exec(h),g&&(y=g[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:u,task:!!g,checked:y,loose:!1,text:h,tokens:[]}),i.raw+=u}let o=i.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l=0;lf.type==="space"),h=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=h}if(i.loose)for(let l=0;l({text:o,tokens:this.lexer.inline(o),header:!1,align:a.align[l]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===` +`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let a=H3(r.slice(0,-1),"\\");if((r.length-a.length)%2===0)return}else{let a=$Et(t[2],"()");if(a===-2)return;if(a>-1){let s=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(n);a&&(n=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),r7e(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[n.toLowerCase()];if(!i){let a=r[0].charAt(0);return{type:"text",raw:a,text:a}}return r7e(r,i,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!r||this.rules.inline.punctuation.exec(r))){let i=[...n[0]].length-1,a,s,o=i,l=0,u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(n=u.exec(t))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(s=[...a].length,n[3]||n[4]){o+=s;continue}else if((n[5]||n[6])&&i%3&&!((i+s)%3)){l+=s;continue}if(o-=s,o>0)continue;s=Math.min(s,s+o+l);let h=[...n[0]][0].length,f=e.slice(0,i+n.index+h+s);if(Math.min(i,s)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let d=f.slice(2,-2);return{type:"strong",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,n;return t[2]==="@"?(r=t[1],n="mailto:"+r):(r=t[1],n=r),{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,n;if(t[2]==="@")r=t[0],n="mailto:"+r;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);r=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},vh=class qU{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Uy,this.options.tokenizer=this.options.tokenizer||new pR,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:vl,block:fR.normal,inline:W3.normal};this.options.pedantic?(r.block=fR.pedantic,r.inline=W3.pedantic):this.options.gfm&&(r.block=fR.gfm,this.options.breaks?r.inline=W3.breaks:r.inline=W3.gfm),this.tokenizer.rules=r}static get rules(){return{block:fR,inline:W3}}static lex(t,r){return new qU(r).lex(t)}static lexInline(t,r){return new qU(r).inlineTokens(t)}lex(t){t=t.replace(vl.carriageReturn,` +`),this.blockTokens(t,this.tokens);for(let r=0;r(i=s.call({lexer:this},t,r))?(t=t.substring(i.raw.length),r.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let s=r.at(-1);i.raw.length===1&&s!==void 0?s.raw+=` `:r.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` `)?"":` `)+i.raw,s.text+=` @@ -451,7 +451,7 @@ ${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(i),n=a.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let s=r.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(` `)?"":` `)+i.raw,s.text+=` -`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(i);continue}if(t){let s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n=t,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)a=i[2]?i[2].length:0,n=n.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let s=!1,o="";for(;t;){s||(o=""),s=!1;let l;if(this.options.extensions?.inline?.some(h=>(l=h.call({lexer:this},t,r))?(t=t.substring(l.raw.length),r.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let h=r.at(-1);l.type==="text"&&h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(l=this.tokenizer.emStrong(t,n,o)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),r.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),r.push(l);continue}let u=t;if(this.options.extensions?.startInline){let h=1/0,f=t.slice(1),d;this.options.extensions.startInline.forEach(p=>{d=p.call({lexer:this},f),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(l=this.tokenizer.inlineText(u)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),s=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},mR=class{options;parser;constructor(e){this.options=e||Uy}space(e){return""}code({text:e,lang:t,escaped:r}){let n=(t||"").match(yl.notSpaceStart)?.[0],i=e.replace(yl.endingNewline,"")+` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(i);continue}if(t){let s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n=t,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)a=i[2]?i[2].length:0,n=n.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let s=!1,o="";for(;t;){s||(o=""),s=!1;let l;if(this.options.extensions?.inline?.some(h=>(l=h.call({lexer:this},t,r))?(t=t.substring(l.raw.length),r.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let h=r.at(-1);l.type==="text"&&h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(l=this.tokenizer.emStrong(t,n,o)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),r.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),r.push(l);continue}let u=t;if(this.options.extensions?.startInline){let h=1/0,f=t.slice(1),d;this.options.extensions.startInline.forEach(p=>{d=p.call({lexer:this},f),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(l=this.tokenizer.inlineText(u)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),s=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},mR=class{options;parser;constructor(e){this.options=e||Uy}space(e){return""}code({text:e,lang:t,escaped:r}){let n=(t||"").match(vl.notSpaceStart)?.[0],i=e.replace(vl.endingNewline,"")+` `;return n?'
'+(r?i:Gf(i,!0))+`
`:"
"+(r?i:Gf(i,!0))+`
`}blockquote({tokens:e}){return`
@@ -469,22 +469,22 @@ ${this.parser.parse(e)}
`}tablerow({text:e}){return` ${e} `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+` -`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Gf(e,!0)}`}br(e){return"
"}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:r}){let n=this.parser.parseInline(r),i=QEe(e);if(i===null)return n;e=i;let a='
",a}image({href:e,title:t,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let i=QEe(e);if(i===null)return Gf(r);e=i;let a=`${r}{let s=i[a].flat(1/0);r=r.concat(this.walkTokens(s,t))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...s){let o=i.renderer.apply(this,s);return o===!1&&(o=a.apply(this,s)),o}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),n.extensions=t),r.renderer){let i=this.defaults.renderer||new mR(this.defaults);for(let a in r.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let s=a,o=r.renderer[s],l=i[s];i[s]=(...u)=>{let h=o.apply(i,u);return h===!1&&(h=l.apply(i,u)),h||""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new pR(this.defaults);for(let a in r.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let s=a,o=r.tokenizer[s],l=i[s];i[s]=(...u)=>{let h=o.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new U3;for(let a in r.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let s=a,o=r.hooks[s],l=i[s];U3.passThroughHooks.has(a)?i[s]=u=>{if(this.defaults.async&&U3.passThroughHooksRespectAsync.has(a))return(async()=>{let f=await o.call(i,u);return l.call(i,f)})();let h=o.call(i,u);return l.call(i,h)}:i[s]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await o.apply(i,u);return f===!1&&(f=await l.apply(i,u)),f})();let h=o.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,a=r.walkTokens;n.walkTokens=function(s){let o=[];return o.push(a.call(this,s)),i&&(o=o.concat(i.call(this,s))),o}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return vh.lex(e,t??this.defaults)}parser(e,t){return xh.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let n={...r},i={...this.defaults,...n},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let s=i.hooks?await i.hooks.preprocess(t):t,o=await(i.hooks?await i.hooks.provideLexer():e?vh.lex:vh.lexInline)(s,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?xh.parse:xh.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let s=(i.hooks?i.hooks.provideLexer():e?vh.lex:vh.lexInline)(t,i);i.hooks&&(s=i.hooks.processAllTokens(s)),i.walkTokens&&this.walkTokens(s,i.walkTokens);let o=(i.hooks?i.hooks.provideParser():e?xh.parse:xh.parseInline)(s,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(s){return a(s)}}}onError(e,t){return r=>{if(r.message+=` -Please report this to https://github.com/markedjs/marked.`,e){let n="

An error occurred:

"+Gf(r.message+"",!0)+"
";return t?Promise.resolve(n):n}if(t)return Promise.reject(r);throw r}}},Hy=new BEt;fi.options=fi.setOptions=function(e){return Hy.setOptions(e),fi.defaults=Hy.defaults,t7e(fi.defaults),fi};fi.getDefaults=qU;fi.defaults=Uy;fi.use=function(...e){return Hy.use(...e),fi.defaults=Hy.defaults,t7e(fi.defaults),fi};fi.walkTokens=function(e,t){return Hy.walkTokens(e,t)};fi.parseInline=Hy.parseInline;fi.Parser=xh;fi.parser=xh.parse;fi.Renderer=mR;fi.TextRenderer=KU;fi.Lexer=vh;fi.lexer=vh.lex;fi.Tokenizer=pR;fi.Hooks=U3;fi.parse=fi;Xqr=fi.options,jqr=fi.setOptions,Kqr=fi.use,Zqr=fi.walkTokens,Qqr=fi.parseInline,Jqr=xh.parse,eVr=vh.lex});function vR(e){for(var t=[],r=1;r${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Gf(e,!0)}`}br(e){return"
"}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:r}){let n=this.parser.parseInline(r),i=e7e(e);if(i===null)return n;e=i;let a='
",a}image({href:e,title:t,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let i=e7e(e);if(i===null)return Gf(r);e=i;let a=`${r}{let s=i[a].flat(1/0);r=r.concat(this.walkTokens(s,t))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...s){let o=i.renderer.apply(this,s);return o===!1&&(o=a.apply(this,s)),o}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),n.extensions=t),r.renderer){let i=this.defaults.renderer||new mR(this.defaults);for(let a in r.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let s=a,o=r.renderer[s],l=i[s];i[s]=(...u)=>{let h=o.apply(i,u);return h===!1&&(h=l.apply(i,u)),h||""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new pR(this.defaults);for(let a in r.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let s=a,o=r.tokenizer[s],l=i[s];i[s]=(...u)=>{let h=o.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new U3;for(let a in r.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let s=a,o=r.hooks[s],l=i[s];U3.passThroughHooks.has(a)?i[s]=u=>{if(this.defaults.async&&U3.passThroughHooksRespectAsync.has(a))return(async()=>{let f=await o.call(i,u);return l.call(i,f)})();let h=o.call(i,u);return l.call(i,h)}:i[s]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await o.apply(i,u);return f===!1&&(f=await l.apply(i,u)),f})();let h=o.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,a=r.walkTokens;n.walkTokens=function(s){let o=[];return o.push(a.call(this,s)),i&&(o=o.concat(i.call(this,s))),o}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return vh.lex(e,t??this.defaults)}parser(e,t){return xh.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let n={...r},i={...this.defaults,...n},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let s=i.hooks?await i.hooks.preprocess(t):t,o=await(i.hooks?await i.hooks.provideLexer():e?vh.lex:vh.lexInline)(s,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?xh.parse:xh.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let s=(i.hooks?i.hooks.provideLexer():e?vh.lex:vh.lexInline)(t,i);i.hooks&&(s=i.hooks.processAllTokens(s)),i.walkTokens&&this.walkTokens(s,i.walkTokens);let o=(i.hooks?i.hooks.provideParser():e?xh.parse:xh.parseInline)(s,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(s){return a(s)}}}onError(e,t){return r=>{if(r.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let n="

An error occurred:

"+Gf(r.message+"",!0)+"
";return t?Promise.resolve(n):n}if(t)return Promise.reject(r);throw r}}},Hy=new GEt;fi.options=fi.setOptions=function(e){return Hy.setOptions(e),fi.defaults=Hy.defaults,n7e(fi.defaults),fi};fi.getDefaults=WU;fi.defaults=Uy;fi.use=function(...e){return Hy.use(...e),fi.defaults=Hy.defaults,n7e(fi.defaults),fi};fi.walkTokens=function(e,t){return Hy.walkTokens(e,t)};fi.parseInline=Hy.parseInline;fi.Parser=xh;fi.parser=xh.parse;fi.Renderer=mR;fi.TextRenderer=QU;fi.Lexer=vh;fi.lexer=vh.lex;fi.Tokenizer=pR;fi.Hooks=U3;fi.parse=fi;Jqr=fi.options,eVr=fi.setOptions,tVr=fi.use,rVr=fi.walkTokens,nVr=fi.parseInline,iVr=xh.parse,aVr=vh.lex});function vR(e){for(var t=[],r=1;r{});function p7e(e,{markdownAutoWrap:t}){let n=e.replace(//g,` +`)),s+=f+n[l+1]}),s}var JU=W(()=>{});function g7e(e,{markdownAutoWrap:t}){let n=e.replace(//g,` `).replace(/\n{2,}/g,` -`);return vR(n)}function m7e(e){return e.split(/\\n|\n|/gi).map(t=>t.trim().match(/<[^>]+>|[^\s<>]+/g)?.map(r=>({content:r,type:"normal"}))??[])}function g7e(e,t={}){let r=p7e(e,t),n=fi.lexer(r),i=[[]],a=0;function s(o,l="normal"){o.type==="text"?o.text.split(` -`).forEach((h,f)=>{f!==0&&(a++,i.push([])),h.split(" ").forEach(d=>{d=d.replace(/'/g,"'"),d&&i[a].push({content:d,type:l})})}):o.type==="strong"||o.type==="em"?o.tokens.forEach(u=>{s(u,o.type)}):o.type==="html"&&i[a].push({content:o.text,type:"normal"})}return b(s,"processNode"),n.forEach(o=>{o.type==="paragraph"?o.tokens?.forEach(l=>{s(l)}):o.type==="html"?i[a].push({content:o.text,type:"normal"}):i[a].push({content:o.raw,type:"normal"})}),i}function y7e(e){return e?`

${e.replace(/\\n|\n/g,"
")}

`:""}function v7e(e,{markdownAutoWrap:t}={}){let r=fi.lexer(e);function n(i){return i.type==="text"?t===!1?i.text.replace(/\n */g,"
").replace(/ /g," "):i.text.replace(/\n */g,"
"):i.type==="strong"?`${i.tokens?.map(n).join("")}`:i.type==="em"?`${i.tokens?.map(n).join("")}`:i.type==="paragraph"?`

${i.tokens?.map(n).join("")}

`:i.type==="space"?"":i.type==="html"?`${i.text}`:i.type==="escape"?i.text:(se.warn(`Unsupported markdown: ${i.type}`),i.raw)}return b(n,"output"),r.map(n).join("")}function x7e(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}function b7e(e,t){let r=x7e(t.content);return eY(e,[],r,t.type)}function eY(e,t,r,n){if(r.length===0)return[{content:t.join(""),type:n},{content:"",type:n}];let[i,...a]=r,s=[...t,i];return e([{content:s.join(""),type:n}])?eY(e,s,a,n):(t.length===0&&i&&(t.push(i),r.shift()),[{content:t.join(""),type:n},{content:r.join(""),type:n}])}function w7e(e,t){if(e.some(({content:r})=>r.includes(` -`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return xR(e,t)}function xR(e,t,r=[],n=[]){if(e.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let i="";e[0].content===" "&&(i=" ",e.shift());let a=e.shift()??{content:" ",type:"normal"},s=[...n];if(i!==""&&s.push({content:i,type:"normal"}),s.push(a),t(s))return xR(e,t,r,s);if(n.length>0)r.push(n),e.unshift(a);else if(a.content){let[o,l]=b7e(t,a);r.push([o]),l.content&&e.unshift(l)}return xR(e,t,r)}function QU(e,t){t&&e.attr("style",t)}async function k7e(e,t,r,n,i=!1,a=qt()){let s=e.append("foreignObject");s.attr("width",`${Math.min(10*r,d7e)}px`),s.attr("height",`${Math.min(10*r,d7e)}px`);let o=s.append("xhtml:div"),l=sa(t.label)?await Lb(t.label.replace(Ct.lineBreakRegex,` -`),a):Mr(t.label,a),u=t.isNode?"nodeLabel":"edgeLabel",h=o.append("span");h.html(l),QU(h,t.labelStyle),h.attr("class",`${u} ${n}`),QU(o,t.labelStyle),o.style("display","table-cell"),o.style("white-space","nowrap"),o.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(o.style("max-width",r+"px"),o.style("text-align","center")),o.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&o.attr("class","labelBkg");let f=o.node().getBoundingClientRect();return f.width===r&&(o.style("display","table"),o.style("white-space","break-spaces"),o.style("width",r+"px"),f=o.node().getBoundingClientRect()),s.node()}function bR(e,t,r,n=!1){let i=e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em");return n&&i.attr("text-anchor","middle"),i}function T7e(e,t,r){let n=e.append("text"),i=bR(n,1,t);wR(i,r);let a=i.node().getComputedTextLength();return n.remove(),a}function tY(e,t,r){let n=e.append("text"),i=bR(n,1,t);wR(i,[{content:r,type:"normal"}]);let a=i.node()?.getBoundingClientRect();return a&&n.remove(),a}function C7e(e,t,r,n=!1,i=!1){let s=t.append("g"),o=s.insert("rect").attr("class","background").attr("style","stroke: none"),l=s.append("text").attr("y","-10.1");i&&l.attr("text-anchor","middle");let u=0;for(let h of r){let f=b(p=>T7e(s,1.1,p)<=e,"checkWidth"),d=f(h)?[h]:w7e(h,f);for(let p of d){let m=bR(l,u,1.1,i);wR(m,p),u++}}if(n){let h=l.node().getBBox(),f=2;return o.attr("x",h.x-f).attr("y",h.y-f).attr("width",h.width+2*f).attr("height",h.height+2*f),s.node()}else return l.node()}function JU(e){let t=/&(amp|lt|gt);/g;return e.replace(t,(r,n)=>{switch(n){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return r}})}function wR(e,t){e.text(""),t.forEach((r,n)=>{let i=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?i.text(JU(r.content)):i.text(" "+JU(r.content))})}async function S7e(e,t={}){let r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,a,s)=>(r.push((async()=>{let o=`${a}:${s}`;return await XEe(o)?await zc(o,void 0,{class:"label-icon"}):``})()),i));let n=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}var d7e,rs,bs=W(()=>{ts();Sn();_r();Rr();hr();fn();f7e();ZU();b(p7e,"preprocessMarkdown");b(m7e,"nonMarkdownToLines");b(g7e,"markdownToLines");b(y7e,"nonMarkdownToHTML");b(v7e,"markdownToHTML");b(x7e,"splitTextToChars");b(b7e,"splitWordToFitWidth");b(eY,"splitWordToFitWidthRecursion");b(w7e,"splitLineToFitWidth");b(xR,"splitLineToFitWidthRecursion");b(QU,"applyStyle");d7e=16384;b(k7e,"addHtmlSpan");b(bR,"createTspan");b(T7e,"computeWidthOfText");b(tY,"computeDimensionOfText");b(C7e,"createFormattedText");b(JU,"decodeHTMLEntities");b(wR,"updateTextContentAndStyles");b(S7e,"replaceIconSubstring");rs=b(async(e,t="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:a=!0,markdown:s=!0,isNode:o=!0,width:l=200,addSvgBackground:u=!1}={},h)=>{if(se.debug("XYZ createText",t,r,n,i,a,o,"addSvgBackground: ",u),a){let f=s?v7e(t,h):y7e(t),d=await S7e($c(f),h),p=t.replace(/\\\\/g,"\\"),m={isNode:o,label:sa(t)?p:d,labelStyle:r.replace("fill:","color:")};return await k7e(e,m,l,i,u,h)}else{let f=$c(t.replace(//g,"
")),d=s?g7e(f.replace("
","
"),h):m7e(f),p=C7e(l,e,d,t?u:!1,!o);if(o){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));let m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ct(p).attr("style",m)}else{let m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");ct(p).select("rect").attr("style",m.replace(/background:/g,"fill:"));let g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ct(p).select("text").attr("style",g)}return n?ct(p).selectAll("tspan.text-outer-tspan").classed("title-row",!0):ct(p).selectAll("tspan.text-outer-tspan").classed("row",!0),p}},"createText")});function rY(e,t,r){if(e&&e.length){let[n,i]=t,a=Math.PI/180*r,s=Math.cos(a),o=Math.sin(a);for(let l of e){let[u,h]=l;l[0]=(u-n)*s-(h-i)*o+n,l[1]=(u-n)*o+(h-i)*s+i}}}function FEt(e,t){return e[0]===t[0]&&e[1]===t[1]}function $Et(e,t,r,n=1){let i=r,a=Math.max(t,.1),s=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,o=[0,0];if(i)for(let u of s)rY(u,o,i);let l=(function(u,h,f){let d=[];for(let x of u){let w=[...x];FEt(w[0],w[w.length-1])||w.push([w[0][0],w[0][1]]),w.length>2&&d.push(w)}let p=[];h=Math.max(h,.1);let m=[];for(let x of d)for(let w=0;wx.yminw.ymin?1:x.xw.x?1:x.ymax===w.ymax?0:(x.ymax-w.ymax)/Math.abs(x.ymax-w.ymax))),!m.length)return p;let g=[],y=m[0].ymin,v=0;for(;g.length||m.length;){if(m.length){let x=-1;for(let w=0;wy);w++)x=w;m.splice(0,x+1).forEach((w=>{g.push({s:y,edge:w})}))}if(g=g.filter((x=>!(x.edge.ymax<=y))),g.sort(((x,w)=>x.edge.x===w.edge.x?0:(x.edge.x-w.edge.x)/Math.abs(x.edge.x-w.edge.x))),(f!==1||v%h==0)&&g.length>1)for(let x=0;x=g.length)break;let C=g[x].edge,T=g[w].edge;p.push([[Math.round(C.x),y],[Math.round(T.x),y]])}y+=f,g.forEach((x=>{x.edge.x=x.edge.x+f*x.edge.islope})),v++}return p})(s,a,n);if(i){for(let u of s)rY(u,o,-i);(function(u,h,f){let d=[];u.forEach((p=>d.push(...p))),rY(d,h,f)})(l,o,-i)}return l}function Q3(e,t){var r;let n=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=4*t.strokeWidth),i=Math.round(Math.max(i,.1));let a=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(a=i),$Et(e,i,n,a||1)}function LR(e){let t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}function iY(e,t){return e.type===t}function vY(e){let t=[],r=(function(s){let o=new Array;for(;s!=="";)if(s.match(/^([ \t\r\n,]+)/))s=s.substr(RegExp.$1.length);else if(s.match(/^([aAcChHlLmMqQsStTvVzZ])/))o[o.length]={type:zEt,text:RegExp.$1},s=s.substr(RegExp.$1.length);else{if(!s.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];o[o.length]={type:nY,text:`${parseFloat(RegExp.$1)}`},s=s.substr(RegExp.$1.length)}return o[o.length]={type:E7e,text:""},o})(e),n="BOD",i=0,a=r[i];for(;!iY(a,E7e);){let s=0,o=[];if(n==="BOD"){if(a.text!=="M"&&a.text!=="m")return vY("M0,0"+e);i++,s=kR[a.text],n=a.text}else iY(a,nY)?s=kR[n]:(i++,s=kR[a.text],n=a.text);if(!(i+sh%2?u+r:u+t));a.push({key:"C",data:l}),t=l[4],r=l[5];break}case"Q":a.push({key:"Q",data:[...o]}),t=o[2],r=o[3];break;case"q":{let l=o.map(((u,h)=>h%2?u+r:u+t));a.push({key:"Q",data:l}),t=l[2],r=l[3];break}case"A":a.push({key:"A",data:[...o]}),t=o[5],r=o[6];break;case"a":t+=o[5],r+=o[6],a.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],t,r]});break;case"H":a.push({key:"H",data:[...o]}),t=o[0];break;case"h":t+=o[0],a.push({key:"H",data:[t]});break;case"V":a.push({key:"V",data:[...o]}),r=o[0];break;case"v":r+=o[0],a.push({key:"V",data:[r]});break;case"S":a.push({key:"S",data:[...o]}),t=o[2],r=o[3];break;case"s":{let l=o.map(((u,h)=>h%2?u+r:u+t));a.push({key:"S",data:l}),t=l[2],r=l[3];break}case"T":a.push({key:"T",data:[...o]}),t=o[0],r=o[1];break;case"t":t+=o[0],r+=o[1],a.push({key:"T",data:[t,r]});break;case"Z":case"z":a.push({key:"Z",data:[]}),t=n,r=i}return a}function O7e(e){let t=[],r="",n=0,i=0,a=0,s=0,o=0,l=0;for(let{key:u,data:h}of e){switch(u){case"M":t.push({key:"M",data:[...h]}),[n,i]=h,[a,s]=h;break;case"C":t.push({key:"C",data:[...h]}),n=h[4],i=h[5],o=h[2],l=h[3];break;case"L":t.push({key:"L",data:[...h]}),[n,i]=h;break;case"H":n=h[0],t.push({key:"L",data:[n,i]});break;case"V":i=h[0],t.push({key:"L",data:[n,i]});break;case"S":{let f=0,d=0;r==="C"||r==="S"?(f=n+(n-o),d=i+(i-l)):(f=n,d=i),t.push({key:"C",data:[f,d,...h]}),o=h[0],l=h[1],n=h[2],i=h[3];break}case"T":{let[f,d]=h,p=0,m=0;r==="Q"||r==="T"?(p=n+(n-o),m=i+(i-l)):(p=n,m=i);let g=n+2*(p-n)/3,y=i+2*(m-i)/3,v=f+2*(p-f)/3,x=d+2*(m-d)/3;t.push({key:"C",data:[g,y,v,x,f,d]}),o=p,l=m,n=f,i=d;break}case"Q":{let[f,d,p,m]=h,g=n+2*(f-n)/3,y=i+2*(d-i)/3,v=p+2*(f-p)/3,x=m+2*(d-m)/3;t.push({key:"C",data:[g,y,v,x,p,m]}),o=f,l=d,n=p,i=m;break}case"A":{let f=Math.abs(h[0]),d=Math.abs(h[1]),p=h[2],m=h[3],g=h[4],y=h[5],v=h[6];f===0||d===0?(t.push({key:"C",data:[n,i,y,v,y,v]}),n=y,i=v):(n!==y||i!==v)&&(P7e(n,i,y,v,f,d,p,m,g).forEach((function(x){t.push({key:"C",data:x})})),n=y,i=v);break}case"Z":t.push({key:"Z",data:[]}),n=a,i=s}r=u}return t}function j3(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function P7e(e,t,r,n,i,a,s,o,l,u){let h=(f=s,Math.PI*f/180);var f;let d=[],p=0,m=0,g=0,y=0;if(u)[p,m,g,y]=u;else{[e,t]=j3(e,t,-h),[r,n]=j3(r,n,-h);let A=(e-r)/2,N=(t-n)/2,M=A*A/(i*i)+N*N/(a*a);M>1&&(M=Math.sqrt(M),i*=M,a*=M);let D=i*i,B=a*a,P=D*B-D*N*N-B*A*A,$=D*N*N+B*A*A,F=(o===l?-1:1)*Math.sqrt(Math.abs(P/$));g=F*i*N/a+(e+r)/2,y=F*-a*A/i+(t+n)/2,p=Math.asin(parseFloat(((t-y)/a).toFixed(9))),m=Math.asin(parseFloat(((n-y)/a).toFixed(9))),em&&(p-=2*Math.PI),!l&&m>p&&(m-=2*Math.PI)}let v=m-p;if(Math.abs(v)>120*Math.PI/180){let A=m,N=r,M=n;m=l&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,d=P7e(r=g+i*Math.cos(m),n=y+a*Math.sin(m),N,M,i,a,s,0,l,[m,A,g,y])}v=m-p;let x=Math.cos(p),w=Math.sin(p),C=Math.cos(m),T=Math.sin(m),k=Math.tan(v/4),S=4/3*i*k,E=4/3*a*k,I=[e,t],L=[e+S*w,t-E*x],O=[r+S*T,n-E*C],R=[r,n];if(L[0]=2*I[0]-L[0],L[1]=2*I[1]-L[1],u)return[L,O,R].concat(d);{d=[L,O,R].concat(d);let A=[];for(let N=0;N2){let i=[];for(let a=0;a2*Math.PI&&(p=0,m=2*Math.PI);let g=2*Math.PI/l.curveStepCount,y=Math.min(g/2,(m-p)/2),v=M7e(y,u,h,f,d,p,m,1,l);if(!l.disableMultiStroke){let x=M7e(y,u,h,f,d,p,m,1.5,l);v.push(...x)}return s&&(o?v.push(...Km(u,h,u+f*Math.cos(p),h+d*Math.sin(p),l),...Km(u,h,u+f*Math.cos(m),h+d*Math.sin(m),l)):v.push({op:"lineTo",data:[u,h]},{op:"lineTo",data:[u+f*Math.cos(p),h+d*Math.sin(p)]})),{type:"path",ops:v}}function R7e(e,t){let r=O7e(D7e(vY(e))),n=[],i=[0,0],a=[0,0];for(let{key:s,data:o}of r)switch(s){case"M":a=[o[0],o[1]],i=[o[0],o[1]];break;case"L":n.push(...Km(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case"C":{let[l,u,h,f,d,p]=o;n.push(...VEt(l,u,h,f,d,p,a,t)),a=[d,p];break}case"Z":n.push(...Km(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:"path",ops:n}}function aY(e,t){let r=[];for(let n of e)if(n.length){let i=t.maxRandomnessOffset||0,a=n.length;if(a>2){r.push({op:"move",data:[n[0][0]+Wr(i,t),n[0][1]+Wr(i,t)]});for(let s=1;s500?.4:-.0016668*l+1.233334;let h=i.maxRandomnessOffset||0;h*h*100>o&&(h=l/10);let f=h/2,d=.2+.2*$7e(i),p=i.bowing*i.maxRandomnessOffset*(n-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-r)/200;p=Wr(p,i,u),m=Wr(m,i,u);let g=[],y=()=>Wr(f,i,u),v=()=>Wr(h,i,u),x=i.preserveVertices;return a&&(s?g.push({op:"move",data:[e+(x?0:y()),t+(x?0:y())]}):g.push({op:"move",data:[e+(x?0:Wr(h,i,u)),t+(x?0:Wr(h,i,u))]})),s?g.push({op:"bcurveTo",data:[p+e+(r-e)*d+y(),m+t+(n-t)*d+y(),p+e+2*(r-e)*d+y(),m+t+2*(n-t)*d+y(),r+(x?0:y()),n+(x?0:y())]}):g.push({op:"bcurveTo",data:[p+e+(r-e)*d+v(),m+t+(n-t)*d+v(),p+e+2*(r-e)*d+v(),m+t+2*(n-t)*d+v(),r+(x?0:v()),n+(x?0:v())]}),g}function TR(e,t,r){if(!e.length)return[];let n=[];n.push([e[0][0]+Wr(t,r),e[0][1]+Wr(t,r)]),n.push([e[0][0]+Wr(t,r),e[0][1]+Wr(t,r)]);for(let i=1;i3){let a=[],s=1-r.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let o=1;o+21&&i.push(o)):i.push(o),i.push(e[t+3])}else{let l=e[t+0],u=e[t+1],h=e[t+2],f=e[t+3],d=Yy(l,u,.5),p=Yy(u,h,.5),m=Yy(h,f,.5),g=Yy(d,p,.5),y=Yy(p,m,.5),v=Yy(g,y,.5);mY([l,d,g,v],0,r,i),mY([v,y,m,f],0,r,i)}var a,s;return i}function HEt(e,t){return RR(e,0,e.length,t)}function RR(e,t,r,n,i){let a=i||[],s=e[t],o=e[r-1],l=0,u=1;for(let h=t+1;hl&&(l=f,u=h)}return Math.sqrt(l)>n?(RR(e,t,u+1,n,a),RR(e,u,r,n,a)):(a.length||a.push(s),a.push(o)),a}function sY(e,t=.15,r){let n=[],i=(e.length-1)/3;for(let a=0;a0?RR(n,0,n.length,r):n}var Z3,oY,lY,cY,uY,hY,Ql,fY,zEt,nY,E7e,kR,GEt,Gc,p4,gY,CR,yY,gt,dr=W(()=>{Z3=class{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){let n=Q3(t,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(t,r){let n=[];for(let i of t)n.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],r));return n}};oY=class extends Z3{fillPolygons(t,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);let i=Q3(t,Object.assign({},r,{hachureGap:n})),a=Math.PI/180*r.hachureAngle,s=[],o=.5*n*Math.cos(a),l=.5*n*Math.sin(a);for(let[u,h]of i)LR([u,h])&&s.push([[u[0]-o,u[1]+l],[...h]],[[u[0]+o,u[1]-l],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,r)}}},lY=class extends Z3{fillPolygons(t,r){let n=this._fillPolygons(t,r),i=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),a=this._fillPolygons(t,i);return n.ops=n.ops.concat(a.ops),n}},cY=class{constructor(t){this.helper=t}fillPolygons(t,r){let n=Q3(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(t,r){let n=[],i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);let a=r.fillWeight;a<0&&(a=r.strokeWidth/2);let s=i/4;for(let o of t){let l=LR(o),u=l/i,h=Math.ceil(u)-1,f=l-h*i,d=(o[0][0]+o[1][0])/2-i/4,p=Math.min(o[0][1],o[1][1]);for(let m=0;m{let o=LR(s),l=Math.floor(o/(n+i)),u=(o+i-l*(n+i))/2,h=s[0],f=s[1];h[0]>f[0]&&(h=s[1],f=s[0]);let d=Math.atan((f[1]-h[1])/(f[0]-h[0]));for(let p=0;p{let s=LR(a),o=Math.round(s/(2*r)),l=a[0],u=a[1];l[0]>u[0]&&(l=a[1],u=a[0]);let h=Math.atan((u[1]-l[1])/(u[0]-l[0]));for(let f=0;f2*Math.PI&&(S=0,E=2*Math.PI);let I=(E-S)/x.curveStepCount,L=[];for(let O=S;O<=E;O+=I)L.push([w+T*Math.cos(O),C+k*Math.sin(O)]);return L.push([w+T*Math.cos(E),C+k*Math.sin(E)]),L.push([w,C]),d4([L],x)})(t,r,n,i,a,s,u));return u.stroke!==Gc&&h.push(f),this._d("arc",h,u)}curve(t,r){let n=this._o(r),i=[],a=A7e(t,n);if(n.fill&&n.fill!==Gc)if(n.fillStyle==="solid"){let s=A7e(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=[],o=t;if(o.length){let l=typeof o[0][0]=="number"?[o]:o;for(let u of l)u.length<3?s.push(...u):u.length===3?s.push(...sY(N7e([u[0],u[0],u[1],u[2]]),10,(1+n.roughness)/2)):s.push(...sY(N7e(u),10,(1+n.roughness)/2))}s.length&&i.push(d4([s],n))}return n.stroke!==Gc&&i.push(a),this._d("curve",i,n)}polygon(t,r){let n=this._o(r),i=[],a=SR(t,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(aY([t],n)):i.push(d4([t],n))),n.stroke!==Gc&&i.push(a),this._d("polygon",i,n)}path(t,r){let n=this._o(r),i=[];if(!t)return this._d("path",i,n);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=n.fill&&n.fill!=="transparent"&&n.fill!==Gc,s=n.stroke!==Gc,o=!!(n.simplification&&n.simplification<1),l=(function(h,f,d){let p=O7e(D7e(vY(h))),m=[],g=[],y=[0,0],v=[],x=()=>{v.length>=4&&g.push(...sY(v,f)),v=[]},w=()=>{x(),g.length&&(m.push(g),g=[])};for(let{key:T,data:k}of p)switch(T){case"M":w(),y=[k[0],k[1]],g.push(y);break;case"L":x(),g.push([k[0],k[1]]);break;case"C":if(!v.length){let S=g.length?g[g.length-1]:y;v.push([S[0],S[1]])}v.push([k[0],k[1]]),v.push([k[2],k[3]]),v.push([k[4],k[5]]);break;case"Z":x(),g.push([y[0],y[1]])}if(w(),!d)return m;let C=[];for(let T of m){let k=HEt(T,d);k.length&&C.push(k)}return C})(t,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),u=R7e(t,n);if(a)if(n.fillStyle==="solid")if(l.length===1){let h=R7e(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else i.push(aY(l,n));else i.push(d4(l,n));return s&&(o?l.forEach((h=>{i.push(SR(h,!1,n))})):i.push(u)),this._d("path",i,n)}opsToPath(t,r){let n="";for(let i of t.ops){let a=typeof r=="number"&&r>=0?i.data.map((s=>+s.toFixed(r))):i.data;switch(i.op){case"move":n+=`M${a[0]} ${a[1]} `;break;case"bcurveTo":n+=`C${a[0]} ${a[1]}, ${a[2]} ${a[3]}, ${a[4]} ${a[5]} `;break;case"lineTo":n+=`L${a[0]} ${a[1]} `}}return n.trim()}toPaths(t){let r=t.sets||[],n=t.options||this.defaultOptions,i=[];for(let a of r){let s=null;switch(a.type){case"path":s={d:this.opsToPath(a),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:Gc};break;case"fillPath":s={d:this.opsToPath(a),stroke:Gc,strokeWidth:0,fill:n.fill||Gc};break;case"fillSketch":s=this.fillSketch(a,n)}s&&i.push(s)}return i}fillSketch(t,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||Gc,strokeWidth:n,fill:Gc}}_mergedShape(t){return t.filter(((r,n)=>n===0||r.op!=="move"))}},gY=class{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new p4(r)}draw(t){let r=t.sets||[],n=t.options||this.getDefaultOptions(),i=this.ctx,a=t.options.fixedDecimalPlaceDigits;for(let s of r)switch(s.type){case"path":i.save(),i.strokeStyle=n.stroke==="none"?"transparent":n.stroke,i.lineWidth=n.strokeWidth,n.strokeLineDash&&i.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(i.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(i,s,a),i.restore();break;case"fillPath":{i.save(),i.fillStyle=n.fill||"";let o=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,a,o),i.restore();break}case"fillSketch":this.fillSketch(i,s,n)}}fillSketch(t,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2),t.save(),n.fillLineDash&&t.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(t.lineDashOffset=n.fillLineDashOffset),t.strokeStyle=n.fill||"",t.lineWidth=i,this._drawToContext(t,r,n.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,n,i="nonzero"){t.beginPath();for(let a of r.ops){let s=typeof n=="number"&&n>=0?a.data.map((o=>+o.toFixed(n))):a.data;switch(a.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1])}}r.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,n,i,a){let s=this.gen.line(t,r,n,i,a);return this.draw(s),s}rectangle(t,r,n,i,a){let s=this.gen.rectangle(t,r,n,i,a);return this.draw(s),s}ellipse(t,r,n,i,a){let s=this.gen.ellipse(t,r,n,i,a);return this.draw(s),s}circle(t,r,n,i){let a=this.gen.circle(t,r,n,i);return this.draw(a),a}linearPath(t,r){let n=this.gen.linearPath(t,r);return this.draw(n),n}polygon(t,r){let n=this.gen.polygon(t,r);return this.draw(n),n}arc(t,r,n,i,a,s,o=!1,l){let u=this.gen.arc(t,r,n,i,a,s,o,l);return this.draw(u),u}curve(t,r){let n=this.gen.curve(t,r);return this.draw(n),n}path(t,r){let n=this.gen.path(t,r);return this.draw(n),n}},CR="http://www.w3.org/2000/svg",yY=class{constructor(t,r){this.svg=t,this.gen=new p4(r)}draw(t){let r=t.sets||[],n=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,a=i.createElementNS(CR,"g"),s=t.options.fixedDecimalPlaceDigits;for(let o of r){let l=null;switch(o.type){case"path":l=i.createElementNS(CR,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=i.createElementNS(CR,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(i,o,n)}l&&a.appendChild(l)}return a}fillSketch(t,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);let a=t.createElementNS(CR,"path");return a.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),a.setAttribute("stroke",n.fill||""),a.setAttribute("stroke-width",i+""),a.setAttribute("fill","none"),n.fillLineDash&&a.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,n,i,a){let s=this.gen.line(t,r,n,i,a);return this.draw(s)}rectangle(t,r,n,i,a){let s=this.gen.rectangle(t,r,n,i,a);return this.draw(s)}ellipse(t,r,n,i,a){let s=this.gen.ellipse(t,r,n,i,a);return this.draw(s)}circle(t,r,n,i){let a=this.gen.circle(t,r,n,i);return this.draw(a)}linearPath(t,r){let n=this.gen.linearPath(t,r);return this.draw(n)}polygon(t,r){let n=this.gen.polygon(t,r);return this.draw(n)}arc(t,r,n,i,a,s,o=!1,l){let u=this.gen.arc(t,r,n,i,a,s,o,l);return this.draw(u)}curve(t,r){let n=this.gen.curve(t,r);return this.draw(n)}path(t,r){let n=this.gen.path(t,r);return this.draw(n)}},gt={canvas:(e,t)=>new gY(e,t),svg:(e,t)=>new yY(e,t),generator:e=>new p4(e),newSeed:()=>p4.newSeed()}});function On(e){let t=e.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}function Zm(e,t,r,n,i,a){let s=[],l=r-e,u=n-t,h=l/a,f=2*Math.PI/h,d=t+u/2;for(let p=0;p<=50;p++){let m=p/50,g=e+m*l,y=d+i*Math.sin(f*(g-e));s.push({x:g,y})}return s}function eC(e,t,r,n,i,a){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fl.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=t.map(l=>l.getAttribute("d")).filter(l=>l!==null).join(" ");r.setAttribute("d",n);let i=t.find(l=>l.getAttribute("fill")!=="none"),a=t.find(l=>l.getAttribute("stroke")!=="none"),s=b((l,u)=>l?.getAttribute(u)??void 0,"getAttr");if(i){let l={fill:s(i,"fill"),"fill-opacity":s(i,"fill-opacity")??"1"};Object.entries(l).forEach(([u,h])=>{h&&r.setAttribute(u,h)})}if(a){let l={stroke:s(a,"stroke"),"stroke-width":s(a,"stroke-width")??"1","stroke-opacity":s(a,"stroke-opacity")??"1"};Object.entries(l).forEach(([u,h])=>{h&&r.setAttribute(u,h)})}let o=document.createElementNS("http://www.w3.org/2000/svg","g");return o.appendChild(r),o}function J7e(e,t){return e.intersect(t)}function e8e(e,t,r,n){var i=e.x,a=e.y,s=i-n.x,o=a-n.y,l=Math.sqrt(t*t*o*o+r*r*s*s),u=Math.abs(t*r*s/l);n.x0}function i8e(e,t,r){let n=e.x,i=e.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(h){s=Math.min(s,h.x),o=Math.min(o,h.y)}):(s=Math.min(s,t.x),o=Math.min(o,t.y));let l=n-e.width/2-s,u=i-e.height/2-o;for(let h=0;h1&&a.sort(function(h,f){let d=h.x-r.x,p=h.y-r.y,m=Math.sqrt(d*d+p*p),g=f.x-r.x,y=f.y-r.y,v=Math.sqrt(g*g+y*y);return mh,":first-child");return f.attr("class","anchor").attr("style",es(o)),gr(t,f),t.intersect=function(d){return se.info("Circle intersect",t,s,d),sr.circle(t,s,d)},a}function TY(e,t,r,n,i,a,s){let l=(e+r)/2,u=(t+n)/2,h=Math.atan2(n-t,r-e),f=(r-e)/2,d=(n-t)/2,p=f/i,m=d/a,g=Math.sqrt(p**2+m**2);if(g>1)throw new Error("The given radii are too small to create an arc between the points.");let y=Math.sqrt(1-g**2),v=l+y*a*Math.sin(h)*(s?-1:1),x=u-y*i*Math.cos(h)*(s?-1:1),w=Math.atan2((t-x)/a,(e-v)/i),T=Math.atan2((n-x)/a,(r-v)/i)-w;s&&T<0&&(T+=2*Math.PI),!s&&T>0&&(T-=2*Math.PI);let k=[];for(let S=0;S<20;S++){let E=S/19,I=w+E*T,L=v+i*Math.cos(I),O=x+a*Math.sin(I);k.push({x:L,y:O})}return k}function s8e(e,t,r){let[n,i]=[t,r].sort((a,s)=>s-a);return i*(1-Math.sqrt(1-(e/n/2)**2))}async function o8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=b(I=>I+s,"calcTotalHeight"),l=b(I=>{let L=I/2;return[L/(2.5+I/50),L]},"calcEllipseRadius"),{shapeSvg:u,bbox:h}=await Hr(e,t,$r(t)),f=o(t?.height?t?.height:h.height),[d,p]=l(f),m=s8e(f,d,p),y=(t?.width?t?.width:h.width)+a*2+m-m,v=f,{cssStyles:x}=t,w=[{x:y/2,y:-v/2},{x:-y/2,y:-v/2},...TY(-y/2,-v/2,-y/2,v/2,d,p,!1),{x:y/2,y:v/2},...TY(y/2,v/2,y/2,-v/2,d,p,!0)],C=gt.svg(u),T=cr(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let k=On(w),S=C.path(k,T),E=u.insert(()=>S,":first-child");return E.attr("class","basic label-container outer-path"),x&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",x),n&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(${d/2}, 0)`),gr(t,E),t.intersect=function(I){return sr.polygon(t,w,I)},u}function I0(e,t,r,n){return e.insert("polygon",":first-child").attr("points",n.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}async function l8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?28:i,s=t.look==="neo"?24:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width??l.width)+(t.look==="neo"?a*2:a+IR),h=(t?.height??l.height)+(t.look==="neo"?s*2:s),f=0,d=u,p=-h,m=0,g=[{x:f+IR,y:p},{x:d,y:p},{x:d,y:m},{x:f,y:m},{x:f,y:p+IR},{x:f+IR,y:p}],y,{cssStyles:v}=t;if(t.look==="handDrawn"){let x=gt.svg(o),w=cr(t,{}),C=On(g),T=x.path(C,w);y=o.insert(()=>T,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),v&&y.attr("style",v)}else y=I0(o,u,h,g);return n&&y.attr("style",n),gr(t,y),t.intersect=function(x){return sr.polygon(t,g,x)},o}function c8e(e,t){let{nodeStyles:r}=ar(t);t.label="";let n=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),{cssStyles:i}=t,a=Math.max(28,t.width??0),s=[{x:0,y:a/2},{x:a/2,y:0},{x:0,y:-a/2},{x:-a/2,y:0}],o=gt.svg(n),l=cr(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let u=On(s),h=o.path(u,l),f=n.insert(()=>h,":first-child");return i&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",i),r&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(d){return sr.polygon(t,s,d)},n}async function CY(e,t,r){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n;let{shapeSvg:a,bbox:s,halfPadding:o}=await Hr(e,t,$r(t)),l=16,u=r?.padding??o,h=t.look==="neo"?s.width/2+l*2:s.width/2+u,f,{cssStyles:d}=t;if(t.look==="handDrawn"){let p=gt.svg(a),m=cr(t,{}),g=p.circle(0,0,h*2,m);f=a.insert(()=>g,":first-child"),f.attr("class","basic label-container").attr("style",es(d))}else f=a.insert("circle",":first-child").attr("class","basic label-container").attr("style",i).attr("r",h).attr("cx",0).attr("cy",0);return gr(t,f),t.calcIntersect=function(p,m){let g=p.width/2;return sr.circle(p,g,m)},t.intersect=function(p){return se.info("Circle intersect",t,h,p),sr.circle(t,h,p)},a}function u8e(e){let t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=e*2,i={x:n/2*t,y:n/2*r},a={x:-(n/2)*t,y:n/2*r},s={x:-(n/2)*t,y:-(n/2)*r},o={x:n/2*t,y:-(n/2)*r};return`M ${a.x},${a.y} L ${o.x},${o.y} - M ${i.x},${i.y} L ${s.x},${s.y}`}function h8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r,t.label="";let i=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),a=Math.max(30,t?.width??0),{cssStyles:s}=t,o=gt.svg(i),l=cr(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let u=o.circle(0,0,a*2,l),h=u8e(a),f=o.path(h,l),d=i.insert(()=>u,":first-child");return d.insert(()=>f),d.attr("class","outer-path"),s&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",s),n&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",n),gr(t,d),t.intersect=function(p){return se.info("crossedCircle intersect",t,{radius:a,point:p}),sr.circle(t,a,p)},i}function _0(e,t,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fT,":first-child").attr("stroke-opacity",0),k.insert(()=>w,":first-child"),k.attr("class","text"),d&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",d),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(${f}, 0)`),s.attr("transform",`translate(${-u/2+f-(a.x-(a.left??0))},${-h/2+(t.padding??0)/2-(a.y-(a.top??0))})`),gr(t,k),t.intersect=function(S){return sr.polygon(t,m,S)},i}function R0(e,t,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fT,":first-child").attr("stroke-opacity",0),k.insert(()=>w,":first-child"),k.attr("class","text"),d&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",d),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(${-f}, 0)`),s.attr("transform",`translate(${-u/2+(t.padding??0)/2-(a.x-(a.left??0))},${-h/2+(t.padding??0)/2-(a.y-(a.top??0))})`),gr(t,k),t.intersect=function(S){return sr.polygon(t,m,S)},i}function fo(e,t,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fI,":first-child").attr("stroke-opacity",0),L.insert(()=>C,":first-child"),L.insert(()=>S,":first-child"),L.attr("class","text"),d&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",d),n&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(${f-f/4}, 0)`),s.attr("transform",`translate(${-u/2+(t.padding??0)/2-(a.x-(a.left??0))},${-h/2+(t.padding??0)/2-(a.y-(a.top??0))})`),gr(t,L),t.intersect=function(O){return sr.polygon(t,g,O)},i}async function m8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=20,l=5,{shapeSvg:u,bbox:h}=await Hr(e,t,$r(t)),f=Math.max(o,(h.width+a*2)*1.25,t?.width??0),d=Math.max(l,h.height+s*2,t?.height??0),p=d/2,{cssStyles:m}=t,g=gt.svg(u),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=f,x=d,w=v-p,C=x/4,T=[{x:w,y:0},{x:C,y:0},{x:0,y:x/2},{x:C,y:x},{x:w,y:x},...eC(-w,-x/2,p,50,270,90)],k=On(T),S=g.path(k,y),E=u.insert(()=>S,":first-child");return E.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&E.selectChildren("path").attr("style",m),n&&t.look!=="handDrawn"&&E.selectChildren("path").attr("style",n),E.attr("transform",`translate(${-f/2}, ${-d/2})`),gr(t,E),t.intersect=function(I){return sr.polygon(t,T,I)},u}async function g8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?24:i,s=t.look==="neo"?24:i;if(t.width||t.height){let y=t.width??0;t.width=(t.width??0)-s,t.widthT,":first-child"),m=o.insert(()=>C,":first-child"),m.attr("class","basic label-container"),g&&m.attr("style",g)}else{let y=a7t(0,0,h,p,f,d);m=o.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",es(g)).attr("style",n)}return m.attr("label-offset-y",d),m.attr("transform",`translate(${-h/2}, ${-(p/2+d)})`),gr(t,m),u.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+(t.padding??0)/1.5-(l.y-(l.top??0))})`),t.intersect=function(y){let v=sr.rect(t,y),x=v.x-(t.x??0);if(f!=0&&(Math.abs(x)<(t.width??0)/2||Math.abs(x)==(t.width??0)/2&&Math.abs(v.y-(t.y??0))>(t.height??0)/2-d)){let w=d*d*(1-x*x/(f*f));w>0&&(w=Math.sqrt(w)),w=d-w,y.y-(t.y??0)>0&&(w=-w),v.y+=w}return v},o}async function v4(e,t,r){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n;let{shapeSvg:a,bbox:s}=await Hr(e,t,$r(t)),o=Math.max(s.width+r.labelPaddingX*2,t?.width||0),l=Math.max(s.height+r.labelPaddingY*2,t?.height||0),u=-o/2,h=-l/2,f,{rx:d,ry:p}=t,{cssStyles:m}=t;if(r?.rx&&r.ry&&(d=r.rx,p=r.ry),t.look==="handDrawn"){let g=gt.svg(a),y=cr(t,{}),v=d||p?g.path(Qm(u,h,o,l,d||0),y):g.rectangle(u,h,o,l,y);f=a.insert(()=>v,":first-child"),f.attr("class","basic label-container").attr("style",es(m))}else f=a.insert("rect",":first-child"),f.attr("class","basic label-container").attr("style",i).attr("rx",es(d)).attr("ry",es(p)).attr("x",u).attr("y",h).attr("width",o).attr("height",l);return gr(t,f),t.calcIntersect=function(g,y){return sr.rect(g,y)},t.intersect=function(g){return sr.rect(t,g)},a}async function y8e(e,t){let{cssClasses:r,labelPaddingX:n,labelPaddingY:i,padding:a,width:s,height:o}=t,l={rx:0,ry:0,classes:r??"",labelPaddingX:n??(a??0)*2,labelPaddingY:i??a??0},u=await v4(e,t,l);if(t.look==="handDrawn"){let p=gt.svg(u),m=cr(t,{}),g=u.select(".basic.label-container > path:nth-child(2)"),y=g.node();if(!y)return u;let v=null;if(y instanceof SVGGraphicsElement)v=y.getBBox();else return u;return u.insert(()=>p.line(v.x,v.y,v.x+v.width,v.y,m),".basic.label-container g.label"),u.insert(()=>p.line(v.x,v.y+v.height,v.x+v.width,v.y+v.height,m),".basic.label-container g.label"),g.remove(),u}let h=u.select(".basic.label-container"),f=(Number(h.attr("width"))||s)??0,d=(Number(h.attr("height"))||o)??0;return f>0&&d>0&&h.attr("stroke-dasharray",`${f} ${d}`),u}async function v8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?16:t.padding??0,{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=o.width+i,h=o.height+a,f=h*.2,d=-u/2,p=-h/2-f/2,{cssStyles:m}=t,g=gt.svg(s),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=[{x:d,y:p+f},{x:-d,y:p+f},{x:-d,y:-p},{x:d,y:-p},{x:d,y:p},{x:-d,y:p},{x:-d,y:p+f}],x=g.polygon(v.map(C=>[C.x,C.y]),y),w=s.insert(()=>x,":first-child");return w.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",m),n&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",n),l.attr("transform",`translate(${d+(t.padding??0)/2-(o.x-(o.left??0))}, ${p+f+(t.padding??0)/2-(o.y-(o.top??0))})`),gr(t,w),t.intersect=function(C){return sr.rect(t,C)},s}async function x8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t),i=t.look==="neo"?12:5;t.labelStyle=r;let a=t.padding??0,s=t.look==="neo"?16:a,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width?t?.width/2:l.width/2)+(s??0),h=u-i,f,{cssStyles:d}=t;if(t.look==="handDrawn"){let p=gt.svg(o),m=cr(t,{roughness:.2,strokeWidth:2.5}),g=cr(t,{roughness:.2,strokeWidth:1.5}),y=p.circle(0,0,u*2,m),v=p.circle(0,0,h*2,g);f=o.insert("g",":first-child"),f.attr("class",es(t.cssClasses)).attr("style",es(d)),f.node()?.appendChild(y),f.node()?.appendChild(v)}else{f=o.insert("g",":first-child");let p=f.insert("circle",":first-child"),m=f.insert("circle");f.attr("class","basic label-container").attr("style",n),p.attr("class","outer-circle").attr("style",n).attr("r",u).attr("cx",0).attr("cy",0),m.attr("class","inner-circle").attr("style",n).attr("r",h).attr("cx",0).attr("cy",0)}return gr(t,f),t.intersect=function(p){return se.info("DoubleCircle intersect",t,u,p),sr.circle(t,u,p)},o}function b8e(e,t,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=ar(t);t.label="",t.labelStyle=n;let a=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),s=7,{cssStyles:o}=t,l=gt.svg(a),{nodeBorder:u}=r,h=cr(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(h.roughness=0);let f=l.circle(0,0,s*2,h),d=a.insert(()=>f,":first-child");return d.selectAll("path").attr("style",`fill: ${u} !important;`),o&&o.length>0&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",o),i&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",i),gr(t,d),t.intersect=function(p){return se.info("filledCircle intersect",t,{radius:s,point:p}),sr.circle(t,s,p)},a}async function w8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?i*2:i;(t.width||t.height)&&(t.height=t?.height??0,t.heightv,":first-child").attr("transform",`translate(${-h/2}, ${h/2})`).attr("class","outer-path");return p&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",p),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),t.width=u,t.height=h,gr(t,x),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-h/2+(t.padding??0)/2+(o.y-(o.top??0))})`),t.intersect=function(w){return se.info("Triangle intersect",t,d,w),sr.polygon(t,d,w)},s}function k8e(e,t,{dir:r,config:{state:n,themeVariables:i}}){let{nodeStyles:a}=ar(t);t.label="";let s=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),{cssStyles:o}=t,l=Math.max(70,t?.width??0),u=Math.max(10,t?.height??0);r==="LR"&&(l=Math.max(10,t?.width??0),u=Math.max(70,t?.height??0));let h=-1*l/2,f=-1*u/2,d=gt.svg(s),p=cr(t,{stroke:i.lineColor,fill:i.lineColor});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let m=d.rectangle(h,f,l,u,p),g=s.insert(()=>m,":first-child");o&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",o),a&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",a),gr(t,g);let y=n?.padding??0;return t.width&&t.height&&(t.width+=y/2||0,t.height+=y/2||0),t.intersect=function(v){return sr.rect(t,v)},s}async function T8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=15,a=10,s=t.look==="neo"?16:t.padding??0,o=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.height=(t?.height??0)-o*2,t.heightx,":first-child");return w.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",p),n&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),gr(t,w),t.intersect=function(C){return se.info("Pill intersect",t,{radius:d,point:C}),sr.polygon(t,y,C)},l}async function C8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t),i=t.look==="neo"?3.5:4;t.labelStyle=r;let a=t.padding??0,s=70,o=32,l=t.look==="neo"?s:a,u=t.look==="neo"?o:a;if(t.width||t.height){let w=(t.height??0)/i;t.width=(t?.width??0)-2*w-u,t.height=(t.height??0)-l}let{shapeSvg:h,bbox:f}=await Hr(e,t,$r(t)),d=(t?.height?t?.height:f.height)+l,p=d/i,m=(t?.width?t?.width:f.width)+2*p+u,g=[{x:p,y:0},{x:m-p,y:0},{x:m,y:-d/2},{x:m-p,y:-d},{x:p,y:-d},{x:0,y:-d/2}],y,{cssStyles:v}=t;if(t.look==="handDrawn"){let x=gt.svg(h),w=cr(t,{}),C=l7t(0,0,m,d,p),T=x.path(C,w);y=h.insert(()=>T,":first-child").attr("transform",`translate(${-m/2}, ${d/2})`),v&&y.attr("style",v)}else y=I0(h,m,d,g);return n&&y.attr("style",n),t.width=m,t.height=d,gr(t,y),t.intersect=function(x){return sr.polygon(t,g,x)},h}async function S8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.label="",t.labelStyle=r;let{shapeSvg:i}=await Hr(e,t,$r(t)),a=Math.max(30,t?.width??0),s=Math.max(30,t?.height??0),{cssStyles:o}=t,l=gt.svg(i),u=cr(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let h=[{x:0,y:0},{x:a,y:0},{x:0,y:s},{x:a,y:s}],f=On(h),d=l.path(f,u),p=i.insert(()=>d,":first-child");return p.attr("class","basic label-container outer-path"),o&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",o),n&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",n),p.attr("transform",`translate(${-a/2}, ${-s/2})`),gr(t,p),t.intersect=function(m){return se.info("Pill intersect",t,{points:h}),sr.polygon(t,h,m)},i}async function E8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,label:f}=await Hr(e,t,"icon-shape default"),d=t.pos==="t",p=o,m=o,{nodeBorder:g}=r,{stylesMap:y}=qy(t),v=-m/2,x=-p/2,w=t.label?8:0,C=gt.svg(u),T=cr(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let k=C.rectangle(v,x,m,p,T),S=Math.max(m,h.width),E=p+h.height+w,I=C.rectangle(-S/2,-E/2,S,E,{...T,fill:"transparent",stroke:"none"}),L=u.insert(()=>k,":first-child"),O=u.insert(()=>I);if(t.icon){let R=u.append("g");R.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let A=R.node().getBBox(),N=A.width,M=A.height,D=A.x,B=A.y;R.attr("transform",`translate(${-N/2-D},${d?h.height/2+w/2-M/2-B:-h.height/2-w/2-M/2-B})`),R.attr("style",`color: ${y.get("stroke")??g};`)}return f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${d?-E/2:E/2-h.height})`),L.attr("transform",`translate(0,${d?h.height/2+w/2:-h.height/2-w/2})`),gr(t,O),t.intersect=function(R){if(se.info("iconSquare intersect",t,R),!t.label)return sr.rect(t,R);let A=t.x??0,N=t.y??0,M=t.height??0,D=[];return d?D=[{x:A-h.width/2,y:N-M/2},{x:A+h.width/2,y:N-M/2},{x:A+h.width/2,y:N-M/2+h.height+w},{x:A+m/2,y:N-M/2+h.height+w},{x:A+m/2,y:N+M/2},{x:A-m/2,y:N+M/2},{x:A-m/2,y:N-M/2+h.height+w},{x:A-h.width/2,y:N-M/2+h.height+w}]:D=[{x:A-m/2,y:N-M/2},{x:A+m/2,y:N-M/2},{x:A+m/2,y:N-M/2+p},{x:A+h.width/2,y:N-M/2+p},{x:A+h.width/2/2,y:N+M/2},{x:A-h.width/2,y:N+M/2},{x:A-h.width/2,y:N-M/2+p},{x:A-m/2,y:N-M/2+p}],sr.polygon(t,D,R)},u}async function A8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,label:f}=await Hr(e,t,"icon-shape default"),d=20,p=t.label?8:0,m=t.pos==="t",{nodeBorder:g,mainBkg:y}=r,{stylesMap:v}=qy(t),x=gt.svg(u),w=cr(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let C=v.get("fill");w.stroke=C??y;let T=u.append("g");t.icon&&T.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let k=T.node().getBBox(),S=k.width,E=k.height,I=k.x,L=k.y,O=Math.max(S,E)*Math.SQRT2+d*2,R=x.circle(0,0,O,w),A=Math.max(O,h.width),N=O+h.height+p,M=x.rectangle(-A/2,-N/2,A,N,{...w,fill:"transparent",stroke:"none"}),D=u.insert(()=>R,":first-child"),B=u.insert(()=>M);return T.attr("transform",`translate(${-S/2-I},${m?h.height/2+p/2-E/2-L:-h.height/2-p/2-E/2-L})`),T.attr("style",`color: ${v.get("stroke")??g};`),f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${m?-N/2:N/2-h.height})`),D.attr("transform",`translate(0,${m?h.height/2+p/2:-h.height/2-p/2})`),gr(t,B),t.intersect=function(P){return se.info("iconSquare intersect",t,P),sr.rect(t,P)},u}async function _8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,halfPadding:f,label:d}=await Hr(e,t,"icon-shape default"),p=t.pos==="t",m=o+f*2,g=o+f*2,{nodeBorder:y,mainBkg:v}=r,{stylesMap:x}=qy(t),w=-g/2,C=-m/2,T=t.label?8:0,k=gt.svg(u),S=cr(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let E=x.get("fill");S.stroke=E??v;let I=k.path(Qm(w,C,g,m,5),S),L=Math.max(g,h.width),O=m+h.height+T,R=k.rectangle(-L/2,-O/2,L,O,{...S,fill:"transparent",stroke:"none"}),A=u.insert(()=>I,":first-child").attr("class","icon-shape2"),N=u.insert(()=>R);if(t.icon){let M=u.append("g");M.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let D=M.node().getBBox(),B=D.width,P=D.height,$=D.x,F=D.y;M.attr("transform",`translate(${-B/2-$},${p?h.height/2+T/2-P/2-F:-h.height/2-T/2-P/2-F})`),M.attr("style",`color: ${x.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${p?-O/2:O/2-h.height})`),A.attr("transform",`translate(0,${p?h.height/2+T/2:-h.height/2-T/2})`),gr(t,N),t.intersect=function(M){if(se.info("iconSquare intersect",t,M),!t.label)return sr.rect(t,M);let D=t.x??0,B=t.y??0,P=t.height??0,$=[];return p?$=[{x:D-h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2+h.height+T},{x:D+g/2,y:B-P/2+h.height+T},{x:D+g/2,y:B+P/2},{x:D-g/2,y:B+P/2},{x:D-g/2,y:B-P/2+h.height+T},{x:D-h.width/2,y:B-P/2+h.height+T}]:$=[{x:D-g/2,y:B-P/2},{x:D+g/2,y:B-P/2},{x:D+g/2,y:B-P/2+m},{x:D+h.width/2,y:B-P/2+m},{x:D+h.width/2/2,y:B+P/2},{x:D-h.width/2,y:B+P/2},{x:D-h.width/2,y:B-P/2+m},{x:D-g/2,y:B-P/2+m}],sr.polygon(t,$,M)},u}async function R8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,halfPadding:f,label:d}=await Hr(e,t,"icon-shape default"),p=t.pos==="t",m=o+f*2,g=o+f*2,{nodeBorder:y,mainBkg:v}=r,{stylesMap:x}=qy(t),w=-g/2,C=-m/2,T=t.label?8:0,k=gt.svg(u),S=cr(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let E=x.get("fill");S.stroke=E??v;let I=k.path(Qm(w,C,g,m,.1),S),L=Math.max(g,h.width),O=m+h.height+T,R=k.rectangle(-L/2,-O/2,L,O,{...S,fill:"transparent",stroke:"none"}),A=u.insert(()=>I,":first-child"),N=u.insert(()=>R);if(t.icon){let M=u.append("g");M.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let D=M.node().getBBox(),B=D.width,P=D.height,$=D.x,F=D.y;M.attr("transform",`translate(${-B/2-$},${p?h.height/2+T/2-P/2-F:-h.height/2-T/2-P/2-F})`),M.attr("style",`color: ${x.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${p?-O/2:O/2-h.height})`),A.attr("transform",`translate(0,${p?h.height/2+T/2:-h.height/2-T/2})`),gr(t,N),t.intersect=function(M){if(se.info("iconSquare intersect",t,M),!t.label)return sr.rect(t,M);let D=t.x??0,B=t.y??0,P=t.height??0,$=[];return p?$=[{x:D-h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2+h.height+T},{x:D+g/2,y:B-P/2+h.height+T},{x:D+g/2,y:B+P/2},{x:D-g/2,y:B+P/2},{x:D-g/2,y:B-P/2+h.height+T},{x:D-h.width/2,y:B-P/2+h.height+T}]:$=[{x:D-g/2,y:B-P/2},{x:D+g/2,y:B-P/2},{x:D+g/2,y:B-P/2+m},{x:D+h.width/2,y:B-P/2+m},{x:D+h.width/2/2,y:B+P/2},{x:D-h.width/2,y:B+P/2},{x:D-h.width/2,y:B-P/2+m},{x:D-g/2,y:B-P/2+m}],sr.polygon(t,$,M)},u}async function L8e(e,t,{config:{flowchart:r}}){let n=new Image;n.src=t?.img??"",await n.decode();let i=Number(n.naturalWidth.toString().replace("px","")),a=Number(n.naturalHeight.toString().replace("px",""));t.imageAspectRatio=i/a;let{labelStyles:s}=ar(t);t.labelStyle=s;let o=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;let l=Math.max(t.label?o??0:0,t?.assetWidth??i),u=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:l,h=t.constraint==="on"?u/t.imageAspectRatio:t?.assetHeight??a;t.width=Math.max(u,o??0);let{shapeSvg:f,bbox:d,label:p}=await Hr(e,t,"image-shape default"),m=t.pos==="t",g=-u/2,y=-h/2,v=t.label?8:0,x=gt.svg(f),w=cr(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let C=x.rectangle(g,y,u,h,w),T=Math.max(u,d.width),k=h+d.height+v,S=x.rectangle(-T/2,-k/2,T,k,{...w,fill:"none",stroke:"none"}),E=f.insert(()=>C,":first-child"),I=f.insert(()=>S);if(t.img){let L=f.append("image");L.attr("href",t.img),L.attr("width",u),L.attr("height",h),L.attr("preserveAspectRatio","none"),L.attr("transform",`translate(${-u/2},${m?k/2-h:-k/2})`)}return p.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${m?-h/2-d.height/2-v/2:h/2-d.height/2+v/2})`),E.attr("transform",`translate(0,${m?d.height/2+v/2:-d.height/2-v/2})`),gr(t,I),t.intersect=function(L){if(se.info("iconSquare intersect",t,L),!t.label)return sr.rect(t,L);let O=t.x??0,R=t.y??0,A=t.height??0,N=[];return m?N=[{x:O-d.width/2,y:R-A/2},{x:O+d.width/2,y:R-A/2},{x:O+d.width/2,y:R-A/2+d.height+v},{x:O+u/2,y:R-A/2+d.height+v},{x:O+u/2,y:R+A/2},{x:O-u/2,y:R+A/2},{x:O-u/2,y:R-A/2+d.height+v},{x:O-d.width/2,y:R-A/2+d.height+v}]:N=[{x:O-u/2,y:R-A/2},{x:O+u/2,y:R-A/2},{x:O+u/2,y:R-A/2+h},{x:O+d.width/2,y:R-A/2+h},{x:O+d.width/2/2,y:R+A/2},{x:O-d.width/2,y:R+A/2},{x:O-d.width/2,y:R-A/2+h},{x:O-u/2,y:R-A/2+h}],sr.polygon(t,N,L)},f}async function I8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=i,s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=Math.max(l.width+(s??0)*2,t?.width??0),h=Math.max(l.height+(a??0)*2,t?.height??0),f=[{x:0,y:0},{x:u,y:0},{x:u+3*h/6,y:-h},{x:-3*h/6,y:-h}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&d.attr("style",p)}else d=I0(o,u,h,f);return n&&d.attr("style",n),t.width=u,t.height=h,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}async function M8e(e,t){let{shapeSvg:r,bbox:n,label:i}=await Hr(e,t,"label"),a=r.insert("rect",":first-child");return a.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),i.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),gr(t,a),t.intersect=function(l){return sr.rect(t,l)},r}async function N8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=i,s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height??l.height)+a,h=(t?.width??l.width)+s,f=[{x:0,y:0},{x:h+3*u/6,y:0},{x:h,y:-u},{x:-(3*u)/6,y:-u}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&d.attr("style",p)}else d=I0(o,h,u,f);return n&&d.attr("style",n),t.width=h,t.height=u,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}async function D8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=i,s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height??l.height)+a,h=(t?.width??l.width)+s,f=[{x:-3*u/6,y:0},{x:h,y:0},{x:h+3*u/6,y:-u},{x:0,y:-u}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&d.attr("style",p)}else d=I0(o,h,u,f);return n&&d.attr("style",n),t.width=h,t.height=u,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}function O8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.label="",t.labelStyle=r;let i=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),{cssStyles:a}=t,s=Math.max(35,t?.width??0),o=Math.max(35,t?.height??0),l=7,u=[{x:s,y:0},{x:0,y:o+l/2},{x:s-2*l,y:o+l/2},{x:0,y:2*o},{x:s,y:o-l/2},{x:2*l,y:o-l/2}],h=gt.svg(i),f=cr(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let d=On(u),p=h.path(d,f),m=i.insert(()=>p,":first-child");return m.attr("class","outer-path"),a&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",a),n&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",n),m.attr("transform",`translate(-${s/2},${-o})`),gr(t,m),t.intersect=function(g){return se.info("lightningBolt intersect",t,g),sr.polygon(t,u,g)},i}async function P8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?24:i;if(t.width||t.height){let v=t.width??0;t.width=(t.width??0)-a,t.widthk,":first-child").attr("class","line"),g=o.insert(()=>T,":first-child"),g.attr("class","basic label-container"),y&&g.attr("style",y)}else{let v=c7t(0,0,h,p,f,d,m);g=o.insert("path",":first-child").attr("d",v).attr("class","basic label-container outer-path").attr("style",es(y)).attr("style",n)}return g.attr("label-offset-y",d),g.attr("transform",`translate(${-h/2}, ${-(p/2+d)})`),gr(t,g),u.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+d-(l.y-(l.top??0))})`),t.intersect=function(v){let x=sr.rect(t,v),w=x.x-(t.x??0);if(f!=0&&(Math.abs(w)<(t.width??0)/2||Math.abs(w)==(t.width??0)/2&&Math.abs(x.y-(t.y??0))>(t.height??0)/2-d)){let C=d*d*(1-w*w/(f*f));C>0&&(C=Math.sqrt(C)),C=d-C,v.y-(t.y??0)>0&&(C=-C),x.y+=C}return x},o}async function B8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i;if(t.width||t.height){let C=t.width;t.width=(C??0)*10/11-a*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-s*2,t.height<10&&(t.height=10)}let{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=(t?.width?t?.width:l.width)+(a??0)*2,f=(t?.height?t?.height:l.height)+(s??0)*2,d=t.look==="neo"?f/4:f/8,p=f+d,{cssStyles:m}=t,g=gt.svg(o),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=[{x:-h/2-h/2*.1,y:-p/2},{x:-h/2-h/2*.1,y:p/2},...Zm(-h/2-h/2*.1,p/2,h/2+h/2*.1,p/2,d,.8),{x:h/2+h/2*.1,y:-p/2},{x:-h/2-h/2*.1,y:-p/2},{x:-h/2,y:-p/2},{x:-h/2,y:p/2*1.1},{x:-h/2,y:-p/2}],x=g.polygon(v.map(C=>[C.x,C.y]),y),w=o.insert(()=>x,":first-child");return w.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",m),n&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(0,${-d/2})`),u.attr("transform",`translate(${-h/2+(t.padding??0)+h/2*.1/2-(l.x-(l.left??0))},${-f/2+(t.padding??0)-d/2-(l.y-(l.top??0))})`),gr(t,w),t.intersect=function(C){return sr.polygon(t,v,C)},o}async function F8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=t.look==="neo"?10:5;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-a*2-2*o,10),t.height=Math.max((t?.height??0)-s*2-2*o,10));let{shapeSvg:l,bbox:u,label:h}=await Hr(e,t,$r(t)),f=(t?.width?t?.width:u.width)+a*2+2*o,d=(t?.height?t?.height:u.height)+s*2+2*o,p=f-2*o,m=d-2*o,g=-p/2,y=-m/2,{cssStyles:v}=t,x=gt.svg(l),w=cr(t,{}),C=[{x:g-o,y:y+o},{x:g-o,y:y+m+o},{x:g+p-o,y:y+m+o},{x:g+p-o,y:y+m},{x:g+p,y:y+m},{x:g+p,y:y+m-o},{x:g+p+o,y:y+m-o},{x:g+p+o,y:y-o},{x:g+o,y:y-o},{x:g+o,y},{x:g,y},{x:g,y:y+o}],T=[{x:g,y:y+o},{x:g+p-o,y:y+o},{x:g+p-o,y:y+m},{x:g+p,y:y+m},{x:g+p,y},{x:g,y}];t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let k=On(C),S=x.path(k,w),E=On(T),I=x.path(E,w);t.look!=="handDrawn"&&(S=wY(S),I=wY(I));let L=l.insert("g",":first-child");return L.insert(()=>S),L.insert(()=>I),L.attr("class","basic label-container outer-path"),v&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",v),n&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",n),h.attr("transform",`translate(${-(u.width/2)-o-(u.x-(u.left??0))}, ${-(u.height/2)+o-(u.y-(u.top??0))})`),gr(t,L),t.intersect=function(O){return sr.polygon(t,C,O)},l}async function $8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await Hr(e,t,$r(t)),o=t.padding??0,l=t.look==="neo"?16:o,u=t.look==="neo"?12:o,h=!0;(t.width||t.height)&&(h=!1,t.width=(t?.width??0)-l*2,t.height=(t?.height??0)-u*3);let f=Math.max(a.width,t?.width??0)+l*2,d=Math.max(a.height,t?.height??0)+u*3,p=t.look==="neo"?d/4:d/8,m=d+(h?p/2:-p/2),g=-f/2,y=-m/2,v=10,{cssStyles:x}=t,w=Zm(g-v,y+m+v,g+f-v,y+m+v,p,.8),C=w?.[w.length-1],T=[{x:g-v,y:y+v},{x:g-v,y:y+m+v},...w,{x:g+f-v,y:C.y-v},{x:g+f,y:C.y-v},{x:g+f,y:C.y-2*v},{x:g+f+v,y:C.y-2*v},{x:g+f+v,y:y-v},{x:g+v,y:y-v},{x:g+v,y},{x:g,y},{x:g,y:y+v}],k=[{x:g,y:y+v},{x:g+f-v,y:y+v},{x:g+f-v,y:C.y-v},{x:g+f,y:C.y-v},{x:g+f,y},{x:g,y}],S=gt.svg(i),E=cr(t,{});t.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");let I=On(T),L=S.path(I,E),O=On(k),R=S.path(O,E),A=i.insert(()=>L,":first-child");return A.insert(()=>R),A.attr("class","basic label-container outer-path"),x&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",x),n&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",n),A.attr("transform",`translate(0,${-p/2})`),s.attr("transform",`translate(${-(a.width/2)-v-(a.x-(a.left??0))}, ${-(a.height/2)+v-p/2-(a.y-(a.top??0))})`),gr(t,A),t.intersect=function(N){return sr.polygon(t,T,N)},i}async function z8e(e,t,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n,t.useHtmlLabels||zn(qt())||(t.centerLabel=!0);let{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=Math.max(o.width+(t.padding??0)*2,t?.width??0),h=Math.max(o.height+(t.padding??0)*2,t?.height??0),f=-u/2,d=-h/2,{cssStyles:p}=t,m=gt.svg(s),g=cr(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=m.rectangle(f,d,u,h,g),v=s.insert(()=>y,":first-child");return v.attr("class","basic label-container outer-path"),l.attr("class","label noteLabel"),p&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),gr(t,v),t.intersect=function(x){return sr.rect(t,x)},s}async function G8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a}=await Hr(e,t,$r(t)),s=a.width+(t.padding??0),o=a.height+(t.padding??0),l=s+o,u=.5,h=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}],f,{cssStyles:d}=t;if(t.look==="handDrawn"){let p=gt.svg(i),m=cr(t,{}),g=f7t(0,0,l),y=p.path(g,m);f=i.insert(()=>y,":first-child").attr("transform",`translate(${-l/2+u}, ${l/2})`),d&&f.attr("style",d)}else f=I0(i,l,l,h),f.attr("transform",`translate(${-l/2+u}, ${l/2})`);return n&&f.attr("style",n),gr(t,f),t.calcIntersect=function(p,m){let g=p.width,y=[{x:g/2,y:0},{x:g,y:-g/2},{x:g/2,y:-g},{x:0,y:-g/2}],v=sr.polygon(p,y,m);return{x:v.x-.5,y:v.y-.5}},t.intersect=function(p){return this.calcIntersect(t,p)},i}async function q8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?21:i??0,s=t.look==="neo"?12:i??0,{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=(t?.width??l.width)+(t.look==="neo"?a*2:a),f=(t?.height??l.height)+(t.look==="neo"?s*2:s),d=-h/2,p=-f/2,m=p/2,g=[{x:d+m,y:p},{x:d,y:0},{x:d+m,y:-p},{x:-d,y:-p},{x:-d,y:p}],{cssStyles:y}=t,v=gt.svg(o),x=cr(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");let w=On(g),C=v.path(w,x),T=o.insert(()=>C,":first-child");return T.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",y),n&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",n),T.attr("transform",`translate(${-m/2},0)`),u.attr("transform",`translate(${-m/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),gr(t,T),t.intersect=function(k){return sr.polygon(t,g,k)},o}async function V8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i;t.cssClasses?i="node "+t.cssClasses:i="node default";let a=e.insert("g").attr("class",i).attr("id",t.domId||t.id),s=a.insert("g"),o=a.insert("g").attr("class","label").attr("style",n),l=t.description,u=t.label,h=await L0(o,u,t.labelStyle,!0,!0),f={width:0,height:0};if(zn(Be())){let E=h.children[0],I=ct(h);f=E.getBoundingClientRect(),I.attr("width",f.width),I.attr("height",f.height)}se.info("Text 2",l);let d=l||[],p=h.getBBox(),m=await L0(o,Array.isArray(d)?d.join("
"):d,t.labelStyle,!0,!0),g=m.children[0],y=ct(m);f=g.getBoundingClientRect(),y.attr("width",f.width),y.attr("height",f.height);let v=(t.padding||0)/2;ct(m).attr("transform","translate( "+(f.width>p.width?0:(p.width-f.width)/2)+", "+(p.height+v+5)+")"),ct(h).attr("transform","translate( "+(f.width(se.debug("Rough node insert CXC",L),O),":first-child"),k=a.insert(()=>(se.debug("Rough node insert CXC",L),L),":first-child")}else k=s.insert("rect",":first-child"),S=s.insert("line"),k.attr("class","outer title-state").attr("style",n).attr("x",-f.width/2-v).attr("y",-f.height/2-v).attr("width",f.width+(t.padding||0)).attr("height",f.height+(t.padding||0)),S.attr("class","divider").attr("x1",-f.width/2-v).attr("x2",f.width/2+v).attr("y1",-f.height/2-v+p.height+v).attr("y2",-f.height/2-v+p.height+v);return gr(t,k),t.intersect=function(E){return sr.rect(t,E)},a}async function W8e(e,t,{config:{themeVariables:r}}){let n=r?.radius??5,i={rx:n,ry:n,classes:"",labelPaddingX:(t?.padding??0)*1,labelPaddingY:(t?.padding??0)*1};return v4(e,t,i)}async function H8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?12:t.padding??0,{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=(t?.width??o.width)+i*2+(t.look==="neo"?Xy:Xy*2),h=(t?.height??o.height)+a*2,f=u-Xy,d=h,p=Xy-u/2,m=-h/2,{cssStyles:g}=t,y=gt.svg(s),v=cr(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let x=[{x:p,y:m},{x:p+f,y:m},{x:p+f,y:m+d},{x:p-Xy,y:m+d},{x:p-Xy,y:m},{x:p,y:m},{x:p,y:m+d}],w=y.polygon(x.map(T=>[T.x,T.y]),v),C=s.insert(()=>w,":first-child");return C.attr("class","basic label-container outer-path").attr("style",es(g)),n&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),g&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),l.attr("transform",`translate(${Xy/2-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),gr(t,C),t.intersect=function(T){return sr.rect(t,T)},s}async function U8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-a*2,10),t.height=Math.max((t?.height??0)/1.5-s*2,10));let{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=(t?.width?t?.width:l.width)+a*2,f=((t?.height?t?.height:l.height)+s*2)*1.5,d=h,p=f/1.5,m=-d/2,g=-p/2,{cssStyles:y}=t,v=gt.svg(o),x=cr(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");let w=[{x:m,y:g},{x:m,y:g+p},{x:m+d,y:g+p},{x:m+d,y:g-p/2}],C=On(w),T=v.path(C,x),k=o.insert(()=>T,":first-child");return k.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",y),n&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),k.attr("transform",`translate(0, ${p/4})`),u.attr("transform",`translate(${-d/2+(t.padding??0)-(l.x-(l.left??0))}, ${-p/4+(t.padding??0)-(l.y-(l.top??0))})`),gr(t,k),t.intersect=function(S){return sr.polygon(t,w,S)},o}async function Y8e(e,t){let r=t.padding??0,n=t.look==="neo"?16:r*2,i=t.look==="neo"?12:r,a={rx:0,ry:0,classes:"",labelPaddingX:t.labelPaddingX??n,labelPaddingY:i};return v4(e,t,a)}async function X8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?20:i,s=t.look==="neo"?12:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=l.height+(t.look==="neo"?s*2:s),h=l.width+u/4+(t.look==="neo"?a*2:a),f=u/2,{cssStyles:d}=t,p=gt.svg(o),m=cr(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let g=[{x:-h/2+f,y:-u/2},{x:h/2-f,y:-u/2},...eC(-h/2+f,0,f,50,90,270),{x:h/2-f,y:u/2},...eC(h/2-f,0,f,50,270,450)],y=On(g),v=p.path(y,m),x=o.insert(()=>v,":first-child");return x.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",d),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),gr(t,x),t.intersect=function(w){return sr.polygon(t,g,w)},o}async function j8e(e,t){let r={rx:t.look==="neo"?3:5,ry:t.look==="neo"?3:5,classes:"flowchart-node"};return v4(e,t,r)}function K8e(e,t,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n;let{cssStyles:a}=t,{lineColor:s,stateBorder:o,nodeBorder:l,nodeShadow:u}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let h=e.insert("g").attr("class","node default").attr("id",t.domId??t.id),f=gt.svg(h),d=cr(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let p=f.circle(0,0,t.width,{...d,stroke:s,strokeWidth:2}),m=o??l,g=(t.width??0)*5/14,y=f.circle(0,0,g,{...d,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),v=h.insert(()=>p,":first-child");if(v.insert(()=>y),t.look!=="handDrawn"&&v.attr("class","outer-path"),a&&v.selectAll("path").attr("style",a),i&&v.selectAll("path").attr("style",i),t.width<25&&u&&t.look!=="handDrawn"){let x=e.node()?.ownerSVGElement?.id??"",w=x?`${x}-drop-shadow-small`:"drop-shadow-small";v.attr("style",`filter:url(#${w})`)}return gr(t,v),t.intersect=function(x){return sr.circle(t,(t.width??0)/2,x)},h}function Z8e(e,t,{config:{themeVariables:r}}){let{lineColor:n,nodeShadow:i}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s;if(t.look==="handDrawn"){let l=gt.svg(a).circle(0,0,t.width,$6e(n));s=a.insert(()=>l),s.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14)}else s=a.insert("circle",":first-child"),s.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14);if(t.width<25&&i&&t.look!=="handDrawn"){let o=e.node()?.ownerSVGElement?.id??"",l=o?`${o}-drop-shadow-small`:"drop-shadow-small";s.attr("style",`filter:url(#${l})`)}return gr(t,s),t.intersect=function(o){return sr.circle(t,(t.width??7)/2,o)},a}async function Q8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t?.padding??8,a=t.look==="neo"?28:i,s=t.look==="neo"?12:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width??l.width)+2*m4+a,h=(t?.height??l.height)+s,f=u-2*m4,d=h,p=-u/2,m=-h/2,g=[{x:0,y:0},{x:f,y:0},{x:f,y:-d},{x:0,y:-d},{x:0,y:0},{x:-8,y:0},{x:f+8,y:0},{x:f+8,y:-d},{x:-8,y:-d},{x:-8,y:0}];if(t.look==="handDrawn"){let y=gt.svg(o),v=cr(t,{}),x=y.rectangle(p,m,f+16,d,v),w=y.line(p+m4,m,p+m4,m+d,v),C=y.line(p+m4+f,m,p+m4+f,m+d,v);o.insert(()=>w,":first-child"),o.insert(()=>C,":first-child");let T=o.insert(()=>x,":first-child"),{cssStyles:k}=t;T.attr("class","basic label-container").attr("style",es(k)),gr(t,T)}else{let y=I0(o,f,d,g);n&&y.attr("style",n),gr(t,y)}return t.intersect=function(y){return sr.polygon(t,g,y)},o}async function J8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i;(t.width||t.height)&&(t.height=Math.max((t?.height??0)-s*2,10),t.width=Math.max((t?.width??0)-a*2-bY*(t.height+s*2),10));let{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height?t?.height:l.height)+s*2,h=bY*u,f=bY*u,p=(t?.width?t?.width:l.width)+a*2+h-h,m=u,g=-p/2,y=-m/2,{cssStyles:v}=t,x=gt.svg(o),w=cr(t,{}),C=[{x:g-h/2,y},{x:g+p+h/2,y},{x:g+p+h/2,y:y+m},{x:g-h/2,y:y+m}],T=[{x:g+p-h/2,y:y+m},{x:g+p+h/2,y:y+m},{x:g+p+h/2,y:y+m-f}];t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let k=On(C),S=x.path(k,w),E=On(T),I=x.path(E,{...w,fillStyle:"solid"}),L=o.insert(()=>I,":first-child");return L.insert(()=>S,":first-child"),L.attr("class","basic label-container outer-path"),v&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",v),n&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",n),gr(t,L),t.intersect=function(O){return sr.polygon(t,C,O)},o}async function eAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await Hr(e,t,$r(t)),o=Math.max(a.width+(t.padding??0)*2,t?.width??0),l=Math.max(a.height+(t.padding??0)*2,t?.height??0),u=l/8,h=.2*o,f=.2*l,d=l+u,{cssStyles:p}=t,m=gt.svg(i),g=cr(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=[{x:-o/2-o/2*.1,y:d/2},...Zm(-o/2-o/2*.1,d/2,o/2+o/2*.1,d/2,u,.8),{x:o/2+o/2*.1,y:-d/2},{x:-o/2-o/2*.1,y:-d/2}],v=-o/2+o/2*.1,x=-d/2-f*.4,w=[{x:v+o-h,y:(x+l)*1.3},{x:v+o,y:x+l-f},{x:v+o,y:(x+l)*.9},...Zm(v+o,(x+l)*1.25,v+o-h,(x+l)*1.3,-l*.02,.5)],C=On(y),T=m.path(C,g),k=On(w),S=m.path(k,{...g,fillStyle:"solid"}),E=i.insert(()=>S,":first-child");return E.insert(()=>T,":first-child"),E.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",p),n&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(0,${-u/2})`),s.attr("transform",`translate(${-o/2+(t.padding??0)-(a.x-(a.left??0))},${-l/2+(t.padding??0)-u/2-(a.y-(a.top??0))})`),gr(t,E),t.intersect=function(I){return sr.polygon(t,y,I)},i}async function tAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a}=await Hr(e,t,$r(t)),s=Math.max(a.width+(t.padding??0),t?.width||0),o=Math.max(a.height+(t.padding??0),t?.height||0),l=-s/2,u=-o/2,h=i.insert("rect",":first-child");return h.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",l).attr("y",u).attr("width",s).attr("height",o),gr(t,h),t.intersect=function(f){return sr.rect(t,f)},i}async function rAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?12:i/2;if(t.width||t.height){let g=t.height??0;t.height=(t.height??0)-a,t.heightw,":first-child"),m=s.insert(()=>x,":first-child"),m.attr("class","basic label-container"),p&&m.attr("style",p)}else{let g=d7t(0,0,d,u,f,h);m=s.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",es(p)).attr("style",n),m.attr("class","basic label-container outer-path"),p&&m.selectAll("path").attr("style",p),n&&m.selectAll("path").attr("style",n)}return m.attr("label-offset-x",f),m.attr("transform",`translate(${-d/2}, ${u/2} )`),l.attr("transform",`translate(${-(o.width/2)-f-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),gr(t,m),t.intersect=function(g){let y=sr.rect(t,g),v=y.y-(t.y??0);if(h!=0&&(Math.abs(v)<(t.height??0)/2||Math.abs(v)==(t.height??0)/2&&Math.abs(y.x-(t.x??0))>(t.width??0)/2-f)){let x=f*f*(1-v*v/(h*h));x!=0&&(x=Math.sqrt(Math.abs(x))),x=f-x,g.x-(t.x??0)>0&&(x=-x),y.x+=x}return y},s}async function nAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=(t.look==="neo",i),s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height??l.height)+a,h=(t?.width??l.width)+s,f=[{x:-3*u/6,y:0},{x:h+3*u/6,y:0},{x:h,y:-u},{x:0,y:-u}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&d.attr("style",p)}else d=I0(o,h,u,f);return n&&d.attr("style",n),t.width=h,t.height=u,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}async function iAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=15,l=5;(t.width||t.height)&&(t.height=(t.height??0)-s*2,t.heightx,":first-child");return w.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",p),n&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),gr(t,w),t.intersect=function(C){return sr.polygon(t,y,C)},u}async function aAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?i*2:i;(t.width||t.height)&&(t.width=((t?.width??0)-a)/2,t.widthx,":first-child").attr("transform",`translate(${-f/2}, ${f/2})`).attr("class","outer-path");return m&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",m),n&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),t.width=h,t.height=f,gr(t,w),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${f/2-(o.height+(t.padding??0)/(u?2:1)-(o.y-(o.top??0)))})`),t.intersect=function(C){return se.info("Triangle intersect",t,p,C),sr.polygon(t,p,C)},s}async function sAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=!0;(t.width||t.height)&&(o=!1,t.width=(t?.width??0)-a*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-s*2,t.height<10&&(t.height=10));let{shapeSvg:l,bbox:u,label:h}=await Hr(e,t,$r(t)),f=(t?.width?t?.width:u.width)+(a??0)*2,d=(t?.height?t?.height:u.height)+(s??0)*2,p=t.look==="neo"?d/4:d/8,m=d+(o?p:-p),{cssStyles:g}=t,v=14-f,x=v>0?v/2:0,w=gt.svg(l),C=cr(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");let T=[{x:-f/2-x,y:m/2},...Zm(-f/2-x,m/2,f/2+x,m/2,p,.8),{x:f/2+x,y:-m/2},{x:-f/2-x,y:-m/2}],k=On(T),S=w.path(k,C),E=l.insert(()=>S,":first-child");return E.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(0,${-p/2})`),h.attr("transform",`translate(${-f/2+(t.padding??0)-(u.x-(u.left??0))},${-d/2+(t.padding??0)-p-(u.y-(u.top??0))})`),gr(t,E),t.intersect=function(I){return sr.polygon(t,T,I)},l}async function oAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?20:i;if(t.width||t.height){t.width=t?.width??0,t.width<20&&(t.width=20),t.height=t?.height??0,t.height<10&&(t.height=10);let C=Math.min(t.height*.2,t.height/4);t.height=Math.ceil(t.height-s-C*(20/9)),t.width=t.width-a*2}let{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width?t?.width:l.width)+a*2,h=(t?.height?t?.height:l.height)+s,f=h/8,d=h+f*2,{cssStyles:p}=t,m=gt.svg(o),g=cr(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=[{x:-u/2,y:d/2},...Zm(-u/2,d/2,u/2,d/2,f,1),{x:u/2,y:-d/2},...Zm(u/2,-d/2,-u/2,-d/2,f,-1)],v=On(y),x=m.path(v,g),w=o.insert(()=>x,":first-child");return w.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",n),gr(t,w),t.intersect=function(C){return sr.polygon(t,y,C)},o}async function lAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-i*2-Ea,10),t.height=Math.max((t?.height??0)-a*2-Ea,10));let{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=(t?.width?t?.width:o.width)+i*2+Ea,h=(t?.height?t?.height:o.height)+a*2+Ea,f=u-Ea,d=h-Ea,p=-f/2,m=-d/2,{cssStyles:g}=t,y=gt.svg(s),v=cr(t,{}),x=[{x:p-Ea,y:m-Ea},{x:p-Ea,y:m+d},{x:p+f,y:m+d},{x:p+f,y:m-Ea}],w=`M${p-Ea},${m-Ea} L${p+f},${m-Ea} L${p+f},${m+d} L${p-Ea},${m+d} L${p-Ea},${m-Ea} +`);return vR(n)}function y7e(e){return e.split(/\\n|\n|/gi).map(t=>t.trim().match(/<[^>]+>|[^\s<>]+/g)?.map(r=>({content:r,type:"normal"}))??[])}function v7e(e,t={}){let r=g7e(e,t),n=fi.lexer(r),i=[[]],a=0;function s(o,l="normal"){o.type==="text"?o.text.split(` +`).forEach((h,f)=>{f!==0&&(a++,i.push([])),h.split(" ").forEach(d=>{d=d.replace(/'/g,"'"),d&&i[a].push({content:d,type:l})})}):o.type==="strong"||o.type==="em"?o.tokens.forEach(u=>{s(u,o.type)}):o.type==="html"&&i[a].push({content:o.text,type:"normal"})}return b(s,"processNode"),n.forEach(o=>{o.type==="paragraph"?o.tokens?.forEach(l=>{s(l)}):o.type==="html"?i[a].push({content:o.text,type:"normal"}):i[a].push({content:o.raw,type:"normal"})}),i}function x7e(e){return e?`

${e.replace(/\\n|\n/g,"
")}

`:""}function b7e(e,{markdownAutoWrap:t}={}){let r=fi.lexer(e);function n(i){return i.type==="text"?t===!1?i.text.replace(/\n */g,"
").replace(/ /g," "):i.text.replace(/\n */g,"
"):i.type==="strong"?`${i.tokens?.map(n).join("")}`:i.type==="em"?`${i.tokens?.map(n).join("")}`:i.type==="paragraph"?`

${i.tokens?.map(n).join("")}

`:i.type==="space"?"":i.type==="html"?`${i.text}`:i.type==="escape"?i.text:(se.warn(`Unsupported markdown: ${i.type}`),i.raw)}return b(n,"output"),r.map(n).join("")}function w7e(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}function k7e(e,t){let r=w7e(t.content);return rY(e,[],r,t.type)}function rY(e,t,r,n){if(r.length===0)return[{content:t.join(""),type:n},{content:"",type:n}];let[i,...a]=r,s=[...t,i];return e([{content:s.join(""),type:n}])?rY(e,s,a,n):(t.length===0&&i&&(t.push(i),r.shift()),[{content:t.join(""),type:n},{content:r.join(""),type:n}])}function T7e(e,t){if(e.some(({content:r})=>r.includes(` +`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return xR(e,t)}function xR(e,t,r=[],n=[]){if(e.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let i="";e[0].content===" "&&(i=" ",e.shift());let a=e.shift()??{content:" ",type:"normal"},s=[...n];if(i!==""&&s.push({content:i,type:"normal"}),s.push(a),t(s))return xR(e,t,r,s);if(n.length>0)r.push(n),e.unshift(a);else if(a.content){let[o,l]=k7e(t,a);r.push([o]),l.content&&e.unshift(l)}return xR(e,t,r)}function eY(e,t){t&&e.attr("style",t)}async function C7e(e,t,r,n,i=!1,a=qt()){let s=e.append("foreignObject");s.attr("width",`${Math.min(10*r,m7e)}px`),s.attr("height",`${Math.min(10*r,m7e)}px`);let o=s.append("xhtml:div"),l=sa(t.label)?await Lb(t.label.replace(Ct.lineBreakRegex,` +`),a):Mr(t.label,a),u=t.isNode?"nodeLabel":"edgeLabel",h=o.append("span");h.html(l),eY(h,t.labelStyle),h.attr("class",`${u} ${n}`),eY(o,t.labelStyle),o.style("display","table-cell"),o.style("white-space","nowrap"),o.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(o.style("max-width",r+"px"),o.style("text-align","center")),o.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&o.attr("class","labelBkg");let f=o.node().getBoundingClientRect();return f.width===r&&(o.style("display","table"),o.style("white-space","break-spaces"),o.style("width",r+"px"),f=o.node().getBoundingClientRect()),s.node()}function bR(e,t,r,n=!1){let i=e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em");return n&&i.attr("text-anchor","middle"),i}function S7e(e,t,r){let n=e.append("text"),i=bR(n,1,t);wR(i,r);let a=i.node().getComputedTextLength();return n.remove(),a}function nY(e,t,r){let n=e.append("text"),i=bR(n,1,t);wR(i,[{content:r,type:"normal"}]);let a=i.node()?.getBoundingClientRect();return a&&n.remove(),a}function E7e(e,t,r,n=!1,i=!1){let s=t.append("g"),o=s.insert("rect").attr("class","background").attr("style","stroke: none"),l=s.append("text").attr("y","-10.1");i&&l.attr("text-anchor","middle");let u=0;for(let h of r){let f=b(p=>S7e(s,1.1,p)<=e,"checkWidth"),d=f(h)?[h]:T7e(h,f);for(let p of d){let m=bR(l,u,1.1,i);wR(m,p),u++}}if(n){let h=l.node().getBBox(),f=2;return o.attr("x",h.x-f).attr("y",h.y-f).attr("width",h.width+2*f).attr("height",h.height+2*f),s.node()}else return l.node()}function tY(e){let t=/&(amp|lt|gt);/g;return e.replace(t,(r,n)=>{switch(n){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return r}})}function wR(e,t){e.text(""),t.forEach((r,n)=>{let i=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?i.text(tY(r.content)):i.text(" "+tY(r.content))})}async function A7e(e,t={}){let r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,a,s)=>(r.push((async()=>{let o=`${a}:${s}`;return await KEe(o)?await zc(o,void 0,{class:"label-icon"}):``})()),i));let n=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}var m7e,rs,bs=W(()=>{ts();Sn();_r();Rr();hr();fn();p7e();JU();b(g7e,"preprocessMarkdown");b(y7e,"nonMarkdownToLines");b(v7e,"markdownToLines");b(x7e,"nonMarkdownToHTML");b(b7e,"markdownToHTML");b(w7e,"splitTextToChars");b(k7e,"splitWordToFitWidth");b(rY,"splitWordToFitWidthRecursion");b(T7e,"splitLineToFitWidth");b(xR,"splitLineToFitWidthRecursion");b(eY,"applyStyle");m7e=16384;b(C7e,"addHtmlSpan");b(bR,"createTspan");b(S7e,"computeWidthOfText");b(nY,"computeDimensionOfText");b(E7e,"createFormattedText");b(tY,"decodeHTMLEntities");b(wR,"updateTextContentAndStyles");b(A7e,"replaceIconSubstring");rs=b(async(e,t="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:a=!0,markdown:s=!0,isNode:o=!0,width:l=200,addSvgBackground:u=!1}={},h)=>{if(se.debug("XYZ createText",t,r,n,i,a,o,"addSvgBackground: ",u),a){let f=s?b7e(t,h):x7e(t),d=await A7e($c(f),h),p=t.replace(/\\\\/g,"\\"),m={isNode:o,label:sa(t)?p:d,labelStyle:r.replace("fill:","color:")};return await C7e(e,m,l,i,u,h)}else{let f=$c(t.replace(//g,"
")),d=s?v7e(f.replace("
","
"),h):y7e(f),p=E7e(l,e,d,t?u:!1,!o);if(o){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));let m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ct(p).attr("style",m)}else{let m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");ct(p).select("rect").attr("style",m.replace(/background:/g,"fill:"));let g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ct(p).select("text").attr("style",g)}return n?ct(p).selectAll("tspan.text-outer-tspan").classed("title-row",!0):ct(p).selectAll("tspan.text-outer-tspan").classed("row",!0),p}},"createText")});function iY(e,t,r){if(e&&e.length){let[n,i]=t,a=Math.PI/180*r,s=Math.cos(a),o=Math.sin(a);for(let l of e){let[u,h]=l;l[0]=(u-n)*s-(h-i)*o+n,l[1]=(u-n)*o+(h-i)*s+i}}}function qEt(e,t){return e[0]===t[0]&&e[1]===t[1]}function VEt(e,t,r,n=1){let i=r,a=Math.max(t,.1),s=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,o=[0,0];if(i)for(let u of s)iY(u,o,i);let l=(function(u,h,f){let d=[];for(let x of u){let w=[...x];qEt(w[0],w[w.length-1])||w.push([w[0][0],w[0][1]]),w.length>2&&d.push(w)}let p=[];h=Math.max(h,.1);let m=[];for(let x of d)for(let w=0;wx.yminw.ymin?1:x.xw.x?1:x.ymax===w.ymax?0:(x.ymax-w.ymax)/Math.abs(x.ymax-w.ymax))),!m.length)return p;let g=[],y=m[0].ymin,v=0;for(;g.length||m.length;){if(m.length){let x=-1;for(let w=0;wy);w++)x=w;m.splice(0,x+1).forEach((w=>{g.push({s:y,edge:w})}))}if(g=g.filter((x=>!(x.edge.ymax<=y))),g.sort(((x,w)=>x.edge.x===w.edge.x?0:(x.edge.x-w.edge.x)/Math.abs(x.edge.x-w.edge.x))),(f!==1||v%h==0)&&g.length>1)for(let x=0;x=g.length)break;let C=g[x].edge,T=g[w].edge;p.push([[Math.round(C.x),y],[Math.round(T.x),y]])}y+=f,g.forEach((x=>{x.edge.x=x.edge.x+f*x.edge.islope})),v++}return p})(s,a,n);if(i){for(let u of s)iY(u,o,-i);(function(u,h,f){let d=[];u.forEach((p=>d.push(...p))),iY(d,h,f)})(l,o,-i)}return l}function Q3(e,t){var r;let n=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=4*t.strokeWidth),i=Math.round(Math.max(i,.1));let a=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(a=i),VEt(e,i,n,a||1)}function LR(e){let t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}function sY(e,t){return e.type===t}function bY(e){let t=[],r=(function(s){let o=new Array;for(;s!=="";)if(s.match(/^([ \t\r\n,]+)/))s=s.substr(RegExp.$1.length);else if(s.match(/^([aAcChHlLmMqQsStTvVzZ])/))o[o.length]={type:WEt,text:RegExp.$1},s=s.substr(RegExp.$1.length);else{if(!s.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];o[o.length]={type:aY,text:`${parseFloat(RegExp.$1)}`},s=s.substr(RegExp.$1.length)}return o[o.length]={type:_7e,text:""},o})(e),n="BOD",i=0,a=r[i];for(;!sY(a,_7e);){let s=0,o=[];if(n==="BOD"){if(a.text!=="M"&&a.text!=="m")return bY("M0,0"+e);i++,s=kR[a.text],n=a.text}else sY(a,aY)?s=kR[n]:(i++,s=kR[a.text],n=a.text);if(!(i+sh%2?u+r:u+t));a.push({key:"C",data:l}),t=l[4],r=l[5];break}case"Q":a.push({key:"Q",data:[...o]}),t=o[2],r=o[3];break;case"q":{let l=o.map(((u,h)=>h%2?u+r:u+t));a.push({key:"Q",data:l}),t=l[2],r=l[3];break}case"A":a.push({key:"A",data:[...o]}),t=o[5],r=o[6];break;case"a":t+=o[5],r+=o[6],a.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],t,r]});break;case"H":a.push({key:"H",data:[...o]}),t=o[0];break;case"h":t+=o[0],a.push({key:"H",data:[t]});break;case"V":a.push({key:"V",data:[...o]}),r=o[0];break;case"v":r+=o[0],a.push({key:"V",data:[r]});break;case"S":a.push({key:"S",data:[...o]}),t=o[2],r=o[3];break;case"s":{let l=o.map(((u,h)=>h%2?u+r:u+t));a.push({key:"S",data:l}),t=l[2],r=l[3];break}case"T":a.push({key:"T",data:[...o]}),t=o[0],r=o[1];break;case"t":t+=o[0],r+=o[1],a.push({key:"T",data:[t,r]});break;case"Z":case"z":a.push({key:"Z",data:[]}),t=n,r=i}return a}function B7e(e){let t=[],r="",n=0,i=0,a=0,s=0,o=0,l=0;for(let{key:u,data:h}of e){switch(u){case"M":t.push({key:"M",data:[...h]}),[n,i]=h,[a,s]=h;break;case"C":t.push({key:"C",data:[...h]}),n=h[4],i=h[5],o=h[2],l=h[3];break;case"L":t.push({key:"L",data:[...h]}),[n,i]=h;break;case"H":n=h[0],t.push({key:"L",data:[n,i]});break;case"V":i=h[0],t.push({key:"L",data:[n,i]});break;case"S":{let f=0,d=0;r==="C"||r==="S"?(f=n+(n-o),d=i+(i-l)):(f=n,d=i),t.push({key:"C",data:[f,d,...h]}),o=h[0],l=h[1],n=h[2],i=h[3];break}case"T":{let[f,d]=h,p=0,m=0;r==="Q"||r==="T"?(p=n+(n-o),m=i+(i-l)):(p=n,m=i);let g=n+2*(p-n)/3,y=i+2*(m-i)/3,v=f+2*(p-f)/3,x=d+2*(m-d)/3;t.push({key:"C",data:[g,y,v,x,f,d]}),o=p,l=m,n=f,i=d;break}case"Q":{let[f,d,p,m]=h,g=n+2*(f-n)/3,y=i+2*(d-i)/3,v=p+2*(f-p)/3,x=m+2*(d-m)/3;t.push({key:"C",data:[g,y,v,x,p,m]}),o=f,l=d,n=p,i=m;break}case"A":{let f=Math.abs(h[0]),d=Math.abs(h[1]),p=h[2],m=h[3],g=h[4],y=h[5],v=h[6];f===0||d===0?(t.push({key:"C",data:[n,i,y,v,y,v]}),n=y,i=v):(n!==y||i!==v)&&(F7e(n,i,y,v,f,d,p,m,g).forEach((function(x){t.push({key:"C",data:x})})),n=y,i=v);break}case"Z":t.push({key:"Z",data:[]}),n=a,i=s}r=u}return t}function j3(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function F7e(e,t,r,n,i,a,s,o,l,u){let h=(f=s,Math.PI*f/180);var f;let d=[],p=0,m=0,g=0,y=0;if(u)[p,m,g,y]=u;else{[e,t]=j3(e,t,-h),[r,n]=j3(r,n,-h);let A=(e-r)/2,N=(t-n)/2,M=A*A/(i*i)+N*N/(a*a);M>1&&(M=Math.sqrt(M),i*=M,a*=M);let D=i*i,B=a*a,P=D*B-D*N*N-B*A*A,$=D*N*N+B*A*A,F=(o===l?-1:1)*Math.sqrt(Math.abs(P/$));g=F*i*N/a+(e+r)/2,y=F*-a*A/i+(t+n)/2,p=Math.asin(parseFloat(((t-y)/a).toFixed(9))),m=Math.asin(parseFloat(((n-y)/a).toFixed(9))),em&&(p-=2*Math.PI),!l&&m>p&&(m-=2*Math.PI)}let v=m-p;if(Math.abs(v)>120*Math.PI/180){let A=m,N=r,M=n;m=l&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,d=F7e(r=g+i*Math.cos(m),n=y+a*Math.sin(m),N,M,i,a,s,0,l,[m,A,g,y])}v=m-p;let x=Math.cos(p),w=Math.sin(p),C=Math.cos(m),T=Math.sin(m),k=Math.tan(v/4),S=4/3*i*k,E=4/3*a*k,I=[e,t],L=[e+S*w,t-E*x],O=[r+S*T,n-E*C],R=[r,n];if(L[0]=2*I[0]-L[0],L[1]=2*I[1]-L[1],u)return[L,O,R].concat(d);{d=[L,O,R].concat(d);let A=[];for(let N=0;N2){let i=[];for(let a=0;a2*Math.PI&&(p=0,m=2*Math.PI);let g=2*Math.PI/l.curveStepCount,y=Math.min(g/2,(m-p)/2),v=D7e(y,u,h,f,d,p,m,1,l);if(!l.disableMultiStroke){let x=D7e(y,u,h,f,d,p,m,1.5,l);v.push(...x)}return s&&(o?v.push(...Km(u,h,u+f*Math.cos(p),h+d*Math.sin(p),l),...Km(u,h,u+f*Math.cos(m),h+d*Math.sin(m),l)):v.push({op:"lineTo",data:[u,h]},{op:"lineTo",data:[u+f*Math.cos(p),h+d*Math.sin(p)]})),{type:"path",ops:v}}function I7e(e,t){let r=B7e(P7e(bY(e))),n=[],i=[0,0],a=[0,0];for(let{key:s,data:o}of r)switch(s){case"M":a=[o[0],o[1]],i=[o[0],o[1]];break;case"L":n.push(...Km(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case"C":{let[l,u,h,f,d,p]=o;n.push(...YEt(l,u,h,f,d,p,a,t)),a=[d,p];break}case"Z":n.push(...Km(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:"path",ops:n}}function oY(e,t){let r=[];for(let n of e)if(n.length){let i=t.maxRandomnessOffset||0,a=n.length;if(a>2){r.push({op:"move",data:[n[0][0]+Wr(i,t),n[0][1]+Wr(i,t)]});for(let s=1;s500?.4:-.0016668*l+1.233334;let h=i.maxRandomnessOffset||0;h*h*100>o&&(h=l/10);let f=h/2,d=.2+.2*G7e(i),p=i.bowing*i.maxRandomnessOffset*(n-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-r)/200;p=Wr(p,i,u),m=Wr(m,i,u);let g=[],y=()=>Wr(f,i,u),v=()=>Wr(h,i,u),x=i.preserveVertices;return a&&(s?g.push({op:"move",data:[e+(x?0:y()),t+(x?0:y())]}):g.push({op:"move",data:[e+(x?0:Wr(h,i,u)),t+(x?0:Wr(h,i,u))]})),s?g.push({op:"bcurveTo",data:[p+e+(r-e)*d+y(),m+t+(n-t)*d+y(),p+e+2*(r-e)*d+y(),m+t+2*(n-t)*d+y(),r+(x?0:y()),n+(x?0:y())]}):g.push({op:"bcurveTo",data:[p+e+(r-e)*d+v(),m+t+(n-t)*d+v(),p+e+2*(r-e)*d+v(),m+t+2*(n-t)*d+v(),r+(x?0:v()),n+(x?0:v())]}),g}function TR(e,t,r){if(!e.length)return[];let n=[];n.push([e[0][0]+Wr(t,r),e[0][1]+Wr(t,r)]),n.push([e[0][0]+Wr(t,r),e[0][1]+Wr(t,r)]);for(let i=1;i3){let a=[],s=1-r.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let o=1;o+21&&i.push(o)):i.push(o),i.push(e[t+3])}else{let l=e[t+0],u=e[t+1],h=e[t+2],f=e[t+3],d=Yy(l,u,.5),p=Yy(u,h,.5),m=Yy(h,f,.5),g=Yy(d,p,.5),y=Yy(p,m,.5),v=Yy(g,y,.5);yY([l,d,g,v],0,r,i),yY([v,y,m,f],0,r,i)}var a,s;return i}function jEt(e,t){return RR(e,0,e.length,t)}function RR(e,t,r,n,i){let a=i||[],s=e[t],o=e[r-1],l=0,u=1;for(let h=t+1;hl&&(l=f,u=h)}return Math.sqrt(l)>n?(RR(e,t,u+1,n,a),RR(e,u,r,n,a)):(a.length||a.push(s),a.push(o)),a}function lY(e,t=.15,r){let n=[],i=(e.length-1)/3;for(let a=0;a0?RR(n,0,n.length,r):n}var Z3,cY,uY,hY,fY,dY,Jl,pY,WEt,aY,_7e,kR,HEt,Gc,p4,vY,CR,xY,gt,dr=W(()=>{Z3=class{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){let n=Q3(t,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(t,r){let n=[];for(let i of t)n.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],r));return n}};cY=class extends Z3{fillPolygons(t,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);let i=Q3(t,Object.assign({},r,{hachureGap:n})),a=Math.PI/180*r.hachureAngle,s=[],o=.5*n*Math.cos(a),l=.5*n*Math.sin(a);for(let[u,h]of i)LR([u,h])&&s.push([[u[0]-o,u[1]+l],[...h]],[[u[0]+o,u[1]-l],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,r)}}},uY=class extends Z3{fillPolygons(t,r){let n=this._fillPolygons(t,r),i=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),a=this._fillPolygons(t,i);return n.ops=n.ops.concat(a.ops),n}},hY=class{constructor(t){this.helper=t}fillPolygons(t,r){let n=Q3(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(t,r){let n=[],i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);let a=r.fillWeight;a<0&&(a=r.strokeWidth/2);let s=i/4;for(let o of t){let l=LR(o),u=l/i,h=Math.ceil(u)-1,f=l-h*i,d=(o[0][0]+o[1][0])/2-i/4,p=Math.min(o[0][1],o[1][1]);for(let m=0;m{let o=LR(s),l=Math.floor(o/(n+i)),u=(o+i-l*(n+i))/2,h=s[0],f=s[1];h[0]>f[0]&&(h=s[1],f=s[0]);let d=Math.atan((f[1]-h[1])/(f[0]-h[0]));for(let p=0;p{let s=LR(a),o=Math.round(s/(2*r)),l=a[0],u=a[1];l[0]>u[0]&&(l=a[1],u=a[0]);let h=Math.atan((u[1]-l[1])/(u[0]-l[0]));for(let f=0;f2*Math.PI&&(S=0,E=2*Math.PI);let I=(E-S)/x.curveStepCount,L=[];for(let O=S;O<=E;O+=I)L.push([w+T*Math.cos(O),C+k*Math.sin(O)]);return L.push([w+T*Math.cos(E),C+k*Math.sin(E)]),L.push([w,C]),d4([L],x)})(t,r,n,i,a,s,u));return u.stroke!==Gc&&h.push(f),this._d("arc",h,u)}curve(t,r){let n=this._o(r),i=[],a=R7e(t,n);if(n.fill&&n.fill!==Gc)if(n.fillStyle==="solid"){let s=R7e(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=[],o=t;if(o.length){let l=typeof o[0][0]=="number"?[o]:o;for(let u of l)u.length<3?s.push(...u):u.length===3?s.push(...lY(O7e([u[0],u[0],u[1],u[2]]),10,(1+n.roughness)/2)):s.push(...lY(O7e(u),10,(1+n.roughness)/2))}s.length&&i.push(d4([s],n))}return n.stroke!==Gc&&i.push(a),this._d("curve",i,n)}polygon(t,r){let n=this._o(r),i=[],a=SR(t,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(oY([t],n)):i.push(d4([t],n))),n.stroke!==Gc&&i.push(a),this._d("polygon",i,n)}path(t,r){let n=this._o(r),i=[];if(!t)return this._d("path",i,n);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=n.fill&&n.fill!=="transparent"&&n.fill!==Gc,s=n.stroke!==Gc,o=!!(n.simplification&&n.simplification<1),l=(function(h,f,d){let p=B7e(P7e(bY(h))),m=[],g=[],y=[0,0],v=[],x=()=>{v.length>=4&&g.push(...lY(v,f)),v=[]},w=()=>{x(),g.length&&(m.push(g),g=[])};for(let{key:T,data:k}of p)switch(T){case"M":w(),y=[k[0],k[1]],g.push(y);break;case"L":x(),g.push([k[0],k[1]]);break;case"C":if(!v.length){let S=g.length?g[g.length-1]:y;v.push([S[0],S[1]])}v.push([k[0],k[1]]),v.push([k[2],k[3]]),v.push([k[4],k[5]]);break;case"Z":x(),g.push([y[0],y[1]])}if(w(),!d)return m;let C=[];for(let T of m){let k=jEt(T,d);k.length&&C.push(k)}return C})(t,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),u=I7e(t,n);if(a)if(n.fillStyle==="solid")if(l.length===1){let h=I7e(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else i.push(oY(l,n));else i.push(d4(l,n));return s&&(o?l.forEach((h=>{i.push(SR(h,!1,n))})):i.push(u)),this._d("path",i,n)}opsToPath(t,r){let n="";for(let i of t.ops){let a=typeof r=="number"&&r>=0?i.data.map((s=>+s.toFixed(r))):i.data;switch(i.op){case"move":n+=`M${a[0]} ${a[1]} `;break;case"bcurveTo":n+=`C${a[0]} ${a[1]}, ${a[2]} ${a[3]}, ${a[4]} ${a[5]} `;break;case"lineTo":n+=`L${a[0]} ${a[1]} `}}return n.trim()}toPaths(t){let r=t.sets||[],n=t.options||this.defaultOptions,i=[];for(let a of r){let s=null;switch(a.type){case"path":s={d:this.opsToPath(a),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:Gc};break;case"fillPath":s={d:this.opsToPath(a),stroke:Gc,strokeWidth:0,fill:n.fill||Gc};break;case"fillSketch":s=this.fillSketch(a,n)}s&&i.push(s)}return i}fillSketch(t,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||Gc,strokeWidth:n,fill:Gc}}_mergedShape(t){return t.filter(((r,n)=>n===0||r.op!=="move"))}},vY=class{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new p4(r)}draw(t){let r=t.sets||[],n=t.options||this.getDefaultOptions(),i=this.ctx,a=t.options.fixedDecimalPlaceDigits;for(let s of r)switch(s.type){case"path":i.save(),i.strokeStyle=n.stroke==="none"?"transparent":n.stroke,i.lineWidth=n.strokeWidth,n.strokeLineDash&&i.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(i.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(i,s,a),i.restore();break;case"fillPath":{i.save(),i.fillStyle=n.fill||"";let o=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,a,o),i.restore();break}case"fillSketch":this.fillSketch(i,s,n)}}fillSketch(t,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2),t.save(),n.fillLineDash&&t.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(t.lineDashOffset=n.fillLineDashOffset),t.strokeStyle=n.fill||"",t.lineWidth=i,this._drawToContext(t,r,n.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,n,i="nonzero"){t.beginPath();for(let a of r.ops){let s=typeof n=="number"&&n>=0?a.data.map((o=>+o.toFixed(n))):a.data;switch(a.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1])}}r.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,n,i,a){let s=this.gen.line(t,r,n,i,a);return this.draw(s),s}rectangle(t,r,n,i,a){let s=this.gen.rectangle(t,r,n,i,a);return this.draw(s),s}ellipse(t,r,n,i,a){let s=this.gen.ellipse(t,r,n,i,a);return this.draw(s),s}circle(t,r,n,i){let a=this.gen.circle(t,r,n,i);return this.draw(a),a}linearPath(t,r){let n=this.gen.linearPath(t,r);return this.draw(n),n}polygon(t,r){let n=this.gen.polygon(t,r);return this.draw(n),n}arc(t,r,n,i,a,s,o=!1,l){let u=this.gen.arc(t,r,n,i,a,s,o,l);return this.draw(u),u}curve(t,r){let n=this.gen.curve(t,r);return this.draw(n),n}path(t,r){let n=this.gen.path(t,r);return this.draw(n),n}},CR="http://www.w3.org/2000/svg",xY=class{constructor(t,r){this.svg=t,this.gen=new p4(r)}draw(t){let r=t.sets||[],n=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,a=i.createElementNS(CR,"g"),s=t.options.fixedDecimalPlaceDigits;for(let o of r){let l=null;switch(o.type){case"path":l=i.createElementNS(CR,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=i.createElementNS(CR,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(i,o,n)}l&&a.appendChild(l)}return a}fillSketch(t,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);let a=t.createElementNS(CR,"path");return a.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),a.setAttribute("stroke",n.fill||""),a.setAttribute("stroke-width",i+""),a.setAttribute("fill","none"),n.fillLineDash&&a.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,n,i,a){let s=this.gen.line(t,r,n,i,a);return this.draw(s)}rectangle(t,r,n,i,a){let s=this.gen.rectangle(t,r,n,i,a);return this.draw(s)}ellipse(t,r,n,i,a){let s=this.gen.ellipse(t,r,n,i,a);return this.draw(s)}circle(t,r,n,i){let a=this.gen.circle(t,r,n,i);return this.draw(a)}linearPath(t,r){let n=this.gen.linearPath(t,r);return this.draw(n)}polygon(t,r){let n=this.gen.polygon(t,r);return this.draw(n)}arc(t,r,n,i,a,s,o=!1,l){let u=this.gen.arc(t,r,n,i,a,s,o,l);return this.draw(u)}curve(t,r){let n=this.gen.curve(t,r);return this.draw(n)}path(t,r){let n=this.gen.path(t,r);return this.draw(n)}},gt={canvas:(e,t)=>new vY(e,t),svg:(e,t)=>new xY(e,t),generator:e=>new p4(e),newSeed:()=>p4.newSeed()}});function On(e){let t=e.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}function Zm(e,t,r,n,i,a){let s=[],l=r-e,u=n-t,h=l/a,f=2*Math.PI/h,d=t+u/2;for(let p=0;p<=50;p++){let m=p/50,g=e+m*l,y=d+i*Math.sin(f*(g-e));s.push({x:g,y})}return s}function eC(e,t,r,n,i,a){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fl.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=t.map(l=>l.getAttribute("d")).filter(l=>l!==null).join(" ");r.setAttribute("d",n);let i=t.find(l=>l.getAttribute("fill")!=="none"),a=t.find(l=>l.getAttribute("stroke")!=="none"),s=b((l,u)=>l?.getAttribute(u)??void 0,"getAttr");if(i){let l={fill:s(i,"fill"),"fill-opacity":s(i,"fill-opacity")??"1"};Object.entries(l).forEach(([u,h])=>{h&&r.setAttribute(u,h)})}if(a){let l={stroke:s(a,"stroke"),"stroke-width":s(a,"stroke-width")??"1","stroke-opacity":s(a,"stroke-opacity")??"1"};Object.entries(l).forEach(([u,h])=>{h&&r.setAttribute(u,h)})}let o=document.createElementNS("http://www.w3.org/2000/svg","g");return o.appendChild(r),o}function t8e(e,t){return e.intersect(t)}function r8e(e,t,r,n){var i=e.x,a=e.y,s=i-n.x,o=a-n.y,l=Math.sqrt(t*t*o*o+r*r*s*s),u=Math.abs(t*r*s/l);n.x0}function s8e(e,t,r){let n=e.x,i=e.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(h){s=Math.min(s,h.x),o=Math.min(o,h.y)}):(s=Math.min(s,t.x),o=Math.min(o,t.y));let l=n-e.width/2-s,u=i-e.height/2-o;for(let h=0;h1&&a.sort(function(h,f){let d=h.x-r.x,p=h.y-r.y,m=Math.sqrt(d*d+p*p),g=f.x-r.x,y=f.y-r.y,v=Math.sqrt(g*g+y*y);return mh,":first-child");return f.attr("class","anchor").attr("style",es(o)),gr(t,f),t.intersect=function(d){return se.info("Circle intersect",t,s,d),sr.circle(t,s,d)},a}function SY(e,t,r,n,i,a,s){let l=(e+r)/2,u=(t+n)/2,h=Math.atan2(n-t,r-e),f=(r-e)/2,d=(n-t)/2,p=f/i,m=d/a,g=Math.sqrt(p**2+m**2);if(g>1)throw new Error("The given radii are too small to create an arc between the points.");let y=Math.sqrt(1-g**2),v=l+y*a*Math.sin(h)*(s?-1:1),x=u-y*i*Math.cos(h)*(s?-1:1),w=Math.atan2((t-x)/a,(e-v)/i),T=Math.atan2((n-x)/a,(r-v)/i)-w;s&&T<0&&(T+=2*Math.PI),!s&&T>0&&(T-=2*Math.PI);let k=[];for(let S=0;S<20;S++){let E=S/19,I=w+E*T,L=v+i*Math.cos(I),O=x+a*Math.sin(I);k.push({x:L,y:O})}return k}function l8e(e,t,r){let[n,i]=[t,r].sort((a,s)=>s-a);return i*(1-Math.sqrt(1-(e/n/2)**2))}async function c8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=b(I=>I+s,"calcTotalHeight"),l=b(I=>{let L=I/2;return[L/(2.5+I/50),L]},"calcEllipseRadius"),{shapeSvg:u,bbox:h}=await Hr(e,t,$r(t)),f=o(t?.height?t?.height:h.height),[d,p]=l(f),m=l8e(f,d,p),y=(t?.width?t?.width:h.width)+a*2+m-m,v=f,{cssStyles:x}=t,w=[{x:y/2,y:-v/2},{x:-y/2,y:-v/2},...SY(-y/2,-v/2,-y/2,v/2,d,p,!1),{x:y/2,y:v/2},...SY(y/2,v/2,y/2,-v/2,d,p,!0)],C=gt.svg(u),T=cr(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let k=On(w),S=C.path(k,T),E=u.insert(()=>S,":first-child");return E.attr("class","basic label-container outer-path"),x&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",x),n&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(${d/2}, 0)`),gr(t,E),t.intersect=function(I){return sr.polygon(t,w,I)},u}function I0(e,t,r,n){return e.insert("polygon",":first-child").attr("points",n.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}async function u8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?28:i,s=t.look==="neo"?24:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width??l.width)+(t.look==="neo"?a*2:a+IR),h=(t?.height??l.height)+(t.look==="neo"?s*2:s),f=0,d=u,p=-h,m=0,g=[{x:f+IR,y:p},{x:d,y:p},{x:d,y:m},{x:f,y:m},{x:f,y:p+IR},{x:f+IR,y:p}],y,{cssStyles:v}=t;if(t.look==="handDrawn"){let x=gt.svg(o),w=cr(t,{}),C=On(g),T=x.path(C,w);y=o.insert(()=>T,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),v&&y.attr("style",v)}else y=I0(o,u,h,g);return n&&y.attr("style",n),gr(t,y),t.intersect=function(x){return sr.polygon(t,g,x)},o}function h8e(e,t){let{nodeStyles:r}=ar(t);t.label="";let n=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),{cssStyles:i}=t,a=Math.max(28,t.width??0),s=[{x:0,y:a/2},{x:a/2,y:0},{x:0,y:-a/2},{x:-a/2,y:0}],o=gt.svg(n),l=cr(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let u=On(s),h=o.path(u,l),f=n.insert(()=>h,":first-child");return i&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",i),r&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(d){return sr.polygon(t,s,d)},n}async function EY(e,t,r){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n;let{shapeSvg:a,bbox:s,halfPadding:o}=await Hr(e,t,$r(t)),l=16,u=r?.padding??o,h=t.look==="neo"?s.width/2+l*2:s.width/2+u,f,{cssStyles:d}=t;if(t.look==="handDrawn"){let p=gt.svg(a),m=cr(t,{}),g=p.circle(0,0,h*2,m);f=a.insert(()=>g,":first-child"),f.attr("class","basic label-container").attr("style",es(d))}else f=a.insert("circle",":first-child").attr("class","basic label-container").attr("style",i).attr("r",h).attr("cx",0).attr("cy",0);return gr(t,f),t.calcIntersect=function(p,m){let g=p.width/2;return sr.circle(p,g,m)},t.intersect=function(p){return se.info("Circle intersect",t,h,p),sr.circle(t,h,p)},a}function f8e(e){let t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=e*2,i={x:n/2*t,y:n/2*r},a={x:-(n/2)*t,y:n/2*r},s={x:-(n/2)*t,y:-(n/2)*r},o={x:n/2*t,y:-(n/2)*r};return`M ${a.x},${a.y} L ${o.x},${o.y} + M ${i.x},${i.y} L ${s.x},${s.y}`}function d8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r,t.label="";let i=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),a=Math.max(30,t?.width??0),{cssStyles:s}=t,o=gt.svg(i),l=cr(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let u=o.circle(0,0,a*2,l),h=f8e(a),f=o.path(h,l),d=i.insert(()=>u,":first-child");return d.insert(()=>f),d.attr("class","outer-path"),s&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",s),n&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",n),gr(t,d),t.intersect=function(p){return se.info("crossedCircle intersect",t,{radius:a,point:p}),sr.circle(t,a,p)},i}function _0(e,t,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fT,":first-child").attr("stroke-opacity",0),k.insert(()=>w,":first-child"),k.attr("class","text"),d&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",d),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(${f}, 0)`),s.attr("transform",`translate(${-u/2+f-(a.x-(a.left??0))},${-h/2+(t.padding??0)/2-(a.y-(a.top??0))})`),gr(t,k),t.intersect=function(S){return sr.polygon(t,m,S)},i}function R0(e,t,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fT,":first-child").attr("stroke-opacity",0),k.insert(()=>w,":first-child"),k.attr("class","text"),d&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",d),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(${-f}, 0)`),s.attr("transform",`translate(${-u/2+(t.padding??0)/2-(a.x-(a.left??0))},${-h/2+(t.padding??0)/2-(a.y-(a.top??0))})`),gr(t,k),t.intersect=function(S){return sr.polygon(t,m,S)},i}function fo(e,t,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fI,":first-child").attr("stroke-opacity",0),L.insert(()=>C,":first-child"),L.insert(()=>S,":first-child"),L.attr("class","text"),d&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",d),n&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(${f-f/4}, 0)`),s.attr("transform",`translate(${-u/2+(t.padding??0)/2-(a.x-(a.left??0))},${-h/2+(t.padding??0)/2-(a.y-(a.top??0))})`),gr(t,L),t.intersect=function(O){return sr.polygon(t,g,O)},i}async function y8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=20,l=5,{shapeSvg:u,bbox:h}=await Hr(e,t,$r(t)),f=Math.max(o,(h.width+a*2)*1.25,t?.width??0),d=Math.max(l,h.height+s*2,t?.height??0),p=d/2,{cssStyles:m}=t,g=gt.svg(u),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=f,x=d,w=v-p,C=x/4,T=[{x:w,y:0},{x:C,y:0},{x:0,y:x/2},{x:C,y:x},{x:w,y:x},...eC(-w,-x/2,p,50,270,90)],k=On(T),S=g.path(k,y),E=u.insert(()=>S,":first-child");return E.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&E.selectChildren("path").attr("style",m),n&&t.look!=="handDrawn"&&E.selectChildren("path").attr("style",n),E.attr("transform",`translate(${-f/2}, ${-d/2})`),gr(t,E),t.intersect=function(I){return sr.polygon(t,T,I)},u}async function v8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?24:i,s=t.look==="neo"?24:i;if(t.width||t.height){let y=t.width??0;t.width=(t.width??0)-s,t.widthT,":first-child"),m=o.insert(()=>C,":first-child"),m.attr("class","basic label-container"),g&&m.attr("style",g)}else{let y=c7t(0,0,h,p,f,d);m=o.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",es(g)).attr("style",n)}return m.attr("label-offset-y",d),m.attr("transform",`translate(${-h/2}, ${-(p/2+d)})`),gr(t,m),u.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+(t.padding??0)/1.5-(l.y-(l.top??0))})`),t.intersect=function(y){let v=sr.rect(t,y),x=v.x-(t.x??0);if(f!=0&&(Math.abs(x)<(t.width??0)/2||Math.abs(x)==(t.width??0)/2&&Math.abs(v.y-(t.y??0))>(t.height??0)/2-d)){let w=d*d*(1-x*x/(f*f));w>0&&(w=Math.sqrt(w)),w=d-w,y.y-(t.y??0)>0&&(w=-w),v.y+=w}return v},o}async function v4(e,t,r){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n;let{shapeSvg:a,bbox:s}=await Hr(e,t,$r(t)),o=Math.max(s.width+r.labelPaddingX*2,t?.width||0),l=Math.max(s.height+r.labelPaddingY*2,t?.height||0),u=-o/2,h=-l/2,f,{rx:d,ry:p}=t,{cssStyles:m}=t;if(r?.rx&&r.ry&&(d=r.rx,p=r.ry),t.look==="handDrawn"){let g=gt.svg(a),y=cr(t,{}),v=d||p?g.path(Qm(u,h,o,l,d||0),y):g.rectangle(u,h,o,l,y);f=a.insert(()=>v,":first-child"),f.attr("class","basic label-container").attr("style",es(m))}else f=a.insert("rect",":first-child"),f.attr("class","basic label-container").attr("style",i).attr("rx",es(d)).attr("ry",es(p)).attr("x",u).attr("y",h).attr("width",o).attr("height",l);return gr(t,f),t.calcIntersect=function(g,y){return sr.rect(g,y)},t.intersect=function(g){return sr.rect(t,g)},a}async function x8e(e,t){let{cssClasses:r,labelPaddingX:n,labelPaddingY:i,padding:a,width:s,height:o}=t,l={rx:0,ry:0,classes:r??"",labelPaddingX:n??(a??0)*2,labelPaddingY:i??a??0},u=await v4(e,t,l);if(t.look==="handDrawn"){let p=gt.svg(u),m=cr(t,{}),g=u.select(".basic.label-container > path:nth-child(2)"),y=g.node();if(!y)return u;let v=null;if(y instanceof SVGGraphicsElement)v=y.getBBox();else return u;return u.insert(()=>p.line(v.x,v.y,v.x+v.width,v.y,m),".basic.label-container g.label"),u.insert(()=>p.line(v.x,v.y+v.height,v.x+v.width,v.y+v.height,m),".basic.label-container g.label"),g.remove(),u}let h=u.select(".basic.label-container"),f=(Number(h.attr("width"))||s)??0,d=(Number(h.attr("height"))||o)??0;return f>0&&d>0&&h.attr("stroke-dasharray",`${f} ${d}`),u}async function b8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?16:t.padding??0,{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=o.width+i,h=o.height+a,f=h*.2,d=-u/2,p=-h/2-f/2,{cssStyles:m}=t,g=gt.svg(s),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=[{x:d,y:p+f},{x:-d,y:p+f},{x:-d,y:-p},{x:d,y:-p},{x:d,y:p},{x:-d,y:p},{x:-d,y:p+f}],x=g.polygon(v.map(C=>[C.x,C.y]),y),w=s.insert(()=>x,":first-child");return w.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",m),n&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",n),l.attr("transform",`translate(${d+(t.padding??0)/2-(o.x-(o.left??0))}, ${p+f+(t.padding??0)/2-(o.y-(o.top??0))})`),gr(t,w),t.intersect=function(C){return sr.rect(t,C)},s}async function w8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t),i=t.look==="neo"?12:5;t.labelStyle=r;let a=t.padding??0,s=t.look==="neo"?16:a,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width?t?.width/2:l.width/2)+(s??0),h=u-i,f,{cssStyles:d}=t;if(t.look==="handDrawn"){let p=gt.svg(o),m=cr(t,{roughness:.2,strokeWidth:2.5}),g=cr(t,{roughness:.2,strokeWidth:1.5}),y=p.circle(0,0,u*2,m),v=p.circle(0,0,h*2,g);f=o.insert("g",":first-child"),f.attr("class",es(t.cssClasses)).attr("style",es(d)),f.node()?.appendChild(y),f.node()?.appendChild(v)}else{f=o.insert("g",":first-child");let p=f.insert("circle",":first-child"),m=f.insert("circle");f.attr("class","basic label-container").attr("style",n),p.attr("class","outer-circle").attr("style",n).attr("r",u).attr("cx",0).attr("cy",0),m.attr("class","inner-circle").attr("style",n).attr("r",h).attr("cx",0).attr("cy",0)}return gr(t,f),t.intersect=function(p){return se.info("DoubleCircle intersect",t,u,p),sr.circle(t,u,p)},o}function k8e(e,t,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=ar(t);t.label="",t.labelStyle=n;let a=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),s=7,{cssStyles:o}=t,l=gt.svg(a),{nodeBorder:u}=r,h=cr(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(h.roughness=0);let f=l.circle(0,0,s*2,h),d=a.insert(()=>f,":first-child");return d.selectAll("path").attr("style",`fill: ${u} !important;`),o&&o.length>0&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",o),i&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",i),gr(t,d),t.intersect=function(p){return se.info("filledCircle intersect",t,{radius:s,point:p}),sr.circle(t,s,p)},a}async function T8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?i*2:i;(t.width||t.height)&&(t.height=t?.height??0,t.heightv,":first-child").attr("transform",`translate(${-h/2}, ${h/2})`).attr("class","outer-path");return p&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",p),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),t.width=u,t.height=h,gr(t,x),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-h/2+(t.padding??0)/2+(o.y-(o.top??0))})`),t.intersect=function(w){return se.info("Triangle intersect",t,d,w),sr.polygon(t,d,w)},s}function C8e(e,t,{dir:r,config:{state:n,themeVariables:i}}){let{nodeStyles:a}=ar(t);t.label="";let s=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),{cssStyles:o}=t,l=Math.max(70,t?.width??0),u=Math.max(10,t?.height??0);r==="LR"&&(l=Math.max(10,t?.width??0),u=Math.max(70,t?.height??0));let h=-1*l/2,f=-1*u/2,d=gt.svg(s),p=cr(t,{stroke:i.lineColor,fill:i.lineColor});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let m=d.rectangle(h,f,l,u,p),g=s.insert(()=>m,":first-child");o&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",o),a&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",a),gr(t,g);let y=n?.padding??0;return t.width&&t.height&&(t.width+=y/2||0,t.height+=y/2||0),t.intersect=function(v){return sr.rect(t,v)},s}async function S8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=15,a=10,s=t.look==="neo"?16:t.padding??0,o=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.height=(t?.height??0)-o*2,t.heightx,":first-child");return w.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",p),n&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),gr(t,w),t.intersect=function(C){return se.info("Pill intersect",t,{radius:d,point:C}),sr.polygon(t,y,C)},l}async function E8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t),i=t.look==="neo"?3.5:4;t.labelStyle=r;let a=t.padding??0,s=70,o=32,l=t.look==="neo"?s:a,u=t.look==="neo"?o:a;if(t.width||t.height){let w=(t.height??0)/i;t.width=(t?.width??0)-2*w-u,t.height=(t.height??0)-l}let{shapeSvg:h,bbox:f}=await Hr(e,t,$r(t)),d=(t?.height?t?.height:f.height)+l,p=d/i,m=(t?.width?t?.width:f.width)+2*p+u,g=[{x:p,y:0},{x:m-p,y:0},{x:m,y:-d/2},{x:m-p,y:-d},{x:p,y:-d},{x:0,y:-d/2}],y,{cssStyles:v}=t;if(t.look==="handDrawn"){let x=gt.svg(h),w=cr(t,{}),C=f7t(0,0,m,d,p),T=x.path(C,w);y=h.insert(()=>T,":first-child").attr("transform",`translate(${-m/2}, ${d/2})`),v&&y.attr("style",v)}else y=I0(h,m,d,g);return n&&y.attr("style",n),t.width=m,t.height=d,gr(t,y),t.intersect=function(x){return sr.polygon(t,g,x)},h}async function A8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.label="",t.labelStyle=r;let{shapeSvg:i}=await Hr(e,t,$r(t)),a=Math.max(30,t?.width??0),s=Math.max(30,t?.height??0),{cssStyles:o}=t,l=gt.svg(i),u=cr(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let h=[{x:0,y:0},{x:a,y:0},{x:0,y:s},{x:a,y:s}],f=On(h),d=l.path(f,u),p=i.insert(()=>d,":first-child");return p.attr("class","basic label-container outer-path"),o&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",o),n&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",n),p.attr("transform",`translate(${-a/2}, ${-s/2})`),gr(t,p),t.intersect=function(m){return se.info("Pill intersect",t,{points:h}),sr.polygon(t,h,m)},i}async function _8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,label:f}=await Hr(e,t,"icon-shape default"),d=t.pos==="t",p=o,m=o,{nodeBorder:g}=r,{stylesMap:y}=qy(t),v=-m/2,x=-p/2,w=t.label?8:0,C=gt.svg(u),T=cr(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let k=C.rectangle(v,x,m,p,T),S=Math.max(m,h.width),E=p+h.height+w,I=C.rectangle(-S/2,-E/2,S,E,{...T,fill:"transparent",stroke:"none"}),L=u.insert(()=>k,":first-child"),O=u.insert(()=>I);if(t.icon){let R=u.append("g");R.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let A=R.node().getBBox(),N=A.width,M=A.height,D=A.x,B=A.y;R.attr("transform",`translate(${-N/2-D},${d?h.height/2+w/2-M/2-B:-h.height/2-w/2-M/2-B})`),R.attr("style",`color: ${y.get("stroke")??g};`)}return f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${d?-E/2:E/2-h.height})`),L.attr("transform",`translate(0,${d?h.height/2+w/2:-h.height/2-w/2})`),gr(t,O),t.intersect=function(R){if(se.info("iconSquare intersect",t,R),!t.label)return sr.rect(t,R);let A=t.x??0,N=t.y??0,M=t.height??0,D=[];return d?D=[{x:A-h.width/2,y:N-M/2},{x:A+h.width/2,y:N-M/2},{x:A+h.width/2,y:N-M/2+h.height+w},{x:A+m/2,y:N-M/2+h.height+w},{x:A+m/2,y:N+M/2},{x:A-m/2,y:N+M/2},{x:A-m/2,y:N-M/2+h.height+w},{x:A-h.width/2,y:N-M/2+h.height+w}]:D=[{x:A-m/2,y:N-M/2},{x:A+m/2,y:N-M/2},{x:A+m/2,y:N-M/2+p},{x:A+h.width/2,y:N-M/2+p},{x:A+h.width/2/2,y:N+M/2},{x:A-h.width/2,y:N+M/2},{x:A-h.width/2,y:N-M/2+p},{x:A-m/2,y:N-M/2+p}],sr.polygon(t,D,R)},u}async function R8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,label:f}=await Hr(e,t,"icon-shape default"),d=20,p=t.label?8:0,m=t.pos==="t",{nodeBorder:g,mainBkg:y}=r,{stylesMap:v}=qy(t),x=gt.svg(u),w=cr(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let C=v.get("fill");w.stroke=C??y;let T=u.append("g");t.icon&&T.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let k=T.node().getBBox(),S=k.width,E=k.height,I=k.x,L=k.y,O=Math.max(S,E)*Math.SQRT2+d*2,R=x.circle(0,0,O,w),A=Math.max(O,h.width),N=O+h.height+p,M=x.rectangle(-A/2,-N/2,A,N,{...w,fill:"transparent",stroke:"none"}),D=u.insert(()=>R,":first-child"),B=u.insert(()=>M);return T.attr("transform",`translate(${-S/2-I},${m?h.height/2+p/2-E/2-L:-h.height/2-p/2-E/2-L})`),T.attr("style",`color: ${v.get("stroke")??g};`),f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${m?-N/2:N/2-h.height})`),D.attr("transform",`translate(0,${m?h.height/2+p/2:-h.height/2-p/2})`),gr(t,B),t.intersect=function(P){return se.info("iconSquare intersect",t,P),sr.rect(t,P)},u}async function L8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,halfPadding:f,label:d}=await Hr(e,t,"icon-shape default"),p=t.pos==="t",m=o+f*2,g=o+f*2,{nodeBorder:y,mainBkg:v}=r,{stylesMap:x}=qy(t),w=-g/2,C=-m/2,T=t.label?8:0,k=gt.svg(u),S=cr(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let E=x.get("fill");S.stroke=E??v;let I=k.path(Qm(w,C,g,m,5),S),L=Math.max(g,h.width),O=m+h.height+T,R=k.rectangle(-L/2,-O/2,L,O,{...S,fill:"transparent",stroke:"none"}),A=u.insert(()=>I,":first-child").attr("class","icon-shape2"),N=u.insert(()=>R);if(t.icon){let M=u.append("g");M.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let D=M.node().getBBox(),B=D.width,P=D.height,$=D.x,F=D.y;M.attr("transform",`translate(${-B/2-$},${p?h.height/2+T/2-P/2-F:-h.height/2-T/2-P/2-F})`),M.attr("style",`color: ${x.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${p?-O/2:O/2-h.height})`),A.attr("transform",`translate(0,${p?h.height/2+T/2:-h.height/2-T/2})`),gr(t,N),t.intersect=function(M){if(se.info("iconSquare intersect",t,M),!t.label)return sr.rect(t,M);let D=t.x??0,B=t.y??0,P=t.height??0,$=[];return p?$=[{x:D-h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2+h.height+T},{x:D+g/2,y:B-P/2+h.height+T},{x:D+g/2,y:B+P/2},{x:D-g/2,y:B+P/2},{x:D-g/2,y:B-P/2+h.height+T},{x:D-h.width/2,y:B-P/2+h.height+T}]:$=[{x:D-g/2,y:B-P/2},{x:D+g/2,y:B-P/2},{x:D+g/2,y:B-P/2+m},{x:D+h.width/2,y:B-P/2+m},{x:D+h.width/2/2,y:B+P/2},{x:D-h.width/2,y:B+P/2},{x:D-h.width/2,y:B-P/2+m},{x:D-g/2,y:B-P/2+m}],sr.polygon(t,$,M)},u}async function I8e(e,t,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=ar(t);t.labelStyle=i;let a=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;t.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,halfPadding:f,label:d}=await Hr(e,t,"icon-shape default"),p=t.pos==="t",m=o+f*2,g=o+f*2,{nodeBorder:y,mainBkg:v}=r,{stylesMap:x}=qy(t),w=-g/2,C=-m/2,T=t.label?8:0,k=gt.svg(u),S=cr(t,{});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");let E=x.get("fill");S.stroke=E??v;let I=k.path(Qm(w,C,g,m,.1),S),L=Math.max(g,h.width),O=m+h.height+T,R=k.rectangle(-L/2,-O/2,L,O,{...S,fill:"transparent",stroke:"none"}),A=u.insert(()=>I,":first-child"),N=u.insert(()=>R);if(t.icon){let M=u.append("g");M.html(`${await zc(t.icon,{height:o,width:o,fallbackPrefix:""})}`);let D=M.node().getBBox(),B=D.width,P=D.height,$=D.x,F=D.y;M.attr("transform",`translate(${-B/2-$},${p?h.height/2+T/2-P/2-F:-h.height/2-T/2-P/2-F})`),M.attr("style",`color: ${x.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${p?-O/2:O/2-h.height})`),A.attr("transform",`translate(0,${p?h.height/2+T/2:-h.height/2-T/2})`),gr(t,N),t.intersect=function(M){if(se.info("iconSquare intersect",t,M),!t.label)return sr.rect(t,M);let D=t.x??0,B=t.y??0,P=t.height??0,$=[];return p?$=[{x:D-h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2},{x:D+h.width/2,y:B-P/2+h.height+T},{x:D+g/2,y:B-P/2+h.height+T},{x:D+g/2,y:B+P/2},{x:D-g/2,y:B+P/2},{x:D-g/2,y:B-P/2+h.height+T},{x:D-h.width/2,y:B-P/2+h.height+T}]:$=[{x:D-g/2,y:B-P/2},{x:D+g/2,y:B-P/2},{x:D+g/2,y:B-P/2+m},{x:D+h.width/2,y:B-P/2+m},{x:D+h.width/2/2,y:B+P/2},{x:D-h.width/2,y:B+P/2},{x:D-h.width/2,y:B-P/2+m},{x:D-g/2,y:B-P/2+m}],sr.polygon(t,$,M)},u}async function M8e(e,t,{config:{flowchart:r}}){let n=new Image;n.src=t?.img??"",await n.decode();let i=Number(n.naturalWidth.toString().replace("px","")),a=Number(n.naturalHeight.toString().replace("px",""));t.imageAspectRatio=i/a;let{labelStyles:s}=ar(t);t.labelStyle=s;let o=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;let l=Math.max(t.label?o??0:0,t?.assetWidth??i),u=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:l,h=t.constraint==="on"?u/t.imageAspectRatio:t?.assetHeight??a;t.width=Math.max(u,o??0);let{shapeSvg:f,bbox:d,label:p}=await Hr(e,t,"image-shape default"),m=t.pos==="t",g=-u/2,y=-h/2,v=t.label?8:0,x=gt.svg(f),w=cr(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let C=x.rectangle(g,y,u,h,w),T=Math.max(u,d.width),k=h+d.height+v,S=x.rectangle(-T/2,-k/2,T,k,{...w,fill:"none",stroke:"none"}),E=f.insert(()=>C,":first-child"),I=f.insert(()=>S);if(t.img){let L=f.append("image");L.attr("href",t.img),L.attr("width",u),L.attr("height",h),L.attr("preserveAspectRatio","none"),L.attr("transform",`translate(${-u/2},${m?k/2-h:-k/2})`)}return p.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${m?-h/2-d.height/2-v/2:h/2-d.height/2+v/2})`),E.attr("transform",`translate(0,${m?d.height/2+v/2:-d.height/2-v/2})`),gr(t,I),t.intersect=function(L){if(se.info("iconSquare intersect",t,L),!t.label)return sr.rect(t,L);let O=t.x??0,R=t.y??0,A=t.height??0,N=[];return m?N=[{x:O-d.width/2,y:R-A/2},{x:O+d.width/2,y:R-A/2},{x:O+d.width/2,y:R-A/2+d.height+v},{x:O+u/2,y:R-A/2+d.height+v},{x:O+u/2,y:R+A/2},{x:O-u/2,y:R+A/2},{x:O-u/2,y:R-A/2+d.height+v},{x:O-d.width/2,y:R-A/2+d.height+v}]:N=[{x:O-u/2,y:R-A/2},{x:O+u/2,y:R-A/2},{x:O+u/2,y:R-A/2+h},{x:O+d.width/2,y:R-A/2+h},{x:O+d.width/2/2,y:R+A/2},{x:O-d.width/2,y:R+A/2},{x:O-d.width/2,y:R-A/2+h},{x:O-u/2,y:R-A/2+h}],sr.polygon(t,N,L)},f}async function N8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=i,s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=Math.max(l.width+(s??0)*2,t?.width??0),h=Math.max(l.height+(a??0)*2,t?.height??0),f=[{x:0,y:0},{x:u,y:0},{x:u+3*h/6,y:-h},{x:-3*h/6,y:-h}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&d.attr("style",p)}else d=I0(o,u,h,f);return n&&d.attr("style",n),t.width=u,t.height=h,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}async function D8e(e,t){let{shapeSvg:r,bbox:n,label:i}=await Hr(e,t,"label"),a=r.insert("rect",":first-child");return a.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),i.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),gr(t,a),t.intersect=function(l){return sr.rect(t,l)},r}async function O8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=i,s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height??l.height)+a,h=(t?.width??l.width)+s,f=[{x:0,y:0},{x:h+3*u/6,y:0},{x:h,y:-u},{x:-(3*u)/6,y:-u}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&d.attr("style",p)}else d=I0(o,h,u,f);return n&&d.attr("style",n),t.width=h,t.height=u,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}async function P8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=i,s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height??l.height)+a,h=(t?.width??l.width)+s,f=[{x:-3*u/6,y:0},{x:h,y:0},{x:h+3*u/6,y:-u},{x:0,y:-u}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&d.attr("style",p)}else d=I0(o,h,u,f);return n&&d.attr("style",n),t.width=h,t.height=u,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}function B8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.label="",t.labelStyle=r;let i=e.insert("g").attr("class",$r(t)).attr("id",t.domId??t.id),{cssStyles:a}=t,s=Math.max(35,t?.width??0),o=Math.max(35,t?.height??0),l=7,u=[{x:s,y:0},{x:0,y:o+l/2},{x:s-2*l,y:o+l/2},{x:0,y:2*o},{x:s,y:o-l/2},{x:2*l,y:o-l/2}],h=gt.svg(i),f=cr(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let d=On(u),p=h.path(d,f),m=i.insert(()=>p,":first-child");return m.attr("class","outer-path"),a&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",a),n&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",n),m.attr("transform",`translate(-${s/2},${-o})`),gr(t,m),t.intersect=function(g){return se.info("lightningBolt intersect",t,g),sr.polygon(t,u,g)},i}async function F8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?24:i;if(t.width||t.height){let v=t.width??0;t.width=(t.width??0)-a,t.widthk,":first-child").attr("class","line"),g=o.insert(()=>T,":first-child"),g.attr("class","basic label-container"),y&&g.attr("style",y)}else{let v=d7t(0,0,h,p,f,d,m);g=o.insert("path",":first-child").attr("d",v).attr("class","basic label-container outer-path").attr("style",es(y)).attr("style",n)}return g.attr("label-offset-y",d),g.attr("transform",`translate(${-h/2}, ${-(p/2+d)})`),gr(t,g),u.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+d-(l.y-(l.top??0))})`),t.intersect=function(v){let x=sr.rect(t,v),w=x.x-(t.x??0);if(f!=0&&(Math.abs(w)<(t.width??0)/2||Math.abs(w)==(t.width??0)/2&&Math.abs(x.y-(t.y??0))>(t.height??0)/2-d)){let C=d*d*(1-w*w/(f*f));C>0&&(C=Math.sqrt(C)),C=d-C,v.y-(t.y??0)>0&&(C=-C),x.y+=C}return x},o}async function $8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i;if(t.width||t.height){let C=t.width;t.width=(C??0)*10/11-a*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-s*2,t.height<10&&(t.height=10)}let{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=(t?.width?t?.width:l.width)+(a??0)*2,f=(t?.height?t?.height:l.height)+(s??0)*2,d=t.look==="neo"?f/4:f/8,p=f+d,{cssStyles:m}=t,g=gt.svg(o),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=[{x:-h/2-h/2*.1,y:-p/2},{x:-h/2-h/2*.1,y:p/2},...Zm(-h/2-h/2*.1,p/2,h/2+h/2*.1,p/2,d,.8),{x:h/2+h/2*.1,y:-p/2},{x:-h/2-h/2*.1,y:-p/2},{x:-h/2,y:-p/2},{x:-h/2,y:p/2*1.1},{x:-h/2,y:-p/2}],x=g.polygon(v.map(C=>[C.x,C.y]),y),w=o.insert(()=>x,":first-child");return w.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",m),n&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(0,${-d/2})`),u.attr("transform",`translate(${-h/2+(t.padding??0)+h/2*.1/2-(l.x-(l.left??0))},${-f/2+(t.padding??0)-d/2-(l.y-(l.top??0))})`),gr(t,w),t.intersect=function(C){return sr.polygon(t,v,C)},o}async function z8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=t.look==="neo"?10:5;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-a*2-2*o,10),t.height=Math.max((t?.height??0)-s*2-2*o,10));let{shapeSvg:l,bbox:u,label:h}=await Hr(e,t,$r(t)),f=(t?.width?t?.width:u.width)+a*2+2*o,d=(t?.height?t?.height:u.height)+s*2+2*o,p=f-2*o,m=d-2*o,g=-p/2,y=-m/2,{cssStyles:v}=t,x=gt.svg(l),w=cr(t,{}),C=[{x:g-o,y:y+o},{x:g-o,y:y+m+o},{x:g+p-o,y:y+m+o},{x:g+p-o,y:y+m},{x:g+p,y:y+m},{x:g+p,y:y+m-o},{x:g+p+o,y:y+m-o},{x:g+p+o,y:y-o},{x:g+o,y:y-o},{x:g+o,y},{x:g,y},{x:g,y:y+o}],T=[{x:g,y:y+o},{x:g+p-o,y:y+o},{x:g+p-o,y:y+m},{x:g+p,y:y+m},{x:g+p,y},{x:g,y}];t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let k=On(C),S=x.path(k,w),E=On(T),I=x.path(E,w);t.look!=="handDrawn"&&(S=TY(S),I=TY(I));let L=l.insert("g",":first-child");return L.insert(()=>S),L.insert(()=>I),L.attr("class","basic label-container outer-path"),v&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",v),n&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",n),h.attr("transform",`translate(${-(u.width/2)-o-(u.x-(u.left??0))}, ${-(u.height/2)+o-(u.y-(u.top??0))})`),gr(t,L),t.intersect=function(O){return sr.polygon(t,C,O)},l}async function G8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await Hr(e,t,$r(t)),o=t.padding??0,l=t.look==="neo"?16:o,u=t.look==="neo"?12:o,h=!0;(t.width||t.height)&&(h=!1,t.width=(t?.width??0)-l*2,t.height=(t?.height??0)-u*3);let f=Math.max(a.width,t?.width??0)+l*2,d=Math.max(a.height,t?.height??0)+u*3,p=t.look==="neo"?d/4:d/8,m=d+(h?p/2:-p/2),g=-f/2,y=-m/2,v=10,{cssStyles:x}=t,w=Zm(g-v,y+m+v,g+f-v,y+m+v,p,.8),C=w?.[w.length-1],T=[{x:g-v,y:y+v},{x:g-v,y:y+m+v},...w,{x:g+f-v,y:C.y-v},{x:g+f,y:C.y-v},{x:g+f,y:C.y-2*v},{x:g+f+v,y:C.y-2*v},{x:g+f+v,y:y-v},{x:g+v,y:y-v},{x:g+v,y},{x:g,y},{x:g,y:y+v}],k=[{x:g,y:y+v},{x:g+f-v,y:y+v},{x:g+f-v,y:C.y-v},{x:g+f,y:C.y-v},{x:g+f,y},{x:g,y}],S=gt.svg(i),E=cr(t,{});t.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");let I=On(T),L=S.path(I,E),O=On(k),R=S.path(O,E),A=i.insert(()=>L,":first-child");return A.insert(()=>R),A.attr("class","basic label-container outer-path"),x&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",x),n&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",n),A.attr("transform",`translate(0,${-p/2})`),s.attr("transform",`translate(${-(a.width/2)-v-(a.x-(a.left??0))}, ${-(a.height/2)+v-p/2-(a.y-(a.top??0))})`),gr(t,A),t.intersect=function(N){return sr.polygon(t,T,N)},i}async function q8e(e,t,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n,t.useHtmlLabels||zn(qt())||(t.centerLabel=!0);let{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=Math.max(o.width+(t.padding??0)*2,t?.width??0),h=Math.max(o.height+(t.padding??0)*2,t?.height??0),f=-u/2,d=-h/2,{cssStyles:p}=t,m=gt.svg(s),g=cr(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=m.rectangle(f,d,u,h,g),v=s.insert(()=>y,":first-child");return v.attr("class","basic label-container outer-path"),l.attr("class","label noteLabel"),p&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),gr(t,v),t.intersect=function(x){return sr.rect(t,x)},s}async function V8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a}=await Hr(e,t,$r(t)),s=a.width+(t.padding??0),o=a.height+(t.padding??0),l=s+o,u=.5,h=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}],f,{cssStyles:d}=t;if(t.look==="handDrawn"){let p=gt.svg(i),m=cr(t,{}),g=g7t(0,0,l),y=p.path(g,m);f=i.insert(()=>y,":first-child").attr("transform",`translate(${-l/2+u}, ${l/2})`),d&&f.attr("style",d)}else f=I0(i,l,l,h),f.attr("transform",`translate(${-l/2+u}, ${l/2})`);return n&&f.attr("style",n),gr(t,f),t.calcIntersect=function(p,m){let g=p.width,y=[{x:g/2,y:0},{x:g,y:-g/2},{x:g/2,y:-g},{x:0,y:-g/2}],v=sr.polygon(p,y,m);return{x:v.x-.5,y:v.y-.5}},t.intersect=function(p){return this.calcIntersect(t,p)},i}async function W8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?21:i??0,s=t.look==="neo"?12:i??0,{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=(t?.width??l.width)+(t.look==="neo"?a*2:a),f=(t?.height??l.height)+(t.look==="neo"?s*2:s),d=-h/2,p=-f/2,m=p/2,g=[{x:d+m,y:p},{x:d,y:0},{x:d+m,y:-p},{x:-d,y:-p},{x:-d,y:p}],{cssStyles:y}=t,v=gt.svg(o),x=cr(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");let w=On(g),C=v.path(w,x),T=o.insert(()=>C,":first-child");return T.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",y),n&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",n),T.attr("transform",`translate(${-m/2},0)`),u.attr("transform",`translate(${-m/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),gr(t,T),t.intersect=function(k){return sr.polygon(t,g,k)},o}async function H8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i;t.cssClasses?i="node "+t.cssClasses:i="node default";let a=e.insert("g").attr("class",i).attr("id",t.domId||t.id),s=a.insert("g"),o=a.insert("g").attr("class","label").attr("style",n),l=t.description,u=t.label,h=await L0(o,u,t.labelStyle,!0,!0),f={width:0,height:0};if(zn(Be())){let E=h.children[0],I=ct(h);f=E.getBoundingClientRect(),I.attr("width",f.width),I.attr("height",f.height)}se.info("Text 2",l);let d=l||[],p=h.getBBox(),m=await L0(o,Array.isArray(d)?d.join("
"):d,t.labelStyle,!0,!0),g=m.children[0],y=ct(m);f=g.getBoundingClientRect(),y.attr("width",f.width),y.attr("height",f.height);let v=(t.padding||0)/2;ct(m).attr("transform","translate( "+(f.width>p.width?0:(p.width-f.width)/2)+", "+(p.height+v+5)+")"),ct(h).attr("transform","translate( "+(f.width(se.debug("Rough node insert CXC",L),O),":first-child"),k=a.insert(()=>(se.debug("Rough node insert CXC",L),L),":first-child")}else k=s.insert("rect",":first-child"),S=s.insert("line"),k.attr("class","outer title-state").attr("style",n).attr("x",-f.width/2-v).attr("y",-f.height/2-v).attr("width",f.width+(t.padding||0)).attr("height",f.height+(t.padding||0)),S.attr("class","divider").attr("x1",-f.width/2-v).attr("x2",f.width/2+v).attr("y1",-f.height/2-v+p.height+v).attr("y2",-f.height/2-v+p.height+v);return gr(t,k),t.intersect=function(E){return sr.rect(t,E)},a}async function U8e(e,t,{config:{themeVariables:r}}){let n=r?.radius??5,i={rx:n,ry:n,classes:"",labelPaddingX:(t?.padding??0)*1,labelPaddingY:(t?.padding??0)*1};return v4(e,t,i)}async function Y8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?12:t.padding??0,{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=(t?.width??o.width)+i*2+(t.look==="neo"?Xy:Xy*2),h=(t?.height??o.height)+a*2,f=u-Xy,d=h,p=Xy-u/2,m=-h/2,{cssStyles:g}=t,y=gt.svg(s),v=cr(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let x=[{x:p,y:m},{x:p+f,y:m},{x:p+f,y:m+d},{x:p-Xy,y:m+d},{x:p-Xy,y:m},{x:p,y:m},{x:p,y:m+d}],w=y.polygon(x.map(T=>[T.x,T.y]),v),C=s.insert(()=>w,":first-child");return C.attr("class","basic label-container outer-path").attr("style",es(g)),n&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),g&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",n),l.attr("transform",`translate(${Xy/2-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),gr(t,C),t.intersect=function(T){return sr.rect(t,T)},s}async function X8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-a*2,10),t.height=Math.max((t?.height??0)/1.5-s*2,10));let{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=(t?.width?t?.width:l.width)+a*2,f=((t?.height?t?.height:l.height)+s*2)*1.5,d=h,p=f/1.5,m=-d/2,g=-p/2,{cssStyles:y}=t,v=gt.svg(o),x=cr(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");let w=[{x:m,y:g},{x:m,y:g+p},{x:m+d,y:g+p},{x:m+d,y:g-p/2}],C=On(w),T=v.path(C,x),k=o.insert(()=>T,":first-child");return k.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",y),n&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),k.attr("transform",`translate(0, ${p/4})`),u.attr("transform",`translate(${-d/2+(t.padding??0)-(l.x-(l.left??0))}, ${-p/4+(t.padding??0)-(l.y-(l.top??0))})`),gr(t,k),t.intersect=function(S){return sr.polygon(t,w,S)},o}async function j8e(e,t){let r=t.padding??0,n=t.look==="neo"?16:r*2,i=t.look==="neo"?12:r,a={rx:0,ry:0,classes:"",labelPaddingX:t.labelPaddingX??n,labelPaddingY:i};return v4(e,t,a)}async function K8e(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?20:i,s=t.look==="neo"?12:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=l.height+(t.look==="neo"?s*2:s),h=l.width+u/4+(t.look==="neo"?a*2:a),f=u/2,{cssStyles:d}=t,p=gt.svg(o),m=cr(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let g=[{x:-h/2+f,y:-u/2},{x:h/2-f,y:-u/2},...eC(-h/2+f,0,f,50,90,270),{x:h/2-f,y:u/2},...eC(h/2-f,0,f,50,270,450)],y=On(g),v=p.path(y,m),x=o.insert(()=>v,":first-child");return x.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",d),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),gr(t,x),t.intersect=function(w){return sr.polygon(t,g,w)},o}async function Z8e(e,t){let r={rx:t.look==="neo"?3:5,ry:t.look==="neo"?3:5,classes:"flowchart-node"};return v4(e,t,r)}function Q8e(e,t,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n;let{cssStyles:a}=t,{lineColor:s,stateBorder:o,nodeBorder:l,nodeShadow:u}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let h=e.insert("g").attr("class","node default").attr("id",t.domId??t.id),f=gt.svg(h),d=cr(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let p=f.circle(0,0,t.width,{...d,stroke:s,strokeWidth:2}),m=o??l,g=(t.width??0)*5/14,y=f.circle(0,0,g,{...d,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),v=h.insert(()=>p,":first-child");if(v.insert(()=>y),t.look!=="handDrawn"&&v.attr("class","outer-path"),a&&v.selectAll("path").attr("style",a),i&&v.selectAll("path").attr("style",i),t.width<25&&u&&t.look!=="handDrawn"){let x=e.node()?.ownerSVGElement?.id??"",w=x?`${x}-drop-shadow-small`:"drop-shadow-small";v.attr("style",`filter:url(#${w})`)}return gr(t,v),t.intersect=function(x){return sr.circle(t,(t.width??0)/2,x)},h}function J8e(e,t,{config:{themeVariables:r}}){let{lineColor:n,nodeShadow:i}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s;if(t.look==="handDrawn"){let l=gt.svg(a).circle(0,0,t.width,G6e(n));s=a.insert(()=>l),s.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14)}else s=a.insert("circle",":first-child"),s.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14);if(t.width<25&&i&&t.look!=="handDrawn"){let o=e.node()?.ownerSVGElement?.id??"",l=o?`${o}-drop-shadow-small`:"drop-shadow-small";s.attr("style",`filter:url(#${l})`)}return gr(t,s),t.intersect=function(o){return sr.circle(t,(t.width??7)/2,o)},a}async function eAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t?.padding??8,a=t.look==="neo"?28:i,s=t.look==="neo"?12:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width??l.width)+2*m4+a,h=(t?.height??l.height)+s,f=u-2*m4,d=h,p=-u/2,m=-h/2,g=[{x:0,y:0},{x:f,y:0},{x:f,y:-d},{x:0,y:-d},{x:0,y:0},{x:-8,y:0},{x:f+8,y:0},{x:f+8,y:-d},{x:-8,y:-d},{x:-8,y:0}];if(t.look==="handDrawn"){let y=gt.svg(o),v=cr(t,{}),x=y.rectangle(p,m,f+16,d,v),w=y.line(p+m4,m,p+m4,m+d,v),C=y.line(p+m4+f,m,p+m4+f,m+d,v);o.insert(()=>w,":first-child"),o.insert(()=>C,":first-child");let T=o.insert(()=>x,":first-child"),{cssStyles:k}=t;T.attr("class","basic label-container").attr("style",es(k)),gr(t,T)}else{let y=I0(o,f,d,g);n&&y.attr("style",n),gr(t,y)}return t.intersect=function(y){return sr.polygon(t,g,y)},o}async function tAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i;(t.width||t.height)&&(t.height=Math.max((t?.height??0)-s*2,10),t.width=Math.max((t?.width??0)-a*2-kY*(t.height+s*2),10));let{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height?t?.height:l.height)+s*2,h=kY*u,f=kY*u,p=(t?.width?t?.width:l.width)+a*2+h-h,m=u,g=-p/2,y=-m/2,{cssStyles:v}=t,x=gt.svg(o),w=cr(t,{}),C=[{x:g-h/2,y},{x:g+p+h/2,y},{x:g+p+h/2,y:y+m},{x:g-h/2,y:y+m}],T=[{x:g+p-h/2,y:y+m},{x:g+p+h/2,y:y+m},{x:g+p+h/2,y:y+m-f}];t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let k=On(C),S=x.path(k,w),E=On(T),I=x.path(E,{...w,fillStyle:"solid"}),L=o.insert(()=>I,":first-child");return L.insert(()=>S,":first-child"),L.attr("class","basic label-container outer-path"),v&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",v),n&&t.look!=="handDrawn"&&L.selectAll("path").attr("style",n),gr(t,L),t.intersect=function(O){return sr.polygon(t,C,O)},o}async function rAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await Hr(e,t,$r(t)),o=Math.max(a.width+(t.padding??0)*2,t?.width??0),l=Math.max(a.height+(t.padding??0)*2,t?.height??0),u=l/8,h=.2*o,f=.2*l,d=l+u,{cssStyles:p}=t,m=gt.svg(i),g=cr(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=[{x:-o/2-o/2*.1,y:d/2},...Zm(-o/2-o/2*.1,d/2,o/2+o/2*.1,d/2,u,.8),{x:o/2+o/2*.1,y:-d/2},{x:-o/2-o/2*.1,y:-d/2}],v=-o/2+o/2*.1,x=-d/2-f*.4,w=[{x:v+o-h,y:(x+l)*1.3},{x:v+o,y:x+l-f},{x:v+o,y:(x+l)*.9},...Zm(v+o,(x+l)*1.25,v+o-h,(x+l)*1.3,-l*.02,.5)],C=On(y),T=m.path(C,g),k=On(w),S=m.path(k,{...g,fillStyle:"solid"}),E=i.insert(()=>S,":first-child");return E.insert(()=>T,":first-child"),E.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",p),n&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(0,${-u/2})`),s.attr("transform",`translate(${-o/2+(t.padding??0)-(a.x-(a.left??0))},${-l/2+(t.padding??0)-u/2-(a.y-(a.top??0))})`),gr(t,E),t.intersect=function(I){return sr.polygon(t,y,I)},i}async function nAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a}=await Hr(e,t,$r(t)),s=Math.max(a.width+(t.padding??0),t?.width||0),o=Math.max(a.height+(t.padding??0),t?.height||0),l=-s/2,u=-o/2,h=i.insert("rect",":first-child");return h.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",l).attr("y",u).attr("width",s).attr("height",o),gr(t,h),t.intersect=function(f){return sr.rect(t,f)},i}async function iAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?12:i/2;if(t.width||t.height){let g=t.height??0;t.height=(t.height??0)-a,t.heightw,":first-child"),m=s.insert(()=>x,":first-child"),m.attr("class","basic label-container"),p&&m.attr("style",p)}else{let g=y7t(0,0,d,u,f,h);m=s.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",es(p)).attr("style",n),m.attr("class","basic label-container outer-path"),p&&m.selectAll("path").attr("style",p),n&&m.selectAll("path").attr("style",n)}return m.attr("label-offset-x",f),m.attr("transform",`translate(${-d/2}, ${u/2} )`),l.attr("transform",`translate(${-(o.width/2)-f-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),gr(t,m),t.intersect=function(g){let y=sr.rect(t,g),v=y.y-(t.y??0);if(h!=0&&(Math.abs(v)<(t.height??0)/2||Math.abs(v)==(t.height??0)/2&&Math.abs(y.x-(t.x??0))>(t.width??0)/2-f)){let x=f*f*(1-v*v/(h*h));x!=0&&(x=Math.sqrt(Math.abs(x))),x=f-x,g.x-(t.x??0)>0&&(x=-x),y.x+=x}return y},s}async function aAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=(t.look==="neo",i),s=t.look==="neo"?i*2:i,{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.height??l.height)+a,h=(t?.width??l.width)+s,f=[{x:-3*u/6,y:0},{x:h+3*u/6,y:0},{x:h,y:-u},{x:0,y:-u}],d,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=gt.svg(o),g=cr(t,{}),y=On(f),v=m.path(y,g);d=o.insert(()=>v,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&d.attr("style",p)}else d=I0(o,h,u,f);return n&&d.attr("style",n),t.width=h,t.height=u,gr(t,d),t.intersect=function(m){return sr.polygon(t,f,m)},o}async function sAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=15,l=5;(t.width||t.height)&&(t.height=(t.height??0)-s*2,t.heightx,":first-child");return w.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",p),n&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),gr(t,w),t.intersect=function(C){return sr.polygon(t,y,C)},u}async function oAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?i*2:i;(t.width||t.height)&&(t.width=((t?.width??0)-a)/2,t.widthx,":first-child").attr("transform",`translate(${-f/2}, ${f/2})`).attr("class","outer-path");return m&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",m),n&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),t.width=h,t.height=f,gr(t,w),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${f/2-(o.height+(t.padding??0)/(u?2:1)-(o.y-(o.top??0)))})`),t.intersect=function(C){return se.info("Triangle intersect",t,p,C),sr.polygon(t,p,C)},s}async function lAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?12:i,o=!0;(t.width||t.height)&&(o=!1,t.width=(t?.width??0)-a*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-s*2,t.height<10&&(t.height=10));let{shapeSvg:l,bbox:u,label:h}=await Hr(e,t,$r(t)),f=(t?.width?t?.width:u.width)+(a??0)*2,d=(t?.height?t?.height:u.height)+(s??0)*2,p=t.look==="neo"?d/4:d/8,m=d+(o?p:-p),{cssStyles:g}=t,v=14-f,x=v>0?v/2:0,w=gt.svg(l),C=cr(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");let T=[{x:-f/2-x,y:m/2},...Zm(-f/2-x,m/2,f/2+x,m/2,p,.8),{x:f/2+x,y:-m/2},{x:-f/2-x,y:-m/2}],k=On(T),S=w.path(k,C),E=l.insert(()=>S,":first-child");return E.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(0,${-p/2})`),h.attr("transform",`translate(${-f/2+(t.padding??0)-(u.x-(u.left??0))},${-d/2+(t.padding??0)-p-(u.y-(u.top??0))})`),gr(t,E),t.intersect=function(I){return sr.polygon(t,T,I)},l}async function cAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.padding??0,a=t.look==="neo"?16:i,s=t.look==="neo"?20:i;if(t.width||t.height){t.width=t?.width??0,t.width<20&&(t.width=20),t.height=t?.height??0,t.height<10&&(t.height=10);let C=Math.min(t.height*.2,t.height/4);t.height=Math.ceil(t.height-s-C*(20/9)),t.width=t.width-a*2}let{shapeSvg:o,bbox:l}=await Hr(e,t,$r(t)),u=(t?.width?t?.width:l.width)+a*2,h=(t?.height?t?.height:l.height)+s,f=h/8,d=h+f*2,{cssStyles:p}=t,m=gt.svg(o),g=cr(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=[{x:-u/2,y:d/2},...Zm(-u/2,d/2,u/2,d/2,f,1),{x:u/2,y:-d/2},...Zm(u/2,-d/2,-u/2,-d/2,f,-1)],v=On(y),x=m.path(v,g),w=o.insert(()=>x,":first-child");return w.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",n),gr(t,w),t.intersect=function(C){return sr.polygon(t,y,C)},o}async function uAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-i*2-Ea,10),t.height=Math.max((t?.height??0)-a*2-Ea,10));let{shapeSvg:s,bbox:o,label:l}=await Hr(e,t,$r(t)),u=(t?.width?t?.width:o.width)+i*2+Ea,h=(t?.height?t?.height:o.height)+a*2+Ea,f=u-Ea,d=h-Ea,p=-f/2,m=-d/2,{cssStyles:g}=t,y=gt.svg(s),v=cr(t,{}),x=[{x:p-Ea,y:m-Ea},{x:p-Ea,y:m+d},{x:p+f,y:m+d},{x:p+f,y:m-Ea}],w=`M${p-Ea},${m-Ea} L${p+f},${m-Ea} L${p+f},${m+d} L${p-Ea},${m+d} L${p-Ea},${m-Ea} M${p-Ea},${m} L${p+f},${m} - M${p},${m-Ea} L${p},${m+d}`;t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let C=y.path(w,v),T=s.insert(()=>C,":first-child");return T.attr("transform",`translate(${Ea/2}, ${Ea/2})`),T.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",n),l.attr("transform",`translate(${-(o.width/2)+Ea/2-(o.x-(o.left??0))}, ${-(o.height/2)+Ea/2-(o.y-(o.top??0))})`),gr(t,T),t.intersect=function(k){return sr.polygon(t,x,k)},s}async function SY(e,t){let r=t;r.alias&&(t.label=r.alias);let{theme:n,themeVariables:i}=qt(),{rowEven:a,rowOdd:s,nodeBorder:o,borderColorArray:l}=i;if(t.look==="handDrawn"){let{themeVariables:J}=qt(),{background:U}=J,le={...t,id:t.id+"-background",domId:(t.domId||t.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${U}`]};await SY(e,le)}let u=qt();t.useHtmlLabels=u.htmlLabels;let h=u.er?.diagramPadding??10,f=u.er?.entityPadding??6,{cssStyles:d}=t,{labelStyles:p,nodeStyles:m}=ar(t);if(r.attributes.length===0&&t.label){let J={rx:0,ry:0,labelPaddingX:h,labelPaddingY:h*1.5,classes:""};uo(t.label,u)+J.labelPaddingX*20){let J=v.width+h*2-(T+k+S+E);T+=J/O,k+=J/O,S>0&&(S+=J/O),E>0&&(E+=J/O)}let A=T+k+S+E,N=gt.svg(y),M=cr(t,{});t.look!=="handDrawn"&&(M.roughness=0,M.fillStyle="solid");let D=0;C.length>0&&(D=C.reduce((J,U)=>J+(U?.rowHeight??0),0));let B=Math.max(R.width+h*2,t?.width||0,A),P=Math.max((D??0)+v.height,t?.height||0),$=-B/2,F=-P/2;if(y.selectAll("g:not(:first-child)").each((J,U,le)=>{let ee=ct(le[U]),ue=ee.attr("transform"),ae=0,oe=0;if(ue){let Te=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(ue);Te&&(ae=parseFloat(Te[1]),oe=parseFloat(Te[2]),ee.attr("class").includes("attribute-name")?ae+=T:ee.attr("class").includes("attribute-keys")?ae+=T+k:ee.attr("class").includes("attribute-comment")&&(ae+=T+k+S))}ee.attr("transform",`translate(${$+h/2+ae}, ${oe+F+v.height+f/2})`)}),y.select(".name").attr("transform","translate("+-v.width/2+", "+(F+f/2)+")"),n!=null&&K7e.has(n)){let J=r.colorIndex??0;y.attr("data-color-id",`color-${J%l.length}`)}let q=N.rectangle($,F,B,P,M),G=y.insert(()=>q,":first-child").attr("class","outer-path").attr("style",d.join(""));w.push(0);for(let[J,U]of C.entries()){let ee=(J+1)%2===0&&U.yOffset!==0,ue=N.rectangle($,v.height+F+U?.yOffset,B,U?.rowHeight,{...M,fill:ee?a:s,stroke:o});y.insert(()=>ue,"g.label").attr("style",d.join("")).attr("class",`row-rect-${ee?"even":"odd"}`)}let z=1e-4,H=y4($,v.height+F,B+$,v.height+F,z),j=N.polygon(H.map(J=>[J.x,J.y]),M);if(y.insert(()=>j).attr("class","divider"),H=y4(T+$,v.height+F,T+$,P+F,z),j=N.polygon(H.map(J=>[J.x,J.y]),M),y.insert(()=>j).attr("class","divider"),I){let J=T+k+$;H=y4(J,v.height+F,J,P+F,z),j=N.polygon(H.map(U=>[U.x,U.y]),M),y.insert(()=>j).attr("class","divider")}if(L){let J=T+k+S+$;H=y4(J,v.height+F,J,P+F,z),j=N.polygon(H.map(U=>[U.x,U.y]),M),y.insert(()=>j).attr("class","divider")}for(let J of w){let U=v.height+F+J;H=y4($,U,B+$,U,z),j=N.polygon(H.map(le=>[le.x,le.y]),M),y.insert(()=>j).attr("class","divider")}if(gr(t,G),m&&t.look!=="handDrawn")if(n!=null&&g7t.has(n))y.selectAll("path").attr("style",m);else{let U=m.split(";")?.filter(le=>le.includes("stroke"))?.map(le=>`${le}`).join("; ");y.selectAll("path").attr("style",U??""),y.selectAll(".row-rect-even path").attr("style",m)}return t.intersect=function(J){return sr.rect(t,J)},y}async function g4(e,t,r,n=0,i=0,a=[],s=""){let o=e.insert("g").attr("class",`label ${a.join(" ")}`).attr("transform",`translate(${n}, ${i})`).attr("style",s);t!==Af(t)&&(t=Af(t),t=t.replaceAll("<","<").replaceAll(">",">"));let l=o.node().appendChild(await rs(o,t,{width:uo(t,r)+100,style:s,useHtmlLabels:r.htmlLabels},r));if(t.includes("<")||t.includes(">")){let h=l.children[0];for(h.textContent=h.textContent.replaceAll("<","<").replaceAll(">",">");h.childNodes[0];)h=h.childNodes[0],h.textContent=h.textContent.replaceAll("<","<").replaceAll(">",">")}let u=l.getBBox();if(Cu(r.htmlLabels)){let h=l.children[0];h.style.textAlign="start";let f=ct(l);u=h.getBoundingClientRect(),f.attr("width",u.width),f.attr("height",u.height)}return u}function y4(e,t,r,n,i){return e===r?[{x:e-i/2,y:t},{x:e+i/2,y:t},{x:r+i/2,y:n},{x:r-i/2,y:n}]:[{x:e,y:t-i/2},{x:e,y:t+i/2},{x:r,y:n+i/2},{x:r,y:n-i/2}]}async function cAe(e,t,r,n,i=r.class.padding??12){let a=n?0:3,s=e.insert("g").attr("class",$r(t)).attr("id",t.domId||t.id),o=null,l=null,u=null,h=null,f=0,d=0,p=0;if(o=s.insert("g").attr("class","annotation-group text"),t.annotations.length>0){let x=t.annotations[0];await J3(o,{text:`\xAB${x}\xBB`},0),f=o.node().getBBox().height}l=s.insert("g").attr("class","label-group text"),await J3(l,t,0,["font-weight: bolder"]);let m=l.node().getBBox();d=m.height,u=s.insert("g").attr("class","members-group text");let g=0;for(let x of t.members){let w=await J3(u,x,g,[x.parseClassifier()]);g+=w+a}p=u.node().getBBox().height,p<=0&&(p=i/2),h=s.insert("g").attr("class","methods-group text");let y=0;for(let x of t.methods){let w=await J3(h,x,y,[x.parseClassifier()]);y+=w+a}let v=s.node().getBBox();if(o!==null){let x=o.node().getBBox();o.attr("transform",`translate(${-x.width/2})`)}return l.attr("transform",`translate(${-m.width/2}, ${f})`),v=s.node().getBBox(),u.attr("transform",`translate(0, ${f+d+i*2})`),v=s.node().getBBox(),h.attr("transform",`translate(0, ${f+d+(p?p+i*4:i*2)})`),v=s.node().getBBox(),{shapeSvg:s,bbox:v}}async function J3(e,t,r,n=[]){let i=e.insert("g").attr("class","label").attr("style",n.join("; ")),a=qt(),s="useHtmlLabels"in t?t.useHtmlLabels:Cu(a.htmlLabels)??!0,o="";"text"in t?o=t.text:o=t.label,!s&&o.startsWith("\\")&&(o=o.substring(1)),sa(o)&&(s=!0);let l=await rs(i,c9($c(o)),{width:uo(o,a)+50,classes:"markdown-node-label",useHtmlLabels:s},a),u,h=1;if(s){let f=l.children[0],d=ct(l);h=f.innerHTML.split("
").length,f.innerHTML.includes("")&&(h+=f.innerHTML.split("").length-1);let p=f.getElementsByTagName("img");if(p){let m=o.replace(/]*>/g,"").trim()==="";await Promise.all([...p].map(g=>new Promise(y=>{function v(){if(g.style.display="flex",g.style.flexDirection="column",m){let x=a.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,C=parseInt(x,10)*5+"px";g.style.minWidth=C,g.style.maxWidth=C}else g.style.width="100%";y(g)}b(v,"setupImage"),setTimeout(()=>{g.complete&&v()}),g.addEventListener("error",v),g.addEventListener("load",v)})))}u=f.getBoundingClientRect(),d.attr("width",u.width),d.attr("height",u.height)}else{n.includes("font-weight: bolder")&&ct(l).selectAll("tspan").attr("font-weight",""),h=l.children.length;let f=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(f.textContent=o[0]+o.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),o[1]===" "&&(f.textContent=f.textContent[0]+" "+f.textContent.substring(1))),f.textContent==="undefined"&&(f.textContent=""),u=l.getBBox()}return i.attr("transform","translate(0,"+(-u.height/(2*h)+r)+")"),u.height}async function uAe(e,t){let r=Be(),{themeVariables:n}=r,{useGradient:i}=n,a=r.class.padding??12,s=a,o=t.useHtmlLabels??Cu(r.htmlLabels)??!0,l=t;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];let{shapeSvg:u,bbox:h}=await cAe(e,t,r,o,s),{labelStyles:f,nodeStyles:d}=ar(t);t.labelStyle=f,t.cssStyles=l.styles||"";let p=l.styles?.join(";")||d||"";t.cssStyles||(t.cssStyles=p.replaceAll("!important","").split(";"));let m=l.members.length===0&&l.methods.length===0&&!r.class?.hideEmptyMembersBox,g=gt.svg(u),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=Math.max(t.width??0,h.width),x=Math.max(t.height??0,h.height),w=(t.height??0)>h.height;l.members.length===0&&l.methods.length===0?x+=s:l.members.length>0&&l.methods.length===0&&(x+=s*2);let C=-v/2,T=-x/2,k=m?a*2:l.members.length===0&&l.methods.length===0?-a:0;w&&(k=a*2);let S=g.rectangle(C-a,T-a-(m?a:l.members.length===0&&l.methods.length===0?-a/2:0),v+2*a,x+2*a+k,y),E=u.insert(()=>S,":first-child");E.attr("class","basic label-container outer-path");let I=E.node().getBBox(),L=u.select(".annotation-group").node().getBBox().height-(m?a/2:0)||0,O=u.select(".label-group").node().getBBox().height-(m?a/2:0)||0,R=u.select(".members-group").node().getBBox().height-(m?a/2:0)||0,A=(L+O+T+a-(T-a-(m?a:l.members.length===0&&l.methods.length===0?-a/2:0)))/2;if(u.selectAll(".text").each((N,M,D)=>{let B=ct(D[M]),P=B.attr("transform"),$=0;if(P){let z=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(P);z&&($=parseFloat(z[2]))}let F=$+T+a-(m?a:l.members.length===0&&l.methods.length===0?-a/2:0);if(B.attr("class").includes("methods-group")){let G=Math.max(R,s/2);w?F=Math.max(A,L+O+G+T+s*2+a)+s*2:F=L+O+G+T+s*4+a}l.members.length===0&&l.methods.length===0&&r.class?.hideEmptyMembersBox&&(l.annotations.length>0?F=$-s:F=$),o||(F-=4);let q=C;(B.attr("class").includes("label-group")||B.attr("class").includes("annotation-group"))&&(q=-B.node()?.getBBox().width/2||0,u.selectAll("text").each(function(G,z,H){window.getComputedStyle(H[z]).textAnchor==="middle"&&(q=0)})),B.attr("transform",`translate(${q}, ${F})`)}),l.members.length>0||l.methods.length>0||m){let N=L+O+T+a,M=g.line(I.x,N,I.x+I.width,N+.001,y);u.insert(()=>M).attr("class",`divider${t.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(m||l.members.length>0||l.methods.length>0){let N=L+O+R+T+s*2+a,M=g.line(I.x,w?Math.max(A,N):N,I.x+I.width,(w?Math.max(A,N):N)+.001,y);u.insert(()=>M).attr("class",`divider${t.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(l.look!=="handDrawn"&&u.selectAll("path").attr("style",p),E.select(":nth-child(2)").attr("style",p),u.selectAll(".divider").select("path").attr("style",p),t.labelStyle?u.selectAll("span").attr("style",t.labelStyle):u.selectAll("span").attr("style",p),!o){let N=RegExp(/color\s*:\s*([^;]*)/),M=N.exec(p);if(M){let D=M[0].replace("color","fill");u.selectAll("tspan").attr("style",D)}else if(f){let D=N.exec(f);if(D){let B=D[0].replace("color","fill");u.selectAll("tspan").attr("style",B)}}}return gr(t,E),t.intersect=function(N){return sr.rect(t,N)},u}async function hAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t,a=t,s=20,o=20,l="verifyMethod"in t,u=$r(t),{themeVariables:h}=Be(),{borderColorArray:f,requirementEdgeLabelBackground:d}=h,p=e.insert("g").attr("class",u).attr("id",t.domId??t.id),m;l?m=await qf(p,`<<${i.type}>>`,0,t.labelStyle):m=await qf(p,"<<Element>>",0,t.labelStyle);let g=m,y=await qf(p,i.name,g,t.labelStyle+"; font-weight: bold;");if(g+=y+o,l){let I=await qf(p,`${i.requirementId?`ID: ${i.requirementId}`:""}`,g,t.labelStyle);g+=I;let L=await qf(p,`${i.text?`Text: ${i.text}`:""}`,g,t.labelStyle);g+=L;let O=await qf(p,`${i.risk?`Risk: ${i.risk}`:""}`,g,t.labelStyle);g+=O,await qf(p,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,g,t.labelStyle)}else{let I=await qf(p,`${a.type?`Type: ${a.type}`:""}`,g,t.labelStyle);g+=I,await qf(p,`${a.docRef?`Doc Ref: ${a.docRef}`:""}`,g,t.labelStyle)}let v=(p.node()?.getBBox().width??200)+s,x=(p.node()?.getBBox().height??200)+s,w=-v/2,C=-x/2,T=gt.svg(p),k=cr(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");let S=T.rectangle(w,C,v,x,k),E=p.insert(()=>S,":first-child");if(E.attr("class","basic label-container outer-path").attr("style",n),f?.length){let I=t.colorIndex??0;p.attr("data-color-id",`color-${I%f.length}`)}if(p.selectAll(".label").each((I,L,O)=>{let R=ct(O[L]),A=R.attr("transform"),N=0,M=0;if(A){let $=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(A);$&&(N=parseFloat($[1]),M=parseFloat($[2]))}let D=M-x/2,B=w+s/2;(L===0||L===1)&&(B=N),R.attr("transform",`translate(${B}, ${D+s})`)}),g>m+y+o){let I=C+m+y+o,L;if(t.look==="neo"){let A=[[w,I],[w+v,I],[w+v,I+.001],[w,I+.001]];L=T.polygon(A,k)}else L=T.line(w,I,w+v,I,k);p.insert(()=>L).attr("class","divider")}return gr(t,E),t.intersect=function(I){return sr.rect(t,I)},n&&t.look!=="handDrawn"&&(d||f?.length)&&p.selectAll("path").attr("style",n),p}async function qf(e,t,r,n=""){if(t==="")return 0;let i=e.insert("g").attr("class","label").attr("style",n),a=Be(),s=a.htmlLabels??!0,o=await rs(i,c9($c(t)),{width:uo(t,a)+50,classes:"markdown-node-label",useHtmlLabels:s,style:n},a),l;if(s){let u=o.children[0],h=ct(o);l=u.getBoundingClientRect(),h.attr("width",l.width),h.attr("height",l.height)}else{let u=o.children[0];for(let h of u.children)n&&h.setAttribute("style",n);l=o.getBBox(),l.height+=6}return i.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}async function fAe(e,t,{config:r}){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n||"";let a=10,s=t.width;t.width=(t.width??200)-10;let{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=t.padding||10,f="",d;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(f=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),d=o.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",f).attr("target","_blank"));let p={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1},m,g;d?{label:m,bbox:g}=await xY(d,"ticket"in t&&t.ticket||"",p):{label:m,bbox:g}=await xY(o,"ticket"in t&&t.ticket||"",p);let{label:y,bbox:v}=await xY(o,"assigned"in t&&t.assigned||"",p);t.width=s;let x=10,w=t?.width||0,C=Math.max(g.height,v.height)/2,T=Math.max(l.height+x*2,t?.height||0)+C,k=-w/2,S=-T/2;u.attr("transform","translate("+(h-w/2)+", "+(-C-l.height/2)+")"),m.attr("transform","translate("+(h-w/2)+", "+(-C+l.height/2)+")"),y.attr("transform","translate("+(h+w/2-v.width-2*a)+", "+(-C+l.height/2)+")");let E,{rx:I,ry:L}=t,{cssStyles:O}=t;if(t.look==="handDrawn"){let R=gt.svg(o),A=cr(t,{}),N=I||L?R.path(Qm(k,S,w,T,I||0),A):R.rectangle(k,S,w,T,A);E=o.insert(()=>N,":first-child"),E.attr("class","basic label-container").attr("style",O||null)}else{E=o.insert("rect",":first-child"),E.attr("class","basic label-container __APA__").attr("style",i).attr("rx",I??5).attr("ry",L??5).attr("x",k).attr("y",S).attr("width",w).attr("height",T);let R="priority"in t&&t.priority;if(R){let A=o.append("line"),N=k+2,M=S+Math.floor((I??0)/2),D=S+T-Math.floor((I??0)/2);A.attr("x1",N).attr("y1",M).attr("x2",N).attr("y2",D).attr("stroke-width","4").attr("stroke",y7t(R))}}return gr(t,E),t.height=T,t.intersect=function(R){return sr.rect(t,R)},o}async function dAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s,label:o}=await Hr(e,t,$r(t)),l=a.width+10*s,u=a.height+8*s,h=.15*l,{cssStyles:f}=t,d=a.width+20,p=a.height+20,m=Math.max(l,d),g=Math.max(u,p);o.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`);let y,v=`M0 0 + M${p},${m-Ea} L${p},${m+d}`;t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let C=y.path(w,v),T=s.insert(()=>C,":first-child");return T.attr("transform",`translate(${Ea/2}, ${Ea/2})`),T.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",n),l.attr("transform",`translate(${-(o.width/2)+Ea/2-(o.x-(o.left??0))}, ${-(o.height/2)+Ea/2-(o.y-(o.top??0))})`),gr(t,T),t.intersect=function(k){return sr.polygon(t,x,k)},s}async function AY(e,t){let r=t;r.alias&&(t.label=r.alias);let{theme:n,themeVariables:i}=qt(),{rowEven:a,rowOdd:s,nodeBorder:o,borderColorArray:l}=i;if(t.look==="handDrawn"){let{themeVariables:J}=qt(),{background:U}=J,le={...t,id:t.id+"-background",domId:(t.domId||t.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${U}`]};await AY(e,le)}let u=qt();t.useHtmlLabels=u.htmlLabels;let h=u.er?.diagramPadding??10,f=u.er?.entityPadding??6,{cssStyles:d}=t,{labelStyles:p,nodeStyles:m}=ar(t);if(r.attributes.length===0&&t.label){let J={rx:0,ry:0,labelPaddingX:h,labelPaddingY:h*1.5,classes:""};uo(t.label,u)+J.labelPaddingX*20){let J=v.width+h*2-(T+k+S+E);T+=J/O,k+=J/O,S>0&&(S+=J/O),E>0&&(E+=J/O)}let A=T+k+S+E,N=gt.svg(y),M=cr(t,{});t.look!=="handDrawn"&&(M.roughness=0,M.fillStyle="solid");let D=0;C.length>0&&(D=C.reduce((J,U)=>J+(U?.rowHeight??0),0));let B=Math.max(R.width+h*2,t?.width||0,A),P=Math.max((D??0)+v.height,t?.height||0),$=-B/2,F=-P/2;if(y.selectAll("g:not(:first-child)").each((J,U,le)=>{let ee=ct(le[U]),ue=ee.attr("transform"),ae=0,oe=0;if(ue){let Te=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(ue);Te&&(ae=parseFloat(Te[1]),oe=parseFloat(Te[2]),ee.attr("class").includes("attribute-name")?ae+=T:ee.attr("class").includes("attribute-keys")?ae+=T+k:ee.attr("class").includes("attribute-comment")&&(ae+=T+k+S))}ee.attr("transform",`translate(${$+h/2+ae}, ${oe+F+v.height+f/2})`)}),y.select(".name").attr("transform","translate("+-v.width/2+", "+(F+f/2)+")"),n!=null&&Q7e.has(n)){let J=r.colorIndex??0;y.attr("data-color-id",`color-${J%l.length}`)}let q=N.rectangle($,F,B,P,M),G=y.insert(()=>q,":first-child").attr("class","outer-path").attr("style",d.join(""));w.push(0);for(let[J,U]of C.entries()){let ee=(J+1)%2===0&&U.yOffset!==0,ue=N.rectangle($,v.height+F+U?.yOffset,B,U?.rowHeight,{...M,fill:ee?a:s,stroke:o});y.insert(()=>ue,"g.label").attr("style",d.join("")).attr("class",`row-rect-${ee?"even":"odd"}`)}let z=1e-4,H=y4($,v.height+F,B+$,v.height+F,z),j=N.polygon(H.map(J=>[J.x,J.y]),M);if(y.insert(()=>j).attr("class","divider"),H=y4(T+$,v.height+F,T+$,P+F,z),j=N.polygon(H.map(J=>[J.x,J.y]),M),y.insert(()=>j).attr("class","divider"),I){let J=T+k+$;H=y4(J,v.height+F,J,P+F,z),j=N.polygon(H.map(U=>[U.x,U.y]),M),y.insert(()=>j).attr("class","divider")}if(L){let J=T+k+S+$;H=y4(J,v.height+F,J,P+F,z),j=N.polygon(H.map(U=>[U.x,U.y]),M),y.insert(()=>j).attr("class","divider")}for(let J of w){let U=v.height+F+J;H=y4($,U,B+$,U,z),j=N.polygon(H.map(le=>[le.x,le.y]),M),y.insert(()=>j).attr("class","divider")}if(gr(t,G),m&&t.look!=="handDrawn")if(n!=null&&b7t.has(n))y.selectAll("path").attr("style",m);else{let U=m.split(";")?.filter(le=>le.includes("stroke"))?.map(le=>`${le}`).join("; ");y.selectAll("path").attr("style",U??""),y.selectAll(".row-rect-even path").attr("style",m)}return t.intersect=function(J){return sr.rect(t,J)},y}async function g4(e,t,r,n=0,i=0,a=[],s=""){let o=e.insert("g").attr("class",`label ${a.join(" ")}`).attr("transform",`translate(${n}, ${i})`).attr("style",s);t!==Af(t)&&(t=Af(t),t=t.replaceAll("<","<").replaceAll(">",">"));let l=o.node().appendChild(await rs(o,t,{width:uo(t,r)+100,style:s,useHtmlLabels:r.htmlLabels},r));if(t.includes("<")||t.includes(">")){let h=l.children[0];for(h.textContent=h.textContent.replaceAll("<","<").replaceAll(">",">");h.childNodes[0];)h=h.childNodes[0],h.textContent=h.textContent.replaceAll("<","<").replaceAll(">",">")}let u=l.getBBox();if(Cu(r.htmlLabels)){let h=l.children[0];h.style.textAlign="start";let f=ct(l);u=h.getBoundingClientRect(),f.attr("width",u.width),f.attr("height",u.height)}return u}function y4(e,t,r,n,i){return e===r?[{x:e-i/2,y:t},{x:e+i/2,y:t},{x:r+i/2,y:n},{x:r-i/2,y:n}]:[{x:e,y:t-i/2},{x:e,y:t+i/2},{x:r,y:n+i/2},{x:r,y:n-i/2}]}async function hAe(e,t,r,n,i=r.class.padding??12){let a=n?0:3,s=e.insert("g").attr("class",$r(t)).attr("id",t.domId||t.id),o=null,l=null,u=null,h=null,f=0,d=0,p=0;if(o=s.insert("g").attr("class","annotation-group text"),t.annotations.length>0){let x=t.annotations[0];await J3(o,{text:`\xAB${x}\xBB`},0),f=o.node().getBBox().height}l=s.insert("g").attr("class","label-group text"),await J3(l,t,0,["font-weight: bolder"]);let m=l.node().getBBox();d=m.height,u=s.insert("g").attr("class","members-group text");let g=0;for(let x of t.members){let w=await J3(u,x,g,[x.parseClassifier()]);g+=w+a}p=u.node().getBBox().height,p<=0&&(p=i/2),h=s.insert("g").attr("class","methods-group text");let y=0;for(let x of t.methods){let w=await J3(h,x,y,[x.parseClassifier()]);y+=w+a}let v=s.node().getBBox();if(o!==null){let x=o.node().getBBox();o.attr("transform",`translate(${-x.width/2})`)}return l.attr("transform",`translate(${-m.width/2}, ${f})`),v=s.node().getBBox(),u.attr("transform",`translate(0, ${f+d+i*2})`),v=s.node().getBBox(),h.attr("transform",`translate(0, ${f+d+(p?p+i*4:i*2)})`),v=s.node().getBBox(),{shapeSvg:s,bbox:v}}async function J3(e,t,r,n=[]){let i=e.insert("g").attr("class","label").attr("style",n.join("; ")),a=qt(),s="useHtmlLabels"in t?t.useHtmlLabels:Cu(a.htmlLabels)??!0,o="";"text"in t?o=t.text:o=t.label,!s&&o.startsWith("\\")&&(o=o.substring(1)),sa(o)&&(s=!0);let l=await rs(i,c9($c(o)),{width:uo(o,a)+50,classes:"markdown-node-label",useHtmlLabels:s},a),u,h=1;if(s){let f=l.children[0],d=ct(l);h=f.innerHTML.split("
").length,f.innerHTML.includes("")&&(h+=f.innerHTML.split("").length-1);let p=f.getElementsByTagName("img");if(p){let m=o.replace(/]*>/g,"").trim()==="";await Promise.all([...p].map(g=>new Promise(y=>{function v(){if(g.style.display="flex",g.style.flexDirection="column",m){let x=a.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,C=parseInt(x,10)*5+"px";g.style.minWidth=C,g.style.maxWidth=C}else g.style.width="100%";y(g)}b(v,"setupImage"),setTimeout(()=>{g.complete&&v()}),g.addEventListener("error",v),g.addEventListener("load",v)})))}u=f.getBoundingClientRect(),d.attr("width",u.width),d.attr("height",u.height)}else{n.includes("font-weight: bolder")&&ct(l).selectAll("tspan").attr("font-weight",""),h=l.children.length;let f=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(f.textContent=o[0]+o.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),o[1]===" "&&(f.textContent=f.textContent[0]+" "+f.textContent.substring(1))),f.textContent==="undefined"&&(f.textContent=""),u=l.getBBox()}return i.attr("transform","translate(0,"+(-u.height/(2*h)+r)+")"),u.height}async function fAe(e,t){let r=Be(),{themeVariables:n}=r,{useGradient:i}=n,a=r.class.padding??12,s=a,o=t.useHtmlLabels??Cu(r.htmlLabels)??!0,l=t;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];let{shapeSvg:u,bbox:h}=await hAe(e,t,r,o,s),{labelStyles:f,nodeStyles:d}=ar(t);t.labelStyle=f,t.cssStyles=l.styles||"";let p=l.styles?.join(";")||d||"";t.cssStyles||(t.cssStyles=p.replaceAll("!important","").split(";"));let m=l.members.length===0&&l.methods.length===0&&!r.class?.hideEmptyMembersBox,g=gt.svg(u),y=cr(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=Math.max(t.width??0,h.width),x=Math.max(t.height??0,h.height),w=(t.height??0)>h.height;l.members.length===0&&l.methods.length===0?x+=s:l.members.length>0&&l.methods.length===0&&(x+=s*2);let C=-v/2,T=-x/2,k=m?a*2:l.members.length===0&&l.methods.length===0?-a:0;w&&(k=a*2);let S=g.rectangle(C-a,T-a-(m?a:l.members.length===0&&l.methods.length===0?-a/2:0),v+2*a,x+2*a+k,y),E=u.insert(()=>S,":first-child");E.attr("class","basic label-container outer-path");let I=E.node().getBBox(),L=u.select(".annotation-group").node().getBBox().height-(m?a/2:0)||0,O=u.select(".label-group").node().getBBox().height-(m?a/2:0)||0,R=u.select(".members-group").node().getBBox().height-(m?a/2:0)||0,A=(L+O+T+a-(T-a-(m?a:l.members.length===0&&l.methods.length===0?-a/2:0)))/2;if(u.selectAll(".text").each((N,M,D)=>{let B=ct(D[M]),P=B.attr("transform"),$=0;if(P){let z=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(P);z&&($=parseFloat(z[2]))}let F=$+T+a-(m?a:l.members.length===0&&l.methods.length===0?-a/2:0);if(B.attr("class").includes("methods-group")){let G=Math.max(R,s/2);w?F=Math.max(A,L+O+G+T+s*2+a)+s*2:F=L+O+G+T+s*4+a}l.members.length===0&&l.methods.length===0&&r.class?.hideEmptyMembersBox&&(l.annotations.length>0?F=$-s:F=$),o||(F-=4);let q=C;(B.attr("class").includes("label-group")||B.attr("class").includes("annotation-group"))&&(q=-B.node()?.getBBox().width/2||0,u.selectAll("text").each(function(G,z,H){window.getComputedStyle(H[z]).textAnchor==="middle"&&(q=0)})),B.attr("transform",`translate(${q}, ${F})`)}),l.members.length>0||l.methods.length>0||m){let N=L+O+T+a,M=g.line(I.x,N,I.x+I.width,N+.001,y);u.insert(()=>M).attr("class",`divider${t.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(m||l.members.length>0||l.methods.length>0){let N=L+O+R+T+s*2+a,M=g.line(I.x,w?Math.max(A,N):N,I.x+I.width,(w?Math.max(A,N):N)+.001,y);u.insert(()=>M).attr("class",`divider${t.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(l.look!=="handDrawn"&&u.selectAll("path").attr("style",p),E.select(":nth-child(2)").attr("style",p),u.selectAll(".divider").select("path").attr("style",p),t.labelStyle?u.selectAll("span").attr("style",t.labelStyle):u.selectAll("span").attr("style",p),!o){let N=RegExp(/color\s*:\s*([^;]*)/),M=N.exec(p);if(M){let D=M[0].replace("color","fill");u.selectAll("tspan").attr("style",D)}else if(f){let D=N.exec(f);if(D){let B=D[0].replace("color","fill");u.selectAll("tspan").attr("style",B)}}}return gr(t,E),t.intersect=function(N){return sr.rect(t,N)},u}async function dAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let i=t,a=t,s=20,o=20,l="verifyMethod"in t,u=$r(t),{themeVariables:h}=Be(),{borderColorArray:f,requirementEdgeLabelBackground:d}=h,p=e.insert("g").attr("class",u).attr("id",t.domId??t.id),m;l?m=await qf(p,`<<${i.type}>>`,0,t.labelStyle):m=await qf(p,"<<Element>>",0,t.labelStyle);let g=m,y=await qf(p,i.name,g,t.labelStyle+"; font-weight: bold;");if(g+=y+o,l){let I=await qf(p,`${i.requirementId?`ID: ${i.requirementId}`:""}`,g,t.labelStyle);g+=I;let L=await qf(p,`${i.text?`Text: ${i.text}`:""}`,g,t.labelStyle);g+=L;let O=await qf(p,`${i.risk?`Risk: ${i.risk}`:""}`,g,t.labelStyle);g+=O,await qf(p,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,g,t.labelStyle)}else{let I=await qf(p,`${a.type?`Type: ${a.type}`:""}`,g,t.labelStyle);g+=I,await qf(p,`${a.docRef?`Doc Ref: ${a.docRef}`:""}`,g,t.labelStyle)}let v=(p.node()?.getBBox().width??200)+s,x=(p.node()?.getBBox().height??200)+s,w=-v/2,C=-x/2,T=gt.svg(p),k=cr(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");let S=T.rectangle(w,C,v,x,k),E=p.insert(()=>S,":first-child");if(E.attr("class","basic label-container outer-path").attr("style",n),f?.length){let I=t.colorIndex??0;p.attr("data-color-id",`color-${I%f.length}`)}if(p.selectAll(".label").each((I,L,O)=>{let R=ct(O[L]),A=R.attr("transform"),N=0,M=0;if(A){let $=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(A);$&&(N=parseFloat($[1]),M=parseFloat($[2]))}let D=M-x/2,B=w+s/2;(L===0||L===1)&&(B=N),R.attr("transform",`translate(${B}, ${D+s})`)}),g>m+y+o){let I=C+m+y+o,L;if(t.look==="neo"){let A=[[w,I],[w+v,I],[w+v,I+.001],[w,I+.001]];L=T.polygon(A,k)}else L=T.line(w,I,w+v,I,k);p.insert(()=>L).attr("class","divider")}return gr(t,E),t.intersect=function(I){return sr.rect(t,I)},n&&t.look!=="handDrawn"&&(d||f?.length)&&p.selectAll("path").attr("style",n),p}async function qf(e,t,r,n=""){if(t==="")return 0;let i=e.insert("g").attr("class","label").attr("style",n),a=Be(),s=a.htmlLabels??!0,o=await rs(i,c9($c(t)),{width:uo(t,a)+50,classes:"markdown-node-label",useHtmlLabels:s,style:n},a),l;if(s){let u=o.children[0],h=ct(o);l=u.getBoundingClientRect(),h.attr("width",l.width),h.attr("height",l.height)}else{let u=o.children[0];for(let h of u.children)n&&h.setAttribute("style",n);l=o.getBBox(),l.height+=6}return i.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}async function pAe(e,t,{config:r}){let{labelStyles:n,nodeStyles:i}=ar(t);t.labelStyle=n||"";let a=10,s=t.width;t.width=(t.width??200)-10;let{shapeSvg:o,bbox:l,label:u}=await Hr(e,t,$r(t)),h=t.padding||10,f="",d;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(f=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),d=o.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",f).attr("target","_blank"));let p={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1},m,g;d?{label:m,bbox:g}=await wY(d,"ticket"in t&&t.ticket||"",p):{label:m,bbox:g}=await wY(o,"ticket"in t&&t.ticket||"",p);let{label:y,bbox:v}=await wY(o,"assigned"in t&&t.assigned||"",p);t.width=s;let x=10,w=t?.width||0,C=Math.max(g.height,v.height)/2,T=Math.max(l.height+x*2,t?.height||0)+C,k=-w/2,S=-T/2;u.attr("transform","translate("+(h-w/2)+", "+(-C-l.height/2)+")"),m.attr("transform","translate("+(h-w/2)+", "+(-C+l.height/2)+")"),y.attr("transform","translate("+(h+w/2-v.width-2*a)+", "+(-C+l.height/2)+")");let E,{rx:I,ry:L}=t,{cssStyles:O}=t;if(t.look==="handDrawn"){let R=gt.svg(o),A=cr(t,{}),N=I||L?R.path(Qm(k,S,w,T,I||0),A):R.rectangle(k,S,w,T,A);E=o.insert(()=>N,":first-child"),E.attr("class","basic label-container").attr("style",O||null)}else{E=o.insert("rect",":first-child"),E.attr("class","basic label-container __APA__").attr("style",i).attr("rx",I??5).attr("ry",L??5).attr("x",k).attr("y",S).attr("width",w).attr("height",T);let R="priority"in t&&t.priority;if(R){let A=o.append("line"),N=k+2,M=S+Math.floor((I??0)/2),D=S+T-Math.floor((I??0)/2);A.attr("x1",N).attr("y1",M).attr("x2",N).attr("y2",D).attr("stroke-width","4").attr("stroke",w7t(R))}}return gr(t,E),t.height=T,t.intersect=function(R){return sr.rect(t,R)},o}async function mAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s,label:o}=await Hr(e,t,$r(t)),l=a.width+10*s,u=a.height+8*s,h=.15*l,{cssStyles:f}=t,d=a.width+20,p=a.height+20,m=Math.max(l,d),g=Math.max(u,p);o.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`);let y,v=`M0 0 a${h},${h} 1 0,0 ${m*.25},${-1*g*.1} a${h},${h} 1 0,0 ${m*.25},0 a${h},${h} 1 0,0 ${m*.25},0 @@ -502,7 +502,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="

An error a${h},${h} 1 0,0 ${-1*m*.1},${-1*g*.33} a${h*.8},${h*.8} 1 0,0 0,${-1*g*.34} a${h},${h} 1 0,0 ${m*.1},${-1*g*.33} - H0 V0 Z`;if(t.look==="handDrawn"){let x=gt.svg(i),w=cr(t,{}),C=x.path(v,w);y=i.insert(()=>C,":first-child"),y.attr("class","basic label-container").attr("style",es(f))}else y=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",v);return y.attr("transform",`translate(${-m/2}, ${-g/2})`),gr(t,y),t.calcIntersect=function(x,w){return sr.rect(x,w)},t.intersect=function(x){return se.info("Bang intersect",t,x),sr.rect(t,x)},i}async function pAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s,label:o}=await Hr(e,t,$r(t)),l=a.width+2*s,u=a.height+2*s,h=.15*l,f=.25*l,d=.35*l,p=.2*l,{cssStyles:m}=t,g,y=`M0 0 + H0 V0 Z`;if(t.look==="handDrawn"){let x=gt.svg(i),w=cr(t,{}),C=x.path(v,w);y=i.insert(()=>C,":first-child"),y.attr("class","basic label-container").attr("style",es(f))}else y=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",v);return y.attr("transform",`translate(${-m/2}, ${-g/2})`),gr(t,y),t.calcIntersect=function(x,w){return sr.rect(x,w)},t.intersect=function(x){return se.info("Bang intersect",t,x),sr.rect(t,x)},i}async function gAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s,label:o}=await Hr(e,t,$r(t)),l=a.width+2*s,u=a.height+2*s,h=.15*l,f=.25*l,d=.35*l,p=.2*l,{cssStyles:m}=t,g,y=`M0 0 a${h},${h} 0 0,1 ${l*.25},${-1*l*.1} a${d},${d} 1 0,1 ${l*.4},${-1*l*.1} a${f},${f} 1 0,1 ${l*.35},${l*.2} @@ -516,7 +516,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="

An error a${h},${h} 1 0,1 ${-1*l*.1},${-1*u*.35} a${p},${p} 1 0,1 ${l*.1},${-1*u*.65} - H0 V0 Z`;if(t.look==="handDrawn"){let v=gt.svg(i),x=cr(t,{}),w=v.path(y,x);g=i.insert(()=>w,":first-child"),g.attr("class","basic label-container").attr("style",es(m))}else g=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return o.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),g.attr("transform",`translate(${-l/2}, ${-u/2})`),gr(t,g),t.calcIntersect=function(v,x){return sr.rect(v,x)},t.intersect=function(v){return se.info("Cloud intersect",t,v),sr.rect(t,v)},i}async function mAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s,label:o}=await Hr(e,t,$r(t)),l=a.width+8*s,u=a.height+2*s,h=5,f=t.look==="neo"?` + H0 V0 Z`;if(t.look==="handDrawn"){let v=gt.svg(i),x=cr(t,{}),w=v.path(y,x);g=i.insert(()=>w,":first-child"),g.attr("class","basic label-container").attr("style",es(m))}else g=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return o.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),g.attr("transform",`translate(${-l/2}, ${-u/2})`),gr(t,g),t.calcIntersect=function(v,x){return sr.rect(v,x)},t.intersect=function(v){return se.info("Cloud intersect",t,v),sr.rect(t,v)},i}async function yAe(e,t){let{labelStyles:r,nodeStyles:n}=ar(t);t.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s,label:o}=await Hr(e,t,$r(t)),l=a.width+8*s,u=a.height+2*s,h=5,f=t.look==="neo"?` M${-l/2} ${u/2-h} v${-u+2*h} q0,-${h} ${h},-${h} @@ -536,47 +536,47 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="

An error h${-(l-2*h)} q${-h},0 ${-h},${-h} Z - `;if(!t.domId)throw new Error(`defaultMindmapNode: node "${t.id}" is missing a domId \u2014 was render.ts domId prefixing skipped?`);let d=i.append("path").attr("id",t.domId).attr("class","node-bkg node-"+t.type).attr("style",n).attr("d",f);return i.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",u/2).attr("x2",l/2).attr("y2",u/2),o.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),i.append(()=>o.node()),gr(t,d),t.calcIntersect=function(p,m){return sr.rect(p,m)},t.intersect=function(p){return sr.rect(t,p)},i}async function gAe(e,t){let r={padding:t.padding??0};return CY(e,t,r)}function EY(e){return e in yAe}async function M0(e,t,r){let n,i;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");let a=t.shape?yAe[t.shape]:void 0;if(!a)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let s;r.config.securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s??null),i=await a(n,t,r)}else i=await a(e,t,r),n=i;return n.attr("data-look",es(t.look)),t.tooltip&&i.attr("title",t.tooltip),NR.set(t.id,n),t.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}var Hr,xY,gr,$r,UEt,jy,YEt,L0,Qm,XEt,Z7e,jEt,KEt,ZEt,QEt,JEt,e7t,Q7e,Jm,MR,t7t,t8e,r7t,n7t,i7t,sr,IR,a7t,s7t,o7t,z7e,G7e,q7e,V7e,l7t,c7t,u7t,h7t,W7e,H7e,f7t,Xy,m4,bY,d7t,p7t,m7t,U7e,Y7e,X7e,j7e,Ea,K7e,g7t,y7t,v7t,x7t,yAe,NR,vAe,DR,Ky,po=W(()=>{co();ho();bs();ts();Sn();_r();Rr();hr();fn();fn();dr();fn();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();fn();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();fn();fn();dr();fn();dr();fn();dr();dr();dr();Hr=b(async(e,t,r)=>{let n,i=t.useHtmlLabels||Cu(Be()?.htmlLabels);r?n=r:n="node default";let a=e.insert("g").attr("class",n).attr("id",t.domId||t.id),s=a.insert("g").attr("class","label").attr("style",es(t.labelStyle)),o;t.label===void 0?o="":o=typeof t.label=="string"?t.label:t.label[0];let l=!!t.icon||!!t.img,u=t.labelType==="markdown",h=await rs(s,Mr($c(o),Be()),{useHtmlLabels:i,width:t.width||Be().flowchart?.wrappingWidth,classes:u?"markdown-node-label":"",style:t.labelStyle,addSvgBackground:l,markdown:u},Be()),f=h.getBBox(),d=(t?.padding??0)/2;if(i){let p=h.children[0],m=ct(h);await V3(p,o),f=p.getBoundingClientRect(),m.attr("width",f.width),m.attr("height",f.height)}return i?s.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):s.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&s.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:a,bbox:f,halfPadding:d,label:s}},"labelHelper"),xY=b(async(e,t,r)=>{let n=r.useHtmlLabels??zn(Be()),i=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),a=await rs(i,Mr($c(t),Be()),{useHtmlLabels:n,width:r.width||Be()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img}),s=a.getBBox(),o=r.padding/2;if(zn(Be())){let l=a.children[0],u=ct(a);s=l.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height)}return n?i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"):i.attr("transform","translate(0, "+-s.height/2+")"),r.centerLabel&&i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:e,bbox:s,halfPadding:o,label:i}},"insertLabel"),gr=b((e,t)=>{let r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),$r=b((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");b(On,"createPathFromPoints");b(Zm,"generateFullSineWavePoints");b(eC,"generateCirclePoints");b(wY,"mergePaths");UEt=b((e,t)=>{var r=e.x,n=e.y,i=t.x-r,a=t.y-n,s=e.width/2,o=e.height/2,l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=a===0?0:o*i/a,u=o):(i<0&&(s=-s),l=s,u=i===0?0:s*a/i),{x:r+l,y:n+u}},"intersectRect"),jy=UEt,YEt=b(async(e,t,r,n=!1,i=!1)=>{let a=t||"";typeof a=="object"&&(a=a[0]);let s=Be(),o=zn(s);return await rs(e,a,{style:r,isTitle:n,useHtmlLabels:o,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},s)},"createLabel"),L0=YEt,Qm=b((e,t,r,n,i)=>["M",e+i,t,"H",e+r-i,"A",i,i,0,0,1,e+r,t+i,"V",t+n-i,"A",i,i,0,0,1,e+r-i,t+n,"H",e+i,"A",i,i,0,0,1,e,t+n-i,"V",t+i,"A",i,i,0,0,1,e+i,t,"Z"].join(" "),"createRoundedRectPathD"),XEt=b(async(e,t)=>{let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,o=s,{labelStyles:l,nodeStyles:u,borderStyles:h,backgroundStyles:f}=ar(t),d=e.insert("g").attr("class","cluster swimlane "+(t.cssClasses||"")).attr("id",t.id).attr("data-id",t.id).attr("data-et","cluster").attr("data-look",t.look),p=Cu(r.flowchart.htmlLabels),m=t.direction==="LR",g=d.insert("g").attr("class","cluster-label swimlane-label"),y=await rs(g,t.label,{style:t.labelStyle,useHtmlLabels:p,isNode:!0,width:t.width}),v=y.getBBox();if(p){let A=y.children[0],N=ct(y);v=A.getBoundingClientRect(),N.attr("width",v.width),N.attr("height",v.height)}let x=t.padding??0,w=t.width<=v.width+x?v.width+x:t.width;t.width<=v.width+x?t.diff=(w-t.width)/2-x:t.diff=-x;let C=t.height,T=t.y-C/2,k=t.y+C/2,S=t.x-w/2,E=t.swimlaneContentTop!==void 0?t.swimlaneContentTop:T+C/3,I=m?4:0,L=v.height+2*I,O,R;if(m){let A=Math.max(L,v.height+2*I),N=S+A,M=Math.max(0,w-A);if(t.look==="handDrawn"){let P=gt.svg(d),$=cr(t,{roughness:.7,fill:a,stroke:o,fillWeight:3,seed:i}),F=cr(t,{roughness:.7,fill:"none",stroke:o,seed:i}),q=P.rectangle(S,T,A,C,$);O=d.insert(()=>q,":first-child");let G=P.rectangle(N,T,M,C,F);R=d.insert(()=>G,":first-child"),O.select("path:nth-child(2)").attr("style",h.join(";")),O.select("path").attr("style",f.join(";").replace("fill","stroke"))}else O=d.insert("rect",":first-child"),R=d.insert("rect",":first-child"),O.attr("class","swimlane-title").attr("style",u).attr("x",S).attr("y",T).attr("width",A).attr("height",C).attr("fill",a).attr("stroke",o),R.attr("class","swimlane-body").attr("style",u).attr("x",N).attr("y",T).attr("width",M).attr("height",C).attr("fill","none").attr("stroke",o);let D=S+A/2,B=t.y;g.attr("transform",`translate(${D}, ${B}) rotate(-90) translate(${-v.width/2}, ${-v.height/2})`)}else{let A=Math.max(0,E-T),N=Math.min(L,A),M=T+N,D=Math.max(0,k-M),B=t.x-w/2;if(t.look==="handDrawn"){let F=gt.svg(d),q=cr(t,{roughness:.7,fill:a,stroke:o,fillWeight:3,seed:i}),G=cr(t,{roughness:.7,fill:"none",stroke:o,seed:i}),z=F.rectangle(B,T,w,N,q);O=d.insert(()=>z,":first-child");let H=F.rectangle(B,M,w,D,G);R=d.insert(()=>H,":first-child"),O.select("path:nth-child(2)").attr("style",h.join(";")),O.select("path").attr("style",f.join(";").replace("fill","stroke"))}else O=d.insert("rect",":first-child"),R=d.insert("rect",":first-child"),O.attr("class","swimlane-title").attr("style",u).attr("x",B).attr("y",T).attr("width",w).attr("height",N).attr("fill",a).attr("stroke",o),R.attr("class","swimlane-body").attr("style",u).attr("x",B).attr("y",M).attr("width",w).attr("height",D).attr("fill","none").attr("stroke",o);let P=t.x-v.width/2,$=T+(N-v.height)/2;g.attr("transform",`translate(${P}, ${$})`)}if(se.trace("Swimlane data ",t,JSON.stringify(t)),l){let A=g.select("span");A&&A.attr("style",l)}return t.offsetX=0,t.width=w,t.height=C,t.offsetY=v.height-x/2,t.intersect=function(A){return jy(t,A)},{cluster:d,labelBBox:v}},"swimlane"),Z7e=b(async(e,t)=>{se.info("Creating subgraph rect for ",t.id,t);let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,{labelStyles:o,nodeStyles:l,borderStyles:u,backgroundStyles:h}=ar(t),f=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),d=zn(r),p=f.insert("g").attr("class","cluster-label "),m;t.labelType==="markdown"?m=await rs(p,t.label,{style:t.labelStyle,useHtmlLabels:d,isNode:!0,width:t.width}):m=await L0(p,t.label,t.labelStyle||"",!1,!0);let g=m.getBBox();if(zn(r)){let S=m.children[0],E=ct(m);g=S.getBoundingClientRect(),E.attr("width",g.width),E.attr("height",g.height)}let y=t.width<=g.width+t.padding?g.width+t.padding:t.width;t.width<=g.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let v=t.height,x=t.x-y/2,w=t.y-v/2;se.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){let S=gt.svg(f),E=cr(t,{roughness:.7,fill:a,stroke:s,fillWeight:3,seed:i}),I=S.path(Qm(x,w,y,v,0),E);C=f.insert(()=>(se.debug("Rough node insert CXC",I),I),":first-child"),C.select("path:nth-child(2)").attr("style",u.join(";")),C.select("path").attr("style",h.join(";").replace("fill","stroke"))}else C=f.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",w).attr("width",y).attr("height",v);let{subGraphTitleTopMargin:T}=yh(r);if(p.attr("transform",`translate(${t.x-g.width/2}, ${t.y-t.height/2+T})`),o){let S=p.select("span");S&&S.attr("style",o)}let k=C.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=g.height-t.padding/2,t.intersect=function(S){return jy(t,S)},{cluster:f,labelBBox:g}},"rect"),jEt=b((e,t)=>{let r=e.insert("g").attr("class","note-cluster").attr("id",t.domId),n=r.insert("rect",":first-child"),i=0*t.padding,a=i/2;n.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+i).attr("height",t.height+i).attr("fill","none");let s=n.node().getBBox();return t.width=s.width,t.height=s.height,t.intersect=function(o){return jy(t,o)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),KEt=b(async(e,t)=>{let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:a,compositeBackground:s,compositeTitleBackground:o,nodeBorder:l}=n,u=e.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-id",t.id).attr("data-look",t.look),h=u.insert("g",":first-child"),f=u.insert("g").attr("class","cluster-label"),d=u.append("rect"),p=await L0(f,t.label,t.labelStyle,void 0,!0),m=p.getBBox();if(zn(r)){let I=p.children[0],L=ct(p);m=I.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}let g=0*t.padding,y=g/2,v=(t.width<=m.width+t.padding?m.width+t.padding:t.width)+g;t.width<=m.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height+g,w=t.height+g-m.height-6,C=t.x-v/2,T=t.y-x/2;t.width=v;let k=t.y-t.height/2-y+m.height+2,S;if(t.look==="handDrawn"){let I=t.cssClasses.includes("statediagram-cluster-alt"),L=gt.svg(u),O=t.rx||t.ry?L.path(Qm(C,T,v,x,10),{roughness:.7,fill:o,fillStyle:"solid",stroke:l,seed:i}):L.rectangle(C,T,v,x,{seed:i});S=u.insert(()=>O,":first-child");let R=L.rectangle(C,k,v,w,{fill:I?a:s,fillStyle:I?"hachure":"solid",stroke:l,seed:i});S=u.insert(()=>O,":first-child"),d=u.insert(()=>R)}else S=h.insert("rect",":first-child"),S.attr("class","outer").attr("x",C).attr("y",T).attr("width",v).attr("height",x).attr("data-look",t.look),d.attr("class","inner").attr("x",C).attr("y",k).attr("width",v).attr("height",w);f.attr("transform",`translate(${t.x-m.width/2}, ${T+1-(zn(r)?0:3)})`);let E=S.node().getBBox();return t.height=E.height,t.offsetX=0,t.offsetY=m.height-t.padding/2,t.labelBBox=m,t.intersect=function(I){return jy(t,I)},{cluster:u,labelBBox:m}},"roundedWithTitle"),ZEt=b(async(e,t)=>{se.info("Creating subgraph rect for ",t.id,t);let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,{labelStyles:o,nodeStyles:l,borderStyles:u,backgroundStyles:h}=ar(t),f=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),d=zn(r),p=f.insert("g").attr("class","cluster-label "),m=await rs(p,t.label,{style:t.labelStyle,useHtmlLabels:d,isNode:!0,width:t.width}),g=m.getBBox();if(zn(r)){let S=m.children[0],E=ct(m);g=S.getBoundingClientRect(),E.attr("width",g.width),E.attr("height",g.height)}let y=t.width<=g.width+t.padding?g.width+t.padding:t.width;t.width<=g.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let v=t.height,x=t.x-y/2,w=t.y-v/2;se.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){let S=gt.svg(f),E=cr(t,{roughness:.7,fill:a,stroke:s,fillWeight:4,seed:i}),I=S.path(Qm(x,w,y,v,t.rx),E);C=f.insert(()=>(se.debug("Rough node insert CXC",I),I),":first-child"),C.select("path:nth-child(2)").attr("style",u.join(";")),C.select("path").attr("style",h.join(";").replace("fill","stroke"))}else C=f.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",w).attr("width",y).attr("height",v);let{subGraphTitleTopMargin:T}=yh(r);if(p.attr("transform",`translate(${t.x-g.width/2}, ${t.y-t.height/2+T})`),o){let S=p.select("span");S&&S.attr("style",o)}let k=C.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=g.height-t.padding/2,t.intersect=function(S){return jy(t,S)},{cluster:f,labelBBox:g}},"kanbanSection"),QEt=b((e,t)=>{let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{nodeBorder:a}=n,s=e.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-look",t.look),o=s.insert("g",":first-child"),l=0*t.padding,u=t.width+l;t.diff=-t.padding;let h=t.height+l,f=t.x-u/2,d=t.y-h/2;t.width=u;let p;if(t.look==="handDrawn"){let y=gt.svg(s).rectangle(f,d,u,h,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:a,seed:i});p=s.insert(()=>y,":first-child")}else{p=o.insert("rect",":first-child");let g="outer";t.look,g="divider",p.attr("class",g).attr("x",f).attr("y",d).attr("width",u).attr("height",h).attr("data-look",t.look)}let m=p.node().getBBox();return t.height=m.height,t.offsetX=0,t.offsetY=0,t.intersect=function(g){return jy(t,g)},{cluster:s,labelBBox:{}}},"divider"),JEt=Z7e,e7t={rect:Z7e,squareRect:JEt,roundedWithTitle:KEt,noteGroup:jEt,divider:QEt,kanbanSection:ZEt,swimlane:XEt},Q7e=new Map,Jm=b(async(e,t)=>{let r=t.shape||"rect",n=await e7t[r](e,t);return Q7e.set(t.id,n),n},"insertCluster"),MR=b(()=>{Q7e=new Map},"clear");b(J7e,"intersectNode");t7t=J7e;b(e8e,"intersectEllipse");t8e=e8e;b(r8e,"intersectCircle");r7t=r8e;b(n8e,"intersectLine");b(kY,"sameSign");n7t=n8e;b(i8e,"intersectPolygon");i7t=i8e,sr={node:t7t,circle:r7t,ellipse:t8e,polygon:i7t,rect:jy};b(a8e,"anchor");b(TY,"generateArcPoints");b(s8e,"calculateArcSagitta");b(o8e,"bowTieRect");b(I0,"insertPolygonShape");IR=12;b(l8e,"card");b(c8e,"choice");b(CY,"circle");b(u8e,"createLine");b(h8e,"crossedCircle");b(_0,"generateCirclePoints");b(f8e,"curlyBraceLeft");b(R0,"generateCirclePoints");b(d8e,"curlyBraceRight");b(fo,"generateCirclePoints");b(p8e,"curlyBraces");b(m8e,"curvedTrapezoid");a7t=b((e,t,r,n,i,a)=>[`M${e},${t+a}`,`a${i},${a} 0,0,0 ${r},0`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),s7t=b((e,t,r,n,i,a)=>[`M${e},${t+a}`,`M${e+r},${t+a}`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),o7t=b((e,t,r,n,i,a)=>[`M${e-r/2},${-n/2}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),z7e=8,G7e=8;b(g8e,"cylinder");b(v4,"drawRect");b(y8e,"datastore");b(v8e,"dividedRectangle");b(x8e,"doublecircle");b(b8e,"filledCircle");q7e=10,V7e=10;b(w8e,"flippedTriangle");b(k8e,"forkJoin");b(T8e,"halfRoundedRectangle");l7t=b((e,t,r,n,i)=>[`M${e+i},${t}`,`L${e+r-i},${t}`,`L${e+r},${t-n/2}`,`L${e+r-i},${t-n}`,`L${e+i},${t-n}`,`L${e},${t-n/2}`,"Z"].join(" "),"createHexagonPathD");b(C8e,"hexagon");b(S8e,"hourglass");b(E8e,"icon");b(A8e,"iconCircle");b(_8e,"iconRounded");b(R8e,"iconSquare");b(L8e,"imageSquare");b(I8e,"inv_trapezoid");b(M8e,"labelRect");b(N8e,"lean_left");b(D8e,"lean_right");b(O8e,"lightningBolt");c7t=b((e,t,r,n,i,a,s)=>[`M${e},${t+a}`,`a${i},${a} 0,0,0 ${r},0`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+a+s}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),u7t=b((e,t,r,n,i,a,s)=>[`M${e},${t+a}`,`M${e+r},${t+a}`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+a+s}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),h7t=b((e,t,r,n,i,a)=>[`M${e-r/2},${-n/2}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),W7e=10,H7e=10;b(P8e,"linedCylinder");b(B8e,"linedWaveEdgedRect");b(F8e,"multiRect");b($8e,"multiWaveEdgedRectangle");b(z8e,"note");f7t=b((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");b(G8e,"question");b(q8e,"rect_left_inv_arrow");b(V8e,"rectWithTitle");b(W8e,"roundedRect");Xy=8;b(H8e,"shadedProcess");b(U8e,"slopedRect");b(Y8e,"squareRect");b(X8e,"stadium");b(j8e,"state");b(K8e,"stateEnd");b(Z8e,"stateStart");m4=8;b(Q8e,"subroutine");bY=.2;b(J8e,"taggedRect");b(eAe,"taggedWaveEdgedRectangle");b(tAe,"text");d7t=b((e,t,r,n,i,a)=>`M${e},${t} + `;if(!t.domId)throw new Error(`defaultMindmapNode: node "${t.id}" is missing a domId \u2014 was render.ts domId prefixing skipped?`);let d=i.append("path").attr("id",t.domId).attr("class","node-bkg node-"+t.type).attr("style",n).attr("d",f);return i.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",u/2).attr("x2",l/2).attr("y2",u/2),o.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),i.append(()=>o.node()),gr(t,d),t.calcIntersect=function(p,m){return sr.rect(p,m)},t.intersect=function(p){return sr.rect(t,p)},i}async function vAe(e,t){let r={padding:t.padding??0};return EY(e,t,r)}function _Y(e){return e in xAe}async function M0(e,t,r){let n,i;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");let a=t.shape?xAe[t.shape]:void 0;if(!a)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let s;r.config.securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s??null),i=await a(n,t,r)}else i=await a(e,t,r),n=i;return n.attr("data-look",es(t.look)),t.tooltip&&i.attr("title",t.tooltip),NR.set(t.id,n),t.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}var Hr,wY,gr,$r,KEt,jy,ZEt,L0,Qm,QEt,J7e,JEt,e7t,t7t,r7t,n7t,i7t,e8e,Jm,MR,a7t,n8e,s7t,o7t,l7t,sr,IR,c7t,u7t,h7t,q7e,V7e,W7e,H7e,f7t,d7t,p7t,m7t,U7e,Y7e,g7t,Xy,m4,kY,y7t,v7t,x7t,X7e,j7e,K7e,Z7e,Ea,Q7e,b7t,w7t,k7t,T7t,xAe,NR,bAe,DR,Ky,po=W(()=>{co();ho();bs();ts();Sn();_r();Rr();hr();fn();fn();dr();fn();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();fn();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();dr();fn();fn();dr();fn();dr();fn();dr();dr();dr();Hr=b(async(e,t,r)=>{let n,i=t.useHtmlLabels||Cu(Be()?.htmlLabels);r?n=r:n="node default";let a=e.insert("g").attr("class",n).attr("id",t.domId||t.id),s=a.insert("g").attr("class","label").attr("style",es(t.labelStyle)),o;t.label===void 0?o="":o=typeof t.label=="string"?t.label:t.label[0];let l=!!t.icon||!!t.img,u=t.labelType==="markdown",h=await rs(s,Mr($c(o),Be()),{useHtmlLabels:i,width:t.width||Be().flowchart?.wrappingWidth,classes:u?"markdown-node-label":"",style:t.labelStyle,addSvgBackground:l,markdown:u},Be()),f=h.getBBox(),d=(t?.padding??0)/2;if(i){let p=h.children[0],m=ct(h);await V3(p,o),f=p.getBoundingClientRect(),m.attr("width",f.width),m.attr("height",f.height)}return i?s.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):s.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&s.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:a,bbox:f,halfPadding:d,label:s}},"labelHelper"),wY=b(async(e,t,r)=>{let n=r.useHtmlLabels??zn(Be()),i=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),a=await rs(i,Mr($c(t),Be()),{useHtmlLabels:n,width:r.width||Be()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img}),s=a.getBBox(),o=r.padding/2;if(zn(Be())){let l=a.children[0],u=ct(a);s=l.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height)}return n?i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"):i.attr("transform","translate(0, "+-s.height/2+")"),r.centerLabel&&i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:e,bbox:s,halfPadding:o,label:i}},"insertLabel"),gr=b((e,t)=>{let r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),$r=b((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");b(On,"createPathFromPoints");b(Zm,"generateFullSineWavePoints");b(eC,"generateCirclePoints");b(TY,"mergePaths");KEt=b((e,t)=>{var r=e.x,n=e.y,i=t.x-r,a=t.y-n,s=e.width/2,o=e.height/2,l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=a===0?0:o*i/a,u=o):(i<0&&(s=-s),l=s,u=i===0?0:s*a/i),{x:r+l,y:n+u}},"intersectRect"),jy=KEt,ZEt=b(async(e,t,r,n=!1,i=!1)=>{let a=t||"";typeof a=="object"&&(a=a[0]);let s=Be(),o=zn(s);return await rs(e,a,{style:r,isTitle:n,useHtmlLabels:o,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},s)},"createLabel"),L0=ZEt,Qm=b((e,t,r,n,i)=>["M",e+i,t,"H",e+r-i,"A",i,i,0,0,1,e+r,t+i,"V",t+n-i,"A",i,i,0,0,1,e+r-i,t+n,"H",e+i,"A",i,i,0,0,1,e,t+n-i,"V",t+i,"A",i,i,0,0,1,e+i,t,"Z"].join(" "),"createRoundedRectPathD"),QEt=b(async(e,t)=>{let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,o=s,{labelStyles:l,nodeStyles:u,borderStyles:h,backgroundStyles:f}=ar(t),d=e.insert("g").attr("class","cluster swimlane "+(t.cssClasses||"")).attr("id",t.id).attr("data-id",t.id).attr("data-et","cluster").attr("data-look",t.look),p=Cu(r.flowchart.htmlLabels),m=t.direction==="LR",g=d.insert("g").attr("class","cluster-label swimlane-label"),y=await rs(g,t.label,{style:t.labelStyle,useHtmlLabels:p,isNode:!0,width:t.width}),v=y.getBBox();if(p){let A=y.children[0],N=ct(y);v=A.getBoundingClientRect(),N.attr("width",v.width),N.attr("height",v.height)}let x=t.padding??0,w=t.width<=v.width+x?v.width+x:t.width;t.width<=v.width+x?t.diff=(w-t.width)/2-x:t.diff=-x;let C=t.height,T=t.y-C/2,k=t.y+C/2,S=t.x-w/2,E=t.swimlaneContentTop!==void 0?t.swimlaneContentTop:T+C/3,I=m?4:0,L=v.height+2*I,O,R;if(m){let A=Math.max(L,v.height+2*I),N=S+A,M=Math.max(0,w-A);if(t.look==="handDrawn"){let P=gt.svg(d),$=cr(t,{roughness:.7,fill:a,stroke:o,fillWeight:3,seed:i}),F=cr(t,{roughness:.7,fill:"none",stroke:o,seed:i}),q=P.rectangle(S,T,A,C,$);O=d.insert(()=>q,":first-child");let G=P.rectangle(N,T,M,C,F);R=d.insert(()=>G,":first-child"),O.select("path:nth-child(2)").attr("style",h.join(";")),O.select("path").attr("style",f.join(";").replace("fill","stroke"))}else O=d.insert("rect",":first-child"),R=d.insert("rect",":first-child"),O.attr("class","swimlane-title").attr("style",u).attr("x",S).attr("y",T).attr("width",A).attr("height",C).attr("fill",a).attr("stroke",o),R.attr("class","swimlane-body").attr("style",u).attr("x",N).attr("y",T).attr("width",M).attr("height",C).attr("fill","none").attr("stroke",o);let D=S+A/2,B=t.y;g.attr("transform",`translate(${D}, ${B}) rotate(-90) translate(${-v.width/2}, ${-v.height/2})`)}else{let A=Math.max(0,E-T),N=Math.min(L,A),M=T+N,D=Math.max(0,k-M),B=t.x-w/2;if(t.look==="handDrawn"){let F=gt.svg(d),q=cr(t,{roughness:.7,fill:a,stroke:o,fillWeight:3,seed:i}),G=cr(t,{roughness:.7,fill:"none",stroke:o,seed:i}),z=F.rectangle(B,T,w,N,q);O=d.insert(()=>z,":first-child");let H=F.rectangle(B,M,w,D,G);R=d.insert(()=>H,":first-child"),O.select("path:nth-child(2)").attr("style",h.join(";")),O.select("path").attr("style",f.join(";").replace("fill","stroke"))}else O=d.insert("rect",":first-child"),R=d.insert("rect",":first-child"),O.attr("class","swimlane-title").attr("style",u).attr("x",B).attr("y",T).attr("width",w).attr("height",N).attr("fill",a).attr("stroke",o),R.attr("class","swimlane-body").attr("style",u).attr("x",B).attr("y",M).attr("width",w).attr("height",D).attr("fill","none").attr("stroke",o);let P=t.x-v.width/2,$=T+(N-v.height)/2;g.attr("transform",`translate(${P}, ${$})`)}if(se.trace("Swimlane data ",t,JSON.stringify(t)),l){let A=g.select("span");A&&A.attr("style",l)}return t.offsetX=0,t.width=w,t.height=C,t.offsetY=v.height-x/2,t.intersect=function(A){return jy(t,A)},{cluster:d,labelBBox:v}},"swimlane"),J7e=b(async(e,t)=>{se.info("Creating subgraph rect for ",t.id,t);let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,{labelStyles:o,nodeStyles:l,borderStyles:u,backgroundStyles:h}=ar(t),f=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),d=zn(r),p=f.insert("g").attr("class","cluster-label "),m;t.labelType==="markdown"?m=await rs(p,t.label,{style:t.labelStyle,useHtmlLabels:d,isNode:!0,width:t.width}):m=await L0(p,t.label,t.labelStyle||"",!1,!0);let g=m.getBBox();if(zn(r)){let S=m.children[0],E=ct(m);g=S.getBoundingClientRect(),E.attr("width",g.width),E.attr("height",g.height)}let y=t.width<=g.width+t.padding?g.width+t.padding:t.width;t.width<=g.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let v=t.height,x=t.x-y/2,w=t.y-v/2;se.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){let S=gt.svg(f),E=cr(t,{roughness:.7,fill:a,stroke:s,fillWeight:3,seed:i}),I=S.path(Qm(x,w,y,v,0),E);C=f.insert(()=>(se.debug("Rough node insert CXC",I),I),":first-child"),C.select("path:nth-child(2)").attr("style",u.join(";")),C.select("path").attr("style",h.join(";").replace("fill","stroke"))}else C=f.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",w).attr("width",y).attr("height",v);let{subGraphTitleTopMargin:T}=yh(r);if(p.attr("transform",`translate(${t.x-g.width/2}, ${t.y-t.height/2+T})`),o){let S=p.select("span");S&&S.attr("style",o)}let k=C.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=g.height-t.padding/2,t.intersect=function(S){return jy(t,S)},{cluster:f,labelBBox:g}},"rect"),JEt=b((e,t)=>{let r=e.insert("g").attr("class","note-cluster").attr("id",t.domId),n=r.insert("rect",":first-child"),i=0*t.padding,a=i/2;n.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+i).attr("height",t.height+i).attr("fill","none");let s=n.node().getBBox();return t.width=s.width,t.height=s.height,t.intersect=function(o){return jy(t,o)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),e7t=b(async(e,t)=>{let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:a,compositeBackground:s,compositeTitleBackground:o,nodeBorder:l}=n,u=e.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-id",t.id).attr("data-look",t.look),h=u.insert("g",":first-child"),f=u.insert("g").attr("class","cluster-label"),d=u.append("rect"),p=await L0(f,t.label,t.labelStyle,void 0,!0),m=p.getBBox();if(zn(r)){let I=p.children[0],L=ct(p);m=I.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}let g=0*t.padding,y=g/2,v=(t.width<=m.width+t.padding?m.width+t.padding:t.width)+g;t.width<=m.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height+g,w=t.height+g-m.height-6,C=t.x-v/2,T=t.y-x/2;t.width=v;let k=t.y-t.height/2-y+m.height+2,S;if(t.look==="handDrawn"){let I=t.cssClasses.includes("statediagram-cluster-alt"),L=gt.svg(u),O=t.rx||t.ry?L.path(Qm(C,T,v,x,10),{roughness:.7,fill:o,fillStyle:"solid",stroke:l,seed:i}):L.rectangle(C,T,v,x,{seed:i});S=u.insert(()=>O,":first-child");let R=L.rectangle(C,k,v,w,{fill:I?a:s,fillStyle:I?"hachure":"solid",stroke:l,seed:i});S=u.insert(()=>O,":first-child"),d=u.insert(()=>R)}else S=h.insert("rect",":first-child"),S.attr("class","outer").attr("x",C).attr("y",T).attr("width",v).attr("height",x).attr("data-look",t.look),d.attr("class","inner").attr("x",C).attr("y",k).attr("width",v).attr("height",w);f.attr("transform",`translate(${t.x-m.width/2}, ${T+1-(zn(r)?0:3)})`);let E=S.node().getBBox();return t.height=E.height,t.offsetX=0,t.offsetY=m.height-t.padding/2,t.labelBBox=m,t.intersect=function(I){return jy(t,I)},{cluster:u,labelBBox:m}},"roundedWithTitle"),t7t=b(async(e,t)=>{se.info("Creating subgraph rect for ",t.id,t);let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,{labelStyles:o,nodeStyles:l,borderStyles:u,backgroundStyles:h}=ar(t),f=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),d=zn(r),p=f.insert("g").attr("class","cluster-label "),m=await rs(p,t.label,{style:t.labelStyle,useHtmlLabels:d,isNode:!0,width:t.width}),g=m.getBBox();if(zn(r)){let S=m.children[0],E=ct(m);g=S.getBoundingClientRect(),E.attr("width",g.width),E.attr("height",g.height)}let y=t.width<=g.width+t.padding?g.width+t.padding:t.width;t.width<=g.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let v=t.height,x=t.x-y/2,w=t.y-v/2;se.trace("Data ",t,JSON.stringify(t));let C;if(t.look==="handDrawn"){let S=gt.svg(f),E=cr(t,{roughness:.7,fill:a,stroke:s,fillWeight:4,seed:i}),I=S.path(Qm(x,w,y,v,t.rx),E);C=f.insert(()=>(se.debug("Rough node insert CXC",I),I),":first-child"),C.select("path:nth-child(2)").attr("style",u.join(";")),C.select("path").attr("style",h.join(";").replace("fill","stroke"))}else C=f.insert("rect",":first-child"),C.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",w).attr("width",y).attr("height",v);let{subGraphTitleTopMargin:T}=yh(r);if(p.attr("transform",`translate(${t.x-g.width/2}, ${t.y-t.height/2+T})`),o){let S=p.select("span");S&&S.attr("style",o)}let k=C.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=g.height-t.padding/2,t.intersect=function(S){return jy(t,S)},{cluster:f,labelBBox:g}},"kanbanSection"),r7t=b((e,t)=>{let r=Be(),{themeVariables:n,handDrawnSeed:i}=r,{nodeBorder:a}=n,s=e.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-look",t.look),o=s.insert("g",":first-child"),l=0*t.padding,u=t.width+l;t.diff=-t.padding;let h=t.height+l,f=t.x-u/2,d=t.y-h/2;t.width=u;let p;if(t.look==="handDrawn"){let y=gt.svg(s).rectangle(f,d,u,h,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:a,seed:i});p=s.insert(()=>y,":first-child")}else{p=o.insert("rect",":first-child");let g="outer";t.look,g="divider",p.attr("class",g).attr("x",f).attr("y",d).attr("width",u).attr("height",h).attr("data-look",t.look)}let m=p.node().getBBox();return t.height=m.height,t.offsetX=0,t.offsetY=0,t.intersect=function(g){return jy(t,g)},{cluster:s,labelBBox:{}}},"divider"),n7t=J7e,i7t={rect:J7e,squareRect:n7t,roundedWithTitle:e7t,noteGroup:JEt,divider:r7t,kanbanSection:t7t,swimlane:QEt},e8e=new Map,Jm=b(async(e,t)=>{let r=t.shape||"rect",n=await i7t[r](e,t);return e8e.set(t.id,n),n},"insertCluster"),MR=b(()=>{e8e=new Map},"clear");b(t8e,"intersectNode");a7t=t8e;b(r8e,"intersectEllipse");n8e=r8e;b(i8e,"intersectCircle");s7t=i8e;b(a8e,"intersectLine");b(CY,"sameSign");o7t=a8e;b(s8e,"intersectPolygon");l7t=s8e,sr={node:a7t,circle:s7t,ellipse:n8e,polygon:l7t,rect:jy};b(o8e,"anchor");b(SY,"generateArcPoints");b(l8e,"calculateArcSagitta");b(c8e,"bowTieRect");b(I0,"insertPolygonShape");IR=12;b(u8e,"card");b(h8e,"choice");b(EY,"circle");b(f8e,"createLine");b(d8e,"crossedCircle");b(_0,"generateCirclePoints");b(p8e,"curlyBraceLeft");b(R0,"generateCirclePoints");b(m8e,"curlyBraceRight");b(fo,"generateCirclePoints");b(g8e,"curlyBraces");b(y8e,"curvedTrapezoid");c7t=b((e,t,r,n,i,a)=>[`M${e},${t+a}`,`a${i},${a} 0,0,0 ${r},0`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),u7t=b((e,t,r,n,i,a)=>[`M${e},${t+a}`,`M${e+r},${t+a}`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),h7t=b((e,t,r,n,i,a)=>[`M${e-r/2},${-n/2}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),q7e=8,V7e=8;b(v8e,"cylinder");b(v4,"drawRect");b(x8e,"datastore");b(b8e,"dividedRectangle");b(w8e,"doublecircle");b(k8e,"filledCircle");W7e=10,H7e=10;b(T8e,"flippedTriangle");b(C8e,"forkJoin");b(S8e,"halfRoundedRectangle");f7t=b((e,t,r,n,i)=>[`M${e+i},${t}`,`L${e+r-i},${t}`,`L${e+r},${t-n/2}`,`L${e+r-i},${t-n}`,`L${e+i},${t-n}`,`L${e},${t-n/2}`,"Z"].join(" "),"createHexagonPathD");b(E8e,"hexagon");b(A8e,"hourglass");b(_8e,"icon");b(R8e,"iconCircle");b(L8e,"iconRounded");b(I8e,"iconSquare");b(M8e,"imageSquare");b(N8e,"inv_trapezoid");b(D8e,"labelRect");b(O8e,"lean_left");b(P8e,"lean_right");b(B8e,"lightningBolt");d7t=b((e,t,r,n,i,a,s)=>[`M${e},${t+a}`,`a${i},${a} 0,0,0 ${r},0`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+a+s}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),p7t=b((e,t,r,n,i,a,s)=>[`M${e},${t+a}`,`M${e+r},${t+a}`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+a+s}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),m7t=b((e,t,r,n,i,a)=>[`M${e-r/2},${-n/2}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),U7e=10,Y7e=10;b(F8e,"linedCylinder");b($8e,"linedWaveEdgedRect");b(z8e,"multiRect");b(G8e,"multiWaveEdgedRectangle");b(q8e,"note");g7t=b((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");b(V8e,"question");b(W8e,"rect_left_inv_arrow");b(H8e,"rectWithTitle");b(U8e,"roundedRect");Xy=8;b(Y8e,"shadedProcess");b(X8e,"slopedRect");b(j8e,"squareRect");b(K8e,"stadium");b(Z8e,"state");b(Q8e,"stateEnd");b(J8e,"stateStart");m4=8;b(eAe,"subroutine");kY=.2;b(tAe,"taggedRect");b(rAe,"taggedWaveEdgedRectangle");b(nAe,"text");y7t=b((e,t,r,n,i,a)=>`M${e},${t} a${i},${a} 0,0,1 0,${-n} l${r},0 a${i},${a} 0,0,1 0,${n} M${r},${-n} a${i},${a} 0,0,0 0,${n} - l${-r},0`,"createCylinderPathD"),p7t=b((e,t,r,n,i,a)=>[`M${e},${t}`,`M${e+r},${t}`,`a${i},${a} 0,0,0 0,${-n}`,`l${-r},0`,`a${i},${a} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),m7t=b((e,t,r,n,i,a)=>[`M${e+r/2},${-n/2}`,`a${i},${a} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),U7e=5,Y7e=10;b(rAe,"tiltedCylinder");b(nAe,"trapezoid");b(iAe,"trapezoidalPentagon");X7e=10,j7e=10;b(aAe,"triangle");b(sAe,"waveEdgedRectangle");b(oAe,"waveRectangle");Ea=10;b(lAe,"windowPane");K7e=new Set(["redux-color","redux-dark-color"]),g7t=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);b(SY,"erBox");b(g4,"addText");b(y4,"lineToPolygon");b(cAe,"textHelper");b(J3,"addText");b(uAe,"classBox");b(hAe,"requirementBox");b(qf,"addText");y7t=b(e=>{switch(e){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");b(fAe,"kanbanItem");b(dAe,"bang");b(pAe,"cloud");b(mAe,"defaultMindmapNode");b(gAe,"mindmapCircle");v7t=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Y8e},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:W8e},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:X8e},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Q8e},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:g8e},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:y8e},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:CY},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:dAe},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:pAe},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:G8e},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:C8e},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:D8e},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:N8e},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:nAe},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:I8e},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:x8e},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:tAe},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:l8e},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:H8e},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Z8e},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:K8e},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:k8e},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:S8e},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:f8e},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:d8e},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:p8e},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:O8e},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:sAe},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:T8e},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:rAe},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:P8e},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:m8e},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:v8e},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:aAe},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:lAe},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:b8e},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:iAe},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:w8e},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:U8e},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:$8e},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:F8e},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:o8e},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:h8e},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:eAe},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:J8e},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:oAe},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:q8e},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:B8e}],x7t=b(()=>{let t=[...Object.entries({state:j8e,choice:c8e,note:z8e,rectWithTitle:V8e,labelRect:M8e,iconSquare:R8e,iconCircle:A8e,icon:E8e,iconRounded:_8e,imageSquare:L8e,anchor:a8e,kanbanItem:fAe,mindmapCircle:gAe,defaultMindmapNode:mAe,classBox:uAe,erBox:SY,requirementBox:hAe}),...v7t.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),yAe=x7t();b(EY,"isValidShape");NR=new Map;b(M0,"insertNode");vAe=b((e,t)=>{NR.set(t.id,e)},"setNodeElem"),DR=b(()=>{NR.clear()},"clear"),Ky=b(e=>{let t=NR.get(e.id);se.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");let r=8,n=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+n-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),n},"positionNode")});function tC(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=la(e),t=la(t);let[r,n]=[e.x,e.y],[i,a]=[t.x,t.y],s=i-r,o=a-n;return{angle:Math.atan(o/s),deltaX:s,deltaY:o}}var _u,ns,AY,la,OR,vl=W(()=>{hr();_u=b((e,t)=>{if(t)return"translate("+-e.width/2+", "+-e.height/2+")";let r=e.x??0,n=e.y??0;return"translate("+-(r+e.width/2)+", "+-(n+e.height/2)+")"},"computeLabelTransform"),ns={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4,arrow_barb:0,arrow_barb_neo:5.5},AY={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};b(tC,"calculateDeltaAndAngle");la=b(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),OR=b(e=>({x:b(function(t,r,n){let i=0,a=la(n[0]).x=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(ns,e.arrowTypeEnd)){let{angle:p,deltaX:m}=tC(n[n.length-1],n[n.length-2]);i=ns[e.arrowTypeEnd]*Math.cos(p)*(m>=0?1:-1)}let s=Math.abs(la(t).x-la(n[n.length-1]).x),o=Math.abs(la(t).y-la(n[n.length-1]).y),l=Math.abs(la(t).x-la(n[0]).x),u=Math.abs(la(t).y-la(n[0]).y),h=ns[e.arrowTypeStart],f=ns[e.arrowTypeEnd],d=1;if(s0&&o0&&u=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(ns,e.arrowTypeEnd)){let{angle:p,deltaY:m}=tC(n[n.length-1],n[n.length-2]);i=ns[e.arrowTypeEnd]*Math.abs(Math.sin(p))*(m>=0?1:-1)}let s=Math.abs(la(t).y-la(n[n.length-1]).y),o=Math.abs(la(t).x-la(n[n.length-1]).x),l=Math.abs(la(t).y-la(n[0]).y),u=Math.abs(la(t).x-la(n[0]).x),h=ns[e.arrowTypeStart],f=ns[e.arrowTypeEnd],d=1;if(s0&&o0&&u5&&Math.abs(a.y-i.y)>5||i.y===a.y&&a.x===s.x&&Math.abs(a.x-i.x)>5&&Math.abs(a.y-s.y)>5)&&(t.push(a),r.push(n))}return{cornerPoints:t,cornerPointPositions:r}}function TAe(e,t){if(e.length<2)return"";let r="",n=e.length,i=1e-5;for(let a=0;a({...i}));if(e.length>=2&&ns[t.arrowTypeStart]){let i=ns[t.arrowTypeStart],a=e[0],s=e[1],{angle:o}=_Y(a,s),l=i*Math.cos(o),u=i*Math.sin(o);r[0].x=a.x+l,r[0].y=a.y+u}let n=e.length;if(n>=2&&ns[t.arrowTypeEnd]){let i=ns[t.arrowTypeEnd],a=e[n-1],s=e[n-2],{angle:o}=_Y(s,a),l=i*Math.cos(o),u=i*Math.sin(o);r[n-1].x=a.x-l,r[n-1].y=a.y-u}return r}var b7t,w7t,k7t,xAe,T7t,x4,Aa,PR,rC,Zy,BR,C7t,S7t,E7t,bAe,wAe,A7t,_7t,b4,R7t,L7t,I7t,M7t,N7t,D7t,O7t,P7t,B7t,F7t,$7t,z7t,G7t,q7t,V7t,W7t,H7t,U7t,Y7t,X7t,j7t,K7t,Z7t,Q7t,w4,Jl=W(()=>{po();co();vl();ho();bs();Sn();_r();Rr();hr();fn();dr();b7t=b((e,t,r,n,i,a=!1,s)=>{t.arrowTypeStart&&xAe(e,"start",t.arrowTypeStart,r,n,i,a,s),t.arrowTypeEnd&&xAe(e,"end",t.arrowTypeEnd,r,n,i,a,s)},"addEdgeMarkers"),w7t={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_barb_neo:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},k7t=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],xAe=b((e,t,r,n,i,a,s=!1,o)=>{let l=w7t[r],u=l&&k7t.includes(l.type);if(!l){se.warn(`Unknown arrow type: ${r}`);return}let h=l.type,p=`${i}_${a}-${h}${t==="start"?"Start":"End"}${s&&u?"-margin":""}`;if(o&&o.trim()!==""){let m=o.replace(/[^\dA-Za-z]/g,"_"),g=`${p}_${m}`;if(!document.getElementById(g)){let y=document.getElementById(p);if(y){let v=y.cloneNode(!0);v.id=g,v.querySelectorAll("path, circle, line").forEach(w=>{w.setAttribute("stroke",o),l.fill&&w.setAttribute("fill",o)}),y.parentNode?.appendChild(v)}}e.attr(`marker-${t}`,`url(${n}#${g})`)}else e.attr(`marker-${t}`,`url(${n}#${p})`)},"addEdgeMarker"),T7t=b(e=>typeof e=="string"?e:Be()?.flowchart?.curve,"resolveEdgeCurveType"),x4=new Map,Aa=new Map,PR=b(()=>{x4.clear(),Aa.clear()},"clear"),rC=b(e=>e?typeof e=="string"?e:e.reduce((t,r)=>t+";"+r,""):"","getLabelStyles"),Zy=b(async(e,t)=>{let r=Be(),n=zn(r),{labelStyles:i}=ar(t);t.labelStyle=i;let a=e.insert("g").attr("class","edgeLabel"),s=a.insert("g").attr("class","label").attr("data-id",t.id),o=t.labelType==="markdown",u=await rs(e,t.label,{style:rC(t.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:o,width:o?void 0:void 0},r);s.node().appendChild(u),se.info("abc82",t,t.labelType);let h=u.getBBox(),f=h;if(n){let p=u.children[0],m=ct(u);h=p.getBoundingClientRect(),f=h,m.attr("width",h.width),m.attr("height",h.height)}else{let p=ct(u).select("text").node();p&&typeof p.getBBox=="function"&&(f=p.getBBox())}s.attr("transform",_u(f,n)),x4.set(t.id,a),t.width=h.width,t.height=h.height;let d;if(t.startLabelLeft){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(m,t.startLabelLeft,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).startLeft=p,nC(d,t.startLabelLeft)}if(t.startLabelRight){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(m,t.startLabelRight,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).startRight=p,nC(d,t.startLabelRight)}if(t.endLabelLeft){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(p,t.endLabelLeft,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).endLeft=p,nC(d,t.endLabelLeft)}if(t.endLabelRight){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(p,t.endLabelRight,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).endRight=p,nC(d,t.endLabelRight)}return u},"insertEdgeLabel");b(nC,"setTerminalWidth");BR=b((e,t)=>{se.debug("Moving label abc88 ",e.id,e.label,x4.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath,n=Be(),{subGraphTitleTotalMargin:i}=yh(n);if(e.label){let a=x4.get(e.id),s=e.x,o=e.y;if(r){let l=pr.calcLabelPosition(r);se.debug("Moving label "+e.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(e.startLabelLeft){let a=Aa.get(e.id).startLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.startLabelRight){let a=Aa.get(e.id).startRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelLeft){let a=Aa.get(e.id).endLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelRight){let a=Aa.get(e.id).endRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}},"positionEdgeLabel"),C7t=b((e,t)=>{if(!e?.isLabelEdge||!e?.id?.endsWith("-to-label")||!Array.isArray(t)||t.length!==2)return t;let[r,n]=t,i=Math.abs(n.x-r.x),a=Math.abs(n.y-r.y);return i<.001||a<.001?t:a>=i?[r,{x:r.x,y:n.y},n]:[r,{x:n.x,y:r.y},n]},"orthogonalizeToLabelClippedPoints"),S7t=b((e,t)=>{let r=e.x,n=e.y,i=Math.abs(t.x-r),a=Math.abs(t.y-n),s=e.width/2,o=e.height/2;return i>=s||a>=o},"outsideNode"),E7t=b((e,t,r)=>{se.debug(`intersection calc abc89: + l${-r},0`,"createCylinderPathD"),v7t=b((e,t,r,n,i,a)=>[`M${e},${t}`,`M${e+r},${t}`,`a${i},${a} 0,0,0 0,${-n}`,`l${-r},0`,`a${i},${a} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),x7t=b((e,t,r,n,i,a)=>[`M${e+r/2},${-n/2}`,`a${i},${a} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),X7e=5,j7e=10;b(iAe,"tiltedCylinder");b(aAe,"trapezoid");b(sAe,"trapezoidalPentagon");K7e=10,Z7e=10;b(oAe,"triangle");b(lAe,"waveEdgedRectangle");b(cAe,"waveRectangle");Ea=10;b(uAe,"windowPane");Q7e=new Set(["redux-color","redux-dark-color"]),b7t=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);b(AY,"erBox");b(g4,"addText");b(y4,"lineToPolygon");b(hAe,"textHelper");b(J3,"addText");b(fAe,"classBox");b(dAe,"requirementBox");b(qf,"addText");w7t=b(e=>{switch(e){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");b(pAe,"kanbanItem");b(mAe,"bang");b(gAe,"cloud");b(yAe,"defaultMindmapNode");b(vAe,"mindmapCircle");k7t=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:j8e},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:U8e},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:K8e},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:eAe},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:v8e},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:x8e},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:EY},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:mAe},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:gAe},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:V8e},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:E8e},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:P8e},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:O8e},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:aAe},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:N8e},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:w8e},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:nAe},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:u8e},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Y8e},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:J8e},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Q8e},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:C8e},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:A8e},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:p8e},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:m8e},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:g8e},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:B8e},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:lAe},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:S8e},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:iAe},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:F8e},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:y8e},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:b8e},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:oAe},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:uAe},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:k8e},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:sAe},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:T8e},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:X8e},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:G8e},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:z8e},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:c8e},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:d8e},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:rAe},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:tAe},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:cAe},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:W8e},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:$8e}],T7t=b(()=>{let t=[...Object.entries({state:Z8e,choice:h8e,note:q8e,rectWithTitle:H8e,labelRect:D8e,iconSquare:I8e,iconCircle:R8e,icon:_8e,iconRounded:L8e,imageSquare:M8e,anchor:o8e,kanbanItem:pAe,mindmapCircle:vAe,defaultMindmapNode:yAe,classBox:fAe,erBox:AY,requirementBox:dAe}),...k7t.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),xAe=T7t();b(_Y,"isValidShape");NR=new Map;b(M0,"insertNode");bAe=b((e,t)=>{NR.set(t.id,e)},"setNodeElem"),DR=b(()=>{NR.clear()},"clear"),Ky=b(e=>{let t=NR.get(e.id);se.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");let r=8,n=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+n-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),n},"positionNode")});function tC(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=la(e),t=la(t);let[r,n]=[e.x,e.y],[i,a]=[t.x,t.y],s=i-r,o=a-n;return{angle:Math.atan(o/s),deltaX:s,deltaY:o}}var _u,ns,RY,la,OR,xl=W(()=>{hr();_u=b((e,t)=>{if(t)return"translate("+-e.width/2+", "+-e.height/2+")";let r=e.x??0,n=e.y??0;return"translate("+-(r+e.width/2)+", "+-(n+e.height/2)+")"},"computeLabelTransform"),ns={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4,arrow_barb:0,arrow_barb_neo:5.5},RY={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};b(tC,"calculateDeltaAndAngle");la=b(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),OR=b(e=>({x:b(function(t,r,n){let i=0,a=la(n[0]).x=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(ns,e.arrowTypeEnd)){let{angle:p,deltaX:m}=tC(n[n.length-1],n[n.length-2]);i=ns[e.arrowTypeEnd]*Math.cos(p)*(m>=0?1:-1)}let s=Math.abs(la(t).x-la(n[n.length-1]).x),o=Math.abs(la(t).y-la(n[n.length-1]).y),l=Math.abs(la(t).x-la(n[0]).x),u=Math.abs(la(t).y-la(n[0]).y),h=ns[e.arrowTypeStart],f=ns[e.arrowTypeEnd],d=1;if(s0&&o0&&u=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(ns,e.arrowTypeEnd)){let{angle:p,deltaY:m}=tC(n[n.length-1],n[n.length-2]);i=ns[e.arrowTypeEnd]*Math.abs(Math.sin(p))*(m>=0?1:-1)}let s=Math.abs(la(t).y-la(n[n.length-1]).y),o=Math.abs(la(t).x-la(n[n.length-1]).x),l=Math.abs(la(t).y-la(n[0]).y),u=Math.abs(la(t).x-la(n[0]).x),h=ns[e.arrowTypeStart],f=ns[e.arrowTypeEnd],d=1;if(s0&&o0&&u5&&Math.abs(a.y-i.y)>5||i.y===a.y&&a.x===s.x&&Math.abs(a.x-i.x)>5&&Math.abs(a.y-s.y)>5)&&(t.push(a),r.push(n))}return{cornerPoints:t,cornerPointPositions:r}}function SAe(e,t){if(e.length<2)return"";let r="",n=e.length,i=1e-5;for(let a=0;a({...i}));if(e.length>=2&&ns[t.arrowTypeStart]){let i=ns[t.arrowTypeStart],a=e[0],s=e[1],{angle:o}=LY(a,s),l=i*Math.cos(o),u=i*Math.sin(o);r[0].x=a.x+l,r[0].y=a.y+u}let n=e.length;if(n>=2&&ns[t.arrowTypeEnd]){let i=ns[t.arrowTypeEnd],a=e[n-1],s=e[n-2],{angle:o}=LY(s,a),l=i*Math.cos(o),u=i*Math.sin(o);r[n-1].x=a.x-l,r[n-1].y=a.y-u}return r}var C7t,S7t,E7t,wAe,A7t,x4,Aa,PR,rC,Zy,BR,_7t,R7t,L7t,kAe,TAe,I7t,M7t,b4,N7t,D7t,O7t,P7t,B7t,F7t,$7t,z7t,G7t,q7t,V7t,W7t,H7t,U7t,Y7t,X7t,j7t,K7t,Z7t,Q7t,J7t,e8t,t8t,r8t,w4,ec=W(()=>{po();co();xl();ho();bs();Sn();_r();Rr();hr();fn();dr();C7t=b((e,t,r,n,i,a=!1,s)=>{t.arrowTypeStart&&wAe(e,"start",t.arrowTypeStart,r,n,i,a,s),t.arrowTypeEnd&&wAe(e,"end",t.arrowTypeEnd,r,n,i,a,s)},"addEdgeMarkers"),S7t={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_barb_neo:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},E7t=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],wAe=b((e,t,r,n,i,a,s=!1,o)=>{let l=S7t[r],u=l&&E7t.includes(l.type);if(!l){se.warn(`Unknown arrow type: ${r}`);return}let h=l.type,p=`${i}_${a}-${h}${t==="start"?"Start":"End"}${s&&u?"-margin":""}`;if(o&&o.trim()!==""){let m=o.replace(/[^\dA-Za-z]/g,"_"),g=`${p}_${m}`;if(!document.getElementById(g)){let y=document.getElementById(p);if(y){let v=y.cloneNode(!0);v.id=g,v.querySelectorAll("path, circle, line").forEach(w=>{w.setAttribute("stroke",o),l.fill&&w.setAttribute("fill",o)}),y.parentNode?.appendChild(v)}}e.attr(`marker-${t}`,`url(${n}#${g})`)}else e.attr(`marker-${t}`,`url(${n}#${p})`)},"addEdgeMarker"),A7t=b(e=>typeof e=="string"?e:Be()?.flowchart?.curve,"resolveEdgeCurveType"),x4=new Map,Aa=new Map,PR=b(()=>{x4.clear(),Aa.clear()},"clear"),rC=b(e=>e?typeof e=="string"?e:e.reduce((t,r)=>t+";"+r,""):"","getLabelStyles"),Zy=b(async(e,t)=>{let r=Be(),n=zn(r),{labelStyles:i}=ar(t);t.labelStyle=i;let a=e.insert("g").attr("class","edgeLabel"),s=a.insert("g").attr("class","label").attr("data-id",t.id),o=t.labelType==="markdown",u=await rs(e,t.label,{style:rC(t.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:o,width:o?void 0:void 0},r);s.node().appendChild(u),se.info("abc82",t,t.labelType);let h=u.getBBox(),f=h;if(n){let p=u.children[0],m=ct(u);h=p.getBoundingClientRect(),f=h,m.attr("width",h.width),m.attr("height",h.height)}else{let p=ct(u).select("text").node();p&&typeof p.getBBox=="function"&&(f=p.getBBox())}s.attr("transform",_u(f,n)),x4.set(t.id,a),t.width=h.width,t.height=h.height;let d;if(t.startLabelLeft){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(m,t.startLabelLeft,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).startLeft=p,nC(d,t.startLabelLeft)}if(t.startLabelRight){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(m,t.startLabelRight,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).startRight=p,nC(d,t.startLabelRight)}if(t.endLabelLeft){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(p,t.endLabelLeft,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).endLeft=p,nC(d,t.endLabelLeft)}if(t.endLabelRight){let p=e.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),g=await L0(p,t.endLabelRight,rC(t.labelStyle)||"",!1,!1);d=g;let y=g.getBBox();if(n){let v=g.children[0],x=ct(g);y=v.getBoundingClientRect(),x.attr("width",y.width),x.attr("height",y.height)}m.attr("transform",_u(y,n)),Aa.get(t.id)||Aa.set(t.id,{}),Aa.get(t.id).endRight=p,nC(d,t.endLabelRight)}return u},"insertEdgeLabel");b(nC,"setTerminalWidth");BR=b((e,t)=>{se.debug("Moving label abc88 ",e.id,e.label,x4.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath,n=Be(),{subGraphTitleTotalMargin:i}=yh(n);if(e.label){let a=x4.get(e.id),s=e.x,o=e.y;if(r){let l=pr.calcLabelPosition(r);se.debug("Moving label "+e.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(e.startLabelLeft){let a=Aa.get(e.id).startLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.startLabelRight){let a=Aa.get(e.id).startRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelLeft){let a=Aa.get(e.id).endLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelRight){let a=Aa.get(e.id).endRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}},"positionEdgeLabel"),_7t=b((e,t)=>{if(!e?.isLabelEdge||!e?.id?.endsWith("-to-label")||!Array.isArray(t)||t.length!==2)return t;let[r,n]=t,i=Math.abs(n.x-r.x),a=Math.abs(n.y-r.y);return i<.001||a<.001?t:a>=i?[r,{x:r.x,y:n.y},n]:[r,{x:n.x,y:r.y},n]},"orthogonalizeToLabelClippedPoints"),R7t=b((e,t)=>{let r=e.x,n=e.y,i=Math.abs(t.x-r),a=Math.abs(t.y-n),s=e.width/2,o=e.height/2;return i>=s||a>=o},"outsideNode"),L7t=b((e,t,r)=>{se.debug(`intersection calc abc89: outsidePoint: ${JSON.stringify(t)} insidePoint : ${JSON.stringify(r)} - node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let n=e.x,i=e.y,a=Math.abs(n-r.x),s=e.width/2,o=r.xMath.abs(n-t.x)*l){let f=r.y{se.warn("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],i=!1;return e.forEach(a=>{if(se.info("abc88 checking point",a,t),!S7t(t,a)&&!i){let s=E7t(t,n,a);se.debug("abc88 inside",a,n,s),se.debug("abc88 intersection",s,t);let o=!1;r.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),r.some(l=>l.x===s.x&&l.y===s.y)?se.warn("abc88 no intersect",s,r):r.push(s),i=!0}else se.warn("abc88 outside",a,n),n=a,i||r.push(a)}),se.debug("returning points",r),r},"cutPathAtIntersect");b(kAe,"extractCornerPoints");wAe=b(function(e,t,r){let n=t.x-e.x,i=t.y-e.y,a=Math.sqrt(n*n+i*i),s=r/a;return{x:t.x-s*n,y:t.y-s*i}},"findAdjacentPoint"),A7t=b(function(e){let{cornerPointPositions:t}=kAe(e),r=[];for(let n=0;n10&&Math.abs(a.y-i.y)>=10){se.debug("Corner point fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));let p=5;s.x===o.x?d={x:u<0?o.x-p+f:o.x+p-f,y:h<0?o.y-f:o.y+f}:d={x:u<0?o.x-f:o.x+f,y:h<0?o.y-p+f:o.y+p-f}}else se.debug("Corner point skipping fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));r.push(d,l)}else r.push(e[n]);return r},"fixCorners"),_7t=b((e,t,r)=>{let n=e-t-r,i=2,a=2,s=i+a,o=Math.floor(n/s),l=Array(o).fill(`${i} ${a}`).join(" ");return`0 ${t} ${l} ${r}`},"generateDashArray"),b4=b(function(e,t,r,n,i,a,s,o=!1){if(!s)throw new Error(`insertEdge: missing diagramId for edge "${t.id}" \u2014 edge IDs require a diagram prefix for uniqueness`);let{handDrawnSeed:l,layout:u}=Be(),h=t.points,f=!1,d=i;var p=a;let m=[];for(let P in t.cssCompiledStyles)P3(P)||m.push(t.cssCompiledStyles[P]);if(u==="swimlane"){if(p.intersect&&d.intersect&&Array.isArray(h)&&h.length>=2)if(h.length===2)h=[d.intersect(h[0]),p.intersect(h[1])];else{let P=h.slice(1,-1),$=P[0],F=P[P.length-1],q=.5,G=Math.abs(h[h.length-1].x-F.x)!Number.isNaN(P.y)),v=T7t(t.curve);v!=="rounded"&&(y=A7t(y));let x=S0;switch(v){case"linear":x=S0;break;case"basis":x=Ff;break;case"cardinal":x=w3;break;case"bumpX":x=g3;break;case"bumpY":x=y3;break;case"catmullRom":x=C3;break;case"monotoneX":x=S3;break;case"monotoneY":x=E3;break;case"natural":x=A3;break;case"step":x=_3;break;case"stepAfter":x=L3;break;case"stepBefore":x=R3;break;case"rounded":x=S0;break;default:x=Ff}let{x:w,y:C}=OR(t),T=Bf().x(w).y(C).curve(x),k;switch(t.thickness){case"normal":k="edge-thickness-normal";break;case"thick":k="edge-thickness-thick";break;case"invisible":k="edge-thickness-invisible";break;default:k="edge-thickness-normal"}switch(t.pattern){case"solid":k+=" edge-pattern-solid";break;case"dotted":k+=" edge-pattern-dotted";break;case"dashed":k+=" edge-pattern-dashed";break;default:k+=" edge-pattern-solid"}let S,E=v==="rounded"?TAe(CAe(y,t),5):T(y),I=Array.isArray(t.style)?t.style:[t.style],L=I.find(P=>P?.startsWith("stroke:")),O="";t.animate&&(O="edge-animation-fast"),t.animation&&(O="edge-animation-"+t.animation);let R=!1;if(t.look==="handDrawn"){let P=gt.svg(e);Object.assign([],y);let $=P.path(E,{roughness:.3,seed:l});k+=" transition",S=ct($).select("path").attr("id",`${s}-${t.id}`).attr("class"," "+k+(t.classes?" "+t.classes:"")+(O?" "+O:"")).attr("style",I?I.reduce((q,G)=>q+";"+G,""):"");let F=S.attr("d");S.attr("d",F),e.node().appendChild(S.node())}else{let P=m.join(";"),$=I?I.reduce((j,J)=>j+J+";",""):"",F=(P?P+";"+$+";":$)+";"+(I?I.reduce((j,J)=>j+";"+J,""):"");S=e.append("path").attr("d",E).attr("id",`${s}-${t.id}`).attr("class"," "+k+(t.classes?" "+t.classes:"")+(O?" "+O:"")).attr("style",F),L=F.match(/stroke:([^;]+)/)?.[1],R=t.animate===!0||!!t.animation||P.includes("animation");let q=S.node(),G=typeof q.getTotalLength=="function"?q.getTotalLength():0,z=AY[t.arrowTypeStart]||0,H=AY[t.arrowTypeEnd]||0;if(t.look==="neo"&&!R){let J=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?_7t(G,z,H):`0 ${z} ${G-z-H} ${H}`}; stroke-dashoffset: 0;`;S.attr("style",J+S.attr("style"))}}S.attr("data-edge",!0),S.attr("data-et","edge"),S.attr("data-id",t.id),S.attr("data-points",g),S.attr("data-look",es(t.look)),t.showPoints&&y.forEach(P=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",P.x).attr("cy",P.y)});let A="";(Be().flowchart.arrowMarkerAbsolute||Be().state.arrowMarkerAbsolute)&&(A=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,A=A.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),se.info("arrowTypeStart",t.arrowTypeStart),se.info("arrowTypeEnd",t.arrowTypeEnd);let N=!R&&t?.look==="neo";b7t(S,t,A,s,n,N,L);let M=Math.floor(h.length/2),D=h[M];pr.isLabelCoordinateInPath(D,S.attr("d"))||(f=!0);let B={};return f&&(B.updatedPath=h),B.originalPath=t.points,B},"insertEdge");b(TAe,"generateRoundedPath");b(_Y,"calculateDeltaAndAngle");b(CAe,"applyMarkerOffsetsToPoints");R7t=b((e,t,r,n)=>{t.forEach(i=>{Q7t[i](e,r,n)})},"insertMarkers"),L7t=b((e,t,r)=>{se.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),e.append("marker").attr("id",r+"_"+t+"-extensionStart-margin").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd-margin").attr("class","marker extension "+t).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),I7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart-margin").attr("class","marker composition "+t).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("viewBox","0 0 15 15").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd-margin").attr("class","marker composition "+t).attr("refX",3.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),M7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart-margin").attr("class","marker aggregation "+t).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd-margin").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),N7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart-margin").attr("class","marker dependency "+t).attr("refX",4).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd-margin").attr("class","marker dependency "+t).attr("refX",16).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),D7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart-margin").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd-margin").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2)},"lollipop"),O7t=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointEnd-margin").attr("class","marker "+t).attr("viewBox","0 0 11.5 14").attr("refX",11.5).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",10.5).attr("markerHeight",14).attr("orient","auto").append("path").attr("d","M 0 0 L 11.5 7 L 0 14 z").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart-margin").attr("class","marker "+t).attr("viewBox","0 0 11.5 14").attr("refX",1).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11.5).attr("markerHeight",14).attr("orient","auto").append("polygon").attr("points","0,7 11.5,14 11.5,0").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"point"),P7t=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleEnd-margin").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refY",5).attr("refX",12.25).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart-margin").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-2).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"circle"),B7t=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossEnd-margin").attr("class","marker cross "+t).attr("viewBox","0 0 15 15").attr("refX",17.7).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5),e.append("marker").attr("id",r+"_"+t+"-crossStart-margin").attr("class","marker cross "+t).attr("viewBox","0 0 15 15").attr("refX",-3.5).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5).style("stroke-dasharray","1,0")},"cross"),F7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),$7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{transitionColor:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd-margin").attr("refX",17).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z").attr("fill",`${a}`)},"barbNeo"),z7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),G7t=b((e,t,r)=>{let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");let i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),q7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),V7t=b((e,t,r)=>{let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");let i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),W7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M9,0 L9,18 M15,0 L15,18").attr("stroke-width",`${a}`),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M3,0 L3,18 M9,0 L9,18").attr("stroke-width",`${a}`)},"only_one_neo"),H7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a,mainBkg:s}=i,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse");o.append("circle").attr("fill",s??"white").attr("cx",21).attr("cy",9).attr("stroke-width",`${a}`).attr("r",6),o.append("path").attr("d","M9,0 L9,18").attr("stroke-width",`${a}`);let l=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("markerUnits","userSpaceOnUse").attr("orient","auto");l.append("circle").attr("fill",s??"white").attr("cx",9).attr("cy",9).attr("stroke-width",`${a}`).attr("r",6),l.append("path").attr("d","M21,0 L21,18").attr("stroke-width",`${a}`)},"zero_or_one_neo"),U7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width",`${a}`),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width",`${a}`)},"one_or_more_neo"),Y7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a,mainBkg:s}=i,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto");o.append("circle").attr("fill",s??"white").attr("cx",45.5).attr("cy",18).attr("r",6).attr("stroke-width",`${a}`),o.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width",`${a}`);let l=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse");l.append("circle").attr("fill",s??"white").attr("cx",11).attr("cy",18).attr("r",6).attr("stroke-width",`${a}`),l.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width",`${a}`)},"zero_or_more_neo"),X7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0 + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let n=e.x,i=e.y,a=Math.abs(n-r.x),s=e.width/2,o=r.xMath.abs(n-t.x)*l){let f=r.y{se.warn("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],i=!1;return e.forEach(a=>{if(se.info("abc88 checking point",a,t),!R7t(t,a)&&!i){let s=L7t(t,n,a);se.debug("abc88 inside",a,n,s),se.debug("abc88 intersection",s,t);let o=!1;r.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),r.some(l=>l.x===s.x&&l.y===s.y)?se.warn("abc88 no intersect",s,r):r.push(s),i=!0}else se.warn("abc88 outside",a,n),n=a,i||r.push(a)}),se.debug("returning points",r),r},"cutPathAtIntersect");b(CAe,"extractCornerPoints");TAe=b(function(e,t,r){let n=t.x-e.x,i=t.y-e.y,a=Math.sqrt(n*n+i*i),s=r/a;return{x:t.x-s*n,y:t.y-s*i}},"findAdjacentPoint"),I7t=b(function(e){let{cornerPointPositions:t}=CAe(e),r=[];for(let n=0;n10&&Math.abs(a.y-i.y)>=10){se.debug("Corner point fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));let p=5;s.x===o.x?d={x:u<0?o.x-p+f:o.x+p-f,y:h<0?o.y-f:o.y+f}:d={x:u<0?o.x-f:o.x+f,y:h<0?o.y-p+f:o.y+p-f}}else se.debug("Corner point skipping fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));r.push(d,l)}else r.push(e[n]);return r},"fixCorners"),M7t=b((e,t,r)=>{let n=e-t-r,i=2,a=2,s=i+a,o=Math.floor(n/s),l=Array(o).fill(`${i} ${a}`).join(" ");return`0 ${t} ${l} ${r}`},"generateDashArray"),b4=b(function(e,t,r,n,i,a,s,o=!1){if(!s)throw new Error(`insertEdge: missing diagramId for edge "${t.id}" \u2014 edge IDs require a diagram prefix for uniqueness`);let{handDrawnSeed:l,layout:u}=Be(),h=t.points,f=!1,d=i;var p=a;let m=[];for(let P in t.cssCompiledStyles)P3(P)||m.push(t.cssCompiledStyles[P]);if(u==="swimlane"){if(p.intersect&&d.intersect&&Array.isArray(h)&&h.length>=2)if(h.length===2)h=[d.intersect(h[0]),p.intersect(h[1])];else{let P=h.slice(1,-1),$=P[0],F=P[P.length-1],q=.5,G=Math.abs(h[h.length-1].x-F.x)!Number.isNaN(P.y)),v=A7t(t.curve);v!=="rounded"&&(y=I7t(y));let x=S0;switch(v){case"linear":x=S0;break;case"basis":x=Ff;break;case"cardinal":x=w3;break;case"bumpX":x=g3;break;case"bumpY":x=y3;break;case"catmullRom":x=C3;break;case"monotoneX":x=S3;break;case"monotoneY":x=E3;break;case"natural":x=A3;break;case"step":x=_3;break;case"stepAfter":x=L3;break;case"stepBefore":x=R3;break;case"rounded":x=S0;break;default:x=Ff}let{x:w,y:C}=OR(t),T=Bf().x(w).y(C).curve(x),k;switch(t.thickness){case"normal":k="edge-thickness-normal";break;case"thick":k="edge-thickness-thick";break;case"invisible":k="edge-thickness-invisible";break;default:k="edge-thickness-normal"}switch(t.pattern){case"solid":k+=" edge-pattern-solid";break;case"dotted":k+=" edge-pattern-dotted";break;case"dashed":k+=" edge-pattern-dashed";break;default:k+=" edge-pattern-solid"}let S,E=v==="rounded"?SAe(EAe(y,t),5):T(y),I=Array.isArray(t.style)?t.style:[t.style],L=I.find(P=>P?.startsWith("stroke:")),O="";t.animate&&(O="edge-animation-fast"),t.animation&&(O="edge-animation-"+t.animation);let R=!1;if(t.look==="handDrawn"){let P=gt.svg(e);Object.assign([],y);let $=P.path(E,{roughness:.3,seed:l});k+=" transition",S=ct($).select("path").attr("id",`${s}-${t.id}`).attr("class"," "+k+(t.classes?" "+t.classes:"")+(O?" "+O:"")).attr("style",I?I.reduce((q,G)=>q+";"+G,""):"");let F=S.attr("d");S.attr("d",F),e.node().appendChild(S.node())}else{let P=m.join(";"),$=I?I.reduce((j,J)=>j+J+";",""):"",F=(P?P+";"+$+";":$)+";"+(I?I.reduce((j,J)=>j+";"+J,""):"");S=e.append("path").attr("d",E).attr("id",`${s}-${t.id}`).attr("class"," "+k+(t.classes?" "+t.classes:"")+(O?" "+O:"")).attr("style",F),L=F.match(/stroke:([^;]+)/)?.[1],R=t.animate===!0||!!t.animation||P.includes("animation");let q=S.node(),G=typeof q.getTotalLength=="function"?q.getTotalLength():0,z=RY[t.arrowTypeStart]||0,H=RY[t.arrowTypeEnd]||0;if(t.look==="neo"&&!R){let J=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?M7t(G,z,H):`0 ${z} ${G-z-H} ${H}`}; stroke-dashoffset: 0;`;S.attr("style",J+S.attr("style"))}}S.attr("data-edge",!0),S.attr("data-et","edge"),S.attr("data-id",t.id),S.attr("data-points",g),S.attr("data-look",es(t.look)),t.showPoints&&y.forEach(P=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",P.x).attr("cy",P.y)});let A="";(Be().flowchart.arrowMarkerAbsolute||Be().state.arrowMarkerAbsolute)&&(A=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,A=A.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),se.info("arrowTypeStart",t.arrowTypeStart),se.info("arrowTypeEnd",t.arrowTypeEnd);let N=!R&&t?.look==="neo";C7t(S,t,A,s,n,N,L);let M=Math.floor(h.length/2),D=h[M];pr.isLabelCoordinateInPath(D,S.attr("d"))||(f=!0);let B={};return f&&(B.updatedPath=h),B.originalPath=t.points,B},"insertEdge");b(SAe,"generateRoundedPath");b(LY,"calculateDeltaAndAngle");b(EAe,"applyMarkerOffsetsToPoints");N7t=b((e,t,r,n)=>{t.forEach(i=>{r8t[i](e,r,n)})},"insertMarkers"),D7t=b((e,t,r)=>{se.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),e.append("marker").attr("id",r+"_"+t+"-extensionStart-margin").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd-margin").attr("class","marker extension "+t).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),O7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart-margin").attr("class","marker composition "+t).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("viewBox","0 0 15 15").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd-margin").attr("class","marker composition "+t).attr("refX",3.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),P7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart-margin").attr("class","marker aggregation "+t).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd-margin").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),B7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart-margin").attr("class","marker dependency "+t).attr("refX",4).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd-margin").attr("class","marker dependency "+t).attr("refX",16).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),F7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart-margin").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd-margin").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2)},"lollipop"),$7t=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointEnd-margin").attr("class","marker "+t).attr("viewBox","0 0 11.5 14").attr("refX",11.5).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",10.5).attr("markerHeight",14).attr("orient","auto").append("path").attr("d","M 0 0 L 11.5 7 L 0 14 z").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart-margin").attr("class","marker "+t).attr("viewBox","0 0 11.5 14").attr("refX",1).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11.5).attr("markerHeight",14).attr("orient","auto").append("polygon").attr("points","0,7 11.5,14 11.5,0").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"point"),z7t=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleEnd-margin").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refY",5).attr("refX",12.25).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart-margin").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-2).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"circle"),G7t=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossEnd-margin").attr("class","marker cross "+t).attr("viewBox","0 0 15 15").attr("refX",17.7).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5),e.append("marker").attr("id",r+"_"+t+"-crossStart-margin").attr("class","marker cross "+t).attr("viewBox","0 0 15 15").attr("refX",-3.5).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5).style("stroke-dasharray","1,0")},"cross"),q7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),V7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{transitionColor:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd-margin").attr("refX",17).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z").attr("fill",`${a}`)},"barbNeo"),W7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),H7t=b((e,t,r)=>{let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");let i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),U7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),Y7t=b((e,t,r)=>{let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");let i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),X7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M9,0 L9,18 M15,0 L15,18").attr("stroke-width",`${a}`),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M3,0 L3,18 M9,0 L9,18").attr("stroke-width",`${a}`)},"only_one_neo"),j7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a,mainBkg:s}=i,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse");o.append("circle").attr("fill",s??"white").attr("cx",21).attr("cy",9).attr("stroke-width",`${a}`).attr("r",6),o.append("path").attr("d","M9,0 L9,18").attr("stroke-width",`${a}`);let l=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("markerUnits","userSpaceOnUse").attr("orient","auto");l.append("circle").attr("fill",s??"white").attr("cx",9).attr("cy",9).attr("stroke-width",`${a}`).attr("r",6),l.append("path").attr("d","M21,0 L21,18").attr("stroke-width",`${a}`)},"zero_or_one_neo"),K7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width",`${a}`),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width",`${a}`)},"one_or_more_neo"),Z7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a,mainBkg:s}=i,o=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto");o.append("circle").attr("fill",s??"white").attr("cx",45.5).attr("cy",18).attr("r",6).attr("stroke-width",`${a}`),o.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width",`${a}`);let l=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse");l.append("circle").attr("fill",s??"white").attr("cx",11).attr("cy",18).attr("r",6).attr("stroke-width",`${a}`),l.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width",`${a}`)},"zero_or_more_neo"),Q7t=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0 L20,10 M20,10 - L0,20`)},"requirement_arrow"),j7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 + L0,20`)},"requirement_arrow"),J7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 L20,10 M20,10 - L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),K7t=b((e,t,r)=>{let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Z7t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i,s=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");s.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),s.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),s.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),s.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),Q7t={extension:L7t,composition:I7t,aggregation:M7t,dependency:N7t,lollipop:D7t,point:O7t,circle:P7t,cross:B7t,barb:F7t,barbNeo:$7t,only_one:z7t,zero_or_one:G7t,one_or_more:q7t,zero_or_more:V7t,only_one_neo:W7t,zero_or_one_neo:H7t,one_or_more_neo:U7t,zero_or_more_neo:Y7t,requirement_arrow:X7t,requirement_contains:K7t,requirement_arrow_neo:j7t,requirement_contains_neo:Z7t},w4=R7t});function EAe(e,t){e[t]?e[t]++:e[t]=1}function AAe(e,t){--e[t]||delete e[t]}function iC(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}return i+SAe+a+SAe+(Si(n)?J7t:n)}function e8t(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};return n&&(o.name=n),o}function RY(e,t){return iC(e,t.v,t.w,t.name)}var J7t,Qy,SAe,qn,FR=W(()=>{si();J7t="\0",Qy="\0",SAe="",qn=class{constructor(t={}){this._isDirected=Object.prototype.hasOwnProperty.call(t,"directed")?t.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=ql(void 0),this._defaultEdgeLabelFn=ql(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Qy]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return Jh(t)||(t=ql(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return ka(this._nodes)}sources(){var t=this;return al(this.nodes(),function(r){return S8(t._in[r])})}sinks(){var t=this;return al(this.nodes(),function(r){return S8(t._out[r])})}setNodes(t,r){var n=arguments,i=this;return ft(t,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Qy,this._children[t]={},this._children[Qy][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ft(this.children(t),n=>{this.setParent(n)}),delete this._children[t]),ft(ka(this._in[t]),r),delete this._in[t],delete this._preds[t],ft(ka(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Si(r))r=Qy;else{r+="";for(var n=r;!Si(n);n=this.parent(n))if(n===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==Qy)return r}}children(t){if(Si(t)&&(t=Qy),this._isCompound){var r=this._children[t];if(r)return ka(r)}else{if(t===Qy)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return ka(r)}successors(t){var r=this._sucs[t];if(r)return ka(r)}neighbors(t){var r=this.predecessors(t);if(r)return fG(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;ft(this._nodes,function(s,o){t(o)&&r.setNode(o,s)}),ft(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var o=n.parent(s);return o===void 0||r.hasNode(o)?(i[s]=o,o):o in i?i[o]:a(o)}return this._isCompound&&ft(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(t){return Jh(t)||(t=ql(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Rc(this._edgeObjs)}setPath(t,r){var n=this,i=arguments;return af(t,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var t,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(t=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(t=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),t=""+t,r=""+r,Si(n)||(n=""+n);var o=iC(this._isDirected,t,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!Si(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(t,r,n);var l=e8t(this._isDirected,t,r,n);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,EAe(this._preds[r],t),EAe(this._sucs[t],r),this._in[r][o]=l,this._out[t][o]=l,this._edgeCount++,this}edge(t,r,n){var i=arguments.length===1?RY(this._isDirected,arguments[0]):iC(this._isDirected,t,r,n);return this._edgeLabels[i]}hasEdge(t,r,n){var i=arguments.length===1?RY(this._isDirected,arguments[0]):iC(this._isDirected,t,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(t,r,n){var i=arguments.length===1?RY(this._isDirected,arguments[0]):iC(this._isDirected,t,r,n),a=this._edgeObjs[i];return a&&(t=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],AAe(this._preds[r],t),AAe(this._sucs[t],r),delete this._in[r][i],delete this._out[t][i],this._edgeCount--),this}inEdges(t,r){var n=this._in[t];if(n){var i=Rc(n);return r?al(i,function(a){return a.v===r}):i}}outEdges(t,r){var n=this._out[t];if(n){var i=Rc(n);return r?al(i,function(a){return a.w===r}):i}}nodeEdges(t,r){var n=this.inEdges(t,r);if(n)return n.concat(this.outEdges(t,r))}};qn.prototype._nodeCount=0;qn.prototype._edgeCount=0});var qc=W(()=>{FR()});function bh(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:t8t(e),edges:r8t(e)};return Si(e.graph())||(t.value=zz(e.graph())),t}function t8t(e){return Kn(e.nodes(),function(t){var r=e.node(t),n=e.parent(t),i={v:t};return Si(r)||(i.value=r),Si(n)||(i.parent=n),i})}function r8t(e){return Kn(e.edges(),function(t){var r=e.edge(t),n={v:t.v,w:t.w};return Si(t.name)||(n.name=t.name),Si(r)||(n.value=r),n})}var LY=W(()=>{si();FR()});var un,eg,LAe,$R,Jy,n8t,IY,IAe,i8t,ev,RAe,MAe,NAe,DAe,OAe,PAe,a8t,MY=W(()=>{Rr();hr();qc();LY();un=new Map,eg=new Map,LAe=new Map,$R=b(()=>{eg.clear(),LAe.clear(),un.clear()},"clear"),Jy=b((e,t)=>{let r=eg.get(t)||[];return se.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),n8t=b((e,t)=>{let r=eg.get(t)||[];return se.info("Descendants of ",t," is ",r),se.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||Jy(e.v,t)||Jy(e.w,t)||r.includes(e.w):(se.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),IY=b((e,t,r,n)=>{se.warn("Copying children of ",e,"root",n,"data",t.node(e),n);let i=t.children(e)||[];e!==n&&i.push(e),se.warn("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)IY(a,t,r,n);else{let s=t.node(a);se.info("cp ",a," to ",n," with parent ",e),r.setNode(a,s),n!==t.parent(a)&&(se.warn("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==n&&a!==e?(se.debug("Setting parent",a,e),r.setParent(a,e)):(se.info("In copy ",e,"root",n,"data",t.node(e),n),se.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==n,"node!==clusterId",a!==e));let o=t.edges(a);se.debug("Copying Edges",o),o.forEach(l=>{se.info("Edge",l);let u=t.edge(l.v,l.w,l.name);se.info("Edge data",u,n);try{if(n8t(l,n)){let h=eg.get(n)||[],f=h.includes(l.v)||Jy(l.v,n)||l.v===n,d=h.includes(l.w)||Jy(l.w,n)||l.w===n;if(f&&d)se.info("Copying as ",l.v,l.w,u,l.name),r.setEdge(l.v,l.w,u,l.name),se.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]));else{let p=f?n:l.v,m=d?n:l.w;se.info("Rebinding cross-boundary edge as ",p,m,u,l.name),t.setEdge(p,m,u,l.name)}}else se.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",n," clusterId:",e)}catch(h){se.error(h)}})}se.debug("Removing node",a),t.removeNode(a)})},"copy"),IAe=b((e,t)=>{let r=t.children(e),n=[...r];for(let i of r)LAe.set(i,e),n=[...n,...IAe(i,t)];return n},"extractDescendants"),i8t=b((e,t,r)=>{let n=e.edges().filter(l=>l.v===t||l.w===t),i=e.edges().filter(l=>l.v===r||l.w===r),a=n.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),s=i.map(l=>({v:l.v,w:l.w}));return a.filter(l=>s.some(u=>l.v===u.v&&l.w===u.w))},"findCommonEdges"),ev=b((e,t,r)=>{let n=t.children(e);if(se.trace("Searching children of id ",e,n),n.length<1)return e;let i;for(let a of n){let s=ev(a,t,r),o=i8t(t,r,s);if(s)if(o.length>0)i=s;else return s}return i},"findNonClusterChild"),RAe=b(e=>!un.has(e)||!un.get(e).externalConnections?e:un.has(e)?un.get(e).id:e,"getAnchorId"),MAe=b((e,t)=>{if(!e||t>10){se.debug("Opting out, no graph ");return}else se.debug("Opting in, graph ");e.nodes().forEach(function(r){e.children(r).length>0&&(se.warn("Cluster identified",r," Replacement id in edges: ",ev(r,e,r)),eg.set(r,IAe(r,e)),un.set(r,{id:ev(r,e,r),clusterData:e.node(r)}))}),e.nodes().forEach(function(r){let n=e.children(r),i=e.edges();n.length>0?(se.debug("Cluster identified",r,eg),i.forEach(a=>{let s=Jy(a.v,r),o=Jy(a.w,r);s^o&&(se.warn("Edge: ",a," leaves cluster ",r),se.warn("Descendants of XXX ",r,": ",eg.get(r)),un.get(r).externalConnections=!0)})):se.debug("Not a cluster ",r,eg)});for(let r of un.keys()){let n=un.get(r).id,i=e.parent(n);i!==r&&un.has(i)&&!un.get(i).externalConnections&&(un.get(r).id=i);let a=e.edges().some(s=>s.v===r);if(n&&un.get(r)?.externalConnections&&a&&PAe(e,n,r)){let s=a8t(e,r,e.parent(n));s&&(un.get(r).id=s)}}e.edges().forEach(function(r){let n=e.edge(r);se.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),se.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(e.edge(r)));let i=r.v,a=r.w;if(se.warn("Fix XXX",un,"ids:",r.v,r.w,"Translating: ",un.get(r.v)," --- ",un.get(r.w)),un.get(r.v)||un.get(r.w)){if(se.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),i=RAe(r.v),a=RAe(r.w),e.removeEdge(r.v,r.w,r.name),i!==r.v){let s=e.parent(i);un.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){let s=e.parent(a);un.get(s).externalConnections=!0,n.toCluster=r.w}se.warn("Fix Replacing with XXX",i,a,r.name),e.setEdge(i,a,n,r.name)}}),se.warn("Adjusted Graph",bh(e)),NAe(e,0),se.trace(un)},"adjustClustersAndEdges"),NAe=b((e,t)=>{if(se.warn("extractor - ",t,bh(e),e.children("D")),t>10){se.error("Bailing out");return}let r=e.nodes(),n=!1;for(let i of r){let a=e.children(i);n=n||a.length>0}if(!n){se.debug("Done, no node has children",e.nodes());return}se.debug("Nodes = ",r,t);for(let i of r)if(se.debug("Extracting node",i,un,un.has(i)&&!un.get(i).externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!un.has(i))se.debug("Not a cluster",i,t);else if(un.get(i)?.clusterData?.explicitDir&&e.children(i)&&e.children(i).length>0){se.warn("Cluster with explicit dir, creating subgraph for children",i,t);let a=un.get(i).clusterData.dir,s=new qn({multigraph:!0,compound:!0}).setGraph({rankdir:a,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});IY(i,e,s,i);let o=e.node(i)||{};e.setNode(i,{...o,clusterNode:!0,id:i,clusterData:un.get(i).clusterData,label:un.get(i).label,graph:s}),se.warn("Subgraph for cluster with explicit dir created:",i,bh(s))}else if(!un.get(i).externalConnections&&e.children(i)&&e.children(i).length>0){se.warn("Cluster without external connections, without a parent and with children",i,t);let s=e.graph().rankdir==="TB"?"LR":"TB";un.get(i)?.clusterData?.dir&&(s=un.get(i).clusterData.dir,se.warn("Fixing dir",un.get(i).clusterData.dir,s));let o=new qn({multigraph:!0,compound:!0}).setGraph({rankdir:s,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});IY(i,e,o,i);let l=e.node(i)||{};e.setNode(i,{...l,clusterNode:!0,id:i,clusterData:un.get(i).clusterData,label:un.get(i).label,graph:o}),se.debug("Old graph after copy",bh(e))}else se.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!un.get(i).externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),se.debug(un);r=e.nodes(),se.warn("New list of nodes",r);for(let i of r){let a=e.node(i);se.warn(" Now next level",i,a),a?.clusterNode&&NAe(a.graph,t+1)}},"extractor"),DAe=b((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(n=>{let i=e.children(n),a=DAe(e,i);r=[...r,...a]}),r},"sorter"),OAe=b(e=>DAe(e,e.children()),"sortNodesByHierarchy"),PAe=b((e,t,r)=>{let n=e.parent(t);for(;n&&n!==r;){let i=un.get(n);if(i&&!i.externalConnections)return!0;n=e.parent(n)}return!1},"isNodeInExtractableCluster"),a8t=b((e,t,r)=>{let n=e.children(t)??[];for(let i of n){if(i===r||Jy(i,r))continue;let a=ev(i,e,t);if(a&&!PAe(e,a,t))return a}return null},"findSafeAnchorNode")});function BAe(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function s8t(e,t){if(e!=="_next"&&e!=="_prev")return t}var zR,FAe=W(()=>{zR=class{constructor(){var t={};t._next=t._prev=t,this._sentinel=t}dequeue(){var t=this._sentinel,r=t._prev;if(r!==t)return BAe(r),r}enqueue(t){var r=this._sentinel;t._prev&&t._next&&BAe(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r}toString(){for(var t=[],r=this._sentinel,n=r._prev;n!==r;)t.push(JSON.stringify(n,s8t)),n=n._prev;return"["+t.join(", ")+"]"}}});function $Ae(e,t){if(e.nodeCount()<=1)return[];var r=c8t(e,t||o8t),n=l8t(r.graph,r.buckets,r.zeroIdx);return yu(Kn(n,function(i){return e.outEdges(i.v,i.w)}))}function l8t(e,t,r){for(var n=[],i=t[t.length-1],a=t[0],s;e.nodeCount();){for(;s=a.dequeue();)NY(e,t,r,s);for(;s=i.dequeue();)NY(e,t,r,s);if(e.nodeCount()){for(var o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(NY(e,t,r,s,!0));break}}}return n}function NY(e,t,r,n,i){var a=i?[]:void 0;return ft(e.inEdges(n.v),function(s){var o=e.edge(s),l=e.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,DY(t,r,l)}),ft(e.outEdges(n.v),function(s){var o=e.edge(s),l=s.w,u=e.node(l);u.in-=o,DY(t,r,u)}),e.removeNode(n.v),a}function c8t(e,t){var r=new qn,n=0,i=0;ft(e.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),ft(e.edges(),function(o){var l=r.edge(o.v,o.w)||0,u=t(o),h=l+u;r.setEdge(o.v,o.w,h),i=Math.max(i,r.node(o.v).out+=u),n=Math.max(n,r.node(o.w).in+=u)});var a=vu(i+n+3).map(function(){return new zR}),s=n+1;return ft(r.nodes(),function(o){DY(a,s,r.node(o))}),{graph:r,buckets:a,zeroIdx:s}}function DY(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var o8t,zAe=W(()=>{si();qc();FAe();o8t=ql(1)});function GAe(e){var t=e.graph().acyclicer==="greedy"?$Ae(e,r(e)):u8t(e);ft(t,function(n){var i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,ry("rev"))});function r(n){return function(i){return n.edge(i).weight}}}function u8t(e){var t=[],r={},n={};function i(a){Object.prototype.hasOwnProperty.call(n,a)||(n[a]=!0,r[a]=!0,ft(e.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?t.push(s):i(s.w)}),delete r[a])}return ft(e.nodes(),i),t}function qAe(e){ft(e.edges(),function(t){var r=e.edge(t);if(r.reversed){e.removeEdge(t);var n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}var OY=W(()=>{si();zAe()});function Vf(e,t,r,n){var i;do i=ry(n);while(e.hasNode(i));return r.dummy=t,e.setNode(i,r),i}function WAe(e){var t=new qn().setGraph(e.graph());return ft(e.nodes(),function(r){t.setNode(r,e.node(r))}),ft(e.edges(),function(r){var n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function GR(e){var t=new qn({multigraph:e.isMultigraph()}).setGraph(e.graph());return ft(e.nodes(),function(r){e.children(r).length||t.setNode(r,e.node(r))}),ft(e.edges(),function(r){t.setEdge(r,e.edge(r))}),t}function PY(e,t){var r=e.x,n=e.y,i=t.x-r,a=t.y-n,s=e.width/2,o=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:r+l,y:n+u}}function tg(e){var t=Kn(vu(FY(e)+1),function(){return[]});return ft(e.nodes(),function(r){var n=e.node(r),i=n.rank;Si(i)||(t[i][n.order]=r)}),t}function HAe(e){var t=Jd(Kn(e.nodes(),function(r){return e.node(r).rank}));ft(e.nodes(),function(r){var n=e.node(r);e5(n,"rank")&&(n.rank-=t)})}function UAe(e){var t=Jd(Kn(e.nodes(),function(a){return e.node(a).rank})),r=[];ft(e.nodes(),function(a){var s=e.node(a).rank-t;r[s]||(r[s]=[]),r[s].push(a)});var n=0,i=e.graph().nodeRankFactor;ft(r,function(a,s){Si(a)&&s%i!==0?--n:n&&ft(a,function(o){e.node(o).rank+=n})})}function BY(e,t,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),Vf(e,"border",i,t)}function FY(e){return Wl(Kn(e.nodes(),function(t){var r=e.node(t).rank;if(!Si(r))return r}))}function YAe(e,t){var r={lhs:[],rhs:[]};return ft(e,function(n){t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function XAe(e,t){var r=hm();try{return t()}finally{console.log(e+" time: "+(hm()-r)+"ms")}}function jAe(e,t){return t()}var Wf=W(()=>{si();qc()});function ZAe(e){function t(r){var n=e.children(r),i=e.node(r);if(n.length&&ft(n,t),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a{si();Wf()});function e9e(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&r9e(e)}function t9e(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&h8t(e),(t==="lr"||t==="rl")&&(f8t(e),r9e(e))}function r9e(e){ft(e.nodes(),function(t){JAe(e.node(t))}),ft(e.edges(),function(t){JAe(e.edge(t))})}function JAe(e){var t=e.width;e.width=e.height,e.height=t}function h8t(e){ft(e.nodes(),function(t){$Y(e.node(t))}),ft(e.edges(),function(t){var r=e.edge(t);ft(r.points,$Y),Object.prototype.hasOwnProperty.call(r,"y")&&$Y(r)})}function $Y(e){e.y=-e.y}function f8t(e){ft(e.nodes(),function(t){zY(e.node(t))}),ft(e.edges(),function(t){var r=e.edge(t);ft(r.points,zY),Object.prototype.hasOwnProperty.call(r,"x")&&zY(r)})}function zY(e){var t=e.x;e.x=e.y,e.y=t}var n9e=W(()=>{si()});function i9e(e){e.graph().dummyChains=[],ft(e.edges(),function(t){p8t(e,t)})}function p8t(e,t){var r=t.v,n=e.node(r).rank,i=t.w,a=e.node(i).rank,s=t.name,o=e.edge(t),l=o.labelRank;if(a!==n+1){e.removeEdge(t);var u=void 0,h,f;for(f=0,++n;n{si();Wf()});function sC(e){var t={};function r(n){var i=e.node(n);if(Object.prototype.hasOwnProperty.call(t,n))return i.rank;t[n]=!0;var a=Jd(Kn(e.outEdges(n),function(s){return r(s.w)-e.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}ft(e.sources(),r)}function tv(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var qR=W(()=>{si()});function VR(e){var t=new qn({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,a;m8t(t,e){si();qc();qR()});var o9e=W(()=>{});var VY=W(()=>{});var kHr,WY=W(()=>{si();VY();kHr=ql(1)});var l9e=W(()=>{WY()});var HY=W(()=>{});var c9e=W(()=>{HY()});var RHr,u9e=W(()=>{si();RHr=ql(1)});function UY(e){var t={},r={},n=[];function i(a){if(Object.prototype.hasOwnProperty.call(r,a))throw new oC;Object.prototype.hasOwnProperty.call(t,a)||(r[a]=!0,t[a]=!0,ft(e.predecessors(a),i),delete r[a],n.push(a))}if(ft(e.sinks(),i),hG(t)!==e.nodeCount())throw new oC;return n}function oC(){}var YY=W(()=>{si();UY.CycleException=oC;oC.prototype=new Error});var h9e=W(()=>{YY()});function WR(e,t,r){wn(t)||(t=[t]);var n=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return ft(t,function(s){if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);f9e(e,s,r==="post",a,n,i)}),i}function f9e(e,t,r,n,i,a){Object.prototype.hasOwnProperty.call(n,t)||(n[t]=!0,r||a.push(t),ft(i(t),function(s){f9e(e,s,r,n,i,a)}),r&&a.push(t))}var XY=W(()=>{si()});function jY(e,t){return WR(e,t,"post")}var d9e=W(()=>{XY()});function KY(e,t){return WR(e,t,"pre")}var p9e=W(()=>{XY()});var m9e=W(()=>{VY();FR()});var g9e=W(()=>{o9e();WY();l9e();c9e();u9e();h9e();d9e();p9e();m9e();HY();YY()});function ng(e){e=WAe(e),sC(e);var t=VR(e);QY(t),ZY(t,e);for(var r,n;r=b9e(t);)n=w9e(t,e,r),k9e(t,e,r,n)}function ZY(e,t){var r=jY(e,e.nodes());r=r.slice(0,r.length-1),ft(r,function(n){k8t(e,t,n)})}function k8t(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=v9e(e,t,r)}function v9e(e,t,r){var n=e.node(r),i=n.parent,a=!0,s=t.edge(r,i),o=0;return s||(a=!1,s=t.edge(i,r)),o=s.weight,ft(t.nodeEdges(r),function(l){var u=l.v===r,h=u?l.w:l.v;if(h!==i){var f=u===a,d=t.edge(l).weight;if(o+=f?d:-d,C8t(e,r,h)){var p=e.edge(r,h).cutvalue;o+=f?-p:p}}}),o}function QY(e,t){arguments.length<2&&(t=e.nodes()[0]),x9e(e,{},1,t)}function x9e(e,t,r,n,i){var a=r,s=e.node(n);return t[n]=!0,ft(e.neighbors(n),function(o){Object.prototype.hasOwnProperty.call(t,o)||(r=x9e(e,t,r,o,n))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function b9e(e){return ib(e.edges(),function(t){return e.edge(t).cutvalue<0})}function w9e(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var a=e.node(n),s=e.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=al(t.edges(),function(h){return l===y9e(e,e.node(h.v),o)&&l!==y9e(e,e.node(h.w),o)});return ey(u,function(h){return tv(t,h)})}function k9e(e,t,r,n){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(n.v,n.w,{}),QY(e),ZY(e,t),T8t(e,t)}function T8t(e,t){var r=ib(e.nodes(),function(i){return!t.node(i).parent}),n=KY(e,r);n=n.slice(1),ft(n,function(i){var a=e.node(i).parent,s=t.edge(i,a),o=!1;s||(s=t.edge(a,i),o=!0),t.node(i).rank=t.node(a).rank+(o?s.minlen:-s.minlen)})}function C8t(e,t,r){return e.hasEdge(t,r)}function y9e(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}var T9e=W(()=>{si();g9e();Wf();qY();qR();ng.initLowLimValues=QY;ng.initCutValues=ZY;ng.calcCutValue=v9e;ng.leaveEdge=b9e;ng.enterEdge=w9e;ng.exchangeEdges=k9e});function JY(e){switch(e.graph().ranker){case"network-simplex":C9e(e);break;case"tight-tree":E8t(e);break;case"longest-path":S8t(e);break;default:C9e(e)}}function E8t(e){sC(e),VR(e)}function C9e(e){ng(e)}var S8t,eX=W(()=>{qY();T9e();qR();S8t=sC});function S9e(e){var t=Vf(e,"root",{},"_root"),r=A8t(e),n=Wl(Rc(r))-1,i=2*n+1;e.graph().nestingRoot=t,ft(e.edges(),function(s){e.edge(s).minlen*=i});var a=_8t(e)+1;ft(e.children(),function(s){E9e(e,t,i,a,n,r,s)}),e.graph().nodeRankFactor=i}function E9e(e,t,r,n,i,a,s){var o=e.children(s);if(!o.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}var l=BY(e,"_bt"),u=BY(e,"_bb"),h=e.node(s);e.setParent(l,s),h.borderTop=l,e.setParent(u,s),h.borderBottom=u,ft(o,function(f){E9e(e,t,r,n,i,a,f);var d=e.node(f),p=d.borderTop?d.borderTop:f,m=d.borderBottom?d.borderBottom:f,g=d.borderTop?n:2*n,y=p!==m?1:i-a[s]+1;e.setEdge(l,p,{weight:g,minlen:y,nestingEdge:!0}),e.setEdge(m,u,{weight:g,minlen:y,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:i+a[s]})}function A8t(e){var t={};function r(n,i){var a=e.children(n);a&&a.length&&ft(a,function(s){r(s,i+1)}),t[n]=i}return ft(e.children(),function(n){r(n,1)}),t}function _8t(e){return af(e.edges(),function(t,r){return t+e.edge(r).weight},0)}function A9e(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,ft(e.edges(),function(r){var n=e.edge(r);n.nestingEdge&&e.removeEdge(r)})}var _9e=W(()=>{si();Wf()});function R9e(e,t,r){var n={},i;ft(r,function(a){for(var s=e.parent(a),o,l;s;){if(o=e.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=o}})}var L9e=W(()=>{si()});function I9e(e,t,r){var n=L8t(e),i=new qn({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return e.node(a)});return ft(e.nodes(),function(a){var s=e.node(a),o=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),ft(e[r](a),function(l){var u=l.v===a?l.w:l.v,h=i.edge(u,a),f=Si(h)?0:h.weight;i.setEdge(u,a,{weight:e.edge(l).weight+f})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i}function L8t(e){for(var t;e.hasNode(t=ry("_root")););return t}var M9e=W(()=>{si();qc()});function N9e(e,t){for(var r=0,n=1;n0;)h%2&&(f+=o[h+1]),h=h-1>>1,o[h]+=u.weight;l+=u.weight*f})),l}var D9e=W(()=>{si()});function O9e(e){var t={},r=al(e.nodes(),function(o){return!e.children(o).length}),n=Wl(Kn(r,function(o){return e.node(o).rank})),i=Kn(vu(n+1),function(){return[]});function a(o){if(!e5(t,o)){t[o]=!0;var l=e.node(o);i[l.rank].push(o),ft(e.successors(o),a)}}var s=sf(r,function(o){return e.node(o).rank});return ft(s,a),i}var P9e=W(()=>{si()});function B9e(e,t){return Kn(t,function(r){var n=e.inEdges(r);if(n.length){var i=af(n,function(a,s){var o=e.edge(s),l=e.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}var F9e=W(()=>{si()});function $9e(e,t){var r={};ft(e,function(i,a){var s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};Si(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),ft(t.edges(),function(i){var a=r[i.v],s=r[i.w];!Si(a)&&!Si(s)&&(s.indegree++,a.out.push(r[i.w]))});var n=al(r,function(i){return!i.indegree});return M8t(n)}function M8t(e){var t=[];function r(a){return function(s){s.merged||(Si(s.barycenter)||Si(a.barycenter)||s.barycenter>=a.barycenter)&&N8t(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&e.push(s)}}for(;e.length;){var i=e.pop();t.push(i),ft(i.in.reverse(),r(i)),ft(i.out,n(i))}return Kn(al(t,function(a){return!a.merged}),function(a){return ty(a,["vs","i","barycenter","weight"])})}function N8t(e,t){var r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}var z9e=W(()=>{si()});function q9e(e,t){var r=YAe(e,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),n=r.lhs,i=sf(r.rhs,function(h){return-h.i}),a=[],s=0,o=0,l=0;n.sort(D8t(!!t)),l=G9e(a,i,l),ft(n,function(h){l+=h.vs.length,a.push(h.vs),s+=h.barycenter*h.weight,o+=h.weight,l=G9e(a,i,l)});var u={vs:yu(a)};return o&&(u.barycenter=s/o,u.weight=o),u}function G9e(e,t,r){for(var n;t.length&&(n=fm(t)).i<=r;)t.pop(),e.push(n.vs),r++;return r}function D8t(e){return function(t,r){return t.barycenterr.barycenter?1:e?r.i-t.i:t.i-r.i}}var V9e=W(()=>{si();Wf()});function tX(e,t,r,n){var i=e.children(t),a=e.node(t),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=al(i,function(m){return m!==s&&m!==o}));var u=B9e(e,i);ft(u,function(m){if(e.children(m.v).length){var g=tX(e,m.v,r,n);l[m.v]=g,Object.prototype.hasOwnProperty.call(g,"barycenter")&&P8t(m,g)}});var h=$9e(u,r);O8t(h,l);var f=q9e(h,n);if(s&&(f.vs=yu([s,f.vs,o]),e.predecessors(s).length)){var d=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(o)[0]);Object.prototype.hasOwnProperty.call(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+d.order+p.order)/(f.weight+2),f.weight+=2}return f}function O8t(e,t){ft(e,function(r){r.vs=yu(r.vs.map(function(n){return t[n]?t[n].vs:n}))})}function P8t(e,t){Si(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var W9e=W(()=>{si();F9e();z9e();V9e()});function Y9e(e){var t=FY(e),r=H9e(e,vu(1,t+1),"inEdges"),n=H9e(e,vu(t-1,-1,-1),"outEdges"),i=O9e(e);U9e(e,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){B8t(o%2?r:n,o%4>=2),i=tg(e);var u=N9e(e,i);u{si();qc();Wf();L9e();M9e();D9e();P9e();W9e()});function j9e(e){var t=$8t(e);ft(e.graph().dummyChains,function(r){for(var n=e.node(r),i=n.edgeObj,a=F8t(e,t,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],h=!0;r!==i.w;){if(n=e.node(r),h){for(;(u=s[l])!==o&&e.node(u).maxRanks||o>t[l].lim));for(u=l,l=n;(l=e.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function $8t(e){var t={},r=0;function n(i){var a=r;ft(e.children(i),n),t[i]={low:a,lim:r++}}return ft(e.children(),n),t}var K9e=W(()=>{si()});function z8t(e,t){var r={};function n(i,a){var s=0,o=0,l=i.length,u=fm(a);return ft(a,function(h,f){var d=q8t(e,h),p=d?e.node(d).order:l;(d||h===u)&&(ft(a.slice(o,f+1),function(m){ft(e.predecessors(m),function(g){var y=e.node(g),v=y.order;(vu)&&Z9e(r,d,h)})})}function i(a,s){var o=-1,l,u=0;return ft(s,function(h,f){if(e.node(h).dummy==="border"){var d=e.predecessors(h);d.length&&(l=e.node(d[0]).order,n(s,u,f,o,l),u=f,o=l)}n(s,u,s.length,l,a.length)}),s}return af(t,i),r}function q8t(e,t){if(e.node(t).dummy)return ib(e.predecessors(t),function(r){return e.node(r).dummy})}function Z9e(e,t,r){if(t>r){var n=t;t=r,r=n}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function V8t(e,t,r){if(t>r){var n=t;t=r,r=n}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],r)}function W8t(e,t,r,n){var i={},a={},s={};return ft(t,function(o){ft(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),ft(t,function(o){var l=-1;ft(o,function(u){var h=n(u);if(h.length){h=sf(h,function(g){return s[g]});for(var f=(h.length-1)/2,d=Math.floor(f),p=Math.ceil(f);d<=p;++d){var m=h[d];a[u]===u&&l{si();qc();Wf()});function e_e(e){e=GR(e),Q8t(e),oG(Q9e(e),function(t,r){e.node(r).x=t})}function Q8t(e){var t=tg(e),r=e.graph().ranksep,n=0;ft(t,function(i){var a=Wl(Kn(i,function(s){return e.node(s).height}));ft(i,function(s){e.node(s).y=n+a/2}),n+=a+r})}var t_e=W(()=>{si();Wf();J9e()});function lC(e,t){var r=t&&t.debugTiming?XAe:jAe;r("layout",()=>{var n=r(" buildLayoutGraph",()=>cAt(e));r(" runLayout",()=>J8t(n,r)),r(" updateInputGraph",()=>eAt(e,n))})}function J8t(e,t){t(" makeSpaceForEdgeLabels",()=>uAt(e)),t(" removeSelfEdges",()=>xAt(e)),t(" acyclic",()=>GAe(e)),t(" nestingGraph.run",()=>S9e(e)),t(" rank",()=>JY(GR(e))),t(" injectEdgeLabelProxies",()=>hAt(e)),t(" removeEmptyRanks",()=>UAe(e)),t(" nestingGraph.cleanup",()=>A9e(e)),t(" normalizeRanks",()=>HAe(e)),t(" assignRankMinMax",()=>fAt(e)),t(" removeEdgeLabelProxies",()=>dAt(e)),t(" normalize.run",()=>i9e(e)),t(" parentDummyChains",()=>j9e(e)),t(" addBorderSegments",()=>ZAe(e)),t(" order",()=>Y9e(e)),t(" insertSelfEdges",()=>bAt(e)),t(" adjustCoordinateSystem",()=>e9e(e)),t(" position",()=>e_e(e)),t(" positionSelfEdges",()=>wAt(e)),t(" removeBorderNodes",()=>vAt(e)),t(" normalize.undo",()=>a9e(e)),t(" fixupEdgeLabelCoords",()=>gAt(e)),t(" undoCoordinateSystem",()=>t9e(e)),t(" translateGraph",()=>pAt(e)),t(" assignNodeIntersects",()=>mAt(e)),t(" reversePoints",()=>yAt(e)),t(" acyclic.undo",()=>qAe(e))}function eAt(e,t){ft(e.nodes(),function(r){var n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,t.children(r).length&&(n.width=i.width,n.height=i.height))}),ft(e.edges(),function(r){var n=e.edge(r),i=t.edge(r);n.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}function cAt(e){var t=new qn({multigraph:!0,compound:!0}),r=nX(e.graph());return t.setGraph(sb({},rAt,rX(r,tAt),ty(r,nAt))),ft(e.nodes(),function(n){var i=nX(e.node(n));t.setNode(n,eG(rX(i,iAt),aAt)),t.setParent(n,e.parent(n))}),ft(e.edges(),function(n){var i=nX(e.edge(n));t.setEdge(n,sb({},oAt,rX(i,sAt),ty(i,lAt)))}),t}function uAt(e){var t=e.graph();t.ranksep/=2,ft(e.edges(),function(r){var n=e.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function hAt(e){ft(e.edges(),function(t){var r=e.edge(t);if(r.width&&r.height){var n=e.node(t.v),i=e.node(t.w),a={rank:(i.rank-n.rank)/2+n.rank,e:t};Vf(e,"edge-proxy",a,"_ep")}})}function fAt(e){var t=0;ft(e.nodes(),function(r){var n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Wl(t,n.maxRank))}),e.graph().maxRank=t}function dAt(e){ft(e.nodes(),function(t){var r=e.node(t);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function pAt(e){var t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=e.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var h=u.x,f=u.y,d=u.width,p=u.height;t=Math.min(t,h-d/2),r=Math.max(r,h+d/2),n=Math.min(n,f-p/2),i=Math.max(i,f+p/2)}ft(e.nodes(),function(u){l(e.node(u))}),ft(e.edges(),function(u){var h=e.edge(u);Object.prototype.hasOwnProperty.call(h,"x")&&l(h)}),t-=s,n-=o,ft(e.nodes(),function(u){var h=e.node(u);h.x-=t,h.y-=n}),ft(e.edges(),function(u){var h=e.edge(u);ft(h.points,function(f){f.x-=t,f.y-=n}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=t),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=n)}),a.width=r-t+s,a.height=i-n+o}function mAt(e){ft(e.edges(),function(t){var r=e.edge(t),n=e.node(t.v),i=e.node(t.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=i,s=n),r.points.unshift(PY(n,a)),r.points.push(PY(i,s))})}function gAt(e){ft(e.edges(),function(t){var r=e.edge(t);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function yAt(e){ft(e.edges(),function(t){var r=e.edge(t);r.reversed&&r.points.reverse()})}function vAt(e){ft(e.nodes(),function(t){if(e.children(t).length){var r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),a=e.node(fm(r.borderLeft)),s=e.node(fm(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),ft(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function xAt(e){ft(e.edges(),function(t){if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function bAt(e){var t=tg(e);ft(t,function(r){var n=0;ft(r,function(i,a){var s=e.node(i);s.order=a+n,ft(s.selfEdges,function(o){Vf(e,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function wAt(e){ft(e.nodes(),function(t){var r=e.node(t);if(r.dummy==="selfedge"){var n=e.node(r.e.v),i=n.x+n.width/2,a=n.y,s=r.x-i,o=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function rX(e,t){return J1(ty(e,t),Number)}function nX(e){var t={};return ft(e,function(r,n){t[n.toLowerCase()]=r}),t}var tAt,rAt,nAt,iAt,aAt,sAt,oAt,lAt,r_e=W(()=>{si();qc();QAe();n9e();OY();GY();eX();_9e();X9e();K9e();t_e();Wf();tAt=["nodesep","edgesep","ranksep","marginx","marginy"],rAt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},nAt=["acyclicer","ranker","rankdir","align"],iAt=["width","height"],aAt={width:0,height:0},sAt=["minlen","weight","width","height","labeloffset"],oAt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lAt=["labelpos"]});var iX=W(()=>{OY();r_e();GY();eX()});var o_e={};Tr(o_e,{getEdgesToRender:()=>a_e,render:()=>EAt});var n_e,i_e,kAt,TAt,CAt,SAt,a_e,s_e,EAt,l_e=W(()=>{MY();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();iX();LY();qc();n_e=b((e,t,r)=>Math.max(t,Math.min(r,e)),"clamp"),i_e=b((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),kAt=b(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram","shouldMergeSelfLoopSegments"),TAt=b((e,t,r,n,i)=>{let a=[],s=new Set;if(r.forEach(({start:h,end:f})=>{h!==n&&s.add(h),f!==n&&s.add(f)}),s.forEach(h=>{let f=e.node(h);typeof f?.x=="number"&&typeof f?.y=="number"&&a.push(f)}),a.length===0&&r.forEach(({edge:h})=>{(h.points??[]).forEach(f=>{typeof f?.x=="number"&&typeof f?.y=="number"&&a.push(f)})}),a.length===0)return i_e(i);let o=a.reduce((h,f)=>({x:h.x+f.x/a.length,y:h.y+f.y/a.length}),{x:0,y:0}),l=o.x-t.x,u=o.y-t.y;return Math.abs(l)>Math.abs(u)?l>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":i_e(i)},"getSelfLoopSide"),CAt=b((e,t="top",r=0,n=0)=>{let i=e.x,a=e.y-r,s=e.width/2,o=e.height/2,l=Math.max(36,Math.min(100,e.width*.8)),u=n_e(Math.max(n,e.width*.35),36,l),h=n_e(Math.min(e.width,e.height)*.45,24,48);switch(t){case"bottom":{let f=a+o;return[{x:i-u/2,y:f},{x:i-u/2,y:f+h},{x:i+u/2,y:f+h},{x:i+u/2,y:f}]}case"right":{let f=i+s;return[{x:f,y:a-u/2},{x:f+h,y:a-u/2},{x:f+h,y:a+u/2},{x:f,y:a+u/2}]}case"left":{let f=i-s;return[{x:f,y:a-u/2},{x:f-h,y:a-u/2},{x:f-h,y:a+u/2},{x:f,y:a+u/2}]}default:{let f=a-o;return[{x:i-u/2,y:f},{x:i-u/2,y:f-h},{x:i+u/2,y:f-h},{x:i+u/2,y:f}]}}},"getSelfLoopPoints"),SAt=b((e,t,r="top",n=0,i={})=>{let s=e.x,o=e.y-n,l=i.width??0,u=i.height??0;switch(r){case"bottom":return{x:s,y:Math.max(...t.map(h=>h.y))+u/2+4};case"right":return{x:Math.max(...t.map(h=>h.x))+l/2+4,y:o};case"left":return{x:Math.min(...t.map(h=>h.x))-l/2-4,y:o};default:return{x:s,y:Math.min(...t.map(h=>h.y))-u/2-4}}},"getSelfLoopLabelPosition"),a_e=b((e,t=0,{mergeSelfLoops:r=!0}={})=>{let n=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(s=>{let o=e.edge(s);if(r&&o.selfLoop){let l=o.selfLoop.id;n.has(l)||n.set(l,[]),n.get(l).push({edge:o,start:s.v,end:s.w})}else i.push({edge:o,start:s.v,end:s.w})}),n.forEach(s=>{if(s.length!==3){s.forEach(v=>i.push(v));return}s.sort((v,x)=>v.edge.selfLoop.order-x.edge.selfLoop.order);let[o,l,u]=s,h=o.edge.originalEdge??l.edge.originalEdge??u.edge.originalEdge??l.edge,f=e.node(h.start);if(!f){s.forEach(v=>i.push(v));return}let d={width:l.edge.width,height:l.edge.height},p=TAt(e,f,s,h.start,a),m=CAt(f,p,t,d.width??0),g=SAt(f,m,p,t,d),y={...l.edge,...h,id:h.id,points:m,start:h.start,end:h.end,x:g.x,y:g.y,width:d.width,height:d.height,labelStyle:l.edge.labelStyle,fromCluster:o.edge.fromCluster??l.edge.fromCluster??u.edge.fromCluster,toCluster:o.edge.toCluster??l.edge.toCluster??u.edge.toCluster};delete y.selfLoop,delete y.originalEdge,i.push({edge:y,start:y.start,end:y.end})}),i},"getEdgesToRender"),s_e=b(async(e,t,r,n,i,a)=>{se.warn("Graph in recursive render:XAX",bh(t),i);let s=t.graph().rankdir;se.trace("Dir in recursive render - dir:",s);let o=e.insert("g").attr("class","root");t.nodes()?se.info("Recursive render XXX",t.nodes()):se.info("No nodes found for",t),t.edges().length>0&&se.info("Recursive edges",t.edge(t.edges()[0]));let l=o.insert("g").attr("class","clusters"),u=o.insert("g").attr("class","edgePaths"),h=o.insert("g").attr("class","edgeLabels"),f=o.insert("g").attr("class","nodes"),d=kAt(r);await Promise.all(t.nodes().map(async function(x){let w=t.node(x);if(i!==void 0){let C=JSON.parse(JSON.stringify(i.clusterData));se.trace(`Setting data for parent cluster XXX + L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),e8t=b((e,t,r)=>{let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),t8t=b((e,t,r)=>{let n=qt(),{themeVariables:i}=n,{strokeWidth:a}=i,s=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");s.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),s.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),s.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),s.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),r8t={extension:D7t,composition:O7t,aggregation:P7t,dependency:B7t,lollipop:F7t,point:$7t,circle:z7t,cross:G7t,barb:q7t,barbNeo:V7t,only_one:W7t,zero_or_one:H7t,one_or_more:U7t,zero_or_more:Y7t,only_one_neo:X7t,zero_or_one_neo:j7t,one_or_more_neo:K7t,zero_or_more_neo:Z7t,requirement_arrow:Q7t,requirement_contains:e8t,requirement_arrow_neo:J7t,requirement_contains_neo:t8t},w4=N7t});function _Ae(e,t){e[t]?e[t]++:e[t]=1}function RAe(e,t){--e[t]||delete e[t]}function iC(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}return i+AAe+a+AAe+(Si(n)?n8t:n)}function i8t(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};return n&&(o.name=n),o}function IY(e,t){return iC(e,t.v,t.w,t.name)}var n8t,Qy,AAe,qn,FR=W(()=>{si();n8t="\0",Qy="\0",AAe="",qn=class{constructor(t={}){this._isDirected=Object.prototype.hasOwnProperty.call(t,"directed")?t.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=Vl(void 0),this._defaultEdgeLabelFn=Vl(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Qy]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return Jh(t)||(t=Vl(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return ka(this._nodes)}sources(){var t=this;return sl(this.nodes(),function(r){return S8(t._in[r])})}sinks(){var t=this;return sl(this.nodes(),function(r){return S8(t._out[r])})}setNodes(t,r){var n=arguments,i=this;return ft(t,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Qy,this._children[t]={},this._children[Qy][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ft(this.children(t),n=>{this.setParent(n)}),delete this._children[t]),ft(ka(this._in[t]),r),delete this._in[t],delete this._preds[t],ft(ka(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Si(r))r=Qy;else{r+="";for(var n=r;!Si(n);n=this.parent(n))if(n===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==Qy)return r}}children(t){if(Si(t)&&(t=Qy),this._isCompound){var r=this._children[t];if(r)return ka(r)}else{if(t===Qy)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return ka(r)}successors(t){var r=this._sucs[t];if(r)return ka(r)}neighbors(t){var r=this.predecessors(t);if(r)return pG(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;ft(this._nodes,function(s,o){t(o)&&r.setNode(o,s)}),ft(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var o=n.parent(s);return o===void 0||r.hasNode(o)?(i[s]=o,o):o in i?i[o]:a(o)}return this._isCompound&&ft(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(t){return Jh(t)||(t=Vl(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Rc(this._edgeObjs)}setPath(t,r){var n=this,i=arguments;return af(t,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var t,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(t=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(t=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),t=""+t,r=""+r,Si(n)||(n=""+n);var o=iC(this._isDirected,t,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!Si(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(t,r,n);var l=i8t(this._isDirected,t,r,n);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,_Ae(this._preds[r],t),_Ae(this._sucs[t],r),this._in[r][o]=l,this._out[t][o]=l,this._edgeCount++,this}edge(t,r,n){var i=arguments.length===1?IY(this._isDirected,arguments[0]):iC(this._isDirected,t,r,n);return this._edgeLabels[i]}hasEdge(t,r,n){var i=arguments.length===1?IY(this._isDirected,arguments[0]):iC(this._isDirected,t,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(t,r,n){var i=arguments.length===1?IY(this._isDirected,arguments[0]):iC(this._isDirected,t,r,n),a=this._edgeObjs[i];return a&&(t=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],RAe(this._preds[r],t),RAe(this._sucs[t],r),delete this._in[r][i],delete this._out[t][i],this._edgeCount--),this}inEdges(t,r){var n=this._in[t];if(n){var i=Rc(n);return r?sl(i,function(a){return a.v===r}):i}}outEdges(t,r){var n=this._out[t];if(n){var i=Rc(n);return r?sl(i,function(a){return a.w===r}):i}}nodeEdges(t,r){var n=this.inEdges(t,r);if(n)return n.concat(this.outEdges(t,r))}};qn.prototype._nodeCount=0;qn.prototype._edgeCount=0});var qc=W(()=>{FR()});function bh(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:a8t(e),edges:s8t(e)};return Si(e.graph())||(t.value=qz(e.graph())),t}function a8t(e){return Kn(e.nodes(),function(t){var r=e.node(t),n=e.parent(t),i={v:t};return Si(r)||(i.value=r),Si(n)||(i.parent=n),i})}function s8t(e){return Kn(e.edges(),function(t){var r=e.edge(t),n={v:t.v,w:t.w};return Si(t.name)||(n.name=t.name),Si(r)||(n.value=r),n})}var MY=W(()=>{si();FR()});var un,eg,MAe,$R,Jy,o8t,NY,NAe,l8t,ev,IAe,DAe,OAe,PAe,BAe,FAe,c8t,DY=W(()=>{Rr();hr();qc();MY();un=new Map,eg=new Map,MAe=new Map,$R=b(()=>{eg.clear(),MAe.clear(),un.clear()},"clear"),Jy=b((e,t)=>{let r=eg.get(t)||[];return se.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),o8t=b((e,t)=>{let r=eg.get(t)||[];return se.info("Descendants of ",t," is ",r),se.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||Jy(e.v,t)||Jy(e.w,t)||r.includes(e.w):(se.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),NY=b((e,t,r,n)=>{se.warn("Copying children of ",e,"root",n,"data",t.node(e),n);let i=t.children(e)||[];e!==n&&i.push(e),se.warn("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)NY(a,t,r,n);else{let s=t.node(a);se.info("cp ",a," to ",n," with parent ",e),r.setNode(a,s),n!==t.parent(a)&&(se.warn("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==n&&a!==e?(se.debug("Setting parent",a,e),r.setParent(a,e)):(se.info("In copy ",e,"root",n,"data",t.node(e),n),se.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==n,"node!==clusterId",a!==e));let o=t.edges(a);se.debug("Copying Edges",o),o.forEach(l=>{se.info("Edge",l);let u=t.edge(l.v,l.w,l.name);se.info("Edge data",u,n);try{if(o8t(l,n)){let h=eg.get(n)||[],f=h.includes(l.v)||Jy(l.v,n)||l.v===n,d=h.includes(l.w)||Jy(l.w,n)||l.w===n;if(f&&d)se.info("Copying as ",l.v,l.w,u,l.name),r.setEdge(l.v,l.w,u,l.name),se.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]));else{let p=f?n:l.v,m=d?n:l.w;se.info("Rebinding cross-boundary edge as ",p,m,u,l.name),t.setEdge(p,m,u,l.name)}}else se.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",n," clusterId:",e)}catch(h){se.error(h)}})}se.debug("Removing node",a),t.removeNode(a)})},"copy"),NAe=b((e,t)=>{let r=t.children(e),n=[...r];for(let i of r)MAe.set(i,e),n=[...n,...NAe(i,t)];return n},"extractDescendants"),l8t=b((e,t,r)=>{let n=e.edges().filter(l=>l.v===t||l.w===t),i=e.edges().filter(l=>l.v===r||l.w===r),a=n.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),s=i.map(l=>({v:l.v,w:l.w}));return a.filter(l=>s.some(u=>l.v===u.v&&l.w===u.w))},"findCommonEdges"),ev=b((e,t,r)=>{let n=t.children(e);if(se.trace("Searching children of id ",e,n),n.length<1)return e;let i;for(let a of n){let s=ev(a,t,r),o=l8t(t,r,s);if(s)if(o.length>0)i=s;else return s}return i},"findNonClusterChild"),IAe=b(e=>!un.has(e)||!un.get(e).externalConnections?e:un.has(e)?un.get(e).id:e,"getAnchorId"),DAe=b((e,t)=>{if(!e||t>10){se.debug("Opting out, no graph ");return}else se.debug("Opting in, graph ");e.nodes().forEach(function(r){e.children(r).length>0&&(se.warn("Cluster identified",r," Replacement id in edges: ",ev(r,e,r)),eg.set(r,NAe(r,e)),un.set(r,{id:ev(r,e,r),clusterData:e.node(r)}))}),e.nodes().forEach(function(r){let n=e.children(r),i=e.edges();n.length>0?(se.debug("Cluster identified",r,eg),i.forEach(a=>{let s=Jy(a.v,r),o=Jy(a.w,r);s^o&&(se.warn("Edge: ",a," leaves cluster ",r),se.warn("Descendants of XXX ",r,": ",eg.get(r)),un.get(r).externalConnections=!0)})):se.debug("Not a cluster ",r,eg)});for(let r of un.keys()){let n=un.get(r).id,i=e.parent(n);i!==r&&un.has(i)&&!un.get(i).externalConnections&&(un.get(r).id=i);let a=e.edges().some(s=>s.v===r);if(n&&un.get(r)?.externalConnections&&a&&FAe(e,n,r)){let s=c8t(e,r,e.parent(n));s&&(un.get(r).id=s)}}e.edges().forEach(function(r){let n=e.edge(r);se.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),se.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(e.edge(r)));let i=r.v,a=r.w;if(se.warn("Fix XXX",un,"ids:",r.v,r.w,"Translating: ",un.get(r.v)," --- ",un.get(r.w)),un.get(r.v)||un.get(r.w)){if(se.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),i=IAe(r.v),a=IAe(r.w),e.removeEdge(r.v,r.w,r.name),i!==r.v){let s=e.parent(i);un.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){let s=e.parent(a);un.get(s).externalConnections=!0,n.toCluster=r.w}se.warn("Fix Replacing with XXX",i,a,r.name),e.setEdge(i,a,n,r.name)}}),se.warn("Adjusted Graph",bh(e)),OAe(e,0),se.trace(un)},"adjustClustersAndEdges"),OAe=b((e,t)=>{if(se.warn("extractor - ",t,bh(e),e.children("D")),t>10){se.error("Bailing out");return}let r=e.nodes(),n=!1;for(let i of r){let a=e.children(i);n=n||a.length>0}if(!n){se.debug("Done, no node has children",e.nodes());return}se.debug("Nodes = ",r,t);for(let i of r)if(se.debug("Extracting node",i,un,un.has(i)&&!un.get(i).externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!un.has(i))se.debug("Not a cluster",i,t);else if(un.get(i)?.clusterData?.explicitDir&&e.children(i)&&e.children(i).length>0){se.warn("Cluster with explicit dir, creating subgraph for children",i,t);let a=un.get(i).clusterData.dir,s=new qn({multigraph:!0,compound:!0}).setGraph({rankdir:a,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});NY(i,e,s,i);let o=e.node(i)||{};e.setNode(i,{...o,clusterNode:!0,id:i,clusterData:un.get(i).clusterData,label:un.get(i).label,graph:s}),se.warn("Subgraph for cluster with explicit dir created:",i,bh(s))}else if(!un.get(i).externalConnections&&e.children(i)&&e.children(i).length>0){se.warn("Cluster without external connections, without a parent and with children",i,t);let s=e.graph().rankdir==="TB"?"LR":"TB";un.get(i)?.clusterData?.dir&&(s=un.get(i).clusterData.dir,se.warn("Fixing dir",un.get(i).clusterData.dir,s));let o=new qn({multigraph:!0,compound:!0}).setGraph({rankdir:s,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});NY(i,e,o,i);let l=e.node(i)||{};e.setNode(i,{...l,clusterNode:!0,id:i,clusterData:un.get(i).clusterData,label:un.get(i).label,graph:o}),se.debug("Old graph after copy",bh(e))}else se.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!un.get(i).externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),se.debug(un);r=e.nodes(),se.warn("New list of nodes",r);for(let i of r){let a=e.node(i);se.warn(" Now next level",i,a),a?.clusterNode&&OAe(a.graph,t+1)}},"extractor"),PAe=b((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(n=>{let i=e.children(n),a=PAe(e,i);r=[...r,...a]}),r},"sorter"),BAe=b(e=>PAe(e,e.children()),"sortNodesByHierarchy"),FAe=b((e,t,r)=>{let n=e.parent(t);for(;n&&n!==r;){let i=un.get(n);if(i&&!i.externalConnections)return!0;n=e.parent(n)}return!1},"isNodeInExtractableCluster"),c8t=b((e,t,r)=>{let n=e.children(t)??[];for(let i of n){if(i===r||Jy(i,r))continue;let a=ev(i,e,t);if(a&&!FAe(e,a,t))return a}return null},"findSafeAnchorNode")});function $Ae(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function u8t(e,t){if(e!=="_next"&&e!=="_prev")return t}var zR,zAe=W(()=>{zR=class{constructor(){var t={};t._next=t._prev=t,this._sentinel=t}dequeue(){var t=this._sentinel,r=t._prev;if(r!==t)return $Ae(r),r}enqueue(t){var r=this._sentinel;t._prev&&t._next&&$Ae(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r}toString(){for(var t=[],r=this._sentinel,n=r._prev;n!==r;)t.push(JSON.stringify(n,u8t)),n=n._prev;return"["+t.join(", ")+"]"}}});function GAe(e,t){if(e.nodeCount()<=1)return[];var r=d8t(e,t||h8t),n=f8t(r.graph,r.buckets,r.zeroIdx);return yu(Kn(n,function(i){return e.outEdges(i.v,i.w)}))}function f8t(e,t,r){for(var n=[],i=t[t.length-1],a=t[0],s;e.nodeCount();){for(;s=a.dequeue();)OY(e,t,r,s);for(;s=i.dequeue();)OY(e,t,r,s);if(e.nodeCount()){for(var o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(OY(e,t,r,s,!0));break}}}return n}function OY(e,t,r,n,i){var a=i?[]:void 0;return ft(e.inEdges(n.v),function(s){var o=e.edge(s),l=e.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,PY(t,r,l)}),ft(e.outEdges(n.v),function(s){var o=e.edge(s),l=s.w,u=e.node(l);u.in-=o,PY(t,r,u)}),e.removeNode(n.v),a}function d8t(e,t){var r=new qn,n=0,i=0;ft(e.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),ft(e.edges(),function(o){var l=r.edge(o.v,o.w)||0,u=t(o),h=l+u;r.setEdge(o.v,o.w,h),i=Math.max(i,r.node(o.v).out+=u),n=Math.max(n,r.node(o.w).in+=u)});var a=vu(i+n+3).map(function(){return new zR}),s=n+1;return ft(r.nodes(),function(o){PY(a,s,r.node(o))}),{graph:r,buckets:a,zeroIdx:s}}function PY(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var h8t,qAe=W(()=>{si();qc();zAe();h8t=Vl(1)});function VAe(e){var t=e.graph().acyclicer==="greedy"?GAe(e,r(e)):p8t(e);ft(t,function(n){var i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,ry("rev"))});function r(n){return function(i){return n.edge(i).weight}}}function p8t(e){var t=[],r={},n={};function i(a){Object.prototype.hasOwnProperty.call(n,a)||(n[a]=!0,r[a]=!0,ft(e.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?t.push(s):i(s.w)}),delete r[a])}return ft(e.nodes(),i),t}function WAe(e){ft(e.edges(),function(t){var r=e.edge(t);if(r.reversed){e.removeEdge(t);var n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}var BY=W(()=>{si();qAe()});function Vf(e,t,r,n){var i;do i=ry(n);while(e.hasNode(i));return r.dummy=t,e.setNode(i,r),i}function UAe(e){var t=new qn().setGraph(e.graph());return ft(e.nodes(),function(r){t.setNode(r,e.node(r))}),ft(e.edges(),function(r){var n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function GR(e){var t=new qn({multigraph:e.isMultigraph()}).setGraph(e.graph());return ft(e.nodes(),function(r){e.children(r).length||t.setNode(r,e.node(r))}),ft(e.edges(),function(r){t.setEdge(r,e.edge(r))}),t}function FY(e,t){var r=e.x,n=e.y,i=t.x-r,a=t.y-n,s=e.width/2,o=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:r+l,y:n+u}}function tg(e){var t=Kn(vu(zY(e)+1),function(){return[]});return ft(e.nodes(),function(r){var n=e.node(r),i=n.rank;Si(i)||(t[i][n.order]=r)}),t}function YAe(e){var t=Jd(Kn(e.nodes(),function(r){return e.node(r).rank}));ft(e.nodes(),function(r){var n=e.node(r);e5(n,"rank")&&(n.rank-=t)})}function XAe(e){var t=Jd(Kn(e.nodes(),function(a){return e.node(a).rank})),r=[];ft(e.nodes(),function(a){var s=e.node(a).rank-t;r[s]||(r[s]=[]),r[s].push(a)});var n=0,i=e.graph().nodeRankFactor;ft(r,function(a,s){Si(a)&&s%i!==0?--n:n&&ft(a,function(o){e.node(o).rank+=n})})}function $Y(e,t,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),Vf(e,"border",i,t)}function zY(e){return Hl(Kn(e.nodes(),function(t){var r=e.node(t).rank;if(!Si(r))return r}))}function jAe(e,t){var r={lhs:[],rhs:[]};return ft(e,function(n){t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function KAe(e,t){var r=hm();try{return t()}finally{console.log(e+" time: "+(hm()-r)+"ms")}}function ZAe(e,t){return t()}var Wf=W(()=>{si();qc()});function JAe(e){function t(r){var n=e.children(r),i=e.node(r);if(n.length&&ft(n,t),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a{si();Wf()});function r9e(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&i9e(e)}function n9e(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&m8t(e),(t==="lr"||t==="rl")&&(g8t(e),i9e(e))}function i9e(e){ft(e.nodes(),function(t){t9e(e.node(t))}),ft(e.edges(),function(t){t9e(e.edge(t))})}function t9e(e){var t=e.width;e.width=e.height,e.height=t}function m8t(e){ft(e.nodes(),function(t){GY(e.node(t))}),ft(e.edges(),function(t){var r=e.edge(t);ft(r.points,GY),Object.prototype.hasOwnProperty.call(r,"y")&&GY(r)})}function GY(e){e.y=-e.y}function g8t(e){ft(e.nodes(),function(t){qY(e.node(t))}),ft(e.edges(),function(t){var r=e.edge(t);ft(r.points,qY),Object.prototype.hasOwnProperty.call(r,"x")&&qY(r)})}function qY(e){var t=e.x;e.x=e.y,e.y=t}var a9e=W(()=>{si()});function s9e(e){e.graph().dummyChains=[],ft(e.edges(),function(t){v8t(e,t)})}function v8t(e,t){var r=t.v,n=e.node(r).rank,i=t.w,a=e.node(i).rank,s=t.name,o=e.edge(t),l=o.labelRank;if(a!==n+1){e.removeEdge(t);var u=void 0,h,f;for(f=0,++n;n{si();Wf()});function sC(e){var t={};function r(n){var i=e.node(n);if(Object.prototype.hasOwnProperty.call(t,n))return i.rank;t[n]=!0;var a=Jd(Kn(e.outEdges(n),function(s){return r(s.w)-e.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}ft(e.sources(),r)}function tv(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var qR=W(()=>{si()});function VR(e){var t=new qn({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,a;x8t(t,e){si();qc();qR()});var c9e=W(()=>{});var HY=W(()=>{});var AHr,UY=W(()=>{si();HY();AHr=Vl(1)});var u9e=W(()=>{UY()});var YY=W(()=>{});var h9e=W(()=>{YY()});var DHr,f9e=W(()=>{si();DHr=Vl(1)});function XY(e){var t={},r={},n=[];function i(a){if(Object.prototype.hasOwnProperty.call(r,a))throw new oC;Object.prototype.hasOwnProperty.call(t,a)||(r[a]=!0,t[a]=!0,ft(e.predecessors(a),i),delete r[a],n.push(a))}if(ft(e.sinks(),i),dG(t)!==e.nodeCount())throw new oC;return n}function oC(){}var jY=W(()=>{si();XY.CycleException=oC;oC.prototype=new Error});var d9e=W(()=>{jY()});function WR(e,t,r){wn(t)||(t=[t]);var n=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return ft(t,function(s){if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);p9e(e,s,r==="post",a,n,i)}),i}function p9e(e,t,r,n,i,a){Object.prototype.hasOwnProperty.call(n,t)||(n[t]=!0,r||a.push(t),ft(i(t),function(s){p9e(e,s,r,n,i,a)}),r&&a.push(t))}var KY=W(()=>{si()});function ZY(e,t){return WR(e,t,"post")}var m9e=W(()=>{KY()});function QY(e,t){return WR(e,t,"pre")}var g9e=W(()=>{KY()});var y9e=W(()=>{HY();FR()});var v9e=W(()=>{c9e();UY();u9e();h9e();f9e();d9e();m9e();g9e();y9e();YY();jY()});function ng(e){e=UAe(e),sC(e);var t=VR(e);eX(t),JY(t,e);for(var r,n;r=k9e(t);)n=T9e(t,e,r),C9e(t,e,r,n)}function JY(e,t){var r=ZY(e,e.nodes());r=r.slice(0,r.length-1),ft(r,function(n){E8t(e,t,n)})}function E8t(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=b9e(e,t,r)}function b9e(e,t,r){var n=e.node(r),i=n.parent,a=!0,s=t.edge(r,i),o=0;return s||(a=!1,s=t.edge(i,r)),o=s.weight,ft(t.nodeEdges(r),function(l){var u=l.v===r,h=u?l.w:l.v;if(h!==i){var f=u===a,d=t.edge(l).weight;if(o+=f?d:-d,_8t(e,r,h)){var p=e.edge(r,h).cutvalue;o+=f?-p:p}}}),o}function eX(e,t){arguments.length<2&&(t=e.nodes()[0]),w9e(e,{},1,t)}function w9e(e,t,r,n,i){var a=r,s=e.node(n);return t[n]=!0,ft(e.neighbors(n),function(o){Object.prototype.hasOwnProperty.call(t,o)||(r=w9e(e,t,r,o,n))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function k9e(e){return ib(e.edges(),function(t){return e.edge(t).cutvalue<0})}function T9e(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var a=e.node(n),s=e.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=sl(t.edges(),function(h){return l===x9e(e,e.node(h.v),o)&&l!==x9e(e,e.node(h.w),o)});return ey(u,function(h){return tv(t,h)})}function C9e(e,t,r,n){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(n.v,n.w,{}),eX(e),JY(e,t),A8t(e,t)}function A8t(e,t){var r=ib(e.nodes(),function(i){return!t.node(i).parent}),n=QY(e,r);n=n.slice(1),ft(n,function(i){var a=e.node(i).parent,s=t.edge(i,a),o=!1;s||(s=t.edge(a,i),o=!0),t.node(i).rank=t.node(a).rank+(o?s.minlen:-s.minlen)})}function _8t(e,t,r){return e.hasEdge(t,r)}function x9e(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}var S9e=W(()=>{si();v9e();Wf();WY();qR();ng.initLowLimValues=eX;ng.initCutValues=JY;ng.calcCutValue=b9e;ng.leaveEdge=k9e;ng.enterEdge=T9e;ng.exchangeEdges=C9e});function tX(e){switch(e.graph().ranker){case"network-simplex":E9e(e);break;case"tight-tree":L8t(e);break;case"longest-path":R8t(e);break;default:E9e(e)}}function L8t(e){sC(e),VR(e)}function E9e(e){ng(e)}var R8t,rX=W(()=>{WY();S9e();qR();R8t=sC});function A9e(e){var t=Vf(e,"root",{},"_root"),r=I8t(e),n=Hl(Rc(r))-1,i=2*n+1;e.graph().nestingRoot=t,ft(e.edges(),function(s){e.edge(s).minlen*=i});var a=M8t(e)+1;ft(e.children(),function(s){_9e(e,t,i,a,n,r,s)}),e.graph().nodeRankFactor=i}function _9e(e,t,r,n,i,a,s){var o=e.children(s);if(!o.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}var l=$Y(e,"_bt"),u=$Y(e,"_bb"),h=e.node(s);e.setParent(l,s),h.borderTop=l,e.setParent(u,s),h.borderBottom=u,ft(o,function(f){_9e(e,t,r,n,i,a,f);var d=e.node(f),p=d.borderTop?d.borderTop:f,m=d.borderBottom?d.borderBottom:f,g=d.borderTop?n:2*n,y=p!==m?1:i-a[s]+1;e.setEdge(l,p,{weight:g,minlen:y,nestingEdge:!0}),e.setEdge(m,u,{weight:g,minlen:y,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:i+a[s]})}function I8t(e){var t={};function r(n,i){var a=e.children(n);a&&a.length&&ft(a,function(s){r(s,i+1)}),t[n]=i}return ft(e.children(),function(n){r(n,1)}),t}function M8t(e){return af(e.edges(),function(t,r){return t+e.edge(r).weight},0)}function R9e(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,ft(e.edges(),function(r){var n=e.edge(r);n.nestingEdge&&e.removeEdge(r)})}var L9e=W(()=>{si();Wf()});function I9e(e,t,r){var n={},i;ft(r,function(a){for(var s=e.parent(a),o,l;s;){if(o=e.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=o}})}var M9e=W(()=>{si()});function N9e(e,t,r){var n=D8t(e),i=new qn({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return e.node(a)});return ft(e.nodes(),function(a){var s=e.node(a),o=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),ft(e[r](a),function(l){var u=l.v===a?l.w:l.v,h=i.edge(u,a),f=Si(h)?0:h.weight;i.setEdge(u,a,{weight:e.edge(l).weight+f})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i}function D8t(e){for(var t;e.hasNode(t=ry("_root")););return t}var D9e=W(()=>{si();qc()});function O9e(e,t){for(var r=0,n=1;n0;)h%2&&(f+=o[h+1]),h=h-1>>1,o[h]+=u.weight;l+=u.weight*f})),l}var P9e=W(()=>{si()});function B9e(e){var t={},r=sl(e.nodes(),function(o){return!e.children(o).length}),n=Hl(Kn(r,function(o){return e.node(o).rank})),i=Kn(vu(n+1),function(){return[]});function a(o){if(!e5(t,o)){t[o]=!0;var l=e.node(o);i[l.rank].push(o),ft(e.successors(o),a)}}var s=sf(r,function(o){return e.node(o).rank});return ft(s,a),i}var F9e=W(()=>{si()});function $9e(e,t){return Kn(t,function(r){var n=e.inEdges(r);if(n.length){var i=af(n,function(a,s){var o=e.edge(s),l=e.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}var z9e=W(()=>{si()});function G9e(e,t){var r={};ft(e,function(i,a){var s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};Si(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),ft(t.edges(),function(i){var a=r[i.v],s=r[i.w];!Si(a)&&!Si(s)&&(s.indegree++,a.out.push(r[i.w]))});var n=sl(r,function(i){return!i.indegree});return P8t(n)}function P8t(e){var t=[];function r(a){return function(s){s.merged||(Si(s.barycenter)||Si(a.barycenter)||s.barycenter>=a.barycenter)&&B8t(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&e.push(s)}}for(;e.length;){var i=e.pop();t.push(i),ft(i.in.reverse(),r(i)),ft(i.out,n(i))}return Kn(sl(t,function(a){return!a.merged}),function(a){return ty(a,["vs","i","barycenter","weight"])})}function B8t(e,t){var r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}var q9e=W(()=>{si()});function W9e(e,t){var r=jAe(e,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),n=r.lhs,i=sf(r.rhs,function(h){return-h.i}),a=[],s=0,o=0,l=0;n.sort(F8t(!!t)),l=V9e(a,i,l),ft(n,function(h){l+=h.vs.length,a.push(h.vs),s+=h.barycenter*h.weight,o+=h.weight,l=V9e(a,i,l)});var u={vs:yu(a)};return o&&(u.barycenter=s/o,u.weight=o),u}function V9e(e,t,r){for(var n;t.length&&(n=fm(t)).i<=r;)t.pop(),e.push(n.vs),r++;return r}function F8t(e){return function(t,r){return t.barycenterr.barycenter?1:e?r.i-t.i:t.i-r.i}}var H9e=W(()=>{si();Wf()});function nX(e,t,r,n){var i=e.children(t),a=e.node(t),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=sl(i,function(m){return m!==s&&m!==o}));var u=$9e(e,i);ft(u,function(m){if(e.children(m.v).length){var g=nX(e,m.v,r,n);l[m.v]=g,Object.prototype.hasOwnProperty.call(g,"barycenter")&&z8t(m,g)}});var h=G9e(u,r);$8t(h,l);var f=W9e(h,n);if(s&&(f.vs=yu([s,f.vs,o]),e.predecessors(s).length)){var d=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(o)[0]);Object.prototype.hasOwnProperty.call(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+d.order+p.order)/(f.weight+2),f.weight+=2}return f}function $8t(e,t){ft(e,function(r){r.vs=yu(r.vs.map(function(n){return t[n]?t[n].vs:n}))})}function z8t(e,t){Si(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var U9e=W(()=>{si();z9e();q9e();H9e()});function j9e(e){var t=zY(e),r=Y9e(e,vu(1,t+1),"inEdges"),n=Y9e(e,vu(t-1,-1,-1),"outEdges"),i=B9e(e);X9e(e,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){G8t(o%2?r:n,o%4>=2),i=tg(e);var u=O9e(e,i);u{si();qc();Wf();M9e();D9e();P9e();F9e();U9e()});function Z9e(e){var t=V8t(e);ft(e.graph().dummyChains,function(r){for(var n=e.node(r),i=n.edgeObj,a=q8t(e,t,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],h=!0;r!==i.w;){if(n=e.node(r),h){for(;(u=s[l])!==o&&e.node(u).maxRanks||o>t[l].lim));for(u=l,l=n;(l=e.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function V8t(e){var t={},r=0;function n(i){var a=r;ft(e.children(i),n),t[i]={low:a,lim:r++}}return ft(e.children(),n),t}var Q9e=W(()=>{si()});function W8t(e,t){var r={};function n(i,a){var s=0,o=0,l=i.length,u=fm(a);return ft(a,function(h,f){var d=U8t(e,h),p=d?e.node(d).order:l;(d||h===u)&&(ft(a.slice(o,f+1),function(m){ft(e.predecessors(m),function(g){var y=e.node(g),v=y.order;(vu)&&J9e(r,d,h)})})}function i(a,s){var o=-1,l,u=0;return ft(s,function(h,f){if(e.node(h).dummy==="border"){var d=e.predecessors(h);d.length&&(l=e.node(d[0]).order,n(s,u,f,o,l),u=f,o=l)}n(s,u,s.length,l,a.length)}),s}return af(t,i),r}function U8t(e,t){if(e.node(t).dummy)return ib(e.predecessors(t),function(r){return e.node(r).dummy})}function J9e(e,t,r){if(t>r){var n=t;t=r,r=n}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Y8t(e,t,r){if(t>r){var n=t;t=r,r=n}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],r)}function X8t(e,t,r,n){var i={},a={},s={};return ft(t,function(o){ft(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),ft(t,function(o){var l=-1;ft(o,function(u){var h=n(u);if(h.length){h=sf(h,function(g){return s[g]});for(var f=(h.length-1)/2,d=Math.floor(f),p=Math.ceil(f);d<=p;++d){var m=h[d];a[u]===u&&l{si();qc();Wf()});function r_e(e){e=GR(e),rAt(e),cG(e_e(e),function(t,r){e.node(r).x=t})}function rAt(e){var t=tg(e),r=e.graph().ranksep,n=0;ft(t,function(i){var a=Hl(Kn(i,function(s){return e.node(s).height}));ft(i,function(s){e.node(s).y=n+a/2}),n+=a+r})}var n_e=W(()=>{si();Wf();t_e()});function lC(e,t){var r=t&&t.debugTiming?KAe:ZAe;r("layout",()=>{var n=r(" buildLayoutGraph",()=>dAt(e));r(" runLayout",()=>nAt(n,r)),r(" updateInputGraph",()=>iAt(e,n))})}function nAt(e,t){t(" makeSpaceForEdgeLabels",()=>pAt(e)),t(" removeSelfEdges",()=>TAt(e)),t(" acyclic",()=>VAe(e)),t(" nestingGraph.run",()=>A9e(e)),t(" rank",()=>tX(GR(e))),t(" injectEdgeLabelProxies",()=>mAt(e)),t(" removeEmptyRanks",()=>XAe(e)),t(" nestingGraph.cleanup",()=>R9e(e)),t(" normalizeRanks",()=>YAe(e)),t(" assignRankMinMax",()=>gAt(e)),t(" removeEdgeLabelProxies",()=>yAt(e)),t(" normalize.run",()=>s9e(e)),t(" parentDummyChains",()=>Z9e(e)),t(" addBorderSegments",()=>JAe(e)),t(" order",()=>j9e(e)),t(" insertSelfEdges",()=>CAt(e)),t(" adjustCoordinateSystem",()=>r9e(e)),t(" position",()=>r_e(e)),t(" positionSelfEdges",()=>SAt(e)),t(" removeBorderNodes",()=>kAt(e)),t(" normalize.undo",()=>o9e(e)),t(" fixupEdgeLabelCoords",()=>bAt(e)),t(" undoCoordinateSystem",()=>n9e(e)),t(" translateGraph",()=>vAt(e)),t(" assignNodeIntersects",()=>xAt(e)),t(" reversePoints",()=>wAt(e)),t(" acyclic.undo",()=>WAe(e))}function iAt(e,t){ft(e.nodes(),function(r){var n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,t.children(r).length&&(n.width=i.width,n.height=i.height))}),ft(e.edges(),function(r){var n=e.edge(r),i=t.edge(r);n.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}function dAt(e){var t=new qn({multigraph:!0,compound:!0}),r=aX(e.graph());return t.setGraph(sb({},sAt,iX(r,aAt),ty(r,oAt))),ft(e.nodes(),function(n){var i=aX(e.node(n));t.setNode(n,rG(iX(i,lAt),cAt)),t.setParent(n,e.parent(n))}),ft(e.edges(),function(n){var i=aX(e.edge(n));t.setEdge(n,sb({},hAt,iX(i,uAt),ty(i,fAt)))}),t}function pAt(e){var t=e.graph();t.ranksep/=2,ft(e.edges(),function(r){var n=e.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function mAt(e){ft(e.edges(),function(t){var r=e.edge(t);if(r.width&&r.height){var n=e.node(t.v),i=e.node(t.w),a={rank:(i.rank-n.rank)/2+n.rank,e:t};Vf(e,"edge-proxy",a,"_ep")}})}function gAt(e){var t=0;ft(e.nodes(),function(r){var n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Hl(t,n.maxRank))}),e.graph().maxRank=t}function yAt(e){ft(e.nodes(),function(t){var r=e.node(t);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function vAt(e){var t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=e.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var h=u.x,f=u.y,d=u.width,p=u.height;t=Math.min(t,h-d/2),r=Math.max(r,h+d/2),n=Math.min(n,f-p/2),i=Math.max(i,f+p/2)}ft(e.nodes(),function(u){l(e.node(u))}),ft(e.edges(),function(u){var h=e.edge(u);Object.prototype.hasOwnProperty.call(h,"x")&&l(h)}),t-=s,n-=o,ft(e.nodes(),function(u){var h=e.node(u);h.x-=t,h.y-=n}),ft(e.edges(),function(u){var h=e.edge(u);ft(h.points,function(f){f.x-=t,f.y-=n}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=t),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=n)}),a.width=r-t+s,a.height=i-n+o}function xAt(e){ft(e.edges(),function(t){var r=e.edge(t),n=e.node(t.v),i=e.node(t.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=i,s=n),r.points.unshift(FY(n,a)),r.points.push(FY(i,s))})}function bAt(e){ft(e.edges(),function(t){var r=e.edge(t);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function wAt(e){ft(e.edges(),function(t){var r=e.edge(t);r.reversed&&r.points.reverse()})}function kAt(e){ft(e.nodes(),function(t){if(e.children(t).length){var r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),a=e.node(fm(r.borderLeft)),s=e.node(fm(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),ft(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function TAt(e){ft(e.edges(),function(t){if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function CAt(e){var t=tg(e);ft(t,function(r){var n=0;ft(r,function(i,a){var s=e.node(i);s.order=a+n,ft(s.selfEdges,function(o){Vf(e,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function SAt(e){ft(e.nodes(),function(t){var r=e.node(t);if(r.dummy==="selfedge"){var n=e.node(r.e.v),i=n.x+n.width/2,a=n.y,s=r.x-i,o=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function iX(e,t){return J1(ty(e,t),Number)}function aX(e){var t={};return ft(e,function(r,n){t[n.toLowerCase()]=r}),t}var aAt,sAt,oAt,lAt,cAt,uAt,hAt,fAt,i_e=W(()=>{si();qc();e9e();a9e();BY();VY();rX();L9e();K9e();Q9e();n_e();Wf();aAt=["nodesep","edgesep","ranksep","marginx","marginy"],sAt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},oAt=["acyclicer","ranker","rankdir","align"],lAt=["width","height"],cAt={width:0,height:0},uAt=["minlen","weight","width","height","labeloffset"],hAt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},fAt=["labelpos"]});var sX=W(()=>{BY();i_e();VY();rX()});var c_e={};Tr(c_e,{getEdgesToRender:()=>o_e,render:()=>LAt});var a_e,s_e,EAt,AAt,_At,RAt,o_e,l_e,LAt,u_e=W(()=>{DY();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();sX();MY();qc();a_e=b((e,t,r)=>Math.max(t,Math.min(r,e)),"clamp"),s_e=b((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),EAt=b(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram","shouldMergeSelfLoopSegments"),AAt=b((e,t,r,n,i)=>{let a=[],s=new Set;if(r.forEach(({start:h,end:f})=>{h!==n&&s.add(h),f!==n&&s.add(f)}),s.forEach(h=>{let f=e.node(h);typeof f?.x=="number"&&typeof f?.y=="number"&&a.push(f)}),a.length===0&&r.forEach(({edge:h})=>{(h.points??[]).forEach(f=>{typeof f?.x=="number"&&typeof f?.y=="number"&&a.push(f)})}),a.length===0)return s_e(i);let o=a.reduce((h,f)=>({x:h.x+f.x/a.length,y:h.y+f.y/a.length}),{x:0,y:0}),l=o.x-t.x,u=o.y-t.y;return Math.abs(l)>Math.abs(u)?l>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":s_e(i)},"getSelfLoopSide"),_At=b((e,t="top",r=0,n=0)=>{let i=e.x,a=e.y-r,s=e.width/2,o=e.height/2,l=Math.max(36,Math.min(100,e.width*.8)),u=a_e(Math.max(n,e.width*.35),36,l),h=a_e(Math.min(e.width,e.height)*.45,24,48);switch(t){case"bottom":{let f=a+o;return[{x:i-u/2,y:f},{x:i-u/2,y:f+h},{x:i+u/2,y:f+h},{x:i+u/2,y:f}]}case"right":{let f=i+s;return[{x:f,y:a-u/2},{x:f+h,y:a-u/2},{x:f+h,y:a+u/2},{x:f,y:a+u/2}]}case"left":{let f=i-s;return[{x:f,y:a-u/2},{x:f-h,y:a-u/2},{x:f-h,y:a+u/2},{x:f,y:a+u/2}]}default:{let f=a-o;return[{x:i-u/2,y:f},{x:i-u/2,y:f-h},{x:i+u/2,y:f-h},{x:i+u/2,y:f}]}}},"getSelfLoopPoints"),RAt=b((e,t,r="top",n=0,i={})=>{let s=e.x,o=e.y-n,l=i.width??0,u=i.height??0;switch(r){case"bottom":return{x:s,y:Math.max(...t.map(h=>h.y))+u/2+4};case"right":return{x:Math.max(...t.map(h=>h.x))+l/2+4,y:o};case"left":return{x:Math.min(...t.map(h=>h.x))-l/2-4,y:o};default:return{x:s,y:Math.min(...t.map(h=>h.y))-u/2-4}}},"getSelfLoopLabelPosition"),o_e=b((e,t=0,{mergeSelfLoops:r=!0}={})=>{let n=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(s=>{let o=e.edge(s);if(r&&o.selfLoop){let l=o.selfLoop.id;n.has(l)||n.set(l,[]),n.get(l).push({edge:o,start:s.v,end:s.w})}else i.push({edge:o,start:s.v,end:s.w})}),n.forEach(s=>{if(s.length!==3){s.forEach(v=>i.push(v));return}s.sort((v,x)=>v.edge.selfLoop.order-x.edge.selfLoop.order);let[o,l,u]=s,h=o.edge.originalEdge??l.edge.originalEdge??u.edge.originalEdge??l.edge,f=e.node(h.start);if(!f){s.forEach(v=>i.push(v));return}let d={width:l.edge.width,height:l.edge.height},p=AAt(e,f,s,h.start,a),m=_At(f,p,t,d.width??0),g=RAt(f,m,p,t,d),y={...l.edge,...h,id:h.id,points:m,start:h.start,end:h.end,x:g.x,y:g.y,width:d.width,height:d.height,labelStyle:l.edge.labelStyle,fromCluster:o.edge.fromCluster??l.edge.fromCluster??u.edge.fromCluster,toCluster:o.edge.toCluster??l.edge.toCluster??u.edge.toCluster};delete y.selfLoop,delete y.originalEdge,i.push({edge:y,start:y.start,end:y.end})}),i},"getEdgesToRender"),l_e=b(async(e,t,r,n,i,a)=>{se.warn("Graph in recursive render:XAX",bh(t),i);let s=t.graph().rankdir;se.trace("Dir in recursive render - dir:",s);let o=e.insert("g").attr("class","root");t.nodes()?se.info("Recursive render XXX",t.nodes()):se.info("No nodes found for",t),t.edges().length>0&&se.info("Recursive edges",t.edge(t.edges()[0]));let l=o.insert("g").attr("class","clusters"),u=o.insert("g").attr("class","edgePaths"),h=o.insert("g").attr("class","edgeLabels"),f=o.insert("g").attr("class","nodes"),d=EAt(r);await Promise.all(t.nodes().map(async function(x){let w=t.node(x);if(i!==void 0){let C=JSON.parse(JSON.stringify(i.clusterData));se.trace(`Setting data for parent cluster XXX Node.id = `,x,` data=`,C.height,` -Parent cluster`,i.height),t.setNode(i.id,C),t.parent(x)||(se.trace("Setting parent",x,i.id),t.setParent(x,i.id,C))}if(se.info("(Insert) Node XXX"+x+": "+JSON.stringify(t.node(x))),w?.clusterNode){se.info("Cluster identified XBX",x,w.width,t.node(x));let{ranksep:C,nodesep:T}=t.graph();w.graph.setGraph({...w.graph.graph(),ranksep:C+25,nodesep:T});let k=await s_e(f,w.graph,r,n,t.node(x),a),S=k.elem;gr(w,S),w.diff=k.diff||0,se.info("New compound node after recursive render XAX",x,"width",w.width,"height",w.height),vAe(S,w)}else t.children(x).length>0?(se.trace("Cluster - the non recursive path XBX",x,w.id,w,w.width,"Graph:",t),se.trace(ev(w.id,t)),un.set(w.id,{id:ev(w.id,t),node:w})):(se.trace("Node - the non recursive path XAX",x,f,t.node(x),s),await M0(f,t.node(x),{config:a,dir:s}))})),await b(async()=>{let x=t.edges().map(async function(w){let C=t.edge(w.v,w.w,w.name);if(se.info("Edge "+w.v+" -> "+w.w+": "+JSON.stringify(w)),se.info("Edge "+w.v+" -> "+w.w+": ",w," ",JSON.stringify(t.edge(w))),se.info("Fix",un,"ids:",w.v,w.w,"Translating: ",un.get(w.v),un.get(w.w)),d&&C.selfLoop){if(C.selfLoop.order!==1)return;let T=C.id;C.id=C.selfLoop.id,await Zy(h,C),C.id=T;return}await Zy(h,C)});await Promise.all(x)},"processEdges")(),se.info("Graph before layout:",JSON.stringify(bh(t))),se.info("############################################# XXX"),se.info("### Layout ### XXX"),se.info("############################################# XXX"),lC(t),se.info("Graph after layout:",JSON.stringify(bh(t)));let m=0,{subGraphTitleTotalMargin:g}=yh(a);await Promise.all(OAe(t).map(async function(x){let w=t.node(x);if(se.info("Position XBX => "+x+": ("+w.x,","+w.y,") width: ",w.width," height: ",w.height),w?.clusterNode)w.y+=g,se.info("A tainted cluster node XBX1",x,w.id,w.width,w.height,w.x,w.y,t.parent(x)),un.get(w.id).node=w,Ky(w);else if(t.children(x).length>0){se.info("A pure cluster node XBX1",x,w.id,w.x,w.y,w.width,w.height,t.parent(x)),w.height+=g,t.node(w.parentId);let C=w?.padding/2||0,T=w?.labelBBox?.height||0,k=T-C||0;se.debug("OffsetY",k,"labelHeight",T,"halfPadding",C),await Jm(l,w),un.get(w.id).node=w}else{let C=t.node(w.parentId);w.y+=g/2,se.info("A regular node XBX1 - using the padding",w.id,"parent",w.parentId,w.width,w.height,w.x,w.y,"offsetY",w.offsetY,"parent",C,C?.offsetY,w),Ky(w)}}));let y=g/2;return a_e(t,y,{mergeSelfLoops:d}).forEach(function({edge:x,start:w,end:C}){se.info("Edge "+w+" -> "+C+": "+JSON.stringify(x),x),x.points.forEach(E=>E.y+=y);let T=t.node(w),k=t.node(C),S=b4(u,x,un,r,T,k,n);BR(x,S)}),t.nodes().forEach(function(x){let w=t.node(x);se.info(x,w.type,w.diff),w.isGroup&&(m=w.diff)}),se.warn("Returning from recursive render XAX",o,m),{elem:o,diff:m}},"recursiveRender"),EAt=b(async(e,t)=>{let r=new qn({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),n=t.select("g");w4(n,e.markers,e.type,e.diagramId),DR(),PR(),MR(),$R(),e.nodes.forEach(a=>{r.setNode(a.id,{...a}),a.parentId&&r.setParent(a.id,a.parentId)}),se.debug("Edges:",e.edges),e.edges.forEach(a=>{if(a.start===a.end){let s=a.start,o=s+"---"+s+"---1",l=s+"---"+s+"---2",u=r.node(s);r.setNode(o,{domId:o,id:o,parentId:u.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(o,u.parentId),r.setNode(l,{domId:l,id:l,parentId:u.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(l,u.parentId);let h=structuredClone(a),f=structuredClone(a),d=structuredClone(a),p=structuredClone(a);f.originalEdge=h,f.selfLoop={id:h.id,order:0},d.originalEdge=h,d.selfLoop={id:h.id,order:1},p.originalEdge=h,p.selfLoop={id:h.id,order:2},f.label="",f.arrowTypeEnd="none",f.endLabelLeft="",f.endLabelRight="",f.startLabelLeft="",f.id=s+"-cyclic-special-1",d.startLabelRight="",d.startLabelLeft="",d.endLabelLeft="",d.endLabelRight="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.id=s+"-cyclic-special-mid",p.label="",p.startLabelRight="",p.startLabelLeft="",p.arrowTypeStart="none",u.isGroup&&(f.fromCluster=s,p.toCluster=s),p.id=s+"-cyclic-special-2",p.arrowTypeStart="none",r.setEdge(s,o,f,s+"-cyclic-special-0"),r.setEdge(o,l,d,s+"-cyclic-special-1"),r.setEdge(l,s,p,s+"-cyclic-special-2")}else r.setEdge(a.start,a.end,{...a},a.id)}),se.warn("Graph at first:",JSON.stringify(bh(r))),MAe(r),se.warn("Graph after XAX:",JSON.stringify(bh(r)));let i=Be();await s_e(n,r,e.type,e.diagramId,void 0,i)},"render")});var d_e={};Tr(d_e,{captureNodeSizes:()=>f_e,shouldCaptureSizes:()=>c_e});function aX(){if(!(typeof globalThis>"u"))return globalThis}function c_e(){return!!aX()?.mermaidCaptureSizes}function u_e(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}function h_e(e,t){let r=aX();if(!r)return;let n=t.node(),a=((n&&"ownerSVGElement"in n?n.ownerSVGElement:null)??n)?.id??"(unknown)";r.mermaidCapturedSizes??=[];let s={svgId:a,sizes:e};r.mermaidCapturedSizes.push(s),r.mermaidLastCapturedSizes=s}function f_e(e,t){let r=[];for(let n of t.nodes)n.isGroup||r.push({id:n.id,width:n.width??0,height:n.height??0});r.length!==0&&h_e({metadata:{captureVersion:AAt,capturedAt:new Date().toISOString(),capturedFrom:u_e()},nodes:r},e)}var AAt,p_e=W(()=>{hr();AAt=1;b(aX,"getCaptureGlobal");b(c_e,"shouldCaptureSizes");b(u_e,"capturedFromLocation");b(h_e,"emitCapturedSizes");b(f_e,"captureNodeSizes")});var rLe={};Tr(rLe,{render:()=>tLe});async function w_e(e,t){let r=new qn({multigraph:!0,compound:!0}),n=[...t.edges],i=Be(),a=e.insert("g").attr("class","root"),s=a.insert("g").attr("class","clusters"),o=a.insert("g").attr("class","edges edgePath"),l=a.insert("g").attr("class","edgeLabels"),u=a.insert("g").attr("class","nodes"),h=new Map,f=e.node()!=null;await Promise.all(t.nodes.map(async d=>{if(d.isGroup)r.setNode(d.id,{...d});else{if(f){let p=await M0(u,d,{config:i,dir:d.dir}),m=p.node()?.getBBox()??{width:0,height:0};h.set(d.id,p),d.width=m.width,d.height=m.height}r.setNode(d.id,{...d})}}));for(let d of n)r.setEdge(d.start,d.end,{...d},d.id),t.edges.some(m=>m.id===d.id)||t.edges.push(d);if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:d}=await Promise.resolve().then(()=>(p_e(),d_e));d(e,t)}return{graph:r,groups:{clusters:s,edgePaths:o,edgeLabels:l,nodes:u,rootGroups:a},nodeElements:h}}function QR(e){let t=[];for(let r=0;r=1-UR||d<=UR||d>=1-UR?null:{point:{x:e.x+f*i,y:e.y+f*a},tA:f,tB:d}}function uX(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}function T_e(e){let t=[];for(let r=0;r=Math.abs(r)?t>=0?1:0:r>=0?1:0}function S_e(e,t){if(e.length<2)return e.map(a=>({...a}));let r=e.map(a=>({...a})),n=t.arrowTypeStart&&ns[t.arrowTypeStart];if(n){let a=e[0],s=e[1],o=Math.atan2(s.y-a.y,s.x-a.x);r[0].x=a.x+n*Math.cos(o),r[0].y=a.y+n*Math.sin(o)}let i=t.arrowTypeEnd&&ns[t.arrowTypeEnd];if(i){let a=e.length,s=e[a-2],o=e[a-1],l=Math.atan2(o.y-s.y,o.x-s.x);r[a-1].x=o.x-i*Math.cos(l),r[a-1].y=o.y-i*Math.sin(l)}return r}function E_e(e,t,r,n,i){let a=e.point.x,s=e.point.y,o={x:a-t*e.r,y:s-r*e.r},l={x:a+t*e.r,y:s+r*e.r},u=[`L${T4(o)}`];return i==="arc"?u.push(`A${kh(e.r)},${kh(e.r)} 0 0 ${n} ${T4(l)}`):u.push(`M${T4(l)}`),u}function hX(e,t,r,n){let i=t.x-e.x,a=t.y-e.y,s=r.x-t.x,o=r.y-t.y,l=Math.hypot(i,a),u=Math.hypot(s,o);if(l0){let w=hX(i[u-1],i[u],i[u+1]??i[u],m_e);w&&(g=w.cutLen)}let y=f,v=null;a&&uw.t-C.t);for(let w of x)w.r=Math.min(w.r,w.d-g,y-w.d);for(let w=0;wC){let T=C/2;x[w].r=Math.min(x[w].r,T),x[w+1].r=Math.min(x[w+1].r,T)}}for(let w of x)w.r<_At||l.push(...E_e(w,d,p,m,r.jumpStyle));a&&v?(l.push(`L${kh(v.startX)},${kh(v.startY)}`),l.push(`Q${kh(v.ctrlX)},${kh(v.ctrlY)} ${kh(v.endX)},${kh(v.endY)}`)):l.push(`L${T4(h.b)}`)}return l.join(" ")}function __e(e){return/^[\d\s+,.LMelm-]*$/.test(e)}function R_e(e){return e?e==="linear"||e==="rounded"||e==="step"||e==="stepBefore"||e==="stepAfter":!0}function L_e(e){if(!e)return null;try{let t=typeof atob=="function"?atob(e):Buffer.from(e,"base64").toString(),r=JSON.parse(t);if(!Array.isArray(r))return null;let n=[];for(let i of r)i&&typeof i.x=="number"&&typeof i.y=="number"&&n.push({x:i.x,y:i.y});return n.length>=2?n:null}catch{return null}}function I_e(e,t,r){if(!r.enabled)return;let n=e.node();if(!n)return;let i=new Map;for(let u of t)i.set(u.id,u);let a=[],s=new Map;for(let u of t){let h=typeof CSS<"u"&&CSS.escape?CSS.escape(u.id):u.id,f=n.querySelector(`path[data-id="${h}"]`);if(!f)continue;s.set(u.id,f);let p=L_e(f.getAttribute("data-points"))??u.points;a.push({...u,points:p})}let o=T_e(a);if(o.length===0)return;let l=new Map;for(let u of o){let h=l.get(u.jumpEdgeId)??[];h.push(u),l.set(u.jumpEdgeId,h)}for(let u of a){let h=l.get(u.id);if(!h||h.length===0)continue;let d=i.get(u.id)?.curve;if(d!==void 0&&!R_e(d))continue;let p=s.get(u.id);if(!p)continue;if(d===void 0){let w=p.getAttribute("d")??"";if(!__e(w))continue}let m=p.getAttribute("style")??"",g=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(m),y=g?Number.parseFloat(g[1]):null,v=g?Number.parseFloat(g[2]):null,x=A_e(u,h,r);if(p.setAttribute("d",x),y!==null&&v!==null&&typeof p.getTotalLength=="function"){let w=p.getTotalLength(),C=Math.max(0,w-y-v),T=`0 ${y} ${C} ${v}`,k=m.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${T};`).replace(/;\s*;+/g,";");p.setAttribute("style",k)}}}async function M_e(e,t){for(let i of e.nodes)i.isGroup?await Jm(t.clusters,i):Ky(i);let r=new Map;for(let i of e.nodes)i?.id&&r.set(i.id,i);for(let i of e.edges){let a=i.start?r.get(i.start)??{}:{},s=i.end?r.get(i.end)??{}:{},o=b4(t.edgePaths,{...i},{},e.type,a,s,e.diagramId);i.label&&await Zy(t.rootGroups,i),i.label&&N_e(i,o)}let n=e.config?.swimlane?.lineHops;if(n!==!1){let i=n==="gap"?"gap":"arc",a=e.edges.filter(s=>Array.isArray(s.points)&&s.points.length>=2).map(s=>({id:s.id,points:s.points,curve:s.curve,arrowTypeStart:s.arrowTypeStart,arrowTypeEnd:s.arrowTypeEnd}));I_e(t.edgePaths,a,{enabled:!0,jumpRadius:6,jumpStyle:i})}}function N_e(e,t){let r=t?.updatedPath??t?.originalPath,n=qt(),{subGraphTitleTotalMargin:i}=yh({flowchart:n.flowchart??{}});if(e.label){let a=x4.get(e.id),s=e.x,o=e.y;if(r){let l=pr.calcLabelPosition(r);se.debug("Moving label "+e.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),t&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(e?.startLabelLeft){let a=Aa.get(e.id).startLeft,s=e?.x,o=e?.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.startLabelRight){let a=Aa.get(e.id).startRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelLeft){let a=Aa.get(e.id).endLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelRight){let a=Aa.get(e.id).endRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}}function fX(e){return Math.max(e.padding??g_e,g_e)}function D_e(e){let{x:t,y:r,width:n,height:i}=e,a=e.swimlaneContentTop;if(typeof t!="number"||typeof r!="number"||typeof n!="number"||typeof i!="number"||typeof a!="number"||!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(a)||n<=0||i<=0){delete e.groupTitleRect;return}let s=r-i/2,o=Math.min(a,r+i/2),l=Math.min(RAt,Math.max(0,o-s)),u=s+l;if(u<=s){delete e.groupTitleRect;return}e.groupTitleRect={left:t-n/2,right:t+n/2,top:s,bottom:u}}function O_e(e){let t=e.direction,r=e.nodes??=[];for(let a of e.nodes??[])a.isGroup&&!a.parentId&&(a.shape="swimlane",t&&(a.direction=t));let n=r.filter(a=>!a.isGroup&&!a.parentId);if(n.length===0)return;let i=r.find(a=>a.id===sX);i?i.isGroup&&(i.shape="swimlane",t&&(i.direction=t)):(i={id:sX,label:"",isGroup:!0,shape:"swimlane",padding:20,...t?{direction:t}:{}},r.push(i));for(let a of n)a.parentId=sX}function P_e(e){let t=new Map;for(let l of e.nodes??[])t.set(l.id,l);let r=[];for(let l of e.edges??[]){let u=typeof l.start=="string"?l.start:void 0,h=typeof l.end=="string"?l.end:void 0;!u||!h||l.labelNodeId||r.push({id:l.id,src:u,dst:h,ref:l})}let n=e.nodes??[],i=n.filter(l=>l.isGroup),a=n.filter(l=>!l.isGroup);return{nodes:[...[...i].reverse(),...a].map(l=>l.id),edges:r,layout:e,nodeById:t}}function B_e(e,t,r,n){let{layout:i}=e,a=e.nodeById,s=n?.layerGap??100,o=n?.nodeGap??40,l=0;for(let d of t.layers){let p=0;for(let m of d){let g=a.get(m);if(!g){p++;continue}g.layer=l,g.order=p;let y=r.x[m]??p*o,v=r.y[m]??l*s;g.x=y,g.y=v,p++}l++}let u=i.nodes??[],h=new Map,f=[];for(let d of u){if(!d?.isGroup)continue;d.parentId||f.push(d);let p=u.filter(x=>x.parentId===d.id),m=1/0,g=-1/0,y=1/0,v=-1/0;for(let x of p){let w=x.x??r.x[x.id],C=x.y??r.y[x.id],T=x.width??0,k=x.height??0;w!=null&&C!=null&&(m=Math.min(m,w-T/2),g=Math.max(g,w+T/2),y=Math.min(y,C-k/2),v=Math.max(v,C+k/2))}if(m===1/0||y===1/0)d.x=d.x??0,d.y=d.y??0,d.width=d.width??0,d.height=d.height??0;else{let x=d.padding??20,w=d.parentId?x:2*fX(d),C=x,T=Math.max(0,g-m)+w,k=Math.max(0,v-y)+C,S=(m+g)/2,E=(y+v)/2;d.x=S,d.y=E,d.width=T,d.height=k,h.set(d.id,{minX:m,maxX:g,minY:y,maxY:v})}}if(f.length>0&&h.size>0){let d=1/0,p=-1/0,m=0;for(let g of f){let y=g.padding??20;y>m&&(m=y);let v=h.get(g.id);v&&(d=Math.min(d,v.minY),p=Math.max(p,v.maxY))}if(d!==1/0&&p!==-1/0){let g=Math.max(0,p-d),v=Math.max(m,36),x=g+2*v,w=(d+p)/2;for(let I of f)I.y=w,I.height=x,I.swimlaneContentTop=d;let C=[...f].sort((I,L)=>{let O=I.x??0,R=L.x??0;return O-R}),T=[],k=[],S=[];for(let I of C){let L=h.get(I.id);if(!L)continue;let O=Math.max(0,L.maxX-L.minX)+2*fX(I),R=(L.minX+L.maxX)/2;T.push(I.id),k.push(R),S.push(O)}let E=T.length;if(E>0){let I=new Map;if(E===1)I.set(T[0],S[0]);else{let L=[];for(let M=0;M0&&i>0?{cx:t,cy:r,rect:C4(t,r,n,i)}:void 0}function WX(e){if(e.isGroup)return;let t=VX(e);return t?{id:String(e.id??""),cx:t.cx,cy:t.cy,rect:t.rect}:void 0}function Lu(e,t,r=zs){return Math.abs(e.x-t.x)r}function Ra(e,t,r=zs){return Nn(e,t,r)&&Math.abs(e.y-t.y)>r}function xl(e,t,r,n){return Math.max(0,Math.min(Math.max(e,t),Math.max(r,n))-Math.max(Math.min(e,t),Math.min(r,n)))}function Hf(e,t,r=zs){return e.horizontal&&t.horizontal&&Pn(e.a,t.a,r)?xl(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&Nn(e.a,t.a,r)?xl(e.a.y,e.b.y,t.a.y,t.b.y):0}function S4(e,t=zs){let r=[];for(let n=0;n0?r[r.length-1]:void 0;(!i||!Lu(i,n,t))&&r.push({x:n.x,y:n.y})}return r}function HX(e,t=zs){if(!e||e.length!==4)return;let[r,n,i,a]=e;return _a(r,n,t)&&Ra(n,i,t)&&_a(i,a,t)?{kind:"HVH",p0:r,p1:n,p2:i,p3:a}:Ra(r,n,t)&&_a(n,i,t)&&Ra(i,a,t)?{kind:"VHV",p0:r,p1:n,p2:i,p3:a}:void 0}function lL(e,t,r,n=0){let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),s=Math.min(e.y,t.y),o=Math.max(e.y,t.y);return a>r.left-n&&ir.top-n&&st.left+r&&e.xt.top+r&&e.y=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function JR(e,t){return e.leftt.left&&e.topt.top}function dX(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function C4(e,t,r,n){return{left:e-r/2,right:e+r/2,top:t-n/2,bottom:t+n/2}}function tc(e){return VX(e)?.rect}function iv(e,t){switch(t){case"top":return{x:e.cx,y:e.rect.top};case"bottom":return{x:e.cx,y:e.rect.bottom};case"left":return{x:e.rect.left,y:e.cy};case"right":return{x:e.rect.right,y:e.cy}}}function YX(e,t,r,n,i,a=zs){let s=t==="left"||t==="right",o=n==="left"||n==="right";if(s&&o){if(t==="right"&&n==="left"&&e.xr.x){if(Pn(e,r,a))return[e,r];let f=(e.x+r.x)/2;return[e,{x:f,y:e.y},{x:f,y:r.y},r]}if(t===n){if(Pn(e,r,a))return;let f=t==="left"?Math.min(e.x,r.x)-i:Math.max(e.x,r.x)+i;return[e,{x:f,y:e.y},{x:f,y:r.y},r]}return}if(!s&&!o){if(t===n){if(Nn(e,r,a))return;let d=t==="top"?Math.min(e.y,r.y)-i:Math.max(e.y,r.y)+i;return[e,{x:e.x,y:d},{x:r.x,y:d},r]}if(!(t==="bottom"&&n==="top"&&e.yr.y))return;if(Nn(e,r,a))return[e,r];let f=(e.y+r.y)/2;return[e,{x:e.x,y:f},{x:r.x,y:f},r]}if(s&&!o){let h=t==="right"&&r.x>e.x||t==="left"&&r.xr.y;return h&&f?[e,{x:r.x,y:e.y},r]:void 0}let l=t==="bottom"&&r.y>e.y||t==="top"&&r.yr.x;return l&&u?[e,{x:e.x,y:r.y},r]:void 0}function XX(e,t,r,n){return t==="left"||t==="right"?[e,{x:n,y:e.y},{x:n,y:r.y},r]:[e,{x:e.x,y:n},{x:r.x,y:n},r]}function cL(e){let t=new Map,r=[];for(let n of e){if(n.isEdgeLabel)continue;let i=WX(n);i&&(t.set(i.id,i),r.push({id:i.id,rect:i.rect}))}return{nodeInfoById:t,realNodeRects:r}}function ag(e){let t=[],r=[];for(let n of e){let i=WX(n);if(!i)continue;let a={id:i.id,rect:i.rect};n.isEdgeLabel?r.push(a):t.push(a)}return{realNodeRects:t,labelNodeRects:r}}function z_e(e,{includeEdgeLabels:t=!0}={}){let r=[];for(let n of e){if(n.isGroup||!t&&n.isEdgeLabel)continue;let i=n.x??0,a=n.y??0,s=n.width??0,o=n.height??0;r.push({nodeId:n.id,...C4(i,a,s,o)})}return r}function jX(e,t,r=zs){let n=e.start,i=e.end;if(!n||!i)return;let a=t.get(n),s=t.get(i);if(!(!a||!s))return{srcId:n,dstId:i,srcInfo:a,dstInfo:s,collinearX:Math.abs(a.cx-s.cx)m||dv)return!1;let x=Math.abs(g-h.a.x)i:a&&o&&Pn(e,r,i)?xl(e.x,t.x,r.x,n.x)>i:!1}function eL(e,t,r,n,{epsilon:i=zs,skipDegenerateOther:a=!1}={}){for(let s of r){if(s===n||s.isLayoutOnly)continue;let o=s.points;if(!(!o||o.length<2))for(let l=0;ld+i&&mg+i&&fn+zs&&e=2?t[t.length-2]:void 0,l=(s?Nn(s,i):!1)?{x:i.x,y:a.y}:{x:a.x,y:i.y};t.push(l)}t.push(a)}let r=[];for(let n of t){let i=r[r.length-1];(!i||!Lu(i,n))&&r.push(n)}return r}function Uf(e){if(e.length<3)return e;let t=[...e];for(let r=0;r<32;r++){let n=V_e(t);if(t=n.points,!n.changed)break}return t}function ZX(e,t,r){let n=e;if(n.isLayoutOnly||!n.points||n.points.length=0&&i=e.length)return e;let a=i-n;if(a<0||a>=e.length)return e;let s=W_e(e[i],e[a],t);return r?[s,...e.slice(i)]:[...e.slice(0,i+1),s]}function H_e(e,t){for(let r of e){let n=ZX(r,t,2);if(!n)continue;let i=[...n.points];n.srcRect&&(i=mX(i,n.srcRect,!0)),n.dstRect&&(i=mX(i,n.dstRect,!1)),i=Uf(tL(i)),i=QX(i,n.srcRect,n.dstRect),n.edge.points=Uf(tL(i))}}function gX(e,t,r,n=!1){if(Pn(e,t,Xr)){if(t.yr.bottom+Xr)return t;if(n){if(e.xr.right+Xr)return{x:r.right,y:e.y}}return{x:Math.abs(t.x-r.left)<=Math.abs(t.x-r.right)?r.left:r.right,y:e.y}}if(Nn(e,t,Xr)){if(t.xr.right+Xr)return t;if(n){if(e.yr.bottom+Xr)return{x:e.x,y:r.bottom}}let i=Math.abs(t.y-r.top)<=Math.abs(t.y-r.bottom);return{x:e.x,y:i?r.top:r.bottom}}return t}function rL(e,t,r){let n=e[t];for(let i=t+r;i>=0&&in.lo)),r=Math.min(...e.map(n=>n.hi));if(!(t>r))return{lo:t,hi:r}}function vX(e,t){return t==="left"||t==="right"?nL(e.top,e.bottom):nL(e.left,e.right)}function iL(e,t,r){let n=e.y>=r.top-Xr&&e.y<=r.bottom+Xr,i=e.x>=r.left-Xr&&e.x<=r.right+Xr;if(Pn(e,t,Xr)&&n){if(Math.abs(e.x-r.left)0?U_e(a):void 0}function xX(e,t,r,n,i){let a=Y_e(e,t,r,n,i);if(!a)return;let s=i?e.y:e.x,o=Math.min(a.hi,Math.max(a.lo,s));if(!(Math.abs(o-s)({...o}));for(let o=t;o>=0&&o=r.left-Xr&&Math.max(e.x,t.x)<=r.right+Xr,i=Math.min(e.y,t.y)>=r.top-Xr&&Math.max(e.y,t.y)<=r.bottom+Xr;if(Math.abs(e.y-r.top)n.bottom+Xr;case"left":return Pn(t,r,Xr)&&r.xn.right+Xr}}function TX(e,t,r){if(e.length<3)return e;if(r){let a=wX(e[0],e[1],t);return a&&kX(a,e[1],e[2],t)?e.slice(1):e}let n=e.length-1,i=wX(e[n-1],e[n],t);return i&&kX(i,e[n-1],e[n-2],t)?e.slice(0,n):e}function K_e(e,t,r){let n=e;if(t){let a=rL(n,0,1);if(a){let s=gX(a,n[0],t);s!==n[0]&&(n=[s,...n.slice(1)])}n=TX(n,t,!0)}if(r){let a=n.length-1,s=rL(n,a,-1);if(s){let o=gX(s,n[a],r,!0);o!==n[a]&&(n=[...n.slice(0,a),o])}n=TX(n,r,!1)}let i=QX(n,t,r);return i!==n||n.length===2?i:(t&&(n=bX(n,t,!0)),r&&(n=bX(n,r,!1)),n)}function CX(e,t){for(let r of e){let n=ZX(r,t,2);if(!n)continue;let i=Vn(n.points,Xr),a=K_e(i,n.srcRect,n.dstRect);if(a.length<3){n.edge.points=a;continue}let s=[a[0],{...a[0]},...a.slice(1,-1),a[a.length-1],{...a[a.length-1]}];n.edge.points=s}}function JX(e){return new Map(e.map(t=>[t.id,t]))}function Z_e(e,t){let r=e.parentId,n=null;for(;r;){let i=t.get(r);if(!i?.isGroup)break;n=i.id,r=i.parentId}return n}function SX(e,t){let r=0,n=e.parentId;for(;n;){let i=t.get(n);if(!i?.isGroup)break;r++,n=i.parentId}return r}function ej(e){let t=1/0,r=-1/0,n=1/0,i=-1/0;for(let a of e){let s=a.x,o=a.y;if(typeof s!="number"||typeof o!="number")continue;let l=a.width??0,u=a.height??0;t=Math.min(t,s-l/2),r=Math.max(r,s+l/2),n=Math.min(n,o-u/2),i=Math.max(i,o+u/2)}return t===1/0||n===1/0?null:{minX:t,maxX:r,minY:n,maxY:i}}function Q_e(e,t){let r=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+r,e.height=Math.max(0,t.maxY-t.minY)+r}function J_e(e){let t=JX(e),r=e.filter(n=>n.isGroup&&n.parentId).sort((n,i)=>SX(i,t)-SX(n,t));for(let n of r){let i=e.filter(s=>s.parentId===n.id),a=ej(i);a&&Q_e(n,a)}}function aL(e,t){let r=e.nodes??[],n=e.edges??[],i=r.filter(l=>!l.isGroup),a=1/0,s=-1/0;for(let l of i){let u=l[t];typeof u=="number"&&(a=Math.min(a,u),s=Math.max(s,u))}if(!Number.isFinite(a)||!Number.isFinite(s))return!1;let o=b(l=>a+s-l,"mirror");for(let l of r){let u=l[t];typeof u=="number"&&(l[t]=o(u));let h=l.groupTitleRect;h&&(l.groupTitleRect=t==="x"?{...h,left:o(h.right),right:o(h.left)}:{...h,top:o(h.bottom),bottom:o(h.top)})}for(let l of n)for(let u of l.points??[])u[t]=o(u[t]);return!0}function eRe(e){return(e.nodes??[]).some(r=>!r.isGroup)?aL(e,"y"):!0}function tRe(e,t="LR"){let r=e.nodes??[],n=e.edges??[],i=r.filter(A=>!A.isGroup),a=1/0,s=1/0;for(let A of i){let N=A.x??0,M=A.y??0;N0?Math.max(1,h/f):1;for(let A of i){let N=A.x??0,D=((A.y??0)-s)*d+o,B=N-a;A.x=D,A.y=B}for(let A of n)if(A.points)for(let N of A.points){let M=N.x,B=(N.y-s)*d+o,P=M-a;N.x=B,N.y=P}J_e(r);let p=r.filter(A=>A.isGroup&&!A.parentId);if(p.length===0)return t==="RL"&&aL(e,"x"),!0;let m=JX(r),g=new Map;for(let A of r){if(A.isGroup)continue;let N=Z_e(A,m);if(!N)continue;let M=g.get(N)??[];M.push(A),g.set(N,M)}let y=0;for(let A of p){let N=A.padding??0;N>y&&(y=N)}let v=[],x=1/0,w=-1/0;for(let A of p){let N=g.get(A.id)??[],M=ej(N);M&&(x=Math.min(x,M.minX),w=Math.max(w,M.maxX),v.push({lane:A,contentTop:M.minY,contentBottom:M.maxY,centerY:(M.minY+M.maxY)/2}))}if(x===1/0||w===-1/0)return!0;let C=Math.max(0,w-x),T=Math.max(y,10),k=C+2*T,S=o+k,L=(x+w)/2-k/2-o,O=L+S/2,R=Math.max(y,o);v.sort((A,N)=>A.centerY-N.centerY);for(let A=0;Ad.cy?v.bottom:v.top,R=d.cx+x;if(R<=v.left+wh||R>=v.right-wh)continue;w={x:R,y:O},C={x:R,y:o.y},T={x:o.x,y:o.y}}else{let O=p.cx>d.cx?v.right:v.left,R=d.cy+x;if(R<=v.top+wh||R>=v.bottom-wh)continue;w={x:O,y:R},C={x:o.x,y:R},T={x:o.x,y:o.y}}let k=Lu(w,C,wh),S=Lu(C,T,wh);if(k&&S||!k&&qa(w,C,n,[h],1)||!S&&qa(C,T,n,[f],1))continue;let E=!k&&eL(w,C,e,i,{epsilon:wh,skipDegenerateOther:!0}),I=!S&&eL(C,T,e,i,{epsilon:wh,skipDegenerateOther:!0});if(!(E||I)){k?y=[C,T]:S?y=[w,C]:y=[w,C,T];break}}y&&(i.points=y)}}function nRe(e,t){let{realNodeRects:a,labelNodeRects:s}=ag(t.values());for(let o of e){if(o.isLayoutOnly)continue;let l=o.points;if(!l||l.length<4)continue;let u=Vn(l,.001);if(u.length<4)continue;let h=u.length-1,f=u[h],d=u[h-1],p=u[h-2],m=f.x-d.x,g=f.y-d.y,y=Math.hypot(m,g);if(y>=10||y<.001)continue;let v=d.x-p.x,x=d.y-p.y;if(Math.hypot(v,x)<.001)continue;let C=_a(d,f,.001),T=Ra(d,f,.001),k=_a(p,d,.001),S=Ra(p,d,.001);if(!(C&&S||T&&k))continue;let E=o.end,I=o.start,L=E?t.get(E):void 0;if(!L)continue;let O=L.x??0,R=L.y??0,A=tc(L);if(!A)continue;let N,M;if(S){let G=x<0;N={x:O,y:p.y},M={x:O,y:G?A.bottom:A.top}}else{let G=v>0;N={x:p.x,y:R},M={x:G?A.right:A.left,y:R}}if(qa(N,M,a,E?[E]:[],-2)||qa(N,M,s,[],-2))continue;if(I){let G=t.get(I),z=G?tc(G):void 0;if(z&&UX(N,z,2))continue}let D=b((G,z)=>`${G.x.toFixed(3)},${G.y.toFixed(3)}|${z.x.toFixed(3)},${z.y.toFixed(3)}`,"ownSegmentKey"),B=new Set;for(let G=0;G{for(let H of e){if(H===o||H.isLayoutOnly)continue;let j=H.points;if(!(!j||j.length<2))for(let J=0;J=0){let G=u[h-3],z=[I,E].filter(H=>!!H);if(qa(G,N,a,z,-2)||P(G,N))continue}let F=[...u.slice(0,h-2),N,M];o.points=F;let q=o.labelNodeId;if(q){let G=t.get(q);if(G){let z=G.width??0,H=G.height??0;if(z>0&&H>0){let j,J,U=-1;for(let le=0;le=z+2||Re&&ae>=H+2)&&ae>U&&(U=ae,j=(ee.x+ue.x)/2,J=(ee.y+ue.y)/2)}j!==void 0&&J!==void 0&&(G.x=j,G.y=J)}}}}}function iRe(e,t){let i=b((p,m)=>{let g=p.x??0,y=p.y??0,v=m.x-g,x=m.y-y,w=(p.width??0)/2,C=(p.height??0)/2;return Math.abs(x)*w>Math.abs(v)*C?(x<0&&(C=-C),{x:g+(x===0?0:C*v/x),y:y+C}):(v<0&&(w=-w),{x:g+w,y:y+(v===0?0:w*x/v)})},"rectIntersect"),a=b((p,m)=>{let g=Vn(p.points??[]);if(g.length<2)return;let y=m?p.start:p.end,v=y?t.get(y):void 0,x=v?tc(v):void 0;if(!v||!y||!x)return;let w=m?g[0]:g[g.length-1],C=m?g[1]:g[g.length-2],T=i(v,w),k=w;if(oX(C,T)&&(k=C),Nn(T,k,mr))return{edge:p,edgeId:String(p.id??""),nodeId:y,atStart:m,orientation:"V",coord:T.x,min:Math.min(T.y,k.y),max:Math.max(T.y,k.y),boundary:T,railEnd:k,rect:x};if(Pn(T,k,mr))return{edge:p,edgeId:String(p.id??""),nodeId:y,atStart:m,orientation:"H",coord:T.y,min:Math.min(T.x,k.x),max:Math.max(T.x,k.x),boundary:T,railEnd:k,rect:x}},"terminalLaneFor"),s=b((p,m)=>Math.max(0,Math.min(p.max,m.max)-Math.max(p.min,m.min)),"projectedOverlapLength"),o=b((p,m)=>p.nodeId!==m.nodeId||p.orientation!==m.orientation?!1:p.orientation==="H"?(Math.abs(p.boundary.x-p.rect.left)<1||Math.abs(p.boundary.x-p.rect.right)<1)&&Nn(p.boundary,m.boundary,1):(Math.abs(p.boundary.y-p.rect.top)<1||Math.abs(p.boundary.y-p.rect.bottom)<1)&&Pn(p.boundary,m.boundary,1),"sameTerminalFace"),l=b((p,m)=>p.nodeId!==m.nodeId||p.orientation!==m.orientation?!1:s(p,m)>=$s&&Math.abs(p.coord-m.coord)<.5,"exactTerminalLaneConflict"),u=b((p,m)=>{if(p.nodeId!==m.nodeId||p.orientation!==m.orientation||p.orientation!=="H"||p.atStart===m.atStart)return!1;let g=s(p,m);if(g<$s)return!1;let y=p.rect.bottom-p.rect.top;return g2*y?!1:o(p,m)&&Math.abs(p.coord-m.coord)<16},"nearTerminalLaneConflict"),h=b((p,m)=>{let g=Vn(p.edge.points??[]);if(g.length<2)return;let y=p.orientation==="V"?{x:p.boundary.x+m,y:p.boundary.y}:{x:p.boundary.x,y:p.boundary.y+m},v=p.orientation==="V"?{x:p.railEnd.x+m,y:p.railEnd.y}:{x:p.railEnd.x,y:p.railEnd.y+m};if(!b(()=>Math.abs(p.boundary.y-p.rect.top)<1||Math.abs(p.boundary.y-p.rect.bottom)<1?Pn(y,p.boundary,mr)&&y.x>=p.rect.left+1&&y.x<=p.rect.right-1:Math.abs(p.boundary.x-p.rect.left)<1||Math.abs(p.boundary.x-p.rect.right)<1?Nn(y,p.boundary,mr)&&y.y>=p.rect.top+1&&y.y<=p.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(p.atStart){let k=g.length>1&&Lu(g[1],p.railEnd,mr),S=g.slice(k?2:1),E=S[0];return E&&!oX(E,v)?void 0:[y,v,...S]}let w=g.length>1&&Lu(g[g.length-2],p.railEnd,mr),C=g.slice(0,w?-2:-1),T=C[C.length-1];if(!(T&&!oX(T,v)))return[...C,v,y]},"shiftedCandidate"),f=b(p=>{let m=p.edge,g=Vn(m.points??[]);if(g.length!==2)return!1;let y=m.start,v=m.end,x=y?t.get(y):void 0,w=v?t.get(v):void 0;if(!x||!w)return!1;let C=x.x??0,T=x.y??0,k=w.x??0,S=w.y??0,[E,I]=g;return Pn(E,I,mr)&&Math.abs(T-S)<1&&Math.abs(C-k)>1||Nn(E,I,mr)&&Math.abs(C-k)<1&&Math.abs(T-S)>1},"laneIsStraightCollinearConnector"),d=[-7,7,-14,14,-21,21];for(let p=0;p<8;p++){let m=e.filter(y=>!y.isLayoutOnly).flatMap(y=>[a(y,!0),a(y,!1)]).filter(y=>!!y),g=!1;for(let y=0;y{let E=f(k),I=f(S);return E!==I?Number(E)-Number(I):+!S.atStart-+!k.atStart});for(let k of T){for(let S of d){let E=h(k,S);if(!E)continue;let I=a({...k.edge,points:E},k.atStart);if(!(!I||m.some(L=>L.edge!==k.edge&&(l(I,L)||C&&u(I,L))))){k.edge.points=E,g=!0;break}}if(g)break}}if(!g)return}}function aRe(e,t){let{realNodeRects:i,labelNodeRects:a}=ag(t.values()),s=b((l,u)=>{let h=l.start,f=l.end,d=Cn(u);if(d.length!==u.length-1)return!1;let p=[h,f].filter(m=>!!m);for(let m of d)if(qa(m.a,m.b,i,p,-2)||qa(m.a,m.b,a,[],-2))return!1;for(let m of e){if(m===l||m.isLayoutOnly)continue;let g=m.points;if(!(!g||g.length<2)){for(let y of d)for(let v of Cn(Vn(g)))if(Hf(y,v,.5)>=$s||N0(y.a,y.b,v.a,v.b,mr))return!1}}return!0},"candidateIsSafe"),o=b((l,u)=>{if(u+4>=l.length)return;let h=l[u],f=l[u+1],d=l[u+2],p=l[u+3],m=l[u+4],g=_a(h,f)&&Ra(f,d)&&_a(d,p)&&Ra(p,m)&&Nn(h,p,mr)&&Nn(h,m,mr)&&Nn(f,d,mr)&&(f.x-h.x)*(p.x-d.x)<0,y=Ra(h,f)&&_a(f,d)&&Ra(d,p)&&_a(p,m)&&Pn(h,p,mr)&&Pn(h,m,mr)&&Pn(f,d,mr)&&(f.y-h.y)*(p.y-d.y)<0;if(g||y)return Vn([...l.slice(0,u+1),m,...l.slice(u+5)]);if(u+5>=l.length)return;let v=l[u+5],x=Ra(h,f)&&_a(f,d)&&Ra(d,p)&&_a(p,m)&&Ra(m,v)&&Nn(h,m,mr)&&Nn(h,v,mr)&&Nn(d,p,mr)&&(d.x-f.x)*(m.x-p.x)<0,w=_a(h,f)&&Ra(f,d)&&_a(d,p)&&Ra(p,m)&&_a(m,v)&&Pn(h,m,mr)&&Pn(h,v,mr)&&Pn(d,p,mr)&&(d.y-f.y)*(m.y-p.y)<0;if(!(!x&&!w))return Vn([...l.slice(0,u+1),v,...l.slice(u+6)])},"withoutDogleg");for(let l=0;l<8;l++){let u=!1;for(let h of e){if(h.isLayoutOnly)continue;let f=Vn(h.points??[]);for(let d=0;d<=f.length-5;d++){let p=o(f,d);if(!(!p||!s(h,p))){h.points=p,u=!0;break}}if(u)break}if(!u)return}}function EX(e,t){let{realNodeRects:a,labelNodeRects:s}=ag(t.values()),o=e.filter(m=>!m.isLayoutOnly),l=b((m,g,y)=>Vn(m===g?y??[]:m.points??[]),"pointsFor"),u=b((m,g)=>{let y=0;for(let v=0;v{let g=Cn(m);if(g.length!==3)return;let y=g[1];if(!(g[0].horizontal===y.horizontal||g[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),f=b((m,g)=>{let y=[m.start,m.end].filter(v=>!!v);return a.filter(v=>{if(y.includes(v.id))return!1;let x=v.rect;return g.horizontal?xl(g.a.x,g.b.x,x.left,x.right)>=$s&&g.a.y>=x.top-2&&g.a.y<=x.bottom+2:xl(g.a.y,g.b.y,x.top,x.bottom)>=$s&&g.a.x>=x.left-2&&g.a.x<=x.right+2})},"blockingRectsFor"),d=b((m,g,y)=>{let v=m.map(w=>({...w}));if(g.horizontal)v[g.index].y=y,v[g.index+1].y=y;else if(g.vertical)v[g.index].x=y,v[g.index+1].x=y;else return;let x=Uf(Vn(v));return Cn(x).length===x.length-1?x:void 0},"candidateByMovingRail"),p=b((m,g,y)=>{let v=[m.start,m.end].filter(w=>!!w),x=Cn(g);if(x.length!==g.length-1)return!1;for(let w of x)if(qa(w.a,w.b,a,v,-2)||qa(w.a,w.b,s,[],-2))return!1;for(let w of o)if(w!==m){for(let C of x)for(let T of Cn(l(w)))if(Hf(C,T,.5)>=$s)return!1}return u(m,g)<=y},"candidateIsSafe");for(let m=0;m<8;m++){let g=u(),y=!1;for(let v of o){let x=l(v),w=h(x);if(!w)continue;let C=f(v,w.segment);if(C.length===0)continue;let T=w.horizontal?[Math.min(...C.map(k=>k.rect.top))-20,Math.max(...C.map(k=>k.rect.bottom))+20]:[Math.min(...C.map(k=>k.rect.left))-20,Math.max(...C.map(k=>k.rect.right))+20];for(let k of T){let S=d(x,w.segment,k);if(!(!S||!p(v,S,g))){v.points=S,y=!0;break}}if(y)break}if(!y)return}}function AX(e,t){let n=b(l=>{let u=l.groupTitleRect;if(!(!u||typeof u.left!="number"||typeof u.right!="number"||typeof u.top!="number"||typeof u.bottom!="number"||!Number.isFinite(u.left)||!Number.isFinite(u.right)||!Number.isFinite(u.top)||!Number.isFinite(u.bottom)||u.right<=u.left||u.bottom<=u.top))return{left:u.left,right:u.right,top:u.top,bottom:u.bottom}},"validTitleRect"),i=b(l=>{if(!l.isGroup||l.parentId)return;let u=l.direction,h=typeof u=="string"?u.toUpperCase():"";if(h==="LR"||h==="RL"||h==="BT")return;let f=n(l),d=l.y,p=l.height;if(!f||typeof d!="number"||typeof p!="number"||!Number.isFinite(d)||!Number.isFinite(p)||p<=0)return;let m=f.right-f.left,g=f.bottom-f.top;if(!(g<=0||m{if(!l.horizontal)return!1;let h=l.a.y;return h<=u.top+mr||h>=u.bottom-mr?!1:xl(l.a.x,l.b.x,u.left,u.right)>=$s},"horizontalSegmentIntersectsTitle"),s=[...t.values()].map(i).filter(l=>!!l);if(s.length===0)return;let o=0;for(let l of e){if(l.isLayoutOnly)continue;let u=Vn(l.points??[]);for(let h of Cn(u))for(let f of s)a(h,f.rect)&&(o=Math.max(o,f.rect.bottom-h.a.y+4))}if(!(o<=mr))for(let l of s){let u=l.node.y,h=l.node.height;typeof u!="number"||typeof h!="number"||!Number.isFinite(u)||!Number.isFinite(h)||h<=0||(l.node.y=u-o/2,l.node.height=h+o,l.node.groupTitleRect={...l.rect,top:l.rect.top-o,bottom:l.rect.bottom-o})}}function _X(e,t){let n=b(u=>{let h=u.groupTitleRect;if(!(!h||typeof h.left!="number"||typeof h.right!="number"||typeof h.top!="number"||typeof h.bottom!="number"||!Number.isFinite(h.left)||!Number.isFinite(h.right)||!Number.isFinite(h.top)||!Number.isFinite(h.bottom)||h.right<=h.left||h.bottom<=h.top))return{left:h.left,right:h.right,top:h.top,bottom:h.bottom}},"validTitleRect"),i=b(u=>{if(!u.isGroup||u.parentId||u.direction!=="LR")return;let f=n(u),d=u.x,p=u.width;if(!f||typeof d!="number"||typeof p!="number"||!Number.isFinite(d)||!Number.isFinite(p)||p<=0)return;let m=f.right-f.left,g=f.bottom-f.top;if(!(m<=0||g{if(!u.vertical)return!1;let f=u.a.x;return f<=h.left+mr||f>=h.right-mr?!1:xl(u.a.y,u.b.y,h.top,h.bottom)>=$s},"verticalSegmentIntersectsTitle"),s=b((u,h)=>{if(!u.horizontal)return!1;let f=u.a.y;return f<=h.top+mr||f>=h.bottom-mr?!1:xl(u.a.x,u.b.x,h.left,h.right)>=$s},"horizontalSegmentIntersectsTitle"),o=[...t.values()].map(i).filter(u=>!!u);if(o.length===0)return;let l=0;for(let u of e){if(u.isLayoutOnly)continue;let h=Vn(u.points??[]);for(let f of Cn(h))for(let d of o)if(a(f,d.rect))l=Math.max(l,d.rect.right-f.a.x+4);else if(s(f,d.rect)){let p=Math.min(f.a.x,f.b.x);l=Math.max(l,d.rect.right-p+4)}}if(!(l<=mr))for(let u of o){let h=u.node.x,f=u.node.width;typeof h!="number"||typeof f!="number"||!Number.isFinite(h)||!Number.isFinite(f)||f<=0||(u.node.x=h-l/2,u.node.width=f+l,u.node.groupTitleRect={...u.rect,left:u.rect.left-l,right:u.rect.right-l})}}function sRe(e,t){let{realNodeRects:i}=ag(t.values()),a=e.filter(g=>!g.isLayoutOnly),s=b((g,y=new Map)=>Vn(y.get(g)??g.points??[]),"replacementPointsFor"),o=b((g=new Map)=>{let y=0;for(let v=0;va.reduce((y,v)=>y+Vc(s(v,g)),0),"totalBends"),u=b(g=>{let y=s(g);if(y.length<4)return;let v=y[y.length-2],x=y[y.length-1];if(!(!_a(v,x,mr)&&!Ra(v,x,mr)))return{tailStart:v,terminal:x}},"terminalTailFor"),h=b((g,y)=>{let v=s(g);if(v.length<3)return;let x=v[0],w=v[1],C;if(_a(x,w,mr))C={x:w.x,y:y.tailStart.y};else if(Ra(x,w,mr))C={x:y.tailStart.x,y:w.y};else return;let T=Uf(Vn([x,w,C,y.tailStart,y.terminal]));return Cn(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),f=b((g,y)=>{let v=[g.start,g.end].filter(x=>!!x);for(let x of Cn(y))if(qa(x.a,x.b,i,v,-2))return!0;return!1},"pathHasNodeHit"),d=b((g,y,v)=>{for(let x of a)if(x!==g){for(let w of Cn(y))for(let C of Cn(s(x,v)))if(Hf(w,C,.5)>=$s)return!0}return!1},"pathHasSharedTrack"),p=b((g,y,v)=>!f(g,y)&&!d(g,y,v),"candidateIsSafe"),m=b(()=>{let g=new Map;for(let y of a){let v=y.end;if(!v||!t.has(v)||s(y).length<4)continue;let w=g.get(v)??[];w.push(y),g.set(v,w)}return g},"edgesByDestination");for(let g=0;g<4;g++){let y=o();if(y===0)return;let v=l(),x,w=y,C=v;for(let T of m().values())for(let k=0;k=y||M>w||M===w&&D>=C||(x=N,w=M,C=D)}if(!x)return;for(let[T,k]of x)T.points=k}}function oRe(e,t){let{realNodeRects:s,labelNodeRects:o}=ag(t.values()),l=e.filter(T=>!T.isLayoutOnly),u=b((T,k=new Map)=>Vn(k.get(T)??T.points??[]),"replacementPointsFor"),h=b((T=new Map)=>{let k=0;for(let S=0;Sl.reduce((k,S)=>k+Vc(u(S,T)),0),"totalBends"),d=b(T=>{let k=T.start,S=T.end,E=k?t.get(k):void 0,I=S?t.get(S):void 0,L=E?tc(E):void 0,O=I?tc(I):void 0;return L&&O?{src:L,dst:O}:void 0},"endpointRectsFor"),p=b((T,k,S)=>{if(S.index<=0||S.index+1>=k.length-1)return;let E=d(T);if(E){if(S.vertical){let I=S.a.x,L=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),R=IO+mr?"right":void 0;return R?{edge:T,points:k,segmentIndex:S.index,axis:"vertical",side:R,coord:I,min:Math.min(S.a.y,S.b.y),max:Math.max(S.a.y,S.b.y)}:void 0}if(S.horizontal){let I=S.a.y,L=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),R=IO+mr?"bottom":void 0;return R?{edge:T,points:k,segmentIndex:S.index,axis:"horizontal",side:R,coord:I,min:Math.min(S.a.x,S.b.x),max:Math.max(S.a.x,S.b.x)}:void 0}}},"externalRailForSegment"),m=b(()=>{let T=[];for(let k of l){let S=u(k);for(let E of Cn(S)){let I=p(k,S,E);I&&T.push(I)}}return T},"collectExternalRails"),g=b((T,k)=>T.edge!==k.edge&&T.axis===k.axis&&T.side===k.side&&xl(T.min,T.max,k.min,k.max)>=$s,"railsInteract"),y=b(T=>{let k=[],S=new Set;for(let E of T){if(S.has(E))continue;let I=[E],L=[];for(S.add(E);I.length>0;){let O=I.pop();L.push(O);for(let R of T)!S.has(R)&&g(O,R)&&(S.add(R),I.push(R))}L.length>1&&k.push(L)}return k},"connectedComponents"),v=b(T=>{let k=[];for(let S of T)k.some(E=>Math.abs(E-S.coord){let k=T.map(I=>I.coord),S=v(T),E=[];if(T.length<=6){let I=new Array(S.length).fill(!1),L=[],O=b(()=>{if(L.length===T.length){L.some((R,A)=>Math.abs(R-k[A])>=mr)&&E.push([...L]);return}for(let[R,A]of S.entries())I[R]||(I[R]=!0,L.push(A),O(),L.pop(),I[R]=!1)},"visit");return O(),E}for(let I=0;I{let S=new Map;for(let[I,L]of T.entries()){let O=k[I],R=S.get(L.edge)??L.points.map(A=>({x:A.x,y:A.y}));L.axis==="vertical"?(R[L.segmentIndex].x=O,R[L.segmentIndex+1].x=O):(R[L.segmentIndex].y=O,R[L.segmentIndex+1].y=O),S.set(L.edge,R)}let E=new Map;for(let[I,L]of S){let O=Uf(Vn(L));if(Cn(O).length!==O.length-1)return;E.set(I,O)}return E},"replacementsForAssignment"),C=b(T=>{for(let[k,S]of T){let E=[k.start,k.end].filter(I=>!!I);for(let I of Cn(S))if(qa(I.a,I.b,s,E,-2)||qa(I.a,I.b,o,[],-2))return!1}for(let k=0;k=$s)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){let k=h();if(k===0)return;let S,E=k,I=f(),L=Number.POSITIVE_INFINITY;for(let O of y(m()))for(let R of x(O)){let A=w(O,R);if(!A||!C(A))continue;let N=h(A);if(N>=k)continue;let M=f(A),D=O.reduce((B,P,$)=>B+Math.abs(R[$]-P.coord),0);N>E||N===E&&(M>I||M===I&&D>=L)||(S=A,E=N,I=M,L=D)}if(!S)return;for(let[O,R]of S)O.points=R}}function lRe(e,t){let{realNodeRects:i,labelNodeRects:a}=ag(t.values()),s=e.filter(m=>!m.isLayoutOnly),o=b((m,g,y)=>Vn(m===g?y??[]:m.points??[]),"pointsFor"),l=b(m=>Cn(m).reduce((g,y)=>{let v=y.a.x-y.b.x,x=y.a.y-y.b.y;return g+Math.hypot(v,x)},0),"pathLength"),u=b((m,g)=>{let y=0;for(let v=0;v{if(m.horizontal){let y=m.a.y;return(Math.abs(y-g.top)<1||Math.abs(y-g.bottom)<1)&&xl(m.a.x,m.b.x,g.left,g.right)>=$s}if(m.vertical){let y=m.a.x;return(Math.abs(y-g.left)<1||Math.abs(y-g.right)<1)&&xl(m.a.y,m.b.y,g.top,g.bottom)>=$s}return!1},"segmentRunsAlongRectBorder"),f=b(m=>{let g=[m.start,m.end].filter(v=>!!v),y=[];for(let v of g){let x=t.get(v),w=x?tc(x):void 0;w&&y.push(w)}return y},"endpointRectsFor"),d=b((m,g)=>{if(g+3>=m.length)return[];let y=m[g],v=m[g+1],x=m[g+2],w=m[g+3],C=_a(y,v,mr)&&Ra(v,x,mr)&&_a(x,w,mr),T=Ra(y,v,mr)&&_a(v,x,mr)&&Ra(x,w,mr);if(!C&&!T)return[];if(!(C?Math.sign(v.x-y.x)!==Math.sign(w.x-x.x):Math.sign(v.y-y.y)!==Math.sign(w.y-x.y)))return[];let S=Nn(y,w,mr)||Pn(y,w,mr)?[]:[{x:y.x,y:w.y},{x:w.x,y:y.y}],E=S.length===0?[[...m.slice(0,g+1),...m.slice(g+3)]]:S.map(L=>[...m.slice(0,g+1),L,...m.slice(g+3)]),I=new Set;return E.map(L=>Uf(Vn(L))).filter(L=>{if(Cn(L).length!==L.length-1||!L.some(R=>Lu(R,w,mr)))return!1;let O=L.map(R=>`${R.x.toFixed(3)},${R.y.toFixed(3)}`).join("|");return I.has(O)?!1:(I.add(O),!0)})},"shortcutCandidatesAt"),p=b((m,g,y)=>{let v=[m.start,m.end].filter(w=>!!w),x=f(m);for(let w of Cn(g))if(qa(w.a,w.b,i,v,-2)||qa(w.a,w.b,a,[],-2)||x.some(C=>h(w,C)))return!1;for(let w of s)if(w!==m){for(let C of Cn(g))for(let T of Cn(o(w)))if(Hf(C,T,.5)>=$s)return!1}return u(m,g)<=y},"candidateIsSafe");for(let m=0;m<8;m++){let g=u(),y,v,x=g,w=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY;for(let T of s){let k=o(T),S=Vc(k,mr),E=l(k);for(let I=0;I<=k.length-4;I++)for(let L of d(k,I)){let O=Vc(L,mr),R=l(L);if(!(Ox||N===x&&(O>w||O===w&&R>=C)||(y=T,v=L,x=N,w=O,C=R)}}if(!y||!v)return;y.points=v}}function cRe(e,t){let s=[];for(let fe of t.values()){if(fe.isGroup||fe.isEdgeLabel)continue;let Ce=fe.x??0,_e=fe.y??0,de=tc(fe);de&&s.push({id:String(fe.id??""),cx:Ce,cy:_e,rect:de})}if(s.length===0)return;let o=new Map(s.map(fe=>[fe.id,fe])),l=s.map(fe=>({id:fe.id,rect:fe.rect})),u=["top","bottom","left","right"],h={top:Math.min(...s.map(fe=>fe.rect.top))-20,bottom:Math.max(...s.map(fe=>fe.rect.bottom))+20,left:Math.min(...s.map(fe=>fe.rect.left))-20,right:Math.max(...s.map(fe=>fe.rect.right))+20},f=e.filter(fe=>!fe.isLayoutOnly),d=new Map(f.map((fe,Ce)=>[fe,Ce])),p=b(fe=>{let Ce=fe==="left"||fe==="top"?-1:1,_e=[];for(let de=0;de<=2;de++)_e.push(h[fe]+Ce*20*de);return _e},"outwardTracksForSide"),m=b((fe,Ce=new Map)=>Vn(Ce.get(fe)??fe.points??[]),"replacementPointsFor"),g=b((fe,Ce)=>{let _e=0;for(let de of fe)for(let ie of Ce)N0(de.a,de.b,ie.a,ie.b,mr)&&_e++;return _e},"crossingCountBetweenSegments"),y=b((fe,Ce)=>g(Cn(fe),Cn(Ce)),"crossingCountBetweenPaths"),v=b((fe=new Map)=>{let Ce=0,_e=[],de=new Set,ie=[],Q=b(he=>{de.has(he)||(de.add(he),ie.push(he))},"addEdge");for(let he=0;he0&&(Ce+=ye,_e.push({first:xe,second:Ie,count:ye}),Q(xe),Q(Ie))}}return ie.sort((he,xe)=>(d.get(he)??0)-(d.get(xe)??0)),{count:Ce,pairs:_e,edgeSet:de,edges:ie}},"crossingSnapshot"),x=b((fe,Ce)=>{let _e=new Set(Ce.keys());if(_e.size===0)return fe.count;let de=0;for(let Q of fe.pairs)(_e.has(Q.first)||_e.has(Q.second))&&(de+=Q.count);let ie=0;for(let Q=0;Q{let Ce=new Map;for(let ie of fe.pairs){let Q=Ce.get(ie.first)??new Set;Q.add(ie.second),Ce.set(ie.first,Q);let he=Ce.get(ie.second)??new Set;he.add(ie.first),Ce.set(ie.second,he)}let _e=[],de=new Set;for(let ie of fe.edges){if(de.has(ie))continue;let Q=[ie],he=[];for(de.add(ie);Q.length>0;){let xe=Q.pop();he.push(xe);for(let ce of Ce.get(xe)??[])de.has(ce)||(de.add(ce),Q.push(ce))}he.sort((xe,ce)=>(d.get(xe)??0)-(d.get(ce)??0)),he.length>1&&_e.push(he)}return _e},"crossingComponents"),C=b(fe=>[fe.start,fe.end].filter(Ce=>!!Ce),"endpointIdsFor"),T=b(fe=>{let Ce=[];for(let _e of w(fe)){let de=new Set(_e),ie=new Set(_e.flatMap(he=>C(he))),Q=[..._e];for(let he of f)de.has(he)||C(he).some(xe=>ie.has(xe))&&Q.push(he);Q.sort((he,xe)=>(d.get(he)??0)-(d.get(xe)??0)),Ce.push(Q)}return Ce},"pairSearchGroups"),k=b((fe,Ce,_e)=>x(fe,new Map([[Ce,_e]])),"crossingCountWithSingleReplacement"),S=b(fe=>{let Ce=new Map;for(let _e of fe.pairs)Ce.set(_e.first,(Ce.get(_e.first)??0)+_e.count),Ce.set(_e.second,(Ce.get(_e.second)??0)+_e.count);return Ce},"currentCrossingsByEdge"),E=b(fe=>fe.slice(1).reduce((Ce,_e,de)=>{let ie=fe[de];return Ce+Math.abs(_e.x-ie.x)+Math.abs(_e.y-ie.y)},0),"pathLength"),I=b((fe=new Map)=>f.reduce((Ce,_e)=>Ce+Vc(m(_e,fe)),0),"totalBends"),L=b((fe=new Map)=>f.reduce((Ce,_e)=>Ce+E(m(_e,fe)),0),"totalLength"),O=b((fe,Ce,_e=new Map)=>{let de=Cn(Ce);for(let ie of f)if(ie!==fe){for(let Q of de)for(let he of Cn(m(ie,_e)))if(Hf(Q,he,.5)>=$s)return!0}return!1},"pathHasSegmentConflict"),R=b((fe,Ce)=>{let _e=[fe.start,fe.end].filter(de=>!!de);for(let de of Cn(Ce))if(qa(de.a,de.b,l,_e,-2))return!0;return!1},"pathHitsNode"),A=b((fe,Ce)=>{let _e=Uf(Vn(Ce));Cn(_e).length===_e.length-1&&fe.push(_e)},"pushOrthogonalCandidate"),N=b(fe=>fe==="left"||fe==="right","sideIsHorizontal"),M=b((fe,Ce,_e)=>{switch(Ce){case"left":return Math.min(fe.x,_e.x)-20;case"right":return Math.max(fe.x,_e.x)+20;case"top":return Math.min(fe.y,_e.y)-20;case"bottom":return Math.max(fe.y,_e.y)+20}},"localTrackForSameSide"),D=b((fe,Ce,_e,de)=>{let ie=_e==="left"||_e==="top"?-1:1,Q=[M(Ce,_e,de),h[_e]];for(let he of Q)for(let xe=0;xe<=2;xe++)A(fe,XX(Ce,_e,de,he+ie*20*xe))},"addSameSideCandidates"),B=b((fe,Ce,_e,de,ie)=>{for(let Q of p(_e))for(let he of p(ie))A(fe,[Ce,{x:Q,y:Ce.y},{x:Q,y:he},{x:de.x,y:he},de])},"addHorizontalToVerticalCandidates"),P=b((fe,Ce,_e,de,ie)=>{for(let Q of p(_e))for(let he of p(ie))A(fe,[Ce,{x:Ce.x,y:Q},{x:he,y:Q},{x:he,y:de.y},de])},"addVerticalToHorizontalCandidates"),$=b((fe,Ce,_e,de,ie)=>{let Q=[...p("top"),...p("bottom")];for(let he of p(_e))for(let xe of p(ie))for(let ce of Q)A(fe,[Ce,{x:he,y:Ce.y},{x:he,y:ce},{x:xe,y:ce},{x:xe,y:de.y},de])},"addHorizontalPairCandidates"),F=b((fe,Ce,_e,de,ie)=>{let Q=[...p("left"),...p("right")];for(let he of p(_e))for(let xe of p(ie))for(let ce of Q)A(fe,[Ce,{x:Ce.x,y:he},{x:ce,y:he},{x:ce,y:xe},{x:de.x,y:xe},de])},"addVerticalPairCandidates"),q=b(fe=>{let Ce=new Set;return fe.map(_e=>Vn(_e)).filter(_e=>{let de=_e.map(ie=>`${ie.x.toFixed(3)},${ie.y.toFixed(3)}`).join("|");return Ce.has(de)||_e.length<2?!1:(Ce.add(de),!0)})},"dedupeCandidatePaths"),G=b((fe,Ce,_e,de)=>{let ie=[],Q=YX(fe,Ce,_e,de,20,mr);Q&&A(ie,Q),Ce===de&&D(ie,fe,Ce,_e);let he=N(Ce),xe=N(de);return he&&!xe?B(ie,fe,Ce,_e,de):!he&&xe?P(ie,fe,Ce,_e,de):he?$(ie,fe,Ce,_e,de):F(ie,fe,Ce,_e,de),q(ie)},"buildCandidatesForSides"),z=b((fe,Ce,_e,de)=>{let ie=[...p("left"),...p("right")],Q=[...p("top"),...p("bottom")];for(let he of u){let xe=iv(de,he),ce=he==="top"||he==="bottom"?p(he):Q;for(let ge of ie){A(fe,[Ce,_e,{x:ge,y:_e.y},{x:ge,y:xe.y},xe]);for(let Ie of ce)A(fe,[Ce,_e,{x:ge,y:_e.y},{x:ge,y:Ie},{x:xe.x,y:Ie},xe])}}},"addVerticalDepartureOuterTrackCandidates"),H=b((fe,Ce,_e,de)=>{let ie=[...p("left"),...p("right")],Q=[...p("top"),...p("bottom")];for(let he of u){let xe=iv(de,he),ce=he==="left"||he==="right"?p(he):ie;for(let ge of Q){A(fe,[Ce,_e,{x:_e.x,y:ge},{x:xe.x,y:ge},xe]);for(let Ie of ce)A(fe,[Ce,_e,{x:_e.x,y:ge},{x:Ie,y:ge},{x:Ie,y:xe.y},xe])}}},"addHorizontalDepartureOuterTrackCandidates"),j=b(fe=>{let Ce=fe.start,_e=fe.end,de=_e?o.get(_e):void 0;if(!Ce||!de)return[];let ie=Vn(fe.points??[]);if(ie.length<4)return[];let Q=ie[0],he=ie[1],xe=[];return Ra(Q,he,mr)?z(xe,Q,he,de):_a(Q,he,mr)&&H(xe,Q,he,de),xe},"terminalPreservingOuterTrackCandidates"),J=b(fe=>{let Ce=fe.start,_e=fe.end,de=Ce?o.get(Ce):void 0,ie=_e?o.get(_e):void 0;if(!de||!ie)return[];let Q=[];for(let he of u){let xe=iv(de,he);for(let ce of u)Q.push(...G(xe,he,iv(ie,ce),ce))}return Q.push(...j(fe)),Q},"candidatePathsFor"),U=b(()=>new Map(f.map(fe=>[fe,Cn(m(fe))])),"currentSegmentsByEdge"),le=b((fe,Ce,_e)=>{let de=new Set;for(let ie of f){if(ie===fe)continue;let Q=_e.get(ie)??Cn(m(ie));Ce.some(he=>Q.some(xe=>Hf(he,xe,.5)>=$s))&&de.add(ie)}return de},"sharedTrackConflictsFor"),ee=b((fe,Ce,_e,de)=>{let ie=new Set;return J(fe).map(he=>Uf(Vn(he))).filter(he=>{if(R(fe,he))return!1;let xe=he.map(ce=>`${ce.x.toFixed(3)},${ce.y.toFixed(3)}`).join("|");return ie.has(xe)||he.length<2?!1:(ie.add(xe),!0)}).map(he=>{let xe=Cn(he),ce=0;for(let ge of f)ge!==fe&&(ce+=g(xe,_e.get(ge)??Cn(m(ge))));return{candidate:he,candidateSegments:xe,crossings:Ce.count-(de.get(fe)??0)+ce,bends:Vc(he,mr),totalBends:Vc(he),length:E(he)}}).filter(({crossings:he})=>he<=Ce.count).sort((he,xe)=>he.crossings-xe.crossings||he.bends-xe.bends||he.length-xe.length).slice(0,48).map(he=>({path:he.candidate,segments:he.candidateSegments,sharedTrackConflicts:le(fe,he.candidateSegments,_e),totalBends:he.totalBends,length:he.length}))},"pairCandidatesFor"),ue=b((fe,Ce,_e,de,ie,Q)=>{let he=0;for(let ce of fe.pairs)(ce.first===Ce||ce.second===Ce||ce.first===de||ce.second===de)&&(he+=ce.count);let xe=g(_e.segments,ie.segments);for(let ce of f){if(ce===Ce||ce===de)continue;let ge=Q.get(ce)??Cn(m(ce));xe+=g(_e.segments,ge)+g(ie.segments,ge)}return fe.count-he+xe},"pairCrossingCount"),ae=b((fe,Ce)=>{for(let _e of fe.sharedTrackConflicts)if(_e!==Ce)return!1;return!0},"conflictsOnlyWith"),oe=b((fe,Ce)=>fe.segments.some(_e=>Ce.segments.some(de=>Hf(_e,de,.5)>=$s)),"candidatesShareTrack"),Re=b((fe,Ce,_e,de)=>ae(Ce,_e.edge)&&ae(de,fe.edge)&&!oe(Ce,de),"pairCandidatesAreCompatible"),Te=b((fe,Ce,_e,de,ie)=>{let Q=ue(fe.current,Ce.edge,_e,de.edge,ie,fe.baseSegments);if(!(Q>=fe.current.count))return{replacements:new Map([[Ce.edge,_e.path],[de.edge,ie.path]]),crossings:Q,bends:fe.currentBends-(fe.baseBendsByEdge.get(Ce.edge)??0)-(fe.baseBendsByEdge.get(de.edge)??0)+_e.totalBends+ie.totalBends,length:fe.currentLength-(fe.baseLengthByEdge.get(Ce.edge)??0)-(fe.baseLengthByEdge.get(de.edge)??0)+_e.length+ie.length}},"scorePairReplacement"),Oe=b((fe,Ce)=>fe.crossings{let ie=de;for(let Q of Ce.candidates)for(let he of _e.candidates){if(!Re(Ce,Q,_e,he))continue;let xe=Te(fe,Ce,Q,_e,he);xe&&Oe(xe,ie)&&(ie=xe)}return ie},"bestScoreForOptionPair"),Ge=b(fe=>{let Ce=I(),_e=L(),de=U(),ie=S(fe),Q=new Map(f.map(ye=>[ye,Vc(m(ye))])),he=new Map(f.map(ye=>[ye,E(m(ye))])),xe=new Map,ce=T(fe);for(let ye of ce)for(let ne of ye){if(xe.has(ne))continue;let V=ee(ne,fe,de,ie);V.length>0&&xe.set(ne,{edge:ne,candidates:V})}let ge={replacements:new Map,crossings:fe.count,bends:Ce,length:_e},Ie={current:fe,currentBends:Ce,currentLength:_e,baseBendsByEdge:Q,baseLengthByEdge:he,baseSegments:de};for(let ye of ce){let ne=new Set(ye.filter(pe=>fe.edgeSet.has(pe))),V=ye.map(pe=>xe.get(pe)).filter(pe=>!!pe);for(let pe=0;pe0?ge.replacements:void 0},"bestPairedReplacement");for(let fe=0;fe<4;fe++){let Ce=v(),_e=Ce.count;if(_e===0)return;let de,ie,Q=_e,he=Number.POSITIVE_INFINITY;for(let ce of Ce.edges){let ge=Vc(m(ce),mr);for(let Ie of J(ce)){let ye=R(ce,Ie),ne=!ye&&O(ce,Ie),V=k(Ce,ce,Ie),pe=Vc(Ie,mr);ye||ne||!(V<_e||V===_e&&peQ||V===Q&&pe>=he||(de=ce,ie=Ie,Q=V,he=pe)}}if(de&&ie){de.points=ie;continue}let xe=Ge(Ce);if(!xe)return;for(let[ce,ge]of xe)ce.points=ge}}function uRe(e,t){let{nodeInfoById:r,realNodeRects:n}=cL(t),i=["top","bottom","left","right"],a=20,s={top:Math.min(...n.map(g=>g.rect.top))-a,bottom:Math.max(...n.map(g=>g.rect.bottom))+a,left:Math.min(...n.map(g=>g.rect.left))-a,right:Math.max(...n.map(g=>g.rect.right))+a},o=b((g,y,v,x)=>{let w=[],C=YX(g,y,v,x,a,ig);return C&&w.push(C),y===x&&w.push(XX(g,y,v,s[y])),w},"buildOrthogonalPathCandidates"),l=b((g,y)=>{for(let v=0;v{let x=0,w=S4(g,ig),C=y.start,T=y.end;for(let k of e){if(k===y||k.isLayoutOnly)continue;let S=k.start,E=k.end;if(!v&&C&&T&&(S===C||S===T||E===C||E===T))continue;let I=k.points;if(!(!I||I.length<2))for(let L of w)for(let O of S4(I,ig)){if(KX(L.a,L.b,O.a,O.b,ig,ig)){x++;continue}Hf(L,O,ig)>=DAt&&x++}}return x},"pathConflictCount"),h=4,f=b((g,y)=>{let v=Math.abs(g.y-y.rect.top),x=Math.abs(g.y-y.rect.bottom),w=Math.abs(g.x-y.rect.left),C=Math.abs(g.x-y.rect.right),T="top",k=v;return x{let x=d.get(g)??[];x.push({side:y,edgeId:v}),d.set(g,x)},"addFaceClaim");for(let g of e){if(g.isLayoutOnly)continue;let y=g.points??[];if(y.length<1)continue;let v=g.id??"",x=g.start,w=g.end;if(x){let C=r.get(x);C&&p(x,f(y[0],C),v)}if(w){let C=r.get(w);C&&p(w,f(y[y.length-1],C),v)}}let m=b((g,y,v)=>d.get(g)?.some(x=>x.edgeId!==v&&x.side===y)??!1,"faceIsClaimed");for(let g of e){if(g.isLayoutOnly)continue;let y=g.points;if(!y||y.length<2)continue;let v=Vc(y,ig);if(v0){let P=u(D,g,!0);if(P>L||P===L&&B>=O)continue;L=P,O=B,I=D;continue}u(D,g)>E||BN.edgeId!==k));let A=d.get(w);A&&d.set(w,A.filter(N=>N.edgeId!==k)),p(x,f(I[0],C),k),p(w,f(I[I.length-1],T),k)}}}function RX(e,t){let r=t?0:e.length-1,n=t?1:-1,i=e[r],a=e[r+n];if(!i||!a)return;let s=a.x-i.x,o=a.y-i.y;if(!(Math.abs(s)+Math.abs(o)a&&JR(e,hRe(a)))}function KR(e,t){let r=[];for(let m of e){if(m.isLayoutOnly)continue;let g=m.points;if(!(!g||g.length<2))for(let y=0;y{let y=dX(g,a);for(let{nodeId:v,rect:x}of n)if(v!==m&&JR(y,x))return!0;return!1},"labelOverlapsForeignNode"),u=b((m,g)=>{let y=dX(g,a);for(let v of r)if(v.edgeId!==m&&lL(v.p1,v.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),h=b((m,g,y)=>l(m,y)||u(g,y),"labelOverlapsAnything"),f=[],d=b(m=>{for(let{id:g,rect:y}of i)if($_e(y,m))return g},"findContainingLane"),p=b((m,g)=>f.some(y=>y.labelId!==m&&JR(g,y.rect)),"overlapsPlacedLabel");for(let m of e){if(m.isLayoutOnly)continue;let g=m.labelNodeId;if(!g)continue;let y=t.get(g);if(!y)continue;let v=m.points;if(!v||v.length<2)continue;let x=y.width??0,w=y.height??0;if(x<=0||w<=0)continue;let C=[];for(let q=0;q=ec&&j>=ec||C.push({idx:q,length:H+j,orientation:H>=ec?"horizontal":"vertical",midX:(G.x+z.x)/2,midY:(G.y+z.y)/2})}if(C.length===0)continue;let T=C.length>=3?C.filter(q=>q.idx>0&&q.idx0?T:C,S=x>=w?"horizontal":"vertical",E=b(q=>[...q].sort((G,z)=>{let H=G.orientation===S,j=z.orientation===S;if(H!==j)return H?-1:1;let J=G.length>=(G.orientation==="horizontal"?x:w)+2,U=z.length>=(z.orientation==="horizontal"?x:w)+2;return J!==U?J?-1:1:z.length-G.length}),"rankSegments"),I=C[0],L=C[C.length-1],O=[.5,.25,.75,.05,.95,.15,.85,.1,.9],R=b((q,G)=>{let z=v[q.idx],H=v[q.idx+1];return{midX:z.x+(H.x-z.x)*G,midY:z.y+(H.y-z.y)*G}},"anchorAtT"),A=b((q,G,z)=>Math.min(z,Math.max(G,q)),"clamp"),N=b((q,G)=>q.midX>=G.left-ec&&q.midX<=G.right+ec&&q.midY>=G.top-ec&&q.midY<=G.bottom+ec,"pointInsideRectInclusive"),M=b(q=>{let G=C4(q.midX,q.midY,x,w),z=d(G);if(z)return{laneId:z,anchor:q,rect:G};let H=i.find(({rect:ae})=>N(q,ae));if(!H)return;let j=H.rect.left+x/2+s,J=H.rect.right-x/2-s,U=H.rect.top+w/2+s,le=H.rect.bottom-w/2-s;if(j>J||U>le)return;let ee={midX:A(q.midX,j,J),midY:A(q.midY,U,le)},ue=C4(ee.midX,ee.midY,x,w);return N(q,ue)?{laneId:H.id,anchor:ee,rect:ue}:void 0},"placementForAnchor"),D=b((q,G,z)=>q.orientation==="horizontal"?Math.abs(G.midX-z.x):Math.abs(G.midY-z.y),"distanceAlongSegment"),B=b((q,G)=>{let H=(q.orientation==="horizontal"?x/2:w/2)+o;if(q===I){let j=v[q.idx];if(D(q,G,j)+ec{let G=E(q);for(let z of G)for(let H of O){let j=R(z,H);if(!B(z,j))continue;let J=M(j);if(J&&!LX(J.rect,v)&&!p(g,J.rect)&&!h(g,m.id,J.rect))return{laneId:J.laneId,anchor:J.anchor}}},"tryPool"),$=b((q,G,z=!1)=>{let H=E(q);for(let j of H){let J={midX:j.midX,midY:j.midY};if(G&&!B(j,J))continue;let U=M(J);if(U&&!LX(U.rect,v)&&!p(g,U.rect)&&!l(g,U.rect)&&(z||!u(m.id,U.rect)))return{laneId:U.laneId,anchor:U.anchor}}},"findLaneContainingFallback"),F=P(k)??(k.lengthz.labelId===g);G>=0?f[G]={labelId:g,rect:q}:f.push({labelId:g,rect:q})}}}function IX(e,t){return e{let h=IX(o,l),f=0,d=b(p=>{if(!p)return;let m=i.get(p);if(!m)return;let g=u==="x"?m.w/2:m.h/2;g>f&&(f=g)},"consider");d(s.labelNodeId);for(let p of e){if(p===s||p.isLayoutOnly)continue;let m=p.start,g=p.end;!m||!g||IX(m,g)===h&&d(p.labelNodeId)}return f>0?f+PAt:0},"labelClearanceFor");for(let s of e){if(s.isLayoutOnly)continue;let o=s.points;if(!HX(o,lX))continue;let l=jX(s,r,lX);if(!l)continue;let{srcId:u,dstId:h,srcInfo:f,dstInfo:d,collinearX:p,collinearY:m}=l;if(p===m)continue;let g,y;if(p){let T=d.cy>f.cy;g={x:f.cx,y:T?f.rect.bottom:f.rect.top},y={x:d.cx,y:T?d.rect.top:d.rect.bottom}}else{let T=d.cx>f.cx;g={x:T?f.rect.right:f.rect.left,y:f.cy},y={x:T?d.rect.left:d.rect.right,y:d.cy}}if(qa(g,y,n,[u,h],1))continue;let x=a(s,u,h,p?"x":"y"),w=x>x_e?x:x_e,C=[0,w,-w];for(let T of C){let k={...g},S={...y};if(p){if(k.x+=T,S.x+=T,k.x<=f.rect.left||k.x>=f.rect.right||S.x<=d.rect.left||S.x>=d.rect.right)continue}else if(k.y+=T,S.y+=T,k.y<=f.rect.top||k.y>=f.rect.bottom||S.y<=d.rect.top||S.y>=d.rect.bottom)continue;if(!qa(k,S,n,[u,h],1)&&!eL(k,S,e,s,{epsilon:lX})){s.points=[k,S];break}}}}function MX(e,t){let{realNodeRects:u,labelNodeRects:h}=ag(t.values()),f=b((k,S)=>S4(S,.001).map(E=>({...E,edge:k,interior:E.index>=1&&E.index<=S.length-3})),"segmentsFor"),d=b(()=>{let k=[];for(let S of e){if(S.isLayoutOnly)continue;let E=S.points;!E||E.length<2||k.push(...f(S,Vn(E)))}return k},"allSegments"),p=b((k,S)=>k.horizontal&&S.horizontal?xl(k.a.x,k.b.x,S.a.x,S.b.x)>=8&&Math.abs(k.a.y-S.a.y)<7:k.vertical&&S.vertical?xl(k.a.y,k.b.y,S.a.y,S.b.y)>=8&&Math.abs(k.a.x-S.a.x)<7:!1,"hasCrowdedParallelTrack"),m=b((k,S)=>{let E=k.start,I=k.end,L=f(k,S);if(L.length!==S.length-1)return!1;let O=[E,I].filter(A=>!!A),R=k.labelNodeId?[k.labelNodeId]:[];for(let A of L)if(qa(A.a,A.b,u,O,-2)||qa(A.a,A.b,h,R,-2))return!1;for(let A of e){if(A===k||A.isLayoutOnly)continue;let N=A.points;if(!(!N||N.length<2)){for(let M of L)for(let D of f(A,Vn(N)))if(p(M,D)||N0(M.a,M.b,D.a,D.b,.001))return!1}}return!0},"candidateIsSafe"),g=b((k,S)=>{let E=Vn(k.edge.points??[]);if(E.length<4||k.index>=E.length-1)return;let I=E.map(L=>({...L}));if(k.horizontal)I[k.index].y+=S,I[k.index+1].y+=S;else if(k.vertical)I[k.index].x+=S,I[k.index+1].x+=S;else return;return f(k.edge,I).length===I.length-1?I:void 0},"shiftedCandidate"),y=b((k,S)=>({x:k.x??(S.left+S.right)/2,y:k.y??(S.top+S.bottom)/2}),"nodeCenter"),v=b(k=>{let S=k.edge,E=Vn(S.points??[]);if(E.length!==4||k.index!==1)return;let I=S.start?t.get(S.start):void 0,L=S.end?t.get(S.end):void 0,O=I?tc(I):void 0,R=L?tc(L):void 0,A=E.slice(k.index+2);if(!(!I||!L||!O||!R||A.length===0))return{sourceCenter:y(I,O),targetCenter:y(L,R),sourceRect:O,tail:A}},"sourceDetourContextFor"),x=b((k,S,E,I,L,O)=>{let R=I.y>=E.y,A=R?L.bottom:L.top,N=A+(R?20:-20);if(R&&k.b.y<=N+.001||!R&&k.b.y>=N-.001)return;let M=k.a.x+S;return Vn([{x:E.x,y:A},{x:E.x,y:N},{x:M,y:N},{x:M,y:k.b.y},...O],.001)},"verticalSourceDetour"),w=b((k,S,E,I,L,O)=>{let R=I.x>=E.x,A=R?L.right:L.left,N=A+(R?20:-20);if(R&&k.b.x<=N+.001||!R&&k.b.x>=N-.001)return;let M=k.a.y+S;return Vn([{x:A,y:E.y},{x:N,y:E.y},{x:N,y:M},{x:k.b.x,y:M},...O],.001)},"horizontalSourceDetour"),C=b((k,S)=>{let E=v(k);if(E){if(k.vertical)return x(k,S,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(k.horizontal)return w(k,S,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let k=0;k<12;k++){let S=d(),E=!1;for(let I=0;IN.interior);for(let N of A){for(let M of T){let D=g(N,M);if(D&&m(N.edge,D)){N.edge.points=D,E=!0;break}let B=C(N,M);if(B&&m(N.edge,B)){N.edge.points=B,E=!0;break}}if(E)break}}if(!E)return}}function dRe(e,t,r,n){let i=t.x-e.x,a=t.y-e.y,s=n.x-r.x,o=n.y-r.y,l=i*o-a*s;if(Math.abs(l)<1e-10)return!1;let u=r.x-e.x,h=r.y-e.y,f=(u*o-h*s)/l,d=(u*a-h*i)/l,p=.01;return f>p&&f<1-p&&d>p&&d<1-p}function pRe(e){let t=e.nodes??[],r=e.edges??[],n=[];if(!r.length||!t.length)return n;let i=z_e(t),a=1,s=[];for(let l of r){if(l.isLayoutOnly)continue;let u=l.points;if(!u||u.length<2)continue;let h=l.start,f=l.end,d=l.labelNodeId,p=l.id??`${h}->${f}`;for(let m of i)if(!(m.nodeId===h||m.nodeId===f)&&!(d&&m.nodeId===d)){for(let g=0;g0){let l=n.filter(h=>h.type==="edge-node-overlap").length,u=n.filter(h=>h.type==="edge-edge-crossing").length;se.warn(`[SWIMLANE_VALIDATE] ${n.length} issue(s) detected: ${l} edge-node overlap(s), ${u} edge crossing(s)`);for(let h of n)se.warn(`[SWIMLANE_VALIDATE] ${h.type}: ${h.detail}`)}return n}function mRe(e,t){let r=e.nodes??[],n=e.edges??[],i=r.filter(o=>!o.isGroup);if((t==="LR"||t==="RL")&&i.length>0&&!tRe(e,t)||t==="BT"&&i.length>0&&!eRe(e))return;for(let o of n){if(o.isLayoutOnly)continue;let l=o.points;!l||l.length<2||(o.points=Uf(tL(l)))}uRe(n,r),fRe(n,r),rRe(n,r);let a=new Map;for(let o of r)a.set(String(o.id),o);KR(n,a),H_e(n,a),nRe(n,a),MX(n,a),iRe(n,a),aRe(n,a),EX(n,a),sRe(n,a);let s=b(()=>{cRe(n,a),oRe(n,a),lRe(n,a),KR(n,a),CX(n,a),EX(n,a),KR(n,a),CX(n,a)},"finalizeRenderedEdges");s(),MX(n,a),s(),AX(n,a),_X(n,a),AX(n,a),_X(n,a)}function sg(e){let t=new Map(e.nodeById),r=new Set,n=[];for(let a of e.edges){if(!t.has(a.src)||!t.has(a.dst))continue;let s=`${a.id}:${a.src}->${a.dst}`;r.has(s)||(r.add(s),n.push(a))}return{nodes:[...t.keys()],edges:n,layout:e.layout,nodeById:t}}function tj(e,t){return e.edges.filter(r=>r.dst===t)}function gRe(e){let t=new Map;for(let r of e.nodes)t.set(r,[]);for(let r of e.edges)t.get(r.src).push(r.dst);return t}function rj(e){let t=gRe(e);for(let r of t.values())r.sort((n,i)=>n.localeCompare(i));return t}function nj(e){let t=new Map;for(let r of e.nodes)t.set(r,0);for(let r of e.edges)t.set(r.dst,(t.get(r.dst)??0)+1);return t}function ij(e){return[...e.entries()].filter(([,t])=>t===0).map(([t])=>t).sort((t,r)=>t.localeCompare(r))}function uL(e,t=()=>!0){let r=new Map,n=new Map;for(let i of e.nodes)r.set(i,[]),n.set(i,[]);for(let i of e.edges)t(i)&&(n.get(i.src).push(i.dst),r.get(i.dst).push(i.src));return{preds:r,succs:n}}function aj(e,t,r,n){let i=0;for(let s of e.nodes)n?.skipGroups&&e.nodeById.get(s)?.isGroup||(i=Math.max(i,r[s]??0));let a=Array.from({length:i+1},()=>[]);for(let s of t)n?.skipGroups&&e.nodeById.get(s)?.isGroup||a[Math.max(0,r[s]??0)].push(s);return a}function uC(e){let t=nj(e),r=ij(t),n=[],i=rj(e);for(;r.length;){let a=r.shift();n.push(a);for(let s of i.get(a)??[])if(t.set(s,(t.get(s)??0)-1),(t.get(s)??0)===0){let o=0;for(;o{if(i-n<=1)return 0;let a=n+i>>1,s=r(n,a)+r(a,i),o=n,l=a,u=n;for(;o=i||of.dst===d.dst?f.id.localeCompare(d.id):f.dst.localeCompare(d.dst));let n=Object.create(null);for(let h of t.nodes)n[h]=0;let i=[],a=b(h=>{n[h]=1;for(let f of r.get(h)??[]){let d=f.dst;n[d]===0?a(d):n[d]===1&&i.push(f)}n[h]=2},"dfs"),s=[...t.nodes].sort((h,f)=>h.localeCompare(f));for(let h of s)n[h]===0&&a(h);let o=new Set(i.map(h=>`${h.id}:${h.src}->${h.dst}`)),l=t.edges.map(h=>o.has(`${h.id}:${h.src}->${h.dst}`)?{id:h.id,src:h.dst,dst:h.src,weight:h.weight,ref:h.ref}:h);return{acyclic:{nodes:[...t.nodes],edges:l,layout:t.layout,nodeById:new Map(t.nodeById)},reversed:i}}function vRe(e){let t=new Map,r=b(n=>{if(t.has(n))return t.get(n);let i=e.nodeById.get(n);if(!i)return t.set(n,null),null;let a=i.parentId;if(!a)return t.set(n,null),null;let o=r(a)??a;return t.set(n,o),o},"resolve");for(let n of e.nodes)r(n);return t}function D0(e){let t=vRe(e);return r=>t.get(r)??null}function hL(e){let t=[];for(let r of e.layout.nodes??[])r.isGroup&&!r.parentId&&t.push(r.id);return[...new Set(t)].reverse()}function oj(e,t){let r=hL(e);if(!t||t.length===0)return r;let n=new Set(r),i=new Set,a=[];for(let s of t)!n.has(s)||i.has(s)||(i.add(s),a.push(s));for(let s of r)i.has(s)||a.push(s);return a}function xRe(e,t){let r=sg(e),n=t?.laneOf??(()=>null),i=t?.rankHint,{preds:a}=uL(r);for(let T of a.values())T.sort((k,S)=>k.localeCompare(S));let s=uC(r)??[...r.nodes].sort((T,k)=>T.localeCompare(k)),o=new Map;for(let[T,k]of s.entries())o.set(k,T);let l=new Map,u=new Map;for(let T of r.nodes)u.set(T,[]);for(let T of s){let k=(a.get(T)??[]).filter(S=>l.has(S));if(k.length>0){let S=bRe(T,k,{laneOf:n,rankHint:i,topoIndex:o});l.set(T,S),u.get(S).push(T)}else l.has(T)||l.set(T,null)}for(let T of r.nodes)l.has(T)||l.set(T,null);let h=new Set;for(let T of r.nodes)(l.get(T)??null)===null&&h.add(T);let f=[...h].sort((T,k)=>{let S=o.get(T)??0,E=o.get(k)??0;return S===E?T.localeCompare(k):S-E}),d=wRe(r),p=new Map;for(let[T,k]of d.entries())p.set(T,[...k].sort((S,E)=>S.localeCompare(E)));let m=kRe(p),g=TRe(p),y=new Map;for(let T of r.nodes)y.set(T,[]);for(let T of g)for(let k of T.nodes){let S=y.get(k);S?S.push(T.id):y.set(k,[T.id])}let v=[],x=[],w=new Set,C=b(T=>{if(!w.has(T)){w.add(T),v.push(T);for(let k of u.get(T)??[])C(k);x.push(T)}},"walk");for(let T of f)C(T);for(let T of s)C(T);return{parent:l,children:u,roots:f,componentOf:m,blocks:g,nodeBlocks:y,adjacency:p,preorder:v,postorder:x,topologicalOrder:s}}function bRe(e,t,r){let n=r.laneOf(e);return[...t].sort((a,s)=>{let o=r.laneOf(a),l=r.laneOf(s),u=o!=null&&o===n,h=l!=null&&l===n;if(u!==h)return u?-1:1;let f=r.rankHint?.[a],d=r.rankHint?.[s];if(f!=null&&d!=null&&f!==d)return d-f;let p=r.topoIndex.get(a)??0,m=r.topoIndex.get(s)??0;return p!==m?p-m:a.localeCompare(s)})[0]}function wRe(e){let t=new Map;for(let r of e.nodes)t.set(r,new Set);for(let r of e.edges)t.get(r.src).add(r.dst),t.get(r.dst).add(r.src);return t}function kRe(e){let t=new Map,r=0;for(let n of e.keys()){if(t.has(n))continue;let i=[n];for(;i.length>0;){let a=i.pop();if(!t.has(a)){t.set(a,r);for(let s of e.get(a)??[])t.has(s)||i.push(s)}}r++}return t}function TRe(e){let t=new Map,r=new Map,n=[],i=[],a=0,s=b((o,l)=>{t.set(o,++a),r.set(o,a);for(let u of e.get(o)??[])u!==l&&(t.has(u)?(t.get(u)??0)<(t.get(o)??0)&&(n.push([o,u]),r.set(o,Math.min(r.get(o)??a,t.get(u)??a))):(n.push([o,u]),s(u,o),r.set(o,Math.min(r.get(o)??a,r.get(u)??a)),(r.get(u)??0)>=(t.get(o)??0)&&i.push(CRe(o,u,n,i.length))))},"visit");for(let o of e.keys())t.has(o)||s(o,null);return i}function CRe(e,t,r,n){let i=[],a=new Set;for(;r.length>0;){let s=r.pop();if(i.push(s),a.add(s[0]),a.add(s[1]),s[0]===e&&s[1]===t||s[0]===t&&s[1]===e)break}return{id:n,edges:i,nodes:[...a]}}function SRe(e,t,r){let n=[...e.nodes],i=new Map;for(let[x,w]of n.entries())i.set(w,x);let a=n.length,s=new Array(a).fill(-1),o=new Array(a).fill(0),l=[],u=new Set;for(let x of n){let w=r.parent.get(x)??null,C=i.get(x);C!=null&&w==null&&(s[C]=-1,o[C]=0,u.has(x)||(u.add(x),l.push(x)))}for(;l.length>0;){let x=l.shift(),w=i.get(x);if(w==null)continue;let C=r.children.get(x)??[];for(let T of C){if(u.has(T))continue;let k=i.get(T);k!=null&&(s[k]=w,o[k]=o[w]+1,u.add(T),l.push(T))}}for(let x of n){if(u.has(x))continue;let w=i.get(x);w!=null&&(s[w]=-1,o[w]=0,u.add(x))}let h=Math.max(1,Math.ceil(Math.log2(Math.max(1,a)))+1),f=Array.from({length:h},()=>new Array(a).fill(-1));for(let x=0;x{if(x===-1||w===-1)return-1;o[x]>T&1&&(x=f[T][x],x===-1))return-1;if(x===w)return x;for(let T=h-1;T>=0;T--){let k=f[T][x],S=f[T][w];k===-1||S===-1||k!==S&&(x=k,w=S)}return f[0][x]},"lcaIndex"),p=Array.from({length:a},()=>new Map);for(let x of e.edges){let w=x.src,C=x.dst,T=t[w],k=t[C];if(T==null||k==null||(T>k&&([w,C]=[C,w],[T,k]=[k,T]),T==null||k==null||T===k))continue;let S=i.get(w),E=i.get(C);if(S==null||E==null)continue;let I=d(S,E);if(I===-1)continue;let L=p[I];for(let O=T;O{if(w.size!==0)for(let[C,T]of w)x.set(C,(x.get(C)??0)+T)},"mergeInto"),y=new Set,v=b(x=>{let w=i.get(x);y.add(x);let C=w==null?void 0:p[w],T=C?new Map(C):new Map,k=r.children.get(x)??[];for(let S of k){let E=v(S),I=t[x];if(I!=null){let L=m.get(x);L||(L=new Map,m.set(x,L));let O=E.get(I)??0,R=t[S];R!=null&&R>I&&(O+=1),L.set(S,O)}g(T,E)}return T},"dfs");for(let x of r.roots)y.has(x)||v(x);for(let x of n)y.has(x)||v(x);return m}function ERe(e,t,r){let n=new Map,i=b(a=>{let s=r[a]??0,o=[...t.get(a)??[]];o.sort(lj(r));for(let l of o){i(l);let u=n.get(l);u!=null&&(s=Math.min(s,u))}n.set(a,s)},"annotate");for(let a of e)i(a);return n}function lj(e){return(t,r)=>{let n=e[t]??0,i=e[r]??0;return n===i?t.localeCompare(r):n-i}}function ARe(e,t,r,n){let i=0;for(let l of t){let u=r[l]??0;u>i&&(i=u)}let a=Array.from({length:i+1},()=>[]),s=new Set,o=b(l=>{if(s.has(l))return;s.add(l);let u=r[l]??0;a[u]||(a[u]=[]),a[u].push(l);for(let h of n(l))o(h)},"emit");for(let l of e)o(l);for(let l of t)if(!s.has(l)){let u=r[l]??0;a[u]||(a[u]=[]),a[u].push(l),s.add(l)}return a}function _Re(e){let t=[];for(let r of e){let n=new Set,i=[];for(let a of r)n.has(a)||(n.add(a),i.push(a));t.push(i)}return t}function RRe(e,t,r,n){return i=>{let a=e.get(i)??[];if(a.length===0)return[];let s=t[i]??0,o=[],l=[],u=r.get(i);for(let h of a){let f=n.get(h)??s;f>s?o.push({child:h,min:f}):l.push(h)}return o.sort((h,f)=>h.min===f.min?h.child.localeCompare(f.child):h.min-f.min),l.sort((h,f)=>{let d=u?.get(h)??0,p=u?.get(f)??0;if(d!==p)return d-p;let m=n.get(h)??s,g=n.get(f)??s;return m!==g?m-g:h.localeCompare(f)}),[...o.map(h=>h.child),...l]}}function oL(e,t,r){let n=xRe(e,{rankHint:t,laneOf:r}),{children:i,roots:a}=n;for(let f of e.nodes)i.has(f)||i.set(f,[]);let s=SRe(e,t,n),o=[...a].sort(lj(t)),l=ERe(o,i,t),u=RRe(i,t,s,l),h=ARe(o,e.nodes,t,u);return h=_Re(h),h}function LRe(e,t,r){let n=new Set(e),i=new Set(t),a=E4(t),s=[];for(let o of r)n.has(o.src)&&i.has(o.dst)&&s.push(a.get(o.dst));return sj(s)}function NX(e,t,r){let n=[];for(let a of t){let s=r[a.src],o=r[a.dst];if(s==null||o==null||s===o)continue;let l=a.src,u=a.dst,h=s,f=o;s>o&&(l=a.dst,u=a.src,h=o,f=s);for(let d=h;d(r[d]??0)-(r[f]??0));for(let f of h){let d=r[f]??0;if(d===0)continue;let p=0;for(let v of n.get(f)??[])p=Math.max(p,(r[v]??0)+1);if(p>=d)continue;let m=d;r[f]=p;let g=oL(e,r,i),y=NX(g,e.edges,r);y(t[i]??0)-(t[a]??0)||i.localeCompare(a));for(let i of n){let a=r(i);if(!a)continue;let s=e.edges.filter(g=>g.src===i);if(s.length===0)continue;let o=!1,l=0;for(let g of s){let y=r(g.dst);y==null||y===a?o=!0:l++}if(l===0||o)continue;let u=0,h=!1;for(let g of e.edges){if(g.dst!==i)continue;let y=r(g.src);y&&(y===a?h=!0:u++)}if(u>0||!h)continue;let f=t[i]??0,d=f+l,p=0;for(let g of e.edges)g.dst===i&&(p=Math.max(p,(t[g.src]??0)+1));let m=Math.max(f,p,d);m!==f&&(t[i]=m)}}function NRe(e,t){let r=sg(e),n=uC(r)??[...r.nodes].sort(),i=t?.compactSingleInput??!1,a=D0(r),s=Object.create(null);for(let l of n){let u=tj(r,l),h=t?.ignoreCrossLaneEdges?u.filter(f=>{let d=a(f.src),p=a(l);return!d||!p?!0:d===p}):u;if(h.length===0)s[l]=0;else if(i&&h.length===1){let f=h[0].src,d=a(f),p=a(l);d!==p?s[l]=s[f]??0:s[l]=(s[f]??0)+1}else{let f=-1/0;for(let d of h)f=Math.max(f,(s[d.src]??0)+1);s[l]=f===-1/0?0:f}}return(t?.optimizeRanksByCrossings??!1)&&(s=IRe(r,s)),t?.ignoreCrossLaneEdges&&MRe(r,s),{layers:oL(r,s,a),rankOf:s,dummy:new Set}}function DRe(e,t){let r=sg(e),i={...NRe(r,{compactSingleInput:t?.compactSingleInput,ignoreCrossLaneEdges:t?.ignoreCrossLaneEdges,optimizeRanksByCrossings:t?.optimizeRanksByCrossings}).rankOf},a=D0(r),{preds:s,succs:o}=uL(r,m=>{if(t?.ignoreCrossLaneEdges){let g=a(m.src),y=a(m.dst);if(g&&y&&g!==y)return!1}return!0}),l=uC(r)??[...r.nodes],u=[...l].reverse(),h=b((m,g)=>{let y=0;for(let w of s.get(m)??[])y=Math.max(y,(i[w]??0)+1);let v=Number.POSITIVE_INFINITY,x=o.get(m)??[];return x.length>0&&(v=Math.min(...x.map(w=>(i[w]??0)-1))),Number.isFinite(v)||(v=Math.max(y,g)),Math.min(Math.max(g,y),v)},"clampFeasible"),f=sL.GRAVITY_ITERATIONS,d=b(m=>{let g=!1;for(let y of m){let v=s.get(y)??[],x=o.get(y)??[];if(v.length===0&&x.length===0)continue;let w=v.length>0?v.reduce((S,E)=>S+(i[E]??0)+1,0)/v.length:i[y]??0,C=x.length>0?x.reduce((S,E)=>S+(i[E]??0)-1,0)/x.length:i[y]??0,T=Math.round((w+C)/2),k=h(y,T);k!==i[y]&&(i[y]=k,g=!0)}return g},"relaxOrder");for(let m=0;m0){let y=Math.min(...g.map(v=>(i[v]??0)-1));(i[m]??0)>y&&(i[m]=y)}}return{layers:aj(r,l,i),rankOf:i,dummy:new Set}}function ORe(e){let t=nj(e),r=rj(e),n=ij(t),i=[];for(;n.length>0;){let a=[];for(let s of n){i.push(s);for(let o of r.get(s)??[])t.set(o,(t.get(o)??0)-1),(t.get(o)??0)===0&&a.push(o)}n=a.sort((s,o)=>s.localeCompare(o))}return i.length===e.nodes.length?i:null}function PRe(e,t){let r=sg(e),n=t?.direction==="LR"?ORe(r)??[...r.nodes].sort():uC(r)??[...r.nodes].sort(),i=D0(r),a=b(h=>i(h)??h,"laneOf"),s=Object.create(null),o=new Map,l=b((h,f)=>t?.ignoreCrossLaneEdges??!0?a(h)===a(f)?1:0:1,"edgeWeight");for(let h of n){if(r.nodeById.get(h)?.isGroup)continue;let d=tj(r,h),p=0;if(d.length>0)for(let v of d){let x=v.src,w=s[x]??0;p=Math.max(p,w+l(x,h))}let m=a(h),g=o.get(m)??0,y=Math.max(p,g);s[h]=y,o.set(m,y+1)}return{layers:aj(r,n,s,{skipGroups:!0}),rankOf:s,dummy:new Set}}function BRe(e,t){let r=sg(t),{rankOf:n}=e,i=e.layers.map(p=>[...p]),a=new Set(e.dummy?[...e.dummy]:[]),s=0,o=new Map(r.nodeById),l=b(p=>{let m=`placeholder-${s++}`,g={id:m,isGroup:!1,isDummy:!0,width:0,height:0};for(o.set(m,g),a.add(m);i.length<=p;)i.push([]);return i[p].push(m),n[m]=p,m},"addDummyAt"),u=[...r.edges].sort((p,m)=>p.id===m.id?p.src===m.src?p.dst.localeCompare(m.dst):p.src.localeCompare(m.src):p.id.localeCompare(m.id)),h=[];for(let p of u){let m=n[p.src]??0,g=n[p.dst]??0;if(g-m<=1){h.push(p);continue}let y=p.src;for(let x=m+1,w=0;x!r.nodes.includes(p))],edges:h,layout:r.layout,nodeById:o};return{layering:{layers:i,rankOf:n,dummy:a},graphWithDummies:d}}function DX(e){let t=e.length;if(t===0)return Number.POSITIVE_INFINITY;let r=[...e].sort((n,i)=>n-i);return t%2===1?r[(t-1)/2]:.5*(r[t/2-1]+r[t/2])}function OX(e){return e.length===0?Number.POSITIVE_INFINITY:e.reduce((r,n)=>r+n,0)/e.length}function FRe(e,t,r,n){let i=new Map;for(let a of e)i.set(a,[]);for(let a of r)n==="down"?t.has(a.src)&&i.has(a.dst)&&i.get(a.dst).push(t.get(a.src)):t.has(a.dst)&&i.has(a.src)&&i.get(a.src).push(t.get(a.dst));return i}function $Re(e,t,r){let n=r.get(e)??0,i=r.get(t)??0;return n!==i?n-i:e.localeCompare(t)}function PX(e,t,r){let n=new Set(e),i=new Set(t),a=E4(e),s=E4(t),o=[];for(let u of r)n.has(u.src)&&i.has(u.dst)&&o.push({u:a.get(u.src),v:s.get(u.dst)});o.sort((u,h)=>u.u===h.u?u.v-h.v:u.u-h.u);let l=o.map(u=>u.v);return sj(l)}function ZR(e,t,r){return[...e].sort((n,i)=>{let a=DX(t.get(n)??[]),s=DX(t.get(i)??[]);return a===s?$Re(n,i,r):isFinite(a)?isFinite(s)?a-s:-1:1})}function BX(e,t,r,n,i,a){let s=E4(e),o=E4(t),l=FRe(t,s,r,n);if(!i||!a||a.length===0)return ZR(t,l,o);let u=new Map;for(let d of t){let p=i(d),m=u.get(p)??[];m.push(d),u.set(p,m)}let h=[];for(let d of a){let p=u.get(d);if(!p||p.length===0)continue;let m=ZR(p,l,o);h.push(...m)}let f=u.get(null);if(f&&f.length>0){let d=ZR(f,l,o);for(let p of d){let m=OX(l.get(p)??[]),g=h.length;if(isFinite(m))for(let[y,v]of h.entries()){let x=OX(l.get(v)??[]);if(ms.has(g.src)&&o.has(g.dst)),h=l?r.filter(g=>o.has(g.src)&&l.has(g.dst)):void 0,f=b(g=>{let y=PX(e,g,u);return h&&n&&(y+=PX(g,n,h)),y},"crossingScore"),d=i?new Map:null;if(i&&d)for(let g of t)d.set(g,i(g));let p=!0,m=f(a);for(;p;){p=!1;for(let g=0;g+1[...o]),i=t.edges,a=D0(t),s=oj(t,r?.laneOrder);for(let o=0;o<3;o++){for(let l=1;l=0;l--)n[l]=BX(n[l+1],n[l],i,"up",a,s),n[l]=FX(n[l+1],n[l],i,n[l-1],a)}return{layers:n}}function GRe(e,t,r){let n=r?.layerGap??b_e.DEFAULT_LAYER_GAP,i=r?.nodeGap??b_e.DEFAULT_NODE_GAP,a=r?.laneGap??i*2,s=r?.direction??"TB",o=s==="LR"||s==="RL",l=e.layers,u=Object.create(null),h=Object.create(null),f=b(L=>t.nodeById.get(L),"getNode"),d=b(L=>f(L)?.width??0,"getWidth"),p=b(L=>f(L)?.height??0,"getHeight"),m=D0(t),g=oj(t,r?.laneOrder),y=l.map(L=>L.reduce((O,R)=>Math.max(O,p(R)),0)),v=[];if(o)for(let L=0;L+1Math.max(P,d($)),0),R=l[L+1].reduce((P,$)=>Math.max(P,d($)),0),A=y[L],N=y[L+1],M=A/2+N/2,D=(O+R)/2,B=Math.max(0,D-M-n);v.push(B)}let x=new Set;for(let L of l)for(let O of L)x.add(m(O));let w=x.has(null),C=g.filter(L=>x.has(L)),T=[...w?[null]:[],...C],k=Object.create(null);for(let L of C)k[L]=0;w&&(k.null=0);for(let L of l){let O=Object.create(null),R=[];for(let A of L){let N=m(A);N===null?R.push(A):(O[N]||=[]).push(A)}for(let[A,N]of Object.entries(O)){let M=N.reduce((D,B)=>D+d(B),0)+i*Math.max(0,N.length-1);k[A]=Math.max(k[A]??0,M)}if(w&&R.length){let A=R.reduce((N,M)=>N+d(M),0)+i*Math.max(0,R.length-1);k.null=Math.max(k.null??0,A)}}let S=new Map;{let L=T.map(A=>(A===null?k.null:k[A])??0),R=-(L.reduce((A,N)=>A+N,0)+a*Math.max(0,T.length-1))/2;for(let A=0;Ad(q)),$=P.reduce((q,G)=>q+G,0)+i*(D.length-1),F=B-$/2;for(let[q,G]of D.entries()){let z=P[q];u[G]=F+z/2,h[G]=E+R/2,F+=z+i}}}let N=v[L]??0;E+=R+n+N}let I=new Map;for(let L of t.edges){let O=L.ref.id;I.has(O)||I.set(O,[]),I.get(O).push(L)}for(let[,L]of I){if(L.length===0)continue;let O=L[0].ref,R=O.start,A=O.end;if(R==null||A==null)continue;let N=Math.round(((u[R]??0)+(u[A]??0))/2),M=new Set;for(let D of L)M.add(D.src),M.add(D.dst);for(let D of M){if(D===R||D===A)continue;t.nodeById.get(D)?.isDummy&&(u[D]=N)}}return{x:u,y:h}}function VRe(e){let t=2166136261;for(let r=0;r>>0}function WRe(e){let t=e>>>0;return()=>{t+=1831565813;let r=t;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function HRe(e,t){let r=[...e],n=WRe(t);for(let i=r.length-1;i>0;i--){let a=Math.floor(n()*(i+1));[r[i],r[a]]=[r[a],r[i]]}return r}function URe(e,t){let r=0;for(let[n,i]of e.entries())r+=Math.abs(n-(t.get(i)??n));return r}function $X(e,t){let r=new Map;for(let[i,a]of e.entries())r.set(a,i);let n=0;for(let{a:i,b:a,weight:s}of t){let o=r.get(i),l=r.get(a);o==null||l==null||(n+=s*Math.abs(o-l))}return n}function YRe(e){let t=hL(e);if(t.length<2)return[];let r=new Map(t.map((a,s)=>[a,s])),n=D0(e),i=new Map;for(let a of e.layout.edges??[]){if(a.isLayoutOnly)continue;let s=typeof a.start=="string"?a.start:void 0,o=typeof a.end=="string"?a.end:void 0;if(!s||!o||!e.nodeById.has(s)||!e.nodeById.has(o))continue;let l=n(s),u=n(o);if(!l||!u||l===u)continue;let h=r.get(l),f=r.get(u);if(h==null||f==null)continue;let[d,p]=h<=f?[l,u]:[u,l],m=`${d}\0${p}`,g=i.get(m);g?g.weight++:i.set(m,{a:d,b:p,weight:1})}return[...i.values()]}function zX(e,t,r){let n=[...e],i=$X(n,t),a=!0,s=0,o=Math.max(1,n.length);for(;a&&si.a===a.a?i.b.localeCompare(a.b):i.a.localeCompare(a.a)).map(({a:i,b:a,weight:s})=>`${i}:${a}:${s}`).join("|");return VRe(`${e.join("|")}#${n}#${r}`)}function KRe(e,t={}){let r=hL(e);if(r.length<2)return r;let n=YRe(e);if(n.length===0)return r;let i=new Map(r.map((o,l)=>[o,l])),a=zX(r,n,i),s=Math.max(0,t.restarts??qRe);for(let o=0;oEn&&l*3>=o?s>0?"bottom":"top":o>En?a>0?"right":"left":r}function qX(e,t){return Math.abs(e.to-t.from)ie.isGroup&&!ie.parentId);for(let ie of u){let Q={id:ie.id},he=b(xe=>{s.set(xe.id,Q),r.filter(ce=>ce.parentId===xe.id).forEach(he)},"assignLane");he(ie)}let h=r.filter(ie=>!ie.isGroup&&!ie.isEdgeLabel).map(ie=>{let Q=ie.width??10,he=ie.height??10,xe=ie.x??0,ce=ie.y??0,ge=FAt;return{nodeId:ie.id,minX:xe-Q/2-ge,maxX:xe+Q/2+ge,minY:ce-he/2-ge,maxY:ce+he/2+ge,visualXHalfExtent:l?he/2+ge:Q/2+ge}}),f=b((ie,Q,he,xe)=>{let ce=o.find(ge=>ge.orientation===ie&&Math.abs(ge.coord-Q)<1);return ce||(ce={id:`pipe-${ie}-${Q.toFixed(0)}`,orientation:ie,coord:Q,spanMin:he,spanMax:xe,tracks:[]},o.push(ce)),ce.spanMin=Math.min(ce.spanMin,he),ce.spanMax=Math.max(ce.spanMax,xe),ce},"getOrAddPipe"),d=b((ie,Q)=>{let he=ie.width??10,xe=ie.height??10,ce=ie.x??0,ge=ie.y??0;switch(Q){case"top":return{x:ce,y:ge-xe/2};case"bottom":return{x:ce,y:ge+xe/2};case"left":return{x:ce-he/2,y:ge};case"right":return{x:ce+he/2,y:ge}}},"portForSide"),p=b((ie,Q,he)=>d(ie,GX(ie,Q,he?"bottom":"top")),"getOrthogonalPort"),m=[],g=[],y=new Set,v=1e3,x=b((ie,Q,he)=>{if(m.length===0)return 0;let xe=Math.abs(Q.y-he.y)ne||V.from-En<=Ie&&V.to+En>=Ie&&(ge+=v)}else if(ce){let Ie=Q.x,ye=Math.min(Q.y,he.y)-En,ne=Math.max(Q.y,he.y)+En;if(ne<=ye)return 0;for(let V of m)V.edgeIndex===ie||V.orientation!=="horizontal"||V.pipe.coordne||V.from-En<=Ie&&V.to+En>=Ie&&(ge+=v)}return ge},"crossingPenalty"),w=i.map((ie,Q)=>{if(!ie.start||!ie.end)return{idx:Q,crossLane:0,dx:0,dy:0};let he=a.get(ie.start),xe=a.get(ie.end),ce=s.get(ie.start),ge=s.get(ie.end),Ie=ce&&ge&&ce.id!==ge.id?1:0,ye=he&&xe?Math.abs((xe.x??0)-(he.x??0)):0,ne=he&&xe?Math.abs((xe.y??0)-(he.y??0)):0;return{idx:Q,crossLane:Ie,dx:ye,dy:ne}}).sort((ie,Q)=>{if(ie.crossLane!==Q.crossLane)return Q.crossLane-ie.crossLane;let he=ie.dx+ie.dy,xe=Q.dx+Q.dy;return Math.abs(he-xe)>1?he-xe:ie.idx-Q.idx}).map(ie=>ie.idx),C=b((ie,Q,he,xe)=>{let ce=Math.min(ie.x,Q.x),ge=Math.max(ie.x,Q.x),Ie=Math.min(ie.y,Q.y),ye=Math.max(ie.y,Q.y);return!!h.find(V=>he&&V.nodeId===he||xe&&V.nodeId===xe?!1:Math.abs(ie.x-Q.x)>En?V.minYie.y&&V.maxX>ce&&V.minXie.x&&V.maxY>Ie&&V.minYGX(ie,Q,"bottom"),"determineSide"),E=new Map;for(let[ie,Q]of i.entries()){if(!Q.start||!Q.end||Q.start===Q.end||Q.points&&Q.points.length>0)continue;let he=a.get(Q.start),xe=a.get(Q.end);if(!he||!xe)continue;let ce=(xe.x??0)-(he.x??0),ge=(xe.y??0)-(he.y??0);E.set(ie,{edgeIdx:ie,srcId:Q.start,dstId:Q.end,srcSide:S(he,{x:xe.x??0,y:xe.y??0}),dstSide:S(xe,{x:he.x??0,y:he.y??0}),absDx:Math.abs(ce),absDy:Math.abs(ge),dxSign:Math.sign(ce),dySign:Math.sign(ge)})}let I=b(ie=>ie.srcSide==="top"||ie.srcSide==="bottom"?ie.absDx===0?1/0:ie.absDy/ie.absDx:ie.absDy===0?1/0:ie.absDx/ie.absDy,"preferenceStrength"),L=b(ie=>ie.srcSide==="top"||ie.srcSide==="bottom"?ie.dxSign>=0?"right":"left":ie.dySign>=0?"bottom":"top","secondarySide"),O=new Map;for(let ie of E.values()){let Q=`${ie.srcId}:${ie.srcSide}`;O.has(Q)||O.set(Q,[]),O.get(Q).push(ie)}let R=new Map,A=b((ie,Q)=>`${ie}:${Q}`,"loadKey");for(let ie of E.values())R.set(A(ie.srcId,ie.srcSide),(R.get(A(ie.srcId,ie.srcSide))??0)+1),R.set(A(ie.dstId,ie.dstSide),(R.get(A(ie.dstId,ie.dstSide))??0)+1);for(let ie of O.values())if(!(ie.length<2)){ie.sort((Q,he)=>{let xe=I(Q),ce=I(he);return Math.abs(xe-ce)>1e-9?ce-xe:Q.edgeIdx-he.edgeIdx});for(let Q=1;Q=ce||(R.set(A(he.srcId,he.srcSide),ce-1),R.set(A(he.srcId,xe),ge+1),he.srcSide=xe)}}let N=b(ie=>{let Q=ie?.shape;return Q==="question"||Q==="diamond"},"isDiamondNode"),M=new Map;for(let ie of E.values())M.has(ie.dstId)||M.set(ie.dstId,new Set),M.get(ie.dstId).add(ie.dstSide);for(let ie of E.values()){if(!N(a.get(ie.srcId)))continue;let Q=M.get(ie.srcId);if(!Q?.has(ie.srcSide))continue;let he=L(ie);if(Q.has(he)||(R.get(A(ie.srcId,he))??0)>0)continue;let xe=R.get(A(ie.srcId,ie.srcSide))??0;R.set(A(ie.srcId,ie.srcSide),Math.max(0,xe-1)),R.set(A(ie.srcId,he),1),ie.srcSide=he}for(let ie of E.values()){let{edgeIdx:Q,srcId:he,dstId:xe,srcSide:ce,dstSide:ge}=ie,Ie=a.get(he),ye=a.get(xe),ne=`${he}:${ce}:src`,V=ce==="top"||ce==="bottom"?ye.x??0:ye.y??0;T.has(ne)||T.set(ne,[]),T.get(ne).push({edgeIdx:Q,oppositeCoord:V});let pe=`${xe}:${ge}:dst`,K=ge==="top"||ge==="bottom"?Ie.x??0:Ie.y??0;T.has(pe)||T.set(pe,[]),T.get(pe).push({edgeIdx:Q,oppositeCoord:K})}let D=new Map,B=8;for(let[ie,Q]of T){if(Q.length<2)continue;Q.sort((ze,Fe)=>ze.oppositeCoord-Fe.oppositeCoord);let he=ie.split(":"),xe=he.slice(0,-2).join(":"),ce=he[he.length-2],ge=he[he.length-1],Ie=a.get(xe);if(!Ie)continue;let ne=ce==="left"||ce==="right"?Ie.height??10:Ie.width??10,V=Ie.shape,K=V==="question"||V==="diamond"?ne*.3:ne,Z=Math.min(20,Math.max(B,K/(Q.length+1))),Ne=-(Z*(Q.length-1))/2;for(let[ze,Fe]of Q.entries()){let Ke=Ne+ze*Z,Ve=`${Fe.edgeIdx}:${ge}`;D.set(Ve,Ke)}}let P=b(ie=>!!i[ie]?.labelNodeId,"edgeHasLabelNode"),$=b((ie,Q)=>ie?(T.get(`${ie}:${Q}:src`)??[]).some(({edgeIdx:he})=>P(he))||(T.get(`${ie}:${Q}:dst`)??[]).some(({edgeIdx:he})=>P(he)):!1,"faceHasLabelNode"),F=b((ie,Q,he)=>Q==="top"||Q==="bottom"?{x:ie.x+he,y:ie.y}:{x:ie.x,y:ie.y+he},"applyPortOffset"),q=b((ie,Q,he)=>{let xe=E.get(ie),ce={x:he.x??0,y:he.y??0},ge={x:Q.x??0,y:Q.y??0},Ie=xe?.srcSide??S(Q,ce),ye=xe?.dstSide??S(he,ge),ne=xe?d(Q,xe.srcSide):p(Q,ce,!0),V=xe?d(he,xe.dstSide):p(he,ge,!1),pe=D.get(`${ie}:src`),K=D.get(`${ie}:dst`);return pe!==void 0&&(ne=F(ne,Ie,pe)),K!==void 0&&(V=F(V,ye,K)),{pSrcPort:ne,pDstPort:V,srcSide:Ie,dstSide:ye}},"portsForEdge");for(let ie of w){let Q=i[ie];if(g[ie]=[],!Q.start||!Q.end||Q.points&&Q.points.length>0||Q.start===Q.end)continue;let he=a.get(Q.start),xe=a.get(Q.end);if(!he||!xe)continue;let{pSrcPort:ce,pDstPort:ge,srcSide:Ie,dstSide:ye}=q(ie,he,xe),ne={...ce},V={...ge},pe=Ie==="top"||Ie==="bottom",K=ye==="top"||ye==="bottom";if(pe){let lt=ce.y>(he.y??0);ne.y=lt?ce.y+Ru:ce.y-Ru}else{let lt=ce.x>(he.x??0);ne.x=lt?ce.x+Ru:ce.x-Ru}if(K){let lt=ge.y>(xe.y??0);V.y=lt?ge.y+Ru:ge.y-Ru}else{let lt=ge.x>(xe.x??0);V.x=lt?ge.x+Ru:ge.x-Ru}let ve=b((lt,pt)=>{for(let St of h)if(!pt.includes(St.nodeId)&<.x>St.minX&<.xSt.minY&<.y{if(ur){let jr=lt.y>(pt.y??0);return{x:(St.x??0)>=lt.x?Ir.maxX+rv:Ir.minX-rv,y:jr?Ir.maxY+k4:Ir.minY-k4,leavesPositiveSide:jr}}let gn=lt.x>(pt.x??0),Fn=(St.y??0)>=lt.y;return{x:gn?Ir.maxX+rv:Ir.minX-rv,y:Fn?Ir.maxY+k4:Ir.minY-k4,leavesPositiveSide:gn}},"obstacleDetour"),je=[],Ne=[Q.start,Q.end],ze=ve(ne,Ne);if(ze.inside&&ze.obstacle){let lt=ze.obstacle;if(pe){let pt=Z(ce,he,xe,lt,!0);ne.x=pt.x,ne.y=pt.y;let St=pt.leavesPositiveSide?Math.min(lt.minY-2,ce.y+Ru):Math.max(lt.maxY+2,ce.y-Ru);je=[{x:ce.x,y:St},{x:pt.x,y:St},{x:pt.x,y:pt.y}]}else{let pt=Z(ce,he,xe,lt,!1),St=pt.leavesPositiveSide?Math.min(lt.minX-2,ce.x+Ru):Math.max(lt.maxX+2,ce.x-Ru);ne.x=pt.x,ne.y=pt.y,je=[{x:St,y:ce.y},{x:St,y:pt.y},{x:pt.x,y:pt.y}]}}let Fe=[],Ke=ve(V,Ne);if(Ke.inside&&Ke.obstacle){let lt=Ke.obstacle;if(K){let pt=Z(ge,xe,he,lt,!0);V.x=pt.x,V.y=pt.y,Fe=[{x:pt.x,y:pt.y},{x:ge.x,y:pt.y}]}else{let pt=Z(ge,xe,he,lt,!1);V.x=pt.x,V.y=pt.y,Fe=[{x:pt.x,y:pt.y},{x:pt.x,y:ge.y}]}}if(je.length===0&&Fe.length===0){let lt=rv,pt=Math.abs(ne.x-V.x)1||gn>1,jr=k.get(Q.start??"")??0,Ft=k.get(Q.end??"")??0,kt=ur>1&&$(Q.start,Ie)||gn>1&&$(Q.end,ye),zt=ur<=1||jr<=2,Wt=gn<=1||Ft<=2;if((pt||St)&&!Ir&&(!Fn||Fn&&!kt&&zt&&Wt)&&!C(ce,ge,Q.start,Q.end)){Q.points=[{...ce},{...ne},{...V},{...ge}],y.add(ie);let Le=St?"horizontal":"vertical",Ri=St?ce.y:ce.x,Pe=St?Math.min(ce.x,ge.x):Math.min(ce.y,ge.y),qr=St?Math.max(ce.x,ge.x):Math.max(ce.y,ge.y),Ha={id:`fast-path-${Le}-${Ri.toFixed(0)}-${ie}`,orientation:Le,coord:Ri,spanMin:Pe,spanMax:qr,tracks:[]};m.push({edgeIndex:ie,segmentIndex:0,orientation:Le,pipe:Ha,trackIndex:0,from:Pe,to:qr});continue}}let Ve=f("vertical",ne.x,ne.y,ne.y);ne.x=Ve.coord;let tt=f("vertical",V.x,V.y,V.y);V.x=tt.coord;let We=Math.min(ne.x,V.x)-50,rt=Math.max(ne.x,V.x)+50,Se=Math.min(ne.y,V.y)-50,Et=Math.max(ne.y,V.y)+50;for(let lt of h){let pt=Math.min(ne.x,V.x),St=Math.max(ne.x,V.x),Ir=Math.min(ne.y,V.y),ur=Math.max(ne.y,V.y);lt.minXpt&<.minYIr&&(We=Math.min(We,lt.minX-jR),rt=Math.max(rt,lt.maxX+jR),Se=Math.min(Se,lt.minY-jR),Et=Math.max(Et,lt.maxY+jR))}for(let lt of h){if(lt.maxXrt||lt.maxYEt)continue;let pt=rv;f("horizontal",lt.minY-pt,We,rt),f("horizontal",lt.maxY+pt,We,rt);let St=k4;f("vertical",lt.minX-St,Se,Et),f("vertical",lt.maxX+St,Se,Et)}f("horizontal",ne.y,We,rt),f("horizontal",V.y,We,rt);let De=o.filter(lt=>lt.orientation==="horizontal"&<.coord>=Se&<.coord<=Et),mt=o.filter(lt=>lt.orientation==="vertical"&<.coord>=We&<.coord<=rt),Tt=b((lt,pt)=>`${lt.toFixed(1)},${pt.toFixed(1)}`,"getKey"),jt=Tt(ne.x,ne.y),_t=Tt(V.x,V.y),Rt=new Map,bt=new Map,ke=new Map,yt=new Set,xt=[];Rt.set(jt,0),ke.set(jt,"n"),xt.push({key:jt,f:Math.hypot(V.x-ne.x,V.y-ne.y),pt:ne}),yt.add(jt);let it=[],Me=b((lt,pt)=>C(lt,pt,Q.start,Q.end),"checkSegmentBlocked"),ut={x:V.x,y:ne.y},at=Me(ne,ut),dt=Me(ut,V),tr=at||dt,Vt={x:ne.x,y:V.y},rr=Me(ne,Vt),Dr=Me(Vt,V);if(tr?rr||Dr||(Math.abs(ne.x-V.x)0;){xt.sort((Ft,kt)=>Ft.f-kt.f);let lt=xt.shift();if(yt.delete(lt.key),lt.key===_t){let Ft=_t,kt=V;for(it=[kt];bt.has(Ft);){let zt=bt.get(Ft);it.unshift(zt),kt=zt,Ft=Tt(zt.x,zt.y)}break}let pt=lt.pt.x,St=lt.pt.y,Ir=mt.sort((Ft,kt)=>Ft.coord-kt.coord),ur=Ir.findIndex(Ft=>Math.abs(Ft.coord-pt)<1),gn=De.sort((Ft,kt)=>Ft.coord-kt.coord),Fn=gn.findIndex(Ft=>Math.abs(Ft.coord-St)<1),jr=[];ur>0&&jr.push({x:Ir[ur-1].coord,y:St}),ur>=0&&ur0&&jr.push({x:pt,y:gn[Fn-1].coord}),Fn>=0&&Fnnt.nodeId===Q.start||nt.nodeId===Q.end?!1:kt!==zt?nt.minYSt&&nt.maxX>kt&&nt.minXpt&&nt.maxY>Wt&&nt.minY10&&Sp<-5||Ku<-10&&Sp>5)&&(qr=Math.abs(Sp)*100),(Ha>10&&Ad<-5||Ha<-10&&Ad>5)&&(qr+=Math.abs(Ad)*50);let X2=0,ta=ke.get(lt.key)??"n",Zo=Math.abs(Ad)>En?"h":"v";ta!=="n"&&ta!==Zo&&(X2=50);let _d=Ri+Pe+qr+X2,Gt=(Rt.get(lt.key)??1/0)+_d,$e=Math.abs(V.x-Ft.x)+Math.abs(V.y-Ft.y);if(Gt<(Rt.get(Le)??1/0))if(bt.set(Le,lt.pt),Rt.set(Le,Gt),ke.set(Le,Zo),!yt.has(Le))xt.push({key:Le,f:Gt+$e,pt:Ft}),yt.add(Le);else{let nt=xt.findIndex(Ht=>Ht.key===Le);nt!==-1&&(xt[nt].f=Gt+$e)}}}if(it.length===0&&(it=[ne,{x:ne.x,y:V.y},V]),it.length>4){let lt=it[0],pt=it[it.length-1],St=Math.min(lt.x,pt.x),Ir=Math.max(lt.x,pt.x),ur=Math.min(lt.y,pt.y),gn=Math.max(lt.y,pt.y);for(let Wt of it)St=Math.min(St,Wt.x),Ir=Math.max(Ir,Wt.x),ur=Math.min(ur,Wt.y),gn=Math.max(gn,Wt.y);let Fn=Ir>Math.max(lt.x,pt.x),jr=StPe.minXwt&&Pe.minYwr);if(Ri.length>0){let Pe=Math.max(lt.x,pt.x);for(let qr of Ri){let Ha=(qr.minX+qr.maxX)/2;if(qr.visualXHalfExtent===void 0||isNaN(qr.visualXHalfExtent))continue;let Ku=Ha+qr.visualXHalfExtent+Wt;Pe=Math.max(Pe,Ku)}isNaN(Pe)||(Ir=Pe)}}if(jr){let wt=h.filter(wr=>wr.minXMath.min(lt.y,pt.y));if(wt.length>0){let wr=Math.min(lt.x,pt.x);for(let Le of wt){let Pe=(Le.minX+Le.maxX)/2-Le.visualXHalfExtent-Wt;wr=Math.min(wr,Pe)}St=wr}}}let Ft=b(Wt=>{let wt=pt.y>lt.y,wr=h.filter(Pe=>{let qr=Math.min(lt.x,pt.x)Pe.minX,Ha=Math.min(lt.y,pt.y)Pe.minY;return qr&&Ha}),Le=wr;if(l&&wr.length>0){let Pe=wr.filter(qr=>qr.minXWt);Pe.length>0&&(Le=Pe)}if(Le.length===0)return pt.y;let Ri=rv;if(wt){let qr=Math.max(...Le.map(Ha=>Ha.maxY))+Ri;if(qrHa.minY))-Ri;if(qr>pt.y+En)return qr}return pt.y},"findBestReturnY"),kt=b(Wt=>{let wt=Ft(Wt),wr={x:Wt,y:lt.y},Le={x:Wt,y:wt},Ri={x:pt.x,y:wt},Pe=Me(lt,wr),qr=Me(wr,Le),Ha=Me(Le,Ri),Ku=wt!==pt.y?Me(Ri,pt):!1;return!Pe&&!qr&&!Ha&&!Ku?Math.abs(wt-pt.y)=3){let lt=Qt[Qt.length-1],pt=Qt[Qt.length-2],St=Qt[Qt.length-3],Ir=Math.abs(St.y-pt.y)Math.abs(lt.x-St.x)&&Qt.splice(-2,1)}else if(ur){let gn=Math.sign(pt.y-St.y),Fn=Math.sign(lt.y-St.y);gn!==0&&gn===Fn&&Math.abs(pt.y-St.y)>Math.abs(lt.y-St.y)&&Qt.splice(-2,1)}}let yr=[Qt[0]];for(let lt=1;ltpt.x,gn=Ir.x>St.x;if(ur!==gn){yr.push(St);continue}continue}if(Math.abs(pt.x-St.x)pt.y,gn=Ir.y>St.y;if(ur!==gn){yr.push(St);continue}continue}yr.push(St)}yr.push(Qt[Qt.length-1]);for(let lt=0;ltie.from{let ce=!xe.segments.some(Ie=>(Ie.edgeIndex!==Q.edgeIndex||Ie.segmentIndex!==Q.segmentIndex)&&G(Ie,ie)),ge=!he.segments.some(Ie=>(Ie.edgeIndex!==ie.edgeIndex||Ie.segmentIndex!==ie.segmentIndex)&&G(Ie,Q));return ce&&ge?(ie.trackIndex=xe.index,Q.trackIndex=he.index,he.segments=[...he.segments.filter(Ie=>Ie.edgeIndex!==ie.edgeIndex||Ie.segmentIndex!==ie.segmentIndex),{edgeIndex:Q.edgeIndex,segmentIndex:Q.segmentIndex,from:Q.from,to:Q.to}],xe.segments=[...xe.segments.filter(Ie=>Ie.edgeIndex!==Q.edgeIndex||Ie.segmentIndex!==Q.segmentIndex),{edgeIndex:ie.edgeIndex,segmentIndex:ie.segmentIndex,from:ie.from,to:ie.to}],!0):!1},"trySwapSegmentsAcrossTracks"),H=b(ie=>{let Q=ie.tracks.length;return ie.tracks[Q]={index:Q,coord:ie.coord,segments:[]},Q},"createNewTrack"),j=b((ie,Q)=>{let he=ie.pipe.tracks[ie.trackIndex];he.segments=he.segments.filter(ce=>ce.edgeIndex!==ie.edgeIndex||ce.segmentIndex!==ie.segmentIndex),ie.trackIndex=Q,ie.pipe.tracks[Q].segments.push({edgeIndex:ie.edgeIndex,segmentIndex:ie.segmentIndex,from:ie.from,to:ie.to})},"moveSegmentToTrack"),J=b((ie,Q)=>{let he=g[ie.edgeIndex];for(let xe of he){let ce=m[xe];ce.pipe===ie.pipe&&j(ce,Q)}},"moveSegmentChainToTrack"),U=b(ie=>{let Q=g[ie.edgeIndex],he=Q.indexOf(m.indexOf(ie)),xe=[];return he>0&&xe.push(m[Q[he-1]]),he{if(ie.orientation===Q.orientation)return!1;let he=ie.orientation==="horizontal"?ie:Q,xe=ie.orientation==="horizontal"?Q:ie;return xe.pipe.coord>he.from&&xe.pipe.coordxe.from&&he.pipe.coord{for(let he of ie.tracks)if(!he.segments.some(ce=>(ce.edgeIndex!==Q.edgeIndex||ce.segmentIndex!==Q.segmentIndex)&&G(ce,Q)))return he.index;return-1},"findAvailableTrack"),ue=b((ie,Q)=>{if(ie.trackIndex===Q.trackIndex)return G(ie,Q);let he=U(ie),xe=U(Q);return he.some(ce=>xe.some(ge=>le(ce,ge)))},"segmentsConflict"),ae=b((ie,Q,he)=>{if(z(ie,Q,ie.pipe.tracks[ie.trackIndex],Q.pipe.tracks[Q.trackIndex]))return;let xe=ee(ie.pipe,Q);he(Q,xe!==-1?xe:H(ie.pipe))},"resolveTrackConflict"),oe=b(ie=>{let Q=0;for(let he=0;he{if(Re.has(ie))return Re.get(ie);let Q=g[ie];if(Q.length===0){let ye={dest:0,deviation:0,base:0,delta:0};return Re.set(ie,ye),ye}let xe=m[Q[0]].pipe.coord,ce=xe;for(let ye=1;yeMath.abs(pe-xe)?V:pe;break}}let ge=Math.abs(ce-xe),Ie={dest:ce,deviation:ge,base:xe,delta:ce-xe};return Re.set(ie,Ie),Ie},"getDestInfo"),Oe=b(()=>{let ie=0,Q=new Map;for(let[xe,ce]of i.entries())g[xe].length!==0&&ce.start&&(Q.has(ce.start)||Q.set(ce.start,[]),Q.get(ce.start).push(xe));let he=b(xe=>{let ce=i[xe];if(!ce.start||!ce.end)return 0;let ge=a.get(ce.start),Ie=a.get(ce.end);if(!ge||!Ie)return 0;let ye=(Ie.x??0)-(ge.x??0),ne=(Ie.y??0)-(ge.y??0);return Math.abs(ye)+Math.abs(ne)},"getEdgeDistance");for(let xe of Q.values()){xe.sort((ge,Ie)=>{let ye=Te(ge),ne=Te(Ie);if(Math.abs(ye.deviation-ne.deviation)>1)return ye.deviation-ne.deviation;if(Math.abs(ye.dest-ne.dest)>1)return ye.dest-ne.dest;let V=he(ge),pe=he(Ie);if(Math.abs(V-pe)>1)return pe-V;let K=g[ge].length,ve=g[Ie].length;if(K!==ve)return K-ve;if(K===1){let Z=g[ge][0],je=g[Ie][0];if(m[Z]&&m[je]){let Ne=m[Z],ze=m[je],Fe=Math.abs(Ne.to-Ne.from),Ke=Math.abs(ze.to-ze.from);if(Math.abs(Fe-Ke)>1)return Fe-Ke}}return 0});let ce=xe.map(ge=>m[g[ge][0]]);ie+=oe(ce)}return ie},"fixSourceHandleCrossings"),qe=b(()=>{let ie=0,Q=new Map;for(let[he,xe]of i.entries())g[he].length!==0&&xe.end&&(Q.has(xe.end)||Q.set(xe.end,[]),Q.get(xe.end).push(he));for(let he of Q.values()){he.sort((ce,ge)=>{let Ie=b(V=>{let pe=g[V];if(pe.length<2)return 0;let K=m[pe[pe.length-2]];return Math.abs(K.to-K.from)},"getDist"),ye=Ie(ce),ne=Ie(ge);return Math.abs(ye-ne)>.1?ye-ne:ce-ge});let xe=he.map(ce=>m[g[ce][g[ce].length-1]]);ie+=oe(xe)}return ie},"fixTargetHandleCrossings"),Ge=b(()=>{let ie=0;for(let Q of o){let he=[];for(let xe of Q.tracks)for(let ce of xe.segments){let ge=g[ce.edgeIndex].find(Ie=>m[Ie].segmentIndex===ce.segmentIndex);ge!==void 0&&he.push(m[ge])}he.sort((xe,ce)=>xe.edgeIndex-ce.edgeIndex||xe.segmentIndex-ce.segmentIndex);for(let xe=0;xe{xe.segments.forEach(ce=>{Q.push({edgeIndex:ce.edgeIndex,segmentIndex:ce.segmentIndex,trackIndex:xe.index,from:ce.from,to:ce.to})})}),Q.sort((xe,ce)=>xe.from-ce.from);let he=[];if(Q.length>0){let xe=[Q[0]],ce=Q[0].to;for(let ge=1;gece.add(Z.trackIndex));let ge=new Map;xe.forEach(Z=>{let je=Te(Z.edgeIndex);ge.set(Z.trackIndex,(ge.get(Z.trackIndex)??0)+je.delta)});let Ie=[...ce].filter(Z=>(ge.get(Z)??0)<-1),ye=[...ce].filter(Z=>(ge.get(Z)??0)>1),ne=[...ce].filter(Z=>Math.abs(ge.get(Z)??0)<=1);Ie.sort((Z,je)=>(ge.get(je)??0)-(ge.get(Z)??0)),ye.sort((Z,je)=>(ge.get(Z)??0)-(ge.get(je)??0));let V=b((Z,je)=>{xe.filter(Ne=>Ne.trackIndex===Z).forEach(Ne=>{let ze=y.has(Ne.edgeIndex)?ie.coord:je;_e.set(`${Ne.edgeIndex}-${Ne.segmentIndex}`,ze)})},"assignCoord"),pe=0;for(let Z of Ie)pe++,V(Z,ie.coord-pe*cX);if(ne.length===0&&ce.size>0){let Z=[...ce].sort((ze,Fe)=>Math.abs(ge.get(ze)??0)-Math.abs(ge.get(Fe)??0))[0],je=Ie.indexOf(Z);je!==-1&&Ie.splice(je,1);let Ne=ye.indexOf(Z);Ne!==-1&&ye.splice(Ne,1),ne.push(Z)}let K=0;for(let Z of ne){if(K===0)V(Z,ie.coord);else{let je=K%2===1?1:-1,Ne=Math.ceil(K/2);V(Z,ie.coord+je*Ne*cX*.5)}K++}let ve=0;for(let Z of ye)ve++,V(Z,ie.coord+ve*cX)}}for(let[ie,Q]of i.entries()){let he=g[ie]??[];if(he.length===0)continue;let xe=[],ce=a.get(Q.start),ge=a.get(Q.end),{pSrcPort:Ie,pDstPort:ye}=q(ie,ce,ge),ne=he.map(K=>{let ve=m[K],Z=_e.get(`${ve.edgeIndex}-${ve.segmentIndex}`)??ve.pipe.coord;return{orient:ve.orientation,coord:Z,from:ve.from,to:ve.to}});xe.push(Ie);for(let K=0;KEn&&xe.push(nv(ve,je)),Fe&&ze.orient===ve.orient)if(Math.abs(ve.coord-ze.coord)>En){let Ke=ve.orient==="vertical"?(je+ze.from)/2:qX(ve,ze);xe.push(nv(ve,Ke),nv(ze,Ke))}else(K===0||K===ne.length-2)&&xe.push(nv(ve,qX(ve,ze)));else if(Fe)xe.push(nv(ve,ze.coord));else{let Ke=Math.abs(ve.from-je)En||Math.abs(V.y-ye.y)>En)&&xe.push(ye);let pe=[];xe.length>0&&pe.push(xe[0]);for(let K=1;KEn||Math.abs(ve.y-Z.y)>En)&&pe.push(ve)}Q.points=pe}for(let ie of i){let Q=ie.__originalEdge;Q&&ie.points&&(Q.points=ie.points)}e.edges=(e.edges??[]).filter(ie=>!ie.isLayoutOnly);let de=b((ie,Q)=>{let he=Q.x??0,xe=Q.y??0,ce=Q.width??0,ge=Q.height??0;if(ce<=0||ge<=0)return ie;let Ie=he-ce/2,ye=he+ce/2,ne=xe-ge/2,V=xe+ge/2;if(ie.xye||ie.yV)return ie;let pe=ie.x-Ie,K=ye-ie.x,ve=ie.y-ne,Z=V-ie.y,je=Math.min(pe,K,ve,Z);return je===pe?{x:Ie,y:ie.y}:je===K?{x:ye,y:ie.y}:je===ve?{x:ie.x,y:ne}:{x:ie.x,y:V}},"nodeBoundaryClamp");for(let ie of e.edges){let Q=ie.points;if(!Q||Q.length<2)continue;let he=ie.start,xe=ie.end,ce=he?a.get(he):void 0,ge=xe?a.get(xe):void 0;ce&&(Q[0]=de(Q[0],ce)),ge&&(Q[Q.length-1]=de(Q[Q.length-1],ge))}return e}function JRe(e){return e.direction??"TB"}function eLe(e){let t=P_e(e),r=e.config.flowchart?.nodeSpacing??40,n=e.config.flowchart?.rankSpacing??100,i=e.config.swimlane?.ignoreCrossLaneEdges??!0,a=e.config.swimlane?.optimizeRanksByCrossings??!0,s=e.config.swimlane?.automaticLaneOrdering??!1,o=JRe(e),{ordered:l,coordinates:u}=ZRe(t,{nodeGap:r,layerGap:n,ignoreCrossLaneEdges:i,optimizeRanksByCrossings:a,automaticLaneOrdering:s,direction:o});B_e(t,l,u,{nodeGap:r,layerGap:n});for(let h of e.edges??[])delete h.points;QRe(e,o);for(let h of e.edges??[])(!h.curve||h.curve==="basis")&&(h.curve="rounded");return mRe(e,o),pRe(e),o}async function tLe(e,t){let r=t.select("g");w4(r,e.markers,e.type,e.diagramId),DR(),PR(),MR(),$R(),O_e(e);let n=F_e(e);e.nodes=n.nodes,e.edges=n.edges;let{groups:i}=await w_e(r,e);eLe(e),await M_e(e,i)}var m_e,HR,UR,_At,sX,RAt,g_e,LAt,zs,Xr,IAt,y_e,wh,MAt,YR,NAt,mr,$s,Cn,oX,ig,DAt,ec,v_e,XR,lX,OAt,x_e,PAt,BAt,sL,b_e,qRe,En,FAt,rv,k4,jR,Ru,cX,nLe=W(()=>{MY();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();qc();b(w_e,"createGraphWithElements");m_e=5,HR=1e-5,UR=1e-6;b(QR,"buildSegmentList");b(k_e,"segmentIntersection");b(uX,"isHorizontalSeg");b(T_e,"findEdgeIntersections");b(kh,"fmt");b(T4,"pointToString");b(C_e,"getArcSweepFlag");_At=.001;b(S_e,"applyMarkerOffsets");b(E_e,"emitJump");b(hX,"computeRoundedCorner");b(A_e,"rewriteEdgePath");b(__e,"isStraightPath");b(R_e,"curveSupportsLineHops");b(L_e,"decodeDataPoints");b(I_e,"applyLineJumpsToSvg");b(M_e,"adjustLayout");b(N_e,"positionEdgeLabel");sX="__swimlane_default__",RAt=21,g_e=20;b(fX,"topLaneHorizontalPadding");b(D_e,"assignTopLaneTitleRect");b(O_e,"prepareLayoutForSwimlanes");b(P_e,"toGraphView");b(B_e,"writeBackToLayoutData");LAt="[EdgeLabelNodes]";b(F_e,"createEdgeLabelNodes");zs=.001;b(VX,"measuredNodeRect");b(WX,"nodeBoundsInfoFor");b(Lu,"samePoint");b(Nn,"sameX");b(Pn,"sameY");b(_a,"isHorizontalSegment");b(Ra,"isVerticalSegment");b(xl,"overlapLength");b(Hf,"sameAxisSegmentOverlapLength");b(S4,"orthogonalSegmentsForPoints");b(Vc,"countOrthogonalBends");b(Vn,"dedupeConsecutivePoints");b(HX,"classifyThreeSegmentRoute");b(lL,"segmentBoundsOverlapRect");b(UX,"pointInsideRect");b($_e,"rectContainsRect");b(JR,"rectsOverlap");b(dX,"inflateRect");b(C4,"rectFromCenterSize");b(tc,"rectOfNodeBounds");b(iv,"portForRectSide");b(YX,"buildOrthogonalPortPath");b(XX,"buildSameSideTrackPath");b(cL,"collectRealNodeBounds");b(ag,"collectNodeRectEntries");b(z_e,"collectLayoutNodeRects");b(jX,"getNodePairGeometry");b(qa,"segmentHitsAnyRect");b(KX,"orthogonalSegmentsCross");b(G_e,"sameAxisSegmentsOverlap");b(eL,"segmentConflictsWithAnyEdge");b(N0,"orthogonalSegmentsStrictlyCross");b(pX,"strictlyBetween");b(q_e,"isCollinearIntermediate");b(V_e,"simplifyPolylineOnce");b(tL,"orthogonalizePolyline");b(Uf,"simplifyPolyline");Xr=.001,IAt=.5,y_e=4;b(ZX,"endpointContextFor");b(W_e,"segmentEnterPoint");b(mX,"clipEndpoint");b(H_e,"clipEdgeEndpointsToNodeBoundaries");b(gX,"snapEndpointToBoundary");b(rL,"firstDistinctAdjacent");b(nL,"cornerClearanceRange");b(yX,"clampToCornerClearance");b(U_e,"intersectRanges");b(vX,"clearanceRangeForSide");b(iL,"terminalSideForSegment");b(cC,"isHorizontalSide");b(Y_e,"straightClearanceRange");b(xX,"clearStraightEndpointCornerAxis");b(QX,"clearStraightEndpointCornerConnections");b(X_e,"cornerClearedEndpoint");b(j_e,"moveCollinearEndpointRun");b(bX,"clearEndpointCornerConnection");b(wX,"borderSideForSegment");b(kX,"leavesOutward");b(TX,"collapseOwnBorderStub");b(K_e,"snapAndCollapseEndpoints");b(CX,"prepareEdgeEndpointsForRenderer");b(JX,"buildNodeMap");b(Z_e,"resolveTopLevelGroupId");b(SX,"groupDepth");b(ej,"boundsForChildren");b(Q_e,"applyGroupBounds");b(J_e,"recomputeNestedGroupBounds");b(aL,"mirrorAxis");b(eRe,"applyBtDirectionTransform");b(tRe,"applyLrDirectionTransform");wh=1e-6,MAt=8,YR=MAt,NAt=[0,YR,-YR,2*YR,-2*YR];b(rRe,"portSwapToLShape");b(nRe,"collapseShortTerminalStub");mr=.001,$s=8,Cn=S4,oX=b((e,t)=>Nn(e,t,mr)||Pn(e,t,mr),"orthogonallyAligned");b(iRe,"separateSharedRenderedTerminalLanes");b(aRe,"collapseRedundantRectangularDoglegs");b(EX,"liftObstacleHuggingSameSideRails");b(AX,"liftTopLaneTitleBandsAboveRails");b(_X,"shiftLeftLaneTitleBandsLeftOfRails");b(sRe,"swapDestinationTerminalTailsToReduceCrossings");b(oRe,"reassignCrossingExternalRailChannels");b(lRe,"shortcutRedundantOrthogonalJogs");b(cRe,"resolveRenderedOrthogonalCrossings");ig=.001,DAt=8;b(uRe,"simplifyDetouredEdges");ec=.001,v_e=10,XR=7;b(RX,"markerClearanceRectFor");b(hRe,"normalizeRect");b(LX,"labelOverlapsOwnMarker");b(KR,"anchorLabelsToPolyline");lX=1e-6,OAt=8,x_e=OAt/2,PAt=3;b(IX,"pairKey");b(fRe,"straightenCollinearSiblingDetours");b(MX,"nudgeSharedInteriorSubpaths");b(dRe,"segmentsIntersect");b(pRe,"validateSwimlanesLayout");b(mRe,"postProcessSwimlaneLayout");b(sg,"normalizeGraph");b(tj,"incoming");b(gRe,"buildSuccessorMap");b(rj,"buildSortedSuccessorMap");b(nj,"buildInDegreeMap");b(ij,"sortedZeroInDegreeNodes");b(uL,"buildPredecessorSuccessorMaps");b(aj,"buildLayersFromRanks");b(uC,"topoSortIfAcyclic");b(E4,"buildLayerIndex");b(sj,"countInversions");b(yRe,"removeCycles_DFS");b(vRe,"buildTopLaneMap");b(D0,"createTopLaneResolver");b(hL,"buildTopLaneOrder");b(oj,"resolveTopLaneOrder");BAt={EPSILON:1e-6},sL={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},b_e={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};b(xRe,"buildDrivingTree");b(bRe,"chooseParent");b(wRe,"buildAdjacency");b(kRe,"assignComponents");b(TRe,"computeBlocks");b(CRe,"popBlock");b(SRe,"computeSubtreeCrossCounts");b(ERe,"annotateMinimumLayers");b(lj,"compareByRankThenId");b(ARe,"emitNodesInTreeOrder");b(_Re,"deduplicateLayers");b(RRe,"createChildOrderer");b(oL,"buildMultitreeLayerOrder");b(LRe,"countCrossingsBetweenAdjacent");b(NX,"totalCrossings");b(IRe,"optimizeRanksByCrossings");b(MRe,"adjustCrossLaneSources");b(NRe,"assignLayers_LongestPath");b(DRe,"assignLayers_Gravity");b(ORe,"topoSortByGenerationIfAcyclic");b(PRe,"assignLayers_LaneAwareCompact");b(BRe,"makeProperLayering");b(DX,"median");b(OX,"barycenter");b(FRe,"neighborPositionsFor");b($Re,"currentOrderTieBreak");b(PX,"countCrossingsBetweenAdjacent");b(ZR,"sortByHeuristic");b(BX,"reorderLayer");b(FX,"transposeImprove");b(zRe,"orderLayers");b(GRe,"assignCoordinates");qRe=8;b(VRe,"hashString");b(WRe,"mulberry32");b(HRe,"deterministicShuffle");b(URe,"sourceDistance");b($X,"laneArrangementCost");b(YRe,"buildWeightedLaneEdges");b(zX,"greedySwitch");b(XRe,"isBetterCandidate");b(jRe,"seedForRestart");b(KRe,"optimizeTopLaneOrder");b(ZRe,"sugiyamaLayout");En=BAt.EPSILON,FAt=8,rv=15,k4=15,jR=25,Ru=20,cX=10;b(GX,"chooseOrthogonalSide");b(qX,"sharedLineEndpointCoord");b(nv,"pointOnLine");b(QRe,"routeEdgesOrthogonal");b(JRe,"getSwimlaneDirection");b(eLe,"runSwimlaneLayoutCore");b(tLe,"render")});function $K(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return s=l.done,l},e:function(l){o=!0,a=l},f:function(){try{s||r.return==null||r.return()}finally{if(o)throw a}}}}function MMe(e,t,r){return(t=NMe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qAt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function VAt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,s,o=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(o.push(n.value),o.length!==t);l=!0);}catch(h){u=!0,i=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function WAt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HAt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function as(e,t){return $At(e)||VAt(e,t)||aZ(e,t)||WAt()}function PL(e){return zAt(e)||qAt(e)||aZ(e)||HAt()}function UAt(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function NMe(e){var t=UAt(e,"string");return typeof t=="symbol"?t:t+""}function Ts(e){"@babel/helpers - typeof";return Ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ts(e)}function aZ(e,t){if(e){if(typeof e=="string")return $K(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$K(e,t):void 0}}function PC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function BC(){if(sLe)return cj;sLe=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return cj=e,cj}function m9t(){if(oLe)return uj;oLe=1;var e=typeof fL=="object"&&fL&&fL.Object===Object&&fL;return uj=e,uj}function ZL(){if(lLe)return hj;lLe=1;var e=m9t(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return hj=r,hj}function g9t(){if(cLe)return fj;cLe=1;var e=ZL(),t=function(){return e.Date.now()};return fj=t,fj}function y9t(){if(uLe)return dj;uLe=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return dj=t,dj}function v9t(){if(hLe)return pj;hLe=1;var e=y9t(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return pj=r,pj}function lZ(){if(fLe)return mj;fLe=1;var e=ZL(),t=e.Symbol;return mj=t,mj}function x9t(){if(dLe)return gj;dLe=1;var e=lZ(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=r.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var h=n.call(s);return u&&(o?s[i]=l:delete s[i]),h}return gj=a,gj}function b9t(){if(pLe)return yj;pLe=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return yj=r,yj}function qMe(){if(mLe)return vj;mLe=1;var e=lZ(),t=x9t(),r=b9t(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?t(o):r(o)}return vj=s,vj}function w9t(){if(gLe)return xj;gLe=1;function e(t){return t!=null&&typeof t=="object"}return xj=e,xj}function FC(){if(yLe)return bj;yLe=1;var e=qMe(),t=w9t(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return bj=n,bj}function k9t(){if(vLe)return wj;vLe=1;var e=v9t(),t=BC(),r=FC(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var h=typeof u.valueOf=="function"?u.valueOf():u;u=t(h)?h+"":h}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=a.test(u);return f||s.test(u)?o(u.slice(2),f?2:8):i.test(u)?n:+u}return wj=l,wj}function T9t(){if(xLe)return kj;xLe=1;var e=BC(),t=g9t(),r=k9t(),n="Expected a function",i=Math.max,a=Math.min;function s(o,l,u){var h,f,d,p,m,g,y=0,v=!1,x=!1,w=!0;if(typeof o!="function")throw new TypeError(n);l=r(l)||0,e(u)&&(v=!!u.leading,x="maxWait"in u,d=x?i(r(u.maxWait)||0,l):d,w="trailing"in u?!!u.trailing:w);function C(A){var N=h,M=f;return h=f=void 0,y=A,p=o.apply(M,N),p}function T(A){return y=A,m=setTimeout(E,l),v?C(A):p}function k(A){var N=A-g,M=A-y,D=l-N;return x?a(D,d-M):D}function S(A){var N=A-g,M=A-y;return g===void 0||N>=l||N<0||x&&M>=d}function E(){var A=t();if(S(A))return I(A);m=setTimeout(E,k(A))}function I(A){return m=void 0,w&&h?C(A):(h=f=void 0,p)}function L(){m!==void 0&&clearTimeout(m),y=0,h=g=f=m=void 0}function O(){return m===void 0?p:I(t())}function R(){var A=t(),N=S(A);if(h=arguments,f=this,g=A,N){if(m===void 0)return T(g);if(x)return clearTimeout(m),m=setTimeout(E,l),C(g)}return m===void 0&&(m=setTimeout(E,l)),p}return R.cancel=L,R.flush=O,R}return kj=s,kj}function _9t(e,t,r,n,i){var a=i*Math.PI/180,s=Math.cos(a)*(e-r)-Math.sin(a)*(t-n)+r,o=Math.sin(a)*(e-r)+Math.cos(a)*(t-n)+n;return{x:s,y:o}}function L9t(e,t,r){if(r===0)return e;var n=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,s=1/a,o=_9t(e.x,e.y,n,i,r),l=R9t(o.x,o.y,n,i,a,s);return{x:l.x,y:l.y}}function G9t(){return CLe||(CLe=1,(function(e,t){(function(){var r,n,i,a,s,o,l,u,h,f,d,p,m,g,y;i=Math.floor,f=Math.min,n=function(v,x){return vx?1:0},h=function(v,x,w,C,T){var k;if(w==null&&(w=0),T==null&&(T=n),w<0)throw new Error("lo must be non-negative");for(C==null&&(C=v.length);wL;0<=L?I++:I--)E.push(I);return E}).apply(this).reverse(),S=[],C=0,T=k.length;CO;0<=O?++E:--E)R.push(s(v,w));return R},g=function(v,x,w,C){var T,k,S;for(C==null&&(C=n),T=v[w];w>x;){if(S=w-1>>1,k=v[S],C(T,k)<0){v[w]=k,w=S;continue}break}return v[w]=T},y=function(v,x,w){var C,T,k,S,E;for(w==null&&(w=n),T=v.length,E=x,k=v[x],C=2*x+1;C-1}return Zj=t,Zj}function DRt(){if(hIe)return Qj;hIe=1;var e=nI();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Qj=t,Qj}function ORt(){if(fIe)return Jj;fIe=1;var e=LRt(),t=IRt(),r=MRt(),n=NRt(),i=DRt();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o-1&&n%1==0&&n0;){var h=i.shift();t(h),a.add(h.id()),o&&n(i,a,h)}return e}function xNe(e,t,r){if(r.isParent())for(var n=r._private.children,i=0;i0&&arguments[0]!==void 0?arguments[0]:ULt,t=arguments.length>1?arguments[1]:void 0,r=0;r0?R=N:O=N;while(Math.abs(A)>s&&++M=a?x(L,M):D===0?M:C(L,O,O+u)}var k=!1;function S(){k=!0,(e!==t||r!==n)&&w()}var E=function(O){return k||S(),e===t&&r===n?O:O===0?0:O===1?1:y(T(O),t,n)};E.getControlPoints=function(){return[{x:e,y:t},{x:r,y:n}]};var I="generateBezier("+[e,t,r,n]+")";return E.toString=function(){return I},E}function tMe(e,t,r,n,i){if(n===1||t===r)return r;var a=i(t,r,n);return e==null||((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max))),a}function rMe(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function R4(e,t,r,n,i){var a=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var s=rMe(e,i),o=rMe(t,i);if(Zt(s)&&Zt(o))return tMe(a,s,o,r,n);if(Di(s)&&Di(o)){for(var l=[],u=0;u0?(p==="spring"&&m.push(s.duration),s.easingImpl=LL[p].apply(null,m)):s.easingImpl=LL[p]}var g=s.easingImpl,y;if(s.duration===0?y=1:y=(r-l)/s.duration,s.applying&&(y=s.progress),y<0?y=0:y>1&&(y=1),s.delay==null){var v=s.startPosition,x=s.position;if(x&&i&&!e.locked()){var w={};pC(v.x,x.x)&&(w.x=R4(v.x,x.x,y,g)),pC(v.y,x.y)&&(w.y=R4(v.y,x.y,y,g)),e.position(w)}var C=s.startPan,T=s.pan,k=a.pan,S=T!=null&&n;S&&(pC(C.x,T.x)&&(k.x=R4(C.x,T.x,y,g)),pC(C.y,T.y)&&(k.y=R4(C.y,T.y,y,g)),e.emit("pan"));var E=s.startZoom,I=s.zoom,L=I!=null&&n;L&&(pC(E,I)&&(a.zoom=AC(a.minZoom,R4(E,I,y,g),a.maxZoom)),e.emit("zoom")),(S||L)&&e.emit("viewport");var O=s.style;if(O&&O.length>0&&i){for(var R=0;R=0;S--){var E=k[S];E()}k.splice(0,k.length)},x=p.length-1;x>=0;x--){var w=p[x],C=w._private;if(C.stopped){p.splice(x,1),C.hooked=!1,C.playing=!1,C.started=!1,v(C.frames);continue}!C.playing&&!C.applying||(C.playing&&C.applying&&(C.applying=!1),C.started||sIt(h,w,e),aIt(h,w,e,f),C.applying&&(C.applying=!1),v(C.frames),C.step!=null&&C.step(e),w.completed()&&(p.splice(x,1),C.hooked=!1,C.playing=!1,C.started=!1,v(C.completes)),g=!0)}return!f&&p.length===0&&m.length===0&&n.push(h),g}for(var a=!1,s=0;s0?t.notify("draw",r):t.notify("draw")),r.unmerge(n),t.emit("step")}function BNe(e){this.options=zr({},pIt,mIt,e)}function FNe(e){this.options=zr({},gIt,e)}function $Ne(e){this.options=zr({},yIt,e)}function hI(e){this.options=zr({},vIt,e),this.options.layout=this;var t=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var a=i.source().data("id"),s=i.target().data("id"),o=t.some(function(u){return u.data("id")===a}),l=t.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(n)}function VNe(e){this.options=zr({},NIt,e)}function CZ(e){this.options=zr({},DIt,e)}function WNe(e){this.options=zr({},OIt,e)}function HNe(e){this.options=zr({},PIt,e)}function UNe(e){this.options=e,this.notifications=0}function jNe(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function EZ(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:($It(e,t,r,n,i),{cx:KK,cy:ZK,radius:cv,startX:YNe,startY:XNe,stopX:QK,stopY:JK,startAngle:jf.ang+Math.PI/2*hv,endAngle:Iu.ang-Math.PI/2*hv,counterClockwise:NL})}function KNe(e){var t=[];if(e!=null){for(var r=0;r5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(a,n/2,i/2);e.beginPath(),e.moveTo(t+s,r),e.lineTo(t+n-s,r),e.quadraticCurveTo(t+n,r,t+n,r+s),e.lineTo(t+n,r+i-s),e.quadraticCurveTo(t+n,r+i,t+n-s,r+i),e.lineTo(t+s,r+i),e.quadraticCurveTo(t,r+i,t,r+i-s),e.lineTo(t,r+s),e.quadraticCurveTo(t,r,t+s,r),e.closePath()}function TMe(e,t,r){var n=e.createShader(t);if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(n));return n}function LMt(e,t,r){var n=TMe(e,e.VERTEX_SHADER,t),i=TMe(e,e.FRAGMENT_SHADER,r),a=e.createProgram();if(e.attachShader(a,n),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function IMt(e,t,r){r===void 0&&(r=t);var n=e.makeOffscreenCanvas(t,r),i=n.context=n.getContext("2d");return n.clear=function(){return i.clearRect(0,0,n.width,n.height)},n.clear(),n}function RZ(e){var t=e.pixelRatio,r=e.cy.zoom(),n=e.cy.pan();return{zoom:r*t,pan:{x:n.x*t,y:n.y*t}}}function MMt(e){var t=e.pixelRatio,r=e.cy.zoom();return r*t}function NMt(e,t,r,n,i){var a=n*r+t.x,s=i*r+t.y;return s=Math.round(e.canvasHeight-s),[a,s]}function DMt(e,t){return t.picking?!0:e.pstyle("background-fill").value!=="solid"||e.pstyle("background-image").strValue!=="none"?!1:e.pstyle("border-width").value===0||e.pstyle("border-opacity").value===0?!0:e.pstyle("border-style").value==="solid"}function OMt(e,t){if(e.length!==t.length)return!1;for(var r=0;r>0&255)/255,r[1]=(e>>8&255)/255,r[2]=(e>>16&255)/255,r[3]=(e>>24&255)/255,r}function PMt(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function BMt(e,t){var r=e.createTexture();return r.buffer=function(n){e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},r.deleteTexture=function(){e.deleteTexture(r)},r}function uDe(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function hDe(e,t,r){switch(t){case e.FLOAT:return new Float32Array(r);case e.INT:return new Int32Array(r)}}function FMt(e,t,r,n,i,a){switch(t){case e.FLOAT:return new Float32Array(r.buffer,a*n,i);case e.INT:return new Int32Array(r.buffer,a*n,i)}}function $Mt(e,t,r,n){var i=uDe(e,t),a=as(i,2),s=a[0],o=a[1],l=hDe(e,o,n),u=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,l,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(r,s,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(r,s,o,0,0),e.enableVertexAttribArray(r),e.bindBuffer(e.ARRAY_BUFFER,null),u}function Xf(e,t,r,n){var i=uDe(e,r),a=as(i,3),s=a[0],o=a[1],l=a[2],u=hDe(e,o,t*s),h=s*l,f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,t*h,e.DYNAMIC_DRAW),e.enableVertexAttribArray(n),o===e.FLOAT?e.vertexAttribPointer(n,s,o,!1,h,0):o===e.INT&&e.vertexAttribIPointer(n,s,o,h,0),e.vertexAttribDivisor(n,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=new Array(t),p=0;paDe?(rNt(e),t.call(e,a)):(nNt(e),mDe(e,a,TC.SCREEN)))}}{var r=e.matchCanvasSize;e.matchCanvasSize=function(a){r.call(e,a),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(a,s,o,l){return cNt(e,a,s)};{var n=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){n.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var i=e.notify;e.notify=function(a,s){i.call(e,a,s),a==="viewport"||a==="bounds"?e.pickingFrameBuffer.needsDraw=!0:a==="background"&&e.drawing.invalidate(s,{type:"node-body"})}}}function rNt(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function nNt(e){var t=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,e.canvasWidth,e.canvasHeight),n.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function iNt(e){var t=e.canvasWidth,r=e.canvasHeight,n=RZ(e),i=n.pan,a=n.zoom,s=NK();OL(s,s,[i.x,i.y]),tZ(s,s,[a,a]);var o=NK();VMt(o,t,r);var l=NK();return qMt(l,o,s),l}function pDe(e,t){var r=e.canvasWidth,n=e.canvasHeight,i=RZ(e),a=i.pan,s=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,r,n),t.translate(a.x,a.y),t.scale(s,s)}function aNt(e,t){e.drawSelectionRectangle(t,function(r){return pDe(e,r)})}function sNt(e){var t=e.data.contexts[e.NODE];t.save(),pDe(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function oNt(e){var t=function(i,a,s){for(var o=i.atlasManager.getAtlasCollection(a),l=e.data.contexts[e.NODE],u=o.atlases,h=0;h=0&&C.add(S)}return C}function cNt(e,t,r){var n=lNt(e,t,r),i=e.getCachedZSortedEles(),a,s,o=nc(n),l;try{for(o.s();!(l=o.n()).done;){var u=l.value,h=i[u];if(!a&&h.isNode()&&(a=h),!s&&h.isEdge()&&(s=h),a&&s)break}}catch(f){o.e(f)}finally{o.f()}return[a,s].filter(Boolean)}function FK(e,t,r){var n=e.drawing;t+=1,r.isNode()?(n.drawNode(r,t,"node-underlay"),n.drawNode(r,t,"node-body"),n.drawTexture(r,t,"label"),n.drawNode(r,t,"node-overlay")):(n.drawEdgeLine(r,t),n.drawEdgeArrow(r,t,"source"),n.drawEdgeArrow(r,t,"target"),n.drawTexture(r,t,"label"),n.drawTexture(r,t,"edge-source-label"),n.drawTexture(r,t,"edge-target-label"))}function mDe(e,t,r){var n;e.webglDebug&&(n=performance.now());var i=e.drawing,a=0;if(r.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&aNt(e,t),e.data.canvasNeedsRedraw[e.NODE]||r.picking){var s=e.data.contexts[e.WEBGL];r.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=iNt(e),l=e.getCachedZSortedEles();if(a=l.length,i.startFrame(o,r),r.screen){for(var u=0;u{ws=typeof window>"u"?null:window,iLe=ws?ws.navigator:null;ws&&ws.document;YAt=Ts(""),DMe=Ts({}),XAt=Ts(function(){}),jAt=typeof HTMLElement>"u"?"undefined":Ts(HTMLElement),DC=function(t){return t&&t.instanceString&&ya(t.instanceString)?t.instanceString():null},Ar=function(t){return t!=null&&Ts(t)==YAt},ya=function(t){return t!=null&&Ts(t)===XAt},Di=function(t){return!Wc(t)&&(Array.isArray?Array.isArray(t):t!=null&&t instanceof Array)},Hn=function(t){return t!=null&&Ts(t)===DMe&&!Di(t)&&t.constructor===Object},KAt=function(t){return t!=null&&Ts(t)===DMe},Zt=function(t){return t!=null&&Ts(t)===Ts(1)&&!isNaN(t)},ZAt=function(t){return Zt(t)&&Math.floor(t)===t},BL=function(t){if(jAt!=="undefined")return t!=null&&t instanceof HTMLElement},Wc=function(t){return OC(t)||OMe(t)},OC=function(t){return DC(t)==="collection"&&t._private.single},OMe=function(t){return DC(t)==="collection"&&!t._private.single},sZ=function(t){return DC(t)==="core"},PMe=function(t){return DC(t)==="stylesheet"},QAt=function(t){return DC(t)==="event"},mg=function(t){return t==null?!0:!!(t===""||t.match(/^\s+$/))},JAt=function(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement},e9t=function(t){return Hn(t)&&Zt(t.x1)&&Zt(t.x2)&&Zt(t.y1)&&Zt(t.y2)},t9t=function(t){return KAt(t)&&ya(t.then)},r9t=function(){return iLe&&iLe.userAgent.match(/msie|trident|edge/i)},q4=function(t,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var a=[],s=0;sr?1:0},c9t=function(t,r){return-1*FMe(t,r)},zr=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,r=1;r1&&(y-=1),y<1/6?m+(g-m)*6*y:y<1/2?g:y<2/3?m+(g-m)*(2/3-y)*6:m}var f=new RegExp("^"+a9t+"$").exec(t);if(f){if(n=parseInt(f[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(f[2]),i<0||i>100||(i=i/100,a=parseFloat(f[3]),a<0||a>100)||(a=a/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(i===0)o=l=u=Math.round(a*255);else{var d=a<.5?a*(1+i):a+i-a*i,p=2*a-d;o=Math.round(255*h(p,d,n+1/3)),l=Math.round(255*h(p,d,n)),u=Math.round(255*h(p,d,n-1/3))}r=[o,l,u,s]}return r},f9t=function(t){var r,n=new RegExp("^"+n9t+"$").exec(t);if(n){r=[];for(var i=[],a=1;a<=3;a++){var s=n[a];if(s[s.length-1]==="%"&&(i[a]=!0),s=parseFloat(s),i[a]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(o&&!l)return;var u=n[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},d9t=function(t){return p9t[t.toLowerCase()]},$Me=function(t){return(Di(t)?t:null)||d9t(t)||u9t(t)||f9t(t)||h9t(t)},p9t={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},zMe=function(t){for(var r=t.map,n=t.keys,i=n.length,a=0;a1&&arguments[1]!==void 0?arguments[1]:uv,n=r,i;i=t.next(),!i.done;)n=n*WMe+i.value|0;return n},CC=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:uv;return r*WMe+t|0},SC=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:D4;return(r<<5)+r+t|0},E9t=function(t,r){return t*2097152+r},og=function(t){return t[0]*2097152+t[1]},dL=function(t,r){return[CC(t[0],r[0]),SC(t[1],r[1])]},bLe=function(t,r){var n={value:0,done:!1},i=0,a=t.length,s={next:function(){return i=0;i--)t[i]===r&&t.splice(i,1)},hZ=function(t){t.splice(0,t.length)},P9t=function(t,r){for(var n=0;n"u"?"undefined":Ts(Set))!==F9t?Set:$9t,QL=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(t===void 0||r===void 0||!sZ(t)){ca("An element must have a core reference and parameters set");return}var i=r.group;if(i==null&&(r.data&&r.data.source!=null&&r.data.target!=null?i="edges":i="nodes"),i!=="nodes"&&i!=="edges"){ca("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var a=this._private={cy:t,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?i==="edges":!!r.pannable,active:!1,classes:new Y4,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=t.pan(),l=t.zoom();a.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];Di(r.classes)?u=r.classes:Ar(r.classes)&&(u=r.classes.split(/\s+/));for(var h=0,f=u.length;h0;){var k=x.pop(),S=y(k),E=k.id();if(d[E]=S,S!==1/0)for(var I=k.neighborhood().intersect(m),L=0;L0)for(P.unshift(B);f[F];){var q=f[F];P.unshift(q.edge),P.unshift(q.node),$=q.node,F=$.id()}return o.spawn(P)}}}},U9t={kruskal:function(t){t=t||function(w){return 1};for(var r=this.byGroup(),n=r.nodes,i=r.edges,a=n.length,s=new Array(a),o=n,l=function(C){for(var T=0;T0;){if(T(),S++,C===h){for(var E=[],I=a,L=h,O=v[L];E.unshift(I),O!=null&&E.unshift(O),I=y[L],I!=null;)L=I.id(),O=v[L];return{found:!0,distance:f[C],path:this.spawn(E),steps:S}}p[C]=!0;for(var R=w._private.edges,A=0;AO&&(m[L]=O,x[L]=I,w[L]=T),!a){var R=I*h+E;!a&&m[R]>O&&(m[R]=O,x[R]=E,w[R]=T)}}}for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:s,_e=w(fe),de=[],ie=_e;;){if(ie==null)return r.spawn();var Q=x(ie),he=Q.edge,xe=Q.pred;if(de.unshift(ie[0]),ie.same(Ce)&&de.length>0)break;he!=null&&de.unshift(he),ie=xe}return l.spawn(de)},k=0;k=0;h--){var f=u[h],d=f[1],p=f[2];(r[d]===o&&r[p]===l||r[d]===l&&r[p]===o)&&u.splice(h,1)}for(var m=0;mi;){var a=Math.floor(Math.random()*r.length);r=e_t(a,t,r),n--}return r},t_t={kargerStein:function(){var t=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function(P){return P.isLoop()});var a=n.length,s=i.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),l=Math.floor(a/J9t);if(a<2){ca("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],h=0;h1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=-1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=0,a=0,s=r;s1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?t=t.slice(r,n):(n0&&t.splice(0,r));for(var o=0,l=t.length-1;l>=0;l--){var u=t[l];s?isFinite(u)||(t[l]=-1/0,o++):t.splice(l,1)}a&&t.sort(function(d,p){return d-p});var h=t.length,f=Math.floor(h/2);return h%2!==0?t[f+1+o]:(t[f-1+o]+t[f+o])/2},o_t=function(t){return Math.PI*t/180},pL=function(t,r){return Math.atan2(r,t)-Math.PI/2},fZ=Math.log2||function(e){return Math.log(e)/Math.log(2)},dZ=function(t){return t>0?1:t<0?-1:0},pv=function(t,r){return Math.sqrt(lv(t,r))},lv=function(t,r){var n=r.x-t.x,i=r.y-t.y;return n*n+i*i},l_t=function(t){for(var r=t.length,n=0,i=0;i=t.x1&&t.y2>=t.y1)return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,w:t.x2-t.x1,h:t.y2-t.y1};if(t.w!=null&&t.h!=null&&t.w>=0&&t.h>=0)return{x1:t.x1,y1:t.y1,x2:t.x1+t.w,y2:t.y1+t.h,w:t.w,h:t.h}}},u_t=function(t){return{x1:t.x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h}},h_t=function(t){t.x1=1/0,t.y1=1/0,t.x2=-1/0,t.y2=-1/0,t.w=0,t.h=0},f_t=function(t,r){t.x1=Math.min(t.x1,r.x1),t.x2=Math.max(t.x2,r.x2),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,r.y1),t.y2=Math.max(t.y2,r.y2),t.h=t.y2-t.y1},QMe=function(t,r,n){t.x1=Math.min(t.x1,r),t.x2=Math.max(t.x2,r),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,n),t.y2=Math.max(t.y2,n),t.h=t.y2-t.y1},EL=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.x1-=r,t.x2+=r,t.y1-=r,t.y2+=r,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},AL=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,i,a,s;if(r.length===1)n=i=a=s=r[0];else if(r.length===2)n=a=r[0],s=i=r[1];else if(r.length===4){var o=as(r,4);n=o[0],i=o[1],a=o[2],s=o[3]}return t.x1-=s,t.x2+=i,t.y1-=n,t.y2+=a,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},ELe=function(t,r){t.x1=r.x1,t.y1=r.y1,t.x2=r.x2,t.y2=r.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1},pZ=function(t,r){return!(t.x1>r.x2||r.x1>t.x2||t.x2r.y2||r.y1>t.y2)},hg=function(t,r,n){return t.x1<=r&&r<=t.x2&&t.y1<=n&&n<=t.y2},ALe=function(t,r){return hg(t,r.x,r.y)},JMe=function(t,r){return hg(t,r.x1,r.y1)&&hg(t,r.x2,r.y2)},d_t=(Ej=Math.hypot)!==null&&Ej!==void 0?Ej:function(e,t){return Math.sqrt(e*e+t*t)};eNe=function(t,r,n,i,a,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?yg(a,s):l,h=a/2,f=s/2;u=Math.min(u,h,f);var d=u!==h,p=u!==f,m;if(d){var g=n-h+u-o,y=i-f-o,v=n+h-u+o,x=y;if(m=fg(t,r,n,i,g,y,v,x,!1),m.length>0)return m}if(p){var w=n+h+o,C=i-f+u-o,T=w,k=i+f-u+o;if(m=fg(t,r,n,i,w,C,T,k,!1),m.length>0)return m}if(d){var S=n-h+u-o,E=i+f+o,I=n+h-u+o,L=E;if(m=fg(t,r,n,i,S,E,I,L,!1),m.length>0)return m}if(p){var O=n-h-o,R=i-f+u-o,A=O,N=i+f-u+o;if(m=fg(t,r,n,i,O,R,A,N,!1),m.length>0)return m}var M;{var D=n-h+u,B=i-f+u;if(M=vC(t,r,n,i,D,B,u+o),M.length>0&&M[0]<=D&&M[1]<=B)return[M[0],M[1]]}{var P=n+h-u,$=i-f+u;if(M=vC(t,r,n,i,P,$,u+o),M.length>0&&M[0]>=P&&M[1]<=$)return[M[0],M[1]]}{var F=n+h-u,q=i+f-u;if(M=vC(t,r,n,i,F,q,u+o),M.length>0&&M[0]>=F&&M[1]>=q)return[M[0],M[1]]}{var G=n-h+u,z=i+f-u;if(M=vC(t,r,n,i,G,z,u+o),M.length>0&&M[0]<=G&&M[1]>=z)return[M[0],M[1]]}return[]},g_t=function(t,r,n,i,a,s,o){var l=o,u=Math.min(n,a),h=Math.max(n,a),f=Math.min(i,s),d=Math.max(i,s);return u-l<=t&&t<=h+l&&f-l<=r&&r<=d+l},y_t=function(t,r,n,i,a,s,o,l,u){var h={x1:Math.min(n,o,a)-u,x2:Math.max(n,o,a)+u,y1:Math.min(i,l,s)-u,y2:Math.max(i,l,s)+u};return!(th.x2||rh.y2)},v_t=function(t,r,n,i){n-=i;var a=r*r-4*t*n;if(a<0)return[];var s=Math.sqrt(a),o=2*t,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},x_t=function(t,r,n,i,a){var s=1e-5;t===0&&(t=s),r/=t,n/=t,i/=t;var o,l,u,h,f,d,p,m;if(l=(3*n-r*r)/9,u=-(27*i)+r*(9*n-2*(r*r)),u/=54,o=l*l*l+u*u,a[1]=0,p=r/3,o>0){f=u+Math.sqrt(o),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),d=u-Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-p+f+d,p+=(f+d)/2,a[4]=a[2]=-p,p=Math.sqrt(3)*(-d+f)/2,a[3]=p,a[5]=-p;return}if(a[5]=a[3]=0,o===0){m=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),a[0]=-p+2*m,a[4]=a[2]=-(m+p);return}l=-l,h=l*l*l,h=Math.acos(u/Math.sqrt(h)),m=2*Math.sqrt(l),a[0]=-p+m*Math.cos(h/3),a[2]=-p+m*Math.cos((h+2*Math.PI)/3),a[4]=-p+m*Math.cos((h+4*Math.PI)/3)},b_t=function(t,r,n,i,a,s,o,l){var u=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+i*i-4*i*s+2*i*l+4*s*s-4*s*l+l*l,h=9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*i*s-3*i*i-3*i*l-6*s*s+3*s*l,f=3*n*n-6*n*a+n*o-n*t+2*a*a+2*a*t-o*t+3*i*i-6*i*s+i*l-i*r+2*s*s+2*s*r-l*r,d=1*n*a-n*n+n*t-a*t+i*s-i*i+i*r-s*r,p=[];x_t(u,h,f,d,p);for(var m=1e-7,g=[],y=0;y<6;y+=2)Math.abs(p[y+1])=0&&p[y]<=1&&g.push(p[y]);g.push(1),g.push(0);for(var v=-1,x,w,C,T=0;T=0?Cu?(t-a)*(t-a)+(r-s)*(r-s):h-d},rc=function(t,r,n){for(var i,a,s,o,l,u=0,h=0;h=t&&t>=s||i<=t&&t<=s)l=(t-i)/(s-i)*(o-a)+a,l>r&&u++;else continue;return u%2!==0},F0=function(t,r,n,i,a,s,o,l,u){var h=new Array(n.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var d=Math.cos(-f),p=Math.sin(-f),m=0;m0){var y=GL(h,-u);g=zL(y)}else g=h;return rc(t,r,g)},k_t=function(t,r,n,i,a,s,o,l){for(var u=new Array(n.length*2),h=0;h=0&&y<=1&&x.push(y),v>=0&&v<=1&&x.push(v),x.length===0)return[];var w=x[0]*l[0]+t,C=x[0]*l[1]+r;if(x.length>1){if(x[0]==x[1])return[w,C];var T=x[1]*l[0]+t,k=x[1]*l[1]+r;return[w,C,T,k]}else return[w,C]},Aj=function(t,r,n){return r<=t&&t<=n||n<=t&&t<=r?t:t<=r&&r<=n||n<=r&&r<=t?r:n},fg=function(t,r,n,i,a,s,o,l,u){var h=t-a,f=n-t,d=o-a,p=r-s,m=i-r,g=l-s,y=d*p-g*h,v=f*p-m*h,x=g*f-d*m;if(x!==0){var w=y/x,C=v/x,T=.001,k=0-T,S=1+T;return k<=w&&w<=S&&k<=C&&C<=S?[t+w*f,r+w*m]:u?[t+w*f,r+w*m]:[]}else return y===0||v===0?Aj(t,n,o)===o?[o,l]:Aj(t,n,a)===a?[a,s]:Aj(a,o,n)===n?[n,i]:[]:[]},C_t=function(t,r,n,i,a){var s=[],o=i/2,l=a/2,u=r,h=n;s.push({x:u+o*t[0],y:h+l*t[1]});for(var f=1;f0){var g=GL(f,-l);p=zL(g)}else p=f}else p=n;for(var y,v,x,w,C=0;C2){for(var m=[h[0],h[1]],g=Math.pow(m[0]-t,2)+Math.pow(m[1]-r,2),y=1;yh&&(h=C)},get:function(w){return u[w]}},d=0;d0?M=N.edgesTo(A)[0]:M=A.edgesTo(N)[0];var D=i(M);A=A.id(),S[A]>S[O]+D&&(S[A]=S[O]+D,E.nodes.indexOf(A)<0?E.push(A):E.updateItem(A),k[A]=0,T[A]=[]),S[A]==S[O]+D&&(k[A]=k[A]+k[O],T[A].push(O))}else for(var B=0;B0;){for(var q=C.pop(),G=0;G0&&o.push(n[l]);o.length!==0&&a.push(i.collection(o))}return a},$_t=function(t,r){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:q_t,o=i,l,u,h=0;h=2?hC(t,r,n,0,MLe,V_t):hC(t,r,n,0,ILe)},squaredEuclidean:function(t,r,n){return hC(t,r,n,0,MLe)},manhattan:function(t,r,n){return hC(t,r,n,0,ILe)},max:function(t,r,n){return hC(t,r,n,-1/0,W_t)}};V4["squared-euclidean"]=V4.squaredEuclidean;V4.squaredeuclidean=V4.squaredEuclidean;H_t=yo({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),gZ=function(t){return H_t(t)},qL=function(t,r,n,i,a){var s=a!=="kMedoids",o=s?function(f){return n[f]}:function(f){return i[f](n)},l=function(d){return i[d](r)},u=n,h=r;return eI(t,i.length,o,l,u,h)},Rj=function(t,r,n){for(var i=n.length,a=new Array(i),s=new Array(i),o=new Array(r),l=null,u=0;un)return!1}return!0},X_t=function(t,r,n){for(var i=0;io&&(o=r[u][h],l=h);a[l].push(t[u])}for(var f=0;f=a.threshold||a.mode==="dendrogram"&&t.length===1)return!1;var m=r[s],g=r[i[s]],y;a.mode==="dendrogram"?y={left:m,right:g,key:m.key}:y={value:m.value.concat(g.value),key:m.key},t[m.index]=y,t.splice(g.index,1),r[m.key]=y;for(var v=0;vn[g.key][x.key]&&(l=n[g.key][x.key])):a.linkage==="max"?(l=n[m.key][x.key],n[m.key][x.key]0&&i.push(a);return i},FLe=function(t,r,n){for(var i=[],a=0;ao&&(s=u,o=r[a*t+u])}s>0&&i.push(s)}for(var h=0;hu&&(l=h,u=f)}n[a]=s[l]}return i=FLe(t,r,n),i},$Le=function(t){for(var r=this.cy(),n=this.nodes(),i=sRt(t),a={},s=0;s=O?(R=O,O=N,A=M):N>R&&(R=N);for(var D=0;D0?1:0;S[I%i.minIterations*o+G]=z,q+=z}if(q>0&&(I>=i.minIterations-1||I==i.maxIterations-1)){for(var H=0,j=0;j1||k>1)&&(o=!0),f[w]=[],x.outgoers().forEach(function(E){E.isEdge()&&f[w].push(E.id())})}else d[w]=[void 0,x.target().id()]}):s.forEach(function(x){var w=x.id();if(x.isNode()){var C=x.degree(!0);C%2&&(l?u?o=!0:u=w:l=w),f[w]=[],x.connectedEdges().forEach(function(T){return f[w].push(T.id())})}else d[w]=[x.source().id(),x.target().id()]});var p={found:!1,trail:void 0};if(o)return p;if(u&&l)if(a){if(h&&u!=h)return p;h=u}else{if(h&&u!=h&&l!=h)return p;h||(h=u)}else h||(h=s[0].id());var m=function(w){for(var C=w,T=[w],k,S,E;f[C].length;)k=f[C].shift(),S=d[k][0],E=d[k][1],C!=E?(f[E]=f[E].filter(function(I){return I!=k}),C=E):!a&&C!=S&&(f[S]=f[S].filter(function(I){return I!=k}),C=S),T.unshift(k),T.unshift(C);return T},g=[],y=[];for(y=m(h);y.length!=1;)f[y[0]].length==0?(g.unshift(s.getElementById(y.shift())),g.unshift(s.getElementById(y.shift()))):y=m(y.shift()).concat(y);g.unshift(s.getElementById(y.shift()));for(var v in f)if(f[v].length)return p;return p.found=!0,p.trail=this.spawn(g,!0),p}},gL=function(){var t=this,r={},n=0,i=0,a=[],s=[],o={},l=function(d,p){for(var m=s.length-1,g=[],y=t.spawn();s[m].x!=d||s[m].y!=p;)g.push(s.pop().edge),m--;g.push(s.pop().edge),g.forEach(function(v){var x=v.connectedNodes().intersection(t);y.merge(v),x.forEach(function(w){var C=w.id(),T=w.connectedEdges().intersection(t);y.merge(w),r[C].cutVertex?y.merge(T.filter(function(k){return k.isLoop()})):y.merge(T)})}),a.push(y)},u=function(d,p,m){d===m&&(i+=1),r[p]={id:n,low:n++,cutVertex:!1};var g=t.getElementById(p).connectedEdges().intersection(t);if(g.size()===0)a.push(t.spawn(t.getElementById(p)));else{var y,v,x,w;g.forEach(function(C){y=C.source().id(),v=C.target().id(),x=y===p?v:y,x!==m&&(w=C.id(),o[w]||(o[w]=!0,s.push({x:p,y:x,edge:C})),x in r?r[p].low=Math.min(r[p].low,r[x].id):(u(d,x,p),r[p].low=Math.min(r[p].low,r[x].low),r[p].id<=r[x].low&&(r[p].cutVertex=!0,l(p,x))))})}};t.forEach(function(f){if(f.isNode()){var d=f.id();d in r||(i=0,u(d,d),r[d].cutVertex=i>1)}});var h=Object.keys(r).filter(function(f){return r[f].cutVertex}).map(function(f){return t.getElementById(f)});return{cut:t.spawn(h),components:a}},pRt={hopcroftTarjanBiconnected:gL,htbc:gL,htb:gL,hopcroftTarjanBiconnectedComponents:gL},yL=function(){var t=this,r={},n=0,i=[],a=[],s=t.spawn(t),o=function(u){a.push(u),r[u]={index:n,low:n++,explored:!1};var h=t.getElementById(u).connectedEdges().intersection(t);if(h.forEach(function(g){var y=g.target().id();y!==u&&(y in r||o(y),r[y].explored||(r[u].low=Math.min(r[u].low,r[y].low)))}),r[u].index===r[u].low){for(var f=t.spawn();;){var d=a.pop();if(f.merge(t.getElementById(d)),r[d].low=r[u].index,r[d].explored=!0,d===u)break}var p=f.edgesWith(f),m=f.merge(p);i.push(m),s=s.difference(m)}};return t.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:i}},mRt={tarjanStronglyConnected:yL,tsc:yL,tscc:yL,tarjanStronglyConnectedComponents:yL},oNe={};[EC,H9t,U9t,X9t,K9t,Q9t,t_t,__t,$4,z4,qK,G_t,eRt,iRt,hRt,dRt,pRt,mRt].forEach(function(e){zr(oNe,e)});lNe=0,cNe=1,uNe=2,Sh=function(t){if(!(this instanceof Sh))return new Sh(t);this.id="Thenable/1.0.7",this.state=lNe,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Sh.prototype={fulfill:function(t){return zLe(this,cNe,"fulfillValue",t)},reject:function(t){return zLe(this,uNe,"rejectReason",t)},then:function(t,r){var n=this,i=new Sh;return n.onFulfilled.push(qLe(t,i,"fulfill")),n.onRejected.push(qLe(r,i,"reject")),hNe(n),i.proxy}};zLe=function(t,r,n,i){return t.state===lNe&&(t.state=r,t[n]=i,hNe(t)),t},hNe=function(t){t.state===cNe?GLe(t,"onFulfilled",t.fulfillValue):t.state===uNe&&GLe(t,"onRejected",t.rejectReason)},GLe=function(t,r,n){if(t[r].length!==0){var i=t[r];t[r]=[];var a=function(){for(var o=0;o0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var s=0;s0&&this.spawn(i).updateStyle().emit("class"),r},addClass:function(t){return this.toggleClass(t,!0)},hasClass:function(t){var r=this[0];return r!=null&&r._private.classes.has(t)},toggleClass:function(t,r){Di(t)||(t=t.match(/\S+/g)||[]);for(var n=this,i=r===void 0,a=[],s=0,o=n.length;s0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(t){return this.toggleClass(t,!1)},flashClass:function(t,r){var n=this;if(r==null)r=250;else if(r===0)return n;return n.addClass(t),setTimeout(function(){n.removeClass(t)},r),n}};_L.className=_L.classNames=_L.classes;Wn={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:ks,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Wn.variable="(?:[\\w-.]|(?:\\\\"+Wn.metaChar+"))+";Wn.className="(?:[\\w-]|(?:\\\\"+Wn.metaChar+"))+";Wn.value=Wn.string+"|"+Wn.number;Wn.id=Wn.variable;(function(){var e,t,r;for(e=Wn.comparatorOp.split("|"),r=0;r=0)&&t!=="="&&(Wn.comparatorOp+="|\\!"+t)})();Ei=function(){return{checks:[]}},fr={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},UK=[{selector:":selected",matches:function(t){return t.selected()}},{selector:":unselected",matches:function(t){return!t.selected()}},{selector:":selectable",matches:function(t){return t.selectable()}},{selector:":unselectable",matches:function(t){return!t.selectable()}},{selector:":locked",matches:function(t){return t.locked()}},{selector:":unlocked",matches:function(t){return!t.locked()}},{selector:":visible",matches:function(t){return t.visible()}},{selector:":hidden",matches:function(t){return!t.visible()}},{selector:":transparent",matches:function(t){return t.transparent()}},{selector:":grabbed",matches:function(t){return t.grabbed()}},{selector:":free",matches:function(t){return!t.grabbed()}},{selector:":removed",matches:function(t){return t.removed()}},{selector:":inside",matches:function(t){return!t.removed()}},{selector:":grabbable",matches:function(t){return t.grabbable()}},{selector:":ungrabbable",matches:function(t){return!t.grabbable()}},{selector:":animated",matches:function(t){return t.animated()}},{selector:":unanimated",matches:function(t){return!t.animated()}},{selector:":parent",matches:function(t){return t.isParent()}},{selector:":childless",matches:function(t){return t.isChildless()}},{selector:":child",matches:function(t){return t.isChild()}},{selector:":orphan",matches:function(t){return t.isOrphan()}},{selector:":nonorphan",matches:function(t){return t.isChild()}},{selector:":compound",matches:function(t){return t.isNode()?t.isParent():t.source().isParent()||t.target().isParent()}},{selector:":loop",matches:function(t){return t.isLoop()}},{selector:":simple",matches:function(t){return t.isSimple()}},{selector:":active",matches:function(t){return t.active()}},{selector:":inactive",matches:function(t){return!t.active()}},{selector:":backgrounding",matches:function(t){return t.backgrounding()}},{selector:":nonbackgrounding",matches:function(t){return!t.backgrounding()}}].sort(function(e,t){return c9t(e.selector,t.selector)}),fLt=(function(){for(var e={},t,r=0;r0&&h.edgeCount>0)return yi("The selector `"+t+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return yi("The selector `"+t+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&yi("The selector `"+t+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},vLt=function(){if(this.toStringCache!=null)return this.toStringCache;for(var t=function(h){return h??""},r=function(h){return Ar(h)?'"'+h+'"':t(h)},n=function(h){return" "+h+" "},i=function(h,f){var d=h.type,p=h.value;switch(d){case fr.GROUP:{var m=t(p);return m.substring(0,m.length-1)}case fr.DATA_COMPARE:{var g=h.field,y=h.operator;return"["+g+n(t(y))+r(p)+"]"}case fr.DATA_BOOL:{var v=h.operator,x=h.field;return"["+t(v)+x+"]"}case fr.DATA_EXIST:{var w=h.field;return"["+w+"]"}case fr.META_COMPARE:{var C=h.operator,T=h.field;return"[["+T+n(t(C))+r(p)+"]]"}case fr.STATE:return p;case fr.ID:return"#"+p;case fr.CLASS:return"."+p;case fr.PARENT:case fr.CHILD:return a(h.parent,f)+n(">")+a(h.child,f);case fr.ANCESTOR:case fr.DESCENDANT:return a(h.ancestor,f)+" "+a(h.descendant,f);case fr.COMPOUND_SPLIT:{var k=a(h.left,f),S=a(h.subject,f),E=a(h.right,f);return k+(k.length>0?" ":"")+S+E}case fr.TRUE:return""}},a=function(h,f){return h.checks.reduce(function(d,p,m){return d+(f===h&&m===0?"$":"")+i(p,f)},"")},s="",o=0;o1&&o=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(a||o||h)&&(l=!a&&!s?"":""+t,u=""+n),h&&(t=l=l.toLowerCase(),n=u=u.toLowerCase()),r){case"*=":i=l.indexOf(u)>=0;break;case"$=":i=l.indexOf(u,l.length-u.length)>=0;break;case"^=":i=l.indexOf(u)===0;break;case"=":i=t===n;break;case">":d=!0,i=t>n;break;case">=":d=!0,i=t>=n;break;case"<":d=!0,i=t1&&arguments[1]!==void 0?arguments[1]:!0;return bZ(this,e,t,xNe)};W4.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return bZ(this,e,t,bNe)};W4.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return bZ(this,e,t,ELt)};W4.ancestors=W4.parents;RC=wNe={data:gi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:gi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:gi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:gi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:gi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:gi.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var t=this[0];if(t)return t._private.data.id}};RC.attr=RC.data;RC.removeAttr=RC.removeData;ALt=wNe,aI={};zr(aI,{degree:AK(function(e,t){return t.source().same(t.target())?2:1}),indegree:AK(function(e,t){return t.target().same(e)?1:0}),outdegree:AK(function(e,t){return t.source().same(e)?1:0})});zr(aI,{minDegree:_4("degree",function(e,t){return et}),minIndegree:_4("indegree",function(e,t){return et}),minOutdegree:_4("outdegree",function(e,t){return et})});zr(aI,{totalDegree:function(t){for(var r=0,n=this.nodes(),i=0;i0,d=f;f&&(h=h[0]);var p=d?h.position():{x:0,y:0};r!==void 0?u.position(t,r+p[t]):a!==void 0&&u.position({x:a.x+p.x,y:a.y+p.y})}else{var m=n.position(),g=o?n.parent():null,y=g&&g.length>0,v=y;y&&(g=g[0]);var x=v?g.position():{x:0,y:0};return a={x:m.x-x.x,y:m.y-x.y},t===void 0?a:a[t]}else if(!s)return;return this}};Ch.modelPosition=Ch.point=Ch.position;Ch.modelPositions=Ch.points=Ch.positions;Ch.renderedPoint=Ch.renderedPosition;Ch.relativePoint=Ch.relativePosition;_Lt=kNe,H4=function(t){switch(t){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},U4=function(t){switch(t){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},RLt=function(t){switch(t){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}};G4=Tg={};Tg.renderedBoundingBox=function(e){var t=this.boundingBox(e),r=this.cy(),n=r.zoom(),i=r.pan(),a=t.x1*n+i.x,s=t.x2*n+i.x,o=t.y1*n+i.y,l=t.y2*n+i.y;return{x1:a,x2:s,y1:o,y2:l,w:s-a,h:l-o}};Tg.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,e||r.emitAndNotify("bounds")}}),this)};Tg.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),d=o.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=d.x-f.w/2,f.x2=d.x+f.w/2,f.y1=d.y-f.h/2,f.y2=d.y+f.h/2);function p(I,L,O){var R=0,A=0,N=L+O;return I>0&&N>0&&(R=L/N*I,A=O/N*I),{biasDiff:R,biasComplementDiff:A}}function m(I,L,O,R){if(O.units==="%")switch(R){case"width":return I>0?O.pfValue*I:0;case"height":return L>0?O.pfValue*L:0;case"average":return I>0&&L>0?O.pfValue*(I+L)/2:0;case"min":return I>0&&L>0?I>L?O.pfValue*L:O.pfValue*I:0;case"max":return I>0&&L>0?I>L?O.pfValue*I:O.pfValue*L:0;default:return 0}else return O.units==="px"?O.pfValue:0}var g=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(g=g*100/h.width.val);var y=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(y=y*100/h.width.val);var v=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(v=v*100/h.height.val);var x=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(x=x*100/h.height.val);var w=p(h.width.val-f.w,g,y),C=w.biasDiff,T=w.biasComplementDiff,k=p(h.height.val-f.h,v,x),S=k.biasDiff,E=k.biasComplementDiff;o.autoPadding=m(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,h.width.val),d.x=(-C+f.x1+f.x2+T)/2,o.autoHeight=Math.max(f.h,h.height.val),d.y=(-S+f.y1+f.y2+E)/2}for(var n=0;nt.x2?i:t.x2,t.y1=nt.y2?a:t.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1)},cg=function(t,r){return r==null?t:Th(t,r.x1,r.y1,r.x2,r.y2)},fC=function(t,r,n){return wl(t,r,n)},vL=function(t,r,n){if(!r.cy().headless()){var i=r._private,a=i.rstyle,s=a.arrowWidth/2,o=r.pstyle(n+"-arrow-shape").value,l,u;if(o!=="none"){n==="source"?(l=a.srcX,u=a.srcY):n==="target"?(l=a.tgtX,u=a.tgtY):(l=a.midX,u=a.midY);var h=i.arrowBounds=i.arrowBounds||{},f=h[n]=h[n]||{};f.x1=l-s,f.y1=u-s,f.x2=l+s,f.y2=u+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,EL(f,1),Th(t,f.x1,f.y1,f.x2,f.y2)}}},_K=function(t,r,n){if(!r.cy().headless()){var i;n?i=n+"-":i="";var a=r._private,s=a.rstyle,o=r.pstyle(i+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),h=fC(s,"labelWidth",n),f=fC(s,"labelHeight",n),d=fC(s,"labelX",n),p=fC(s,"labelY",n),m=r.pstyle(i+"text-margin-x").pfValue,g=r.pstyle(i+"text-margin-y").pfValue,y=r.isEdge(),v=r.pstyle(i+"text-rotation"),x=r.pstyle("text-outline-width").pfValue,w=r.pstyle("text-border-width").pfValue,C=w/2,T=r.pstyle("text-background-padding").pfValue,k=2,S=f,E=h,I=E/2,L=S/2,O,R,A,N;if(y)O=d-I,R=d+I,A=p-L,N=p+L;else{switch(H4(l.value)){case"left":O=d-E,R=d;break;case"center":O=d-I,R=d+I;break;case"right":O=d,R=d+E;break}switch(U4(u.value)){case"top":A=p-S,N=p;break;case"center":A=p-L,N=p+L;break;case"bottom":A=p,N=p+S;break}}var M=m-Math.max(x,C)-T-k,D=m+Math.max(x,C)+T+k,B=g-Math.max(x,C)-T-k,P=g+Math.max(x,C)+T+k;O+=M,R+=D,A+=B,N+=P;var $=n||"main",F=a.labelBounds,q=F[$]=F[$]||{};q.x1=O,q.y1=A,q.x2=R,q.y2=N,q.w=R-O,q.h=N-A,q.leftPad=M,q.rightPad=D,q.topPad=B,q.botPad=P;var G=y&&v.strValue==="autorotate",z=v.pfValue!=null&&v.pfValue!==0;if(G||z){var H=G?fC(a.rstyle,"labelAngle",n):v.pfValue,j=Math.cos(H),J=Math.sin(H),U=(O+R)/2,le=(A+N)/2;if(!y){switch(H4(l.value)){case"left":U=R;break;case"right":U=O;break}switch(U4(u.value)){case"top":le=N;break;case"bottom":le=A;break}}var ee=function(Ge,fe){return Ge=Ge-U,fe=fe-le,{x:Ge*j-fe*J+U,y:Ge*J+fe*j+le}},ue=ee(O,A),ae=ee(O,N),oe=ee(R,A),Re=ee(R,N);O=Math.min(ue.x,ae.x,oe.x,Re.x),R=Math.max(ue.x,ae.x,oe.x,Re.x),A=Math.min(ue.y,ae.y,oe.y,Re.y),N=Math.max(ue.y,ae.y,oe.y,Re.y)}var Te=$+"Rot",Oe=F[Te]=F[Te]||{};Oe.x1=O,Oe.y1=A,Oe.x2=R,Oe.y2=N,Oe.w=R-O,Oe.h=N-A,Th(t,O,A,R,N),Th(a.labelBounds.all,O,A,R,N)}return t}},GIe=function(t,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,a=r.pstyle("outline-offset").value,s=i+a;CNe(t,r,n,s,"outside",s/2)}},CNe=function(t,r,n,i,a,s){if(!(n===0||i<=0||a==="inside")){var o=r.cy(),l=o.renderer(),u=l.nodeShapes[l.getNodeShape(r)];if(u){var h=r.position(),f=h.x,d=h.y,p=r.width(),m=r.height();if(u.hasMiterBounds){a==="center"&&(i/=2);var g=u.miterBounds(f,d,p,m,i);cg(t,g)}else s!=null&&s>0&&AL(t,[s,s,s,s])}}},LLt=function(t,r){if(!r.cy().headless()){var n=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,a=r.pstyle("border-position").value;CNe(t,r,n,i,a)}},ILt=function(t,r){var n=t._private.cy,i=n.styleEnabled(),a=n.headless(),s=kl(),o=t._private,l=t.isNode(),u=t.isEdge(),h,f,d,p,m,g,y=o.rstyle,v=l&&i?t.pstyle("bounds-expansion").pfValue:[0],x=function(qe){return qe.pstyle("display").value!=="none"},w=!i||x(t)&&(!u||x(t.source())&&x(t.target()));if(w){var C=0,T=0;i&&r.includeOverlays&&(C=t.pstyle("overlay-opacity").value,C!==0&&(T=t.pstyle("overlay-padding").value));var k=0,S=0;i&&r.includeUnderlays&&(k=t.pstyle("underlay-opacity").value,k!==0&&(S=t.pstyle("underlay-padding").value));var E=Math.max(T,S),I=0,L=0;if(i&&(I=t.pstyle("width").pfValue,L=I/2),l&&r.includeNodes){var O=t.position();m=O.x,g=O.y;var R=t.outerWidth(),A=R/2,N=t.outerHeight(),M=N/2;h=m-A,f=m+A,d=g-M,p=g+M,Th(s,h,d,f,p),i&&GIe(s,t),i&&r.includeOutlines&&!a&&GIe(s,t),i&&LLt(s,t)}else if(u&&r.includeEdges)if(i&&!a){var D=t.pstyle("curve-style").strValue;if(h=Math.min(y.srcX,y.midX,y.tgtX),f=Math.max(y.srcX,y.midX,y.tgtX),d=Math.min(y.srcY,y.midY,y.tgtY),p=Math.max(y.srcY,y.midY,y.tgtY),h-=L,f+=L,d-=L,p+=L,Th(s,h,d,f,p),D==="haystack"){var B=y.haystackPts;if(B&&B.length===2){if(h=B[0].x,d=B[0].y,f=B[1].x,p=B[1].y,h>f){var P=h;h=f,f=P}if(d>p){var $=d;d=p,p=$}Th(s,h-L,d-L,f+L,p+L)}}else if(D==="bezier"||D==="unbundled-bezier"||ug(D,"segments")||ug(D,"taxi")){var F;switch(D){case"bezier":case"unbundled-bezier":F=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":F=y.linePts;break}if(F!=null)for(var q=0;qf){var U=h;h=f,f=U}if(d>p){var le=d;d=p,p=le}h-=L,f+=L,d-=L,p+=L,Th(s,h,d,f,p)}if(i&&r.includeEdges&&u&&(vL(s,t,"mid-source"),vL(s,t,"mid-target"),vL(s,t,"source"),vL(s,t,"target")),i){var ee=t.pstyle("ghost").value==="yes";if(ee){var ue=t.pstyle("ghost-offset-x").pfValue,ae=t.pstyle("ghost-offset-y").pfValue;Th(s,s.x1+ue,s.y1+ae,s.x2+ue,s.y2+ae)}}var oe=o.bodyBounds=o.bodyBounds||{};ELe(oe,s),AL(oe,v),EL(oe,1),i&&(h=s.x1,f=s.x2,d=s.y1,p=s.y2,Th(s,h-E,d-E,f+E,p+E));var Re=o.overlayBounds=o.overlayBounds||{};ELe(Re,s),AL(Re,v),EL(Re,1);var Te=o.labelBounds=o.labelBounds||{};Te.all!=null?h_t(Te.all):Te.all=kl(),i&&r.includeLabels&&(r.includeMainLabels&&_K(s,t,null),u&&(r.includeSourceLabels&&_K(s,t,"source"),r.includeTargetLabels&&_K(s,t,"target")))}return s.x1=Mu(s.x1),s.y1=Mu(s.y1),s.x2=Mu(s.x2),s.y2=Mu(s.y2),s.w=Mu(s.x2-s.x1),s.h=Mu(s.y2-s.y1),s.w>0&&s.h>0&&w&&(AL(s,v),EL(s,1)),s},SNe=function(t){var r=0,n=function(s){return(s?1:0)<=0;o--)s(o);return this};bg.removeAllListeners=function(){return this.removeListener("*")};bg.emit=bg.trigger=function(e,t,r){var n=this.listeners,i=n.length;return this.emitting++,Di(t)||(t=[t]),YLt(this,function(a,s){r!=null&&(n=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],i=n.length);for(var o=function(){var h=n[l];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===HLt)&&a.eventMatches(a.context,h,s)){var f=[s];t!=null&&P9t(f,t),a.beforeEmit(a.context,h,s),h.conf&&h.conf.one&&(a.listeners=a.listeners.filter(function(m){return m!==h}));var d=a.callbackContext(a.context,h,s),p=h.callback.apply(d,f);a.afterEmit(a.context,h,s),p===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[t]=l,a.set(u,{ele:l,index:t})}return this.length--,this},unmergeOne:function(t){t=t[0];var r=this._private,n=t._private.data.id,i=r.map,a=i.get(n);if(!a)return this;var s=a.index;return this.unmergeAt(s),this},unmerge:function(t){var r=this._private.cy;if(!t)return this;if(t&&Ar(t)){var n=t;t=r.mutableElements().filter(n)}for(var i=0;i=0;r--){var n=this[r];t(n)&&this.unmergeAt(r)}return this},map:function(t,r){for(var n=[],i=this,a=0;an&&(n=l,i=o)}return{value:n,ele:i}},min:function(t,r){for(var n=1/0,i,a=this,s=0;s=0&&a"u"?"undefined":Ts(Symbol))!=t&&Ts(Symbol.iterator)!=t;r&&(VL[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},a=0,s=this.length;return MMe({next:function(){return a1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],i=n.cy();if(i.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,i.style().apply(n));var a=n._private.style[t];return a??(r?i.style().getDefaultProperty(t):null)}},numericStyle:function(t){var r=this[0];if(r.cy().styleEnabled()&&r){var n=r.pstyle(t);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(t){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(t).units},renderedStyle:function(t){var r=this.cy();if(!r.styleEnabled())return this;var n=this[0];if(n)return r.style().getRenderedStyle(n,t)},style:function(t,r){var n=this.cy();if(!n.styleEnabled())return this;var i=!1,a=n.style();if(Hn(t)){var s=t;a.applyBypass(this,s,i),this.emitAndNotify("style")}else if(Ar(t))if(r===void 0){var o=this[0];return o?a.getStylePropertyValue(o,t):void 0}else a.applyBypass(this,t,r,i),this.emitAndNotify("style");else if(t===void 0){var l=this[0];return l?a.getRawStyle(l):void 0}return this},removeStyle:function(t){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style(),a=this;if(t===void 0)for(var s=0;s0&&t.push(h[0]),t.push(o[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(t){return this.neighborhood().add(this).filter(t)},openNeighborhood:function(t){return this.neighborhood(t)}});Ho.neighbourhood=Ho.neighborhood;Ho.closedNeighbourhood=Ho.closedNeighborhood;Ho.openNeighbourhood=Ho.openNeighborhood;zr(Ho,{source:Nu(function(t){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&t?n.filter(t):n},"source"),target:Nu(function(t){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&t?n.filter(t):n},"target"),sources:QIe({attr:"source"}),targets:QIe({attr:"target"})});zr(Ho,{edgesWith:Nu(JIe(),"edgesWith"),edgesTo:Nu(JIe({thisIsSrc:!0}),"edgesTo")});zr(Ho,{connectedEdges:Nu(function(e){for(var t=[],r=this,n=0;n0);return s},component:function(){var t=this[0];return t.cy().mutableElements().components(t)[0]}});Ho.componentsOf=Ho.components;go=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t===void 0){ca("A collection must have a reference to the core");return}var a=new P0,s=!1;if(!r)r=[];else if(r.length>0&&Hn(r[0])&&!OC(r[0])){s=!0;for(var o=[],l=new Y4,u=0,h=r.length;u0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=r.cy(),i=n._private,a=[],s=[],o,l=0,u=r.length;l0){for(var $=o.length===r.length?r:new go(n,o),F=0;F<$.length;F++){var q=$[F];q.isNode()||(q.parallelEdges().clearTraversalCache(),q.source().clearTraversalCache(),q.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=n.collection().merge($).merge($.connectedNodes()).merge($.parent()):G=$,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?$.emitAndNotify("add"):t&&$.emit("add")}return r};$i.removed=function(){var e=this[0];return e&&e._private.removed};$i.inside=function(){var e=this[0];return e&&!e._private.removed};$i.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=[],i={},a=r._private.cy;function s(N){for(var M=N._private.edges,D=0;D0&&(e?O.emitAndNotify("remove"):t&&O.emit("remove"));for(var R=0;Rh&&Math.abs(m.v)>h;);return d?function(g){return l[g*(l.length-1)|0]}:u}})(),Fi=function(t,r,n,i){var a=nIt(t,r,n,i);return function(s,o,l){return s+(o-s)*a(l)}},LL={linear:function(t,r,n){return t+(r-t)*n},ease:Fi(.25,.1,.25,1),"ease-in":Fi(.42,0,1,1),"ease-out":Fi(0,0,.58,1),"ease-in-out":Fi(.42,0,.58,1),"ease-in-sine":Fi(.47,0,.745,.715),"ease-out-sine":Fi(.39,.575,.565,1),"ease-in-out-sine":Fi(.445,.05,.55,.95),"ease-in-quad":Fi(.55,.085,.68,.53),"ease-out-quad":Fi(.25,.46,.45,.94),"ease-in-out-quad":Fi(.455,.03,.515,.955),"ease-in-cubic":Fi(.55,.055,.675,.19),"ease-out-cubic":Fi(.215,.61,.355,1),"ease-in-out-cubic":Fi(.645,.045,.355,1),"ease-in-quart":Fi(.895,.03,.685,.22),"ease-out-quart":Fi(.165,.84,.44,1),"ease-in-out-quart":Fi(.77,0,.175,1),"ease-in-quint":Fi(.755,.05,.855,.06),"ease-out-quint":Fi(.23,1,.32,1),"ease-in-out-quint":Fi(.86,0,.07,1),"ease-in-expo":Fi(.95,.05,.795,.035),"ease-out-expo":Fi(.19,1,.22,1),"ease-in-out-expo":Fi(1,0,0,1),"ease-in-circ":Fi(.6,.04,.98,.335),"ease-out-circ":Fi(.075,.82,.165,1),"ease-in-out-circ":Fi(.785,.135,.15,.86),spring:function(t,r,n){if(n===0)return LL.linear;var i=iIt(t,r,n);return function(a,s,o){return a+(s-a)*i(o)}},"cubic-bezier":Fi};oIt={animate:gi.animate(),animation:gi.animation(),animated:gi.animated(),clearQueue:gi.clearQueue(),delay:gi.delay(),delayAnimation:gi.delayAnimation(),stop:gi.stop(),addToAnimationPool:function(t){var r=this;r.styleEnabled()&&r._private.aniEles.merge(t)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var t=this;if(t._private.animationsRunning=!0,!t.styleEnabled())return;function r(){t._private.animationsRunning&&FL(function(a){nMe(a,t),r()})}var n=t.renderer();n&&n.beforeRender?n.beforeRender(function(a,s){nMe(s,t)},n.beforeRenderPriorities.animations):r()}},lIt={qualifierCompare:function(t,r){return t==null||r==null?t==null&&r==null:t.sameText(r)},eventMatches:function(t,r,n){var i=r.qualifier;return i!=null?t!==n.target&&OC(n.target)&&i.matches(n.target):!0},addEventFields:function(t,r){r.cy=t,r.target=t},callbackContext:function(t,r,n){return r.qualifier!=null?n.target:t}},wL=function(t){return Ar(t)?new vg(t):t},PNe={createEmitter:function(){var t=this._private;return t.emitter||(t.emitter=new sI(lIt,this)),this},emitter:function(){return this._private.emitter},on:function(t,r,n){return this.emitter().on(t,wL(r),n),this},removeListener:function(t,r,n){return this.emitter().removeListener(t,wL(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(t,r,n){return this.emitter().one(t,wL(r),n),this},once:function(t,r,n){return this.emitter().one(t,wL(r),n),this},emit:function(t,r){return this.emitter().emit(t,r),this},emitAndNotify:function(t,r){return this.emit(t),this.notify(t,r),this}};gi.eventAliasesOn(PNe);XK={png:function(t){var r=this._private.renderer;return t=t||{},r.png(t)},jpg:function(t){var r=this._private.renderer;return t=t||{},t.bg=t.bg||"#fff",r.jpg(t)}};XK.jpeg=XK.jpg;IL={layout:function(t){var r=this;if(t==null){ca("Layout options must be specified to make a layout");return}if(t.name==null){ca("A `name` must be specified to make a layout");return}var n=t.name,i=r.extension("layout",n);if(i==null){ca("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;Ar(t.eles)?a=r.$(t.eles):a=t.eles!=null?t.eles:r.$();var s=new i(zr({},t,{cy:r,eles:a}));return s}};IL.createLayout=IL.makeLayout=IL.layout;cIt={notify:function(t,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var i=n.batchNotifications[t]=n.batchNotifications[t]||this.collection();r!=null&&i.merge(r);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(t,r)}},notifications:function(t){var r=this._private;return t===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!t,this)},noNotifications:function(t){this.notifications(!1),t(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var t=this._private;return t.batchCount==null&&(t.batchCount=0),t.batchCount===0&&(t.batchStyleEles=this.collection(),t.batchNotifications={}),t.batchCount++,this},endBatch:function(){var t=this._private;if(t.batchCount===0)return this;if(t.batchCount--,t.batchCount===0){t.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(t.batchNotifications).forEach(function(n){var i=t.batchNotifications[n];i.empty()?r.notify(n):r.notify(n,i)})}return this},batch:function(t){return this.startBatch(),t(),this.endBatch(),this},batchData:function(t){var r=this;return this.batch(function(){for(var n=Object.keys(t),i=0;i0;)r.removeChild(r.childNodes[0]);t._private.renderer=null,t.mutableElements().forEach(function(n){var i=n._private;i.rscratch={},i.rstyle={},i.animation.current=[],i.animation.queue=[]})},onRender:function(t){return this.on("render",t)},offRender:function(t){return this.off("render",t)}};jK.invalidateDimensions=jK.resize;ML={collection:function(t,r){return Ar(t)?this.$(t):Wc(t)?t.collection():Di(t)?(r||(r={}),new go(this,t,r.unique,r.removed)):new go(this)},nodes:function(t){var r=this.$(function(n){return n.isNode()});return t?r.filter(t):r},edges:function(t){var r=this.$(function(n){return n.isEdge()});return t?r.filter(t):r},$:function(t){var r=this._private.elements;return t?r.filter(t):r.spawnSelf()},mutableElements:function(){return this._private.elements}};ML.elements=ML.filter=ML.$;Vs={},wC="t",hIt="f";Vs.apply=function(e){for(var t=this,r=t._private,n=r.cy,i=n.collection(),a=0;a0;if(d||f&&p){var m=void 0;d&&p||d?m=u.properties:p&&(m=u.mappedProperties);for(var g=0;g1&&(C=1),o.color){var k=n.valueMin[0],S=n.valueMax[0],E=n.valueMin[1],I=n.valueMax[1],L=n.valueMin[2],O=n.valueMax[2],R=n.valueMin[3]==null?1:n.valueMin[3],A=n.valueMax[3]==null?1:n.valueMax[3],N=[Math.round(k+(S-k)*C),Math.round(E+(I-E)*C),Math.round(L+(O-L)*C),Math.round(R+(A-R)*C)];a={bypass:n.bypass,name:n.name,value:N,strValue:"rgb("+N[0]+", "+N[1]+", "+N[2]+")"}}else if(o.number){var M=n.valueMin+(n.valueMax-n.valueMin)*C;a=this.parse(n.name,M,n.bypass,d)}else return!1;if(!a)return g(),!1;a.mapping=n,n=a;break}case s.data:{for(var D=n.field.split("."),B=f.data,P=0;P0&&a>0){for(var o={},l=!1,u=0;u0?e.delayAnimation(s).play().promise().then(w):w()}).then(function(){return e.animation({style:o,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1)};Vs.checkTrigger=function(e,t,r,n,i,a){var s=this.properties[t],o=i(s);e.removed()||o!=null&&o(r,n,e)&&a(s)};Vs.checkZOrderTrigger=function(e,t,r,n){var i=this;this.checkTrigger(e,t,r,n,function(a){return a.triggersZOrder},function(){i._private.cy.notify("zorder",e)})};Vs.checkBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})};Vs.checkConnectedEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBoundsOfConnectedEdges},function(i){e.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Vs.checkParallelEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBoundsOfParallelEdges},function(i){e.parallelEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Vs.checkTriggers=function(e,t,r,n){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,r,n),this.checkBoundsTrigger(e,t,r,n),this.checkConnectedEdgesBoundsTrigger(e,t,r,n),this.checkParallelEdgesBoundsTrigger(e,t,r,n)};qC={};qC.applyBypass=function(e,t,r,n){var i=this,a=[],s=!0;if(t==="*"||t==="**"){if(r!==void 0)for(var o=0;oi.length?n=n.substr(i.length):n=""}function l(){a.length>s.length?a=a.substr(s.length):a=""}for(;;){var u=n.match(/^\s*$/);if(u)break;var h=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){yi("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=h[0];var f=h[1];if(f!=="core"){var d=new vg(f);if(d.invalid){yi("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}}var p=h[2],m=!1;a=p;for(var g=[];;){var y=a.match(/^\s*$/);if(y)break;var v=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!v){yi("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),m=!0;break}s=v[0];var x=v[1],w=v[2],C=t.properties[x];if(!C){yi("Skipping property: Invalid property name in: "+s),l();continue}var T=r.parse(x,w);if(!T){yi("Skipping property: Invalid property definition in: "+s),l();continue}g.push({name:x,val:w}),l()}if(m){o();break}r.selector(f);for(var k=0;k=7&&t[0]==="d"&&(h=new RegExp(o.data.regex).exec(t))){if(r)return!1;var d=o.data;return{name:e,value:h,strValue:""+t,mapped:d,field:h[1],bypass:r}}else if(t.length>=10&&t[0]==="m"&&(f=new RegExp(o.mapData.regex).exec(t))){if(r||u.multiple)return!1;var p=o.mapData;if(!(u.color||u.number))return!1;var m=this.parse(e,f[4]);if(!m||m.mapped)return!1;var g=this.parse(e,f[5]);if(!g||g.mapped)return!1;if(m.pfValue===g.pfValue||m.strValue===g.strValue)return yi("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+m.strValue+"`"),this.parse(e,m.strValue);if(u.color){var y=m.value,v=g.value,x=y[0]===v[0]&&y[1]===v[1]&&y[2]===v[2]&&(y[3]===v[3]||(y[3]==null||y[3]===1)&&(v[3]==null||v[3]===1));if(x)return!1}return{name:e,value:f,strValue:""+t,mapped:p,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:m.value,valueMax:g.value,bypass:r}}}if(u.multiple&&n!=="multiple"){var w;if(l?w=t.split(/\s+/):Di(t)?w=t:w=[t],u.evenMultiple&&w.length%2!==0)return null;for(var C=[],T=[],k=[],S="",E=!1,I=0;I0?" ":"")+L.strValue}return u.validate&&!u.validate(C,T)?null:u.singleEnum&&E?C.length===1&&Ar(C[0])?{name:e,value:C[0],strValue:C[0],bypass:r}:null:{name:e,value:C,pfValue:k,strValue:S,bypass:r,units:T}}var O=function(){for(var ee=0;eeu.max||u.strictMax&&t===u.max))return null;var D={name:e,value:t,strValue:""+t+(R||""),units:R,bypass:r};return u.unitless||R!=="px"&&R!=="em"?D.pfValue=t:D.pfValue=R==="px"||!R?t:this.getEmSizeInPixels()*t,(R==="ms"||R==="s")&&(D.pfValue=R==="ms"?t:1e3*t),(R==="deg"||R==="rad")&&(D.pfValue=R==="rad"?t:o_t(t)),R==="%"&&(D.pfValue=t/100),D}else if(u.propList){var B=[],P=""+t;if(P!=="none"){for(var $=P.split(/\s*,\s*|\s+/),F=0;F<$.length;F++){var q=$[F].trim();i.properties[q]?B.push(q):yi("`"+q+"` is not a valid property name")}if(B.length===0)return null}return{name:e,value:B,strValue:B.length===0?"none":B.join(" "),bypass:r}}else if(u.color){var G=$Me(t);return G?{name:e,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var z=O();if(z)return z}for(var H=u.regexes?u.regexes:[u.regex],j=0;j0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((s-2*r)/n.w,(o-2*r)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=n.minZoom&&(n.maxZoom=r),this},minZoom:function(t){return t===void 0?this._private.minZoom:this.zoomRange({min:t})},maxZoom:function(t){return t===void 0?this._private.maxZoom:this.zoomRange({max:t})},getZoomedViewport:function(t){var r=this._private,n=r.pan,i=r.zoom,a,s,o=!1;if(r.zoomingEnabled||(o=!0),Zt(t)?s=t:Hn(t)&&(s=t.level,t.position!=null?a=JL(t.position,i,n):t.renderedPosition!=null&&(a=t.renderedPosition),a!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=sr.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,a.push("zoom"))}if(i&&(!s||!t.cancelOnFailedZoom)&&r.panningEnabled){var u=t.pan;Zt(u.x)&&(r.pan.x=u.x,o=!1),Zt(u.y)&&(r.pan.y=u.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(t){var r=this.getCenterPan(t);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(t,r){if(this._private.panningEnabled){if(Ar(t)){var n=t;t=this.mutableElements().filter(n)}else Wc(t)||(t=this.mutableElements());if(t.length!==0){var i=t.boundingBox(),a=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(a-r*(i.x1+i.x2))/2,y:(s-r*(i.y1+i.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var t=this._private,r=t.container,n=this;return t.sizeCache=t.sizeCache||(r?(function(){var i=n.window().getComputedStyle(r),a=function(o){return parseFloat(i.getPropertyValue(o))};return{width:r.clientWidth-a("padding-left")-a("padding-right"),height:r.clientHeight-a("padding-top")-a("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var t=this._private.pan,r=this._private.zoom,n=this.renderedExtent(),i={x1:(n.x1-t.x)/r,x2:(n.x2-t.x)/r,y1:(n.y1-t.y)/r,y2:(n.y2-t.y)/r};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var t=this.width(),r=this.height();return{x1:0,y1:0,x2:t,y2:r,w:t,h:r}},multiClickDebounceTime:function(t){if(t)this._private.multiClickDebounceTime=t;else return this._private.multiClickDebounceTime;return this}};gv.centre=gv.center;gv.autolockNodes=gv.autolock;gv.autoungrabifyNodes=gv.autoungrabify;IC={data:gi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:gi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:gi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:gi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};IC.attr=IC.data;IC.removeAttr=IC.removeData;MC=function(t){var r=this;t=zr({},t);var n=t.container;n&&!BL(n)&&BL(n[0])&&(n=n[0]);var i=n?n._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var a=i.readies=i.readies||[];n&&(n._cyreg=i),i.cy=r;var s=ws!==void 0&&n!==void 0&&!t.headless,o=t;o.layout=zr({name:s?"grid":"null"},o.layout),o.renderer=zr({name:s?"canvas":"null"},o.renderer);var l=function(m,g,y){return g!==void 0?g:y!==void 0?y:m},u=this._private={container:n,ready:!1,options:o,elements:new go(this),listeners:[],aniEles:new go(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:Zt(o.zoom)?o.zoom:1,pan:{x:Hn(o.pan)&&Zt(o.pan.x)?o.pan.x:0,y:Hn(o.pan)&&Zt(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var h=function(m,g){var y=m.some(t9t);if(y)return X4.all(m).then(g);g(m)};u.styleEnabled&&r.setStyle([]);var f=zr({},o,o.renderer);r.initRenderer(f);var d=function(m,g,y){r.notifications(!1);var v=r.mutableElements();v.length>0&&v.remove(),m!=null&&(Hn(m)||Di(m))&&r.add(m),r.one("layoutready",function(w){r.notifications(!0),r.emit(w),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var x=zr({},r._private.options.layout);x.eles=r.elements(),r.layout(x).run()};h([o.style,o.elements],function(p){var m=p[0],g=p[1];u.styleEnabled&&r.style().append(m),d(g,function(){r.startAnimationLoop(),u.ready=!0,ya(o.ready)&&r.on("ready",o.ready);for(var y=0;y0,o=!!e.boundingBox,l=kl(o?e.boundingBox:structuredClone(t.extent())),u;if(Wc(e.roots))u=e.roots;else if(Di(e.roots)){for(var h=[],f=0;f0;){var N=A(),M=I(N,O);if(M)N.outgoers().filter(function(Ce){return Ce.isNode()&&r.has(Ce)}).forEach(R);else if(M===null){yi("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var D=0;if(e.avoidOverlap)for(var B=0;B0&&v[0].length<=3?he/2:0),ce=2*Math.PI/v[ie].length*Q;return ie===0&&v[0].length===1&&(xe=1),{x:oe.x+xe*Math.cos(ce),y:oe.y+xe*Math.sin(ce)}}else{var ge=v[ie].length,Ie=Math.max(ge===1?0:o?(l.w-e.padding*2-Re.w)/((e.grid?Oe:ge)-1):(l.w-e.padding*2-Re.w)/((e.grid?Oe:ge)+1),D),ye={x:oe.x+(Q+1-(ge+1)/2)*Ie,y:oe.y+(ie+1-(j+1)/2)*Te};return ye}},Ge={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Ge).indexOf(e.direction)===-1&&ca("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Ge).join(", ")));var fe=function(_e){return L9t(qe(_e),l,Ge[e.direction])};return r.nodes().layoutPositions(this,e,fe),this};gIt={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,r){return!0},ready:void 0,stop:void 0,transform:function(t,r){return r}};FNe.prototype.run=function(){var e=this.options,t=e,r=e.cy,n=t.eles,i=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,a=n.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var s=kl(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep,u=l/Math.max(1,a.length-1),h,f=0,d=0;d1&&t.avoidOverlap){f*=1.75;var v=Math.cos(u)-Math.cos(0),x=Math.sin(u)-Math.sin(0),w=Math.sqrt(f*f/(v*v+x*x));h=Math.max(w,h)}var C=function(k,S){var E=t.startAngle+S*u*(i?1:-1),I=h*Math.cos(E),L=h*Math.sin(E),O={x:o.x+I,y:o.y+L};return O};return n.nodes().layoutPositions(this,t,C),this};yIt={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(t){return t.degree()},levelWidth:function(t){return t.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,r){return!0},ready:void 0,stop:void 0,transform:function(t,r){return r}};$Ne.prototype.run=function(){for(var e=this.options,t=e,r=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,n=e.cy,i=t.eles,a=i.nodes().not(":parent"),s=kl(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,h=0;h0){var T=Math.abs(x[0].value-C.value);T>=y&&(x=[],v.push(x))}x.push(C)}var k=u+t.minNodeSpacing;if(!t.avoidOverlap){var S=v.length>0&&v[0].length>1,E=Math.min(s.w,s.h)/2-k,I=E/(v.length+S?1:0);k=Math.min(k,I)}for(var L=0,O=0;O1&&t.avoidOverlap){var M=Math.cos(N)-Math.cos(0),D=Math.sin(N)-Math.sin(0),B=Math.sqrt(k*k/(M*M+D*D));L=Math.max(B,L)}R.r=L,L+=k}if(t.equidistant){for(var P=0,$=0,F=0;F=e.numIter||(CIt(n,e),n.temperature=n.temperature*e.coolingFactor,n.temperature=e.animationThreshold&&a(),FL(h)}};h()}else{for(;u;)u=s(l),l++;sMe(n,e),o()}return this};hI.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};hI.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};xIt=function(t,r,n){for(var i=n.eles.edges(),a=n.eles.nodes(),s=kl(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={isCompound:t.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=n.eles.components(),u={},h=0;h0){o.graphSet.push(E);for(var h=0;hi.count?0:i.graph},zNe=function(t,r,n,i){var a=i.graphSet[n];if(-10)var f=i.nodeOverlap*h,d=Math.sqrt(o*o+l*l),p=f*o/d,m=f*l/d;else var g=HL(t,o,l),y=HL(r,-1*o,-1*l),v=y.x-g.x,x=y.y-g.y,w=v*v+x*x,d=Math.sqrt(w),f=(t.nodeRepulsion+r.nodeRepulsion)/w,p=f*v/d,m=f*x/d;t.isLocked||(t.offsetX-=p,t.offsetY-=m),r.isLocked||(r.offsetX+=p,r.offsetY+=m)}},AIt=function(t,r,n,i){if(n>0)var a=t.maxX-r.minX;else var a=r.maxX-t.minX;if(i>0)var s=t.maxY-r.minY;else var s=r.maxY-t.minY;return a>=0&&s>=0?Math.sqrt(a*a+s*s):0},HL=function(t,r,n){var i=t.positionX,a=t.positionY,s=t.height||1,o=t.width||1,l=n/r,u=s/o,h={};return r===0&&0n?(h.x=i,h.y=a+s/2,h):0r&&-1*u<=l&&l<=u?(h.x=i-o/2,h.y=a-o*n/2/r,h):0=u)?(h.x=i+s*r/2/n,h.y=a+s/2,h):(0>n&&(l<=-1*u||l>=u)&&(h.x=i-s*r/2/n,h.y=a-s/2),h)},_It=function(t,r){for(var n=0;nn){var y=r.gravity*p/g,v=r.gravity*m/g;d.offsetX+=y,d.offsetY+=v}}}}},LIt=function(t,r){var n=[],i=0,a=-1;for(n.push.apply(n,t.graphSet[0]),a+=t.graphSet[0].length;i<=a;){var s=n[i++],o=t.idToIndex[s],l=t.layoutNodes[o],u=l.children;if(0n)var a={x:n*t/i,y:n*r/i};else var a={x:t,y:r};return a},qNe=function(t,r){var n=t.parentId;if(n!=null){var i=r.layoutNodes[r.idToIndex[n]],a=!1;if((i.maxX==null||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(i.minX==null||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(i.minY==null||t.minY-i.padTopv&&(m+=y+r.componentSpacing,p=0,g=0,y=0)}}},NIt={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(t){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,r){return!0},ready:void 0,stop:void 0,transform:function(t,r){return r}};VNe.prototype.run=function(){var e=this.options,t=e,r=e.cy,n=t.eles,i=n.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=kl(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(a.h===0||a.w===0)n.nodes().layoutPositions(this,t,function(z){return{x:a.x1,y:a.y1}});else{var s=i.size(),o=Math.sqrt(s*a.h/a.w),l=Math.round(o),u=Math.round(a.w/a.h*o),h=function(H){if(H==null)return Math.min(l,u);var j=Math.min(l,u);j==l?l=H:u=H},f=function(H){if(H==null)return Math.max(l,u);var j=Math.max(l,u);j==l?l=H:u=H},d=t.rows,p=t.cols!=null?t.cols:t.columns;if(d!=null&&p!=null)l=d,u=p;else if(d!=null&&p==null)l=d,u=Math.ceil(s/l);else if(d==null&&p!=null)u=p,l=Math.ceil(s/u);else if(u*l>s){var m=h(),g=f();(m-1)*g>=s?h(m-1):(g-1)*m>=s&&f(g-1)}else for(;u*l=s?f(v+1):h(y+1)}var x=a.w/u,w=a.h/l;if(t.condense&&(x=0,w=0),t.avoidOverlap)for(var C=0;C=u&&(M=0,N++)},B={},P=0;P(M=w_t(e,t,D[B],D[B+1],D[B+2],D[B+3])))return y(S,M),!0}else if(I.edgeType==="bezier"||I.edgeType==="multibezier"||I.edgeType==="self"||I.edgeType==="compound"){for(var D=I.allpts,B=0;B+5(M=b_t(e,t,D[B],D[B+1],D[B+2],D[B+3],D[B+4],D[B+5])))return y(S,M),!0}for(var P=P||E.source,$=$||E.target,F=i.getArrowWidth(L,O),q=[{name:"source",x:I.arrowStartX,y:I.arrowStartY,angle:I.srcArrowAngle},{name:"target",x:I.arrowEndX,y:I.arrowEndY,angle:I.tgtArrowAngle},{name:"mid-source",x:I.midX,y:I.midY,angle:I.midsrcArrowAngle},{name:"mid-target",x:I.midX,y:I.midY,angle:I.midtgtArrowAngle}],B=0;B0&&(v(P),v($))}function w(S,E,I){return wl(S,E,I)}function C(S,E){var I=S._private,L=d,O;E?O=E+"-":O="",S.boundingBox();var R=I.labelBounds[E||"main"],A=S.pstyle(O+"label").value,N=S.pstyle("text-events").strValue==="yes";if(!(!N||!A)){var M=w(I.rscratch,"labelX",E),D=w(I.rscratch,"labelY",E),B=w(I.rscratch,"labelAngle",E),P=S.pstyle(O+"text-margin-x").pfValue,$=S.pstyle(O+"text-margin-y").pfValue,F=R.x1-L-P,q=R.x2+L-P,G=R.y1-L-$,z=R.y2+L-$;if(B){var H=Math.cos(B),j=Math.sin(B),J=function(Re,Te){return Re=Re-M,Te=Te-D,{x:Re*H-Te*j+M,y:Re*j+Te*H+D}},U=J(F,G),le=J(F,z),ee=J(q,G),ue=J(q,z),ae=[U.x+P,U.y+$,ee.x+P,ee.y+$,ue.x+P,ue.y+$,le.x+P,le.y+$];if(rc(e,t,ae))return y(S),!0}else if(hg(R,e,t))return y(S),!0}}for(var T=s.length-1;T>=0;T--){var k=s[T];k.isNode()?v(k)||C(k):x(k)||C(k)||C(k,"source")||C(k,"target")}return o};vv.getAllInBox=function(e,t,r,n){var i=this.getCachedZSortedEles().interactive,a=this.cy.zoom(),s=2/a,o=[],l=Math.min(e,r),u=Math.max(e,r),h=Math.min(t,n),f=Math.max(t,n);e=l,r=u,t=h,n=f;var d=kl({x1:e,y1:t,x2:r,y2:n}),p=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],m=[[p[0],p[1]],[p[1],p[2]],[p[2],p[3]],[p[3],p[0]]];function g(Re,Te,Oe){return wl(Re,Te,Oe)}function y(Re,Te){var Oe=Re._private,qe=s,Ge="";Re.boundingBox();var fe=Oe.labelBounds.main;if(!fe)return null;var Ce=g(Oe.rscratch,"labelX",Te),_e=g(Oe.rscratch,"labelY",Te),de=g(Oe.rscratch,"labelAngle",Te),ie=Re.pstyle(Ge+"text-margin-x").pfValue,Q=Re.pstyle(Ge+"text-margin-y").pfValue,he=fe.x1-qe-ie,xe=fe.x2+qe-ie,ce=fe.y1-qe-Q,ge=fe.y2+qe-Q;if(de){var Ie=Math.cos(de),ye=Math.sin(de),ne=function(pe,K){return pe=pe-Ce,K=K-_e,{x:pe*Ie-K*ye+Ce,y:pe*ye+K*Ie+_e}};return[ne(he,ce),ne(xe,ce),ne(xe,ge),ne(he,ge)]}else return[{x:he,y:ce},{x:xe,y:ce},{x:xe,y:ge},{x:he,y:ge}]}function v(Re,Te,Oe,qe){function Ge(fe,Ce,_e){return(_e.y-fe.y)*(Ce.x-fe.x)>(Ce.y-fe.y)*(_e.x-fe.x)}return Ge(Re,Oe,qe)!==Ge(Te,Oe,qe)&&Ge(Re,Te,Oe)!==Ge(Re,Te,qe)}for(var x=0;x0?-(Math.PI-t.ang):Math.PI+t.ang},$It=function(t,r,n,i,a){if(t!==hMe?fMe(r,t,jf):FIt(Iu,jf),fMe(r,n,Iu),cMe=jf.nx*Iu.ny-jf.ny*Iu.nx,uMe=jf.nx*Iu.nx-jf.ny*-Iu.ny,O0=Math.asin(Math.max(-1,Math.min(1,cMe))),Math.abs(O0)<1e-6){KK=r.x,ZK=r.y,cv=I4=0;return}hv=1,NL=!1,uMe<0?O0<0?O0=Math.PI+O0:(O0=Math.PI-O0,hv=-1,NL=!0):O0>0&&(hv=-1,NL=!0),r.radius!==void 0?I4=r.radius:I4=i,av=O0/2,kL=Math.min(jf.len/2,Iu.len/2),a?(Yf=Math.abs(Math.cos(av)*I4/Math.sin(av)),Yf>kL?(Yf=kL,cv=Math.abs(Yf*Math.sin(av)/Math.cos(av))):cv=I4):(Yf=Math.min(kL,I4),cv=Math.abs(Yf*Math.sin(av)/Math.cos(av))),QK=r.x+Iu.nx*Yf,JK=r.y+Iu.ny*Yf,KK=QK-Iu.ny*cv*hv,ZK=JK+Iu.nx*cv*hv,YNe=r.x+jf.nx*Yf,XNe=r.y+jf.ny*Yf,hMe=r};NC=.01,zIt=Math.sqrt(2*NC),Yo={};Yo.findMidptPtsEtc=function(e,t){var r=t.posPts,n=t.intersectionPts,i=t.vectorNormInverse,a,s=e.pstyle("source-endpoint"),o=e.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(T,k,S,E){var I=E-k,L=S-T,O=Math.sqrt(L*L+I*I);return{x:-I/O,y:L/O}},h=e.pstyle("edge-distances").value;switch(h){case"node-position":a=r;break;case"intersection":a=n;break;case"endpoints":{if(l){var f=this.manualEndptToPx(e.source()[0],s),d=as(f,2),p=d[0],m=d[1],g=this.manualEndptToPx(e.target()[0],o),y=as(g,2),v=y[0],x=y[1],w={x1:p,y1:m,x2:v,y2:x};i=u(p,m,v,x),a=w}else yi("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),a=n;break}}return{midptPts:a,vectorNormInverse:i}};Yo.findHaystackPoints=function(e){for(var t=0;t0?Math.max(K-ve,0):Math.min(K+ve,0)},A=R(L,E),N=R(O,I),M=!1;x===u?v=Math.abs(A)>Math.abs(N)?i:n:x===l||x===o?(v=n,M=!0):(x===a||x===s)&&(v=i,M=!0);var D=v===n,B=D?N:A,P=D?O:L,$=dZ(P),F=!1;!(M&&(C||k))&&(x===o&&P<0||x===l&&P>0||x===a&&P>0||x===s&&P<0)&&($*=-1,B=$*Math.abs(B),F=!0);var q;if(C){var G=T<0?1+T:T;q=G*B}else{var z=T<0?B:0;q=z+T*$}var H=function(K){return Math.abs(K)=Math.abs(B)},j=H(q),J=H(Math.abs(B)-Math.abs(q)),U=j||J;if(U&&!F)if(D){var le=Math.abs(P)<=d/2,ee=Math.abs(L)<=p/2;if(le){var ue=(h.x1+h.x2)/2,ae=h.y1,oe=h.y2;r.segpts=[ue,ae,ue,oe]}else if(ee){var Re=(h.y1+h.y2)/2,Te=h.x1,Oe=h.x2;r.segpts=[Te,Re,Oe,Re]}else r.segpts=[h.x1,h.y2]}else{var qe=Math.abs(P)<=f/2,Ge=Math.abs(O)<=m/2;if(qe){var fe=(h.y1+h.y2)/2,Ce=h.x1,_e=h.x2;r.segpts=[Ce,fe,_e,fe]}else if(Ge){var de=(h.x1+h.x2)/2,ie=h.y1,Q=h.y2;r.segpts=[de,ie,de,Q]}else r.segpts=[h.x2,h.y1]}else if(D){var he=h.y1+q+(y?d/2*$:0),xe=h.x1,ce=h.x2;r.segpts=[xe,he,ce,he]}else{var ge=h.x1+q+(y?f/2*$:0),Ie=h.y1,ye=h.y2;r.segpts=[ge,Ie,ge,ye]}if(r.isRound){var ne=e.pstyle("taxi-radius").value,V=e.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ne),r.isArcRadius=new Array(r.segpts.length/2).fill(V)}};Yo.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if(r.edgeType==="bezier"){var n=t.srcPos,i=t.tgtPos,a=t.srcW,s=t.srcH,o=t.tgtW,l=t.tgtH,u=t.srcShape,h=t.tgtShape,f=t.srcCornerRadius,d=t.tgtCornerRadius,p=t.srcRs,m=t.tgtRs,g=!Zt(r.startX)||!Zt(r.startY),y=!Zt(r.arrowStartX)||!Zt(r.arrowStartY),v=!Zt(r.endX)||!Zt(r.endY),x=!Zt(r.arrowEndX)||!Zt(r.arrowEndY),w=3,C=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,T=w*C,k=pv({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),S=kP.poolIndex()){var $=B;B=P,P=$}var F=A.srcPos=B.position(),q=A.tgtPos=P.position(),G=A.srcW=B.outerWidth(),z=A.srcH=B.outerHeight(),H=A.tgtW=P.outerWidth(),j=A.tgtH=P.outerHeight(),J=A.srcShape=r.nodeShapes[t.getNodeShape(B)],U=A.tgtShape=r.nodeShapes[t.getNodeShape(P)],le=A.srcCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,ee=A.tgtCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,ue=A.tgtRs=P._private.rscratch,ae=A.srcRs=B._private.rscratch;A.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var oe=0;oe=zIt||(ce=Math.sqrt(Math.max(xe*xe,NC)+Math.max(he*he,NC)));var ge=A.vector={x:xe,y:he},Ie=A.vectorNorm={x:ge.x/ce,y:ge.y/ce},ye={x:-Ie.y,y:Ie.x};A.nodesOverlap=!Zt(ce)||U.checkPoint(fe[0],fe[1],0,H,j,q.x,q.y,ee,ue)||J.checkPoint(_e[0],_e[1],0,G,z,F.x,F.y,le,ae),A.vectorNormInverse=ye,N={nodesOverlap:A.nodesOverlap,dirCounts:A.dirCounts,calculatedIntersection:!0,hasBezier:A.hasBezier,hasUnbundled:A.hasUnbundled,eles:A.eles,srcPos:q,srcRs:ue,tgtPos:F,tgtRs:ae,srcW:H,srcH:j,tgtW:G,tgtH:z,srcIntn:de,tgtIntn:Ce,srcShape:U,tgtShape:J,posPts:{x1:Q.x2,y1:Q.y2,x2:Q.x1,y2:Q.y1},intersectionPts:{x1:ie.x2,y1:ie.y2,x2:ie.x1,y2:ie.y1},vector:{x:-ge.x,y:-ge.y},vectorNorm:{x:-Ie.x,y:-Ie.y},vectorNormInverse:{x:-ye.x,y:-ye.y}}}var ne=Ge?N:A;Te.nodesOverlap=ne.nodesOverlap,Te.srcIntn=ne.srcIntn,Te.tgtIntn=ne.tgtIntn,Te.isRound=Oe.startsWith("round"),i&&(B.isParent()||B.isChild()||P.isParent()||P.isChild())&&(B.parents().anySame(P)||P.parents().anySame(B)||B.same(P)&&B.isParent())?t.findCompoundLoopPoints(Re,ne,oe,qe):B===P?t.findLoopPoints(Re,ne,oe,qe):Oe.endsWith("segments")?t.findSegmentsPoints(Re,ne):Oe.endsWith("taxi")?t.findTaxiPoints(Re,ne):Oe==="straight"||!qe&&A.eles.length%2===1&&oe===Math.floor(A.eles.length/2)?t.findStraightEdgePoints(Re):t.findBezierPoints(Re,ne,oe,qe,Ge),t.findEndpoints(Re),t.tryToCorrectInvalidPoints(Re,ne),t.checkForInvalidEdgeWarning(Re),t.storeAllpts(Re),t.storeEdgeProjections(Re),t.calculateArrowAngles(Re),t.recalculateEdgeLabelProjections(Re),t.calculateLabelAngles(Re)}},S=0;S0){var fe=u,Ce=lv(fe,O4(s)),_e=lv(fe,O4(Ge)),de=Ce;if(_e2){var ie=lv(fe,{x:Ge[2],y:Ge[3]});ie0){var Z=h,je=lv(Z,O4(s)),Ne=lv(Z,O4(ve)),ze=je;if(Ne2){var Fe=lv(Z,{x:ve[2],y:ve[3]});Fe=m||S){y={cp:C,segment:k};break}}if(y)break}var E=y.cp,I=y.segment,L=(m-v)/I.length,O=I.t1-I.t0,R=p?I.t0+O*L:I.t1-O*L;R=AC(0,R,1),t=F4(E.p0,E.p1,E.p2,R),d=qIt(E.p0,E.p1,E.p2,R);break}case"straight":case"segments":case"haystack":{for(var A=0,N,M,D,B,P=n.allpts.length,$=0;$+3=m));$+=2);var F=m-M,q=F/N;q=AC(0,q,1),t=c_t(D,B,q),d=QNe(D,B);break}}s("labelX",f,t.x),s("labelY",f,t.y),s("labelAutoAngle",f,d)}};u("source"),u("target"),this.applyLabelDimensions(e)}};Jf.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))};Jf.applyPrefixedLabelDimensions=function(e,t){var r=e._private,n=this.getLabelText(e,t),i=dv(n,e._private.labelDimsKey);if(wl(r.rscratch,"prefixedLabelDimsKey",t)!==i){Kf(r.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,n),s=e.pstyle("line-height").pfValue,o=e.pstyle("font-size").pfValue,l=e.pstyle("text-wrap").strValue,u=wl(r.rscratch,"labelWrapCachedLines",t)||[],h=l!=="wrap"?1:Math.max(u.length,1),f=o*s,d=a.width,p=a.height+(h-1)*(s-1)*o;Kf(r.rstyle,"labelWidth",t,d),Kf(r.rscratch,"labelWidth",t,d),Kf(r.rstyle,"labelHeight",t,p),Kf(r.rscratch,"labelHeight",t,p),Kf(r.rscratch,"labelLineHeight",t,f),Kf(r.rscratch,"labelActualDescent",t,a.labelActualDescent)}};Jf.getLabelText=function(e,t){var r=e._private,n=t?t+"-":"",i=e.pstyle(n+"label").strValue,a=e.pstyle("text-transform").value,s=function(z,H){return H?(Kf(r.rscratch,z,t,H),H):wl(r.rscratch,z,t)};if(!i)return"";a=="none"||(a=="uppercase"?i=i.toUpperCase():a=="lowercase"&&(i=i.toLowerCase()));var o=e.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",h=i.split(` -`),f=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value,p=d==="anywhere",m=[],g=/[\s\u200b]+|$/g,y=0;yf){var T=v.matchAll(g),k="",S=0,E=nc(T),I;try{for(E.s();!(I=E.n()).done;){var L=I.value,O=L[0],R=v.substring(S,L.index);S=L.index+O.length;var A=k.length===0?R:k+R+O,N=this.calculateLabelDimensions(e,A),M=N.width;M<=f?k+=R+O:(k&&m.push(k),k=R+O)}}catch(G){E.e(G)}finally{E.f()}k.match(/^[\s\u200b]+$/)||m.push(k)}else m.push(v)}s("labelWrapCachedLines",m),i=s("labelWrapCachedText",m.join(` -`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var D=e.pstyle("text-max-width").pfValue,B="",P="\u2026",$=!1;if(this.calculateLabelDimensions(e,i).widthD)break;B+=i[F],F===i.length-1&&($=!0)}return $||(B+=P),B}return i};Jf.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;return t==="auto"?e.isNode()?RLt(r):"center":t};Jf.calculateLabelDimensions=function(e,t){var r=this,n=r.cy.window(),i=n.document,a=0,s=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,h=e.pstyle("text-metrics").strValue||"font",f=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=i.createElement("canvas"),d=this.labelCalcCanvasContext=f.getContext("2d");var p=f.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}d.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var m=0,g=0,y=t.split(` -`),v=y.length,x=0,w=0,C=0;C1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(s),o)for(var l=0;l=e.desktopTapThreshold2}var Rt=a(V);Et&&(e.hoverData.tapholdCancelled=!0);var bt=function(){var rr=e.hoverData.dragDelta=e.hoverData.dragDelta||[];rr.length===0?(rr.push(rt[0]),rr.push(rt[1])):(rr[0]+=rt[0],rr[1]+=rt[1])};K=!0,i(Ve,["mousemove","vmousemove","tapdrag"],V,{x:Ne[0],y:Ne[1]});var ke=function(rr){return{originalEvent:V,type:rr,position:{x:Ne[0],y:Ne[1]}}},yt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||ve.emit(ke("boxstart")),Ke[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Et){var xt=ke("cxtdrag");We?We.emit(xt):ve.emit(xt),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||Ve!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(ke("cxtdragout")),e.hoverData.cxtOver=Ve,Ve&&Ve.emit(ke("cxtdragover")))}}else if(e.hoverData.dragging){if(K=!0,ve.panningEnabled()&&ve.userPanningEnabled()){var it;if(e.hoverData.justStartedPan){var Me=e.hoverData.mdownPos;it={x:(Ne[0]-Me[0])*Z,y:(Ne[1]-Me[1])*Z},e.hoverData.justStartedPan=!1}else it={x:rt[0]*Z,y:rt[1]*Z};ve.panBy(it),ve.emit(ke("dragpan")),e.hoverData.dragged=!0}Ne=e.projectIntoViewport(V.clientX,V.clientY)}else if(Ke[4]==1&&(We==null||We.pannable())){if(Et){if(!e.hoverData.dragging&&ve.boxSelectionEnabled()&&(Rt||!ve.panningEnabled()||!ve.userPanningEnabled()))yt();else if(!e.hoverData.selecting&&ve.panningEnabled()&&ve.userPanningEnabled()){var ut=s(We,e.hoverData.downs);ut&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ke[4]=0,e.data.bgActivePosistion=O4(ze),e.redrawHint("select",!0),e.redraw())}We&&We.pannable()&&We.active()&&We.unactivate()}}else{if(We&&We.pannable()&&We.active()&&We.unactivate(),(!We||!We.grabbed())&&Ve!=tt&&(tt&&i(tt,["mouseout","tapdragout"],V,{x:Ne[0],y:Ne[1]}),Ve&&i(Ve,["mouseover","tapdragover"],V,{x:Ne[0],y:Ne[1]}),e.hoverData.last=Ve),We)if(Et){if(ve.boxSelectionEnabled()&&Rt)We&&We.grabbed()&&(g(Se),We.emit(ke("freeon")),Se.emit(ke("free")),e.dragData.didDrag&&(We.emit(ke("dragfreeon")),Se.emit(ke("dragfree")))),yt();else if(We&&We.grabbed()&&e.nodeIsDraggable(We)){var at=!e.dragData.didDrag;at&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(Se,{inDragLayer:!0});var dt={x:0,y:0};if(Zt(rt[0])&&Zt(rt[1])&&(dt.x+=rt[0],dt.y+=rt[1],at)){var tr=e.hoverData.dragDelta;tr&&Zt(tr[0])&&Zt(tr[1])&&(dt.x+=tr[0],dt.y+=tr[1])}e.hoverData.draggingEles=!0,Se.silentShift(dt).emit(ke("position")).emit(ke("drag")),e.redrawHint("drag",!0),e.redraw()}}else bt();K=!0}if(Ke[2]=Ne[0],Ke[3]=Ne[1],K)return V.stopPropagation&&V.stopPropagation(),V.preventDefault&&V.preventDefault(),!1}},!1);var L,O,R;e.registerBinding(t,"mouseup",function(V){if(!(e.hoverData.which===1&&V.which!==1&&e.hoverData.capture)){var pe=e.hoverData.capture;if(pe){e.hoverData.capture=!1;var K=e.cy,ve=e.projectIntoViewport(V.clientX,V.clientY),Z=e.selection,je=e.findNearestElement(ve[0],ve[1],!0,!1),Ne=e.dragData.possibleDragElements,ze=e.hoverData.down,Fe=a(V);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,ze&&ze.unactivate();var Ke=function(De){return{originalEvent:V,type:De,position:{x:ve[0],y:ve[1]}}};if(e.hoverData.which===3){var Ve=Ke("cxttapend");if(ze?ze.emit(Ve):K.emit(Ve),!e.hoverData.cxtDragged){var tt=Ke("cxttap");ze?ze.emit(tt):K.emit(tt)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(je,["mouseup","tapend","vmouseup"],V,{x:ve[0],y:ve[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(ze,["click","tap","vclick"],V,{x:ve[0],y:ve[1]}),O=!1,V.timeStamp-R<=K.multiClickDebounceTime()?(L&&clearTimeout(L),O=!0,R=null,i(ze,["dblclick","dbltap","vdblclick"],V,{x:ve[0],y:ve[1]})):(L=setTimeout(function(){O||i(ze,["oneclick","onetap","voneclick"],V,{x:ve[0],y:ve[1]})},K.multiClickDebounceTime()),R=V.timeStamp)),ze==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(V)&&(K.$(r).unselect(["tapunselect"]),Ne.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=Ne=K.collection()),je==ze&&!e.dragData.didDrag&&!e.hoverData.selecting&&je!=null&&je._private.selectable&&(e.hoverData.dragging||(K.selectionType()==="additive"||Fe?je.selected()?je.unselect(["tapunselect"]):je.select(["tapselect"]):Fe||(K.$(r).unmerge(je).unselect(["tapunselect"]),je.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var We=K.collection(e.getAllInBox(Z[0],Z[1],Z[2],Z[3]));e.redrawHint("select",!0),We.length>0&&e.redrawHint("eles",!0),K.emit(Ke("boxend"));var rt=function(De){return De.selectable()&&!De.selected()};K.selectionType()==="additive"||Fe||K.$(r).unmerge(We).unselect(),We.emit(Ke("box")).stdFilter(rt).select().emit(Ke("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!Z[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var Se=ze&&ze.grabbed();g(Ne),Se&&(ze.emit(Ke("freeon")),Ne.emit(Ke("free")),e.dragData.didDrag&&(ze.emit(Ke("dragfreeon")),Ne.emit(Ke("dragfree"))))}}Z[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var A=[],N=4,M,D=1e5,B=function(V,pe){for(var K=0;K=N){var ve=A;if(M=B(ve,5),!M){var Z=Math.abs(ve[0]);M=P(ve)&&Z>5}if(M)for(var je=0;je5&&(K=dZ(K)*5),tt=K/-250,M&&(tt/=D,tt*=3),tt=tt*e.wheelSensitivity;var We=V.deltaMode===1;We&&(tt*=33);var rt=Ne.zoom()*Math.pow(10,tt);V.type==="gesturechange"&&(rt=e.gestureStartZoom*V.scale),Ne.zoom({level:rt,renderedPosition:{x:Ve[0],y:Ve[1]}}),Ne.emit({type:V.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:V,position:{x:Ke[0],y:Ke[1]}})}}}};e.registerBinding(e.container,"wheel",$,!0),e.registerBinding(t,"scroll",function(V){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(V){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||V.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(ne){e.hasTouchStarted||$(ne)},!0),e.registerBinding(e.container,"mouseout",function(V){var pe=e.projectIntoViewport(V.clientX,V.clientY);e.cy.emit({originalEvent:V,type:"mouseout",position:{x:pe[0],y:pe[1]}})},!1),e.registerBinding(e.container,"mouseover",function(V){var pe=e.projectIntoViewport(V.clientX,V.clientY);e.cy.emit({originalEvent:V,type:"mouseover",position:{x:pe[0],y:pe[1]}})},!1);var F,q,G,z,H,j,J,U,le,ee,ue,ae,oe,Re=function(V,pe,K,ve){return Math.sqrt((K-V)*(K-V)+(ve-pe)*(ve-pe))},Te=function(V,pe,K,ve){return(K-V)*(K-V)+(ve-pe)*(ve-pe)},Oe;e.registerBinding(e.container,"touchstart",Oe=function(V){if(e.hasTouchStarted=!0,!!E(V)){v(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var pe=e.cy,K=e.touchData.now,ve=e.touchData.earlier;if(V.touches[0]){var Z=e.projectIntoViewport(V.touches[0].clientX,V.touches[0].clientY);K[0]=Z[0],K[1]=Z[1]}if(V.touches[1]){var Z=e.projectIntoViewport(V.touches[1].clientX,V.touches[1].clientY);K[2]=Z[0],K[3]=Z[1]}if(V.touches[2]){var Z=e.projectIntoViewport(V.touches[2].clientX,V.touches[2].clientY);K[4]=Z[0],K[5]=Z[1]}var je=function(Rt){return{originalEvent:V,type:Rt,position:{x:K[0],y:K[1]}}};if(V.touches[1]){e.touchData.singleTouchMoved=!0,g(e.dragData.touchDragEles);var Ne=e.findContainerClientCoords();le=Ne[0],ee=Ne[1],ue=Ne[2],ae=Ne[3],F=V.touches[0].clientX-le,q=V.touches[0].clientY-ee,G=V.touches[1].clientX-le,z=V.touches[1].clientY-ee,oe=0<=F&&F<=ue&&0<=G&&G<=ue&&0<=q&&q<=ae&&0<=z&&z<=ae;var ze=pe.pan(),Fe=pe.zoom();H=Re(F,q,G,z),j=Te(F,q,G,z),J=[(F+G)/2,(q+z)/2],U=[(J[0]-ze.x)/Fe,(J[1]-ze.y)/Fe];var Ke=200,Ve=Ke*Ke;if(j=1){for(var mt=e.touchData.startPosition=[null,null,null,null,null,null],Tt=0;Tt=e.touchTapThreshold2}if(pe&&e.touchData.cxt){V.preventDefault();var Tt=V.touches[0].clientX-le,jt=V.touches[0].clientY-ee,_t=V.touches[1].clientX-le,Rt=V.touches[1].clientY-ee,bt=Te(Tt,jt,_t,Rt),ke=bt/j,yt=150,xt=yt*yt,it=1.5,Me=it*it;if(ke>=Me||bt>=xt){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ut=Fe("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(ut),e.touchData.start=null):ve.emit(ut)}}if(pe&&e.touchData.cxt){var ut=Fe("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(ut):ve.emit(ut),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var at=e.findNearestElement(Z[0],Z[1],!0,!0);(!e.touchData.cxtOver||at!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(Fe("cxtdragout")),e.touchData.cxtOver=at,at&&at.emit(Fe("cxtdragover")))}else if(pe&&V.touches[2]&&ve.boxSelectionEnabled())V.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||ve.emit(Fe("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,K[4]=1,!K||K.length===0||K[0]===void 0?(K[0]=(Z[0]+Z[2]+Z[4])/3,K[1]=(Z[1]+Z[3]+Z[5])/3,K[2]=(Z[0]+Z[2]+Z[4])/3+1,K[3]=(Z[1]+Z[3]+Z[5])/3+1):(K[2]=(Z[0]+Z[2]+Z[4])/3,K[3]=(Z[1]+Z[3]+Z[5])/3),e.redrawHint("select",!0),e.redraw();else if(pe&&V.touches[1]&&!e.touchData.didSelect&&ve.zoomingEnabled()&&ve.panningEnabled()&&ve.userZoomingEnabled()&&ve.userPanningEnabled()){V.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var dt=e.dragData.touchDragEles;if(dt){e.redrawHint("drag",!0);for(var tr=0;tr0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var Ge;e.registerBinding(t,"touchcancel",Ge=function(V){var pe=e.touchData.start;e.touchData.capture=!1,pe&&pe.unactivate()});var fe,Ce,_e,de;if(e.registerBinding(t,"touchend",fe=function(V){var pe=e.touchData.start,K=e.touchData.capture;if(K)V.touches.length===0&&(e.touchData.capture=!1),V.preventDefault();else return;var ve=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var Z=e.cy,je=Z.zoom(),Ne=e.touchData.now,ze=e.touchData.earlier;if(V.touches[0]){var Fe=e.projectIntoViewport(V.touches[0].clientX,V.touches[0].clientY);Ne[0]=Fe[0],Ne[1]=Fe[1]}if(V.touches[1]){var Fe=e.projectIntoViewport(V.touches[1].clientX,V.touches[1].clientY);Ne[2]=Fe[0],Ne[3]=Fe[1]}if(V.touches[2]){var Fe=e.projectIntoViewport(V.touches[2].clientX,V.touches[2].clientY);Ne[4]=Fe[0],Ne[5]=Fe[1]}var Ke=function(xt){return{originalEvent:V,type:xt,position:{x:Ne[0],y:Ne[1]}}};pe&&pe.unactivate();var Ve;if(e.touchData.cxt){if(Ve=Ke("cxttapend"),pe?pe.emit(Ve):Z.emit(Ve),!e.touchData.cxtDragged){var tt=Ke("cxttap");pe?pe.emit(tt):Z.emit(tt)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!V.touches[2]&&Z.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var We=Z.collection(e.getAllInBox(ve[0],ve[1],ve[2],ve[3]));ve[0]=void 0,ve[1]=void 0,ve[2]=void 0,ve[3]=void 0,ve[4]=0,e.redrawHint("select",!0),Z.emit(Ke("boxend"));var rt=function(xt){return xt.selectable()&&!xt.selected()};We.emit(Ke("box")).stdFilter(rt).select().emit(Ke("boxselect")),We.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(pe?.unactivate(),V.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!V.touches[1]){if(!V.touches[0]){if(!V.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Se=e.dragData.touchDragEles;if(pe!=null){var Et=pe._private.grabbed;g(Se),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Et&&(pe.emit(Ke("freeon")),Se.emit(Ke("free")),e.dragData.didDrag&&(pe.emit(Ke("dragfreeon")),Se.emit(Ke("dragfree")))),i(pe,["touchend","tapend","vmouseup","tapdragout"],V,{x:Ne[0],y:Ne[1]}),pe.unactivate(),e.touchData.start=null}else{var De=e.findNearestElement(Ne[0],Ne[1],!0,!0);i(De,["touchend","tapend","vmouseup","tapdragout"],V,{x:Ne[0],y:Ne[1]})}var mt=e.touchData.startPosition[0]-Ne[0],Tt=mt*mt,jt=e.touchData.startPosition[1]-Ne[1],_t=jt*jt,Rt=Tt+_t,bt=Rt*je*je;e.touchData.singleTouchMoved||(pe||Z.$(":selected").unselect(["tapunselect"]),i(pe,["tap","vclick"],V,{x:Ne[0],y:Ne[1]}),Ce=!1,V.timeStamp-de<=Z.multiClickDebounceTime()?(_e&&clearTimeout(_e),Ce=!0,de=null,i(pe,["dbltap","vdblclick"],V,{x:Ne[0],y:Ne[1]})):(_e=setTimeout(function(){Ce||i(pe,["onetap","voneclick"],V,{x:Ne[0],y:Ne[1]})},Z.multiClickDebounceTime()),de=V.timeStamp)),pe!=null&&!e.dragData.didDrag&&pe._private.selectable&&bt"u"){var ie=[],Q=function(V){return{clientX:V.clientX,clientY:V.clientY,force:1,identifier:V.pointerId,pageX:V.pageX,pageY:V.pageY,radiusX:V.width/2,radiusY:V.height/2,screenX:V.screenX,screenY:V.screenY,target:V.target}},he=function(V){return{event:V,touch:Q(V)}},xe=function(V){ie.push(he(V))},ce=function(V){for(var pe=0;pe0)return G[0]}return null},m=Object.keys(d),g=0;g0?p:eNe(a,s,t,r,n,i,o,l)},checkPoint:function(t,r,n,i,a,s,o,l){l=l==="auto"?yg(i,a):l;var u=2*l;if(F0(t,r,this.points,s,o,i,a-u,[0,-1],n)||F0(t,r,this.points,s,o,i-u,a,[0,-1],n))return!0;var h=i/2+2*n,f=a/2+2*n,d=[s-h,o-f,s-h,o,s+h,o,s+h,o-f];return!!(rc(t,r,d)||fv(t,r,u,u,s+i/2-l,o+a/2-l,n)||fv(t,r,u,u,s-i/2+l,o+a/2-l,n))}}};$0.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",bl(3,0)),this.generateRoundPolygon("round-triangle",bl(3,0)),this.generatePolygon("rectangle",bl(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",bl(5,0)),this.generateRoundPolygon("round-pentagon",bl(5,0)),this.generatePolygon("hexagon",bl(6,0)),this.generateRoundPolygon("round-hexagon",bl(6,0)),this.generatePolygon("heptagon",bl(7,0)),this.generateRoundPolygon("round-heptagon",bl(7,0)),this.generatePolygon("octagon",bl(8,0)),this.generateRoundPolygon("round-octagon",bl(8,0));var n=new Array(20);{var i=zK(5,0),a=zK(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=t.deqFastCost*C)break}else if(u){if(x>=t.deqCost*p||x>=t.deqAvgCost*d)break}else if(w>=t.deqNoDrawCost*IK)break;var T=t.deq(n,y,g);if(T.length>0)for(var k=0;k0&&(t.onDeqd(n,m),!u&&t.shouldRedraw(n,m,y,g)&&a())},o=t.priority||uZ;i.beforeRender(s,o(n))}}}},UIt=(function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$L;wg(this,e),this.idsByKey=new P0,this.keyForId=new P0,this.cachesByLvl=new P0,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=r}return kg(e,[{key:"getIdsFor",value:function(r){r==null&&ca("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Y4,n.set(r,i)),i}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);this.deleteIdForKey(i,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteIdForKey(i,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);return i!==a}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,i=this.lvls,a=n.get(r);return a||(a=new P0,n.set(r,a),i.push(r)),a}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var i=this.getKey(r),a=this.getCache(i,n);return a!=null&&this.updateKeyMappingFor(r),a}},{key:"getForCachedKey",value:function(r,n){var i=this.keyForId.get(r.id()),a=this.getCache(i,n);return a}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var i=this.getKey(r);return this.hasCache(i,n)}},{key:"setCache",value:function(r,n,i){i.key=r,this.getCachesAt(n).set(r,i)}},{key:"set",value:function(r,n,i){var a=this.getKey(r);this.setCache(a,n,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var i=this.getKey(r);this.deleteCache(i,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(i){return n.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteKeyMappingFor(r);var a=this.doesEleInvalidateKey(r);return a&&this.invalidateKey(i),a||this.getNumberOfIdsForKey(i)===0}}])})(),gMe=25,TL=50,DL=-4,eZ=3,aDe=7.99,YIt=8,XIt=1024,jIt=1024,KIt=1024,ZIt=.2,QIt=.8,JIt=10,eMt=.15,tMt=.1,rMt=.9,nMt=.9,iMt=100,aMt=1,B4={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},sMt=yo({getKey:null,doesEleInvalidateKey:$L,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:YMe,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),bC=function(t,r){var n=this;n.renderer=t,n.onDequeues=[];var i=sMt(r);zr(n,i),n.lookup=new UIt(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},Cs=bC.prototype;Cs.reasons=B4;Cs.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]};Cs.getRetiredTextureQueue=function(e){var t=this,r=t.eleImgCaches.retired=t.eleImgCaches.retired||{},n=r[e]=r[e]||[];return n};Cs.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new zC(function(r,n){return n.reqs-r.reqs});return t};Cs.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};Cs.getElement=function(e,t,r,n,i){var a=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(n==null&&(n=Math.ceil(fZ(o*r))),n=aDe||n>eZ)return null;var u=Math.pow(2,n),h=t.h*u,f=t.w*u,d=s.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p=l.get(e,n);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var m;if(h<=gMe?m=gMe:h<=TL?m=TL:m=Math.ceil(h/TL)*TL,h>KIt||f>jIt)return null;var g=a.getTextureQueue(m),y=g[g.length-2],v=function(){return a.recycleTexture(m,f)||a.addTexture(m,f)};y||(y=g[g.length-1]),y||(y=v()),y.width-y.usedWidthn;O--)I=a.getElement(e,t,r,O,B4.downscale);L()}else return a.queueElement(e,k.level-1),k;else{var R;if(!w&&!C&&!T)for(var A=n-1;A>=DL;A--){var N=l.get(e,A);if(N){R=N;break}}if(x(R))return a.queueElement(e,n),R;y.context.translate(y.usedWidth,0),y.context.scale(u,u),this.drawElement(y.context,e,t,d,!1),y.context.scale(1/u,1/u),y.context.translate(-y.usedWidth,0)}return p={x:y.usedWidth,texture:y,level:n,scale:u,width:f,height:h,scaledLabelShown:d},y.usedWidth+=Math.ceil(f+YIt),y.eleCaches.push(p),l.set(e,n,p),a.checkTextureFullness(y),p};Cs.invalidateElements=function(e){for(var t=0;t=ZIt*e.width&&this.retireTexture(e)};Cs.checkTextureFullness=function(e){var t=this,r=t.getTextureQueue(e.height);e.usedWidth/e.width>QIt&&e.fullnessChecks>=JIt?gg(r,e):e.fullnessChecks++};Cs.retireTexture=function(e){var t=this,r=e.height,n=t.getTextureQueue(r),i=this.lookup;gg(n,e),e.retired=!0;for(var a=e.eleCaches,s=0;s=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,hZ(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),gg(i,s),n.push(s),s}};Cs.queueElement=function(e,t){var r=this,n=r.getElementQueue(),i=r.getElementKeyToQueue(),a=this.getKey(e),s=i[a];if(s)s.level=Math.max(s.level,t),s.eles.merge(e),s.reqs++,n.updateItem(s);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),i[a]=o}};Cs.dequeue=function(e){for(var t=this,r=t.getElementQueue(),n=t.getElementKeyToQueue(),i=[],a=t.lookup,s=0;s0;s++){var o=r.pop(),l=o.key,u=o.eles[0],h=a.hasCache(u,o.level);if(n[l]=null,h)continue;i.push(o);var f=t.getBoundingBox(u);t.getElement(u,f,e,o.level,B4.dequeue)}return i};Cs.removeFromQueue=function(e){var t=this,r=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(e),a=n[i];a!=null&&(a.eles.length===1?(a.reqs=cZ,r.updateItem(a),r.pop(),n[i]=null):a.eles.unmerge(e))};Cs.onDequeue=function(e){this.onDequeues.push(e)};Cs.offDequeue=function(e){gg(this.onDequeues,e)};Cs.setupDequeueing=iDe.setupDequeueing({deqRedrawThreshold:iMt,deqCost:eMt,deqAvgCost:tMt,deqNoDrawCost:rMt,deqFastCost:nMt,deq:function(t,r,n){return t.dequeue(r,n)},onDeqd:function(t,r){for(var n=0;n=lMt||r>YL)return null}n.validateLayersElesOrdering(r,e);var l=n.layersByLevel,u=Math.pow(2,r),h=l[r]=l[r]||[],f,d=n.levelIsComplete(r,e),p,m=function(){var L=function(M){if(n.validateLayersElesOrdering(M,e),n.levelIsComplete(M,e))return p=l[M],!0},O=function(M){if(!p)for(var D=r+M;kC<=D&&D<=YL&&!L(D);D+=M);};O(1),O(-1);for(var R=h.length-1;R>=0;R--){var A=h[R];A.invalid&&gg(h,A)}};if(!d)m();else return h;var g=function(){if(!f){f=kl();for(var L=0;LvMe||A>vMe)return null;var N=R*A;if(N>gMt)return null;var M=n.makeLayer(f,r);if(O!=null){var D=h.indexOf(O)+1;h.splice(D,0,M)}else(L.insert===void 0||L.insert)&&h.unshift(M);return M};if(n.skipping&&!o)return null;for(var v=null,x=e.length/oMt,w=!o,C=0;C=x||!JMe(v.bb,T.boundingBox()))&&(v=y({insert:!0,after:v}),!v))return null;p||w?n.queueLayer(v,T):n.drawEleInLayer(v,T,r,t),v.eles.push(T),S[r]=v}return p||(w?null:h)};vo.getEleLevelForLayerLevel=function(e,t){return e};vo.drawEleInLayer=function(e,t,r,n){var i=this,a=this.renderer,s=e.context,o=t.boundingBox();o.w===0||o.h===0||!t.visible()||(r=i.getEleLevelForLayerLevel(r,n),a.setImgSmoothing(s,!1),a.drawCachedElement(s,t,null,null,r,yMt),a.setImgSmoothing(s,!0))};vo.levelIsComplete=function(e,t){var r=this,n=r.layersByLevel[e];if(!n||n.length===0)return!1;for(var i=0,a=0;a0||s.invalid)return!1;i+=s.eles.length}return i===t.length};vo.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var n=0;n0){t=!0;break}}return t};vo.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=B0(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,i,a){t.invalidateLayer(n)}))};vo.invalidateLayer=function(e){if(this.lastInvalidationTime=B0(),!e.invalid){var t=e.level,r=e.eles,n=this.layersByLevel[t];gg(n,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=t._private.rscratch;if(!(a&&!t.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,h=a?t.pstyle("line-opacity").value:1,f=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,m=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,y=t.pstyle("line-outline-color").value,v=u*h,x=u*h,w=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;f==="straight-triangle"?(s.eleStrokeStyle(e,t,M),s.drawEdgeTrianglePath(t,e,o.allpts)):(e.lineWidth=p,e.lineCap=m,s.eleStrokeStyle(e,t,M),s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},C=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;if(e.lineWidth=p+g,e.lineCap=m,g>0)s.colorStrokeStyle(e,y[0],y[1],y[2],M);else{e.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(t,e,o.allpts):(s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},T=function(){i&&s.drawEdgeOverlay(e,t)},k=function(){i&&s.drawEdgeUnderlay(e,t)},S=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;s.drawArrowheads(e,t,M)},E=function(){s.drawElementText(e,t,null,n)};e.lineJoin="round";var I=t.pstyle("ghost").value==="yes";if(I){var L=t.pstyle("ghost-offset-x").pfValue,O=t.pstyle("ghost-offset-y").pfValue,R=t.pstyle("ghost-opacity").value,A=v*R;e.translate(L,O),w(A),S(A),e.translate(-L,-O)}else C();k(),w(),S(),T(),E(),r&&e.translate(l.x1,l.y1)}};lDe=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(r,n){if(n.visible()){var i=n.pstyle("".concat(t,"-opacity")).value;if(i!==0){var a=this,s=a.usePaths(),o=n._private.rscratch,l=n.pstyle("".concat(t,"-padding")).pfValue,u=2*l,h=n.pstyle("".concat(t,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",a.colorStrokeStyle(r,h[0],h[1],h[2],i),a.drawEdgePath(n,r,o.allpts,"solid")}}}};z0.drawEdgeOverlay=lDe("overlay");z0.drawEdgeUnderlay=lDe("underlay");z0.drawEdgePath=function(e,t,r,n){var i=e._private.rscratch,a=t,s,o=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,h=e.pstyle("line-dash-offset").pfValue;if(l){var f=r.join("$"),d=i.pathCacheKey&&i.pathCacheKey===f;d?(s=t=i.pathCache,o=!0):(s=t=new Path2D,i.pathCacheKey=f,i.pathCache=s)}if(a.setLineDash)switch(n){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=h;break;case"solid":a.setLineDash([]);break}if(!o&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(n==null){if(a&&!s.eleTextBiggerThanMin(t))return}else if(n===!1)return;if(t.isNode()){var o=t.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(t),u=t.pstyle("text-metrics").strValue==="glyph";e.textAlign=l,e.textBaseline=u?"alphabetic":"bottom"}else{var h=t.element()._private.rscratch.badLine,f=t.pstyle("label"),d=t.pstyle("source-label"),p=t.pstyle("target-label");if(h||(!f||!f.value)&&(!d||!d.value)&&(!p||!p.value))return;e.textAlign="center",e.textBaseline="bottom"}var m=!r,g;r&&(g=r,e.translate(-g.x1,-g.y1)),i==null?(s.drawText(e,t,null,m,a),t.isEdge()&&(s.drawText(e,t,"source",m,a),s.drawText(e,t,"target",m,a))):s.drawText(e,t,i,m,a),r&&e.translate(g.x1,g.y1)};xv.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!0,n=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,o=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*o,u=t.pstyle("color").value,h=t.pstyle("text-outline-color").value;e.font=n+" "+s+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],o),this.colorStrokeStyle(e,h[0],h[1],h[2],l)};xv.getTextAngle=function(e,t){var r,n=e._private,i=n.rscratch,a=t?t+"-":"",s=e.pstyle(a+"text-rotation");if(s.strValue==="autorotate"){var o=wl(i,"labelAngle",t);r=e.isEdge()?o:0}else s.strValue==="none"?r=0:r=s.pfValue;return r};xv.drawText=function(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private,s=a.rscratch,o=i?t.effectiveOpacity():1;if(!(i&&(o===0||t.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=wl(s,"labelX",r),u=wl(s,"labelY",r),h,f,d=this.getLabelText(t,r);if(d!=null&&d!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(e,t,i);var p=r?r+"-":"",m=wl(s,"labelWidth",r),g=wl(s,"labelHeight",r),y=wl(s,"labelActualDescent",r),v=t.pstyle(p+"text-margin-x").pfValue,x=t.pstyle(p+"text-margin-y").pfValue,w=t.isEdge(),C=t.pstyle("text-halign").value,T=t.pstyle("text-valign").value;w&&(C="center",T="center"),l+=v,u+=x;var k;n?k=this.getTextAngle(t,r):k=0,k!==0&&(h=l,f=u,e.translate(h,f),e.rotate(k),l=0,u=0);var S=H4(C),E=U4(T);switch(E){case"top":break;case"center":u+=g/2;break;case"bottom":u+=g;break}var I=t.pstyle("text-background-opacity").value,L=t.pstyle("text-border-opacity").value,O=t.pstyle("text-border-width").pfValue,R=t.pstyle("text-background-padding").pfValue,A=t.pstyle("text-background-shape").strValue,N=A==="round-rectangle"||A==="roundrectangle",M=A==="circle",D=2;if(I>0||O>0&&L>0){var B=e.fillStyle,P=e.strokeStyle,$=e.lineWidth,F=t.pstyle("text-background-color").value,q=t.pstyle("text-border-color").value,G=t.pstyle("text-border-style").value,z=I>0,H=O>0&&L>0,j=l-R;switch(S){case"left":j-=m;break;case"center":j-=m/2;break}var J=u-g-R,U=m+2*R,le=g+2*R;if(z&&(e.fillStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(I*o,")")),H&&(e.strokeStyle="rgba(".concat(q[0],",").concat(q[1],",").concat(q[2],",").concat(L*o,")"),e.lineWidth=O,e.setLineDash))switch(G){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=O/4,e.setLineDash([]);break;default:e.setLineDash([]);break}if(N?(e.beginPath(),kMe(e,j,J,U,le,D)):M?(e.beginPath(),_Mt(e,j,J,U,le)):(e.beginPath(),e.rect(j,J,U,le)),z&&e.fill(),H&&e.stroke(),H&&G==="double"){var ee=O/2;e.beginPath(),N?kMe(e,j+ee,J+ee,U-2*ee,le-2*ee,D):e.rect(j+ee,J+ee,U-2*ee,le-2*ee),e.stroke()}e.fillStyle=B,e.strokeStyle=P,e.lineWidth=$,e.setLineDash&&e.setLineDash([])}var ue=2*t.pstyle("text-outline-width").pfValue;if(ue>0&&(e.lineWidth=ue),u-=y,t.pstyle("text-wrap").value==="wrap"){var ae=wl(s,"labelWrapCachedLines",r),oe=wl(s,"labelLineHeight",r),Re=m/2,Te=this.getLabelJustification(t);switch(Te==="auto"||(S==="left"?Te==="left"?l+=-m:Te==="center"&&(l+=-Re):S==="center"?Te==="left"?l+=-Re:Te==="right"&&(l+=Re):S==="right"&&(Te==="center"?l+=Re:Te==="right"&&(l+=m))),E){case"top":u-=(ae.length-1)*oe;break;case"center":case"bottom":u-=(ae.length-1)*oe;break}for(var Oe=0;Oe0&&e.strokeText(ae[Oe],l,u),e.fillText(ae[Oe],l,u),u+=oe}else ue>0&&e.strokeText(d,l,u),e.fillText(d,l,u);k!==0&&(e.rotate(-k),e.translate(-h,-f))}}};Cg={};Cg.drawNode=function(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=t._private,h=u.rscratch,f=t.position();if(!(!Zt(f.x)||!Zt(f.y))&&!(a&&!t.visible())){var d=a?t.effectiveOpacity():1,p=s.usePaths(),m,g=!1,y=t.padding();o=t.width()+2*y,l=t.height()+2*y;var v;r&&(v=r,e.translate(-v.x1,-v.y1));for(var x=t.pstyle("background-image"),w=x.value,C=new Array(w.length),T=new Array(w.length),k=0,S=0;S0&&arguments[0]!==void 0?arguments[0]:A;s.eleFillStyle(e,t,V)},ee=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;s.colorStrokeStyle(e,N[0],N[1],N[2],V)},ue=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j;s.colorStrokeStyle(e,z[0],z[1],z[2],V)},ae=function(V,pe,K,ve){var Z=s.nodePathCache=s.nodePathCache||[],je=UMe(K==="polygon"?K+","+ve.join(","):K,""+pe,""+V,""+U),Ne=Z[je],ze,Fe=!1;return Ne!=null?(ze=Ne,Fe=!0,h.pathCache=ze):(ze=new Path2D,Z[je]=h.pathCache=ze),{path:ze,cacheHit:Fe}},oe=t.pstyle("shape").strValue,Re=t.pstyle("shape-polygon-points").pfValue;if(p){e.translate(f.x,f.y);var Te=ae(o,l,oe,Re);m=Te.path,g=Te.cacheHit}var Oe=function(){if(!g){var V=f;p&&(V={x:0,y:0}),s.nodeShapes[s.getNodeShape(t)].draw(m||e,V.x,V.y,o,l,U,h)}p?e.fill(m):e.fill()},qe=function(){for(var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,K=u.backgrounding,ve=0,Z=0;Z0&&arguments[0]!==void 0?arguments[0]:!1,pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasPie(t)&&(s.drawPie(e,t,pe),V&&(p||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,o,l,U,h)))},fe=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasStripe(t)&&(e.save(),p?e.clip(h.pathCache):(s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,o,l,U,h),e.clip()),s.drawStripe(e,t,pe),e.restore(),V&&(p||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,o,l,U,h)))},Ce=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,pe=(O>0?O:-O)*V,K=O>0?0:255;O!==0&&(s.colorFillStyle(e,K,K,K,pe),p?e.fill(m):e.fill())},_e=function(){if(R>0){if(e.lineWidth=R,e.lineCap=B,e.lineJoin=D,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash($),e.lineDashOffset=F;break;case"solid":case"double":e.setLineDash([]);break}if(P!=="center"){if(e.save(),e.lineWidth*=2,P==="inside")p?e.clip(m):e.clip();else{var V=new Path2D;V.rect(-o/2-R,-l/2-R,o+2*R,l+2*R),V.addPath(m),e.clip(V,"evenodd")}p?e.stroke(m):e.stroke(),e.restore()}else p?e.stroke(m):e.stroke();if(M==="double"){e.lineWidth=R/3;var pe=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(m):e.stroke(),e.globalCompositeOperation=pe}e.setLineDash&&e.setLineDash([])}},de=function(){if(G>0){if(e.lineWidth=G,e.lineCap="butt",e.setLineDash)switch(H){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var V=f;p&&(V={x:0,y:0});var pe=s.getNodeShape(t),K=R;P==="inside"&&(K=0),P==="outside"&&(K*=2);var ve=(o+K+(G+J))/o,Z=(l+K+(G+J))/l,je=o*ve,Ne=l*Z,ze=s.nodeShapes[pe].points,Fe;if(p){var Ke=ae(je,Ne,pe,ze);Fe=Ke.path}if(pe==="ellipse")s.drawEllipsePath(Fe||e,V.x,V.y,je,Ne);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(pe)){var Ve=0,tt=0,We=0;pe==="round-diamond"?Ve=(K+J+G)*1.4:pe==="round-heptagon"?(Ve=(K+J+G)*1.075,We=-(K/2+J+G)/35):pe==="round-hexagon"?Ve=(K+J+G)*1.12:pe==="round-pentagon"?(Ve=(K+J+G)*1.13,We=-(K/2+J+G)/15):pe==="round-tag"?(Ve=(K+J+G)*1.12,tt=(K/2+G+J)*.07):pe==="round-triangle"&&(Ve=(K+J+G)*(Math.PI/2),We=-(K+J/2+G)/Math.PI),Ve!==0&&(ve=(o+Ve)/o,je=o*ve,["round-hexagon","round-tag"].includes(pe)||(Z=(l+Ve)/l,Ne=l*Z)),U=U==="auto"?rNe(je,Ne):U;for(var rt=je/2,Se=Ne/2,Et=U+(K+G+J)/2,De=new Array(ze.length/2),mt=new Array(ze.length/2),Tt=0;Tt0){if(i=i||n.position(),a==null||s==null){var p=n.padding();a=n.width()+2*p,s=n.height()+2*p}o.colorFillStyle(r,h[0],h[1],h[2],u),o.nodeShapes[f].draw(r,i.x,i.y,a+l*2,s+l*2,d),r.fill()}}}};Cg.drawNodeOverlay=cDe("overlay");Cg.drawNodeUnderlay=cDe("underlay");Cg.hasPie=function(e){return e=e[0],e._private.hasPie};Cg.hasStripe=function(e){return e=e[0],e._private.hasStripe};Cg.drawPie=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),o=t.pstyle("pie-start-angle").pfValue,l=n.x,u=n.y,h=t.width(),f=t.height(),d=Math.min(h,f)/2,p,m=0,g=this.usePaths();if(g&&(l=0,u=0),a.units==="%"?d=d*a.pfValue:a.pfValue!==void 0&&(d=a.pfValue/2),s.units==="%"?p=d*s.pfValue:s.pfValue!==void 0&&(p=s.pfValue/2),!(p>=d))for(var y=1;y<=i.pieBackgroundN;y++){var v=t.pstyle("pie-"+y+"-background-size").value,x=t.pstyle("pie-"+y+"-background-color").value,w=t.pstyle("pie-"+y+"-background-opacity").value*r,C=v/100;C+m>1&&(C=1-m);var T=1.5*Math.PI+2*Math.PI*m;T+=o;var k=2*Math.PI*C,S=T+k;v===0||m>=1||m+C>1||(p===0?(e.beginPath(),e.moveTo(l,u),e.arc(l,u,d,T,S),e.closePath()):(e.beginPath(),e.arc(l,u,d,T,S),e.arc(l,u,p,S,T,!0),e.closePath()),this.colorFillStyle(e,x[0],x[1],x[2],w),e.fill(),m+=C)}};Cg.drawStripe=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=n.x,s=n.y,o=t.width(),l=t.height(),u=0,h=this.usePaths();e.save();var f=t.pstyle("stripe-direction").value,d=t.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":e.rotate(-Math.PI/2);break}var p=o,m=l;d.units==="%"?(p=p*d.pfValue,m=m*d.pfValue):d.pfValue!==void 0&&(p=d.pfValue,m=d.pfValue),h&&(a=0,s=0),s-=p/2,a-=m/2;for(var g=1;g<=i.stripeBackgroundN;g++){var y=t.pstyle("stripe-"+g+"-background-size").value,v=t.pstyle("stripe-"+g+"-background-color").value,x=t.pstyle("stripe-"+g+"-background-opacity").value*r,w=y/100;w+u>1&&(w=1-u),!(y===0||u>=1||u+w>1)&&(e.beginPath(),e.rect(a,s+m*u,p,m*w),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],x),e.fill(),u+=w)}e.restore()};Tl={},RMt=100;Tl.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),r=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/r};Tl.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],r=!0,n,i=0;it.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!f&&(h[t.NODE]=!0,h[t.SELECT_BOX]=!0);var x=r.style(),w=r.zoom(),C=s!==void 0?s:w,T=r.pan(),k={x:T.x,y:T.y},S={zoom:w,pan:{x:T.x,y:T.y}},E=t.prevViewport,I=E===void 0||S.zoom!==E.zoom||S.pan.x!==E.pan.x||S.pan.y!==E.pan.y;!I&&!(g&&!m)&&(t.motionBlurPxRatio=1),o&&(k=o),C*=l,k.x*=l,k.y*=l;var L=t.getCachedZSortedEles();function O(ee,ue,ae,oe,Re){var Te=ee.globalCompositeOperation;ee.globalCompositeOperation="destination-out",t.colorFillStyle(ee,255,255,255,t.motionBlurTransparency),ee.fillRect(ue,ae,oe,Re),ee.globalCompositeOperation=Te}function R(ee,ue){var ae,oe,Re,Te;!t.clearingMotionBlur&&(ee===u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||ee===u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(ae={x:T.x*p,y:T.y*p},oe=w*p,Re=t.canvasWidth*p,Te=t.canvasHeight*p):(ae=k,oe=C,Re=t.canvasWidth,Te=t.canvasHeight),ee.setTransform(1,0,0,1,0,0),ue==="motionBlur"?O(ee,0,0,Re,Te):!n&&(ue===void 0||ue)&&ee.clearRect(0,0,Re,Te),i||(ee.translate(ae.x,ae.y),ee.scale(oe,oe)),o&&ee.translate(o.x,o.y),s&&ee.scale(s,s)}if(f||(t.textureDrawLastFrame=!1),f){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=r.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var A=t.data.bufferContexts[t.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});var S=t.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:t.canvasWidth,height:t.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}h[t.DRAG]=!1,h[t.NODE]=!1;var N=u.contexts[t.NODE],M=t.textureCache.texture,S=t.textureCache.viewport;N.setTransform(1,0,0,1,0,0),d?O(N,0,0,S.width,S.height):N.clearRect(0,0,S.width,S.height);var D=x.core("outside-texture-bg-color").value,B=x.core("outside-texture-bg-opacity").value;t.colorFillStyle(N,D[0],D[1],D[2],B),N.fillRect(0,0,S.width,S.height);var w=r.zoom();R(N,!1),N.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/l,S.height/S.zoom/l),N.drawImage(M,S.mpan.x,S.mpan.y,S.width/S.zoom/l,S.height/S.zoom/l)}else t.textureOnViewport&&!n&&(t.textureCache=null);var P=r.extent(),$=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),F=t.hideEdgesOnViewport&&$,q=[];if(q[t.NODE]=!h[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,q[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),q[t.DRAG]=!h[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,q[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),h[t.NODE]||i||a||q[t.NODE]){var G=d&&!q[t.NODE]&&p!==1,N=n||(G?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),z=d&&!G?"motionBlur":void 0;R(N,z),F?t.drawCachedNodes(N,L.nondrag,l,P):t.drawLayeredElements(N,L.nondrag,l,P),t.debug&&t.drawDebugPoints(N,L.nondrag),!i&&!d&&(h[t.NODE]=!1)}if(!a&&(h[t.DRAG]||i||q[t.DRAG])){var G=d&&!q[t.DRAG]&&p!==1,N=n||(G?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]);R(N,d&&!G?"motionBlur":void 0),F?t.drawCachedNodes(N,L.drag,l,P):t.drawCachedElements(N,L.drag,l,P),t.debug&&t.drawDebugPoints(N,L.drag),!i&&!d&&(h[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,R),d&&p!==1){var H=u.contexts[t.NODE],j=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],J=u.contexts[t.DRAG],U=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],le=function(ue,ae,oe){ue.setTransform(1,0,0,1,0,0),oe||!v?ue.clearRect(0,0,t.canvasWidth,t.canvasHeight):O(ue,0,0,t.canvasWidth,t.canvasHeight);var Re=p;ue.drawImage(ae,0,0,t.canvasWidth*Re,t.canvasHeight*Re,0,0,t.canvasWidth,t.canvasHeight)};(h[t.NODE]||q[t.NODE])&&(le(H,j,q[t.NODE]),h[t.NODE]=!1),(h[t.DRAG]||q[t.DRAG])&&(le(J,U,q[t.DRAG]),h[t.DRAG]=!1)}t.prevViewport=S,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!f,t.mbFrames=0,h[t.NODE]=!0,h[t.DRAG]=!0,t.redraw()},RMt)),n||r.emit("render")};Tl.drawSelectionRectangle=function(e,t){var r=this,n=r.cy,i=r.data,a=n.style(),s=e.drawOnlyNodeLayer,o=e.drawAllLayers,l=i.canvasNeedsRedraw,u=e.forcedContext;if(r.showFps||!s&&l[r.SELECT_BOX]&&!o){var h=u||i.contexts[r.SELECT_BOX];if(t(h),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var f=r.cy.zoom(),d=a.core("selection-box-border-width").value/f;h.lineWidth=d,h.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",h.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),d>0&&(h.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",h.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var f=r.cy.zoom(),p=i.bgActivePosistion;h.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",h.beginPath(),h.arc(p.x,p.y,a.core("active-bg-size").pfValue/f,0,2*Math.PI),h.fill()}var m=r.lastRedrawTime;if(r.showFps&&m){m=Math.round(m);var g=Math.round(1e3/m),y="1 frame = "+m+" ms = "+g+" fps";if(h.setTransform(1,0,0,1,0,0),h.fillStyle="rgba(255, 0, 0, 0.75)",h.strokeStyle="rgba(255, 0, 0, 0.75)",h.font="30px Arial",!mC){var v=h.measureText(y);mC=v.actualBoundingBoxAscent}h.fillText(y,0,mC);var x=60;h.strokeRect(0,mC+10,250,20),h.fillRect(0,mC+10,250*Math.min(g/x,1),20)}o||(l[r.SELECT_BOX]=!1)}};CMe=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});WMt=(function(){function e(t,r,n,i){wg(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=r,this.texRows=n,this.texHeight=Math.floor(r/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,r,r),this.scratch=i(t,r,this.texHeight,"scratch")}return kg(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var n=r.w,i=r.h,a=this.texHeight,s=this.texSize,o=a/i,l=n*o,u=i*o;return l>s&&(o=s/n,l=n*o,u=i*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(r,n,i){var a=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,l=this.texHeight,u=this.getScale(n),h=u.scale,f=u.texW,d=u.texH,p=function(w,C){if(i&&C){var T=C.context,k=w.x,S=w.row,E=k,I=l*S;T.save(),T.translate(E,I),T.scale(h,h),i(T,n),T.restore()}},m=[null,null],g=function(){p(a.freePointer,a.canvas),m[0]={x:a.freePointer.x,y:a.freePointer.row*l,w:f,h:d},m[1]={x:a.freePointer.x+f,y:a.freePointer.row*l,w:0,h:d},a.freePointer.x+=f,a.freePointer.x==s&&(a.freePointer.x=0,a.freePointer.row++)},y=function(){var w=a.scratch,C=a.canvas;w.clear(),p({x:0,row:0},w);var T=s-a.freePointer.x,k=f-T,S=l;{var E=a.freePointer.x,I=a.freePointer.row*l,L=T;C.context.drawImage(w,0,0,L,S,E,I,L,S),m[0]={x:E,y:I,w:L,h:d}}{var O=T,R=(a.freePointer.row+1)*l,A=k;C&&C.context.drawImage(w,O,0,A,S,0,R,A,S),m[1]={x:0,y:R,w:A,h:d}}a.freePointer.x=k,a.freePointer.row++},v=function(){a.freePointer.x=0,a.freePointer.row++};if(this.freePointer.x+f<=s)g();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(v(),g()):this.enableWrapping?y():(v(),g())}return this.keyToLocation.set(r,m),this.needsBuffer=!0,m}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var n=this.texSize,i=this.texRows,a=this.getScale(r),s=a.texW;return this.freePointer.x+s>n?this.freePointer.row1&&arguments[1]!==void 0?arguments[1]:{},a=i.forceRedraw,s=a===void 0?!1:a,o=i.filterEle,l=o===void 0?function(){return!0}:o,u=i.filterType,h=u===void 0?function(){return!0}:u,f=!1,d=!1,p=nc(r),m;try{for(p.s();!(m=p.n()).done;){var g=m.value;if(l(g)){var y=nc(this.renderTypes.values()),v;try{var x=function(){var C=v.value,T=C.type;if(h(T)){var k=n.collections.get(C.collection),S=C.getKey(g),E=Array.isArray(S)?S:[S];if(s)E.forEach(function(R){return k.markKeyForGC(R)}),d=!0;else{var I=C.getID?C.getID(g):g.id(),L=n._key(T,I),O=n.typeAndIdToKey.get(L);O!==void 0&&!OMt(E,O)&&(f=!0,n.typeAndIdToKey.delete(L),O.forEach(function(R){return k.markKeyForGC(R)}))}}};for(y.s();!(v=y.n()).done;)x()}catch(w){y.e(w)}finally{y.f()}}}}catch(w){p.e(w)}finally{p.f()}return d&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var r=nc(this.collections.values()),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;i.gc()}}catch(a){r.e(a)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,n,i,a){var s=this.renderTypes.get(n),o=this.collections.get(s.collection),l=!1,u=o.draw(a,i,function(d){s.drawClipped?(d.save(),d.beginPath(),d.rect(0,0,i.w,i.h),d.clip(),s.drawElement(d,r,i,!0,!0),d.restore()):s.drawElement(d,r,i,!0,!0),l=!0});if(l){var h=s.getID?s.getID(r):r.id(),f=this._key(n,h);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(a):this.typeAndIdToKey.set(f,[a])}return u}},{key:"getAtlasInfo",value:function(r,n){var i=this,a=this.renderTypes.get(n),s=a.getKey(r),o=Array.isArray(s)?s:[s];return o.map(function(l){var u=a.getBoundingBox(r,l),h=i.getOrCreateAtlas(r,n,u,l),f=h.getOffsets(l),d=as(f,2),p=d[0],m=d[1];return{atlas:h,tex:p,tex1:p,tex2:m,bb:u}})}},{key:"getDebugInfo",value:function(){var r=[],n=nc(this.collections),i;try{for(n.s();!(i=n.n()).done;){var a=as(i.value,2),s=a[0],o=a[1],l=o.getCounts(),u=l.keyCount,h=l.atlasCount;r.push({type:s,keyCount:u,atlasCount:h})}}catch(f){n.e(f)}finally{n.f()}return r}}])})(),XMt=(function(){function e(t){wg(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return kg(e,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,n){return n})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var n=this.batchAtlases.indexOf(r);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),n=this.batchAtlases.length-1}return n}}])})(),jMt=` +Parent cluster`,i.height),t.setNode(i.id,C),t.parent(x)||(se.trace("Setting parent",x,i.id),t.setParent(x,i.id,C))}if(se.info("(Insert) Node XXX"+x+": "+JSON.stringify(t.node(x))),w?.clusterNode){se.info("Cluster identified XBX",x,w.width,t.node(x));let{ranksep:C,nodesep:T}=t.graph();w.graph.setGraph({...w.graph.graph(),ranksep:C+25,nodesep:T});let k=await l_e(f,w.graph,r,n,t.node(x),a),S=k.elem;gr(w,S),w.diff=k.diff||0,se.info("New compound node after recursive render XAX",x,"width",w.width,"height",w.height),bAe(S,w)}else t.children(x).length>0?(se.trace("Cluster - the non recursive path XBX",x,w.id,w,w.width,"Graph:",t),se.trace(ev(w.id,t)),un.set(w.id,{id:ev(w.id,t),node:w})):(se.trace("Node - the non recursive path XAX",x,f,t.node(x),s),await M0(f,t.node(x),{config:a,dir:s}))})),await b(async()=>{let x=t.edges().map(async function(w){let C=t.edge(w.v,w.w,w.name);if(se.info("Edge "+w.v+" -> "+w.w+": "+JSON.stringify(w)),se.info("Edge "+w.v+" -> "+w.w+": ",w," ",JSON.stringify(t.edge(w))),se.info("Fix",un,"ids:",w.v,w.w,"Translating: ",un.get(w.v),un.get(w.w)),d&&C.selfLoop){if(C.selfLoop.order!==1)return;let T=C.id;C.id=C.selfLoop.id,await Zy(h,C),C.id=T;return}await Zy(h,C)});await Promise.all(x)},"processEdges")(),se.info("Graph before layout:",JSON.stringify(bh(t))),se.info("############################################# XXX"),se.info("### Layout ### XXX"),se.info("############################################# XXX"),lC(t),se.info("Graph after layout:",JSON.stringify(bh(t)));let m=0,{subGraphTitleTotalMargin:g}=yh(a);await Promise.all(BAe(t).map(async function(x){let w=t.node(x);if(se.info("Position XBX => "+x+": ("+w.x,","+w.y,") width: ",w.width," height: ",w.height),w?.clusterNode)w.y+=g,se.info("A tainted cluster node XBX1",x,w.id,w.width,w.height,w.x,w.y,t.parent(x)),un.get(w.id).node=w,Ky(w);else if(t.children(x).length>0){se.info("A pure cluster node XBX1",x,w.id,w.x,w.y,w.width,w.height,t.parent(x)),w.height+=g,t.node(w.parentId);let C=w?.padding/2||0,T=w?.labelBBox?.height||0,k=T-C||0;se.debug("OffsetY",k,"labelHeight",T,"halfPadding",C),await Jm(l,w),un.get(w.id).node=w}else{let C=t.node(w.parentId);w.y+=g/2,se.info("A regular node XBX1 - using the padding",w.id,"parent",w.parentId,w.width,w.height,w.x,w.y,"offsetY",w.offsetY,"parent",C,C?.offsetY,w),Ky(w)}}));let y=g/2;return o_e(t,y,{mergeSelfLoops:d}).forEach(function({edge:x,start:w,end:C}){se.info("Edge "+w+" -> "+C+": "+JSON.stringify(x),x),x.points.forEach(E=>E.y+=y);let T=t.node(w),k=t.node(C),S=b4(u,x,un,r,T,k,n);BR(x,S)}),t.nodes().forEach(function(x){let w=t.node(x);se.info(x,w.type,w.diff),w.isGroup&&(m=w.diff)}),se.warn("Returning from recursive render XAX",o,m),{elem:o,diff:m}},"recursiveRender"),LAt=b(async(e,t)=>{let r=new qn({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),n=t.select("g");w4(n,e.markers,e.type,e.diagramId),DR(),PR(),MR(),$R(),e.nodes.forEach(a=>{r.setNode(a.id,{...a}),a.parentId&&r.setParent(a.id,a.parentId)}),se.debug("Edges:",e.edges),e.edges.forEach(a=>{if(a.start===a.end){let s=a.start,o=s+"---"+s+"---1",l=s+"---"+s+"---2",u=r.node(s);r.setNode(o,{domId:o,id:o,parentId:u.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(o,u.parentId),r.setNode(l,{domId:l,id:l,parentId:u.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(l,u.parentId);let h=structuredClone(a),f=structuredClone(a),d=structuredClone(a),p=structuredClone(a);f.originalEdge=h,f.selfLoop={id:h.id,order:0},d.originalEdge=h,d.selfLoop={id:h.id,order:1},p.originalEdge=h,p.selfLoop={id:h.id,order:2},f.label="",f.arrowTypeEnd="none",f.endLabelLeft="",f.endLabelRight="",f.startLabelLeft="",f.id=s+"-cyclic-special-1",d.startLabelRight="",d.startLabelLeft="",d.endLabelLeft="",d.endLabelRight="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.id=s+"-cyclic-special-mid",p.label="",p.startLabelRight="",p.startLabelLeft="",p.arrowTypeStart="none",u.isGroup&&(f.fromCluster=s,p.toCluster=s),p.id=s+"-cyclic-special-2",p.arrowTypeStart="none",r.setEdge(s,o,f,s+"-cyclic-special-0"),r.setEdge(o,l,d,s+"-cyclic-special-1"),r.setEdge(l,s,p,s+"-cyclic-special-2")}else r.setEdge(a.start,a.end,{...a},a.id)}),se.warn("Graph at first:",JSON.stringify(bh(r))),DAe(r),se.warn("Graph after XAX:",JSON.stringify(bh(r)));let i=Be();await l_e(n,r,e.type,e.diagramId,void 0,i)},"render")});var m_e={};Tr(m_e,{captureNodeSizes:()=>p_e,shouldCaptureSizes:()=>h_e});function oX(){if(!(typeof globalThis>"u"))return globalThis}function h_e(){return!!oX()?.mermaidCaptureSizes}function f_e(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}function d_e(e,t){let r=oX();if(!r)return;let n=t.node(),a=((n&&"ownerSVGElement"in n?n.ownerSVGElement:null)??n)?.id??"(unknown)";r.mermaidCapturedSizes??=[];let s={svgId:a,sizes:e};r.mermaidCapturedSizes.push(s),r.mermaidLastCapturedSizes=s}function p_e(e,t){let r=[];for(let n of t.nodes)n.isGroup||r.push({id:n.id,width:n.width??0,height:n.height??0});r.length!==0&&d_e({metadata:{captureVersion:IAt,capturedAt:new Date().toISOString(),capturedFrom:f_e()},nodes:r},e)}var IAt,g_e=W(()=>{hr();IAt=1;b(oX,"getCaptureGlobal");b(h_e,"shouldCaptureSizes");b(f_e,"capturedFromLocation");b(d_e,"emitCapturedSizes");b(p_e,"captureNodeSizes")});var iLe={};Tr(iLe,{render:()=>nLe});async function T_e(e,t){let r=new qn({multigraph:!0,compound:!0}),n=[...t.edges],i=Be(),a=e.insert("g").attr("class","root"),s=a.insert("g").attr("class","clusters"),o=a.insert("g").attr("class","edges edgePath"),l=a.insert("g").attr("class","edgeLabels"),u=a.insert("g").attr("class","nodes"),h=new Map,f=e.node()!=null;await Promise.all(t.nodes.map(async d=>{if(d.isGroup)r.setNode(d.id,{...d});else{if(f){let p=await M0(u,d,{config:i,dir:d.dir}),m=p.node()?.getBBox()??{width:0,height:0};h.set(d.id,p),d.width=m.width,d.height=m.height}r.setNode(d.id,{...d})}}));for(let d of n)r.setEdge(d.start,d.end,{...d},d.id),t.edges.some(m=>m.id===d.id)||t.edges.push(d);if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:d}=await Promise.resolve().then(()=>(g_e(),m_e));d(e,t)}return{graph:r,groups:{clusters:s,edgePaths:o,edgeLabels:l,nodes:u,rootGroups:a},nodeElements:h}}function QR(e){let t=[];for(let r=0;r=1-UR||d<=UR||d>=1-UR?null:{point:{x:e.x+f*i,y:e.y+f*a},tA:f,tB:d}}function fX(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}function S_e(e){let t=[];for(let r=0;r=Math.abs(r)?t>=0?1:0:r>=0?1:0}function A_e(e,t){if(e.length<2)return e.map(a=>({...a}));let r=e.map(a=>({...a})),n=t.arrowTypeStart&&ns[t.arrowTypeStart];if(n){let a=e[0],s=e[1],o=Math.atan2(s.y-a.y,s.x-a.x);r[0].x=a.x+n*Math.cos(o),r[0].y=a.y+n*Math.sin(o)}let i=t.arrowTypeEnd&&ns[t.arrowTypeEnd];if(i){let a=e.length,s=e[a-2],o=e[a-1],l=Math.atan2(o.y-s.y,o.x-s.x);r[a-1].x=o.x-i*Math.cos(l),r[a-1].y=o.y-i*Math.sin(l)}return r}function __e(e,t,r,n,i){let a=e.point.x,s=e.point.y,o={x:a-t*e.r,y:s-r*e.r},l={x:a+t*e.r,y:s+r*e.r},u=[`L${T4(o)}`];return i==="arc"?u.push(`A${kh(e.r)},${kh(e.r)} 0 0 ${n} ${T4(l)}`):u.push(`M${T4(l)}`),u}function dX(e,t,r,n){let i=t.x-e.x,a=t.y-e.y,s=r.x-t.x,o=r.y-t.y,l=Math.hypot(i,a),u=Math.hypot(s,o);if(l0){let w=dX(i[u-1],i[u],i[u+1]??i[u],y_e);w&&(g=w.cutLen)}let y=f,v=null;a&&uw.t-C.t);for(let w of x)w.r=Math.min(w.r,w.d-g,y-w.d);for(let w=0;wC){let T=C/2;x[w].r=Math.min(x[w].r,T),x[w+1].r=Math.min(x[w+1].r,T)}}for(let w of x)w.r=2?n:null}catch{return null}}function N_e(e,t,r){if(!r.enabled)return;let n=e.node();if(!n)return;let i=new Map;for(let u of t)i.set(u.id,u);let a=[],s=new Map;for(let u of t){let h=typeof CSS<"u"&&CSS.escape?CSS.escape(u.id):u.id,f=n.querySelector(`path[data-id="${h}"]`);if(!f)continue;s.set(u.id,f);let p=M_e(f.getAttribute("data-points"))??u.points;a.push({...u,points:p})}let o=S_e(a);if(o.length===0)return;let l=new Map;for(let u of o){let h=l.get(u.jumpEdgeId)??[];h.push(u),l.set(u.jumpEdgeId,h)}for(let u of a){let h=l.get(u.id);if(!h||h.length===0)continue;let d=i.get(u.id)?.curve;if(d!==void 0&&!I_e(d))continue;let p=s.get(u.id);if(!p)continue;if(d===void 0){let w=p.getAttribute("d")??"";if(!L_e(w))continue}let m=p.getAttribute("style")??"",g=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(m),y=g?Number.parseFloat(g[1]):null,v=g?Number.parseFloat(g[2]):null,x=R_e(u,h,r);if(p.setAttribute("d",x),y!==null&&v!==null&&typeof p.getTotalLength=="function"){let w=p.getTotalLength(),C=Math.max(0,w-y-v),T=`0 ${y} ${C} ${v}`,k=m.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${T};`).replace(/;\s*;+/g,";");p.setAttribute("style",k)}}}async function D_e(e,t){for(let i of e.nodes)i.isGroup?await Jm(t.clusters,i):Ky(i);let r=new Map;for(let i of e.nodes)i?.id&&r.set(i.id,i);for(let i of e.edges){let a=i.start?r.get(i.start)??{}:{},s=i.end?r.get(i.end)??{}:{},o=b4(t.edgePaths,{...i},{},e.type,a,s,e.diagramId);i.label&&await Zy(t.rootGroups,i),i.label&&O_e(i,o)}let n=e.config?.swimlane?.lineHops;if(n!==!1){let i=n==="gap"?"gap":"arc",a=e.edges.filter(s=>Array.isArray(s.points)&&s.points.length>=2).map(s=>({id:s.id,points:s.points,curve:s.curve,arrowTypeStart:s.arrowTypeStart,arrowTypeEnd:s.arrowTypeEnd}));N_e(t.edgePaths,a,{enabled:!0,jumpRadius:6,jumpStyle:i})}}function O_e(e,t){let r=t?.updatedPath??t?.originalPath,n=qt(),{subGraphTitleTotalMargin:i}=yh({flowchart:n.flowchart??{}});if(e.label){let a=x4.get(e.id),s=e.x,o=e.y;if(r){let l=pr.calcLabelPosition(r);se.debug("Moving label "+e.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),t&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(e?.startLabelLeft){let a=Aa.get(e.id).startLeft,s=e?.x,o=e?.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.startLabelRight){let a=Aa.get(e.id).startRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelLeft){let a=Aa.get(e.id).endLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelRight){let a=Aa.get(e.id).endRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}}function pX(e){return Math.max(e.padding??v_e,v_e)}function P_e(e){let{x:t,y:r,width:n,height:i}=e,a=e.swimlaneContentTop;if(typeof t!="number"||typeof r!="number"||typeof n!="number"||typeof i!="number"||typeof a!="number"||!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(a)||n<=0||i<=0){delete e.groupTitleRect;return}let s=r-i/2,o=Math.min(a,r+i/2),l=Math.min(NAt,Math.max(0,o-s)),u=s+l;if(u<=s){delete e.groupTitleRect;return}e.groupTitleRect={left:t-n/2,right:t+n/2,top:s,bottom:u}}function B_e(e){let t=e.direction,r=e.nodes??=[];for(let a of e.nodes??[])a.isGroup&&!a.parentId&&(a.shape="swimlane",t&&(a.direction=t));let n=r.filter(a=>!a.isGroup&&!a.parentId);if(n.length===0)return;let i=r.find(a=>a.id===lX);i?i.isGroup&&(i.shape="swimlane",t&&(i.direction=t)):(i={id:lX,label:"",isGroup:!0,shape:"swimlane",padding:20,...t?{direction:t}:{}},r.push(i));for(let a of n)a.parentId=lX}function F_e(e){let t=new Map;for(let l of e.nodes??[])t.set(l.id,l);let r=[];for(let l of e.edges??[]){let u=typeof l.start=="string"?l.start:void 0,h=typeof l.end=="string"?l.end:void 0;!u||!h||l.labelNodeId||r.push({id:l.id,src:u,dst:h,ref:l})}let n=e.nodes??[],i=n.filter(l=>l.isGroup),a=n.filter(l=>!l.isGroup);return{nodes:[...[...i].reverse(),...a].map(l=>l.id),edges:r,layout:e,nodeById:t}}function $_e(e,t,r,n){let{layout:i}=e,a=e.nodeById,s=n?.layerGap??100,o=n?.nodeGap??40,l=0;for(let d of t.layers){let p=0;for(let m of d){let g=a.get(m);if(!g){p++;continue}g.layer=l,g.order=p;let y=r.x[m]??p*o,v=r.y[m]??l*s;g.x=y,g.y=v,p++}l++}let u=i.nodes??[],h=new Map,f=[];for(let d of u){if(!d?.isGroup)continue;d.parentId||f.push(d);let p=u.filter(x=>x.parentId===d.id),m=1/0,g=-1/0,y=1/0,v=-1/0;for(let x of p){let w=x.x??r.x[x.id],C=x.y??r.y[x.id],T=x.width??0,k=x.height??0;w!=null&&C!=null&&(m=Math.min(m,w-T/2),g=Math.max(g,w+T/2),y=Math.min(y,C-k/2),v=Math.max(v,C+k/2))}if(m===1/0||y===1/0)d.x=d.x??0,d.y=d.y??0,d.width=d.width??0,d.height=d.height??0;else{let x=d.padding??20,w=d.parentId?x:2*pX(d),C=x,T=Math.max(0,g-m)+w,k=Math.max(0,v-y)+C,S=(m+g)/2,E=(y+v)/2;d.x=S,d.y=E,d.width=T,d.height=k,h.set(d.id,{minX:m,maxX:g,minY:y,maxY:v})}}if(f.length>0&&h.size>0){let d=1/0,p=-1/0,m=0;for(let g of f){let y=g.padding??20;y>m&&(m=y);let v=h.get(g.id);v&&(d=Math.min(d,v.minY),p=Math.max(p,v.maxY))}if(d!==1/0&&p!==-1/0){let g=Math.max(0,p-d),v=Math.max(m,36),x=g+2*v,w=(d+p)/2;for(let I of f)I.y=w,I.height=x,I.swimlaneContentTop=d;let C=[...f].sort((I,L)=>{let O=I.x??0,R=L.x??0;return O-R}),T=[],k=[],S=[];for(let I of C){let L=h.get(I.id);if(!L)continue;let O=Math.max(0,L.maxX-L.minX)+2*pX(I),R=(L.minX+L.maxX)/2;T.push(I.id),k.push(R),S.push(O)}let E=T.length;if(E>0){let I=new Map;if(E===1)I.set(T[0],S[0]);else{let L=[];for(let M=0;M0&&i>0?{cx:t,cy:r,rect:C4(t,r,n,i)}:void 0}function UX(e){if(e.isGroup)return;let t=HX(e);return t?{id:String(e.id??""),cx:t.cx,cy:t.cy,rect:t.rect}:void 0}function Lu(e,t,r=zs){return Math.abs(e.x-t.x)r}function Ra(e,t,r=zs){return Nn(e,t,r)&&Math.abs(e.y-t.y)>r}function bl(e,t,r,n){return Math.max(0,Math.min(Math.max(e,t),Math.max(r,n))-Math.max(Math.min(e,t),Math.min(r,n)))}function Hf(e,t,r=zs){return e.horizontal&&t.horizontal&&Pn(e.a,t.a,r)?bl(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&Nn(e.a,t.a,r)?bl(e.a.y,e.b.y,t.a.y,t.b.y):0}function S4(e,t=zs){let r=[];for(let n=0;n0?r[r.length-1]:void 0;(!i||!Lu(i,n,t))&&r.push({x:n.x,y:n.y})}return r}function YX(e,t=zs){if(!e||e.length!==4)return;let[r,n,i,a]=e;return _a(r,n,t)&&Ra(n,i,t)&&_a(i,a,t)?{kind:"HVH",p0:r,p1:n,p2:i,p3:a}:Ra(r,n,t)&&_a(n,i,t)&&Ra(i,a,t)?{kind:"VHV",p0:r,p1:n,p2:i,p3:a}:void 0}function lL(e,t,r,n=0){let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),s=Math.min(e.y,t.y),o=Math.max(e.y,t.y);return a>r.left-n&&ir.top-n&&st.left+r&&e.xt.top+r&&e.y=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function JR(e,t){return e.leftt.left&&e.topt.top}function mX(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function C4(e,t,r,n){return{left:e-r/2,right:e+r/2,top:t-n/2,bottom:t+n/2}}function rc(e){return HX(e)?.rect}function iv(e,t){switch(t){case"top":return{x:e.cx,y:e.rect.top};case"bottom":return{x:e.cx,y:e.rect.bottom};case"left":return{x:e.rect.left,y:e.cy};case"right":return{x:e.rect.right,y:e.cy}}}function jX(e,t,r,n,i,a=zs){let s=t==="left"||t==="right",o=n==="left"||n==="right";if(s&&o){if(t==="right"&&n==="left"&&e.xr.x){if(Pn(e,r,a))return[e,r];let f=(e.x+r.x)/2;return[e,{x:f,y:e.y},{x:f,y:r.y},r]}if(t===n){if(Pn(e,r,a))return;let f=t==="left"?Math.min(e.x,r.x)-i:Math.max(e.x,r.x)+i;return[e,{x:f,y:e.y},{x:f,y:r.y},r]}return}if(!s&&!o){if(t===n){if(Nn(e,r,a))return;let d=t==="top"?Math.min(e.y,r.y)-i:Math.max(e.y,r.y)+i;return[e,{x:e.x,y:d},{x:r.x,y:d},r]}if(!(t==="bottom"&&n==="top"&&e.yr.y))return;if(Nn(e,r,a))return[e,r];let f=(e.y+r.y)/2;return[e,{x:e.x,y:f},{x:r.x,y:f},r]}if(s&&!o){let h=t==="right"&&r.x>e.x||t==="left"&&r.xr.y;return h&&f?[e,{x:r.x,y:e.y},r]:void 0}let l=t==="bottom"&&r.y>e.y||t==="top"&&r.yr.x;return l&&u?[e,{x:e.x,y:r.y},r]:void 0}function KX(e,t,r,n){return t==="left"||t==="right"?[e,{x:n,y:e.y},{x:n,y:r.y},r]:[e,{x:e.x,y:n},{x:r.x,y:n},r]}function cL(e){let t=new Map,r=[];for(let n of e){if(n.isEdgeLabel)continue;let i=UX(n);i&&(t.set(i.id,i),r.push({id:i.id,rect:i.rect}))}return{nodeInfoById:t,realNodeRects:r}}function ag(e){let t=[],r=[];for(let n of e){let i=UX(n);if(!i)continue;let a={id:i.id,rect:i.rect};n.isEdgeLabel?r.push(a):t.push(a)}return{realNodeRects:t,labelNodeRects:r}}function q_e(e,{includeEdgeLabels:t=!0}={}){let r=[];for(let n of e){if(n.isGroup||!t&&n.isEdgeLabel)continue;let i=n.x??0,a=n.y??0,s=n.width??0,o=n.height??0;r.push({nodeId:n.id,...C4(i,a,s,o)})}return r}function ZX(e,t,r=zs){let n=e.start,i=e.end;if(!n||!i)return;let a=t.get(n),s=t.get(i);if(!(!a||!s))return{srcId:n,dstId:i,srcInfo:a,dstInfo:s,collinearX:Math.abs(a.cx-s.cx)m||dv)return!1;let x=Math.abs(g-h.a.x)i:a&&o&&Pn(e,r,i)?bl(e.x,t.x,r.x,n.x)>i:!1}function eL(e,t,r,n,{epsilon:i=zs,skipDegenerateOther:a=!1}={}){for(let s of r){if(s===n||s.isLayoutOnly)continue;let o=s.points;if(!(!o||o.length<2))for(let l=0;ld+i&&mg+i&&fn+zs&&e=2?t[t.length-2]:void 0,l=(s?Nn(s,i):!1)?{x:i.x,y:a.y}:{x:a.x,y:i.y};t.push(l)}t.push(a)}let r=[];for(let n of t){let i=r[r.length-1];(!i||!Lu(i,n))&&r.push(n)}return r}function Uf(e){if(e.length<3)return e;let t=[...e];for(let r=0;r<32;r++){let n=H_e(t);if(t=n.points,!n.changed)break}return t}function JX(e,t,r){let n=e;if(n.isLayoutOnly||!n.points||n.points.length=0&&i=e.length)return e;let a=i-n;if(a<0||a>=e.length)return e;let s=U_e(e[i],e[a],t);return r?[s,...e.slice(i)]:[...e.slice(0,i+1),s]}function Y_e(e,t){for(let r of e){let n=JX(r,t,2);if(!n)continue;let i=[...n.points];n.srcRect&&(i=yX(i,n.srcRect,!0)),n.dstRect&&(i=yX(i,n.dstRect,!1)),i=Uf(tL(i)),i=ej(i,n.srcRect,n.dstRect),n.edge.points=Uf(tL(i))}}function vX(e,t,r,n=!1){if(Pn(e,t,Xr)){if(t.yr.bottom+Xr)return t;if(n){if(e.xr.right+Xr)return{x:r.right,y:e.y}}return{x:Math.abs(t.x-r.left)<=Math.abs(t.x-r.right)?r.left:r.right,y:e.y}}if(Nn(e,t,Xr)){if(t.xr.right+Xr)return t;if(n){if(e.yr.bottom+Xr)return{x:e.x,y:r.bottom}}let i=Math.abs(t.y-r.top)<=Math.abs(t.y-r.bottom);return{x:e.x,y:i?r.top:r.bottom}}return t}function rL(e,t,r){let n=e[t];for(let i=t+r;i>=0&&in.lo)),r=Math.min(...e.map(n=>n.hi));if(!(t>r))return{lo:t,hi:r}}function bX(e,t){return t==="left"||t==="right"?nL(e.top,e.bottom):nL(e.left,e.right)}function iL(e,t,r){let n=e.y>=r.top-Xr&&e.y<=r.bottom+Xr,i=e.x>=r.left-Xr&&e.x<=r.right+Xr;if(Pn(e,t,Xr)&&n){if(Math.abs(e.x-r.left)0?X_e(a):void 0}function wX(e,t,r,n,i){let a=j_e(e,t,r,n,i);if(!a)return;let s=i?e.y:e.x,o=Math.min(a.hi,Math.max(a.lo,s));if(!(Math.abs(o-s)({...o}));for(let o=t;o>=0&&o=r.left-Xr&&Math.max(e.x,t.x)<=r.right+Xr,i=Math.min(e.y,t.y)>=r.top-Xr&&Math.max(e.y,t.y)<=r.bottom+Xr;if(Math.abs(e.y-r.top)n.bottom+Xr;case"left":return Pn(t,r,Xr)&&r.xn.right+Xr}}function SX(e,t,r){if(e.length<3)return e;if(r){let a=TX(e[0],e[1],t);return a&&CX(a,e[1],e[2],t)?e.slice(1):e}let n=e.length-1,i=TX(e[n-1],e[n],t);return i&&CX(i,e[n-1],e[n-2],t)?e.slice(0,n):e}function Q_e(e,t,r){let n=e;if(t){let a=rL(n,0,1);if(a){let s=vX(a,n[0],t);s!==n[0]&&(n=[s,...n.slice(1)])}n=SX(n,t,!0)}if(r){let a=n.length-1,s=rL(n,a,-1);if(s){let o=vX(s,n[a],r,!0);o!==n[a]&&(n=[...n.slice(0,a),o])}n=SX(n,r,!1)}let i=ej(n,t,r);return i!==n||n.length===2?i:(t&&(n=kX(n,t,!0)),r&&(n=kX(n,r,!1)),n)}function EX(e,t){for(let r of e){let n=JX(r,t,2);if(!n)continue;let i=Vn(n.points,Xr),a=Q_e(i,n.srcRect,n.dstRect);if(a.length<3){n.edge.points=a;continue}let s=[a[0],{...a[0]},...a.slice(1,-1),a[a.length-1],{...a[a.length-1]}];n.edge.points=s}}function tj(e){return new Map(e.map(t=>[t.id,t]))}function J_e(e,t){let r=e.parentId,n=null;for(;r;){let i=t.get(r);if(!i?.isGroup)break;n=i.id,r=i.parentId}return n}function AX(e,t){let r=0,n=e.parentId;for(;n;){let i=t.get(n);if(!i?.isGroup)break;r++,n=i.parentId}return r}function rj(e){let t=1/0,r=-1/0,n=1/0,i=-1/0;for(let a of e){let s=a.x,o=a.y;if(typeof s!="number"||typeof o!="number")continue;let l=a.width??0,u=a.height??0;t=Math.min(t,s-l/2),r=Math.max(r,s+l/2),n=Math.min(n,o-u/2),i=Math.max(i,o+u/2)}return t===1/0||n===1/0?null:{minX:t,maxX:r,minY:n,maxY:i}}function eRe(e,t){let r=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+r,e.height=Math.max(0,t.maxY-t.minY)+r}function tRe(e){let t=tj(e),r=e.filter(n=>n.isGroup&&n.parentId).sort((n,i)=>AX(i,t)-AX(n,t));for(let n of r){let i=e.filter(s=>s.parentId===n.id),a=rj(i);a&&eRe(n,a)}}function aL(e,t){let r=e.nodes??[],n=e.edges??[],i=r.filter(l=>!l.isGroup),a=1/0,s=-1/0;for(let l of i){let u=l[t];typeof u=="number"&&(a=Math.min(a,u),s=Math.max(s,u))}if(!Number.isFinite(a)||!Number.isFinite(s))return!1;let o=b(l=>a+s-l,"mirror");for(let l of r){let u=l[t];typeof u=="number"&&(l[t]=o(u));let h=l.groupTitleRect;h&&(l.groupTitleRect=t==="x"?{...h,left:o(h.right),right:o(h.left)}:{...h,top:o(h.bottom),bottom:o(h.top)})}for(let l of n)for(let u of l.points??[])u[t]=o(u[t]);return!0}function rRe(e){return(e.nodes??[]).some(r=>!r.isGroup)?aL(e,"y"):!0}function nRe(e,t="LR"){let r=e.nodes??[],n=e.edges??[],i=r.filter(A=>!A.isGroup),a=1/0,s=1/0;for(let A of i){let N=A.x??0,M=A.y??0;N0?Math.max(1,h/f):1;for(let A of i){let N=A.x??0,D=((A.y??0)-s)*d+o,B=N-a;A.x=D,A.y=B}for(let A of n)if(A.points)for(let N of A.points){let M=N.x,B=(N.y-s)*d+o,P=M-a;N.x=B,N.y=P}tRe(r);let p=r.filter(A=>A.isGroup&&!A.parentId);if(p.length===0)return t==="RL"&&aL(e,"x"),!0;let m=tj(r),g=new Map;for(let A of r){if(A.isGroup)continue;let N=J_e(A,m);if(!N)continue;let M=g.get(N)??[];M.push(A),g.set(N,M)}let y=0;for(let A of p){let N=A.padding??0;N>y&&(y=N)}let v=[],x=1/0,w=-1/0;for(let A of p){let N=g.get(A.id)??[],M=rj(N);M&&(x=Math.min(x,M.minX),w=Math.max(w,M.maxX),v.push({lane:A,contentTop:M.minY,contentBottom:M.maxY,centerY:(M.minY+M.maxY)/2}))}if(x===1/0||w===-1/0)return!0;let C=Math.max(0,w-x),T=Math.max(y,10),k=C+2*T,S=o+k,L=(x+w)/2-k/2-o,O=L+S/2,R=Math.max(y,o);v.sort((A,N)=>A.centerY-N.centerY);for(let A=0;Ad.cy?v.bottom:v.top,R=d.cx+x;if(R<=v.left+wh||R>=v.right-wh)continue;w={x:R,y:O},C={x:R,y:o.y},T={x:o.x,y:o.y}}else{let O=p.cx>d.cx?v.right:v.left,R=d.cy+x;if(R<=v.top+wh||R>=v.bottom-wh)continue;w={x:O,y:R},C={x:o.x,y:R},T={x:o.x,y:o.y}}let k=Lu(w,C,wh),S=Lu(C,T,wh);if(k&&S||!k&&qa(w,C,n,[h],1)||!S&&qa(C,T,n,[f],1))continue;let E=!k&&eL(w,C,e,i,{epsilon:wh,skipDegenerateOther:!0}),I=!S&&eL(C,T,e,i,{epsilon:wh,skipDegenerateOther:!0});if(!(E||I)){k?y=[C,T]:S?y=[w,C]:y=[w,C,T];break}}y&&(i.points=y)}}function aRe(e,t){let{realNodeRects:a,labelNodeRects:s}=ag(t.values());for(let o of e){if(o.isLayoutOnly)continue;let l=o.points;if(!l||l.length<4)continue;let u=Vn(l,.001);if(u.length<4)continue;let h=u.length-1,f=u[h],d=u[h-1],p=u[h-2],m=f.x-d.x,g=f.y-d.y,y=Math.hypot(m,g);if(y>=10||y<.001)continue;let v=d.x-p.x,x=d.y-p.y;if(Math.hypot(v,x)<.001)continue;let C=_a(d,f,.001),T=Ra(d,f,.001),k=_a(p,d,.001),S=Ra(p,d,.001);if(!(C&&S||T&&k))continue;let E=o.end,I=o.start,L=E?t.get(E):void 0;if(!L)continue;let O=L.x??0,R=L.y??0,A=rc(L);if(!A)continue;let N,M;if(S){let G=x<0;N={x:O,y:p.y},M={x:O,y:G?A.bottom:A.top}}else{let G=v>0;N={x:p.x,y:R},M={x:G?A.right:A.left,y:R}}if(qa(N,M,a,E?[E]:[],-2)||qa(N,M,s,[],-2))continue;if(I){let G=t.get(I),z=G?rc(G):void 0;if(z&&XX(N,z,2))continue}let D=b((G,z)=>`${G.x.toFixed(3)},${G.y.toFixed(3)}|${z.x.toFixed(3)},${z.y.toFixed(3)}`,"ownSegmentKey"),B=new Set;for(let G=0;G{for(let H of e){if(H===o||H.isLayoutOnly)continue;let j=H.points;if(!(!j||j.length<2))for(let J=0;J=0){let G=u[h-3],z=[I,E].filter(H=>!!H);if(qa(G,N,a,z,-2)||P(G,N))continue}let F=[...u.slice(0,h-2),N,M];o.points=F;let q=o.labelNodeId;if(q){let G=t.get(q);if(G){let z=G.width??0,H=G.height??0;if(z>0&&H>0){let j,J,U=-1;for(let le=0;le=z+2||Re&&ae>=H+2)&&ae>U&&(U=ae,j=(ee.x+ue.x)/2,J=(ee.y+ue.y)/2)}j!==void 0&&J!==void 0&&(G.x=j,G.y=J)}}}}}function sRe(e,t){let i=b((p,m)=>{let g=p.x??0,y=p.y??0,v=m.x-g,x=m.y-y,w=(p.width??0)/2,C=(p.height??0)/2;return Math.abs(x)*w>Math.abs(v)*C?(x<0&&(C=-C),{x:g+(x===0?0:C*v/x),y:y+C}):(v<0&&(w=-w),{x:g+w,y:y+(v===0?0:w*x/v)})},"rectIntersect"),a=b((p,m)=>{let g=Vn(p.points??[]);if(g.length<2)return;let y=m?p.start:p.end,v=y?t.get(y):void 0,x=v?rc(v):void 0;if(!v||!y||!x)return;let w=m?g[0]:g[g.length-1],C=m?g[1]:g[g.length-2],T=i(v,w),k=w;if(cX(C,T)&&(k=C),Nn(T,k,mr))return{edge:p,edgeId:String(p.id??""),nodeId:y,atStart:m,orientation:"V",coord:T.x,min:Math.min(T.y,k.y),max:Math.max(T.y,k.y),boundary:T,railEnd:k,rect:x};if(Pn(T,k,mr))return{edge:p,edgeId:String(p.id??""),nodeId:y,atStart:m,orientation:"H",coord:T.y,min:Math.min(T.x,k.x),max:Math.max(T.x,k.x),boundary:T,railEnd:k,rect:x}},"terminalLaneFor"),s=b((p,m)=>Math.max(0,Math.min(p.max,m.max)-Math.max(p.min,m.min)),"projectedOverlapLength"),o=b((p,m)=>p.nodeId!==m.nodeId||p.orientation!==m.orientation?!1:p.orientation==="H"?(Math.abs(p.boundary.x-p.rect.left)<1||Math.abs(p.boundary.x-p.rect.right)<1)&&Nn(p.boundary,m.boundary,1):(Math.abs(p.boundary.y-p.rect.top)<1||Math.abs(p.boundary.y-p.rect.bottom)<1)&&Pn(p.boundary,m.boundary,1),"sameTerminalFace"),l=b((p,m)=>p.nodeId!==m.nodeId||p.orientation!==m.orientation?!1:s(p,m)>=$s&&Math.abs(p.coord-m.coord)<.5,"exactTerminalLaneConflict"),u=b((p,m)=>{if(p.nodeId!==m.nodeId||p.orientation!==m.orientation||p.orientation!=="H"||p.atStart===m.atStart)return!1;let g=s(p,m);if(g<$s)return!1;let y=p.rect.bottom-p.rect.top;return g2*y?!1:o(p,m)&&Math.abs(p.coord-m.coord)<16},"nearTerminalLaneConflict"),h=b((p,m)=>{let g=Vn(p.edge.points??[]);if(g.length<2)return;let y=p.orientation==="V"?{x:p.boundary.x+m,y:p.boundary.y}:{x:p.boundary.x,y:p.boundary.y+m},v=p.orientation==="V"?{x:p.railEnd.x+m,y:p.railEnd.y}:{x:p.railEnd.x,y:p.railEnd.y+m};if(!b(()=>Math.abs(p.boundary.y-p.rect.top)<1||Math.abs(p.boundary.y-p.rect.bottom)<1?Pn(y,p.boundary,mr)&&y.x>=p.rect.left+1&&y.x<=p.rect.right-1:Math.abs(p.boundary.x-p.rect.left)<1||Math.abs(p.boundary.x-p.rect.right)<1?Nn(y,p.boundary,mr)&&y.y>=p.rect.top+1&&y.y<=p.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(p.atStart){let k=g.length>1&&Lu(g[1],p.railEnd,mr),S=g.slice(k?2:1),E=S[0];return E&&!cX(E,v)?void 0:[y,v,...S]}let w=g.length>1&&Lu(g[g.length-2],p.railEnd,mr),C=g.slice(0,w?-2:-1),T=C[C.length-1];if(!(T&&!cX(T,v)))return[...C,v,y]},"shiftedCandidate"),f=b(p=>{let m=p.edge,g=Vn(m.points??[]);if(g.length!==2)return!1;let y=m.start,v=m.end,x=y?t.get(y):void 0,w=v?t.get(v):void 0;if(!x||!w)return!1;let C=x.x??0,T=x.y??0,k=w.x??0,S=w.y??0,[E,I]=g;return Pn(E,I,mr)&&Math.abs(T-S)<1&&Math.abs(C-k)>1||Nn(E,I,mr)&&Math.abs(C-k)<1&&Math.abs(T-S)>1},"laneIsStraightCollinearConnector"),d=[-7,7,-14,14,-21,21];for(let p=0;p<8;p++){let m=e.filter(y=>!y.isLayoutOnly).flatMap(y=>[a(y,!0),a(y,!1)]).filter(y=>!!y),g=!1;for(let y=0;y{let E=f(k),I=f(S);return E!==I?Number(E)-Number(I):+!S.atStart-+!k.atStart});for(let k of T){for(let S of d){let E=h(k,S);if(!E)continue;let I=a({...k.edge,points:E},k.atStart);if(!(!I||m.some(L=>L.edge!==k.edge&&(l(I,L)||C&&u(I,L))))){k.edge.points=E,g=!0;break}}if(g)break}}if(!g)return}}function oRe(e,t){let{realNodeRects:i,labelNodeRects:a}=ag(t.values()),s=b((l,u)=>{let h=l.start,f=l.end,d=Cn(u);if(d.length!==u.length-1)return!1;let p=[h,f].filter(m=>!!m);for(let m of d)if(qa(m.a,m.b,i,p,-2)||qa(m.a,m.b,a,[],-2))return!1;for(let m of e){if(m===l||m.isLayoutOnly)continue;let g=m.points;if(!(!g||g.length<2)){for(let y of d)for(let v of Cn(Vn(g)))if(Hf(y,v,.5)>=$s||N0(y.a,y.b,v.a,v.b,mr))return!1}}return!0},"candidateIsSafe"),o=b((l,u)=>{if(u+4>=l.length)return;let h=l[u],f=l[u+1],d=l[u+2],p=l[u+3],m=l[u+4],g=_a(h,f)&&Ra(f,d)&&_a(d,p)&&Ra(p,m)&&Nn(h,p,mr)&&Nn(h,m,mr)&&Nn(f,d,mr)&&(f.x-h.x)*(p.x-d.x)<0,y=Ra(h,f)&&_a(f,d)&&Ra(d,p)&&_a(p,m)&&Pn(h,p,mr)&&Pn(h,m,mr)&&Pn(f,d,mr)&&(f.y-h.y)*(p.y-d.y)<0;if(g||y)return Vn([...l.slice(0,u+1),m,...l.slice(u+5)]);if(u+5>=l.length)return;let v=l[u+5],x=Ra(h,f)&&_a(f,d)&&Ra(d,p)&&_a(p,m)&&Ra(m,v)&&Nn(h,m,mr)&&Nn(h,v,mr)&&Nn(d,p,mr)&&(d.x-f.x)*(m.x-p.x)<0,w=_a(h,f)&&Ra(f,d)&&_a(d,p)&&Ra(p,m)&&_a(m,v)&&Pn(h,m,mr)&&Pn(h,v,mr)&&Pn(d,p,mr)&&(d.y-f.y)*(m.y-p.y)<0;if(!(!x&&!w))return Vn([...l.slice(0,u+1),v,...l.slice(u+6)])},"withoutDogleg");for(let l=0;l<8;l++){let u=!1;for(let h of e){if(h.isLayoutOnly)continue;let f=Vn(h.points??[]);for(let d=0;d<=f.length-5;d++){let p=o(f,d);if(!(!p||!s(h,p))){h.points=p,u=!0;break}}if(u)break}if(!u)return}}function _X(e,t){let{realNodeRects:a,labelNodeRects:s}=ag(t.values()),o=e.filter(m=>!m.isLayoutOnly),l=b((m,g,y)=>Vn(m===g?y??[]:m.points??[]),"pointsFor"),u=b((m,g)=>{let y=0;for(let v=0;v{let g=Cn(m);if(g.length!==3)return;let y=g[1];if(!(g[0].horizontal===y.horizontal||g[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),f=b((m,g)=>{let y=[m.start,m.end].filter(v=>!!v);return a.filter(v=>{if(y.includes(v.id))return!1;let x=v.rect;return g.horizontal?bl(g.a.x,g.b.x,x.left,x.right)>=$s&&g.a.y>=x.top-2&&g.a.y<=x.bottom+2:bl(g.a.y,g.b.y,x.top,x.bottom)>=$s&&g.a.x>=x.left-2&&g.a.x<=x.right+2})},"blockingRectsFor"),d=b((m,g,y)=>{let v=m.map(w=>({...w}));if(g.horizontal)v[g.index].y=y,v[g.index+1].y=y;else if(g.vertical)v[g.index].x=y,v[g.index+1].x=y;else return;let x=Uf(Vn(v));return Cn(x).length===x.length-1?x:void 0},"candidateByMovingRail"),p=b((m,g,y)=>{let v=[m.start,m.end].filter(w=>!!w),x=Cn(g);if(x.length!==g.length-1)return!1;for(let w of x)if(qa(w.a,w.b,a,v,-2)||qa(w.a,w.b,s,[],-2))return!1;for(let w of o)if(w!==m){for(let C of x)for(let T of Cn(l(w)))if(Hf(C,T,.5)>=$s)return!1}return u(m,g)<=y},"candidateIsSafe");for(let m=0;m<8;m++){let g=u(),y=!1;for(let v of o){let x=l(v),w=h(x);if(!w)continue;let C=f(v,w.segment);if(C.length===0)continue;let T=w.horizontal?[Math.min(...C.map(k=>k.rect.top))-20,Math.max(...C.map(k=>k.rect.bottom))+20]:[Math.min(...C.map(k=>k.rect.left))-20,Math.max(...C.map(k=>k.rect.right))+20];for(let k of T){let S=d(x,w.segment,k);if(!(!S||!p(v,S,g))){v.points=S,y=!0;break}}if(y)break}if(!y)return}}function RX(e,t){let n=b(l=>{let u=l.groupTitleRect;if(!(!u||typeof u.left!="number"||typeof u.right!="number"||typeof u.top!="number"||typeof u.bottom!="number"||!Number.isFinite(u.left)||!Number.isFinite(u.right)||!Number.isFinite(u.top)||!Number.isFinite(u.bottom)||u.right<=u.left||u.bottom<=u.top))return{left:u.left,right:u.right,top:u.top,bottom:u.bottom}},"validTitleRect"),i=b(l=>{if(!l.isGroup||l.parentId)return;let u=l.direction,h=typeof u=="string"?u.toUpperCase():"";if(h==="LR"||h==="RL"||h==="BT")return;let f=n(l),d=l.y,p=l.height;if(!f||typeof d!="number"||typeof p!="number"||!Number.isFinite(d)||!Number.isFinite(p)||p<=0)return;let m=f.right-f.left,g=f.bottom-f.top;if(!(g<=0||m{if(!l.horizontal)return!1;let h=l.a.y;return h<=u.top+mr||h>=u.bottom-mr?!1:bl(l.a.x,l.b.x,u.left,u.right)>=$s},"horizontalSegmentIntersectsTitle"),s=[...t.values()].map(i).filter(l=>!!l);if(s.length===0)return;let o=0;for(let l of e){if(l.isLayoutOnly)continue;let u=Vn(l.points??[]);for(let h of Cn(u))for(let f of s)a(h,f.rect)&&(o=Math.max(o,f.rect.bottom-h.a.y+4))}if(!(o<=mr))for(let l of s){let u=l.node.y,h=l.node.height;typeof u!="number"||typeof h!="number"||!Number.isFinite(u)||!Number.isFinite(h)||h<=0||(l.node.y=u-o/2,l.node.height=h+o,l.node.groupTitleRect={...l.rect,top:l.rect.top-o,bottom:l.rect.bottom-o})}}function LX(e,t){let n=b(u=>{let h=u.groupTitleRect;if(!(!h||typeof h.left!="number"||typeof h.right!="number"||typeof h.top!="number"||typeof h.bottom!="number"||!Number.isFinite(h.left)||!Number.isFinite(h.right)||!Number.isFinite(h.top)||!Number.isFinite(h.bottom)||h.right<=h.left||h.bottom<=h.top))return{left:h.left,right:h.right,top:h.top,bottom:h.bottom}},"validTitleRect"),i=b(u=>{if(!u.isGroup||u.parentId||u.direction!=="LR")return;let f=n(u),d=u.x,p=u.width;if(!f||typeof d!="number"||typeof p!="number"||!Number.isFinite(d)||!Number.isFinite(p)||p<=0)return;let m=f.right-f.left,g=f.bottom-f.top;if(!(m<=0||g{if(!u.vertical)return!1;let f=u.a.x;return f<=h.left+mr||f>=h.right-mr?!1:bl(u.a.y,u.b.y,h.top,h.bottom)>=$s},"verticalSegmentIntersectsTitle"),s=b((u,h)=>{if(!u.horizontal)return!1;let f=u.a.y;return f<=h.top+mr||f>=h.bottom-mr?!1:bl(u.a.x,u.b.x,h.left,h.right)>=$s},"horizontalSegmentIntersectsTitle"),o=[...t.values()].map(i).filter(u=>!!u);if(o.length===0)return;let l=0;for(let u of e){if(u.isLayoutOnly)continue;let h=Vn(u.points??[]);for(let f of Cn(h))for(let d of o)if(a(f,d.rect))l=Math.max(l,d.rect.right-f.a.x+4);else if(s(f,d.rect)){let p=Math.min(f.a.x,f.b.x);l=Math.max(l,d.rect.right-p+4)}}if(!(l<=mr))for(let u of o){let h=u.node.x,f=u.node.width;typeof h!="number"||typeof f!="number"||!Number.isFinite(h)||!Number.isFinite(f)||f<=0||(u.node.x=h-l/2,u.node.width=f+l,u.node.groupTitleRect={...u.rect,left:u.rect.left-l,right:u.rect.right-l})}}function lRe(e,t){let{realNodeRects:i}=ag(t.values()),a=e.filter(g=>!g.isLayoutOnly),s=b((g,y=new Map)=>Vn(y.get(g)??g.points??[]),"replacementPointsFor"),o=b((g=new Map)=>{let y=0;for(let v=0;va.reduce((y,v)=>y+Vc(s(v,g)),0),"totalBends"),u=b(g=>{let y=s(g);if(y.length<4)return;let v=y[y.length-2],x=y[y.length-1];if(!(!_a(v,x,mr)&&!Ra(v,x,mr)))return{tailStart:v,terminal:x}},"terminalTailFor"),h=b((g,y)=>{let v=s(g);if(v.length<3)return;let x=v[0],w=v[1],C;if(_a(x,w,mr))C={x:w.x,y:y.tailStart.y};else if(Ra(x,w,mr))C={x:y.tailStart.x,y:w.y};else return;let T=Uf(Vn([x,w,C,y.tailStart,y.terminal]));return Cn(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),f=b((g,y)=>{let v=[g.start,g.end].filter(x=>!!x);for(let x of Cn(y))if(qa(x.a,x.b,i,v,-2))return!0;return!1},"pathHasNodeHit"),d=b((g,y,v)=>{for(let x of a)if(x!==g){for(let w of Cn(y))for(let C of Cn(s(x,v)))if(Hf(w,C,.5)>=$s)return!0}return!1},"pathHasSharedTrack"),p=b((g,y,v)=>!f(g,y)&&!d(g,y,v),"candidateIsSafe"),m=b(()=>{let g=new Map;for(let y of a){let v=y.end;if(!v||!t.has(v)||s(y).length<4)continue;let w=g.get(v)??[];w.push(y),g.set(v,w)}return g},"edgesByDestination");for(let g=0;g<4;g++){let y=o();if(y===0)return;let v=l(),x,w=y,C=v;for(let T of m().values())for(let k=0;k=y||M>w||M===w&&D>=C||(x=N,w=M,C=D)}if(!x)return;for(let[T,k]of x)T.points=k}}function cRe(e,t){let{realNodeRects:s,labelNodeRects:o}=ag(t.values()),l=e.filter(T=>!T.isLayoutOnly),u=b((T,k=new Map)=>Vn(k.get(T)??T.points??[]),"replacementPointsFor"),h=b((T=new Map)=>{let k=0;for(let S=0;Sl.reduce((k,S)=>k+Vc(u(S,T)),0),"totalBends"),d=b(T=>{let k=T.start,S=T.end,E=k?t.get(k):void 0,I=S?t.get(S):void 0,L=E?rc(E):void 0,O=I?rc(I):void 0;return L&&O?{src:L,dst:O}:void 0},"endpointRectsFor"),p=b((T,k,S)=>{if(S.index<=0||S.index+1>=k.length-1)return;let E=d(T);if(E){if(S.vertical){let I=S.a.x,L=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),R=IO+mr?"right":void 0;return R?{edge:T,points:k,segmentIndex:S.index,axis:"vertical",side:R,coord:I,min:Math.min(S.a.y,S.b.y),max:Math.max(S.a.y,S.b.y)}:void 0}if(S.horizontal){let I=S.a.y,L=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),R=IO+mr?"bottom":void 0;return R?{edge:T,points:k,segmentIndex:S.index,axis:"horizontal",side:R,coord:I,min:Math.min(S.a.x,S.b.x),max:Math.max(S.a.x,S.b.x)}:void 0}}},"externalRailForSegment"),m=b(()=>{let T=[];for(let k of l){let S=u(k);for(let E of Cn(S)){let I=p(k,S,E);I&&T.push(I)}}return T},"collectExternalRails"),g=b((T,k)=>T.edge!==k.edge&&T.axis===k.axis&&T.side===k.side&&bl(T.min,T.max,k.min,k.max)>=$s,"railsInteract"),y=b(T=>{let k=[],S=new Set;for(let E of T){if(S.has(E))continue;let I=[E],L=[];for(S.add(E);I.length>0;){let O=I.pop();L.push(O);for(let R of T)!S.has(R)&&g(O,R)&&(S.add(R),I.push(R))}L.length>1&&k.push(L)}return k},"connectedComponents"),v=b(T=>{let k=[];for(let S of T)k.some(E=>Math.abs(E-S.coord){let k=T.map(I=>I.coord),S=v(T),E=[];if(T.length<=6){let I=new Array(S.length).fill(!1),L=[],O=b(()=>{if(L.length===T.length){L.some((R,A)=>Math.abs(R-k[A])>=mr)&&E.push([...L]);return}for(let[R,A]of S.entries())I[R]||(I[R]=!0,L.push(A),O(),L.pop(),I[R]=!1)},"visit");return O(),E}for(let I=0;I{let S=new Map;for(let[I,L]of T.entries()){let O=k[I],R=S.get(L.edge)??L.points.map(A=>({x:A.x,y:A.y}));L.axis==="vertical"?(R[L.segmentIndex].x=O,R[L.segmentIndex+1].x=O):(R[L.segmentIndex].y=O,R[L.segmentIndex+1].y=O),S.set(L.edge,R)}let E=new Map;for(let[I,L]of S){let O=Uf(Vn(L));if(Cn(O).length!==O.length-1)return;E.set(I,O)}return E},"replacementsForAssignment"),C=b(T=>{for(let[k,S]of T){let E=[k.start,k.end].filter(I=>!!I);for(let I of Cn(S))if(qa(I.a,I.b,s,E,-2)||qa(I.a,I.b,o,[],-2))return!1}for(let k=0;k=$s)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){let k=h();if(k===0)return;let S,E=k,I=f(),L=Number.POSITIVE_INFINITY;for(let O of y(m()))for(let R of x(O)){let A=w(O,R);if(!A||!C(A))continue;let N=h(A);if(N>=k)continue;let M=f(A),D=O.reduce((B,P,$)=>B+Math.abs(R[$]-P.coord),0);N>E||N===E&&(M>I||M===I&&D>=L)||(S=A,E=N,I=M,L=D)}if(!S)return;for(let[O,R]of S)O.points=R}}function uRe(e,t){let{realNodeRects:i,labelNodeRects:a}=ag(t.values()),s=e.filter(m=>!m.isLayoutOnly),o=b((m,g,y)=>Vn(m===g?y??[]:m.points??[]),"pointsFor"),l=b(m=>Cn(m).reduce((g,y)=>{let v=y.a.x-y.b.x,x=y.a.y-y.b.y;return g+Math.hypot(v,x)},0),"pathLength"),u=b((m,g)=>{let y=0;for(let v=0;v{if(m.horizontal){let y=m.a.y;return(Math.abs(y-g.top)<1||Math.abs(y-g.bottom)<1)&&bl(m.a.x,m.b.x,g.left,g.right)>=$s}if(m.vertical){let y=m.a.x;return(Math.abs(y-g.left)<1||Math.abs(y-g.right)<1)&&bl(m.a.y,m.b.y,g.top,g.bottom)>=$s}return!1},"segmentRunsAlongRectBorder"),f=b(m=>{let g=[m.start,m.end].filter(v=>!!v),y=[];for(let v of g){let x=t.get(v),w=x?rc(x):void 0;w&&y.push(w)}return y},"endpointRectsFor"),d=b((m,g)=>{if(g+3>=m.length)return[];let y=m[g],v=m[g+1],x=m[g+2],w=m[g+3],C=_a(y,v,mr)&&Ra(v,x,mr)&&_a(x,w,mr),T=Ra(y,v,mr)&&_a(v,x,mr)&&Ra(x,w,mr);if(!C&&!T)return[];if(!(C?Math.sign(v.x-y.x)!==Math.sign(w.x-x.x):Math.sign(v.y-y.y)!==Math.sign(w.y-x.y)))return[];let S=Nn(y,w,mr)||Pn(y,w,mr)?[]:[{x:y.x,y:w.y},{x:w.x,y:y.y}],E=S.length===0?[[...m.slice(0,g+1),...m.slice(g+3)]]:S.map(L=>[...m.slice(0,g+1),L,...m.slice(g+3)]),I=new Set;return E.map(L=>Uf(Vn(L))).filter(L=>{if(Cn(L).length!==L.length-1||!L.some(R=>Lu(R,w,mr)))return!1;let O=L.map(R=>`${R.x.toFixed(3)},${R.y.toFixed(3)}`).join("|");return I.has(O)?!1:(I.add(O),!0)})},"shortcutCandidatesAt"),p=b((m,g,y)=>{let v=[m.start,m.end].filter(w=>!!w),x=f(m);for(let w of Cn(g))if(qa(w.a,w.b,i,v,-2)||qa(w.a,w.b,a,[],-2)||x.some(C=>h(w,C)))return!1;for(let w of s)if(w!==m){for(let C of Cn(g))for(let T of Cn(o(w)))if(Hf(C,T,.5)>=$s)return!1}return u(m,g)<=y},"candidateIsSafe");for(let m=0;m<8;m++){let g=u(),y,v,x=g,w=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY;for(let T of s){let k=o(T),S=Vc(k,mr),E=l(k);for(let I=0;I<=k.length-4;I++)for(let L of d(k,I)){let O=Vc(L,mr),R=l(L);if(!(Ox||N===x&&(O>w||O===w&&R>=C)||(y=T,v=L,x=N,w=O,C=R)}}if(!y||!v)return;y.points=v}}function hRe(e,t){let s=[];for(let fe of t.values()){if(fe.isGroup||fe.isEdgeLabel)continue;let Ce=fe.x??0,_e=fe.y??0,de=rc(fe);de&&s.push({id:String(fe.id??""),cx:Ce,cy:_e,rect:de})}if(s.length===0)return;let o=new Map(s.map(fe=>[fe.id,fe])),l=s.map(fe=>({id:fe.id,rect:fe.rect})),u=["top","bottom","left","right"],h={top:Math.min(...s.map(fe=>fe.rect.top))-20,bottom:Math.max(...s.map(fe=>fe.rect.bottom))+20,left:Math.min(...s.map(fe=>fe.rect.left))-20,right:Math.max(...s.map(fe=>fe.rect.right))+20},f=e.filter(fe=>!fe.isLayoutOnly),d=new Map(f.map((fe,Ce)=>[fe,Ce])),p=b(fe=>{let Ce=fe==="left"||fe==="top"?-1:1,_e=[];for(let de=0;de<=2;de++)_e.push(h[fe]+Ce*20*de);return _e},"outwardTracksForSide"),m=b((fe,Ce=new Map)=>Vn(Ce.get(fe)??fe.points??[]),"replacementPointsFor"),g=b((fe,Ce)=>{let _e=0;for(let de of fe)for(let ie of Ce)N0(de.a,de.b,ie.a,ie.b,mr)&&_e++;return _e},"crossingCountBetweenSegments"),y=b((fe,Ce)=>g(Cn(fe),Cn(Ce)),"crossingCountBetweenPaths"),v=b((fe=new Map)=>{let Ce=0,_e=[],de=new Set,ie=[],Q=b(he=>{de.has(he)||(de.add(he),ie.push(he))},"addEdge");for(let he=0;he0&&(Ce+=ye,_e.push({first:xe,second:Ie,count:ye}),Q(xe),Q(Ie))}}return ie.sort((he,xe)=>(d.get(he)??0)-(d.get(xe)??0)),{count:Ce,pairs:_e,edgeSet:de,edges:ie}},"crossingSnapshot"),x=b((fe,Ce)=>{let _e=new Set(Ce.keys());if(_e.size===0)return fe.count;let de=0;for(let Q of fe.pairs)(_e.has(Q.first)||_e.has(Q.second))&&(de+=Q.count);let ie=0;for(let Q=0;Q{let Ce=new Map;for(let ie of fe.pairs){let Q=Ce.get(ie.first)??new Set;Q.add(ie.second),Ce.set(ie.first,Q);let he=Ce.get(ie.second)??new Set;he.add(ie.first),Ce.set(ie.second,he)}let _e=[],de=new Set;for(let ie of fe.edges){if(de.has(ie))continue;let Q=[ie],he=[];for(de.add(ie);Q.length>0;){let xe=Q.pop();he.push(xe);for(let ce of Ce.get(xe)??[])de.has(ce)||(de.add(ce),Q.push(ce))}he.sort((xe,ce)=>(d.get(xe)??0)-(d.get(ce)??0)),he.length>1&&_e.push(he)}return _e},"crossingComponents"),C=b(fe=>[fe.start,fe.end].filter(Ce=>!!Ce),"endpointIdsFor"),T=b(fe=>{let Ce=[];for(let _e of w(fe)){let de=new Set(_e),ie=new Set(_e.flatMap(he=>C(he))),Q=[..._e];for(let he of f)de.has(he)||C(he).some(xe=>ie.has(xe))&&Q.push(he);Q.sort((he,xe)=>(d.get(he)??0)-(d.get(xe)??0)),Ce.push(Q)}return Ce},"pairSearchGroups"),k=b((fe,Ce,_e)=>x(fe,new Map([[Ce,_e]])),"crossingCountWithSingleReplacement"),S=b(fe=>{let Ce=new Map;for(let _e of fe.pairs)Ce.set(_e.first,(Ce.get(_e.first)??0)+_e.count),Ce.set(_e.second,(Ce.get(_e.second)??0)+_e.count);return Ce},"currentCrossingsByEdge"),E=b(fe=>fe.slice(1).reduce((Ce,_e,de)=>{let ie=fe[de];return Ce+Math.abs(_e.x-ie.x)+Math.abs(_e.y-ie.y)},0),"pathLength"),I=b((fe=new Map)=>f.reduce((Ce,_e)=>Ce+Vc(m(_e,fe)),0),"totalBends"),L=b((fe=new Map)=>f.reduce((Ce,_e)=>Ce+E(m(_e,fe)),0),"totalLength"),O=b((fe,Ce,_e=new Map)=>{let de=Cn(Ce);for(let ie of f)if(ie!==fe){for(let Q of de)for(let he of Cn(m(ie,_e)))if(Hf(Q,he,.5)>=$s)return!0}return!1},"pathHasSegmentConflict"),R=b((fe,Ce)=>{let _e=[fe.start,fe.end].filter(de=>!!de);for(let de of Cn(Ce))if(qa(de.a,de.b,l,_e,-2))return!0;return!1},"pathHitsNode"),A=b((fe,Ce)=>{let _e=Uf(Vn(Ce));Cn(_e).length===_e.length-1&&fe.push(_e)},"pushOrthogonalCandidate"),N=b(fe=>fe==="left"||fe==="right","sideIsHorizontal"),M=b((fe,Ce,_e)=>{switch(Ce){case"left":return Math.min(fe.x,_e.x)-20;case"right":return Math.max(fe.x,_e.x)+20;case"top":return Math.min(fe.y,_e.y)-20;case"bottom":return Math.max(fe.y,_e.y)+20}},"localTrackForSameSide"),D=b((fe,Ce,_e,de)=>{let ie=_e==="left"||_e==="top"?-1:1,Q=[M(Ce,_e,de),h[_e]];for(let he of Q)for(let xe=0;xe<=2;xe++)A(fe,KX(Ce,_e,de,he+ie*20*xe))},"addSameSideCandidates"),B=b((fe,Ce,_e,de,ie)=>{for(let Q of p(_e))for(let he of p(ie))A(fe,[Ce,{x:Q,y:Ce.y},{x:Q,y:he},{x:de.x,y:he},de])},"addHorizontalToVerticalCandidates"),P=b((fe,Ce,_e,de,ie)=>{for(let Q of p(_e))for(let he of p(ie))A(fe,[Ce,{x:Ce.x,y:Q},{x:he,y:Q},{x:he,y:de.y},de])},"addVerticalToHorizontalCandidates"),$=b((fe,Ce,_e,de,ie)=>{let Q=[...p("top"),...p("bottom")];for(let he of p(_e))for(let xe of p(ie))for(let ce of Q)A(fe,[Ce,{x:he,y:Ce.y},{x:he,y:ce},{x:xe,y:ce},{x:xe,y:de.y},de])},"addHorizontalPairCandidates"),F=b((fe,Ce,_e,de,ie)=>{let Q=[...p("left"),...p("right")];for(let he of p(_e))for(let xe of p(ie))for(let ce of Q)A(fe,[Ce,{x:Ce.x,y:he},{x:ce,y:he},{x:ce,y:xe},{x:de.x,y:xe},de])},"addVerticalPairCandidates"),q=b(fe=>{let Ce=new Set;return fe.map(_e=>Vn(_e)).filter(_e=>{let de=_e.map(ie=>`${ie.x.toFixed(3)},${ie.y.toFixed(3)}`).join("|");return Ce.has(de)||_e.length<2?!1:(Ce.add(de),!0)})},"dedupeCandidatePaths"),G=b((fe,Ce,_e,de)=>{let ie=[],Q=jX(fe,Ce,_e,de,20,mr);Q&&A(ie,Q),Ce===de&&D(ie,fe,Ce,_e);let he=N(Ce),xe=N(de);return he&&!xe?B(ie,fe,Ce,_e,de):!he&&xe?P(ie,fe,Ce,_e,de):he?$(ie,fe,Ce,_e,de):F(ie,fe,Ce,_e,de),q(ie)},"buildCandidatesForSides"),z=b((fe,Ce,_e,de)=>{let ie=[...p("left"),...p("right")],Q=[...p("top"),...p("bottom")];for(let he of u){let xe=iv(de,he),ce=he==="top"||he==="bottom"?p(he):Q;for(let ge of ie){A(fe,[Ce,_e,{x:ge,y:_e.y},{x:ge,y:xe.y},xe]);for(let Ie of ce)A(fe,[Ce,_e,{x:ge,y:_e.y},{x:ge,y:Ie},{x:xe.x,y:Ie},xe])}}},"addVerticalDepartureOuterTrackCandidates"),H=b((fe,Ce,_e,de)=>{let ie=[...p("left"),...p("right")],Q=[...p("top"),...p("bottom")];for(let he of u){let xe=iv(de,he),ce=he==="left"||he==="right"?p(he):ie;for(let ge of Q){A(fe,[Ce,_e,{x:_e.x,y:ge},{x:xe.x,y:ge},xe]);for(let Ie of ce)A(fe,[Ce,_e,{x:_e.x,y:ge},{x:Ie,y:ge},{x:Ie,y:xe.y},xe])}}},"addHorizontalDepartureOuterTrackCandidates"),j=b(fe=>{let Ce=fe.start,_e=fe.end,de=_e?o.get(_e):void 0;if(!Ce||!de)return[];let ie=Vn(fe.points??[]);if(ie.length<4)return[];let Q=ie[0],he=ie[1],xe=[];return Ra(Q,he,mr)?z(xe,Q,he,de):_a(Q,he,mr)&&H(xe,Q,he,de),xe},"terminalPreservingOuterTrackCandidates"),J=b(fe=>{let Ce=fe.start,_e=fe.end,de=Ce?o.get(Ce):void 0,ie=_e?o.get(_e):void 0;if(!de||!ie)return[];let Q=[];for(let he of u){let xe=iv(de,he);for(let ce of u)Q.push(...G(xe,he,iv(ie,ce),ce))}return Q.push(...j(fe)),Q},"candidatePathsFor"),U=b(()=>new Map(f.map(fe=>[fe,Cn(m(fe))])),"currentSegmentsByEdge"),le=b((fe,Ce,_e)=>{let de=new Set;for(let ie of f){if(ie===fe)continue;let Q=_e.get(ie)??Cn(m(ie));Ce.some(he=>Q.some(xe=>Hf(he,xe,.5)>=$s))&&de.add(ie)}return de},"sharedTrackConflictsFor"),ee=b((fe,Ce,_e,de)=>{let ie=new Set;return J(fe).map(he=>Uf(Vn(he))).filter(he=>{if(R(fe,he))return!1;let xe=he.map(ce=>`${ce.x.toFixed(3)},${ce.y.toFixed(3)}`).join("|");return ie.has(xe)||he.length<2?!1:(ie.add(xe),!0)}).map(he=>{let xe=Cn(he),ce=0;for(let ge of f)ge!==fe&&(ce+=g(xe,_e.get(ge)??Cn(m(ge))));return{candidate:he,candidateSegments:xe,crossings:Ce.count-(de.get(fe)??0)+ce,bends:Vc(he,mr),totalBends:Vc(he),length:E(he)}}).filter(({crossings:he})=>he<=Ce.count).sort((he,xe)=>he.crossings-xe.crossings||he.bends-xe.bends||he.length-xe.length).slice(0,48).map(he=>({path:he.candidate,segments:he.candidateSegments,sharedTrackConflicts:le(fe,he.candidateSegments,_e),totalBends:he.totalBends,length:he.length}))},"pairCandidatesFor"),ue=b((fe,Ce,_e,de,ie,Q)=>{let he=0;for(let ce of fe.pairs)(ce.first===Ce||ce.second===Ce||ce.first===de||ce.second===de)&&(he+=ce.count);let xe=g(_e.segments,ie.segments);for(let ce of f){if(ce===Ce||ce===de)continue;let ge=Q.get(ce)??Cn(m(ce));xe+=g(_e.segments,ge)+g(ie.segments,ge)}return fe.count-he+xe},"pairCrossingCount"),ae=b((fe,Ce)=>{for(let _e of fe.sharedTrackConflicts)if(_e!==Ce)return!1;return!0},"conflictsOnlyWith"),oe=b((fe,Ce)=>fe.segments.some(_e=>Ce.segments.some(de=>Hf(_e,de,.5)>=$s)),"candidatesShareTrack"),Re=b((fe,Ce,_e,de)=>ae(Ce,_e.edge)&&ae(de,fe.edge)&&!oe(Ce,de),"pairCandidatesAreCompatible"),Te=b((fe,Ce,_e,de,ie)=>{let Q=ue(fe.current,Ce.edge,_e,de.edge,ie,fe.baseSegments);if(!(Q>=fe.current.count))return{replacements:new Map([[Ce.edge,_e.path],[de.edge,ie.path]]),crossings:Q,bends:fe.currentBends-(fe.baseBendsByEdge.get(Ce.edge)??0)-(fe.baseBendsByEdge.get(de.edge)??0)+_e.totalBends+ie.totalBends,length:fe.currentLength-(fe.baseLengthByEdge.get(Ce.edge)??0)-(fe.baseLengthByEdge.get(de.edge)??0)+_e.length+ie.length}},"scorePairReplacement"),Oe=b((fe,Ce)=>fe.crossings{let ie=de;for(let Q of Ce.candidates)for(let he of _e.candidates){if(!Re(Ce,Q,_e,he))continue;let xe=Te(fe,Ce,Q,_e,he);xe&&Oe(xe,ie)&&(ie=xe)}return ie},"bestScoreForOptionPair"),Ge=b(fe=>{let Ce=I(),_e=L(),de=U(),ie=S(fe),Q=new Map(f.map(ye=>[ye,Vc(m(ye))])),he=new Map(f.map(ye=>[ye,E(m(ye))])),xe=new Map,ce=T(fe);for(let ye of ce)for(let ne of ye){if(xe.has(ne))continue;let V=ee(ne,fe,de,ie);V.length>0&&xe.set(ne,{edge:ne,candidates:V})}let ge={replacements:new Map,crossings:fe.count,bends:Ce,length:_e},Ie={current:fe,currentBends:Ce,currentLength:_e,baseBendsByEdge:Q,baseLengthByEdge:he,baseSegments:de};for(let ye of ce){let ne=new Set(ye.filter(pe=>fe.edgeSet.has(pe))),V=ye.map(pe=>xe.get(pe)).filter(pe=>!!pe);for(let pe=0;pe0?ge.replacements:void 0},"bestPairedReplacement");for(let fe=0;fe<4;fe++){let Ce=v(),_e=Ce.count;if(_e===0)return;let de,ie,Q=_e,he=Number.POSITIVE_INFINITY;for(let ce of Ce.edges){let ge=Vc(m(ce),mr);for(let Ie of J(ce)){let ye=R(ce,Ie),ne=!ye&&O(ce,Ie),V=k(Ce,ce,Ie),pe=Vc(Ie,mr);ye||ne||!(V<_e||V===_e&&peQ||V===Q&&pe>=he||(de=ce,ie=Ie,Q=V,he=pe)}}if(de&&ie){de.points=ie;continue}let xe=Ge(Ce);if(!xe)return;for(let[ce,ge]of xe)ce.points=ge}}function fRe(e,t){let{nodeInfoById:r,realNodeRects:n}=cL(t),i=["top","bottom","left","right"],a=20,s={top:Math.min(...n.map(g=>g.rect.top))-a,bottom:Math.max(...n.map(g=>g.rect.bottom))+a,left:Math.min(...n.map(g=>g.rect.left))-a,right:Math.max(...n.map(g=>g.rect.right))+a},o=b((g,y,v,x)=>{let w=[],C=jX(g,y,v,x,a,ig);return C&&w.push(C),y===x&&w.push(KX(g,y,v,s[y])),w},"buildOrthogonalPathCandidates"),l=b((g,y)=>{for(let v=0;v{let x=0,w=S4(g,ig),C=y.start,T=y.end;for(let k of e){if(k===y||k.isLayoutOnly)continue;let S=k.start,E=k.end;if(!v&&C&&T&&(S===C||S===T||E===C||E===T))continue;let I=k.points;if(!(!I||I.length<2))for(let L of w)for(let O of S4(I,ig)){if(QX(L.a,L.b,O.a,O.b,ig,ig)){x++;continue}Hf(L,O,ig)>=FAt&&x++}}return x},"pathConflictCount"),h=4,f=b((g,y)=>{let v=Math.abs(g.y-y.rect.top),x=Math.abs(g.y-y.rect.bottom),w=Math.abs(g.x-y.rect.left),C=Math.abs(g.x-y.rect.right),T="top",k=v;return x{let x=d.get(g)??[];x.push({side:y,edgeId:v}),d.set(g,x)},"addFaceClaim");for(let g of e){if(g.isLayoutOnly)continue;let y=g.points??[];if(y.length<1)continue;let v=g.id??"",x=g.start,w=g.end;if(x){let C=r.get(x);C&&p(x,f(y[0],C),v)}if(w){let C=r.get(w);C&&p(w,f(y[y.length-1],C),v)}}let m=b((g,y,v)=>d.get(g)?.some(x=>x.edgeId!==v&&x.side===y)??!1,"faceIsClaimed");for(let g of e){if(g.isLayoutOnly)continue;let y=g.points;if(!y||y.length<2)continue;let v=Vc(y,ig);if(v0){let P=u(D,g,!0);if(P>L||P===L&&B>=O)continue;L=P,O=B,I=D;continue}u(D,g)>E||BN.edgeId!==k));let A=d.get(w);A&&d.set(w,A.filter(N=>N.edgeId!==k)),p(x,f(I[0],C),k),p(w,f(I[I.length-1],T),k)}}}function IX(e,t){let r=t?0:e.length-1,n=t?1:-1,i=e[r],a=e[r+n];if(!i||!a)return;let s=a.x-i.x,o=a.y-i.y;if(!(Math.abs(s)+Math.abs(o)a&&JR(e,dRe(a)))}function KR(e,t){let r=[];for(let m of e){if(m.isLayoutOnly)continue;let g=m.points;if(!(!g||g.length<2))for(let y=0;y{let y=mX(g,a);for(let{nodeId:v,rect:x}of n)if(v!==m&&JR(y,x))return!0;return!1},"labelOverlapsForeignNode"),u=b((m,g)=>{let y=mX(g,a);for(let v of r)if(v.edgeId!==m&&lL(v.p1,v.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),h=b((m,g,y)=>l(m,y)||u(g,y),"labelOverlapsAnything"),f=[],d=b(m=>{for(let{id:g,rect:y}of i)if(G_e(y,m))return g},"findContainingLane"),p=b((m,g)=>f.some(y=>y.labelId!==m&&JR(g,y.rect)),"overlapsPlacedLabel");for(let m of e){if(m.isLayoutOnly)continue;let g=m.labelNodeId;if(!g)continue;let y=t.get(g);if(!y)continue;let v=m.points;if(!v||v.length<2)continue;let x=y.width??0,w=y.height??0;if(x<=0||w<=0)continue;let C=[];for(let q=0;q=tc&&j>=tc||C.push({idx:q,length:H+j,orientation:H>=tc?"horizontal":"vertical",midX:(G.x+z.x)/2,midY:(G.y+z.y)/2})}if(C.length===0)continue;let T=C.length>=3?C.filter(q=>q.idx>0&&q.idx0?T:C,S=x>=w?"horizontal":"vertical",E=b(q=>[...q].sort((G,z)=>{let H=G.orientation===S,j=z.orientation===S;if(H!==j)return H?-1:1;let J=G.length>=(G.orientation==="horizontal"?x:w)+2,U=z.length>=(z.orientation==="horizontal"?x:w)+2;return J!==U?J?-1:1:z.length-G.length}),"rankSegments"),I=C[0],L=C[C.length-1],O=[.5,.25,.75,.05,.95,.15,.85,.1,.9],R=b((q,G)=>{let z=v[q.idx],H=v[q.idx+1];return{midX:z.x+(H.x-z.x)*G,midY:z.y+(H.y-z.y)*G}},"anchorAtT"),A=b((q,G,z)=>Math.min(z,Math.max(G,q)),"clamp"),N=b((q,G)=>q.midX>=G.left-tc&&q.midX<=G.right+tc&&q.midY>=G.top-tc&&q.midY<=G.bottom+tc,"pointInsideRectInclusive"),M=b(q=>{let G=C4(q.midX,q.midY,x,w),z=d(G);if(z)return{laneId:z,anchor:q,rect:G};let H=i.find(({rect:ae})=>N(q,ae));if(!H)return;let j=H.rect.left+x/2+s,J=H.rect.right-x/2-s,U=H.rect.top+w/2+s,le=H.rect.bottom-w/2-s;if(j>J||U>le)return;let ee={midX:A(q.midX,j,J),midY:A(q.midY,U,le)},ue=C4(ee.midX,ee.midY,x,w);return N(q,ue)?{laneId:H.id,anchor:ee,rect:ue}:void 0},"placementForAnchor"),D=b((q,G,z)=>q.orientation==="horizontal"?Math.abs(G.midX-z.x):Math.abs(G.midY-z.y),"distanceAlongSegment"),B=b((q,G)=>{let H=(q.orientation==="horizontal"?x/2:w/2)+o;if(q===I){let j=v[q.idx];if(D(q,G,j)+tc{let G=E(q);for(let z of G)for(let H of O){let j=R(z,H);if(!B(z,j))continue;let J=M(j);if(J&&!MX(J.rect,v)&&!p(g,J.rect)&&!h(g,m.id,J.rect))return{laneId:J.laneId,anchor:J.anchor}}},"tryPool"),$=b((q,G,z=!1)=>{let H=E(q);for(let j of H){let J={midX:j.midX,midY:j.midY};if(G&&!B(j,J))continue;let U=M(J);if(U&&!MX(U.rect,v)&&!p(g,U.rect)&&!l(g,U.rect)&&(z||!u(m.id,U.rect)))return{laneId:U.laneId,anchor:U.anchor}}},"findLaneContainingFallback"),F=P(k)??(k.lengthz.labelId===g);G>=0?f[G]={labelId:g,rect:q}:f.push({labelId:g,rect:q})}}}function NX(e,t){return e{let h=NX(o,l),f=0,d=b(p=>{if(!p)return;let m=i.get(p);if(!m)return;let g=u==="x"?m.w/2:m.h/2;g>f&&(f=g)},"consider");d(s.labelNodeId);for(let p of e){if(p===s||p.isLayoutOnly)continue;let m=p.start,g=p.end;!m||!g||NX(m,g)===h&&d(p.labelNodeId)}return f>0?f+zAt:0},"labelClearanceFor");for(let s of e){if(s.isLayoutOnly)continue;let o=s.points;if(!YX(o,uX))continue;let l=ZX(s,r,uX);if(!l)continue;let{srcId:u,dstId:h,srcInfo:f,dstInfo:d,collinearX:p,collinearY:m}=l;if(p===m)continue;let g,y;if(p){let T=d.cy>f.cy;g={x:f.cx,y:T?f.rect.bottom:f.rect.top},y={x:d.cx,y:T?d.rect.top:d.rect.bottom}}else{let T=d.cx>f.cx;g={x:T?f.rect.right:f.rect.left,y:f.cy},y={x:T?d.rect.left:d.rect.right,y:d.cy}}if(qa(g,y,n,[u,h],1))continue;let x=a(s,u,h,p?"x":"y"),w=x>w_e?x:w_e,C=[0,w,-w];for(let T of C){let k={...g},S={...y};if(p){if(k.x+=T,S.x+=T,k.x<=f.rect.left||k.x>=f.rect.right||S.x<=d.rect.left||S.x>=d.rect.right)continue}else if(k.y+=T,S.y+=T,k.y<=f.rect.top||k.y>=f.rect.bottom||S.y<=d.rect.top||S.y>=d.rect.bottom)continue;if(!qa(k,S,n,[u,h],1)&&!eL(k,S,e,s,{epsilon:uX})){s.points=[k,S];break}}}}function DX(e,t){let{realNodeRects:u,labelNodeRects:h}=ag(t.values()),f=b((k,S)=>S4(S,.001).map(E=>({...E,edge:k,interior:E.index>=1&&E.index<=S.length-3})),"segmentsFor"),d=b(()=>{let k=[];for(let S of e){if(S.isLayoutOnly)continue;let E=S.points;!E||E.length<2||k.push(...f(S,Vn(E)))}return k},"allSegments"),p=b((k,S)=>k.horizontal&&S.horizontal?bl(k.a.x,k.b.x,S.a.x,S.b.x)>=8&&Math.abs(k.a.y-S.a.y)<7:k.vertical&&S.vertical?bl(k.a.y,k.b.y,S.a.y,S.b.y)>=8&&Math.abs(k.a.x-S.a.x)<7:!1,"hasCrowdedParallelTrack"),m=b((k,S)=>{let E=k.start,I=k.end,L=f(k,S);if(L.length!==S.length-1)return!1;let O=[E,I].filter(A=>!!A),R=k.labelNodeId?[k.labelNodeId]:[];for(let A of L)if(qa(A.a,A.b,u,O,-2)||qa(A.a,A.b,h,R,-2))return!1;for(let A of e){if(A===k||A.isLayoutOnly)continue;let N=A.points;if(!(!N||N.length<2)){for(let M of L)for(let D of f(A,Vn(N)))if(p(M,D)||N0(M.a,M.b,D.a,D.b,.001))return!1}}return!0},"candidateIsSafe"),g=b((k,S)=>{let E=Vn(k.edge.points??[]);if(E.length<4||k.index>=E.length-1)return;let I=E.map(L=>({...L}));if(k.horizontal)I[k.index].y+=S,I[k.index+1].y+=S;else if(k.vertical)I[k.index].x+=S,I[k.index+1].x+=S;else return;return f(k.edge,I).length===I.length-1?I:void 0},"shiftedCandidate"),y=b((k,S)=>({x:k.x??(S.left+S.right)/2,y:k.y??(S.top+S.bottom)/2}),"nodeCenter"),v=b(k=>{let S=k.edge,E=Vn(S.points??[]);if(E.length!==4||k.index!==1)return;let I=S.start?t.get(S.start):void 0,L=S.end?t.get(S.end):void 0,O=I?rc(I):void 0,R=L?rc(L):void 0,A=E.slice(k.index+2);if(!(!I||!L||!O||!R||A.length===0))return{sourceCenter:y(I,O),targetCenter:y(L,R),sourceRect:O,tail:A}},"sourceDetourContextFor"),x=b((k,S,E,I,L,O)=>{let R=I.y>=E.y,A=R?L.bottom:L.top,N=A+(R?20:-20);if(R&&k.b.y<=N+.001||!R&&k.b.y>=N-.001)return;let M=k.a.x+S;return Vn([{x:E.x,y:A},{x:E.x,y:N},{x:M,y:N},{x:M,y:k.b.y},...O],.001)},"verticalSourceDetour"),w=b((k,S,E,I,L,O)=>{let R=I.x>=E.x,A=R?L.right:L.left,N=A+(R?20:-20);if(R&&k.b.x<=N+.001||!R&&k.b.x>=N-.001)return;let M=k.a.y+S;return Vn([{x:A,y:E.y},{x:N,y:E.y},{x:N,y:M},{x:k.b.x,y:M},...O],.001)},"horizontalSourceDetour"),C=b((k,S)=>{let E=v(k);if(E){if(k.vertical)return x(k,S,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(k.horizontal)return w(k,S,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let k=0;k<12;k++){let S=d(),E=!1;for(let I=0;IN.interior);for(let N of A){for(let M of T){let D=g(N,M);if(D&&m(N.edge,D)){N.edge.points=D,E=!0;break}let B=C(N,M);if(B&&m(N.edge,B)){N.edge.points=B,E=!0;break}}if(E)break}}if(!E)return}}function mRe(e,t,r,n){let i=t.x-e.x,a=t.y-e.y,s=n.x-r.x,o=n.y-r.y,l=i*o-a*s;if(Math.abs(l)<1e-10)return!1;let u=r.x-e.x,h=r.y-e.y,f=(u*o-h*s)/l,d=(u*a-h*i)/l,p=.01;return f>p&&f<1-p&&d>p&&d<1-p}function gRe(e){let t=e.nodes??[],r=e.edges??[],n=[];if(!r.length||!t.length)return n;let i=q_e(t),a=1,s=[];for(let l of r){if(l.isLayoutOnly)continue;let u=l.points;if(!u||u.length<2)continue;let h=l.start,f=l.end,d=l.labelNodeId,p=l.id??`${h}->${f}`;for(let m of i)if(!(m.nodeId===h||m.nodeId===f)&&!(d&&m.nodeId===d)){for(let g=0;g0){let l=n.filter(h=>h.type==="edge-node-overlap").length,u=n.filter(h=>h.type==="edge-edge-crossing").length;se.warn(`[SWIMLANE_VALIDATE] ${n.length} issue(s) detected: ${l} edge-node overlap(s), ${u} edge crossing(s)`);for(let h of n)se.warn(`[SWIMLANE_VALIDATE] ${h.type}: ${h.detail}`)}return n}function yRe(e,t){let r=e.nodes??[],n=e.edges??[],i=r.filter(o=>!o.isGroup);if((t==="LR"||t==="RL")&&i.length>0&&!nRe(e,t)||t==="BT"&&i.length>0&&!rRe(e))return;for(let o of n){if(o.isLayoutOnly)continue;let l=o.points;!l||l.length<2||(o.points=Uf(tL(l)))}fRe(n,r),pRe(n,r),iRe(n,r);let a=new Map;for(let o of r)a.set(String(o.id),o);KR(n,a),Y_e(n,a),aRe(n,a),DX(n,a),sRe(n,a),oRe(n,a),_X(n,a),lRe(n,a);let s=b(()=>{hRe(n,a),cRe(n,a),uRe(n,a),KR(n,a),EX(n,a),_X(n,a),KR(n,a),EX(n,a)},"finalizeRenderedEdges");s(),DX(n,a),s(),RX(n,a),LX(n,a),RX(n,a),LX(n,a)}function sg(e){let t=new Map(e.nodeById),r=new Set,n=[];for(let a of e.edges){if(!t.has(a.src)||!t.has(a.dst))continue;let s=`${a.id}:${a.src}->${a.dst}`;r.has(s)||(r.add(s),n.push(a))}return{nodes:[...t.keys()],edges:n,layout:e.layout,nodeById:t}}function nj(e,t){return e.edges.filter(r=>r.dst===t)}function vRe(e){let t=new Map;for(let r of e.nodes)t.set(r,[]);for(let r of e.edges)t.get(r.src).push(r.dst);return t}function ij(e){let t=vRe(e);for(let r of t.values())r.sort((n,i)=>n.localeCompare(i));return t}function aj(e){let t=new Map;for(let r of e.nodes)t.set(r,0);for(let r of e.edges)t.set(r.dst,(t.get(r.dst)??0)+1);return t}function sj(e){return[...e.entries()].filter(([,t])=>t===0).map(([t])=>t).sort((t,r)=>t.localeCompare(r))}function uL(e,t=()=>!0){let r=new Map,n=new Map;for(let i of e.nodes)r.set(i,[]),n.set(i,[]);for(let i of e.edges)t(i)&&(n.get(i.src).push(i.dst),r.get(i.dst).push(i.src));return{preds:r,succs:n}}function oj(e,t,r,n){let i=0;for(let s of e.nodes)n?.skipGroups&&e.nodeById.get(s)?.isGroup||(i=Math.max(i,r[s]??0));let a=Array.from({length:i+1},()=>[]);for(let s of t)n?.skipGroups&&e.nodeById.get(s)?.isGroup||a[Math.max(0,r[s]??0)].push(s);return a}function uC(e){let t=aj(e),r=sj(t),n=[],i=ij(e);for(;r.length;){let a=r.shift();n.push(a);for(let s of i.get(a)??[])if(t.set(s,(t.get(s)??0)-1),(t.get(s)??0)===0){let o=0;for(;o{if(i-n<=1)return 0;let a=n+i>>1,s=r(n,a)+r(a,i),o=n,l=a,u=n;for(;o=i||of.dst===d.dst?f.id.localeCompare(d.id):f.dst.localeCompare(d.dst));let n=Object.create(null);for(let h of t.nodes)n[h]=0;let i=[],a=b(h=>{n[h]=1;for(let f of r.get(h)??[]){let d=f.dst;n[d]===0?a(d):n[d]===1&&i.push(f)}n[h]=2},"dfs"),s=[...t.nodes].sort((h,f)=>h.localeCompare(f));for(let h of s)n[h]===0&&a(h);let o=new Set(i.map(h=>`${h.id}:${h.src}->${h.dst}`)),l=t.edges.map(h=>o.has(`${h.id}:${h.src}->${h.dst}`)?{id:h.id,src:h.dst,dst:h.src,weight:h.weight,ref:h.ref}:h);return{acyclic:{nodes:[...t.nodes],edges:l,layout:t.layout,nodeById:new Map(t.nodeById)},reversed:i}}function bRe(e){let t=new Map,r=b(n=>{if(t.has(n))return t.get(n);let i=e.nodeById.get(n);if(!i)return t.set(n,null),null;let a=i.parentId;if(!a)return t.set(n,null),null;let o=r(a)??a;return t.set(n,o),o},"resolve");for(let n of e.nodes)r(n);return t}function D0(e){let t=bRe(e);return r=>t.get(r)??null}function hL(e){let t=[];for(let r of e.layout.nodes??[])r.isGroup&&!r.parentId&&t.push(r.id);return[...new Set(t)].reverse()}function cj(e,t){let r=hL(e);if(!t||t.length===0)return r;let n=new Set(r),i=new Set,a=[];for(let s of t)!n.has(s)||i.has(s)||(i.add(s),a.push(s));for(let s of r)i.has(s)||a.push(s);return a}function wRe(e,t){let r=sg(e),n=t?.laneOf??(()=>null),i=t?.rankHint,{preds:a}=uL(r);for(let T of a.values())T.sort((k,S)=>k.localeCompare(S));let s=uC(r)??[...r.nodes].sort((T,k)=>T.localeCompare(k)),o=new Map;for(let[T,k]of s.entries())o.set(k,T);let l=new Map,u=new Map;for(let T of r.nodes)u.set(T,[]);for(let T of s){let k=(a.get(T)??[]).filter(S=>l.has(S));if(k.length>0){let S=kRe(T,k,{laneOf:n,rankHint:i,topoIndex:o});l.set(T,S),u.get(S).push(T)}else l.has(T)||l.set(T,null)}for(let T of r.nodes)l.has(T)||l.set(T,null);let h=new Set;for(let T of r.nodes)(l.get(T)??null)===null&&h.add(T);let f=[...h].sort((T,k)=>{let S=o.get(T)??0,E=o.get(k)??0;return S===E?T.localeCompare(k):S-E}),d=TRe(r),p=new Map;for(let[T,k]of d.entries())p.set(T,[...k].sort((S,E)=>S.localeCompare(E)));let m=CRe(p),g=SRe(p),y=new Map;for(let T of r.nodes)y.set(T,[]);for(let T of g)for(let k of T.nodes){let S=y.get(k);S?S.push(T.id):y.set(k,[T.id])}let v=[],x=[],w=new Set,C=b(T=>{if(!w.has(T)){w.add(T),v.push(T);for(let k of u.get(T)??[])C(k);x.push(T)}},"walk");for(let T of f)C(T);for(let T of s)C(T);return{parent:l,children:u,roots:f,componentOf:m,blocks:g,nodeBlocks:y,adjacency:p,preorder:v,postorder:x,topologicalOrder:s}}function kRe(e,t,r){let n=r.laneOf(e);return[...t].sort((a,s)=>{let o=r.laneOf(a),l=r.laneOf(s),u=o!=null&&o===n,h=l!=null&&l===n;if(u!==h)return u?-1:1;let f=r.rankHint?.[a],d=r.rankHint?.[s];if(f!=null&&d!=null&&f!==d)return d-f;let p=r.topoIndex.get(a)??0,m=r.topoIndex.get(s)??0;return p!==m?p-m:a.localeCompare(s)})[0]}function TRe(e){let t=new Map;for(let r of e.nodes)t.set(r,new Set);for(let r of e.edges)t.get(r.src).add(r.dst),t.get(r.dst).add(r.src);return t}function CRe(e){let t=new Map,r=0;for(let n of e.keys()){if(t.has(n))continue;let i=[n];for(;i.length>0;){let a=i.pop();if(!t.has(a)){t.set(a,r);for(let s of e.get(a)??[])t.has(s)||i.push(s)}}r++}return t}function SRe(e){let t=new Map,r=new Map,n=[],i=[],a=0,s=b((o,l)=>{t.set(o,++a),r.set(o,a);for(let u of e.get(o)??[])u!==l&&(t.has(u)?(t.get(u)??0)<(t.get(o)??0)&&(n.push([o,u]),r.set(o,Math.min(r.get(o)??a,t.get(u)??a))):(n.push([o,u]),s(u,o),r.set(o,Math.min(r.get(o)??a,r.get(u)??a)),(r.get(u)??0)>=(t.get(o)??0)&&i.push(ERe(o,u,n,i.length))))},"visit");for(let o of e.keys())t.has(o)||s(o,null);return i}function ERe(e,t,r,n){let i=[],a=new Set;for(;r.length>0;){let s=r.pop();if(i.push(s),a.add(s[0]),a.add(s[1]),s[0]===e&&s[1]===t||s[0]===t&&s[1]===e)break}return{id:n,edges:i,nodes:[...a]}}function ARe(e,t,r){let n=[...e.nodes],i=new Map;for(let[x,w]of n.entries())i.set(w,x);let a=n.length,s=new Array(a).fill(-1),o=new Array(a).fill(0),l=[],u=new Set;for(let x of n){let w=r.parent.get(x)??null,C=i.get(x);C!=null&&w==null&&(s[C]=-1,o[C]=0,u.has(x)||(u.add(x),l.push(x)))}for(;l.length>0;){let x=l.shift(),w=i.get(x);if(w==null)continue;let C=r.children.get(x)??[];for(let T of C){if(u.has(T))continue;let k=i.get(T);k!=null&&(s[k]=w,o[k]=o[w]+1,u.add(T),l.push(T))}}for(let x of n){if(u.has(x))continue;let w=i.get(x);w!=null&&(s[w]=-1,o[w]=0,u.add(x))}let h=Math.max(1,Math.ceil(Math.log2(Math.max(1,a)))+1),f=Array.from({length:h},()=>new Array(a).fill(-1));for(let x=0;x{if(x===-1||w===-1)return-1;o[x]>T&1&&(x=f[T][x],x===-1))return-1;if(x===w)return x;for(let T=h-1;T>=0;T--){let k=f[T][x],S=f[T][w];k===-1||S===-1||k!==S&&(x=k,w=S)}return f[0][x]},"lcaIndex"),p=Array.from({length:a},()=>new Map);for(let x of e.edges){let w=x.src,C=x.dst,T=t[w],k=t[C];if(T==null||k==null||(T>k&&([w,C]=[C,w],[T,k]=[k,T]),T==null||k==null||T===k))continue;let S=i.get(w),E=i.get(C);if(S==null||E==null)continue;let I=d(S,E);if(I===-1)continue;let L=p[I];for(let O=T;O{if(w.size!==0)for(let[C,T]of w)x.set(C,(x.get(C)??0)+T)},"mergeInto"),y=new Set,v=b(x=>{let w=i.get(x);y.add(x);let C=w==null?void 0:p[w],T=C?new Map(C):new Map,k=r.children.get(x)??[];for(let S of k){let E=v(S),I=t[x];if(I!=null){let L=m.get(x);L||(L=new Map,m.set(x,L));let O=E.get(I)??0,R=t[S];R!=null&&R>I&&(O+=1),L.set(S,O)}g(T,E)}return T},"dfs");for(let x of r.roots)y.has(x)||v(x);for(let x of n)y.has(x)||v(x);return m}function _Re(e,t,r){let n=new Map,i=b(a=>{let s=r[a]??0,o=[...t.get(a)??[]];o.sort(uj(r));for(let l of o){i(l);let u=n.get(l);u!=null&&(s=Math.min(s,u))}n.set(a,s)},"annotate");for(let a of e)i(a);return n}function uj(e){return(t,r)=>{let n=e[t]??0,i=e[r]??0;return n===i?t.localeCompare(r):n-i}}function RRe(e,t,r,n){let i=0;for(let l of t){let u=r[l]??0;u>i&&(i=u)}let a=Array.from({length:i+1},()=>[]),s=new Set,o=b(l=>{if(s.has(l))return;s.add(l);let u=r[l]??0;a[u]||(a[u]=[]),a[u].push(l);for(let h of n(l))o(h)},"emit");for(let l of e)o(l);for(let l of t)if(!s.has(l)){let u=r[l]??0;a[u]||(a[u]=[]),a[u].push(l),s.add(l)}return a}function LRe(e){let t=[];for(let r of e){let n=new Set,i=[];for(let a of r)n.has(a)||(n.add(a),i.push(a));t.push(i)}return t}function IRe(e,t,r,n){return i=>{let a=e.get(i)??[];if(a.length===0)return[];let s=t[i]??0,o=[],l=[],u=r.get(i);for(let h of a){let f=n.get(h)??s;f>s?o.push({child:h,min:f}):l.push(h)}return o.sort((h,f)=>h.min===f.min?h.child.localeCompare(f.child):h.min-f.min),l.sort((h,f)=>{let d=u?.get(h)??0,p=u?.get(f)??0;if(d!==p)return d-p;let m=n.get(h)??s,g=n.get(f)??s;return m!==g?m-g:h.localeCompare(f)}),[...o.map(h=>h.child),...l]}}function oL(e,t,r){let n=wRe(e,{rankHint:t,laneOf:r}),{children:i,roots:a}=n;for(let f of e.nodes)i.has(f)||i.set(f,[]);let s=ARe(e,t,n),o=[...a].sort(uj(t)),l=_Re(o,i,t),u=IRe(i,t,s,l),h=RRe(o,e.nodes,t,u);return h=LRe(h),h}function MRe(e,t,r){let n=new Set(e),i=new Set(t),a=E4(t),s=[];for(let o of r)n.has(o.src)&&i.has(o.dst)&&s.push(a.get(o.dst));return lj(s)}function OX(e,t,r){let n=[];for(let a of t){let s=r[a.src],o=r[a.dst];if(s==null||o==null||s===o)continue;let l=a.src,u=a.dst,h=s,f=o;s>o&&(l=a.dst,u=a.src,h=o,f=s);for(let d=h;d(r[d]??0)-(r[f]??0));for(let f of h){let d=r[f]??0;if(d===0)continue;let p=0;for(let v of n.get(f)??[])p=Math.max(p,(r[v]??0)+1);if(p>=d)continue;let m=d;r[f]=p;let g=oL(e,r,i),y=OX(g,e.edges,r);y(t[i]??0)-(t[a]??0)||i.localeCompare(a));for(let i of n){let a=r(i);if(!a)continue;let s=e.edges.filter(g=>g.src===i);if(s.length===0)continue;let o=!1,l=0;for(let g of s){let y=r(g.dst);y==null||y===a?o=!0:l++}if(l===0||o)continue;let u=0,h=!1;for(let g of e.edges){if(g.dst!==i)continue;let y=r(g.src);y&&(y===a?h=!0:u++)}if(u>0||!h)continue;let f=t[i]??0,d=f+l,p=0;for(let g of e.edges)g.dst===i&&(p=Math.max(p,(t[g.src]??0)+1));let m=Math.max(f,p,d);m!==f&&(t[i]=m)}}function ORe(e,t){let r=sg(e),n=uC(r)??[...r.nodes].sort(),i=t?.compactSingleInput??!1,a=D0(r),s=Object.create(null);for(let l of n){let u=nj(r,l),h=t?.ignoreCrossLaneEdges?u.filter(f=>{let d=a(f.src),p=a(l);return!d||!p?!0:d===p}):u;if(h.length===0)s[l]=0;else if(i&&h.length===1){let f=h[0].src,d=a(f),p=a(l);d!==p?s[l]=s[f]??0:s[l]=(s[f]??0)+1}else{let f=-1/0;for(let d of h)f=Math.max(f,(s[d.src]??0)+1);s[l]=f===-1/0?0:f}}return(t?.optimizeRanksByCrossings??!1)&&(s=NRe(r,s)),t?.ignoreCrossLaneEdges&&DRe(r,s),{layers:oL(r,s,a),rankOf:s,dummy:new Set}}function PRe(e,t){let r=sg(e),i={...ORe(r,{compactSingleInput:t?.compactSingleInput,ignoreCrossLaneEdges:t?.ignoreCrossLaneEdges,optimizeRanksByCrossings:t?.optimizeRanksByCrossings}).rankOf},a=D0(r),{preds:s,succs:o}=uL(r,m=>{if(t?.ignoreCrossLaneEdges){let g=a(m.src),y=a(m.dst);if(g&&y&&g!==y)return!1}return!0}),l=uC(r)??[...r.nodes],u=[...l].reverse(),h=b((m,g)=>{let y=0;for(let w of s.get(m)??[])y=Math.max(y,(i[w]??0)+1);let v=Number.POSITIVE_INFINITY,x=o.get(m)??[];return x.length>0&&(v=Math.min(...x.map(w=>(i[w]??0)-1))),Number.isFinite(v)||(v=Math.max(y,g)),Math.min(Math.max(g,y),v)},"clampFeasible"),f=sL.GRAVITY_ITERATIONS,d=b(m=>{let g=!1;for(let y of m){let v=s.get(y)??[],x=o.get(y)??[];if(v.length===0&&x.length===0)continue;let w=v.length>0?v.reduce((S,E)=>S+(i[E]??0)+1,0)/v.length:i[y]??0,C=x.length>0?x.reduce((S,E)=>S+(i[E]??0)-1,0)/x.length:i[y]??0,T=Math.round((w+C)/2),k=h(y,T);k!==i[y]&&(i[y]=k,g=!0)}return g},"relaxOrder");for(let m=0;m0){let y=Math.min(...g.map(v=>(i[v]??0)-1));(i[m]??0)>y&&(i[m]=y)}}return{layers:oj(r,l,i),rankOf:i,dummy:new Set}}function BRe(e){let t=aj(e),r=ij(e),n=sj(t),i=[];for(;n.length>0;){let a=[];for(let s of n){i.push(s);for(let o of r.get(s)??[])t.set(o,(t.get(o)??0)-1),(t.get(o)??0)===0&&a.push(o)}n=a.sort((s,o)=>s.localeCompare(o))}return i.length===e.nodes.length?i:null}function FRe(e,t){let r=sg(e),n=t?.direction==="LR"?BRe(r)??[...r.nodes].sort():uC(r)??[...r.nodes].sort(),i=D0(r),a=b(h=>i(h)??h,"laneOf"),s=Object.create(null),o=new Map,l=b((h,f)=>t?.ignoreCrossLaneEdges??!0?a(h)===a(f)?1:0:1,"edgeWeight");for(let h of n){if(r.nodeById.get(h)?.isGroup)continue;let d=nj(r,h),p=0;if(d.length>0)for(let v of d){let x=v.src,w=s[x]??0;p=Math.max(p,w+l(x,h))}let m=a(h),g=o.get(m)??0,y=Math.max(p,g);s[h]=y,o.set(m,y+1)}return{layers:oj(r,n,s,{skipGroups:!0}),rankOf:s,dummy:new Set}}function $Re(e,t){let r=sg(t),{rankOf:n}=e,i=e.layers.map(p=>[...p]),a=new Set(e.dummy?[...e.dummy]:[]),s=0,o=new Map(r.nodeById),l=b(p=>{let m=`placeholder-${s++}`,g={id:m,isGroup:!1,isDummy:!0,width:0,height:0};for(o.set(m,g),a.add(m);i.length<=p;)i.push([]);return i[p].push(m),n[m]=p,m},"addDummyAt"),u=[...r.edges].sort((p,m)=>p.id===m.id?p.src===m.src?p.dst.localeCompare(m.dst):p.src.localeCompare(m.src):p.id.localeCompare(m.id)),h=[];for(let p of u){let m=n[p.src]??0,g=n[p.dst]??0;if(g-m<=1){h.push(p);continue}let y=p.src;for(let x=m+1,w=0;x!r.nodes.includes(p))],edges:h,layout:r.layout,nodeById:o};return{layering:{layers:i,rankOf:n,dummy:a},graphWithDummies:d}}function PX(e){let t=e.length;if(t===0)return Number.POSITIVE_INFINITY;let r=[...e].sort((n,i)=>n-i);return t%2===1?r[(t-1)/2]:.5*(r[t/2-1]+r[t/2])}function BX(e){return e.length===0?Number.POSITIVE_INFINITY:e.reduce((r,n)=>r+n,0)/e.length}function zRe(e,t,r,n){let i=new Map;for(let a of e)i.set(a,[]);for(let a of r)n==="down"?t.has(a.src)&&i.has(a.dst)&&i.get(a.dst).push(t.get(a.src)):t.has(a.dst)&&i.has(a.src)&&i.get(a.src).push(t.get(a.dst));return i}function GRe(e,t,r){let n=r.get(e)??0,i=r.get(t)??0;return n!==i?n-i:e.localeCompare(t)}function FX(e,t,r){let n=new Set(e),i=new Set(t),a=E4(e),s=E4(t),o=[];for(let u of r)n.has(u.src)&&i.has(u.dst)&&o.push({u:a.get(u.src),v:s.get(u.dst)});o.sort((u,h)=>u.u===h.u?u.v-h.v:u.u-h.u);let l=o.map(u=>u.v);return lj(l)}function ZR(e,t,r){return[...e].sort((n,i)=>{let a=PX(t.get(n)??[]),s=PX(t.get(i)??[]);return a===s?GRe(n,i,r):isFinite(a)?isFinite(s)?a-s:-1:1})}function $X(e,t,r,n,i,a){let s=E4(e),o=E4(t),l=zRe(t,s,r,n);if(!i||!a||a.length===0)return ZR(t,l,o);let u=new Map;for(let d of t){let p=i(d),m=u.get(p)??[];m.push(d),u.set(p,m)}let h=[];for(let d of a){let p=u.get(d);if(!p||p.length===0)continue;let m=ZR(p,l,o);h.push(...m)}let f=u.get(null);if(f&&f.length>0){let d=ZR(f,l,o);for(let p of d){let m=BX(l.get(p)??[]),g=h.length;if(isFinite(m))for(let[y,v]of h.entries()){let x=BX(l.get(v)??[]);if(ms.has(g.src)&&o.has(g.dst)),h=l?r.filter(g=>o.has(g.src)&&l.has(g.dst)):void 0,f=b(g=>{let y=FX(e,g,u);return h&&n&&(y+=FX(g,n,h)),y},"crossingScore"),d=i?new Map:null;if(i&&d)for(let g of t)d.set(g,i(g));let p=!0,m=f(a);for(;p;){p=!1;for(let g=0;g+1[...o]),i=t.edges,a=D0(t),s=cj(t,r?.laneOrder);for(let o=0;o<3;o++){for(let l=1;l=0;l--)n[l]=$X(n[l+1],n[l],i,"up",a,s),n[l]=zX(n[l+1],n[l],i,n[l-1],a)}return{layers:n}}function VRe(e,t,r){let n=r?.layerGap??k_e.DEFAULT_LAYER_GAP,i=r?.nodeGap??k_e.DEFAULT_NODE_GAP,a=r?.laneGap??i*2,s=r?.direction??"TB",o=s==="LR"||s==="RL",l=e.layers,u=Object.create(null),h=Object.create(null),f=b(L=>t.nodeById.get(L),"getNode"),d=b(L=>f(L)?.width??0,"getWidth"),p=b(L=>f(L)?.height??0,"getHeight"),m=D0(t),g=cj(t,r?.laneOrder),y=l.map(L=>L.reduce((O,R)=>Math.max(O,p(R)),0)),v=[];if(o)for(let L=0;L+1Math.max(P,d($)),0),R=l[L+1].reduce((P,$)=>Math.max(P,d($)),0),A=y[L],N=y[L+1],M=A/2+N/2,D=(O+R)/2,B=Math.max(0,D-M-n);v.push(B)}let x=new Set;for(let L of l)for(let O of L)x.add(m(O));let w=x.has(null),C=g.filter(L=>x.has(L)),T=[...w?[null]:[],...C],k=Object.create(null);for(let L of C)k[L]=0;w&&(k.null=0);for(let L of l){let O=Object.create(null),R=[];for(let A of L){let N=m(A);N===null?R.push(A):(O[N]||=[]).push(A)}for(let[A,N]of Object.entries(O)){let M=N.reduce((D,B)=>D+d(B),0)+i*Math.max(0,N.length-1);k[A]=Math.max(k[A]??0,M)}if(w&&R.length){let A=R.reduce((N,M)=>N+d(M),0)+i*Math.max(0,R.length-1);k.null=Math.max(k.null??0,A)}}let S=new Map;{let L=T.map(A=>(A===null?k.null:k[A])??0),R=-(L.reduce((A,N)=>A+N,0)+a*Math.max(0,T.length-1))/2;for(let A=0;Ad(q)),$=P.reduce((q,G)=>q+G,0)+i*(D.length-1),F=B-$/2;for(let[q,G]of D.entries()){let z=P[q];u[G]=F+z/2,h[G]=E+R/2,F+=z+i}}}let N=v[L]??0;E+=R+n+N}let I=new Map;for(let L of t.edges){let O=L.ref.id;I.has(O)||I.set(O,[]),I.get(O).push(L)}for(let[,L]of I){if(L.length===0)continue;let O=L[0].ref,R=O.start,A=O.end;if(R==null||A==null)continue;let N=Math.round(((u[R]??0)+(u[A]??0))/2),M=new Set;for(let D of L)M.add(D.src),M.add(D.dst);for(let D of M){if(D===R||D===A)continue;t.nodeById.get(D)?.isDummy&&(u[D]=N)}}return{x:u,y:h}}function HRe(e){let t=2166136261;for(let r=0;r>>0}function URe(e){let t=e>>>0;return()=>{t+=1831565813;let r=t;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function YRe(e,t){let r=[...e],n=URe(t);for(let i=r.length-1;i>0;i--){let a=Math.floor(n()*(i+1));[r[i],r[a]]=[r[a],r[i]]}return r}function XRe(e,t){let r=0;for(let[n,i]of e.entries())r+=Math.abs(n-(t.get(i)??n));return r}function GX(e,t){let r=new Map;for(let[i,a]of e.entries())r.set(a,i);let n=0;for(let{a:i,b:a,weight:s}of t){let o=r.get(i),l=r.get(a);o==null||l==null||(n+=s*Math.abs(o-l))}return n}function jRe(e){let t=hL(e);if(t.length<2)return[];let r=new Map(t.map((a,s)=>[a,s])),n=D0(e),i=new Map;for(let a of e.layout.edges??[]){if(a.isLayoutOnly)continue;let s=typeof a.start=="string"?a.start:void 0,o=typeof a.end=="string"?a.end:void 0;if(!s||!o||!e.nodeById.has(s)||!e.nodeById.has(o))continue;let l=n(s),u=n(o);if(!l||!u||l===u)continue;let h=r.get(l),f=r.get(u);if(h==null||f==null)continue;let[d,p]=h<=f?[l,u]:[u,l],m=`${d}\0${p}`,g=i.get(m);g?g.weight++:i.set(m,{a:d,b:p,weight:1})}return[...i.values()]}function qX(e,t,r){let n=[...e],i=GX(n,t),a=!0,s=0,o=Math.max(1,n.length);for(;a&&si.a===a.a?i.b.localeCompare(a.b):i.a.localeCompare(a.a)).map(({a:i,b:a,weight:s})=>`${i}:${a}:${s}`).join("|");return HRe(`${e.join("|")}#${n}#${r}`)}function QRe(e,t={}){let r=hL(e);if(r.length<2)return r;let n=jRe(e);if(n.length===0)return r;let i=new Map(r.map((o,l)=>[o,l])),a=qX(r,n,i),s=Math.max(0,t.restarts??WRe);for(let o=0;oEn&&l*3>=o?s>0?"bottom":"top":o>En?a>0?"right":"left":r}function WX(e,t){return Math.abs(e.to-t.from)ie.isGroup&&!ie.parentId);for(let ie of u){let Q={id:ie.id},he=b(xe=>{s.set(xe.id,Q),r.filter(ce=>ce.parentId===xe.id).forEach(he)},"assignLane");he(ie)}let h=r.filter(ie=>!ie.isGroup&&!ie.isEdgeLabel).map(ie=>{let Q=ie.width??10,he=ie.height??10,xe=ie.x??0,ce=ie.y??0,ge=qAt;return{nodeId:ie.id,minX:xe-Q/2-ge,maxX:xe+Q/2+ge,minY:ce-he/2-ge,maxY:ce+he/2+ge,visualXHalfExtent:l?he/2+ge:Q/2+ge}}),f=b((ie,Q,he,xe)=>{let ce=o.find(ge=>ge.orientation===ie&&Math.abs(ge.coord-Q)<1);return ce||(ce={id:`pipe-${ie}-${Q.toFixed(0)}`,orientation:ie,coord:Q,spanMin:he,spanMax:xe,tracks:[]},o.push(ce)),ce.spanMin=Math.min(ce.spanMin,he),ce.spanMax=Math.max(ce.spanMax,xe),ce},"getOrAddPipe"),d=b((ie,Q)=>{let he=ie.width??10,xe=ie.height??10,ce=ie.x??0,ge=ie.y??0;switch(Q){case"top":return{x:ce,y:ge-xe/2};case"bottom":return{x:ce,y:ge+xe/2};case"left":return{x:ce-he/2,y:ge};case"right":return{x:ce+he/2,y:ge}}},"portForSide"),p=b((ie,Q,he)=>d(ie,VX(ie,Q,he?"bottom":"top")),"getOrthogonalPort"),m=[],g=[],y=new Set,v=1e3,x=b((ie,Q,he)=>{if(m.length===0)return 0;let xe=Math.abs(Q.y-he.y)ne||V.from-En<=Ie&&V.to+En>=Ie&&(ge+=v)}else if(ce){let Ie=Q.x,ye=Math.min(Q.y,he.y)-En,ne=Math.max(Q.y,he.y)+En;if(ne<=ye)return 0;for(let V of m)V.edgeIndex===ie||V.orientation!=="horizontal"||V.pipe.coordne||V.from-En<=Ie&&V.to+En>=Ie&&(ge+=v)}return ge},"crossingPenalty"),w=i.map((ie,Q)=>{if(!ie.start||!ie.end)return{idx:Q,crossLane:0,dx:0,dy:0};let he=a.get(ie.start),xe=a.get(ie.end),ce=s.get(ie.start),ge=s.get(ie.end),Ie=ce&&ge&&ce.id!==ge.id?1:0,ye=he&&xe?Math.abs((xe.x??0)-(he.x??0)):0,ne=he&&xe?Math.abs((xe.y??0)-(he.y??0)):0;return{idx:Q,crossLane:Ie,dx:ye,dy:ne}}).sort((ie,Q)=>{if(ie.crossLane!==Q.crossLane)return Q.crossLane-ie.crossLane;let he=ie.dx+ie.dy,xe=Q.dx+Q.dy;return Math.abs(he-xe)>1?he-xe:ie.idx-Q.idx}).map(ie=>ie.idx),C=b((ie,Q,he,xe)=>{let ce=Math.min(ie.x,Q.x),ge=Math.max(ie.x,Q.x),Ie=Math.min(ie.y,Q.y),ye=Math.max(ie.y,Q.y);return!!h.find(V=>he&&V.nodeId===he||xe&&V.nodeId===xe?!1:Math.abs(ie.x-Q.x)>En?V.minYie.y&&V.maxX>ce&&V.minXie.x&&V.maxY>Ie&&V.minYVX(ie,Q,"bottom"),"determineSide"),E=new Map;for(let[ie,Q]of i.entries()){if(!Q.start||!Q.end||Q.start===Q.end||Q.points&&Q.points.length>0)continue;let he=a.get(Q.start),xe=a.get(Q.end);if(!he||!xe)continue;let ce=(xe.x??0)-(he.x??0),ge=(xe.y??0)-(he.y??0);E.set(ie,{edgeIdx:ie,srcId:Q.start,dstId:Q.end,srcSide:S(he,{x:xe.x??0,y:xe.y??0}),dstSide:S(xe,{x:he.x??0,y:he.y??0}),absDx:Math.abs(ce),absDy:Math.abs(ge),dxSign:Math.sign(ce),dySign:Math.sign(ge)})}let I=b(ie=>ie.srcSide==="top"||ie.srcSide==="bottom"?ie.absDx===0?1/0:ie.absDy/ie.absDx:ie.absDy===0?1/0:ie.absDx/ie.absDy,"preferenceStrength"),L=b(ie=>ie.srcSide==="top"||ie.srcSide==="bottom"?ie.dxSign>=0?"right":"left":ie.dySign>=0?"bottom":"top","secondarySide"),O=new Map;for(let ie of E.values()){let Q=`${ie.srcId}:${ie.srcSide}`;O.has(Q)||O.set(Q,[]),O.get(Q).push(ie)}let R=new Map,A=b((ie,Q)=>`${ie}:${Q}`,"loadKey");for(let ie of E.values())R.set(A(ie.srcId,ie.srcSide),(R.get(A(ie.srcId,ie.srcSide))??0)+1),R.set(A(ie.dstId,ie.dstSide),(R.get(A(ie.dstId,ie.dstSide))??0)+1);for(let ie of O.values())if(!(ie.length<2)){ie.sort((Q,he)=>{let xe=I(Q),ce=I(he);return Math.abs(xe-ce)>1e-9?ce-xe:Q.edgeIdx-he.edgeIdx});for(let Q=1;Q=ce||(R.set(A(he.srcId,he.srcSide),ce-1),R.set(A(he.srcId,xe),ge+1),he.srcSide=xe)}}let N=b(ie=>{let Q=ie?.shape;return Q==="question"||Q==="diamond"},"isDiamondNode"),M=new Map;for(let ie of E.values())M.has(ie.dstId)||M.set(ie.dstId,new Set),M.get(ie.dstId).add(ie.dstSide);for(let ie of E.values()){if(!N(a.get(ie.srcId)))continue;let Q=M.get(ie.srcId);if(!Q?.has(ie.srcSide))continue;let he=L(ie);if(Q.has(he)||(R.get(A(ie.srcId,he))??0)>0)continue;let xe=R.get(A(ie.srcId,ie.srcSide))??0;R.set(A(ie.srcId,ie.srcSide),Math.max(0,xe-1)),R.set(A(ie.srcId,he),1),ie.srcSide=he}for(let ie of E.values()){let{edgeIdx:Q,srcId:he,dstId:xe,srcSide:ce,dstSide:ge}=ie,Ie=a.get(he),ye=a.get(xe),ne=`${he}:${ce}:src`,V=ce==="top"||ce==="bottom"?ye.x??0:ye.y??0;T.has(ne)||T.set(ne,[]),T.get(ne).push({edgeIdx:Q,oppositeCoord:V});let pe=`${xe}:${ge}:dst`,K=ge==="top"||ge==="bottom"?Ie.x??0:Ie.y??0;T.has(pe)||T.set(pe,[]),T.get(pe).push({edgeIdx:Q,oppositeCoord:K})}let D=new Map,B=8;for(let[ie,Q]of T){if(Q.length<2)continue;Q.sort((ze,Fe)=>ze.oppositeCoord-Fe.oppositeCoord);let he=ie.split(":"),xe=he.slice(0,-2).join(":"),ce=he[he.length-2],ge=he[he.length-1],Ie=a.get(xe);if(!Ie)continue;let ne=ce==="left"||ce==="right"?Ie.height??10:Ie.width??10,V=Ie.shape,K=V==="question"||V==="diamond"?ne*.3:ne,Z=Math.min(20,Math.max(B,K/(Q.length+1))),Ne=-(Z*(Q.length-1))/2;for(let[ze,Fe]of Q.entries()){let Ke=Ne+ze*Z,Ve=`${Fe.edgeIdx}:${ge}`;D.set(Ve,Ke)}}let P=b(ie=>!!i[ie]?.labelNodeId,"edgeHasLabelNode"),$=b((ie,Q)=>ie?(T.get(`${ie}:${Q}:src`)??[]).some(({edgeIdx:he})=>P(he))||(T.get(`${ie}:${Q}:dst`)??[]).some(({edgeIdx:he})=>P(he)):!1,"faceHasLabelNode"),F=b((ie,Q,he)=>Q==="top"||Q==="bottom"?{x:ie.x+he,y:ie.y}:{x:ie.x,y:ie.y+he},"applyPortOffset"),q=b((ie,Q,he)=>{let xe=E.get(ie),ce={x:he.x??0,y:he.y??0},ge={x:Q.x??0,y:Q.y??0},Ie=xe?.srcSide??S(Q,ce),ye=xe?.dstSide??S(he,ge),ne=xe?d(Q,xe.srcSide):p(Q,ce,!0),V=xe?d(he,xe.dstSide):p(he,ge,!1),pe=D.get(`${ie}:src`),K=D.get(`${ie}:dst`);return pe!==void 0&&(ne=F(ne,Ie,pe)),K!==void 0&&(V=F(V,ye,K)),{pSrcPort:ne,pDstPort:V,srcSide:Ie,dstSide:ye}},"portsForEdge");for(let ie of w){let Q=i[ie];if(g[ie]=[],!Q.start||!Q.end||Q.points&&Q.points.length>0||Q.start===Q.end)continue;let he=a.get(Q.start),xe=a.get(Q.end);if(!he||!xe)continue;let{pSrcPort:ce,pDstPort:ge,srcSide:Ie,dstSide:ye}=q(ie,he,xe),ne={...ce},V={...ge},pe=Ie==="top"||Ie==="bottom",K=ye==="top"||ye==="bottom";if(pe){let lt=ce.y>(he.y??0);ne.y=lt?ce.y+Ru:ce.y-Ru}else{let lt=ce.x>(he.x??0);ne.x=lt?ce.x+Ru:ce.x-Ru}if(K){let lt=ge.y>(xe.y??0);V.y=lt?ge.y+Ru:ge.y-Ru}else{let lt=ge.x>(xe.x??0);V.x=lt?ge.x+Ru:ge.x-Ru}let ve=b((lt,pt)=>{for(let St of h)if(!pt.includes(St.nodeId)&<.x>St.minX&<.xSt.minY&<.y{if(ur){let jr=lt.y>(pt.y??0);return{x:(St.x??0)>=lt.x?Ir.maxX+rv:Ir.minX-rv,y:jr?Ir.maxY+k4:Ir.minY-k4,leavesPositiveSide:jr}}let gn=lt.x>(pt.x??0),Fn=(St.y??0)>=lt.y;return{x:gn?Ir.maxX+rv:Ir.minX-rv,y:Fn?Ir.maxY+k4:Ir.minY-k4,leavesPositiveSide:gn}},"obstacleDetour"),je=[],Ne=[Q.start,Q.end],ze=ve(ne,Ne);if(ze.inside&&ze.obstacle){let lt=ze.obstacle;if(pe){let pt=Z(ce,he,xe,lt,!0);ne.x=pt.x,ne.y=pt.y;let St=pt.leavesPositiveSide?Math.min(lt.minY-2,ce.y+Ru):Math.max(lt.maxY+2,ce.y-Ru);je=[{x:ce.x,y:St},{x:pt.x,y:St},{x:pt.x,y:pt.y}]}else{let pt=Z(ce,he,xe,lt,!1),St=pt.leavesPositiveSide?Math.min(lt.minX-2,ce.x+Ru):Math.max(lt.maxX+2,ce.x-Ru);ne.x=pt.x,ne.y=pt.y,je=[{x:St,y:ce.y},{x:St,y:pt.y},{x:pt.x,y:pt.y}]}}let Fe=[],Ke=ve(V,Ne);if(Ke.inside&&Ke.obstacle){let lt=Ke.obstacle;if(K){let pt=Z(ge,xe,he,lt,!0);V.x=pt.x,V.y=pt.y,Fe=[{x:pt.x,y:pt.y},{x:ge.x,y:pt.y}]}else{let pt=Z(ge,xe,he,lt,!1);V.x=pt.x,V.y=pt.y,Fe=[{x:pt.x,y:pt.y},{x:pt.x,y:ge.y}]}}if(je.length===0&&Fe.length===0){let lt=rv,pt=Math.abs(ne.x-V.x)1||gn>1,jr=k.get(Q.start??"")??0,Ft=k.get(Q.end??"")??0,kt=ur>1&&$(Q.start,Ie)||gn>1&&$(Q.end,ye),zt=ur<=1||jr<=2,Wt=gn<=1||Ft<=2;if((pt||St)&&!Ir&&(!Fn||Fn&&!kt&&zt&&Wt)&&!C(ce,ge,Q.start,Q.end)){Q.points=[{...ce},{...ne},{...V},{...ge}],y.add(ie);let Le=St?"horizontal":"vertical",Ri=St?ce.y:ce.x,Pe=St?Math.min(ce.x,ge.x):Math.min(ce.y,ge.y),qr=St?Math.max(ce.x,ge.x):Math.max(ce.y,ge.y),Ha={id:`fast-path-${Le}-${Ri.toFixed(0)}-${ie}`,orientation:Le,coord:Ri,spanMin:Pe,spanMax:qr,tracks:[]};m.push({edgeIndex:ie,segmentIndex:0,orientation:Le,pipe:Ha,trackIndex:0,from:Pe,to:qr});continue}}let Ve=f("vertical",ne.x,ne.y,ne.y);ne.x=Ve.coord;let tt=f("vertical",V.x,V.y,V.y);V.x=tt.coord;let We=Math.min(ne.x,V.x)-50,rt=Math.max(ne.x,V.x)+50,Se=Math.min(ne.y,V.y)-50,Et=Math.max(ne.y,V.y)+50;for(let lt of h){let pt=Math.min(ne.x,V.x),St=Math.max(ne.x,V.x),Ir=Math.min(ne.y,V.y),ur=Math.max(ne.y,V.y);lt.minXpt&<.minYIr&&(We=Math.min(We,lt.minX-jR),rt=Math.max(rt,lt.maxX+jR),Se=Math.min(Se,lt.minY-jR),Et=Math.max(Et,lt.maxY+jR))}for(let lt of h){if(lt.maxXrt||lt.maxYEt)continue;let pt=rv;f("horizontal",lt.minY-pt,We,rt),f("horizontal",lt.maxY+pt,We,rt);let St=k4;f("vertical",lt.minX-St,Se,Et),f("vertical",lt.maxX+St,Se,Et)}f("horizontal",ne.y,We,rt),f("horizontal",V.y,We,rt);let De=o.filter(lt=>lt.orientation==="horizontal"&<.coord>=Se&<.coord<=Et),mt=o.filter(lt=>lt.orientation==="vertical"&<.coord>=We&<.coord<=rt),Tt=b((lt,pt)=>`${lt.toFixed(1)},${pt.toFixed(1)}`,"getKey"),jt=Tt(ne.x,ne.y),_t=Tt(V.x,V.y),Rt=new Map,bt=new Map,ke=new Map,yt=new Set,xt=[];Rt.set(jt,0),ke.set(jt,"n"),xt.push({key:jt,f:Math.hypot(V.x-ne.x,V.y-ne.y),pt:ne}),yt.add(jt);let it=[],Me=b((lt,pt)=>C(lt,pt,Q.start,Q.end),"checkSegmentBlocked"),ut={x:V.x,y:ne.y},at=Me(ne,ut),dt=Me(ut,V),tr=at||dt,Vt={x:ne.x,y:V.y},rr=Me(ne,Vt),Dr=Me(Vt,V);if(tr?rr||Dr||(Math.abs(ne.x-V.x)0;){xt.sort((Ft,kt)=>Ft.f-kt.f);let lt=xt.shift();if(yt.delete(lt.key),lt.key===_t){let Ft=_t,kt=V;for(it=[kt];bt.has(Ft);){let zt=bt.get(Ft);it.unshift(zt),kt=zt,Ft=Tt(zt.x,zt.y)}break}let pt=lt.pt.x,St=lt.pt.y,Ir=mt.sort((Ft,kt)=>Ft.coord-kt.coord),ur=Ir.findIndex(Ft=>Math.abs(Ft.coord-pt)<1),gn=De.sort((Ft,kt)=>Ft.coord-kt.coord),Fn=gn.findIndex(Ft=>Math.abs(Ft.coord-St)<1),jr=[];ur>0&&jr.push({x:Ir[ur-1].coord,y:St}),ur>=0&&ur0&&jr.push({x:pt,y:gn[Fn-1].coord}),Fn>=0&&Fnnt.nodeId===Q.start||nt.nodeId===Q.end?!1:kt!==zt?nt.minYSt&&nt.maxX>kt&&nt.minXpt&&nt.maxY>Wt&&nt.minY10&&Sp<-5||Ku<-10&&Sp>5)&&(qr=Math.abs(Sp)*100),(Ha>10&&Ad<-5||Ha<-10&&Ad>5)&&(qr+=Math.abs(Ad)*50);let X2=0,ta=ke.get(lt.key)??"n",Qo=Math.abs(Ad)>En?"h":"v";ta!=="n"&&ta!==Qo&&(X2=50);let _d=Ri+Pe+qr+X2,Gt=(Rt.get(lt.key)??1/0)+_d,$e=Math.abs(V.x-Ft.x)+Math.abs(V.y-Ft.y);if(Gt<(Rt.get(Le)??1/0))if(bt.set(Le,lt.pt),Rt.set(Le,Gt),ke.set(Le,Qo),!yt.has(Le))xt.push({key:Le,f:Gt+$e,pt:Ft}),yt.add(Le);else{let nt=xt.findIndex(Ht=>Ht.key===Le);nt!==-1&&(xt[nt].f=Gt+$e)}}}if(it.length===0&&(it=[ne,{x:ne.x,y:V.y},V]),it.length>4){let lt=it[0],pt=it[it.length-1],St=Math.min(lt.x,pt.x),Ir=Math.max(lt.x,pt.x),ur=Math.min(lt.y,pt.y),gn=Math.max(lt.y,pt.y);for(let Wt of it)St=Math.min(St,Wt.x),Ir=Math.max(Ir,Wt.x),ur=Math.min(ur,Wt.y),gn=Math.max(gn,Wt.y);let Fn=Ir>Math.max(lt.x,pt.x),jr=StPe.minXwt&&Pe.minYwr);if(Ri.length>0){let Pe=Math.max(lt.x,pt.x);for(let qr of Ri){let Ha=(qr.minX+qr.maxX)/2;if(qr.visualXHalfExtent===void 0||isNaN(qr.visualXHalfExtent))continue;let Ku=Ha+qr.visualXHalfExtent+Wt;Pe=Math.max(Pe,Ku)}isNaN(Pe)||(Ir=Pe)}}if(jr){let wt=h.filter(wr=>wr.minXMath.min(lt.y,pt.y));if(wt.length>0){let wr=Math.min(lt.x,pt.x);for(let Le of wt){let Pe=(Le.minX+Le.maxX)/2-Le.visualXHalfExtent-Wt;wr=Math.min(wr,Pe)}St=wr}}}let Ft=b(Wt=>{let wt=pt.y>lt.y,wr=h.filter(Pe=>{let qr=Math.min(lt.x,pt.x)Pe.minX,Ha=Math.min(lt.y,pt.y)Pe.minY;return qr&&Ha}),Le=wr;if(l&&wr.length>0){let Pe=wr.filter(qr=>qr.minXWt);Pe.length>0&&(Le=Pe)}if(Le.length===0)return pt.y;let Ri=rv;if(wt){let qr=Math.max(...Le.map(Ha=>Ha.maxY))+Ri;if(qrHa.minY))-Ri;if(qr>pt.y+En)return qr}return pt.y},"findBestReturnY"),kt=b(Wt=>{let wt=Ft(Wt),wr={x:Wt,y:lt.y},Le={x:Wt,y:wt},Ri={x:pt.x,y:wt},Pe=Me(lt,wr),qr=Me(wr,Le),Ha=Me(Le,Ri),Ku=wt!==pt.y?Me(Ri,pt):!1;return!Pe&&!qr&&!Ha&&!Ku?Math.abs(wt-pt.y)=3){let lt=Qt[Qt.length-1],pt=Qt[Qt.length-2],St=Qt[Qt.length-3],Ir=Math.abs(St.y-pt.y)Math.abs(lt.x-St.x)&&Qt.splice(-2,1)}else if(ur){let gn=Math.sign(pt.y-St.y),Fn=Math.sign(lt.y-St.y);gn!==0&&gn===Fn&&Math.abs(pt.y-St.y)>Math.abs(lt.y-St.y)&&Qt.splice(-2,1)}}let yr=[Qt[0]];for(let lt=1;ltpt.x,gn=Ir.x>St.x;if(ur!==gn){yr.push(St);continue}continue}if(Math.abs(pt.x-St.x)pt.y,gn=Ir.y>St.y;if(ur!==gn){yr.push(St);continue}continue}yr.push(St)}yr.push(Qt[Qt.length-1]);for(let lt=0;ltie.from{let ce=!xe.segments.some(Ie=>(Ie.edgeIndex!==Q.edgeIndex||Ie.segmentIndex!==Q.segmentIndex)&&G(Ie,ie)),ge=!he.segments.some(Ie=>(Ie.edgeIndex!==ie.edgeIndex||Ie.segmentIndex!==ie.segmentIndex)&&G(Ie,Q));return ce&&ge?(ie.trackIndex=xe.index,Q.trackIndex=he.index,he.segments=[...he.segments.filter(Ie=>Ie.edgeIndex!==ie.edgeIndex||Ie.segmentIndex!==ie.segmentIndex),{edgeIndex:Q.edgeIndex,segmentIndex:Q.segmentIndex,from:Q.from,to:Q.to}],xe.segments=[...xe.segments.filter(Ie=>Ie.edgeIndex!==Q.edgeIndex||Ie.segmentIndex!==Q.segmentIndex),{edgeIndex:ie.edgeIndex,segmentIndex:ie.segmentIndex,from:ie.from,to:ie.to}],!0):!1},"trySwapSegmentsAcrossTracks"),H=b(ie=>{let Q=ie.tracks.length;return ie.tracks[Q]={index:Q,coord:ie.coord,segments:[]},Q},"createNewTrack"),j=b((ie,Q)=>{let he=ie.pipe.tracks[ie.trackIndex];he.segments=he.segments.filter(ce=>ce.edgeIndex!==ie.edgeIndex||ce.segmentIndex!==ie.segmentIndex),ie.trackIndex=Q,ie.pipe.tracks[Q].segments.push({edgeIndex:ie.edgeIndex,segmentIndex:ie.segmentIndex,from:ie.from,to:ie.to})},"moveSegmentToTrack"),J=b((ie,Q)=>{let he=g[ie.edgeIndex];for(let xe of he){let ce=m[xe];ce.pipe===ie.pipe&&j(ce,Q)}},"moveSegmentChainToTrack"),U=b(ie=>{let Q=g[ie.edgeIndex],he=Q.indexOf(m.indexOf(ie)),xe=[];return he>0&&xe.push(m[Q[he-1]]),he{if(ie.orientation===Q.orientation)return!1;let he=ie.orientation==="horizontal"?ie:Q,xe=ie.orientation==="horizontal"?Q:ie;return xe.pipe.coord>he.from&&xe.pipe.coordxe.from&&he.pipe.coord{for(let he of ie.tracks)if(!he.segments.some(ce=>(ce.edgeIndex!==Q.edgeIndex||ce.segmentIndex!==Q.segmentIndex)&&G(ce,Q)))return he.index;return-1},"findAvailableTrack"),ue=b((ie,Q)=>{if(ie.trackIndex===Q.trackIndex)return G(ie,Q);let he=U(ie),xe=U(Q);return he.some(ce=>xe.some(ge=>le(ce,ge)))},"segmentsConflict"),ae=b((ie,Q,he)=>{if(z(ie,Q,ie.pipe.tracks[ie.trackIndex],Q.pipe.tracks[Q.trackIndex]))return;let xe=ee(ie.pipe,Q);he(Q,xe!==-1?xe:H(ie.pipe))},"resolveTrackConflict"),oe=b(ie=>{let Q=0;for(let he=0;he{if(Re.has(ie))return Re.get(ie);let Q=g[ie];if(Q.length===0){let ye={dest:0,deviation:0,base:0,delta:0};return Re.set(ie,ye),ye}let xe=m[Q[0]].pipe.coord,ce=xe;for(let ye=1;yeMath.abs(pe-xe)?V:pe;break}}let ge=Math.abs(ce-xe),Ie={dest:ce,deviation:ge,base:xe,delta:ce-xe};return Re.set(ie,Ie),Ie},"getDestInfo"),Oe=b(()=>{let ie=0,Q=new Map;for(let[xe,ce]of i.entries())g[xe].length!==0&&ce.start&&(Q.has(ce.start)||Q.set(ce.start,[]),Q.get(ce.start).push(xe));let he=b(xe=>{let ce=i[xe];if(!ce.start||!ce.end)return 0;let ge=a.get(ce.start),Ie=a.get(ce.end);if(!ge||!Ie)return 0;let ye=(Ie.x??0)-(ge.x??0),ne=(Ie.y??0)-(ge.y??0);return Math.abs(ye)+Math.abs(ne)},"getEdgeDistance");for(let xe of Q.values()){xe.sort((ge,Ie)=>{let ye=Te(ge),ne=Te(Ie);if(Math.abs(ye.deviation-ne.deviation)>1)return ye.deviation-ne.deviation;if(Math.abs(ye.dest-ne.dest)>1)return ye.dest-ne.dest;let V=he(ge),pe=he(Ie);if(Math.abs(V-pe)>1)return pe-V;let K=g[ge].length,ve=g[Ie].length;if(K!==ve)return K-ve;if(K===1){let Z=g[ge][0],je=g[Ie][0];if(m[Z]&&m[je]){let Ne=m[Z],ze=m[je],Fe=Math.abs(Ne.to-Ne.from),Ke=Math.abs(ze.to-ze.from);if(Math.abs(Fe-Ke)>1)return Fe-Ke}}return 0});let ce=xe.map(ge=>m[g[ge][0]]);ie+=oe(ce)}return ie},"fixSourceHandleCrossings"),qe=b(()=>{let ie=0,Q=new Map;for(let[he,xe]of i.entries())g[he].length!==0&&xe.end&&(Q.has(xe.end)||Q.set(xe.end,[]),Q.get(xe.end).push(he));for(let he of Q.values()){he.sort((ce,ge)=>{let Ie=b(V=>{let pe=g[V];if(pe.length<2)return 0;let K=m[pe[pe.length-2]];return Math.abs(K.to-K.from)},"getDist"),ye=Ie(ce),ne=Ie(ge);return Math.abs(ye-ne)>.1?ye-ne:ce-ge});let xe=he.map(ce=>m[g[ce][g[ce].length-1]]);ie+=oe(xe)}return ie},"fixTargetHandleCrossings"),Ge=b(()=>{let ie=0;for(let Q of o){let he=[];for(let xe of Q.tracks)for(let ce of xe.segments){let ge=g[ce.edgeIndex].find(Ie=>m[Ie].segmentIndex===ce.segmentIndex);ge!==void 0&&he.push(m[ge])}he.sort((xe,ce)=>xe.edgeIndex-ce.edgeIndex||xe.segmentIndex-ce.segmentIndex);for(let xe=0;xe{xe.segments.forEach(ce=>{Q.push({edgeIndex:ce.edgeIndex,segmentIndex:ce.segmentIndex,trackIndex:xe.index,from:ce.from,to:ce.to})})}),Q.sort((xe,ce)=>xe.from-ce.from);let he=[];if(Q.length>0){let xe=[Q[0]],ce=Q[0].to;for(let ge=1;gece.add(Z.trackIndex));let ge=new Map;xe.forEach(Z=>{let je=Te(Z.edgeIndex);ge.set(Z.trackIndex,(ge.get(Z.trackIndex)??0)+je.delta)});let Ie=[...ce].filter(Z=>(ge.get(Z)??0)<-1),ye=[...ce].filter(Z=>(ge.get(Z)??0)>1),ne=[...ce].filter(Z=>Math.abs(ge.get(Z)??0)<=1);Ie.sort((Z,je)=>(ge.get(je)??0)-(ge.get(Z)??0)),ye.sort((Z,je)=>(ge.get(Z)??0)-(ge.get(je)??0));let V=b((Z,je)=>{xe.filter(Ne=>Ne.trackIndex===Z).forEach(Ne=>{let ze=y.has(Ne.edgeIndex)?ie.coord:je;_e.set(`${Ne.edgeIndex}-${Ne.segmentIndex}`,ze)})},"assignCoord"),pe=0;for(let Z of Ie)pe++,V(Z,ie.coord-pe*hX);if(ne.length===0&&ce.size>0){let Z=[...ce].sort((ze,Fe)=>Math.abs(ge.get(ze)??0)-Math.abs(ge.get(Fe)??0))[0],je=Ie.indexOf(Z);je!==-1&&Ie.splice(je,1);let Ne=ye.indexOf(Z);Ne!==-1&&ye.splice(Ne,1),ne.push(Z)}let K=0;for(let Z of ne){if(K===0)V(Z,ie.coord);else{let je=K%2===1?1:-1,Ne=Math.ceil(K/2);V(Z,ie.coord+je*Ne*hX*.5)}K++}let ve=0;for(let Z of ye)ve++,V(Z,ie.coord+ve*hX)}}for(let[ie,Q]of i.entries()){let he=g[ie]??[];if(he.length===0)continue;let xe=[],ce=a.get(Q.start),ge=a.get(Q.end),{pSrcPort:Ie,pDstPort:ye}=q(ie,ce,ge),ne=he.map(K=>{let ve=m[K],Z=_e.get(`${ve.edgeIndex}-${ve.segmentIndex}`)??ve.pipe.coord;return{orient:ve.orientation,coord:Z,from:ve.from,to:ve.to}});xe.push(Ie);for(let K=0;KEn&&xe.push(nv(ve,je)),Fe&&ze.orient===ve.orient)if(Math.abs(ve.coord-ze.coord)>En){let Ke=ve.orient==="vertical"?(je+ze.from)/2:WX(ve,ze);xe.push(nv(ve,Ke),nv(ze,Ke))}else(K===0||K===ne.length-2)&&xe.push(nv(ve,WX(ve,ze)));else if(Fe)xe.push(nv(ve,ze.coord));else{let Ke=Math.abs(ve.from-je)En||Math.abs(V.y-ye.y)>En)&&xe.push(ye);let pe=[];xe.length>0&&pe.push(xe[0]);for(let K=1;KEn||Math.abs(ve.y-Z.y)>En)&&pe.push(ve)}Q.points=pe}for(let ie of i){let Q=ie.__originalEdge;Q&&ie.points&&(Q.points=ie.points)}e.edges=(e.edges??[]).filter(ie=>!ie.isLayoutOnly);let de=b((ie,Q)=>{let he=Q.x??0,xe=Q.y??0,ce=Q.width??0,ge=Q.height??0;if(ce<=0||ge<=0)return ie;let Ie=he-ce/2,ye=he+ce/2,ne=xe-ge/2,V=xe+ge/2;if(ie.xye||ie.yV)return ie;let pe=ie.x-Ie,K=ye-ie.x,ve=ie.y-ne,Z=V-ie.y,je=Math.min(pe,K,ve,Z);return je===pe?{x:Ie,y:ie.y}:je===K?{x:ye,y:ie.y}:je===ve?{x:ie.x,y:ne}:{x:ie.x,y:V}},"nodeBoundaryClamp");for(let ie of e.edges){let Q=ie.points;if(!Q||Q.length<2)continue;let he=ie.start,xe=ie.end,ce=he?a.get(he):void 0,ge=xe?a.get(xe):void 0;ce&&(Q[0]=de(Q[0],ce)),ge&&(Q[Q.length-1]=de(Q[Q.length-1],ge))}return e}function tLe(e){return e.direction??"TB"}function rLe(e){let t=F_e(e),r=e.config.flowchart?.nodeSpacing??40,n=e.config.flowchart?.rankSpacing??100,i=e.config.swimlane?.ignoreCrossLaneEdges??!0,a=e.config.swimlane?.optimizeRanksByCrossings??!0,s=e.config.swimlane?.automaticLaneOrdering??!1,o=tLe(e),{ordered:l,coordinates:u}=JRe(t,{nodeGap:r,layerGap:n,ignoreCrossLaneEdges:i,optimizeRanksByCrossings:a,automaticLaneOrdering:s,direction:o});$_e(t,l,u,{nodeGap:r,layerGap:n});for(let h of e.edges??[])delete h.points;eLe(e,o);for(let h of e.edges??[])(!h.curve||h.curve==="basis")&&(h.curve="rounded");return yRe(e,o),gRe(e),o}async function nLe(e,t){let r=t.select("g");w4(r,e.markers,e.type,e.diagramId),DR(),PR(),MR(),$R(),B_e(e);let n=z_e(e);e.nodes=n.nodes,e.edges=n.edges;let{groups:i}=await T_e(r,e);rLe(e),await D_e(e,i)}var y_e,HR,UR,MAt,lX,NAt,v_e,DAt,zs,Xr,OAt,x_e,wh,PAt,YR,BAt,mr,$s,Cn,cX,ig,FAt,tc,b_e,XR,uX,$At,w_e,zAt,GAt,sL,k_e,WRe,En,qAt,rv,k4,jR,Ru,hX,aLe=W(()=>{DY();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();qc();b(T_e,"createGraphWithElements");y_e=5,HR=1e-5,UR=1e-6;b(QR,"buildSegmentList");b(C_e,"segmentIntersection");b(fX,"isHorizontalSeg");b(S_e,"findEdgeIntersections");b(kh,"fmt");b(T4,"pointToString");b(E_e,"getArcSweepFlag");MAt=.001;b(A_e,"applyMarkerOffsets");b(__e,"emitJump");b(dX,"computeRoundedCorner");b(R_e,"rewriteEdgePath");b(L_e,"isStraightPath");b(I_e,"curveSupportsLineHops");b(M_e,"decodeDataPoints");b(N_e,"applyLineJumpsToSvg");b(D_e,"adjustLayout");b(O_e,"positionEdgeLabel");lX="__swimlane_default__",NAt=21,v_e=20;b(pX,"topLaneHorizontalPadding");b(P_e,"assignTopLaneTitleRect");b(B_e,"prepareLayoutForSwimlanes");b(F_e,"toGraphView");b($_e,"writeBackToLayoutData");DAt="[EdgeLabelNodes]";b(z_e,"createEdgeLabelNodes");zs=.001;b(HX,"measuredNodeRect");b(UX,"nodeBoundsInfoFor");b(Lu,"samePoint");b(Nn,"sameX");b(Pn,"sameY");b(_a,"isHorizontalSegment");b(Ra,"isVerticalSegment");b(bl,"overlapLength");b(Hf,"sameAxisSegmentOverlapLength");b(S4,"orthogonalSegmentsForPoints");b(Vc,"countOrthogonalBends");b(Vn,"dedupeConsecutivePoints");b(YX,"classifyThreeSegmentRoute");b(lL,"segmentBoundsOverlapRect");b(XX,"pointInsideRect");b(G_e,"rectContainsRect");b(JR,"rectsOverlap");b(mX,"inflateRect");b(C4,"rectFromCenterSize");b(rc,"rectOfNodeBounds");b(iv,"portForRectSide");b(jX,"buildOrthogonalPortPath");b(KX,"buildSameSideTrackPath");b(cL,"collectRealNodeBounds");b(ag,"collectNodeRectEntries");b(q_e,"collectLayoutNodeRects");b(ZX,"getNodePairGeometry");b(qa,"segmentHitsAnyRect");b(QX,"orthogonalSegmentsCross");b(V_e,"sameAxisSegmentsOverlap");b(eL,"segmentConflictsWithAnyEdge");b(N0,"orthogonalSegmentsStrictlyCross");b(gX,"strictlyBetween");b(W_e,"isCollinearIntermediate");b(H_e,"simplifyPolylineOnce");b(tL,"orthogonalizePolyline");b(Uf,"simplifyPolyline");Xr=.001,OAt=.5,x_e=4;b(JX,"endpointContextFor");b(U_e,"segmentEnterPoint");b(yX,"clipEndpoint");b(Y_e,"clipEdgeEndpointsToNodeBoundaries");b(vX,"snapEndpointToBoundary");b(rL,"firstDistinctAdjacent");b(nL,"cornerClearanceRange");b(xX,"clampToCornerClearance");b(X_e,"intersectRanges");b(bX,"clearanceRangeForSide");b(iL,"terminalSideForSegment");b(cC,"isHorizontalSide");b(j_e,"straightClearanceRange");b(wX,"clearStraightEndpointCornerAxis");b(ej,"clearStraightEndpointCornerConnections");b(K_e,"cornerClearedEndpoint");b(Z_e,"moveCollinearEndpointRun");b(kX,"clearEndpointCornerConnection");b(TX,"borderSideForSegment");b(CX,"leavesOutward");b(SX,"collapseOwnBorderStub");b(Q_e,"snapAndCollapseEndpoints");b(EX,"prepareEdgeEndpointsForRenderer");b(tj,"buildNodeMap");b(J_e,"resolveTopLevelGroupId");b(AX,"groupDepth");b(rj,"boundsForChildren");b(eRe,"applyGroupBounds");b(tRe,"recomputeNestedGroupBounds");b(aL,"mirrorAxis");b(rRe,"applyBtDirectionTransform");b(nRe,"applyLrDirectionTransform");wh=1e-6,PAt=8,YR=PAt,BAt=[0,YR,-YR,2*YR,-2*YR];b(iRe,"portSwapToLShape");b(aRe,"collapseShortTerminalStub");mr=.001,$s=8,Cn=S4,cX=b((e,t)=>Nn(e,t,mr)||Pn(e,t,mr),"orthogonallyAligned");b(sRe,"separateSharedRenderedTerminalLanes");b(oRe,"collapseRedundantRectangularDoglegs");b(_X,"liftObstacleHuggingSameSideRails");b(RX,"liftTopLaneTitleBandsAboveRails");b(LX,"shiftLeftLaneTitleBandsLeftOfRails");b(lRe,"swapDestinationTerminalTailsToReduceCrossings");b(cRe,"reassignCrossingExternalRailChannels");b(uRe,"shortcutRedundantOrthogonalJogs");b(hRe,"resolveRenderedOrthogonalCrossings");ig=.001,FAt=8;b(fRe,"simplifyDetouredEdges");tc=.001,b_e=10,XR=7;b(IX,"markerClearanceRectFor");b(dRe,"normalizeRect");b(MX,"labelOverlapsOwnMarker");b(KR,"anchorLabelsToPolyline");uX=1e-6,$At=8,w_e=$At/2,zAt=3;b(NX,"pairKey");b(pRe,"straightenCollinearSiblingDetours");b(DX,"nudgeSharedInteriorSubpaths");b(mRe,"segmentsIntersect");b(gRe,"validateSwimlanesLayout");b(yRe,"postProcessSwimlaneLayout");b(sg,"normalizeGraph");b(nj,"incoming");b(vRe,"buildSuccessorMap");b(ij,"buildSortedSuccessorMap");b(aj,"buildInDegreeMap");b(sj,"sortedZeroInDegreeNodes");b(uL,"buildPredecessorSuccessorMaps");b(oj,"buildLayersFromRanks");b(uC,"topoSortIfAcyclic");b(E4,"buildLayerIndex");b(lj,"countInversions");b(xRe,"removeCycles_DFS");b(bRe,"buildTopLaneMap");b(D0,"createTopLaneResolver");b(hL,"buildTopLaneOrder");b(cj,"resolveTopLaneOrder");GAt={EPSILON:1e-6},sL={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},k_e={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};b(wRe,"buildDrivingTree");b(kRe,"chooseParent");b(TRe,"buildAdjacency");b(CRe,"assignComponents");b(SRe,"computeBlocks");b(ERe,"popBlock");b(ARe,"computeSubtreeCrossCounts");b(_Re,"annotateMinimumLayers");b(uj,"compareByRankThenId");b(RRe,"emitNodesInTreeOrder");b(LRe,"deduplicateLayers");b(IRe,"createChildOrderer");b(oL,"buildMultitreeLayerOrder");b(MRe,"countCrossingsBetweenAdjacent");b(OX,"totalCrossings");b(NRe,"optimizeRanksByCrossings");b(DRe,"adjustCrossLaneSources");b(ORe,"assignLayers_LongestPath");b(PRe,"assignLayers_Gravity");b(BRe,"topoSortByGenerationIfAcyclic");b(FRe,"assignLayers_LaneAwareCompact");b($Re,"makeProperLayering");b(PX,"median");b(BX,"barycenter");b(zRe,"neighborPositionsFor");b(GRe,"currentOrderTieBreak");b(FX,"countCrossingsBetweenAdjacent");b(ZR,"sortByHeuristic");b($X,"reorderLayer");b(zX,"transposeImprove");b(qRe,"orderLayers");b(VRe,"assignCoordinates");WRe=8;b(HRe,"hashString");b(URe,"mulberry32");b(YRe,"deterministicShuffle");b(XRe,"sourceDistance");b(GX,"laneArrangementCost");b(jRe,"buildWeightedLaneEdges");b(qX,"greedySwitch");b(KRe,"isBetterCandidate");b(ZRe,"seedForRestart");b(QRe,"optimizeTopLaneOrder");b(JRe,"sugiyamaLayout");En=GAt.EPSILON,qAt=8,rv=15,k4=15,jR=25,Ru=20,hX=10;b(VX,"chooseOrthogonalSide");b(WX,"sharedLineEndpointCoord");b(nv,"pointOnLine");b(eLe,"routeEdgesOrthogonal");b(tLe,"getSwimlaneDirection");b(rLe,"runSwimlaneLayoutCore");b(nLe,"render")});function GK(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return s=l.done,l},e:function(l){o=!0,a=l},f:function(){try{s||r.return==null||r.return()}finally{if(o)throw a}}}}function DMe(e,t,r){return(t=OMe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function UAt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function YAt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,s,o=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(o.push(n.value),o.length!==t);l=!0);}catch(h){u=!0,i=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function XAt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jAt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function as(e,t){return VAt(e)||YAt(e,t)||oZ(e,t)||XAt()}function PL(e){return WAt(e)||UAt(e)||oZ(e)||jAt()}function KAt(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function OMe(e){var t=KAt(e,"string");return typeof t=="symbol"?t:t+""}function Ts(e){"@babel/helpers - typeof";return Ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ts(e)}function oZ(e,t){if(e){if(typeof e=="string")return GK(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?GK(e,t):void 0}}function PC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function BC(){if(lLe)return hj;lLe=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return hj=e,hj}function x9t(){if(cLe)return fj;cLe=1;var e=typeof fL=="object"&&fL&&fL.Object===Object&&fL;return fj=e,fj}function ZL(){if(uLe)return dj;uLe=1;var e=x9t(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return dj=r,dj}function b9t(){if(hLe)return pj;hLe=1;var e=ZL(),t=function(){return e.Date.now()};return pj=t,pj}function w9t(){if(fLe)return mj;fLe=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return mj=t,mj}function k9t(){if(dLe)return gj;dLe=1;var e=w9t(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return gj=r,gj}function uZ(){if(pLe)return yj;pLe=1;var e=ZL(),t=e.Symbol;return yj=t,yj}function T9t(){if(mLe)return vj;mLe=1;var e=uZ(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=r.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var h=n.call(s);return u&&(o?s[i]=l:delete s[i]),h}return vj=a,vj}function C9t(){if(gLe)return xj;gLe=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return xj=r,xj}function WMe(){if(yLe)return bj;yLe=1;var e=uZ(),t=T9t(),r=C9t(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?t(o):r(o)}return bj=s,bj}function S9t(){if(vLe)return wj;vLe=1;function e(t){return t!=null&&typeof t=="object"}return wj=e,wj}function FC(){if(xLe)return kj;xLe=1;var e=WMe(),t=S9t(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return kj=n,kj}function E9t(){if(bLe)return Tj;bLe=1;var e=k9t(),t=BC(),r=FC(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var h=typeof u.valueOf=="function"?u.valueOf():u;u=t(h)?h+"":h}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=a.test(u);return f||s.test(u)?o(u.slice(2),f?2:8):i.test(u)?n:+u}return Tj=l,Tj}function A9t(){if(wLe)return Cj;wLe=1;var e=BC(),t=b9t(),r=E9t(),n="Expected a function",i=Math.max,a=Math.min;function s(o,l,u){var h,f,d,p,m,g,y=0,v=!1,x=!1,w=!0;if(typeof o!="function")throw new TypeError(n);l=r(l)||0,e(u)&&(v=!!u.leading,x="maxWait"in u,d=x?i(r(u.maxWait)||0,l):d,w="trailing"in u?!!u.trailing:w);function C(A){var N=h,M=f;return h=f=void 0,y=A,p=o.apply(M,N),p}function T(A){return y=A,m=setTimeout(E,l),v?C(A):p}function k(A){var N=A-g,M=A-y,D=l-N;return x?a(D,d-M):D}function S(A){var N=A-g,M=A-y;return g===void 0||N>=l||N<0||x&&M>=d}function E(){var A=t();if(S(A))return I(A);m=setTimeout(E,k(A))}function I(A){return m=void 0,w&&h?C(A):(h=f=void 0,p)}function L(){m!==void 0&&clearTimeout(m),y=0,h=g=f=m=void 0}function O(){return m===void 0?p:I(t())}function R(){var A=t(),N=S(A);if(h=arguments,f=this,g=A,N){if(m===void 0)return T(g);if(x)return clearTimeout(m),m=setTimeout(E,l),C(g)}return m===void 0&&(m=setTimeout(E,l)),p}return R.cancel=L,R.flush=O,R}return Cj=s,Cj}function M9t(e,t,r,n,i){var a=i*Math.PI/180,s=Math.cos(a)*(e-r)-Math.sin(a)*(t-n)+r,o=Math.sin(a)*(e-r)+Math.cos(a)*(t-n)+n;return{x:s,y:o}}function D9t(e,t,r){if(r===0)return e;var n=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,s=1/a,o=M9t(e.x,e.y,n,i,r),l=N9t(o.x,o.y,n,i,a,s);return{x:l.x,y:l.y}}function H9t(){return ELe||(ELe=1,(function(e,t){(function(){var r,n,i,a,s,o,l,u,h,f,d,p,m,g,y;i=Math.floor,f=Math.min,n=function(v,x){return vx?1:0},h=function(v,x,w,C,T){var k;if(w==null&&(w=0),T==null&&(T=n),w<0)throw new Error("lo must be non-negative");for(C==null&&(C=v.length);wL;0<=L?I++:I--)E.push(I);return E}).apply(this).reverse(),S=[],C=0,T=k.length;CO;0<=O?++E:--E)R.push(s(v,w));return R},g=function(v,x,w,C){var T,k,S;for(C==null&&(C=n),T=v[w];w>x;){if(S=w-1>>1,k=v[S],C(T,k)<0){v[w]=k,w=S;continue}break}return v[w]=T},y=function(v,x,w){var C,T,k,S,E;for(w==null&&(w=n),T=v.length,E=x,k=v[x],C=2*x+1;C-1}return Jj=t,Jj}function FRt(){if(dIe)return eK;dIe=1;var e=nI();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return eK=t,eK}function $Rt(){if(pIe)return tK;pIe=1;var e=DRt(),t=ORt(),r=PRt(),n=BRt(),i=FRt();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o-1&&n%1==0&&n0;){var h=i.shift();t(h),a.add(h.id()),o&&n(i,a,h)}return e}function wNe(e,t,r){if(r.isParent())for(var n=r._private.children,i=0;i0&&arguments[0]!==void 0?arguments[0]:KLt,t=arguments.length>1?arguments[1]:void 0,r=0;r0?R=N:O=N;while(Math.abs(A)>s&&++M=a?x(L,M):D===0?M:C(L,O,O+u)}var k=!1;function S(){k=!0,(e!==t||r!==n)&&w()}var E=function(O){return k||S(),e===t&&r===n?O:O===0?0:O===1?1:y(T(O),t,n)};E.getControlPoints=function(){return[{x:e,y:t},{x:r,y:n}]};var I="generateBezier("+[e,t,r,n]+")";return E.toString=function(){return I},E}function nMe(e,t,r,n,i){if(n===1||t===r)return r;var a=i(t,r,n);return e==null||((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max))),a}function iMe(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function R4(e,t,r,n,i){var a=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var s=iMe(e,i),o=iMe(t,i);if(Zt(s)&&Zt(o))return nMe(a,s,o,r,n);if(Di(s)&&Di(o)){for(var l=[],u=0;u0?(p==="spring"&&m.push(s.duration),s.easingImpl=LL[p].apply(null,m)):s.easingImpl=LL[p]}var g=s.easingImpl,y;if(s.duration===0?y=1:y=(r-l)/s.duration,s.applying&&(y=s.progress),y<0?y=0:y>1&&(y=1),s.delay==null){var v=s.startPosition,x=s.position;if(x&&i&&!e.locked()){var w={};pC(v.x,x.x)&&(w.x=R4(v.x,x.x,y,g)),pC(v.y,x.y)&&(w.y=R4(v.y,x.y,y,g)),e.position(w)}var C=s.startPan,T=s.pan,k=a.pan,S=T!=null&&n;S&&(pC(C.x,T.x)&&(k.x=R4(C.x,T.x,y,g)),pC(C.y,T.y)&&(k.y=R4(C.y,T.y,y,g)),e.emit("pan"));var E=s.startZoom,I=s.zoom,L=I!=null&&n;L&&(pC(E,I)&&(a.zoom=AC(a.minZoom,R4(E,I,y,g),a.maxZoom)),e.emit("zoom")),(S||L)&&e.emit("viewport");var O=s.style;if(O&&O.length>0&&i){for(var R=0;R=0;S--){var E=k[S];E()}k.splice(0,k.length)},x=p.length-1;x>=0;x--){var w=p[x],C=w._private;if(C.stopped){p.splice(x,1),C.hooked=!1,C.playing=!1,C.started=!1,v(C.frames);continue}!C.playing&&!C.applying||(C.playing&&C.applying&&(C.applying=!1),C.started||uIt(h,w,e),cIt(h,w,e,f),C.applying&&(C.applying=!1),v(C.frames),C.step!=null&&C.step(e),w.completed()&&(p.splice(x,1),C.hooked=!1,C.playing=!1,C.started=!1,v(C.completes)),g=!0)}return!f&&p.length===0&&m.length===0&&n.push(h),g}for(var a=!1,s=0;s0?t.notify("draw",r):t.notify("draw")),r.unmerge(n),t.emit("step")}function $Ne(e){this.options=zr({},vIt,xIt,e)}function zNe(e){this.options=zr({},bIt,e)}function GNe(e){this.options=zr({},wIt,e)}function hI(e){this.options=zr({},kIt,e),this.options.layout=this;var t=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var a=i.source().data("id"),s=i.target().data("id"),o=t.some(function(u){return u.data("id")===a}),l=t.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(n)}function HNe(e){this.options=zr({},BIt,e)}function EZ(e){this.options=zr({},FIt,e)}function UNe(e){this.options=zr({},$It,e)}function YNe(e){this.options=zr({},zIt,e)}function XNe(e){this.options=e,this.notifications=0}function ZNe(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function _Z(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(VIt(e,t,r,n,i),{cx:QK,cy:JK,radius:cv,startX:jNe,startY:KNe,stopX:eZ,stopY:tZ,startAngle:jf.ang+Math.PI/2*hv,endAngle:Iu.ang-Math.PI/2*hv,counterClockwise:NL})}function QNe(e){var t=[];if(e!=null){for(var r=0;r5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(a,n/2,i/2);e.beginPath(),e.moveTo(t+s,r),e.lineTo(t+n-s,r),e.quadraticCurveTo(t+n,r,t+n,r+s),e.lineTo(t+n,r+i-s),e.quadraticCurveTo(t+n,r+i,t+n-s,r+i),e.lineTo(t+s,r+i),e.quadraticCurveTo(t,r+i,t,r+i-s),e.lineTo(t,r+s),e.quadraticCurveTo(t,r,t+s,r),e.closePath()}function SMe(e,t,r){var n=e.createShader(t);if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(n));return n}function DMt(e,t,r){var n=SMe(e,e.VERTEX_SHADER,t),i=SMe(e,e.FRAGMENT_SHADER,r),a=e.createProgram();if(e.attachShader(a,n),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function OMt(e,t,r){r===void 0&&(r=t);var n=e.makeOffscreenCanvas(t,r),i=n.context=n.getContext("2d");return n.clear=function(){return i.clearRect(0,0,n.width,n.height)},n.clear(),n}function IZ(e){var t=e.pixelRatio,r=e.cy.zoom(),n=e.cy.pan();return{zoom:r*t,pan:{x:n.x*t,y:n.y*t}}}function PMt(e){var t=e.pixelRatio,r=e.cy.zoom();return r*t}function BMt(e,t,r,n,i){var a=n*r+t.x,s=i*r+t.y;return s=Math.round(e.canvasHeight-s),[a,s]}function FMt(e,t){return t.picking?!0:e.pstyle("background-fill").value!=="solid"||e.pstyle("background-image").strValue!=="none"?!1:e.pstyle("border-width").value===0||e.pstyle("border-opacity").value===0?!0:e.pstyle("border-style").value==="solid"}function $Mt(e,t){if(e.length!==t.length)return!1;for(var r=0;r>0&255)/255,r[1]=(e>>8&255)/255,r[2]=(e>>16&255)/255,r[3]=(e>>24&255)/255,r}function zMt(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function GMt(e,t){var r=e.createTexture();return r.buffer=function(n){e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},r.deleteTexture=function(){e.deleteTexture(r)},r}function fDe(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function dDe(e,t,r){switch(t){case e.FLOAT:return new Float32Array(r);case e.INT:return new Int32Array(r)}}function qMt(e,t,r,n,i,a){switch(t){case e.FLOAT:return new Float32Array(r.buffer,a*n,i);case e.INT:return new Int32Array(r.buffer,a*n,i)}}function VMt(e,t,r,n){var i=fDe(e,t),a=as(i,2),s=a[0],o=a[1],l=dDe(e,o,n),u=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,l,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(r,s,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(r,s,o,0,0),e.enableVertexAttribArray(r),e.bindBuffer(e.ARRAY_BUFFER,null),u}function Xf(e,t,r,n){var i=fDe(e,r),a=as(i,3),s=a[0],o=a[1],l=a[2],u=dDe(e,o,t*s),h=s*l,f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,t*h,e.DYNAMIC_DRAW),e.enableVertexAttribArray(n),o===e.FLOAT?e.vertexAttribPointer(n,s,o,!1,h,0):o===e.INT&&e.vertexAttribIPointer(n,s,o,h,0),e.vertexAttribDivisor(n,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=new Array(t),p=0;poDe?(sNt(e),t.call(e,a)):(oNt(e),yDe(e,a,TC.SCREEN)))}}{var r=e.matchCanvasSize;e.matchCanvasSize=function(a){r.call(e,a),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(a,s,o,l){return dNt(e,a,s)};{var n=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){n.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var i=e.notify;e.notify=function(a,s){i.call(e,a,s),a==="viewport"||a==="bounds"?e.pickingFrameBuffer.needsDraw=!0:a==="background"&&e.drawing.invalidate(s,{type:"node-body"})}}}function sNt(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function oNt(e){var t=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,e.canvasWidth,e.canvasHeight),n.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function lNt(e){var t=e.canvasWidth,r=e.canvasHeight,n=IZ(e),i=n.pan,a=n.zoom,s=OK();OL(s,s,[i.x,i.y]),nZ(s,s,[a,a]);var o=OK();YMt(o,t,r);var l=OK();return UMt(l,o,s),l}function gDe(e,t){var r=e.canvasWidth,n=e.canvasHeight,i=IZ(e),a=i.pan,s=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,r,n),t.translate(a.x,a.y),t.scale(s,s)}function cNt(e,t){e.drawSelectionRectangle(t,function(r){return gDe(e,r)})}function uNt(e){var t=e.data.contexts[e.NODE];t.save(),gDe(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function hNt(e){var t=function(i,a,s){for(var o=i.atlasManager.getAtlasCollection(a),l=e.data.contexts[e.NODE],u=o.atlases,h=0;h=0&&C.add(S)}return C}function dNt(e,t,r){var n=fNt(e,t,r),i=e.getCachedZSortedEles(),a,s,o=ic(n),l;try{for(o.s();!(l=o.n()).done;){var u=l.value,h=i[u];if(!a&&h.isNode()&&(a=h),!s&&h.isEdge()&&(s=h),a&&s)break}}catch(f){o.e(f)}finally{o.f()}return[a,s].filter(Boolean)}function zK(e,t,r){var n=e.drawing;t+=1,r.isNode()?(n.drawNode(r,t,"node-underlay"),n.drawNode(r,t,"node-body"),n.drawTexture(r,t,"label"),n.drawNode(r,t,"node-overlay")):(n.drawEdgeLine(r,t),n.drawEdgeArrow(r,t,"source"),n.drawEdgeArrow(r,t,"target"),n.drawTexture(r,t,"label"),n.drawTexture(r,t,"edge-source-label"),n.drawTexture(r,t,"edge-target-label"))}function yDe(e,t,r){var n;e.webglDebug&&(n=performance.now());var i=e.drawing,a=0;if(r.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&cNt(e,t),e.data.canvasNeedsRedraw[e.NODE]||r.picking){var s=e.data.contexts[e.WEBGL];r.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=lNt(e),l=e.getCachedZSortedEles();if(a=l.length,i.startFrame(o,r),r.screen){for(var u=0;u{ws=typeof window>"u"?null:window,sLe=ws?ws.navigator:null;ws&&ws.document;ZAt=Ts(""),PMe=Ts({}),QAt=Ts(function(){}),JAt=typeof HTMLElement>"u"?"undefined":Ts(HTMLElement),DC=function(t){return t&&t.instanceString&&ya(t.instanceString)?t.instanceString():null},Ar=function(t){return t!=null&&Ts(t)==ZAt},ya=function(t){return t!=null&&Ts(t)===QAt},Di=function(t){return!Wc(t)&&(Array.isArray?Array.isArray(t):t!=null&&t instanceof Array)},Hn=function(t){return t!=null&&Ts(t)===PMe&&!Di(t)&&t.constructor===Object},e9t=function(t){return t!=null&&Ts(t)===PMe},Zt=function(t){return t!=null&&Ts(t)===Ts(1)&&!isNaN(t)},t9t=function(t){return Zt(t)&&Math.floor(t)===t},BL=function(t){if(JAt!=="undefined")return t!=null&&t instanceof HTMLElement},Wc=function(t){return OC(t)||BMe(t)},OC=function(t){return DC(t)==="collection"&&t._private.single},BMe=function(t){return DC(t)==="collection"&&!t._private.single},lZ=function(t){return DC(t)==="core"},FMe=function(t){return DC(t)==="stylesheet"},r9t=function(t){return DC(t)==="event"},mg=function(t){return t==null?!0:!!(t===""||t.match(/^\s+$/))},n9t=function(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement},i9t=function(t){return Hn(t)&&Zt(t.x1)&&Zt(t.x2)&&Zt(t.y1)&&Zt(t.y2)},a9t=function(t){return e9t(t)&&ya(t.then)},s9t=function(){return sLe&&sLe.userAgent.match(/msie|trident|edge/i)},q4=function(t,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var a=[],s=0;sr?1:0},d9t=function(t,r){return-1*zMe(t,r)},zr=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,r=1;r1&&(y-=1),y<1/6?m+(g-m)*6*y:y<1/2?g:y<2/3?m+(g-m)*(2/3-y)*6:m}var f=new RegExp("^"+c9t+"$").exec(t);if(f){if(n=parseInt(f[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(f[2]),i<0||i>100||(i=i/100,a=parseFloat(f[3]),a<0||a>100)||(a=a/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(i===0)o=l=u=Math.round(a*255);else{var d=a<.5?a*(1+i):a+i-a*i,p=2*a-d;o=Math.round(255*h(p,d,n+1/3)),l=Math.round(255*h(p,d,n)),u=Math.round(255*h(p,d,n-1/3))}r=[o,l,u,s]}return r},g9t=function(t){var r,n=new RegExp("^"+o9t+"$").exec(t);if(n){r=[];for(var i=[],a=1;a<=3;a++){var s=n[a];if(s[s.length-1]==="%"&&(i[a]=!0),s=parseFloat(s),i[a]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(o&&!l)return;var u=n[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},y9t=function(t){return v9t[t.toLowerCase()]},GMe=function(t){return(Di(t)?t:null)||y9t(t)||p9t(t)||g9t(t)||m9t(t)},v9t={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},qMe=function(t){for(var r=t.map,n=t.keys,i=n.length,a=0;a1&&arguments[1]!==void 0?arguments[1]:uv,n=r,i;i=t.next(),!i.done;)n=n*UMe+i.value|0;return n},CC=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:uv;return r*UMe+t|0},SC=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:D4;return(r<<5)+r+t|0},L9t=function(t,r){return t*2097152+r},og=function(t){return t[0]*2097152+t[1]},dL=function(t,r){return[CC(t[0],r[0]),SC(t[1],r[1])]},kLe=function(t,r){var n={value:0,done:!1},i=0,a=t.length,s={next:function(){return i=0;i--)t[i]===r&&t.splice(i,1)},dZ=function(t){t.splice(0,t.length)},z9t=function(t,r){for(var n=0;n"u"?"undefined":Ts(Set))!==q9t?Set:V9t,QL=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(t===void 0||r===void 0||!lZ(t)){ca("An element must have a core reference and parameters set");return}var i=r.group;if(i==null&&(r.data&&r.data.source!=null&&r.data.target!=null?i="edges":i="nodes"),i!=="nodes"&&i!=="edges"){ca("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var a=this._private={cy:t,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?i==="edges":!!r.pannable,active:!1,classes:new Y4,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=t.pan(),l=t.zoom();a.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];Di(r.classes)?u=r.classes:Ar(r.classes)&&(u=r.classes.split(/\s+/));for(var h=0,f=u.length;h0;){var k=x.pop(),S=y(k),E=k.id();if(d[E]=S,S!==1/0)for(var I=k.neighborhood().intersect(m),L=0;L0)for(P.unshift(B);f[F];){var q=f[F];P.unshift(q.edge),P.unshift(q.node),$=q.node,F=$.id()}return o.spawn(P)}}}},K9t={kruskal:function(t){t=t||function(w){return 1};for(var r=this.byGroup(),n=r.nodes,i=r.edges,a=n.length,s=new Array(a),o=n,l=function(C){for(var T=0;T0;){if(T(),S++,C===h){for(var E=[],I=a,L=h,O=v[L];E.unshift(I),O!=null&&E.unshift(O),I=y[L],I!=null;)L=I.id(),O=v[L];return{found:!0,distance:f[C],path:this.spawn(E),steps:S}}p[C]=!0;for(var R=w._private.edges,A=0;AO&&(m[L]=O,x[L]=I,w[L]=T),!a){var R=I*h+E;!a&&m[R]>O&&(m[R]=O,x[R]=E,w[R]=T)}}}for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:s,_e=w(fe),de=[],ie=_e;;){if(ie==null)return r.spawn();var Q=x(ie),he=Q.edge,xe=Q.pred;if(de.unshift(ie[0]),ie.same(Ce)&&de.length>0)break;he!=null&&de.unshift(he),ie=xe}return l.spawn(de)},k=0;k=0;h--){var f=u[h],d=f[1],p=f[2];(r[d]===o&&r[p]===l||r[d]===l&&r[p]===o)&&u.splice(h,1)}for(var m=0;mi;){var a=Math.floor(Math.random()*r.length);r=i_t(a,t,r),n--}return r},a_t={kargerStein:function(){var t=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function(P){return P.isLoop()});var a=n.length,s=i.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),l=Math.floor(a/n_t);if(a<2){ca("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],h=0;h1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=-1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=0,a=0,s=r;s1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?t=t.slice(r,n):(n0&&t.splice(0,r));for(var o=0,l=t.length-1;l>=0;l--){var u=t[l];s?isFinite(u)||(t[l]=-1/0,o++):t.splice(l,1)}a&&t.sort(function(d,p){return d-p});var h=t.length,f=Math.floor(h/2);return h%2!==0?t[f+1+o]:(t[f-1+o]+t[f+o])/2},h_t=function(t){return Math.PI*t/180},pL=function(t,r){return Math.atan2(r,t)-Math.PI/2},pZ=Math.log2||function(e){return Math.log(e)/Math.log(2)},mZ=function(t){return t>0?1:t<0?-1:0},pv=function(t,r){return Math.sqrt(lv(t,r))},lv=function(t,r){var n=r.x-t.x,i=r.y-t.y;return n*n+i*i},f_t=function(t){for(var r=t.length,n=0,i=0;i=t.x1&&t.y2>=t.y1)return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,w:t.x2-t.x1,h:t.y2-t.y1};if(t.w!=null&&t.h!=null&&t.w>=0&&t.h>=0)return{x1:t.x1,y1:t.y1,x2:t.x1+t.w,y2:t.y1+t.h,w:t.w,h:t.h}}},p_t=function(t){return{x1:t.x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h}},m_t=function(t){t.x1=1/0,t.y1=1/0,t.x2=-1/0,t.y2=-1/0,t.w=0,t.h=0},g_t=function(t,r){t.x1=Math.min(t.x1,r.x1),t.x2=Math.max(t.x2,r.x2),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,r.y1),t.y2=Math.max(t.y2,r.y2),t.h=t.y2-t.y1},eNe=function(t,r,n){t.x1=Math.min(t.x1,r),t.x2=Math.max(t.x2,r),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,n),t.y2=Math.max(t.y2,n),t.h=t.y2-t.y1},EL=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.x1-=r,t.x2+=r,t.y1-=r,t.y2+=r,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},AL=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,i,a,s;if(r.length===1)n=i=a=s=r[0];else if(r.length===2)n=a=r[0],s=i=r[1];else if(r.length===4){var o=as(r,4);n=o[0],i=o[1],a=o[2],s=o[3]}return t.x1-=s,t.x2+=i,t.y1-=n,t.y2+=a,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},_Le=function(t,r){t.x1=r.x1,t.y1=r.y1,t.x2=r.x2,t.y2=r.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1},gZ=function(t,r){return!(t.x1>r.x2||r.x1>t.x2||t.x2r.y2||r.y1>t.y2)},hg=function(t,r,n){return t.x1<=r&&r<=t.x2&&t.y1<=n&&n<=t.y2},RLe=function(t,r){return hg(t,r.x,r.y)},tNe=function(t,r){return hg(t,r.x1,r.y1)&&hg(t,r.x2,r.y2)},y_t=(_j=Math.hypot)!==null&&_j!==void 0?_j:function(e,t){return Math.sqrt(e*e+t*t)};rNe=function(t,r,n,i,a,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?yg(a,s):l,h=a/2,f=s/2;u=Math.min(u,h,f);var d=u!==h,p=u!==f,m;if(d){var g=n-h+u-o,y=i-f-o,v=n+h-u+o,x=y;if(m=fg(t,r,n,i,g,y,v,x,!1),m.length>0)return m}if(p){var w=n+h+o,C=i-f+u-o,T=w,k=i+f-u+o;if(m=fg(t,r,n,i,w,C,T,k,!1),m.length>0)return m}if(d){var S=n-h+u-o,E=i+f+o,I=n+h-u+o,L=E;if(m=fg(t,r,n,i,S,E,I,L,!1),m.length>0)return m}if(p){var O=n-h-o,R=i-f+u-o,A=O,N=i+f-u+o;if(m=fg(t,r,n,i,O,R,A,N,!1),m.length>0)return m}var M;{var D=n-h+u,B=i-f+u;if(M=vC(t,r,n,i,D,B,u+o),M.length>0&&M[0]<=D&&M[1]<=B)return[M[0],M[1]]}{var P=n+h-u,$=i-f+u;if(M=vC(t,r,n,i,P,$,u+o),M.length>0&&M[0]>=P&&M[1]<=$)return[M[0],M[1]]}{var F=n+h-u,q=i+f-u;if(M=vC(t,r,n,i,F,q,u+o),M.length>0&&M[0]>=F&&M[1]>=q)return[M[0],M[1]]}{var G=n-h+u,z=i+f-u;if(M=vC(t,r,n,i,G,z,u+o),M.length>0&&M[0]<=G&&M[1]>=z)return[M[0],M[1]]}return[]},b_t=function(t,r,n,i,a,s,o){var l=o,u=Math.min(n,a),h=Math.max(n,a),f=Math.min(i,s),d=Math.max(i,s);return u-l<=t&&t<=h+l&&f-l<=r&&r<=d+l},w_t=function(t,r,n,i,a,s,o,l,u){var h={x1:Math.min(n,o,a)-u,x2:Math.max(n,o,a)+u,y1:Math.min(i,l,s)-u,y2:Math.max(i,l,s)+u};return!(th.x2||rh.y2)},k_t=function(t,r,n,i){n-=i;var a=r*r-4*t*n;if(a<0)return[];var s=Math.sqrt(a),o=2*t,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},T_t=function(t,r,n,i,a){var s=1e-5;t===0&&(t=s),r/=t,n/=t,i/=t;var o,l,u,h,f,d,p,m;if(l=(3*n-r*r)/9,u=-(27*i)+r*(9*n-2*(r*r)),u/=54,o=l*l*l+u*u,a[1]=0,p=r/3,o>0){f=u+Math.sqrt(o),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),d=u-Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-p+f+d,p+=(f+d)/2,a[4]=a[2]=-p,p=Math.sqrt(3)*(-d+f)/2,a[3]=p,a[5]=-p;return}if(a[5]=a[3]=0,o===0){m=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),a[0]=-p+2*m,a[4]=a[2]=-(m+p);return}l=-l,h=l*l*l,h=Math.acos(u/Math.sqrt(h)),m=2*Math.sqrt(l),a[0]=-p+m*Math.cos(h/3),a[2]=-p+m*Math.cos((h+2*Math.PI)/3),a[4]=-p+m*Math.cos((h+4*Math.PI)/3)},C_t=function(t,r,n,i,a,s,o,l){var u=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+i*i-4*i*s+2*i*l+4*s*s-4*s*l+l*l,h=9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*i*s-3*i*i-3*i*l-6*s*s+3*s*l,f=3*n*n-6*n*a+n*o-n*t+2*a*a+2*a*t-o*t+3*i*i-6*i*s+i*l-i*r+2*s*s+2*s*r-l*r,d=1*n*a-n*n+n*t-a*t+i*s-i*i+i*r-s*r,p=[];T_t(u,h,f,d,p);for(var m=1e-7,g=[],y=0;y<6;y+=2)Math.abs(p[y+1])=0&&p[y]<=1&&g.push(p[y]);g.push(1),g.push(0);for(var v=-1,x,w,C,T=0;T=0?Cu?(t-a)*(t-a)+(r-s)*(r-s):h-d},nc=function(t,r,n){for(var i,a,s,o,l,u=0,h=0;h=t&&t>=s||i<=t&&t<=s)l=(t-i)/(s-i)*(o-a)+a,l>r&&u++;else continue;return u%2!==0},F0=function(t,r,n,i,a,s,o,l,u){var h=new Array(n.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var d=Math.cos(-f),p=Math.sin(-f),m=0;m0){var y=GL(h,-u);g=zL(y)}else g=h;return nc(t,r,g)},E_t=function(t,r,n,i,a,s,o,l){for(var u=new Array(n.length*2),h=0;h=0&&y<=1&&x.push(y),v>=0&&v<=1&&x.push(v),x.length===0)return[];var w=x[0]*l[0]+t,C=x[0]*l[1]+r;if(x.length>1){if(x[0]==x[1])return[w,C];var T=x[1]*l[0]+t,k=x[1]*l[1]+r;return[w,C,T,k]}else return[w,C]},Rj=function(t,r,n){return r<=t&&t<=n||n<=t&&t<=r?t:t<=r&&r<=n||n<=r&&r<=t?r:n},fg=function(t,r,n,i,a,s,o,l,u){var h=t-a,f=n-t,d=o-a,p=r-s,m=i-r,g=l-s,y=d*p-g*h,v=f*p-m*h,x=g*f-d*m;if(x!==0){var w=y/x,C=v/x,T=.001,k=0-T,S=1+T;return k<=w&&w<=S&&k<=C&&C<=S?[t+w*f,r+w*m]:u?[t+w*f,r+w*m]:[]}else return y===0||v===0?Rj(t,n,o)===o?[o,l]:Rj(t,n,a)===a?[a,s]:Rj(a,o,n)===n?[n,i]:[]:[]},__t=function(t,r,n,i,a){var s=[],o=i/2,l=a/2,u=r,h=n;s.push({x:u+o*t[0],y:h+l*t[1]});for(var f=1;f0){var g=GL(f,-l);p=zL(g)}else p=f}else p=n;for(var y,v,x,w,C=0;C2){for(var m=[h[0],h[1]],g=Math.pow(m[0]-t,2)+Math.pow(m[1]-r,2),y=1;yh&&(h=C)},get:function(w){return u[w]}},d=0;d0?M=N.edgesTo(A)[0]:M=A.edgesTo(N)[0];var D=i(M);A=A.id(),S[A]>S[O]+D&&(S[A]=S[O]+D,E.nodes.indexOf(A)<0?E.push(A):E.updateItem(A),k[A]=0,T[A]=[]),S[A]==S[O]+D&&(k[A]=k[A]+k[O],T[A].push(O))}else for(var B=0;B0;){for(var q=C.pop(),G=0;G0&&o.push(n[l]);o.length!==0&&a.push(i.collection(o))}return a},V_t=function(t,r){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:U_t,o=i,l,u,h=0;h=2?hC(t,r,n,0,DLe,Y_t):hC(t,r,n,0,NLe)},squaredEuclidean:function(t,r,n){return hC(t,r,n,0,DLe)},manhattan:function(t,r,n){return hC(t,r,n,0,NLe)},max:function(t,r,n){return hC(t,r,n,-1/0,X_t)}};V4["squared-euclidean"]=V4.squaredEuclidean;V4.squaredeuclidean=V4.squaredEuclidean;j_t=yo({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),vZ=function(t){return j_t(t)},qL=function(t,r,n,i,a){var s=a!=="kMedoids",o=s?function(f){return n[f]}:function(f){return i[f](n)},l=function(d){return i[d](r)},u=n,h=r;return eI(t,i.length,o,l,u,h)},Ij=function(t,r,n){for(var i=n.length,a=new Array(i),s=new Array(i),o=new Array(r),l=null,u=0;un)return!1}return!0},Q_t=function(t,r,n){for(var i=0;io&&(o=r[u][h],l=h);a[l].push(t[u])}for(var f=0;f=a.threshold||a.mode==="dendrogram"&&t.length===1)return!1;var m=r[s],g=r[i[s]],y;a.mode==="dendrogram"?y={left:m,right:g,key:m.key}:y={value:m.value.concat(g.value),key:m.key},t[m.index]=y,t.splice(g.index,1),r[m.key]=y;for(var v=0;vn[g.key][x.key]&&(l=n[g.key][x.key])):a.linkage==="max"?(l=n[m.key][x.key],n[m.key][x.key]0&&i.push(a);return i},zLe=function(t,r,n){for(var i=[],a=0;ao&&(s=u,o=r[a*t+u])}s>0&&i.push(s)}for(var h=0;hu&&(l=h,u=f)}n[a]=s[l]}return i=zLe(t,r,n),i},GLe=function(t){for(var r=this.cy(),n=this.nodes(),i=uRt(t),a={},s=0;s=O?(R=O,O=N,A=M):N>R&&(R=N);for(var D=0;D0?1:0;S[I%i.minIterations*o+G]=z,q+=z}if(q>0&&(I>=i.minIterations-1||I==i.maxIterations-1)){for(var H=0,j=0;j1||k>1)&&(o=!0),f[w]=[],x.outgoers().forEach(function(E){E.isEdge()&&f[w].push(E.id())})}else d[w]=[void 0,x.target().id()]}):s.forEach(function(x){var w=x.id();if(x.isNode()){var C=x.degree(!0);C%2&&(l?u?o=!0:u=w:l=w),f[w]=[],x.connectedEdges().forEach(function(T){return f[w].push(T.id())})}else d[w]=[x.source().id(),x.target().id()]});var p={found:!1,trail:void 0};if(o)return p;if(u&&l)if(a){if(h&&u!=h)return p;h=u}else{if(h&&u!=h&&l!=h)return p;h||(h=u)}else h||(h=s[0].id());var m=function(w){for(var C=w,T=[w],k,S,E;f[C].length;)k=f[C].shift(),S=d[k][0],E=d[k][1],C!=E?(f[E]=f[E].filter(function(I){return I!=k}),C=E):!a&&C!=S&&(f[S]=f[S].filter(function(I){return I!=k}),C=S),T.unshift(k),T.unshift(C);return T},g=[],y=[];for(y=m(h);y.length!=1;)f[y[0]].length==0?(g.unshift(s.getElementById(y.shift())),g.unshift(s.getElementById(y.shift()))):y=m(y.shift()).concat(y);g.unshift(s.getElementById(y.shift()));for(var v in f)if(f[v].length)return p;return p.found=!0,p.trail=this.spawn(g,!0),p}},gL=function(){var t=this,r={},n=0,i=0,a=[],s=[],o={},l=function(d,p){for(var m=s.length-1,g=[],y=t.spawn();s[m].x!=d||s[m].y!=p;)g.push(s.pop().edge),m--;g.push(s.pop().edge),g.forEach(function(v){var x=v.connectedNodes().intersection(t);y.merge(v),x.forEach(function(w){var C=w.id(),T=w.connectedEdges().intersection(t);y.merge(w),r[C].cutVertex?y.merge(T.filter(function(k){return k.isLoop()})):y.merge(T)})}),a.push(y)},u=function(d,p,m){d===m&&(i+=1),r[p]={id:n,low:n++,cutVertex:!1};var g=t.getElementById(p).connectedEdges().intersection(t);if(g.size()===0)a.push(t.spawn(t.getElementById(p)));else{var y,v,x,w;g.forEach(function(C){y=C.source().id(),v=C.target().id(),x=y===p?v:y,x!==m&&(w=C.id(),o[w]||(o[w]=!0,s.push({x:p,y:x,edge:C})),x in r?r[p].low=Math.min(r[p].low,r[x].id):(u(d,x,p),r[p].low=Math.min(r[p].low,r[x].low),r[p].id<=r[x].low&&(r[p].cutVertex=!0,l(p,x))))})}};t.forEach(function(f){if(f.isNode()){var d=f.id();d in r||(i=0,u(d,d),r[d].cutVertex=i>1)}});var h=Object.keys(r).filter(function(f){return r[f].cutVertex}).map(function(f){return t.getElementById(f)});return{cut:t.spawn(h),components:a}},vRt={hopcroftTarjanBiconnected:gL,htbc:gL,htb:gL,hopcroftTarjanBiconnectedComponents:gL},yL=function(){var t=this,r={},n=0,i=[],a=[],s=t.spawn(t),o=function(u){a.push(u),r[u]={index:n,low:n++,explored:!1};var h=t.getElementById(u).connectedEdges().intersection(t);if(h.forEach(function(g){var y=g.target().id();y!==u&&(y in r||o(y),r[y].explored||(r[u].low=Math.min(r[u].low,r[y].low)))}),r[u].index===r[u].low){for(var f=t.spawn();;){var d=a.pop();if(f.merge(t.getElementById(d)),r[d].low=r[u].index,r[d].explored=!0,d===u)break}var p=f.edgesWith(f),m=f.merge(p);i.push(m),s=s.difference(m)}};return t.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:i}},xRt={tarjanStronglyConnected:yL,tsc:yL,tscc:yL,tarjanStronglyConnectedComponents:yL},cNe={};[EC,j9t,K9t,Q9t,e_t,r_t,a_t,M_t,$4,z4,WK,H_t,iRt,lRt,mRt,yRt,vRt,xRt].forEach(function(e){zr(cNe,e)});uNe=0,hNe=1,fNe=2,Sh=function(t){if(!(this instanceof Sh))return new Sh(t);this.id="Thenable/1.0.7",this.state=uNe,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Sh.prototype={fulfill:function(t){return qLe(this,hNe,"fulfillValue",t)},reject:function(t){return qLe(this,fNe,"rejectReason",t)},then:function(t,r){var n=this,i=new Sh;return n.onFulfilled.push(WLe(t,i,"fulfill")),n.onRejected.push(WLe(r,i,"reject")),dNe(n),i.proxy}};qLe=function(t,r,n,i){return t.state===uNe&&(t.state=r,t[n]=i,dNe(t)),t},dNe=function(t){t.state===hNe?VLe(t,"onFulfilled",t.fulfillValue):t.state===fNe&&VLe(t,"onRejected",t.rejectReason)},VLe=function(t,r,n){if(t[r].length!==0){var i=t[r];t[r]=[];var a=function(){for(var o=0;o0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var s=0;s0&&this.spawn(i).updateStyle().emit("class"),r},addClass:function(t){return this.toggleClass(t,!0)},hasClass:function(t){var r=this[0];return r!=null&&r._private.classes.has(t)},toggleClass:function(t,r){Di(t)||(t=t.match(/\S+/g)||[]);for(var n=this,i=r===void 0,a=[],s=0,o=n.length;s0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(t){return this.toggleClass(t,!1)},flashClass:function(t,r){var n=this;if(r==null)r=250;else if(r===0)return n;return n.addClass(t),setTimeout(function(){n.removeClass(t)},r),n}};_L.className=_L.classNames=_L.classes;Wn={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:ks,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Wn.variable="(?:[\\w-.]|(?:\\\\"+Wn.metaChar+"))+";Wn.className="(?:[\\w-]|(?:\\\\"+Wn.metaChar+"))+";Wn.value=Wn.string+"|"+Wn.number;Wn.id=Wn.variable;(function(){var e,t,r;for(e=Wn.comparatorOp.split("|"),r=0;r=0)&&t!=="="&&(Wn.comparatorOp+="|\\!"+t)})();Ei=function(){return{checks:[]}},fr={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},XK=[{selector:":selected",matches:function(t){return t.selected()}},{selector:":unselected",matches:function(t){return!t.selected()}},{selector:":selectable",matches:function(t){return t.selectable()}},{selector:":unselectable",matches:function(t){return!t.selectable()}},{selector:":locked",matches:function(t){return t.locked()}},{selector:":unlocked",matches:function(t){return!t.locked()}},{selector:":visible",matches:function(t){return t.visible()}},{selector:":hidden",matches:function(t){return!t.visible()}},{selector:":transparent",matches:function(t){return t.transparent()}},{selector:":grabbed",matches:function(t){return t.grabbed()}},{selector:":free",matches:function(t){return!t.grabbed()}},{selector:":removed",matches:function(t){return t.removed()}},{selector:":inside",matches:function(t){return!t.removed()}},{selector:":grabbable",matches:function(t){return t.grabbable()}},{selector:":ungrabbable",matches:function(t){return!t.grabbable()}},{selector:":animated",matches:function(t){return t.animated()}},{selector:":unanimated",matches:function(t){return!t.animated()}},{selector:":parent",matches:function(t){return t.isParent()}},{selector:":childless",matches:function(t){return t.isChildless()}},{selector:":child",matches:function(t){return t.isChild()}},{selector:":orphan",matches:function(t){return t.isOrphan()}},{selector:":nonorphan",matches:function(t){return t.isChild()}},{selector:":compound",matches:function(t){return t.isNode()?t.isParent():t.source().isParent()||t.target().isParent()}},{selector:":loop",matches:function(t){return t.isLoop()}},{selector:":simple",matches:function(t){return t.isSimple()}},{selector:":active",matches:function(t){return t.active()}},{selector:":inactive",matches:function(t){return!t.active()}},{selector:":backgrounding",matches:function(t){return t.backgrounding()}},{selector:":nonbackgrounding",matches:function(t){return!t.backgrounding()}}].sort(function(e,t){return d9t(e.selector,t.selector)}),gLt=(function(){for(var e={},t,r=0;r0&&h.edgeCount>0)return yi("The selector `"+t+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return yi("The selector `"+t+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&yi("The selector `"+t+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},kLt=function(){if(this.toStringCache!=null)return this.toStringCache;for(var t=function(h){return h??""},r=function(h){return Ar(h)?'"'+h+'"':t(h)},n=function(h){return" "+h+" "},i=function(h,f){var d=h.type,p=h.value;switch(d){case fr.GROUP:{var m=t(p);return m.substring(0,m.length-1)}case fr.DATA_COMPARE:{var g=h.field,y=h.operator;return"["+g+n(t(y))+r(p)+"]"}case fr.DATA_BOOL:{var v=h.operator,x=h.field;return"["+t(v)+x+"]"}case fr.DATA_EXIST:{var w=h.field;return"["+w+"]"}case fr.META_COMPARE:{var C=h.operator,T=h.field;return"[["+T+n(t(C))+r(p)+"]]"}case fr.STATE:return p;case fr.ID:return"#"+p;case fr.CLASS:return"."+p;case fr.PARENT:case fr.CHILD:return a(h.parent,f)+n(">")+a(h.child,f);case fr.ANCESTOR:case fr.DESCENDANT:return a(h.ancestor,f)+" "+a(h.descendant,f);case fr.COMPOUND_SPLIT:{var k=a(h.left,f),S=a(h.subject,f),E=a(h.right,f);return k+(k.length>0?" ":"")+S+E}case fr.TRUE:return""}},a=function(h,f){return h.checks.reduce(function(d,p,m){return d+(f===h&&m===0?"$":"")+i(p,f)},"")},s="",o=0;o1&&o=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(a||o||h)&&(l=!a&&!s?"":""+t,u=""+n),h&&(t=l=l.toLowerCase(),n=u=u.toLowerCase()),r){case"*=":i=l.indexOf(u)>=0;break;case"$=":i=l.indexOf(u,l.length-u.length)>=0;break;case"^=":i=l.indexOf(u)===0;break;case"=":i=t===n;break;case">":d=!0,i=t>n;break;case">=":d=!0,i=t>=n;break;case"<":d=!0,i=t1&&arguments[1]!==void 0?arguments[1]:!0;return kZ(this,e,t,wNe)};W4.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return kZ(this,e,t,kNe)};W4.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return kZ(this,e,t,LLt)};W4.ancestors=W4.parents;RC=TNe={data:gi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:gi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:gi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:gi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:gi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:gi.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var t=this[0];if(t)return t._private.data.id}};RC.attr=RC.data;RC.removeAttr=RC.removeData;ILt=TNe,aI={};zr(aI,{degree:RK(function(e,t){return t.source().same(t.target())?2:1}),indegree:RK(function(e,t){return t.target().same(e)?1:0}),outdegree:RK(function(e,t){return t.source().same(e)?1:0})});zr(aI,{minDegree:_4("degree",function(e,t){return et}),minIndegree:_4("indegree",function(e,t){return et}),minOutdegree:_4("outdegree",function(e,t){return et})});zr(aI,{totalDegree:function(t){for(var r=0,n=this.nodes(),i=0;i0,d=f;f&&(h=h[0]);var p=d?h.position():{x:0,y:0};r!==void 0?u.position(t,r+p[t]):a!==void 0&&u.position({x:a.x+p.x,y:a.y+p.y})}else{var m=n.position(),g=o?n.parent():null,y=g&&g.length>0,v=y;y&&(g=g[0]);var x=v?g.position():{x:0,y:0};return a={x:m.x-x.x,y:m.y-x.y},t===void 0?a:a[t]}else if(!s)return;return this}};Ch.modelPosition=Ch.point=Ch.position;Ch.modelPositions=Ch.points=Ch.positions;Ch.renderedPoint=Ch.renderedPosition;Ch.relativePoint=Ch.relativePosition;MLt=CNe,H4=function(t){switch(t){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},U4=function(t){switch(t){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},NLt=function(t){switch(t){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}};G4=Tg={};Tg.renderedBoundingBox=function(e){var t=this.boundingBox(e),r=this.cy(),n=r.zoom(),i=r.pan(),a=t.x1*n+i.x,s=t.x2*n+i.x,o=t.y1*n+i.y,l=t.y2*n+i.y;return{x1:a,x2:s,y1:o,y2:l,w:s-a,h:l-o}};Tg.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,e||r.emitAndNotify("bounds")}}),this)};Tg.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),d=o.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=d.x-f.w/2,f.x2=d.x+f.w/2,f.y1=d.y-f.h/2,f.y2=d.y+f.h/2);function p(I,L,O){var R=0,A=0,N=L+O;return I>0&&N>0&&(R=L/N*I,A=O/N*I),{biasDiff:R,biasComplementDiff:A}}function m(I,L,O,R){if(O.units==="%")switch(R){case"width":return I>0?O.pfValue*I:0;case"height":return L>0?O.pfValue*L:0;case"average":return I>0&&L>0?O.pfValue*(I+L)/2:0;case"min":return I>0&&L>0?I>L?O.pfValue*L:O.pfValue*I:0;case"max":return I>0&&L>0?I>L?O.pfValue*I:O.pfValue*L:0;default:return 0}else return O.units==="px"?O.pfValue:0}var g=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(g=g*100/h.width.val);var y=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(y=y*100/h.width.val);var v=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(v=v*100/h.height.val);var x=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(x=x*100/h.height.val);var w=p(h.width.val-f.w,g,y),C=w.biasDiff,T=w.biasComplementDiff,k=p(h.height.val-f.h,v,x),S=k.biasDiff,E=k.biasComplementDiff;o.autoPadding=m(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,h.width.val),d.x=(-C+f.x1+f.x2+T)/2,o.autoHeight=Math.max(f.h,h.height.val),d.y=(-S+f.y1+f.y2+E)/2}for(var n=0;nt.x2?i:t.x2,t.y1=nt.y2?a:t.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1)},cg=function(t,r){return r==null?t:Th(t,r.x1,r.y1,r.x2,r.y2)},fC=function(t,r,n){return kl(t,r,n)},vL=function(t,r,n){if(!r.cy().headless()){var i=r._private,a=i.rstyle,s=a.arrowWidth/2,o=r.pstyle(n+"-arrow-shape").value,l,u;if(o!=="none"){n==="source"?(l=a.srcX,u=a.srcY):n==="target"?(l=a.tgtX,u=a.tgtY):(l=a.midX,u=a.midY);var h=i.arrowBounds=i.arrowBounds||{},f=h[n]=h[n]||{};f.x1=l-s,f.y1=u-s,f.x2=l+s,f.y2=u+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,EL(f,1),Th(t,f.x1,f.y1,f.x2,f.y2)}}},LK=function(t,r,n){if(!r.cy().headless()){var i;n?i=n+"-":i="";var a=r._private,s=a.rstyle,o=r.pstyle(i+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),h=fC(s,"labelWidth",n),f=fC(s,"labelHeight",n),d=fC(s,"labelX",n),p=fC(s,"labelY",n),m=r.pstyle(i+"text-margin-x").pfValue,g=r.pstyle(i+"text-margin-y").pfValue,y=r.isEdge(),v=r.pstyle(i+"text-rotation"),x=r.pstyle("text-outline-width").pfValue,w=r.pstyle("text-border-width").pfValue,C=w/2,T=r.pstyle("text-background-padding").pfValue,k=2,S=f,E=h,I=E/2,L=S/2,O,R,A,N;if(y)O=d-I,R=d+I,A=p-L,N=p+L;else{switch(H4(l.value)){case"left":O=d-E,R=d;break;case"center":O=d-I,R=d+I;break;case"right":O=d,R=d+E;break}switch(U4(u.value)){case"top":A=p-S,N=p;break;case"center":A=p-L,N=p+L;break;case"bottom":A=p,N=p+S;break}}var M=m-Math.max(x,C)-T-k,D=m+Math.max(x,C)+T+k,B=g-Math.max(x,C)-T-k,P=g+Math.max(x,C)+T+k;O+=M,R+=D,A+=B,N+=P;var $=n||"main",F=a.labelBounds,q=F[$]=F[$]||{};q.x1=O,q.y1=A,q.x2=R,q.y2=N,q.w=R-O,q.h=N-A,q.leftPad=M,q.rightPad=D,q.topPad=B,q.botPad=P;var G=y&&v.strValue==="autorotate",z=v.pfValue!=null&&v.pfValue!==0;if(G||z){var H=G?fC(a.rstyle,"labelAngle",n):v.pfValue,j=Math.cos(H),J=Math.sin(H),U=(O+R)/2,le=(A+N)/2;if(!y){switch(H4(l.value)){case"left":U=R;break;case"right":U=O;break}switch(U4(u.value)){case"top":le=N;break;case"bottom":le=A;break}}var ee=function(Ge,fe){return Ge=Ge-U,fe=fe-le,{x:Ge*j-fe*J+U,y:Ge*J+fe*j+le}},ue=ee(O,A),ae=ee(O,N),oe=ee(R,A),Re=ee(R,N);O=Math.min(ue.x,ae.x,oe.x,Re.x),R=Math.max(ue.x,ae.x,oe.x,Re.x),A=Math.min(ue.y,ae.y,oe.y,Re.y),N=Math.max(ue.y,ae.y,oe.y,Re.y)}var Te=$+"Rot",Oe=F[Te]=F[Te]||{};Oe.x1=O,Oe.y1=A,Oe.x2=R,Oe.y2=N,Oe.w=R-O,Oe.h=N-A,Th(t,O,A,R,N),Th(a.labelBounds.all,O,A,R,N)}return t}},VIe=function(t,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,a=r.pstyle("outline-offset").value,s=i+a;ENe(t,r,n,s,"outside",s/2)}},ENe=function(t,r,n,i,a,s){if(!(n===0||i<=0||a==="inside")){var o=r.cy(),l=o.renderer(),u=l.nodeShapes[l.getNodeShape(r)];if(u){var h=r.position(),f=h.x,d=h.y,p=r.width(),m=r.height();if(u.hasMiterBounds){a==="center"&&(i/=2);var g=u.miterBounds(f,d,p,m,i);cg(t,g)}else s!=null&&s>0&&AL(t,[s,s,s,s])}}},DLt=function(t,r){if(!r.cy().headless()){var n=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,a=r.pstyle("border-position").value;ENe(t,r,n,i,a)}},OLt=function(t,r){var n=t._private.cy,i=n.styleEnabled(),a=n.headless(),s=Tl(),o=t._private,l=t.isNode(),u=t.isEdge(),h,f,d,p,m,g,y=o.rstyle,v=l&&i?t.pstyle("bounds-expansion").pfValue:[0],x=function(qe){return qe.pstyle("display").value!=="none"},w=!i||x(t)&&(!u||x(t.source())&&x(t.target()));if(w){var C=0,T=0;i&&r.includeOverlays&&(C=t.pstyle("overlay-opacity").value,C!==0&&(T=t.pstyle("overlay-padding").value));var k=0,S=0;i&&r.includeUnderlays&&(k=t.pstyle("underlay-opacity").value,k!==0&&(S=t.pstyle("underlay-padding").value));var E=Math.max(T,S),I=0,L=0;if(i&&(I=t.pstyle("width").pfValue,L=I/2),l&&r.includeNodes){var O=t.position();m=O.x,g=O.y;var R=t.outerWidth(),A=R/2,N=t.outerHeight(),M=N/2;h=m-A,f=m+A,d=g-M,p=g+M,Th(s,h,d,f,p),i&&VIe(s,t),i&&r.includeOutlines&&!a&&VIe(s,t),i&&DLt(s,t)}else if(u&&r.includeEdges)if(i&&!a){var D=t.pstyle("curve-style").strValue;if(h=Math.min(y.srcX,y.midX,y.tgtX),f=Math.max(y.srcX,y.midX,y.tgtX),d=Math.min(y.srcY,y.midY,y.tgtY),p=Math.max(y.srcY,y.midY,y.tgtY),h-=L,f+=L,d-=L,p+=L,Th(s,h,d,f,p),D==="haystack"){var B=y.haystackPts;if(B&&B.length===2){if(h=B[0].x,d=B[0].y,f=B[1].x,p=B[1].y,h>f){var P=h;h=f,f=P}if(d>p){var $=d;d=p,p=$}Th(s,h-L,d-L,f+L,p+L)}}else if(D==="bezier"||D==="unbundled-bezier"||ug(D,"segments")||ug(D,"taxi")){var F;switch(D){case"bezier":case"unbundled-bezier":F=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":F=y.linePts;break}if(F!=null)for(var q=0;qf){var U=h;h=f,f=U}if(d>p){var le=d;d=p,p=le}h-=L,f+=L,d-=L,p+=L,Th(s,h,d,f,p)}if(i&&r.includeEdges&&u&&(vL(s,t,"mid-source"),vL(s,t,"mid-target"),vL(s,t,"source"),vL(s,t,"target")),i){var ee=t.pstyle("ghost").value==="yes";if(ee){var ue=t.pstyle("ghost-offset-x").pfValue,ae=t.pstyle("ghost-offset-y").pfValue;Th(s,s.x1+ue,s.y1+ae,s.x2+ue,s.y2+ae)}}var oe=o.bodyBounds=o.bodyBounds||{};_Le(oe,s),AL(oe,v),EL(oe,1),i&&(h=s.x1,f=s.x2,d=s.y1,p=s.y2,Th(s,h-E,d-E,f+E,p+E));var Re=o.overlayBounds=o.overlayBounds||{};_Le(Re,s),AL(Re,v),EL(Re,1);var Te=o.labelBounds=o.labelBounds||{};Te.all!=null?m_t(Te.all):Te.all=Tl(),i&&r.includeLabels&&(r.includeMainLabels&&LK(s,t,null),u&&(r.includeSourceLabels&&LK(s,t,"source"),r.includeTargetLabels&&LK(s,t,"target")))}return s.x1=Mu(s.x1),s.y1=Mu(s.y1),s.x2=Mu(s.x2),s.y2=Mu(s.y2),s.w=Mu(s.x2-s.x1),s.h=Mu(s.y2-s.y1),s.w>0&&s.h>0&&w&&(AL(s,v),EL(s,1)),s},ANe=function(t){var r=0,n=function(s){return(s?1:0)<=0;o--)s(o);return this};bg.removeAllListeners=function(){return this.removeListener("*")};bg.emit=bg.trigger=function(e,t,r){var n=this.listeners,i=n.length;return this.emitting++,Di(t)||(t=[t]),ZLt(this,function(a,s){r!=null&&(n=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],i=n.length);for(var o=function(){var h=n[l];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===jLt)&&a.eventMatches(a.context,h,s)){var f=[s];t!=null&&z9t(f,t),a.beforeEmit(a.context,h,s),h.conf&&h.conf.one&&(a.listeners=a.listeners.filter(function(m){return m!==h}));var d=a.callbackContext(a.context,h,s),p=h.callback.apply(d,f);a.afterEmit(a.context,h,s),p===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[t]=l,a.set(u,{ele:l,index:t})}return this.length--,this},unmergeOne:function(t){t=t[0];var r=this._private,n=t._private.data.id,i=r.map,a=i.get(n);if(!a)return this;var s=a.index;return this.unmergeAt(s),this},unmerge:function(t){var r=this._private.cy;if(!t)return this;if(t&&Ar(t)){var n=t;t=r.mutableElements().filter(n)}for(var i=0;i=0;r--){var n=this[r];t(n)&&this.unmergeAt(r)}return this},map:function(t,r){for(var n=[],i=this,a=0;an&&(n=l,i=o)}return{value:n,ele:i}},min:function(t,r){for(var n=1/0,i,a=this,s=0;s=0&&a"u"?"undefined":Ts(Symbol))!=t&&Ts(Symbol.iterator)!=t;r&&(VL[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},a=0,s=this.length;return DMe({next:function(){return a1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],i=n.cy();if(i.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,i.style().apply(n));var a=n._private.style[t];return a??(r?i.style().getDefaultProperty(t):null)}},numericStyle:function(t){var r=this[0];if(r.cy().styleEnabled()&&r){var n=r.pstyle(t);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(t){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(t).units},renderedStyle:function(t){var r=this.cy();if(!r.styleEnabled())return this;var n=this[0];if(n)return r.style().getRenderedStyle(n,t)},style:function(t,r){var n=this.cy();if(!n.styleEnabled())return this;var i=!1,a=n.style();if(Hn(t)){var s=t;a.applyBypass(this,s,i),this.emitAndNotify("style")}else if(Ar(t))if(r===void 0){var o=this[0];return o?a.getStylePropertyValue(o,t):void 0}else a.applyBypass(this,t,r,i),this.emitAndNotify("style");else if(t===void 0){var l=this[0];return l?a.getRawStyle(l):void 0}return this},removeStyle:function(t){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style(),a=this;if(t===void 0)for(var s=0;s0&&t.push(h[0]),t.push(o[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(t){return this.neighborhood().add(this).filter(t)},openNeighborhood:function(t){return this.neighborhood(t)}});Ho.neighbourhood=Ho.neighborhood;Ho.closedNeighbourhood=Ho.closedNeighborhood;Ho.openNeighbourhood=Ho.openNeighborhood;zr(Ho,{source:Nu(function(t){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&t?n.filter(t):n},"source"),target:Nu(function(t){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&t?n.filter(t):n},"target"),sources:eMe({attr:"source"}),targets:eMe({attr:"target"})});zr(Ho,{edgesWith:Nu(tMe(),"edgesWith"),edgesTo:Nu(tMe({thisIsSrc:!0}),"edgesTo")});zr(Ho,{connectedEdges:Nu(function(e){for(var t=[],r=this,n=0;n0);return s},component:function(){var t=this[0];return t.cy().mutableElements().components(t)[0]}});Ho.componentsOf=Ho.components;go=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t===void 0){ca("A collection must have a reference to the core");return}var a=new P0,s=!1;if(!r)r=[];else if(r.length>0&&Hn(r[0])&&!OC(r[0])){s=!0;for(var o=[],l=new Y4,u=0,h=r.length;u0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=r.cy(),i=n._private,a=[],s=[],o,l=0,u=r.length;l0){for(var $=o.length===r.length?r:new go(n,o),F=0;F<$.length;F++){var q=$[F];q.isNode()||(q.parallelEdges().clearTraversalCache(),q.source().clearTraversalCache(),q.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=n.collection().merge($).merge($.connectedNodes()).merge($.parent()):G=$,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?$.emitAndNotify("add"):t&&$.emit("add")}return r};$i.removed=function(){var e=this[0];return e&&e._private.removed};$i.inside=function(){var e=this[0];return e&&!e._private.removed};$i.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=[],i={},a=r._private.cy;function s(N){for(var M=N._private.edges,D=0;D0&&(e?O.emitAndNotify("remove"):t&&O.emit("remove"));for(var R=0;Rh&&Math.abs(m.v)>h;);return d?function(g){return l[g*(l.length-1)|0]}:u}})(),Fi=function(t,r,n,i){var a=oIt(t,r,n,i);return function(s,o,l){return s+(o-s)*a(l)}},LL={linear:function(t,r,n){return t+(r-t)*n},ease:Fi(.25,.1,.25,1),"ease-in":Fi(.42,0,1,1),"ease-out":Fi(0,0,.58,1),"ease-in-out":Fi(.42,0,.58,1),"ease-in-sine":Fi(.47,0,.745,.715),"ease-out-sine":Fi(.39,.575,.565,1),"ease-in-out-sine":Fi(.445,.05,.55,.95),"ease-in-quad":Fi(.55,.085,.68,.53),"ease-out-quad":Fi(.25,.46,.45,.94),"ease-in-out-quad":Fi(.455,.03,.515,.955),"ease-in-cubic":Fi(.55,.055,.675,.19),"ease-out-cubic":Fi(.215,.61,.355,1),"ease-in-out-cubic":Fi(.645,.045,.355,1),"ease-in-quart":Fi(.895,.03,.685,.22),"ease-out-quart":Fi(.165,.84,.44,1),"ease-in-out-quart":Fi(.77,0,.175,1),"ease-in-quint":Fi(.755,.05,.855,.06),"ease-out-quint":Fi(.23,1,.32,1),"ease-in-out-quint":Fi(.86,0,.07,1),"ease-in-expo":Fi(.95,.05,.795,.035),"ease-out-expo":Fi(.19,1,.22,1),"ease-in-out-expo":Fi(1,0,0,1),"ease-in-circ":Fi(.6,.04,.98,.335),"ease-out-circ":Fi(.075,.82,.165,1),"ease-in-out-circ":Fi(.785,.135,.15,.86),spring:function(t,r,n){if(n===0)return LL.linear;var i=lIt(t,r,n);return function(a,s,o){return a+(s-a)*i(o)}},"cubic-bezier":Fi};hIt={animate:gi.animate(),animation:gi.animation(),animated:gi.animated(),clearQueue:gi.clearQueue(),delay:gi.delay(),delayAnimation:gi.delayAnimation(),stop:gi.stop(),addToAnimationPool:function(t){var r=this;r.styleEnabled()&&r._private.aniEles.merge(t)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var t=this;if(t._private.animationsRunning=!0,!t.styleEnabled())return;function r(){t._private.animationsRunning&&FL(function(a){aMe(a,t),r()})}var n=t.renderer();n&&n.beforeRender?n.beforeRender(function(a,s){aMe(s,t)},n.beforeRenderPriorities.animations):r()}},fIt={qualifierCompare:function(t,r){return t==null||r==null?t==null&&r==null:t.sameText(r)},eventMatches:function(t,r,n){var i=r.qualifier;return i!=null?t!==n.target&&OC(n.target)&&i.matches(n.target):!0},addEventFields:function(t,r){r.cy=t,r.target=t},callbackContext:function(t,r,n){return r.qualifier!=null?n.target:t}},wL=function(t){return Ar(t)?new vg(t):t},FNe={createEmitter:function(){var t=this._private;return t.emitter||(t.emitter=new sI(fIt,this)),this},emitter:function(){return this._private.emitter},on:function(t,r,n){return this.emitter().on(t,wL(r),n),this},removeListener:function(t,r,n){return this.emitter().removeListener(t,wL(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(t,r,n){return this.emitter().one(t,wL(r),n),this},once:function(t,r,n){return this.emitter().one(t,wL(r),n),this},emit:function(t,r){return this.emitter().emit(t,r),this},emitAndNotify:function(t,r){return this.emit(t),this.notify(t,r),this}};gi.eventAliasesOn(FNe);KK={png:function(t){var r=this._private.renderer;return t=t||{},r.png(t)},jpg:function(t){var r=this._private.renderer;return t=t||{},t.bg=t.bg||"#fff",r.jpg(t)}};KK.jpeg=KK.jpg;IL={layout:function(t){var r=this;if(t==null){ca("Layout options must be specified to make a layout");return}if(t.name==null){ca("A `name` must be specified to make a layout");return}var n=t.name,i=r.extension("layout",n);if(i==null){ca("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;Ar(t.eles)?a=r.$(t.eles):a=t.eles!=null?t.eles:r.$();var s=new i(zr({},t,{cy:r,eles:a}));return s}};IL.createLayout=IL.makeLayout=IL.layout;dIt={notify:function(t,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var i=n.batchNotifications[t]=n.batchNotifications[t]||this.collection();r!=null&&i.merge(r);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(t,r)}},notifications:function(t){var r=this._private;return t===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!t,this)},noNotifications:function(t){this.notifications(!1),t(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var t=this._private;return t.batchCount==null&&(t.batchCount=0),t.batchCount===0&&(t.batchStyleEles=this.collection(),t.batchNotifications={}),t.batchCount++,this},endBatch:function(){var t=this._private;if(t.batchCount===0)return this;if(t.batchCount--,t.batchCount===0){t.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(t.batchNotifications).forEach(function(n){var i=t.batchNotifications[n];i.empty()?r.notify(n):r.notify(n,i)})}return this},batch:function(t){return this.startBatch(),t(),this.endBatch(),this},batchData:function(t){var r=this;return this.batch(function(){for(var n=Object.keys(t),i=0;i0;)r.removeChild(r.childNodes[0]);t._private.renderer=null,t.mutableElements().forEach(function(n){var i=n._private;i.rscratch={},i.rstyle={},i.animation.current=[],i.animation.queue=[]})},onRender:function(t){return this.on("render",t)},offRender:function(t){return this.off("render",t)}};ZK.invalidateDimensions=ZK.resize;ML={collection:function(t,r){return Ar(t)?this.$(t):Wc(t)?t.collection():Di(t)?(r||(r={}),new go(this,t,r.unique,r.removed)):new go(this)},nodes:function(t){var r=this.$(function(n){return n.isNode()});return t?r.filter(t):r},edges:function(t){var r=this.$(function(n){return n.isEdge()});return t?r.filter(t):r},$:function(t){var r=this._private.elements;return t?r.filter(t):r.spawnSelf()},mutableElements:function(){return this._private.elements}};ML.elements=ML.filter=ML.$;Vs={},wC="t",mIt="f";Vs.apply=function(e){for(var t=this,r=t._private,n=r.cy,i=n.collection(),a=0;a0;if(d||f&&p){var m=void 0;d&&p||d?m=u.properties:p&&(m=u.mappedProperties);for(var g=0;g1&&(C=1),o.color){var k=n.valueMin[0],S=n.valueMax[0],E=n.valueMin[1],I=n.valueMax[1],L=n.valueMin[2],O=n.valueMax[2],R=n.valueMin[3]==null?1:n.valueMin[3],A=n.valueMax[3]==null?1:n.valueMax[3],N=[Math.round(k+(S-k)*C),Math.round(E+(I-E)*C),Math.round(L+(O-L)*C),Math.round(R+(A-R)*C)];a={bypass:n.bypass,name:n.name,value:N,strValue:"rgb("+N[0]+", "+N[1]+", "+N[2]+")"}}else if(o.number){var M=n.valueMin+(n.valueMax-n.valueMin)*C;a=this.parse(n.name,M,n.bypass,d)}else return!1;if(!a)return g(),!1;a.mapping=n,n=a;break}case s.data:{for(var D=n.field.split("."),B=f.data,P=0;P0&&a>0){for(var o={},l=!1,u=0;u0?e.delayAnimation(s).play().promise().then(w):w()}).then(function(){return e.animation({style:o,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1)};Vs.checkTrigger=function(e,t,r,n,i,a){var s=this.properties[t],o=i(s);e.removed()||o!=null&&o(r,n,e)&&a(s)};Vs.checkZOrderTrigger=function(e,t,r,n){var i=this;this.checkTrigger(e,t,r,n,function(a){return a.triggersZOrder},function(){i._private.cy.notify("zorder",e)})};Vs.checkBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})};Vs.checkConnectedEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBoundsOfConnectedEdges},function(i){e.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Vs.checkParallelEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBoundsOfParallelEdges},function(i){e.parallelEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Vs.checkTriggers=function(e,t,r,n){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,r,n),this.checkBoundsTrigger(e,t,r,n),this.checkConnectedEdgesBoundsTrigger(e,t,r,n),this.checkParallelEdgesBoundsTrigger(e,t,r,n)};qC={};qC.applyBypass=function(e,t,r,n){var i=this,a=[],s=!0;if(t==="*"||t==="**"){if(r!==void 0)for(var o=0;oi.length?n=n.substr(i.length):n=""}function l(){a.length>s.length?a=a.substr(s.length):a=""}for(;;){var u=n.match(/^\s*$/);if(u)break;var h=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){yi("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=h[0];var f=h[1];if(f!=="core"){var d=new vg(f);if(d.invalid){yi("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}}var p=h[2],m=!1;a=p;for(var g=[];;){var y=a.match(/^\s*$/);if(y)break;var v=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!v){yi("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),m=!0;break}s=v[0];var x=v[1],w=v[2],C=t.properties[x];if(!C){yi("Skipping property: Invalid property name in: "+s),l();continue}var T=r.parse(x,w);if(!T){yi("Skipping property: Invalid property definition in: "+s),l();continue}g.push({name:x,val:w}),l()}if(m){o();break}r.selector(f);for(var k=0;k=7&&t[0]==="d"&&(h=new RegExp(o.data.regex).exec(t))){if(r)return!1;var d=o.data;return{name:e,value:h,strValue:""+t,mapped:d,field:h[1],bypass:r}}else if(t.length>=10&&t[0]==="m"&&(f=new RegExp(o.mapData.regex).exec(t))){if(r||u.multiple)return!1;var p=o.mapData;if(!(u.color||u.number))return!1;var m=this.parse(e,f[4]);if(!m||m.mapped)return!1;var g=this.parse(e,f[5]);if(!g||g.mapped)return!1;if(m.pfValue===g.pfValue||m.strValue===g.strValue)return yi("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+m.strValue+"`"),this.parse(e,m.strValue);if(u.color){var y=m.value,v=g.value,x=y[0]===v[0]&&y[1]===v[1]&&y[2]===v[2]&&(y[3]===v[3]||(y[3]==null||y[3]===1)&&(v[3]==null||v[3]===1));if(x)return!1}return{name:e,value:f,strValue:""+t,mapped:p,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:m.value,valueMax:g.value,bypass:r}}}if(u.multiple&&n!=="multiple"){var w;if(l?w=t.split(/\s+/):Di(t)?w=t:w=[t],u.evenMultiple&&w.length%2!==0)return null;for(var C=[],T=[],k=[],S="",E=!1,I=0;I0?" ":"")+L.strValue}return u.validate&&!u.validate(C,T)?null:u.singleEnum&&E?C.length===1&&Ar(C[0])?{name:e,value:C[0],strValue:C[0],bypass:r}:null:{name:e,value:C,pfValue:k,strValue:S,bypass:r,units:T}}var O=function(){for(var ee=0;eeu.max||u.strictMax&&t===u.max))return null;var D={name:e,value:t,strValue:""+t+(R||""),units:R,bypass:r};return u.unitless||R!=="px"&&R!=="em"?D.pfValue=t:D.pfValue=R==="px"||!R?t:this.getEmSizeInPixels()*t,(R==="ms"||R==="s")&&(D.pfValue=R==="ms"?t:1e3*t),(R==="deg"||R==="rad")&&(D.pfValue=R==="rad"?t:h_t(t)),R==="%"&&(D.pfValue=t/100),D}else if(u.propList){var B=[],P=""+t;if(P!=="none"){for(var $=P.split(/\s*,\s*|\s+/),F=0;F<$.length;F++){var q=$[F].trim();i.properties[q]?B.push(q):yi("`"+q+"` is not a valid property name")}if(B.length===0)return null}return{name:e,value:B,strValue:B.length===0?"none":B.join(" "),bypass:r}}else if(u.color){var G=GMe(t);return G?{name:e,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var z=O();if(z)return z}for(var H=u.regexes?u.regexes:[u.regex],j=0;j0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((s-2*r)/n.w,(o-2*r)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=n.minZoom&&(n.maxZoom=r),this},minZoom:function(t){return t===void 0?this._private.minZoom:this.zoomRange({min:t})},maxZoom:function(t){return t===void 0?this._private.maxZoom:this.zoomRange({max:t})},getZoomedViewport:function(t){var r=this._private,n=r.pan,i=r.zoom,a,s,o=!1;if(r.zoomingEnabled||(o=!0),Zt(t)?s=t:Hn(t)&&(s=t.level,t.position!=null?a=JL(t.position,i,n):t.renderedPosition!=null&&(a=t.renderedPosition),a!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=sr.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,a.push("zoom"))}if(i&&(!s||!t.cancelOnFailedZoom)&&r.panningEnabled){var u=t.pan;Zt(u.x)&&(r.pan.x=u.x,o=!1),Zt(u.y)&&(r.pan.y=u.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(t){var r=this.getCenterPan(t);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(t,r){if(this._private.panningEnabled){if(Ar(t)){var n=t;t=this.mutableElements().filter(n)}else Wc(t)||(t=this.mutableElements());if(t.length!==0){var i=t.boundingBox(),a=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(a-r*(i.x1+i.x2))/2,y:(s-r*(i.y1+i.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var t=this._private,r=t.container,n=this;return t.sizeCache=t.sizeCache||(r?(function(){var i=n.window().getComputedStyle(r),a=function(o){return parseFloat(i.getPropertyValue(o))};return{width:r.clientWidth-a("padding-left")-a("padding-right"),height:r.clientHeight-a("padding-top")-a("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var t=this._private.pan,r=this._private.zoom,n=this.renderedExtent(),i={x1:(n.x1-t.x)/r,x2:(n.x2-t.x)/r,y1:(n.y1-t.y)/r,y2:(n.y2-t.y)/r};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var t=this.width(),r=this.height();return{x1:0,y1:0,x2:t,y2:r,w:t,h:r}},multiClickDebounceTime:function(t){if(t)this._private.multiClickDebounceTime=t;else return this._private.multiClickDebounceTime;return this}};gv.centre=gv.center;gv.autolockNodes=gv.autolock;gv.autoungrabifyNodes=gv.autoungrabify;IC={data:gi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:gi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:gi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:gi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};IC.attr=IC.data;IC.removeAttr=IC.removeData;MC=function(t){var r=this;t=zr({},t);var n=t.container;n&&!BL(n)&&BL(n[0])&&(n=n[0]);var i=n?n._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var a=i.readies=i.readies||[];n&&(n._cyreg=i),i.cy=r;var s=ws!==void 0&&n!==void 0&&!t.headless,o=t;o.layout=zr({name:s?"grid":"null"},o.layout),o.renderer=zr({name:s?"canvas":"null"},o.renderer);var l=function(m,g,y){return g!==void 0?g:y!==void 0?y:m},u=this._private={container:n,ready:!1,options:o,elements:new go(this),listeners:[],aniEles:new go(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:Zt(o.zoom)?o.zoom:1,pan:{x:Hn(o.pan)&&Zt(o.pan.x)?o.pan.x:0,y:Hn(o.pan)&&Zt(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var h=function(m,g){var y=m.some(a9t);if(y)return X4.all(m).then(g);g(m)};u.styleEnabled&&r.setStyle([]);var f=zr({},o,o.renderer);r.initRenderer(f);var d=function(m,g,y){r.notifications(!1);var v=r.mutableElements();v.length>0&&v.remove(),m!=null&&(Hn(m)||Di(m))&&r.add(m),r.one("layoutready",function(w){r.notifications(!0),r.emit(w),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var x=zr({},r._private.options.layout);x.eles=r.elements(),r.layout(x).run()};h([o.style,o.elements],function(p){var m=p[0],g=p[1];u.styleEnabled&&r.style().append(m),d(g,function(){r.startAnimationLoop(),u.ready=!0,ya(o.ready)&&r.on("ready",o.ready);for(var y=0;y0,o=!!e.boundingBox,l=Tl(o?e.boundingBox:structuredClone(t.extent())),u;if(Wc(e.roots))u=e.roots;else if(Di(e.roots)){for(var h=[],f=0;f0;){var N=A(),M=I(N,O);if(M)N.outgoers().filter(function(Ce){return Ce.isNode()&&r.has(Ce)}).forEach(R);else if(M===null){yi("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var D=0;if(e.avoidOverlap)for(var B=0;B0&&v[0].length<=3?he/2:0),ce=2*Math.PI/v[ie].length*Q;return ie===0&&v[0].length===1&&(xe=1),{x:oe.x+xe*Math.cos(ce),y:oe.y+xe*Math.sin(ce)}}else{var ge=v[ie].length,Ie=Math.max(ge===1?0:o?(l.w-e.padding*2-Re.w)/((e.grid?Oe:ge)-1):(l.w-e.padding*2-Re.w)/((e.grid?Oe:ge)+1),D),ye={x:oe.x+(Q+1-(ge+1)/2)*Ie,y:oe.y+(ie+1-(j+1)/2)*Te};return ye}},Ge={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Ge).indexOf(e.direction)===-1&&ca("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Ge).join(", ")));var fe=function(_e){return D9t(qe(_e),l,Ge[e.direction])};return r.nodes().layoutPositions(this,e,fe),this};bIt={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,r){return!0},ready:void 0,stop:void 0,transform:function(t,r){return r}};zNe.prototype.run=function(){var e=this.options,t=e,r=e.cy,n=t.eles,i=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,a=n.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var s=Tl(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep,u=l/Math.max(1,a.length-1),h,f=0,d=0;d1&&t.avoidOverlap){f*=1.75;var v=Math.cos(u)-Math.cos(0),x=Math.sin(u)-Math.sin(0),w=Math.sqrt(f*f/(v*v+x*x));h=Math.max(w,h)}var C=function(k,S){var E=t.startAngle+S*u*(i?1:-1),I=h*Math.cos(E),L=h*Math.sin(E),O={x:o.x+I,y:o.y+L};return O};return n.nodes().layoutPositions(this,t,C),this};wIt={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(t){return t.degree()},levelWidth:function(t){return t.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,r){return!0},ready:void 0,stop:void 0,transform:function(t,r){return r}};GNe.prototype.run=function(){for(var e=this.options,t=e,r=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,n=e.cy,i=t.eles,a=i.nodes().not(":parent"),s=Tl(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,h=0;h0){var T=Math.abs(x[0].value-C.value);T>=y&&(x=[],v.push(x))}x.push(C)}var k=u+t.minNodeSpacing;if(!t.avoidOverlap){var S=v.length>0&&v[0].length>1,E=Math.min(s.w,s.h)/2-k,I=E/(v.length+S?1:0);k=Math.min(k,I)}for(var L=0,O=0;O1&&t.avoidOverlap){var M=Math.cos(N)-Math.cos(0),D=Math.sin(N)-Math.sin(0),B=Math.sqrt(k*k/(M*M+D*D));L=Math.max(B,L)}R.r=L,L+=k}if(t.equidistant){for(var P=0,$=0,F=0;F=e.numIter||(_It(n,e),n.temperature=n.temperature*e.coolingFactor,n.temperature=e.animationThreshold&&a(),FL(h)}};h()}else{for(;u;)u=s(l),l++;lMe(n,e),o()}return this};hI.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};hI.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};TIt=function(t,r,n){for(var i=n.eles.edges(),a=n.eles.nodes(),s=Tl(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={isCompound:t.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=n.eles.components(),u={},h=0;h0){o.graphSet.push(E);for(var h=0;hi.count?0:i.graph},qNe=function(t,r,n,i){var a=i.graphSet[n];if(-10)var f=i.nodeOverlap*h,d=Math.sqrt(o*o+l*l),p=f*o/d,m=f*l/d;else var g=HL(t,o,l),y=HL(r,-1*o,-1*l),v=y.x-g.x,x=y.y-g.y,w=v*v+x*x,d=Math.sqrt(w),f=(t.nodeRepulsion+r.nodeRepulsion)/w,p=f*v/d,m=f*x/d;t.isLocked||(t.offsetX-=p,t.offsetY-=m),r.isLocked||(r.offsetX+=p,r.offsetY+=m)}},IIt=function(t,r,n,i){if(n>0)var a=t.maxX-r.minX;else var a=r.maxX-t.minX;if(i>0)var s=t.maxY-r.minY;else var s=r.maxY-t.minY;return a>=0&&s>=0?Math.sqrt(a*a+s*s):0},HL=function(t,r,n){var i=t.positionX,a=t.positionY,s=t.height||1,o=t.width||1,l=n/r,u=s/o,h={};return r===0&&0n?(h.x=i,h.y=a+s/2,h):0r&&-1*u<=l&&l<=u?(h.x=i-o/2,h.y=a-o*n/2/r,h):0=u)?(h.x=i+s*r/2/n,h.y=a+s/2,h):(0>n&&(l<=-1*u||l>=u)&&(h.x=i-s*r/2/n,h.y=a-s/2),h)},MIt=function(t,r){for(var n=0;nn){var y=r.gravity*p/g,v=r.gravity*m/g;d.offsetX+=y,d.offsetY+=v}}}}},DIt=function(t,r){var n=[],i=0,a=-1;for(n.push.apply(n,t.graphSet[0]),a+=t.graphSet[0].length;i<=a;){var s=n[i++],o=t.idToIndex[s],l=t.layoutNodes[o],u=l.children;if(0n)var a={x:n*t/i,y:n*r/i};else var a={x:t,y:r};return a},WNe=function(t,r){var n=t.parentId;if(n!=null){var i=r.layoutNodes[r.idToIndex[n]],a=!1;if((i.maxX==null||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(i.minX==null||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(i.minY==null||t.minY-i.padTopv&&(m+=y+r.componentSpacing,p=0,g=0,y=0)}}},BIt={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(t){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,r){return!0},ready:void 0,stop:void 0,transform:function(t,r){return r}};HNe.prototype.run=function(){var e=this.options,t=e,r=e.cy,n=t.eles,i=n.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=Tl(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(a.h===0||a.w===0)n.nodes().layoutPositions(this,t,function(z){return{x:a.x1,y:a.y1}});else{var s=i.size(),o=Math.sqrt(s*a.h/a.w),l=Math.round(o),u=Math.round(a.w/a.h*o),h=function(H){if(H==null)return Math.min(l,u);var j=Math.min(l,u);j==l?l=H:u=H},f=function(H){if(H==null)return Math.max(l,u);var j=Math.max(l,u);j==l?l=H:u=H},d=t.rows,p=t.cols!=null?t.cols:t.columns;if(d!=null&&p!=null)l=d,u=p;else if(d!=null&&p==null)l=d,u=Math.ceil(s/l);else if(d==null&&p!=null)u=p,l=Math.ceil(s/u);else if(u*l>s){var m=h(),g=f();(m-1)*g>=s?h(m-1):(g-1)*m>=s&&f(g-1)}else for(;u*l=s?f(v+1):h(y+1)}var x=a.w/u,w=a.h/l;if(t.condense&&(x=0,w=0),t.avoidOverlap)for(var C=0;C=u&&(M=0,N++)},B={},P=0;P(M=S_t(e,t,D[B],D[B+1],D[B+2],D[B+3])))return y(S,M),!0}else if(I.edgeType==="bezier"||I.edgeType==="multibezier"||I.edgeType==="self"||I.edgeType==="compound"){for(var D=I.allpts,B=0;B+5(M=C_t(e,t,D[B],D[B+1],D[B+2],D[B+3],D[B+4],D[B+5])))return y(S,M),!0}for(var P=P||E.source,$=$||E.target,F=i.getArrowWidth(L,O),q=[{name:"source",x:I.arrowStartX,y:I.arrowStartY,angle:I.srcArrowAngle},{name:"target",x:I.arrowEndX,y:I.arrowEndY,angle:I.tgtArrowAngle},{name:"mid-source",x:I.midX,y:I.midY,angle:I.midsrcArrowAngle},{name:"mid-target",x:I.midX,y:I.midY,angle:I.midtgtArrowAngle}],B=0;B0&&(v(P),v($))}function w(S,E,I){return kl(S,E,I)}function C(S,E){var I=S._private,L=d,O;E?O=E+"-":O="",S.boundingBox();var R=I.labelBounds[E||"main"],A=S.pstyle(O+"label").value,N=S.pstyle("text-events").strValue==="yes";if(!(!N||!A)){var M=w(I.rscratch,"labelX",E),D=w(I.rscratch,"labelY",E),B=w(I.rscratch,"labelAngle",E),P=S.pstyle(O+"text-margin-x").pfValue,$=S.pstyle(O+"text-margin-y").pfValue,F=R.x1-L-P,q=R.x2+L-P,G=R.y1-L-$,z=R.y2+L-$;if(B){var H=Math.cos(B),j=Math.sin(B),J=function(Re,Te){return Re=Re-M,Te=Te-D,{x:Re*H-Te*j+M,y:Re*j+Te*H+D}},U=J(F,G),le=J(F,z),ee=J(q,G),ue=J(q,z),ae=[U.x+P,U.y+$,ee.x+P,ee.y+$,ue.x+P,ue.y+$,le.x+P,le.y+$];if(nc(e,t,ae))return y(S),!0}else if(hg(R,e,t))return y(S),!0}}for(var T=s.length-1;T>=0;T--){var k=s[T];k.isNode()?v(k)||C(k):x(k)||C(k)||C(k,"source")||C(k,"target")}return o};vv.getAllInBox=function(e,t,r,n){var i=this.getCachedZSortedEles().interactive,a=this.cy.zoom(),s=2/a,o=[],l=Math.min(e,r),u=Math.max(e,r),h=Math.min(t,n),f=Math.max(t,n);e=l,r=u,t=h,n=f;var d=Tl({x1:e,y1:t,x2:r,y2:n}),p=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],m=[[p[0],p[1]],[p[1],p[2]],[p[2],p[3]],[p[3],p[0]]];function g(Re,Te,Oe){return kl(Re,Te,Oe)}function y(Re,Te){var Oe=Re._private,qe=s,Ge="";Re.boundingBox();var fe=Oe.labelBounds.main;if(!fe)return null;var Ce=g(Oe.rscratch,"labelX",Te),_e=g(Oe.rscratch,"labelY",Te),de=g(Oe.rscratch,"labelAngle",Te),ie=Re.pstyle(Ge+"text-margin-x").pfValue,Q=Re.pstyle(Ge+"text-margin-y").pfValue,he=fe.x1-qe-ie,xe=fe.x2+qe-ie,ce=fe.y1-qe-Q,ge=fe.y2+qe-Q;if(de){var Ie=Math.cos(de),ye=Math.sin(de),ne=function(pe,K){return pe=pe-Ce,K=K-_e,{x:pe*Ie-K*ye+Ce,y:pe*ye+K*Ie+_e}};return[ne(he,ce),ne(xe,ce),ne(xe,ge),ne(he,ge)]}else return[{x:he,y:ce},{x:xe,y:ce},{x:xe,y:ge},{x:he,y:ge}]}function v(Re,Te,Oe,qe){function Ge(fe,Ce,_e){return(_e.y-fe.y)*(Ce.x-fe.x)>(Ce.y-fe.y)*(_e.x-fe.x)}return Ge(Re,Oe,qe)!==Ge(Te,Oe,qe)&&Ge(Re,Te,Oe)!==Ge(Re,Te,qe)}for(var x=0;x0?-(Math.PI-t.ang):Math.PI+t.ang},VIt=function(t,r,n,i,a){if(t!==dMe?pMe(r,t,jf):qIt(Iu,jf),pMe(r,n,Iu),hMe=jf.nx*Iu.ny-jf.ny*Iu.nx,fMe=jf.nx*Iu.nx-jf.ny*-Iu.ny,O0=Math.asin(Math.max(-1,Math.min(1,hMe))),Math.abs(O0)<1e-6){QK=r.x,JK=r.y,cv=I4=0;return}hv=1,NL=!1,fMe<0?O0<0?O0=Math.PI+O0:(O0=Math.PI-O0,hv=-1,NL=!0):O0>0&&(hv=-1,NL=!0),r.radius!==void 0?I4=r.radius:I4=i,av=O0/2,kL=Math.min(jf.len/2,Iu.len/2),a?(Yf=Math.abs(Math.cos(av)*I4/Math.sin(av)),Yf>kL?(Yf=kL,cv=Math.abs(Yf*Math.sin(av)/Math.cos(av))):cv=I4):(Yf=Math.min(kL,I4),cv=Math.abs(Yf*Math.sin(av)/Math.cos(av))),eZ=r.x+Iu.nx*Yf,tZ=r.y+Iu.ny*Yf,QK=eZ-Iu.ny*cv*hv,JK=tZ+Iu.nx*cv*hv,jNe=r.x+jf.nx*Yf,KNe=r.y+jf.ny*Yf,dMe=r};NC=.01,WIt=Math.sqrt(2*NC),Yo={};Yo.findMidptPtsEtc=function(e,t){var r=t.posPts,n=t.intersectionPts,i=t.vectorNormInverse,a,s=e.pstyle("source-endpoint"),o=e.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(T,k,S,E){var I=E-k,L=S-T,O=Math.sqrt(L*L+I*I);return{x:-I/O,y:L/O}},h=e.pstyle("edge-distances").value;switch(h){case"node-position":a=r;break;case"intersection":a=n;break;case"endpoints":{if(l){var f=this.manualEndptToPx(e.source()[0],s),d=as(f,2),p=d[0],m=d[1],g=this.manualEndptToPx(e.target()[0],o),y=as(g,2),v=y[0],x=y[1],w={x1:p,y1:m,x2:v,y2:x};i=u(p,m,v,x),a=w}else yi("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),a=n;break}}return{midptPts:a,vectorNormInverse:i}};Yo.findHaystackPoints=function(e){for(var t=0;t0?Math.max(K-ve,0):Math.min(K+ve,0)},A=R(L,E),N=R(O,I),M=!1;x===u?v=Math.abs(A)>Math.abs(N)?i:n:x===l||x===o?(v=n,M=!0):(x===a||x===s)&&(v=i,M=!0);var D=v===n,B=D?N:A,P=D?O:L,$=mZ(P),F=!1;!(M&&(C||k))&&(x===o&&P<0||x===l&&P>0||x===a&&P>0||x===s&&P<0)&&($*=-1,B=$*Math.abs(B),F=!0);var q;if(C){var G=T<0?1+T:T;q=G*B}else{var z=T<0?B:0;q=z+T*$}var H=function(K){return Math.abs(K)=Math.abs(B)},j=H(q),J=H(Math.abs(B)-Math.abs(q)),U=j||J;if(U&&!F)if(D){var le=Math.abs(P)<=d/2,ee=Math.abs(L)<=p/2;if(le){var ue=(h.x1+h.x2)/2,ae=h.y1,oe=h.y2;r.segpts=[ue,ae,ue,oe]}else if(ee){var Re=(h.y1+h.y2)/2,Te=h.x1,Oe=h.x2;r.segpts=[Te,Re,Oe,Re]}else r.segpts=[h.x1,h.y2]}else{var qe=Math.abs(P)<=f/2,Ge=Math.abs(O)<=m/2;if(qe){var fe=(h.y1+h.y2)/2,Ce=h.x1,_e=h.x2;r.segpts=[Ce,fe,_e,fe]}else if(Ge){var de=(h.x1+h.x2)/2,ie=h.y1,Q=h.y2;r.segpts=[de,ie,de,Q]}else r.segpts=[h.x2,h.y1]}else if(D){var he=h.y1+q+(y?d/2*$:0),xe=h.x1,ce=h.x2;r.segpts=[xe,he,ce,he]}else{var ge=h.x1+q+(y?f/2*$:0),Ie=h.y1,ye=h.y2;r.segpts=[ge,Ie,ge,ye]}if(r.isRound){var ne=e.pstyle("taxi-radius").value,V=e.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ne),r.isArcRadius=new Array(r.segpts.length/2).fill(V)}};Yo.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if(r.edgeType==="bezier"){var n=t.srcPos,i=t.tgtPos,a=t.srcW,s=t.srcH,o=t.tgtW,l=t.tgtH,u=t.srcShape,h=t.tgtShape,f=t.srcCornerRadius,d=t.tgtCornerRadius,p=t.srcRs,m=t.tgtRs,g=!Zt(r.startX)||!Zt(r.startY),y=!Zt(r.arrowStartX)||!Zt(r.arrowStartY),v=!Zt(r.endX)||!Zt(r.endY),x=!Zt(r.arrowEndX)||!Zt(r.arrowEndY),w=3,C=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,T=w*C,k=pv({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),S=kP.poolIndex()){var $=B;B=P,P=$}var F=A.srcPos=B.position(),q=A.tgtPos=P.position(),G=A.srcW=B.outerWidth(),z=A.srcH=B.outerHeight(),H=A.tgtW=P.outerWidth(),j=A.tgtH=P.outerHeight(),J=A.srcShape=r.nodeShapes[t.getNodeShape(B)],U=A.tgtShape=r.nodeShapes[t.getNodeShape(P)],le=A.srcCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,ee=A.tgtCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,ue=A.tgtRs=P._private.rscratch,ae=A.srcRs=B._private.rscratch;A.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var oe=0;oe=WIt||(ce=Math.sqrt(Math.max(xe*xe,NC)+Math.max(he*he,NC)));var ge=A.vector={x:xe,y:he},Ie=A.vectorNorm={x:ge.x/ce,y:ge.y/ce},ye={x:-Ie.y,y:Ie.x};A.nodesOverlap=!Zt(ce)||U.checkPoint(fe[0],fe[1],0,H,j,q.x,q.y,ee,ue)||J.checkPoint(_e[0],_e[1],0,G,z,F.x,F.y,le,ae),A.vectorNormInverse=ye,N={nodesOverlap:A.nodesOverlap,dirCounts:A.dirCounts,calculatedIntersection:!0,hasBezier:A.hasBezier,hasUnbundled:A.hasUnbundled,eles:A.eles,srcPos:q,srcRs:ue,tgtPos:F,tgtRs:ae,srcW:H,srcH:j,tgtW:G,tgtH:z,srcIntn:de,tgtIntn:Ce,srcShape:U,tgtShape:J,posPts:{x1:Q.x2,y1:Q.y2,x2:Q.x1,y2:Q.y1},intersectionPts:{x1:ie.x2,y1:ie.y2,x2:ie.x1,y2:ie.y1},vector:{x:-ge.x,y:-ge.y},vectorNorm:{x:-Ie.x,y:-Ie.y},vectorNormInverse:{x:-ye.x,y:-ye.y}}}var ne=Ge?N:A;Te.nodesOverlap=ne.nodesOverlap,Te.srcIntn=ne.srcIntn,Te.tgtIntn=ne.tgtIntn,Te.isRound=Oe.startsWith("round"),i&&(B.isParent()||B.isChild()||P.isParent()||P.isChild())&&(B.parents().anySame(P)||P.parents().anySame(B)||B.same(P)&&B.isParent())?t.findCompoundLoopPoints(Re,ne,oe,qe):B===P?t.findLoopPoints(Re,ne,oe,qe):Oe.endsWith("segments")?t.findSegmentsPoints(Re,ne):Oe.endsWith("taxi")?t.findTaxiPoints(Re,ne):Oe==="straight"||!qe&&A.eles.length%2===1&&oe===Math.floor(A.eles.length/2)?t.findStraightEdgePoints(Re):t.findBezierPoints(Re,ne,oe,qe,Ge),t.findEndpoints(Re),t.tryToCorrectInvalidPoints(Re,ne),t.checkForInvalidEdgeWarning(Re),t.storeAllpts(Re),t.storeEdgeProjections(Re),t.calculateArrowAngles(Re),t.recalculateEdgeLabelProjections(Re),t.calculateLabelAngles(Re)}},S=0;S0){var fe=u,Ce=lv(fe,O4(s)),_e=lv(fe,O4(Ge)),de=Ce;if(_e2){var ie=lv(fe,{x:Ge[2],y:Ge[3]});ie0){var Z=h,je=lv(Z,O4(s)),Ne=lv(Z,O4(ve)),ze=je;if(Ne2){var Fe=lv(Z,{x:ve[2],y:ve[3]});Fe=m||S){y={cp:C,segment:k};break}}if(y)break}var E=y.cp,I=y.segment,L=(m-v)/I.length,O=I.t1-I.t0,R=p?I.t0+O*L:I.t1-O*L;R=AC(0,R,1),t=F4(E.p0,E.p1,E.p2,R),d=UIt(E.p0,E.p1,E.p2,R);break}case"straight":case"segments":case"haystack":{for(var A=0,N,M,D,B,P=n.allpts.length,$=0;$+3=m));$+=2);var F=m-M,q=F/N;q=AC(0,q,1),t=d_t(D,B,q),d=eDe(D,B);break}}s("labelX",f,t.x),s("labelY",f,t.y),s("labelAutoAngle",f,d)}};u("source"),u("target"),this.applyLabelDimensions(e)}};Jf.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))};Jf.applyPrefixedLabelDimensions=function(e,t){var r=e._private,n=this.getLabelText(e,t),i=dv(n,e._private.labelDimsKey);if(kl(r.rscratch,"prefixedLabelDimsKey",t)!==i){Kf(r.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,n),s=e.pstyle("line-height").pfValue,o=e.pstyle("font-size").pfValue,l=e.pstyle("text-wrap").strValue,u=kl(r.rscratch,"labelWrapCachedLines",t)||[],h=l!=="wrap"?1:Math.max(u.length,1),f=o*s,d=a.width,p=a.height+(h-1)*(s-1)*o;Kf(r.rstyle,"labelWidth",t,d),Kf(r.rscratch,"labelWidth",t,d),Kf(r.rstyle,"labelHeight",t,p),Kf(r.rscratch,"labelHeight",t,p),Kf(r.rscratch,"labelLineHeight",t,f),Kf(r.rscratch,"labelActualDescent",t,a.labelActualDescent)}};Jf.getLabelText=function(e,t){var r=e._private,n=t?t+"-":"",i=e.pstyle(n+"label").strValue,a=e.pstyle("text-transform").value,s=function(z,H){return H?(Kf(r.rscratch,z,t,H),H):kl(r.rscratch,z,t)};if(!i)return"";a=="none"||(a=="uppercase"?i=i.toUpperCase():a=="lowercase"&&(i=i.toLowerCase()));var o=e.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",h=i.split(` +`),f=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value,p=d==="anywhere",m=[],g=/[\s\u200b]+|$/g,y=0;yf){var T=v.matchAll(g),k="",S=0,E=ic(T),I;try{for(E.s();!(I=E.n()).done;){var L=I.value,O=L[0],R=v.substring(S,L.index);S=L.index+O.length;var A=k.length===0?R:k+R+O,N=this.calculateLabelDimensions(e,A),M=N.width;M<=f?k+=R+O:(k&&m.push(k),k=R+O)}}catch(G){E.e(G)}finally{E.f()}k.match(/^[\s\u200b]+$/)||m.push(k)}else m.push(v)}s("labelWrapCachedLines",m),i=s("labelWrapCachedText",m.join(` +`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var D=e.pstyle("text-max-width").pfValue,B="",P="\u2026",$=!1;if(this.calculateLabelDimensions(e,i).widthD)break;B+=i[F],F===i.length-1&&($=!0)}return $||(B+=P),B}return i};Jf.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;return t==="auto"?e.isNode()?NLt(r):"center":t};Jf.calculateLabelDimensions=function(e,t){var r=this,n=r.cy.window(),i=n.document,a=0,s=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,h=e.pstyle("text-metrics").strValue||"font",f=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=i.createElement("canvas"),d=this.labelCalcCanvasContext=f.getContext("2d");var p=f.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}d.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var m=0,g=0,y=t.split(` +`),v=y.length,x=0,w=0,C=0;C1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(s),o)for(var l=0;l=e.desktopTapThreshold2}var Rt=a(V);Et&&(e.hoverData.tapholdCancelled=!0);var bt=function(){var rr=e.hoverData.dragDelta=e.hoverData.dragDelta||[];rr.length===0?(rr.push(rt[0]),rr.push(rt[1])):(rr[0]+=rt[0],rr[1]+=rt[1])};K=!0,i(Ve,["mousemove","vmousemove","tapdrag"],V,{x:Ne[0],y:Ne[1]});var ke=function(rr){return{originalEvent:V,type:rr,position:{x:Ne[0],y:Ne[1]}}},yt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||ve.emit(ke("boxstart")),Ke[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Et){var xt=ke("cxtdrag");We?We.emit(xt):ve.emit(xt),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||Ve!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(ke("cxtdragout")),e.hoverData.cxtOver=Ve,Ve&&Ve.emit(ke("cxtdragover")))}}else if(e.hoverData.dragging){if(K=!0,ve.panningEnabled()&&ve.userPanningEnabled()){var it;if(e.hoverData.justStartedPan){var Me=e.hoverData.mdownPos;it={x:(Ne[0]-Me[0])*Z,y:(Ne[1]-Me[1])*Z},e.hoverData.justStartedPan=!1}else it={x:rt[0]*Z,y:rt[1]*Z};ve.panBy(it),ve.emit(ke("dragpan")),e.hoverData.dragged=!0}Ne=e.projectIntoViewport(V.clientX,V.clientY)}else if(Ke[4]==1&&(We==null||We.pannable())){if(Et){if(!e.hoverData.dragging&&ve.boxSelectionEnabled()&&(Rt||!ve.panningEnabled()||!ve.userPanningEnabled()))yt();else if(!e.hoverData.selecting&&ve.panningEnabled()&&ve.userPanningEnabled()){var ut=s(We,e.hoverData.downs);ut&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ke[4]=0,e.data.bgActivePosistion=O4(ze),e.redrawHint("select",!0),e.redraw())}We&&We.pannable()&&We.active()&&We.unactivate()}}else{if(We&&We.pannable()&&We.active()&&We.unactivate(),(!We||!We.grabbed())&&Ve!=tt&&(tt&&i(tt,["mouseout","tapdragout"],V,{x:Ne[0],y:Ne[1]}),Ve&&i(Ve,["mouseover","tapdragover"],V,{x:Ne[0],y:Ne[1]}),e.hoverData.last=Ve),We)if(Et){if(ve.boxSelectionEnabled()&&Rt)We&&We.grabbed()&&(g(Se),We.emit(ke("freeon")),Se.emit(ke("free")),e.dragData.didDrag&&(We.emit(ke("dragfreeon")),Se.emit(ke("dragfree")))),yt();else if(We&&We.grabbed()&&e.nodeIsDraggable(We)){var at=!e.dragData.didDrag;at&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(Se,{inDragLayer:!0});var dt={x:0,y:0};if(Zt(rt[0])&&Zt(rt[1])&&(dt.x+=rt[0],dt.y+=rt[1],at)){var tr=e.hoverData.dragDelta;tr&&Zt(tr[0])&&Zt(tr[1])&&(dt.x+=tr[0],dt.y+=tr[1])}e.hoverData.draggingEles=!0,Se.silentShift(dt).emit(ke("position")).emit(ke("drag")),e.redrawHint("drag",!0),e.redraw()}}else bt();K=!0}if(Ke[2]=Ne[0],Ke[3]=Ne[1],K)return V.stopPropagation&&V.stopPropagation(),V.preventDefault&&V.preventDefault(),!1}},!1);var L,O,R;e.registerBinding(t,"mouseup",function(V){if(!(e.hoverData.which===1&&V.which!==1&&e.hoverData.capture)){var pe=e.hoverData.capture;if(pe){e.hoverData.capture=!1;var K=e.cy,ve=e.projectIntoViewport(V.clientX,V.clientY),Z=e.selection,je=e.findNearestElement(ve[0],ve[1],!0,!1),Ne=e.dragData.possibleDragElements,ze=e.hoverData.down,Fe=a(V);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,ze&&ze.unactivate();var Ke=function(De){return{originalEvent:V,type:De,position:{x:ve[0],y:ve[1]}}};if(e.hoverData.which===3){var Ve=Ke("cxttapend");if(ze?ze.emit(Ve):K.emit(Ve),!e.hoverData.cxtDragged){var tt=Ke("cxttap");ze?ze.emit(tt):K.emit(tt)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(je,["mouseup","tapend","vmouseup"],V,{x:ve[0],y:ve[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(ze,["click","tap","vclick"],V,{x:ve[0],y:ve[1]}),O=!1,V.timeStamp-R<=K.multiClickDebounceTime()?(L&&clearTimeout(L),O=!0,R=null,i(ze,["dblclick","dbltap","vdblclick"],V,{x:ve[0],y:ve[1]})):(L=setTimeout(function(){O||i(ze,["oneclick","onetap","voneclick"],V,{x:ve[0],y:ve[1]})},K.multiClickDebounceTime()),R=V.timeStamp)),ze==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(V)&&(K.$(r).unselect(["tapunselect"]),Ne.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=Ne=K.collection()),je==ze&&!e.dragData.didDrag&&!e.hoverData.selecting&&je!=null&&je._private.selectable&&(e.hoverData.dragging||(K.selectionType()==="additive"||Fe?je.selected()?je.unselect(["tapunselect"]):je.select(["tapselect"]):Fe||(K.$(r).unmerge(je).unselect(["tapunselect"]),je.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var We=K.collection(e.getAllInBox(Z[0],Z[1],Z[2],Z[3]));e.redrawHint("select",!0),We.length>0&&e.redrawHint("eles",!0),K.emit(Ke("boxend"));var rt=function(De){return De.selectable()&&!De.selected()};K.selectionType()==="additive"||Fe||K.$(r).unmerge(We).unselect(),We.emit(Ke("box")).stdFilter(rt).select().emit(Ke("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!Z[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var Se=ze&&ze.grabbed();g(Ne),Se&&(ze.emit(Ke("freeon")),Ne.emit(Ke("free")),e.dragData.didDrag&&(ze.emit(Ke("dragfreeon")),Ne.emit(Ke("dragfree"))))}}Z[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var A=[],N=4,M,D=1e5,B=function(V,pe){for(var K=0;K=N){var ve=A;if(M=B(ve,5),!M){var Z=Math.abs(ve[0]);M=P(ve)&&Z>5}if(M)for(var je=0;je5&&(K=mZ(K)*5),tt=K/-250,M&&(tt/=D,tt*=3),tt=tt*e.wheelSensitivity;var We=V.deltaMode===1;We&&(tt*=33);var rt=Ne.zoom()*Math.pow(10,tt);V.type==="gesturechange"&&(rt=e.gestureStartZoom*V.scale),Ne.zoom({level:rt,renderedPosition:{x:Ve[0],y:Ve[1]}}),Ne.emit({type:V.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:V,position:{x:Ke[0],y:Ke[1]}})}}}};e.registerBinding(e.container,"wheel",$,!0),e.registerBinding(t,"scroll",function(V){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(V){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||V.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(ne){e.hasTouchStarted||$(ne)},!0),e.registerBinding(e.container,"mouseout",function(V){var pe=e.projectIntoViewport(V.clientX,V.clientY);e.cy.emit({originalEvent:V,type:"mouseout",position:{x:pe[0],y:pe[1]}})},!1),e.registerBinding(e.container,"mouseover",function(V){var pe=e.projectIntoViewport(V.clientX,V.clientY);e.cy.emit({originalEvent:V,type:"mouseover",position:{x:pe[0],y:pe[1]}})},!1);var F,q,G,z,H,j,J,U,le,ee,ue,ae,oe,Re=function(V,pe,K,ve){return Math.sqrt((K-V)*(K-V)+(ve-pe)*(ve-pe))},Te=function(V,pe,K,ve){return(K-V)*(K-V)+(ve-pe)*(ve-pe)},Oe;e.registerBinding(e.container,"touchstart",Oe=function(V){if(e.hasTouchStarted=!0,!!E(V)){v(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var pe=e.cy,K=e.touchData.now,ve=e.touchData.earlier;if(V.touches[0]){var Z=e.projectIntoViewport(V.touches[0].clientX,V.touches[0].clientY);K[0]=Z[0],K[1]=Z[1]}if(V.touches[1]){var Z=e.projectIntoViewport(V.touches[1].clientX,V.touches[1].clientY);K[2]=Z[0],K[3]=Z[1]}if(V.touches[2]){var Z=e.projectIntoViewport(V.touches[2].clientX,V.touches[2].clientY);K[4]=Z[0],K[5]=Z[1]}var je=function(Rt){return{originalEvent:V,type:Rt,position:{x:K[0],y:K[1]}}};if(V.touches[1]){e.touchData.singleTouchMoved=!0,g(e.dragData.touchDragEles);var Ne=e.findContainerClientCoords();le=Ne[0],ee=Ne[1],ue=Ne[2],ae=Ne[3],F=V.touches[0].clientX-le,q=V.touches[0].clientY-ee,G=V.touches[1].clientX-le,z=V.touches[1].clientY-ee,oe=0<=F&&F<=ue&&0<=G&&G<=ue&&0<=q&&q<=ae&&0<=z&&z<=ae;var ze=pe.pan(),Fe=pe.zoom();H=Re(F,q,G,z),j=Te(F,q,G,z),J=[(F+G)/2,(q+z)/2],U=[(J[0]-ze.x)/Fe,(J[1]-ze.y)/Fe];var Ke=200,Ve=Ke*Ke;if(j=1){for(var mt=e.touchData.startPosition=[null,null,null,null,null,null],Tt=0;Tt=e.touchTapThreshold2}if(pe&&e.touchData.cxt){V.preventDefault();var Tt=V.touches[0].clientX-le,jt=V.touches[0].clientY-ee,_t=V.touches[1].clientX-le,Rt=V.touches[1].clientY-ee,bt=Te(Tt,jt,_t,Rt),ke=bt/j,yt=150,xt=yt*yt,it=1.5,Me=it*it;if(ke>=Me||bt>=xt){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ut=Fe("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(ut),e.touchData.start=null):ve.emit(ut)}}if(pe&&e.touchData.cxt){var ut=Fe("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(ut):ve.emit(ut),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var at=e.findNearestElement(Z[0],Z[1],!0,!0);(!e.touchData.cxtOver||at!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(Fe("cxtdragout")),e.touchData.cxtOver=at,at&&at.emit(Fe("cxtdragover")))}else if(pe&&V.touches[2]&&ve.boxSelectionEnabled())V.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||ve.emit(Fe("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,K[4]=1,!K||K.length===0||K[0]===void 0?(K[0]=(Z[0]+Z[2]+Z[4])/3,K[1]=(Z[1]+Z[3]+Z[5])/3,K[2]=(Z[0]+Z[2]+Z[4])/3+1,K[3]=(Z[1]+Z[3]+Z[5])/3+1):(K[2]=(Z[0]+Z[2]+Z[4])/3,K[3]=(Z[1]+Z[3]+Z[5])/3),e.redrawHint("select",!0),e.redraw();else if(pe&&V.touches[1]&&!e.touchData.didSelect&&ve.zoomingEnabled()&&ve.panningEnabled()&&ve.userZoomingEnabled()&&ve.userPanningEnabled()){V.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var dt=e.dragData.touchDragEles;if(dt){e.redrawHint("drag",!0);for(var tr=0;tr0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var Ge;e.registerBinding(t,"touchcancel",Ge=function(V){var pe=e.touchData.start;e.touchData.capture=!1,pe&&pe.unactivate()});var fe,Ce,_e,de;if(e.registerBinding(t,"touchend",fe=function(V){var pe=e.touchData.start,K=e.touchData.capture;if(K)V.touches.length===0&&(e.touchData.capture=!1),V.preventDefault();else return;var ve=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var Z=e.cy,je=Z.zoom(),Ne=e.touchData.now,ze=e.touchData.earlier;if(V.touches[0]){var Fe=e.projectIntoViewport(V.touches[0].clientX,V.touches[0].clientY);Ne[0]=Fe[0],Ne[1]=Fe[1]}if(V.touches[1]){var Fe=e.projectIntoViewport(V.touches[1].clientX,V.touches[1].clientY);Ne[2]=Fe[0],Ne[3]=Fe[1]}if(V.touches[2]){var Fe=e.projectIntoViewport(V.touches[2].clientX,V.touches[2].clientY);Ne[4]=Fe[0],Ne[5]=Fe[1]}var Ke=function(xt){return{originalEvent:V,type:xt,position:{x:Ne[0],y:Ne[1]}}};pe&&pe.unactivate();var Ve;if(e.touchData.cxt){if(Ve=Ke("cxttapend"),pe?pe.emit(Ve):Z.emit(Ve),!e.touchData.cxtDragged){var tt=Ke("cxttap");pe?pe.emit(tt):Z.emit(tt)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!V.touches[2]&&Z.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var We=Z.collection(e.getAllInBox(ve[0],ve[1],ve[2],ve[3]));ve[0]=void 0,ve[1]=void 0,ve[2]=void 0,ve[3]=void 0,ve[4]=0,e.redrawHint("select",!0),Z.emit(Ke("boxend"));var rt=function(xt){return xt.selectable()&&!xt.selected()};We.emit(Ke("box")).stdFilter(rt).select().emit(Ke("boxselect")),We.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(pe?.unactivate(),V.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!V.touches[1]){if(!V.touches[0]){if(!V.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Se=e.dragData.touchDragEles;if(pe!=null){var Et=pe._private.grabbed;g(Se),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Et&&(pe.emit(Ke("freeon")),Se.emit(Ke("free")),e.dragData.didDrag&&(pe.emit(Ke("dragfreeon")),Se.emit(Ke("dragfree")))),i(pe,["touchend","tapend","vmouseup","tapdragout"],V,{x:Ne[0],y:Ne[1]}),pe.unactivate(),e.touchData.start=null}else{var De=e.findNearestElement(Ne[0],Ne[1],!0,!0);i(De,["touchend","tapend","vmouseup","tapdragout"],V,{x:Ne[0],y:Ne[1]})}var mt=e.touchData.startPosition[0]-Ne[0],Tt=mt*mt,jt=e.touchData.startPosition[1]-Ne[1],_t=jt*jt,Rt=Tt+_t,bt=Rt*je*je;e.touchData.singleTouchMoved||(pe||Z.$(":selected").unselect(["tapunselect"]),i(pe,["tap","vclick"],V,{x:Ne[0],y:Ne[1]}),Ce=!1,V.timeStamp-de<=Z.multiClickDebounceTime()?(_e&&clearTimeout(_e),Ce=!0,de=null,i(pe,["dbltap","vdblclick"],V,{x:Ne[0],y:Ne[1]})):(_e=setTimeout(function(){Ce||i(pe,["onetap","voneclick"],V,{x:Ne[0],y:Ne[1]})},Z.multiClickDebounceTime()),de=V.timeStamp)),pe!=null&&!e.dragData.didDrag&&pe._private.selectable&&bt"u"){var ie=[],Q=function(V){return{clientX:V.clientX,clientY:V.clientY,force:1,identifier:V.pointerId,pageX:V.pageX,pageY:V.pageY,radiusX:V.width/2,radiusY:V.height/2,screenX:V.screenX,screenY:V.screenY,target:V.target}},he=function(V){return{event:V,touch:Q(V)}},xe=function(V){ie.push(he(V))},ce=function(V){for(var pe=0;pe0)return G[0]}return null},m=Object.keys(d),g=0;g0?p:rNe(a,s,t,r,n,i,o,l)},checkPoint:function(t,r,n,i,a,s,o,l){l=l==="auto"?yg(i,a):l;var u=2*l;if(F0(t,r,this.points,s,o,i,a-u,[0,-1],n)||F0(t,r,this.points,s,o,i-u,a,[0,-1],n))return!0;var h=i/2+2*n,f=a/2+2*n,d=[s-h,o-f,s-h,o,s+h,o,s+h,o-f];return!!(nc(t,r,d)||fv(t,r,u,u,s+i/2-l,o+a/2-l,n)||fv(t,r,u,u,s-i/2+l,o+a/2-l,n))}}};$0.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",wl(3,0)),this.generateRoundPolygon("round-triangle",wl(3,0)),this.generatePolygon("rectangle",wl(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",wl(5,0)),this.generateRoundPolygon("round-pentagon",wl(5,0)),this.generatePolygon("hexagon",wl(6,0)),this.generateRoundPolygon("round-hexagon",wl(6,0)),this.generatePolygon("heptagon",wl(7,0)),this.generateRoundPolygon("round-heptagon",wl(7,0)),this.generatePolygon("octagon",wl(8,0)),this.generateRoundPolygon("round-octagon",wl(8,0));var n=new Array(20);{var i=qK(5,0),a=qK(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=t.deqFastCost*C)break}else if(u){if(x>=t.deqCost*p||x>=t.deqAvgCost*d)break}else if(w>=t.deqNoDrawCost*NK)break;var T=t.deq(n,y,g);if(T.length>0)for(var k=0;k0&&(t.onDeqd(n,m),!u&&t.shouldRedraw(n,m,y,g)&&a())},o=t.priority||fZ;i.beforeRender(s,o(n))}}}},KIt=(function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$L;wg(this,e),this.idsByKey=new P0,this.keyForId=new P0,this.cachesByLvl=new P0,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=r}return kg(e,[{key:"getIdsFor",value:function(r){r==null&&ca("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Y4,n.set(r,i)),i}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);this.deleteIdForKey(i,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteIdForKey(i,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);return i!==a}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,i=this.lvls,a=n.get(r);return a||(a=new P0,n.set(r,a),i.push(r)),a}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var i=this.getKey(r),a=this.getCache(i,n);return a!=null&&this.updateKeyMappingFor(r),a}},{key:"getForCachedKey",value:function(r,n){var i=this.keyForId.get(r.id()),a=this.getCache(i,n);return a}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var i=this.getKey(r);return this.hasCache(i,n)}},{key:"setCache",value:function(r,n,i){i.key=r,this.getCachesAt(n).set(r,i)}},{key:"set",value:function(r,n,i){var a=this.getKey(r);this.setCache(a,n,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var i=this.getKey(r);this.deleteCache(i,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(i){return n.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteKeyMappingFor(r);var a=this.doesEleInvalidateKey(r);return a&&this.invalidateKey(i),a||this.getNumberOfIdsForKey(i)===0}}])})(),vMe=25,TL=50,DL=-4,rZ=3,oDe=7.99,ZIt=8,QIt=1024,JIt=1024,eMt=1024,tMt=.2,rMt=.8,nMt=10,iMt=.15,aMt=.1,sMt=.9,oMt=.9,lMt=100,cMt=1,B4={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},uMt=yo({getKey:null,doesEleInvalidateKey:$L,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:jMe,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),bC=function(t,r){var n=this;n.renderer=t,n.onDequeues=[];var i=uMt(r);zr(n,i),n.lookup=new KIt(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},Cs=bC.prototype;Cs.reasons=B4;Cs.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]};Cs.getRetiredTextureQueue=function(e){var t=this,r=t.eleImgCaches.retired=t.eleImgCaches.retired||{},n=r[e]=r[e]||[];return n};Cs.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new zC(function(r,n){return n.reqs-r.reqs});return t};Cs.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};Cs.getElement=function(e,t,r,n,i){var a=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(n==null&&(n=Math.ceil(pZ(o*r))),n=oDe||n>rZ)return null;var u=Math.pow(2,n),h=t.h*u,f=t.w*u,d=s.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p=l.get(e,n);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var m;if(h<=vMe?m=vMe:h<=TL?m=TL:m=Math.ceil(h/TL)*TL,h>eMt||f>JIt)return null;var g=a.getTextureQueue(m),y=g[g.length-2],v=function(){return a.recycleTexture(m,f)||a.addTexture(m,f)};y||(y=g[g.length-1]),y||(y=v()),y.width-y.usedWidthn;O--)I=a.getElement(e,t,r,O,B4.downscale);L()}else return a.queueElement(e,k.level-1),k;else{var R;if(!w&&!C&&!T)for(var A=n-1;A>=DL;A--){var N=l.get(e,A);if(N){R=N;break}}if(x(R))return a.queueElement(e,n),R;y.context.translate(y.usedWidth,0),y.context.scale(u,u),this.drawElement(y.context,e,t,d,!1),y.context.scale(1/u,1/u),y.context.translate(-y.usedWidth,0)}return p={x:y.usedWidth,texture:y,level:n,scale:u,width:f,height:h,scaledLabelShown:d},y.usedWidth+=Math.ceil(f+ZIt),y.eleCaches.push(p),l.set(e,n,p),a.checkTextureFullness(y),p};Cs.invalidateElements=function(e){for(var t=0;t=tMt*e.width&&this.retireTexture(e)};Cs.checkTextureFullness=function(e){var t=this,r=t.getTextureQueue(e.height);e.usedWidth/e.width>rMt&&e.fullnessChecks>=nMt?gg(r,e):e.fullnessChecks++};Cs.retireTexture=function(e){var t=this,r=e.height,n=t.getTextureQueue(r),i=this.lookup;gg(n,e),e.retired=!0;for(var a=e.eleCaches,s=0;s=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,dZ(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),gg(i,s),n.push(s),s}};Cs.queueElement=function(e,t){var r=this,n=r.getElementQueue(),i=r.getElementKeyToQueue(),a=this.getKey(e),s=i[a];if(s)s.level=Math.max(s.level,t),s.eles.merge(e),s.reqs++,n.updateItem(s);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),i[a]=o}};Cs.dequeue=function(e){for(var t=this,r=t.getElementQueue(),n=t.getElementKeyToQueue(),i=[],a=t.lookup,s=0;s0;s++){var o=r.pop(),l=o.key,u=o.eles[0],h=a.hasCache(u,o.level);if(n[l]=null,h)continue;i.push(o);var f=t.getBoundingBox(u);t.getElement(u,f,e,o.level,B4.dequeue)}return i};Cs.removeFromQueue=function(e){var t=this,r=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(e),a=n[i];a!=null&&(a.eles.length===1?(a.reqs=hZ,r.updateItem(a),r.pop(),n[i]=null):a.eles.unmerge(e))};Cs.onDequeue=function(e){this.onDequeues.push(e)};Cs.offDequeue=function(e){gg(this.onDequeues,e)};Cs.setupDequeueing=sDe.setupDequeueing({deqRedrawThreshold:lMt,deqCost:iMt,deqAvgCost:aMt,deqNoDrawCost:sMt,deqFastCost:oMt,deq:function(t,r,n){return t.dequeue(r,n)},onDeqd:function(t,r){for(var n=0;n=fMt||r>YL)return null}n.validateLayersElesOrdering(r,e);var l=n.layersByLevel,u=Math.pow(2,r),h=l[r]=l[r]||[],f,d=n.levelIsComplete(r,e),p,m=function(){var L=function(M){if(n.validateLayersElesOrdering(M,e),n.levelIsComplete(M,e))return p=l[M],!0},O=function(M){if(!p)for(var D=r+M;kC<=D&&D<=YL&&!L(D);D+=M);};O(1),O(-1);for(var R=h.length-1;R>=0;R--){var A=h[R];A.invalid&&gg(h,A)}};if(!d)m();else return h;var g=function(){if(!f){f=Tl();for(var L=0;LbMe||A>bMe)return null;var N=R*A;if(N>bMt)return null;var M=n.makeLayer(f,r);if(O!=null){var D=h.indexOf(O)+1;h.splice(D,0,M)}else(L.insert===void 0||L.insert)&&h.unshift(M);return M};if(n.skipping&&!o)return null;for(var v=null,x=e.length/hMt,w=!o,C=0;C=x||!tNe(v.bb,T.boundingBox()))&&(v=y({insert:!0,after:v}),!v))return null;p||w?n.queueLayer(v,T):n.drawEleInLayer(v,T,r,t),v.eles.push(T),S[r]=v}return p||(w?null:h)};vo.getEleLevelForLayerLevel=function(e,t){return e};vo.drawEleInLayer=function(e,t,r,n){var i=this,a=this.renderer,s=e.context,o=t.boundingBox();o.w===0||o.h===0||!t.visible()||(r=i.getEleLevelForLayerLevel(r,n),a.setImgSmoothing(s,!1),a.drawCachedElement(s,t,null,null,r,wMt),a.setImgSmoothing(s,!0))};vo.levelIsComplete=function(e,t){var r=this,n=r.layersByLevel[e];if(!n||n.length===0)return!1;for(var i=0,a=0;a0||s.invalid)return!1;i+=s.eles.length}return i===t.length};vo.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var n=0;n0){t=!0;break}}return t};vo.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=B0(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,i,a){t.invalidateLayer(n)}))};vo.invalidateLayer=function(e){if(this.lastInvalidationTime=B0(),!e.invalid){var t=e.level,r=e.eles,n=this.layersByLevel[t];gg(n,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=t._private.rscratch;if(!(a&&!t.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,h=a?t.pstyle("line-opacity").value:1,f=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,m=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,y=t.pstyle("line-outline-color").value,v=u*h,x=u*h,w=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;f==="straight-triangle"?(s.eleStrokeStyle(e,t,M),s.drawEdgeTrianglePath(t,e,o.allpts)):(e.lineWidth=p,e.lineCap=m,s.eleStrokeStyle(e,t,M),s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},C=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;if(e.lineWidth=p+g,e.lineCap=m,g>0)s.colorStrokeStyle(e,y[0],y[1],y[2],M);else{e.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(t,e,o.allpts):(s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},T=function(){i&&s.drawEdgeOverlay(e,t)},k=function(){i&&s.drawEdgeUnderlay(e,t)},S=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;s.drawArrowheads(e,t,M)},E=function(){s.drawElementText(e,t,null,n)};e.lineJoin="round";var I=t.pstyle("ghost").value==="yes";if(I){var L=t.pstyle("ghost-offset-x").pfValue,O=t.pstyle("ghost-offset-y").pfValue,R=t.pstyle("ghost-opacity").value,A=v*R;e.translate(L,O),w(A),S(A),e.translate(-L,-O)}else C();k(),w(),S(),T(),E(),r&&e.translate(l.x1,l.y1)}};uDe=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(r,n){if(n.visible()){var i=n.pstyle("".concat(t,"-opacity")).value;if(i!==0){var a=this,s=a.usePaths(),o=n._private.rscratch,l=n.pstyle("".concat(t,"-padding")).pfValue,u=2*l,h=n.pstyle("".concat(t,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",a.colorStrokeStyle(r,h[0],h[1],h[2],i),a.drawEdgePath(n,r,o.allpts,"solid")}}}};z0.drawEdgeOverlay=uDe("overlay");z0.drawEdgeUnderlay=uDe("underlay");z0.drawEdgePath=function(e,t,r,n){var i=e._private.rscratch,a=t,s,o=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,h=e.pstyle("line-dash-offset").pfValue;if(l){var f=r.join("$"),d=i.pathCacheKey&&i.pathCacheKey===f;d?(s=t=i.pathCache,o=!0):(s=t=new Path2D,i.pathCacheKey=f,i.pathCache=s)}if(a.setLineDash)switch(n){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=h;break;case"solid":a.setLineDash([]);break}if(!o&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(n==null){if(a&&!s.eleTextBiggerThanMin(t))return}else if(n===!1)return;if(t.isNode()){var o=t.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(t),u=t.pstyle("text-metrics").strValue==="glyph";e.textAlign=l,e.textBaseline=u?"alphabetic":"bottom"}else{var h=t.element()._private.rscratch.badLine,f=t.pstyle("label"),d=t.pstyle("source-label"),p=t.pstyle("target-label");if(h||(!f||!f.value)&&(!d||!d.value)&&(!p||!p.value))return;e.textAlign="center",e.textBaseline="bottom"}var m=!r,g;r&&(g=r,e.translate(-g.x1,-g.y1)),i==null?(s.drawText(e,t,null,m,a),t.isEdge()&&(s.drawText(e,t,"source",m,a),s.drawText(e,t,"target",m,a))):s.drawText(e,t,i,m,a),r&&e.translate(g.x1,g.y1)};xv.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!0,n=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,o=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*o,u=t.pstyle("color").value,h=t.pstyle("text-outline-color").value;e.font=n+" "+s+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],o),this.colorStrokeStyle(e,h[0],h[1],h[2],l)};xv.getTextAngle=function(e,t){var r,n=e._private,i=n.rscratch,a=t?t+"-":"",s=e.pstyle(a+"text-rotation");if(s.strValue==="autorotate"){var o=kl(i,"labelAngle",t);r=e.isEdge()?o:0}else s.strValue==="none"?r=0:r=s.pfValue;return r};xv.drawText=function(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private,s=a.rscratch,o=i?t.effectiveOpacity():1;if(!(i&&(o===0||t.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=kl(s,"labelX",r),u=kl(s,"labelY",r),h,f,d=this.getLabelText(t,r);if(d!=null&&d!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(e,t,i);var p=r?r+"-":"",m=kl(s,"labelWidth",r),g=kl(s,"labelHeight",r),y=kl(s,"labelActualDescent",r),v=t.pstyle(p+"text-margin-x").pfValue,x=t.pstyle(p+"text-margin-y").pfValue,w=t.isEdge(),C=t.pstyle("text-halign").value,T=t.pstyle("text-valign").value;w&&(C="center",T="center"),l+=v,u+=x;var k;n?k=this.getTextAngle(t,r):k=0,k!==0&&(h=l,f=u,e.translate(h,f),e.rotate(k),l=0,u=0);var S=H4(C),E=U4(T);switch(E){case"top":break;case"center":u+=g/2;break;case"bottom":u+=g;break}var I=t.pstyle("text-background-opacity").value,L=t.pstyle("text-border-opacity").value,O=t.pstyle("text-border-width").pfValue,R=t.pstyle("text-background-padding").pfValue,A=t.pstyle("text-background-shape").strValue,N=A==="round-rectangle"||A==="roundrectangle",M=A==="circle",D=2;if(I>0||O>0&&L>0){var B=e.fillStyle,P=e.strokeStyle,$=e.lineWidth,F=t.pstyle("text-background-color").value,q=t.pstyle("text-border-color").value,G=t.pstyle("text-border-style").value,z=I>0,H=O>0&&L>0,j=l-R;switch(S){case"left":j-=m;break;case"center":j-=m/2;break}var J=u-g-R,U=m+2*R,le=g+2*R;if(z&&(e.fillStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(I*o,")")),H&&(e.strokeStyle="rgba(".concat(q[0],",").concat(q[1],",").concat(q[2],",").concat(L*o,")"),e.lineWidth=O,e.setLineDash))switch(G){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=O/4,e.setLineDash([]);break;default:e.setLineDash([]);break}if(N?(e.beginPath(),CMe(e,j,J,U,le,D)):M?(e.beginPath(),MMt(e,j,J,U,le)):(e.beginPath(),e.rect(j,J,U,le)),z&&e.fill(),H&&e.stroke(),H&&G==="double"){var ee=O/2;e.beginPath(),N?CMe(e,j+ee,J+ee,U-2*ee,le-2*ee,D):e.rect(j+ee,J+ee,U-2*ee,le-2*ee),e.stroke()}e.fillStyle=B,e.strokeStyle=P,e.lineWidth=$,e.setLineDash&&e.setLineDash([])}var ue=2*t.pstyle("text-outline-width").pfValue;if(ue>0&&(e.lineWidth=ue),u-=y,t.pstyle("text-wrap").value==="wrap"){var ae=kl(s,"labelWrapCachedLines",r),oe=kl(s,"labelLineHeight",r),Re=m/2,Te=this.getLabelJustification(t);switch(Te==="auto"||(S==="left"?Te==="left"?l+=-m:Te==="center"&&(l+=-Re):S==="center"?Te==="left"?l+=-Re:Te==="right"&&(l+=Re):S==="right"&&(Te==="center"?l+=Re:Te==="right"&&(l+=m))),E){case"top":u-=(ae.length-1)*oe;break;case"center":case"bottom":u-=(ae.length-1)*oe;break}for(var Oe=0;Oe0&&e.strokeText(ae[Oe],l,u),e.fillText(ae[Oe],l,u),u+=oe}else ue>0&&e.strokeText(d,l,u),e.fillText(d,l,u);k!==0&&(e.rotate(-k),e.translate(-h,-f))}}};Cg={};Cg.drawNode=function(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=t._private,h=u.rscratch,f=t.position();if(!(!Zt(f.x)||!Zt(f.y))&&!(a&&!t.visible())){var d=a?t.effectiveOpacity():1,p=s.usePaths(),m,g=!1,y=t.padding();o=t.width()+2*y,l=t.height()+2*y;var v;r&&(v=r,e.translate(-v.x1,-v.y1));for(var x=t.pstyle("background-image"),w=x.value,C=new Array(w.length),T=new Array(w.length),k=0,S=0;S0&&arguments[0]!==void 0?arguments[0]:A;s.eleFillStyle(e,t,V)},ee=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;s.colorStrokeStyle(e,N[0],N[1],N[2],V)},ue=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j;s.colorStrokeStyle(e,z[0],z[1],z[2],V)},ae=function(V,pe,K,ve){var Z=s.nodePathCache=s.nodePathCache||[],je=XMe(K==="polygon"?K+","+ve.join(","):K,""+pe,""+V,""+U),Ne=Z[je],ze,Fe=!1;return Ne!=null?(ze=Ne,Fe=!0,h.pathCache=ze):(ze=new Path2D,Z[je]=h.pathCache=ze),{path:ze,cacheHit:Fe}},oe=t.pstyle("shape").strValue,Re=t.pstyle("shape-polygon-points").pfValue;if(p){e.translate(f.x,f.y);var Te=ae(o,l,oe,Re);m=Te.path,g=Te.cacheHit}var Oe=function(){if(!g){var V=f;p&&(V={x:0,y:0}),s.nodeShapes[s.getNodeShape(t)].draw(m||e,V.x,V.y,o,l,U,h)}p?e.fill(m):e.fill()},qe=function(){for(var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,K=u.backgrounding,ve=0,Z=0;Z0&&arguments[0]!==void 0?arguments[0]:!1,pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasPie(t)&&(s.drawPie(e,t,pe),V&&(p||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,o,l,U,h)))},fe=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasStripe(t)&&(e.save(),p?e.clip(h.pathCache):(s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,o,l,U,h),e.clip()),s.drawStripe(e,t,pe),e.restore(),V&&(p||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,o,l,U,h)))},Ce=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,pe=(O>0?O:-O)*V,K=O>0?0:255;O!==0&&(s.colorFillStyle(e,K,K,K,pe),p?e.fill(m):e.fill())},_e=function(){if(R>0){if(e.lineWidth=R,e.lineCap=B,e.lineJoin=D,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash($),e.lineDashOffset=F;break;case"solid":case"double":e.setLineDash([]);break}if(P!=="center"){if(e.save(),e.lineWidth*=2,P==="inside")p?e.clip(m):e.clip();else{var V=new Path2D;V.rect(-o/2-R,-l/2-R,o+2*R,l+2*R),V.addPath(m),e.clip(V,"evenodd")}p?e.stroke(m):e.stroke(),e.restore()}else p?e.stroke(m):e.stroke();if(M==="double"){e.lineWidth=R/3;var pe=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(m):e.stroke(),e.globalCompositeOperation=pe}e.setLineDash&&e.setLineDash([])}},de=function(){if(G>0){if(e.lineWidth=G,e.lineCap="butt",e.setLineDash)switch(H){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var V=f;p&&(V={x:0,y:0});var pe=s.getNodeShape(t),K=R;P==="inside"&&(K=0),P==="outside"&&(K*=2);var ve=(o+K+(G+J))/o,Z=(l+K+(G+J))/l,je=o*ve,Ne=l*Z,ze=s.nodeShapes[pe].points,Fe;if(p){var Ke=ae(je,Ne,pe,ze);Fe=Ke.path}if(pe==="ellipse")s.drawEllipsePath(Fe||e,V.x,V.y,je,Ne);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(pe)){var Ve=0,tt=0,We=0;pe==="round-diamond"?Ve=(K+J+G)*1.4:pe==="round-heptagon"?(Ve=(K+J+G)*1.075,We=-(K/2+J+G)/35):pe==="round-hexagon"?Ve=(K+J+G)*1.12:pe==="round-pentagon"?(Ve=(K+J+G)*1.13,We=-(K/2+J+G)/15):pe==="round-tag"?(Ve=(K+J+G)*1.12,tt=(K/2+G+J)*.07):pe==="round-triangle"&&(Ve=(K+J+G)*(Math.PI/2),We=-(K+J/2+G)/Math.PI),Ve!==0&&(ve=(o+Ve)/o,je=o*ve,["round-hexagon","round-tag"].includes(pe)||(Z=(l+Ve)/l,Ne=l*Z)),U=U==="auto"?iNe(je,Ne):U;for(var rt=je/2,Se=Ne/2,Et=U+(K+G+J)/2,De=new Array(ze.length/2),mt=new Array(ze.length/2),Tt=0;Tt0){if(i=i||n.position(),a==null||s==null){var p=n.padding();a=n.width()+2*p,s=n.height()+2*p}o.colorFillStyle(r,h[0],h[1],h[2],u),o.nodeShapes[f].draw(r,i.x,i.y,a+l*2,s+l*2,d),r.fill()}}}};Cg.drawNodeOverlay=hDe("overlay");Cg.drawNodeUnderlay=hDe("underlay");Cg.hasPie=function(e){return e=e[0],e._private.hasPie};Cg.hasStripe=function(e){return e=e[0],e._private.hasStripe};Cg.drawPie=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),o=t.pstyle("pie-start-angle").pfValue,l=n.x,u=n.y,h=t.width(),f=t.height(),d=Math.min(h,f)/2,p,m=0,g=this.usePaths();if(g&&(l=0,u=0),a.units==="%"?d=d*a.pfValue:a.pfValue!==void 0&&(d=a.pfValue/2),s.units==="%"?p=d*s.pfValue:s.pfValue!==void 0&&(p=s.pfValue/2),!(p>=d))for(var y=1;y<=i.pieBackgroundN;y++){var v=t.pstyle("pie-"+y+"-background-size").value,x=t.pstyle("pie-"+y+"-background-color").value,w=t.pstyle("pie-"+y+"-background-opacity").value*r,C=v/100;C+m>1&&(C=1-m);var T=1.5*Math.PI+2*Math.PI*m;T+=o;var k=2*Math.PI*C,S=T+k;v===0||m>=1||m+C>1||(p===0?(e.beginPath(),e.moveTo(l,u),e.arc(l,u,d,T,S),e.closePath()):(e.beginPath(),e.arc(l,u,d,T,S),e.arc(l,u,p,S,T,!0),e.closePath()),this.colorFillStyle(e,x[0],x[1],x[2],w),e.fill(),m+=C)}};Cg.drawStripe=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=n.x,s=n.y,o=t.width(),l=t.height(),u=0,h=this.usePaths();e.save();var f=t.pstyle("stripe-direction").value,d=t.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":e.rotate(-Math.PI/2);break}var p=o,m=l;d.units==="%"?(p=p*d.pfValue,m=m*d.pfValue):d.pfValue!==void 0&&(p=d.pfValue,m=d.pfValue),h&&(a=0,s=0),s-=p/2,a-=m/2;for(var g=1;g<=i.stripeBackgroundN;g++){var y=t.pstyle("stripe-"+g+"-background-size").value,v=t.pstyle("stripe-"+g+"-background-color").value,x=t.pstyle("stripe-"+g+"-background-opacity").value*r,w=y/100;w+u>1&&(w=1-u),!(y===0||u>=1||u+w>1)&&(e.beginPath(),e.rect(a,s+m*u,p,m*w),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],x),e.fill(),u+=w)}e.restore()};Cl={},NMt=100;Cl.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),r=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/r};Cl.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],r=!0,n,i=0;it.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!f&&(h[t.NODE]=!0,h[t.SELECT_BOX]=!0);var x=r.style(),w=r.zoom(),C=s!==void 0?s:w,T=r.pan(),k={x:T.x,y:T.y},S={zoom:w,pan:{x:T.x,y:T.y}},E=t.prevViewport,I=E===void 0||S.zoom!==E.zoom||S.pan.x!==E.pan.x||S.pan.y!==E.pan.y;!I&&!(g&&!m)&&(t.motionBlurPxRatio=1),o&&(k=o),C*=l,k.x*=l,k.y*=l;var L=t.getCachedZSortedEles();function O(ee,ue,ae,oe,Re){var Te=ee.globalCompositeOperation;ee.globalCompositeOperation="destination-out",t.colorFillStyle(ee,255,255,255,t.motionBlurTransparency),ee.fillRect(ue,ae,oe,Re),ee.globalCompositeOperation=Te}function R(ee,ue){var ae,oe,Re,Te;!t.clearingMotionBlur&&(ee===u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||ee===u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(ae={x:T.x*p,y:T.y*p},oe=w*p,Re=t.canvasWidth*p,Te=t.canvasHeight*p):(ae=k,oe=C,Re=t.canvasWidth,Te=t.canvasHeight),ee.setTransform(1,0,0,1,0,0),ue==="motionBlur"?O(ee,0,0,Re,Te):!n&&(ue===void 0||ue)&&ee.clearRect(0,0,Re,Te),i||(ee.translate(ae.x,ae.y),ee.scale(oe,oe)),o&&ee.translate(o.x,o.y),s&&ee.scale(s,s)}if(f||(t.textureDrawLastFrame=!1),f){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=r.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var A=t.data.bufferContexts[t.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});var S=t.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:t.canvasWidth,height:t.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}h[t.DRAG]=!1,h[t.NODE]=!1;var N=u.contexts[t.NODE],M=t.textureCache.texture,S=t.textureCache.viewport;N.setTransform(1,0,0,1,0,0),d?O(N,0,0,S.width,S.height):N.clearRect(0,0,S.width,S.height);var D=x.core("outside-texture-bg-color").value,B=x.core("outside-texture-bg-opacity").value;t.colorFillStyle(N,D[0],D[1],D[2],B),N.fillRect(0,0,S.width,S.height);var w=r.zoom();R(N,!1),N.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/l,S.height/S.zoom/l),N.drawImage(M,S.mpan.x,S.mpan.y,S.width/S.zoom/l,S.height/S.zoom/l)}else t.textureOnViewport&&!n&&(t.textureCache=null);var P=r.extent(),$=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),F=t.hideEdgesOnViewport&&$,q=[];if(q[t.NODE]=!h[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,q[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),q[t.DRAG]=!h[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,q[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),h[t.NODE]||i||a||q[t.NODE]){var G=d&&!q[t.NODE]&&p!==1,N=n||(G?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),z=d&&!G?"motionBlur":void 0;R(N,z),F?t.drawCachedNodes(N,L.nondrag,l,P):t.drawLayeredElements(N,L.nondrag,l,P),t.debug&&t.drawDebugPoints(N,L.nondrag),!i&&!d&&(h[t.NODE]=!1)}if(!a&&(h[t.DRAG]||i||q[t.DRAG])){var G=d&&!q[t.DRAG]&&p!==1,N=n||(G?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]);R(N,d&&!G?"motionBlur":void 0),F?t.drawCachedNodes(N,L.drag,l,P):t.drawCachedElements(N,L.drag,l,P),t.debug&&t.drawDebugPoints(N,L.drag),!i&&!d&&(h[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,R),d&&p!==1){var H=u.contexts[t.NODE],j=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],J=u.contexts[t.DRAG],U=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],le=function(ue,ae,oe){ue.setTransform(1,0,0,1,0,0),oe||!v?ue.clearRect(0,0,t.canvasWidth,t.canvasHeight):O(ue,0,0,t.canvasWidth,t.canvasHeight);var Re=p;ue.drawImage(ae,0,0,t.canvasWidth*Re,t.canvasHeight*Re,0,0,t.canvasWidth,t.canvasHeight)};(h[t.NODE]||q[t.NODE])&&(le(H,j,q[t.NODE]),h[t.NODE]=!1),(h[t.DRAG]||q[t.DRAG])&&(le(J,U,q[t.DRAG]),h[t.DRAG]=!1)}t.prevViewport=S,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!f,t.mbFrames=0,h[t.NODE]=!0,h[t.DRAG]=!0,t.redraw()},NMt)),n||r.emit("render")};Cl.drawSelectionRectangle=function(e,t){var r=this,n=r.cy,i=r.data,a=n.style(),s=e.drawOnlyNodeLayer,o=e.drawAllLayers,l=i.canvasNeedsRedraw,u=e.forcedContext;if(r.showFps||!s&&l[r.SELECT_BOX]&&!o){var h=u||i.contexts[r.SELECT_BOX];if(t(h),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var f=r.cy.zoom(),d=a.core("selection-box-border-width").value/f;h.lineWidth=d,h.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",h.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),d>0&&(h.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",h.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var f=r.cy.zoom(),p=i.bgActivePosistion;h.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",h.beginPath(),h.arc(p.x,p.y,a.core("active-bg-size").pfValue/f,0,2*Math.PI),h.fill()}var m=r.lastRedrawTime;if(r.showFps&&m){m=Math.round(m);var g=Math.round(1e3/m),y="1 frame = "+m+" ms = "+g+" fps";if(h.setTransform(1,0,0,1,0,0),h.fillStyle="rgba(255, 0, 0, 0.75)",h.strokeStyle="rgba(255, 0, 0, 0.75)",h.font="30px Arial",!mC){var v=h.measureText(y);mC=v.actualBoundingBoxAscent}h.fillText(y,0,mC);var x=60;h.strokeRect(0,mC+10,250,20),h.fillRect(0,mC+10,250*Math.min(g/x,1),20)}o||(l[r.SELECT_BOX]=!1)}};EMe=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});XMt=(function(){function e(t,r,n,i){wg(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=r,this.texRows=n,this.texHeight=Math.floor(r/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,r,r),this.scratch=i(t,r,this.texHeight,"scratch")}return kg(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var n=r.w,i=r.h,a=this.texHeight,s=this.texSize,o=a/i,l=n*o,u=i*o;return l>s&&(o=s/n,l=n*o,u=i*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(r,n,i){var a=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,l=this.texHeight,u=this.getScale(n),h=u.scale,f=u.texW,d=u.texH,p=function(w,C){if(i&&C){var T=C.context,k=w.x,S=w.row,E=k,I=l*S;T.save(),T.translate(E,I),T.scale(h,h),i(T,n),T.restore()}},m=[null,null],g=function(){p(a.freePointer,a.canvas),m[0]={x:a.freePointer.x,y:a.freePointer.row*l,w:f,h:d},m[1]={x:a.freePointer.x+f,y:a.freePointer.row*l,w:0,h:d},a.freePointer.x+=f,a.freePointer.x==s&&(a.freePointer.x=0,a.freePointer.row++)},y=function(){var w=a.scratch,C=a.canvas;w.clear(),p({x:0,row:0},w);var T=s-a.freePointer.x,k=f-T,S=l;{var E=a.freePointer.x,I=a.freePointer.row*l,L=T;C.context.drawImage(w,0,0,L,S,E,I,L,S),m[0]={x:E,y:I,w:L,h:d}}{var O=T,R=(a.freePointer.row+1)*l,A=k;C&&C.context.drawImage(w,O,0,A,S,0,R,A,S),m[1]={x:0,y:R,w:A,h:d}}a.freePointer.x=k,a.freePointer.row++},v=function(){a.freePointer.x=0,a.freePointer.row++};if(this.freePointer.x+f<=s)g();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(v(),g()):this.enableWrapping?y():(v(),g())}return this.keyToLocation.set(r,m),this.needsBuffer=!0,m}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var n=this.texSize,i=this.texRows,a=this.getScale(r),s=a.texW;return this.freePointer.x+s>n?this.freePointer.row1&&arguments[1]!==void 0?arguments[1]:{},a=i.forceRedraw,s=a===void 0?!1:a,o=i.filterEle,l=o===void 0?function(){return!0}:o,u=i.filterType,h=u===void 0?function(){return!0}:u,f=!1,d=!1,p=ic(r),m;try{for(p.s();!(m=p.n()).done;){var g=m.value;if(l(g)){var y=ic(this.renderTypes.values()),v;try{var x=function(){var C=v.value,T=C.type;if(h(T)){var k=n.collections.get(C.collection),S=C.getKey(g),E=Array.isArray(S)?S:[S];if(s)E.forEach(function(R){return k.markKeyForGC(R)}),d=!0;else{var I=C.getID?C.getID(g):g.id(),L=n._key(T,I),O=n.typeAndIdToKey.get(L);O!==void 0&&!$Mt(E,O)&&(f=!0,n.typeAndIdToKey.delete(L),O.forEach(function(R){return k.markKeyForGC(R)}))}}};for(y.s();!(v=y.n()).done;)x()}catch(w){y.e(w)}finally{y.f()}}}}catch(w){p.e(w)}finally{p.f()}return d&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var r=ic(this.collections.values()),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;i.gc()}}catch(a){r.e(a)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,n,i,a){var s=this.renderTypes.get(n),o=this.collections.get(s.collection),l=!1,u=o.draw(a,i,function(d){s.drawClipped?(d.save(),d.beginPath(),d.rect(0,0,i.w,i.h),d.clip(),s.drawElement(d,r,i,!0,!0),d.restore()):s.drawElement(d,r,i,!0,!0),l=!0});if(l){var h=s.getID?s.getID(r):r.id(),f=this._key(n,h);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(a):this.typeAndIdToKey.set(f,[a])}return u}},{key:"getAtlasInfo",value:function(r,n){var i=this,a=this.renderTypes.get(n),s=a.getKey(r),o=Array.isArray(s)?s:[s];return o.map(function(l){var u=a.getBoundingBox(r,l),h=i.getOrCreateAtlas(r,n,u,l),f=h.getOffsets(l),d=as(f,2),p=d[0],m=d[1];return{atlas:h,tex:p,tex1:p,tex2:m,bb:u}})}},{key:"getDebugInfo",value:function(){var r=[],n=ic(this.collections),i;try{for(n.s();!(i=n.n()).done;){var a=as(i.value,2),s=a[0],o=a[1],l=o.getCounts(),u=l.keyCount,h=l.atlasCount;r.push({type:s,keyCount:u,atlasCount:h})}}catch(f){n.e(f)}finally{n.f()}return r}}])})(),QMt=(function(){function e(t){wg(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return kg(e,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,n){return n})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var n=this.batchAtlases.indexOf(r);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),n=this.batchAtlases.length-1}return n}}])})(),JMt=` float circleSD(vec2 p, float r) { return distance(vec2(0), p) - r; // signed distance } -`,KMt=` +`,eNt=` float rectangleSD(vec2 p, vec2 b) { vec2 d = abs(p)-b; return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0); } -`,ZMt=` +`,tNt=` float roundRectangleSD(vec2 p, vec2 b, vec4 cr) { cr.xy = (p.x > 0.0) ? cr.xy : cr.zw; cr.x = (p.y > 0.0) ? cr.x : cr.y; vec2 q = abs(p) - b + cr.x; return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x; } -`,QMt=` +`,rNt=` float ellipseSD(vec2 p, vec2 ab) { p = abs( p ); // symmetry @@ -596,7 +596,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho // return signed distance return (dot(p/ab,p/ab)>1.0) ? d : -d; } -`,TC={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},XL={IGNORE:1,USE_BB:2},DK=0,AMe=1,_Me=2,OK=3,N4=4,CL=5,gC=6,yC=7,JMt=(function(){function e(t,r,n){wg(this,e),this.r=t,this.gl=r,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=IMt,this.atlasManager=new YMt(t,n),this.batchManager=new XMt(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(TC.SCREEN),this.pickingProgram=this._createShaderProgram(TC.PICKING),this.vao=this._createVAO()}return kg(e,[{key:"addAtlasCollection",value:function(r,n){this.atlasManager.addAtlasCollection(r,n)}},{key:"addTextureAtlasRenderType",value:function(r,n){this.atlasManager.addRenderType(r,n)}},{key:"addSimpleShapeRenderType",value:function(r,n){this.simpleShapeOptions.set(r,n)}},{key:"invalidate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.type,a=this.atlasManager;return i?a.invalidate(r,{filterType:function(o){return o===i},forceRedraw:!0}):a.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var n=this.gl,i=`#version 300 es +`,TC={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},XL={IGNORE:1,USE_BB:2},PK=0,RMe=1,LMe=2,BK=3,N4=4,CL=5,gC=6,yC=7,nNt=(function(){function e(t,r,n){wg(this,e),this.r=t,this.gl=r,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=OMt,this.atlasManager=new ZMt(t,n),this.batchManager=new QMt(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(TC.SCREEN),this.pickingProgram=this._createShaderProgram(TC.PICKING),this.vao=this._createVAO()}return kg(e,[{key:"addAtlasCollection",value:function(r,n){this.atlasManager.addAtlasCollection(r,n)}},{key:"addTextureAtlasRenderType",value:function(r,n){this.atlasManager.addRenderType(r,n)}},{key:"addSimpleShapeRenderType",value:function(r,n){this.simpleShapeOptions.set(r,n)}},{key:"invalidate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.type,a=this.atlasManager;return i?a.invalidate(r,{filterType:function(o){return o===i},forceRedraw:!0}):a.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var n=this.gl,i=`#version 300 es precision highp float; uniform mat3 uPanZoomMatrix; @@ -643,7 +643,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho int vid = gl_VertexID; vec2 position = aPosition; // TODO make this a vec3, simplifies some code below - if(aVertType == `.concat(DK,`) { + if(aVertType == `.concat(PK,`) { float texX = aTex.x; // texture coordinates float texY = aTex.y; float texW = aTex.z; @@ -677,7 +677,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); } - else if(aVertType == `).concat(AMe,`) { + else if(aVertType == `).concat(RMe,`) { vec2 source = aPointAPointB.xy; vec2 target = aPointAPointB.zw; @@ -692,7 +692,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0); vColor = aColor; } - else if(aVertType == `).concat(_Me,`) { + else if(aVertType == `).concat(LMe,`) { vec2 pointA = aPointAPointB.xy; vec2 pointB = aPointAPointB.zw; vec2 pointC = aPointCPointD.xy; @@ -741,7 +741,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vColor = aColor; } - else if(aVertType == `).concat(OK,` && vid < 3) { + else if(aVertType == `).concat(BK,` && vid < 3) { // massage the first triangle into an edge arrow if(vid == 0) position = vec2(-0.15, -0.3); @@ -786,10 +786,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho out vec4 outColor; - `).concat(jMt,` - `).concat(KMt,` - `).concat(ZMt,` - `).concat(QMt,` + `).concat(JMt,` + `).concat(eNt,` + `).concat(tNt,` + `).concat(rNt,` vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha return vec4( @@ -805,12 +805,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } void main(void) { - if(vVertType == `).concat(DK,`) { + if(vVertType == `).concat(PK,`) { // look up the texel from the texture unit `).concat(a.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(` else `),` } - else if(vVertType == `).concat(OK,`) { + else if(vVertType == `).concat(BK,`) { // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out'; outColor = blend(vColor, uBGColor); outColor.a = 1.0; // make opaque, masks out line under arrow @@ -874,16 +874,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `).concat(r.picking?`if(outColor.a == 0.0) discard; else outColor = vIndex;`:"",` } - `),o=LMt(n,i,s);o.aPosition=n.getAttribLocation(o,"aPosition"),o.aIndex=n.getAttribLocation(o,"aIndex"),o.aVertType=n.getAttribLocation(o,"aVertType"),o.aTransform=n.getAttribLocation(o,"aTransform"),o.aAtlasId=n.getAttribLocation(o,"aAtlasId"),o.aTex=n.getAttribLocation(o,"aTex"),o.aPointAPointB=n.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=n.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=n.getAttribLocation(o,"aLineWidth"),o.aColor=n.getAttribLocation(o,"aColor"),o.aCornerRadius=n.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=n.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=n.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=n.getUniformLocation(o,"uAtlasSize"),o.uBGColor=n.getUniformLocation(o,"uBGColor"),o.uZoom=n.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var l=0;l1&&arguments[1]!==void 0?arguments[1]:TC.SCREEN;this.panZoomMatrix=r,this.renderTarget=n,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,n){return r.visible()?n&&n.isVisible?n.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,n,i){var a=this.atlasManager,s=this.batchManager,o=a.getRenderTypeOpts(i);if(this._isVisible(r,o)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&o.getTexPickingMode){var l=o.getTexPickingMode(r);if(l===XL.IGNORE)return;if(l==XL.USE_BB){this.drawPickingRectangle(r,n,i);return}}var u=a.getAtlasInfo(r,i),h=nc(u),f;try{for(h.s();!(f=h.n()).done;){var d=f.value,p=d.atlas,m=d.tex1,g=d.tex2;s.canAddToCurrentBatch(p)||this.endBatch();for(var y=s.getAtlasIndexForBatch(p),v=0,x=[[m,!0],[g,!1]];v=this.maxInstances&&this.endBatch()}}}}catch(O){h.e(O)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(r,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(i.shapeProps&&i.shapeProps.padding&&(o=r.pstyle(i.shapeProps.padding).pfValue),a){var l=a.bb,u=a.tex1,h=a.tex2,f=u.w/(u.w+h.w);s||(f=1-f);var d=this._getAdjustedBB(l,o,s,f);this._applyTransformMatrix(n,d,i,r)}else{var p=i.getBoundingBox(r),m=this._getAdjustedBB(p,o,!0,1);this._applyTransformMatrix(n,m,i,r)}}},{key:"_applyTransformMatrix",value:function(r,n,i,a){var s,o;SMe(r);var l=i.getRotation?i.getRotation(a):0;if(l!==0){var u=i.getRotationPoint(a),h=u.x,f=u.y;OL(r,r,[h,f]),EMe(r,r,l);var d=i.getRotationOffset(a);s=d.x+(n.xOffset||0),o=d.y+(n.yOffset||0)}else s=n.x1,o=n.y1;OL(r,r,[s,o]),tZ(r,r,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(r,n,i,a){var s=r.x1,o=r.y1,l=r.w,u=r.h,h=r.yOffset;n&&(s-=n,o-=n,l+=2*n,u+=2*n);var f=0,d=l*a;return i&&a<1?l=d:!i&&a<1&&(f=l-d,s+=f,l=d),{x1:s,y1:o,w:l,h:u,xOffset:f,yOffset:h}}},{key:"drawPickingRectangle",value:function(r,n,i){var a=this.atlasManager.getRenderTypeOpts(i),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=N4;var o=this.indexBuffer.getView(s);M4(n,o);var l=this.colorBuffer.getView(s);sv([0,0,0],1,l);var u=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(r,u,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,n,i){var a=this.simpleShapeOptions.get(i);if(this._isVisible(r,a)){var s=a.shapeProps,o=this._getVertTypeForShape(r,s.shape);if(o===void 0||a.isSimple&&!a.isSimple(r,this.renderTarget)){this.drawTexture(r,n,i);return}var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=o,o===CL||o===gC){var u=a.getBoundingBox(r),h=this._getCornerRadius(r,s.radius,u),f=this.cornerRadiusBuffer.getView(l);f[0]=h,f[1]=h,f[2]=h,f[3]=h,o===gC&&(f[0]=0,f[2]=0)}var d=this.indexBuffer.getView(l);M4(n,d);var p=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,m=this.renderTarget.picking?1:r.pstyle(s.opacity).value*p,g=r.pstyle(s.color).value,y=this.colorBuffer.getView(l);sv(g,m,y);var v=this.lineWidthBuffer.getView(l);if(v[0]=0,v[1]=0,s.border){var x=r.pstyle("border-width").value;if(x>0){var w=r.pstyle("border-color").value,C=p*r.pstyle("border-opacity").value,T=this.borderColorBuffer.getView(l);sv(w,C,T);var k=r.pstyle("border-position").value;if(k==="inside")v[0]=0,v[1]=-x;else if(k==="outside")v[0]=x,v[1]=0;else{var S=x/2;v[0]=S,v[1]=-S}}}var E=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(r,E,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,n){var i=r.pstyle(n).value;switch(i){case"rectangle":return N4;case"ellipse":return yC;case"roundrectangle":case"round-rectangle":return CL;case"bottom-round-rectangle":return gC;default:return}}},{key:"_getCornerRadius",value:function(r,n,i){var a=i.w,s=i.h;if(r.pstyle(n).value==="auto")return yg(a,s);var o=r.pstyle(n).pfValue,l=a/2,u=s/2;return Math.min(o,u,l)}},{key:"drawEdgeArrow",value:function(r,n,i){if(r.visible()){var a=r._private.rscratch,s,o,l;if(i==="source"?(s=a.arrowStartX,o=a.arrowStartY,l=a.srcArrowAngle):(s=a.arrowEndX,o=a.arrowEndY,l=a.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(l)||l==null)){var u=r.pstyle(i+"-arrow-shape").value;if(u!=="none"){var h=r.pstyle(i+"-arrow-color").value,f=r.pstyle("opacity").value,d=r.pstyle("line-opacity").value,p=f*d,m=r.pstyle("width").pfValue,g=r.pstyle("arrow-scale").value,y=this.r.getArrowWidth(m,g),v=this.instanceCount,x=this.transformBuffer.getMatrixView(v);SMe(x),OL(x,x,[s,o]),tZ(x,x,[y,y]),EMe(x,x,l),this.vertTypeBuffer.getView(v)[0]=OK;var w=this.indexBuffer.getView(v);M4(n,w);var C=this.colorBuffer.getView(v);sv(h,p,C),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,n){if(r.visible()){var i=this._getEdgePoints(r);if(i){var a=r.pstyle("opacity").value,s=r.pstyle("line-opacity").value,o=r.pstyle("width").pfValue,l=r.pstyle("line-color").value,u=a*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=AMe;var f=this.indexBuffer.getView(h);M4(n,f);var d=this.colorBuffer.getView(h);sv(l,u,d);var p=this.lineWidthBuffer.getView(h);p[0]=o;var m=this.pointAPointBBuffer.getView(h);m[0]=i[0],m[1]=i[1],m[2]=i[2],m[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var g=0;g=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var n=r._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var n=r._private.rscratch;if(this._isValidEdge(r)){var i=n.allpts;if(i.length==4)return i;var a=this._getNumSegments(r);return this._getCurveSegmentPoints(i,a)}}},{key:"_getNumSegments",value:function(r){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,n){if(r.length==4)return r;for(var i=Array((n+1)*2),a=0;a<=n;a++)if(a==0)i[0]=r[0],i[1]=r[1];else if(a==n)i[a*2]=r[r.length-2],i[a*2+1]=r[r.length-1];else{var s=a/n;this._setCurvePoint(r,s,i,a*2)}return i}},{key:"_setCurvePoint",value:function(r,n,i,a){if(r.length<=2)i[a]=r[0],i[a+1]=r[1];else{for(var s=Array(r.length-2),o=0;o0}},o=function(f){var d=f.pstyle("text-events").strValue==="yes";return d?XL.USE_BB:XL.IGNORE},l=function(f){var d=f.position(),p=d.x,m=d.y,g=f.outerWidth(),y=f.outerHeight();return{w:g,h:y,x1:p-g/2,y1:m-y/2}};r.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:DMt,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:PK(t.getLabelKey,null),getBoundingBox:BK(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:PK(t.getSourceLabelKey,"source"),getBoundingBox:BK(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:PK(t.getTargetLabelKey,"target"),getBoundingBox:BK(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a("target-label")});var u=$C(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(h,f){var d=!1;f&&f.length>0&&(d|=r.drawing.invalidate(f)),d&&u()}),tNt(r)};PK=function(t,r){return function(n){var i=t(n),a=dDe(n,r);return a.length>1?a.map(function(s,o){return"".concat(i,"_").concat(o)}):i}},BK=function(t,r){return function(n,i){var a=t(n);if(typeof i=="string"){var s=i.indexOf("_");if(s>0){var o=Number(i.substring(s+1)),l=dDe(n,r),u=a.h/l.length,h=u*o,f=a.y1+h;return{x1:a.x1,w:a.w,y1:f,h:u,yOffset:h}}}return a}};Sg={};Sg.drawPolygonPath=function(e,t,r,n,i,a){var s=n/2,o=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*a[0],r+o*a[1]);for(var l=1;l0&&s>0){p.clearRect(0,0,a,s),p.globalCompositeOperation="source-over";var m=this.getCachedZSortedEles();if(e.full)p.translate(-n.x1*u,-n.y1*u),p.scale(u,u),this.drawElements(p,m),p.scale(1/u,1/u),p.translate(n.x1*u,n.y1*u);else{var g=t.pan(),y={x:g.x*u,y:g.y*u};u*=t.zoom(),p.translate(y.x,y.y),p.scale(u,u),this.drawElements(p,m),p.scale(1/u,1/u),p.translate(-y.x,-y.y)}e.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=e.bg,p.rect(0,0,a,s),p.fill())}return d};HC.png=function(e){return yDe(e,this.bufferCanvasImage(e),"image/png")};HC.jpg=function(e){return yDe(e,this.bufferCanvasImage(e),"image/jpeg")};vDe={};vDe.nodeShapeImpl=function(e,t,r,n,i,a,s,o){switch(e){case"ellipse":return this.drawEllipsePath(t,r,n,i,a);case"polygon":return this.drawPolygonPath(t,r,n,i,a,s);case"round-polygon":return this.drawRoundPolygonPath(t,r,n,i,a,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,n,i,a,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,n,i,a,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,n,i,a,o);case"barrel":return this.drawBarrelPath(t,r,n,i,a)}};hNt=xDe,An=xDe.prototype;An.CANVAS_LAYERS=3;An.SELECT_BOX=0;An.DRAG=1;An.NODE=2;An.WEBGL=3;An.CANVAS_TYPES=["2d","2d","2d","webgl2"];An.BUFFER_COUNT=3;An.TEXTURE_BUFFER=0;An.MOTIONBLUR_BUFFER_NODE=1;An.MOTIONBLUR_BUFFER_DRAG=2;An.redrawHint=function(e,t){var r=this;switch(e){case"eles":r.data.canvasNeedsRedraw[An.NODE]=t;break;case"drag":r.data.canvasNeedsRedraw[An.DRAG]=t;break;case"select":r.data.canvasNeedsRedraw[An.SELECT_BOX]=t;break;case"gc":r.data.gc=!0;break}};fNt=typeof Path2D<"u";An.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e};An.usePaths=function(){return fNt&&this.pathsEnabled};An.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)};An.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled};An.makeOffscreenCanvas=function(e,t){var r;if((typeof OffscreenCanvas>"u"?"undefined":Ts(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(e,t);else{var n=this.cy.window(),i=n.document;r=i.createElement("canvas"),r.width=e,r.height=t}return r};[oDe,ed,z0,_Z,xv,Cg,Tl,fDe,Sg,HC,vDe].forEach(function(e){zr(An,e)});dNt=[{name:"null",impl:UNe},{name:"base",impl:nDe},{name:"canvas",impl:hNt}],pNt=[{type:"layout",extensions:BIt},{type:"renderer",extensions:dNt}],bDe={},wDe={};iZ=function(){if(arguments.length===2)return TDe.apply(null,arguments);if(arguments.length===3)return kDe.apply(null,arguments);if(arguments.length===4)return gNt.apply(null,arguments);if(arguments.length===5)return mNt.apply(null,arguments);ca("Invalid extension access syntax")};MC.prototype.extension=iZ;pNt.forEach(function(e){e.extensions.forEach(function(t){kDe(e.type,t.name,t.impl)})});jL=function(){if(!(this instanceof jL))return new jL;this.length=0},yv=jL.prototype;yv.instanceString=function(){return"stylesheet"};yv.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this};yv.css=function(e,t){var r=this.length-1;if(Ar(e))this[r].properties.push({name:e,value:t});else if(Hn(e))for(var n=e,i=Object.keys(n),a=0;a{(function(t,r){typeof UC=="object"&&typeof IZ=="object"?IZ.exports=r():typeof define=="function"&&define.amd?define([],r):typeof UC=="object"?UC.layoutBase=r():t.layoutBase=r()})(UC,function(){return(function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(n){return n},r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:a})},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=26)})([(function(e,t,r){"use strict";function n(){}n.QUALITY=1,n.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,n.DEFAULT_INCREMENTAL=!1,n.DEFAULT_ANIMATION_ON_LAYOUT=!0,n.DEFAULT_ANIMATION_DURING_LAYOUT=!1,n.DEFAULT_ANIMATION_PERIOD=50,n.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,n.DEFAULT_GRAPH_MARGIN=15,n.NODE_DIMENSIONS_INCLUDE_LABELS=!1,n.SIMPLE_NODE_SIZE=40,n.SIMPLE_NODE_HALF_SIZE=n.SIMPLE_NODE_SIZE/2,n.EMPTY_COMPOUND_NODE_SIZE=40,n.MIN_EDGE_LENGTH=1,n.WORLD_BOUNDARY=1e6,n.INITIAL_WORLD_BOUNDARY=n.WORLD_BOUNDARY/1e3,n.WORLD_CENTER_X=1200,n.WORLD_CENTER_Y=900,e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(8),a=r(9);function s(l,u,h){n.call(this,h),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=h,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var h=this.getOtherEnd(l),f=u.getGraphManager().getRoot();;){if(h.getOwner()==u)return h;if(h.getOwner()==f)break;h=h.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=s}),(function(e,t,r){"use strict";function n(i){this.vGraphObject=i}e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(13),s=r(0),o=r(16),l=r(4);function u(f,d,p,m){p==null&&m==null&&(m=d),n.call(this,m),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=m,this.edges=[],this.graphManager=f,p!=null&&d!=null?this.rect=new a(d.x,d.y,p.width,p.height):this.rect=new a}u.prototype=Object.create(n.prototype);for(var h in n)u[h]=n[h];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(f){this.rect.width=f},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(f){this.rect.height=f},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(f,d){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=d.width,this.rect.height=d.height},u.prototype.setCenter=function(f,d){this.rect.x=f-this.rect.width/2,this.rect.y=d-this.rect.height/2},u.prototype.setLocation=function(f,d){this.rect.x=f,this.rect.y=d},u.prototype.moveBy=function(f,d){this.rect.x+=f,this.rect.y+=d},u.prototype.getEdgeListToNode=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(g.target==f){if(g.source!=m)throw"Incorrect edge source!";d.push(g)}}),d},u.prototype.getEdgesBetween=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(!(g.source==m||g.target==m))throw"Incorrect edge source and/or target";(g.target==f||g.source==f)&&d.push(g)}),d},u.prototype.getNeighborsList=function(){var f=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)f.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";f.add(p.source)}}),f},u.prototype.withChildren=function(){var f=new Set,d,p;if(f.add(this),this.child!=null)for(var m=this.child.getNodes(),g=0;gd&&(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)),this.labelHeight>p&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-p)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-p),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(f){var d=this.rect.x;d>s.WORLD_BOUNDARY?d=s.WORLD_BOUNDARY:d<-s.WORLD_BOUNDARY&&(d=-s.WORLD_BOUNDARY);var p=this.rect.y;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var m=new l(d,p),g=f.inverseTransformPoint(m);this.setLocation(g.x,g.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=u}),(function(e,t,r){"use strict";function n(i,a){i==null&&a==null?(this.x=0,this.y=0):(this.x=i,this.y=a)}n.prototype.getX=function(){return this.x},n.prototype.getY=function(){return this.y},n.prototype.setX=function(i){this.x=i},n.prototype.setY=function(i){this.y=i},n.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},n.prototype.getCopy=function(){return new n(this.x,this.y)},n.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(0),s=r(6),o=r(3),l=r(1),u=r(13),h=r(12),f=r(11);function d(m,g,y){n.call(this,y),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=m,g!=null&&g instanceof s?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}d.prototype=Object.create(n.prototype);for(var p in n)d[p]=n[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(m,g,y){if(g==null&&y==null){var v=m;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(v)>-1)throw"Node already in graph!";return v.owner=this,this.getNodes().push(v),v}else{var x=m;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(g.owner==y.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=y.owner?null:(x.source=g,x.target=y,x.isInterGraph=!1,this.getEdges().push(x),g.edges.push(x),y!=g&&y.edges.push(x),x)}},d.prototype.remove=function(m){var g=m;if(m instanceof o){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=g.edges.slice(),v,x=y.length,w=0;w-1&&k>-1))throw"Source and/or target doesn't know this edge!";v.source.edges.splice(T,1),v.target!=v.source&&v.target.edges.splice(k,1);var C=v.source.owner.getEdges().indexOf(v);if(C==-1)throw"Not in owner's edge list!";v.source.owner.getEdges().splice(C,1)}},d.prototype.updateLeftTop=function(){for(var m=i.MAX_VALUE,g=i.MAX_VALUE,y,v,x,w=this.getNodes(),C=w.length,T=0;Ty&&(m=y),g>v&&(g=v)}return m==i.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?x=w[0].getParent().paddingLeft:x=this.margin,this.left=g-x,this.top=m-x,new h(this.left,this.top))},d.prototype.updateBounds=function(m){for(var g=i.MAX_VALUE,y=-i.MAX_VALUE,v=i.MAX_VALUE,x=-i.MAX_VALUE,w,C,T,k,S,E=this.nodes,I=E.length,L=0;Lw&&(g=w),yT&&(v=T),xw&&(g=w),yT&&(v=T),x=this.nodes.length){var I=0;y.forEach(function(L){L.owner==m&&I++}),I==this.nodes.length&&(this.isConnected=!0)}},e.exports=d}),(function(e,t,r){"use strict";var n,i=r(1);function a(s){n=r(5),this.layout=s,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},a.prototype.add=function(s,o,l,u,h){if(l==null&&u==null&&h==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{h=l,u=o,l=s;var f=u.getOwner(),d=h.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==d)return l.isInterGraph=!1,f.add(l,u,h);if(l.isInterGraph=!0,l.source=u,l.target=h,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},a.prototype.remove=function(s){if(s instanceof n){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,h=l.length,f=0;f=s.getRight()?o[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(o[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(o[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var h=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(h=1);var f=h*o[0],d=o[1]/h;o[0]f)return o[0]=l,o[1]=p,o[2]=h,o[3]=E,!1;if(uh)return o[0]=d,o[1]=u,o[2]=k,o[3]=f,!1;if(lh?(o[0]=g,o[1]=y,R=!0):(o[0]=m,o[1]=p,R=!0):N===D&&(l>h?(o[0]=d,o[1]=p,R=!0):(o[0]=v,o[1]=y,R=!0)),-M===D?h>l?(o[2]=S,o[3]=E,A=!0):(o[2]=k,o[3]=T,A=!0):M===D&&(h>l?(o[2]=C,o[3]=T,A=!0):(o[2]=I,o[3]=E,A=!0)),R&&A)return!1;if(l>h?u>f?(B=this.getCardinalDirection(N,D,4),P=this.getCardinalDirection(M,D,2)):(B=this.getCardinalDirection(-N,D,3),P=this.getCardinalDirection(-M,D,1)):u>f?(B=this.getCardinalDirection(-N,D,1),P=this.getCardinalDirection(-M,D,3)):(B=this.getCardinalDirection(N,D,2),P=this.getCardinalDirection(M,D,4)),!R)switch(B){case 1:F=p,$=l+-w/D,o[0]=$,o[1]=F;break;case 2:$=v,F=u+x*D,o[0]=$,o[1]=F;break;case 3:F=y,$=l+w/D,o[0]=$,o[1]=F;break;case 4:$=g,F=u+-x*D,o[0]=$,o[1]=F;break}if(!A)switch(P){case 1:G=T,q=h+-O/D,o[2]=q,o[3]=G;break;case 2:q=I,G=f+L*D,o[2]=q,o[3]=G;break;case 3:G=E,q=h+O/D,o[2]=q,o[3]=G;break;case 4:q=S,G=f+-L*D,o[2]=q,o[3]=G;break}}return!1},i.getCardinalDirection=function(a,s,o){return a>s?o:1+o%4},i.getIntersection=function(a,s,o,l){if(l==null)return this.getIntersection2(a,s,o);var u=a.x,h=a.y,f=s.x,d=s.y,p=o.x,m=o.y,g=l.x,y=l.y,v=void 0,x=void 0,w=void 0,C=void 0,T=void 0,k=void 0,S=void 0,E=void 0,I=void 0;return w=d-h,T=u-f,S=f*h-u*d,C=y-m,k=p-g,E=g*m-p*y,I=w*k-C*T,I===0?null:(v=(T*E-k*S)/I,x=(C*S-w*E)/I,new n(v,x))},i.angleOfVector=function(a,s,o,l){var u=void 0;return a!==o?(u=Math.atan((l-s)/(o-a)),o0?1:i<0?-1:0},n.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},n.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},e.exports=n}),(function(e,t,r){"use strict";function n(){}n.MAX_VALUE=2147483647,n.MIN_VALUE=-2147483648,e.exports=n}),(function(e,t,r){"use strict";var n=(function(){function u(h,f){for(var d=0;d"u"?"undefined":n(a);return a==null||s!="object"&&s!="function"},e.exports=i}),(function(e,t,r){"use strict";function n(p){if(Array.isArray(p)){for(var m=0,g=Array(p.length);m0&&m;){for(w.push(T[0]);w.length>0&&m;){var k=w[0];w.splice(0,1),x.add(k);for(var S=k.getEdges(),v=0;v-1&&T.splice(O,1)}x=new Set,C=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var m=[],g=p.source,y=this.graphManager.calcLowestCommonAncestor(p.source,p.target),v=0;v0){for(var y=this.edgeToDummyNodes.get(g),v=0;v=0&&m.splice(E,1);var I=C.getNeighborsList();I.forEach(function(R){if(g.indexOf(R)<0){var A=y.get(R),N=A-1;N==1&&k.push(R),y.set(R,N)}})}g=g.concat(k),(m.length==1||m.length==2)&&(v=!0,x=m[0])}return x},d.prototype.setGraphManager=function(p){this.graphManager=p},e.exports=d}),(function(e,t,r){"use strict";function n(){}n.seed=1,n.x=0,n.nextDouble=function(){return n.x=Math.sin(n.seed++)*1e4,n.x-Math.floor(n.x)},e.exports=n}),(function(e,t,r){"use strict";var n=r(4);function i(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(a){this.lworldExtX=a},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(a){this.lworldExtY=a},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},i.prototype.transformX=function(a){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/o),s},i.prototype.transformY=function(a){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/o),s},i.prototype.inverseTransformX=function(a){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/o),s},i.prototype.inverseTransformY=function(a){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/o),s},i.prototype.inverseTransformPoint=function(a){var s=new n(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},e.exports=i}),(function(e,t,r){"use strict";function n(f){if(Array.isArray(f)){for(var d=0,p=Array(f.length);da.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),d,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,m,g,y,v=this.getAllNodes(),x;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),x=new Set,p=0;pw||x>w)&&(f.gravitationForceX=-this.gravityConstant*g,f.gravitationForceY=-this.gravityConstant*y)):(w=d.getEstimatedSize()*this.compoundGravityRangeFactor,(v>w||x>w)&&(f.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},u.prototype.isConverged=function(){var f,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=v.length||w>=v[0].length)){for(var C=0;Cu}}]),o})();e.exports=s}),(function(e,t,r){"use strict";var n=(function(){function s(o,l){for(var u=0;u2&&arguments[2]!==void 0?arguments[2]:1,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=h,this.gap_penalty=f,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;o--){var l=this.listeners[o];l.event===a&&l.callback===s&&this.listeners.splice(o,1)}},i.emit=function(a,s){for(var o=0;o{(function(t,r){typeof YC=="object"&&typeof NZ=="object"?NZ.exports=r(MZ()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof YC=="object"?YC.coseBase=r(MZ()):t.coseBase=r(t.layoutBase)})(YC,function(e){return(function(t){var r={};function n(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=r,n.i=function(i){return i},n.d=function(i,a,s){n.o(i,a)||Object.defineProperty(i,a,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(a,"a",a),a},n.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},n.p="",n(n.s=7)})([(function(t,r){t.exports=e}),(function(t,r,n){"use strict";var i=n(0).FDLayoutConstants;function a(){}for(var s in i)a[s]=i[s];a.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,a.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,a.DEFAULT_COMPONENT_SEPERATION=60,a.TILE=!0,a.TILING_PADDING_VERTICAL=10,a.TILING_PADDING_HORIZONTAL=10,a.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=a}),(function(t,r,n){"use strict";var i=n(0).FDLayoutEdge;function a(o,l,u){i.call(this,o,l,u)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];t.exports=a}),(function(t,r,n){"use strict";var i=n(0).LGraph;function a(o,l,u){i.call(this,o,l,u)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];t.exports=a}),(function(t,r,n){"use strict";var i=n(0).LGraphManager;function a(o){i.call(this,o)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];t.exports=a}),(function(t,r,n){"use strict";var i=n(0).FDLayoutNode,a=n(0).IMath;function s(l,u,h,f){i.call(this,l,u,h,f)}s.prototype=Object.create(i.prototype);for(var o in i)s[o]=i[o];s.prototype.move=function(){var l=this.graphManager.getLayout();this.displacementX=l.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=l.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementX=l.coolingFactor*l.maxNodeDisplacement*a.sign(this.displacementX)),Math.abs(this.displacementY)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementY=l.coolingFactor*l.maxNodeDisplacement*a.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),l.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},s.prototype.propogateDisplacementToChildren=function(l,u){for(var h=this.getChild().getNodes(),f,d=0;d0)this.positionNodesRadially(T);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var k=new Set(this.getAllNodes()),S=this.nodesWithGravity.filter(function(E){return k.has(E)});this.graphManager.setAllNodesToApplyGravitation(S),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},w.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var T=new Set(this.getAllNodes()),k=this.nodesWithGravity.filter(function(I){return T.has(I)});this.graphManager.setAllNodesToApplyGravitation(k),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var S=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(S,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},w.prototype.getPositionsData=function(){for(var T=this.graphManager.getAllNodes(),k={},S=0;S1){var R;for(R=0;RE&&(E=Math.floor(O.y)),L=Math.floor(O.x+u.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(f.WORLD_CENTER_X-O.x/2,f.WORLD_CENTER_Y-O.y/2))},w.radialLayout=function(T,k,S){var E=Math.max(this.maxDiagonalInTree(T),u.DEFAULT_RADIAL_SEPARATION);w.branchRadialLayout(k,null,0,359,0,E);var I=v.calculateBounds(T),L=new x;L.setDeviceOrgX(I.getMinX()),L.setDeviceOrgY(I.getMinY()),L.setWorldOrgX(S.x),L.setWorldOrgY(S.y);for(var O=0;O1;){var z=G[0];G.splice(0,1);var H=B.indexOf(z);H>=0&&B.splice(H,1),F--,P--}k!=null?q=(B.indexOf(G[0])+1)%F:q=0;for(var j=Math.abs(E-S)/P,J=q;$!=P;J=++J%F){var U=B[J].getOtherEnd(T);if(U!=k){var le=(S+$*j)%360,ee=(le+j)%360;w.branchRadialLayout(U,T,le,ee,I+L,L),$++}}},w.maxDiagonalInTree=function(T){for(var k=g.MIN_VALUE,S=0;Sk&&(k=I)}return k},w.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},w.prototype.groupZeroDegreeMembers=function(){var T=this,k={};this.memberGroups={},this.idToDummyNode={};for(var S=[],E=this.graphManager.getAllNodes(),I=0;I"u"&&(k[R]=[]),k[R]=k[R].concat(L)}Object.keys(k).forEach(function(A){if(k[A].length>1){var N="DummyCompound_"+A;T.memberGroups[N]=k[A];var M=k[A][0].getParent(),D=new o(T.graphManager);D.id=N,D.paddingLeft=M.paddingLeft||0,D.paddingRight=M.paddingRight||0,D.paddingBottom=M.paddingBottom||0,D.paddingTop=M.paddingTop||0,T.idToDummyNode[N]=D;var B=T.getGraphManager().add(T.newGraph(),D),P=M.getChild();P.add(D);for(var $=0;$=0;T--){var k=this.compoundOrder[T],S=k.id,E=k.paddingLeft,I=k.paddingTop;this.adjustLocations(this.tiledMemberPack[S],k.rect.x,k.rect.y,E,I)}},w.prototype.repopulateZeroDegreeMembers=function(){var T=this,k=this.tiledZeroDegreePack;Object.keys(k).forEach(function(S){var E=T.idToDummyNode[S],I=E.paddingLeft,L=E.paddingTop;T.adjustLocations(k[S],E.rect.x,E.rect.y,I,L)})},w.prototype.getToBeTiled=function(T){var k=T.id;if(this.toBeTiled[k]!=null)return this.toBeTiled[k];var S=T.getChild();if(S==null)return this.toBeTiled[k]=!1,!1;for(var E=S.getNodes(),I=0;I0)return this.toBeTiled[k]=!1,!1;if(L.getChild()==null){this.toBeTiled[L.id]=!1;continue}if(!this.getToBeTiled(L))return this.toBeTiled[k]=!1,!1}return this.toBeTiled[k]=!0,!0},w.prototype.getNodeDegree=function(T){for(var k=T.id,S=T.getEdges(),E=0,I=0;IA&&(A=M.rect.height)}S+=A+T.verticalPadding}},w.prototype.tileCompoundMembers=function(T,k){var S=this;this.tiledMemberPack=[],Object.keys(T).forEach(function(E){var I=k[E];S.tiledMemberPack[E]=S.tileNodes(T[E],I.paddingLeft+I.paddingRight),I.rect.width=S.tiledMemberPack[E].width,I.rect.height=S.tiledMemberPack[E].height})},w.prototype.tileNodes=function(T,k){var S=u.TILING_PADDING_VERTICAL,E=u.TILING_PADDING_HORIZONTAL,I={rows:[],rowWidth:[],rowHeight:[],width:0,height:k,verticalPadding:S,horizontalPadding:E};T.sort(function(R,A){return R.rect.width*R.rect.height>A.rect.width*A.rect.height?-1:R.rect.width*R.rect.height0&&(O+=T.horizontalPadding),T.rowWidth[S]=O,T.width0&&(R+=T.verticalPadding);var A=0;R>T.rowHeight[S]&&(A=T.rowHeight[S],T.rowHeight[S]=R,A=T.rowHeight[S]-A),T.height+=A,T.rows[S].push(k)},w.prototype.getShortestRowIndex=function(T){for(var k=-1,S=Number.MAX_VALUE,E=0;ES&&(k=E,S=T.rowWidth[E]);return k},w.prototype.canAddHorizontal=function(T,k,S){var E=this.getShortestRowIndex(T);if(E<0)return!0;var I=T.rowWidth[E];if(I+T.horizontalPadding+k<=T.width)return!0;var L=0;T.rowHeight[E]0&&(L=S+T.verticalPadding-T.rowHeight[E]);var O;T.width-I>=k+T.horizontalPadding?O=(T.height+L)/(I+k+T.horizontalPadding):O=(T.height+L)/T.width,L=S+T.verticalPadding;var R;return T.widthL&&k!=S){E.splice(-1,1),T.rows[S].push(I),T.rowWidth[k]=T.rowWidth[k]-L,T.rowWidth[S]=T.rowWidth[S]+L,T.width=T.rowWidth[instance.getLongestRowIndex(T)];for(var O=Number.MIN_VALUE,R=0;RO&&(O=E[R].height);k>0&&(O+=T.verticalPadding);var A=T.rowHeight[k]+T.rowHeight[S];T.rowHeight[k]=O,T.rowHeight[S]0)for(var P=I;P<=L;P++)B[0]+=this.grid[P][O-1].length+this.grid[P][O].length-1;if(L0)for(var P=O;P<=R;P++)B[3]+=this.grid[I-1][P].length+this.grid[I][P].length-1;for(var $=g.MAX_VALUE,F,q,G=0;G{(function(t,r){typeof XC=="object"&&typeof OZ=="object"?OZ.exports=r(DZ()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof XC=="object"?XC.cytoscapeCoseBilkent=r(DZ()):t.cytoscapeCoseBilkent=r(t.coseBase)})(XC,function(e){return(function(t){var r={};function n(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=r,n.i=function(i){return i},n.d=function(i,a,s){n.o(i,a)||Object.defineProperty(i,a,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(a,"a",a),a},n.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},n.p="",n(n.s=1)})([(function(t,r){t.exports=e}),(function(t,r,n){"use strict";var i=n(0).layoutBase.LayoutConstants,a=n(0).layoutBase.FDLayoutConstants,s=n(0).CoSEConstants,o=n(0).CoSELayout,l=n(0).CoSENode,u=n(0).layoutBase.PointD,h=n(0).layoutBase.DimensionD,f={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(y,v){var x={};for(var w in y)x[w]=y[w];for(var w in v)x[w]=v[w];return x}function p(y){this.options=d(f,y),m(this.options)}var m=function(v){v.nodeRepulsion!=null&&(s.DEFAULT_REPULSION_STRENGTH=a.DEFAULT_REPULSION_STRENGTH=v.nodeRepulsion),v.idealEdgeLength!=null&&(s.DEFAULT_EDGE_LENGTH=a.DEFAULT_EDGE_LENGTH=v.idealEdgeLength),v.edgeElasticity!=null&&(s.DEFAULT_SPRING_STRENGTH=a.DEFAULT_SPRING_STRENGTH=v.edgeElasticity),v.nestingFactor!=null&&(s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor),v.gravity!=null&&(s.DEFAULT_GRAVITY_STRENGTH=a.DEFAULT_GRAVITY_STRENGTH=v.gravity),v.numIter!=null&&(s.MAX_ITERATIONS=a.MAX_ITERATIONS=v.numIter),v.gravityRange!=null&&(s.DEFAULT_GRAVITY_RANGE_FACTOR=a.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange),v.gravityCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound),v.gravityRangeCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound),v.initialEnergyOnIncremental!=null&&(s.DEFAULT_COOLING_FACTOR_INCREMENTAL=a.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental),v.quality=="draft"?i.QUALITY=0:v.quality=="proof"?i.QUALITY=2:i.QUALITY=1,s.NODE_DIMENSIONS_INCLUDE_LABELS=a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,s.DEFAULT_INCREMENTAL=a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=!v.randomize,s.ANIMATE=a.ANIMATE=i.ANIMATE=v.animate,s.TILE=v.tile,s.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical=="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,s.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal=="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal};p.prototype.run=function(){var y,v,x=this.options,w=this.idToLNode={},C=this.layout=new o,T=this;T.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var k=C.newGraphManager();this.gm=k;var S=this.options.eles.nodes(),E=this.options.eles.edges();this.root=k.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(S),C);for(var I=0;I0){var R;R=x.getGraphManager().add(x.newGraph(),S),this.processChildrenList(R,k,x)}}},p.prototype.stop=function(){return this.stopped=!0,this};var g=function(v){v("layout","cose-bilkent",p)};typeof cytoscape<"u"&&g(cytoscape),t.exports=g})])})});var NDe={};Tr(NDe,{render:()=>xNt});function EDe(e,t){e.forEach(r=>{let n={id:r.id,labelText:r.label,height:r.height,width:r.width,padding:r.padding??0};Object.keys(r).forEach(i=>{["id","label","height","width","padding","x","y"].includes(i)||(n[i]=r[i])}),t.add({group:"nodes",data:n,position:{x:r.x??0,y:r.y??0}})})}function ADe(e,t){e.forEach(r=>{let n={id:r.id,source:r.start,target:r.end};Object.keys(r).forEach(i=>{["id","start","end"].includes(i)||(n[i]=r[i])}),t.add({group:"edges",data:n})})}function _De(e){return new Promise(t=>{let r=ct("body").append("div").attr("id","cy").attr("style","display:none"),n=Du({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),EDe(e.nodes,n),ADe(e.edges,n),n.nodes().forEach(function(a){a.layoutDimensions=()=>{let s=a.data();return{w:s.width,h:s.height}}});let i={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};n.layout(i).run(),n.ready(a=>{se.info("Cytoscape ready",a),t(n)})})}function RDe(e){return e.nodes().map(t=>{let r=t.data(),n=t.position(),i={id:r.id,x:n.x,y:n.y};return Object.keys(r).forEach(a=>{a!=="id"&&(i[a]=r[a])}),i})}function LDe(e){return e.edges().map(t=>{let r=t.data(),n=t._private.rscratch,i={id:r.id,source:r.source,target:r.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(r).forEach(a=>{["id","source","target"].includes(a)||(i[a]=r[a])}),i})}async function IDe(e,t){se.debug("Starting cose-bilkent layout algorithm");try{MDe(e);let r=await _De(e),n=RDe(r),i=LDe(r);return se.debug(`Layout completed: ${n.length} nodes, ${i.length} edges`),{nodes:n,edges:i}}catch(r){throw se.error("Error in cose-bilkent layout algorithm:",r),r}}function MDe(e){if(!e)throw new Error("Layout data is required");if(!e.config)throw new Error("Configuration is required in layout data");if(!e.rootNode)throw new Error("Root node is required");if(!e.nodes||!Array.isArray(e.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(e.edges))throw new Error("Edges array is required in layout data");return!0}var SDe,vNt,xNt,DDe=W(()=>{Rr();hr();LZ();SDe=Ro(CDe(),1);fn();Du.use(SDe.default);b(EDe,"addNodes");b(ADe,"addEdges");b(_De,"createCytoscapeInstance");b(RDe,"extractPositionedNodes");b(LDe,"extractPositionedEdges");b(IDe,"executeCoseBilkentLayout");b(MDe,"validateLayoutData");vNt=b(async(e,t,{insertCluster:r,insertEdge:n,insertEdgeLabel:i,insertMarkers:a,insertNode:s,log:o,positionEdgeLabel:l},{algorithm:u})=>{let h={},f={},d=t.select("g");a(d,e.markers,e.type,e.diagramId);let p=d.insert("g").attr("class","subgraphs"),m=d.insert("g").attr("class","edgePaths"),g=d.insert("g").attr("class","edgeLabels"),y=d.insert("g").attr("class","nodes");o.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(e.nodes.map(async w=>{if(w.isGroup){let C={...w};f[w.id]=C,h[w.id]=C,await r(p,w)}else{let C={...w};h[w.id]=C;let T=await s(y,w,{config:e.config,dir:e.direction||"TB"}),k=T.node().getBBox();C.width=k.width,C.height=k.height,C.domId=T,o.debug(`Node ${w.id} dimensions: ${k.width}x${k.height}`)}})),o.debug("Running cose-bilkent layout algorithm");let v={...e,nodes:e.nodes.map(w=>{let C=h[w.id];return{...w,width:C.width,height:C.height}})},x=await IDe(v,e.config);o.debug("Positioning nodes based on layout results"),x.nodes.forEach(w=>{let C=h[w.id];C?.domId&&(C.domId.attr("transform",`translate(${w.x}, ${w.y})`),C.x=w.x,C.y=w.y,o.debug(`Positioned node ${C.id} at center (${w.x}, ${w.y})`))}),x.edges.forEach(w=>{let C=e.edges.find(T=>T.id===w.id);C&&(C.points=[{x:w.startX,y:w.startY},{x:w.midX,y:w.midY},{x:w.endX,y:w.endY}])}),o.debug("Inserting and positioning edges"),await Promise.all(e.edges.map(async w=>{let C=await i(g,w),T=h[w.start??""],k=h[w.end??""];if(T&&k){let S=x.edges.find(E=>E.id===w.id);if(S){o.debug("APA01 positionedEdge",S);let E={...w},I=n(m,E,f,e.type,T,k,e.diagramId);l(E,I)}else{let E={...w,points:[{x:T.x||0,y:T.y||0},{x:k.x||0,y:k.y||0}]},I=n(m,E,f,e.type,T,k,e.diagramId);l(E,I)}}})),o.debug("Cose-bilkent rendering completed")},"render"),xNt=vNt});var bNt,jC,PZ,wNt,Ou,td,ic=W(()=>{Jl();po();Sn();_r();Rr();hr();bNt={common:Ct,getConfig:qt,insertCluster:Jm,insertEdge:b4,insertEdgeLabel:Zy,insertMarkers:w4,insertNode:M0,interpolateToCurve:oR,labelHelper:Hr,log:se,positionEdgeLabel:BR},jC={},PZ=b(e=>{for(let t of e)jC[t.name]=t},"registerLayoutLoaders"),wNt=b(()=>{PZ([{name:"dagre",loader:b(async()=>await Promise.resolve().then(()=>(l_e(),o_e)),"loader")},{name:"swimlane",loader:b(async()=>await Promise.resolve().then(()=>(nLe(),rLe)),"loader")},{name:"cose-bilkent",loader:b(async()=>await Promise.resolve().then(()=>(DDe(),NDe)),"loader")}])},"registerDefaultLayoutLoaders");wNt();Ou=b(async(e,t,r)=>{if(!(e.layoutAlgorithm in jC))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(let f of e.nodes){let d=f.domId||f.id;f.domId=`${e.diagramId}-${d}`}let n=jC[e.layoutAlgorithm],i=await n.loader(),{theme:a,themeVariables:s}=e.config,{useGradient:o,gradientStart:l,gradientStop:u}=s,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a?.includes("dark")?"#FFFFFF":"#000000"}`),o){let f=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");f.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),f.append("svg:stop").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",1)}return i.render(e,t,bNt,{algorithm:n.algorithm},r)},"render"),td=b((e="",{fallback:t="dagre"}={})=>{if(e in jC)return e;if(t in jC)return se.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm")});var FZ,wv,SI,tOe,EI,AI,Xo,_I,iw,Hc=W(()=>{_r();hr();FZ=Ro(n4(),1);fn();wv=b((e,t)=>{let r=e.append("rect");if(r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),t.name&&r.attr("name",t.name),t.rx&&r.attr("rx",t.rx),t.ry&&r.attr("ry",t.ry),t.attrs!==void 0)for(let n in t.attrs)r.attr(n,t.attrs[n]);return t.class&&r.attr("class",t.class),r},"drawRect"),SI=b((e,t)=>{let r={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};wv(e,r).lower()},"drawBackgroundRect"),tOe=b((e,t)=>{let r=t.text.replace(my," "),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.attr("class","legend"),n.style("text-anchor",t.anchor),t.class&&n.attr("class",t.class);let i=n.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(r),n},"drawText"),EI=b((e,t,r,n)=>{let i=e.append("image");i.attr("x",t),i.attr("y",r);let a=(0,FZ.sanitizeUrl)(n);i.attr("xlink:href",a)},"drawImage"),AI=b((e,t,r,n)=>{let i=e.append("use");i.attr("x",t),i.attr("y",r);let a=(0,FZ.sanitizeUrl)(n);i.attr("xlink:href",`#${a}`)},"drawEmbeddedImage"),Xo=b(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),_I=b(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),iw=b(()=>{let e=ct(".mermaidTooltip");return e.empty()&&(e=ct("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),e},"createTooltip")});var dOe={};Tr(dOe,{diagram:()=>gDt});function $u(e,t,r,n,i){if(!t[e].width)if(r)t[e].text=Wy(t[e].text,i,n),t[e].textLines=t[e].text.split(Ct.lineBreakRegex).length,t[e].width=i,t[e].height=G3(t[e].text,n);else{let a=t[e].text.split(Ct.lineBreakRegex);t[e].textLines=a.length;let s=0;t[e].height=0,t[e].width=0;for(let o of a)t[e].width=Math.max(uo(o,n),t[e].width),s=G3(o,n),t[e].height=t[e].height+s}}function HZ(e,t,r,n,i){let a=new uOe(i);a.data.widthLimit=r.data.widthLimit/Math.min(zZ,n.length);for(let[s,o]of n.entries()){let l=0;o.image={width:0,height:0,Y:0},o.sprite&&(o.image.width=48,o.image.height=48,o.image.Y=l,l=o.image.Y+o.image.height);let u=o.wrap&&xr.wrap,h=RI(xr);if(h.fontSize=h.fontSize+2,h.fontWeight="bold",$u("label",o,u,h,a.data.widthLimit),o.label.Y=l+8,l=o.label.Y+o.label.height,o.type&&o.type.text!==""){o.type.text="["+o.type.text+"]";let m=RI(xr);$u("type",o,u,m,a.data.widthLimit),o.type.Y=l+5,l=o.type.Y+o.type.height}if(o.descr&&o.descr.text!==""){let m=RI(xr);m.fontSize=m.fontSize-2,$u("descr",o,u,m,a.data.widthLimit),o.descr.Y=l+20,l=o.descr.Y+o.descr.height}if(s==0||s%zZ===0){let m=r.data.startx+xr.diagramMarginX,g=r.data.stopy+xr.diagramMarginY+l;a.setData(m,m,g,g)}else{let m=a.data.stopx!==a.data.startx?a.data.stopx+xr.diagramMarginX:a.data.startx,g=a.data.starty;a.setData(m,m,g,g)}a.name=o.alias;let f=i.db.getC4ShapeArray(o.alias),d=i.db.getC4ShapeKeys(o.alias);d.length>0&&fOe(a,e,f,d),t=o.alias;let p=i.db.getBoundaries(t);p.length>0&&HZ(e,t,a,p,i),o.alias!=="global"&&hOe(e,o,a),r.data.stopy=Math.max(a.data.stopy+xr.c4ShapeMargin,r.data.stopy),r.data.stopx=Math.max(a.data.stopx+xr.c4ShapeMargin,r.data.stopx),NI=Math.max(NI,r.data.stopx),DI=Math.max(DI,r.data.stopy)}}var oOe,LI,CNt,Ah,Eg,Cl,Eh,nd,eS,qZ,VZ,II,MI,iOe,SNt,ENt,ANt,_Nt,RNt,LNt,INt,MNt,NNt,DNt,ONt,PNt,BNt,FNt,$Nt,zNt,GNt,aOe,qNt,VNt,sOe,WNt,HNt,UNt,YNt,Ag,XNt,jNt,KNt,ZNt,QNt,$Z,WZ,lOe,JNt,eDt,tDt,rDt,nDt,iDt,aDt,sDt,oDt,lDt,cDt,W0,rd,NI,DI,cOe,zZ,xr,uOe,GZ,JC,RI,uDt,hOe,fOe,Fu,rOe,hDt,fDt,dDt,nOe,pDt,mDt,gDt,pOe=W(()=>{Hc();Sn();_r();Rr();hr();fn();oOe=Ro(n4(),1),LI=(function(){var e=b(function(Q,he,xe,ce){for(xe=xe||{},ce=Q.length;ce--;xe[Q[ce]]=he);return xe},"o"),t=[1,24],r=[1,25],n=[1,26],i=[1,27],a=[1,28],s=[1,63],o=[1,64],l=[1,65],u=[1,66],h=[1,67],f=[1,68],d=[1,69],p=[1,29],m=[1,30],g=[1,31],y=[1,32],v=[1,33],x=[1,34],w=[1,35],C=[1,36],T=[1,37],k=[1,38],S=[1,39],E=[1,40],I=[1,41],L=[1,42],O=[1,43],R=[1,44],A=[1,45],N=[1,46],M=[1,47],D=[1,48],B=[1,50],P=[1,51],$=[1,52],F=[1,53],q=[1,54],G=[1,55],z=[1,56],H=[1,57],j=[1,58],J=[1,59],U=[1,60],le=[14,42],ee=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],ue=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],ae=[1,82],oe=[1,83],Re=[1,84],Te=[1,85],Oe=[12,14,42],qe=[12,14,33,42],Ge=[12,14,33,42,76,77,79,80],fe=[12,33],Ce=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],_e={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:b(function(he,xe,ce,ge,Ie,ye,ne){var V=ye.length-1;switch(Ie){case 3:ge.setDirection("TB");break;case 4:ge.setDirection("BT");break;case 5:ge.setDirection("RL");break;case 6:ge.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:ge.setC4Type(ye[V-3]);break;case 19:ge.setTitle(ye[V].substring(6)),this.$=ye[V].substring(6);break;case 20:ge.setAccDescription(ye[V].substring(15)),this.$=ye[V].substring(15);break;case 21:this.$=ye[V].trim(),ge.setTitle(this.$);break;case 22:case 23:this.$=ye[V].trim(),ge.setAccDescription(this.$);break;case 28:ye[V].splice(2,0,"ENTERPRISE"),ge.addPersonOrSystemBoundary(...ye[V]),this.$=ye[V];break;case 29:ye[V].splice(2,0,"SYSTEM"),ge.addPersonOrSystemBoundary(...ye[V]),this.$=ye[V];break;case 30:ge.addPersonOrSystemBoundary(...ye[V]),this.$=ye[V];break;case 31:ye[V].splice(2,0,"CONTAINER"),ge.addContainerBoundary(...ye[V]),this.$=ye[V];break;case 32:ge.addDeploymentNode("node",...ye[V]),this.$=ye[V];break;case 33:ge.addDeploymentNode("nodeL",...ye[V]),this.$=ye[V];break;case 34:ge.addDeploymentNode("nodeR",...ye[V]),this.$=ye[V];break;case 35:ge.popBoundaryParseStack();break;case 39:ge.addPersonOrSystem("person",...ye[V]),this.$=ye[V];break;case 40:ge.addPersonOrSystem("external_person",...ye[V]),this.$=ye[V];break;case 41:ge.addPersonOrSystem("system",...ye[V]),this.$=ye[V];break;case 42:ge.addPersonOrSystem("system_db",...ye[V]),this.$=ye[V];break;case 43:ge.addPersonOrSystem("system_queue",...ye[V]),this.$=ye[V];break;case 44:ge.addPersonOrSystem("external_system",...ye[V]),this.$=ye[V];break;case 45:ge.addPersonOrSystem("external_system_db",...ye[V]),this.$=ye[V];break;case 46:ge.addPersonOrSystem("external_system_queue",...ye[V]),this.$=ye[V];break;case 47:ge.addContainer("container",...ye[V]),this.$=ye[V];break;case 48:ge.addContainer("container_db",...ye[V]),this.$=ye[V];break;case 49:ge.addContainer("container_queue",...ye[V]),this.$=ye[V];break;case 50:ge.addContainer("external_container",...ye[V]),this.$=ye[V];break;case 51:ge.addContainer("external_container_db",...ye[V]),this.$=ye[V];break;case 52:ge.addContainer("external_container_queue",...ye[V]),this.$=ye[V];break;case 53:ge.addComponent("component",...ye[V]),this.$=ye[V];break;case 54:ge.addComponent("component_db",...ye[V]),this.$=ye[V];break;case 55:ge.addComponent("component_queue",...ye[V]),this.$=ye[V];break;case 56:ge.addComponent("external_component",...ye[V]),this.$=ye[V];break;case 57:ge.addComponent("external_component_db",...ye[V]),this.$=ye[V];break;case 58:ge.addComponent("external_component_queue",...ye[V]),this.$=ye[V];break;case 60:ge.addRel("rel",...ye[V]),this.$=ye[V];break;case 61:ge.addRel("birel",...ye[V]),this.$=ye[V];break;case 62:ge.addRel("rel_u",...ye[V]),this.$=ye[V];break;case 63:ge.addRel("rel_d",...ye[V]),this.$=ye[V];break;case 64:ge.addRel("rel_l",...ye[V]),this.$=ye[V];break;case 65:ge.addRel("rel_r",...ye[V]),this.$=ye[V];break;case 66:ge.addRel("rel_b",...ye[V]),this.$=ye[V];break;case 67:ye[V].splice(0,1),ge.addRel("rel",...ye[V]),this.$=ye[V];break;case 68:ge.updateElStyle("update_el_style",...ye[V]),this.$=ye[V];break;case 69:ge.updateRelStyle("update_rel_style",...ye[V]),this.$=ye[V];break;case 70:ge.updateLayoutConfig("update_layout_config",...ye[V]),this.$=ye[V];break;case 71:this.$=[ye[V]];break;case 72:ye[V].unshift(ye[V-1]),this.$=ye[V];break;case 73:case 75:this.$=ye[V].trim();break;case 74:let pe={};pe[ye[V-1].trim()]=ye[V].trim(),this.$=pe;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:70,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:71,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:72,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:73,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{14:[1,74]},e(le,[2,13],{43:23,29:49,30:61,32:62,20:75,34:s,36:o,37:l,38:u,39:h,40:f,41:d,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U}),e(le,[2,14]),e(ee,[2,16],{12:[1,76]}),e(le,[2,36],{12:[1,77]}),e(ue,[2,19]),e(ue,[2,20]),{25:[1,78]},{27:[1,79]},e(ue,[2,23]),{35:80,75:81,76:ae,77:oe,79:Re,80:Te},{35:86,75:81,76:ae,77:oe,79:Re,80:Te},{35:87,75:81,76:ae,77:oe,79:Re,80:Te},{35:88,75:81,76:ae,77:oe,79:Re,80:Te},{35:89,75:81,76:ae,77:oe,79:Re,80:Te},{35:90,75:81,76:ae,77:oe,79:Re,80:Te},{35:91,75:81,76:ae,77:oe,79:Re,80:Te},{35:92,75:81,76:ae,77:oe,79:Re,80:Te},{35:93,75:81,76:ae,77:oe,79:Re,80:Te},{35:94,75:81,76:ae,77:oe,79:Re,80:Te},{35:95,75:81,76:ae,77:oe,79:Re,80:Te},{35:96,75:81,76:ae,77:oe,79:Re,80:Te},{35:97,75:81,76:ae,77:oe,79:Re,80:Te},{35:98,75:81,76:ae,77:oe,79:Re,80:Te},{35:99,75:81,76:ae,77:oe,79:Re,80:Te},{35:100,75:81,76:ae,77:oe,79:Re,80:Te},{35:101,75:81,76:ae,77:oe,79:Re,80:Te},{35:102,75:81,76:ae,77:oe,79:Re,80:Te},{35:103,75:81,76:ae,77:oe,79:Re,80:Te},{35:104,75:81,76:ae,77:oe,79:Re,80:Te},e(Oe,[2,59]),{35:105,75:81,76:ae,77:oe,79:Re,80:Te},{35:106,75:81,76:ae,77:oe,79:Re,80:Te},{35:107,75:81,76:ae,77:oe,79:Re,80:Te},{35:108,75:81,76:ae,77:oe,79:Re,80:Te},{35:109,75:81,76:ae,77:oe,79:Re,80:Te},{35:110,75:81,76:ae,77:oe,79:Re,80:Te},{35:111,75:81,76:ae,77:oe,79:Re,80:Te},{35:112,75:81,76:ae,77:oe,79:Re,80:Te},{35:113,75:81,76:ae,77:oe,79:Re,80:Te},{35:114,75:81,76:ae,77:oe,79:Re,80:Te},{35:115,75:81,76:ae,77:oe,79:Re,80:Te},{20:116,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{12:[1,118],33:[1,117]},{35:119,75:81,76:ae,77:oe,79:Re,80:Te},{35:120,75:81,76:ae,77:oe,79:Re,80:Te},{35:121,75:81,76:ae,77:oe,79:Re,80:Te},{35:122,75:81,76:ae,77:oe,79:Re,80:Te},{35:123,75:81,76:ae,77:oe,79:Re,80:Te},{35:124,75:81,76:ae,77:oe,79:Re,80:Te},{35:125,75:81,76:ae,77:oe,79:Re,80:Te},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(le,[2,15]),e(ee,[2,17],{21:22,19:130,22:t,23:r,24:n,26:i,28:a}),e(le,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:r,24:n,26:i,28:a,34:s,36:o,37:l,38:u,39:h,40:f,41:d,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U}),e(ue,[2,21]),e(ue,[2,22]),e(Oe,[2,39]),e(qe,[2,71],{75:81,35:132,76:ae,77:oe,79:Re,80:Te}),e(Ge,[2,73]),{78:[1,133]},e(Ge,[2,75]),e(Ge,[2,76]),e(Oe,[2,40]),e(Oe,[2,41]),e(Oe,[2,42]),e(Oe,[2,43]),e(Oe,[2,44]),e(Oe,[2,45]),e(Oe,[2,46]),e(Oe,[2,47]),e(Oe,[2,48]),e(Oe,[2,49]),e(Oe,[2,50]),e(Oe,[2,51]),e(Oe,[2,52]),e(Oe,[2,53]),e(Oe,[2,54]),e(Oe,[2,55]),e(Oe,[2,56]),e(Oe,[2,57]),e(Oe,[2,58]),e(Oe,[2,60]),e(Oe,[2,61]),e(Oe,[2,62]),e(Oe,[2,63]),e(Oe,[2,64]),e(Oe,[2,65]),e(Oe,[2,66]),e(Oe,[2,67]),e(Oe,[2,68]),e(Oe,[2,69]),e(Oe,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(fe,[2,28]),e(fe,[2,29]),e(fe,[2,30]),e(fe,[2,31]),e(fe,[2,32]),e(fe,[2,33]),e(fe,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(ee,[2,18]),e(le,[2,38]),e(qe,[2,72]),e(Ge,[2,74]),e(Oe,[2,24]),e(Oe,[2,35]),e(Ce,[2,25]),e(Ce,[2,26],{12:[1,138]}),e(Ce,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:b(function(he,xe){if(xe.recoverable)this.trace(he);else{var ce=new Error(he);throw ce.hash=xe,ce}},"parseError"),parse:b(function(he){var xe=this,ce=[0],ge=[],Ie=[null],ye=[],ne=this.table,V="",pe=0,K=0,ve=0,Z=2,je=1,Ne=ye.slice.call(arguments,1),ze=Object.create(this.lexer),Fe={yy:{}};for(var Ke in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ke)&&(Fe.yy[Ke]=this.yy[Ke]);ze.setInput(he,Fe.yy),Fe.yy.lexer=ze,Fe.yy.parser=this,typeof ze.yylloc>"u"&&(ze.yylloc={});var Ve=ze.yylloc;ye.push(Ve);var tt=ze.options&&ze.options.ranges;typeof Fe.yy.parseError=="function"?this.parseError=Fe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function We(it){ce.length=ce.length-2*it,Ie.length=Ie.length-it,ye.length=ye.length-it}b(We,"popStack");function rt(){var it;return it=ge.pop()||ze.lex()||je,typeof it!="number"&&(it instanceof Array&&(ge=it,it=ge.pop()),it=xe.symbols_[it]||it),it}b(rt,"lex");for(var Se,Et,De,mt,Tt,jt,_t={},Rt,bt,ke,yt;;){if(De=ce[ce.length-1],this.defaultActions[De]?mt=this.defaultActions[De]:((Se===null||typeof Se>"u")&&(Se=rt()),mt=ne[De]&&ne[De][Se]),typeof mt>"u"||!mt.length||!mt[0]){var xt="";yt=[];for(Rt in ne[De])this.terminals_[Rt]&&Rt>Z&&yt.push("'"+this.terminals_[Rt]+"'");ze.showPosition?xt="Parse error on line "+(pe+1)+`: + `),o=DMt(n,i,s);o.aPosition=n.getAttribLocation(o,"aPosition"),o.aIndex=n.getAttribLocation(o,"aIndex"),o.aVertType=n.getAttribLocation(o,"aVertType"),o.aTransform=n.getAttribLocation(o,"aTransform"),o.aAtlasId=n.getAttribLocation(o,"aAtlasId"),o.aTex=n.getAttribLocation(o,"aTex"),o.aPointAPointB=n.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=n.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=n.getAttribLocation(o,"aLineWidth"),o.aColor=n.getAttribLocation(o,"aColor"),o.aCornerRadius=n.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=n.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=n.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=n.getUniformLocation(o,"uAtlasSize"),o.uBGColor=n.getUniformLocation(o,"uBGColor"),o.uZoom=n.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var l=0;l1&&arguments[1]!==void 0?arguments[1]:TC.SCREEN;this.panZoomMatrix=r,this.renderTarget=n,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,n){return r.visible()?n&&n.isVisible?n.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,n,i){var a=this.atlasManager,s=this.batchManager,o=a.getRenderTypeOpts(i);if(this._isVisible(r,o)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&o.getTexPickingMode){var l=o.getTexPickingMode(r);if(l===XL.IGNORE)return;if(l==XL.USE_BB){this.drawPickingRectangle(r,n,i);return}}var u=a.getAtlasInfo(r,i),h=ic(u),f;try{for(h.s();!(f=h.n()).done;){var d=f.value,p=d.atlas,m=d.tex1,g=d.tex2;s.canAddToCurrentBatch(p)||this.endBatch();for(var y=s.getAtlasIndexForBatch(p),v=0,x=[[m,!0],[g,!1]];v=this.maxInstances&&this.endBatch()}}}}catch(O){h.e(O)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(r,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(i.shapeProps&&i.shapeProps.padding&&(o=r.pstyle(i.shapeProps.padding).pfValue),a){var l=a.bb,u=a.tex1,h=a.tex2,f=u.w/(u.w+h.w);s||(f=1-f);var d=this._getAdjustedBB(l,o,s,f);this._applyTransformMatrix(n,d,i,r)}else{var p=i.getBoundingBox(r),m=this._getAdjustedBB(p,o,!0,1);this._applyTransformMatrix(n,m,i,r)}}},{key:"_applyTransformMatrix",value:function(r,n,i,a){var s,o;AMe(r);var l=i.getRotation?i.getRotation(a):0;if(l!==0){var u=i.getRotationPoint(a),h=u.x,f=u.y;OL(r,r,[h,f]),_Me(r,r,l);var d=i.getRotationOffset(a);s=d.x+(n.xOffset||0),o=d.y+(n.yOffset||0)}else s=n.x1,o=n.y1;OL(r,r,[s,o]),nZ(r,r,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(r,n,i,a){var s=r.x1,o=r.y1,l=r.w,u=r.h,h=r.yOffset;n&&(s-=n,o-=n,l+=2*n,u+=2*n);var f=0,d=l*a;return i&&a<1?l=d:!i&&a<1&&(f=l-d,s+=f,l=d),{x1:s,y1:o,w:l,h:u,xOffset:f,yOffset:h}}},{key:"drawPickingRectangle",value:function(r,n,i){var a=this.atlasManager.getRenderTypeOpts(i),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=N4;var o=this.indexBuffer.getView(s);M4(n,o);var l=this.colorBuffer.getView(s);sv([0,0,0],1,l);var u=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(r,u,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,n,i){var a=this.simpleShapeOptions.get(i);if(this._isVisible(r,a)){var s=a.shapeProps,o=this._getVertTypeForShape(r,s.shape);if(o===void 0||a.isSimple&&!a.isSimple(r,this.renderTarget)){this.drawTexture(r,n,i);return}var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=o,o===CL||o===gC){var u=a.getBoundingBox(r),h=this._getCornerRadius(r,s.radius,u),f=this.cornerRadiusBuffer.getView(l);f[0]=h,f[1]=h,f[2]=h,f[3]=h,o===gC&&(f[0]=0,f[2]=0)}var d=this.indexBuffer.getView(l);M4(n,d);var p=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,m=this.renderTarget.picking?1:r.pstyle(s.opacity).value*p,g=r.pstyle(s.color).value,y=this.colorBuffer.getView(l);sv(g,m,y);var v=this.lineWidthBuffer.getView(l);if(v[0]=0,v[1]=0,s.border){var x=r.pstyle("border-width").value;if(x>0){var w=r.pstyle("border-color").value,C=p*r.pstyle("border-opacity").value,T=this.borderColorBuffer.getView(l);sv(w,C,T);var k=r.pstyle("border-position").value;if(k==="inside")v[0]=0,v[1]=-x;else if(k==="outside")v[0]=x,v[1]=0;else{var S=x/2;v[0]=S,v[1]=-S}}}var E=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(r,E,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,n){var i=r.pstyle(n).value;switch(i){case"rectangle":return N4;case"ellipse":return yC;case"roundrectangle":case"round-rectangle":return CL;case"bottom-round-rectangle":return gC;default:return}}},{key:"_getCornerRadius",value:function(r,n,i){var a=i.w,s=i.h;if(r.pstyle(n).value==="auto")return yg(a,s);var o=r.pstyle(n).pfValue,l=a/2,u=s/2;return Math.min(o,u,l)}},{key:"drawEdgeArrow",value:function(r,n,i){if(r.visible()){var a=r._private.rscratch,s,o,l;if(i==="source"?(s=a.arrowStartX,o=a.arrowStartY,l=a.srcArrowAngle):(s=a.arrowEndX,o=a.arrowEndY,l=a.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(l)||l==null)){var u=r.pstyle(i+"-arrow-shape").value;if(u!=="none"){var h=r.pstyle(i+"-arrow-color").value,f=r.pstyle("opacity").value,d=r.pstyle("line-opacity").value,p=f*d,m=r.pstyle("width").pfValue,g=r.pstyle("arrow-scale").value,y=this.r.getArrowWidth(m,g),v=this.instanceCount,x=this.transformBuffer.getMatrixView(v);AMe(x),OL(x,x,[s,o]),nZ(x,x,[y,y]),_Me(x,x,l),this.vertTypeBuffer.getView(v)[0]=BK;var w=this.indexBuffer.getView(v);M4(n,w);var C=this.colorBuffer.getView(v);sv(h,p,C),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,n){if(r.visible()){var i=this._getEdgePoints(r);if(i){var a=r.pstyle("opacity").value,s=r.pstyle("line-opacity").value,o=r.pstyle("width").pfValue,l=r.pstyle("line-color").value,u=a*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=RMe;var f=this.indexBuffer.getView(h);M4(n,f);var d=this.colorBuffer.getView(h);sv(l,u,d);var p=this.lineWidthBuffer.getView(h);p[0]=o;var m=this.pointAPointBBuffer.getView(h);m[0]=i[0],m[1]=i[1],m[2]=i[2],m[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var g=0;g=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var n=r._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var n=r._private.rscratch;if(this._isValidEdge(r)){var i=n.allpts;if(i.length==4)return i;var a=this._getNumSegments(r);return this._getCurveSegmentPoints(i,a)}}},{key:"_getNumSegments",value:function(r){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,n){if(r.length==4)return r;for(var i=Array((n+1)*2),a=0;a<=n;a++)if(a==0)i[0]=r[0],i[1]=r[1];else if(a==n)i[a*2]=r[r.length-2],i[a*2+1]=r[r.length-1];else{var s=a/n;this._setCurvePoint(r,s,i,a*2)}return i}},{key:"_setCurvePoint",value:function(r,n,i,a){if(r.length<=2)i[a]=r[0],i[a+1]=r[1];else{for(var s=Array(r.length-2),o=0;o0}},o=function(f){var d=f.pstyle("text-events").strValue==="yes";return d?XL.USE_BB:XL.IGNORE},l=function(f){var d=f.position(),p=d.x,m=d.y,g=f.outerWidth(),y=f.outerHeight();return{w:g,h:y,x1:p-g/2,y1:m-y/2}};r.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:FMt,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:FK(t.getLabelKey,null),getBoundingBox:$K(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:FK(t.getSourceLabelKey,"source"),getBoundingBox:$K(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:FK(t.getTargetLabelKey,"target"),getBoundingBox:$K(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a("target-label")});var u=$C(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(h,f){var d=!1;f&&f.length>0&&(d|=r.drawing.invalidate(f)),d&&u()}),aNt(r)};FK=function(t,r){return function(n){var i=t(n),a=mDe(n,r);return a.length>1?a.map(function(s,o){return"".concat(i,"_").concat(o)}):i}},$K=function(t,r){return function(n,i){var a=t(n);if(typeof i=="string"){var s=i.indexOf("_");if(s>0){var o=Number(i.substring(s+1)),l=mDe(n,r),u=a.h/l.length,h=u*o,f=a.y1+h;return{x1:a.x1,w:a.w,y1:f,h:u,yOffset:h}}}return a}};Sg={};Sg.drawPolygonPath=function(e,t,r,n,i,a){var s=n/2,o=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*a[0],r+o*a[1]);for(var l=1;l0&&s>0){p.clearRect(0,0,a,s),p.globalCompositeOperation="source-over";var m=this.getCachedZSortedEles();if(e.full)p.translate(-n.x1*u,-n.y1*u),p.scale(u,u),this.drawElements(p,m),p.scale(1/u,1/u),p.translate(n.x1*u,n.y1*u);else{var g=t.pan(),y={x:g.x*u,y:g.y*u};u*=t.zoom(),p.translate(y.x,y.y),p.scale(u,u),this.drawElements(p,m),p.scale(1/u,1/u),p.translate(-y.x,-y.y)}e.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=e.bg,p.rect(0,0,a,s),p.fill())}return d};HC.png=function(e){return xDe(e,this.bufferCanvasImage(e),"image/png")};HC.jpg=function(e){return xDe(e,this.bufferCanvasImage(e),"image/jpeg")};bDe={};bDe.nodeShapeImpl=function(e,t,r,n,i,a,s,o){switch(e){case"ellipse":return this.drawEllipsePath(t,r,n,i,a);case"polygon":return this.drawPolygonPath(t,r,n,i,a,s);case"round-polygon":return this.drawRoundPolygonPath(t,r,n,i,a,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,n,i,a,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,n,i,a,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,n,i,a,o);case"barrel":return this.drawBarrelPath(t,r,n,i,a)}};mNt=wDe,An=wDe.prototype;An.CANVAS_LAYERS=3;An.SELECT_BOX=0;An.DRAG=1;An.NODE=2;An.WEBGL=3;An.CANVAS_TYPES=["2d","2d","2d","webgl2"];An.BUFFER_COUNT=3;An.TEXTURE_BUFFER=0;An.MOTIONBLUR_BUFFER_NODE=1;An.MOTIONBLUR_BUFFER_DRAG=2;An.redrawHint=function(e,t){var r=this;switch(e){case"eles":r.data.canvasNeedsRedraw[An.NODE]=t;break;case"drag":r.data.canvasNeedsRedraw[An.DRAG]=t;break;case"select":r.data.canvasNeedsRedraw[An.SELECT_BOX]=t;break;case"gc":r.data.gc=!0;break}};gNt=typeof Path2D<"u";An.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e};An.usePaths=function(){return gNt&&this.pathsEnabled};An.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)};An.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled};An.makeOffscreenCanvas=function(e,t){var r;if((typeof OffscreenCanvas>"u"?"undefined":Ts(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(e,t);else{var n=this.cy.window(),i=n.document;r=i.createElement("canvas"),r.width=e,r.height=t}return r};[cDe,ed,z0,LZ,xv,Cg,Cl,pDe,Sg,HC,bDe].forEach(function(e){zr(An,e)});yNt=[{name:"null",impl:XNe},{name:"base",impl:aDe},{name:"canvas",impl:mNt}],vNt=[{type:"layout",extensions:GIt},{type:"renderer",extensions:yNt}],kDe={},TDe={};sZ=function(){if(arguments.length===2)return SDe.apply(null,arguments);if(arguments.length===3)return CDe.apply(null,arguments);if(arguments.length===4)return bNt.apply(null,arguments);if(arguments.length===5)return xNt.apply(null,arguments);ca("Invalid extension access syntax")};MC.prototype.extension=sZ;vNt.forEach(function(e){e.extensions.forEach(function(t){CDe(e.type,t.name,t.impl)})});jL=function(){if(!(this instanceof jL))return new jL;this.length=0},yv=jL.prototype;yv.instanceString=function(){return"stylesheet"};yv.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this};yv.css=function(e,t){var r=this.length-1;if(Ar(e))this[r].properties.push({name:e,value:t});else if(Hn(e))for(var n=e,i=Object.keys(n),a=0;a{(function(t,r){typeof UC=="object"&&typeof NZ=="object"?NZ.exports=r():typeof define=="function"&&define.amd?define([],r):typeof UC=="object"?UC.layoutBase=r():t.layoutBase=r()})(UC,function(){return(function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(n){return n},r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:a})},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=26)})([(function(e,t,r){"use strict";function n(){}n.QUALITY=1,n.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,n.DEFAULT_INCREMENTAL=!1,n.DEFAULT_ANIMATION_ON_LAYOUT=!0,n.DEFAULT_ANIMATION_DURING_LAYOUT=!1,n.DEFAULT_ANIMATION_PERIOD=50,n.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,n.DEFAULT_GRAPH_MARGIN=15,n.NODE_DIMENSIONS_INCLUDE_LABELS=!1,n.SIMPLE_NODE_SIZE=40,n.SIMPLE_NODE_HALF_SIZE=n.SIMPLE_NODE_SIZE/2,n.EMPTY_COMPOUND_NODE_SIZE=40,n.MIN_EDGE_LENGTH=1,n.WORLD_BOUNDARY=1e6,n.INITIAL_WORLD_BOUNDARY=n.WORLD_BOUNDARY/1e3,n.WORLD_CENTER_X=1200,n.WORLD_CENTER_Y=900,e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(8),a=r(9);function s(l,u,h){n.call(this,h),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=h,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var h=this.getOtherEnd(l),f=u.getGraphManager().getRoot();;){if(h.getOwner()==u)return h;if(h.getOwner()==f)break;h=h.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=s}),(function(e,t,r){"use strict";function n(i){this.vGraphObject=i}e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(13),s=r(0),o=r(16),l=r(4);function u(f,d,p,m){p==null&&m==null&&(m=d),n.call(this,m),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=m,this.edges=[],this.graphManager=f,p!=null&&d!=null?this.rect=new a(d.x,d.y,p.width,p.height):this.rect=new a}u.prototype=Object.create(n.prototype);for(var h in n)u[h]=n[h];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(f){this.rect.width=f},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(f){this.rect.height=f},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(f,d){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=d.width,this.rect.height=d.height},u.prototype.setCenter=function(f,d){this.rect.x=f-this.rect.width/2,this.rect.y=d-this.rect.height/2},u.prototype.setLocation=function(f,d){this.rect.x=f,this.rect.y=d},u.prototype.moveBy=function(f,d){this.rect.x+=f,this.rect.y+=d},u.prototype.getEdgeListToNode=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(g.target==f){if(g.source!=m)throw"Incorrect edge source!";d.push(g)}}),d},u.prototype.getEdgesBetween=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(!(g.source==m||g.target==m))throw"Incorrect edge source and/or target";(g.target==f||g.source==f)&&d.push(g)}),d},u.prototype.getNeighborsList=function(){var f=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)f.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";f.add(p.source)}}),f},u.prototype.withChildren=function(){var f=new Set,d,p;if(f.add(this),this.child!=null)for(var m=this.child.getNodes(),g=0;gd&&(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)),this.labelHeight>p&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-p)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-p),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(f){var d=this.rect.x;d>s.WORLD_BOUNDARY?d=s.WORLD_BOUNDARY:d<-s.WORLD_BOUNDARY&&(d=-s.WORLD_BOUNDARY);var p=this.rect.y;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var m=new l(d,p),g=f.inverseTransformPoint(m);this.setLocation(g.x,g.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=u}),(function(e,t,r){"use strict";function n(i,a){i==null&&a==null?(this.x=0,this.y=0):(this.x=i,this.y=a)}n.prototype.getX=function(){return this.x},n.prototype.getY=function(){return this.y},n.prototype.setX=function(i){this.x=i},n.prototype.setY=function(i){this.y=i},n.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},n.prototype.getCopy=function(){return new n(this.x,this.y)},n.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(0),s=r(6),o=r(3),l=r(1),u=r(13),h=r(12),f=r(11);function d(m,g,y){n.call(this,y),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=m,g!=null&&g instanceof s?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}d.prototype=Object.create(n.prototype);for(var p in n)d[p]=n[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(m,g,y){if(g==null&&y==null){var v=m;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(v)>-1)throw"Node already in graph!";return v.owner=this,this.getNodes().push(v),v}else{var x=m;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(g.owner==y.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=y.owner?null:(x.source=g,x.target=y,x.isInterGraph=!1,this.getEdges().push(x),g.edges.push(x),y!=g&&y.edges.push(x),x)}},d.prototype.remove=function(m){var g=m;if(m instanceof o){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=g.edges.slice(),v,x=y.length,w=0;w-1&&k>-1))throw"Source and/or target doesn't know this edge!";v.source.edges.splice(T,1),v.target!=v.source&&v.target.edges.splice(k,1);var C=v.source.owner.getEdges().indexOf(v);if(C==-1)throw"Not in owner's edge list!";v.source.owner.getEdges().splice(C,1)}},d.prototype.updateLeftTop=function(){for(var m=i.MAX_VALUE,g=i.MAX_VALUE,y,v,x,w=this.getNodes(),C=w.length,T=0;Ty&&(m=y),g>v&&(g=v)}return m==i.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?x=w[0].getParent().paddingLeft:x=this.margin,this.left=g-x,this.top=m-x,new h(this.left,this.top))},d.prototype.updateBounds=function(m){for(var g=i.MAX_VALUE,y=-i.MAX_VALUE,v=i.MAX_VALUE,x=-i.MAX_VALUE,w,C,T,k,S,E=this.nodes,I=E.length,L=0;Lw&&(g=w),yT&&(v=T),xw&&(g=w),yT&&(v=T),x=this.nodes.length){var I=0;y.forEach(function(L){L.owner==m&&I++}),I==this.nodes.length&&(this.isConnected=!0)}},e.exports=d}),(function(e,t,r){"use strict";var n,i=r(1);function a(s){n=r(5),this.layout=s,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},a.prototype.add=function(s,o,l,u,h){if(l==null&&u==null&&h==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{h=l,u=o,l=s;var f=u.getOwner(),d=h.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==d)return l.isInterGraph=!1,f.add(l,u,h);if(l.isInterGraph=!0,l.source=u,l.target=h,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},a.prototype.remove=function(s){if(s instanceof n){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,h=l.length,f=0;f=s.getRight()?o[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(o[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(o[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var h=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(h=1);var f=h*o[0],d=o[1]/h;o[0]f)return o[0]=l,o[1]=p,o[2]=h,o[3]=E,!1;if(uh)return o[0]=d,o[1]=u,o[2]=k,o[3]=f,!1;if(lh?(o[0]=g,o[1]=y,R=!0):(o[0]=m,o[1]=p,R=!0):N===D&&(l>h?(o[0]=d,o[1]=p,R=!0):(o[0]=v,o[1]=y,R=!0)),-M===D?h>l?(o[2]=S,o[3]=E,A=!0):(o[2]=k,o[3]=T,A=!0):M===D&&(h>l?(o[2]=C,o[3]=T,A=!0):(o[2]=I,o[3]=E,A=!0)),R&&A)return!1;if(l>h?u>f?(B=this.getCardinalDirection(N,D,4),P=this.getCardinalDirection(M,D,2)):(B=this.getCardinalDirection(-N,D,3),P=this.getCardinalDirection(-M,D,1)):u>f?(B=this.getCardinalDirection(-N,D,1),P=this.getCardinalDirection(-M,D,3)):(B=this.getCardinalDirection(N,D,2),P=this.getCardinalDirection(M,D,4)),!R)switch(B){case 1:F=p,$=l+-w/D,o[0]=$,o[1]=F;break;case 2:$=v,F=u+x*D,o[0]=$,o[1]=F;break;case 3:F=y,$=l+w/D,o[0]=$,o[1]=F;break;case 4:$=g,F=u+-x*D,o[0]=$,o[1]=F;break}if(!A)switch(P){case 1:G=T,q=h+-O/D,o[2]=q,o[3]=G;break;case 2:q=I,G=f+L*D,o[2]=q,o[3]=G;break;case 3:G=E,q=h+O/D,o[2]=q,o[3]=G;break;case 4:q=S,G=f+-L*D,o[2]=q,o[3]=G;break}}return!1},i.getCardinalDirection=function(a,s,o){return a>s?o:1+o%4},i.getIntersection=function(a,s,o,l){if(l==null)return this.getIntersection2(a,s,o);var u=a.x,h=a.y,f=s.x,d=s.y,p=o.x,m=o.y,g=l.x,y=l.y,v=void 0,x=void 0,w=void 0,C=void 0,T=void 0,k=void 0,S=void 0,E=void 0,I=void 0;return w=d-h,T=u-f,S=f*h-u*d,C=y-m,k=p-g,E=g*m-p*y,I=w*k-C*T,I===0?null:(v=(T*E-k*S)/I,x=(C*S-w*E)/I,new n(v,x))},i.angleOfVector=function(a,s,o,l){var u=void 0;return a!==o?(u=Math.atan((l-s)/(o-a)),o0?1:i<0?-1:0},n.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},n.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},e.exports=n}),(function(e,t,r){"use strict";function n(){}n.MAX_VALUE=2147483647,n.MIN_VALUE=-2147483648,e.exports=n}),(function(e,t,r){"use strict";var n=(function(){function u(h,f){for(var d=0;d"u"?"undefined":n(a);return a==null||s!="object"&&s!="function"},e.exports=i}),(function(e,t,r){"use strict";function n(p){if(Array.isArray(p)){for(var m=0,g=Array(p.length);m0&&m;){for(w.push(T[0]);w.length>0&&m;){var k=w[0];w.splice(0,1),x.add(k);for(var S=k.getEdges(),v=0;v-1&&T.splice(O,1)}x=new Set,C=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var m=[],g=p.source,y=this.graphManager.calcLowestCommonAncestor(p.source,p.target),v=0;v0){for(var y=this.edgeToDummyNodes.get(g),v=0;v=0&&m.splice(E,1);var I=C.getNeighborsList();I.forEach(function(R){if(g.indexOf(R)<0){var A=y.get(R),N=A-1;N==1&&k.push(R),y.set(R,N)}})}g=g.concat(k),(m.length==1||m.length==2)&&(v=!0,x=m[0])}return x},d.prototype.setGraphManager=function(p){this.graphManager=p},e.exports=d}),(function(e,t,r){"use strict";function n(){}n.seed=1,n.x=0,n.nextDouble=function(){return n.x=Math.sin(n.seed++)*1e4,n.x-Math.floor(n.x)},e.exports=n}),(function(e,t,r){"use strict";var n=r(4);function i(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(a){this.lworldExtX=a},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(a){this.lworldExtY=a},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},i.prototype.transformX=function(a){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/o),s},i.prototype.transformY=function(a){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/o),s},i.prototype.inverseTransformX=function(a){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/o),s},i.prototype.inverseTransformY=function(a){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/o),s},i.prototype.inverseTransformPoint=function(a){var s=new n(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},e.exports=i}),(function(e,t,r){"use strict";function n(f){if(Array.isArray(f)){for(var d=0,p=Array(f.length);da.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),d,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,m,g,y,v=this.getAllNodes(),x;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),x=new Set,p=0;pw||x>w)&&(f.gravitationForceX=-this.gravityConstant*g,f.gravitationForceY=-this.gravityConstant*y)):(w=d.getEstimatedSize()*this.compoundGravityRangeFactor,(v>w||x>w)&&(f.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},u.prototype.isConverged=function(){var f,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=v.length||w>=v[0].length)){for(var C=0;Cu}}]),o})();e.exports=s}),(function(e,t,r){"use strict";var n=(function(){function s(o,l){for(var u=0;u2&&arguments[2]!==void 0?arguments[2]:1,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=h,this.gap_penalty=f,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;o--){var l=this.listeners[o];l.event===a&&l.callback===s&&this.listeners.splice(o,1)}},i.emit=function(a,s){for(var o=0;o{(function(t,r){typeof YC=="object"&&typeof OZ=="object"?OZ.exports=r(DZ()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof YC=="object"?YC.coseBase=r(DZ()):t.coseBase=r(t.layoutBase)})(YC,function(e){return(function(t){var r={};function n(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=r,n.i=function(i){return i},n.d=function(i,a,s){n.o(i,a)||Object.defineProperty(i,a,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(a,"a",a),a},n.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},n.p="",n(n.s=7)})([(function(t,r){t.exports=e}),(function(t,r,n){"use strict";var i=n(0).FDLayoutConstants;function a(){}for(var s in i)a[s]=i[s];a.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,a.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,a.DEFAULT_COMPONENT_SEPERATION=60,a.TILE=!0,a.TILING_PADDING_VERTICAL=10,a.TILING_PADDING_HORIZONTAL=10,a.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=a}),(function(t,r,n){"use strict";var i=n(0).FDLayoutEdge;function a(o,l,u){i.call(this,o,l,u)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];t.exports=a}),(function(t,r,n){"use strict";var i=n(0).LGraph;function a(o,l,u){i.call(this,o,l,u)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];t.exports=a}),(function(t,r,n){"use strict";var i=n(0).LGraphManager;function a(o){i.call(this,o)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];t.exports=a}),(function(t,r,n){"use strict";var i=n(0).FDLayoutNode,a=n(0).IMath;function s(l,u,h,f){i.call(this,l,u,h,f)}s.prototype=Object.create(i.prototype);for(var o in i)s[o]=i[o];s.prototype.move=function(){var l=this.graphManager.getLayout();this.displacementX=l.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=l.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementX=l.coolingFactor*l.maxNodeDisplacement*a.sign(this.displacementX)),Math.abs(this.displacementY)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementY=l.coolingFactor*l.maxNodeDisplacement*a.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),l.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},s.prototype.propogateDisplacementToChildren=function(l,u){for(var h=this.getChild().getNodes(),f,d=0;d0)this.positionNodesRadially(T);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var k=new Set(this.getAllNodes()),S=this.nodesWithGravity.filter(function(E){return k.has(E)});this.graphManager.setAllNodesToApplyGravitation(S),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},w.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var T=new Set(this.getAllNodes()),k=this.nodesWithGravity.filter(function(I){return T.has(I)});this.graphManager.setAllNodesToApplyGravitation(k),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var S=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(S,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},w.prototype.getPositionsData=function(){for(var T=this.graphManager.getAllNodes(),k={},S=0;S1){var R;for(R=0;RE&&(E=Math.floor(O.y)),L=Math.floor(O.x+u.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(f.WORLD_CENTER_X-O.x/2,f.WORLD_CENTER_Y-O.y/2))},w.radialLayout=function(T,k,S){var E=Math.max(this.maxDiagonalInTree(T),u.DEFAULT_RADIAL_SEPARATION);w.branchRadialLayout(k,null,0,359,0,E);var I=v.calculateBounds(T),L=new x;L.setDeviceOrgX(I.getMinX()),L.setDeviceOrgY(I.getMinY()),L.setWorldOrgX(S.x),L.setWorldOrgY(S.y);for(var O=0;O1;){var z=G[0];G.splice(0,1);var H=B.indexOf(z);H>=0&&B.splice(H,1),F--,P--}k!=null?q=(B.indexOf(G[0])+1)%F:q=0;for(var j=Math.abs(E-S)/P,J=q;$!=P;J=++J%F){var U=B[J].getOtherEnd(T);if(U!=k){var le=(S+$*j)%360,ee=(le+j)%360;w.branchRadialLayout(U,T,le,ee,I+L,L),$++}}},w.maxDiagonalInTree=function(T){for(var k=g.MIN_VALUE,S=0;Sk&&(k=I)}return k},w.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},w.prototype.groupZeroDegreeMembers=function(){var T=this,k={};this.memberGroups={},this.idToDummyNode={};for(var S=[],E=this.graphManager.getAllNodes(),I=0;I"u"&&(k[R]=[]),k[R]=k[R].concat(L)}Object.keys(k).forEach(function(A){if(k[A].length>1){var N="DummyCompound_"+A;T.memberGroups[N]=k[A];var M=k[A][0].getParent(),D=new o(T.graphManager);D.id=N,D.paddingLeft=M.paddingLeft||0,D.paddingRight=M.paddingRight||0,D.paddingBottom=M.paddingBottom||0,D.paddingTop=M.paddingTop||0,T.idToDummyNode[N]=D;var B=T.getGraphManager().add(T.newGraph(),D),P=M.getChild();P.add(D);for(var $=0;$=0;T--){var k=this.compoundOrder[T],S=k.id,E=k.paddingLeft,I=k.paddingTop;this.adjustLocations(this.tiledMemberPack[S],k.rect.x,k.rect.y,E,I)}},w.prototype.repopulateZeroDegreeMembers=function(){var T=this,k=this.tiledZeroDegreePack;Object.keys(k).forEach(function(S){var E=T.idToDummyNode[S],I=E.paddingLeft,L=E.paddingTop;T.adjustLocations(k[S],E.rect.x,E.rect.y,I,L)})},w.prototype.getToBeTiled=function(T){var k=T.id;if(this.toBeTiled[k]!=null)return this.toBeTiled[k];var S=T.getChild();if(S==null)return this.toBeTiled[k]=!1,!1;for(var E=S.getNodes(),I=0;I0)return this.toBeTiled[k]=!1,!1;if(L.getChild()==null){this.toBeTiled[L.id]=!1;continue}if(!this.getToBeTiled(L))return this.toBeTiled[k]=!1,!1}return this.toBeTiled[k]=!0,!0},w.prototype.getNodeDegree=function(T){for(var k=T.id,S=T.getEdges(),E=0,I=0;IA&&(A=M.rect.height)}S+=A+T.verticalPadding}},w.prototype.tileCompoundMembers=function(T,k){var S=this;this.tiledMemberPack=[],Object.keys(T).forEach(function(E){var I=k[E];S.tiledMemberPack[E]=S.tileNodes(T[E],I.paddingLeft+I.paddingRight),I.rect.width=S.tiledMemberPack[E].width,I.rect.height=S.tiledMemberPack[E].height})},w.prototype.tileNodes=function(T,k){var S=u.TILING_PADDING_VERTICAL,E=u.TILING_PADDING_HORIZONTAL,I={rows:[],rowWidth:[],rowHeight:[],width:0,height:k,verticalPadding:S,horizontalPadding:E};T.sort(function(R,A){return R.rect.width*R.rect.height>A.rect.width*A.rect.height?-1:R.rect.width*R.rect.height0&&(O+=T.horizontalPadding),T.rowWidth[S]=O,T.width0&&(R+=T.verticalPadding);var A=0;R>T.rowHeight[S]&&(A=T.rowHeight[S],T.rowHeight[S]=R,A=T.rowHeight[S]-A),T.height+=A,T.rows[S].push(k)},w.prototype.getShortestRowIndex=function(T){for(var k=-1,S=Number.MAX_VALUE,E=0;ES&&(k=E,S=T.rowWidth[E]);return k},w.prototype.canAddHorizontal=function(T,k,S){var E=this.getShortestRowIndex(T);if(E<0)return!0;var I=T.rowWidth[E];if(I+T.horizontalPadding+k<=T.width)return!0;var L=0;T.rowHeight[E]0&&(L=S+T.verticalPadding-T.rowHeight[E]);var O;T.width-I>=k+T.horizontalPadding?O=(T.height+L)/(I+k+T.horizontalPadding):O=(T.height+L)/T.width,L=S+T.verticalPadding;var R;return T.widthL&&k!=S){E.splice(-1,1),T.rows[S].push(I),T.rowWidth[k]=T.rowWidth[k]-L,T.rowWidth[S]=T.rowWidth[S]+L,T.width=T.rowWidth[instance.getLongestRowIndex(T)];for(var O=Number.MIN_VALUE,R=0;RO&&(O=E[R].height);k>0&&(O+=T.verticalPadding);var A=T.rowHeight[k]+T.rowHeight[S];T.rowHeight[k]=O,T.rowHeight[S]0)for(var P=I;P<=L;P++)B[0]+=this.grid[P][O-1].length+this.grid[P][O].length-1;if(L0)for(var P=O;P<=R;P++)B[3]+=this.grid[I-1][P].length+this.grid[I][P].length-1;for(var $=g.MAX_VALUE,F,q,G=0;G{(function(t,r){typeof XC=="object"&&typeof BZ=="object"?BZ.exports=r(PZ()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof XC=="object"?XC.cytoscapeCoseBilkent=r(PZ()):t.cytoscapeCoseBilkent=r(t.coseBase)})(XC,function(e){return(function(t){var r={};function n(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=r,n.i=function(i){return i},n.d=function(i,a,s){n.o(i,a)||Object.defineProperty(i,a,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(a,"a",a),a},n.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},n.p="",n(n.s=1)})([(function(t,r){t.exports=e}),(function(t,r,n){"use strict";var i=n(0).layoutBase.LayoutConstants,a=n(0).layoutBase.FDLayoutConstants,s=n(0).CoSEConstants,o=n(0).CoSELayout,l=n(0).CoSENode,u=n(0).layoutBase.PointD,h=n(0).layoutBase.DimensionD,f={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(y,v){var x={};for(var w in y)x[w]=y[w];for(var w in v)x[w]=v[w];return x}function p(y){this.options=d(f,y),m(this.options)}var m=function(v){v.nodeRepulsion!=null&&(s.DEFAULT_REPULSION_STRENGTH=a.DEFAULT_REPULSION_STRENGTH=v.nodeRepulsion),v.idealEdgeLength!=null&&(s.DEFAULT_EDGE_LENGTH=a.DEFAULT_EDGE_LENGTH=v.idealEdgeLength),v.edgeElasticity!=null&&(s.DEFAULT_SPRING_STRENGTH=a.DEFAULT_SPRING_STRENGTH=v.edgeElasticity),v.nestingFactor!=null&&(s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor),v.gravity!=null&&(s.DEFAULT_GRAVITY_STRENGTH=a.DEFAULT_GRAVITY_STRENGTH=v.gravity),v.numIter!=null&&(s.MAX_ITERATIONS=a.MAX_ITERATIONS=v.numIter),v.gravityRange!=null&&(s.DEFAULT_GRAVITY_RANGE_FACTOR=a.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange),v.gravityCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound),v.gravityRangeCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound),v.initialEnergyOnIncremental!=null&&(s.DEFAULT_COOLING_FACTOR_INCREMENTAL=a.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental),v.quality=="draft"?i.QUALITY=0:v.quality=="proof"?i.QUALITY=2:i.QUALITY=1,s.NODE_DIMENSIONS_INCLUDE_LABELS=a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,s.DEFAULT_INCREMENTAL=a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=!v.randomize,s.ANIMATE=a.ANIMATE=i.ANIMATE=v.animate,s.TILE=v.tile,s.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical=="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,s.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal=="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal};p.prototype.run=function(){var y,v,x=this.options,w=this.idToLNode={},C=this.layout=new o,T=this;T.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var k=C.newGraphManager();this.gm=k;var S=this.options.eles.nodes(),E=this.options.eles.edges();this.root=k.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(S),C);for(var I=0;I0){var R;R=x.getGraphManager().add(x.newGraph(),S),this.processChildrenList(R,k,x)}}},p.prototype.stop=function(){return this.stopped=!0,this};var g=function(v){v("layout","cose-bilkent",p)};typeof cytoscape<"u"&&g(cytoscape),t.exports=g})])})});var ODe={};Tr(ODe,{render:()=>TNt});function _De(e,t){e.forEach(r=>{let n={id:r.id,labelText:r.label,height:r.height,width:r.width,padding:r.padding??0};Object.keys(r).forEach(i=>{["id","label","height","width","padding","x","y"].includes(i)||(n[i]=r[i])}),t.add({group:"nodes",data:n,position:{x:r.x??0,y:r.y??0}})})}function RDe(e,t){e.forEach(r=>{let n={id:r.id,source:r.start,target:r.end};Object.keys(r).forEach(i=>{["id","start","end"].includes(i)||(n[i]=r[i])}),t.add({group:"edges",data:n})})}function LDe(e){return new Promise(t=>{let r=ct("body").append("div").attr("id","cy").attr("style","display:none"),n=Du({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),_De(e.nodes,n),RDe(e.edges,n),n.nodes().forEach(function(a){a.layoutDimensions=()=>{let s=a.data();return{w:s.width,h:s.height}}});let i={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};n.layout(i).run(),n.ready(a=>{se.info("Cytoscape ready",a),t(n)})})}function IDe(e){return e.nodes().map(t=>{let r=t.data(),n=t.position(),i={id:r.id,x:n.x,y:n.y};return Object.keys(r).forEach(a=>{a!=="id"&&(i[a]=r[a])}),i})}function MDe(e){return e.edges().map(t=>{let r=t.data(),n=t._private.rscratch,i={id:r.id,source:r.source,target:r.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(r).forEach(a=>{["id","source","target"].includes(a)||(i[a]=r[a])}),i})}async function NDe(e,t){se.debug("Starting cose-bilkent layout algorithm");try{DDe(e);let r=await LDe(e),n=IDe(r),i=MDe(r);return se.debug(`Layout completed: ${n.length} nodes, ${i.length} edges`),{nodes:n,edges:i}}catch(r){throw se.error("Error in cose-bilkent layout algorithm:",r),r}}function DDe(e){if(!e)throw new Error("Layout data is required");if(!e.config)throw new Error("Configuration is required in layout data");if(!e.rootNode)throw new Error("Root node is required");if(!e.nodes||!Array.isArray(e.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(e.edges))throw new Error("Edges array is required in layout data");return!0}var ADe,kNt,TNt,PDe=W(()=>{Rr();hr();MZ();ADe=Ro(EDe(),1);fn();Du.use(ADe.default);b(_De,"addNodes");b(RDe,"addEdges");b(LDe,"createCytoscapeInstance");b(IDe,"extractPositionedNodes");b(MDe,"extractPositionedEdges");b(NDe,"executeCoseBilkentLayout");b(DDe,"validateLayoutData");kNt=b(async(e,t,{insertCluster:r,insertEdge:n,insertEdgeLabel:i,insertMarkers:a,insertNode:s,log:o,positionEdgeLabel:l},{algorithm:u})=>{let h={},f={},d=t.select("g");a(d,e.markers,e.type,e.diagramId);let p=d.insert("g").attr("class","subgraphs"),m=d.insert("g").attr("class","edgePaths"),g=d.insert("g").attr("class","edgeLabels"),y=d.insert("g").attr("class","nodes");o.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(e.nodes.map(async w=>{if(w.isGroup){let C={...w};f[w.id]=C,h[w.id]=C,await r(p,w)}else{let C={...w};h[w.id]=C;let T=await s(y,w,{config:e.config,dir:e.direction||"TB"}),k=T.node().getBBox();C.width=k.width,C.height=k.height,C.domId=T,o.debug(`Node ${w.id} dimensions: ${k.width}x${k.height}`)}})),o.debug("Running cose-bilkent layout algorithm");let v={...e,nodes:e.nodes.map(w=>{let C=h[w.id];return{...w,width:C.width,height:C.height}})},x=await NDe(v,e.config);o.debug("Positioning nodes based on layout results"),x.nodes.forEach(w=>{let C=h[w.id];C?.domId&&(C.domId.attr("transform",`translate(${w.x}, ${w.y})`),C.x=w.x,C.y=w.y,o.debug(`Positioned node ${C.id} at center (${w.x}, ${w.y})`))}),x.edges.forEach(w=>{let C=e.edges.find(T=>T.id===w.id);C&&(C.points=[{x:w.startX,y:w.startY},{x:w.midX,y:w.midY},{x:w.endX,y:w.endY}])}),o.debug("Inserting and positioning edges"),await Promise.all(e.edges.map(async w=>{let C=await i(g,w),T=h[w.start??""],k=h[w.end??""];if(T&&k){let S=x.edges.find(E=>E.id===w.id);if(S){o.debug("APA01 positionedEdge",S);let E={...w},I=n(m,E,f,e.type,T,k,e.diagramId);l(E,I)}else{let E={...w,points:[{x:T.x||0,y:T.y||0},{x:k.x||0,y:k.y||0}]},I=n(m,E,f,e.type,T,k,e.diagramId);l(E,I)}}})),o.debug("Cose-bilkent rendering completed")},"render"),TNt=kNt});var CNt,jC,FZ,SNt,Ou,td,ac=W(()=>{ec();po();Sn();_r();Rr();hr();CNt={common:Ct,getConfig:qt,insertCluster:Jm,insertEdge:b4,insertEdgeLabel:Zy,insertMarkers:w4,insertNode:M0,interpolateToCurve:oR,labelHelper:Hr,log:se,positionEdgeLabel:BR},jC={},FZ=b(e=>{for(let t of e)jC[t.name]=t},"registerLayoutLoaders"),SNt=b(()=>{FZ([{name:"dagre",loader:b(async()=>await Promise.resolve().then(()=>(u_e(),c_e)),"loader")},{name:"swimlane",loader:b(async()=>await Promise.resolve().then(()=>(aLe(),iLe)),"loader")},{name:"cose-bilkent",loader:b(async()=>await Promise.resolve().then(()=>(PDe(),ODe)),"loader")}])},"registerDefaultLayoutLoaders");SNt();Ou=b(async(e,t,r)=>{if(!(e.layoutAlgorithm in jC))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(let f of e.nodes){let d=f.domId||f.id;f.domId=`${e.diagramId}-${d}`}let n=jC[e.layoutAlgorithm],i=await n.loader(),{theme:a,themeVariables:s}=e.config,{useGradient:o,gradientStart:l,gradientStop:u}=s,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${a?.includes("dark")?"#FFFFFF":"#000000"}`),o){let f=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");f.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),f.append("svg:stop").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",1)}return i.render(e,t,CNt,{algorithm:n.algorithm},r)},"render"),td=b((e="",{fallback:t="dagre"}={})=>{if(e in jC)return e;if(t in jC)return se.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm")});var zZ,wv,SI,nOe,EI,AI,Xo,_I,iw,Hc=W(()=>{_r();hr();zZ=Ro(n4(),1);fn();wv=b((e,t)=>{let r=e.append("rect");if(r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),t.name&&r.attr("name",t.name),t.rx&&r.attr("rx",t.rx),t.ry&&r.attr("ry",t.ry),t.attrs!==void 0)for(let n in t.attrs)r.attr(n,t.attrs[n]);return t.class&&r.attr("class",t.class),r},"drawRect"),SI=b((e,t)=>{let r={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};wv(e,r).lower()},"drawBackgroundRect"),nOe=b((e,t)=>{let r=t.text.replace(my," "),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.attr("class","legend"),n.style("text-anchor",t.anchor),t.class&&n.attr("class",t.class);let i=n.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(r),n},"drawText"),EI=b((e,t,r,n)=>{let i=e.append("image");i.attr("x",t),i.attr("y",r);let a=(0,zZ.sanitizeUrl)(n);i.attr("xlink:href",a)},"drawImage"),AI=b((e,t,r,n)=>{let i=e.append("use");i.attr("x",t),i.attr("y",r);let a=(0,zZ.sanitizeUrl)(n);i.attr("xlink:href",`#${a}`)},"drawEmbeddedImage"),Xo=b(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),_I=b(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),iw=b(()=>{let e=ct(".mermaidTooltip");return e.empty()&&(e=ct("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),e},"createTooltip")});var mOe={};Tr(mOe,{diagram:()=>bDt});function $u(e,t,r,n,i){if(!t[e].width)if(r)t[e].text=Wy(t[e].text,i,n),t[e].textLines=t[e].text.split(Ct.lineBreakRegex).length,t[e].width=i,t[e].height=G3(t[e].text,n);else{let a=t[e].text.split(Ct.lineBreakRegex);t[e].textLines=a.length;let s=0;t[e].height=0,t[e].width=0;for(let o of a)t[e].width=Math.max(uo(o,n),t[e].width),s=G3(o,n),t[e].height=t[e].height+s}}function YZ(e,t,r,n,i){let a=new fOe(i);a.data.widthLimit=r.data.widthLimit/Math.min(qZ,n.length);for(let[s,o]of n.entries()){let l=0;o.image={width:0,height:0,Y:0},o.sprite&&(o.image.width=48,o.image.height=48,o.image.Y=l,l=o.image.Y+o.image.height);let u=o.wrap&&xr.wrap,h=RI(xr);if(h.fontSize=h.fontSize+2,h.fontWeight="bold",$u("label",o,u,h,a.data.widthLimit),o.label.Y=l+8,l=o.label.Y+o.label.height,o.type&&o.type.text!==""){o.type.text="["+o.type.text+"]";let m=RI(xr);$u("type",o,u,m,a.data.widthLimit),o.type.Y=l+5,l=o.type.Y+o.type.height}if(o.descr&&o.descr.text!==""){let m=RI(xr);m.fontSize=m.fontSize-2,$u("descr",o,u,m,a.data.widthLimit),o.descr.Y=l+20,l=o.descr.Y+o.descr.height}if(s==0||s%qZ===0){let m=r.data.startx+xr.diagramMarginX,g=r.data.stopy+xr.diagramMarginY+l;a.setData(m,m,g,g)}else{let m=a.data.stopx!==a.data.startx?a.data.stopx+xr.diagramMarginX:a.data.startx,g=a.data.starty;a.setData(m,m,g,g)}a.name=o.alias;let f=i.db.getC4ShapeArray(o.alias),d=i.db.getC4ShapeKeys(o.alias);d.length>0&&pOe(a,e,f,d),t=o.alias;let p=i.db.getBoundaries(t);p.length>0&&YZ(e,t,a,p,i),o.alias!=="global"&&dOe(e,o,a),r.data.stopy=Math.max(a.data.stopy+xr.c4ShapeMargin,r.data.stopy),r.data.stopx=Math.max(a.data.stopx+xr.c4ShapeMargin,r.data.stopx),NI=Math.max(NI,r.data.stopx),DI=Math.max(DI,r.data.stopy)}}var cOe,LI,_Nt,Ah,Eg,Sl,Eh,nd,eS,WZ,HZ,II,MI,sOe,RNt,LNt,INt,MNt,NNt,DNt,ONt,PNt,BNt,FNt,$Nt,zNt,GNt,qNt,VNt,WNt,HNt,oOe,UNt,YNt,lOe,XNt,jNt,KNt,ZNt,Ag,QNt,JNt,eDt,tDt,rDt,GZ,UZ,uOe,nDt,iDt,aDt,sDt,oDt,lDt,cDt,uDt,hDt,fDt,dDt,W0,rd,NI,DI,hOe,qZ,xr,fOe,VZ,JC,RI,pDt,dOe,pOe,Fu,iOe,mDt,gDt,yDt,aOe,vDt,xDt,bDt,gOe=W(()=>{Hc();Sn();_r();Rr();hr();fn();cOe=Ro(n4(),1),LI=(function(){var e=b(function(Q,he,xe,ce){for(xe=xe||{},ce=Q.length;ce--;xe[Q[ce]]=he);return xe},"o"),t=[1,24],r=[1,25],n=[1,26],i=[1,27],a=[1,28],s=[1,63],o=[1,64],l=[1,65],u=[1,66],h=[1,67],f=[1,68],d=[1,69],p=[1,29],m=[1,30],g=[1,31],y=[1,32],v=[1,33],x=[1,34],w=[1,35],C=[1,36],T=[1,37],k=[1,38],S=[1,39],E=[1,40],I=[1,41],L=[1,42],O=[1,43],R=[1,44],A=[1,45],N=[1,46],M=[1,47],D=[1,48],B=[1,50],P=[1,51],$=[1,52],F=[1,53],q=[1,54],G=[1,55],z=[1,56],H=[1,57],j=[1,58],J=[1,59],U=[1,60],le=[14,42],ee=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],ue=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],ae=[1,82],oe=[1,83],Re=[1,84],Te=[1,85],Oe=[12,14,42],qe=[12,14,33,42],Ge=[12,14,33,42,76,77,79,80],fe=[12,33],Ce=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],_e={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:b(function(he,xe,ce,ge,Ie,ye,ne){var V=ye.length-1;switch(Ie){case 3:ge.setDirection("TB");break;case 4:ge.setDirection("BT");break;case 5:ge.setDirection("RL");break;case 6:ge.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:ge.setC4Type(ye[V-3]);break;case 19:ge.setTitle(ye[V].substring(6)),this.$=ye[V].substring(6);break;case 20:ge.setAccDescription(ye[V].substring(15)),this.$=ye[V].substring(15);break;case 21:this.$=ye[V].trim(),ge.setTitle(this.$);break;case 22:case 23:this.$=ye[V].trim(),ge.setAccDescription(this.$);break;case 28:ye[V].splice(2,0,"ENTERPRISE"),ge.addPersonOrSystemBoundary(...ye[V]),this.$=ye[V];break;case 29:ye[V].splice(2,0,"SYSTEM"),ge.addPersonOrSystemBoundary(...ye[V]),this.$=ye[V];break;case 30:ge.addPersonOrSystemBoundary(...ye[V]),this.$=ye[V];break;case 31:ye[V].splice(2,0,"CONTAINER"),ge.addContainerBoundary(...ye[V]),this.$=ye[V];break;case 32:ge.addDeploymentNode("node",...ye[V]),this.$=ye[V];break;case 33:ge.addDeploymentNode("nodeL",...ye[V]),this.$=ye[V];break;case 34:ge.addDeploymentNode("nodeR",...ye[V]),this.$=ye[V];break;case 35:ge.popBoundaryParseStack();break;case 39:ge.addPersonOrSystem("person",...ye[V]),this.$=ye[V];break;case 40:ge.addPersonOrSystem("external_person",...ye[V]),this.$=ye[V];break;case 41:ge.addPersonOrSystem("system",...ye[V]),this.$=ye[V];break;case 42:ge.addPersonOrSystem("system_db",...ye[V]),this.$=ye[V];break;case 43:ge.addPersonOrSystem("system_queue",...ye[V]),this.$=ye[V];break;case 44:ge.addPersonOrSystem("external_system",...ye[V]),this.$=ye[V];break;case 45:ge.addPersonOrSystem("external_system_db",...ye[V]),this.$=ye[V];break;case 46:ge.addPersonOrSystem("external_system_queue",...ye[V]),this.$=ye[V];break;case 47:ge.addContainer("container",...ye[V]),this.$=ye[V];break;case 48:ge.addContainer("container_db",...ye[V]),this.$=ye[V];break;case 49:ge.addContainer("container_queue",...ye[V]),this.$=ye[V];break;case 50:ge.addContainer("external_container",...ye[V]),this.$=ye[V];break;case 51:ge.addContainer("external_container_db",...ye[V]),this.$=ye[V];break;case 52:ge.addContainer("external_container_queue",...ye[V]),this.$=ye[V];break;case 53:ge.addComponent("component",...ye[V]),this.$=ye[V];break;case 54:ge.addComponent("component_db",...ye[V]),this.$=ye[V];break;case 55:ge.addComponent("component_queue",...ye[V]),this.$=ye[V];break;case 56:ge.addComponent("external_component",...ye[V]),this.$=ye[V];break;case 57:ge.addComponent("external_component_db",...ye[V]),this.$=ye[V];break;case 58:ge.addComponent("external_component_queue",...ye[V]),this.$=ye[V];break;case 60:ge.addRel("rel",...ye[V]),this.$=ye[V];break;case 61:ge.addRel("birel",...ye[V]),this.$=ye[V];break;case 62:ge.addRel("rel_u",...ye[V]),this.$=ye[V];break;case 63:ge.addRel("rel_d",...ye[V]),this.$=ye[V];break;case 64:ge.addRel("rel_l",...ye[V]),this.$=ye[V];break;case 65:ge.addRel("rel_r",...ye[V]),this.$=ye[V];break;case 66:ge.addRel("rel_b",...ye[V]),this.$=ye[V];break;case 67:ye[V].splice(0,1),ge.addRel("rel",...ye[V]),this.$=ye[V];break;case 68:ge.updateElStyle("update_el_style",...ye[V]),this.$=ye[V];break;case 69:ge.updateRelStyle("update_rel_style",...ye[V]),this.$=ye[V];break;case 70:ge.updateLayoutConfig("update_layout_config",...ye[V]),this.$=ye[V];break;case 71:this.$=[ye[V]];break;case 72:ye[V].unshift(ye[V-1]),this.$=ye[V];break;case 73:case 75:this.$=ye[V].trim();break;case 74:let pe={};pe[ye[V-1].trim()]=ye[V].trim(),this.$=pe;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:70,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:71,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:72,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{13:73,19:20,20:21,21:22,22:t,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{14:[1,74]},e(le,[2,13],{43:23,29:49,30:61,32:62,20:75,34:s,36:o,37:l,38:u,39:h,40:f,41:d,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U}),e(le,[2,14]),e(ee,[2,16],{12:[1,76]}),e(le,[2,36],{12:[1,77]}),e(ue,[2,19]),e(ue,[2,20]),{25:[1,78]},{27:[1,79]},e(ue,[2,23]),{35:80,75:81,76:ae,77:oe,79:Re,80:Te},{35:86,75:81,76:ae,77:oe,79:Re,80:Te},{35:87,75:81,76:ae,77:oe,79:Re,80:Te},{35:88,75:81,76:ae,77:oe,79:Re,80:Te},{35:89,75:81,76:ae,77:oe,79:Re,80:Te},{35:90,75:81,76:ae,77:oe,79:Re,80:Te},{35:91,75:81,76:ae,77:oe,79:Re,80:Te},{35:92,75:81,76:ae,77:oe,79:Re,80:Te},{35:93,75:81,76:ae,77:oe,79:Re,80:Te},{35:94,75:81,76:ae,77:oe,79:Re,80:Te},{35:95,75:81,76:ae,77:oe,79:Re,80:Te},{35:96,75:81,76:ae,77:oe,79:Re,80:Te},{35:97,75:81,76:ae,77:oe,79:Re,80:Te},{35:98,75:81,76:ae,77:oe,79:Re,80:Te},{35:99,75:81,76:ae,77:oe,79:Re,80:Te},{35:100,75:81,76:ae,77:oe,79:Re,80:Te},{35:101,75:81,76:ae,77:oe,79:Re,80:Te},{35:102,75:81,76:ae,77:oe,79:Re,80:Te},{35:103,75:81,76:ae,77:oe,79:Re,80:Te},{35:104,75:81,76:ae,77:oe,79:Re,80:Te},e(Oe,[2,59]),{35:105,75:81,76:ae,77:oe,79:Re,80:Te},{35:106,75:81,76:ae,77:oe,79:Re,80:Te},{35:107,75:81,76:ae,77:oe,79:Re,80:Te},{35:108,75:81,76:ae,77:oe,79:Re,80:Te},{35:109,75:81,76:ae,77:oe,79:Re,80:Te},{35:110,75:81,76:ae,77:oe,79:Re,80:Te},{35:111,75:81,76:ae,77:oe,79:Re,80:Te},{35:112,75:81,76:ae,77:oe,79:Re,80:Te},{35:113,75:81,76:ae,77:oe,79:Re,80:Te},{35:114,75:81,76:ae,77:oe,79:Re,80:Te},{35:115,75:81,76:ae,77:oe,79:Re,80:Te},{20:116,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U},{12:[1,118],33:[1,117]},{35:119,75:81,76:ae,77:oe,79:Re,80:Te},{35:120,75:81,76:ae,77:oe,79:Re,80:Te},{35:121,75:81,76:ae,77:oe,79:Re,80:Te},{35:122,75:81,76:ae,77:oe,79:Re,80:Te},{35:123,75:81,76:ae,77:oe,79:Re,80:Te},{35:124,75:81,76:ae,77:oe,79:Re,80:Te},{35:125,75:81,76:ae,77:oe,79:Re,80:Te},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(le,[2,15]),e(ee,[2,17],{21:22,19:130,22:t,23:r,24:n,26:i,28:a}),e(le,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:r,24:n,26:i,28:a,34:s,36:o,37:l,38:u,39:h,40:f,41:d,44:p,45:m,46:g,47:y,48:v,49:x,50:w,51:C,52:T,53:k,54:S,55:E,56:I,57:L,58:O,59:R,60:A,61:N,62:M,63:D,64:B,65:P,66:$,67:F,68:q,69:G,70:z,71:H,72:j,73:J,74:U}),e(ue,[2,21]),e(ue,[2,22]),e(Oe,[2,39]),e(qe,[2,71],{75:81,35:132,76:ae,77:oe,79:Re,80:Te}),e(Ge,[2,73]),{78:[1,133]},e(Ge,[2,75]),e(Ge,[2,76]),e(Oe,[2,40]),e(Oe,[2,41]),e(Oe,[2,42]),e(Oe,[2,43]),e(Oe,[2,44]),e(Oe,[2,45]),e(Oe,[2,46]),e(Oe,[2,47]),e(Oe,[2,48]),e(Oe,[2,49]),e(Oe,[2,50]),e(Oe,[2,51]),e(Oe,[2,52]),e(Oe,[2,53]),e(Oe,[2,54]),e(Oe,[2,55]),e(Oe,[2,56]),e(Oe,[2,57]),e(Oe,[2,58]),e(Oe,[2,60]),e(Oe,[2,61]),e(Oe,[2,62]),e(Oe,[2,63]),e(Oe,[2,64]),e(Oe,[2,65]),e(Oe,[2,66]),e(Oe,[2,67]),e(Oe,[2,68]),e(Oe,[2,69]),e(Oe,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(fe,[2,28]),e(fe,[2,29]),e(fe,[2,30]),e(fe,[2,31]),e(fe,[2,32]),e(fe,[2,33]),e(fe,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(ee,[2,18]),e(le,[2,38]),e(qe,[2,72]),e(Ge,[2,74]),e(Oe,[2,24]),e(Oe,[2,35]),e(Ce,[2,25]),e(Ce,[2,26],{12:[1,138]}),e(Ce,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:b(function(he,xe){if(xe.recoverable)this.trace(he);else{var ce=new Error(he);throw ce.hash=xe,ce}},"parseError"),parse:b(function(he){var xe=this,ce=[0],ge=[],Ie=[null],ye=[],ne=this.table,V="",pe=0,K=0,ve=0,Z=2,je=1,Ne=ye.slice.call(arguments,1),ze=Object.create(this.lexer),Fe={yy:{}};for(var Ke in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ke)&&(Fe.yy[Ke]=this.yy[Ke]);ze.setInput(he,Fe.yy),Fe.yy.lexer=ze,Fe.yy.parser=this,typeof ze.yylloc>"u"&&(ze.yylloc={});var Ve=ze.yylloc;ye.push(Ve);var tt=ze.options&&ze.options.ranges;typeof Fe.yy.parseError=="function"?this.parseError=Fe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function We(it){ce.length=ce.length-2*it,Ie.length=Ie.length-it,ye.length=ye.length-it}b(We,"popStack");function rt(){var it;return it=ge.pop()||ze.lex()||je,typeof it!="number"&&(it instanceof Array&&(ge=it,it=ge.pop()),it=xe.symbols_[it]||it),it}b(rt,"lex");for(var Se,Et,De,mt,Tt,jt,_t={},Rt,bt,ke,yt;;){if(De=ce[ce.length-1],this.defaultActions[De]?mt=this.defaultActions[De]:((Se===null||typeof Se>"u")&&(Se=rt()),mt=ne[De]&&ne[De][Se]),typeof mt>"u"||!mt.length||!mt[0]){var xt="";yt=[];for(Rt in ne[De])this.terminals_[Rt]&&Rt>Z&&yt.push("'"+this.terminals_[Rt]+"'");ze.showPosition?xt="Parse error on line "+(pe+1)+`: `+ze.showPosition()+` Expecting `+yt.join(", ")+", got '"+(this.terminals_[Se]||Se)+"'":xt="Parse error on line "+(pe+1)+": Unexpected "+(Se==je?"end of input":"'"+(this.terminals_[Se]||Se)+"'"),this.parseError(xt,{text:ze.match,token:this.terminals_[Se]||Se,line:ze.yylineno,loc:Ve,expected:yt})}if(mt[0]instanceof Array&&mt.length>1)throw new Error("Parse Error: multiple actions possible at state: "+De+", token: "+Se);switch(mt[0]){case 1:ce.push(Se),Ie.push(ze.yytext),ye.push(ze.yylloc),ce.push(mt[1]),Se=null,Et?(Se=Et,Et=null):(K=ze.yyleng,V=ze.yytext,pe=ze.yylineno,Ve=ze.yylloc,ve>0&&ve--);break;case 2:if(bt=this.productions_[mt[1]][1],_t.$=Ie[Ie.length-bt],_t._$={first_line:ye[ye.length-(bt||1)].first_line,last_line:ye[ye.length-1].last_line,first_column:ye[ye.length-(bt||1)].first_column,last_column:ye[ye.length-1].last_column},tt&&(_t._$.range=[ye[ye.length-(bt||1)].range[0],ye[ye.length-1].range[1]]),jt=this.performAction.apply(_t,[V,K,pe,Fe.yy,mt[1],Ie,ye].concat(Ne)),typeof jt<"u")return jt;bt&&(ce=ce.slice(0,-1*bt*2),Ie=Ie.slice(0,-1*bt),ye=ye.slice(0,-1*bt)),ce.push(this.productions_[mt[1]][0]),Ie.push(_t.$),ye.push(_t._$),ke=ne[ce[ce.length-2]][ce[ce.length-1]],ce.push(ke);break;case 3:return!0}}return!0},"parse")},de=(function(){var Q={EOF:1,parseError:b(function(xe,ce){if(this.yy.parser)this.yy.parser.parseError(xe,ce);else throw new Error(xe)},"parseError"),setInput:b(function(he,xe){return this.yy=xe||this.yy||{},this._input=he,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var he=this._input[0];this.yytext+=he,this.yyleng++,this.offset++,this.match+=he,this.matched+=he;var xe=he.match(/(?:\r\n?|\n).*/g);return xe?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),he},"input"),unput:b(function(he){var xe=he.length,ce=he.split(/(?:\r\n?|\n)/g);this._input=he+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-xe),this.offset-=xe;var ge=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),ce.length-1&&(this.yylineno-=ce.length-1);var Ie=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:ce?(ce.length===ge.length?this.yylloc.first_column:0)+ge[ge.length-ce.length].length-ce[0].length:this.yylloc.first_column-xe},this.options.ranges&&(this.yylloc.range=[Ie[0],Ie[0]+this.yyleng-xe]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(he){this.unput(this.match.slice(he))},"less"),pastInput:b(function(){var he=this.matched.substr(0,this.matched.length-this.match.length);return(he.length>20?"...":"")+he.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var he=this.match;return he.length<20&&(he+=this._input.substr(0,20-he.length)),(he.substr(0,20)+(he.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var he=this.pastInput(),xe=new Array(he.length+1).join("-");return he+this.upcomingInput()+` `+xe+"^"},"showPosition"),test_match:b(function(he,xe){var ce,ge,Ie;if(this.options.backtrack_lexer&&(Ie={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(Ie.yylloc.range=this.yylloc.range.slice(0))),ge=he[0].match(/(?:\r\n?|\n).*/g),ge&&(this.yylineno+=ge.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ge?ge[ge.length-1].length-ge[ge.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+he[0].length},this.yytext+=he[0],this.match+=he[0],this.matches=he,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(he[0].length),this.matched+=he[0],ce=this.performAction.call(this,this.yy,this,xe,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),ce)return ce;if(this._backtrack){for(var ye in Ie)this[ye]=Ie[ye];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var he,xe,ce,ge;this._more||(this.yytext="",this.match="");for(var Ie=this._currentRules(),ye=0;yexe[0].length)){if(xe=ce,ge=ye,this.options.backtrack_lexer){if(he=this.test_match(ce,Ie[ye]),he!==!1)return he;if(this._backtrack){xe=!1;continue}else return!1}else if(!this.options.flex)break}return xe?(he=this.test_match(xe,Ie[ge]),he!==!1?he:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var xe=this.next();return xe||this.lex()},"lex"),begin:b(function(xe){this.conditionStack.push(xe)},"begin"),popState:b(function(){var xe=this.conditionStack.length-1;return xe>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(xe){return xe=this.conditionStack.length-1-Math.abs(xe||0),xe>=0?this.conditionStack[xe]:"INITIAL"},"topState"),pushState:b(function(xe){this.begin(xe)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(xe,ce,ge,Ie){var ye=Ie;switch(ge){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),26;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:break;case 14:c;break;case 15:return 12;case 16:break;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;break;case 23:return this.begin("person"),44;break;case 24:return this.begin("system_ext_queue"),51;break;case 25:return this.begin("system_ext_db"),50;break;case 26:return this.begin("system_ext"),49;break;case 27:return this.begin("system_queue"),48;break;case 28:return this.begin("system_db"),47;break;case 29:return this.begin("system"),46;break;case 30:return this.begin("boundary"),37;break;case 31:return this.begin("enterprise_boundary"),34;break;case 32:return this.begin("system_boundary"),36;break;case 33:return this.begin("container_ext_queue"),57;break;case 34:return this.begin("container_ext_db"),56;break;case 35:return this.begin("container_ext"),55;break;case 36:return this.begin("container_queue"),54;break;case 37:return this.begin("container_db"),53;break;case 38:return this.begin("container"),52;break;case 39:return this.begin("container_boundary"),38;break;case 40:return this.begin("component_ext_queue"),63;break;case 41:return this.begin("component_ext_db"),62;break;case 42:return this.begin("component_ext"),61;break;case 43:return this.begin("component_queue"),60;break;case 44:return this.begin("component_db"),59;break;case 45:return this.begin("component"),58;break;case 46:return this.begin("node"),39;break;case 47:return this.begin("node"),39;break;case 48:return this.begin("node_l"),40;break;case 49:return this.begin("node_r"),41;break;case 50:return this.begin("rel"),64;break;case 51:return this.begin("birel"),65;break;case 52:return this.begin("rel_u"),66;break;case 53:return this.begin("rel_u"),66;break;case 54:return this.begin("rel_d"),67;break;case 55:return this.begin("rel_d"),67;break;case 56:return this.begin("rel_l"),68;break;case 57:return this.begin("rel_l"),68;break;case 58:return this.begin("rel_r"),69;break;case 59:return this.begin("rel_r"),69;break;case 60:return this.begin("rel_b"),70;break;case 61:return this.begin("rel_index"),71;break;case 62:return this.begin("update_el_style"),72;break;case 63:return this.begin("update_rel_style"),73;break;case 64:return this.begin("update_layout_config"),74;break;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";break;case 67:this.begin("attribute");break;case 68:this.popState(),this.popState();break;case 69:return 80;case 70:break;case 71:return 80;case 72:this.begin("string");break;case 73:this.popState();break;case 74:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";break;case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 79:this.popState(),this.popState();break;case 80:return"STR";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[65,66,67,68],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}};return Q})();_e.lexer=de;function ie(){this.yy={}}return b(ie,"Parser"),ie.prototype=_e,_e.Parser=ie,new ie})();LI.parser=LI;CNt=LI,Ah=[],Eg=[""],Cl="global",Eh="",nd=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],eS=[],qZ="",VZ=!1,II=4,MI=2,SNt=b(function(){return iOe},"getC4Type"),ENt=b(function(e){iOe=Mr(e,Be())},"setC4Type"),ANt=b(function(e,t,r,n,i,a,s,o,l){if(e==null||t===void 0||t===null||r===void 0||r===null||n===void 0||n===null)return;let u={},h=eS.find(f=>f.from===t&&f.to===r);if(h?u=h:eS.push(u),u.type=e,u.from=t,u.to=r,u.label={text:n},i==null)u.techn={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.techn={text:i};if(a==null)u.descr={text:""};else if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]={text:d}}else u.descr={text:a};if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.sprite=s;if(typeof o=="object"){let[f,d]=Object.entries(o)[0];u[f]=d}else u.tags=o;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=Ag()},"addRel"),_Nt=b(function(e,t,r,n,i,a,s){if(t===null||r===null)return;let o={},l=Ah.find(u=>u.alias===t);if(l&&t===l.alias?o=l:(o.alias=t,Ah.push(o)),r==null?o.label={text:""}:o.label={text:r},n==null)o.descr={text:""};else if(typeof n=="object"){let[u,h]=Object.entries(n)[0];o[u]={text:h}}else o.descr={text:n};if(typeof i=="object"){let[u,h]=Object.entries(i)[0];o[u]=h}else o.sprite=i;if(typeof a=="object"){let[u,h]=Object.entries(a)[0];o[u]=h}else o.tags=a;if(typeof s=="object"){let[u,h]=Object.entries(s)[0];o[u]=h}else o.link=s;o.typeC4Shape={text:e},o.parentBoundary=Cl,o.wrap=Ag()},"addPersonOrSystem"),RNt=b(function(e,t,r,n,i,a,s,o){if(t===null||r===null)return;let l={},u=Ah.find(h=>h.alias===t);if(u&&t===u.alias?l=u:(l.alias=t,Ah.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.techn={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.techn={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.sprite=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.wrap=Ag(),l.typeC4Shape={text:e},l.parentBoundary=Cl},"addContainer"),LNt=b(function(e,t,r,n,i,a,s,o){if(t===null||r===null)return;let l={},u=Ah.find(h=>h.alias===t);if(u&&t===u.alias?l=u:(l.alias=t,Ah.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.techn={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.techn={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.sprite=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.wrap=Ag(),l.typeC4Shape={text:e},l.parentBoundary=Cl},"addComponent"),INt=b(function(e,t,r,n,i){if(e===null||t===null)return;let a={},s=nd.find(o=>o.alias===e);if(s&&e===s.alias?a=s:(a.alias=e,nd.push(a)),t==null?a.label={text:""}:a.label={text:t},r==null)a.type={text:"system"};else if(typeof r=="object"){let[o,l]=Object.entries(r)[0];a[o]={text:l}}else a.type={text:r};if(typeof n=="object"){let[o,l]=Object.entries(n)[0];a[o]=l}else a.tags=n;if(typeof i=="object"){let[o,l]=Object.entries(i)[0];a[o]=l}else a.link=i;a.parentBoundary=Cl,a.wrap=Ag(),Eh=Cl,Cl=e,Eg.push(Eh)},"addPersonOrSystemBoundary"),MNt=b(function(e,t,r,n,i){if(e===null||t===null)return;let a={},s=nd.find(o=>o.alias===e);if(s&&e===s.alias?a=s:(a.alias=e,nd.push(a)),t==null?a.label={text:""}:a.label={text:t},r==null)a.type={text:"container"};else if(typeof r=="object"){let[o,l]=Object.entries(r)[0];a[o]={text:l}}else a.type={text:r};if(typeof n=="object"){let[o,l]=Object.entries(n)[0];a[o]=l}else a.tags=n;if(typeof i=="object"){let[o,l]=Object.entries(i)[0];a[o]=l}else a.link=i;a.parentBoundary=Cl,a.wrap=Ag(),Eh=Cl,Cl=e,Eg.push(Eh)},"addContainerBoundary"),NNt=b(function(e,t,r,n,i,a,s,o){if(t===null||r===null)return;let l={},u=nd.find(h=>h.alias===t);if(u&&t===u.alias?l=u:(l.alias=t,nd.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.type={text:"node"};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.type={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.nodeType=e,l.parentBoundary=Cl,l.wrap=Ag(),Eh=Cl,Cl=t,Eg.push(Eh)},"addDeploymentNode"),DNt=b(function(){Cl=Eh,Eg.pop(),Eh=Eg.pop(),Eg.push(Eh)},"popBoundaryParseStack"),ONt=b(function(e,t,r,n,i,a,s,o,l,u,h){let f=Ah.find(d=>d.alias===t);if(!(f===void 0&&(f=nd.find(d=>d.alias===t),f===void 0))){if(r!=null)if(typeof r=="object"){let[d,p]=Object.entries(r)[0];f[d]=p}else f.bgColor=r;if(n!=null)if(typeof n=="object"){let[d,p]=Object.entries(n)[0];f[d]=p}else f.fontColor=n;if(i!=null)if(typeof i=="object"){let[d,p]=Object.entries(i)[0];f[d]=p}else f.borderColor=i;if(a!=null)if(typeof a=="object"){let[d,p]=Object.entries(a)[0];f[d]=p}else f.shadowing=a;if(s!=null)if(typeof s=="object"){let[d,p]=Object.entries(s)[0];f[d]=p}else f.shape=s;if(o!=null)if(typeof o=="object"){let[d,p]=Object.entries(o)[0];f[d]=p}else f.sprite=o;if(l!=null)if(typeof l=="object"){let[d,p]=Object.entries(l)[0];f[d]=p}else f.techn=l;if(u!=null)if(typeof u=="object"){let[d,p]=Object.entries(u)[0];f[d]=p}else f.legendText=u;if(h!=null)if(typeof h=="object"){let[d,p]=Object.entries(h)[0];f[d]=p}else f.legendSprite=h}},"updateElStyle"),PNt=b(function(e,t,r,n,i,a,s){let o=eS.find(l=>l.from===t&&l.to===r);if(o!==void 0){if(n!=null)if(typeof n=="object"){let[l,u]=Object.entries(n)[0];o[l]=u}else o.textColor=n;if(i!=null)if(typeof i=="object"){let[l,u]=Object.entries(i)[0];o[l]=u}else o.lineColor=i;if(a!=null)if(typeof a=="object"){let[l,u]=Object.entries(a)[0];o[l]=parseInt(u)}else o.offsetX=parseInt(a);if(s!=null)if(typeof s=="object"){let[l,u]=Object.entries(s)[0];o[l]=parseInt(u)}else o.offsetY=parseInt(s)}},"updateRelStyle"),BNt=b(function(e,t,r){let n=II,i=MI;if(typeof t=="object"){let a=Object.values(t)[0];n=parseInt(a)}else n=parseInt(t);if(typeof r=="object"){let a=Object.values(r)[0];i=parseInt(a)}else i=parseInt(r);n>=1&&(II=n),i>=1&&(MI=i)},"updateLayoutConfig"),FNt=b(function(){return II},"getC4ShapeInRow"),$Nt=b(function(){return MI},"getC4BoundaryInRow"),zNt=b(function(){return Cl},"getCurrentBoundaryParse"),GNt=b(function(){return Eh},"getParentBoundaryParse"),aOe=b(function(e){return e==null?Ah:Ah.filter(t=>t.parentBoundary===e)},"getC4ShapeArray"),qNt=b(function(e){return Ah.find(t=>t.alias===e)},"getC4Shape"),VNt=b(function(e){return Object.keys(aOe(e))},"getC4ShapeKeys"),sOe=b(function(e){return e==null?nd:nd.filter(t=>t.parentBoundary===e)},"getBoundaries"),WNt=sOe,HNt=b(function(){return eS},"getRels"),UNt=b(function(){return qZ},"getTitle"),YNt=b(function(e){VZ=e},"setWrap"),Ag=b(function(){return VZ},"autoWrap"),XNt=b(function(){Ah=[],nd=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Eh="",Cl="global",Eg=[""],eS=[],Eg=[""],qZ="",VZ=!1,II=4,MI=2},"clear"),jNt={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},KNt={FILLED:0,OPEN:1},ZNt={LEFTOF:0,RIGHTOF:1,OVER:2},QNt=b(function(e){qZ=Mr(e,Be())},"setTitle"),$Z={addPersonOrSystem:_Nt,addPersonOrSystemBoundary:INt,addContainer:RNt,addContainerBoundary:MNt,addComponent:LNt,addDeploymentNode:NNt,popBoundaryParseStack:DNt,addRel:ANt,updateElStyle:ONt,updateRelStyle:PNt,updateLayoutConfig:BNt,autoWrap:Ag,setWrap:YNt,getC4ShapeArray:aOe,getC4Shape:qNt,getC4ShapeKeys:VNt,getBoundaries:sOe,getBoundarys:WNt,getCurrentBoundaryParse:zNt,getParentBoundaryParse:GNt,getRels:HNt,getTitle:UNt,getC4Type:SNt,getC4ShapeInRow:FNt,getC4BoundaryInRow:$Nt,setAccTitle:Yr,getAccTitle:Qr,getAccDescription:en,setAccDescription:Jr,getConfig:b(()=>Be().c4,"getConfig"),clear:XNt,LINETYPE:jNt,ARROWTYPE:KNt,PLACEMENT:ZNt,setTitle:QNt,setC4Type:ENt},WZ=b(function(e,t){return wv(e,t)},"drawRect"),lOe=b(function(e,t,r,n,i,a){let s=e.append("image");s.attr("width",t),s.attr("height",r),s.attr("x",n),s.attr("y",i);let o=a.startsWith("data:image/png;base64")?a:(0,oOe.sanitizeUrl)(a);s.attr("xlink:href",o)},"drawImage"),JNt=b((e,t,r,n)=>{let i=e.append("g"),a=0;for(let s of t){let o=s.textColor?s.textColor:"#444444",l=s.lineColor?s.lineColor:"#444444",u=s.offsetX?parseInt(s.offsetX):0,h=s.offsetY?parseInt(s.offsetY):0,f="";if(a===0){let p=i.append("line");p.attr("x1",s.startPoint.x),p.attr("y1",s.startPoint.y),p.attr("x2",s.endPoint.x),p.attr("y2",s.endPoint.y),p.attr("stroke-width","1"),p.attr("stroke",l),p.style("fill","none"),s.type!=="rel_b"&&p.attr("marker-end","url("+f+"#"+n+"-arrowhead)"),(s.type==="birel"||s.type==="rel_b")&&p.attr("marker-start","url("+f+"#"+n+"-arrowend)"),a=-1}else{let p=i.append("path");p.attr("fill","none").attr("stroke-width","1").attr("stroke",l).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",s.startPoint.x).replaceAll("starty",s.startPoint.y).replaceAll("controlx",s.startPoint.x+(s.endPoint.x-s.startPoint.x)/2-(s.endPoint.x-s.startPoint.x)/4).replaceAll("controly",s.startPoint.y+(s.endPoint.y-s.startPoint.y)/2).replaceAll("stopx",s.endPoint.x).replaceAll("stopy",s.endPoint.y)),s.type!=="rel_b"&&p.attr("marker-end","url("+f+"#"+n+"-arrowhead)"),(s.type==="birel"||s.type==="rel_b")&&p.attr("marker-start","url("+f+"#"+n+"-arrowend)")}let d=r.messageFont();W0(r)(s.label.text,i,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+u,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+h,s.label.width,s.label.height,{fill:o},d),s.techn&&s.techn.text!==""&&(d=r.messageFont(),W0(r)("["+s.techn.text+"]",i,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+u,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+r.messageFontSize+5+h,Math.max(s.label.width,s.techn.width),s.techn.height,{fill:o,"font-style":"italic"},d))}},"drawRels"),eDt=b(function(e,t,r){let n=e.append("g"),i=t.bgColor?t.bgColor:"none",a=t.borderColor?t.borderColor:"#444444",s=t.fontColor?t.fontColor:"black",o={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};t.nodeType&&(o={"stroke-width":1});let l={x:t.x,y:t.y,fill:i,stroke:a,width:t.width,height:t.height,rx:2.5,ry:2.5,attrs:o};WZ(n,l);let u=r.boundaryFont();u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=s,W0(r)(t.label.text,n,t.x,t.y+t.label.Y,t.width,t.height,{fill:"#444444"},u),t.type&&t.type.text!==""&&(u=r.boundaryFont(),u.fontColor=s,W0(r)(t.type.text,n,t.x,t.y+t.type.Y,t.width,t.height,{fill:"#444444"},u)),t.descr&&t.descr.text!==""&&(u=r.boundaryFont(),u.fontSize=u.fontSize-2,u.fontColor=s,W0(r)(t.descr.text,n,t.x,t.y+t.descr.Y,t.width,t.height,{fill:"#444444"},u))},"drawBoundary"),tDt=b(function(e,t,r){let n=t.bgColor?t.bgColor:r[t.typeC4Shape.text+"_bg_color"],i=t.borderColor?t.borderColor:r[t.typeC4Shape.text+"_border_color"],a=t.fontColor?t.fontColor:"#FFFFFF",s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(t.typeC4Shape.text){case"person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";break}let o=e.append("g");o.attr("class","person-man");let l=Xo();switch(t.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":l.x=t.x,l.y=t.y,l.fill=n,l.width=t.width,l.height=t.height,l.stroke=i,l.rx=2.5,l.ry=2.5,l.attrs={"stroke-width":.5},WZ(o,l);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":o.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2).replaceAll("height",t.height)),o.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":o.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("width",t.width).replaceAll("half",t.height/2)),o.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",t.x+t.width).replaceAll("starty",t.y).replaceAll("half",t.height/2));break}let u=cDt(r,t.typeC4Shape.text);switch(o.append("text").attr("fill",a).attr("font-family",u.fontFamily).attr("font-size",u.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",t.typeC4Shape.width).attr("x",t.x+t.width/2-t.typeC4Shape.width/2).attr("y",t.y+t.typeC4Shape.Y).text("<<"+t.typeC4Shape.text+">>"),t.typeC4Shape.text){case"person":case"external_person":lOe(o,48,48,t.x+t.width/2-24,t.y+t.image.Y,s);break}let h=r[t.typeC4Shape.text+"Font"]();return h.fontWeight="bold",h.fontSize=h.fontSize+2,h.fontColor=a,W0(r)(t.label.text,o,t.x,t.y+t.label.Y,t.width,t.height,{fill:a},h),h=r[t.typeC4Shape.text+"Font"](),h.fontColor=a,t.techn&&t.techn?.text!==""?W0(r)(t.techn.text,o,t.x,t.y+t.techn.Y,t.width,t.height,{fill:a,"font-style":"italic"},h):t.type&&t.type.text!==""&&W0(r)(t.type.text,o,t.x,t.y+t.type.Y,t.width,t.height,{fill:a,"font-style":"italic"},h),t.descr&&t.descr.text!==""&&(h=r.personFont(),h.fontColor=a,W0(r)(t.descr.text,o,t.x,t.y+t.descr.Y,t.width,t.height,{fill:a},h)),t.height},"drawC4Shape"),rDt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),nDt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),iDt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),aDt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),sDt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),oDt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),lDt=b(function(e,t){let n=e.append("defs").append("marker").attr("id",t+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);n.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),n.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),cDt=b((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"getC4ShapeFont"),W0=(function(){function e(i,a,s,o,l,u,h){let f=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("text-anchor","middle").text(i);n(f,h)}b(e,"byText");function t(i,a,s,o,l,u,h,f){let{fontSize:d,fontFamily:p,fontWeight:m}=f,g=i.split(Ct.lineBreakRegex);for(let y=0;y=this.data.widthLimit||r>=this.data.widthLimit||this.nextData.cnt>cOe)&&(t=this.nextData.startx+e.margin+xr.nextLinePaddingX,n=this.nextData.stopy+e.margin*2,this.nextData.stopx=r=t+e.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=i=n+e.height,this.nextData.cnt=1),e.x=t,e.y=n,this.updateVal(this.data,"startx",t,Math.min),this.updateVal(this.data,"starty",n,Math.min),this.updateVal(this.data,"stopx",r,Math.max),this.updateVal(this.data,"stopy",i,Math.max),this.updateVal(this.nextData,"startx",t,Math.min),this.updateVal(this.nextData,"starty",n,Math.min),this.updateVal(this.nextData,"stopx",r,Math.max),this.updateVal(this.nextData,"stopy",i,Math.max)}init(e){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},GZ(e.db.getConfig())}bumpLastMargin(e){this.data.stopx+=e,this.data.stopy+=e}},GZ=b(function(e){Xi(xr,e),e.fontFamily&&(xr.personFontFamily=xr.systemFontFamily=xr.messageFontFamily=e.fontFamily),e.fontSize&&(xr.personFontSize=xr.systemFontSize=xr.messageFontSize=e.fontSize),e.fontWeight&&(xr.personFontWeight=xr.systemFontWeight=xr.messageFontWeight=e.fontWeight)},"setConf"),JC=b((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"c4ShapeFont"),RI=b(e=>({fontFamily:e.boundaryFontFamily,fontSize:e.boundaryFontSize,fontWeight:e.boundaryFontWeight}),"boundaryFont"),uDt=b(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont");b($u,"calcC4ShapeTextWH");hOe=b(function(e,t,r){t.x=r.data.startx,t.y=r.data.starty,t.width=r.data.stopx-r.data.startx,t.height=r.data.stopy-r.data.starty,t.label.y=xr.c4ShapeMargin-35;let n=t.wrap&&xr.wrap,i=RI(xr);i.fontSize=i.fontSize+2,i.fontWeight="bold";let a=uo(t.label.text,i);$u("label",t,n,i,a),rd.drawBoundary(e,t,xr)},"drawBoundary"),fOe=b(function(e,t,r,n){let i=0;for(let a of n){i=0;let s=r[a],o=JC(xr,s.typeC4Shape.text);switch(o.fontSize=o.fontSize-2,s.typeC4Shape.width=uo("\xAB"+s.typeC4Shape.text+"\xBB",o),s.typeC4Shape.height=o.fontSize+2,s.typeC4Shape.Y=xr.c4ShapePadding,i=s.typeC4Shape.Y+s.typeC4Shape.height-4,s.image={width:0,height:0,Y:0},s.typeC4Shape.text){case"person":case"external_person":s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height;break}s.sprite&&(s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height);let l=s.wrap&&xr.wrap,u=xr.width-xr.c4ShapePadding*2,h=JC(xr,s.typeC4Shape.text);if(h.fontSize=h.fontSize+2,h.fontWeight="bold",$u("label",s,l,h,u),s.label.Y=i+8,i=s.label.Y+s.label.height,s.type&&s.type.text!==""){s.type.text="["+s.type.text+"]";let p=JC(xr,s.typeC4Shape.text);$u("type",s,l,p,u),s.type.Y=i+5,i=s.type.Y+s.type.height}else if(s.techn&&s.techn.text!==""){s.techn.text="["+s.techn.text+"]";let p=JC(xr,s.techn.text);$u("techn",s,l,p,u),s.techn.Y=i+5,i=s.techn.Y+s.techn.height}let f=i,d=s.label.width;if(s.descr&&s.descr.text!==""){let p=JC(xr,s.typeC4Shape.text);$u("descr",s,l,p,u),s.descr.Y=i+20,i=s.descr.Y+s.descr.height,d=Math.max(s.label.width,s.descr.width),f=i-s.descr.textLines*5}d=d+xr.c4ShapePadding,s.width=Math.max(s.width||xr.width,d,xr.width),s.height=Math.max(s.height||xr.height,f,xr.height),s.margin=s.margin||xr.c4ShapeMargin,e.insert(s),rd.drawC4Shape(t,s,xr)}e.bumpLastMargin(xr.c4ShapeMargin)},"drawC4ShapeArray"),Fu=class{static{b(this,"Point")}constructor(e,t){this.x=e,this.y=t}},rOe=b(function(e,t){let r=e.x,n=e.y,i=t.x,a=t.y,s=r+e.width/2,o=n+e.height/2,l=Math.abs(r-i),u=Math.abs(n-a),h=u/l,f=e.height/e.width,d=null;return n==a&&ri?d=new Fu(r,o):r==i&&na&&(d=new Fu(s,n)),r>i&&n=h?d=new Fu(r,o+h*e.width/2):d=new Fu(s-l/u*e.height/2,n+e.height):r=h?d=new Fu(r+e.width,o+h*e.width/2):d=new Fu(s+l/u*e.height/2,n+e.height):ra?f>=h?d=new Fu(r+e.width,o-h*e.width/2):d=new Fu(s+e.height/2*l/u,n):r>i&&n>a&&(f>=h?d=new Fu(r,o-e.width/2*h):d=new Fu(s-e.height/2*l/u,n)),d},"getIntersectPoint"),hDt=b(function(e,t){let r={x:0,y:0};r.x=t.x+t.width/2,r.y=t.y+t.height/2;let n=rOe(e,r);r.x=e.x+e.width/2,r.y=e.y+e.height/2;let i=rOe(t,r);return{startPoint:n,endPoint:i}},"getIntersectPoints"),fDt=b(function(e,t,r,n,i){let a=0;for(let s of t){a=a+1;let o=s.wrap&&xr.wrap,l=uDt(xr);n.db.getC4Type()==="C4Dynamic"&&(s.label.text=a+": "+s.label.text);let h=uo(s.label.text,l);$u("label",s,o,l,h),s.techn&&s.techn.text!==""&&(h=uo(s.techn.text,l),$u("techn",s,o,l,h)),s.descr&&s.descr.text!==""&&(h=uo(s.descr.text,l),$u("descr",s,o,l,h));let f=r(s.from),d=r(s.to),p=hDt(f,d);s.startPoint=p.startPoint,s.endPoint=p.endPoint}rd.drawRels(e,t,xr,i)},"drawRels");b(HZ,"drawInsideBoundary");dDt=b(function(e,t,r,n){xr=Be().c4;let i=Be().securityLevel,a;i==="sandbox"&&(a=ct("#i"+t));let s=i==="sandbox"?ct(a.nodes()[0].contentDocument.body):ct("body"),o=n.db;n.db.setWrap(xr.wrap),cOe=o.getC4ShapeInRow(),zZ=o.getC4BoundaryInRow(),se.debug(`C:${JSON.stringify(xr,null,2)}`);let l=i==="sandbox"?s.select(`[id="${t}"]`):ct(`[id="${t}"]`);rd.insertComputerIcon(l,t),rd.insertDatabaseIcon(l,t),rd.insertClockIcon(l,t);let u=new uOe(n);u.setData(xr.diagramMarginX,xr.diagramMarginX,xr.diagramMarginY,xr.diagramMarginY),u.data.widthLimit=screen.availWidth,NI=xr.diagramMarginX,DI=xr.diagramMarginY;let h=n.db.getTitle(),f=n.db.getBoundaries("");HZ(l,"",u,f,n),rd.insertArrowHead(l,t),rd.insertArrowEnd(l,t),rd.insertArrowCrossHead(l,t),rd.insertArrowFilledHead(l,t),fDt(l,n.db.getRels(),n.db.getC4Shape,n,t),u.data.stopx=NI,u.data.stopy=DI;let d=u.data,m=d.stopy-d.starty+2*xr.diagramMarginY,y=d.stopx-d.startx+2*xr.diagramMarginX;h&&l.append("text").text(h).attr("x",(d.stopx-d.startx)/2-4*xr.diagramMarginX).attr("y",d.starty+xr.diagramMarginY),vn(l,m,y,xr.useMaxWidth);let v=h?60:0;l.attr("viewBox",d.startx-xr.diagramMarginX+" -"+(xr.diagramMarginY+v)+" "+y+" "+(m+v)),se.debug("models:",d)},"draw"),nOe={drawPersonOrSystemArray:fOe,drawBoundary:hOe,setConf:GZ,draw:dDt},pDt=b(e=>`.person { +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var xe=this.next();return xe||this.lex()},"lex"),begin:b(function(xe){this.conditionStack.push(xe)},"begin"),popState:b(function(){var xe=this.conditionStack.length-1;return xe>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(xe){return xe=this.conditionStack.length-1-Math.abs(xe||0),xe>=0?this.conditionStack[xe]:"INITIAL"},"topState"),pushState:b(function(xe){this.begin(xe)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(xe,ce,ge,Ie){var ye=Ie;switch(ge){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),26;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:break;case 14:c;break;case 15:return 12;case 16:break;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;break;case 23:return this.begin("person"),44;break;case 24:return this.begin("system_ext_queue"),51;break;case 25:return this.begin("system_ext_db"),50;break;case 26:return this.begin("system_ext"),49;break;case 27:return this.begin("system_queue"),48;break;case 28:return this.begin("system_db"),47;break;case 29:return this.begin("system"),46;break;case 30:return this.begin("boundary"),37;break;case 31:return this.begin("enterprise_boundary"),34;break;case 32:return this.begin("system_boundary"),36;break;case 33:return this.begin("container_ext_queue"),57;break;case 34:return this.begin("container_ext_db"),56;break;case 35:return this.begin("container_ext"),55;break;case 36:return this.begin("container_queue"),54;break;case 37:return this.begin("container_db"),53;break;case 38:return this.begin("container"),52;break;case 39:return this.begin("container_boundary"),38;break;case 40:return this.begin("component_ext_queue"),63;break;case 41:return this.begin("component_ext_db"),62;break;case 42:return this.begin("component_ext"),61;break;case 43:return this.begin("component_queue"),60;break;case 44:return this.begin("component_db"),59;break;case 45:return this.begin("component"),58;break;case 46:return this.begin("node"),39;break;case 47:return this.begin("node"),39;break;case 48:return this.begin("node_l"),40;break;case 49:return this.begin("node_r"),41;break;case 50:return this.begin("rel"),64;break;case 51:return this.begin("birel"),65;break;case 52:return this.begin("rel_u"),66;break;case 53:return this.begin("rel_u"),66;break;case 54:return this.begin("rel_d"),67;break;case 55:return this.begin("rel_d"),67;break;case 56:return this.begin("rel_l"),68;break;case 57:return this.begin("rel_l"),68;break;case 58:return this.begin("rel_r"),69;break;case 59:return this.begin("rel_r"),69;break;case 60:return this.begin("rel_b"),70;break;case 61:return this.begin("rel_index"),71;break;case 62:return this.begin("update_el_style"),72;break;case 63:return this.begin("update_rel_style"),73;break;case 64:return this.begin("update_layout_config"),74;break;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";break;case 67:this.begin("attribute");break;case 68:this.popState(),this.popState();break;case 69:return 80;case 70:break;case 71:return 80;case 72:this.begin("string");break;case 73:this.popState();break;case 74:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";break;case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 79:this.popState(),this.popState();break;case 80:return"STR";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[65,66,67,68],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}};return Q})();_e.lexer=de;function ie(){this.yy={}}return b(ie,"Parser"),ie.prototype=_e,_e.Parser=ie,new ie})();LI.parser=LI;_Nt=LI,Ah=[],Eg=[""],Sl="global",Eh="",nd=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],eS=[],WZ="",HZ=!1,II=4,MI=2,RNt=b(function(){return sOe},"getC4Type"),LNt=b(function(e){sOe=Mr(e,Be())},"setC4Type"),INt=b(function(e,t,r,n,i,a,s,o,l){if(e==null||t===void 0||t===null||r===void 0||r===null||n===void 0||n===null)return;let u={},h=eS.find(f=>f.from===t&&f.to===r);if(h?u=h:eS.push(u),u.type=e,u.from=t,u.to=r,u.label={text:n},i==null)u.techn={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.techn={text:i};if(a==null)u.descr={text:""};else if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]={text:d}}else u.descr={text:a};if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.sprite=s;if(typeof o=="object"){let[f,d]=Object.entries(o)[0];u[f]=d}else u.tags=o;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=Ag()},"addRel"),MNt=b(function(e,t,r,n,i,a,s){if(t===null||r===null)return;let o={},l=Ah.find(u=>u.alias===t);if(l&&t===l.alias?o=l:(o.alias=t,Ah.push(o)),r==null?o.label={text:""}:o.label={text:r},n==null)o.descr={text:""};else if(typeof n=="object"){let[u,h]=Object.entries(n)[0];o[u]={text:h}}else o.descr={text:n};if(typeof i=="object"){let[u,h]=Object.entries(i)[0];o[u]=h}else o.sprite=i;if(typeof a=="object"){let[u,h]=Object.entries(a)[0];o[u]=h}else o.tags=a;if(typeof s=="object"){let[u,h]=Object.entries(s)[0];o[u]=h}else o.link=s;o.typeC4Shape={text:e},o.parentBoundary=Sl,o.wrap=Ag()},"addPersonOrSystem"),NNt=b(function(e,t,r,n,i,a,s,o){if(t===null||r===null)return;let l={},u=Ah.find(h=>h.alias===t);if(u&&t===u.alias?l=u:(l.alias=t,Ah.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.techn={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.techn={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.sprite=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.wrap=Ag(),l.typeC4Shape={text:e},l.parentBoundary=Sl},"addContainer"),DNt=b(function(e,t,r,n,i,a,s,o){if(t===null||r===null)return;let l={},u=Ah.find(h=>h.alias===t);if(u&&t===u.alias?l=u:(l.alias=t,Ah.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.techn={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.techn={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.sprite=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.wrap=Ag(),l.typeC4Shape={text:e},l.parentBoundary=Sl},"addComponent"),ONt=b(function(e,t,r,n,i){if(e===null||t===null)return;let a={},s=nd.find(o=>o.alias===e);if(s&&e===s.alias?a=s:(a.alias=e,nd.push(a)),t==null?a.label={text:""}:a.label={text:t},r==null)a.type={text:"system"};else if(typeof r=="object"){let[o,l]=Object.entries(r)[0];a[o]={text:l}}else a.type={text:r};if(typeof n=="object"){let[o,l]=Object.entries(n)[0];a[o]=l}else a.tags=n;if(typeof i=="object"){let[o,l]=Object.entries(i)[0];a[o]=l}else a.link=i;a.parentBoundary=Sl,a.wrap=Ag(),Eh=Sl,Sl=e,Eg.push(Eh)},"addPersonOrSystemBoundary"),PNt=b(function(e,t,r,n,i){if(e===null||t===null)return;let a={},s=nd.find(o=>o.alias===e);if(s&&e===s.alias?a=s:(a.alias=e,nd.push(a)),t==null?a.label={text:""}:a.label={text:t},r==null)a.type={text:"container"};else if(typeof r=="object"){let[o,l]=Object.entries(r)[0];a[o]={text:l}}else a.type={text:r};if(typeof n=="object"){let[o,l]=Object.entries(n)[0];a[o]=l}else a.tags=n;if(typeof i=="object"){let[o,l]=Object.entries(i)[0];a[o]=l}else a.link=i;a.parentBoundary=Sl,a.wrap=Ag(),Eh=Sl,Sl=e,Eg.push(Eh)},"addContainerBoundary"),BNt=b(function(e,t,r,n,i,a,s,o){if(t===null||r===null)return;let l={},u=nd.find(h=>h.alias===t);if(u&&t===u.alias?l=u:(l.alias=t,nd.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.type={text:"node"};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.type={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.nodeType=e,l.parentBoundary=Sl,l.wrap=Ag(),Eh=Sl,Sl=t,Eg.push(Eh)},"addDeploymentNode"),FNt=b(function(){Sl=Eh,Eg.pop(),Eh=Eg.pop(),Eg.push(Eh)},"popBoundaryParseStack"),$Nt=b(function(e,t,r,n,i,a,s,o,l,u,h){let f=Ah.find(d=>d.alias===t);if(!(f===void 0&&(f=nd.find(d=>d.alias===t),f===void 0))){if(r!=null)if(typeof r=="object"){let[d,p]=Object.entries(r)[0];f[d]=p}else f.bgColor=r;if(n!=null)if(typeof n=="object"){let[d,p]=Object.entries(n)[0];f[d]=p}else f.fontColor=n;if(i!=null)if(typeof i=="object"){let[d,p]=Object.entries(i)[0];f[d]=p}else f.borderColor=i;if(a!=null)if(typeof a=="object"){let[d,p]=Object.entries(a)[0];f[d]=p}else f.shadowing=a;if(s!=null)if(typeof s=="object"){let[d,p]=Object.entries(s)[0];f[d]=p}else f.shape=s;if(o!=null)if(typeof o=="object"){let[d,p]=Object.entries(o)[0];f[d]=p}else f.sprite=o;if(l!=null)if(typeof l=="object"){let[d,p]=Object.entries(l)[0];f[d]=p}else f.techn=l;if(u!=null)if(typeof u=="object"){let[d,p]=Object.entries(u)[0];f[d]=p}else f.legendText=u;if(h!=null)if(typeof h=="object"){let[d,p]=Object.entries(h)[0];f[d]=p}else f.legendSprite=h}},"updateElStyle"),zNt=b(function(e,t,r,n,i,a,s){let o=eS.find(l=>l.from===t&&l.to===r);if(o!==void 0){if(n!=null)if(typeof n=="object"){let[l,u]=Object.entries(n)[0];o[l]=u}else o.textColor=n;if(i!=null)if(typeof i=="object"){let[l,u]=Object.entries(i)[0];o[l]=u}else o.lineColor=i;if(a!=null)if(typeof a=="object"){let[l,u]=Object.entries(a)[0];o[l]=parseInt(u)}else o.offsetX=parseInt(a);if(s!=null)if(typeof s=="object"){let[l,u]=Object.entries(s)[0];o[l]=parseInt(u)}else o.offsetY=parseInt(s)}},"updateRelStyle"),GNt=b(function(e,t,r){let n=II,i=MI;if(typeof t=="object"){let a=Object.values(t)[0];n=parseInt(a)}else n=parseInt(t);if(typeof r=="object"){let a=Object.values(r)[0];i=parseInt(a)}else i=parseInt(r);n>=1&&(II=n),i>=1&&(MI=i)},"updateLayoutConfig"),qNt=b(function(){return II},"getC4ShapeInRow"),VNt=b(function(){return MI},"getC4BoundaryInRow"),WNt=b(function(){return Sl},"getCurrentBoundaryParse"),HNt=b(function(){return Eh},"getParentBoundaryParse"),oOe=b(function(e){return e==null?Ah:Ah.filter(t=>t.parentBoundary===e)},"getC4ShapeArray"),UNt=b(function(e){return Ah.find(t=>t.alias===e)},"getC4Shape"),YNt=b(function(e){return Object.keys(oOe(e))},"getC4ShapeKeys"),lOe=b(function(e){return e==null?nd:nd.filter(t=>t.parentBoundary===e)},"getBoundaries"),XNt=lOe,jNt=b(function(){return eS},"getRels"),KNt=b(function(){return WZ},"getTitle"),ZNt=b(function(e){HZ=e},"setWrap"),Ag=b(function(){return HZ},"autoWrap"),QNt=b(function(){Ah=[],nd=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Eh="",Sl="global",Eg=[""],eS=[],Eg=[""],WZ="",HZ=!1,II=4,MI=2},"clear"),JNt={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},eDt={FILLED:0,OPEN:1},tDt={LEFTOF:0,RIGHTOF:1,OVER:2},rDt=b(function(e){WZ=Mr(e,Be())},"setTitle"),GZ={addPersonOrSystem:MNt,addPersonOrSystemBoundary:ONt,addContainer:NNt,addContainerBoundary:PNt,addComponent:DNt,addDeploymentNode:BNt,popBoundaryParseStack:FNt,addRel:INt,updateElStyle:$Nt,updateRelStyle:zNt,updateLayoutConfig:GNt,autoWrap:Ag,setWrap:ZNt,getC4ShapeArray:oOe,getC4Shape:UNt,getC4ShapeKeys:YNt,getBoundaries:lOe,getBoundarys:XNt,getCurrentBoundaryParse:WNt,getParentBoundaryParse:HNt,getRels:jNt,getTitle:KNt,getC4Type:RNt,getC4ShapeInRow:qNt,getC4BoundaryInRow:VNt,setAccTitle:Yr,getAccTitle:Qr,getAccDescription:en,setAccDescription:Jr,getConfig:b(()=>Be().c4,"getConfig"),clear:QNt,LINETYPE:JNt,ARROWTYPE:eDt,PLACEMENT:tDt,setTitle:rDt,setC4Type:LNt},UZ=b(function(e,t){return wv(e,t)},"drawRect"),uOe=b(function(e,t,r,n,i,a){let s=e.append("image");s.attr("width",t),s.attr("height",r),s.attr("x",n),s.attr("y",i);let o=a.startsWith("data:image/png;base64")?a:(0,cOe.sanitizeUrl)(a);s.attr("xlink:href",o)},"drawImage"),nDt=b((e,t,r,n)=>{let i=e.append("g"),a=0;for(let s of t){let o=s.textColor?s.textColor:"#444444",l=s.lineColor?s.lineColor:"#444444",u=s.offsetX?parseInt(s.offsetX):0,h=s.offsetY?parseInt(s.offsetY):0,f="";if(a===0){let p=i.append("line");p.attr("x1",s.startPoint.x),p.attr("y1",s.startPoint.y),p.attr("x2",s.endPoint.x),p.attr("y2",s.endPoint.y),p.attr("stroke-width","1"),p.attr("stroke",l),p.style("fill","none"),s.type!=="rel_b"&&p.attr("marker-end","url("+f+"#"+n+"-arrowhead)"),(s.type==="birel"||s.type==="rel_b")&&p.attr("marker-start","url("+f+"#"+n+"-arrowend)"),a=-1}else{let p=i.append("path");p.attr("fill","none").attr("stroke-width","1").attr("stroke",l).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",s.startPoint.x).replaceAll("starty",s.startPoint.y).replaceAll("controlx",s.startPoint.x+(s.endPoint.x-s.startPoint.x)/2-(s.endPoint.x-s.startPoint.x)/4).replaceAll("controly",s.startPoint.y+(s.endPoint.y-s.startPoint.y)/2).replaceAll("stopx",s.endPoint.x).replaceAll("stopy",s.endPoint.y)),s.type!=="rel_b"&&p.attr("marker-end","url("+f+"#"+n+"-arrowhead)"),(s.type==="birel"||s.type==="rel_b")&&p.attr("marker-start","url("+f+"#"+n+"-arrowend)")}let d=r.messageFont();W0(r)(s.label.text,i,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+u,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+h,s.label.width,s.label.height,{fill:o},d),s.techn&&s.techn.text!==""&&(d=r.messageFont(),W0(r)("["+s.techn.text+"]",i,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+u,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+r.messageFontSize+5+h,Math.max(s.label.width,s.techn.width),s.techn.height,{fill:o,"font-style":"italic"},d))}},"drawRels"),iDt=b(function(e,t,r){let n=e.append("g"),i=t.bgColor?t.bgColor:"none",a=t.borderColor?t.borderColor:"#444444",s=t.fontColor?t.fontColor:"black",o={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};t.nodeType&&(o={"stroke-width":1});let l={x:t.x,y:t.y,fill:i,stroke:a,width:t.width,height:t.height,rx:2.5,ry:2.5,attrs:o};UZ(n,l);let u=r.boundaryFont();u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=s,W0(r)(t.label.text,n,t.x,t.y+t.label.Y,t.width,t.height,{fill:"#444444"},u),t.type&&t.type.text!==""&&(u=r.boundaryFont(),u.fontColor=s,W0(r)(t.type.text,n,t.x,t.y+t.type.Y,t.width,t.height,{fill:"#444444"},u)),t.descr&&t.descr.text!==""&&(u=r.boundaryFont(),u.fontSize=u.fontSize-2,u.fontColor=s,W0(r)(t.descr.text,n,t.x,t.y+t.descr.Y,t.width,t.height,{fill:"#444444"},u))},"drawBoundary"),aDt=b(function(e,t,r){let n=t.bgColor?t.bgColor:r[t.typeC4Shape.text+"_bg_color"],i=t.borderColor?t.borderColor:r[t.typeC4Shape.text+"_border_color"],a=t.fontColor?t.fontColor:"#FFFFFF",s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(t.typeC4Shape.text){case"person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";break}let o=e.append("g");o.attr("class","person-man");let l=Xo();switch(t.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":l.x=t.x,l.y=t.y,l.fill=n,l.width=t.width,l.height=t.height,l.stroke=i,l.rx=2.5,l.ry=2.5,l.attrs={"stroke-width":.5},UZ(o,l);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":o.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2).replaceAll("height",t.height)),o.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":o.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("width",t.width).replaceAll("half",t.height/2)),o.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",t.x+t.width).replaceAll("starty",t.y).replaceAll("half",t.height/2));break}let u=dDt(r,t.typeC4Shape.text);switch(o.append("text").attr("fill",a).attr("font-family",u.fontFamily).attr("font-size",u.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",t.typeC4Shape.width).attr("x",t.x+t.width/2-t.typeC4Shape.width/2).attr("y",t.y+t.typeC4Shape.Y).text("<<"+t.typeC4Shape.text+">>"),t.typeC4Shape.text){case"person":case"external_person":uOe(o,48,48,t.x+t.width/2-24,t.y+t.image.Y,s);break}let h=r[t.typeC4Shape.text+"Font"]();return h.fontWeight="bold",h.fontSize=h.fontSize+2,h.fontColor=a,W0(r)(t.label.text,o,t.x,t.y+t.label.Y,t.width,t.height,{fill:a},h),h=r[t.typeC4Shape.text+"Font"](),h.fontColor=a,t.techn&&t.techn?.text!==""?W0(r)(t.techn.text,o,t.x,t.y+t.techn.Y,t.width,t.height,{fill:a,"font-style":"italic"},h):t.type&&t.type.text!==""&&W0(r)(t.type.text,o,t.x,t.y+t.type.Y,t.width,t.height,{fill:a,"font-style":"italic"},h),t.descr&&t.descr.text!==""&&(h=r.personFont(),h.fontColor=a,W0(r)(t.descr.text,o,t.x,t.y+t.descr.Y,t.width,t.height,{fill:a},h)),t.height},"drawC4Shape"),sDt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),oDt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),lDt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),cDt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),uDt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),hDt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),fDt=b(function(e,t){let n=e.append("defs").append("marker").attr("id",t+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);n.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),n.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),dDt=b((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"getC4ShapeFont"),W0=(function(){function e(i,a,s,o,l,u,h){let f=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("text-anchor","middle").text(i);n(f,h)}b(e,"byText");function t(i,a,s,o,l,u,h,f){let{fontSize:d,fontFamily:p,fontWeight:m}=f,g=i.split(Ct.lineBreakRegex);for(let y=0;y=this.data.widthLimit||r>=this.data.widthLimit||this.nextData.cnt>hOe)&&(t=this.nextData.startx+e.margin+xr.nextLinePaddingX,n=this.nextData.stopy+e.margin*2,this.nextData.stopx=r=t+e.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=i=n+e.height,this.nextData.cnt=1),e.x=t,e.y=n,this.updateVal(this.data,"startx",t,Math.min),this.updateVal(this.data,"starty",n,Math.min),this.updateVal(this.data,"stopx",r,Math.max),this.updateVal(this.data,"stopy",i,Math.max),this.updateVal(this.nextData,"startx",t,Math.min),this.updateVal(this.nextData,"starty",n,Math.min),this.updateVal(this.nextData,"stopx",r,Math.max),this.updateVal(this.nextData,"stopy",i,Math.max)}init(e){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},VZ(e.db.getConfig())}bumpLastMargin(e){this.data.stopx+=e,this.data.stopy+=e}},VZ=b(function(e){Xi(xr,e),e.fontFamily&&(xr.personFontFamily=xr.systemFontFamily=xr.messageFontFamily=e.fontFamily),e.fontSize&&(xr.personFontSize=xr.systemFontSize=xr.messageFontSize=e.fontSize),e.fontWeight&&(xr.personFontWeight=xr.systemFontWeight=xr.messageFontWeight=e.fontWeight)},"setConf"),JC=b((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"c4ShapeFont"),RI=b(e=>({fontFamily:e.boundaryFontFamily,fontSize:e.boundaryFontSize,fontWeight:e.boundaryFontWeight}),"boundaryFont"),pDt=b(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont");b($u,"calcC4ShapeTextWH");dOe=b(function(e,t,r){t.x=r.data.startx,t.y=r.data.starty,t.width=r.data.stopx-r.data.startx,t.height=r.data.stopy-r.data.starty,t.label.y=xr.c4ShapeMargin-35;let n=t.wrap&&xr.wrap,i=RI(xr);i.fontSize=i.fontSize+2,i.fontWeight="bold";let a=uo(t.label.text,i);$u("label",t,n,i,a),rd.drawBoundary(e,t,xr)},"drawBoundary"),pOe=b(function(e,t,r,n){let i=0;for(let a of n){i=0;let s=r[a],o=JC(xr,s.typeC4Shape.text);switch(o.fontSize=o.fontSize-2,s.typeC4Shape.width=uo("\xAB"+s.typeC4Shape.text+"\xBB",o),s.typeC4Shape.height=o.fontSize+2,s.typeC4Shape.Y=xr.c4ShapePadding,i=s.typeC4Shape.Y+s.typeC4Shape.height-4,s.image={width:0,height:0,Y:0},s.typeC4Shape.text){case"person":case"external_person":s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height;break}s.sprite&&(s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height);let l=s.wrap&&xr.wrap,u=xr.width-xr.c4ShapePadding*2,h=JC(xr,s.typeC4Shape.text);if(h.fontSize=h.fontSize+2,h.fontWeight="bold",$u("label",s,l,h,u),s.label.Y=i+8,i=s.label.Y+s.label.height,s.type&&s.type.text!==""){s.type.text="["+s.type.text+"]";let p=JC(xr,s.typeC4Shape.text);$u("type",s,l,p,u),s.type.Y=i+5,i=s.type.Y+s.type.height}else if(s.techn&&s.techn.text!==""){s.techn.text="["+s.techn.text+"]";let p=JC(xr,s.techn.text);$u("techn",s,l,p,u),s.techn.Y=i+5,i=s.techn.Y+s.techn.height}let f=i,d=s.label.width;if(s.descr&&s.descr.text!==""){let p=JC(xr,s.typeC4Shape.text);$u("descr",s,l,p,u),s.descr.Y=i+20,i=s.descr.Y+s.descr.height,d=Math.max(s.label.width,s.descr.width),f=i-s.descr.textLines*5}d=d+xr.c4ShapePadding,s.width=Math.max(s.width||xr.width,d,xr.width),s.height=Math.max(s.height||xr.height,f,xr.height),s.margin=s.margin||xr.c4ShapeMargin,e.insert(s),rd.drawC4Shape(t,s,xr)}e.bumpLastMargin(xr.c4ShapeMargin)},"drawC4ShapeArray"),Fu=class{static{b(this,"Point")}constructor(e,t){this.x=e,this.y=t}},iOe=b(function(e,t){let r=e.x,n=e.y,i=t.x,a=t.y,s=r+e.width/2,o=n+e.height/2,l=Math.abs(r-i),u=Math.abs(n-a),h=u/l,f=e.height/e.width,d=null;return n==a&&ri?d=new Fu(r,o):r==i&&na&&(d=new Fu(s,n)),r>i&&n=h?d=new Fu(r,o+h*e.width/2):d=new Fu(s-l/u*e.height/2,n+e.height):r=h?d=new Fu(r+e.width,o+h*e.width/2):d=new Fu(s+l/u*e.height/2,n+e.height):ra?f>=h?d=new Fu(r+e.width,o-h*e.width/2):d=new Fu(s+e.height/2*l/u,n):r>i&&n>a&&(f>=h?d=new Fu(r,o-e.width/2*h):d=new Fu(s-e.height/2*l/u,n)),d},"getIntersectPoint"),mDt=b(function(e,t){let r={x:0,y:0};r.x=t.x+t.width/2,r.y=t.y+t.height/2;let n=iOe(e,r);r.x=e.x+e.width/2,r.y=e.y+e.height/2;let i=iOe(t,r);return{startPoint:n,endPoint:i}},"getIntersectPoints"),gDt=b(function(e,t,r,n,i){let a=0;for(let s of t){a=a+1;let o=s.wrap&&xr.wrap,l=pDt(xr);n.db.getC4Type()==="C4Dynamic"&&(s.label.text=a+": "+s.label.text);let h=uo(s.label.text,l);$u("label",s,o,l,h),s.techn&&s.techn.text!==""&&(h=uo(s.techn.text,l),$u("techn",s,o,l,h)),s.descr&&s.descr.text!==""&&(h=uo(s.descr.text,l),$u("descr",s,o,l,h));let f=r(s.from),d=r(s.to),p=mDt(f,d);s.startPoint=p.startPoint,s.endPoint=p.endPoint}rd.drawRels(e,t,xr,i)},"drawRels");b(YZ,"drawInsideBoundary");yDt=b(function(e,t,r,n){xr=Be().c4;let i=Be().securityLevel,a;i==="sandbox"&&(a=ct("#i"+t));let s=i==="sandbox"?ct(a.nodes()[0].contentDocument.body):ct("body"),o=n.db;n.db.setWrap(xr.wrap),hOe=o.getC4ShapeInRow(),qZ=o.getC4BoundaryInRow(),se.debug(`C:${JSON.stringify(xr,null,2)}`);let l=i==="sandbox"?s.select(`[id="${t}"]`):ct(`[id="${t}"]`);rd.insertComputerIcon(l,t),rd.insertDatabaseIcon(l,t),rd.insertClockIcon(l,t);let u=new fOe(n);u.setData(xr.diagramMarginX,xr.diagramMarginX,xr.diagramMarginY,xr.diagramMarginY),u.data.widthLimit=screen.availWidth,NI=xr.diagramMarginX,DI=xr.diagramMarginY;let h=n.db.getTitle(),f=n.db.getBoundaries("");YZ(l,"",u,f,n),rd.insertArrowHead(l,t),rd.insertArrowEnd(l,t),rd.insertArrowCrossHead(l,t),rd.insertArrowFilledHead(l,t),gDt(l,n.db.getRels(),n.db.getC4Shape,n,t),u.data.stopx=NI,u.data.stopy=DI;let d=u.data,m=d.stopy-d.starty+2*xr.diagramMarginY,y=d.stopx-d.startx+2*xr.diagramMarginX;h&&l.append("text").text(h).attr("x",(d.stopx-d.startx)/2-4*xr.diagramMarginX).attr("y",d.starty+xr.diagramMarginY),vn(l,m,y,xr.useMaxWidth);let v=h?60:0;l.attr("viewBox",d.startx-xr.diagramMarginX+" -"+(xr.diagramMarginY+v)+" "+y+" "+(m+v)),se.debug("models:",d)},"draw"),aOe={drawPersonOrSystemArray:pOe,drawBoundary:dOe,setConf:VZ,draw:yDt},vDt=b(e=>`.person { stroke: ${e.personBorder}; fill: ${e.personBkg}; } -`,"getStyles"),mDt=pDt,gDt={parser:CNt,db:$Z,renderer:nOe,styles:mDt,init:b(({c4:e,wrap:t})=>{nOe.setConf(e),$Z.setWrap(t)},"init")}});var id,ad=W(()=>{hr();id=b(()=>` +`,"getStyles"),xDt=vDt,bDt={parser:_Nt,db:GZ,renderer:aOe,styles:xDt,init:b(({c4:e,wrap:t})=>{aOe.setConf(e),GZ.setWrap(t)},"init")}});var id,ad=W(()=>{hr();id=b(()=>` /* Font Awesome icon styling - consolidated */ .label-icon { display: inline-block; @@ -897,21 +897,21 @@ Expecting `+yt.join(", ")+", got '"+(this.terminals_[Se]||Se)+"'":xt="Parse erro stroke: revert; stroke-width: revert; } -`,"getIconStyles")});var zu,Uc=W(()=>{hr();fn();zu=b((e,t)=>{let r;return t==="sandbox"&&(r=ct("#i"+e)),(t==="sandbox"?ct(r.nodes()[0].contentDocument.body):ct("body")).select(`[id="${e}"]`)},"getDiagramElement")});var sc,yDt,vDt,oc=W(()=>{_r();Rr();hr();sc=b((e,t,r,n)=>{e.attr("class",r);let{width:i,height:a,x:s,y:o}=yDt(e,t);vn(e,a,i,n);let l=vDt(s,o,i,a,t);e.attr("viewBox",l),se.debug(`viewBox configured: ${l} with padding: ${t}`)},"setupViewPortForSVG"),yDt=b((e,t)=>{let r=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:r.width+t*2,height:r.height+t*2,x:r.x,y:r.y}},"calculateDimensionsWithPadding"),vDt=b((e,t,r,n,i)=>`${e-i} ${t-i} ${r} ${n}`,"createViewBox")});var xDt,bDt,wDt,kDt,TDt,UZ,mOe,gOe,CDt,SDt,EDt,YZ,tS,yOe,XZ=W(()=>{ad();Uc();oc();Gy();ic();Hc();po();Sn();_r();Rr();hr();fn();xb();Ka();xDt="flowchart-",bDt=class{constructor(){this.vertexCounter=0,this.config=Be(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=Yr,this.setAccDescription=Jr,this.setDiagramTitle=ln,this.getAccTitle=Qr,this.getAccDescription=en,this.getDiagramTitle=tn,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{b(this,"FlowDB")}sanitizeText(e){return Ct.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(let t of this.vertices.values())if(t.id===e)return this.diagramId?`${this.diagramId}-${t.domId}`:t.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,t,r,n,i,a,s={},o){if(!e||e.trim().length===0)return;let l;if(o!==void 0){let d;o.includes(` +`,"getIconStyles")});var zu,Uc=W(()=>{hr();fn();zu=b((e,t)=>{let r;return t==="sandbox"&&(r=ct("#i"+e)),(t==="sandbox"?ct(r.nodes()[0].contentDocument.body):ct("body")).select(`[id="${e}"]`)},"getDiagramElement")});var oc,wDt,kDt,lc=W(()=>{_r();Rr();hr();oc=b((e,t,r,n)=>{e.attr("class",r);let{width:i,height:a,x:s,y:o}=wDt(e,t);vn(e,a,i,n);let l=kDt(s,o,i,a,t);e.attr("viewBox",l),se.debug(`viewBox configured: ${l} with padding: ${t}`)},"setupViewPortForSVG"),wDt=b((e,t)=>{let r=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:r.width+t*2,height:r.height+t*2,x:r.x,y:r.y}},"calculateDimensionsWithPadding"),kDt=b((e,t,r,n,i)=>`${e-i} ${t-i} ${r} ${n}`,"createViewBox")});var TDt,CDt,SDt,EDt,ADt,XZ,yOe,vOe,_Dt,RDt,LDt,jZ,tS,xOe,KZ=W(()=>{ad();Uc();lc();Gy();ac();Hc();po();Sn();_r();Rr();hr();fn();xb();Ka();TDt="flowchart-",CDt=class{constructor(){this.vertexCounter=0,this.config=Be(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=Yr,this.setAccDescription=Jr,this.setDiagramTitle=ln,this.getAccTitle=Qr,this.getAccDescription=en,this.getDiagramTitle=tn,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{b(this,"FlowDB")}sanitizeText(e){return Ct.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(let t of this.vertices.values())if(t.id===e)return this.diagramId?`${this.diagramId}-${t.domId}`:t.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,t,r,n,i,a,s={},o){if(!e||e.trim().length===0)return;let l;if(o!==void 0){let d;o.includes(` `)?d=o+` `:d=`{ `+o+` -}`,l=Ym(d,{schema:Um})}let u=this.edges.find(d=>d.id===e);if(u){let d=l;d?.animate!==void 0&&(u.animate=d.animate),d?.animation!==void 0&&(u.animation=d.animation),d?.curve!==void 0&&(u.interpolate=d.curve);return}let h,f=this.vertices.get(e);if(f===void 0&&(t===void 0&&r===void 0&&n!==void 0&&n!==null&&se.warn(`Style applied to unknown node "${e}". This may indicate a typo. The node will be created automatically.`),f={id:e,labelType:"text",domId:xDt+e+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(e,f)),this.vertexCounter++,t!==void 0?(this.config=Be(),h=this.sanitizeText(t.text.trim()),f.labelType=t.type,h.startsWith('"')&&h.endsWith('"')&&(h=h.substring(1,h.length-1)),f.text=h):f.text===void 0&&(f.text=e),r!==void 0&&(f.type=r),n?.forEach(d=>{f.styles.push(d)}),i?.forEach(d=>{f.classes.push(d)}),a!==void 0&&(f.dir=a),f.props===void 0?f.props=s:s!==void 0&&Object.assign(f.props,s),l!==void 0){if(l.shape){if(l.shape!==l.shape.toLowerCase()||l.shape.includes("_"))throw new Error(`No such shape: ${l.shape}. Shape names should be lowercase.`);if(!EY(l.shape))throw new Error(`No such shape: ${l.shape}.`);f.type=l?.shape}l?.label&&(f.text=l?.label,f.labelType=this.sanitizeNodeLabelType(l?.labelType)),l?.icon&&(f.icon=l?.icon,!l.label?.trim()&&f.text===e&&(f.text="")),l?.form&&(f.form=l?.form),l?.pos&&(f.pos=l?.pos),l?.img&&(f.img=l?.img,!l.label?.trim()&&f.text===e&&(f.text="")),l?.constraint&&(f.constraint=l.constraint),l.w&&(f.assetWidth=Number(l.w)),l.h&&(f.assetHeight=Number(l.h))}}addSingleLink(e,t,r,n){let s={start:e,end:t,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.edges.defaultInterpolate};se.info("abc78 Got edge...",s);let o=r.text;if(o!==void 0&&(s.text=this.sanitizeText(o.text.trim()),s.text.startsWith('"')&&s.text.endsWith('"')&&(s.text=s.text.substring(1,s.text.length-1)),s.labelType=this.sanitizeNodeLabelType(o.type)),r!==void 0&&(s.type=r.type,s.stroke=r.stroke,s.length=r.length>10?10:r.length),n&&!this.edges.some(l=>l.id===n))s.id=n,s.isUserDefinedId=!0;else{let l=this.edges.filter(u=>u.start===s.start&&u.end===s.end);l.length===0?s.id=zf(s.start,s.end,{counter:0,prefix:"L"}):s.id=zf(s.start,s.end,{counter:l.length+1,prefix:"L"})}if(this.edges.length<(this.config.maxEdges??500))se.info("Pushing edge..."),this.edges.push(s);else throw new Error(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}. +}`,l=Ym(d,{schema:Um})}let u=this.edges.find(d=>d.id===e);if(u){let d=l;d?.animate!==void 0&&(u.animate=d.animate),d?.animation!==void 0&&(u.animation=d.animation),d?.curve!==void 0&&(u.interpolate=d.curve);return}let h,f=this.vertices.get(e);if(f===void 0&&(t===void 0&&r===void 0&&n!==void 0&&n!==null&&se.warn(`Style applied to unknown node "${e}". This may indicate a typo. The node will be created automatically.`),f={id:e,labelType:"text",domId:TDt+e+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(e,f)),this.vertexCounter++,t!==void 0?(this.config=Be(),h=this.sanitizeText(t.text.trim()),f.labelType=t.type,h.startsWith('"')&&h.endsWith('"')&&(h=h.substring(1,h.length-1)),f.text=h):f.text===void 0&&(f.text=e),r!==void 0&&(f.type=r),n?.forEach(d=>{f.styles.push(d)}),i?.forEach(d=>{f.classes.push(d)}),a!==void 0&&(f.dir=a),f.props===void 0?f.props=s:s!==void 0&&Object.assign(f.props,s),l!==void 0){if(l.shape){if(l.shape!==l.shape.toLowerCase()||l.shape.includes("_"))throw new Error(`No such shape: ${l.shape}. Shape names should be lowercase.`);if(!_Y(l.shape))throw new Error(`No such shape: ${l.shape}.`);f.type=l?.shape}l?.label&&(f.text=l?.label,f.labelType=this.sanitizeNodeLabelType(l?.labelType)),l?.icon&&(f.icon=l?.icon,!l.label?.trim()&&f.text===e&&(f.text="")),l?.form&&(f.form=l?.form),l?.pos&&(f.pos=l?.pos),l?.img&&(f.img=l?.img,!l.label?.trim()&&f.text===e&&(f.text="")),l?.constraint&&(f.constraint=l.constraint),l.w&&(f.assetWidth=Number(l.w)),l.h&&(f.assetHeight=Number(l.h))}}addSingleLink(e,t,r,n){let s={start:e,end:t,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.edges.defaultInterpolate};se.info("abc78 Got edge...",s);let o=r.text;if(o!==void 0&&(s.text=this.sanitizeText(o.text.trim()),s.text.startsWith('"')&&s.text.endsWith('"')&&(s.text=s.text.substring(1,s.text.length-1)),s.labelType=this.sanitizeNodeLabelType(o.type)),r!==void 0&&(s.type=r.type,s.stroke=r.stroke,s.length=r.length>10?10:r.length),n&&!this.edges.some(l=>l.id===n))s.id=n,s.isUserDefinedId=!0;else{let l=this.edges.filter(u=>u.start===s.start&&u.end===s.end);l.length===0?s.id=zf(s.start,s.end,{counter:0,prefix:"L"}):s.id=zf(s.start,s.end,{counter:l.length+1,prefix:"L"})}if(this.edges.length<(this.config.maxEdges??500))se.info("Pushing edge..."),this.edges.push(s);else throw new Error(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}. Initialize mermaid with maxEdges set to a higher number to allow more edges. You cannot set this config via configuration inside the diagram as it is a secure config. -You have to call mermaid.initialize.`)}isLinkData(e){return e!==null&&typeof e=="object"&&"id"in e&&typeof e.id=="string"}addLink(e,t,r){let n=this.isLinkData(r)?r.id.replace("@",""):void 0;se.info("addLink",e,t,n);for(let i of e)for(let a of t){let s=i===e[e.length-1],o=a===t[0];s&&o?this.addSingleLink(i,a,r,n):this.addSingleLink(i,a,r,void 0)}}updateLinkInterpolate(e,t){e.forEach(r=>{r==="default"?this.edges.defaultInterpolate=t:this.edges[r].interpolate=t})}updateLink(e,t){e.forEach(r=>{if(typeof r=="number"&&r>=this.edges.length)throw new Error(`The index ${r} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);r==="default"?this.edges.defaultStyle=t:(this.edges[r].style=t,(this.edges[r]?.style?.length??0)>0&&!this.edges[r]?.style?.some(n=>n?.startsWith("fill"))&&this.edges[r]?.style?.push("fill:none"))})}addClass(e,t){let r=t.join().replace(/\\,/g,"\xA7\xA7\xA7").replace(/,/g,";").replace(/§§§/g,",").split(";");e.split(",").forEach(n=>{let i=this.classes.get(n);i===void 0&&(i={id:n,styles:[],textStyles:[]},this.classes.set(n,i)),r?.forEach(a=>{if(/color/.exec(a)){let s=a.replace("fill","bgFill");i.textStyles.push(s)}i.styles.push(a)})})}setDirection(e){this.direction=e.trim(),/.*/.exec(this.direction)&&(this.direction="LR"),/.*v/.exec(this.direction)&&(this.direction="TB"),this.direction==="TD"&&(this.direction="TB")}setClass(e,t){for(let r of e.split(",")){let n=this.vertices.get(r);n&&n.classes.push(t);let i=this.edges.find(s=>s.id===r);i&&i.classes.push(t);let a=this.subGraphLookup.get(r);a&&a.classes.push(t)}}setTooltip(e,t){if(t!==void 0){t=this.sanitizeText(t);for(let r of e.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(r):r,t)}}setClickFun(e,t,r){if(Be().securityLevel!=="loose"||t===void 0)return;let n=[];if(typeof r=="string"){n=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let a=0;a{let a=this.lookUpDomId(e),s=document.querySelector(`[id="${a}"]`);s!==null&&s.addEventListener("click",()=>{pr.runFunc(t,...n)},!1)}))}setLink(e,t,r){e.split(",").forEach(n=>{let i=this.vertices.get(n);i!==void 0&&(i.link=pr.formatUrl(t,this.config),i.linkTarget=r)}),this.setClass(e,"clickable")}getTooltip(e){return this.tooltips.get(e)}setClickEvent(e,t,r){e.split(",").forEach(n=>{this.setClickFun(n,t,r)}),this.setClass(e,"clickable")}bindFunctions(e){this.funs.forEach(t=>{t(e)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}getClasses(){return this.classes}setupToolTips(e){let t=iw();ct(e).select("svg").selectAll("g.node").on("mouseover",i=>{let a=ct(i.currentTarget),s=a.attr("title");if(s===null)return;let o=i.currentTarget?.getBoundingClientRect();t.transition().duration(200).style("opacity",".9"),t.text(a.attr("title")).style("left",window.scrollX+o.left+(o.right-o.left)/2+"px").style("top",window.scrollY+o.bottom+"px"),t.html(Ul.sanitize(s)),a.classed("hover",!0)}).on("mouseout",i=>{t.transition().duration(500).style("opacity",0),ct(i.currentTarget).classed("hover",!1)})}clear(e="gen-2"){this.vertices=new Map,this.classes=new Map,this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.diagramId="",this.subGraphs=[],this.subGraphLookup=new Map,this.subCount=0,this.tooltips=new Map,this.firstGraphFlag=!0,this.version=e,this.config=Be(),Nr()}setGen(e){this.version=e||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(e,t,r){let n=e.text.trim(),i=r.text;e===r&&/\s/.exec(r.text)&&(n=void 0);let s=b(p=>{let m={boolean:{},number:{},string:{}},g=[],y;return{nodeList:p.filter(function(x){let w=typeof x;return x.stmt&&x.stmt==="dir"?(y=x.value,!1):x.trim()===""?!1:w in m?m[w].hasOwnProperty(x)?!1:m[w][x]=!0:g.includes(x)?!1:g.push(x)}),dir:y}},"uniq")(t.flat()),o=s.nodeList,l=s.dir,u=l!==void 0,h=Be().flowchart??{},f=l??(h.inheritDir?this.getDirection()??Be().direction??void 0:void 0);if(this.version==="gen-1")for(let p=0;p2e3)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=t,this.subGraphs[t].id===e)return{result:!0,count:0};let n=0,i=1;for(;n=0){let s=this.indexNodes2(e,a);if(s.result)return{result:!0,count:i+s.count};i=i+s.count}n=n+1}return{result:!1,count:i}}getDepthFirstPos(e){return this.posCrossRef[e]}indexNodes(){this.secCount=-1,this.subGraphs.length>0&&this.indexNodes2("none",this.subGraphs.length-1)}getSubGraphs(){return this.subGraphs}firstGraph(){return this.firstGraphFlag?(this.firstGraphFlag=!1,!0):!1}destructStartLink(e){let t=e.trim(),r="arrow_open";switch(t[0]){case"<":r="arrow_point",t=t.slice(1);break;case"x":r="arrow_cross",t=t.slice(1);break;case"o":r="arrow_circle",t=t.slice(1);break}let n="normal";return t.includes("=")&&(n="thick"),t.includes(".")&&(n="dotted"),{type:r,stroke:n}}countChar(e,t){let r=t.length,n=0;for(let i=0;i":n="arrow_point",t.startsWith("<")&&(n="double_"+n,r=r.slice(1));break;case"o":n="arrow_circle",t.startsWith("o")&&(n="double_"+n,r=r.slice(1));break}let i="normal",a=r.length-1;r.startsWith("=")&&(i="thick"),r.startsWith("~")&&(i="invisible");let s=this.countChar(".",r);return s&&(i="dotted",a=s),{type:n,stroke:i,length:a}}destructLink(e,t){let r=this.destructEndLink(e),n;if(t){if(n=this.destructStartLink(t),n.stroke!==r.stroke)return{type:"INVALID",stroke:"INVALID"};if(n.type==="arrow_open")n.type=r.type;else{if(n.type!==r.type)return{type:"INVALID",stroke:"INVALID"};n.type="double_"+n.type}return n.type==="double_arrow"&&(n.type="double_arrow_point"),n.length=r.length,n}return r}exists(e,t){for(let r of e)if(r.nodes.includes(t))return!0;return!1}makeUniq(e,t){let r=[];return e.nodes.forEach((n,i)=>{this.exists(t,n)||r.push(e.nodes[i])}),{nodes:r}}getTypeFromVertex(e){if(e.img)return"imageSquare";if(e.icon)return e.form==="circle"?"iconCircle":e.form==="square"?"iconSquare":e.form==="rounded"?"iconRounded":"icon";switch(e.type){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return e.type}}findNode(e,t){return e.find(r=>r.id===t)}destructEdgeType(e){let t="none",r="arrow_point";switch(e){case"arrow_point":case"arrow_circle":case"arrow_cross":r=e;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":t=e.replace("double_",""),r=t;break}return{arrowTypeStart:t,arrowTypeEnd:r}}addNodeFromVertex(e,t,r,n,i,a){let s=r.get(e.id),o=n.get(e.id)??!1,l=this.findNode(t,e.id);if(l)l.cssStyles=e.styles,l.cssCompiledStyles=this.getCompiledStyles(e.classes),l.cssClasses=e.classes.join(" ");else{let u={id:e.id,label:e.text,labelType:e.labelType,labelStyle:"",parentId:s,padding:i.flowchart?.padding||8,cssStyles:e.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...e.classes]),cssClasses:"default "+e.classes.join(" "),dir:e.dir,domId:e.domId,look:a,link:e.link,linkTarget:e.linkTarget,tooltip:this.getTooltip(e.id),icon:e.icon,pos:e.pos,img:e.img,assetWidth:e.assetWidth,assetHeight:e.assetHeight,constraint:e.constraint};o?t.push({...u,isGroup:!0,shape:"rect"}):t.push({...u,isGroup:!1,shape:this.getTypeFromVertex(e)})}}getCompiledStyles(e){let t=[];for(let r of e){let n=this.classes.get(r);n?.styles&&(t=[...t,...n.styles??[]].map(i=>i.trim())),n?.textStyles&&(t=[...t,...n.textStyles??[]].map(i=>i.trim()))}return t}getData(){let e=Be(),t=[],r=[],n=this.getSubGraphs(),i=new Map,a=new Map;for(let l=n.length-1;l>=0;l--){let u=n[l];u.nodes.length>0&&a.set(u.id,!0);for(let h of u.nodes)i.set(h,u.id)}for(let l=n.length-1;l>=0;l--){let u=n[l];t.push({id:u.id,label:u.title,labelStyle:"",labelType:u.labelType,parentId:i.get(u.id),padding:8,cssCompiledStyles:this.getCompiledStyles(u.classes),cssClasses:u.classes.join(" "),shape:"rect",dir:u.dir==="TD"?"TB":u.dir,explicitDir:u.hasExplicitDir,isGroup:!0,look:e.look})}this.getVertices().forEach(l=>{this.addNodeFromVertex(l,t,i,a,e,e.look||"classic")});let o=this.getEdges();return o.forEach((l,u)=>{let{arrowTypeStart:h,arrowTypeEnd:f}=this.destructEdgeType(l.type),d=[...o.defaultStyle??[]];l.style&&d.push(...l.style);let p={id:zf(l.start,l.end,{counter:u,prefix:"L"},l.id),isUserDefinedId:l.isUserDefinedId,start:l.start,end:l.end,type:l.type??"normal",label:l.text,labelType:l.labelType,labelpos:"c",thickness:l.stroke,minlen:l.length,classes:l?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:l?.stroke==="invisible"||l?.type==="arrow_open"?"none":h,arrowTypeEnd:l?.stroke==="invisible"||l?.type==="arrow_open"?"none":f,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(l.classes),labelStyle:d,style:d,pattern:l.stroke,look:e.look,animate:l.animate,animation:l.animation,curve:l.interpolate||this.edges.defaultInterpolate||e.flowchart?.curve};r.push(p)}),{nodes:t,edges:r,other:{},config:e}}defaultConfig(){return l9.flowchart}},wDt=b(function(e,t){return t.db.getClasses()},"getClasses"),kDt=b(async function(e,t,r,n,i){se.info("REF0:"),se.info("Drawing state diagram (v2)",t);let{securityLevel:a,flowchart:s,layout:o}=Be();n.db.setDiagramId(t),se.debug("Before getData: ");let l=n.db.getData();se.debug("Data: ",l);let u=zu(t,a),h=n.db.getDirection();l.type=n.type,l.layoutAlgorithm=td(o),l.layoutAlgorithm==="dagre"&&o==="elk"&&se.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."),l.direction=h,l.nodeSpacing=s?.nodeSpacing||50,l.rankSpacing=s?.rankSpacing||50,l.markers=["point","circle","cross"],l.diagramId=t,se.debug("REF1:",l),await Ou(l,u,i);let f=l.config.flowchart?.diagramPadding??8;pr.insertTitle(u,"flowchartTitleText",s?.titleTopMargin||0,n.db.getDiagramTitle()),sc(u,f,"flowchart",s?.useMaxWidth||!1)},"draw"),TDt={getClasses:wDt,draw:kDt},UZ=(function(){var e=b(function(Ft,kt,zt,Wt){for(zt=zt||{},Wt=Ft.length;Wt--;zt[Ft[Wt]]=kt);return zt},"o"),t=[1,4],r=[1,3],n=[1,5],i=[1,8,9,10,11,27,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],a=[2,2],s=[1,13],o=[1,14],l=[1,15],u=[1,16],h=[1,23],f=[1,25],d=[1,26],p=[1,27],m=[1,50],g=[1,49],y=[1,29],v=[1,30],x=[1,31],w=[1,32],C=[1,33],T=[1,45],k=[1,47],S=[1,43],E=[1,48],I=[1,44],L=[1,51],O=[1,46],R=[1,52],A=[1,53],N=[1,34],M=[1,35],D=[1,36],B=[1,37],P=[1,38],$=[1,58],F=[1,8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],q=[1,62],G=[1,61],z=[1,63],H=[8,9,11,75,77,78],j=[1,79],J=[1,92],U=[1,97],le=[1,96],ee=[1,93],ue=[1,89],ae=[1,95],oe=[1,91],Re=[1,98],Te=[1,94],Oe=[1,99],qe=[1,90],Ge=[8,9,10,11,40,75,77,78],fe=[8,9,10,11,40,46,75,77,78],Ce=[8,9,10,11,29,40,44,46,48,50,52,54,56,58,60,63,65,67,68,70,75,77,78,89,102,105,106,109,111,114,115,116],_e=[8,9,11,44,60,75,77,78,89,102,105,106,109,111,114,115,116],de=[44,60,89,102,105,106,109,111,114,115,116],ie=[1,122],Q=[1,123],he=[1,125],xe=[1,124],ce=[44,60,62,74,89,102,105,106,109,111,114,115,116],ge=[1,134],Ie=[1,148],ye=[1,149],ne=[1,150],V=[1,151],pe=[1,136],K=[1,138],ve=[1,142],Z=[1,143],je=[1,144],Ne=[1,145],ze=[1,146],Fe=[1,147],Ke=[1,152],Ve=[1,153],tt=[1,132],We=[1,133],rt=[1,140],Se=[1,135],Et=[1,139],De=[1,137],mt=[8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],Tt=[1,155],jt=[1,157],_t=[8,9,11],Rt=[8,9,10,11,14,44,60,89,105,106,109,111,114,115,116],bt=[1,177],ke=[1,173],yt=[1,174],xt=[1,178],it=[1,175],Me=[1,176],ut=[77,116,119],at=[8,9,10,11,12,14,27,29,32,44,60,75,84,85,86,87,88,89,90,105,109,111,114,115,116],dt=[10,106],tr=[31,49,51,53,55,57,62,64,66,67,69,71,116,117,118],Vt=[1,248],rr=[1,246],Dr=[1,250],vr=[1,244],Qt=[1,245],yr=[1,247],lt=[1,249],pt=[1,251],St=[1,269],Ir=[8,9,11,106],ur=[8,9,10,11,60,84,105,106,109,110,111,112],gn={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,SEMI:8,NEWLINE:9,SPACE:10,EOF:11,GRAPH:12,NODIR:13,DIR:14,FirstStmtSeparator:15,ending:16,endToken:17,spaceList:18,spaceListNewline:19,vertexStatement:20,separator:21,styleStatement:22,linkStyleStatement:23,classDefStatement:24,classStatement:25,clickStatement:26,subgraph:27,textNoTags:28,SQS:29,text:30,SQE:31,end:32,direction:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,shapeData:39,SHAPE_DATA:40,link:41,node:42,styledVertex:43,AMP:44,vertex:45,STYLE_SEPARATOR:46,idString:47,DOUBLECIRCLESTART:48,DOUBLECIRCLEEND:49,PS:50,PE:51,"(-":52,"-)":53,STADIUMSTART:54,STADIUMEND:55,SUBROUTINESTART:56,SUBROUTINEEND:57,VERTEX_WITH_PROPS_START:58,"NODE_STRING[field]":59,COLON:60,"NODE_STRING[value]":61,PIPE:62,CYLINDERSTART:63,CYLINDEREND:64,DIAMOND_START:65,DIAMOND_STOP:66,TAGEND:67,TRAPSTART:68,TRAPEND:69,INVTRAPSTART:70,INVTRAPEND:71,linkStatement:72,arrowText:73,TESTSTR:74,START_LINK:75,edgeText:76,LINK:77,LINK_ID:78,edgeTextToken:79,STR:80,MD_STR:81,textToken:82,keywords:83,STYLE:84,LINKSTYLE:85,CLASSDEF:86,CLASS:87,CLICK:88,DOWN:89,UP:90,textNoTagsToken:91,stylesOpt:92,"idString[vertex]":93,"idString[class]":94,CALLBACKNAME:95,CALLBACKARGS:96,HREF:97,LINK_TARGET:98,"STR[link]":99,"STR[tooltip]":100,alphaNum:101,DEFAULT:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,NODE_STRING:109,UNIT:110,BRKT:111,PCT:112,idStringToken:113,MINUS:114,MULT:115,UNICODE_TEXT:116,TEXT:117,TAGSTART:118,EDGE_TEXT:119,alphaNumToken:120,direction_tb:121,direction_bt:122,direction_rl:123,direction_lr:124,direction_td:125,$accept:0,$end:1},terminals_:{2:"error",8:"SEMI",9:"NEWLINE",10:"SPACE",11:"EOF",12:"GRAPH",13:"NODIR",14:"DIR",27:"subgraph",29:"SQS",31:"SQE",32:"end",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",40:"SHAPE_DATA",44:"AMP",46:"STYLE_SEPARATOR",48:"DOUBLECIRCLESTART",49:"DOUBLECIRCLEEND",50:"PS",51:"PE",52:"(-",53:"-)",54:"STADIUMSTART",55:"STADIUMEND",56:"SUBROUTINESTART",57:"SUBROUTINEEND",58:"VERTEX_WITH_PROPS_START",59:"NODE_STRING[field]",60:"COLON",61:"NODE_STRING[value]",62:"PIPE",63:"CYLINDERSTART",64:"CYLINDEREND",65:"DIAMOND_START",66:"DIAMOND_STOP",67:"TAGEND",68:"TRAPSTART",69:"TRAPEND",70:"INVTRAPSTART",71:"INVTRAPEND",74:"TESTSTR",75:"START_LINK",77:"LINK",78:"LINK_ID",80:"STR",81:"MD_STR",84:"STYLE",85:"LINKSTYLE",86:"CLASSDEF",87:"CLASS",88:"CLICK",89:"DOWN",90:"UP",93:"idString[vertex]",94:"idString[class]",95:"CALLBACKNAME",96:"CALLBACKARGS",97:"HREF",98:"LINK_TARGET",99:"STR[link]",100:"STR[tooltip]",102:"DEFAULT",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"NODE_STRING",110:"UNIT",111:"BRKT",112:"PCT",114:"MINUS",115:"MULT",116:"UNICODE_TEXT",117:"TEXT",118:"TAGSTART",119:"EDGE_TEXT",121:"direction_tb",122:"direction_bt",123:"direction_rl",124:"direction_lr",125:"direction_td"},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,3],[16,2],[16,1],[17,1],[17,1],[17,1],[15,1],[15,1],[15,2],[19,2],[19,2],[19,1],[19,1],[18,2],[18,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,6],[7,4],[7,1],[7,2],[7,2],[7,1],[21,1],[21,1],[21,1],[39,2],[39,1],[20,4],[20,3],[20,4],[20,2],[20,2],[20,1],[42,1],[42,6],[42,5],[43,1],[43,3],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,8],[45,4],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,4],[45,4],[45,1],[41,2],[41,3],[41,3],[41,1],[41,3],[41,4],[76,1],[76,2],[76,1],[76,1],[72,1],[72,2],[73,3],[30,1],[30,2],[30,1],[30,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[28,1],[28,2],[28,1],[28,1],[24,5],[25,5],[26,2],[26,4],[26,3],[26,5],[26,3],[26,5],[26,5],[26,7],[26,2],[26,4],[26,2],[26,4],[26,4],[26,6],[22,5],[23,5],[23,5],[23,9],[23,9],[23,7],[23,7],[103,1],[103,3],[92,1],[92,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[82,1],[82,1],[82,1],[82,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[79,1],[79,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[47,1],[47,2],[101,1],[101,2],[33,1],[33,1],[33,1],[33,1],[33,1]],performAction:b(function(kt,zt,Wt,wt,wr,Le,Ri){var Pe=Le.length-1;switch(wr){case 2:this.$=[];break;case 3:(!Array.isArray(Le[Pe])||Le[Pe].length>0)&&Le[Pe-1].push(Le[Pe]),this.$=Le[Pe-1];break;case 4:case 183:this.$=Le[Pe];break;case 11:wt.setDirection("TB"),this.$="TB";break;case 12:wt.setDirection(Le[Pe-1]),this.$=Le[Pe-1];break;case 27:this.$=Le[Pe-1].nodes;break;case 28:case 29:case 30:case 31:case 32:this.$=[];break;case 33:this.$=wt.addSubGraph(Le[Pe-6],Le[Pe-1],Le[Pe-4]);break;case 34:this.$=wt.addSubGraph(Le[Pe-3],Le[Pe-1],Le[Pe-3]);break;case 35:this.$=wt.addSubGraph(void 0,Le[Pe-1],void 0);break;case 37:this.$=Le[Pe].trim(),wt.setAccTitle(this.$);break;case 38:case 39:this.$=Le[Pe].trim(),wt.setAccDescription(this.$);break;case 43:this.$=Le[Pe-1]+Le[Pe];break;case 44:this.$=Le[Pe];break;case 45:wt.addVertex(Le[Pe-1][Le[Pe-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Le[Pe]),wt.addLink(Le[Pe-3].stmt,Le[Pe-1],Le[Pe-2]),this.$={stmt:Le[Pe-1],nodes:Le[Pe-1].concat(Le[Pe-3].nodes)};break;case 46:wt.addLink(Le[Pe-2].stmt,Le[Pe],Le[Pe-1]),this.$={stmt:Le[Pe],nodes:Le[Pe].concat(Le[Pe-2].nodes)};break;case 47:wt.addLink(Le[Pe-3].stmt,Le[Pe-1],Le[Pe-2]),this.$={stmt:Le[Pe-1],nodes:Le[Pe-1].concat(Le[Pe-3].nodes)};break;case 48:this.$={stmt:Le[Pe-1],nodes:Le[Pe-1]};break;case 49:wt.addVertex(Le[Pe-1][Le[Pe-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Le[Pe]),this.$={stmt:Le[Pe-1],nodes:Le[Pe-1],shapeData:Le[Pe]};break;case 50:this.$={stmt:Le[Pe],nodes:Le[Pe]};break;case 51:this.$=[Le[Pe]];break;case 52:wt.addVertex(Le[Pe-5][Le[Pe-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Le[Pe-4]),this.$=Le[Pe-5].concat(Le[Pe]);break;case 53:this.$=Le[Pe-4].concat(Le[Pe]);break;case 54:this.$=Le[Pe];break;case 55:this.$=Le[Pe-2],wt.setClass(Le[Pe-2],Le[Pe]);break;case 56:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"square");break;case 57:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"doublecircle");break;case 58:this.$=Le[Pe-5],wt.addVertex(Le[Pe-5],Le[Pe-2],"circle");break;case 59:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"ellipse");break;case 60:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"stadium");break;case 61:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"subroutine");break;case 62:this.$=Le[Pe-7],wt.addVertex(Le[Pe-7],Le[Pe-1],"rect",void 0,void 0,void 0,Object.fromEntries([[Le[Pe-5],Le[Pe-3]]]));break;case 63:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"cylinder");break;case 64:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"round");break;case 65:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"diamond");break;case 66:this.$=Le[Pe-5],wt.addVertex(Le[Pe-5],Le[Pe-2],"hexagon");break;case 67:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"odd");break;case 68:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"trapezoid");break;case 69:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"inv_trapezoid");break;case 70:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"lean_right");break;case 71:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"lean_left");break;case 72:this.$=Le[Pe],wt.addVertex(Le[Pe]);break;case 73:Le[Pe-1].text=Le[Pe],this.$=Le[Pe-1];break;case 74:case 75:Le[Pe-2].text=Le[Pe-1],this.$=Le[Pe-2];break;case 76:this.$=Le[Pe];break;case 77:var qr=wt.destructLink(Le[Pe],Le[Pe-2]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length,text:Le[Pe-1]};break;case 78:var qr=wt.destructLink(Le[Pe],Le[Pe-2]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length,text:Le[Pe-1],id:Le[Pe-3]};break;case 79:this.$={text:Le[Pe],type:"text"};break;case 80:this.$={text:Le[Pe-1].text+""+Le[Pe],type:Le[Pe-1].type};break;case 81:this.$={text:Le[Pe],type:"string"};break;case 82:this.$={text:Le[Pe],type:"markdown"};break;case 83:var qr=wt.destructLink(Le[Pe]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length};break;case 84:var qr=wt.destructLink(Le[Pe]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length,id:Le[Pe-1]};break;case 85:this.$=Le[Pe-1];break;case 86:this.$={text:Le[Pe],type:"text"};break;case 87:this.$={text:Le[Pe-1].text+""+Le[Pe],type:Le[Pe-1].type};break;case 88:this.$={text:Le[Pe],type:"string"};break;case 89:case 104:this.$={text:Le[Pe],type:"markdown"};break;case 101:this.$={text:Le[Pe],type:"text"};break;case 102:this.$={text:Le[Pe-1].text+""+Le[Pe],type:Le[Pe-1].type};break;case 103:this.$={text:Le[Pe],type:"text"};break;case 105:this.$=Le[Pe-4],wt.addClass(Le[Pe-2],Le[Pe]);break;case 106:this.$=Le[Pe-4],wt.setClass(Le[Pe-2],Le[Pe]);break;case 107:case 115:this.$=Le[Pe-1],wt.setClickEvent(Le[Pe-1],Le[Pe]);break;case 108:case 116:this.$=Le[Pe-3],wt.setClickEvent(Le[Pe-3],Le[Pe-2]),wt.setTooltip(Le[Pe-3],Le[Pe]);break;case 109:this.$=Le[Pe-2],wt.setClickEvent(Le[Pe-2],Le[Pe-1],Le[Pe]);break;case 110:this.$=Le[Pe-4],wt.setClickEvent(Le[Pe-4],Le[Pe-3],Le[Pe-2]),wt.setTooltip(Le[Pe-4],Le[Pe]);break;case 111:this.$=Le[Pe-2],wt.setLink(Le[Pe-2],Le[Pe]);break;case 112:this.$=Le[Pe-4],wt.setLink(Le[Pe-4],Le[Pe-2]),wt.setTooltip(Le[Pe-4],Le[Pe]);break;case 113:this.$=Le[Pe-4],wt.setLink(Le[Pe-4],Le[Pe-2],Le[Pe]);break;case 114:this.$=Le[Pe-6],wt.setLink(Le[Pe-6],Le[Pe-4],Le[Pe]),wt.setTooltip(Le[Pe-6],Le[Pe-2]);break;case 117:this.$=Le[Pe-1],wt.setLink(Le[Pe-1],Le[Pe]);break;case 118:this.$=Le[Pe-3],wt.setLink(Le[Pe-3],Le[Pe-2]),wt.setTooltip(Le[Pe-3],Le[Pe]);break;case 119:this.$=Le[Pe-3],wt.setLink(Le[Pe-3],Le[Pe-2],Le[Pe]);break;case 120:this.$=Le[Pe-5],wt.setLink(Le[Pe-5],Le[Pe-4],Le[Pe]),wt.setTooltip(Le[Pe-5],Le[Pe-2]);break;case 121:this.$=Le[Pe-4],wt.addVertex(Le[Pe-2],void 0,void 0,Le[Pe]);break;case 122:this.$=Le[Pe-4],wt.updateLink([Le[Pe-2]],Le[Pe]);break;case 123:this.$=Le[Pe-4],wt.updateLink(Le[Pe-2],Le[Pe]);break;case 124:this.$=Le[Pe-8],wt.updateLinkInterpolate([Le[Pe-6]],Le[Pe-2]),wt.updateLink([Le[Pe-6]],Le[Pe]);break;case 125:this.$=Le[Pe-8],wt.updateLinkInterpolate(Le[Pe-6],Le[Pe-2]),wt.updateLink(Le[Pe-6],Le[Pe]);break;case 126:this.$=Le[Pe-6],wt.updateLinkInterpolate([Le[Pe-4]],Le[Pe]);break;case 127:this.$=Le[Pe-6],wt.updateLinkInterpolate(Le[Pe-4],Le[Pe]);break;case 128:case 130:this.$=[Le[Pe]];break;case 129:case 131:Le[Pe-2].push(Le[Pe]),this.$=Le[Pe-2];break;case 133:this.$=Le[Pe-1]+Le[Pe];break;case 181:this.$=Le[Pe];break;case 182:this.$=Le[Pe-1]+""+Le[Pe];break;case 184:this.$=Le[Pe-1]+""+Le[Pe];break;case 185:this.$={stmt:"dir",value:"TB"};break;case 186:this.$={stmt:"dir",value:"BT"};break;case 187:this.$={stmt:"dir",value:"RL"};break;case 188:this.$={stmt:"dir",value:"LR"};break;case 189:this.$={stmt:"dir",value:"TD"};break}},"anonymous"),table:[{3:1,4:2,9:t,10:r,12:n},{1:[3]},e(i,a,{5:6}),{4:7,9:t,10:r,12:n},{4:8,9:t,10:r,12:n},{13:[1,9],14:[1,10]},{1:[2,1],6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},e(i,[2,9]),e(i,[2,10]),e(i,[2,11]),{8:[1,55],9:[1,56],10:$,15:54,18:57},e(F,[2,3]),e(F,[2,4]),e(F,[2,5]),e(F,[2,6]),e(F,[2,7]),e(F,[2,8]),{8:q,9:G,11:z,21:59,41:60,72:64,75:[1,65],77:[1,67],78:[1,66]},{8:q,9:G,11:z,21:68},{8:q,9:G,11:z,21:69},{8:q,9:G,11:z,21:70},{8:q,9:G,11:z,21:71},{8:q,9:G,11:z,21:72},{8:q,9:G,10:[1,73],11:z,21:74},e(F,[2,36]),{35:[1,75]},{37:[1,76]},e(F,[2,39]),e(H,[2,50],{18:77,39:78,10:$,40:j}),{10:[1,80]},{10:[1,81]},{10:[1,82]},{10:[1,83]},{14:J,44:U,60:le,80:[1,87],89:ee,95:[1,84],97:[1,85],101:86,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe,120:88},e(F,[2,185]),e(F,[2,186]),e(F,[2,187]),e(F,[2,188]),e(F,[2,189]),e(Ge,[2,51]),e(Ge,[2,54],{46:[1,100]}),e(fe,[2,72],{113:113,29:[1,101],44:m,48:[1,102],50:[1,103],52:[1,104],54:[1,105],56:[1,106],58:[1,107],60:g,63:[1,108],65:[1,109],67:[1,110],68:[1,111],70:[1,112],89:T,102:k,105:S,106:E,109:I,111:L,114:O,115:R,116:A}),e(Ce,[2,181]),e(Ce,[2,142]),e(Ce,[2,143]),e(Ce,[2,144]),e(Ce,[2,145]),e(Ce,[2,146]),e(Ce,[2,147]),e(Ce,[2,148]),e(Ce,[2,149]),e(Ce,[2,150]),e(Ce,[2,151]),e(Ce,[2,152]),e(i,[2,12]),e(i,[2,18]),e(i,[2,19]),{9:[1,114]},e(_e,[2,26],{18:115,10:$}),e(F,[2,27]),{42:116,43:39,44:m,45:40,47:41,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(F,[2,40]),e(F,[2,41]),e(F,[2,42]),e(de,[2,76],{73:117,62:[1,119],74:[1,118]}),{76:120,79:121,80:ie,81:Q,116:he,119:xe},{75:[1,126],77:[1,127]},e(ce,[2,83]),e(F,[2,28]),e(F,[2,29]),e(F,[2,30]),e(F,[2,31]),e(F,[2,32]),{10:ge,12:Ie,14:ye,27:ne,28:128,32:V,44:pe,60:K,75:ve,80:[1,130],81:[1,131],83:141,84:Z,85:je,86:Ne,87:ze,88:Fe,89:Ke,90:Ve,91:129,105:tt,109:We,111:rt,114:Se,115:Et,116:De},e(mt,a,{5:154}),e(F,[2,37]),e(F,[2,38]),e(H,[2,48],{44:Tt}),e(H,[2,49],{18:156,10:$,40:jt}),e(Ge,[2,44]),{44:m,47:158,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{102:[1,159],103:160,105:[1,161]},{44:m,47:162,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{44:m,47:163,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(_t,[2,107],{10:[1,164],96:[1,165]}),{80:[1,166]},e(_t,[2,115],{120:168,10:[1,167],14:J,44:U,60:le,89:ee,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe}),e(_t,[2,117],{10:[1,169]}),e(Rt,[2,183]),e(Rt,[2,170]),e(Rt,[2,171]),e(Rt,[2,172]),e(Rt,[2,173]),e(Rt,[2,174]),e(Rt,[2,175]),e(Rt,[2,176]),e(Rt,[2,177]),e(Rt,[2,178]),e(Rt,[2,179]),e(Rt,[2,180]),{44:m,47:170,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{30:171,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:179,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:181,50:[1,180],67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:182,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:183,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:184,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{109:[1,185]},{30:186,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:187,65:[1,188],67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:189,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:190,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:191,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},e(Ce,[2,182]),e(i,[2,20]),e(_e,[2,25]),e(H,[2,46],{39:192,18:193,10:$,40:j}),e(de,[2,73],{10:[1,194]}),{10:[1,195]},{30:196,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{77:[1,197],79:198,116:he,119:xe},e(ut,[2,79]),e(ut,[2,81]),e(ut,[2,82]),e(ut,[2,168]),e(ut,[2,169]),{76:199,79:121,80:ie,81:Q,116:he,119:xe},e(ce,[2,84]),{8:q,9:G,10:ge,11:z,12:Ie,14:ye,21:201,27:ne,29:[1,200],32:V,44:pe,60:K,75:ve,83:141,84:Z,85:je,86:Ne,87:ze,88:Fe,89:Ke,90:Ve,91:202,105:tt,109:We,111:rt,114:Se,115:Et,116:De},e(at,[2,101]),e(at,[2,103]),e(at,[2,104]),e(at,[2,157]),e(at,[2,158]),e(at,[2,159]),e(at,[2,160]),e(at,[2,161]),e(at,[2,162]),e(at,[2,163]),e(at,[2,164]),e(at,[2,165]),e(at,[2,166]),e(at,[2,167]),e(at,[2,90]),e(at,[2,91]),e(at,[2,92]),e(at,[2,93]),e(at,[2,94]),e(at,[2,95]),e(at,[2,96]),e(at,[2,97]),e(at,[2,98]),e(at,[2,99]),e(at,[2,100]),{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,203],33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},{10:$,18:204},{44:[1,205]},e(Ge,[2,43]),{10:[1,206],44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:113,114:O,115:R,116:A},{10:[1,207]},{10:[1,208],106:[1,209]},e(dt,[2,128]),{10:[1,210],44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:113,114:O,115:R,116:A},{10:[1,211],44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:113,114:O,115:R,116:A},{80:[1,212]},e(_t,[2,109],{10:[1,213]}),e(_t,[2,111],{10:[1,214]}),{80:[1,215]},e(Rt,[2,184]),{80:[1,216],98:[1,217]},e(Ge,[2,55],{113:113,44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,114:O,115:R,116:A}),{31:[1,218],67:bt,82:219,116:xt,117:it,118:Me},e(tr,[2,86]),e(tr,[2,88]),e(tr,[2,89]),e(tr,[2,153]),e(tr,[2,154]),e(tr,[2,155]),e(tr,[2,156]),{49:[1,220],67:bt,82:219,116:xt,117:it,118:Me},{30:221,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{51:[1,222],67:bt,82:219,116:xt,117:it,118:Me},{53:[1,223],67:bt,82:219,116:xt,117:it,118:Me},{55:[1,224],67:bt,82:219,116:xt,117:it,118:Me},{57:[1,225],67:bt,82:219,116:xt,117:it,118:Me},{60:[1,226]},{64:[1,227],67:bt,82:219,116:xt,117:it,118:Me},{66:[1,228],67:bt,82:219,116:xt,117:it,118:Me},{30:229,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{31:[1,230],67:bt,82:219,116:xt,117:it,118:Me},{67:bt,69:[1,231],71:[1,232],82:219,116:xt,117:it,118:Me},{67:bt,69:[1,234],71:[1,233],82:219,116:xt,117:it,118:Me},e(H,[2,45],{18:156,10:$,40:jt}),e(H,[2,47],{44:Tt}),e(de,[2,75]),e(de,[2,74]),{62:[1,235],67:bt,82:219,116:xt,117:it,118:Me},e(de,[2,77]),e(ut,[2,80]),{77:[1,236],79:198,116:he,119:xe},{30:237,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},e(mt,a,{5:238}),e(at,[2,102]),e(F,[2,35]),{43:239,44:m,45:40,47:41,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{10:$,18:240},{10:Vt,60:rr,84:Dr,92:241,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{10:Vt,60:rr,84:Dr,92:252,104:[1,253],105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{10:Vt,60:rr,84:Dr,92:254,104:[1,255],105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{105:[1,256]},{10:Vt,60:rr,84:Dr,92:257,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{44:m,47:258,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(_t,[2,108]),{80:[1,259]},{80:[1,260],98:[1,261]},e(_t,[2,116]),e(_t,[2,118],{10:[1,262]}),e(_t,[2,119]),e(fe,[2,56]),e(tr,[2,87]),e(fe,[2,57]),{51:[1,263],67:bt,82:219,116:xt,117:it,118:Me},e(fe,[2,64]),e(fe,[2,59]),e(fe,[2,60]),e(fe,[2,61]),{109:[1,264]},e(fe,[2,63]),e(fe,[2,65]),{66:[1,265],67:bt,82:219,116:xt,117:it,118:Me},e(fe,[2,67]),e(fe,[2,68]),e(fe,[2,70]),e(fe,[2,69]),e(fe,[2,71]),e([10,44,60,89,102,105,106,109,111,114,115,116],[2,85]),e(de,[2,78]),{31:[1,266],67:bt,82:219,116:xt,117:it,118:Me},{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,267],33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},e(Ge,[2,53]),{43:268,44:m,45:40,47:41,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(_t,[2,121],{106:St}),e(Ir,[2,130],{108:270,10:Vt,60:rr,84:Dr,105:vr,109:Qt,110:yr,111:lt,112:pt}),e(ur,[2,132]),e(ur,[2,134]),e(ur,[2,135]),e(ur,[2,136]),e(ur,[2,137]),e(ur,[2,138]),e(ur,[2,139]),e(ur,[2,140]),e(ur,[2,141]),e(_t,[2,122],{106:St}),{10:[1,271]},e(_t,[2,123],{106:St}),{10:[1,272]},e(dt,[2,129]),e(_t,[2,105],{106:St}),e(_t,[2,106],{113:113,44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,114:O,115:R,116:A}),e(_t,[2,110]),e(_t,[2,112],{10:[1,273]}),e(_t,[2,113]),{98:[1,274]},{51:[1,275]},{62:[1,276]},{66:[1,277]},{8:q,9:G,11:z,21:278},e(F,[2,34]),e(Ge,[2,52]),{10:Vt,60:rr,84:Dr,105:vr,107:279,108:243,109:Qt,110:yr,111:lt,112:pt},e(ur,[2,133]),{14:J,44:U,60:le,89:ee,101:280,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe,120:88},{14:J,44:U,60:le,89:ee,101:281,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe,120:88},{98:[1,282]},e(_t,[2,120]),e(fe,[2,58]),{30:283,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},e(fe,[2,66]),e(mt,a,{5:284}),e(Ir,[2,131],{108:270,10:Vt,60:rr,84:Dr,105:vr,109:Qt,110:yr,111:lt,112:pt}),e(_t,[2,126],{120:168,10:[1,285],14:J,44:U,60:le,89:ee,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe}),e(_t,[2,127],{120:168,10:[1,286],14:J,44:U,60:le,89:ee,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe}),e(_t,[2,114]),{31:[1,287],67:bt,82:219,116:xt,117:it,118:Me},{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,288],33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},{10:Vt,60:rr,84:Dr,92:289,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{10:Vt,60:rr,84:Dr,92:290,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},e(fe,[2,62]),e(F,[2,33]),e(_t,[2,124],{106:St}),e(_t,[2,125],{106:St})],defaultActions:{},parseError:b(function(kt,zt){if(zt.recoverable)this.trace(kt);else{var Wt=new Error(kt);throw Wt.hash=zt,Wt}},"parseError"),parse:b(function(kt){var zt=this,Wt=[0],wt=[],wr=[null],Le=[],Ri=this.table,Pe="",qr=0,Ha=0,Ku=0,Ad=2,Sp=1,X2=Le.slice.call(arguments,1),ta=Object.create(this.lexer),Zo={yy:{}};for(var _d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_d)&&(Zo.yy[_d]=this.yy[_d]);ta.setInput(kt,Zo.yy),Zo.yy.lexer=ta,Zo.yy.parser=this,typeof ta.yylloc>"u"&&(ta.yylloc={});var Gt=ta.yylloc;Le.push(Gt);var $e=ta.options&&ta.options.ranges;typeof Zo.yy.parseError=="function"?this.parseError=Zo.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function nt(bc){Wt.length=Wt.length-2*bc,wr.length=wr.length-bc,Le.length=Le.length-bc}b(nt,"popStack");function Ht(){var bc;return bc=wt.pop()||ta.lex()||Sp,typeof bc!="number"&&(bc instanceof Array&&(wt=bc,bc=wt.pop()),bc=zt.symbols_[bc]||bc),bc}b(Ht,"lex");for(var er,yn,xn,ii,Da,_o,Rs={},Ep,Wi,xoe,aE;;){if(xn=Wt[Wt.length-1],this.defaultActions[xn]?ii=this.defaultActions[xn]:((er===null||typeof er>"u")&&(er=Ht()),ii=Ri[xn]&&Ri[xn][er]),typeof ii>"u"||!ii.length||!ii[0]){var hP="";aE=[];for(Ep in Ri[xn])this.terminals_[Ep]&&Ep>Ad&&aE.push("'"+this.terminals_[Ep]+"'");ta.showPosition?hP="Parse error on line "+(qr+1)+`: +You have to call mermaid.initialize.`)}isLinkData(e){return e!==null&&typeof e=="object"&&"id"in e&&typeof e.id=="string"}addLink(e,t,r){let n=this.isLinkData(r)?r.id.replace("@",""):void 0;se.info("addLink",e,t,n);for(let i of e)for(let a of t){let s=i===e[e.length-1],o=a===t[0];s&&o?this.addSingleLink(i,a,r,n):this.addSingleLink(i,a,r,void 0)}}updateLinkInterpolate(e,t){e.forEach(r=>{r==="default"?this.edges.defaultInterpolate=t:this.edges[r].interpolate=t})}updateLink(e,t){e.forEach(r=>{if(typeof r=="number"&&r>=this.edges.length)throw new Error(`The index ${r} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);r==="default"?this.edges.defaultStyle=t:(this.edges[r].style=t,(this.edges[r]?.style?.length??0)>0&&!this.edges[r]?.style?.some(n=>n?.startsWith("fill"))&&this.edges[r]?.style?.push("fill:none"))})}addClass(e,t){let r=t.join().replace(/\\,/g,"\xA7\xA7\xA7").replace(/,/g,";").replace(/§§§/g,",").split(";");e.split(",").forEach(n=>{let i=this.classes.get(n);i===void 0&&(i={id:n,styles:[],textStyles:[]},this.classes.set(n,i)),r?.forEach(a=>{if(/color/.exec(a)){let s=a.replace("fill","bgFill");i.textStyles.push(s)}i.styles.push(a)})})}setDirection(e){this.direction=e.trim(),/.*/.exec(this.direction)&&(this.direction="LR"),/.*v/.exec(this.direction)&&(this.direction="TB"),this.direction==="TD"&&(this.direction="TB")}setClass(e,t){for(let r of e.split(",")){let n=this.vertices.get(r);n&&n.classes.push(t);let i=this.edges.find(s=>s.id===r);i&&i.classes.push(t);let a=this.subGraphLookup.get(r);a&&a.classes.push(t)}}setTooltip(e,t){if(t!==void 0){t=this.sanitizeText(t);for(let r of e.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(r):r,t)}}setClickFun(e,t,r){if(Be().securityLevel!=="loose"||t===void 0)return;let n=[];if(typeof r=="string"){n=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let a=0;a{let a=this.lookUpDomId(e),s=document.querySelector(`[id="${a}"]`);s!==null&&s.addEventListener("click",()=>{pr.runFunc(t,...n)},!1)}))}setLink(e,t,r){e.split(",").forEach(n=>{let i=this.vertices.get(n);i!==void 0&&(i.link=pr.formatUrl(t,this.config),i.linkTarget=r)}),this.setClass(e,"clickable")}getTooltip(e){return this.tooltips.get(e)}setClickEvent(e,t,r){e.split(",").forEach(n=>{this.setClickFun(n,t,r)}),this.setClass(e,"clickable")}bindFunctions(e){this.funs.forEach(t=>{t(e)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}getClasses(){return this.classes}setupToolTips(e){let t=iw();ct(e).select("svg").selectAll("g.node").on("mouseover",i=>{let a=ct(i.currentTarget),s=a.attr("title");if(s===null)return;let o=i.currentTarget?.getBoundingClientRect();t.transition().duration(200).style("opacity",".9"),t.text(a.attr("title")).style("left",window.scrollX+o.left+(o.right-o.left)/2+"px").style("top",window.scrollY+o.bottom+"px"),t.html(Yl.sanitize(s)),a.classed("hover",!0)}).on("mouseout",i=>{t.transition().duration(500).style("opacity",0),ct(i.currentTarget).classed("hover",!1)})}clear(e="gen-2"){this.vertices=new Map,this.classes=new Map,this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.diagramId="",this.subGraphs=[],this.subGraphLookup=new Map,this.subCount=0,this.tooltips=new Map,this.firstGraphFlag=!0,this.version=e,this.config=Be(),Nr()}setGen(e){this.version=e||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(e,t,r){let n=e.text.trim(),i=r.text;e===r&&/\s/.exec(r.text)&&(n=void 0);let s=b(p=>{let m={boolean:{},number:{},string:{}},g=[],y;return{nodeList:p.filter(function(x){let w=typeof x;return x.stmt&&x.stmt==="dir"?(y=x.value,!1):x.trim()===""?!1:w in m?m[w].hasOwnProperty(x)?!1:m[w][x]=!0:g.includes(x)?!1:g.push(x)}),dir:y}},"uniq")(t.flat()),o=s.nodeList,l=s.dir,u=l!==void 0,h=Be().flowchart??{},f=l??(h.inheritDir?this.getDirection()??Be().direction??void 0:void 0);if(this.version==="gen-1")for(let p=0;p2e3)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=t,this.subGraphs[t].id===e)return{result:!0,count:0};let n=0,i=1;for(;n=0){let s=this.indexNodes2(e,a);if(s.result)return{result:!0,count:i+s.count};i=i+s.count}n=n+1}return{result:!1,count:i}}getDepthFirstPos(e){return this.posCrossRef[e]}indexNodes(){this.secCount=-1,this.subGraphs.length>0&&this.indexNodes2("none",this.subGraphs.length-1)}getSubGraphs(){return this.subGraphs}firstGraph(){return this.firstGraphFlag?(this.firstGraphFlag=!1,!0):!1}destructStartLink(e){let t=e.trim(),r="arrow_open";switch(t[0]){case"<":r="arrow_point",t=t.slice(1);break;case"x":r="arrow_cross",t=t.slice(1);break;case"o":r="arrow_circle",t=t.slice(1);break}let n="normal";return t.includes("=")&&(n="thick"),t.includes(".")&&(n="dotted"),{type:r,stroke:n}}countChar(e,t){let r=t.length,n=0;for(let i=0;i":n="arrow_point",t.startsWith("<")&&(n="double_"+n,r=r.slice(1));break;case"o":n="arrow_circle",t.startsWith("o")&&(n="double_"+n,r=r.slice(1));break}let i="normal",a=r.length-1;r.startsWith("=")&&(i="thick"),r.startsWith("~")&&(i="invisible");let s=this.countChar(".",r);return s&&(i="dotted",a=s),{type:n,stroke:i,length:a}}destructLink(e,t){let r=this.destructEndLink(e),n;if(t){if(n=this.destructStartLink(t),n.stroke!==r.stroke)return{type:"INVALID",stroke:"INVALID"};if(n.type==="arrow_open")n.type=r.type;else{if(n.type!==r.type)return{type:"INVALID",stroke:"INVALID"};n.type="double_"+n.type}return n.type==="double_arrow"&&(n.type="double_arrow_point"),n.length=r.length,n}return r}exists(e,t){for(let r of e)if(r.nodes.includes(t))return!0;return!1}makeUniq(e,t){let r=[];return e.nodes.forEach((n,i)=>{this.exists(t,n)||r.push(e.nodes[i])}),{nodes:r}}getTypeFromVertex(e){if(e.img)return"imageSquare";if(e.icon)return e.form==="circle"?"iconCircle":e.form==="square"?"iconSquare":e.form==="rounded"?"iconRounded":"icon";switch(e.type){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return e.type}}findNode(e,t){return e.find(r=>r.id===t)}destructEdgeType(e){let t="none",r="arrow_point";switch(e){case"arrow_point":case"arrow_circle":case"arrow_cross":r=e;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":t=e.replace("double_",""),r=t;break}return{arrowTypeStart:t,arrowTypeEnd:r}}addNodeFromVertex(e,t,r,n,i,a){let s=r.get(e.id),o=n.get(e.id)??!1,l=this.findNode(t,e.id);if(l)l.cssStyles=e.styles,l.cssCompiledStyles=this.getCompiledStyles(e.classes),l.cssClasses=e.classes.join(" ");else{let u={id:e.id,label:e.text,labelType:e.labelType,labelStyle:"",parentId:s,padding:i.flowchart?.padding||8,cssStyles:e.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...e.classes]),cssClasses:"default "+e.classes.join(" "),dir:e.dir,domId:e.domId,look:a,link:e.link,linkTarget:e.linkTarget,tooltip:this.getTooltip(e.id),icon:e.icon,pos:e.pos,img:e.img,assetWidth:e.assetWidth,assetHeight:e.assetHeight,constraint:e.constraint};o?t.push({...u,isGroup:!0,shape:"rect"}):t.push({...u,isGroup:!1,shape:this.getTypeFromVertex(e)})}}getCompiledStyles(e){let t=[];for(let r of e){let n=this.classes.get(r);n?.styles&&(t=[...t,...n.styles??[]].map(i=>i.trim())),n?.textStyles&&(t=[...t,...n.textStyles??[]].map(i=>i.trim()))}return t}getData(){let e=Be(),t=[],r=[],n=this.getSubGraphs(),i=new Map,a=new Map;for(let l=n.length-1;l>=0;l--){let u=n[l];u.nodes.length>0&&a.set(u.id,!0);for(let h of u.nodes)i.set(h,u.id)}for(let l=n.length-1;l>=0;l--){let u=n[l];t.push({id:u.id,label:u.title,labelStyle:"",labelType:u.labelType,parentId:i.get(u.id),padding:8,cssCompiledStyles:this.getCompiledStyles(u.classes),cssClasses:u.classes.join(" "),shape:"rect",dir:u.dir==="TD"?"TB":u.dir,explicitDir:u.hasExplicitDir,isGroup:!0,look:e.look})}this.getVertices().forEach(l=>{this.addNodeFromVertex(l,t,i,a,e,e.look||"classic")});let o=this.getEdges();return o.forEach((l,u)=>{let{arrowTypeStart:h,arrowTypeEnd:f}=this.destructEdgeType(l.type),d=[...o.defaultStyle??[]];l.style&&d.push(...l.style);let p={id:zf(l.start,l.end,{counter:u,prefix:"L"},l.id),isUserDefinedId:l.isUserDefinedId,start:l.start,end:l.end,type:l.type??"normal",label:l.text,labelType:l.labelType,labelpos:"c",thickness:l.stroke,minlen:l.length,classes:l?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:l?.stroke==="invisible"||l?.type==="arrow_open"?"none":h,arrowTypeEnd:l?.stroke==="invisible"||l?.type==="arrow_open"?"none":f,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(l.classes),labelStyle:d,style:d,pattern:l.stroke,look:e.look,animate:l.animate,animation:l.animation,curve:l.interpolate||this.edges.defaultInterpolate||e.flowchart?.curve};r.push(p)}),{nodes:t,edges:r,other:{},config:e}}defaultConfig(){return l9.flowchart}},SDt=b(function(e,t){return t.db.getClasses()},"getClasses"),EDt=b(async function(e,t,r,n,i){se.info("REF0:"),se.info("Drawing state diagram (v2)",t);let{securityLevel:a,flowchart:s,layout:o}=Be();n.db.setDiagramId(t),se.debug("Before getData: ");let l=n.db.getData();se.debug("Data: ",l);let u=zu(t,a),h=n.db.getDirection();l.type=n.type,l.layoutAlgorithm=td(o),l.layoutAlgorithm==="dagre"&&o==="elk"&&se.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."),l.direction=h,l.nodeSpacing=s?.nodeSpacing||50,l.rankSpacing=s?.rankSpacing||50,l.markers=["point","circle","cross"],l.diagramId=t,se.debug("REF1:",l),await Ou(l,u,i);let f=l.config.flowchart?.diagramPadding??8;pr.insertTitle(u,"flowchartTitleText",s?.titleTopMargin||0,n.db.getDiagramTitle()),oc(u,f,"flowchart",s?.useMaxWidth||!1)},"draw"),ADt={getClasses:SDt,draw:EDt},XZ=(function(){var e=b(function(Ft,kt,zt,Wt){for(zt=zt||{},Wt=Ft.length;Wt--;zt[Ft[Wt]]=kt);return zt},"o"),t=[1,4],r=[1,3],n=[1,5],i=[1,8,9,10,11,27,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],a=[2,2],s=[1,13],o=[1,14],l=[1,15],u=[1,16],h=[1,23],f=[1,25],d=[1,26],p=[1,27],m=[1,50],g=[1,49],y=[1,29],v=[1,30],x=[1,31],w=[1,32],C=[1,33],T=[1,45],k=[1,47],S=[1,43],E=[1,48],I=[1,44],L=[1,51],O=[1,46],R=[1,52],A=[1,53],N=[1,34],M=[1,35],D=[1,36],B=[1,37],P=[1,38],$=[1,58],F=[1,8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],q=[1,62],G=[1,61],z=[1,63],H=[8,9,11,75,77,78],j=[1,79],J=[1,92],U=[1,97],le=[1,96],ee=[1,93],ue=[1,89],ae=[1,95],oe=[1,91],Re=[1,98],Te=[1,94],Oe=[1,99],qe=[1,90],Ge=[8,9,10,11,40,75,77,78],fe=[8,9,10,11,40,46,75,77,78],Ce=[8,9,10,11,29,40,44,46,48,50,52,54,56,58,60,63,65,67,68,70,75,77,78,89,102,105,106,109,111,114,115,116],_e=[8,9,11,44,60,75,77,78,89,102,105,106,109,111,114,115,116],de=[44,60,89,102,105,106,109,111,114,115,116],ie=[1,122],Q=[1,123],he=[1,125],xe=[1,124],ce=[44,60,62,74,89,102,105,106,109,111,114,115,116],ge=[1,134],Ie=[1,148],ye=[1,149],ne=[1,150],V=[1,151],pe=[1,136],K=[1,138],ve=[1,142],Z=[1,143],je=[1,144],Ne=[1,145],ze=[1,146],Fe=[1,147],Ke=[1,152],Ve=[1,153],tt=[1,132],We=[1,133],rt=[1,140],Se=[1,135],Et=[1,139],De=[1,137],mt=[8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],Tt=[1,155],jt=[1,157],_t=[8,9,11],Rt=[8,9,10,11,14,44,60,89,105,106,109,111,114,115,116],bt=[1,177],ke=[1,173],yt=[1,174],xt=[1,178],it=[1,175],Me=[1,176],ut=[77,116,119],at=[8,9,10,11,12,14,27,29,32,44,60,75,84,85,86,87,88,89,90,105,109,111,114,115,116],dt=[10,106],tr=[31,49,51,53,55,57,62,64,66,67,69,71,116,117,118],Vt=[1,248],rr=[1,246],Dr=[1,250],vr=[1,244],Qt=[1,245],yr=[1,247],lt=[1,249],pt=[1,251],St=[1,269],Ir=[8,9,11,106],ur=[8,9,10,11,60,84,105,106,109,110,111,112],gn={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,SEMI:8,NEWLINE:9,SPACE:10,EOF:11,GRAPH:12,NODIR:13,DIR:14,FirstStmtSeparator:15,ending:16,endToken:17,spaceList:18,spaceListNewline:19,vertexStatement:20,separator:21,styleStatement:22,linkStyleStatement:23,classDefStatement:24,classStatement:25,clickStatement:26,subgraph:27,textNoTags:28,SQS:29,text:30,SQE:31,end:32,direction:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,shapeData:39,SHAPE_DATA:40,link:41,node:42,styledVertex:43,AMP:44,vertex:45,STYLE_SEPARATOR:46,idString:47,DOUBLECIRCLESTART:48,DOUBLECIRCLEEND:49,PS:50,PE:51,"(-":52,"-)":53,STADIUMSTART:54,STADIUMEND:55,SUBROUTINESTART:56,SUBROUTINEEND:57,VERTEX_WITH_PROPS_START:58,"NODE_STRING[field]":59,COLON:60,"NODE_STRING[value]":61,PIPE:62,CYLINDERSTART:63,CYLINDEREND:64,DIAMOND_START:65,DIAMOND_STOP:66,TAGEND:67,TRAPSTART:68,TRAPEND:69,INVTRAPSTART:70,INVTRAPEND:71,linkStatement:72,arrowText:73,TESTSTR:74,START_LINK:75,edgeText:76,LINK:77,LINK_ID:78,edgeTextToken:79,STR:80,MD_STR:81,textToken:82,keywords:83,STYLE:84,LINKSTYLE:85,CLASSDEF:86,CLASS:87,CLICK:88,DOWN:89,UP:90,textNoTagsToken:91,stylesOpt:92,"idString[vertex]":93,"idString[class]":94,CALLBACKNAME:95,CALLBACKARGS:96,HREF:97,LINK_TARGET:98,"STR[link]":99,"STR[tooltip]":100,alphaNum:101,DEFAULT:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,NODE_STRING:109,UNIT:110,BRKT:111,PCT:112,idStringToken:113,MINUS:114,MULT:115,UNICODE_TEXT:116,TEXT:117,TAGSTART:118,EDGE_TEXT:119,alphaNumToken:120,direction_tb:121,direction_bt:122,direction_rl:123,direction_lr:124,direction_td:125,$accept:0,$end:1},terminals_:{2:"error",8:"SEMI",9:"NEWLINE",10:"SPACE",11:"EOF",12:"GRAPH",13:"NODIR",14:"DIR",27:"subgraph",29:"SQS",31:"SQE",32:"end",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",40:"SHAPE_DATA",44:"AMP",46:"STYLE_SEPARATOR",48:"DOUBLECIRCLESTART",49:"DOUBLECIRCLEEND",50:"PS",51:"PE",52:"(-",53:"-)",54:"STADIUMSTART",55:"STADIUMEND",56:"SUBROUTINESTART",57:"SUBROUTINEEND",58:"VERTEX_WITH_PROPS_START",59:"NODE_STRING[field]",60:"COLON",61:"NODE_STRING[value]",62:"PIPE",63:"CYLINDERSTART",64:"CYLINDEREND",65:"DIAMOND_START",66:"DIAMOND_STOP",67:"TAGEND",68:"TRAPSTART",69:"TRAPEND",70:"INVTRAPSTART",71:"INVTRAPEND",74:"TESTSTR",75:"START_LINK",77:"LINK",78:"LINK_ID",80:"STR",81:"MD_STR",84:"STYLE",85:"LINKSTYLE",86:"CLASSDEF",87:"CLASS",88:"CLICK",89:"DOWN",90:"UP",93:"idString[vertex]",94:"idString[class]",95:"CALLBACKNAME",96:"CALLBACKARGS",97:"HREF",98:"LINK_TARGET",99:"STR[link]",100:"STR[tooltip]",102:"DEFAULT",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"NODE_STRING",110:"UNIT",111:"BRKT",112:"PCT",114:"MINUS",115:"MULT",116:"UNICODE_TEXT",117:"TEXT",118:"TAGSTART",119:"EDGE_TEXT",121:"direction_tb",122:"direction_bt",123:"direction_rl",124:"direction_lr",125:"direction_td"},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,3],[16,2],[16,1],[17,1],[17,1],[17,1],[15,1],[15,1],[15,2],[19,2],[19,2],[19,1],[19,1],[18,2],[18,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,6],[7,4],[7,1],[7,2],[7,2],[7,1],[21,1],[21,1],[21,1],[39,2],[39,1],[20,4],[20,3],[20,4],[20,2],[20,2],[20,1],[42,1],[42,6],[42,5],[43,1],[43,3],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,8],[45,4],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,4],[45,4],[45,1],[41,2],[41,3],[41,3],[41,1],[41,3],[41,4],[76,1],[76,2],[76,1],[76,1],[72,1],[72,2],[73,3],[30,1],[30,2],[30,1],[30,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[28,1],[28,2],[28,1],[28,1],[24,5],[25,5],[26,2],[26,4],[26,3],[26,5],[26,3],[26,5],[26,5],[26,7],[26,2],[26,4],[26,2],[26,4],[26,4],[26,6],[22,5],[23,5],[23,5],[23,9],[23,9],[23,7],[23,7],[103,1],[103,3],[92,1],[92,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[82,1],[82,1],[82,1],[82,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[79,1],[79,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[47,1],[47,2],[101,1],[101,2],[33,1],[33,1],[33,1],[33,1],[33,1]],performAction:b(function(kt,zt,Wt,wt,wr,Le,Ri){var Pe=Le.length-1;switch(wr){case 2:this.$=[];break;case 3:(!Array.isArray(Le[Pe])||Le[Pe].length>0)&&Le[Pe-1].push(Le[Pe]),this.$=Le[Pe-1];break;case 4:case 183:this.$=Le[Pe];break;case 11:wt.setDirection("TB"),this.$="TB";break;case 12:wt.setDirection(Le[Pe-1]),this.$=Le[Pe-1];break;case 27:this.$=Le[Pe-1].nodes;break;case 28:case 29:case 30:case 31:case 32:this.$=[];break;case 33:this.$=wt.addSubGraph(Le[Pe-6],Le[Pe-1],Le[Pe-4]);break;case 34:this.$=wt.addSubGraph(Le[Pe-3],Le[Pe-1],Le[Pe-3]);break;case 35:this.$=wt.addSubGraph(void 0,Le[Pe-1],void 0);break;case 37:this.$=Le[Pe].trim(),wt.setAccTitle(this.$);break;case 38:case 39:this.$=Le[Pe].trim(),wt.setAccDescription(this.$);break;case 43:this.$=Le[Pe-1]+Le[Pe];break;case 44:this.$=Le[Pe];break;case 45:wt.addVertex(Le[Pe-1][Le[Pe-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Le[Pe]),wt.addLink(Le[Pe-3].stmt,Le[Pe-1],Le[Pe-2]),this.$={stmt:Le[Pe-1],nodes:Le[Pe-1].concat(Le[Pe-3].nodes)};break;case 46:wt.addLink(Le[Pe-2].stmt,Le[Pe],Le[Pe-1]),this.$={stmt:Le[Pe],nodes:Le[Pe].concat(Le[Pe-2].nodes)};break;case 47:wt.addLink(Le[Pe-3].stmt,Le[Pe-1],Le[Pe-2]),this.$={stmt:Le[Pe-1],nodes:Le[Pe-1].concat(Le[Pe-3].nodes)};break;case 48:this.$={stmt:Le[Pe-1],nodes:Le[Pe-1]};break;case 49:wt.addVertex(Le[Pe-1][Le[Pe-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Le[Pe]),this.$={stmt:Le[Pe-1],nodes:Le[Pe-1],shapeData:Le[Pe]};break;case 50:this.$={stmt:Le[Pe],nodes:Le[Pe]};break;case 51:this.$=[Le[Pe]];break;case 52:wt.addVertex(Le[Pe-5][Le[Pe-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Le[Pe-4]),this.$=Le[Pe-5].concat(Le[Pe]);break;case 53:this.$=Le[Pe-4].concat(Le[Pe]);break;case 54:this.$=Le[Pe];break;case 55:this.$=Le[Pe-2],wt.setClass(Le[Pe-2],Le[Pe]);break;case 56:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"square");break;case 57:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"doublecircle");break;case 58:this.$=Le[Pe-5],wt.addVertex(Le[Pe-5],Le[Pe-2],"circle");break;case 59:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"ellipse");break;case 60:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"stadium");break;case 61:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"subroutine");break;case 62:this.$=Le[Pe-7],wt.addVertex(Le[Pe-7],Le[Pe-1],"rect",void 0,void 0,void 0,Object.fromEntries([[Le[Pe-5],Le[Pe-3]]]));break;case 63:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"cylinder");break;case 64:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"round");break;case 65:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"diamond");break;case 66:this.$=Le[Pe-5],wt.addVertex(Le[Pe-5],Le[Pe-2],"hexagon");break;case 67:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"odd");break;case 68:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"trapezoid");break;case 69:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"inv_trapezoid");break;case 70:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"lean_right");break;case 71:this.$=Le[Pe-3],wt.addVertex(Le[Pe-3],Le[Pe-1],"lean_left");break;case 72:this.$=Le[Pe],wt.addVertex(Le[Pe]);break;case 73:Le[Pe-1].text=Le[Pe],this.$=Le[Pe-1];break;case 74:case 75:Le[Pe-2].text=Le[Pe-1],this.$=Le[Pe-2];break;case 76:this.$=Le[Pe];break;case 77:var qr=wt.destructLink(Le[Pe],Le[Pe-2]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length,text:Le[Pe-1]};break;case 78:var qr=wt.destructLink(Le[Pe],Le[Pe-2]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length,text:Le[Pe-1],id:Le[Pe-3]};break;case 79:this.$={text:Le[Pe],type:"text"};break;case 80:this.$={text:Le[Pe-1].text+""+Le[Pe],type:Le[Pe-1].type};break;case 81:this.$={text:Le[Pe],type:"string"};break;case 82:this.$={text:Le[Pe],type:"markdown"};break;case 83:var qr=wt.destructLink(Le[Pe]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length};break;case 84:var qr=wt.destructLink(Le[Pe]);this.$={type:qr.type,stroke:qr.stroke,length:qr.length,id:Le[Pe-1]};break;case 85:this.$=Le[Pe-1];break;case 86:this.$={text:Le[Pe],type:"text"};break;case 87:this.$={text:Le[Pe-1].text+""+Le[Pe],type:Le[Pe-1].type};break;case 88:this.$={text:Le[Pe],type:"string"};break;case 89:case 104:this.$={text:Le[Pe],type:"markdown"};break;case 101:this.$={text:Le[Pe],type:"text"};break;case 102:this.$={text:Le[Pe-1].text+""+Le[Pe],type:Le[Pe-1].type};break;case 103:this.$={text:Le[Pe],type:"text"};break;case 105:this.$=Le[Pe-4],wt.addClass(Le[Pe-2],Le[Pe]);break;case 106:this.$=Le[Pe-4],wt.setClass(Le[Pe-2],Le[Pe]);break;case 107:case 115:this.$=Le[Pe-1],wt.setClickEvent(Le[Pe-1],Le[Pe]);break;case 108:case 116:this.$=Le[Pe-3],wt.setClickEvent(Le[Pe-3],Le[Pe-2]),wt.setTooltip(Le[Pe-3],Le[Pe]);break;case 109:this.$=Le[Pe-2],wt.setClickEvent(Le[Pe-2],Le[Pe-1],Le[Pe]);break;case 110:this.$=Le[Pe-4],wt.setClickEvent(Le[Pe-4],Le[Pe-3],Le[Pe-2]),wt.setTooltip(Le[Pe-4],Le[Pe]);break;case 111:this.$=Le[Pe-2],wt.setLink(Le[Pe-2],Le[Pe]);break;case 112:this.$=Le[Pe-4],wt.setLink(Le[Pe-4],Le[Pe-2]),wt.setTooltip(Le[Pe-4],Le[Pe]);break;case 113:this.$=Le[Pe-4],wt.setLink(Le[Pe-4],Le[Pe-2],Le[Pe]);break;case 114:this.$=Le[Pe-6],wt.setLink(Le[Pe-6],Le[Pe-4],Le[Pe]),wt.setTooltip(Le[Pe-6],Le[Pe-2]);break;case 117:this.$=Le[Pe-1],wt.setLink(Le[Pe-1],Le[Pe]);break;case 118:this.$=Le[Pe-3],wt.setLink(Le[Pe-3],Le[Pe-2]),wt.setTooltip(Le[Pe-3],Le[Pe]);break;case 119:this.$=Le[Pe-3],wt.setLink(Le[Pe-3],Le[Pe-2],Le[Pe]);break;case 120:this.$=Le[Pe-5],wt.setLink(Le[Pe-5],Le[Pe-4],Le[Pe]),wt.setTooltip(Le[Pe-5],Le[Pe-2]);break;case 121:this.$=Le[Pe-4],wt.addVertex(Le[Pe-2],void 0,void 0,Le[Pe]);break;case 122:this.$=Le[Pe-4],wt.updateLink([Le[Pe-2]],Le[Pe]);break;case 123:this.$=Le[Pe-4],wt.updateLink(Le[Pe-2],Le[Pe]);break;case 124:this.$=Le[Pe-8],wt.updateLinkInterpolate([Le[Pe-6]],Le[Pe-2]),wt.updateLink([Le[Pe-6]],Le[Pe]);break;case 125:this.$=Le[Pe-8],wt.updateLinkInterpolate(Le[Pe-6],Le[Pe-2]),wt.updateLink(Le[Pe-6],Le[Pe]);break;case 126:this.$=Le[Pe-6],wt.updateLinkInterpolate([Le[Pe-4]],Le[Pe]);break;case 127:this.$=Le[Pe-6],wt.updateLinkInterpolate(Le[Pe-4],Le[Pe]);break;case 128:case 130:this.$=[Le[Pe]];break;case 129:case 131:Le[Pe-2].push(Le[Pe]),this.$=Le[Pe-2];break;case 133:this.$=Le[Pe-1]+Le[Pe];break;case 181:this.$=Le[Pe];break;case 182:this.$=Le[Pe-1]+""+Le[Pe];break;case 184:this.$=Le[Pe-1]+""+Le[Pe];break;case 185:this.$={stmt:"dir",value:"TB"};break;case 186:this.$={stmt:"dir",value:"BT"};break;case 187:this.$={stmt:"dir",value:"RL"};break;case 188:this.$={stmt:"dir",value:"LR"};break;case 189:this.$={stmt:"dir",value:"TD"};break}},"anonymous"),table:[{3:1,4:2,9:t,10:r,12:n},{1:[3]},e(i,a,{5:6}),{4:7,9:t,10:r,12:n},{4:8,9:t,10:r,12:n},{13:[1,9],14:[1,10]},{1:[2,1],6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},e(i,[2,9]),e(i,[2,10]),e(i,[2,11]),{8:[1,55],9:[1,56],10:$,15:54,18:57},e(F,[2,3]),e(F,[2,4]),e(F,[2,5]),e(F,[2,6]),e(F,[2,7]),e(F,[2,8]),{8:q,9:G,11:z,21:59,41:60,72:64,75:[1,65],77:[1,67],78:[1,66]},{8:q,9:G,11:z,21:68},{8:q,9:G,11:z,21:69},{8:q,9:G,11:z,21:70},{8:q,9:G,11:z,21:71},{8:q,9:G,11:z,21:72},{8:q,9:G,10:[1,73],11:z,21:74},e(F,[2,36]),{35:[1,75]},{37:[1,76]},e(F,[2,39]),e(H,[2,50],{18:77,39:78,10:$,40:j}),{10:[1,80]},{10:[1,81]},{10:[1,82]},{10:[1,83]},{14:J,44:U,60:le,80:[1,87],89:ee,95:[1,84],97:[1,85],101:86,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe,120:88},e(F,[2,185]),e(F,[2,186]),e(F,[2,187]),e(F,[2,188]),e(F,[2,189]),e(Ge,[2,51]),e(Ge,[2,54],{46:[1,100]}),e(fe,[2,72],{113:113,29:[1,101],44:m,48:[1,102],50:[1,103],52:[1,104],54:[1,105],56:[1,106],58:[1,107],60:g,63:[1,108],65:[1,109],67:[1,110],68:[1,111],70:[1,112],89:T,102:k,105:S,106:E,109:I,111:L,114:O,115:R,116:A}),e(Ce,[2,181]),e(Ce,[2,142]),e(Ce,[2,143]),e(Ce,[2,144]),e(Ce,[2,145]),e(Ce,[2,146]),e(Ce,[2,147]),e(Ce,[2,148]),e(Ce,[2,149]),e(Ce,[2,150]),e(Ce,[2,151]),e(Ce,[2,152]),e(i,[2,12]),e(i,[2,18]),e(i,[2,19]),{9:[1,114]},e(_e,[2,26],{18:115,10:$}),e(F,[2,27]),{42:116,43:39,44:m,45:40,47:41,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(F,[2,40]),e(F,[2,41]),e(F,[2,42]),e(de,[2,76],{73:117,62:[1,119],74:[1,118]}),{76:120,79:121,80:ie,81:Q,116:he,119:xe},{75:[1,126],77:[1,127]},e(ce,[2,83]),e(F,[2,28]),e(F,[2,29]),e(F,[2,30]),e(F,[2,31]),e(F,[2,32]),{10:ge,12:Ie,14:ye,27:ne,28:128,32:V,44:pe,60:K,75:ve,80:[1,130],81:[1,131],83:141,84:Z,85:je,86:Ne,87:ze,88:Fe,89:Ke,90:Ve,91:129,105:tt,109:We,111:rt,114:Se,115:Et,116:De},e(mt,a,{5:154}),e(F,[2,37]),e(F,[2,38]),e(H,[2,48],{44:Tt}),e(H,[2,49],{18:156,10:$,40:jt}),e(Ge,[2,44]),{44:m,47:158,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{102:[1,159],103:160,105:[1,161]},{44:m,47:162,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{44:m,47:163,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(_t,[2,107],{10:[1,164],96:[1,165]}),{80:[1,166]},e(_t,[2,115],{120:168,10:[1,167],14:J,44:U,60:le,89:ee,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe}),e(_t,[2,117],{10:[1,169]}),e(Rt,[2,183]),e(Rt,[2,170]),e(Rt,[2,171]),e(Rt,[2,172]),e(Rt,[2,173]),e(Rt,[2,174]),e(Rt,[2,175]),e(Rt,[2,176]),e(Rt,[2,177]),e(Rt,[2,178]),e(Rt,[2,179]),e(Rt,[2,180]),{44:m,47:170,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{30:171,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:179,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:181,50:[1,180],67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:182,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:183,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:184,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{109:[1,185]},{30:186,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:187,65:[1,188],67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:189,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:190,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{30:191,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},e(Ce,[2,182]),e(i,[2,20]),e(_e,[2,25]),e(H,[2,46],{39:192,18:193,10:$,40:j}),e(de,[2,73],{10:[1,194]}),{10:[1,195]},{30:196,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{77:[1,197],79:198,116:he,119:xe},e(ut,[2,79]),e(ut,[2,81]),e(ut,[2,82]),e(ut,[2,168]),e(ut,[2,169]),{76:199,79:121,80:ie,81:Q,116:he,119:xe},e(ce,[2,84]),{8:q,9:G,10:ge,11:z,12:Ie,14:ye,21:201,27:ne,29:[1,200],32:V,44:pe,60:K,75:ve,83:141,84:Z,85:je,86:Ne,87:ze,88:Fe,89:Ke,90:Ve,91:202,105:tt,109:We,111:rt,114:Se,115:Et,116:De},e(at,[2,101]),e(at,[2,103]),e(at,[2,104]),e(at,[2,157]),e(at,[2,158]),e(at,[2,159]),e(at,[2,160]),e(at,[2,161]),e(at,[2,162]),e(at,[2,163]),e(at,[2,164]),e(at,[2,165]),e(at,[2,166]),e(at,[2,167]),e(at,[2,90]),e(at,[2,91]),e(at,[2,92]),e(at,[2,93]),e(at,[2,94]),e(at,[2,95]),e(at,[2,96]),e(at,[2,97]),e(at,[2,98]),e(at,[2,99]),e(at,[2,100]),{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,203],33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},{10:$,18:204},{44:[1,205]},e(Ge,[2,43]),{10:[1,206],44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:113,114:O,115:R,116:A},{10:[1,207]},{10:[1,208],106:[1,209]},e(dt,[2,128]),{10:[1,210],44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:113,114:O,115:R,116:A},{10:[1,211],44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:113,114:O,115:R,116:A},{80:[1,212]},e(_t,[2,109],{10:[1,213]}),e(_t,[2,111],{10:[1,214]}),{80:[1,215]},e(Rt,[2,184]),{80:[1,216],98:[1,217]},e(Ge,[2,55],{113:113,44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,114:O,115:R,116:A}),{31:[1,218],67:bt,82:219,116:xt,117:it,118:Me},e(tr,[2,86]),e(tr,[2,88]),e(tr,[2,89]),e(tr,[2,153]),e(tr,[2,154]),e(tr,[2,155]),e(tr,[2,156]),{49:[1,220],67:bt,82:219,116:xt,117:it,118:Me},{30:221,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{51:[1,222],67:bt,82:219,116:xt,117:it,118:Me},{53:[1,223],67:bt,82:219,116:xt,117:it,118:Me},{55:[1,224],67:bt,82:219,116:xt,117:it,118:Me},{57:[1,225],67:bt,82:219,116:xt,117:it,118:Me},{60:[1,226]},{64:[1,227],67:bt,82:219,116:xt,117:it,118:Me},{66:[1,228],67:bt,82:219,116:xt,117:it,118:Me},{30:229,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},{31:[1,230],67:bt,82:219,116:xt,117:it,118:Me},{67:bt,69:[1,231],71:[1,232],82:219,116:xt,117:it,118:Me},{67:bt,69:[1,234],71:[1,233],82:219,116:xt,117:it,118:Me},e(H,[2,45],{18:156,10:$,40:jt}),e(H,[2,47],{44:Tt}),e(de,[2,75]),e(de,[2,74]),{62:[1,235],67:bt,82:219,116:xt,117:it,118:Me},e(de,[2,77]),e(ut,[2,80]),{77:[1,236],79:198,116:he,119:xe},{30:237,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},e(mt,a,{5:238}),e(at,[2,102]),e(F,[2,35]),{43:239,44:m,45:40,47:41,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},{10:$,18:240},{10:Vt,60:rr,84:Dr,92:241,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{10:Vt,60:rr,84:Dr,92:252,104:[1,253],105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{10:Vt,60:rr,84:Dr,92:254,104:[1,255],105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{105:[1,256]},{10:Vt,60:rr,84:Dr,92:257,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{44:m,47:258,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(_t,[2,108]),{80:[1,259]},{80:[1,260],98:[1,261]},e(_t,[2,116]),e(_t,[2,118],{10:[1,262]}),e(_t,[2,119]),e(fe,[2,56]),e(tr,[2,87]),e(fe,[2,57]),{51:[1,263],67:bt,82:219,116:xt,117:it,118:Me},e(fe,[2,64]),e(fe,[2,59]),e(fe,[2,60]),e(fe,[2,61]),{109:[1,264]},e(fe,[2,63]),e(fe,[2,65]),{66:[1,265],67:bt,82:219,116:xt,117:it,118:Me},e(fe,[2,67]),e(fe,[2,68]),e(fe,[2,70]),e(fe,[2,69]),e(fe,[2,71]),e([10,44,60,89,102,105,106,109,111,114,115,116],[2,85]),e(de,[2,78]),{31:[1,266],67:bt,82:219,116:xt,117:it,118:Me},{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,267],33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},e(Ge,[2,53]),{43:268,44:m,45:40,47:41,60:g,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A},e(_t,[2,121],{106:St}),e(Ir,[2,130],{108:270,10:Vt,60:rr,84:Dr,105:vr,109:Qt,110:yr,111:lt,112:pt}),e(ur,[2,132]),e(ur,[2,134]),e(ur,[2,135]),e(ur,[2,136]),e(ur,[2,137]),e(ur,[2,138]),e(ur,[2,139]),e(ur,[2,140]),e(ur,[2,141]),e(_t,[2,122],{106:St}),{10:[1,271]},e(_t,[2,123],{106:St}),{10:[1,272]},e(dt,[2,129]),e(_t,[2,105],{106:St}),e(_t,[2,106],{113:113,44:m,60:g,89:T,102:k,105:S,106:E,109:I,111:L,114:O,115:R,116:A}),e(_t,[2,110]),e(_t,[2,112],{10:[1,273]}),e(_t,[2,113]),{98:[1,274]},{51:[1,275]},{62:[1,276]},{66:[1,277]},{8:q,9:G,11:z,21:278},e(F,[2,34]),e(Ge,[2,52]),{10:Vt,60:rr,84:Dr,105:vr,107:279,108:243,109:Qt,110:yr,111:lt,112:pt},e(ur,[2,133]),{14:J,44:U,60:le,89:ee,101:280,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe,120:88},{14:J,44:U,60:le,89:ee,101:281,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe,120:88},{98:[1,282]},e(_t,[2,120]),e(fe,[2,58]),{30:283,67:bt,80:ke,81:yt,82:172,116:xt,117:it,118:Me},e(fe,[2,66]),e(mt,a,{5:284}),e(Ir,[2,131],{108:270,10:Vt,60:rr,84:Dr,105:vr,109:Qt,110:yr,111:lt,112:pt}),e(_t,[2,126],{120:168,10:[1,285],14:J,44:U,60:le,89:ee,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe}),e(_t,[2,127],{120:168,10:[1,286],14:J,44:U,60:le,89:ee,105:ue,106:ae,109:oe,111:Re,114:Te,115:Oe,116:qe}),e(_t,[2,114]),{31:[1,287],67:bt,82:219,116:xt,117:it,118:Me},{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,288],33:24,34:f,36:d,38:p,42:28,43:39,44:m,45:40,47:41,60:g,84:y,85:v,86:x,87:w,88:C,89:T,102:k,105:S,106:E,109:I,111:L,113:42,114:O,115:R,116:A,121:N,122:M,123:D,124:B,125:P},{10:Vt,60:rr,84:Dr,92:289,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},{10:Vt,60:rr,84:Dr,92:290,105:vr,107:242,108:243,109:Qt,110:yr,111:lt,112:pt},e(fe,[2,62]),e(F,[2,33]),e(_t,[2,124],{106:St}),e(_t,[2,125],{106:St})],defaultActions:{},parseError:b(function(kt,zt){if(zt.recoverable)this.trace(kt);else{var Wt=new Error(kt);throw Wt.hash=zt,Wt}},"parseError"),parse:b(function(kt){var zt=this,Wt=[0],wt=[],wr=[null],Le=[],Ri=this.table,Pe="",qr=0,Ha=0,Ku=0,Ad=2,Sp=1,X2=Le.slice.call(arguments,1),ta=Object.create(this.lexer),Qo={yy:{}};for(var _d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_d)&&(Qo.yy[_d]=this.yy[_d]);ta.setInput(kt,Qo.yy),Qo.yy.lexer=ta,Qo.yy.parser=this,typeof ta.yylloc>"u"&&(ta.yylloc={});var Gt=ta.yylloc;Le.push(Gt);var $e=ta.options&&ta.options.ranges;typeof Qo.yy.parseError=="function"?this.parseError=Qo.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function nt(bc){Wt.length=Wt.length-2*bc,wr.length=wr.length-bc,Le.length=Le.length-bc}b(nt,"popStack");function Ht(){var bc;return bc=wt.pop()||ta.lex()||Sp,typeof bc!="number"&&(bc instanceof Array&&(wt=bc,bc=wt.pop()),bc=zt.symbols_[bc]||bc),bc}b(Ht,"lex");for(var er,yn,xn,ii,Da,_o,Rs={},Ep,Wi,woe,aE;;){if(xn=Wt[Wt.length-1],this.defaultActions[xn]?ii=this.defaultActions[xn]:((er===null||typeof er>"u")&&(er=Ht()),ii=Ri[xn]&&Ri[xn][er]),typeof ii>"u"||!ii.length||!ii[0]){var dP="";aE=[];for(Ep in Ri[xn])this.terminals_[Ep]&&Ep>Ad&&aE.push("'"+this.terminals_[Ep]+"'");ta.showPosition?dP="Parse error on line "+(qr+1)+`: `+ta.showPosition()+` -Expecting `+aE.join(", ")+", got '"+(this.terminals_[er]||er)+"'":hP="Parse error on line "+(qr+1)+": Unexpected "+(er==Sp?"end of input":"'"+(this.terminals_[er]||er)+"'"),this.parseError(hP,{text:ta.match,token:this.terminals_[er]||er,line:ta.yylineno,loc:Gt,expected:aE})}if(ii[0]instanceof Array&&ii.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xn+", token: "+er);switch(ii[0]){case 1:Wt.push(er),wr.push(ta.yytext),Le.push(ta.yylloc),Wt.push(ii[1]),er=null,yn?(er=yn,yn=null):(Ha=ta.yyleng,Pe=ta.yytext,qr=ta.yylineno,Gt=ta.yylloc,Ku>0&&Ku--);break;case 2:if(Wi=this.productions_[ii[1]][1],Rs.$=wr[wr.length-Wi],Rs._$={first_line:Le[Le.length-(Wi||1)].first_line,last_line:Le[Le.length-1].last_line,first_column:Le[Le.length-(Wi||1)].first_column,last_column:Le[Le.length-1].last_column},$e&&(Rs._$.range=[Le[Le.length-(Wi||1)].range[0],Le[Le.length-1].range[1]]),_o=this.performAction.apply(Rs,[Pe,Ha,qr,Zo.yy,ii[1],wr,Le].concat(X2)),typeof _o<"u")return _o;Wi&&(Wt=Wt.slice(0,-1*Wi*2),wr=wr.slice(0,-1*Wi),Le=Le.slice(0,-1*Wi)),Wt.push(this.productions_[ii[1]][0]),wr.push(Rs.$),Le.push(Rs._$),xoe=Ri[Wt[Wt.length-2]][Wt[Wt.length-1]],Wt.push(xoe);break;case 3:return!0}}return!0},"parse")},Fn=(function(){var Ft={EOF:1,parseError:b(function(zt,Wt){if(this.yy.parser)this.yy.parser.parseError(zt,Wt);else throw new Error(zt)},"parseError"),setInput:b(function(kt,zt){return this.yy=zt||this.yy||{},this._input=kt,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var kt=this._input[0];this.yytext+=kt,this.yyleng++,this.offset++,this.match+=kt,this.matched+=kt;var zt=kt.match(/(?:\r\n?|\n).*/g);return zt?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),kt},"input"),unput:b(function(kt){var zt=kt.length,Wt=kt.split(/(?:\r\n?|\n)/g);this._input=kt+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-zt),this.offset-=zt;var wt=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Wt.length-1&&(this.yylineno-=Wt.length-1);var wr=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Wt?(Wt.length===wt.length?this.yylloc.first_column:0)+wt[wt.length-Wt.length].length-Wt[0].length:this.yylloc.first_column-zt},this.options.ranges&&(this.yylloc.range=[wr[0],wr[0]+this.yyleng-zt]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +Expecting `+aE.join(", ")+", got '"+(this.terminals_[er]||er)+"'":dP="Parse error on line "+(qr+1)+": Unexpected "+(er==Sp?"end of input":"'"+(this.terminals_[er]||er)+"'"),this.parseError(dP,{text:ta.match,token:this.terminals_[er]||er,line:ta.yylineno,loc:Gt,expected:aE})}if(ii[0]instanceof Array&&ii.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xn+", token: "+er);switch(ii[0]){case 1:Wt.push(er),wr.push(ta.yytext),Le.push(ta.yylloc),Wt.push(ii[1]),er=null,yn?(er=yn,yn=null):(Ha=ta.yyleng,Pe=ta.yytext,qr=ta.yylineno,Gt=ta.yylloc,Ku>0&&Ku--);break;case 2:if(Wi=this.productions_[ii[1]][1],Rs.$=wr[wr.length-Wi],Rs._$={first_line:Le[Le.length-(Wi||1)].first_line,last_line:Le[Le.length-1].last_line,first_column:Le[Le.length-(Wi||1)].first_column,last_column:Le[Le.length-1].last_column},$e&&(Rs._$.range=[Le[Le.length-(Wi||1)].range[0],Le[Le.length-1].range[1]]),_o=this.performAction.apply(Rs,[Pe,Ha,qr,Qo.yy,ii[1],wr,Le].concat(X2)),typeof _o<"u")return _o;Wi&&(Wt=Wt.slice(0,-1*Wi*2),wr=wr.slice(0,-1*Wi),Le=Le.slice(0,-1*Wi)),Wt.push(this.productions_[ii[1]][0]),wr.push(Rs.$),Le.push(Rs._$),woe=Ri[Wt[Wt.length-2]][Wt[Wt.length-1]],Wt.push(woe);break;case 3:return!0}}return!0},"parse")},Fn=(function(){var Ft={EOF:1,parseError:b(function(zt,Wt){if(this.yy.parser)this.yy.parser.parseError(zt,Wt);else throw new Error(zt)},"parseError"),setInput:b(function(kt,zt){return this.yy=zt||this.yy||{},this._input=kt,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var kt=this._input[0];this.yytext+=kt,this.yyleng++,this.offset++,this.match+=kt,this.matched+=kt;var zt=kt.match(/(?:\r\n?|\n).*/g);return zt?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),kt},"input"),unput:b(function(kt){var zt=kt.length,Wt=kt.split(/(?:\r\n?|\n)/g);this._input=kt+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-zt),this.offset-=zt;var wt=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Wt.length-1&&(this.yylineno-=Wt.length-1);var wr=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Wt?(Wt.length===wt.length?this.yylloc.first_column:0)+wt[wt.length-Wt.length].length-Wt[0].length:this.yylloc.first_column-zt},this.options.ranges&&(this.yylloc.range=[wr[0],wr[0]+this.yyleng-zt]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(kt){this.unput(this.match.slice(kt))},"less"),pastInput:b(function(){var kt=this.matched.substr(0,this.matched.length-this.match.length);return(kt.length>20?"...":"")+kt.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var kt=this.match;return kt.length<20&&(kt+=this._input.substr(0,20-kt.length)),(kt.substr(0,20)+(kt.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var kt=this.pastInput(),zt=new Array(kt.length+1).join("-");return kt+this.upcomingInput()+` `+zt+"^"},"showPosition"),test_match:b(function(kt,zt){var Wt,wt,wr;if(this.options.backtrack_lexer&&(wr={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(wr.yylloc.range=this.yylloc.range.slice(0))),wt=kt[0].match(/(?:\r\n?|\n).*/g),wt&&(this.yylineno+=wt.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:wt?wt[wt.length-1].length-wt[wt.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+kt[0].length},this.yytext+=kt[0],this.match+=kt[0],this.matches=kt,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(kt[0].length),this.matched+=kt[0],Wt=this.performAction.call(this,this.yy,this,zt,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Wt)return Wt;if(this._backtrack){for(var Le in wr)this[Le]=wr[Le];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var kt,zt,Wt,wt;this._more||(this.yytext="",this.match="");for(var wr=this._currentRules(),Le=0;Lezt[0].length)){if(zt=Wt,wt=Le,this.options.backtrack_lexer){if(kt=this.test_match(Wt,wr[Le]),kt!==!1)return kt;if(this._backtrack){zt=!1;continue}else return!1}else if(!this.options.flex)break}return zt?(kt=this.test_match(zt,wr[wt]),kt!==!1?kt:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var zt=this.next();return zt||this.lex()},"lex"),begin:b(function(zt){this.conditionStack.push(zt)},"begin"),popState:b(function(){var zt=this.conditionStack.length-1;return zt>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(zt){return zt=this.conditionStack.length-1-Math.abs(zt||0),zt>=0?this.conditionStack[zt]:"INITIAL"},"topState"),pushState:b(function(zt){this.begin(zt)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(zt,Wt,wt,wr){var Le=wr;switch(wt){case 0:return this.begin("acc_title"),34;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),36;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return this.pushState("shapeData"),Wt.yytext="",40;break;case 8:return this.pushState("shapeDataStr"),40;break;case 9:return this.popState(),40;break;case 10:let Ri=/\n\s*/g;return Wt.yytext=Wt.yytext.replace(Ri,"
"),40;break;case 11:return 40;case 12:this.popState();break;case 13:this.begin("callbackname");break;case 14:this.popState();break;case 15:this.popState(),this.begin("callbackargs");break;case 16:return 95;case 17:this.popState();break;case 18:return 96;case 19:return"MD_STR";case 20:this.popState();break;case 21:this.begin("md_string");break;case 22:return"STR";case 23:this.popState();break;case 24:this.pushState("string");break;case 25:return 84;case 26:return 102;case 27:return 85;case 28:return 104;case 29:return 86;case 30:return 87;case 31:return 97;case 32:this.begin("click");break;case 33:this.popState();break;case 34:return 88;case 35:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 36:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 37:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 38:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 39:return 27;case 40:return 32;case 41:return 98;case 42:return 98;case 43:return 98;case 44:return 98;case 45:return this.popState(),13;break;case 46:return this.popState(),14;break;case 47:return this.popState(),14;break;case 48:return this.popState(),14;break;case 49:return this.popState(),14;break;case 50:return this.popState(),14;break;case 51:return this.popState(),14;break;case 52:return this.popState(),14;break;case 53:return this.popState(),14;break;case 54:return this.popState(),14;break;case 55:return this.popState(),14;break;case 56:return 121;case 57:return 122;case 58:return 123;case 59:return 124;case 60:return 125;case 61:return 78;case 62:return 105;case 63:return 111;case 64:return 46;case 65:return 60;case 66:return 44;case 67:return 8;case 68:return 106;case 69:return 115;case 70:return this.popState(),77;break;case 71:return this.pushState("edgeText"),75;break;case 72:return 119;case 73:return this.popState(),77;break;case 74:return this.pushState("thickEdgeText"),75;break;case 75:return 119;case 76:return this.popState(),77;break;case 77:return this.pushState("dottedEdgeText"),75;break;case 78:return 119;case 79:return 77;case 80:return this.popState(),53;break;case 81:return"TEXT";case 82:return this.pushState("ellipseText"),52;break;case 83:return this.popState(),55;break;case 84:return this.pushState("text"),54;break;case 85:return this.popState(),57;break;case 86:return this.pushState("text"),56;break;case 87:return 58;case 88:return this.pushState("text"),67;break;case 89:return this.popState(),64;break;case 90:return this.pushState("text"),63;break;case 91:return this.popState(),49;break;case 92:return this.pushState("text"),48;break;case 93:return this.popState(),69;break;case 94:return this.popState(),71;break;case 95:return 117;case 96:return this.pushState("trapText"),68;break;case 97:return this.pushState("trapText"),70;break;case 98:return 118;case 99:return 67;case 100:return 90;case 101:return"SEP";case 102:return 89;case 103:return 115;case 104:return 111;case 105:return 44;case 106:return 109;case 107:return 114;case 108:return 116;case 109:return this.popState(),62;break;case 110:return this.pushState("text"),62;break;case 111:return this.popState(),51;break;case 112:return this.pushState("text"),50;break;case 113:return this.popState(),31;break;case 114:return this.pushState("text"),29;break;case 115:return this.popState(),66;break;case 116:return this.pushState("text"),65;break;case 117:return"TEXT";case 118:return"QUOTE";case 119:return 9;case 120:return 10;case 121:return 11}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:@\{)/,/^(?:["])/,/^(?:["])/,/^(?:[^\"]+)/,/^(?:[^}^"]+)/,/^(?:\})/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["][`])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:["])/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s])/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:flowchart-elk\b)/,/^(?:swimlane-beta\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:.*direction\s+TD[^\n]*)/,/^(?:[^\s\"]+@(?=[^\{\"]))/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:[^-]|-(?!-)+)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:[^=]|=(?!))/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:[^\.]|\.(?!))/,/^(?:\s*~~[\~]+\s*)/,/^(?:[-/\)][\)])/,/^(?:[^\(\)\[\]\{\}]|!\)+)/,/^(?:\(-)/,/^(?:\]\))/,/^(?:\(\[)/,/^(?:\]\])/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:>)/,/^(?:\)\])/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\(\(\()/,/^(?:[\\(?=\])][\]])/,/^(?:\/(?=\])\])/,/^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:\*)/,/^(?:#)/,/^(?:&)/,/^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/,/^(?:-)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\|)/,/^(?:\))/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:(\}))/,/^(?:\{)/,/^(?:[^\[\]\(\)\{\}\|\"]+)/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{shapeDataEndBracket:{rules:[21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},shapeDataStr:{rules:[9,10,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},shapeData:{rules:[8,11,12,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},callbackargs:{rules:[17,18,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},callbackname:{rules:[14,15,16,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},href:{rules:[21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},click:{rules:[21,24,33,34,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},dottedEdgeText:{rules:[21,24,76,78,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},thickEdgeText:{rules:[21,24,73,75,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},edgeText:{rules:[21,24,70,72,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},trapText:{rules:[21,24,79,82,84,86,90,92,93,94,95,96,97,110,112,114,116],inclusive:!1},ellipseText:{rules:[21,24,79,80,81,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},text:{rules:[21,24,79,82,83,84,85,86,89,90,91,92,96,97,109,110,111,112,113,114,115,116,117],inclusive:!1},vertex:{rules:[21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},dir:{rules:[21,24,45,46,47,48,49,50,51,52,53,54,55,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},acc_descr_multiline:{rules:[5,6,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},acc_descr:{rules:[3,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},acc_title:{rules:[1,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},md_string:{rules:[19,20,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},string:{rules:[21,22,23,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},INITIAL:{rules:[0,2,4,7,13,21,24,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,43,44,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,76,77,79,82,84,86,87,88,90,92,96,97,98,99,100,101,102,103,104,105,106,107,108,110,112,114,116,118,119,120,121],inclusive:!0}}};return Ft})();gn.lexer=Fn;function jr(){this.yy={}}return b(jr,"Parser"),jr.prototype=gn,gn.Parser=jr,new jr})();UZ.parser=UZ;mOe=UZ,gOe=Object.assign({},mOe);gOe.parse=e=>{let t=e.replace(/}\s*\n/g,`} -`);return mOe.parse(t)};CDt=gOe,SDt=b((e,t)=>{let r=ly,n=r(e,"r"),i=r(e,"g"),a=r(e,"b");return $a(n,i,a,t)},"fade"),EDt=b(e=>`.label { +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var zt=this.next();return zt||this.lex()},"lex"),begin:b(function(zt){this.conditionStack.push(zt)},"begin"),popState:b(function(){var zt=this.conditionStack.length-1;return zt>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(zt){return zt=this.conditionStack.length-1-Math.abs(zt||0),zt>=0?this.conditionStack[zt]:"INITIAL"},"topState"),pushState:b(function(zt){this.begin(zt)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(zt,Wt,wt,wr){var Le=wr;switch(wt){case 0:return this.begin("acc_title"),34;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),36;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return this.pushState("shapeData"),Wt.yytext="",40;break;case 8:return this.pushState("shapeDataStr"),40;break;case 9:return this.popState(),40;break;case 10:let Ri=/\n\s*/g;return Wt.yytext=Wt.yytext.replace(Ri,"
"),40;break;case 11:return 40;case 12:this.popState();break;case 13:this.begin("callbackname");break;case 14:this.popState();break;case 15:this.popState(),this.begin("callbackargs");break;case 16:return 95;case 17:this.popState();break;case 18:return 96;case 19:return"MD_STR";case 20:this.popState();break;case 21:this.begin("md_string");break;case 22:return"STR";case 23:this.popState();break;case 24:this.pushState("string");break;case 25:return 84;case 26:return 102;case 27:return 85;case 28:return 104;case 29:return 86;case 30:return 87;case 31:return 97;case 32:this.begin("click");break;case 33:this.popState();break;case 34:return 88;case 35:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 36:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 37:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 38:return zt.lex.firstGraph()&&this.begin("dir"),12;break;case 39:return 27;case 40:return 32;case 41:return 98;case 42:return 98;case 43:return 98;case 44:return 98;case 45:return this.popState(),13;break;case 46:return this.popState(),14;break;case 47:return this.popState(),14;break;case 48:return this.popState(),14;break;case 49:return this.popState(),14;break;case 50:return this.popState(),14;break;case 51:return this.popState(),14;break;case 52:return this.popState(),14;break;case 53:return this.popState(),14;break;case 54:return this.popState(),14;break;case 55:return this.popState(),14;break;case 56:return 121;case 57:return 122;case 58:return 123;case 59:return 124;case 60:return 125;case 61:return 78;case 62:return 105;case 63:return 111;case 64:return 46;case 65:return 60;case 66:return 44;case 67:return 8;case 68:return 106;case 69:return 115;case 70:return this.popState(),77;break;case 71:return this.pushState("edgeText"),75;break;case 72:return 119;case 73:return this.popState(),77;break;case 74:return this.pushState("thickEdgeText"),75;break;case 75:return 119;case 76:return this.popState(),77;break;case 77:return this.pushState("dottedEdgeText"),75;break;case 78:return 119;case 79:return 77;case 80:return this.popState(),53;break;case 81:return"TEXT";case 82:return this.pushState("ellipseText"),52;break;case 83:return this.popState(),55;break;case 84:return this.pushState("text"),54;break;case 85:return this.popState(),57;break;case 86:return this.pushState("text"),56;break;case 87:return 58;case 88:return this.pushState("text"),67;break;case 89:return this.popState(),64;break;case 90:return this.pushState("text"),63;break;case 91:return this.popState(),49;break;case 92:return this.pushState("text"),48;break;case 93:return this.popState(),69;break;case 94:return this.popState(),71;break;case 95:return 117;case 96:return this.pushState("trapText"),68;break;case 97:return this.pushState("trapText"),70;break;case 98:return 118;case 99:return 67;case 100:return 90;case 101:return"SEP";case 102:return 89;case 103:return 115;case 104:return 111;case 105:return 44;case 106:return 109;case 107:return 114;case 108:return 116;case 109:return this.popState(),62;break;case 110:return this.pushState("text"),62;break;case 111:return this.popState(),51;break;case 112:return this.pushState("text"),50;break;case 113:return this.popState(),31;break;case 114:return this.pushState("text"),29;break;case 115:return this.popState(),66;break;case 116:return this.pushState("text"),65;break;case 117:return"TEXT";case 118:return"QUOTE";case 119:return 9;case 120:return 10;case 121:return 11}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:@\{)/,/^(?:["])/,/^(?:["])/,/^(?:[^\"]+)/,/^(?:[^}^"]+)/,/^(?:\})/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["][`])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:["])/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s])/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:flowchart-elk\b)/,/^(?:swimlane-beta\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:.*direction\s+TD[^\n]*)/,/^(?:[^\s\"]+@(?=[^\{\"]))/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:[^-]|-(?!-)+)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:[^=]|=(?!))/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:[^\.]|\.(?!))/,/^(?:\s*~~[\~]+\s*)/,/^(?:[-/\)][\)])/,/^(?:[^\(\)\[\]\{\}]|!\)+)/,/^(?:\(-)/,/^(?:\]\))/,/^(?:\(\[)/,/^(?:\]\])/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:>)/,/^(?:\)\])/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\(\(\()/,/^(?:[\\(?=\])][\]])/,/^(?:\/(?=\])\])/,/^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:\*)/,/^(?:#)/,/^(?:&)/,/^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/,/^(?:-)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\|)/,/^(?:\))/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:(\}))/,/^(?:\{)/,/^(?:[^\[\]\(\)\{\}\|\"]+)/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{shapeDataEndBracket:{rules:[21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},shapeDataStr:{rules:[9,10,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},shapeData:{rules:[8,11,12,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},callbackargs:{rules:[17,18,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},callbackname:{rules:[14,15,16,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},href:{rules:[21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},click:{rules:[21,24,33,34,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},dottedEdgeText:{rules:[21,24,76,78,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},thickEdgeText:{rules:[21,24,73,75,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},edgeText:{rules:[21,24,70,72,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},trapText:{rules:[21,24,79,82,84,86,90,92,93,94,95,96,97,110,112,114,116],inclusive:!1},ellipseText:{rules:[21,24,79,80,81,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},text:{rules:[21,24,79,82,83,84,85,86,89,90,91,92,96,97,109,110,111,112,113,114,115,116,117],inclusive:!1},vertex:{rules:[21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},dir:{rules:[21,24,45,46,47,48,49,50,51,52,53,54,55,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},acc_descr_multiline:{rules:[5,6,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},acc_descr:{rules:[3,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},acc_title:{rules:[1,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},md_string:{rules:[19,20,21,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},string:{rules:[21,22,23,24,79,82,84,86,90,92,96,97,110,112,114,116],inclusive:!1},INITIAL:{rules:[0,2,4,7,13,21,24,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,43,44,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,76,77,79,82,84,86,87,88,90,92,96,97,98,99,100,101,102,103,104,105,106,107,108,110,112,114,116,118,119,120,121],inclusive:!0}}};return Ft})();gn.lexer=Fn;function jr(){this.yy={}}return b(jr,"Parser"),jr.prototype=gn,gn.Parser=jr,new jr})();XZ.parser=XZ;yOe=XZ,vOe=Object.assign({},yOe);vOe.parse=e=>{let t=e.replace(/}\s*\n/g,`} +`);return yOe.parse(t)};_Dt=vOe,RDt=b((e,t)=>{let r=ly,n=r(e,"r"),i=r(e,"g"),a=r(e,"b");return $a(n,i,a,t)},"fade"),LDt=b(e=>`.label { font-family: ${e.fontFamily}; color: ${e.nodeTextColor||e.textColor}; } @@ -992,7 +992,7 @@ Expecting `+aE.join(", ")+", got '"+(this.terminals_[er]||er)+"'":hP="Parse erro /* For html labels only */ .labelBkg { - background-color: ${SDt(e.edgeLabelBackground,.5)}; + background-color: ${RDt(e.edgeLabelBackground,.5)}; // background-color: } @@ -1052,19 +1052,19 @@ Expecting `+aE.join(", ")+", got '"+(this.terminals_[er]||er)+"'":hP="Parse erro text-align: center; } ${id()} -`,"getStyles"),YZ=EDt,tS=b(({defaultLayout:e,styles:t=YZ}={})=>({parser:CDt,get db(){return new bDt},renderer:TDt,styles:t,init:b(r=>{r.flowchart||(r.flowchart={});let n=i9().layout??e??r.layout;n&&P5({layout:n}),r.flowchart.arrowMarkerAbsolute=r.arrowMarkerAbsolute,P5({flowchart:{arrowMarkerAbsolute:r.arrowMarkerAbsolute}})},"init")}),"createFlowDiagram"),yOe=tS()});var OI={};Tr(OI,{createFlowDiagram:()=>tS,diagram:()=>yOe});var PI=W(()=>{XZ();ad();Uc();oc();Gy();ic();Hc();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr()});var vOe={};Tr(vOe,{diagram:()=>RDt});var ADt,_Dt,RDt,xOe=W(()=>{XZ();ad();Uc();oc();Gy();ic();Hc();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();ADt=b(e=>`${YZ(e)} +`,"getStyles"),jZ=LDt,tS=b(({defaultLayout:e,styles:t=jZ}={})=>({parser:_Dt,get db(){return new CDt},renderer:ADt,styles:t,init:b(r=>{r.flowchart||(r.flowchart={});let n=i9().layout??e??r.layout;n&&P5({layout:n}),r.flowchart.arrowMarkerAbsolute=r.arrowMarkerAbsolute,P5({flowchart:{arrowMarkerAbsolute:r.arrowMarkerAbsolute}})},"init")}),"createFlowDiagram"),xOe=tS()});var OI={};Tr(OI,{createFlowDiagram:()=>tS,diagram:()=>xOe});var PI=W(()=>{KZ();ad();Uc();lc();Gy();ac();Hc();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr()});var bOe={};Tr(bOe,{diagram:()=>NDt});var IDt,MDt,NDt,wOe=W(()=>{KZ();ad();Uc();lc();Gy();ac();Hc();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();IDt=b(e=>`${jZ(e)} .swimlane.cluster rect { stroke: ${e.clusterBorder} !important; } [data-look="neo"].cluster rect { filter: none; } -`,"getStyles"),_Dt=ADt,RDt=tS({defaultLayout:"swimlane",styles:_Dt})});var kOe={};Tr(kOe,{diagram:()=>PDt});var jZ,LDt,IDt,wOe,MDt,bOe,BI,NDt,DDt,ODt,PDt,TOe=W(()=>{Uc();oc();ic();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();fn();Ka();jZ=(function(){var e=b(function(Oe,qe,Ge,fe){for(Ge=Ge||{},fe=Oe.length;fe--;Ge[Oe[fe]]=qe);return Ge},"o"),t=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],r=[1,10],n=[1,11],i=[1,12],a=[1,13],s=[1,23],o=[1,24],l=[1,25],u=[1,26],h=[1,27],f=[1,19],d=[1,28],p=[1,29],m=[1,20],g=[1,18],y=[1,21],v=[1,22],x=[1,36],w=[1,37],C=[1,38],T=[1,39],k=[1,40],S=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,66,67,68,69,70],E=[1,45],I=[1,46],L=[1,55],O=[40,48,50,51,52,71,72],R=[1,66],A=[1,64],N=[1,61],M=[1,65],D=[1,67],B=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,66,67,68,69,70],P=[66,67,68,69,70],$=[1,85],F=[1,84],q=[1,82],G=[1,83],z=[6,10,42,47],H=[6,10,13,41,42,47,48,49],j=[1,93],J=[1,92],U=[1,91],le=[19,58],ee=[1,102],ue=[1,101],ae=[19,58,61,63],oe={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,"?":59,attributeKeyType:60,",":61,ATTRIBUTE_KEY:62,COMMENT:63,cardinality:64,relType:65,ZERO_OR_ONE:66,ZERO_OR_MORE:67,ONE_OR_MORE:68,ONLY_ONE:69,MD_PARENT:70,NON_IDENTIFYING:71,IDENTIFYING:72,WORD:73,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",59:"?",61:",",62:"ATTRIBUTE_KEY",63:"COMMENT",66:"ZERO_OR_ONE",67:"ZERO_OR_MORE",68:"ONE_OR_MORE",69:"ONLY_ONE",70:"MD_PARENT",71:"NON_IDENTIFYING",72:"IDENTIFYING",73:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[54,2],[55,1],[56,1],[56,3],[60,1],[57,1],[12,3],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[14,1],[14,1],[14,1]],performAction:b(function(qe,Ge,fe,Ce,_e,de,ie){var Q=de.length-1;switch(_e){case 1:break;case 2:this.$=[];break;case 3:de[Q-1].push(de[Q]),this.$=de[Q-1];break;case 4:case 5:this.$=de[Q];break;case 6:case 7:this.$=[];break;case 8:Ce.addEntity(de[Q-4]),Ce.addEntity(de[Q-2]),Ce.addRelationship(de[Q-4],de[Q],de[Q-2],de[Q-3]);break;case 9:Ce.addEntity(de[Q-8]),Ce.addEntity(de[Q-4]),Ce.addRelationship(de[Q-8],de[Q],de[Q-4],de[Q-5]),Ce.setClass([de[Q-8]],de[Q-6]),Ce.setClass([de[Q-4]],de[Q-2]);break;case 10:Ce.addEntity(de[Q-6]),Ce.addEntity(de[Q-2]),Ce.addRelationship(de[Q-6],de[Q],de[Q-2],de[Q-3]),Ce.setClass([de[Q-6]],de[Q-4]);break;case 11:Ce.addEntity(de[Q-6]),Ce.addEntity(de[Q-4]),Ce.addRelationship(de[Q-6],de[Q],de[Q-4],de[Q-5]),Ce.setClass([de[Q-4]],de[Q-2]);break;case 12:Ce.addEntity(de[Q-3]),Ce.addAttributes(de[Q-3],de[Q-1]);break;case 13:Ce.addEntity(de[Q-5]),Ce.addAttributes(de[Q-5],de[Q-1]),Ce.setClass([de[Q-5]],de[Q-3]);break;case 14:Ce.addEntity(de[Q-2]);break;case 15:Ce.addEntity(de[Q-4]),Ce.setClass([de[Q-4]],de[Q-2]);break;case 16:Ce.addEntity(de[Q]);break;case 17:Ce.addEntity(de[Q-2]),Ce.setClass([de[Q-2]],de[Q]);break;case 18:Ce.addEntity(de[Q-6],de[Q-4]),Ce.addAttributes(de[Q-6],de[Q-1]);break;case 19:Ce.addEntity(de[Q-8],de[Q-6]),Ce.addAttributes(de[Q-8],de[Q-1]),Ce.setClass([de[Q-8]],de[Q-3]);break;case 20:Ce.addEntity(de[Q-5],de[Q-3]);break;case 21:Ce.addEntity(de[Q-7],de[Q-5]),Ce.setClass([de[Q-7]],de[Q-2]);break;case 22:Ce.addEntity(de[Q-3],de[Q-1]);break;case 23:Ce.addEntity(de[Q-5],de[Q-3]),Ce.setClass([de[Q-5]],de[Q]);break;case 24:case 25:this.$=de[Q].trim(),Ce.setAccTitle(this.$);break;case 26:case 27:this.$=de[Q].trim(),Ce.setAccDescription(this.$);break;case 32:Ce.setDirection("TB");break;case 33:Ce.setDirection("BT");break;case 34:Ce.setDirection("RL");break;case 35:Ce.setDirection("LR");break;case 36:this.$=de[Q-3],Ce.addClass(de[Q-2],de[Q-1]);break;case 37:case 38:case 59:case 68:this.$=[de[Q]];break;case 39:case 40:this.$=de[Q-2].concat([de[Q]]);break;case 41:this.$=de[Q-2],Ce.setClass(de[Q-1],de[Q]);break;case 42:this.$=de[Q-3],Ce.addCssStyles(de[Q-2],de[Q-1]);break;case 43:this.$=[de[Q]];break;case 44:de[Q-2].push(de[Q]),this.$=de[Q-2];break;case 46:this.$=de[Q-1]+de[Q];break;case 54:case 80:case 81:this.$=de[Q].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 82:this.$=de[Q];break;case 60:de[Q].push(de[Q-1]),this.$=de[Q];break;case 61:this.$={type:de[Q-1],name:de[Q]};break;case 62:this.$={type:de[Q-2],name:de[Q-1],keys:de[Q]};break;case 63:this.$={type:de[Q-2],name:de[Q-1],comment:de[Q]};break;case 64:this.$={type:de[Q-3],name:de[Q-2],keys:de[Q-1],comment:de[Q]};break;case 65:case 67:case 70:this.$=de[Q];break;case 66:this.$=de[Q-1]+de[Q];break;case 69:de[Q-2].push(de[Q]),this.$=de[Q-2];break;case 71:this.$=de[Q].replace(/"/g,"");break;case 72:this.$={cardA:de[Q],relType:de[Q-1],cardB:de[Q-2]};break;case 73:this.$=Ce.Cardinality.ZERO_OR_ONE;break;case 74:this.$=Ce.Cardinality.ZERO_OR_MORE;break;case 75:this.$=Ce.Cardinality.ONE_OR_MORE;break;case 76:this.$=Ce.Cardinality.ONLY_ONE;break;case 77:this.$=Ce.Cardinality.MD_PARENT;break;case 78:this.$=Ce.Identification.NON_IDENTIFYING;break;case 79:this.$=Ce.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:r,24:n,26:i,28:a,29:14,30:15,31:16,32:17,33:s,34:o,35:l,36:u,37:h,40:f,43:d,44:p,48:m,50:g,51:y,52:v},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:30,11:9,22:r,24:n,26:i,28:a,29:14,30:15,31:16,32:17,33:s,34:o,35:l,36:u,37:h,40:f,43:d,44:p,48:m,50:g,51:y,52:v},e(t,[2,5]),e(t,[2,6]),e(t,[2,16],{12:31,64:35,15:[1,32],17:[1,33],20:[1,34],66:x,67:w,68:C,69:T,70:k}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(t,[2,27]),e(t,[2,28]),e(t,[2,29]),e(t,[2,30]),e(t,[2,31]),e(S,[2,54]),e(S,[2,55]),e(S,[2,56]),e(S,[2,57]),e(S,[2,58]),e(t,[2,32]),e(t,[2,33]),e(t,[2,34]),e(t,[2,35]),{16:44,40:E,41:I},{16:47,40:E,41:I},{16:48,40:E,41:I},e(t,[2,4]),{11:49,40:f,48:m,50:g,51:y,52:v},{16:50,40:E,41:I},{18:51,19:[1,52],53:53,54:54,58:L},{11:56,40:f,48:m,50:g,51:y,52:v},{65:57,71:[1,58],72:[1,59]},e(O,[2,73]),e(O,[2,74]),e(O,[2,75]),e(O,[2,76]),e(O,[2,77]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),{13:R,38:60,41:A,42:N,45:62,46:63,48:M,49:D},e(B,[2,37]),e(B,[2,38]),{16:68,40:E,41:I,42:N},{13:R,38:69,41:A,42:N,45:62,46:63,48:M,49:D},{13:[1,70],15:[1,71]},e(t,[2,17],{64:35,12:72,17:[1,73],42:N,66:x,67:w,68:C,69:T,70:k}),{19:[1,74]},e(t,[2,14]),{18:75,19:[2,59],53:53,54:54,58:L},{55:76,58:[1,77]},{58:[2,65],59:[1,78]},{21:[1,79]},{64:80,66:x,67:w,68:C,69:T,70:k},e(P,[2,78]),e(P,[2,79]),{6:$,10:F,39:81,42:q,47:G},{40:[1,86],41:[1,87]},e(z,[2,43],{46:88,13:R,41:A,48:M,49:D}),e(H,[2,45]),e(H,[2,50]),e(H,[2,51]),e(H,[2,52]),e(H,[2,53]),e(t,[2,41],{42:N}),{6:$,10:F,39:89,42:q,47:G},{14:90,40:j,50:J,73:U},{16:94,40:E,41:I},{11:95,40:f,48:m,50:g,51:y,52:v},{18:96,19:[1,97],53:53,54:54,58:L},e(t,[2,12]),{19:[2,60]},e(le,[2,61],{56:98,57:99,60:100,62:ee,63:ue}),e([19,58,62,63],[2,67]),{58:[2,66]},e(t,[2,22],{15:[1,104],17:[1,103]}),e([40,48,50,51,52],[2,72]),e(t,[2,36]),{13:R,41:A,45:105,46:63,48:M,49:D},e(t,[2,47]),e(t,[2,48]),e(t,[2,49]),e(B,[2,39]),e(B,[2,40]),e(H,[2,46]),e(t,[2,42]),e(t,[2,8]),e(t,[2,80]),e(t,[2,81]),e(t,[2,82]),{13:[1,106],42:N},{13:[1,108],15:[1,107]},{19:[1,109]},e(t,[2,15]),e(le,[2,62],{57:110,61:[1,111],63:ue}),e(le,[2,63]),e(ae,[2,68]),e(le,[2,71]),e(ae,[2,70]),{18:112,19:[1,113],53:53,54:54,58:L},{16:114,40:E,41:I},e(z,[2,44],{46:88,13:R,41:A,48:M,49:D}),{14:115,40:j,50:J,73:U},{16:116,40:E,41:I},{14:117,40:j,50:J,73:U},e(t,[2,13]),e(le,[2,64]),{60:118,62:ee},{19:[1,119]},e(t,[2,20]),e(t,[2,23],{17:[1,120],42:N}),e(t,[2,11]),{13:[1,121],42:N},e(t,[2,10]),e(ae,[2,69]),e(t,[2,18]),{18:122,19:[1,123],53:53,54:54,58:L},{14:124,40:j,50:J,73:U},{19:[1,125]},e(t,[2,21]),e(t,[2,9]),e(t,[2,19])],defaultActions:{75:[2,60],78:[2,66]},parseError:b(function(qe,Ge){if(Ge.recoverable)this.trace(qe);else{var fe=new Error(qe);throw fe.hash=Ge,fe}},"parseError"),parse:b(function(qe){var Ge=this,fe=[0],Ce=[],_e=[null],de=[],ie=this.table,Q="",he=0,xe=0,ce=0,ge=2,Ie=1,ye=de.slice.call(arguments,1),ne=Object.create(this.lexer),V={yy:{}};for(var pe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,pe)&&(V.yy[pe]=this.yy[pe]);ne.setInput(qe,V.yy),V.yy.lexer=ne,V.yy.parser=this,typeof ne.yylloc>"u"&&(ne.yylloc={});var K=ne.yylloc;de.push(K);var ve=ne.options&&ne.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Z(Tt){fe.length=fe.length-2*Tt,_e.length=_e.length-Tt,de.length=de.length-Tt}b(Z,"popStack");function je(){var Tt;return Tt=Ce.pop()||ne.lex()||Ie,typeof Tt!="number"&&(Tt instanceof Array&&(Ce=Tt,Tt=Ce.pop()),Tt=Ge.symbols_[Tt]||Tt),Tt}b(je,"lex");for(var Ne,ze,Fe,Ke,Ve,tt,We={},rt,Se,Et,De;;){if(Fe=fe[fe.length-1],this.defaultActions[Fe]?Ke=this.defaultActions[Fe]:((Ne===null||typeof Ne>"u")&&(Ne=je()),Ke=ie[Fe]&&ie[Fe][Ne]),typeof Ke>"u"||!Ke.length||!Ke[0]){var mt="";De=[];for(rt in ie[Fe])this.terminals_[rt]&&rt>ge&&De.push("'"+this.terminals_[rt]+"'");ne.showPosition?mt="Parse error on line "+(he+1)+`: +`,"getStyles"),MDt=IDt,NDt=tS({defaultLayout:"swimlane",styles:MDt})});var COe={};Tr(COe,{diagram:()=>zDt});var ZZ,DDt,ODt,TOe,PDt,kOe,BI,BDt,FDt,$Dt,zDt,SOe=W(()=>{Uc();lc();ac();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();fn();Ka();ZZ=(function(){var e=b(function(Oe,qe,Ge,fe){for(Ge=Ge||{},fe=Oe.length;fe--;Ge[Oe[fe]]=qe);return Ge},"o"),t=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],r=[1,10],n=[1,11],i=[1,12],a=[1,13],s=[1,23],o=[1,24],l=[1,25],u=[1,26],h=[1,27],f=[1,19],d=[1,28],p=[1,29],m=[1,20],g=[1,18],y=[1,21],v=[1,22],x=[1,36],w=[1,37],C=[1,38],T=[1,39],k=[1,40],S=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,66,67,68,69,70],E=[1,45],I=[1,46],L=[1,55],O=[40,48,50,51,52,71,72],R=[1,66],A=[1,64],N=[1,61],M=[1,65],D=[1,67],B=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,66,67,68,69,70],P=[66,67,68,69,70],$=[1,85],F=[1,84],q=[1,82],G=[1,83],z=[6,10,42,47],H=[6,10,13,41,42,47,48,49],j=[1,93],J=[1,92],U=[1,91],le=[19,58],ee=[1,102],ue=[1,101],ae=[19,58,61,63],oe={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,"?":59,attributeKeyType:60,",":61,ATTRIBUTE_KEY:62,COMMENT:63,cardinality:64,relType:65,ZERO_OR_ONE:66,ZERO_OR_MORE:67,ONE_OR_MORE:68,ONLY_ONE:69,MD_PARENT:70,NON_IDENTIFYING:71,IDENTIFYING:72,WORD:73,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",59:"?",61:",",62:"ATTRIBUTE_KEY",63:"COMMENT",66:"ZERO_OR_ONE",67:"ZERO_OR_MORE",68:"ONE_OR_MORE",69:"ONLY_ONE",70:"MD_PARENT",71:"NON_IDENTIFYING",72:"IDENTIFYING",73:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[54,2],[55,1],[56,1],[56,3],[60,1],[57,1],[12,3],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[14,1],[14,1],[14,1]],performAction:b(function(qe,Ge,fe,Ce,_e,de,ie){var Q=de.length-1;switch(_e){case 1:break;case 2:this.$=[];break;case 3:de[Q-1].push(de[Q]),this.$=de[Q-1];break;case 4:case 5:this.$=de[Q];break;case 6:case 7:this.$=[];break;case 8:Ce.addEntity(de[Q-4]),Ce.addEntity(de[Q-2]),Ce.addRelationship(de[Q-4],de[Q],de[Q-2],de[Q-3]);break;case 9:Ce.addEntity(de[Q-8]),Ce.addEntity(de[Q-4]),Ce.addRelationship(de[Q-8],de[Q],de[Q-4],de[Q-5]),Ce.setClass([de[Q-8]],de[Q-6]),Ce.setClass([de[Q-4]],de[Q-2]);break;case 10:Ce.addEntity(de[Q-6]),Ce.addEntity(de[Q-2]),Ce.addRelationship(de[Q-6],de[Q],de[Q-2],de[Q-3]),Ce.setClass([de[Q-6]],de[Q-4]);break;case 11:Ce.addEntity(de[Q-6]),Ce.addEntity(de[Q-4]),Ce.addRelationship(de[Q-6],de[Q],de[Q-4],de[Q-5]),Ce.setClass([de[Q-4]],de[Q-2]);break;case 12:Ce.addEntity(de[Q-3]),Ce.addAttributes(de[Q-3],de[Q-1]);break;case 13:Ce.addEntity(de[Q-5]),Ce.addAttributes(de[Q-5],de[Q-1]),Ce.setClass([de[Q-5]],de[Q-3]);break;case 14:Ce.addEntity(de[Q-2]);break;case 15:Ce.addEntity(de[Q-4]),Ce.setClass([de[Q-4]],de[Q-2]);break;case 16:Ce.addEntity(de[Q]);break;case 17:Ce.addEntity(de[Q-2]),Ce.setClass([de[Q-2]],de[Q]);break;case 18:Ce.addEntity(de[Q-6],de[Q-4]),Ce.addAttributes(de[Q-6],de[Q-1]);break;case 19:Ce.addEntity(de[Q-8],de[Q-6]),Ce.addAttributes(de[Q-8],de[Q-1]),Ce.setClass([de[Q-8]],de[Q-3]);break;case 20:Ce.addEntity(de[Q-5],de[Q-3]);break;case 21:Ce.addEntity(de[Q-7],de[Q-5]),Ce.setClass([de[Q-7]],de[Q-2]);break;case 22:Ce.addEntity(de[Q-3],de[Q-1]);break;case 23:Ce.addEntity(de[Q-5],de[Q-3]),Ce.setClass([de[Q-5]],de[Q]);break;case 24:case 25:this.$=de[Q].trim(),Ce.setAccTitle(this.$);break;case 26:case 27:this.$=de[Q].trim(),Ce.setAccDescription(this.$);break;case 32:Ce.setDirection("TB");break;case 33:Ce.setDirection("BT");break;case 34:Ce.setDirection("RL");break;case 35:Ce.setDirection("LR");break;case 36:this.$=de[Q-3],Ce.addClass(de[Q-2],de[Q-1]);break;case 37:case 38:case 59:case 68:this.$=[de[Q]];break;case 39:case 40:this.$=de[Q-2].concat([de[Q]]);break;case 41:this.$=de[Q-2],Ce.setClass(de[Q-1],de[Q]);break;case 42:this.$=de[Q-3],Ce.addCssStyles(de[Q-2],de[Q-1]);break;case 43:this.$=[de[Q]];break;case 44:de[Q-2].push(de[Q]),this.$=de[Q-2];break;case 46:this.$=de[Q-1]+de[Q];break;case 54:case 80:case 81:this.$=de[Q].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 82:this.$=de[Q];break;case 60:de[Q].push(de[Q-1]),this.$=de[Q];break;case 61:this.$={type:de[Q-1],name:de[Q]};break;case 62:this.$={type:de[Q-2],name:de[Q-1],keys:de[Q]};break;case 63:this.$={type:de[Q-2],name:de[Q-1],comment:de[Q]};break;case 64:this.$={type:de[Q-3],name:de[Q-2],keys:de[Q-1],comment:de[Q]};break;case 65:case 67:case 70:this.$=de[Q];break;case 66:this.$=de[Q-1]+de[Q];break;case 69:de[Q-2].push(de[Q]),this.$=de[Q-2];break;case 71:this.$=de[Q].replace(/"/g,"");break;case 72:this.$={cardA:de[Q],relType:de[Q-1],cardB:de[Q-2]};break;case 73:this.$=Ce.Cardinality.ZERO_OR_ONE;break;case 74:this.$=Ce.Cardinality.ZERO_OR_MORE;break;case 75:this.$=Ce.Cardinality.ONE_OR_MORE;break;case 76:this.$=Ce.Cardinality.ONLY_ONE;break;case 77:this.$=Ce.Cardinality.MD_PARENT;break;case 78:this.$=Ce.Identification.NON_IDENTIFYING;break;case 79:this.$=Ce.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:r,24:n,26:i,28:a,29:14,30:15,31:16,32:17,33:s,34:o,35:l,36:u,37:h,40:f,43:d,44:p,48:m,50:g,51:y,52:v},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:30,11:9,22:r,24:n,26:i,28:a,29:14,30:15,31:16,32:17,33:s,34:o,35:l,36:u,37:h,40:f,43:d,44:p,48:m,50:g,51:y,52:v},e(t,[2,5]),e(t,[2,6]),e(t,[2,16],{12:31,64:35,15:[1,32],17:[1,33],20:[1,34],66:x,67:w,68:C,69:T,70:k}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(t,[2,27]),e(t,[2,28]),e(t,[2,29]),e(t,[2,30]),e(t,[2,31]),e(S,[2,54]),e(S,[2,55]),e(S,[2,56]),e(S,[2,57]),e(S,[2,58]),e(t,[2,32]),e(t,[2,33]),e(t,[2,34]),e(t,[2,35]),{16:44,40:E,41:I},{16:47,40:E,41:I},{16:48,40:E,41:I},e(t,[2,4]),{11:49,40:f,48:m,50:g,51:y,52:v},{16:50,40:E,41:I},{18:51,19:[1,52],53:53,54:54,58:L},{11:56,40:f,48:m,50:g,51:y,52:v},{65:57,71:[1,58],72:[1,59]},e(O,[2,73]),e(O,[2,74]),e(O,[2,75]),e(O,[2,76]),e(O,[2,77]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),{13:R,38:60,41:A,42:N,45:62,46:63,48:M,49:D},e(B,[2,37]),e(B,[2,38]),{16:68,40:E,41:I,42:N},{13:R,38:69,41:A,42:N,45:62,46:63,48:M,49:D},{13:[1,70],15:[1,71]},e(t,[2,17],{64:35,12:72,17:[1,73],42:N,66:x,67:w,68:C,69:T,70:k}),{19:[1,74]},e(t,[2,14]),{18:75,19:[2,59],53:53,54:54,58:L},{55:76,58:[1,77]},{58:[2,65],59:[1,78]},{21:[1,79]},{64:80,66:x,67:w,68:C,69:T,70:k},e(P,[2,78]),e(P,[2,79]),{6:$,10:F,39:81,42:q,47:G},{40:[1,86],41:[1,87]},e(z,[2,43],{46:88,13:R,41:A,48:M,49:D}),e(H,[2,45]),e(H,[2,50]),e(H,[2,51]),e(H,[2,52]),e(H,[2,53]),e(t,[2,41],{42:N}),{6:$,10:F,39:89,42:q,47:G},{14:90,40:j,50:J,73:U},{16:94,40:E,41:I},{11:95,40:f,48:m,50:g,51:y,52:v},{18:96,19:[1,97],53:53,54:54,58:L},e(t,[2,12]),{19:[2,60]},e(le,[2,61],{56:98,57:99,60:100,62:ee,63:ue}),e([19,58,62,63],[2,67]),{58:[2,66]},e(t,[2,22],{15:[1,104],17:[1,103]}),e([40,48,50,51,52],[2,72]),e(t,[2,36]),{13:R,41:A,45:105,46:63,48:M,49:D},e(t,[2,47]),e(t,[2,48]),e(t,[2,49]),e(B,[2,39]),e(B,[2,40]),e(H,[2,46]),e(t,[2,42]),e(t,[2,8]),e(t,[2,80]),e(t,[2,81]),e(t,[2,82]),{13:[1,106],42:N},{13:[1,108],15:[1,107]},{19:[1,109]},e(t,[2,15]),e(le,[2,62],{57:110,61:[1,111],63:ue}),e(le,[2,63]),e(ae,[2,68]),e(le,[2,71]),e(ae,[2,70]),{18:112,19:[1,113],53:53,54:54,58:L},{16:114,40:E,41:I},e(z,[2,44],{46:88,13:R,41:A,48:M,49:D}),{14:115,40:j,50:J,73:U},{16:116,40:E,41:I},{14:117,40:j,50:J,73:U},e(t,[2,13]),e(le,[2,64]),{60:118,62:ee},{19:[1,119]},e(t,[2,20]),e(t,[2,23],{17:[1,120],42:N}),e(t,[2,11]),{13:[1,121],42:N},e(t,[2,10]),e(ae,[2,69]),e(t,[2,18]),{18:122,19:[1,123],53:53,54:54,58:L},{14:124,40:j,50:J,73:U},{19:[1,125]},e(t,[2,21]),e(t,[2,9]),e(t,[2,19])],defaultActions:{75:[2,60],78:[2,66]},parseError:b(function(qe,Ge){if(Ge.recoverable)this.trace(qe);else{var fe=new Error(qe);throw fe.hash=Ge,fe}},"parseError"),parse:b(function(qe){var Ge=this,fe=[0],Ce=[],_e=[null],de=[],ie=this.table,Q="",he=0,xe=0,ce=0,ge=2,Ie=1,ye=de.slice.call(arguments,1),ne=Object.create(this.lexer),V={yy:{}};for(var pe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,pe)&&(V.yy[pe]=this.yy[pe]);ne.setInput(qe,V.yy),V.yy.lexer=ne,V.yy.parser=this,typeof ne.yylloc>"u"&&(ne.yylloc={});var K=ne.yylloc;de.push(K);var ve=ne.options&&ne.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Z(Tt){fe.length=fe.length-2*Tt,_e.length=_e.length-Tt,de.length=de.length-Tt}b(Z,"popStack");function je(){var Tt;return Tt=Ce.pop()||ne.lex()||Ie,typeof Tt!="number"&&(Tt instanceof Array&&(Ce=Tt,Tt=Ce.pop()),Tt=Ge.symbols_[Tt]||Tt),Tt}b(je,"lex");for(var Ne,ze,Fe,Ke,Ve,tt,We={},rt,Se,Et,De;;){if(Fe=fe[fe.length-1],this.defaultActions[Fe]?Ke=this.defaultActions[Fe]:((Ne===null||typeof Ne>"u")&&(Ne=je()),Ke=ie[Fe]&&ie[Fe][Ne]),typeof Ke>"u"||!Ke.length||!Ke[0]){var mt="";De=[];for(rt in ie[Fe])this.terminals_[rt]&&rt>ge&&De.push("'"+this.terminals_[rt]+"'");ne.showPosition?mt="Parse error on line "+(he+1)+`: `+ne.showPosition()+` Expecting `+De.join(", ")+", got '"+(this.terminals_[Ne]||Ne)+"'":mt="Parse error on line "+(he+1)+": Unexpected "+(Ne==Ie?"end of input":"'"+(this.terminals_[Ne]||Ne)+"'"),this.parseError(mt,{text:ne.match,token:this.terminals_[Ne]||Ne,line:ne.yylineno,loc:K,expected:De})}if(Ke[0]instanceof Array&&Ke.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Fe+", token: "+Ne);switch(Ke[0]){case 1:fe.push(Ne),_e.push(ne.yytext),de.push(ne.yylloc),fe.push(Ke[1]),Ne=null,ze?(Ne=ze,ze=null):(xe=ne.yyleng,Q=ne.yytext,he=ne.yylineno,K=ne.yylloc,ce>0&&ce--);break;case 2:if(Se=this.productions_[Ke[1]][1],We.$=_e[_e.length-Se],We._$={first_line:de[de.length-(Se||1)].first_line,last_line:de[de.length-1].last_line,first_column:de[de.length-(Se||1)].first_column,last_column:de[de.length-1].last_column},ve&&(We._$.range=[de[de.length-(Se||1)].range[0],de[de.length-1].range[1]]),tt=this.performAction.apply(We,[Q,xe,he,V.yy,Ke[1],_e,de].concat(ye)),typeof tt<"u")return tt;Se&&(fe=fe.slice(0,-1*Se*2),_e=_e.slice(0,-1*Se),de=de.slice(0,-1*Se)),fe.push(this.productions_[Ke[1]][0]),_e.push(We.$),de.push(We._$),Et=ie[fe[fe.length-2]][fe[fe.length-1]],fe.push(Et);break;case 3:return!0}}return!0},"parse")},Re=(function(){var Oe={EOF:1,parseError:b(function(Ge,fe){if(this.yy.parser)this.yy.parser.parseError(Ge,fe);else throw new Error(Ge)},"parseError"),setInput:b(function(qe,Ge){return this.yy=Ge||this.yy||{},this._input=qe,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var qe=this._input[0];this.yytext+=qe,this.yyleng++,this.offset++,this.match+=qe,this.matched+=qe;var Ge=qe.match(/(?:\r\n?|\n).*/g);return Ge?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),qe},"input"),unput:b(function(qe){var Ge=qe.length,fe=qe.split(/(?:\r\n?|\n)/g);this._input=qe+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Ge),this.offset-=Ge;var Ce=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),fe.length-1&&(this.yylineno-=fe.length-1);var _e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:fe?(fe.length===Ce.length?this.yylloc.first_column:0)+Ce[Ce.length-fe.length].length-fe[0].length:this.yylloc.first_column-Ge},this.options.ranges&&(this.yylloc.range=[_e[0],_e[0]+this.yyleng-Ge]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(qe){this.unput(this.match.slice(qe))},"less"),pastInput:b(function(){var qe=this.matched.substr(0,this.matched.length-this.match.length);return(qe.length>20?"...":"")+qe.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var qe=this.match;return qe.length<20&&(qe+=this._input.substr(0,20-qe.length)),(qe.substr(0,20)+(qe.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var qe=this.pastInput(),Ge=new Array(qe.length+1).join("-");return qe+this.upcomingInput()+` `+Ge+"^"},"showPosition"),test_match:b(function(qe,Ge){var fe,Ce,_e;if(this.options.backtrack_lexer&&(_e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(_e.yylloc.range=this.yylloc.range.slice(0))),Ce=qe[0].match(/(?:\r\n?|\n).*/g),Ce&&(this.yylineno+=Ce.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Ce?Ce[Ce.length-1].length-Ce[Ce.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+qe[0].length},this.yytext+=qe[0],this.match+=qe[0],this.matches=qe,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(qe[0].length),this.matched+=qe[0],fe=this.performAction.call(this,this.yy,this,Ge,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),fe)return fe;if(this._backtrack){for(var de in _e)this[de]=_e[de];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var qe,Ge,fe,Ce;this._more||(this.yytext="",this.match="");for(var _e=this._currentRules(),de=0;de<_e.length;de++)if(fe=this._input.match(this.rules[_e[de]]),fe&&(!Ge||fe[0].length>Ge[0].length)){if(Ge=fe,Ce=de,this.options.backtrack_lexer){if(qe=this.test_match(fe,_e[de]),qe!==!1)return qe;if(this._backtrack){Ge=!1;continue}else return!1}else if(!this.options.flex)break}return Ge?(qe=this.test_match(Ge,_e[Ce]),qe!==!1?qe:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var Ge=this.next();return Ge||this.lex()},"lex"),begin:b(function(Ge){this.conditionStack.push(Ge)},"begin"),popState:b(function(){var Ge=this.conditionStack.length-1;return Ge>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(Ge){return Ge=this.conditionStack.length-1-Math.abs(Ge||0),Ge>=0?this.conditionStack[Ge]:"INITIAL"},"topState"),pushState:b(function(Ge){this.begin(Ge)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(Ge,fe,Ce,_e){var de=_e;switch(Ce){case 0:return this.begin("acc_title"),24;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),26;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 33;case 8:return 34;case 9:return 35;case 10:return 36;case 11:return 10;case 12:break;case 13:return 8;case 14:return 50;case 15:return 73;case 16:return 4;case 17:return this.begin("block"),17;break;case 18:return 49;case 19:return 49;case 20:return 42;case 21:return 15;case 22:return 13;case 23:break;case 24:return 62;case 25:return 58;case 26:return 58;case 27:this.begin("block_bq");break;case 28:return 58;case 29:this.popState();break;case 30:return 63;case 31:break;case 32:return this.popState(),19;break;case 33:return fe.yytext[0];case 34:return 20;case 35:return 21;case 36:return this.begin("style"),44;break;case 37:return this.popState(),10;break;case 38:break;case 39:return 13;case 40:return 42;case 41:return 49;case 42:return this.begin("style"),37;break;case 43:return 43;case 44:return 66;case 45:return 68;case 46:return 68;case 47:return 68;case 48:return 66;case 49:return 66;case 50:return 67;case 51:return 67;case 52:return 67;case 53:return 67;case 54:return 67;case 55:return 68;case 56:return 67;case 57:return 68;case 58:return 69;case 59:return 69;case 60:return 51;case 61:return 69;case 62:return 69;case 63:return 69;case 64:return 52;case 65:return 48;case 66:return 69;case 67:return 66;case 68:return 67;case 69:return 68;case 70:return 70;case 71:return 71;case 72:return 72;case 73:return 72;case 74:return 71;case 75:return 71;case 76:return 71;case 77:return 41;case 78:return 47;case 79:return 40;case 80:return fe.yytext[0];case 81:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\.,\u00C0-\uFFFF\*]*))/i,/^(?:[`])/i,/^(?:[^`]+)/i,/^(?:[`])/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:[0-9]+\.[0-9]+)/i,/^(?:1(?=\s+[A-Za-z_"']))/i,/^(?:1(?=\s+[0-9]))/i,/^(?:1(?=(--|\.\.|\.-|-\.)))/i,/^(?:1\b)/i,/^(?:[0-9]+)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:u(?=[\.\-\|]))/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[37,38,39,40,41,77,78],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block_bq:{rules:[28,29],inclusive:!1},block:{rules:[23,24,25,26,27,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,34,35,36,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,79,80,81],inclusive:!0}}};return Oe})();oe.lexer=Re;function Te(){this.yy={}}return b(Te,"Parser"),Te.prototype=oe,oe.Parser=Te,new Te})();jZ.parser=jZ;LDt=jZ,IDt=class{constructor(){this.entities=new Map,this.relationships=[],this.classes=new Map,this.direction="TB",this.Cardinality={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"},this.Identification={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},this.setAccTitle=Yr,this.getAccTitle=Qr,this.setAccDescription=Jr,this.getAccDescription=en,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getConfig=b(()=>Be().er,"getConfig"),this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{b(this,"ErDB")}addEntity(e,t=""){return this.entities.has(e)?!this.entities.get(e)?.alias&&t&&(this.entities.get(e).alias=t,se.info(`Add alias '${t}' to entity '${e}'`)):(this.entities.set(e,{id:`entity-${e}-${this.entities.size}`,label:e,attributes:[],alias:t,shape:"erBox",look:Be().look??"default",cssClasses:"default",cssStyles:[],labelType:"markdown"}),se.info("Added new entity :",e)),this.entities.get(e)}getEntity(e){return this.entities.get(e)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(e,t){let r=this.addEntity(e),n;for(n=t.length-1;n>=0;n--)t[n].keys||(t[n].keys=[]),t[n].comment||(t[n].comment=""),r.attributes.push(t[n]),se.debug("Added attribute ",t[n].name)}addRelationship(e,t,r,n){let i=this.entities.get(e),a=this.entities.get(r);if(!i||!a)return;let s={entityA:i.id,roleA:t,entityB:a.id,relSpec:n};this.relationships.push(s),se.debug("Added new relationship :",s)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(e){this.direction=e}getCompiledStyles(e){let t=[];for(let r of e){let n=this.classes.get(r);n?.styles&&(t=[...t,...n.styles??[]].map(i=>i.trim())),n?.textStyles&&(t=[...t,...n.textStyles??[]].map(i=>i.trim()))}return t}addCssStyles(e,t){for(let r of e){let n=this.entities.get(r);if(!t||!n)return;for(let i of t)n.cssStyles.push(i)}}addClass(e,t){e.forEach(r=>{let n=this.classes.get(r);n===void 0&&(n={id:r,styles:[],textStyles:[]},this.classes.set(r,n)),t&&t.forEach(function(i){if(/color/.exec(i)){let a=i.replace("fill","bgFill");n.textStyles.push(a)}n.styles.push(i)})})}setClass(e,t){for(let r of e){let n=this.entities.get(r);if(n)for(let i of t)n.cssClasses+=" "+i}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],Nr()}getData(){let e=[],t=[],r=Be(),n=0;for(let a of this.entities.keys()){let s=this.entities.get(a);s&&(s.cssCompiledStyles=this.getCompiledStyles(s.cssClasses.split(" ")),s.colorIndex=n++,e.push(s))}let i=0;for(let a of this.relationships){let s={id:zf(a.entityA,a.entityB,{prefix:"id",counter:i++}),type:"normal",curve:"basis",start:a.entityA,end:a.entityB,label:a.roleA,labelpos:"c",thickness:"normal",classes:"relationshipLine",arrowTypeStart:a.relSpec.cardB.toLowerCase(),arrowTypeEnd:a.relSpec.cardA.toLowerCase(),pattern:a.relSpec.relType=="IDENTIFYING"?"solid":"dashed",look:r.look,labelType:"markdown"};t.push(s)}return{nodes:e,edges:t,other:{},config:r,direction:"TB"}}},wOe={};wm(wOe,{draw:()=>MDt});MDt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing er diagram (unified)",t);let{securityLevel:i,er:a,layout:s}=Be(),o=n.db.getData(),l=zu(t,i);o.type=n.type,o.layoutAlgorithm=td(s),o.config.flowchart.nodeSpacing=a?.nodeSpacing||140,o.config.flowchart.rankSpacing=a?.rankSpacing||80,o.direction=n.db.getDirection();let{config:u}=o,{look:h}=u;h==="neo"?o.markers=["only_one_neo","zero_or_one_neo","one_or_more_neo","zero_or_more_neo"]:o.markers=["only_one","zero_or_one","one_or_more","zero_or_more"],o.diagramId=t,await Ou(o,l),o.layoutAlgorithm==="elk"&&l.select(".edges").lower();let f=l.selectAll('[id*="-background"]');Array.from(f).length>0&&f.each(function(){let p=ct(this),g=p.attr("id").replace("-background",""),y=l.select(`#${CSS.escape(g)}`);if(!y.empty()){let v=y.attr("transform");p.attr("transform",v)}});let d=8;pr.insertTitle(l,"erDiagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),sc(l,d,"erDiagram",a?.useMaxWidth??!0)},"draw"),bOe=b((e,t)=>{let r=ly,n=r(e,"r"),i=r(e,"g"),a=r(e,"b");return $a(n,i,a,t)},"fade"),BI=new Set(["redux-color","redux-dark-color"]),NDt=b(e=>{let{theme:t,look:r,bkgColorArray:n,borderColorArray:i}=e;if(!BI.has(t))return"";let a=n?.length>0,s="";for(let o=0;o0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(Ge){return Ge=this.conditionStack.length-1-Math.abs(Ge||0),Ge>=0?this.conditionStack[Ge]:"INITIAL"},"topState"),pushState:b(function(Ge){this.begin(Ge)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(Ge,fe,Ce,_e){var de=_e;switch(Ce){case 0:return this.begin("acc_title"),24;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),26;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 33;case 8:return 34;case 9:return 35;case 10:return 36;case 11:return 10;case 12:break;case 13:return 8;case 14:return 50;case 15:return 73;case 16:return 4;case 17:return this.begin("block"),17;break;case 18:return 49;case 19:return 49;case 20:return 42;case 21:return 15;case 22:return 13;case 23:break;case 24:return 62;case 25:return 58;case 26:return 58;case 27:this.begin("block_bq");break;case 28:return 58;case 29:this.popState();break;case 30:return 63;case 31:break;case 32:return this.popState(),19;break;case 33:return fe.yytext[0];case 34:return 20;case 35:return 21;case 36:return this.begin("style"),44;break;case 37:return this.popState(),10;break;case 38:break;case 39:return 13;case 40:return 42;case 41:return 49;case 42:return this.begin("style"),37;break;case 43:return 43;case 44:return 66;case 45:return 68;case 46:return 68;case 47:return 68;case 48:return 66;case 49:return 66;case 50:return 67;case 51:return 67;case 52:return 67;case 53:return 67;case 54:return 67;case 55:return 68;case 56:return 67;case 57:return 68;case 58:return 69;case 59:return 69;case 60:return 51;case 61:return 69;case 62:return 69;case 63:return 69;case 64:return 52;case 65:return 48;case 66:return 69;case 67:return 66;case 68:return 67;case 69:return 68;case 70:return 70;case 71:return 71;case 72:return 72;case 73:return 72;case 74:return 71;case 75:return 71;case 76:return 71;case 77:return 41;case 78:return 47;case 79:return 40;case 80:return fe.yytext[0];case 81:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\.,\u00C0-\uFFFF\*]*))/i,/^(?:[`])/i,/^(?:[^`]+)/i,/^(?:[`])/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:[0-9]+\.[0-9]+)/i,/^(?:1(?=\s+[A-Za-z_"']))/i,/^(?:1(?=\s+[0-9]))/i,/^(?:1(?=(--|\.\.|\.-|-\.)))/i,/^(?:1\b)/i,/^(?:[0-9]+)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:u(?=[\.\-\|]))/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[37,38,39,40,41,77,78],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block_bq:{rules:[28,29],inclusive:!1},block:{rules:[23,24,25,26,27,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,34,35,36,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,79,80,81],inclusive:!0}}};return Oe})();oe.lexer=Re;function Te(){this.yy={}}return b(Te,"Parser"),Te.prototype=oe,oe.Parser=Te,new Te})();ZZ.parser=ZZ;DDt=ZZ,ODt=class{constructor(){this.entities=new Map,this.relationships=[],this.classes=new Map,this.direction="TB",this.Cardinality={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"},this.Identification={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},this.setAccTitle=Yr,this.getAccTitle=Qr,this.setAccDescription=Jr,this.getAccDescription=en,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getConfig=b(()=>Be().er,"getConfig"),this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{b(this,"ErDB")}addEntity(e,t=""){return this.entities.has(e)?!this.entities.get(e)?.alias&&t&&(this.entities.get(e).alias=t,se.info(`Add alias '${t}' to entity '${e}'`)):(this.entities.set(e,{id:`entity-${e}-${this.entities.size}`,label:e,attributes:[],alias:t,shape:"erBox",look:Be().look??"default",cssClasses:"default",cssStyles:[],labelType:"markdown"}),se.info("Added new entity :",e)),this.entities.get(e)}getEntity(e){return this.entities.get(e)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(e,t){let r=this.addEntity(e),n;for(n=t.length-1;n>=0;n--)t[n].keys||(t[n].keys=[]),t[n].comment||(t[n].comment=""),r.attributes.push(t[n]),se.debug("Added attribute ",t[n].name)}addRelationship(e,t,r,n){let i=this.entities.get(e),a=this.entities.get(r);if(!i||!a)return;let s={entityA:i.id,roleA:t,entityB:a.id,relSpec:n};this.relationships.push(s),se.debug("Added new relationship :",s)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(e){this.direction=e}getCompiledStyles(e){let t=[];for(let r of e){let n=this.classes.get(r);n?.styles&&(t=[...t,...n.styles??[]].map(i=>i.trim())),n?.textStyles&&(t=[...t,...n.textStyles??[]].map(i=>i.trim()))}return t}addCssStyles(e,t){for(let r of e){let n=this.entities.get(r);if(!t||!n)return;for(let i of t)n.cssStyles.push(i)}}addClass(e,t){e.forEach(r=>{let n=this.classes.get(r);n===void 0&&(n={id:r,styles:[],textStyles:[]},this.classes.set(r,n)),t&&t.forEach(function(i){if(/color/.exec(i)){let a=i.replace("fill","bgFill");n.textStyles.push(a)}n.styles.push(i)})})}setClass(e,t){for(let r of e){let n=this.entities.get(r);if(n)for(let i of t)n.cssClasses+=" "+i}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],Nr()}getData(){let e=[],t=[],r=Be(),n=0;for(let a of this.entities.keys()){let s=this.entities.get(a);s&&(s.cssCompiledStyles=this.getCompiledStyles(s.cssClasses.split(" ")),s.colorIndex=n++,e.push(s))}let i=0;for(let a of this.relationships){let s={id:zf(a.entityA,a.entityB,{prefix:"id",counter:i++}),type:"normal",curve:"basis",start:a.entityA,end:a.entityB,label:a.roleA,labelpos:"c",thickness:"normal",classes:"relationshipLine",arrowTypeStart:a.relSpec.cardB.toLowerCase(),arrowTypeEnd:a.relSpec.cardA.toLowerCase(),pattern:a.relSpec.relType=="IDENTIFYING"?"solid":"dashed",look:r.look,labelType:"markdown"};t.push(s)}return{nodes:e,edges:t,other:{},config:r,direction:"TB"}}},TOe={};wm(TOe,{draw:()=>PDt});PDt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing er diagram (unified)",t);let{securityLevel:i,er:a,layout:s}=Be(),o=n.db.getData(),l=zu(t,i);o.type=n.type,o.layoutAlgorithm=td(s),o.config.flowchart.nodeSpacing=a?.nodeSpacing||140,o.config.flowchart.rankSpacing=a?.rankSpacing||80,o.direction=n.db.getDirection();let{config:u}=o,{look:h}=u;h==="neo"?o.markers=["only_one_neo","zero_or_one_neo","one_or_more_neo","zero_or_more_neo"]:o.markers=["only_one","zero_or_one","one_or_more","zero_or_more"],o.diagramId=t,await Ou(o,l),o.layoutAlgorithm==="elk"&&l.select(".edges").lower();let f=l.selectAll('[id*="-background"]');Array.from(f).length>0&&f.each(function(){let p=ct(this),g=p.attr("id").replace("-background",""),y=l.select(`#${CSS.escape(g)}`);if(!y.empty()){let v=y.attr("transform");p.attr("transform",v)}});let d=8;pr.insertTitle(l,"erDiagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),oc(l,d,"erDiagram",a?.useMaxWidth??!0)},"draw"),kOe=b((e,t)=>{let r=ly,n=r(e,"r"),i=r(e,"g"),a=r(e,"b");return $a(n,i,a,t)},"fade"),BI=new Set(["redux-color","redux-dark-color"]),BDt=b(e=>{let{theme:t,look:r,bkgColorArray:n,borderColorArray:i}=e;if(!BI.has(t))return"";let a=n?.length>0,s="";for(let o=0;o{let{look:t,theme:r,erEdgeLabelBackground:n,strokeWidth:i}=e;return` - ${NDt(e)} + `;return s},"genColor"),FDt=b(e=>{let{look:t,theme:r,erEdgeLabelBackground:n,strokeWidth:i}=e;return` + ${BDt(e)} .entityBox { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; @@ -1092,7 +1092,7 @@ Expecting `+De.join(", ")+", got '"+(this.terminals_[Ne]||Ne)+"'":mt="Parse erro } .labelBkg { - background-color: ${BI.has(r)&&n?n:bOe(e.tertiaryColor,.5)}; + background-color: ${BI.has(r)&&n?n:kOe(e.tertiaryColor,.5)}; } .edgeLabel { @@ -1141,9 +1141,9 @@ Expecting `+De.join(", ")+", got '"+(this.terminals_[Ne]||Ne)+"'":mt="Parse erro stroke-width: 1; } [data-look=neo].labelBkg { - background-color: ${bOe(e.tertiaryColor,.5)}; + background-color: ${kOe(e.tertiaryColor,.5)}; } -`},"getStyles"),ODt=DDt,PDt={parser:LDt,get db(){return new IDt},renderer:wOe,styles:ODt}});var aw,FI=W(()=>{hr();aw=class{constructor(e){this.init=e,this.records=this.init()}static{b(this,"ImperativeState")}reset(){this.records=this.init()}}});function wi(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}var Sl=W(()=>{hr();b(wi,"populateCommonDb")});function ls(e){return typeof e=="object"&&e!==null&&typeof e.$type=="string"}function Al(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"ref"in e}function md(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"items"in e}function tte(e){return typeof e=="object"&&e!==null&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.path=="string"}function Dv(e){return typeof e=="object"&&e!==null&&typeof e.info=="object"&&typeof e.message=="string"}function Z0(e){return typeof e=="object"&&e!==null&&Array.isArray(e.content)}function f2(e){return typeof e=="object"&&e!==null&&typeof e.tokenType=="object"}function CN(e){return Z0(e)&&typeof e.fullText=="string"}function SBe(e){return typeof e=="string"?e:typeof e>"u"?"undefined":typeof e.toString=="function"?e.toString():Object.prototype.toString.call(e)}function GS(e){return!!e&&typeof e[Symbol.iterator]=="function"}function ki(...e){if(e.length===1){let t=e[0];if(t instanceof dd)return t;if(GS(t))return new dd(()=>t[Symbol.iterator](),r=>r.next());if(typeof t.length=="number")return new dd(()=>({index:0}),r=>r.index1?new dd(()=>({collIndex:0,arrIndex:0}),t=>{do{if(t.iterator){let r=t.iterator.next();if(!r.done)return r;t.iterator=void 0}if(t.array){if(t.arrIndex{ls(i)&&(i.$container=e,i.$containerProperty=r,i.$containerIndex=a,t.deep&&Nw(i,t))}):ls(n)&&(n.$container=e,n.$containerProperty=r,t.deep&&Nw(n,t)))}function d2(e,t){let r=e;for(;r;){if(t(r))return r;r=r.$container}}function EBe(e,t){let r=e;for(;r;){if(t(r))return!0;r=r.$container}return!1}function Mh(e){let r=Aw(e).$document;if(!r)throw new Error("AST node has no document.");return r}function Aw(e){for(;e.$container;)e=e.$container;return e}function NM(e){return Al(e)?e.ref?[e.ref]:[]:md(e)?e.items.map(t=>t.ref):[]}function o6(e,t){if(!e)throw new Error("Node must be an AstNode.");let r=t?.range;return new dd(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndexo6(r,t))}function Nh(e,t){if(e){if(t?.range&&!DM(e,t.range))return new Mw(e,()=>[])}else throw new Error("Root node must be an AstNode.");return new Mw(e,r=>o6(r,t),{includeRoot:!0})}function DM(e,t){if(!t)return!0;let r=e.$cstNode?.range;return r?Ate(r,t):!1}function Dw(e){return new dd(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndexZ0(t)?t.content:[],{includeRoot:!0})}function HBe(e){return Pw(e).filter(f2)}function Ste(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function VS(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function Bw(e){if(!e)return;let{offset:t,end:r,range:n}=e;return{range:n,offset:t,end:r,length:r-t}}function Ete(e,t){if(e.end.linet.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return fd.After;let r=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,n=e.end.linefd.After}function UBe(e,t,r=_te){if(e){if(t>0){let n=t-e.offset,i=e.text.charAt(n);r.test(i)||t--}return IN(e,t)}}function Rte(e,t){if(e){let r=Mte(e,!0);if(r&&jM(r,t))return r;if(CN(e)){let n=e.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let a=e.content[i];if(jM(a,t))return a}}}}function jM(e,t){return f2(e)&&t.includes(e.tokenType.name)}function IN(e,t){if(f2(e))return e;if(Z0(e)){let r=Ite(e,t,!1);if(r)return IN(r,t)}}function Lte(e,t){if(f2(e))return e;if(Z0(e)){let r=Ite(e,t,!0);if(r)return Lte(r,t)}}function Ite(e,t,r){let n=0,i=e.content.length-1,a;for(;n<=i;){let s=Math.floor((n+i)/2),o=e.content[s];if(o.offset<=t&&o.end>t)return o;o.end<=t?(a=r?o:void 0,n=s+1):i=s-1}return a}function Mte(e,t=!0){for(;e.container;){let r=e.container,n=r.content.indexOf(e);for(;n>0;){n--;let i=r.content[n];if(t||!i.hidden)return i}e=r}}function YBe(e,t=!0){for(;e.container;){let r=e.container,n=r.content.indexOf(e),i=r.content.length-1;for(;nt.test(r))}function Ww(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bte(e,t){let r=Fte(e),n=t.match(r);return!!n&&n[0].length>0}function Fte(e){typeof e=="string"&&(e=new RegExp(e));let t=e,r=e.source,n=0;function i(){let a="",s;function o(u){a+=r.substr(n,u),n+=u}_(o,"appendRaw");function l(u){a+="(?:"+r.substr(n,u)+"|$)",n+=u}for(_(l,"appendOptional");n",n)-n+1);break;default:l(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],l(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?o(s[0].length):l(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":a+="(?:",n+=3,a+=i()+"|$)";break;case"=":a+="(?=",n+=3,a+=i()+")";break;case"!":s=n,n+=3,i(),a+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),a+=r.substr(s,n-s);break;default:o(r.indexOf(">",n)-n+1),a+=i()+"|$)";break}break}else o(1),a+=i()+"|$)";break;case")":return++n,a;default:l(1);break}return a}return _(i,"process"),new RegExp(i(),e.flags)}function $te(e){return e.rules.find(t=>Ll(t)&&t.entry)}function zte(e){return e.rules.filter(t=>Hu(t)&&t.hidden)}function ON(e,t){let r=new Set,n=$te(e);if(!n)return new Set(e.rules);let i=[n].concat(zte(e));for(let s of i)Gte(s,r,t);let a=new Set;for(let s of e.rules)(r.has(s.name)||Hu(s)&&s.hidden)&&a.add(s);return a}function Gte(e,t,r){t.add(e.name),op(e).forEach(n=>{if(ep(n)||r&&_N(n)){let i=n.rule.ref;i&&!t.has(i.name)&&Gte(i,t,r)}})}function rFe(e){let t=new Set;return op(e).forEach(r=>{m2(r)&&(Ll(r.type.ref)&&t.add(r.type.ref),l6(r.type.ref)&&Ll(r.type.ref.$container)&&t.add(r.type.ref.$container))}),t}function qte(e){if(e.terminal)return e.terminal;if(e.type.ref)return $N(e.type.ref)?.terminal}function Vte(e){return e.hidden&&!DN(h6(e))}function Wte(e,t){return!e||!t?[]:BN(e,t,e.astNode,!0)}function PN(e,t,r){if(!e||!t)return;let n=BN(e,t,e.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function BN(e,t,r,n){if(!n){let i=d2(e.grammarSource,Q0);if(i&&i.feature===t)return[e]}return Z0(e)&&e.astNode===r?e.content.flatMap(i=>BN(i,t,r,!1)):[]}function nFe(e,t){return e?FN(e,t,e?.astNode):[]}function Hte(e,t,r){if(!e)return;let n=FN(e,t,e?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function FN(e,t,r){if(e.astNode!==r)return[];if(J0(e.grammarSource)&&e.grammarSource.value===t)return[e];let n=Pw(e).iterator(),i,a=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?J0(s.grammarSource)&&s.grammarSource.value===t&&a.push(s):n.prune()}while(!i.done);return a}function Ute(e){let t=e.astNode;for(;t===e.container?.astNode;){let r=d2(e.grammarSource,Q0);if(r)return r;e=e.container}}function $N(e){let t=e;return l6(t)&&(zg(t.$container)?t=t.$container.$container:p2(t.$container)?t=t.$container:Ug(t.$container)),Yte(e,t,new Map)}function Yte(e,t,r){function n(i,a){let s;return d2(i,Q0)||(s=Yte(a,a,r)),r.set(e,s),s}if(_(n,"go"),r.has(e))return r.get(e);r.set(e,void 0);for(let i of op(t)){if(Q0(i)&&i.feature.toLowerCase()==="name")return r.set(e,i),i;if(ep(i)&&Ll(i.rule.ref))return n(i,i.rule.ref);if(AN(i)&&i.typeRef?.ref)return n(i,i.typeRef.ref)}}function Xte(e){let t=e.$container;if(g2(t)){let r=t.elements,n=r.indexOf(e);for(let i=n-1;i>=0;i--){let a=r[i];if(zg(a))return a;{let s=op(r[i]).find(zg);if(s)return s}}}if(SN(t))return Xte(t)}function iFe(e,t){return e==="?"||e==="*"||g2(t)&&!!t.guardCondition}function aFe(e){return e==="*"||e==="+"}function sFe(e){return e==="+="}function c6(e){return jte(e,new Set)}function jte(e,t){if(t.has(e))return!0;t.add(e);for(let r of op(e))if(ep(r)){if(!r.rule.ref||Ll(r.rule.ref)&&!jte(r.rule.ref,t)||Ow(r.rule.ref))return!1}else{if(Q0(r))return!1;if(zg(r))return!1}return!!e.definition}function oFe(e){return QM(e.type,new Set)}function QM(e,t){if(t.has(e))return!0;if(t.add(e),ste(e))return!1;if(gte(e))return!1;if(wte(e))return e.types.every(r=>QM(r,t));if(AN(e)){if(e.primitiveType!==void 0)return!0;if(e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let r=e.typeRef.ref;return RN(r)?QM(r.type,t):!1}else return!1}else return!1}function u6(e){if(!Hu(e)){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t)return t.name}}}function o2(e){if(p2(e))return Ll(e)&&c6(e)?e.name:u6(e)??e.name;if(fte(e)||RN(e)||vte(e))return e.name;if(zg(e)){let t=Kte(e);if(t)return t}else if(l6(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function Kte(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return o2(e.type.ref)}function lFe(e){return Hu(e)?e.type?.name??"string":Ll(e)&&c6(e)?e.name:u6(e)??e.name}function Zte(e){return Hu(e)?e.type?.name??"string":u6(e)??e.name}function h6(e){let t={s:!1,i:!1,u:!1},r=y2(e.definition,t),n=Object.entries(t).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}function y2(e,t){if(xte(e))return cFe(e);if(bte(e))return uFe(e);if(lte(e))return dFe(e);if(_N(e)){let r=e.rule.ref;if(!r)throw new Error("Missing rule reference.");return gd(y2(r.definition),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}else{if(dte(e))return fFe(e);if(kte(e))return hFe(e);if(yte(e)){let r=e.regex.lastIndexOf("/"),n=e.regex.substring(1,r),i=e.regex.substring(r+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),gd(n,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}else{if(Tte(e))return gd(Qte,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized});throw new Error(`Invalid terminal element: ${e?.$type}, ${e?.$cstNode?.text}`)}}}function cFe(e){return gd(e.elements.map(t=>y2(t)).join("|"),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function uFe(e){return gd(e.elements.map(t=>y2(t)).join(""),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function hFe(e){return gd(`${Qte}*?${y2(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function fFe(e){return gd(`(?!${y2(e.terminal)})${Qte}*?`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function dFe(e){return e.right?gd(`[${fM(e.left)}-${fM(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1}):gd(fM(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function fM(e){return Ww(e.value)}function gd(e,t){return(t.parenthesized||t.lookahead||t.wrap!==!1)&&(e=`(${t.lookahead??(t.parenthesized?"":"?:")}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function Jte(e){let t=[],r=e.Grammar;for(let n of r.rules)Hu(n)&&Vte(n)&&Pte(h6(n))&&t.push(n.name);return{multilineCommentRules:t,nameRegexp:_te}}function gFe(e){var t=_Ot.call(e,nS),r=e[nS];try{e[nS]=void 0;var n=!0}catch{}var i=ROt.call(e);return n&&(t?e[nS]=r:delete e[nS]),i}function yFe(e){return MOt.call(e)}function vFe(e){return e==null?e===void 0?OOt:DOt:AOe&&AOe in Object(e)?LOt(e):NOt(e)}function xFe(e){return e!=null&&typeof e=="object"}function bFe(e){return typeof e=="symbol"||Ph(e)&&Yg(e)==POt}function wFe(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r0){if(++t>=xPt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function $Fe(e){return function(){return e}}function zFe(e,t){for(var r=-1,n=e==null?0:e.length;++r-1}function jFe(e,t){var r=typeof e;return t=t??IPt,!!t&&(r=="number"||r!="symbol"&&MPt.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=PPt}function n$e(e){return e!=null&&ire(e.length)&&!lp(e)}function i$e(e,t,r){if(!Wu(r))return!1;var n=typeof t;return(n=="number"?xd(r)&&GN(t,r.length):n=="string"&&t in r)?m6(r[t],e):!1}function a$e(e){return nre(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,s&&VN(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++n-1}function P$e(e,t){var r=this.__data__,n=UN(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function w2(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t0&&r(o)?t>1?cre(o,t-1,r,n,i):lre(i,o):n||(i[i.length]=o)}return i}function Q$e(e){var t=e==null?0:e.length;return t?ure(e,1):[]}function eze(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++no))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,d=!0,p=r&hzt?new pre:void 0;for(a.set(e,t),a.set(t,e);++f=iGt&&(a=mre,s=!1,t=new pre(t));e:for(;++i-1?i[a?t[s]:s]:void 0}}function PGe(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var i=r==null?0:d6(r);return i<0&&(i=hGt(n+i,0)),VFe(e,bd(t,3),i)}function BGe(e){return e&&e.length?e[0]:void 0}function FGe(e,t){var r=-1,n=xd(e)?Array(e.length):[];return C2(e,function(i,a,s){n[++r]=t(i,a,s)}),n}function $Ge(e,t){var r=Un(e)?f6:pGt;return r(e,bd(t,3))}function zGe(e,t){return ure(Er(e,t),1)}function GGe(e,t){return e!=null&&bGt.call(e,t)}function qGe(e,t){return e!=null&&sGe(e,t,wGt)}function VGe(e){return typeof e=="string"||!Un(e)&&Ph(e)&&Yg(e)==kGt}function WGe(e,t){return f6(t,function(r){return e[r]})}function HGe(e){return e==null?[]:TGt(e,jc(e))}function UGe(e,t,r,n){e=xd(e)?e:Ss(e),r=r&&!n?d6(r):0;var i=e.length;return r<0&&(r=CGt(i+r,0)),uc(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&tre(e,t,r)>-1}function YGe(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var i=r==null?0:d6(r);return i<0&&(i=SGt(n+i,0)),tre(e,t,i)}function XGe(e){if(e==null)return!0;if(xd(e)&&(Un(e)||typeof e=="string"||typeof e.splice=="function"||WS(e)||are(e)||WN(e)))return!e.length;var t=Fw(e);if(t==EGt||t==AGt)return!e.size;if(y6(e))return!b$e(e).length;for(var r in e)if(RGt.call(e,r))return!1;return!0}function jGe(e){return Ph(e)&&Yg(e)==LGt}function KGe(e){return e===void 0}function ZGe(e){if(typeof e!="function")throw new TypeError(NGt);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function QGe(e,t,r,n){if(!Wu(e))return e;t=ZN(t,e);for(var i=-1,a=t.length,s=a-1,o=e;o!=null&&++i=qGt){var u=t?null:GGt(e);if(u)return gre(u);s=!1,i=mre,l=new pre}else l=t?[]:o;e:for(;++njS(n,t)):e instanceof Il&&Dl(t,e)?!1:e instanceof wd?(e instanceof Il&&t.push(e),Oh(e.definition,n=>jS(n,t))):!1}function dqe(e){return e instanceof dc}function Lh(e){if(e instanceof Il)return"SUBRULE";if(e instanceof wo)return"OPTION";if(e instanceof dc)return"OR";if(e instanceof Qc)return"AT_LEAST_ONE";if(e instanceof Jc)return"AT_LEAST_ONE_SEP";if(e instanceof fc)return"MANY_SEP";if(e instanceof Ia)return"MANY";if(e instanceof Qi)return"CONSUME";throw Error("non exhaustive match")}function SJ(e,t,r){return[new wo({definition:[new Qi({terminalType:e.separator})].concat(e.definition)})].concat(t,r)}function Yw(e){if(e instanceof Il)return Yw(e.referencedRule);if(e instanceof Qi)return gqe(e);if(fqe(e))return pqe(e);if(dqe(e))return mqe(e);throw Error("non exhaustive match")}function pqe(e){let t=[],r=e.definition,n=0,i=r.length>n,a,s=!0;for(;i&&s;)a=r[n],s=jS(a),t=t.concat(Yw(a)),n=n+1,i=r.length>n;return xre(t)}function mqe(e){let t=Er(e.definition,r=>Yw(r));return xre(Dh(t))}function gqe(e){return[e.terminalType]}function vqe(e){let t={};return nn(e,r=>{let n=new WGt(r).startWalking();Kc(t,n)}),t}function xqe(e,t){return e.name+t+yqe}function w6(e){let t=e.toString();if(dM.hasOwnProperty(t))return dM[t];{let r=HGt.pattern(t);return dM[t]=r,r}}function bqe(){dM={}}function kqe(e,t=!1){try{let r=w6(e);return nN(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===wqe)t&&bre(`${rN} Unable to optimize: < ${e.toString()} > +`},"getStyles"),$Dt=FDt,zDt={parser:DDt,get db(){return new ODt},renderer:TOe,styles:$Dt}});var aw,FI=W(()=>{hr();aw=class{constructor(e){this.init=e,this.records=this.init()}static{b(this,"ImperativeState")}reset(){this.records=this.init()}}});function wi(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}var El=W(()=>{hr();b(wi,"populateCommonDb")});function ls(e){return typeof e=="object"&&e!==null&&typeof e.$type=="string"}function _l(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"ref"in e}function md(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"items"in e}function nte(e){return typeof e=="object"&&e!==null&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.path=="string"}function Dv(e){return typeof e=="object"&&e!==null&&typeof e.info=="object"&&typeof e.message=="string"}function Z0(e){return typeof e=="object"&&e!==null&&Array.isArray(e.content)}function f2(e){return typeof e=="object"&&e!==null&&typeof e.tokenType=="object"}function CN(e){return Z0(e)&&typeof e.fullText=="string"}function ABe(e){return typeof e=="string"?e:typeof e>"u"?"undefined":typeof e.toString=="function"?e.toString():Object.prototype.toString.call(e)}function GS(e){return!!e&&typeof e[Symbol.iterator]=="function"}function ki(...e){if(e.length===1){let t=e[0];if(t instanceof dd)return t;if(GS(t))return new dd(()=>t[Symbol.iterator](),r=>r.next());if(typeof t.length=="number")return new dd(()=>({index:0}),r=>r.index1?new dd(()=>({collIndex:0,arrIndex:0}),t=>{do{if(t.iterator){let r=t.iterator.next();if(!r.done)return r;t.iterator=void 0}if(t.array){if(t.arrIndex{ls(i)&&(i.$container=e,i.$containerProperty=r,i.$containerIndex=a,t.deep&&Nw(i,t))}):ls(n)&&(n.$container=e,n.$containerProperty=r,t.deep&&Nw(n,t)))}function d2(e,t){let r=e;for(;r;){if(t(r))return r;r=r.$container}}function _Be(e,t){let r=e;for(;r;){if(t(r))return!0;r=r.$container}return!1}function Mh(e){let r=Aw(e).$document;if(!r)throw new Error("AST node has no document.");return r}function Aw(e){for(;e.$container;)e=e.$container;return e}function NM(e){return _l(e)?e.ref?[e.ref]:[]:md(e)?e.items.map(t=>t.ref):[]}function o6(e,t){if(!e)throw new Error("Node must be an AstNode.");let r=t?.range;return new dd(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndexo6(r,t))}function Nh(e,t){if(e){if(t?.range&&!DM(e,t.range))return new Mw(e,()=>[])}else throw new Error("Root node must be an AstNode.");return new Mw(e,r=>o6(r,t),{includeRoot:!0})}function DM(e,t){if(!t)return!0;let r=e.$cstNode?.range;return r?Rte(r,t):!1}function Dw(e){return new dd(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndexZ0(t)?t.content:[],{includeRoot:!0})}function YBe(e){return Pw(e).filter(f2)}function Ate(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function VS(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function Bw(e){if(!e)return;let{offset:t,end:r,range:n}=e;return{range:n,offset:t,end:r,length:r-t}}function _te(e,t){if(e.end.linet.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return fd.After;let r=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,n=e.end.linefd.After}function XBe(e,t,r=Lte){if(e){if(t>0){let n=t-e.offset,i=e.text.charAt(n);r.test(i)||t--}return IN(e,t)}}function Ite(e,t){if(e){let r=Dte(e,!0);if(r&&jM(r,t))return r;if(CN(e)){let n=e.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let a=e.content[i];if(jM(a,t))return a}}}}function jM(e,t){return f2(e)&&t.includes(e.tokenType.name)}function IN(e,t){if(f2(e))return e;if(Z0(e)){let r=Nte(e,t,!1);if(r)return IN(r,t)}}function Mte(e,t){if(f2(e))return e;if(Z0(e)){let r=Nte(e,t,!0);if(r)return Mte(r,t)}}function Nte(e,t,r){let n=0,i=e.content.length-1,a;for(;n<=i;){let s=Math.floor((n+i)/2),o=e.content[s];if(o.offset<=t&&o.end>t)return o;o.end<=t?(a=r?o:void 0,n=s+1):i=s-1}return a}function Dte(e,t=!0){for(;e.container;){let r=e.container,n=r.content.indexOf(e);for(;n>0;){n--;let i=r.content[n];if(t||!i.hidden)return i}e=r}}function jBe(e,t=!0){for(;e.container;){let r=e.container,n=r.content.indexOf(e),i=r.content.length-1;for(;nt.test(r))}function Ww(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $te(e,t){let r=zte(e),n=t.match(r);return!!n&&n[0].length>0}function zte(e){typeof e=="string"&&(e=new RegExp(e));let t=e,r=e.source,n=0;function i(){let a="",s;function o(u){a+=r.substr(n,u),n+=u}_(o,"appendRaw");function l(u){a+="(?:"+r.substr(n,u)+"|$)",n+=u}for(_(l,"appendOptional");n",n)-n+1);break;default:l(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],l(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?o(s[0].length):l(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":a+="(?:",n+=3,a+=i()+"|$)";break;case"=":a+="(?=",n+=3,a+=i()+")";break;case"!":s=n,n+=3,i(),a+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),a+=r.substr(s,n-s);break;default:o(r.indexOf(">",n)-n+1),a+=i()+"|$)";break}break}else o(1),a+=i()+"|$)";break;case")":return++n,a;default:l(1);break}return a}return _(i,"process"),new RegExp(i(),e.flags)}function Gte(e){return e.rules.find(t=>Il(t)&&t.entry)}function qte(e){return e.rules.filter(t=>Hu(t)&&t.hidden)}function ON(e,t){let r=new Set,n=Gte(e);if(!n)return new Set(e.rules);let i=[n].concat(qte(e));for(let s of i)Vte(s,r,t);let a=new Set;for(let s of e.rules)(r.has(s.name)||Hu(s)&&s.hidden)&&a.add(s);return a}function Vte(e,t,r){t.add(e.name),op(e).forEach(n=>{if(ep(n)||r&&_N(n)){let i=n.rule.ref;i&&!t.has(i.name)&&Vte(i,t,r)}})}function iFe(e){let t=new Set;return op(e).forEach(r=>{m2(r)&&(Il(r.type.ref)&&t.add(r.type.ref),l6(r.type.ref)&&Il(r.type.ref.$container)&&t.add(r.type.ref.$container))}),t}function Wte(e){if(e.terminal)return e.terminal;if(e.type.ref)return $N(e.type.ref)?.terminal}function Hte(e){return e.hidden&&!DN(h6(e))}function Ute(e,t){return!e||!t?[]:BN(e,t,e.astNode,!0)}function PN(e,t,r){if(!e||!t)return;let n=BN(e,t,e.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function BN(e,t,r,n){if(!n){let i=d2(e.grammarSource,Q0);if(i&&i.feature===t)return[e]}return Z0(e)&&e.astNode===r?e.content.flatMap(i=>BN(i,t,r,!1)):[]}function aFe(e,t){return e?FN(e,t,e?.astNode):[]}function Yte(e,t,r){if(!e)return;let n=FN(e,t,e?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function FN(e,t,r){if(e.astNode!==r)return[];if(J0(e.grammarSource)&&e.grammarSource.value===t)return[e];let n=Pw(e).iterator(),i,a=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?J0(s.grammarSource)&&s.grammarSource.value===t&&a.push(s):n.prune()}while(!i.done);return a}function Xte(e){let t=e.astNode;for(;t===e.container?.astNode;){let r=d2(e.grammarSource,Q0);if(r)return r;e=e.container}}function $N(e){let t=e;return l6(t)&&(zg(t.$container)?t=t.$container.$container:p2(t.$container)?t=t.$container:Ug(t.$container)),jte(e,t,new Map)}function jte(e,t,r){function n(i,a){let s;return d2(i,Q0)||(s=jte(a,a,r)),r.set(e,s),s}if(_(n,"go"),r.has(e))return r.get(e);r.set(e,void 0);for(let i of op(t)){if(Q0(i)&&i.feature.toLowerCase()==="name")return r.set(e,i),i;if(ep(i)&&Il(i.rule.ref))return n(i,i.rule.ref);if(AN(i)&&i.typeRef?.ref)return n(i,i.typeRef.ref)}}function Kte(e){let t=e.$container;if(g2(t)){let r=t.elements,n=r.indexOf(e);for(let i=n-1;i>=0;i--){let a=r[i];if(zg(a))return a;{let s=op(r[i]).find(zg);if(s)return s}}}if(SN(t))return Kte(t)}function sFe(e,t){return e==="?"||e==="*"||g2(t)&&!!t.guardCondition}function oFe(e){return e==="*"||e==="+"}function lFe(e){return e==="+="}function c6(e){return Zte(e,new Set)}function Zte(e,t){if(t.has(e))return!0;t.add(e);for(let r of op(e))if(ep(r)){if(!r.rule.ref||Il(r.rule.ref)&&!Zte(r.rule.ref,t)||Ow(r.rule.ref))return!1}else{if(Q0(r))return!1;if(zg(r))return!1}return!!e.definition}function cFe(e){return QM(e.type,new Set)}function QM(e,t){if(t.has(e))return!0;if(t.add(e),lte(e))return!1;if(vte(e))return!1;if(Tte(e))return e.types.every(r=>QM(r,t));if(AN(e)){if(e.primitiveType!==void 0)return!0;if(e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let r=e.typeRef.ref;return RN(r)?QM(r.type,t):!1}else return!1}else return!1}function u6(e){if(!Hu(e)){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t)return t.name}}}function o2(e){if(p2(e))return Il(e)&&c6(e)?e.name:u6(e)??e.name;if(pte(e)||RN(e)||bte(e))return e.name;if(zg(e)){let t=Qte(e);if(t)return t}else if(l6(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function Qte(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return o2(e.type.ref)}function uFe(e){return Hu(e)?e.type?.name??"string":Il(e)&&c6(e)?e.name:u6(e)??e.name}function Jte(e){return Hu(e)?e.type?.name??"string":u6(e)??e.name}function h6(e){let t={s:!1,i:!1,u:!1},r=y2(e.definition,t),n=Object.entries(t).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}function y2(e,t){if(wte(e))return hFe(e);if(kte(e))return fFe(e);if(ute(e))return mFe(e);if(_N(e)){let r=e.rule.ref;if(!r)throw new Error("Missing rule reference.");return gd(y2(r.definition),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}else{if(mte(e))return pFe(e);if(Cte(e))return dFe(e);if(xte(e)){let r=e.regex.lastIndexOf("/"),n=e.regex.substring(1,r),i=e.regex.substring(r+1);return t&&(t.i=i.includes("i"),t.s=i.includes("s"),t.u=i.includes("u")),gd(n,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}else{if(Ste(e))return gd(ere,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized});throw new Error(`Invalid terminal element: ${e?.$type}, ${e?.$cstNode?.text}`)}}}function hFe(e){return gd(e.elements.map(t=>y2(t)).join("|"),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function fFe(e){return gd(e.elements.map(t=>y2(t)).join(""),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function dFe(e){return gd(`${ere}*?${y2(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function pFe(e){return gd(`(?!${y2(e.terminal)})${ere}*?`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function mFe(e){return e.right?gd(`[${fM(e.left)}-${fM(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1}):gd(fM(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function fM(e){return Ww(e.value)}function gd(e,t){return(t.parenthesized||t.lookahead||t.wrap!==!1)&&(e=`(${t.lookahead??(t.parenthesized?"":"?:")}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function tre(e){let t=[],r=e.Grammar;for(let n of r.rules)Hu(n)&&Hte(n)&&Fte(h6(n))&&t.push(n.name);return{multilineCommentRules:t,nameRegexp:Lte}}function vFe(e){var t=MOt.call(e,nS),r=e[nS];try{e[nS]=void 0;var n=!0}catch{}var i=NOt.call(e);return n&&(t?e[nS]=r:delete e[nS]),i}function xFe(e){return POt.call(e)}function bFe(e){return e==null?e===void 0?$Ot:FOt:ROe&&ROe in Object(e)?DOt(e):BOt(e)}function wFe(e){return e!=null&&typeof e=="object"}function kFe(e){return typeof e=="symbol"||Ph(e)&&Yg(e)==zOt}function TFe(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r0){if(++t>=TPt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function GFe(e){return function(){return e}}function qFe(e,t){for(var r=-1,n=e==null?0:e.length;++r-1}function ZFe(e,t){var r=typeof e;return t=t??OPt,!!t&&(r=="number"||r!="symbol"&&PPt.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=zPt}function a$e(e){return e!=null&&sre(e.length)&&!lp(e)}function s$e(e,t,r){if(!Wu(r))return!1;var n=typeof t;return(n=="number"?xd(r)&&GN(t,r.length):n=="string"&&t in r)?m6(r[t],e):!1}function o$e(e){return are(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,s&&VN(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++n-1}function F$e(e,t){var r=this.__data__,n=UN(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function w2(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t0&&r(o)?t>1?hre(o,t-1,r,n,i):ure(i,o):n||(i[i.length]=o)}return i}function eze(e){var t=e==null?0:e.length;return t?fre(e,1):[]}function rze(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++no))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,d=!0,p=r&mzt?new gre:void 0;for(a.set(e,t),a.set(t,e);++f=lGt&&(a=yre,s=!1,t=new gre(t));e:for(;++i-1?i[a?t[s]:s]:void 0}}function FGe(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var i=r==null?0:d6(r);return i<0&&(i=mGt(n+i,0)),HFe(e,bd(t,3),i)}function $Ge(e){return e&&e.length?e[0]:void 0}function zGe(e,t){var r=-1,n=xd(e)?Array(e.length):[];return C2(e,function(i,a,s){n[++r]=t(i,a,s)}),n}function GGe(e,t){var r=Un(e)?f6:vGt;return r(e,bd(t,3))}function qGe(e,t){return fre(Er(e,t),1)}function VGe(e,t){return e!=null&&CGt.call(e,t)}function WGe(e,t){return e!=null&&lGe(e,t,SGt)}function HGe(e){return typeof e=="string"||!Un(e)&&Ph(e)&&Yg(e)==EGt}function UGe(e,t){return f6(t,function(r){return e[r]})}function YGe(e){return e==null?[]:AGt(e,jc(e))}function XGe(e,t,r,n){e=xd(e)?e:Ss(e),r=r&&!n?d6(r):0;var i=e.length;return r<0&&(r=_Gt(i+r,0)),hc(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&nre(e,t,r)>-1}function jGe(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var i=r==null?0:d6(r);return i<0&&(i=RGt(n+i,0)),nre(e,t,i)}function KGe(e){if(e==null)return!0;if(xd(e)&&(Un(e)||typeof e=="string"||typeof e.splice=="function"||WS(e)||ore(e)||WN(e)))return!e.length;var t=Fw(e);if(t==LGt||t==IGt)return!e.size;if(y6(e))return!k$e(e).length;for(var r in e)if(NGt.call(e,r))return!1;return!0}function ZGe(e){return Ph(e)&&Yg(e)==DGt}function QGe(e){return e===void 0}function JGe(e){if(typeof e!="function")throw new TypeError(BGt);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function eqe(e,t,r,n){if(!Wu(e))return e;t=ZN(t,e);for(var i=-1,a=t.length,s=a-1,o=e;o!=null&&++i=UGt){var u=t?null:HGt(e);if(u)return vre(u);s=!1,i=yre,l=new gre}else l=t?[]:o;e:for(;++njS(n,t)):e instanceof Ml&&Ol(t,e)?!1:e instanceof wd?(e instanceof Ml&&t.push(e),Oh(e.definition,n=>jS(n,t))):!1}function mqe(e){return e instanceof pc}function Lh(e){if(e instanceof Ml)return"SUBRULE";if(e instanceof wo)return"OPTION";if(e instanceof pc)return"OR";if(e instanceof Qc)return"AT_LEAST_ONE";if(e instanceof Jc)return"AT_LEAST_ONE_SEP";if(e instanceof dc)return"MANY_SEP";if(e instanceof Ia)return"MANY";if(e instanceof Qi)return"CONSUME";throw Error("non exhaustive match")}function AJ(e,t,r){return[new wo({definition:[new Qi({terminalType:e.separator})].concat(e.definition)})].concat(t,r)}function Yw(e){if(e instanceof Ml)return Yw(e.referencedRule);if(e instanceof Qi)return vqe(e);if(pqe(e))return gqe(e);if(mqe(e))return yqe(e);throw Error("non exhaustive match")}function gqe(e){let t=[],r=e.definition,n=0,i=r.length>n,a,s=!0;for(;i&&s;)a=r[n],s=jS(a),t=t.concat(Yw(a)),n=n+1,i=r.length>n;return wre(t)}function yqe(e){let t=Er(e.definition,r=>Yw(r));return wre(Dh(t))}function vqe(e){return[e.terminalType]}function bqe(e){let t={};return nn(e,r=>{let n=new XGt(r).startWalking();Kc(t,n)}),t}function wqe(e,t){return e.name+t+xqe}function w6(e){let t=e.toString();if(dM.hasOwnProperty(t))return dM[t];{let r=jGt.pattern(t);return dM[t]=r,r}}function kqe(){dM={}}function Cqe(e,t=!1){try{let r=w6(e);return nN(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===Tqe)t&&kre(`${rN} Unable to optimize: < ${e.toString()} > Complement Sets cannot be automatically optimized. This will disable the lexer's first char optimizations. See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";t&&(n=` @@ -1151,54 +1151,54 @@ Expecting `+De.join(", ")+", got '"+(this.terminals_[Ne]||Ne)+"'":mt="Parse erro See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),tN(`${rN} Failed parsing: < ${e.toString()} > Using the @chevrotain/regexp-to-ast library - Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function nN(e,t,r){switch(e.type){case"Disjunction":for(let i=0;i{if(typeof l=="number")xS(l,t,r);else{let u=l;if(r===!0)for(let h=u.from;h<=u.to;h++)xS(h,t,r);else{for(let h=u.from;h<=u.to&&h=wS){let h=u.from>=wS?u.from:wS,f=u.to,d=np(h),p=np(f);for(let m=d;m<=p;m++)t[m]=m}}}});break;case"Group":nN(s.value,t,r);break;default:throw Error("Non Exhaustive Match")}let o=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&iN(s)===!1||s.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return Ss(t)}function xS(e,t,r){let n=np(e);t[n]=n,r===!0&&Tqe(e,t)}function Tqe(e,t){let r=String.fromCharCode(e),n=r.toUpperCase();if(n!==r){let i=np(n.charCodeAt(0));t[i]=i}else{let i=r.toLowerCase();if(i!==r){let a=np(i.charCodeAt(0));t[a]=a}}}function EJ(e,t){return $w(e.value,r=>{if(typeof r=="number")return Dl(t,r);{let n=r;return $w(t,i=>n.from<=i&&i<=n.to)!==void 0}})}function iN(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?Un(e.value)?Oh(e.value,iN):iN(e.value):!1}function tD(e,t){if(t instanceof RegExp){let r=w6(t),n=new UGt(e);return n.visit(r),n.found}else return $w(t,r=>Dl(e,r.charCodeAt(0)))!==void 0}function Cqe(e,t){t=vre(t,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` -`],tracer:_((x,w)=>w(),"tracer")});let r=t.tracer;r("initCharCodeToOptimizedIndexMap",()=>{Hqe()});let n;r("Reject Lexer.NA",()=>{n=JN(e,x=>x[c2]===Rl.NA)});let i=!1,a;r("Transform Patterns",()=>{i=!1,a=Er(n,x=>{let w=x[c2];if(tp(w)){let C=w.source;return C.length===1&&C!=="^"&&C!=="$"&&C!=="."&&!w.ignoreCase?C:C.length===2&&C[0]==="\\"&&!Dl(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],C[1])?C[1]:AJ(w)}else{if(lp(w))return i=!0,{exec:w};if(typeof w=="object")return i=!0,w;if(typeof w=="string"){if(w.length===1)return w;{let C=w.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),T=new RegExp(C);return AJ(T)}}else throw Error("non exhaustive match")}})});let s,o,l,u,h;r("misc mapping",()=>{s=Er(n,x=>x.tokenTypeIdx),o=Er(n,x=>{let w=x.GROUP;if(w!==Rl.SKIPPED){if(uc(w))return w;if(rp(w))return!1;throw Error("non exhaustive match")}}),l=Er(n,x=>{let w=x.LONGER_ALT;if(w)return Un(w)?Er(w,T=>aPe(n,T)):[aPe(n,w)]}),u=Er(n,x=>x.PUSH_MODE),h=Er(n,x=>Ur(x,"POP_MODE"))});let f;r("Line Terminator Handling",()=>{let x=Sre(t.lineTerminatorCharacters);f=Er(n,w=>!1),t.positionTracking!=="onlyOffset"&&(f=Er(n,w=>Ur(w,"LINE_BREAKS")?!!w.LINE_BREAKS:Cre(w,x)===!1&&tD(x,w.PATTERN)))});let d,p,m,g;r("Misc Mapping #2",()=>{d=Er(n,Tre),p=Er(a,Vqe),m=Zc(n,(x,w)=>{let C=w.GROUP;return uc(C)&&C!==Rl.SKIPPED&&(x[C]=[]),x},{}),g=Er(a,(x,w)=>({pattern:a[w],longerAlt:l[w],canLineTerminator:f[w],isCustom:d[w],short:p[w],group:o[w],push:u[w],pop:h[w],tokenTypeIdx:s[w],tokenType:n[w]}))});let y=!0,v=[];return t.safeMode||r("First Char Optimization",()=>{v=Zc(n,(x,w,C)=>{if(typeof w.PATTERN=="string"){let T=w.PATTERN.charCodeAt(0),k=np(T);pM(x,k,g[C])}else if(Un(w.START_CHARS_HINT)){let T;nn(w.START_CHARS_HINT,k=>{let S=typeof k=="string"?k.charCodeAt(0):k,E=np(S);T!==E&&(T=E,pM(x,E,g[C]))})}else if(tp(w.PATTERN))if(w.PATTERN.unicode)y=!1,t.ensureOptimizations&&tN(`${rN} Unable to analyze < ${w.PATTERN.toString()} > pattern. + Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function nN(e,t,r){switch(e.type){case"Disjunction":for(let i=0;i{if(typeof l=="number")xS(l,t,r);else{let u=l;if(r===!0)for(let h=u.from;h<=u.to;h++)xS(h,t,r);else{for(let h=u.from;h<=u.to&&h=wS){let h=u.from>=wS?u.from:wS,f=u.to,d=np(h),p=np(f);for(let m=d;m<=p;m++)t[m]=m}}}});break;case"Group":nN(s.value,t,r);break;default:throw Error("Non Exhaustive Match")}let o=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&iN(s)===!1||s.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return Ss(t)}function xS(e,t,r){let n=np(e);t[n]=n,r===!0&&Sqe(e,t)}function Sqe(e,t){let r=String.fromCharCode(e),n=r.toUpperCase();if(n!==r){let i=np(n.charCodeAt(0));t[i]=i}else{let i=r.toLowerCase();if(i!==r){let a=np(i.charCodeAt(0));t[a]=a}}}function _J(e,t){return $w(e.value,r=>{if(typeof r=="number")return Ol(t,r);{let n=r;return $w(t,i=>n.from<=i&&i<=n.to)!==void 0}})}function iN(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?Un(e.value)?Oh(e.value,iN):iN(e.value):!1}function tD(e,t){if(t instanceof RegExp){let r=w6(t),n=new KGt(e);return n.visit(r),n.found}else return $w(t,r=>Ol(e,r.charCodeAt(0)))!==void 0}function Eqe(e,t){t=bre(t,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` +`],tracer:_((x,w)=>w(),"tracer")});let r=t.tracer;r("initCharCodeToOptimizedIndexMap",()=>{Yqe()});let n;r("Reject Lexer.NA",()=>{n=JN(e,x=>x[c2]===Ll.NA)});let i=!1,a;r("Transform Patterns",()=>{i=!1,a=Er(n,x=>{let w=x[c2];if(tp(w)){let C=w.source;return C.length===1&&C!=="^"&&C!=="$"&&C!=="."&&!w.ignoreCase?C:C.length===2&&C[0]==="\\"&&!Ol(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],C[1])?C[1]:RJ(w)}else{if(lp(w))return i=!0,{exec:w};if(typeof w=="object")return i=!0,w;if(typeof w=="string"){if(w.length===1)return w;{let C=w.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),T=new RegExp(C);return RJ(T)}}else throw Error("non exhaustive match")}})});let s,o,l,u,h;r("misc mapping",()=>{s=Er(n,x=>x.tokenTypeIdx),o=Er(n,x=>{let w=x.GROUP;if(w!==Ll.SKIPPED){if(hc(w))return w;if(rp(w))return!1;throw Error("non exhaustive match")}}),l=Er(n,x=>{let w=x.LONGER_ALT;if(w)return Un(w)?Er(w,T=>oPe(n,T)):[oPe(n,w)]}),u=Er(n,x=>x.PUSH_MODE),h=Er(n,x=>Ur(x,"POP_MODE"))});let f;r("Line Terminator Handling",()=>{let x=Are(t.lineTerminatorCharacters);f=Er(n,w=>!1),t.positionTracking!=="onlyOffset"&&(f=Er(n,w=>Ur(w,"LINE_BREAKS")?!!w.LINE_BREAKS:Ere(w,x)===!1&&tD(x,w.PATTERN)))});let d,p,m,g;r("Misc Mapping #2",()=>{d=Er(n,Sre),p=Er(a,Hqe),m=Zc(n,(x,w)=>{let C=w.GROUP;return hc(C)&&C!==Ll.SKIPPED&&(x[C]=[]),x},{}),g=Er(a,(x,w)=>({pattern:a[w],longerAlt:l[w],canLineTerminator:f[w],isCustom:d[w],short:p[w],group:o[w],push:u[w],pop:h[w],tokenTypeIdx:s[w],tokenType:n[w]}))});let y=!0,v=[];return t.safeMode||r("First Char Optimization",()=>{v=Zc(n,(x,w,C)=>{if(typeof w.PATTERN=="string"){let T=w.PATTERN.charCodeAt(0),k=np(T);pM(x,k,g[C])}else if(Un(w.START_CHARS_HINT)){let T;nn(w.START_CHARS_HINT,k=>{let S=typeof k=="string"?k.charCodeAt(0):k,E=np(S);T!==E&&(T=E,pM(x,E,g[C]))})}else if(tp(w.PATTERN))if(w.PATTERN.unicode)y=!1,t.ensureOptimizations&&tN(`${rN} Unable to analyze < ${w.PATTERN.toString()} > pattern. The regexp unicode flag is not currently supported by the regexp-to-ast library. This will disable the lexer's first char optimizations. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let T=kqe(w.PATTERN,t.ensureOptimizations);qi(T)&&(y=!1),nn(T,k=>{pM(x,k,g[C])})}else t.ensureOptimizations&&tN(`${rN} TokenType: <${w.name}> is using a custom token pattern without providing parameter. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let T=Cqe(w.PATTERN,t.ensureOptimizations);qi(T)&&(y=!1),nn(T,k=>{pM(x,k,g[C])})}else t.ensureOptimizations&&tN(`${rN} TokenType: <${w.name}> is using a custom token pattern without providing parameter. This will disable the lexer's first char optimizations. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),y=!1;return x},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:v,hasCustom:i,canBeOptimized:y}}function Sqe(e,t){let r=[],n=Aqe(e);r=r.concat(n.errors);let i=_qe(n.valid),a=i.valid;return r=r.concat(i.errors),r=r.concat(Eqe(a)),r=r.concat(Dqe(a)),r=r.concat(Oqe(a,t)),r=r.concat(Pqe(a)),r}function Eqe(e){let t=[],r=Uu(e,n=>tp(n[c2]));return t=t.concat(Rqe(r)),t=t.concat(Iqe(r)),t=t.concat(Mqe(r)),t=t.concat(Nqe(r)),t=t.concat(Lqe(r)),t}function Aqe(e){let t=Uu(e,i=>!Ur(i,c2)),r=Er(t,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Ma.MISSING_PATTERN,tokenTypes:[i]})),n=QN(e,t);return{errors:r,valid:n}}function _qe(e){let t=Uu(e,i=>{let a=i[c2];return!tp(a)&&!lp(a)&&!Ur(a,"exec")&&!uc(a)}),r=Er(t,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Ma.INVALID_PATTERN,tokenTypes:[i]})),n=QN(e,t);return{errors:r,valid:n}}function Rqe(e){class t extends NN{static{_(this,"EndAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitEndAnchor(a){this.found=!0}}let r=Uu(e,i=>{let a=i.PATTERN;try{let s=w6(a),o=new t;return o.visit(s),o.found}catch{return YGt.test(a.source)}});return Er(r,i=>({message:`Unexpected RegExp Anchor Error: + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),y=!1;return x},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:v,hasCustom:i,canBeOptimized:y}}function Aqe(e,t){let r=[],n=Rqe(e);r=r.concat(n.errors);let i=Lqe(n.valid),a=i.valid;return r=r.concat(i.errors),r=r.concat(_qe(a)),r=r.concat(Pqe(a)),r=r.concat(Bqe(a,t)),r=r.concat(Fqe(a)),r}function _qe(e){let t=[],r=Uu(e,n=>tp(n[c2]));return t=t.concat(Iqe(r)),t=t.concat(Nqe(r)),t=t.concat(Dqe(r)),t=t.concat(Oqe(r)),t=t.concat(Mqe(r)),t}function Rqe(e){let t=Uu(e,i=>!Ur(i,c2)),r=Er(t,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Ma.MISSING_PATTERN,tokenTypes:[i]})),n=QN(e,t);return{errors:r,valid:n}}function Lqe(e){let t=Uu(e,i=>{let a=i[c2];return!tp(a)&&!lp(a)&&!Ur(a,"exec")&&!hc(a)}),r=Er(t,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Ma.INVALID_PATTERN,tokenTypes:[i]})),n=QN(e,t);return{errors:r,valid:n}}function Iqe(e){class t extends NN{static{_(this,"EndAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitEndAnchor(a){this.found=!0}}let r=Uu(e,i=>{let a=i.PATTERN;try{let s=w6(a),o=new t;return o.visit(s),o.found}catch{return ZGt.test(a.source)}});return Er(r,i=>({message:`Unexpected RegExp Anchor Error: Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$' - See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Ma.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Lqe(e){let t=Uu(e,n=>n.PATTERN.test(""));return Er(t,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Ma.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}function Iqe(e){class t extends NN{static{_(this,"StartAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitStartAnchor(a){this.found=!0}}let r=Uu(e,i=>{let a=i.PATTERN;try{let s=w6(a),o=new t;return o.visit(s),o.found}catch{return XGt.test(a.source)}});return Er(r,i=>({message:`Unexpected RegExp Anchor Error: + See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Ma.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Mqe(e){let t=Uu(e,n=>n.PATTERN.test(""));return Er(t,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Ma.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}function Nqe(e){class t extends NN{static{_(this,"StartAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitStartAnchor(a){this.found=!0}}let r=Uu(e,i=>{let a=i.PATTERN;try{let s=w6(a),o=new t;return o.visit(s),o.found}catch{return QGt.test(a.source)}});return Er(r,i=>({message:`Unexpected RegExp Anchor Error: Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^' - See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Ma.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Mqe(e){let t=Uu(e,n=>{let i=n[c2];return i instanceof RegExp&&(i.multiline||i.global)});return Er(t,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Ma.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function Nqe(e){let t=[],r=Er(e,a=>Zc(e,(s,o)=>(a.PATTERN.source===o.PATTERN.source&&!Dl(t,o)&&o.PATTERN!==Rl.NA&&(t.push(o),s.push(o)),s),[]));r=b6(r);let n=Uu(r,a=>a.length>1);return Er(n,a=>{let s=Er(a,l=>l.name);return{message:`The same RegExp pattern ->${Bh(a).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Ma.DUPLICATE_PATTERNS_FOUND,tokenTypes:a}})}function Dqe(e){let t=Uu(e,n=>{if(!Ur(n,"GROUP"))return!1;let i=n.GROUP;return i!==Rl.SKIPPED&&i!==Rl.NA&&!uc(i)});return Er(t,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Ma.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function Oqe(e,t){let r=Uu(e,i=>i.PUSH_MODE!==void 0&&!Dl(t,i.PUSH_MODE));return Er(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Ma.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function Pqe(e){let t=[],r=Zc(e,(n,i,a)=>{let s=i.PATTERN;return s===Rl.NA||(uc(s)?n.push({str:s,idx:a,tokenType:i}):tp(s)&&Fqe(s)&&n.push({str:s.source,idx:a,tokenType:i})),n},[]);return nn(e,(n,i)=>{nn(r,({str:a,idx:s,tokenType:o})=>{if(i${o.name}<- can never be matched. + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Ma.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Dqe(e){let t=Uu(e,n=>{let i=n[c2];return i instanceof RegExp&&(i.multiline||i.global)});return Er(t,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Ma.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function Oqe(e){let t=[],r=Er(e,a=>Zc(e,(s,o)=>(a.PATTERN.source===o.PATTERN.source&&!Ol(t,o)&&o.PATTERN!==Ll.NA&&(t.push(o),s.push(o)),s),[]));r=b6(r);let n=Uu(r,a=>a.length>1);return Er(n,a=>{let s=Er(a,l=>l.name);return{message:`The same RegExp pattern ->${Bh(a).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Ma.DUPLICATE_PATTERNS_FOUND,tokenTypes:a}})}function Pqe(e){let t=Uu(e,n=>{if(!Ur(n,"GROUP"))return!1;let i=n.GROUP;return i!==Ll.SKIPPED&&i!==Ll.NA&&!hc(i)});return Er(t,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Ma.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function Bqe(e,t){let r=Uu(e,i=>i.PUSH_MODE!==void 0&&!Ol(t,i.PUSH_MODE));return Er(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Ma.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function Fqe(e){let t=[],r=Zc(e,(n,i,a)=>{let s=i.PATTERN;return s===Ll.NA||(hc(s)?n.push({str:s,idx:a,tokenType:i}):tp(s)&&zqe(s)&&n.push({str:s.source,idx:a,tokenType:i})),n},[]);return nn(e,(n,i)=>{nn(r,({str:a,idx:s,tokenType:o})=>{if(i${o.name}<- can never be matched. Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition. -See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:l,type:Ma.UNREACHABLE_PATTERN,tokenTypes:[n,o]})}})}),t}function Bqe(e,t){if(tp(t)){if($qe(t))return!1;let r=t.exec(e);return r!==null&&r.index===0}else{if(lp(t))return t(e,0,[],{});if(Ur(t,"exec"))return t.exec(e,0,[],{});if(typeof t=="string")return t===e;throw Error("non exhaustive match")}}function Fqe(e){return $w([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>e.source.indexOf(r)!==-1)===void 0}function $qe(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\? property in its definition +See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:l,type:Ma.UNREACHABLE_PATTERN,tokenTypes:[n,o]})}})}),t}function $qe(e,t){if(tp(t)){if(Gqe(t))return!1;let r=t.exec(e);return r!==null&&r.index===0}else{if(lp(t))return t(e,0,[],{});if(Ur(t,"exec"))return t.exec(e,0,[],{});if(typeof t=="string")return t===e;throw Error("non exhaustive match")}}function zqe(e){return $w([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>e.source.indexOf(r)!==-1)===void 0}function Gqe(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\? property in its definition `,type:Ma.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Ur(e,GI)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+GI+`> property in its definition `,type:Ma.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Ur(e,GI)&&Ur(e,bS)&&!Ur(e.modes,e.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${bS}: <${e.defaultMode}>which does not exist `,type:Ma.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Ur(e,GI)&&nn(e.modes,(i,a)=>{nn(i,(s,o)=>{if(rp(s))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${a}> at index: <${o}> -`,type:Ma.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(Ur(s,"LONGER_ALT")){let l=Un(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT];nn(l,u=>{!rp(u)&&!Dl(i,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${s.name}> outside of mode <${a}> -`,type:Ma.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function Gqe(e,t,r){let n=[],i=!1,a=b6(Dh(Ss(e.modes))),s=JN(a,l=>l[c2]===Rl.NA),o=Sre(r);return t&&nn(s,l=>{let u=Cre(l,o);if(u!==!1){let f={message:Wqe(l,u),type:u.issue,tokenType:l};n.push(f)}else Ur(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):tD(o,l.PATTERN)&&(i=!0)}),t&&!i&&n.push({message:`Warning: No LINE_BREAKS Found. +`,type:Ma.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(Ur(s,"LONGER_ALT")){let l=Un(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT];nn(l,u=>{!rp(u)&&!Ol(i,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${s.name}> outside of mode <${a}> +`,type:Ma.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function Vqe(e,t,r){let n=[],i=!1,a=b6(Dh(Ss(e.modes))),s=JN(a,l=>l[c2]===Ll.NA),o=Are(r);return t&&nn(s,l=>{let u=Ere(l,o);if(u!==!1){let f={message:Uqe(l,u),type:u.issue,tokenType:l};n.push(f)}else Ur(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):tD(o,l.PATTERN)&&(i=!0)}),t&&!i&&n.push({message:`Warning: No LINE_BREAKS Found. This Lexer has been defined to track line and column information, But none of the Token Types can be identified as matching a line terminator. See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS - for details.`,type:Ma.NO_LINE_BREAKS_FLAGS}),n}function qqe(e){let t={},r=jc(e);return nn(r,n=>{let i=e[n];if(Un(i))t[n]=[];else throw Error("non exhaustive match")}),t}function Tre(e){let t=e.PATTERN;if(tp(t))return!1;if(lp(t))return!0;if(Ur(t,"exec"))return!0;if(uc(t))return!1;throw Error("non exhaustive match")}function Vqe(e){return uc(e)&&e.length===1?e.charCodeAt(0):!1}function Cre(e,t){if(Ur(e,"LINE_BREAKS"))return!1;if(tp(e.PATTERN)){try{tD(t,e.PATTERN)}catch(r){return{issue:Ma.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(uc(e.PATTERN))return!1;if(Tre(e))return{issue:Ma.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Wqe(e,t){if(t.issue===Ma.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern. + for details.`,type:Ma.NO_LINE_BREAKS_FLAGS}),n}function Wqe(e){let t={},r=jc(e);return nn(r,n=>{let i=e[n];if(Un(i))t[n]=[];else throw Error("non exhaustive match")}),t}function Sre(e){let t=e.PATTERN;if(tp(t))return!1;if(lp(t))return!0;if(Ur(t,"exec"))return!0;if(hc(t))return!1;throw Error("non exhaustive match")}function Hqe(e){return hc(e)&&e.length===1?e.charCodeAt(0):!1}function Ere(e,t){if(Ur(e,"LINE_BREAKS"))return!1;if(tp(e.PATTERN)){try{tD(t,e.PATTERN)}catch(r){return{issue:Ma.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(hc(e.PATTERN))return!1;if(Sre(e))return{issue:Ma.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function Uqe(e,t){if(t.issue===Ma.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern. The problem is in the <${e.name}> Token Type Root cause: ${t.errMsg}. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===Ma.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. The problem is in the <${e.name}> Token Type - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Sre(e){return Er(e,r=>uc(r)?r.charCodeAt(0):r)}function pM(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function np(e){return e255?255+~~(e/255):e}}function Xw(e,t){let r=e.tokenTypeIdx;return r===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[r]===!0}function KS(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}function jw(e){let t=Yqe(e);Xqe(t),Kqe(t),jqe(t),nn(t,r=>{r.isParent=r.categoryMatches.length>0})}function Yqe(e){let t=ko(e),r=e,n=!0;for(;n;){r=b6(Dh(Er(r,a=>a.CATEGORIES)));let i=QN(r,t);t=t.concat(i),qi(i)?n=!1:r=i}return t}function Xqe(e){nn(e,t=>{Are(t)||(Uqe[oPe]=t,t.tokenTypeIdx=oPe++),_J(t)&&!Un(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),_J(t)||(t.CATEGORIES=[]),Zqe(t)||(t.categoryMatches=[]),Qqe(t)||(t.categoryMatchesMap={})})}function jqe(e){nn(e,t=>{t.categoryMatches=[],nn(t.categoryMatchesMap,(r,n)=>{t.categoryMatches.push(Uqe[n].tokenTypeIdx)})})}function Kqe(e){nn(e,t=>{Ere([],t)})}function Ere(e,t){nn(e,r=>{t.categoryMatchesMap[r.tokenTypeIdx]=!0}),nn(t.CATEGORIES,r=>{let n=e.concat(t);Dl(n,r)||Ere(n,r)})}function Are(e){return Ur(e,"tokenTypeIdx")}function _J(e){return Ur(e,"CATEGORIES")}function Zqe(e){return Ur(e,"categoryMatches")}function Qqe(e){return Ur(e,"categoryMatchesMap")}function Jqe(e){return Ur(e,"tokenTypeIdx")}function a2(e){return _re(e)?e.LABEL:e.name}function _re(e){return uc(e.LABEL)&&e.LABEL!==""}function Rw(e){return eVe(e)}function eVe(e){let t=e.pattern,r={};if(r.name=e.name,rp(t)||(r.PATTERN=t),Ur(e,KGt))throw`The parent property is no longer supported. -See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Ur(e,lPe)&&(r.CATEGORIES=e[lPe]),jw([r]),Ur(e,cPe)&&(r.LABEL=e[cPe]),Ur(e,uPe)&&(r.GROUP=e[uPe]),Ur(e,fPe)&&(r.POP_MODE=e[fPe]),Ur(e,hPe)&&(r.PUSH_MODE=e[hPe]),Ur(e,dPe)&&(r.LONGER_ALT=e[dPe]),Ur(e,pPe)&&(r.LINE_BREAKS=e[pPe]),Ur(e,mPe)&&(r.START_CHARS_HINT=e[mPe]),r}function k6(e,t,r,n,i,a,s,o){return{image:t,startOffset:r,endOffset:n,startLine:i,endLine:a,startColumn:s,endColumn:o,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function Rre(e,t){return Xw(e,t)}function tVe(e,t){let r=new QGt(e,t);return r.resolveRefs(),r.errors}function aN(e,t,r=[]){r=ko(r);let n=[],i=0;function a(o){return o.concat(bo(e,i+1))}_(a,"remainingPathWith");function s(o){let l=aN(a(o),t,r);return n.concat(l)}for(_(s,"getAlternativesForProd");r.length{qi(l.definition)===!1&&(n=s(l.definition))}),n;if(o instanceof Qi)r.push(o.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:bo(e,i)}),n}function Lre(e,t,r,n){let i="EXIT_NONE_TERMINAL",a=[i],s="EXIT_ALTERNATIVE",o=!1,l=t.length,u=l-n-1,h=[],f=[];for(f.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!qi(f);){let d=f.pop();if(d===s){o&&l2(f).idx<=u&&f.pop();continue}let p=d.def,m=d.idx,g=d.ruleStack,y=d.occurrenceStack;if(qi(p))continue;let v=p[0];if(v===i){let x={idx:m,def:bo(p),ruleStack:XS(g),occurrenceStack:XS(y)};f.push(x)}else if(v instanceof Qi)if(m=0;x--){let w=v.definition[x],C={idx:m,def:w.definition.concat(bo(p)),ruleStack:g,occurrenceStack:y};f.push(C),f.push(s)}else if(v instanceof hc)f.push({idx:m,def:v.definition.concat(bo(p)),ruleStack:g,occurrenceStack:y});else if(v instanceof Hw)f.push(rVe(v,m,g,y));else throw Error("non exhaustive match")}return h}function rVe(e,t,r,n){let i=ko(r);i.push(e.name);let a=ko(n);return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}function nD(e){if(e instanceof wo||e==="Option")return va.OPTION;if(e instanceof Ia||e==="Repetition")return va.REPETITION;if(e instanceof Qc||e==="RepetitionMandatory")return va.REPETITION_MANDATORY;if(e instanceof Jc||e==="RepetitionMandatoryWithSeparator")return va.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof fc||e==="RepetitionWithSeparator")return va.REPETITION_WITH_SEPARATOR;if(e instanceof dc||e==="Alternation")return va.ALTERNATION;throw Error("non exhaustive match")}function LJ(e){let{occurrence:t,rule:r,prodType:n,maxLookahead:i}=e,a=nD(n);return a===va.ALTERNATION?T6(t,r,i):C6(t,r,a,i)}function nVe(e,t,r,n,i,a){let s=T6(e,t,r),o=Mre(s)?KS:Xw;return a(s,n,o,i)}function iVe(e,t,r,n,i,a){let s=C6(e,t,i,r),o=Mre(s)?KS:Xw;return a(s[0],o,n)}function aVe(e,t,r,n){let i=e.length,a=Oh(e,s=>Oh(s,o=>o.length===1));if(t)return function(s){let o=Er(s,l=>l.GATE);for(let l=0;lDh(l)),o=Zc(s,(l,u,h)=>(nn(u,f=>{Ur(l,f.tokenTypeIdx)||(l[f.tokenTypeIdx]=h),nn(f.categoryMatches,d=>{Ur(l,d)||(l[d]=h)})}),l),{});return function(){let l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let s=0;sa.length===1),i=e.length;if(n&&!r){let a=Dh(e);if(a.length===1&&qi(a[0].categoryMatches)){let o=a[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{let s=Zc(a,(o,l,u)=>(o[l.tokenTypeIdx]=!0,nn(l.categoryMatches,h=>{o[h]=!0}),o),[]);return function(){let o=this.LA(1);return s[o.tokenTypeIdx]===!0}}}else return function(){e:for(let a=0;aaN([s],1)),n=IJ(r.length),i=Er(r,s=>{let o={};return nn(s,l=>{let u=gM(l.partialPath);nn(u,h=>{o[h]=!0})}),o}),a=r;for(let s=1;s<=t;s++){let o=a;a=IJ(o.length);for(let l=0;l{let v=gM(y.partialPath);nn(v,x=>{i[l][x]=!0})})}}}}return n}function T6(e,t,r,n){let i=new oVe(e,va.ALTERNATION,n);return t.accept(i),Ire(i.result,r)}function C6(e,t,r,n){let i=new oVe(e,r);t.accept(i);let a=i.result,o=new nqt(t,e,r).startWalking(),l=new hc({definition:a}),u=new hc({definition:o});return Ire([l,u],n)}function sN(e,t){e:for(let r=0;r{let i=t[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function Mre(e){return Oh(e,t=>Oh(t,r=>Oh(r,n=>qi(n.categoryMatches))))}function uVe(e){let t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return Er(t,r=>Object.assign({type:Ml.CUSTOM_LOOKAHEAD_VALIDATION},r))}function hVe(e,t,r,n){let i=qu(e,l=>fVe(l,r)),a=kVe(e,t,r),s=qu(e,l=>vVe(l,r)),o=qu(e,l=>pVe(l,e,n,r));return i.concat(a,s,o)}function fVe(e,t){let r=new iqt;e.accept(r);let n=r.allProductions,i=vGt(n,dVe),a=Fh(i,o=>o.length>1);return Er(Ss(a),o=>{let l=Bh(o),u=t.buildDuplicateFoundError(e,o),h=Lh(l),f={message:u,type:Ml.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:h,occurrence:l.idx},d=Nre(l);return d&&(f.parameter=d),f})}function dVe(e){return`${Lh(e)}_#_${e.idx}_#_${Nre(e)}`}function Nre(e){return e instanceof Qi?e.terminalType.name:e instanceof Il?e.nonTerminalName:""}function pVe(e,t,r,n){let i=[];if(Zc(t,(s,o)=>o.name===e.name?s+1:s,0)>1){let s=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:r});i.push({message:s,type:Ml.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function mVe(e,t,r){let n=[],i;return Dl(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Ml.INVALID_RULE_OVERRIDE,ruleName:e})),n}function Dre(e,t,r,n=[]){let i=[],a=OS(t.definition);if(qi(a))return[];{let s=e.name;Dl(a,e)&&i.push({message:r.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Ml.LEFT_RECURSION,ruleName:s});let l=QN(a,n.concat([e])),u=qu(l,h=>{let f=ko(n);return f.push(h),Dre(e,h,r,f)});return i.concat(u)}}function OS(e){let t=[];if(qi(e))return t;let r=Bh(e);if(r instanceof Il)t.push(r.referencedRule);else if(r instanceof hc||r instanceof wo||r instanceof Qc||r instanceof Jc||r instanceof fc||r instanceof Ia)t=t.concat(OS(r.definition));else if(r instanceof dc)t=Dh(Er(r.definition,a=>OS(a.definition)));else if(!(r instanceof Qi))throw Error("non exhaustive match");let n=jS(r),i=e.length>1;if(n&&i){let a=bo(e);return t.concat(OS(a))}else return t}function gVe(e,t){let r=new Ore;e.accept(r);let n=r.alternations;return qu(n,a=>{let s=XS(a.definition);return qu(s,(o,l)=>{let u=Lre([o],[],Xw,1);return qi(u)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:a,emptyChoiceIdx:l}),type:Ml.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:a.idx,alternative:l+1}]:[]})})}function yVe(e,t,r){let n=new Ore;e.accept(n);let i=n.alternations;return i=JN(i,s=>s.ignoreAmbiguities===!0),qu(i,s=>{let o=s.idx,l=s.maxLookahead||t,u=T6(o,e,l,s),h=bVe(u,s,e,r),f=wVe(u,s,e,r);return h.concat(f)})}function vVe(e,t){let r=new Ore;e.accept(r);let n=r.alternations;return qu(n,a=>a.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:a}),type:Ml.TOO_MANY_ALTS,ruleName:e.name,occurrence:a.idx}]:[])}function xVe(e,t,r){let n=[];return nn(e,i=>{let a=new aqt;i.accept(a);let s=a.allProductions;nn(s,o=>{let l=nD(o),u=o.maxLookahead||t,h=o.idx,d=C6(h,i,l,u)[0];if(qi(Dh(d))){let p=r.buildEmptyRepetitionError({topLevelRule:i,repetition:o});n.push({message:p,type:Ml.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function bVe(e,t,r,n){let i=[],a=Zc(e,(o,l,u)=>(t.definition[u].ignoreAmbiguities===!0||nn(l,h=>{let f=[u];nn(e,(d,p)=>{u!==p&&sN(d,h)&&t.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!sN(i,h)&&(i.push(h),o.push({alts:f,path:h}))}),o),[]);return Er(a,o=>{let l=Er(o.alts,h=>h+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:l,prefixPath:o.path}),type:Ml.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:t.idx,alternatives:o.alts}})}function wVe(e,t,r,n){let i=Zc(e,(s,o,l)=>{let u=Er(o,h=>({idx:l,path:h}));return s.concat(u)},[]);return b6(qu(i,s=>{if(t.definition[s.idx].ignoreAmbiguities===!0)return[];let l=s.idx,u=s.path,h=Uu(i,d=>t.definition[d.idx].ignoreAmbiguities!==!0&&d.idx{let p=[d.idx+1,l+1],m=t.idx===0?"":t.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:p,prefixPath:d.path}),type:Ml.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:m,alternatives:p}})}))}function kVe(e,t,r){let n=[],i=Er(t,a=>a.name);return nn(e,a=>{let s=a.name;if(Dl(i,s)){let o=r.buildNamespaceConflictError(a);n.push({message:o,type:Ml.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function TVe(e){let t=vre(e,{errMsgProvider:ZGt}),r={};return nn(e.rules,n=>{r[n.name]=n}),tVe(r,t.errMsgProvider)}function CVe(e){return e=vre(e,{errMsgProvider:r2}),hVe(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}function ZS(e){return Dl(RVe,e.name)}function MVe(e,t,r,n,i,a,s){let o=this.getKeyForAutomaticLookahead(n,i),l=this.firstAfterRepMap[o];if(l===void 0){let d=this.getCurrRuleFullName(),p=this.getGAstProductions()[d];l=new a(p,i).startWalking(),this.firstAfterRepMap[o]=l}let u=l.token,h=l.occurrence,f=l.isEndOfRule;this.RULE_STACK.length===1&&f&&u===void 0&&(u=qg,h=1),!(u===void 0||h===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,h,s)&&this.tryInRepetitionRecovery(e,t,r,u)}function vM(e,t,r){return r|t|e}function OVe(e){qI.reset(),e.accept(qI);let t=qI.dslMethods;return qI.reset(),t}function OJ(e,t){isNaN(e.startOffset)===!0?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffsets.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Are(e){return Er(e,r=>hc(r)?r.charCodeAt(0):r)}function pM(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function np(e){return e255?255+~~(e/255):e}}function Xw(e,t){let r=e.tokenTypeIdx;return r===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[r]===!0}function KS(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}function jw(e){let t=jqe(e);Kqe(t),Qqe(t),Zqe(t),nn(t,r=>{r.isParent=r.categoryMatches.length>0})}function jqe(e){let t=ko(e),r=e,n=!0;for(;n;){r=b6(Dh(Er(r,a=>a.CATEGORIES)));let i=QN(r,t);t=t.concat(i),qi(i)?n=!1:r=i}return t}function Kqe(e){nn(e,t=>{Rre(t)||(Xqe[cPe]=t,t.tokenTypeIdx=cPe++),LJ(t)&&!Un(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),LJ(t)||(t.CATEGORIES=[]),Jqe(t)||(t.categoryMatches=[]),eVe(t)||(t.categoryMatchesMap={})})}function Zqe(e){nn(e,t=>{t.categoryMatches=[],nn(t.categoryMatchesMap,(r,n)=>{t.categoryMatches.push(Xqe[n].tokenTypeIdx)})})}function Qqe(e){nn(e,t=>{_re([],t)})}function _re(e,t){nn(e,r=>{t.categoryMatchesMap[r.tokenTypeIdx]=!0}),nn(t.CATEGORIES,r=>{let n=e.concat(t);Ol(n,r)||_re(n,r)})}function Rre(e){return Ur(e,"tokenTypeIdx")}function LJ(e){return Ur(e,"CATEGORIES")}function Jqe(e){return Ur(e,"categoryMatches")}function eVe(e){return Ur(e,"categoryMatchesMap")}function tVe(e){return Ur(e,"tokenTypeIdx")}function a2(e){return Lre(e)?e.LABEL:e.name}function Lre(e){return hc(e.LABEL)&&e.LABEL!==""}function Rw(e){return rVe(e)}function rVe(e){let t=e.pattern,r={};if(r.name=e.name,rp(t)||(r.PATTERN=t),Ur(e,eqt))throw`The parent property is no longer supported. +See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Ur(e,uPe)&&(r.CATEGORIES=e[uPe]),jw([r]),Ur(e,hPe)&&(r.LABEL=e[hPe]),Ur(e,fPe)&&(r.GROUP=e[fPe]),Ur(e,pPe)&&(r.POP_MODE=e[pPe]),Ur(e,dPe)&&(r.PUSH_MODE=e[dPe]),Ur(e,mPe)&&(r.LONGER_ALT=e[mPe]),Ur(e,gPe)&&(r.LINE_BREAKS=e[gPe]),Ur(e,yPe)&&(r.START_CHARS_HINT=e[yPe]),r}function k6(e,t,r,n,i,a,s,o){return{image:t,startOffset:r,endOffset:n,startLine:i,endLine:a,startColumn:s,endColumn:o,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function Ire(e,t){return Xw(e,t)}function nVe(e,t){let r=new rqt(e,t);return r.resolveRefs(),r.errors}function aN(e,t,r=[]){r=ko(r);let n=[],i=0;function a(o){return o.concat(bo(e,i+1))}_(a,"remainingPathWith");function s(o){let l=aN(a(o),t,r);return n.concat(l)}for(_(s,"getAlternativesForProd");r.length{qi(l.definition)===!1&&(n=s(l.definition))}),n;if(o instanceof Qi)r.push(o.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:bo(e,i)}),n}function Mre(e,t,r,n){let i="EXIT_NONE_TERMINAL",a=[i],s="EXIT_ALTERNATIVE",o=!1,l=t.length,u=l-n-1,h=[],f=[];for(f.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!qi(f);){let d=f.pop();if(d===s){o&&l2(f).idx<=u&&f.pop();continue}let p=d.def,m=d.idx,g=d.ruleStack,y=d.occurrenceStack;if(qi(p))continue;let v=p[0];if(v===i){let x={idx:m,def:bo(p),ruleStack:XS(g),occurrenceStack:XS(y)};f.push(x)}else if(v instanceof Qi)if(m=0;x--){let w=v.definition[x],C={idx:m,def:w.definition.concat(bo(p)),ruleStack:g,occurrenceStack:y};f.push(C),f.push(s)}else if(v instanceof fc)f.push({idx:m,def:v.definition.concat(bo(p)),ruleStack:g,occurrenceStack:y});else if(v instanceof Hw)f.push(iVe(v,m,g,y));else throw Error("non exhaustive match")}return h}function iVe(e,t,r,n){let i=ko(r);i.push(e.name);let a=ko(n);return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}function nD(e){if(e instanceof wo||e==="Option")return va.OPTION;if(e instanceof Ia||e==="Repetition")return va.REPETITION;if(e instanceof Qc||e==="RepetitionMandatory")return va.REPETITION_MANDATORY;if(e instanceof Jc||e==="RepetitionMandatoryWithSeparator")return va.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof dc||e==="RepetitionWithSeparator")return va.REPETITION_WITH_SEPARATOR;if(e instanceof pc||e==="Alternation")return va.ALTERNATION;throw Error("non exhaustive match")}function MJ(e){let{occurrence:t,rule:r,prodType:n,maxLookahead:i}=e,a=nD(n);return a===va.ALTERNATION?T6(t,r,i):C6(t,r,a,i)}function aVe(e,t,r,n,i,a){let s=T6(e,t,r),o=Dre(s)?KS:Xw;return a(s,n,o,i)}function sVe(e,t,r,n,i,a){let s=C6(e,t,i,r),o=Dre(s)?KS:Xw;return a(s[0],o,n)}function oVe(e,t,r,n){let i=e.length,a=Oh(e,s=>Oh(s,o=>o.length===1));if(t)return function(s){let o=Er(s,l=>l.GATE);for(let l=0;lDh(l)),o=Zc(s,(l,u,h)=>(nn(u,f=>{Ur(l,f.tokenTypeIdx)||(l[f.tokenTypeIdx]=h),nn(f.categoryMatches,d=>{Ur(l,d)||(l[d]=h)})}),l),{});return function(){let l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let s=0;sa.length===1),i=e.length;if(n&&!r){let a=Dh(e);if(a.length===1&&qi(a[0].categoryMatches)){let o=a[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{let s=Zc(a,(o,l,u)=>(o[l.tokenTypeIdx]=!0,nn(l.categoryMatches,h=>{o[h]=!0}),o),[]);return function(){let o=this.LA(1);return s[o.tokenTypeIdx]===!0}}}else return function(){e:for(let a=0;aaN([s],1)),n=NJ(r.length),i=Er(r,s=>{let o={};return nn(s,l=>{let u=gM(l.partialPath);nn(u,h=>{o[h]=!0})}),o}),a=r;for(let s=1;s<=t;s++){let o=a;a=NJ(o.length);for(let l=0;l{let v=gM(y.partialPath);nn(v,x=>{i[l][x]=!0})})}}}}return n}function T6(e,t,r,n){let i=new cVe(e,va.ALTERNATION,n);return t.accept(i),Nre(i.result,r)}function C6(e,t,r,n){let i=new cVe(e,r);t.accept(i);let a=i.result,o=new oqt(t,e,r).startWalking(),l=new fc({definition:a}),u=new fc({definition:o});return Nre([l,u],n)}function sN(e,t){e:for(let r=0;r{let i=t[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function Dre(e){return Oh(e,t=>Oh(t,r=>Oh(r,n=>qi(n.categoryMatches))))}function fVe(e){let t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return Er(t,r=>Object.assign({type:Nl.CUSTOM_LOOKAHEAD_VALIDATION},r))}function dVe(e,t,r,n){let i=qu(e,l=>pVe(l,r)),a=CVe(e,t,r),s=qu(e,l=>bVe(l,r)),o=qu(e,l=>gVe(l,e,n,r));return i.concat(a,s,o)}function pVe(e,t){let r=new lqt;e.accept(r);let n=r.allProductions,i=kGt(n,mVe),a=Fh(i,o=>o.length>1);return Er(Ss(a),o=>{let l=Bh(o),u=t.buildDuplicateFoundError(e,o),h=Lh(l),f={message:u,type:Nl.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:h,occurrence:l.idx},d=Ore(l);return d&&(f.parameter=d),f})}function mVe(e){return`${Lh(e)}_#_${e.idx}_#_${Ore(e)}`}function Ore(e){return e instanceof Qi?e.terminalType.name:e instanceof Ml?e.nonTerminalName:""}function gVe(e,t,r,n){let i=[];if(Zc(t,(s,o)=>o.name===e.name?s+1:s,0)>1){let s=n.buildDuplicateRuleNameError({topLevelRule:e,grammarName:r});i.push({message:s,type:Nl.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function yVe(e,t,r){let n=[],i;return Ol(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Nl.INVALID_RULE_OVERRIDE,ruleName:e})),n}function Pre(e,t,r,n=[]){let i=[],a=OS(t.definition);if(qi(a))return[];{let s=e.name;Ol(a,e)&&i.push({message:r.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:n}),type:Nl.LEFT_RECURSION,ruleName:s});let l=QN(a,n.concat([e])),u=qu(l,h=>{let f=ko(n);return f.push(h),Pre(e,h,r,f)});return i.concat(u)}}function OS(e){let t=[];if(qi(e))return t;let r=Bh(e);if(r instanceof Ml)t.push(r.referencedRule);else if(r instanceof fc||r instanceof wo||r instanceof Qc||r instanceof Jc||r instanceof dc||r instanceof Ia)t=t.concat(OS(r.definition));else if(r instanceof pc)t=Dh(Er(r.definition,a=>OS(a.definition)));else if(!(r instanceof Qi))throw Error("non exhaustive match");let n=jS(r),i=e.length>1;if(n&&i){let a=bo(e);return t.concat(OS(a))}else return t}function vVe(e,t){let r=new Bre;e.accept(r);let n=r.alternations;return qu(n,a=>{let s=XS(a.definition);return qu(s,(o,l)=>{let u=Mre([o],[],Xw,1);return qi(u)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:a,emptyChoiceIdx:l}),type:Nl.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:a.idx,alternative:l+1}]:[]})})}function xVe(e,t,r){let n=new Bre;e.accept(n);let i=n.alternations;return i=JN(i,s=>s.ignoreAmbiguities===!0),qu(i,s=>{let o=s.idx,l=s.maxLookahead||t,u=T6(o,e,l,s),h=kVe(u,s,e,r),f=TVe(u,s,e,r);return h.concat(f)})}function bVe(e,t){let r=new Bre;e.accept(r);let n=r.alternations;return qu(n,a=>a.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:a}),type:Nl.TOO_MANY_ALTS,ruleName:e.name,occurrence:a.idx}]:[])}function wVe(e,t,r){let n=[];return nn(e,i=>{let a=new cqt;i.accept(a);let s=a.allProductions;nn(s,o=>{let l=nD(o),u=o.maxLookahead||t,h=o.idx,d=C6(h,i,l,u)[0];if(qi(Dh(d))){let p=r.buildEmptyRepetitionError({topLevelRule:i,repetition:o});n.push({message:p,type:Nl.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function kVe(e,t,r,n){let i=[],a=Zc(e,(o,l,u)=>(t.definition[u].ignoreAmbiguities===!0||nn(l,h=>{let f=[u];nn(e,(d,p)=>{u!==p&&sN(d,h)&&t.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!sN(i,h)&&(i.push(h),o.push({alts:f,path:h}))}),o),[]);return Er(a,o=>{let l=Er(o.alts,h=>h+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:l,prefixPath:o.path}),type:Nl.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:t.idx,alternatives:o.alts}})}function TVe(e,t,r,n){let i=Zc(e,(s,o,l)=>{let u=Er(o,h=>({idx:l,path:h}));return s.concat(u)},[]);return b6(qu(i,s=>{if(t.definition[s.idx].ignoreAmbiguities===!0)return[];let l=s.idx,u=s.path,h=Uu(i,d=>t.definition[d.idx].ignoreAmbiguities!==!0&&d.idx{let p=[d.idx+1,l+1],m=t.idx===0?"":t.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:p,prefixPath:d.path}),type:Nl.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:m,alternatives:p}})}))}function CVe(e,t,r){let n=[],i=Er(t,a=>a.name);return nn(e,a=>{let s=a.name;if(Ol(i,s)){let o=r.buildNamespaceConflictError(a);n.push({message:o,type:Nl.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}function SVe(e){let t=bre(e,{errMsgProvider:tqt}),r={};return nn(e.rules,n=>{r[n.name]=n}),nVe(r,t.errMsgProvider)}function EVe(e){return e=bre(e,{errMsgProvider:r2}),dVe(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}function ZS(e){return Ol(IVe,e.name)}function DVe(e,t,r,n,i,a,s){let o=this.getKeyForAutomaticLookahead(n,i),l=this.firstAfterRepMap[o];if(l===void 0){let d=this.getCurrRuleFullName(),p=this.getGAstProductions()[d];l=new a(p,i).startWalking(),this.firstAfterRepMap[o]=l}let u=l.token,h=l.occurrence,f=l.isEndOfRule;this.RULE_STACK.length===1&&f&&u===void 0&&(u=qg,h=1),!(u===void 0||h===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,h,s)&&this.tryInRepetitionRecovery(e,t,r,u)}function vM(e,t,r){return r|t|e}function BVe(e){qI.reset(),e.accept(qI);let t=qI.dslMethods;return qI.reset(),t}function BJ(e,t){isNaN(e.startOffset)===!0?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffsets.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: ${a.join(` `).replace(/\n/g,` - `)}`)}},"validateVisitor")};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=t,r}function zVe(e,t,r){let n=_(function(){},"derivedConstructor");Bre(n,e+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return nn(t,a=>{i[a]=FVe}),n.prototype=i,n.prototype.constructor=n,n}function GVe(e,t){return qVe(e,t)}function qVe(e,t){let r=Uu(t,i=>lp(e[i])===!1),n=Er(r,i=>({msg:`Missing visitor method: <${i}> on ${e.constructor.name} CST Visitor.`,type:BJ.MISSING_METHOD,methodName:i}));return b6(n)}function dw(e,t,r,n=!1){QS(r);let i=l2(this.recordingProdStack),a=lp(t)?t:t.DEF,s=new e({definition:[],idx:r});return n&&(s.separator=t.SEP),Ur(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),i.definition.push(s),this.recordingProdStack.pop(),aD}function HVe(e,t){QS(t);let r=l2(this.recordingProdStack),n=Un(e)===!1,i=n===!1?e:e.DEF,a=new dc({definition:[],idx:t,ignoreAmbiguities:n&&e.IGNORE_AMBIGUITIES===!0});Ur(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD);let s=sqe(i,o=>lp(o.GATE));return a.hasPredicates=s,r.definition.push(a),nn(i,o=>{let l=new hc({definition:[]});a.definition.push(l),Ur(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:Ur(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),aD}function FJ(e){return e===0?"":`${e}`}function QS(e){if(e<0||e>xPe){let t=new Error(`Invalid DSL Method idx value: <${e}> - Idx value must be a none negative value smaller than ${xPe+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}function UVe(e,t){t.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let a=Object.getOwnPropertyDescriptor(n,i);a&&(a.get||a.set)?Object.defineProperty(e.prototype,i,a):e.prototype[i]=r.prototype[i]})})}function $J(e=void 0){return function(){return e}}function XVe(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r-1}function nWe(e,t){var r=this.__data__,n=sD(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function S2(e){var t=-1,r=e==null?0:e.length;for(this.clear();++to))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,d=!0,p=r&FVt?new PWe:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=xWt}function sHe(e){return zw(e)&&Gre(e.length)&&!!Zi[Kw(e)]}function oHe(e){return function(t){return e(t)}}function cHe(e,t){var r=Nl(e),n=!r&&uD(e),i=!r&&!n&&cN(e),a=!r&&!n&&!i&&qre(e),s=r||n||i||a,o=s?lWt(e.length,String):[],l=o.length;for(var u in e)(t||KWt.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||iHe(u,l)))&&o.push(u);return o}function uHe(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||QWt;return e===r}function fHe(e,t){return function(r){return e(t(r))}}function dHe(e){if(!hHe(e))return tHt(e);var t=[];for(var r in Object(e))nHt.call(e,r)&&r!="constructor"&&t.push(r);return t}function mHe(e){return e!=null&&Gre(e.length)&&!mWe(e)}function gHe(e){return hD(e)?ZWt(e):pHe(e)}function yHe(e){return rWt(e,Vre,oWt)}function vHe(e,t,r,n,i,a){var s=r&iHt,o=IPe(e),l=o.length,u=IPe(t),h=u.length;if(l!=h&&!s)return!1;for(var f=l;f--;){var d=o[f];if(!(s?d in t:sHt.call(t,d)))return!1}var p=a.get(e),m=a.get(t);if(p&&m)return p==t&&m==e;var g=!0;a.set(e,t),a.set(t,e);for(var y=s;++fZre(e,t,s));return L2(e,t,n,r,...i)}function hUe(e,t,r){let n=Es(e,t,r,{type:Vg});up(e,n);let i=L2(e,t,n,r,jg(e,t,r));return fUe(e,t,r,i)}function jg(e,t,r){let n=aUt(K0(r.definition,i=>Zre(e,t,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:pUe(e,n)}function Qre(e,t,r,n,i){let a=n.left,s=n.right,o=Es(e,t,r,{type:uUt});up(e,o);let l=Es(e,t,r,{type:rUe});return a.loopback=o,l.loopback=o,e.decisionMap[u2(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=o,Va(s,o),i===void 0?(Va(o,a),Va(o,l)):(Va(o,l),Va(o,i.left),Va(i.right,a)),{left:a,right:l}}function Jre(e,t,r,n,i){let a=n.left,s=n.right,o=Es(e,t,r,{type:cUt});up(e,o);let l=Es(e,t,r,{type:rUe}),u=Es(e,t,r,{type:lUt});return o.loopback=u,l.loopback=u,Va(o,a),Va(o,l),Va(s,u),i!==void 0?(Va(u,l),Va(u,i.left),Va(i.right,a)):Va(u,o),e.decisionMap[u2(t,i?"RepetitionWithSeparator":"Repetition",r.idx)]=o,{left:o,right:l}}function fUe(e,t,r,n){let i=n.left,a=n.right;return Va(i,a),e.decisionMap[u2(t,"Option",r.idx)]=i,n}function up(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function L2(e,t,r,n,...i){let a=Es(e,t,n,{type:oUt,start:r});r.end=a;for(let o of i)o!==void 0?(Va(r,o.left),Va(o.right,a)):Va(r,a);let s={left:r,right:a};return e.decisionMap[u2(t,dUe(n),n.idx)]=r,s}function dUe(e){if(e instanceof dc)return"Alternation";if(e instanceof wo)return"Option";if(e instanceof Ia)return"Repetition";if(e instanceof fc)return"RepetitionWithSeparator";if(e instanceof Qc)return"RepetitionMandatory";if(e instanceof Jc)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function pUe(e,t){let r=t.length;for(let a=0;ar.stateNumber.toString()).join("_")}`}function vUe(e,t,r){for(var n=-1,i=e.length;++n0&&r(o)?t>1?tne(o,t-1,r,n,i):UWe(i,o):n||(i[i.length]=o)}return i}function TUe(e,t){return kUe(K0(e,t),1)}function CUe(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a-1}function RUe(e,t,r){for(var n=-1,i=e==null?0:e.length;++n=EUt){var u=t?null:SUt(e);if(u)return zre(u);s=!1,i=$We,l=new PWe}else l=t?[]:o;e:for(;++n{let i=n.toString(),a=r[i];return a!==void 0||(a={atnStartState:e,decision:t,states:{}},r[i]=a),a}}function HJ(e,t=!0){let r=new Set;for(let n of e){let i=new Set;for(let a of n){if(a===void 0){if(t)break;return!1}let s=[a.tokenTypeIdx].concat(a.categoryMatches);for(let o of s)if(r.has(o)){if(!i.has(o))return!1}else r.add(o),i.add(o)}}return!0}function VUe(e){let t=e.decisionStates.length,r=Array(t);for(let n=0;na2(i)).join(", "),r=e.production.idx===0?"":e.production.idx,n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${XUe(e.production)}${r}> inside <${e.topLevelRule.name}> Rule, + `)}`)}},"validateVisitor")};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=t,r}function qVe(e,t,r){let n=_(function(){},"derivedConstructor");$re(n,e+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return nn(t,a=>{i[a]=zVe}),n.prototype=i,n.prototype.constructor=n,n}function VVe(e,t){return WVe(e,t)}function WVe(e,t){let r=Uu(t,i=>lp(e[i])===!1),n=Er(r,i=>({msg:`Missing visitor method: <${i}> on ${e.constructor.name} CST Visitor.`,type:$J.MISSING_METHOD,methodName:i}));return b6(n)}function dw(e,t,r,n=!1){QS(r);let i=l2(this.recordingProdStack),a=lp(t)?t:t.DEF,s=new e({definition:[],idx:r});return n&&(s.separator=t.SEP),Ur(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),i.definition.push(s),this.recordingProdStack.pop(),aD}function YVe(e,t){QS(t);let r=l2(this.recordingProdStack),n=Un(e)===!1,i=n===!1?e:e.DEF,a=new pc({definition:[],idx:t,ignoreAmbiguities:n&&e.IGNORE_AMBIGUITIES===!0});Ur(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD);let s=lqe(i,o=>lp(o.GATE));return a.hasPredicates=s,r.definition.push(a),nn(i,o=>{let l=new fc({definition:[]});a.definition.push(l),Ur(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:Ur(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),aD}function zJ(e){return e===0?"":`${e}`}function QS(e){if(e<0||e>wPe){let t=new Error(`Invalid DSL Method idx value: <${e}> + Idx value must be a none negative value smaller than ${wPe+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}function XVe(e,t){t.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let a=Object.getOwnPropertyDescriptor(n,i);a&&(a.get||a.set)?Object.defineProperty(e.prototype,i,a):e.prototype[i]=r.prototype[i]})})}function GJ(e=void 0){return function(){return e}}function KVe(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r-1}function aWe(e,t){var r=this.__data__,n=sD(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function S2(e){var t=-1,r=e==null?0:e.length;for(this.clear();++to))return!1;var u=a.get(e),h=a.get(t);if(u&&h)return u==t&&h==e;var f=-1,d=!0,p=r&qVt?new FWe:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=TWt}function lHe(e){return zw(e)&&Vre(e.length)&&!!Zi[Kw(e)]}function cHe(e){return function(t){return e(t)}}function hHe(e,t){var r=Dl(e),n=!r&&uD(e),i=!r&&!n&&cN(e),a=!r&&!n&&!i&&Wre(e),s=r||n||i||a,o=s?fWt(e.length,String):[],l=o.length;for(var u in e)(t||eHt.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||sHe(u,l)))&&o.push(u);return o}function fHe(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||rHt;return e===r}function pHe(e,t){return function(r){return e(t(r))}}function mHe(e){if(!dHe(e))return aHt(e);var t=[];for(var r in Object(e))oHt.call(e,r)&&r!="constructor"&&t.push(r);return t}function yHe(e){return e!=null&&Vre(e.length)&&!yWe(e)}function vHe(e){return hD(e)?tHt(e):gHe(e)}function xHe(e){return sWt(e,Hre,hWt)}function bHe(e,t,r,n,i,a){var s=r&lHt,o=NPe(e),l=o.length,u=NPe(t),h=u.length;if(l!=h&&!s)return!1;for(var f=l;f--;){var d=o[f];if(!(s?d in t:uHt.call(t,d)))return!1}var p=a.get(e),m=a.get(t);if(p&&m)return p==t&&m==e;var g=!0;a.set(e,t),a.set(t,e);for(var y=s;++fJre(e,t,s));return L2(e,t,n,r,...i)}function dUe(e,t,r){let n=Es(e,t,r,{type:Vg});up(e,n);let i=L2(e,t,n,r,jg(e,t,r));return pUe(e,t,r,i)}function jg(e,t,r){let n=cUt(K0(r.definition,i=>Jre(e,t,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:gUe(e,n)}function ene(e,t,r,n,i){let a=n.left,s=n.right,o=Es(e,t,r,{type:pUt});up(e,o);let l=Es(e,t,r,{type:iUe});return a.loopback=o,l.loopback=o,e.decisionMap[u2(t,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=o,Va(s,o),i===void 0?(Va(o,a),Va(o,l)):(Va(o,l),Va(o,i.left),Va(i.right,a)),{left:a,right:l}}function tne(e,t,r,n,i){let a=n.left,s=n.right,o=Es(e,t,r,{type:dUt});up(e,o);let l=Es(e,t,r,{type:iUe}),u=Es(e,t,r,{type:fUt});return o.loopback=u,l.loopback=u,Va(o,a),Va(o,l),Va(s,u),i!==void 0?(Va(u,l),Va(u,i.left),Va(i.right,a)):Va(u,o),e.decisionMap[u2(t,i?"RepetitionWithSeparator":"Repetition",r.idx)]=o,{left:o,right:l}}function pUe(e,t,r,n){let i=n.left,a=n.right;return Va(i,a),e.decisionMap[u2(t,"Option",r.idx)]=i,n}function up(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function L2(e,t,r,n,...i){let a=Es(e,t,n,{type:hUt,start:r});r.end=a;for(let o of i)o!==void 0?(Va(r,o.left),Va(o.right,a)):Va(r,a);let s={left:r,right:a};return e.decisionMap[u2(t,mUe(n),n.idx)]=r,s}function mUe(e){if(e instanceof pc)return"Alternation";if(e instanceof wo)return"Option";if(e instanceof Ia)return"Repetition";if(e instanceof dc)return"RepetitionWithSeparator";if(e instanceof Qc)return"RepetitionMandatory";if(e instanceof Jc)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function gUe(e,t){let r=t.length;for(let a=0;ar.stateNumber.toString()).join("_")}`}function bUe(e,t,r){for(var n=-1,i=e.length;++n0&&r(o)?t>1?nne(o,t-1,r,n,i):XWe(i,o):n||(i[i.length]=o)}return i}function SUe(e,t){return CUe(K0(e,t),1)}function EUe(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a-1}function IUe(e,t,r){for(var n=-1,i=e==null?0:e.length;++n=LUt){var u=t?null:RUt(e);if(u)return qre(u);s=!1,i=GWe,l=new FWe}else l=t?[]:o;e:for(;++n{let i=n.toString(),a=r[i];return a!==void 0||(a={atnStartState:e,decision:t,states:{}},r[i]=a),a}}function YJ(e,t=!0){let r=new Set;for(let n of e){let i=new Set;for(let a of n){if(a===void 0){if(t)break;return!1}let s=[a.tokenTypeIdx].concat(a.categoryMatches);for(let o of s)if(r.has(o)){if(!i.has(o))return!1}else r.add(o),i.add(o)}}return!0}function HUe(e){let t=e.decisionStates.length,r=Array(t);for(let n=0;na2(i)).join(", "),r=e.production.idx===0?"":e.production.idx,n=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${KUe(e.production)}${r}> inside <${e.topLevelRule.name}> Rule, <${t}> may appears as a prefix path in all these alternatives. `;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES -For Further details.`,n}function XUe(e){if(e instanceof Il)return"SUBRULE";if(e instanceof wo)return"OPTION";if(e instanceof dc)return"OR";if(e instanceof Qc)return"AT_LEAST_ONE";if(e instanceof Jc)return"AT_LEAST_ONE_SEP";if(e instanceof fc)return"MANY_SEP";if(e instanceof Ia)return"MANY";if(e instanceof Qi)return"CONSUME";throw Error("non exhaustive match")}function jUe(e,t,r){let n=mUt(t.configs.elements,a=>a.state.transitions),i=_Ut(n.filter(a=>a instanceof jre).map(a=>a.tokenType),a=>a.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:e}}function KUe(e,t){return e.edges[t.tokenTypeIdx]}function ZUe(e,t,r){let n=new WJ,i=[];for(let s of e.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===S6){i.push(s);continue}let o=s.state.transitions.length;for(let l=0;l0&&!rYe(a))for(let s of i)a.add(s);return a}function QUe(e,t){if(e instanceof jre&&Rre(t,e.tokenType))return e.target}function JUe(e,t){let r;for(let n of e.elements)if(t.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}function rne(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function UJ(e,t,r,n){return n=nne(e,n),t.edges[r.tokenTypeIdx]=n,n}function nne(e,t){if(t===uN)return t;let r=t.configs.key,n=e.states[r];return n!==void 0?n:(t.configs.finalize(),e.states[r]=t,t)}function eYe(e){let t=new WJ,r=e.transitions.length;for(let n=0;n0){let i=[...e.stack],s={state:i.pop(),alt:e.alt,stack:i};r6(s,t)}else t.add(e);return}r.epsilonOnlyTransitions||t.add(e);let n=r.transitions.length;for(let i=0;i1)return!0;return!1}function oYe(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}function wM(e){return e.$type===fN}function bD(e,t,r){return mYe({parser:t,tokens:r,ruleNames:new Map},e),t}function mYe(e,t){let r=ON(t,!1),n=ki(t.rules).filter(Ll).filter(a=>r.has(a));for(let a of n){let s={...e,consume:1,optional:1,subrule:1,many:1,or:1};e.parser.rule(a,Wg(s,a.definition))}let i=ki(t.rules).filter(Ow).filter(a=>r.has(a));for(let a of i)e.parser.rule(a,gYe(e,a))}function gYe(e,t){let r=t.call.rule.ref;if(!r)throw new Error("Could not resolve reference to infix operator rule: "+t.call.rule.$refText);if(Hu(r))throw new Error("Cannot use terminal rule in infix expression");let n=t.operators.precedences.flatMap(p=>p.operators),i={$type:"Group",elements:[]},a={$container:i,$type:"Assignment",feature:"parts",operator:"+=",terminal:t.call},s={$container:i,$type:"Group",elements:[],cardinality:"*"};i.elements.push(a,s);let l={$container:s,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:n}},u={...a,$container:s};s.elements.push(l,u);let f=n.map(p=>e.tokens[p.value]).map((p,m)=>({ALT:_(()=>e.parser.consume(m,p,l),"ALT")})),d;return p=>{d??(d=wD(e,r)),e.parser.subrule(0,d,!1,a,p),e.parser.many(0,{DEF:_(()=>{e.parser.alternatives(0,f),e.parser.subrule(1,d,!1,u,p)},"DEF")})}}function Wg(e,t,r=!1){let n;if(J0(t))n=TYe(e,t);else if(zg(t))n=yYe(e,t);else if(Q0(t))n=Wg(e,t.terminal);else if(m2(t))n=lne(e,t);else if(ep(t))n=vYe(e,t);else if(EN(t))n=bYe(e,t);else if(LN(t))n=wYe(e,t);else if(g2(t))n=kYe(e,t);else if(hte(t)){let i=e.consume++;n=_(()=>e.parser.consume(i,qg,t),"method")}else throw new MN(t.$cstNode,`Unexpected element type: ${t.$type}`);return cne(e,r?void 0:n6(t),n,t.cardinality)}function yYe(e,t){let r=o2(t);return()=>e.parser.action(r,t)}function vYe(e,t){let r=t.rule.ref;if(p2(r)){let n=e.subrule++,i=Ll(r)&&r.fragment,a=t.arguments.length>0?xYe(r,t.arguments):()=>({}),s;return o=>{s??(s=wD(e,r)),e.parser.subrule(n,s,i,t,a(o))}}else if(Hu(r)){let n=e.consume++,i=dN(e,r.name);return()=>e.parser.consume(n,i,t)}else if(r)Ug(r);else throw new MN(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function xYe(e,t){if(t.some(n=>n.calledByName)){let n=t.map(i=>({parameterName:i.parameter?.ref?.name,predicate:Ih(i.value)}));return i=>{let a={};for(let{parameterName:s,predicate:o}of n)s&&(a[s]=o(i));return a}}else{let n=t.map(i=>Ih(i.value));return i=>{let a={};for(let s=0;st(n)||r(n)}else if(cte(e)){let t=Ih(e.left),r=Ih(e.right);return n=>t(n)&&r(n)}else if(pte(e)){let t=Ih(e.value);return r=>!t(r)}else if(mte(e)){let t=e.parameter.ref.name;return r=>r!==void 0&&r[t]===!0}else if(ote(e)){let t=!!e.true;return()=>t}Ug(e)}function bYe(e,t){if(t.elements.length===1)return Wg(e,t.elements[0]);{let r=[];for(let i of t.elements){let a={ALT:Wg(e,i,!0)},s=n6(i);s&&(a.GATE=Ih(s)),r.push(a)}let n=e.or++;return i=>e.parser.alternatives(n,r.map(a=>{let s={ALT:_(()=>a.ALT(i),"ALT")},o=a.GATE;return o&&(s.GATE=()=>o(i)),s}))}}function wYe(e,t){if(t.elements.length===1)return Wg(e,t.elements[0]);let r=[];for(let o of t.elements){let l={ALT:Wg(e,o,!0)},u=n6(o);u&&(l.GATE=Ih(u)),r.push(l)}let n=e.or++,i=_((o,l)=>{let u=l.getRuleStack().join("-");return`uGroup_${o}_${u}`},"idFunc"),a=_(o=>e.parser.alternatives(n,r.map((l,u)=>{let h={ALT:_(()=>!0,"ALT")},f=e.parser;h.ALT=()=>{if(l.ALT(o),!f.isRecording()){let p=i(n,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);let m=f.unorderedGroups.get(p);typeof m?.[u]>"u"&&(m[u]=!0)}};let d=l.GATE;return d?h.GATE=()=>d(o):h.GATE=()=>!f.unorderedGroups.get(i(n,f))?.[u],h})),"alternatives"),s=cne(e,n6(t),a,"*");return o=>{s(o),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(n,e.parser))}}function kYe(e,t){let r=t.elements.map(n=>Wg(e,n));return n=>r.forEach(i=>i(n))}function n6(e){if(g2(e))return e.guardCondition}function lne(e,t,r=t.terminal){if(r)if(ep(r)&&Ll(r.rule.ref)){let n=r.rule.ref,i=e.subrule++,a;return s=>{a??(a=wD(e,n)),e.parser.subrule(i,a,!1,t,s)}}else if(ep(r)&&Hu(r.rule.ref)){let n=e.consume++,i=dN(e,r.rule.ref.name);return()=>e.parser.consume(n,i,t)}else if(J0(r)){let n=e.consume++,i=dN(e,r.value);return()=>e.parser.consume(n,i,t)}else throw new Error("Could not build cross reference parser");else{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);let i=$N(t.type.ref)?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+o2(t.type.ref));return lne(e,t,i)}}function TYe(e,t){let r=e.consume++,n=e.tokens[t.value];if(!n)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(r,n,t)}function cne(e,t,r,n){let i=t&&Ih(t);if(!n)if(i){let a=e.or++;return s=>e.parser.alternatives(a,[{ALT:_(()=>r(s),"ALT"),GATE:_(()=>i(s),"GATE")},{ALT:$J(),GATE:_(()=>!i(s),"GATE")}])}else return r;if(n==="*"){let a=e.many++;return s=>e.parser.many(a,{DEF:_(()=>r(s),"DEF"),GATE:i?()=>i(s):void 0})}else if(n==="+"){let a=e.many++;if(i){let s=e.or++;return o=>e.parser.alternatives(s,[{ALT:_(()=>e.parser.atLeastOne(a,{DEF:_(()=>r(o),"DEF")}),"ALT"),GATE:_(()=>i(o),"GATE")},{ALT:$J(),GATE:_(()=>!i(o),"GATE")}])}else return s=>e.parser.atLeastOne(a,{DEF:_(()=>r(s),"DEF")})}else if(n==="?"){let a=e.optional++;return s=>e.parser.optional(a,{DEF:_(()=>r(s),"DEF"),GATE:i?()=>i(s):void 0})}else Ug(n)}function wD(e,t){let r=CYe(e,t),n=e.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function CYe(e,t){if(p2(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let r=t,n=r.$container,i=t.$type;for(;!Ll(n);)(g2(n)||EN(n)||LN(n))&&(i=n.elements.indexOf(r).toString()+":"+i),r=n,n=n.$container;return i=n.name+":"+i,e.ruleNames.set(t,i),i}}function dN(e,t){let r=e.tokens[t];if(!r)throw new Error(`Token "${t}" not found."`);return r}function une(e){let t=e.Grammar,r=e.parser.Lexer,n=new dYe(e);return bD(t,n,r.definition),n.finalize(),n}function hne(e){let t=fne(e);return t.finalize(),t}function fne(e){let t=e.Grammar,r=e.parser.Lexer,n=new hYe(e);return bD(t,n,r.definition)}function TD(){return new Promise(e=>{typeof setImmediate>"u"?setTimeout(e,0):setImmediate(e)})}function CD(){return kM=performance.now(),new Gi.CancellationTokenSource}function pne(e){SYe=e}function I2(e){return e===pd}async function Us(e){if(e===Gi.CancellationToken.None)return;let t=performance.now();if(t-kM>=SYe&&(kM=t,await TD(),kM=performance.now()),e.isCancellationRequested)throw pd}function mN(e,t){if(e.length<=1)return e;let r=e.length/2|0,n=e.slice(0,r),i=e.slice(r);mN(n,t),mN(i,t);let a=0,s=0,o=0;for(;ar.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}function EYe(e){let t=gne(e.range);return t!==e.range?{newText:e.newText,range:t}:e}function vne(e){return typeof e.name=="string"}function wne(e){return typeof e.$comment=="string"}function KJ(e){return typeof e=="object"&&!!e&&("$ref"in e||"$error"in e)}function n2(e){return{code:e}}function kne(e){if(e.range)return e.range;let t;return typeof e.property=="string"?t=PN(e.node.$cstNode,e.property,e.index):typeof e.keyword=="string"&&(t=Hte(e.node.$cstNode,e.keyword,e.index)),t??(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function BS(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}function Tne(e){switch(e){case"error":return n2(Gu.LexingError);case"warning":return n2(Gu.LexingWarning);case"info":return n2(Gu.LexingInfo);case"hint":return n2(Gu.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}function _D(e){return Array.isArray(e)&&(e.length===0||"name"in e[0])}function RD(e){return e&&"modes"in e&&"defaultMode"in e}function vN(e){return!_D(e)&&!RD(e)}function Ene(e,t,r){let n,i;typeof e=="string"?(i=t,n=r):(i=e.range.start,n=t),i||(i=di.create(0,0));let a=_ne(e),s=LD(n),o=KYe({lines:a,position:i,options:s});return JYe({index:0,tokens:o,position:i})}function Ane(e,t){let r=LD(t),n=_ne(e);if(n.length===0)return!1;let i=n[0],a=n[n.length-1],s=r.start,o=r.end;return!!s?.exec(i)&&!!o?.exec(a)}function _ne(e){let t="";return typeof e=="string"?t=e:t=e.text,t.split(QBe)}function KYe(e){let t=[],r=e.position.line,n=e.position.character;for(let i=0;i=o.length){if(t.length>0){let h=di.create(r,n);t.push({type:"break",content:"",range:Bn.create(h,h)})}}else{YPe.lastIndex=l;let h=YPe.exec(o);if(h){let f=h[0],d=h[1],p=di.create(r,n+l),m=di.create(r,n+l+f.length);t.push({type:"tag",content:d,range:Bn.create(p,m)}),l+=f.length,l=xN(o,l)}if(l0&&t[t.length-1].type==="break"?t.slice(0,-1):t}function ZYe(e,t,r,n){let i=[];if(e.length===0){let a=di.create(r,n),s=di.create(r,n+t.length);i.push({type:"text",content:t,range:Bn.create(a,s)})}else{let a=0;for(let o of e){let l=o.index,u=t.substring(a,l);u.length>0&&i.push({type:"text",content:t.substring(a,l),range:Bn.create(di.create(r,a+n),di.create(r,l+n))});let h=u.length+1,f=o[1];if(i.push({type:"inline-tag",content:f,range:Bn.create(di.create(r,a+h+n),di.create(r,a+h+f.length+n))}),h+=f.length,o.length===4){h+=o[2].length;let d=o[3];i.push({type:"text",content:d,range:Bn.create(di.create(r,a+h+n),di.create(r,a+h+d.length+n))})}else i.push({type:"text",content:"",range:Bn.create(di.create(r,a+h+n),di.create(r,a+h+n))});a=l+o[0].length}let s=t.substring(a);s.length>0&&i.push({type:"text",content:s,range:Bn.create(di.create(r,a+n),di.create(r,a+n+s.length))})}return i}function xN(e,t){let r=e.substring(t).match(UUt);return r?t+r.index:e.length}function QYe(e){let t=e.match(YUt);if(t&&typeof t.index=="number")return t.index}function JYe(e){let t=di.create(e.position.line,e.position.character);if(e.tokens.length===0)return new XPe([],Bn.create(t,t));let r=[];for(;e.index0){let s=xN(t,n);i=t.substring(s),t=t.substring(0,n)}return(e==="linkcode"||e==="link"&&r.link==="code")&&(i=`\`${i}\``),r.renderLink?.(t,i)??iXe(t,i)}}function iXe(e,t){try{return Xc.parse(e,!0),`[${t}](${e})`}catch{return e}}function QJ(e){return e.endsWith(` +For Further details.`,n}function KUe(e){if(e instanceof Ml)return"SUBRULE";if(e instanceof wo)return"OPTION";if(e instanceof pc)return"OR";if(e instanceof Qc)return"AT_LEAST_ONE";if(e instanceof Jc)return"AT_LEAST_ONE_SEP";if(e instanceof dc)return"MANY_SEP";if(e instanceof Ia)return"MANY";if(e instanceof Qi)return"CONSUME";throw Error("non exhaustive match")}function ZUe(e,t,r){let n=xUt(t.configs.elements,a=>a.state.transitions),i=MUt(n.filter(a=>a instanceof Zre).map(a=>a.tokenType),a=>a.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:e}}function QUe(e,t){return e.edges[t.tokenTypeIdx]}function JUe(e,t,r){let n=new UJ,i=[];for(let s of e.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===S6){i.push(s);continue}let o=s.state.transitions.length;for(let l=0;l0&&!iYe(a))for(let s of i)a.add(s);return a}function eYe(e,t){if(e instanceof Zre&&Ire(t,e.tokenType))return e.target}function tYe(e,t){let r;for(let n of e.elements)if(t.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}function ine(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function XJ(e,t,r,n){return n=ane(e,n),t.edges[r.tokenTypeIdx]=n,n}function ane(e,t){if(t===uN)return t;let r=t.configs.key,n=e.states[r];return n!==void 0?n:(t.configs.finalize(),e.states[r]=t,t)}function rYe(e){let t=new UJ,r=e.transitions.length;for(let n=0;n0){let i=[...e.stack],s={state:i.pop(),alt:e.alt,stack:i};r6(s,t)}else t.add(e);return}r.epsilonOnlyTransitions||t.add(e);let n=r.transitions.length;for(let i=0;i1)return!0;return!1}function cYe(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}function wM(e){return e.$type===fN}function bD(e,t,r){return yYe({parser:t,tokens:r,ruleNames:new Map},e),t}function yYe(e,t){let r=ON(t,!1),n=ki(t.rules).filter(Il).filter(a=>r.has(a));for(let a of n){let s={...e,consume:1,optional:1,subrule:1,many:1,or:1};e.parser.rule(a,Wg(s,a.definition))}let i=ki(t.rules).filter(Ow).filter(a=>r.has(a));for(let a of i)e.parser.rule(a,vYe(e,a))}function vYe(e,t){let r=t.call.rule.ref;if(!r)throw new Error("Could not resolve reference to infix operator rule: "+t.call.rule.$refText);if(Hu(r))throw new Error("Cannot use terminal rule in infix expression");let n=t.operators.precedences.flatMap(p=>p.operators),i={$type:"Group",elements:[]},a={$container:i,$type:"Assignment",feature:"parts",operator:"+=",terminal:t.call},s={$container:i,$type:"Group",elements:[],cardinality:"*"};i.elements.push(a,s);let l={$container:s,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:n}},u={...a,$container:s};s.elements.push(l,u);let f=n.map(p=>e.tokens[p.value]).map((p,m)=>({ALT:_(()=>e.parser.consume(m,p,l),"ALT")})),d;return p=>{d??(d=wD(e,r)),e.parser.subrule(0,d,!1,a,p),e.parser.many(0,{DEF:_(()=>{e.parser.alternatives(0,f),e.parser.subrule(1,d,!1,u,p)},"DEF")})}}function Wg(e,t,r=!1){let n;if(J0(t))n=SYe(e,t);else if(zg(t))n=xYe(e,t);else if(Q0(t))n=Wg(e,t.terminal);else if(m2(t))n=une(e,t);else if(ep(t))n=bYe(e,t);else if(EN(t))n=kYe(e,t);else if(LN(t))n=TYe(e,t);else if(g2(t))n=CYe(e,t);else if(dte(t)){let i=e.consume++;n=_(()=>e.parser.consume(i,qg,t),"method")}else throw new MN(t.$cstNode,`Unexpected element type: ${t.$type}`);return hne(e,r?void 0:n6(t),n,t.cardinality)}function xYe(e,t){let r=o2(t);return()=>e.parser.action(r,t)}function bYe(e,t){let r=t.rule.ref;if(p2(r)){let n=e.subrule++,i=Il(r)&&r.fragment,a=t.arguments.length>0?wYe(r,t.arguments):()=>({}),s;return o=>{s??(s=wD(e,r)),e.parser.subrule(n,s,i,t,a(o))}}else if(Hu(r)){let n=e.consume++,i=dN(e,r.name);return()=>e.parser.consume(n,i,t)}else if(r)Ug(r);else throw new MN(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function wYe(e,t){if(t.some(n=>n.calledByName)){let n=t.map(i=>({parameterName:i.parameter?.ref?.name,predicate:Ih(i.value)}));return i=>{let a={};for(let{parameterName:s,predicate:o}of n)s&&(a[s]=o(i));return a}}else{let n=t.map(i=>Ih(i.value));return i=>{let a={};for(let s=0;st(n)||r(n)}else if(hte(e)){let t=Ih(e.left),r=Ih(e.right);return n=>t(n)&&r(n)}else if(gte(e)){let t=Ih(e.value);return r=>!t(r)}else if(yte(e)){let t=e.parameter.ref.name;return r=>r!==void 0&&r[t]===!0}else if(cte(e)){let t=!!e.true;return()=>t}Ug(e)}function kYe(e,t){if(t.elements.length===1)return Wg(e,t.elements[0]);{let r=[];for(let i of t.elements){let a={ALT:Wg(e,i,!0)},s=n6(i);s&&(a.GATE=Ih(s)),r.push(a)}let n=e.or++;return i=>e.parser.alternatives(n,r.map(a=>{let s={ALT:_(()=>a.ALT(i),"ALT")},o=a.GATE;return o&&(s.GATE=()=>o(i)),s}))}}function TYe(e,t){if(t.elements.length===1)return Wg(e,t.elements[0]);let r=[];for(let o of t.elements){let l={ALT:Wg(e,o,!0)},u=n6(o);u&&(l.GATE=Ih(u)),r.push(l)}let n=e.or++,i=_((o,l)=>{let u=l.getRuleStack().join("-");return`uGroup_${o}_${u}`},"idFunc"),a=_(o=>e.parser.alternatives(n,r.map((l,u)=>{let h={ALT:_(()=>!0,"ALT")},f=e.parser;h.ALT=()=>{if(l.ALT(o),!f.isRecording()){let p=i(n,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);let m=f.unorderedGroups.get(p);typeof m?.[u]>"u"&&(m[u]=!0)}};let d=l.GATE;return d?h.GATE=()=>d(o):h.GATE=()=>!f.unorderedGroups.get(i(n,f))?.[u],h})),"alternatives"),s=hne(e,n6(t),a,"*");return o=>{s(o),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(n,e.parser))}}function CYe(e,t){let r=t.elements.map(n=>Wg(e,n));return n=>r.forEach(i=>i(n))}function n6(e){if(g2(e))return e.guardCondition}function une(e,t,r=t.terminal){if(r)if(ep(r)&&Il(r.rule.ref)){let n=r.rule.ref,i=e.subrule++,a;return s=>{a??(a=wD(e,n)),e.parser.subrule(i,a,!1,t,s)}}else if(ep(r)&&Hu(r.rule.ref)){let n=e.consume++,i=dN(e,r.rule.ref.name);return()=>e.parser.consume(n,i,t)}else if(J0(r)){let n=e.consume++,i=dN(e,r.value);return()=>e.parser.consume(n,i,t)}else throw new Error("Could not build cross reference parser");else{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);let i=$N(t.type.ref)?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+o2(t.type.ref));return une(e,t,i)}}function SYe(e,t){let r=e.consume++,n=e.tokens[t.value];if(!n)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(r,n,t)}function hne(e,t,r,n){let i=t&&Ih(t);if(!n)if(i){let a=e.or++;return s=>e.parser.alternatives(a,[{ALT:_(()=>r(s),"ALT"),GATE:_(()=>i(s),"GATE")},{ALT:GJ(),GATE:_(()=>!i(s),"GATE")}])}else return r;if(n==="*"){let a=e.many++;return s=>e.parser.many(a,{DEF:_(()=>r(s),"DEF"),GATE:i?()=>i(s):void 0})}else if(n==="+"){let a=e.many++;if(i){let s=e.or++;return o=>e.parser.alternatives(s,[{ALT:_(()=>e.parser.atLeastOne(a,{DEF:_(()=>r(o),"DEF")}),"ALT"),GATE:_(()=>i(o),"GATE")},{ALT:GJ(),GATE:_(()=>!i(o),"GATE")}])}else return s=>e.parser.atLeastOne(a,{DEF:_(()=>r(s),"DEF")})}else if(n==="?"){let a=e.optional++;return s=>e.parser.optional(a,{DEF:_(()=>r(s),"DEF"),GATE:i?()=>i(s):void 0})}else Ug(n)}function wD(e,t){let r=EYe(e,t),n=e.parser.getRule(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function EYe(e,t){if(p2(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let r=t,n=r.$container,i=t.$type;for(;!Il(n);)(g2(n)||EN(n)||LN(n))&&(i=n.elements.indexOf(r).toString()+":"+i),r=n,n=n.$container;return i=n.name+":"+i,e.ruleNames.set(t,i),i}}function dN(e,t){let r=e.tokens[t];if(!r)throw new Error(`Token "${t}" not found."`);return r}function fne(e){let t=e.Grammar,r=e.parser.Lexer,n=new mYe(e);return bD(t,n,r.definition),n.finalize(),n}function dne(e){let t=pne(e);return t.finalize(),t}function pne(e){let t=e.Grammar,r=e.parser.Lexer,n=new dYe(e);return bD(t,n,r.definition)}function TD(){return new Promise(e=>{typeof setImmediate>"u"?setTimeout(e,0):setImmediate(e)})}function CD(){return kM=performance.now(),new Gi.CancellationTokenSource}function gne(e){AYe=e}function I2(e){return e===pd}async function Us(e){if(e===Gi.CancellationToken.None)return;let t=performance.now();if(t-kM>=AYe&&(kM=t,await TD(),kM=performance.now()),e.isCancellationRequested)throw pd}function mN(e,t){if(e.length<=1)return e;let r=e.length/2|0,n=e.slice(0,r),i=e.slice(r);mN(n,t),mN(i,t);let a=0,s=0,o=0;for(;ar.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}function _Ye(e){let t=vne(e.range);return t!==e.range?{newText:e.newText,range:t}:e}function bne(e){return typeof e.name=="string"}function Tne(e){return typeof e.$comment=="string"}function QJ(e){return typeof e=="object"&&!!e&&("$ref"in e||"$error"in e)}function n2(e){return{code:e}}function Cne(e){if(e.range)return e.range;let t;return typeof e.property=="string"?t=PN(e.node.$cstNode,e.property,e.index):typeof e.keyword=="string"&&(t=Yte(e.node.$cstNode,e.keyword,e.index)),t??(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function BS(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}function Sne(e){switch(e){case"error":return n2(Gu.LexingError);case"warning":return n2(Gu.LexingWarning);case"info":return n2(Gu.LexingInfo);case"hint":return n2(Gu.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}function _D(e){return Array.isArray(e)&&(e.length===0||"name"in e[0])}function RD(e){return e&&"modes"in e&&"defaultMode"in e}function vN(e){return!_D(e)&&!RD(e)}function _ne(e,t,r){let n,i;typeof e=="string"?(i=t,n=r):(i=e.range.start,n=t),i||(i=di.create(0,0));let a=Lne(e),s=LD(n),o=QYe({lines:a,position:i,options:s});return tXe({index:0,tokens:o,position:i})}function Rne(e,t){let r=LD(t),n=Lne(e);if(n.length===0)return!1;let i=n[0],a=n[n.length-1],s=r.start,o=r.end;return!!s?.exec(i)&&!!o?.exec(a)}function Lne(e){let t="";return typeof e=="string"?t=e:t=e.text,t.split(eFe)}function QYe(e){let t=[],r=e.position.line,n=e.position.character;for(let i=0;i=o.length){if(t.length>0){let h=di.create(r,n);t.push({type:"break",content:"",range:Bn.create(h,h)})}}else{jPe.lastIndex=l;let h=jPe.exec(o);if(h){let f=h[0],d=h[1],p=di.create(r,n+l),m=di.create(r,n+l+f.length);t.push({type:"tag",content:d,range:Bn.create(p,m)}),l+=f.length,l=xN(o,l)}if(l0&&t[t.length-1].type==="break"?t.slice(0,-1):t}function JYe(e,t,r,n){let i=[];if(e.length===0){let a=di.create(r,n),s=di.create(r,n+t.length);i.push({type:"text",content:t,range:Bn.create(a,s)})}else{let a=0;for(let o of e){let l=o.index,u=t.substring(a,l);u.length>0&&i.push({type:"text",content:t.substring(a,l),range:Bn.create(di.create(r,a+n),di.create(r,l+n))});let h=u.length+1,f=o[1];if(i.push({type:"inline-tag",content:f,range:Bn.create(di.create(r,a+h+n),di.create(r,a+h+f.length+n))}),h+=f.length,o.length===4){h+=o[2].length;let d=o[3];i.push({type:"text",content:d,range:Bn.create(di.create(r,a+h+n),di.create(r,a+h+d.length+n))})}else i.push({type:"text",content:"",range:Bn.create(di.create(r,a+h+n),di.create(r,a+h+n))});a=l+o[0].length}let s=t.substring(a);s.length>0&&i.push({type:"text",content:s,range:Bn.create(di.create(r,a+n),di.create(r,a+n+s.length))})}return i}function xN(e,t){let r=e.substring(t).match(KUt);return r?t+r.index:e.length}function eXe(e){let t=e.match(ZUt);if(t&&typeof t.index=="number")return t.index}function tXe(e){let t=di.create(e.position.line,e.position.character);if(e.tokens.length===0)return new KPe([],Bn.create(t,t));let r=[];for(;e.index0){let s=xN(t,n);i=t.substring(s),t=t.substring(0,n)}return(e==="linkcode"||e==="link"&&r.link==="code")&&(i=`\`${i}\``),r.renderLink?.(t,i)??sXe(t,i)}}function sXe(e,t){try{return Xc.parse(e,!0),`[${t}](${e})`}catch{return e}}function eee(e){return e.endsWith(` `)?` `:` -`}function Yn(e){return{documentation:{CommentProvider:_(t=>new oXe(t),"CommentProvider"),DocumentationProvider:_(t=>new sXe(t),"DocumentationProvider")},parser:{AsyncParser:_(t=>new lXe(t),"AsyncParser"),GrammarConfig:_(t=>Jte(t),"GrammarConfig"),LangiumParser:_(t=>hne(t),"LangiumParser"),CompletionParser:_(t=>une(t),"CompletionParser"),ValueConverter:_(()=>new dne,"ValueConverter"),TokenBuilder:_(()=>new kD,"TokenBuilder"),Lexer:_(t=>new Sne(t),"Lexer"),ParserErrorMessageProvider:_(()=>new one,"ParserErrorMessageProvider"),LexerErrorMessageProvider:_(()=>new jYe,"LexerErrorMessageProvider")},workspace:{AstNodeLocator:_(()=>new WYe,"AstNodeLocator"),AstNodeDescriptionProvider:_(t=>new qYe(t),"AstNodeDescriptionProvider"),ReferenceDescriptionProvider:_(t=>new VYe(t),"ReferenceDescriptionProvider")},references:{Linker:_(t=>new LYe(t),"Linker"),NameProvider:_(()=>new IYe,"NameProvider"),ScopeProvider:_(t=>new PYe(t),"ScopeProvider"),ScopeComputation:_(t=>new NYe(t),"ScopeComputation"),References:_(t=>new MYe(t),"References")},serializer:{Hydrator:_(t=>new uXe(t),"Hydrator"),JsonSerializer:_(t=>new BYe(t),"JsonSerializer")},validation:{DocumentValidator:_(t=>new GYe(t),"DocumentValidator"),ValidationRegistry:_(t=>new $Ye(t),"ValidationRegistry")},shared:_(()=>e.shared,"shared")}}function Xn(e){return{ServiceRegistry:_(t=>new FYe(t),"ServiceRegistry"),workspace:{LangiumDocuments:_(t=>new RYe(t),"LangiumDocuments"),LangiumDocumentFactory:_(t=>new _Ye(t),"LangiumDocumentFactory"),DocumentBuilder:_(t=>new UYe(t),"DocumentBuilder"),IndexManager:_(t=>new YYe(t),"IndexManager"),WorkspaceManager:_(t=>new XYe(t),"WorkspaceManager"),FileSystemProvider:_(t=>e.fileSystemProvider(t),"FileSystemProvider"),WorkspaceLock:_(()=>new cXe,"WorkspaceLock"),ConfigurationProvider:_(t=>new HYe(t),"ConfigurationProvider")},profilers:{}}}function an(e,t,r,n,i,a,s,o,l){let u=[e,t,r,n,i,a,s,o,l].reduce(Gw,{});return Nne(u)}function Mne(e){if(e&&e[hXe])for(let t of Object.values(e))Mne(t);return e}function Nne(e,t){let r=new Proxy({},{deleteProperty:_(()=>!1,"deleteProperty"),set:_(()=>{throw new Error("Cannot set property on injected service container")},"set"),get:_((n,i)=>i===hXe?!0:eee(n,i,e,t||r),"get"),getOwnPropertyDescriptor:_((n,i)=>(eee(n,i,e,t||r),Object.getOwnPropertyDescriptor(n,i)),"getOwnPropertyDescriptor"),has:_((n,i)=>i in e,"has"),ownKeys:_(()=>[...Object.getOwnPropertyNames(e)],"ownKeys")});return r}function eee(e,t,r,n){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: "+e[t]);if(e[t]===jPe)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return e[t]}else if(t in r){let i=r[t];e[t]=jPe;try{e[t]=typeof i=="function"?i(n):Nne(i,n)}catch(a){throw e[t]=a instanceof Error?a:void 0,a}return e[t]}else return}function Gw(e,t){if(t){for(let[r,n]of Object.entries(t))if(n!=null)if(typeof n=="object"){let i=e[r];typeof i=="object"&&i!==null?e[r]=Gw(i,n):e[r]=Gw({},n)}else e[r]=n}return e}function pXe(){let e=an(Xn(ti),QUt),t=an(Yn({shared:e}),ZUt);return e.ServiceRegistry.register(t),t}function Ys(e){let t=pXe(),r=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(r,Xc.parse(`memory:/${r.name??"grammar"}.langium`)),r}function gXe(e){return Wa.isInstance(e,Rh.$type)}function yXe(e){return Wa.isInstance(e,FS.$type)}function vXe(e){return Wa.isInstance(e,Uv.$type)}function xXe(e){return Wa.isInstance(e,Bg.$type)}function bXe(e){return Wa.isInstance(e,$S.$type)}function wXe(e){return Wa.isInstance(e,bN.$type)}function kXe(e){return e==="rmo"||e==="readmodel"||e==="ui"||e==="cmd"||e==="command"||e==="evt"||e==="event"||e==="pcr"||e==="processor"}function ID(e){return Wa.isInstance(e,Y0.$type)}function TXe(e){return Wa.isInstance(e,Fg.$type)}function CXe(e){return Wa.isInstance(e,Sw.$type)}function SXe(e){return Wa.isInstance(e,Yv.$type)}function EXe(e){return Wa.isInstance(e,Xv.$type)}function AXe(e){return Wa.isInstance(e,jv.$type)}function _Xe(e){return Wa.isInstance(e,$g.$type)}function RXe(e){return Wa.isInstance(e,zS.$type)}function LXe(e){return Wa.isInstance(e,Kv.$type)}function IXe(e){return Wa.isInstance(e,Zv.$type)}function MXe(e){return Wa.isInstance(e,Qv.$type)}function NXe(e){return Wa.isInstance(e,Jv.$type)}function DXe(e){return Wa.isInstance(e,Ew.$type)}function OXe(e){return Wa.isInstance(e,e2.$type)}function PXe(e){return Wa.isInstance(e,Ws.$type)}var BDt,i6,FDt,Kee,$Dt,zDt,_,GDt,mn,Hg,MM,wN,Zee,Qee,kN,vQ,nM,xQ,hS,di,Bn,fS,bQ,iM,wQ,kQ,TQ,CQ,aM,SQ,EQ,AQ,dS,Cv,od,Sv,xo,H0,pS,lw,cw,uw,sM,rS,KZ,mBe,_Q,RQ,mS,LQ,oM,hw,IQ,MQ,NQ,DQ,OQ,PQ,BQ,FQ,gS,$Q,zQ,GQ,qQ,VQ,WQ,HQ,UQ,YQ,XQ,jQ,yS,KQ,ZQ,QQ,JQ,eJ,tJ,rJ,nJ,iJ,aJ,sJ,oJ,lJ,lM,cM,cJ,uJ,hJ,fJ,dJ,pJ,mJ,gJ,gBe,yJ,COe,ht,a6,h2,s6,qw,TN,vBe,bBe,qDt,VDt,wBe,WDt,HDt,UDt,YDt,vJ,XDt,Vw,SOe,xa,Jee,jDt,KDt,ZDt,QDt,JDt,eOt,tOt,rOt,nOt,iOt,aOt,sOt,oOt,lOt,cOt,uOt,hOt,fOt,dOt,pOt,mOt,gOt,yOt,vOt,xOt,CBe,ete,rte,dd,Iw,El,Mw,qS,nte,ABe,bOt,lc,TS,yw,Yc,Mg,CS,PM,BM,Ng,FM,Dg,Og,SS,Pg,ES,$M,X0,zM,Ov,GM,ud,AS,qM,vw,xw,bw,Pv,VM,WM,ww,HM,_h,_S,Bv,UM,Fv,kw,YM,$v,cc,zv,j0,Gv,RS,qv,Vv,XM,LS,Wv,Hv,Tw,Cte,Gr,fd,_te,Nte,MN,Ote,KM,ZM,EOe,wOt,$I,kOt,ZBe,NN,QBe,JBe,TOt,t2,tFe,Qte,COt,pFe,SOt,EOt,vd,AOt,Vu,mFe,_Ot,ROt,nS,LOt,IOt,MOt,NOt,DOt,OOt,AOe,Yg,Ph,POt,zN,f6,BOt,Un,FOt,_Oe,ROe,$Ot,zOt,GOt,qOt,VOt,Wu,LOe,WOt,HOt,UOt,YOt,XOt,IOe,jOt,KOt,d6,p6,ZOt,QOt,JOt,ePt,lp,tPt,ZZ,MOe,rPt,nPt,iPt,v2,aPt,sPt,oPt,lPt,cPt,uPt,hPt,fPt,dPt,x2,pPt,wJ,NOe,mPt,gPt,yPt,Hs,vPt,xPt,bPt,wPt,kPt,TPt,CPt,JM,SPt,EPt,APt,_Pt,GFe,VFe,RPt,LPt,tre,XFe,IPt,MPt,GN,rre,m6,NPt,DPt,qN,g6,DOe,OPt,nre,PPt,ire,xd,VN,BPt,FPt,y6,$Pt,zPt,OOe,c$e,GPt,qPt,VPt,WN,WPt,h$e,POe,HPt,BOe,UPt,YPt,WS,XPt,jPt,KPt,ZPt,QPt,JPt,eBt,tBt,rBt,nBt,iBt,aBt,sBt,oBt,lBt,cBt,uBt,hBt,fBt,dBt,pBt,mBt,gBt,yBt,Ki,vBt,v6,p$e,IS,xBt,QZ,bBt,Gg,FOe,wBt,are,kBt,TBt,g$e,v$e,CBt,SBt,EBt,ABt,b$e,jc,_Bt,RBt,LBt,Kc,IBt,MBt,NBt,DBt,HN,OBt,PBt,sre,BBt,HS,FBt,$Bt,zBt,GBt,qBt,VBt,WBt,HBt,UBt,YBt,XBt,$Oe,jBt,UN,KBt,ZBt,QBt,JBt,eFt,tFt,YN,rFt,US,nFt,iFt,XN,aFt,sFt,oFt,lFt,jN,cFt,uFt,hFt,fFt,dFt,pFt,mFt,gFt,yFt,ZN,vFt,x6,ore,xFt,lre,zOe,bFt,ure,Dh,wFt,J$e,tze,kFt,TFt,CFt,SFt,EFt,AFt,_Ft,MS,RFt,LFt,uze,GOe,IFt,qOe,VOe,MFt,hre,pze,NFt,DFt,WOe,OFt,fre,PFt,BFt,FFt,gze,$Ft,xze,kJ,kze,zFt,TJ,GFt,CJ,qFt,_w,HOe,VFt,UOe,YOe,XOe,jOe,WFt,HFt,UFt,YFt,XFt,Av,Fw,jFt,KFt,ZFt,QFt,eN,dre,JFt,e$t,t$t,KOe,ZOe,r$t,n$t,i$t,a$t,s$t,o$t,l$t,c$t,u$t,h$t,f$t,d$t,p$t,m$t,g$t,y$t,v$t,x$t,b$t,w$t,k$t,T$t,C$t,S$t,E$t,QOe,A$t,_$t,R$t,L$t,JOe,I$t,M$t,N$t,D$t,O$t,Nze,P$t,B$t,F$t,$$t,Dze,z$t,G$t,q$t,Oze,V$t,W$t,H$t,U$t,Y$t,X$t,j$t,K$t,Z$t,Q$t,J$t,ezt,tzt,rzt,nzt,izt,zi,azt,szt,ko,b6,ozt,lzt,czt,pre,Gze,mre,uzt,hzt,Wze,fzt,gre,dzt,pzt,mzt,gzt,yzt,vzt,xzt,bzt,wzt,kzt,Tzt,Czt,Szt,ePe,JZ,Ezt,Azt,_zt,Rzt,Lzt,Izt,tPe,rPe,zI,Mzt,nPe,Nzt,Kze,Dzt,Ozt,Pzt,Jze,Bzt,rGe,Fzt,$zt,sGe,zzt,Gzt,qzt,Vzt,Wzt,Hzt,Uzt,bd,Yzt,Xzt,jzt,Kzt,Zzt,Qzt,Jzt,C2,eGt,tGt,xGe,rGt,nGt,vre,iPe,kGe,iGt,aGt,sGt,QN,l2,bo,XS,oGt,nn,lGt,cGt,Oh,NGe,Uu,uGt,hGt,fGt,dGt,$w,Bh,pGt,Er,qu,mGt,gGt,yGt,vGt,xGt,bGt,wGt,Ur,kGt,uc,TGt,Ss,CGt,Dl,SGt,aPe,EGt,AGt,_Gt,RGt,qi,LGt,IGt,sPe,MGt,tp,rp,NGt,DGt,OGt,PGt,Fh,BGt,Zc,JN,FGt,sqe,$Gt,zGt,GGt,qGt,VGt,xre,wd,Il,Hw,hc,wo,Qc,Jc,Ia,fc,dc,Qi,Uw,eD,yqe,WGt,dM,HGt,wqe,rN,UGt,c2,bS,GI,YGt,XGt,jGt,wS,mM,oPe,Uqe,RJ,Ma,kS,Rl,KGt,lPe,cPe,uPe,hPe,fPe,dPe,pPe,mPe,qg,Cw,ZGt,r2,QGt,JGt,eqt,rD,tqt,gPe,rqt,yPe,va,nqt,oVe,iqt,Ore,aqt,SVe,EVe,AVe,_Ve,RVe,iD,LVe,sqt,oqt,lqt,eQ,IVe,cqt,uqt,hqt,Xg,fqt,NVe,DVe,MJ,NJ,DJ,yM,Mjr,Pre,dqt,pqt,qI,mqt,BJ,gqt,yqt,vqt,xqt,bqt,wqt,aD,vPe,xPe,VVe,WVe,kqt,Tqt,Cqt,oN,ip,lN,Ml,Fre,Sqt,jVe,Eqt,QVe,sD,Aqt,_qt,Rqt,Lqt,Iqt,Mqt,oD,Nqt,Dqt,Oqt,Pqt,Bqt,lWe,Fqt,$qt,cp,zqt,yd,cWe,Gqt,qqt,iS,Vqt,Wqt,Hqt,Uqt,Yqt,Xqt,bPe,Kw,$re,jqt,Kqt,Zqt,Qqt,mWe,Jqt,tQ,wPe,eVt,tVt,rVt,E2,nVt,iVt,aVt,sVt,oVt,lVt,cVt,uVt,hVt,Zw,fVt,JS,dVt,e6,pVt,mVt,gVt,yVt,vVt,xVt,bVt,wVt,kVt,TVt,CVt,kPe,SVt,EVt,lD,AVt,_Vt,RVt,LVt,cD,IVt,MVt,xM,NVt,DVt,OVt,PWe,PVt,$We,BVt,FVt,GWe,$Vt,TPe,zVt,zre,GVt,qVt,VVt,WVt,HVt,UVt,YVt,XVt,jVt,KVt,ZVt,QVt,JVt,CPe,rQ,eWt,UWe,tWt,Nl,rWt,jWe,nWt,iWt,aWt,SPe,sWt,oWt,lWt,zw,cWt,EPe,eHe,uWt,hWt,fWt,uD,dWt,rHe,APe,pWt,_Pe,mWt,gWt,cN,yWt,vWt,iHe,xWt,Gre,bWt,wWt,kWt,TWt,CWt,SWt,EWt,AWt,_Wt,RWt,LWt,IWt,MWt,NWt,DWt,OWt,PWt,BWt,FWt,$Wt,zWt,GWt,qWt,VWt,Zi,WWt,HWt,lHe,PS,UWt,nQ,YWt,RPe,LPe,XWt,qre,jWt,KWt,ZWt,QWt,hHe,JWt,eHt,tHt,rHt,nHt,pHe,hD,Vre,IPe,iHt,aHt,sHt,oHt,lHt,zJ,cHt,GJ,uHt,Lw,hHt,qJ,MPe,fHt,NPe,DPe,OPe,PPe,dHt,pHt,mHt,gHt,yHt,_v,VJ,vHt,BPe,FPe,VI,xHt,$Pe,bHt,bHe,wHt,kHt,THt,THe,CHt,EHe,SHt,EHt,fD,AHt,_Ht,Hre,RHt,LHt,IHt,MHt,NHt,DHt,OHt,PHt,BHt,zPe,GPe,FHt,$Ht,NHe,zHt,pD,PHe,GHt,qHt,VHt,WHt,HHt,UHt,YHt,Yre,XHt,jHt,KHt,mD,ZHt,QHt,JHt,eUt,tUt,rUt,gD,nUt,K0,iUt,aUt,Vg,sUt,eUe,tUe,S6,oUt,lUt,cUt,uUt,rUe,Xre,jre,nUe,Kre,uN,WJ,hUt,fUt,dUt,qPe,pUt,kUe,mUt,gUt,yUt,vUt,xUt,bUt,wUt,kUt,TUt,CUt,SUt,EUt,AUt,_Ut,RUt,LUt,IUt,iQ,MUt,NUt,DUt,OUt,PUt,BUt,FUt,VPe,qUe,WPe,$Ut,lYe,ine,hN,xD,zUt,ane,fN,HPe,uYe,sne,hYe,fYe,one,dYe,GUt,pYe,qUt,kD,dne,hd,Gi,kM,SYe,pd,ap,UPe,pN,AYe,Xc,aS,_l,yne,Ln,_Ye,RYe,Rv,LYe,IYe,MYe,sp,gN,NYe,jJ,VUt,DYe,WUt,SD,xne,ED,OYe,bne,PYe,BYe,FYe,yN,$Ye,zYe,GYe,Gu,qYe,VYe,WYe,AD,HYe,WI,s2,UYe,YYe,XYe,jYe,Cne,Sne,YPe,HUt,UUt,YUt,XPe,aQ,ZJ,aXe,sXe,oXe,lXe,XUt,jUt,cXe,uXe,JJ,hXe,jPe,tee,i2,fXe,KUt,Dne,dXe,ti,ZUt,QUt,JUt,mXe,ree,nee,iee,aee,see,oee,lee,cee,uee,hee,fee,dee,pee,mee,gee,Njr,yee,vee,CM,xee,bee,wee,Lv,SM,kee,Tee,HI,sQ,UI,sS,oQ,Rh,YI,FS,KPe,XI,lQ,Uv,jI,kv,KI,Bg,ZI,ZPe,sw,$S,bN,Cee,See,Eee,Aee,_ee,Ree,Lee,pw,Rg,Iee,EM,Mee,Nee,AM,Dee,Oee,sd,Iv,Lg,oS,QPe,cQ,QI,Y0,_g,uQ,ld,JPe,JI,hQ,Fg,lS,Sw,cS,fQ,uS,eM,Tv,Yv,tM,dQ,Xv,jv,Pee,Bee,Fee,$ee,zee,_M,mw,RM,Gee,LM,$g,zS,pQ,rM,Ig,Kv,Zv,qee,Qv,cd,Vee,Wee,Hee,Jv,IM,Uee,Yee,Xee,jee,mQ,ow,gQ,Mv,Ew,e2,yQ,Nv,gw,Ws,BXe,Wa,eBe,eYt,tBe,tYt,rBe,rYt,nBe,nYt,iBe,iYt,aBe,aYt,sBe,sYt,oBe,oYt,lBe,lYt,cBe,cYt,uBe,uYt,hBe,hYt,fBe,fYt,dBe,dYt,pBe,pYt,mYt,gYt,yYt,vYt,xYt,bYt,wYt,kYt,TYt,CYt,SYt,EYt,AYt,_Yt,RYt,pi,One,Pne,Bne,Fne,$ne,zne,Gne,qne,Vne,Wne,Hne,Une,Yne,Xne,jne,LYt,IYt,MYt,NYt,cs,eu,xi,DYt,ri=W(()=>{BDt=Object.create,i6=Object.defineProperty,FDt=Object.getOwnPropertyDescriptor,Kee=Object.getOwnPropertyNames,$Dt=Object.getPrototypeOf,zDt=Object.prototype.hasOwnProperty,_=(e,t)=>i6(e,"name",{value:t,configurable:!0}),GDt=(e,t)=>function(){return e&&(t=(0,e[Kee(e)[0]])(e=0)),t},mn=(e,t)=>function(){return t||(0,e[Kee(e)[0]])((t={exports:{}}).exports,t),t.exports},Hg=(e,t)=>{for(var r in t)i6(e,r,{get:t[r],enumerable:!0})},MM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kee(t))!zDt.call(e,i)&&i!==r&&i6(e,i,{get:()=>t[i],enumerable:!(n=FDt(t,i))||n.enumerable});return e},wN=(e,t,r)=>(MM(e,t,"default"),r&&MM(r,t,"default")),Zee=(e,t,r)=>(r=e!=null?BDt($Dt(e)):{},MM(t||!e||!e.__esModule?i6(r,"default",{value:e,enumerable:!0}):r,e)),Qee=e=>MM(i6({},"__esModule",{value:!0}),e),kN={};Hg(kN,{AnnotatedTextEdit:()=>H0,ChangeAnnotation:()=>Sv,ChangeAnnotationIdentifier:()=>xo,CodeAction:()=>ZQ,CodeActionContext:()=>KQ,CodeActionKind:()=>jQ,CodeActionTriggerKind:()=>yS,CodeDescription:()=>AQ,CodeLens:()=>QQ,Color:()=>iM,ColorInformation:()=>wQ,ColorPresentation:()=>kQ,Command:()=>Cv,CompletionItem:()=>BQ,CompletionItemKind:()=>IQ,CompletionItemLabelDetails:()=>PQ,CompletionItemTag:()=>NQ,CompletionList:()=>FQ,CreateFile:()=>lw,DeleteFile:()=>uw,Diagnostic:()=>dS,DiagnosticRelatedInformation:()=>aM,DiagnosticSeverity:()=>SQ,DiagnosticTag:()=>EQ,DocumentHighlight:()=>VQ,DocumentHighlightKind:()=>qQ,DocumentLink:()=>eJ,DocumentSymbol:()=>XQ,DocumentUri:()=>vQ,EOL:()=>gBe,FoldingRange:()=>CQ,FoldingRangeKind:()=>TQ,FormattingOptions:()=>JQ,Hover:()=>$Q,InlayHint:()=>cJ,InlayHintKind:()=>lM,InlayHintLabelPart:()=>cM,InlineCompletionContext:()=>mJ,InlineCompletionItem:()=>hJ,InlineCompletionList:()=>fJ,InlineCompletionTriggerKind:()=>dJ,InlineValueContext:()=>lJ,InlineValueEvaluatableExpression:()=>oJ,InlineValueText:()=>aJ,InlineValueVariableLookup:()=>sJ,InsertReplaceEdit:()=>DQ,InsertTextFormat:()=>MQ,InsertTextMode:()=>OQ,Location:()=>fS,LocationLink:()=>bQ,MarkedString:()=>gS,MarkupContent:()=>hw,MarkupKind:()=>oM,OptionalVersionedTextDocumentIdentifier:()=>mS,ParameterInformation:()=>zQ,Position:()=>di,Range:()=>Bn,RenameFile:()=>cw,SelectedCompletionInfo:()=>pJ,SelectionRange:()=>tJ,SemanticTokenModifiers:()=>nJ,SemanticTokenTypes:()=>rJ,SemanticTokens:()=>iJ,SignatureInformation:()=>GQ,StringValue:()=>uJ,SymbolInformation:()=>UQ,SymbolKind:()=>WQ,SymbolTag:()=>HQ,TextDocument:()=>yJ,TextDocumentEdit:()=>pS,TextDocumentIdentifier:()=>_Q,TextDocumentItem:()=>LQ,TextEdit:()=>od,URI:()=>nM,VersionedTextDocumentIdentifier:()=>RQ,WorkspaceChange:()=>mBe,WorkspaceEdit:()=>sM,WorkspaceFolder:()=>gJ,WorkspaceSymbol:()=>YQ,integer:()=>xQ,uinteger:()=>hS});a6=GDt({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){"use strict";(function(e){function t(r){return typeof r=="string"}_(t,"is"),e.is=t})(vQ||(vQ={})),(function(e){function t(r){return typeof r=="string"}_(t,"is"),e.is=t})(nM||(nM={})),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}_(t,"is"),e.is=t})(xQ||(xQ={})),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}_(t,"is"),e.is=t})(hS||(hS={})),(function(e){function t(n,i){return n===Number.MAX_VALUE&&(n=hS.MAX_VALUE),i===Number.MAX_VALUE&&(i=hS.MAX_VALUE),{line:n,character:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.uinteger(i.line)&&ht.uinteger(i.character)}_(r,"is"),e.is=r})(di||(di={})),(function(e){function t(n,i,a,s){if(ht.uinteger(n)&&ht.uinteger(i)&&ht.uinteger(a)&&ht.uinteger(s))return{start:di.create(n,i),end:di.create(a,s)};if(di.is(n)&&di.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${a}, ${s}]`)}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&di.is(i.start)&&di.is(i.end)}_(r,"is"),e.is=r})(Bn||(Bn={})),(function(e){function t(n,i){return{uri:n,range:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.range)&&(ht.string(i.uri)||ht.undefined(i.uri))}_(r,"is"),e.is=r})(fS||(fS={})),(function(e){function t(n,i,a,s){return{targetUri:n,targetRange:i,targetSelectionRange:a,originSelectionRange:s}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.targetRange)&&ht.string(i.targetUri)&&Bn.is(i.targetSelectionRange)&&(Bn.is(i.originSelectionRange)||ht.undefined(i.originSelectionRange))}_(r,"is"),e.is=r})(bQ||(bQ={})),(function(e){function t(n,i,a,s){return{red:n,green:i,blue:a,alpha:s}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.numberRange(i.red,0,1)&&ht.numberRange(i.green,0,1)&&ht.numberRange(i.blue,0,1)&&ht.numberRange(i.alpha,0,1)}_(r,"is"),e.is=r})(iM||(iM={})),(function(e){function t(n,i){return{range:n,color:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.range)&&iM.is(i.color)}_(r,"is"),e.is=r})(wQ||(wQ={})),(function(e){function t(n,i,a){return{label:n,textEdit:i,additionalTextEdits:a}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.string(i.label)&&(ht.undefined(i.textEdit)||od.is(i))&&(ht.undefined(i.additionalTextEdits)||ht.typedArray(i.additionalTextEdits,od.is))}_(r,"is"),e.is=r})(kQ||(kQ={})),(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(TQ||(TQ={})),(function(e){function t(n,i,a,s,o,l){let u={startLine:n,endLine:i};return ht.defined(a)&&(u.startCharacter=a),ht.defined(s)&&(u.endCharacter=s),ht.defined(o)&&(u.kind=o),ht.defined(l)&&(u.collapsedText=l),u}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.uinteger(i.startLine)&&ht.uinteger(i.startLine)&&(ht.undefined(i.startCharacter)||ht.uinteger(i.startCharacter))&&(ht.undefined(i.endCharacter)||ht.uinteger(i.endCharacter))&&(ht.undefined(i.kind)||ht.string(i.kind))}_(r,"is"),e.is=r})(CQ||(CQ={})),(function(e){function t(n,i){return{location:n,message:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&fS.is(i.location)&&ht.string(i.message)}_(r,"is"),e.is=r})(aM||(aM={})),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(SQ||(SQ={})),(function(e){e.Unnecessary=1,e.Deprecated=2})(EQ||(EQ={})),(function(e){function t(r){let n=r;return ht.objectLiteral(n)&&ht.string(n.href)}_(t,"is"),e.is=t})(AQ||(AQ={})),(function(e){function t(n,i,a,s,o,l){let u={range:n,message:i};return ht.defined(a)&&(u.severity=a),ht.defined(s)&&(u.code=s),ht.defined(o)&&(u.source=o),ht.defined(l)&&(u.relatedInformation=l),u}_(t,"create"),e.create=t;function r(n){var i;let a=n;return ht.defined(a)&&Bn.is(a.range)&&ht.string(a.message)&&(ht.number(a.severity)||ht.undefined(a.severity))&&(ht.integer(a.code)||ht.string(a.code)||ht.undefined(a.code))&&(ht.undefined(a.codeDescription)||ht.string((i=a.codeDescription)===null||i===void 0?void 0:i.href))&&(ht.string(a.source)||ht.undefined(a.source))&&(ht.undefined(a.relatedInformation)||ht.typedArray(a.relatedInformation,aM.is))}_(r,"is"),e.is=r})(dS||(dS={})),(function(e){function t(n,i,...a){let s={title:n,command:i};return ht.defined(a)&&a.length>0&&(s.arguments=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.title)&&ht.string(i.command)}_(r,"is"),e.is=r})(Cv||(Cv={})),(function(e){function t(a,s){return{range:a,newText:s}}_(t,"replace"),e.replace=t;function r(a,s){return{range:{start:a,end:a},newText:s}}_(r,"insert"),e.insert=r;function n(a){return{range:a,newText:""}}_(n,"del"),e.del=n;function i(a){let s=a;return ht.objectLiteral(s)&&ht.string(s.newText)&&Bn.is(s.range)}_(i,"is"),e.is=i})(od||(od={})),(function(e){function t(n,i,a){let s={label:n};return i!==void 0&&(s.needsConfirmation=i),a!==void 0&&(s.description=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.string(i.label)&&(ht.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(ht.string(i.description)||i.description===void 0)}_(r,"is"),e.is=r})(Sv||(Sv={})),(function(e){function t(r){let n=r;return ht.string(n)}_(t,"is"),e.is=t})(xo||(xo={})),(function(e){function t(a,s,o){return{range:a,newText:s,annotationId:o}}_(t,"replace"),e.replace=t;function r(a,s,o){return{range:{start:a,end:a},newText:s,annotationId:o}}_(r,"insert"),e.insert=r;function n(a,s){return{range:a,newText:"",annotationId:s}}_(n,"del"),e.del=n;function i(a){let s=a;return od.is(s)&&(Sv.is(s.annotationId)||xo.is(s.annotationId))}_(i,"is"),e.is=i})(H0||(H0={})),(function(e){function t(n,i){return{textDocument:n,edits:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&mS.is(i.textDocument)&&Array.isArray(i.edits)}_(r,"is"),e.is=r})(pS||(pS={})),(function(e){function t(n,i,a){let s={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),a!==void 0&&(s.annotationId=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="create"&&ht.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||ht.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||ht.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}_(r,"is"),e.is=r})(lw||(lw={})),(function(e){function t(n,i,a,s){let o={kind:"rename",oldUri:n,newUri:i};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}_(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="rename"&&ht.string(i.oldUri)&&ht.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||ht.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||ht.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}_(r,"is"),e.is=r})(cw||(cw={})),(function(e){function t(n,i,a){let s={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),a!==void 0&&(s.annotationId=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="delete"&&ht.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||ht.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||ht.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}_(r,"is"),e.is=r})(uw||(uw={})),(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>ht.string(i.kind)?lw.is(i)||cw.is(i)||uw.is(i):pS.is(i)))}_(t,"is"),e.is=t})(sM||(sM={})),rS=class{static{_(this,"TextEditChangeImpl")}constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,i;if(r===void 0?n=od.insert(e,t):xo.is(r)?(i=r,n=H0.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=H0.insert(e,t,i)),this.edits.push(n),i!==void 0)return i}replace(e,t,r){let n,i;if(r===void 0?n=od.replace(e,t):xo.is(r)?(i=r,n=H0.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=H0.replace(e,t,i)),this.edits.push(n),i!==void 0)return i}delete(e,t){let r,n;if(t===void 0?r=od.del(e):xo.is(t)?(n=t,r=H0.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=H0.del(e,n)),this.edits.push(r),n!==void 0)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},KZ=class{static{_(this,"ChangeAnnotations")}constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(xo.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},mBe=class{static{_(this,"WorkspaceChange")}constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new KZ(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(pS.is(t)){let r=new rS(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{let r=new rS(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(mS.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let t={uri:e.uri,version:e.version},r=this._textEditChanges[t.uri];if(!r){let n=[],i={textDocument:t,edits:n};this._workspaceEdit.documentChanges.push(i),r=new rS(n,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new rS(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new KZ,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;Sv.is(t)||xo.is(t)?n=t:r=t;let i,a;if(n===void 0?i=lw.create(e,r):(a=xo.is(n)?n:this._changeAnnotations.manage(n),i=lw.create(e,r,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}renameFile(e,t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Sv.is(r)||xo.is(r)?i=r:n=r;let a,s;if(i===void 0?a=cw.create(e,t,n):(s=xo.is(i)?i:this._changeAnnotations.manage(i),a=cw.create(e,t,n,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;Sv.is(t)||xo.is(t)?n=t:r=t;let i,a;if(n===void 0?i=uw.create(e,r):(a=xo.is(n)?n:this._changeAnnotations.manage(n),i=uw.create(e,r,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}},(function(e){function t(n){return{uri:n}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)}_(r,"is"),e.is=r})(_Q||(_Q={})),(function(e){function t(n,i){return{uri:n,version:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)&&ht.integer(i.version)}_(r,"is"),e.is=r})(RQ||(RQ={})),(function(e){function t(n,i){return{uri:n,version:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)&&(i.version===null||ht.integer(i.version))}_(r,"is"),e.is=r})(mS||(mS={})),(function(e){function t(n,i,a,s){return{uri:n,languageId:i,version:a,text:s}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)&&ht.string(i.languageId)&&ht.integer(i.version)&&ht.string(i.text)}_(r,"is"),e.is=r})(LQ||(LQ={})),(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){let n=r;return n===e.PlainText||n===e.Markdown}_(t,"is"),e.is=t})(oM||(oM={})),(function(e){function t(r){let n=r;return ht.objectLiteral(r)&&oM.is(n.kind)&&ht.string(n.value)}_(t,"is"),e.is=t})(hw||(hw={})),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(IQ||(IQ={})),(function(e){e.PlainText=1,e.Snippet=2})(MQ||(MQ={})),(function(e){e.Deprecated=1})(NQ||(NQ={})),(function(e){function t(n,i,a){return{newText:n,insert:i,replace:a}}_(t,"create"),e.create=t;function r(n){let i=n;return i&&ht.string(i.newText)&&Bn.is(i.insert)&&Bn.is(i.replace)}_(r,"is"),e.is=r})(DQ||(DQ={})),(function(e){e.asIs=1,e.adjustIndentation=2})(OQ||(OQ={})),(function(e){function t(r){let n=r;return n&&(ht.string(n.detail)||n.detail===void 0)&&(ht.string(n.description)||n.description===void 0)}_(t,"is"),e.is=t})(PQ||(PQ={})),(function(e){function t(r){return{label:r}}_(t,"create"),e.create=t})(BQ||(BQ={})),(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}_(t,"create"),e.create=t})(FQ||(FQ={})),(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}_(t,"fromPlainText"),e.fromPlainText=t;function r(n){let i=n;return ht.string(i)||ht.objectLiteral(i)&&ht.string(i.language)&&ht.string(i.value)}_(r,"is"),e.is=r})(gS||(gS={})),(function(e){function t(r){let n=r;return!!n&&ht.objectLiteral(n)&&(hw.is(n.contents)||gS.is(n.contents)||ht.typedArray(n.contents,gS.is))&&(r.range===void 0||Bn.is(r.range))}_(t,"is"),e.is=t})($Q||($Q={})),(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}_(t,"create"),e.create=t})(zQ||(zQ={})),(function(e){function t(r,n,...i){let a={label:r};return ht.defined(n)&&(a.documentation=n),ht.defined(i)?a.parameters=i:a.parameters=[],a}_(t,"create"),e.create=t})(GQ||(GQ={})),(function(e){e.Text=1,e.Read=2,e.Write=3})(qQ||(qQ={})),(function(e){function t(r,n){let i={range:r};return ht.number(n)&&(i.kind=n),i}_(t,"create"),e.create=t})(VQ||(VQ={})),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(WQ||(WQ={})),(function(e){e.Deprecated=1})(HQ||(HQ={})),(function(e){function t(r,n,i,a,s){let o={name:r,kind:n,location:{uri:a,range:i}};return s&&(o.containerName=s),o}_(t,"create"),e.create=t})(UQ||(UQ={})),(function(e){function t(r,n,i,a){return a!==void 0?{name:r,kind:n,location:{uri:i,range:a}}:{name:r,kind:n,location:{uri:i}}}_(t,"create"),e.create=t})(YQ||(YQ={})),(function(e){function t(n,i,a,s,o,l){let u={name:n,detail:i,kind:a,range:s,selectionRange:o};return l!==void 0&&(u.children=l),u}_(t,"create"),e.create=t;function r(n){let i=n;return i&&ht.string(i.name)&&ht.number(i.kind)&&Bn.is(i.range)&&Bn.is(i.selectionRange)&&(i.detail===void 0||ht.string(i.detail))&&(i.deprecated===void 0||ht.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}_(r,"is"),e.is=r})(XQ||(XQ={})),(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(jQ||(jQ={})),(function(e){e.Invoked=1,e.Automatic=2})(yS||(yS={})),(function(e){function t(n,i,a){let s={diagnostics:n};return i!=null&&(s.only=i),a!=null&&(s.triggerKind=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.typedArray(i.diagnostics,dS.is)&&(i.only===void 0||ht.typedArray(i.only,ht.string))&&(i.triggerKind===void 0||i.triggerKind===yS.Invoked||i.triggerKind===yS.Automatic)}_(r,"is"),e.is=r})(KQ||(KQ={})),(function(e){function t(n,i,a){let s={title:n},o=!0;return typeof i=="string"?(o=!1,s.kind=i):Cv.is(i)?s.command=i:s.edit=i,o&&a!==void 0&&(s.kind=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return i&&ht.string(i.title)&&(i.diagnostics===void 0||ht.typedArray(i.diagnostics,dS.is))&&(i.kind===void 0||ht.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Cv.is(i.command))&&(i.isPreferred===void 0||ht.boolean(i.isPreferred))&&(i.edit===void 0||sM.is(i.edit))}_(r,"is"),e.is=r})(ZQ||(ZQ={})),(function(e){function t(n,i){let a={range:n};return ht.defined(i)&&(a.data=i),a}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&Bn.is(i.range)&&(ht.undefined(i.command)||Cv.is(i.command))}_(r,"is"),e.is=r})(QQ||(QQ={})),(function(e){function t(n,i){return{tabSize:n,insertSpaces:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.uinteger(i.tabSize)&&ht.boolean(i.insertSpaces)}_(r,"is"),e.is=r})(JQ||(JQ={})),(function(e){function t(n,i,a){return{range:n,target:i,data:a}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&Bn.is(i.range)&&(ht.undefined(i.target)||ht.string(i.target))}_(r,"is"),e.is=r})(eJ||(eJ={})),(function(e){function t(n,i){return{range:n,parent:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.range)&&(i.parent===void 0||e.is(i.parent))}_(r,"is"),e.is=r})(tJ||(tJ={})),(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(rJ||(rJ={})),(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(nJ||(nJ={})),(function(e){function t(r){let n=r;return ht.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}_(t,"is"),e.is=t})(iJ||(iJ={})),(function(e){function t(n,i){return{range:n,text:i}}_(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Bn.is(i.range)&&ht.string(i.text)}_(r,"is"),e.is=r})(aJ||(aJ={})),(function(e){function t(n,i,a){return{range:n,variableName:i,caseSensitiveLookup:a}}_(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Bn.is(i.range)&&ht.boolean(i.caseSensitiveLookup)&&(ht.string(i.variableName)||i.variableName===void 0)}_(r,"is"),e.is=r})(sJ||(sJ={})),(function(e){function t(n,i){return{range:n,expression:i}}_(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Bn.is(i.range)&&(ht.string(i.expression)||i.expression===void 0)}_(r,"is"),e.is=r})(oJ||(oJ={})),(function(e){function t(n,i){return{frameId:n,stoppedLocation:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&Bn.is(n.stoppedLocation)}_(r,"is"),e.is=r})(lJ||(lJ={})),(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}_(t,"is"),e.is=t})(lM||(lM={})),(function(e){function t(n){return{value:n}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&(i.tooltip===void 0||ht.string(i.tooltip)||hw.is(i.tooltip))&&(i.location===void 0||fS.is(i.location))&&(i.command===void 0||Cv.is(i.command))}_(r,"is"),e.is=r})(cM||(cM={})),(function(e){function t(n,i,a){let s={position:n,label:i};return a!==void 0&&(s.kind=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&di.is(i.position)&&(ht.string(i.label)||ht.typedArray(i.label,cM.is))&&(i.kind===void 0||lM.is(i.kind))&&i.textEdits===void 0||ht.typedArray(i.textEdits,od.is)&&(i.tooltip===void 0||ht.string(i.tooltip)||hw.is(i.tooltip))&&(i.paddingLeft===void 0||ht.boolean(i.paddingLeft))&&(i.paddingRight===void 0||ht.boolean(i.paddingRight))}_(r,"is"),e.is=r})(cJ||(cJ={})),(function(e){function t(r){return{kind:"snippet",value:r}}_(t,"createSnippet"),e.createSnippet=t})(uJ||(uJ={})),(function(e){function t(r,n,i,a){return{insertText:r,filterText:n,range:i,command:a}}_(t,"create"),e.create=t})(hJ||(hJ={})),(function(e){function t(r){return{items:r}}_(t,"create"),e.create=t})(fJ||(fJ={})),(function(e){e.Invoked=0,e.Automatic=1})(dJ||(dJ={})),(function(e){function t(r,n){return{range:r,text:n}}_(t,"create"),e.create=t})(pJ||(pJ={})),(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}_(t,"create"),e.create=t})(mJ||(mJ={})),(function(e){function t(r){let n=r;return ht.objectLiteral(n)&&nM.is(n.uri)&&ht.string(n.name)}_(t,"is"),e.is=t})(gJ||(gJ={})),gBe=[` +`}function Yn(e){return{documentation:{CommentProvider:_(t=>new cXe(t),"CommentProvider"),DocumentationProvider:_(t=>new lXe(t),"DocumentationProvider")},parser:{AsyncParser:_(t=>new uXe(t),"AsyncParser"),GrammarConfig:_(t=>tre(t),"GrammarConfig"),LangiumParser:_(t=>dne(t),"LangiumParser"),CompletionParser:_(t=>fne(t),"CompletionParser"),ValueConverter:_(()=>new mne,"ValueConverter"),TokenBuilder:_(()=>new kD,"TokenBuilder"),Lexer:_(t=>new Ane(t),"Lexer"),ParserErrorMessageProvider:_(()=>new cne,"ParserErrorMessageProvider"),LexerErrorMessageProvider:_(()=>new ZYe,"LexerErrorMessageProvider")},workspace:{AstNodeLocator:_(()=>new UYe,"AstNodeLocator"),AstNodeDescriptionProvider:_(t=>new WYe(t),"AstNodeDescriptionProvider"),ReferenceDescriptionProvider:_(t=>new HYe(t),"ReferenceDescriptionProvider")},references:{Linker:_(t=>new MYe(t),"Linker"),NameProvider:_(()=>new NYe,"NameProvider"),ScopeProvider:_(t=>new FYe(t),"ScopeProvider"),ScopeComputation:_(t=>new OYe(t),"ScopeComputation"),References:_(t=>new DYe(t),"References")},serializer:{Hydrator:_(t=>new fXe(t),"Hydrator"),JsonSerializer:_(t=>new $Ye(t),"JsonSerializer")},validation:{DocumentValidator:_(t=>new VYe(t),"DocumentValidator"),ValidationRegistry:_(t=>new GYe(t),"ValidationRegistry")},shared:_(()=>e.shared,"shared")}}function Xn(e){return{ServiceRegistry:_(t=>new zYe(t),"ServiceRegistry"),workspace:{LangiumDocuments:_(t=>new IYe(t),"LangiumDocuments"),LangiumDocumentFactory:_(t=>new LYe(t),"LangiumDocumentFactory"),DocumentBuilder:_(t=>new XYe(t),"DocumentBuilder"),IndexManager:_(t=>new jYe(t),"IndexManager"),WorkspaceManager:_(t=>new KYe(t),"WorkspaceManager"),FileSystemProvider:_(t=>e.fileSystemProvider(t),"FileSystemProvider"),WorkspaceLock:_(()=>new hXe,"WorkspaceLock"),ConfigurationProvider:_(t=>new YYe(t),"ConfigurationProvider")},profilers:{}}}function an(e,t,r,n,i,a,s,o,l){let u=[e,t,r,n,i,a,s,o,l].reduce(Gw,{});return One(u)}function Dne(e){if(e&&e[dXe])for(let t of Object.values(e))Dne(t);return e}function One(e,t){let r=new Proxy({},{deleteProperty:_(()=>!1,"deleteProperty"),set:_(()=>{throw new Error("Cannot set property on injected service container")},"set"),get:_((n,i)=>i===dXe?!0:ree(n,i,e,t||r),"get"),getOwnPropertyDescriptor:_((n,i)=>(ree(n,i,e,t||r),Object.getOwnPropertyDescriptor(n,i)),"getOwnPropertyDescriptor"),has:_((n,i)=>i in e,"has"),ownKeys:_(()=>[...Object.getOwnPropertyNames(e)],"ownKeys")});return r}function ree(e,t,r,n){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: "+e[t]);if(e[t]===ZPe)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return e[t]}else if(t in r){let i=r[t];e[t]=ZPe;try{e[t]=typeof i=="function"?i(n):One(i,n)}catch(a){throw e[t]=a instanceof Error?a:void 0,a}return e[t]}else return}function Gw(e,t){if(t){for(let[r,n]of Object.entries(t))if(n!=null)if(typeof n=="object"){let i=e[r];typeof i=="object"&&i!==null?e[r]=Gw(i,n):e[r]=Gw({},n)}else e[r]=n}return e}function gXe(){let e=an(Xn(ti),rYt),t=an(Yn({shared:e}),tYt);return e.ServiceRegistry.register(t),t}function Ys(e){let t=gXe(),r=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(r,Xc.parse(`memory:/${r.name??"grammar"}.langium`)),r}function vXe(e){return Wa.isInstance(e,Rh.$type)}function xXe(e){return Wa.isInstance(e,FS.$type)}function bXe(e){return Wa.isInstance(e,Uv.$type)}function wXe(e){return Wa.isInstance(e,Bg.$type)}function kXe(e){return Wa.isInstance(e,$S.$type)}function TXe(e){return Wa.isInstance(e,bN.$type)}function CXe(e){return e==="rmo"||e==="readmodel"||e==="ui"||e==="cmd"||e==="command"||e==="evt"||e==="event"||e==="pcr"||e==="processor"}function ID(e){return Wa.isInstance(e,Y0.$type)}function SXe(e){return Wa.isInstance(e,Fg.$type)}function EXe(e){return Wa.isInstance(e,Sw.$type)}function AXe(e){return Wa.isInstance(e,Yv.$type)}function _Xe(e){return Wa.isInstance(e,Xv.$type)}function RXe(e){return Wa.isInstance(e,jv.$type)}function LXe(e){return Wa.isInstance(e,$g.$type)}function IXe(e){return Wa.isInstance(e,zS.$type)}function MXe(e){return Wa.isInstance(e,Kv.$type)}function NXe(e){return Wa.isInstance(e,Zv.$type)}function DXe(e){return Wa.isInstance(e,Qv.$type)}function OXe(e){return Wa.isInstance(e,Jv.$type)}function PXe(e){return Wa.isInstance(e,Ew.$type)}function BXe(e){return Wa.isInstance(e,e2.$type)}function FXe(e){return Wa.isInstance(e,Ws.$type)}var GDt,i6,qDt,Qee,VDt,WDt,_,HDt,mn,Hg,MM,wN,Jee,ete,kN,bQ,nM,wQ,hS,di,Bn,fS,kQ,iM,TQ,CQ,SQ,EQ,aM,AQ,_Q,RQ,dS,Cv,od,Sv,xo,H0,pS,lw,cw,uw,sM,rS,QZ,yBe,LQ,IQ,mS,MQ,oM,hw,NQ,DQ,OQ,PQ,BQ,FQ,$Q,zQ,gS,GQ,qQ,VQ,WQ,HQ,UQ,YQ,XQ,jQ,KQ,ZQ,yS,QQ,JQ,eJ,tJ,rJ,nJ,iJ,aJ,sJ,oJ,lJ,cJ,uJ,lM,cM,hJ,fJ,dJ,pJ,mJ,gJ,yJ,vJ,vBe,xJ,EOe,ht,a6,h2,s6,qw,TN,bBe,kBe,UDt,YDt,TBe,XDt,jDt,KDt,ZDt,bJ,QDt,Vw,AOe,xa,tte,JDt,eOt,tOt,rOt,nOt,iOt,aOt,sOt,oOt,lOt,cOt,uOt,hOt,fOt,dOt,pOt,mOt,gOt,yOt,vOt,xOt,bOt,wOt,kOt,TOt,EBe,rte,ite,dd,Iw,Al,Mw,qS,ate,RBe,COt,cc,TS,yw,Yc,Mg,CS,PM,BM,Ng,FM,Dg,Og,SS,Pg,ES,$M,X0,zM,Ov,GM,ud,AS,qM,vw,xw,bw,Pv,VM,WM,ww,HM,_h,_S,Bv,UM,Fv,kw,YM,$v,uc,zv,j0,Gv,RS,qv,Vv,XM,LS,Wv,Hv,Tw,Ete,Gr,fd,Lte,Ote,MN,Bte,KM,ZM,_Oe,SOt,$I,EOt,JBe,NN,eFe,tFe,AOt,t2,nFe,ere,_Ot,gFe,ROt,LOt,vd,IOt,Vu,yFe,MOt,NOt,nS,DOt,OOt,POt,BOt,FOt,$Ot,ROe,Yg,Ph,zOt,zN,f6,GOt,Un,qOt,LOe,IOe,VOt,WOt,HOt,UOt,YOt,Wu,MOe,XOt,jOt,KOt,ZOt,QOt,NOe,JOt,ePt,d6,p6,tPt,rPt,nPt,iPt,lp,aPt,JZ,DOe,sPt,oPt,lPt,v2,cPt,uPt,hPt,fPt,dPt,pPt,mPt,gPt,yPt,x2,vPt,TJ,OOe,xPt,bPt,wPt,Hs,kPt,TPt,CPt,SPt,EPt,APt,_Pt,JM,RPt,LPt,IPt,MPt,VFe,HFe,NPt,DPt,nre,KFe,OPt,PPt,GN,ire,m6,BPt,FPt,qN,g6,POe,$Pt,are,zPt,sre,xd,VN,GPt,qPt,y6,VPt,WPt,BOe,h$e,HPt,UPt,YPt,WN,XPt,d$e,FOe,jPt,$Oe,KPt,ZPt,WS,QPt,JPt,eBt,tBt,rBt,nBt,iBt,aBt,sBt,oBt,lBt,cBt,uBt,hBt,fBt,dBt,pBt,mBt,gBt,yBt,vBt,xBt,bBt,wBt,Ki,kBt,v6,g$e,IS,TBt,eQ,CBt,Gg,zOe,SBt,ore,EBt,ABt,v$e,b$e,_Bt,RBt,LBt,IBt,k$e,jc,MBt,NBt,DBt,Kc,OBt,PBt,BBt,FBt,HN,$Bt,zBt,lre,GBt,HS,qBt,VBt,WBt,HBt,UBt,YBt,XBt,jBt,KBt,ZBt,QBt,GOe,JBt,UN,eFt,tFt,rFt,nFt,iFt,aFt,YN,sFt,US,oFt,lFt,XN,cFt,uFt,hFt,fFt,jN,dFt,pFt,mFt,gFt,yFt,vFt,xFt,bFt,wFt,ZN,kFt,x6,cre,TFt,ure,qOe,CFt,fre,Dh,SFt,tze,nze,EFt,AFt,_Ft,RFt,LFt,IFt,MFt,MS,NFt,DFt,fze,VOe,OFt,WOe,HOe,PFt,dre,gze,BFt,FFt,UOe,$Ft,pre,zFt,GFt,qFt,vze,VFt,wze,CJ,Cze,WFt,SJ,HFt,EJ,UFt,_w,YOe,YFt,XOe,jOe,KOe,ZOe,XFt,jFt,KFt,ZFt,QFt,Av,Fw,JFt,e$t,t$t,r$t,eN,mre,n$t,i$t,a$t,QOe,JOe,s$t,o$t,l$t,c$t,u$t,h$t,f$t,d$t,p$t,m$t,g$t,y$t,v$t,x$t,b$t,w$t,k$t,T$t,C$t,S$t,E$t,A$t,_$t,R$t,L$t,ePe,I$t,M$t,N$t,D$t,tPe,O$t,P$t,B$t,F$t,$$t,Oze,z$t,G$t,q$t,V$t,Pze,W$t,H$t,U$t,Bze,Y$t,X$t,j$t,K$t,Z$t,Q$t,J$t,ezt,tzt,rzt,nzt,izt,azt,szt,ozt,lzt,zi,czt,uzt,ko,b6,hzt,fzt,dzt,gre,Vze,yre,pzt,mzt,Uze,gzt,vre,yzt,vzt,xzt,bzt,wzt,kzt,Tzt,Czt,Szt,Ezt,Azt,_zt,Rzt,rPe,tQ,Lzt,Izt,Mzt,Nzt,Dzt,Ozt,nPe,iPe,zI,Pzt,aPe,Bzt,Qze,Fzt,$zt,zzt,tGe,Gzt,iGe,qzt,Vzt,lGe,Wzt,Hzt,Uzt,Yzt,Xzt,jzt,Kzt,bd,Zzt,Qzt,Jzt,eGt,tGt,rGt,nGt,C2,iGt,aGt,wGe,sGt,oGt,bre,sPe,CGe,lGt,cGt,uGt,QN,l2,bo,XS,hGt,nn,fGt,dGt,Oh,OGe,Uu,pGt,mGt,gGt,yGt,$w,Bh,vGt,Er,qu,xGt,bGt,wGt,kGt,TGt,CGt,SGt,Ur,EGt,hc,AGt,Ss,_Gt,Ol,RGt,oPe,LGt,IGt,MGt,NGt,qi,DGt,OGt,lPe,PGt,tp,rp,BGt,FGt,$Gt,zGt,Fh,GGt,Zc,JN,qGt,lqe,VGt,WGt,HGt,UGt,YGt,wre,wd,Ml,Hw,fc,wo,Qc,Jc,Ia,dc,pc,Qi,Uw,eD,xqe,XGt,dM,jGt,Tqe,rN,KGt,c2,bS,GI,ZGt,QGt,JGt,wS,mM,cPe,Xqe,IJ,Ma,kS,Ll,eqt,uPe,hPe,fPe,dPe,pPe,mPe,gPe,yPe,qg,Cw,tqt,r2,rqt,nqt,iqt,rD,aqt,vPe,sqt,xPe,va,oqt,cVe,lqt,Bre,cqt,AVe,_Ve,RVe,LVe,IVe,iD,MVe,uqt,hqt,fqt,rQ,NVe,dqt,pqt,mqt,Xg,gqt,OVe,PVe,DJ,OJ,PJ,yM,Bjr,Fre,yqt,vqt,qI,xqt,$J,bqt,wqt,kqt,Tqt,Cqt,Sqt,aD,bPe,wPe,HVe,UVe,Eqt,Aqt,_qt,oN,ip,lN,Nl,zre,Rqt,ZVe,Lqt,eWe,sD,Iqt,Mqt,Nqt,Dqt,Oqt,Pqt,oD,Bqt,Fqt,$qt,zqt,Gqt,uWe,qqt,Vqt,cp,Wqt,yd,hWe,Hqt,Uqt,iS,Yqt,Xqt,jqt,Kqt,Zqt,Qqt,kPe,Kw,Gre,Jqt,eVt,tVt,rVt,yWe,nVt,nQ,TPe,iVt,aVt,sVt,E2,oVt,lVt,cVt,uVt,hVt,fVt,dVt,pVt,mVt,Zw,gVt,JS,yVt,e6,vVt,xVt,bVt,wVt,kVt,TVt,CVt,SVt,EVt,AVt,_Vt,CPe,RVt,LVt,lD,IVt,MVt,NVt,DVt,cD,OVt,PVt,xM,BVt,FVt,$Vt,FWe,zVt,GWe,GVt,qVt,VWe,VVt,SPe,WVt,qre,HVt,UVt,YVt,XVt,jVt,KVt,ZVt,QVt,JVt,eWt,tWt,rWt,nWt,EPe,iQ,iWt,XWe,aWt,Dl,sWt,ZWe,oWt,lWt,cWt,APe,uWt,hWt,fWt,zw,dWt,_Pe,rHe,pWt,mWt,gWt,uD,yWt,iHe,RPe,vWt,LPe,xWt,bWt,cN,wWt,kWt,sHe,TWt,Vre,CWt,SWt,EWt,AWt,_Wt,RWt,LWt,IWt,MWt,NWt,DWt,OWt,PWt,BWt,FWt,$Wt,zWt,GWt,qWt,VWt,WWt,HWt,UWt,YWt,Zi,XWt,jWt,uHe,PS,KWt,aQ,ZWt,IPe,MPe,QWt,Wre,JWt,eHt,tHt,rHt,dHe,nHt,iHt,aHt,sHt,oHt,gHe,hD,Hre,NPe,lHt,cHt,uHt,hHt,fHt,qJ,dHt,VJ,pHt,Lw,mHt,WJ,DPe,gHt,OPe,PPe,BPe,FPe,yHt,vHt,xHt,bHt,wHt,_v,HJ,kHt,$Pe,zPe,VI,THt,GPe,CHt,kHe,SHt,EHt,AHt,SHe,_Ht,_He,RHt,LHt,fD,IHt,MHt,Yre,NHt,DHt,OHt,PHt,BHt,FHt,$Ht,zHt,GHt,qPe,VPe,qHt,VHt,OHe,WHt,pD,FHe,HHt,UHt,YHt,XHt,jHt,KHt,ZHt,jre,QHt,JHt,eUt,mD,tUt,rUt,nUt,iUt,aUt,sUt,gD,oUt,K0,lUt,cUt,Vg,uUt,rUe,nUe,S6,hUt,fUt,dUt,pUt,iUe,Kre,Zre,aUe,Qre,uN,UJ,mUt,gUt,yUt,WPe,vUt,CUe,xUt,bUt,wUt,kUt,TUt,CUt,SUt,EUt,AUt,_Ut,RUt,LUt,IUt,MUt,NUt,DUt,OUt,sQ,PUt,BUt,FUt,$Ut,zUt,GUt,qUt,HPe,WUe,UPe,VUt,uYe,sne,hN,xD,WUt,one,fN,YPe,fYe,lne,dYe,pYe,cne,mYe,HUt,gYe,UUt,kD,mne,hd,Gi,kM,AYe,pd,ap,XPe,pN,RYe,Xc,aS,Rl,xne,Ln,LYe,IYe,Rv,MYe,NYe,DYe,sp,gN,OYe,ZJ,YUt,PYe,XUt,SD,wne,ED,BYe,kne,FYe,$Ye,zYe,yN,GYe,qYe,VYe,Gu,WYe,HYe,UYe,AD,YYe,WI,s2,XYe,jYe,KYe,ZYe,Ene,Ane,jPe,jUt,KUt,ZUt,KPe,oQ,JJ,oXe,lXe,cXe,uXe,QUt,JUt,hXe,fXe,tee,dXe,ZPe,nee,i2,pXe,eYt,Pne,mXe,ti,tYt,rYt,nYt,yXe,iee,aee,see,oee,lee,cee,uee,hee,fee,dee,pee,mee,gee,yee,vee,Fjr,xee,bee,CM,wee,kee,Tee,Lv,SM,Cee,See,HI,lQ,UI,sS,cQ,Rh,YI,FS,QPe,XI,uQ,Uv,jI,kv,KI,Bg,ZI,JPe,sw,$S,bN,Eee,Aee,_ee,Ree,Lee,Iee,Mee,pw,Rg,Nee,EM,Dee,Oee,AM,Pee,Bee,sd,Iv,Lg,oS,eBe,hQ,QI,Y0,_g,fQ,ld,tBe,JI,dQ,Fg,lS,Sw,cS,pQ,uS,eM,Tv,Yv,tM,mQ,Xv,jv,Fee,$ee,zee,Gee,qee,_M,mw,RM,Vee,LM,$g,zS,gQ,rM,Ig,Kv,Zv,Wee,Qv,cd,Hee,Uee,Yee,Jv,IM,Xee,jee,Kee,Zee,yQ,ow,vQ,Mv,Ew,e2,xQ,Nv,gw,Ws,$Xe,Wa,rBe,iYt,nBe,aYt,iBe,sYt,aBe,oYt,sBe,lYt,oBe,cYt,lBe,uYt,cBe,hYt,uBe,fYt,hBe,dYt,fBe,pYt,dBe,mYt,pBe,gYt,mBe,yYt,gBe,vYt,xYt,bYt,wYt,kYt,TYt,CYt,SYt,EYt,AYt,_Yt,RYt,LYt,IYt,MYt,NYt,pi,Bne,Fne,$ne,zne,Gne,qne,Vne,Wne,Hne,Une,Yne,Xne,jne,Kne,Zne,DYt,OYt,PYt,BYt,cs,eu,xi,FYt,ri=W(()=>{GDt=Object.create,i6=Object.defineProperty,qDt=Object.getOwnPropertyDescriptor,Qee=Object.getOwnPropertyNames,VDt=Object.getPrototypeOf,WDt=Object.prototype.hasOwnProperty,_=(e,t)=>i6(e,"name",{value:t,configurable:!0}),HDt=(e,t)=>function(){return e&&(t=(0,e[Qee(e)[0]])(e=0)),t},mn=(e,t)=>function(){return t||(0,e[Qee(e)[0]])((t={exports:{}}).exports,t),t.exports},Hg=(e,t)=>{for(var r in t)i6(e,r,{get:t[r],enumerable:!0})},MM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qee(t))!WDt.call(e,i)&&i!==r&&i6(e,i,{get:()=>t[i],enumerable:!(n=qDt(t,i))||n.enumerable});return e},wN=(e,t,r)=>(MM(e,t,"default"),r&&MM(r,t,"default")),Jee=(e,t,r)=>(r=e!=null?GDt(VDt(e)):{},MM(t||!e||!e.__esModule?i6(r,"default",{value:e,enumerable:!0}):r,e)),ete=e=>MM(i6({},"__esModule",{value:!0}),e),kN={};Hg(kN,{AnnotatedTextEdit:()=>H0,ChangeAnnotation:()=>Sv,ChangeAnnotationIdentifier:()=>xo,CodeAction:()=>JQ,CodeActionContext:()=>QQ,CodeActionKind:()=>ZQ,CodeActionTriggerKind:()=>yS,CodeDescription:()=>RQ,CodeLens:()=>eJ,Color:()=>iM,ColorInformation:()=>TQ,ColorPresentation:()=>CQ,Command:()=>Cv,CompletionItem:()=>$Q,CompletionItemKind:()=>NQ,CompletionItemLabelDetails:()=>FQ,CompletionItemTag:()=>OQ,CompletionList:()=>zQ,CreateFile:()=>lw,DeleteFile:()=>uw,Diagnostic:()=>dS,DiagnosticRelatedInformation:()=>aM,DiagnosticSeverity:()=>AQ,DiagnosticTag:()=>_Q,DocumentHighlight:()=>HQ,DocumentHighlightKind:()=>WQ,DocumentLink:()=>rJ,DocumentSymbol:()=>KQ,DocumentUri:()=>bQ,EOL:()=>vBe,FoldingRange:()=>EQ,FoldingRangeKind:()=>SQ,FormattingOptions:()=>tJ,Hover:()=>GQ,InlayHint:()=>hJ,InlayHintKind:()=>lM,InlayHintLabelPart:()=>cM,InlineCompletionContext:()=>yJ,InlineCompletionItem:()=>dJ,InlineCompletionList:()=>pJ,InlineCompletionTriggerKind:()=>mJ,InlineValueContext:()=>uJ,InlineValueEvaluatableExpression:()=>cJ,InlineValueText:()=>oJ,InlineValueVariableLookup:()=>lJ,InsertReplaceEdit:()=>PQ,InsertTextFormat:()=>DQ,InsertTextMode:()=>BQ,Location:()=>fS,LocationLink:()=>kQ,MarkedString:()=>gS,MarkupContent:()=>hw,MarkupKind:()=>oM,OptionalVersionedTextDocumentIdentifier:()=>mS,ParameterInformation:()=>qQ,Position:()=>di,Range:()=>Bn,RenameFile:()=>cw,SelectedCompletionInfo:()=>gJ,SelectionRange:()=>nJ,SemanticTokenModifiers:()=>aJ,SemanticTokenTypes:()=>iJ,SemanticTokens:()=>sJ,SignatureInformation:()=>VQ,StringValue:()=>fJ,SymbolInformation:()=>XQ,SymbolKind:()=>UQ,SymbolTag:()=>YQ,TextDocument:()=>xJ,TextDocumentEdit:()=>pS,TextDocumentIdentifier:()=>LQ,TextDocumentItem:()=>MQ,TextEdit:()=>od,URI:()=>nM,VersionedTextDocumentIdentifier:()=>IQ,WorkspaceChange:()=>yBe,WorkspaceEdit:()=>sM,WorkspaceFolder:()=>vJ,WorkspaceSymbol:()=>jQ,integer:()=>wQ,uinteger:()=>hS});a6=HDt({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){"use strict";(function(e){function t(r){return typeof r=="string"}_(t,"is"),e.is=t})(bQ||(bQ={})),(function(e){function t(r){return typeof r=="string"}_(t,"is"),e.is=t})(nM||(nM={})),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}_(t,"is"),e.is=t})(wQ||(wQ={})),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}_(t,"is"),e.is=t})(hS||(hS={})),(function(e){function t(n,i){return n===Number.MAX_VALUE&&(n=hS.MAX_VALUE),i===Number.MAX_VALUE&&(i=hS.MAX_VALUE),{line:n,character:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.uinteger(i.line)&&ht.uinteger(i.character)}_(r,"is"),e.is=r})(di||(di={})),(function(e){function t(n,i,a,s){if(ht.uinteger(n)&&ht.uinteger(i)&&ht.uinteger(a)&&ht.uinteger(s))return{start:di.create(n,i),end:di.create(a,s)};if(di.is(n)&&di.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${a}, ${s}]`)}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&di.is(i.start)&&di.is(i.end)}_(r,"is"),e.is=r})(Bn||(Bn={})),(function(e){function t(n,i){return{uri:n,range:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.range)&&(ht.string(i.uri)||ht.undefined(i.uri))}_(r,"is"),e.is=r})(fS||(fS={})),(function(e){function t(n,i,a,s){return{targetUri:n,targetRange:i,targetSelectionRange:a,originSelectionRange:s}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.targetRange)&&ht.string(i.targetUri)&&Bn.is(i.targetSelectionRange)&&(Bn.is(i.originSelectionRange)||ht.undefined(i.originSelectionRange))}_(r,"is"),e.is=r})(kQ||(kQ={})),(function(e){function t(n,i,a,s){return{red:n,green:i,blue:a,alpha:s}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.numberRange(i.red,0,1)&&ht.numberRange(i.green,0,1)&&ht.numberRange(i.blue,0,1)&&ht.numberRange(i.alpha,0,1)}_(r,"is"),e.is=r})(iM||(iM={})),(function(e){function t(n,i){return{range:n,color:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.range)&&iM.is(i.color)}_(r,"is"),e.is=r})(TQ||(TQ={})),(function(e){function t(n,i,a){return{label:n,textEdit:i,additionalTextEdits:a}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.string(i.label)&&(ht.undefined(i.textEdit)||od.is(i))&&(ht.undefined(i.additionalTextEdits)||ht.typedArray(i.additionalTextEdits,od.is))}_(r,"is"),e.is=r})(CQ||(CQ={})),(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(SQ||(SQ={})),(function(e){function t(n,i,a,s,o,l){let u={startLine:n,endLine:i};return ht.defined(a)&&(u.startCharacter=a),ht.defined(s)&&(u.endCharacter=s),ht.defined(o)&&(u.kind=o),ht.defined(l)&&(u.collapsedText=l),u}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.uinteger(i.startLine)&&ht.uinteger(i.startLine)&&(ht.undefined(i.startCharacter)||ht.uinteger(i.startCharacter))&&(ht.undefined(i.endCharacter)||ht.uinteger(i.endCharacter))&&(ht.undefined(i.kind)||ht.string(i.kind))}_(r,"is"),e.is=r})(EQ||(EQ={})),(function(e){function t(n,i){return{location:n,message:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&fS.is(i.location)&&ht.string(i.message)}_(r,"is"),e.is=r})(aM||(aM={})),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(AQ||(AQ={})),(function(e){e.Unnecessary=1,e.Deprecated=2})(_Q||(_Q={})),(function(e){function t(r){let n=r;return ht.objectLiteral(n)&&ht.string(n.href)}_(t,"is"),e.is=t})(RQ||(RQ={})),(function(e){function t(n,i,a,s,o,l){let u={range:n,message:i};return ht.defined(a)&&(u.severity=a),ht.defined(s)&&(u.code=s),ht.defined(o)&&(u.source=o),ht.defined(l)&&(u.relatedInformation=l),u}_(t,"create"),e.create=t;function r(n){var i;let a=n;return ht.defined(a)&&Bn.is(a.range)&&ht.string(a.message)&&(ht.number(a.severity)||ht.undefined(a.severity))&&(ht.integer(a.code)||ht.string(a.code)||ht.undefined(a.code))&&(ht.undefined(a.codeDescription)||ht.string((i=a.codeDescription)===null||i===void 0?void 0:i.href))&&(ht.string(a.source)||ht.undefined(a.source))&&(ht.undefined(a.relatedInformation)||ht.typedArray(a.relatedInformation,aM.is))}_(r,"is"),e.is=r})(dS||(dS={})),(function(e){function t(n,i,...a){let s={title:n,command:i};return ht.defined(a)&&a.length>0&&(s.arguments=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.title)&&ht.string(i.command)}_(r,"is"),e.is=r})(Cv||(Cv={})),(function(e){function t(a,s){return{range:a,newText:s}}_(t,"replace"),e.replace=t;function r(a,s){return{range:{start:a,end:a},newText:s}}_(r,"insert"),e.insert=r;function n(a){return{range:a,newText:""}}_(n,"del"),e.del=n;function i(a){let s=a;return ht.objectLiteral(s)&&ht.string(s.newText)&&Bn.is(s.range)}_(i,"is"),e.is=i})(od||(od={})),(function(e){function t(n,i,a){let s={label:n};return i!==void 0&&(s.needsConfirmation=i),a!==void 0&&(s.description=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&ht.string(i.label)&&(ht.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(ht.string(i.description)||i.description===void 0)}_(r,"is"),e.is=r})(Sv||(Sv={})),(function(e){function t(r){let n=r;return ht.string(n)}_(t,"is"),e.is=t})(xo||(xo={})),(function(e){function t(a,s,o){return{range:a,newText:s,annotationId:o}}_(t,"replace"),e.replace=t;function r(a,s,o){return{range:{start:a,end:a},newText:s,annotationId:o}}_(r,"insert"),e.insert=r;function n(a,s){return{range:a,newText:"",annotationId:s}}_(n,"del"),e.del=n;function i(a){let s=a;return od.is(s)&&(Sv.is(s.annotationId)||xo.is(s.annotationId))}_(i,"is"),e.is=i})(H0||(H0={})),(function(e){function t(n,i){return{textDocument:n,edits:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&mS.is(i.textDocument)&&Array.isArray(i.edits)}_(r,"is"),e.is=r})(pS||(pS={})),(function(e){function t(n,i,a){let s={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),a!==void 0&&(s.annotationId=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="create"&&ht.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||ht.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||ht.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}_(r,"is"),e.is=r})(lw||(lw={})),(function(e){function t(n,i,a,s){let o={kind:"rename",oldUri:n,newUri:i};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}_(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="rename"&&ht.string(i.oldUri)&&ht.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||ht.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||ht.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}_(r,"is"),e.is=r})(cw||(cw={})),(function(e){function t(n,i,a){let s={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),a!==void 0&&(s.annotationId=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return i&&i.kind==="delete"&&ht.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||ht.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||ht.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||xo.is(i.annotationId))}_(r,"is"),e.is=r})(uw||(uw={})),(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>ht.string(i.kind)?lw.is(i)||cw.is(i)||uw.is(i):pS.is(i)))}_(t,"is"),e.is=t})(sM||(sM={})),rS=class{static{_(this,"TextEditChangeImpl")}constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,i;if(r===void 0?n=od.insert(e,t):xo.is(r)?(i=r,n=H0.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=H0.insert(e,t,i)),this.edits.push(n),i!==void 0)return i}replace(e,t,r){let n,i;if(r===void 0?n=od.replace(e,t):xo.is(r)?(i=r,n=H0.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(r),n=H0.replace(e,t,i)),this.edits.push(n),i!==void 0)return i}delete(e,t){let r,n;if(t===void 0?r=od.del(e):xo.is(t)?(n=t,r=H0.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=H0.del(e,n)),this.edits.push(r),n!==void 0)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},QZ=class{static{_(this,"ChangeAnnotations")}constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(xo.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},yBe=class{static{_(this,"WorkspaceChange")}constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new QZ(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(pS.is(t)){let r=new rS(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{let r=new rS(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(mS.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let t={uri:e.uri,version:e.version},r=this._textEditChanges[t.uri];if(!r){let n=[],i={textDocument:t,edits:n};this._workspaceEdit.documentChanges.push(i),r=new rS(n,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new rS(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new QZ,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;Sv.is(t)||xo.is(t)?n=t:r=t;let i,a;if(n===void 0?i=lw.create(e,r):(a=xo.is(n)?n:this._changeAnnotations.manage(n),i=lw.create(e,r,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}renameFile(e,t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;Sv.is(r)||xo.is(r)?i=r:n=r;let a,s;if(i===void 0?a=cw.create(e,t,n):(s=xo.is(i)?i:this._changeAnnotations.manage(i),a=cw.create(e,t,n,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;Sv.is(t)||xo.is(t)?n=t:r=t;let i,a;if(n===void 0?i=uw.create(e,r):(a=xo.is(n)?n:this._changeAnnotations.manage(n),i=uw.create(e,r,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}},(function(e){function t(n){return{uri:n}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)}_(r,"is"),e.is=r})(LQ||(LQ={})),(function(e){function t(n,i){return{uri:n,version:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)&&ht.integer(i.version)}_(r,"is"),e.is=r})(IQ||(IQ={})),(function(e){function t(n,i){return{uri:n,version:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)&&(i.version===null||ht.integer(i.version))}_(r,"is"),e.is=r})(mS||(mS={})),(function(e){function t(n,i,a,s){return{uri:n,languageId:i,version:a,text:s}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.string(i.uri)&&ht.string(i.languageId)&&ht.integer(i.version)&&ht.string(i.text)}_(r,"is"),e.is=r})(MQ||(MQ={})),(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){let n=r;return n===e.PlainText||n===e.Markdown}_(t,"is"),e.is=t})(oM||(oM={})),(function(e){function t(r){let n=r;return ht.objectLiteral(r)&&oM.is(n.kind)&&ht.string(n.value)}_(t,"is"),e.is=t})(hw||(hw={})),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(NQ||(NQ={})),(function(e){e.PlainText=1,e.Snippet=2})(DQ||(DQ={})),(function(e){e.Deprecated=1})(OQ||(OQ={})),(function(e){function t(n,i,a){return{newText:n,insert:i,replace:a}}_(t,"create"),e.create=t;function r(n){let i=n;return i&&ht.string(i.newText)&&Bn.is(i.insert)&&Bn.is(i.replace)}_(r,"is"),e.is=r})(PQ||(PQ={})),(function(e){e.asIs=1,e.adjustIndentation=2})(BQ||(BQ={})),(function(e){function t(r){let n=r;return n&&(ht.string(n.detail)||n.detail===void 0)&&(ht.string(n.description)||n.description===void 0)}_(t,"is"),e.is=t})(FQ||(FQ={})),(function(e){function t(r){return{label:r}}_(t,"create"),e.create=t})($Q||($Q={})),(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}_(t,"create"),e.create=t})(zQ||(zQ={})),(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}_(t,"fromPlainText"),e.fromPlainText=t;function r(n){let i=n;return ht.string(i)||ht.objectLiteral(i)&&ht.string(i.language)&&ht.string(i.value)}_(r,"is"),e.is=r})(gS||(gS={})),(function(e){function t(r){let n=r;return!!n&&ht.objectLiteral(n)&&(hw.is(n.contents)||gS.is(n.contents)||ht.typedArray(n.contents,gS.is))&&(r.range===void 0||Bn.is(r.range))}_(t,"is"),e.is=t})(GQ||(GQ={})),(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}_(t,"create"),e.create=t})(qQ||(qQ={})),(function(e){function t(r,n,...i){let a={label:r};return ht.defined(n)&&(a.documentation=n),ht.defined(i)?a.parameters=i:a.parameters=[],a}_(t,"create"),e.create=t})(VQ||(VQ={})),(function(e){e.Text=1,e.Read=2,e.Write=3})(WQ||(WQ={})),(function(e){function t(r,n){let i={range:r};return ht.number(n)&&(i.kind=n),i}_(t,"create"),e.create=t})(HQ||(HQ={})),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(UQ||(UQ={})),(function(e){e.Deprecated=1})(YQ||(YQ={})),(function(e){function t(r,n,i,a,s){let o={name:r,kind:n,location:{uri:a,range:i}};return s&&(o.containerName=s),o}_(t,"create"),e.create=t})(XQ||(XQ={})),(function(e){function t(r,n,i,a){return a!==void 0?{name:r,kind:n,location:{uri:i,range:a}}:{name:r,kind:n,location:{uri:i}}}_(t,"create"),e.create=t})(jQ||(jQ={})),(function(e){function t(n,i,a,s,o,l){let u={name:n,detail:i,kind:a,range:s,selectionRange:o};return l!==void 0&&(u.children=l),u}_(t,"create"),e.create=t;function r(n){let i=n;return i&&ht.string(i.name)&&ht.number(i.kind)&&Bn.is(i.range)&&Bn.is(i.selectionRange)&&(i.detail===void 0||ht.string(i.detail))&&(i.deprecated===void 0||ht.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}_(r,"is"),e.is=r})(KQ||(KQ={})),(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(ZQ||(ZQ={})),(function(e){e.Invoked=1,e.Automatic=2})(yS||(yS={})),(function(e){function t(n,i,a){let s={diagnostics:n};return i!=null&&(s.only=i),a!=null&&(s.triggerKind=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.typedArray(i.diagnostics,dS.is)&&(i.only===void 0||ht.typedArray(i.only,ht.string))&&(i.triggerKind===void 0||i.triggerKind===yS.Invoked||i.triggerKind===yS.Automatic)}_(r,"is"),e.is=r})(QQ||(QQ={})),(function(e){function t(n,i,a){let s={title:n},o=!0;return typeof i=="string"?(o=!1,s.kind=i):Cv.is(i)?s.command=i:s.edit=i,o&&a!==void 0&&(s.kind=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return i&&ht.string(i.title)&&(i.diagnostics===void 0||ht.typedArray(i.diagnostics,dS.is))&&(i.kind===void 0||ht.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||Cv.is(i.command))&&(i.isPreferred===void 0||ht.boolean(i.isPreferred))&&(i.edit===void 0||sM.is(i.edit))}_(r,"is"),e.is=r})(JQ||(JQ={})),(function(e){function t(n,i){let a={range:n};return ht.defined(i)&&(a.data=i),a}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&Bn.is(i.range)&&(ht.undefined(i.command)||Cv.is(i.command))}_(r,"is"),e.is=r})(eJ||(eJ={})),(function(e){function t(n,i){return{tabSize:n,insertSpaces:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&ht.uinteger(i.tabSize)&&ht.boolean(i.insertSpaces)}_(r,"is"),e.is=r})(tJ||(tJ={})),(function(e){function t(n,i,a){return{range:n,target:i,data:a}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&Bn.is(i.range)&&(ht.undefined(i.target)||ht.string(i.target))}_(r,"is"),e.is=r})(rJ||(rJ={})),(function(e){function t(n,i){return{range:n,parent:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&Bn.is(i.range)&&(i.parent===void 0||e.is(i.parent))}_(r,"is"),e.is=r})(nJ||(nJ={})),(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(iJ||(iJ={})),(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(aJ||(aJ={})),(function(e){function t(r){let n=r;return ht.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}_(t,"is"),e.is=t})(sJ||(sJ={})),(function(e){function t(n,i){return{range:n,text:i}}_(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Bn.is(i.range)&&ht.string(i.text)}_(r,"is"),e.is=r})(oJ||(oJ={})),(function(e){function t(n,i,a){return{range:n,variableName:i,caseSensitiveLookup:a}}_(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Bn.is(i.range)&&ht.boolean(i.caseSensitiveLookup)&&(ht.string(i.variableName)||i.variableName===void 0)}_(r,"is"),e.is=r})(lJ||(lJ={})),(function(e){function t(n,i){return{range:n,expression:i}}_(t,"create"),e.create=t;function r(n){let i=n;return i!=null&&Bn.is(i.range)&&(ht.string(i.expression)||i.expression===void 0)}_(r,"is"),e.is=r})(cJ||(cJ={})),(function(e){function t(n,i){return{frameId:n,stoppedLocation:i}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.defined(i)&&Bn.is(n.stoppedLocation)}_(r,"is"),e.is=r})(uJ||(uJ={})),(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}_(t,"is"),e.is=t})(lM||(lM={})),(function(e){function t(n){return{value:n}}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&(i.tooltip===void 0||ht.string(i.tooltip)||hw.is(i.tooltip))&&(i.location===void 0||fS.is(i.location))&&(i.command===void 0||Cv.is(i.command))}_(r,"is"),e.is=r})(cM||(cM={})),(function(e){function t(n,i,a){let s={position:n,label:i};return a!==void 0&&(s.kind=a),s}_(t,"create"),e.create=t;function r(n){let i=n;return ht.objectLiteral(i)&&di.is(i.position)&&(ht.string(i.label)||ht.typedArray(i.label,cM.is))&&(i.kind===void 0||lM.is(i.kind))&&i.textEdits===void 0||ht.typedArray(i.textEdits,od.is)&&(i.tooltip===void 0||ht.string(i.tooltip)||hw.is(i.tooltip))&&(i.paddingLeft===void 0||ht.boolean(i.paddingLeft))&&(i.paddingRight===void 0||ht.boolean(i.paddingRight))}_(r,"is"),e.is=r})(hJ||(hJ={})),(function(e){function t(r){return{kind:"snippet",value:r}}_(t,"createSnippet"),e.createSnippet=t})(fJ||(fJ={})),(function(e){function t(r,n,i,a){return{insertText:r,filterText:n,range:i,command:a}}_(t,"create"),e.create=t})(dJ||(dJ={})),(function(e){function t(r){return{items:r}}_(t,"create"),e.create=t})(pJ||(pJ={})),(function(e){e.Invoked=0,e.Automatic=1})(mJ||(mJ={})),(function(e){function t(r,n){return{range:r,text:n}}_(t,"create"),e.create=t})(gJ||(gJ={})),(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}_(t,"create"),e.create=t})(yJ||(yJ={})),(function(e){function t(r){let n=r;return ht.objectLiteral(n)&&nM.is(n.uri)&&ht.string(n.name)}_(t,"is"),e.is=t})(vJ||(vJ={})),vBe=[` `,`\r -`,"\r"],(function(e){function t(a,s,o,l){return new COe(a,s,o,l)}_(t,"create"),e.create=t;function r(a){let s=a;return!!(ht.defined(s)&&ht.string(s.uri)&&(ht.undefined(s.languageId)||ht.string(s.languageId))&&ht.uinteger(s.lineCount)&&ht.func(s.getText)&&ht.func(s.positionAt)&&ht.func(s.offsetAt))}_(r,"is"),e.is=r;function n(a,s){let o=a.getText(),l=i(s,(h,f)=>{let d=h.range.start.line-f.range.start.line;return d===0?h.range.start.character-f.range.start.character:d}),u=o.length;for(let h=l.length-1;h>=0;h--){let f=l[h],d=a.offsetAt(f.range.start),p=a.offsetAt(f.range.end);if(p<=u)o=o.substring(0,d)+f.newText+o.substring(p,o.length);else throw new Error("Overlapping edit");u=d}return o}_(n,"applyEdits"),e.applyEdits=n;function i(a,s){if(a.length<=1)return a;let o=a.length/2|0,l=a.slice(0,o),u=a.slice(o);i(l,s),i(u,s);let h=0,f=0,d=0;for(;h{let d=h.range.start.line-f.range.start.line;return d===0?h.range.start.character-f.range.start.character:d}),u=o.length;for(let h=l.length-1;h>=0;h--){let f=l[h],d=a.offsetAt(f.range.start),p=a.offsetAt(f.range.end);if(p<=u)o=o.substring(0,d)+f.newText+o.substring(p,o.length);else throw new Error("Overlapping edit");u=d}return o}_(n,"applyEdits"),e.applyEdits=n;function i(a,s){if(a.length<=1)return a;let o=a.length/2|0,l=a.slice(0,o),u=a.slice(o);i(l,s),i(u,s);let h=0,f=0,d=0;for(;h0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,n=t.length;if(n===0)return di.create(0,e);for(;re?n=a:r=a+1}let i=r-1;return di.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],n=e.line+1"u"}_(n,"undefined"),e.undefined=n;function i(p){return p===!0||p===!1}_(i,"boolean"),e.boolean=i;function a(p){return t.call(p)==="[object String]"}_(a,"string"),e.string=a;function s(p){return t.call(p)==="[object Number]"}_(s,"number"),e.number=s;function o(p,m,g){return t.call(p)==="[object Number]"&&m<=p&&p<=g}_(o,"numberRange"),e.numberRange=o;function l(p){return t.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}_(l,"integer"),e.integer=l;function u(p){return t.call(p)==="[object Number]"&&0<=p&&p<=2147483647}_(u,"uinteger"),e.uinteger=u;function h(p){return t.call(p)==="[object Function]"}_(h,"func"),e.func=h;function f(p){return p!==null&&typeof p=="object"}_(f,"objectLiteral"),e.objectLiteral=f;function d(p,m){return Array.isArray(p)&&p.every(m)}_(d,"typedArray"),e.typedArray=d})(ht||(ht={}))}}),h2=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t;function r(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}_(r,"RAL"),(function(n){function i(a){if(a===void 0)throw new Error("No runtime abstraction layer provided");t=a}_(i,"install"),n.install=i})(r||(r={})),e.default=r}}),s6=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(l){return l===!0||l===!1}_(t,"boolean"),e.boolean=t;function r(l){return typeof l=="string"||l instanceof String}_(r,"string"),e.string=r;function n(l){return typeof l=="number"||l instanceof Number}_(n,"number"),e.number=n;function i(l){return l instanceof Error}_(i,"error"),e.error=i;function a(l){return typeof l=="function"}_(a,"func"),e.func=a;function s(l){return Array.isArray(l)}_(s,"array"),e.array=s;function o(l){return s(l)&&l.every(u=>r(u))}_(o,"stringArray"),e.stringArray=o}}),qw=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var t=h2(),r;(function(a){let s={dispose(){}};a.None=function(){return s}})(r||(e.Event=r={}));var n=class{static{_(this,"CallbackList")}add(a,s=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(a),this._contexts.push(s),Array.isArray(o)&&o.push({dispose:_(()=>this.remove(a,s),"dispose")})}remove(a,s=null){if(!this._callbacks)return;let o=!1;for(let l=0,u=this._callbacks.length;l{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,o);let u={dispose:_(()=>{this._callbacks&&(this._callbacks.remove(s,o),u.dispose=yBe._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))},"dispose")};return Array.isArray(l)&&l.push(u),u}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};e.Emitter=i,i._noop=function(){}}}),TN=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/cancellation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;var t=h2(),r=s6(),n=qw(),i;(function(l){l.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),l.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None});function u(h){let f=h;return f&&(f===l.None||f===l.Cancelled||r.boolean(f.isCancellationRequested)&&!!f.onCancellationRequested)}_(u,"is"),l.is=u})(i||(e.CancellationToken=i={}));var a=Object.freeze(function(l,u){let h=(0,t.default)().timer.setTimeout(l.bind(u),0);return{dispose(){h.dispose()}}}),s=class{static{_(this,"MutableToken")}constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?a:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},o=class{static{_(this,"CancellationTokenSource")}get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=i.None}};e.CancellationTokenSource=o}}),vBe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messages.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;var t=s6(),r;(function(A){A.ParseError=-32700,A.InvalidRequest=-32600,A.MethodNotFound=-32601,A.InvalidParams=-32602,A.InternalError=-32603,A.jsonrpcReservedErrorRangeStart=-32099,A.serverErrorStart=-32099,A.MessageWriteError=-32099,A.MessageReadError=-32098,A.PendingResponseRejected=-32097,A.ConnectionInactive=-32096,A.ServerNotInitialized=-32002,A.UnknownErrorCode=-32001,A.jsonrpcReservedErrorRangeEnd=-32e3,A.serverErrorEnd=-32e3})(r||(e.ErrorCodes=r={}));var n=class xBe extends Error{static{_(this,"ResponseError")}constructor(N,M,D){super(M),this.code=t.number(N)?N:r.UnknownErrorCode,this.data=D,Object.setPrototypeOf(this,xBe.prototype)}toJson(){let N={code:this.code,message:this.message};return this.data!==void 0&&(N.data=this.data),N}};e.ResponseError=n;var i=class uM{static{_(this,"ParameterStructures")}constructor(N){this.kind=N}static is(N){return N===uM.auto||N===uM.byName||N===uM.byPosition}toString(){return this.kind}};e.ParameterStructures=i,i.auto=new i("auto"),i.byPosition=new i("byPosition"),i.byName=new i("byName");var a=class{static{_(this,"AbstractMessageSignature")}constructor(A,N){this.method=A,this.numberOfParams=N}get parameterStructures(){return i.auto}};e.AbstractMessageSignature=a;var s=class extends a{static{_(this,"RequestType0")}constructor(A){super(A,0)}};e.RequestType0=s;var o=class extends a{static{_(this,"RequestType")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.RequestType=o;var l=class extends a{static{_(this,"RequestType1")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.RequestType1=l;var u=class extends a{static{_(this,"RequestType2")}constructor(A){super(A,2)}};e.RequestType2=u;var h=class extends a{static{_(this,"RequestType3")}constructor(A){super(A,3)}};e.RequestType3=h;var f=class extends a{static{_(this,"RequestType4")}constructor(A){super(A,4)}};e.RequestType4=f;var d=class extends a{static{_(this,"RequestType5")}constructor(A){super(A,5)}};e.RequestType5=d;var p=class extends a{static{_(this,"RequestType6")}constructor(A){super(A,6)}};e.RequestType6=p;var m=class extends a{static{_(this,"RequestType7")}constructor(A){super(A,7)}};e.RequestType7=m;var g=class extends a{static{_(this,"RequestType8")}constructor(A){super(A,8)}};e.RequestType8=g;var y=class extends a{static{_(this,"RequestType9")}constructor(A){super(A,9)}};e.RequestType9=y;var v=class extends a{static{_(this,"NotificationType")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.NotificationType=v;var x=class extends a{static{_(this,"NotificationType0")}constructor(A){super(A,0)}};e.NotificationType0=x;var w=class extends a{static{_(this,"NotificationType1")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.NotificationType1=w;var C=class extends a{static{_(this,"NotificationType2")}constructor(A){super(A,2)}};e.NotificationType2=C;var T=class extends a{static{_(this,"NotificationType3")}constructor(A){super(A,3)}};e.NotificationType3=T;var k=class extends a{static{_(this,"NotificationType4")}constructor(A){super(A,4)}};e.NotificationType4=k;var S=class extends a{static{_(this,"NotificationType5")}constructor(A){super(A,5)}};e.NotificationType5=S;var E=class extends a{static{_(this,"NotificationType6")}constructor(A){super(A,6)}};e.NotificationType6=E;var I=class extends a{static{_(this,"NotificationType7")}constructor(A){super(A,7)}};e.NotificationType7=I;var L=class extends a{static{_(this,"NotificationType8")}constructor(A){super(A,8)}};e.NotificationType8=L;var O=class extends a{static{_(this,"NotificationType9")}constructor(A){super(A,9)}};e.NotificationType9=O;var R;(function(A){function N(B){let P=B;return P&&t.string(P.method)&&(t.string(P.id)||t.number(P.id))}_(N,"isRequest"),A.isRequest=N;function M(B){let P=B;return P&&t.string(P.method)&&B.id===void 0}_(M,"isNotification"),A.isNotification=M;function D(B){let P=B;return P&&(P.result!==void 0||!!P.error)&&(t.string(P.id)||t.number(P.id)||P.id===null)}_(D,"isResponse"),A.isResponse=D})(R||(e.Message=R={}))}}),bBe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var r;(function(a){a.None=0,a.First=1,a.AsOld=a.First,a.Last=2,a.AsNew=a.Last})(r||(e.Touch=r={}));var n=class{static{_(this,"LinkedMap")}constructor(){this[t]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(a){return this._map.has(a)}get(a,s=r.None){let o=this._map.get(a);if(o)return s!==r.None&&this.touch(o,s),o.value}set(a,s,o=r.None){let l=this._map.get(a);if(l)l.value=s,o!==r.None&&this.touch(l,o);else{switch(l={key:a,value:s,next:void 0,previous:void 0},o){case r.None:this.addItemLast(l);break;case r.First:this.addItemFirst(l);break;case r.Last:this.addItemLast(l);break;default:this.addItemLast(l);break}this._map.set(a,l),this._size++}return this}delete(a){return!!this.remove(a)}remove(a){let s=this._map.get(a);if(s)return this._map.delete(a),this.removeItem(s),this._size--,s.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let a=this._head;return this._map.delete(a.key),this.removeItem(a),this._size--,a.value}forEach(a,s){let o=this._state,l=this._head;for(;l;){if(s?a.bind(s)(l.value,l.key,this):a(l.value,l.key,this),this._state!==o)throw new Error("LinkedMap got modified during iteration.");l=l.next}}keys(){let a=this._state,s=this._head,o={[Symbol.iterator]:()=>o,next:_(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let l={value:s.key,done:!1};return s=s.next,l}else return{value:void 0,done:!0}},"next")};return o}values(){let a=this._state,s=this._head,o={[Symbol.iterator]:()=>o,next:_(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let l={value:s.value,done:!1};return s=s.next,l}else return{value:void 0,done:!0}},"next")};return o}entries(){let a=this._state,s=this._head,o={[Symbol.iterator]:()=>o,next:_(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let l={value:[s.key,s.value],done:!1};return s=s.next,l}else return{value:void 0,done:!0}},"next")};return o}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(a){if(a>=this.size)return;if(a===0){this.clear();return}let s=this._head,o=this.size;for(;s&&o>a;)this._map.delete(s.key),s=s.next,o--;this._head=s,this._size=o,s&&(s.previous=void 0),this._state++}addItemFirst(a){if(!this._head&&!this._tail)this._tail=a;else if(this._head)a.next=this._head,this._head.previous=a;else throw new Error("Invalid list");this._head=a,this._state++}addItemLast(a){if(!this._head&&!this._tail)this._head=a;else if(this._tail)a.previous=this._tail,this._tail.next=a;else throw new Error("Invalid list");this._tail=a,this._state++}removeItem(a){if(a===this._head&&a===this._tail)this._head=void 0,this._tail=void 0;else if(a===this._head){if(!a.next)throw new Error("Invalid list");a.next.previous=void 0,this._head=a.next}else if(a===this._tail){if(!a.previous)throw new Error("Invalid list");a.previous.next=void 0,this._tail=a.previous}else{let s=a.next,o=a.previous;if(!s||!o)throw new Error("Invalid list");s.previous=o,o.next=s}a.next=void 0,a.previous=void 0,this._state++}touch(a,s){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(s!==r.First&&s!==r.Last)){if(s===r.First){if(a===this._head)return;let o=a.next,l=a.previous;a===this._tail?(l.next=void 0,this._tail=l):(o.previous=l,l.next=o),a.previous=void 0,a.next=this._head,this._head.previous=a,this._head=a,this._state++}else if(s===r.Last){if(a===this._tail)return;let o=a.next,l=a.previous;a===this._head?(o.previous=void 0,this._head=o):(o.previous=l,l.next=o),a.next=void 0,a.previous=this._tail,this._tail.next=a,this._tail=a,this._state++}}}toJSON(){let a=[];return this.forEach((s,o)=>{a.push([o,s])}),a}fromJSON(a){this.clear();for(let[s,o]of a)this.set(s,o)}};e.LinkedMap=n;var i=class extends n{static{_(this,"LRUCache")}constructor(a,s=1){super(),this._limit=a,this._ratio=Math.min(Math.max(0,s),1)}get limit(){return this._limit}set limit(a){this._limit=a,this.checkTrim()}get ratio(){return this._ratio}set ratio(a){this._ratio=Math.min(Math.max(0,a),1),this.checkTrim()}get(a,s=r.AsNew){return super.get(a,s)}peek(a){return super.get(a,r.None)}set(a,s){return super.set(a,s,r.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};e.LRUCache=i}}),qDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/disposable.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0;var t;(function(r){function n(i){return{dispose:i}}_(n,"create"),r.create=n})(t||(e.Disposable=t={}))}}),VDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;var t=TN(),r;(function(o){o.Continue=0,o.Cancelled=1})(r||(r={}));var n=class{static{_(this,"SharedArraySenderStrategy")}constructor(){this.buffers=new Map}enableCancellation(o){if(o.id===null)return;let l=new SharedArrayBuffer(4),u=new Int32Array(l,0,1);u[0]=r.Continue,this.buffers.set(o.id,l),o.$cancellationData=l}async sendCancellation(o,l){let u=this.buffers.get(l);if(u===void 0)return;let h=new Int32Array(u,0,1);Atomics.store(h,0,r.Cancelled)}cleanup(o){this.buffers.delete(o)}dispose(){this.buffers.clear()}};e.SharedArraySenderStrategy=n;var i=class{static{_(this,"SharedArrayBufferCancellationToken")}constructor(o){this.data=new Int32Array(o,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===r.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},a=class{static{_(this,"SharedArrayBufferCancellationTokenSource")}constructor(o){this.token=new i(o)}cancel(){}dispose(){}},s=class{static{_(this,"SharedArrayReceiverStrategy")}constructor(){this.kind="request"}createCancellationTokenSource(o){let l=o.$cancellationData;return l===void 0?new t.CancellationTokenSource:new a(l)}};e.SharedArrayReceiverStrategy=s}}),wBe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/semaphore.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Semaphore=void 0;var t=h2(),r=class{static{_(this,"Semaphore")}constructor(n=1){if(n<=0)throw new Error("Capacity must be greater than 0");this._capacity=n,this._active=0,this._waiting=[]}lock(n){return new Promise((i,a)=>{this._waiting.push({thunk:n,resolve:i,reject:a}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let n=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let i=n.thunk();i instanceof Promise?i.then(a=>{this._active--,n.resolve(a),this.runNext()},a=>{this._active--,n.reject(a),this.runNext()}):(this._active--,n.resolve(i),this.runNext())}catch(i){this._active--,n.reject(i),this.runNext()}}};e.Semaphore=r}}),WDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageReader.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;var t=h2(),r=s6(),n=qw(),i=wBe(),a;(function(u){function h(f){let d=f;return d&&r.func(d.listen)&&r.func(d.dispose)&&r.func(d.onError)&&r.func(d.onClose)&&r.func(d.onPartialMessage)}_(h,"is"),u.is=h})(a||(e.MessageReader=a={}));var s=class{static{_(this,"AbstractMessageReader")}constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter,this.partialMessageEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(u){this.errorEmitter.fire(this.asError(u))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(u){this.partialMessageEmitter.fire(u)}asError(u){return u instanceof Error?u:new Error(`Reader received error. Reason: ${r.string(u.message)?u.message:"unknown"}`)}};e.AbstractMessageReader=s;var o;(function(u){function h(f){let d,p,m,g=new Map,y,v=new Map;if(f===void 0||typeof f=="string")d=f??"utf-8";else{if(d=f.charset??"utf-8",f.contentDecoder!==void 0&&(m=f.contentDecoder,g.set(m.name,m)),f.contentDecoders!==void 0)for(let x of f.contentDecoders)g.set(x.name,x);if(f.contentTypeDecoder!==void 0&&(y=f.contentTypeDecoder,v.set(y.name,y)),f.contentTypeDecoders!==void 0)for(let x of f.contentTypeDecoders)v.set(x.name,x)}return y===void 0&&(y=(0,t.default)().applicationJson.decoder,v.set(y.name,y)),{charset:d,contentDecoder:m,contentDecoders:g,contentTypeDecoder:y,contentTypeDecoders:v}}_(h,"fromOptions"),u.fromOptions=h})(o||(o={}));var l=class extends s{static{_(this,"ReadableStreamMessageReader")}constructor(u,h){super(),this.readable=u,this.options=o.fromOptions(h),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new i.Semaphore(1)}set partialMessageTimeout(u){this._partialMessageTimeout=u}get partialMessageTimeout(){return this._partialMessageTimeout}listen(u){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=u;let h=this.readable.onData(f=>{this.onData(f)});return this.readable.onError(f=>this.fireError(f)),this.readable.onClose(()=>this.fireClose()),h}onData(u){try{for(this.buffer.append(u);;){if(this.nextMessageLength===-1){let f=this.buffer.tryReadHeaders(!0);if(!f)return;let d=f.get("content-length");if(!d){this.fireError(new Error(`Header must provide a Content-Length property. -${JSON.stringify(Object.fromEntries(f))}`));return}let p=parseInt(d);if(isNaN(p)){this.fireError(new Error(`Content-Length value must be a number. Got ${d}`));return}this.nextMessageLength=p}let h=this.buffer.tryReadBody(this.nextMessageLength);if(h===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let f=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(h):h,d=await this.options.contentTypeDecoder.decode(f,this.options);this.callback(d)}).catch(f=>{this.fireError(f)})}}catch(h){this.fireError(h)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((u,h)=>{this.partialMessageTimer=void 0,u===this.messageToken&&(this.firePartialMessage({messageToken:u,waitingTime:h}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};e.ReadableStreamMessageReader=l}}),HDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var t=h2(),r=s6(),n=wBe(),i=qw(),a="Content-Length: ",s=`\r -`,o;(function(f){function d(p){let m=p;return m&&r.func(m.dispose)&&r.func(m.onClose)&&r.func(m.onError)&&r.func(m.write)}_(d,"is"),f.is=d})(o||(e.MessageWriter=o={}));var l=class{static{_(this,"AbstractMessageWriter")}constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(f,d,p){this.errorEmitter.fire([this.asError(f),d,p])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(f){return f instanceof Error?f:new Error(`Writer received error. Reason: ${r.string(f.message)?f.message:"unknown"}`)}};e.AbstractMessageWriter=l;var u;(function(f){function d(p){return p===void 0||typeof p=="string"?{charset:p??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:p.charset??"utf-8",contentEncoder:p.contentEncoder,contentTypeEncoder:p.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}_(d,"fromOptions"),f.fromOptions=d})(u||(u={}));var h=class extends l{static{_(this,"WriteableStreamMessageWriter")}constructor(f,d){super(),this.writable=f,this.options=u.fromOptions(d),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(p=>this.fireError(p)),this.writable.onClose(()=>this.fireClose())}async write(f){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(f,this.options).then(p=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(p):p).then(p=>{let m=[];return m.push(a,p.byteLength.toString(),s),m.push(s),this.doWrite(f,m,p)},p=>{throw this.fireError(p),p}))}async doWrite(f,d,p){try{return await this.writable.write(d.join(""),"ascii"),this.writable.write(p)}catch(m){return this.handleError(m,f),Promise.reject(m)}}handleError(f,d){this.errorCount++,this.fireError(f,d,this.errorCount)}end(){this.writable.end()}};e.WriteableStreamMessageWriter=h}}),UDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMessageBuffer=void 0;var t=13,r=10,n=`\r +`&&n++}r&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,n=t.length;if(n===0)return di.create(0,e);for(;re?n=a:r=a+1}let i=r-1;return di.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],n=e.line+1"u"}_(n,"undefined"),e.undefined=n;function i(p){return p===!0||p===!1}_(i,"boolean"),e.boolean=i;function a(p){return t.call(p)==="[object String]"}_(a,"string"),e.string=a;function s(p){return t.call(p)==="[object Number]"}_(s,"number"),e.number=s;function o(p,m,g){return t.call(p)==="[object Number]"&&m<=p&&p<=g}_(o,"numberRange"),e.numberRange=o;function l(p){return t.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}_(l,"integer"),e.integer=l;function u(p){return t.call(p)==="[object Number]"&&0<=p&&p<=2147483647}_(u,"uinteger"),e.uinteger=u;function h(p){return t.call(p)==="[object Function]"}_(h,"func"),e.func=h;function f(p){return p!==null&&typeof p=="object"}_(f,"objectLiteral"),e.objectLiteral=f;function d(p,m){return Array.isArray(p)&&p.every(m)}_(d,"typedArray"),e.typedArray=d})(ht||(ht={}))}}),h2=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t;function r(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}_(r,"RAL"),(function(n){function i(a){if(a===void 0)throw new Error("No runtime abstraction layer provided");t=a}_(i,"install"),n.install=i})(r||(r={})),e.default=r}}),s6=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(l){return l===!0||l===!1}_(t,"boolean"),e.boolean=t;function r(l){return typeof l=="string"||l instanceof String}_(r,"string"),e.string=r;function n(l){return typeof l=="number"||l instanceof Number}_(n,"number"),e.number=n;function i(l){return l instanceof Error}_(i,"error"),e.error=i;function a(l){return typeof l=="function"}_(a,"func"),e.func=a;function s(l){return Array.isArray(l)}_(s,"array"),e.array=s;function o(l){return s(l)&&l.every(u=>r(u))}_(o,"stringArray"),e.stringArray=o}}),qw=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var t=h2(),r;(function(a){let s={dispose(){}};a.None=function(){return s}})(r||(e.Event=r={}));var n=class{static{_(this,"CallbackList")}add(a,s=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(a),this._contexts.push(s),Array.isArray(o)&&o.push({dispose:_(()=>this.remove(a,s),"dispose")})}remove(a,s=null){if(!this._callbacks)return;let o=!1;for(let l=0,u=this._callbacks.length;l{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,o);let u={dispose:_(()=>{this._callbacks&&(this._callbacks.remove(s,o),u.dispose=xBe._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))},"dispose")};return Array.isArray(l)&&l.push(u),u}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};e.Emitter=i,i._noop=function(){}}}),TN=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/cancellation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;var t=h2(),r=s6(),n=qw(),i;(function(l){l.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),l.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None});function u(h){let f=h;return f&&(f===l.None||f===l.Cancelled||r.boolean(f.isCancellationRequested)&&!!f.onCancellationRequested)}_(u,"is"),l.is=u})(i||(e.CancellationToken=i={}));var a=Object.freeze(function(l,u){let h=(0,t.default)().timer.setTimeout(l.bind(u),0);return{dispose(){h.dispose()}}}),s=class{static{_(this,"MutableToken")}constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?a:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},o=class{static{_(this,"CancellationTokenSource")}get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=i.None}};e.CancellationTokenSource=o}}),bBe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messages.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;var t=s6(),r;(function(A){A.ParseError=-32700,A.InvalidRequest=-32600,A.MethodNotFound=-32601,A.InvalidParams=-32602,A.InternalError=-32603,A.jsonrpcReservedErrorRangeStart=-32099,A.serverErrorStart=-32099,A.MessageWriteError=-32099,A.MessageReadError=-32098,A.PendingResponseRejected=-32097,A.ConnectionInactive=-32096,A.ServerNotInitialized=-32002,A.UnknownErrorCode=-32001,A.jsonrpcReservedErrorRangeEnd=-32e3,A.serverErrorEnd=-32e3})(r||(e.ErrorCodes=r={}));var n=class wBe extends Error{static{_(this,"ResponseError")}constructor(N,M,D){super(M),this.code=t.number(N)?N:r.UnknownErrorCode,this.data=D,Object.setPrototypeOf(this,wBe.prototype)}toJson(){let N={code:this.code,message:this.message};return this.data!==void 0&&(N.data=this.data),N}};e.ResponseError=n;var i=class uM{static{_(this,"ParameterStructures")}constructor(N){this.kind=N}static is(N){return N===uM.auto||N===uM.byName||N===uM.byPosition}toString(){return this.kind}};e.ParameterStructures=i,i.auto=new i("auto"),i.byPosition=new i("byPosition"),i.byName=new i("byName");var a=class{static{_(this,"AbstractMessageSignature")}constructor(A,N){this.method=A,this.numberOfParams=N}get parameterStructures(){return i.auto}};e.AbstractMessageSignature=a;var s=class extends a{static{_(this,"RequestType0")}constructor(A){super(A,0)}};e.RequestType0=s;var o=class extends a{static{_(this,"RequestType")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.RequestType=o;var l=class extends a{static{_(this,"RequestType1")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.RequestType1=l;var u=class extends a{static{_(this,"RequestType2")}constructor(A){super(A,2)}};e.RequestType2=u;var h=class extends a{static{_(this,"RequestType3")}constructor(A){super(A,3)}};e.RequestType3=h;var f=class extends a{static{_(this,"RequestType4")}constructor(A){super(A,4)}};e.RequestType4=f;var d=class extends a{static{_(this,"RequestType5")}constructor(A){super(A,5)}};e.RequestType5=d;var p=class extends a{static{_(this,"RequestType6")}constructor(A){super(A,6)}};e.RequestType6=p;var m=class extends a{static{_(this,"RequestType7")}constructor(A){super(A,7)}};e.RequestType7=m;var g=class extends a{static{_(this,"RequestType8")}constructor(A){super(A,8)}};e.RequestType8=g;var y=class extends a{static{_(this,"RequestType9")}constructor(A){super(A,9)}};e.RequestType9=y;var v=class extends a{static{_(this,"NotificationType")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.NotificationType=v;var x=class extends a{static{_(this,"NotificationType0")}constructor(A){super(A,0)}};e.NotificationType0=x;var w=class extends a{static{_(this,"NotificationType1")}constructor(A,N=i.auto){super(A,1),this._parameterStructures=N}get parameterStructures(){return this._parameterStructures}};e.NotificationType1=w;var C=class extends a{static{_(this,"NotificationType2")}constructor(A){super(A,2)}};e.NotificationType2=C;var T=class extends a{static{_(this,"NotificationType3")}constructor(A){super(A,3)}};e.NotificationType3=T;var k=class extends a{static{_(this,"NotificationType4")}constructor(A){super(A,4)}};e.NotificationType4=k;var S=class extends a{static{_(this,"NotificationType5")}constructor(A){super(A,5)}};e.NotificationType5=S;var E=class extends a{static{_(this,"NotificationType6")}constructor(A){super(A,6)}};e.NotificationType6=E;var I=class extends a{static{_(this,"NotificationType7")}constructor(A){super(A,7)}};e.NotificationType7=I;var L=class extends a{static{_(this,"NotificationType8")}constructor(A){super(A,8)}};e.NotificationType8=L;var O=class extends a{static{_(this,"NotificationType9")}constructor(A){super(A,9)}};e.NotificationType9=O;var R;(function(A){function N(B){let P=B;return P&&t.string(P.method)&&(t.string(P.id)||t.number(P.id))}_(N,"isRequest"),A.isRequest=N;function M(B){let P=B;return P&&t.string(P.method)&&B.id===void 0}_(M,"isNotification"),A.isNotification=M;function D(B){let P=B;return P&&(P.result!==void 0||!!P.error)&&(t.string(P.id)||t.number(P.id)||P.id===null)}_(D,"isResponse"),A.isResponse=D})(R||(e.Message=R={}))}}),kBe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var r;(function(a){a.None=0,a.First=1,a.AsOld=a.First,a.Last=2,a.AsNew=a.Last})(r||(e.Touch=r={}));var n=class{static{_(this,"LinkedMap")}constructor(){this[t]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(a){return this._map.has(a)}get(a,s=r.None){let o=this._map.get(a);if(o)return s!==r.None&&this.touch(o,s),o.value}set(a,s,o=r.None){let l=this._map.get(a);if(l)l.value=s,o!==r.None&&this.touch(l,o);else{switch(l={key:a,value:s,next:void 0,previous:void 0},o){case r.None:this.addItemLast(l);break;case r.First:this.addItemFirst(l);break;case r.Last:this.addItemLast(l);break;default:this.addItemLast(l);break}this._map.set(a,l),this._size++}return this}delete(a){return!!this.remove(a)}remove(a){let s=this._map.get(a);if(s)return this._map.delete(a),this.removeItem(s),this._size--,s.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let a=this._head;return this._map.delete(a.key),this.removeItem(a),this._size--,a.value}forEach(a,s){let o=this._state,l=this._head;for(;l;){if(s?a.bind(s)(l.value,l.key,this):a(l.value,l.key,this),this._state!==o)throw new Error("LinkedMap got modified during iteration.");l=l.next}}keys(){let a=this._state,s=this._head,o={[Symbol.iterator]:()=>o,next:_(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let l={value:s.key,done:!1};return s=s.next,l}else return{value:void 0,done:!0}},"next")};return o}values(){let a=this._state,s=this._head,o={[Symbol.iterator]:()=>o,next:_(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let l={value:s.value,done:!1};return s=s.next,l}else return{value:void 0,done:!0}},"next")};return o}entries(){let a=this._state,s=this._head,o={[Symbol.iterator]:()=>o,next:_(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let l={value:[s.key,s.value],done:!1};return s=s.next,l}else return{value:void 0,done:!0}},"next")};return o}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(a){if(a>=this.size)return;if(a===0){this.clear();return}let s=this._head,o=this.size;for(;s&&o>a;)this._map.delete(s.key),s=s.next,o--;this._head=s,this._size=o,s&&(s.previous=void 0),this._state++}addItemFirst(a){if(!this._head&&!this._tail)this._tail=a;else if(this._head)a.next=this._head,this._head.previous=a;else throw new Error("Invalid list");this._head=a,this._state++}addItemLast(a){if(!this._head&&!this._tail)this._head=a;else if(this._tail)a.previous=this._tail,this._tail.next=a;else throw new Error("Invalid list");this._tail=a,this._state++}removeItem(a){if(a===this._head&&a===this._tail)this._head=void 0,this._tail=void 0;else if(a===this._head){if(!a.next)throw new Error("Invalid list");a.next.previous=void 0,this._head=a.next}else if(a===this._tail){if(!a.previous)throw new Error("Invalid list");a.previous.next=void 0,this._tail=a.previous}else{let s=a.next,o=a.previous;if(!s||!o)throw new Error("Invalid list");s.previous=o,o.next=s}a.next=void 0,a.previous=void 0,this._state++}touch(a,s){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(s!==r.First&&s!==r.Last)){if(s===r.First){if(a===this._head)return;let o=a.next,l=a.previous;a===this._tail?(l.next=void 0,this._tail=l):(o.previous=l,l.next=o),a.previous=void 0,a.next=this._head,this._head.previous=a,this._head=a,this._state++}else if(s===r.Last){if(a===this._tail)return;let o=a.next,l=a.previous;a===this._head?(o.previous=void 0,this._head=o):(o.previous=l,l.next=o),a.next=void 0,a.previous=this._tail,this._tail.next=a,this._tail=a,this._state++}}}toJSON(){let a=[];return this.forEach((s,o)=>{a.push([o,s])}),a}fromJSON(a){this.clear();for(let[s,o]of a)this.set(s,o)}};e.LinkedMap=n;var i=class extends n{static{_(this,"LRUCache")}constructor(a,s=1){super(),this._limit=a,this._ratio=Math.min(Math.max(0,s),1)}get limit(){return this._limit}set limit(a){this._limit=a,this.checkTrim()}get ratio(){return this._ratio}set ratio(a){this._ratio=Math.min(Math.max(0,a),1),this.checkTrim()}get(a,s=r.AsNew){return super.get(a,s)}peek(a){return super.get(a,r.None)}set(a,s){return super.set(a,s,r.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};e.LRUCache=i}}),UDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/disposable.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0;var t;(function(r){function n(i){return{dispose:i}}_(n,"create"),r.create=n})(t||(e.Disposable=t={}))}}),YDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;var t=TN(),r;(function(o){o.Continue=0,o.Cancelled=1})(r||(r={}));var n=class{static{_(this,"SharedArraySenderStrategy")}constructor(){this.buffers=new Map}enableCancellation(o){if(o.id===null)return;let l=new SharedArrayBuffer(4),u=new Int32Array(l,0,1);u[0]=r.Continue,this.buffers.set(o.id,l),o.$cancellationData=l}async sendCancellation(o,l){let u=this.buffers.get(l);if(u===void 0)return;let h=new Int32Array(u,0,1);Atomics.store(h,0,r.Cancelled)}cleanup(o){this.buffers.delete(o)}dispose(){this.buffers.clear()}};e.SharedArraySenderStrategy=n;var i=class{static{_(this,"SharedArrayBufferCancellationToken")}constructor(o){this.data=new Int32Array(o,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===r.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},a=class{static{_(this,"SharedArrayBufferCancellationTokenSource")}constructor(o){this.token=new i(o)}cancel(){}dispose(){}},s=class{static{_(this,"SharedArrayReceiverStrategy")}constructor(){this.kind="request"}createCancellationTokenSource(o){let l=o.$cancellationData;return l===void 0?new t.CancellationTokenSource:new a(l)}};e.SharedArrayReceiverStrategy=s}}),TBe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/semaphore.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Semaphore=void 0;var t=h2(),r=class{static{_(this,"Semaphore")}constructor(n=1){if(n<=0)throw new Error("Capacity must be greater than 0");this._capacity=n,this._active=0,this._waiting=[]}lock(n){return new Promise((i,a)=>{this._waiting.push({thunk:n,resolve:i,reject:a}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let n=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let i=n.thunk();i instanceof Promise?i.then(a=>{this._active--,n.resolve(a),this.runNext()},a=>{this._active--,n.reject(a),this.runNext()}):(this._active--,n.resolve(i),this.runNext())}catch(i){this._active--,n.reject(i),this.runNext()}}};e.Semaphore=r}}),XDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageReader.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;var t=h2(),r=s6(),n=qw(),i=TBe(),a;(function(u){function h(f){let d=f;return d&&r.func(d.listen)&&r.func(d.dispose)&&r.func(d.onError)&&r.func(d.onClose)&&r.func(d.onPartialMessage)}_(h,"is"),u.is=h})(a||(e.MessageReader=a={}));var s=class{static{_(this,"AbstractMessageReader")}constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter,this.partialMessageEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(u){this.errorEmitter.fire(this.asError(u))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(u){this.partialMessageEmitter.fire(u)}asError(u){return u instanceof Error?u:new Error(`Reader received error. Reason: ${r.string(u.message)?u.message:"unknown"}`)}};e.AbstractMessageReader=s;var o;(function(u){function h(f){let d,p,m,g=new Map,y,v=new Map;if(f===void 0||typeof f=="string")d=f??"utf-8";else{if(d=f.charset??"utf-8",f.contentDecoder!==void 0&&(m=f.contentDecoder,g.set(m.name,m)),f.contentDecoders!==void 0)for(let x of f.contentDecoders)g.set(x.name,x);if(f.contentTypeDecoder!==void 0&&(y=f.contentTypeDecoder,v.set(y.name,y)),f.contentTypeDecoders!==void 0)for(let x of f.contentTypeDecoders)v.set(x.name,x)}return y===void 0&&(y=(0,t.default)().applicationJson.decoder,v.set(y.name,y)),{charset:d,contentDecoder:m,contentDecoders:g,contentTypeDecoder:y,contentTypeDecoders:v}}_(h,"fromOptions"),u.fromOptions=h})(o||(o={}));var l=class extends s{static{_(this,"ReadableStreamMessageReader")}constructor(u,h){super(),this.readable=u,this.options=o.fromOptions(h),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new i.Semaphore(1)}set partialMessageTimeout(u){this._partialMessageTimeout=u}get partialMessageTimeout(){return this._partialMessageTimeout}listen(u){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=u;let h=this.readable.onData(f=>{this.onData(f)});return this.readable.onError(f=>this.fireError(f)),this.readable.onClose(()=>this.fireClose()),h}onData(u){try{for(this.buffer.append(u);;){if(this.nextMessageLength===-1){let f=this.buffer.tryReadHeaders(!0);if(!f)return;let d=f.get("content-length");if(!d){this.fireError(new Error(`Header must provide a Content-Length property. +${JSON.stringify(Object.fromEntries(f))}`));return}let p=parseInt(d);if(isNaN(p)){this.fireError(new Error(`Content-Length value must be a number. Got ${d}`));return}this.nextMessageLength=p}let h=this.buffer.tryReadBody(this.nextMessageLength);if(h===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let f=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(h):h,d=await this.options.contentTypeDecoder.decode(f,this.options);this.callback(d)}).catch(f=>{this.fireError(f)})}}catch(h){this.fireError(h)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((u,h)=>{this.partialMessageTimer=void 0,u===this.messageToken&&(this.firePartialMessage({messageToken:u,waitingTime:h}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};e.ReadableStreamMessageReader=l}}),jDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var t=h2(),r=s6(),n=TBe(),i=qw(),a="Content-Length: ",s=`\r +`,o;(function(f){function d(p){let m=p;return m&&r.func(m.dispose)&&r.func(m.onClose)&&r.func(m.onError)&&r.func(m.write)}_(d,"is"),f.is=d})(o||(e.MessageWriter=o={}));var l=class{static{_(this,"AbstractMessageWriter")}constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(f,d,p){this.errorEmitter.fire([this.asError(f),d,p])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(f){return f instanceof Error?f:new Error(`Writer received error. Reason: ${r.string(f.message)?f.message:"unknown"}`)}};e.AbstractMessageWriter=l;var u;(function(f){function d(p){return p===void 0||typeof p=="string"?{charset:p??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:p.charset??"utf-8",contentEncoder:p.contentEncoder,contentTypeEncoder:p.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}_(d,"fromOptions"),f.fromOptions=d})(u||(u={}));var h=class extends l{static{_(this,"WriteableStreamMessageWriter")}constructor(f,d){super(),this.writable=f,this.options=u.fromOptions(d),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(p=>this.fireError(p)),this.writable.onClose(()=>this.fireClose())}async write(f){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(f,this.options).then(p=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(p):p).then(p=>{let m=[];return m.push(a,p.byteLength.toString(),s),m.push(s),this.doWrite(f,m,p)},p=>{throw this.fireError(p),p}))}async doWrite(f,d,p){try{return await this.writable.write(d.join(""),"ascii"),this.writable.write(p)}catch(m){return this.handleError(m,f),Promise.reject(m)}}handleError(f,d){this.errorCount++,this.fireError(f,d,this.errorCount)}end(){this.writable.end()}};e.WriteableStreamMessageWriter=h}}),KDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMessageBuffer=void 0;var t=13,r=10,n=`\r `,i=class{static{_(this,"AbstractMessageBuffer")}constructor(a="utf-8"){this._encoding=a,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(a){let s=typeof a=="string"?this.fromString(a,this._encoding):a;this._chunks.push(s),this._totalLength+=s.byteLength}tryReadHeaders(a=!1){if(this._chunks.length===0)return;let s=0,o=0,l=0,u=0;e:for(;othis._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===a){let u=this._chunks[0];return this._chunks.shift(),this._totalLength-=a,this.asNative(u)}if(this._chunks[0].byteLength>a){let u=this._chunks[0],h=this.asNative(u,a);return this._chunks[0]=u.slice(a),this._totalLength-=a,h}let s=this.allocNative(a),o=0,l=0;for(;a>0;){let u=this._chunks[l];if(u.byteLength>a){let h=u.slice(0,a);s.set(h,o),o+=a,this._chunks[l]=u.slice(a),this._totalLength-=a,a-=a}else s.set(u,o),o+=u.byteLength,this._chunks.shift(),this._totalLength-=u.byteLength,a-=u.byteLength}return s}};e.AbstractMessageBuffer=i}}),YDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;var t=h2(),r=s6(),n=vBe(),i=bBe(),a=qw(),s=TN(),o;(function(A){A.type=new n.NotificationType("$/cancelRequest")})(o||(o={}));var l;(function(A){function N(M){return typeof M=="string"||typeof M=="number"}_(N,"is"),A.is=N})(l||(e.ProgressToken=l={}));var u;(function(A){A.type=new n.NotificationType("$/progress")})(u||(u={}));var h=class{static{_(this,"ProgressType")}constructor(){}};e.ProgressType=h;var f;(function(A){function N(M){return r.func(M)}_(N,"is"),A.is=N})(f||(f={})),e.NullLogger=Object.freeze({error:_(()=>{},"error"),warn:_(()=>{},"warn"),info:_(()=>{},"info"),log:_(()=>{},"log")});var d;(function(A){A[A.Off=0]="Off",A[A.Messages=1]="Messages",A[A.Compact=2]="Compact",A[A.Verbose=3]="Verbose"})(d||(e.Trace=d={}));var p;(function(A){A.Off="off",A.Messages="messages",A.Compact="compact",A.Verbose="verbose"})(p||(e.TraceValues=p={})),(function(A){function N(D){if(!r.string(D))return A.Off;switch(D=D.toLowerCase(),D){case"off":return A.Off;case"messages":return A.Messages;case"compact":return A.Compact;case"verbose":return A.Verbose;default:return A.Off}}_(N,"fromString"),A.fromString=N;function M(D){switch(D){case A.Off:return"off";case A.Messages:return"messages";case A.Compact:return"compact";case A.Verbose:return"verbose";default:return"off"}}_(M,"toString"),A.toString=M})(d||(e.Trace=d={}));var m;(function(A){A.Text="text",A.JSON="json"})(m||(e.TraceFormat=m={})),(function(A){function N(M){return r.string(M)?(M=M.toLowerCase(),M==="json"?A.JSON:A.Text):A.Text}_(N,"fromString"),A.fromString=N})(m||(e.TraceFormat=m={}));var g;(function(A){A.type=new n.NotificationType("$/setTrace")})(g||(e.SetTraceNotification=g={}));var y;(function(A){A.type=new n.NotificationType("$/logTrace")})(y||(e.LogTraceNotification=y={}));var v;(function(A){A[A.Closed=1]="Closed",A[A.Disposed=2]="Disposed",A[A.AlreadyListening=3]="AlreadyListening"})(v||(e.ConnectionErrors=v={}));var x=class kBe extends Error{static{_(this,"ConnectionError")}constructor(N,M){super(M),this.code=N,Object.setPrototypeOf(this,kBe.prototype)}};e.ConnectionError=x;var w;(function(A){function N(M){let D=M;return D&&r.func(D.cancelUndispatched)}_(N,"is"),A.is=N})(w||(e.ConnectionStrategy=w={}));var C;(function(A){function N(M){let D=M;return D&&(D.kind===void 0||D.kind==="id")&&r.func(D.createCancellationTokenSource)&&(D.dispose===void 0||r.func(D.dispose))}_(N,"is"),A.is=N})(C||(e.IdCancellationReceiverStrategy=C={}));var T;(function(A){function N(M){let D=M;return D&&D.kind==="request"&&r.func(D.createCancellationTokenSource)&&(D.dispose===void 0||r.func(D.dispose))}_(N,"is"),A.is=N})(T||(e.RequestCancellationReceiverStrategy=T={}));var k;(function(A){A.Message=Object.freeze({createCancellationTokenSource(M){return new s.CancellationTokenSource}});function N(M){return C.is(M)||T.is(M)}_(N,"is"),A.is=N})(k||(e.CancellationReceiverStrategy=k={}));var S;(function(A){A.Message=Object.freeze({sendCancellation(M,D){return M.sendNotification(o.type,{id:D})},cleanup(M){}});function N(M){let D=M;return D&&r.func(D.sendCancellation)&&r.func(D.cleanup)}_(N,"is"),A.is=N})(S||(e.CancellationSenderStrategy=S={}));var E;(function(A){A.Message=Object.freeze({receiver:k.Message,sender:S.Message});function N(M){let D=M;return D&&k.is(D.receiver)&&S.is(D.sender)}_(N,"is"),A.is=N})(E||(e.CancellationStrategy=E={}));var I;(function(A){function N(M){let D=M;return D&&r.func(D.handleMessage)}_(N,"is"),A.is=N})(I||(e.MessageStrategy=I={}));var L;(function(A){function N(M){let D=M;return D&&(E.is(D.cancellationStrategy)||w.is(D.connectionStrategy)||I.is(D.messageStrategy))}_(N,"is"),A.is=N})(L||(e.ConnectionOptions=L={}));var O;(function(A){A[A.New=1]="New",A[A.Listening=2]="Listening",A[A.Closed=3]="Closed",A[A.Disposed=4]="Disposed"})(O||(O={}));function R(A,N,M,D){let B=M!==void 0?M:e.NullLogger,P=0,$=0,F=0,q="2.0",G,z=new Map,H,j=new Map,J=new Map,U,le=new i.LinkedMap,ee=new Map,ue=new Set,ae=new Map,oe=d.Off,Re=m.Text,Te,Oe=O.New,qe=new a.Emitter,Ge=new a.Emitter,fe=new a.Emitter,Ce=new a.Emitter,_e=new a.Emitter,de=D&&D.cancellationStrategy?D.cancellationStrategy:E.Message;function ie(Me){if(Me===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+Me.toString()}_(ie,"createRequestQueueKey");function Q(Me){return Me===null?"res-unknown-"+(++F).toString():"res-"+Me.toString()}_(Q,"createResponseQueueKey");function he(){return"not-"+(++$).toString()}_(he,"createNotificationQueueKey");function xe(Me,ut){n.Message.isRequest(ut)?Me.set(ie(ut.id),ut):n.Message.isResponse(ut)?Me.set(Q(ut.id),ut):Me.set(he(),ut)}_(xe,"addMessageToQueue");function ce(Me){}_(ce,"cancelUndispatched");function ge(){return Oe===O.Listening}_(ge,"isListening");function Ie(){return Oe===O.Closed}_(Ie,"isClosed");function ye(){return Oe===O.Disposed}_(ye,"isDisposed");function ne(){(Oe===O.New||Oe===O.Listening)&&(Oe=O.Closed,Ge.fire(void 0))}_(ne,"closeHandler");function V(Me){qe.fire([Me,void 0,void 0])}_(V,"readErrorHandler");function pe(Me){qe.fire(Me)}_(pe,"writeErrorHandler"),A.onClose(ne),A.onError(V),N.onClose(ne),N.onError(pe);function K(){U||le.size===0||(U=(0,t.default)().timer.setImmediate(()=>{U=void 0,Z()}))}_(K,"triggerMessageQueue");function ve(Me){n.Message.isRequest(Me)?Ne(Me):n.Message.isNotification(Me)?Fe(Me):n.Message.isResponse(Me)?ze(Me):Ke(Me)}_(ve,"handleMessage");function Z(){if(le.size===0)return;let Me=le.shift();try{let ut=D?.messageStrategy;I.is(ut)?ut.handleMessage(Me,ve):ve(Me)}finally{K()}}_(Z,"processMessageQueue");let je=_(Me=>{try{if(n.Message.isNotification(Me)&&Me.method===o.type.method){let ut=Me.params.id,at=ie(ut),dt=le.get(at);if(n.Message.isRequest(dt)){let Vt=D?.connectionStrategy,rr=Vt&&Vt.cancelUndispatched?Vt.cancelUndispatched(dt,ce):void 0;if(rr&&(rr.error!==void 0||rr.result!==void 0)){le.delete(at),ae.delete(ut),rr.id=dt.id,rt(rr,Me.method,Date.now()),N.write(rr).catch(()=>B.error("Sending response for canceled message failed."));return}}let tr=ae.get(ut);if(tr!==void 0){tr.cancel(),Et(Me);return}else ue.add(ut)}xe(le,Me)}finally{K()}},"callback");function Ne(Me){if(ye())return;function ut(vr,Qt,yr){let lt={jsonrpc:q,id:Me.id};vr instanceof n.ResponseError?lt.error=vr.toJson():lt.result=vr===void 0?null:vr,rt(lt,Qt,yr),N.write(lt).catch(()=>B.error("Sending response failed."))}_(ut,"reply");function at(vr,Qt,yr){let lt={jsonrpc:q,id:Me.id,error:vr.toJson()};rt(lt,Qt,yr),N.write(lt).catch(()=>B.error("Sending response failed."))}_(at,"replyError");function dt(vr,Qt,yr){vr===void 0&&(vr=null);let lt={jsonrpc:q,id:Me.id,result:vr};rt(lt,Qt,yr),N.write(lt).catch(()=>B.error("Sending response failed."))}_(dt,"replySuccess"),Se(Me);let tr=z.get(Me.method),Vt,rr;tr&&(Vt=tr.type,rr=tr.handler);let Dr=Date.now();if(rr||G){let vr=Me.id??String(Date.now()),Qt=C.is(de.receiver)?de.receiver.createCancellationTokenSource(vr):de.receiver.createCancellationTokenSource(Me);Me.id!==null&&ue.has(Me.id)&&Qt.cancel(),Me.id!==null&&ae.set(vr,Qt);try{let yr;if(rr)if(Me.params===void 0){if(Vt!==void 0&&Vt.numberOfParams!==0){at(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${Me.method} defines ${Vt.numberOfParams} params but received none.`),Me.method,Dr);return}yr=rr(Qt.token)}else if(Array.isArray(Me.params)){if(Vt!==void 0&&Vt.parameterStructures===n.ParameterStructures.byName){at(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${Me.method} defines parameters by name but received parameters by position`),Me.method,Dr);return}yr=rr(...Me.params,Qt.token)}else{if(Vt!==void 0&&Vt.parameterStructures===n.ParameterStructures.byPosition){at(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${Me.method} defines parameters by position but received parameters by name`),Me.method,Dr);return}yr=rr(Me.params,Qt.token)}else G&&(yr=G(Me.method,Me.params,Qt.token));let lt=yr;yr?lt.then?lt.then(pt=>{ae.delete(vr),ut(pt,Me.method,Dr)},pt=>{ae.delete(vr),pt instanceof n.ResponseError?at(pt,Me.method,Dr):pt&&r.string(pt.message)?at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed with message: ${pt.message}`),Me.method,Dr):at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed unexpectedly without providing any details.`),Me.method,Dr)}):(ae.delete(vr),ut(yr,Me.method,Dr)):(ae.delete(vr),dt(yr,Me.method,Dr))}catch(yr){ae.delete(vr),yr instanceof n.ResponseError?ut(yr,Me.method,Dr):yr&&r.string(yr.message)?at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed with message: ${yr.message}`),Me.method,Dr):at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed unexpectedly without providing any details.`),Me.method,Dr)}}else at(new n.ResponseError(n.ErrorCodes.MethodNotFound,`Unhandled method ${Me.method}`),Me.method,Dr)}_(Ne,"handleRequest");function ze(Me){if(!ye())if(Me.id===null)Me.error?B.error(`Received response message without id: Error is: +${m}`);let y=m.substr(0,g),v=m.substr(g+1).trim();f.set(a?y.toLowerCase():y,v)}return f}tryReadBody(a){if(!(this._totalLengththis._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===a){let u=this._chunks[0];return this._chunks.shift(),this._totalLength-=a,this.asNative(u)}if(this._chunks[0].byteLength>a){let u=this._chunks[0],h=this.asNative(u,a);return this._chunks[0]=u.slice(a),this._totalLength-=a,h}let s=this.allocNative(a),o=0,l=0;for(;a>0;){let u=this._chunks[l];if(u.byteLength>a){let h=u.slice(0,a);s.set(h,o),o+=a,this._chunks[l]=u.slice(a),this._totalLength-=a,a-=a}else s.set(u,o),o+=u.byteLength,this._chunks.shift(),this._totalLength-=u.byteLength,a-=u.byteLength}return s}};e.AbstractMessageBuffer=i}}),ZDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;var t=h2(),r=s6(),n=bBe(),i=kBe(),a=qw(),s=TN(),o;(function(A){A.type=new n.NotificationType("$/cancelRequest")})(o||(o={}));var l;(function(A){function N(M){return typeof M=="string"||typeof M=="number"}_(N,"is"),A.is=N})(l||(e.ProgressToken=l={}));var u;(function(A){A.type=new n.NotificationType("$/progress")})(u||(u={}));var h=class{static{_(this,"ProgressType")}constructor(){}};e.ProgressType=h;var f;(function(A){function N(M){return r.func(M)}_(N,"is"),A.is=N})(f||(f={})),e.NullLogger=Object.freeze({error:_(()=>{},"error"),warn:_(()=>{},"warn"),info:_(()=>{},"info"),log:_(()=>{},"log")});var d;(function(A){A[A.Off=0]="Off",A[A.Messages=1]="Messages",A[A.Compact=2]="Compact",A[A.Verbose=3]="Verbose"})(d||(e.Trace=d={}));var p;(function(A){A.Off="off",A.Messages="messages",A.Compact="compact",A.Verbose="verbose"})(p||(e.TraceValues=p={})),(function(A){function N(D){if(!r.string(D))return A.Off;switch(D=D.toLowerCase(),D){case"off":return A.Off;case"messages":return A.Messages;case"compact":return A.Compact;case"verbose":return A.Verbose;default:return A.Off}}_(N,"fromString"),A.fromString=N;function M(D){switch(D){case A.Off:return"off";case A.Messages:return"messages";case A.Compact:return"compact";case A.Verbose:return"verbose";default:return"off"}}_(M,"toString"),A.toString=M})(d||(e.Trace=d={}));var m;(function(A){A.Text="text",A.JSON="json"})(m||(e.TraceFormat=m={})),(function(A){function N(M){return r.string(M)?(M=M.toLowerCase(),M==="json"?A.JSON:A.Text):A.Text}_(N,"fromString"),A.fromString=N})(m||(e.TraceFormat=m={}));var g;(function(A){A.type=new n.NotificationType("$/setTrace")})(g||(e.SetTraceNotification=g={}));var y;(function(A){A.type=new n.NotificationType("$/logTrace")})(y||(e.LogTraceNotification=y={}));var v;(function(A){A[A.Closed=1]="Closed",A[A.Disposed=2]="Disposed",A[A.AlreadyListening=3]="AlreadyListening"})(v||(e.ConnectionErrors=v={}));var x=class CBe extends Error{static{_(this,"ConnectionError")}constructor(N,M){super(M),this.code=N,Object.setPrototypeOf(this,CBe.prototype)}};e.ConnectionError=x;var w;(function(A){function N(M){let D=M;return D&&r.func(D.cancelUndispatched)}_(N,"is"),A.is=N})(w||(e.ConnectionStrategy=w={}));var C;(function(A){function N(M){let D=M;return D&&(D.kind===void 0||D.kind==="id")&&r.func(D.createCancellationTokenSource)&&(D.dispose===void 0||r.func(D.dispose))}_(N,"is"),A.is=N})(C||(e.IdCancellationReceiverStrategy=C={}));var T;(function(A){function N(M){let D=M;return D&&D.kind==="request"&&r.func(D.createCancellationTokenSource)&&(D.dispose===void 0||r.func(D.dispose))}_(N,"is"),A.is=N})(T||(e.RequestCancellationReceiverStrategy=T={}));var k;(function(A){A.Message=Object.freeze({createCancellationTokenSource(M){return new s.CancellationTokenSource}});function N(M){return C.is(M)||T.is(M)}_(N,"is"),A.is=N})(k||(e.CancellationReceiverStrategy=k={}));var S;(function(A){A.Message=Object.freeze({sendCancellation(M,D){return M.sendNotification(o.type,{id:D})},cleanup(M){}});function N(M){let D=M;return D&&r.func(D.sendCancellation)&&r.func(D.cleanup)}_(N,"is"),A.is=N})(S||(e.CancellationSenderStrategy=S={}));var E;(function(A){A.Message=Object.freeze({receiver:k.Message,sender:S.Message});function N(M){let D=M;return D&&k.is(D.receiver)&&S.is(D.sender)}_(N,"is"),A.is=N})(E||(e.CancellationStrategy=E={}));var I;(function(A){function N(M){let D=M;return D&&r.func(D.handleMessage)}_(N,"is"),A.is=N})(I||(e.MessageStrategy=I={}));var L;(function(A){function N(M){let D=M;return D&&(E.is(D.cancellationStrategy)||w.is(D.connectionStrategy)||I.is(D.messageStrategy))}_(N,"is"),A.is=N})(L||(e.ConnectionOptions=L={}));var O;(function(A){A[A.New=1]="New",A[A.Listening=2]="Listening",A[A.Closed=3]="Closed",A[A.Disposed=4]="Disposed"})(O||(O={}));function R(A,N,M,D){let B=M!==void 0?M:e.NullLogger,P=0,$=0,F=0,q="2.0",G,z=new Map,H,j=new Map,J=new Map,U,le=new i.LinkedMap,ee=new Map,ue=new Set,ae=new Map,oe=d.Off,Re=m.Text,Te,Oe=O.New,qe=new a.Emitter,Ge=new a.Emitter,fe=new a.Emitter,Ce=new a.Emitter,_e=new a.Emitter,de=D&&D.cancellationStrategy?D.cancellationStrategy:E.Message;function ie(Me){if(Me===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+Me.toString()}_(ie,"createRequestQueueKey");function Q(Me){return Me===null?"res-unknown-"+(++F).toString():"res-"+Me.toString()}_(Q,"createResponseQueueKey");function he(){return"not-"+(++$).toString()}_(he,"createNotificationQueueKey");function xe(Me,ut){n.Message.isRequest(ut)?Me.set(ie(ut.id),ut):n.Message.isResponse(ut)?Me.set(Q(ut.id),ut):Me.set(he(),ut)}_(xe,"addMessageToQueue");function ce(Me){}_(ce,"cancelUndispatched");function ge(){return Oe===O.Listening}_(ge,"isListening");function Ie(){return Oe===O.Closed}_(Ie,"isClosed");function ye(){return Oe===O.Disposed}_(ye,"isDisposed");function ne(){(Oe===O.New||Oe===O.Listening)&&(Oe=O.Closed,Ge.fire(void 0))}_(ne,"closeHandler");function V(Me){qe.fire([Me,void 0,void 0])}_(V,"readErrorHandler");function pe(Me){qe.fire(Me)}_(pe,"writeErrorHandler"),A.onClose(ne),A.onError(V),N.onClose(ne),N.onError(pe);function K(){U||le.size===0||(U=(0,t.default)().timer.setImmediate(()=>{U=void 0,Z()}))}_(K,"triggerMessageQueue");function ve(Me){n.Message.isRequest(Me)?Ne(Me):n.Message.isNotification(Me)?Fe(Me):n.Message.isResponse(Me)?ze(Me):Ke(Me)}_(ve,"handleMessage");function Z(){if(le.size===0)return;let Me=le.shift();try{let ut=D?.messageStrategy;I.is(ut)?ut.handleMessage(Me,ve):ve(Me)}finally{K()}}_(Z,"processMessageQueue");let je=_(Me=>{try{if(n.Message.isNotification(Me)&&Me.method===o.type.method){let ut=Me.params.id,at=ie(ut),dt=le.get(at);if(n.Message.isRequest(dt)){let Vt=D?.connectionStrategy,rr=Vt&&Vt.cancelUndispatched?Vt.cancelUndispatched(dt,ce):void 0;if(rr&&(rr.error!==void 0||rr.result!==void 0)){le.delete(at),ae.delete(ut),rr.id=dt.id,rt(rr,Me.method,Date.now()),N.write(rr).catch(()=>B.error("Sending response for canceled message failed."));return}}let tr=ae.get(ut);if(tr!==void 0){tr.cancel(),Et(Me);return}else ue.add(ut)}xe(le,Me)}finally{K()}},"callback");function Ne(Me){if(ye())return;function ut(vr,Qt,yr){let lt={jsonrpc:q,id:Me.id};vr instanceof n.ResponseError?lt.error=vr.toJson():lt.result=vr===void 0?null:vr,rt(lt,Qt,yr),N.write(lt).catch(()=>B.error("Sending response failed."))}_(ut,"reply");function at(vr,Qt,yr){let lt={jsonrpc:q,id:Me.id,error:vr.toJson()};rt(lt,Qt,yr),N.write(lt).catch(()=>B.error("Sending response failed."))}_(at,"replyError");function dt(vr,Qt,yr){vr===void 0&&(vr=null);let lt={jsonrpc:q,id:Me.id,result:vr};rt(lt,Qt,yr),N.write(lt).catch(()=>B.error("Sending response failed."))}_(dt,"replySuccess"),Se(Me);let tr=z.get(Me.method),Vt,rr;tr&&(Vt=tr.type,rr=tr.handler);let Dr=Date.now();if(rr||G){let vr=Me.id??String(Date.now()),Qt=C.is(de.receiver)?de.receiver.createCancellationTokenSource(vr):de.receiver.createCancellationTokenSource(Me);Me.id!==null&&ue.has(Me.id)&&Qt.cancel(),Me.id!==null&&ae.set(vr,Qt);try{let yr;if(rr)if(Me.params===void 0){if(Vt!==void 0&&Vt.numberOfParams!==0){at(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${Me.method} defines ${Vt.numberOfParams} params but received none.`),Me.method,Dr);return}yr=rr(Qt.token)}else if(Array.isArray(Me.params)){if(Vt!==void 0&&Vt.parameterStructures===n.ParameterStructures.byName){at(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${Me.method} defines parameters by name but received parameters by position`),Me.method,Dr);return}yr=rr(...Me.params,Qt.token)}else{if(Vt!==void 0&&Vt.parameterStructures===n.ParameterStructures.byPosition){at(new n.ResponseError(n.ErrorCodes.InvalidParams,`Request ${Me.method} defines parameters by position but received parameters by name`),Me.method,Dr);return}yr=rr(Me.params,Qt.token)}else G&&(yr=G(Me.method,Me.params,Qt.token));let lt=yr;yr?lt.then?lt.then(pt=>{ae.delete(vr),ut(pt,Me.method,Dr)},pt=>{ae.delete(vr),pt instanceof n.ResponseError?at(pt,Me.method,Dr):pt&&r.string(pt.message)?at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed with message: ${pt.message}`),Me.method,Dr):at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed unexpectedly without providing any details.`),Me.method,Dr)}):(ae.delete(vr),ut(yr,Me.method,Dr)):(ae.delete(vr),dt(yr,Me.method,Dr))}catch(yr){ae.delete(vr),yr instanceof n.ResponseError?ut(yr,Me.method,Dr):yr&&r.string(yr.message)?at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed with message: ${yr.message}`),Me.method,Dr):at(new n.ResponseError(n.ErrorCodes.InternalError,`Request ${Me.method} failed unexpectedly without providing any details.`),Me.method,Dr)}}else at(new n.ResponseError(n.ErrorCodes.MethodNotFound,`Unhandled method ${Me.method}`),Me.method,Dr)}_(Ne,"handleRequest");function ze(Me){if(!ye())if(Me.id===null)Me.error?B.error(`Received response message without id: Error is: ${JSON.stringify(Me.error,void 0,4)}`):B.error("Received response message without id. No further error information provided.");else{let ut=Me.id,at=ee.get(ut);if(De(Me,at),at!==void 0){ee.delete(ut);try{if(Me.error){let dt=Me.error;at.reject(new n.ResponseError(dt.code,dt.message,dt.data))}else if(Me.result!==void 0)at.resolve(Me.result);else throw new Error("Should never happen.")}catch(dt){dt.message?B.error(`Response handler '${at.method}' failed with message: ${dt.message}`):B.error(`Response handler '${at.method}' failed unexpectedly.`)}}}}_(ze,"handleResponse");function Fe(Me){if(ye())return;let ut,at;if(Me.method===o.type.method){let dt=Me.params.id;ue.delete(dt),Et(Me);return}else{let dt=j.get(Me.method);dt&&(at=dt.handler,ut=dt.type)}if(at||H)try{if(Et(Me),at)if(Me.params===void 0)ut!==void 0&&ut.numberOfParams!==0&&ut.parameterStructures!==n.ParameterStructures.byName&&B.error(`Notification ${Me.method} defines ${ut.numberOfParams} params but received none.`),at();else if(Array.isArray(Me.params)){let dt=Me.params;Me.method===u.type.method&&dt.length===2&&l.is(dt[0])?at({token:dt[0],value:dt[1]}):(ut!==void 0&&(ut.parameterStructures===n.ParameterStructures.byName&&B.error(`Notification ${Me.method} defines parameters by name but received parameters by position`),ut.numberOfParams!==Me.params.length&&B.error(`Notification ${Me.method} defines ${ut.numberOfParams} params but received ${dt.length} arguments`)),at(...dt))}else ut!==void 0&&ut.parameterStructures===n.ParameterStructures.byPosition&&B.error(`Notification ${Me.method} defines parameters by position but received parameters by name`),at(Me.params);else H&&H(Me.method,Me.params)}catch(dt){dt.message?B.error(`Notification handler '${Me.method}' failed with message: ${dt.message}`):B.error(`Notification handler '${Me.method}' failed unexpectedly.`)}else fe.fire(Me)}_(Fe,"handleNotification");function Ke(Me){if(!Me){B.error("Received empty message.");return}B.error(`Received message which is neither a response nor a notification message: ${JSON.stringify(Me,null,4)}`);let ut=Me;if(r.string(ut.id)||r.number(ut.id)){let at=ut.id,dt=ee.get(at);dt&&dt.reject(new Error("The received response has neither a result nor an error property."))}}_(Ke,"handleInvalidMessage");function Ve(Me){if(Me!=null)switch(oe){case d.Verbose:return JSON.stringify(Me,null,4);case d.Compact:return JSON.stringify(Me);default:return}}_(Ve,"stringifyTrace");function tt(Me){if(!(oe===d.Off||!Te))if(Re===m.Text){let ut;(oe===d.Verbose||oe===d.Compact)&&Me.params&&(ut=`Params: ${Ve(Me.params)} @@ -1224,34 +1224,34 @@ ${JSON.stringify(Me,null,4)}`);let ut=Me;if(r.string(ut.id)||r.number(ut.id)){le `:Me.error===void 0&&(at=`No result returned. -`)),ut){let dt=Me.error?` Request failed: ${Me.error.message} (${Me.error.code}).`:"";Te.log(`Received response '${ut.method} - (${Me.id})' in ${Date.now()-ut.timerStart}ms.${dt}`,at)}else Te.log(`Received response ${Me.id} without active response promise.`,at)}else mt("receive-response",Me)}_(De,"traceReceivedResponse");function mt(Me,ut){if(!Te||oe===d.Off)return;let at={isLSPMessage:!0,type:Me,message:ut,timestamp:Date.now()};Te.log(at)}_(mt,"logLSPMessage");function Tt(){if(Ie())throw new x(v.Closed,"Connection is closed.");if(ye())throw new x(v.Disposed,"Connection is disposed.")}_(Tt,"throwIfClosedOrDisposed");function jt(){if(ge())throw new x(v.AlreadyListening,"Connection is already listening")}_(jt,"throwIfListening");function _t(){if(!ge())throw new Error("Call listen() first.")}_(_t,"throwIfNotListening");function Rt(Me){return Me===void 0?null:Me}_(Rt,"undefinedToNull");function bt(Me){if(Me!==null)return Me}_(bt,"nullToUndefined");function ke(Me){return Me!=null&&!Array.isArray(Me)&&typeof Me=="object"}_(ke,"isNamedParam");function yt(Me,ut){switch(Me){case n.ParameterStructures.auto:return ke(ut)?bt(ut):[Rt(ut)];case n.ParameterStructures.byName:if(!ke(ut))throw new Error("Received parameters by name but param is not an object literal.");return bt(ut);case n.ParameterStructures.byPosition:return[Rt(ut)];default:throw new Error(`Unknown parameter structure ${Me.toString()}`)}}_(yt,"computeSingleParam");function xt(Me,ut){let at,dt=Me.numberOfParams;switch(dt){case 0:at=void 0;break;case 1:at=yt(Me.parameterStructures,ut[0]);break;default:at=[];for(let tr=0;tr{Tt();let at,dt;if(r.string(Me)){at=Me;let Vt=ut[0],rr=0,Dr=n.ParameterStructures.auto;n.ParameterStructures.is(Vt)&&(rr=1,Dr=Vt);let vr=ut.length,Qt=vr-rr;switch(Qt){case 0:dt=void 0;break;case 1:dt=yt(Dr,ut[rr]);break;default:if(Dr===n.ParameterStructures.byName)throw new Error(`Received ${Qt} parameters for 'by Name' notification parameter structure.`);dt=ut.slice(rr,vr).map(yr=>Rt(yr));break}}else{let Vt=ut;at=Me.method,dt=xt(Me,Vt)}let tr={jsonrpc:q,method:at,params:dt};return We(tr),N.write(tr).catch(Vt=>{throw B.error("Sending notification failed."),Vt})},"sendNotification"),onNotification:_((Me,ut)=>{Tt();let at;return r.func(Me)?H=Me:ut&&(r.string(Me)?(at=Me,j.set(Me,{type:void 0,handler:ut})):(at=Me.method,j.set(Me.method,{type:Me,handler:ut}))),{dispose:_(()=>{at!==void 0?j.delete(at):H=void 0},"dispose")}},"onNotification"),onProgress:_((Me,ut,at)=>{if(J.has(ut))throw new Error(`Progress handler for token ${ut} already registered`);return J.set(ut,at),{dispose:_(()=>{J.delete(ut)},"dispose")}},"onProgress"),sendProgress:_((Me,ut,at)=>it.sendNotification(u.type,{token:ut,value:at}),"sendProgress"),onUnhandledProgress:Ce.event,sendRequest:_((Me,...ut)=>{Tt(),_t();let at,dt,tr;if(r.string(Me)){at=Me;let vr=ut[0],Qt=ut[ut.length-1],yr=0,lt=n.ParameterStructures.auto;n.ParameterStructures.is(vr)&&(yr=1,lt=vr);let pt=ut.length;s.CancellationToken.is(Qt)&&(pt=pt-1,tr=Qt);let St=pt-yr;switch(St){case 0:dt=void 0;break;case 1:dt=yt(lt,ut[yr]);break;default:if(lt===n.ParameterStructures.byName)throw new Error(`Received ${St} parameters for 'by Name' request parameter structure.`);dt=ut.slice(yr,pt).map(Ir=>Rt(Ir));break}}else{let vr=ut;at=Me.method,dt=xt(Me,vr);let Qt=Me.numberOfParams;tr=s.CancellationToken.is(vr[Qt])?vr[Qt]:void 0}let Vt=P++,rr;tr&&(rr=tr.onCancellationRequested(()=>{let vr=de.sender.sendCancellation(it,Vt);return vr===void 0?(B.log(`Received no promise from cancellation strategy when cancelling id ${Vt}`),Promise.resolve()):vr.catch(()=>{B.log(`Sending cancellation messages for id ${Vt} failed`)})}));let Dr={jsonrpc:q,id:Vt,method:at,params:dt};return tt(Dr),typeof de.sender.enableCancellation=="function"&&de.sender.enableCancellation(Dr),new Promise(async(vr,Qt)=>{let yr=_(St=>{vr(St),de.sender.cleanup(Vt),rr?.dispose()},"resolveWithCleanup"),lt=_(St=>{Qt(St),de.sender.cleanup(Vt),rr?.dispose()},"rejectWithCleanup"),pt={method:at,timerStart:Date.now(),resolve:yr,reject:lt};try{await N.write(Dr),ee.set(Vt,pt)}catch(St){throw B.error("Sending request failed."),pt.reject(new n.ResponseError(n.ErrorCodes.MessageWriteError,St.message?St.message:"Unknown reason")),St}})},"sendRequest"),onRequest:_((Me,ut)=>{Tt();let at=null;return f.is(Me)?(at=void 0,G=Me):r.string(Me)?(at=null,ut!==void 0&&(at=Me,z.set(Me,{handler:ut,type:void 0}))):ut!==void 0&&(at=Me.method,z.set(Me.method,{type:Me,handler:ut})),{dispose:_(()=>{at!==null&&(at!==void 0?z.delete(at):G=void 0)},"dispose")}},"onRequest"),hasPendingResponse:_(()=>ee.size>0,"hasPendingResponse"),trace:_(async(Me,ut,at)=>{let dt=!1,tr=m.Text;at!==void 0&&(r.boolean(at)?dt=at:(dt=at.sendNotification||!1,tr=at.traceFormat||m.Text)),oe=Me,Re=tr,oe===d.Off?Te=void 0:Te=ut,dt&&!Ie()&&!ye()&&await it.sendNotification(g.type,{value:d.toString(Me)})},"trace"),onError:qe.event,onClose:Ge.event,onUnhandledNotification:fe.event,onDispose:_e.event,end:_(()=>{N.end()},"end"),dispose:_(()=>{if(ye())return;Oe=O.Disposed,_e.fire(void 0);let Me=new n.ResponseError(n.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let ut of ee.values())ut.reject(Me);ee=new Map,ae=new Map,ue=new Set,le=new i.LinkedMap,r.func(N.dispose)&&N.dispose(),r.func(A.dispose)&&A.dispose()},"dispose"),listen:_(()=>{Tt(),jt(),Oe=O.Listening,A.listen(je)},"listen"),inspect:_(()=>{(0,t.default)().console.log("inspect")},"inspect")};return it.onNotification(y.type,Me=>{if(oe===d.Off||!Te)return;let ut=oe===d.Verbose||oe===d.Compact;Te.log(Me.message,ut?Me.verbose:void 0)}),it.onNotification(u.type,Me=>{let ut=J.get(Me.token);ut?ut(Me.value):Ce.fire(Me)}),it}_(R,"createMessageConnection"),e.createMessageConnection=R}}),vJ=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/api.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;var t=vBe();Object.defineProperty(e,"Message",{enumerable:!0,get:_(function(){return t.Message},"get")}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:_(function(){return t.RequestType},"get")}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:_(function(){return t.RequestType0},"get")}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:_(function(){return t.RequestType1},"get")}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:_(function(){return t.RequestType2},"get")}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:_(function(){return t.RequestType3},"get")}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:_(function(){return t.RequestType4},"get")}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:_(function(){return t.RequestType5},"get")}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:_(function(){return t.RequestType6},"get")}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:_(function(){return t.RequestType7},"get")}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:_(function(){return t.RequestType8},"get")}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:_(function(){return t.RequestType9},"get")}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:_(function(){return t.ResponseError},"get")}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:_(function(){return t.ErrorCodes},"get")}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:_(function(){return t.NotificationType},"get")}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:_(function(){return t.NotificationType0},"get")}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:_(function(){return t.NotificationType1},"get")}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:_(function(){return t.NotificationType2},"get")}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:_(function(){return t.NotificationType3},"get")}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:_(function(){return t.NotificationType4},"get")}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:_(function(){return t.NotificationType5},"get")}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:_(function(){return t.NotificationType6},"get")}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:_(function(){return t.NotificationType7},"get")}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:_(function(){return t.NotificationType8},"get")}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:_(function(){return t.NotificationType9},"get")}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:_(function(){return t.ParameterStructures},"get")});var r=bBe();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:_(function(){return r.LinkedMap},"get")}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:_(function(){return r.LRUCache},"get")}),Object.defineProperty(e,"Touch",{enumerable:!0,get:_(function(){return r.Touch},"get")});var n=qDt();Object.defineProperty(e,"Disposable",{enumerable:!0,get:_(function(){return n.Disposable},"get")});var i=qw();Object.defineProperty(e,"Event",{enumerable:!0,get:_(function(){return i.Event},"get")}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:_(function(){return i.Emitter},"get")});var a=TN();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:_(function(){return a.CancellationTokenSource},"get")}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:_(function(){return a.CancellationToken},"get")});var s=VDt();Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:_(function(){return s.SharedArraySenderStrategy},"get")}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:_(function(){return s.SharedArrayReceiverStrategy},"get")});var o=WDt();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:_(function(){return o.MessageReader},"get")}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:_(function(){return o.AbstractMessageReader},"get")}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:_(function(){return o.ReadableStreamMessageReader},"get")});var l=HDt();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:_(function(){return l.MessageWriter},"get")}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:_(function(){return l.AbstractMessageWriter},"get")}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:_(function(){return l.WriteableStreamMessageWriter},"get")});var u=UDt();Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:_(function(){return u.AbstractMessageBuffer},"get")});var h=YDt();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:_(function(){return h.ConnectionStrategy},"get")}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:_(function(){return h.ConnectionOptions},"get")}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:_(function(){return h.NullLogger},"get")}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:_(function(){return h.createMessageConnection},"get")}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:_(function(){return h.ProgressToken},"get")}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:_(function(){return h.ProgressType},"get")}),Object.defineProperty(e,"Trace",{enumerable:!0,get:_(function(){return h.Trace},"get")}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:_(function(){return h.TraceValues},"get")}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:_(function(){return h.TraceFormat},"get")}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:_(function(){return h.SetTraceNotification},"get")}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:_(function(){return h.LogTraceNotification},"get")}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:_(function(){return h.ConnectionErrors},"get")}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:_(function(){return h.ConnectionError},"get")}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:_(function(){return h.CancellationReceiverStrategy},"get")}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:_(function(){return h.CancellationSenderStrategy},"get")}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:_(function(){return h.CancellationStrategy},"get")}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:_(function(){return h.MessageStrategy},"get")});var f=h2();e.RAL=f.default}}),XDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/ril.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=vJ(),r=class TBe extends t.AbstractMessageBuffer{static{_(this,"MessageBuffer")}constructor(u="utf-8"){super(u),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return TBe.emptyBuffer}fromString(u,h){return new TextEncoder().encode(u)}toString(u,h){return h==="ascii"?this.asciiDecoder.decode(u):new TextDecoder(h).decode(u)}asNative(u,h){return h===void 0?u:u.slice(0,h)}allocNative(u){return new Uint8Array(u)}};r.emptyBuffer=new Uint8Array(0);var n=class{static{_(this,"ReadableStreamWrapper")}constructor(l){this.socket=l,this._onData=new t.Emitter,this._messageListener=u=>{u.data.arrayBuffer().then(f=>{this._onData.fire(new Uint8Array(f))},()=>{(0,t.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(l){return this.socket.addEventListener("close",l),t.Disposable.create(()=>this.socket.removeEventListener("close",l))}onError(l){return this.socket.addEventListener("error",l),t.Disposable.create(()=>this.socket.removeEventListener("error",l))}onEnd(l){return this.socket.addEventListener("end",l),t.Disposable.create(()=>this.socket.removeEventListener("end",l))}onData(l){return this._onData.event(l)}},i=class{static{_(this,"WritableStreamWrapper")}constructor(l){this.socket=l}onClose(l){return this.socket.addEventListener("close",l),t.Disposable.create(()=>this.socket.removeEventListener("close",l))}onError(l){return this.socket.addEventListener("error",l),t.Disposable.create(()=>this.socket.removeEventListener("error",l))}onEnd(l){return this.socket.addEventListener("end",l),t.Disposable.create(()=>this.socket.removeEventListener("end",l))}write(l,u){if(typeof l=="string"){if(u!==void 0&&u!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${u}`);this.socket.send(l)}else this.socket.send(l);return Promise.resolve()}end(){this.socket.close()}},a=new TextEncoder,s=Object.freeze({messageBuffer:Object.freeze({create:_(l=>new r(l),"create")}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:_((l,u)=>{if(u.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${u.charset}`);return Promise.resolve(a.encode(JSON.stringify(l,void 0,0)))},"encode")}),decoder:Object.freeze({name:"application/json",decode:_((l,u)=>{if(!(l instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(u.charset).decode(l)))},"decode")})}),stream:Object.freeze({asReadableStream:_(l=>new n(l),"asReadableStream"),asWritableStream:_(l=>new i(l),"asWritableStream")}),console,timer:Object.freeze({setTimeout(l,u,...h){let f=setTimeout(l,u,...h);return{dispose:_(()=>clearTimeout(f),"dispose")}},setImmediate(l,...u){let h=setTimeout(l,0,...u);return{dispose:_(()=>clearTimeout(h),"dispose")}},setInterval(l,u,...h){let f=setInterval(l,u,...h);return{dispose:_(()=>clearInterval(f),"dispose")}}})});function o(){return s}_(o,"RIL"),(function(l){function u(){t.RAL.install(s)}_(u,"install"),l.install=u})(o||(o={})),e.default=o}}),Vw=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/main.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(l,u,h,f){f===void 0&&(f=h);var d=Object.getOwnPropertyDescriptor(u,h);(!d||("get"in d?!u.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:_(function(){return u[h]},"get")}),Object.defineProperty(l,f,d)}):(function(l,u,h,f){f===void 0&&(f=h),l[f]=u[h]})),r=e&&e.__exportStar||function(l,u){for(var h in l)h!=="default"&&!Object.prototype.hasOwnProperty.call(u,h)&&t(u,l,h)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0;var n=XDt();n.default.install();var i=vJ();r(vJ(),e);var a=class extends i.AbstractMessageReader{static{_(this,"BrowserMessageReader")}constructor(l){super(),this._onData=new i.Emitter,this._messageListener=u=>{this._onData.fire(u.data)},l.addEventListener("error",u=>this.fireError(u)),l.onmessage=this._messageListener}listen(l){return this._onData.event(l)}};e.BrowserMessageReader=a;var s=class extends i.AbstractMessageWriter{static{_(this,"BrowserMessageWriter")}constructor(l){super(),this.port=l,this.errorCount=0,l.addEventListener("error",u=>this.fireError(u))}write(l){try{return this.port.postMessage(l),Promise.resolve()}catch(u){return this.handleError(u,l),Promise.reject(u)}}handleError(l,u){this.errorCount++,this.fireError(l,u,this.errorCount)}end(){}};e.BrowserMessageWriter=s;function o(l,u,h,f){return h===void 0&&(h=i.NullLogger),i.ConnectionStrategy.is(f)&&(f={connectionStrategy:f}),(0,i.createMessageConnection)(l,u,h,f)}_(o,"createMessageConnection"),e.createMessageConnection=o}}),SOe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/browser.js"(e,t){"use strict";t.exports=Vw()}}),xa=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/messages.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProtocolNotificationType=e.ProtocolNotificationType0=e.ProtocolRequestType=e.ProtocolRequestType0=e.RegistrationType=e.MessageDirection=void 0;var t=Vw(),r;(function(l){l.clientToServer="clientToServer",l.serverToClient="serverToClient",l.both="both"})(r||(e.MessageDirection=r={}));var n=class{static{_(this,"RegistrationType")}constructor(l){this.method=l}};e.RegistrationType=n;var i=class extends t.RequestType0{static{_(this,"ProtocolRequestType0")}constructor(l){super(l)}};e.ProtocolRequestType0=i;var a=class extends t.RequestType{static{_(this,"ProtocolRequestType")}constructor(l){super(l,t.ParameterStructures.byName)}};e.ProtocolRequestType=a;var s=class extends t.NotificationType0{static{_(this,"ProtocolNotificationType0")}constructor(l){super(l)}};e.ProtocolNotificationType0=s;var o=class extends t.NotificationType{static{_(this,"ProtocolNotificationType")}constructor(l){super(l,t.ParameterStructures.byName)}};e.ProtocolNotificationType=o}}),Jee=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.objectLiteral=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(h){return h===!0||h===!1}_(t,"boolean"),e.boolean=t;function r(h){return typeof h=="string"||h instanceof String}_(r,"string"),e.string=r;function n(h){return typeof h=="number"||h instanceof Number}_(n,"number"),e.number=n;function i(h){return h instanceof Error}_(i,"error"),e.error=i;function a(h){return typeof h=="function"}_(a,"func"),e.func=a;function s(h){return Array.isArray(h)}_(s,"array"),e.array=s;function o(h){return s(h)&&h.every(f=>r(f))}_(o,"stringArray"),e.stringArray=o;function l(h,f){return Array.isArray(h)&&h.every(f)}_(l,"typedArray"),e.typedArray=l;function u(h){return h!==null&&typeof h=="object"}_(u,"objectLiteral"),e.objectLiteral=u}}),jDt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/implementation",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.ImplementationRequest=r={}))}}),KDt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeDefinitionRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/typeDefinition",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.TypeDefinitionRequest=r={}))}}),ZDt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;var t=xa(),r;(function(i){i.method="workspace/workspaceFolders",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)})(r||(e.WorkspaceFoldersRequest=r={}));var n;(function(i){i.method="workspace/didChangeWorkspaceFolders",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolNotificationType(i.method)})(n||(e.DidChangeWorkspaceFoldersNotification=n={}))}}),QDt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigurationRequest=void 0;var t=xa(),r;(function(n){n.method="workspace/configuration",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)})(r||(e.ConfigurationRequest=r={}))}}),JDt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;var t=xa(),r;(function(i){i.method="textDocument/documentColor",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.DocumentColorRequest=r={}));var n;(function(i){i.method="textDocument/colorPresentation",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(e.ColorPresentationRequest=n={}))}}),eOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=void 0;var t=xa(),r;(function(i){i.method="textDocument/foldingRange",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.FoldingRangeRequest=r={}));var n;(function(i){i.method="workspace/foldingRange/refresh",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)})(n||(e.FoldingRangeRefreshRequest=n={}))}}),tOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DeclarationRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/declaration",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.DeclarationRequest=r={}))}}),rOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionRangeRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/selectionRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.SelectionRangeRequest=r={}))}}),nOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;var t=Vw(),r=xa(),n;(function(s){s.type=new t.ProgressType;function o(l){return l===s.type}_(o,"is"),s.is=o})(n||(e.WorkDoneProgress=n={}));var i;(function(s){s.method="window/workDoneProgress/create",s.messageDirection=r.MessageDirection.serverToClient,s.type=new r.ProtocolRequestType(s.method)})(i||(e.WorkDoneProgressCreateRequest=i={}));var a;(function(s){s.method="window/workDoneProgress/cancel",s.messageDirection=r.MessageDirection.clientToServer,s.type=new r.ProtocolNotificationType(s.method)})(a||(e.WorkDoneProgressCancelNotification=a={}))}}),iOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;var t=xa(),r;(function(a){a.method="textDocument/prepareCallHierarchy",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.CallHierarchyPrepareRequest=r={}));var n;(function(a){a.method="callHierarchy/incomingCalls",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.CallHierarchyIncomingCallsRequest=n={}));var i;(function(a){a.method="callHierarchy/outgoingCalls",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.CallHierarchyOutgoingCallsRequest=i={}))}}),aOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;var t=xa(),r;(function(l){l.Relative="relative"})(r||(e.TokenFormat=r={}));var n;(function(l){l.method="textDocument/semanticTokens",l.type=new t.RegistrationType(l.method)})(n||(e.SemanticTokensRegistrationType=n={}));var i;(function(l){l.method="textDocument/semanticTokens/full",l.messageDirection=t.MessageDirection.clientToServer,l.type=new t.ProtocolRequestType(l.method),l.registrationMethod=n.method})(i||(e.SemanticTokensRequest=i={}));var a;(function(l){l.method="textDocument/semanticTokens/full/delta",l.messageDirection=t.MessageDirection.clientToServer,l.type=new t.ProtocolRequestType(l.method),l.registrationMethod=n.method})(a||(e.SemanticTokensDeltaRequest=a={}));var s;(function(l){l.method="textDocument/semanticTokens/range",l.messageDirection=t.MessageDirection.clientToServer,l.type=new t.ProtocolRequestType(l.method),l.registrationMethod=n.method})(s||(e.SemanticTokensRangeRequest=s={}));var o;(function(l){l.method="workspace/semanticTokens/refresh",l.messageDirection=t.MessageDirection.serverToClient,l.type=new t.ProtocolRequestType0(l.method)})(o||(e.SemanticTokensRefreshRequest=o={}))}}),sOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShowDocumentRequest=void 0;var t=xa(),r;(function(n){n.method="window/showDocument",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)})(r||(e.ShowDocumentRequest=r={}))}}),oOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedEditingRangeRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/linkedEditingRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.LinkedEditingRangeRequest=r={}))}}),lOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.DidRenameFilesNotification=e.WillRenameFilesRequest=e.DidCreateFilesNotification=e.WillCreateFilesRequest=e.FileOperationPatternKind=void 0;var t=xa(),r;(function(u){u.file="file",u.folder="folder"})(r||(e.FileOperationPatternKind=r={}));var n;(function(u){u.method="workspace/willCreateFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(n||(e.WillCreateFilesRequest=n={}));var i;(function(u){u.method="workspace/didCreateFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(i||(e.DidCreateFilesNotification=i={}));var a;(function(u){u.method="workspace/willRenameFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(a||(e.WillRenameFilesRequest=a={}));var s;(function(u){u.method="workspace/didRenameFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(s||(e.DidRenameFilesNotification=s={}));var o;(function(u){u.method="workspace/didDeleteFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(o||(e.DidDeleteFilesNotification=o={}));var l;(function(u){u.method="workspace/willDeleteFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(l||(e.WillDeleteFilesRequest=l={}))}}),cOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;var t=xa(),r;(function(a){a.document="document",a.project="project",a.group="group",a.scheme="scheme",a.global="global"})(r||(e.UniquenessLevel=r={}));var n;(function(a){a.$import="import",a.$export="export",a.local="local"})(n||(e.MonikerKind=n={}));var i;(function(a){a.method="textDocument/moniker",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.MonikerRequest=i={}))}}),uOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;var t=xa(),r;(function(a){a.method="textDocument/prepareTypeHierarchy",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.TypeHierarchyPrepareRequest=r={}));var n;(function(a){a.method="typeHierarchy/supertypes",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.TypeHierarchySupertypesRequest=n={}));var i;(function(a){a.method="typeHierarchy/subtypes",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.TypeHierarchySubtypesRequest=i={}))}}),hOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;var t=xa(),r;(function(i){i.method="textDocument/inlineValue",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.InlineValueRequest=r={}));var n;(function(i){i.method="workspace/inlineValue/refresh",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)})(n||(e.InlineValueRefreshRequest=n={}))}}),fOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;var t=xa(),r;(function(a){a.method="textDocument/inlayHint",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.InlayHintRequest=r={}));var n;(function(a){a.method="inlayHint/resolve",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.InlayHintResolveRequest=n={}));var i;(function(a){a.method="workspace/inlayHint/refresh",a.messageDirection=t.MessageDirection.serverToClient,a.type=new t.ProtocolRequestType0(a.method)})(i||(e.InlayHintRefreshRequest=i={}))}}),dOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;var t=Vw(),r=Jee(),n=xa(),i;(function(u){function h(f){let d=f;return d&&r.boolean(d.retriggerRequest)}_(h,"is"),u.is=h})(i||(e.DiagnosticServerCancellationData=i={}));var a;(function(u){u.Full="full",u.Unchanged="unchanged"})(a||(e.DocumentDiagnosticReportKind=a={}));var s;(function(u){u.method="textDocument/diagnostic",u.messageDirection=n.MessageDirection.clientToServer,u.type=new n.ProtocolRequestType(u.method),u.partialResult=new t.ProgressType})(s||(e.DocumentDiagnosticRequest=s={}));var o;(function(u){u.method="workspace/diagnostic",u.messageDirection=n.MessageDirection.clientToServer,u.type=new n.ProtocolRequestType(u.method),u.partialResult=new t.ProgressType})(o||(e.WorkspaceDiagnosticRequest=o={}));var l;(function(u){u.method="workspace/diagnostic/refresh",u.messageDirection=n.MessageDirection.serverToClient,u.type=new n.ProtocolRequestType0(u.method)})(l||(e.DiagnosticRefreshRequest=l={}))}}),pOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=void 0;var t=(a6(),Qee(kN)),r=Jee(),n=xa(),i;(function(m){m.Markup=1,m.Code=2;function g(y){return y===1||y===2}_(g,"is"),m.is=g})(i||(e.NotebookCellKind=i={}));var a;(function(m){function g(x,w){let C={executionOrder:x};return(w===!0||w===!1)&&(C.success=w),C}_(g,"create"),m.create=g;function y(x){let w=x;return r.objectLiteral(w)&&t.uinteger.is(w.executionOrder)&&(w.success===void 0||r.boolean(w.success))}_(y,"is"),m.is=y;function v(x,w){return x===w?!0:x==null||w===null||w===void 0?!1:x.executionOrder===w.executionOrder&&x.success===w.success}_(v,"equals"),m.equals=v})(a||(e.ExecutionSummary=a={}));var s;(function(m){function g(w,C){return{kind:w,document:C}}_(g,"create"),m.create=g;function y(w){let C=w;return r.objectLiteral(C)&&i.is(C.kind)&&t.DocumentUri.is(C.document)&&(C.metadata===void 0||r.objectLiteral(C.metadata))}_(y,"is"),m.is=y;function v(w,C){let T=new Set;return w.document!==C.document&&T.add("document"),w.kind!==C.kind&&T.add("kind"),w.executionSummary!==C.executionSummary&&T.add("executionSummary"),(w.metadata!==void 0||C.metadata!==void 0)&&!x(w.metadata,C.metadata)&&T.add("metadata"),(w.executionSummary!==void 0||C.executionSummary!==void 0)&&!a.equals(w.executionSummary,C.executionSummary)&&T.add("executionSummary"),T}_(v,"diff"),m.diff=v;function x(w,C){if(w===C)return!0;if(w==null||C===null||C===void 0||typeof w!=typeof C||typeof w!="object")return!1;let T=Array.isArray(w),k=Array.isArray(C);if(T!==k)return!1;if(T&&k){if(w.length!==C.length)return!1;for(let S=0;S0}_(yt,"hasId"),ke.hasId=yt})(P||(e.StaticRegistrationOptions=P={}));var $;(function(ke){function yt(xt){let it=xt;return it&&(it.documentSelector===null||R.is(it.documentSelector))}_(yt,"is"),ke.is=yt})($||(e.TextDocumentRegistrationOptions=$={}));var F;(function(ke){function yt(it){let Me=it;return n.objectLiteral(Me)&&(Me.workDoneProgress===void 0||n.boolean(Me.workDoneProgress))}_(yt,"is"),ke.is=yt;function xt(it){let Me=it;return Me&&n.boolean(Me.workDoneProgress)}_(xt,"hasWorkDoneProgress"),ke.hasWorkDoneProgress=xt})(F||(e.WorkDoneProgressOptions=F={}));var q;(function(ke){ke.method="initialize",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(q||(e.InitializeRequest=q={}));var G;(function(ke){ke.unknownProtocolVersion=1})(G||(e.InitializeErrorCodes=G={}));var z;(function(ke){ke.method="initialized",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(z||(e.InitializedNotification=z={}));var H;(function(ke){ke.method="shutdown",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType0(ke.method)})(H||(e.ShutdownRequest=H={}));var j;(function(ke){ke.method="exit",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType0(ke.method)})(j||(e.ExitNotification=j={}));var J;(function(ke){ke.method="workspace/didChangeConfiguration",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(J||(e.DidChangeConfigurationNotification=J={}));var U;(function(ke){ke.Error=1,ke.Warning=2,ke.Info=3,ke.Log=4,ke.Debug=5})(U||(e.MessageType=U={}));var le;(function(ke){ke.method="window/showMessage",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(le||(e.ShowMessageNotification=le={}));var ee;(function(ke){ke.method="window/showMessageRequest",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolRequestType(ke.method)})(ee||(e.ShowMessageRequest=ee={}));var ue;(function(ke){ke.method="window/logMessage",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(ue||(e.LogMessageNotification=ue={}));var ae;(function(ke){ke.method="telemetry/event",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(ae||(e.TelemetryEventNotification=ae={}));var oe;(function(ke){ke.None=0,ke.Full=1,ke.Incremental=2})(oe||(e.TextDocumentSyncKind=oe={}));var Re;(function(ke){ke.method="textDocument/didOpen",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Re||(e.DidOpenTextDocumentNotification=Re={}));var Te;(function(ke){function yt(it){let Me=it;return Me!=null&&typeof Me.text=="string"&&Me.range!==void 0&&(Me.rangeLength===void 0||typeof Me.rangeLength=="number")}_(yt,"isIncremental"),ke.isIncremental=yt;function xt(it){let Me=it;return Me!=null&&typeof Me.text=="string"&&Me.range===void 0&&Me.rangeLength===void 0}_(xt,"isFull"),ke.isFull=xt})(Te||(e.TextDocumentContentChangeEvent=Te={}));var Oe;(function(ke){ke.method="textDocument/didChange",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Oe||(e.DidChangeTextDocumentNotification=Oe={}));var qe;(function(ke){ke.method="textDocument/didClose",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(qe||(e.DidCloseTextDocumentNotification=qe={}));var Ge;(function(ke){ke.method="textDocument/didSave",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Ge||(e.DidSaveTextDocumentNotification=Ge={}));var fe;(function(ke){ke.Manual=1,ke.AfterDelay=2,ke.FocusOut=3})(fe||(e.TextDocumentSaveReason=fe={}));var Ce;(function(ke){ke.method="textDocument/willSave",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Ce||(e.WillSaveTextDocumentNotification=Ce={}));var _e;(function(ke){ke.method="textDocument/willSaveWaitUntil",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(_e||(e.WillSaveTextDocumentWaitUntilRequest=_e={}));var de;(function(ke){ke.method="workspace/didChangeWatchedFiles",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(de||(e.DidChangeWatchedFilesNotification=de={}));var ie;(function(ke){ke.Created=1,ke.Changed=2,ke.Deleted=3})(ie||(e.FileChangeType=ie={}));var Q;(function(ke){function yt(xt){let it=xt;return n.objectLiteral(it)&&(r.URI.is(it.baseUri)||r.WorkspaceFolder.is(it.baseUri))&&n.string(it.pattern)}_(yt,"is"),ke.is=yt})(Q||(e.RelativePattern=Q={}));var he;(function(ke){ke.Create=1,ke.Change=2,ke.Delete=4})(he||(e.WatchKind=he={}));var xe;(function(ke){ke.method="textDocument/publishDiagnostics",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(xe||(e.PublishDiagnosticsNotification=xe={}));var ce;(function(ke){ke.Invoked=1,ke.TriggerCharacter=2,ke.TriggerForIncompleteCompletions=3})(ce||(e.CompletionTriggerKind=ce={}));var ge;(function(ke){ke.method="textDocument/completion",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ge||(e.CompletionRequest=ge={}));var Ie;(function(ke){ke.method="completionItem/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ie||(e.CompletionResolveRequest=Ie={}));var ye;(function(ke){ke.method="textDocument/hover",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ye||(e.HoverRequest=ye={}));var ne;(function(ke){ke.Invoked=1,ke.TriggerCharacter=2,ke.ContentChange=3})(ne||(e.SignatureHelpTriggerKind=ne={}));var V;(function(ke){ke.method="textDocument/signatureHelp",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(V||(e.SignatureHelpRequest=V={}));var pe;(function(ke){ke.method="textDocument/definition",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(pe||(e.DefinitionRequest=pe={}));var K;(function(ke){ke.method="textDocument/references",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(K||(e.ReferencesRequest=K={}));var ve;(function(ke){ke.method="textDocument/documentHighlight",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ve||(e.DocumentHighlightRequest=ve={}));var Z;(function(ke){ke.method="textDocument/documentSymbol",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Z||(e.DocumentSymbolRequest=Z={}));var je;(function(ke){ke.method="textDocument/codeAction",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(je||(e.CodeActionRequest=je={}));var Ne;(function(ke){ke.method="codeAction/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ne||(e.CodeActionResolveRequest=Ne={}));var ze;(function(ke){ke.method="workspace/symbol",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ze||(e.WorkspaceSymbolRequest=ze={}));var Fe;(function(ke){ke.method="workspaceSymbol/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Fe||(e.WorkspaceSymbolResolveRequest=Fe={}));var Ke;(function(ke){ke.method="textDocument/codeLens",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ke||(e.CodeLensRequest=Ke={}));var Ve;(function(ke){ke.method="codeLens/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ve||(e.CodeLensResolveRequest=Ve={}));var tt;(function(ke){ke.method="workspace/codeLens/refresh",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolRequestType0(ke.method)})(tt||(e.CodeLensRefreshRequest=tt={}));var We;(function(ke){ke.method="textDocument/documentLink",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(We||(e.DocumentLinkRequest=We={}));var rt;(function(ke){ke.method="documentLink/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(rt||(e.DocumentLinkResolveRequest=rt={}));var Se;(function(ke){ke.method="textDocument/formatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Se||(e.DocumentFormattingRequest=Se={}));var Et;(function(ke){ke.method="textDocument/rangeFormatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Et||(e.DocumentRangeFormattingRequest=Et={}));var De;(function(ke){ke.method="textDocument/rangesFormatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(De||(e.DocumentRangesFormattingRequest=De={}));var mt;(function(ke){ke.method="textDocument/onTypeFormatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(mt||(e.DocumentOnTypeFormattingRequest=mt={}));var Tt;(function(ke){ke.Identifier=1})(Tt||(e.PrepareSupportDefaultBehavior=Tt={}));var jt;(function(ke){ke.method="textDocument/rename",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(jt||(e.RenameRequest=jt={}));var _t;(function(ke){ke.method="textDocument/prepareRename",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(_t||(e.PrepareRenameRequest=_t={}));var Rt;(function(ke){ke.method="workspace/executeCommand",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Rt||(e.ExecuteCommandRequest=Rt={}));var bt;(function(ke){ke.method="workspace/applyEdit",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolRequestType("workspace/applyEdit")})(bt||(e.ApplyWorkspaceEditRequest=bt={}))}}),yOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/connection.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var t=Vw();function r(n,i,a,s){return t.ConnectionStrategy.is(s)&&(s={connectionStrategy:s}),(0,t.createMessageConnection)(n,i,a,s)}_(r,"createProtocolConnection"),e.createProtocolConnection=r}}),vOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/api.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(a,s,o,l){l===void 0&&(l=o);var u=Object.getOwnPropertyDescriptor(s,o);(!u||("get"in u?!s.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:_(function(){return s[o]},"get")}),Object.defineProperty(a,l,u)}):(function(a,s,o,l){l===void 0&&(l=o),a[l]=s[o]})),r=e&&e.__exportStar||function(a,s){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,r(Vw(),e),r((a6(),Qee(kN)),e),r(xa(),e),r(gOt(),e);var n=yOt();Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:_(function(){return n.createProtocolConnection},"get")});var i;(function(a){a.lspReservedErrorRangeStart=-32899,a.RequestFailed=-32803,a.ServerCancelled=-32802,a.ContentModified=-32801,a.RequestCancelled=-32800,a.lspReservedErrorRangeEnd=-32800})(i||(e.LSPErrorCodes=i={}))}}),xOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/browser/main.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(a,s,o,l){l===void 0&&(l=o);var u=Object.getOwnPropertyDescriptor(s,o);(!u||("get"in u?!s.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:_(function(){return s[o]},"get")}),Object.defineProperty(a,l,u)}):(function(a,s,o,l){l===void 0&&(l=o),a[l]=s[o]})),r=e&&e.__exportStar||function(a,s){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var n=SOe();r(SOe(),e),r(vOt(),e);function i(a,s,o,l){return(0,n.createMessageConnection)(a,s,o,l)}_(i,"createProtocolConnection"),e.createProtocolConnection=i}}),CBe={};Hg(CBe,{AbstractAstReflection:()=>rte,AbstractCstNode:()=>ine,AbstractLangiumParser:()=>sne,AbstractParserErrorMessageProvider:()=>fYe,AbstractThreadedAsyncParser:()=>XUt,AstUtils:()=>nte,BiMap:()=>gN,Cancellation:()=>Gi,CompositeCstNodeImpl:()=>xD,ContextCache:()=>ED,CstNodeBuilder:()=>lYe,CstUtils:()=>ete,DEFAULT_TOKENIZE_OPTIONS:()=>Cne,DONE_RESULT:()=>El,DatatypeSymbol:()=>fN,DefaultAstNodeDescriptionProvider:()=>qYe,DefaultAstNodeLocator:()=>WYe,DefaultAsyncParser:()=>lXe,DefaultCommentProvider:()=>oXe,DefaultConfigurationProvider:()=>HYe,DefaultDocumentBuilder:()=>UYe,DefaultDocumentValidator:()=>GYe,DefaultHydrator:()=>uXe,DefaultIndexManager:()=>YYe,DefaultJsonSerializer:()=>BYe,DefaultLangiumDocumentFactory:()=>_Ye,DefaultLangiumDocuments:()=>RYe,DefaultLangiumProfiler:()=>JUt,DefaultLexer:()=>Sne,DefaultLexerErrorMessageProvider:()=>jYe,DefaultLinker:()=>LYe,DefaultNameProvider:()=>IYe,DefaultReferenceDescriptionProvider:()=>VYe,DefaultReferences:()=>MYe,DefaultScopeComputation:()=>NYe,DefaultScopeProvider:()=>PYe,DefaultServiceRegistry:()=>FYe,DefaultTokenBuilder:()=>kD,DefaultValueConverter:()=>dne,DefaultWorkspaceLock:()=>cXe,DefaultWorkspaceManager:()=>XYe,Deferred:()=>ap,Disposable:()=>s2,DisposableCache:()=>SD,DocumentCache:()=>OYe,DocumentState:()=>Ln,DocumentValidator:()=>Gu,EMPTY_SCOPE:()=>WUt,EMPTY_STREAM:()=>Iw,EmptyFileSystem:()=>ti,EmptyFileSystemProvider:()=>dXe,ErrorWithLocation:()=>MN,GrammarAST:()=>ABe,GrammarUtils:()=>Nte,IndentationAwareLexer:()=>KUt,IndentationAwareTokenBuilder:()=>fXe,JSDocDocumentationProvider:()=>sXe,LangiumCompletionParser:()=>dYe,LangiumParser:()=>hYe,LangiumParserErrorMessageProvider:()=>one,LeafCstNodeImpl:()=>hN,LexingMode:()=>i2,MapScope:()=>VUt,Module:()=>JJ,MultiMap:()=>sp,MultiMapScope:()=>DYe,OperationCancelled:()=>pd,ParserWorker:()=>jUt,ProfilingTask:()=>mXe,Reduction:()=>qS,RefResolving:()=>Rv,RegExpUtils:()=>Ote,RootCstNodeImpl:()=>ane,SimpleCache:()=>xne,StreamImpl:()=>dd,StreamScope:()=>jJ,TextDocument:()=>pN,TreeStreamImpl:()=>Mw,URI:()=>Xc,UriTrie:()=>yne,UriUtils:()=>_l,VALIDATE_EACH_NODE:()=>zYe,ValidationCategory:()=>yN,ValidationRegistry:()=>$Ye,ValueConverter:()=>hd,WorkspaceCache:()=>bne,assertCondition:()=>Dte,assertUnreachable:()=>Ug,createCompletionParser:()=>une,createDefaultCoreModule:()=>Yn,createDefaultSharedCoreModule:()=>Xn,createGrammarConfig:()=>Jte,createLangiumParser:()=>hne,createParser:()=>bD,delayNextTick:()=>TD,diagnosticData:()=>n2,eagerLoad:()=>Mne,getDiagnosticRange:()=>kne,indentationBuilderDefaultOptions:()=>tee,inject:()=>an,interruptAndCheck:()=>Us,isAstNode:()=>ls,isAstNodeDescription:()=>tte,isAstNodeWithComment:()=>wne,isCompositeCstNode:()=>Z0,isIMultiModeLexerDefinition:()=>RD,isJSDoc:()=>Ane,isLeafCstNode:()=>f2,isLinkingError:()=>Dv,isMultiReference:()=>md,isNamed:()=>vne,isOperationCancelled:()=>I2,isReference:()=>Al,isRootCstNode:()=>CN,isTokenTypeArray:()=>_D,isTokenTypeDictionary:()=>vN,loadGrammarFromJson:()=>Ys,parseJSDoc:()=>Ene,prepareLangiumParser:()=>fne,setInterruptionPeriod:()=>pne,startCancelableOperation:()=>CD,stream:()=>ki,toDiagnosticData:()=>Tne,toDiagnosticSeverity:()=>BS});ete={};Hg(ete,{DefaultNameRegexp:()=>_te,RangeComparison:()=>fd,compareRange:()=>Ete,findCommentNode:()=>Rte,findDeclarationNodeAtOffset:()=>UBe,findLeafNodeAtOffset:()=>IN,findLeafNodeBeforeOffset:()=>Lte,flattenCst:()=>HBe,getDatatypeNode:()=>WBe,getInteriorNodes:()=>jBe,getNextNode:()=>YBe,getPreviousNode:()=>Mte,getStartlineNode:()=>XBe,inRange:()=>Ate,isChildNode:()=>Ste,isCommentNode:()=>jM,streamCst:()=>Pw,toDocumentSegment:()=>Bw,tokenToRange:()=>VS});_(ls,"isAstNode");_(Al,"isReference");_(md,"isMultiReference");_(tte,"isAstNodeDescription");_(Dv,"isLinkingError");rte=class{static{_(this,"AbstractAstReflection")}constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){let t=this.types[e.container.$type];if(!t)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);let r=t.properties[e.property]?.referenceType;if(!r)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return r}getTypeMetaData(e){let t=this.types[e];return t||{name:e,properties:{},superTypes:[]}}isInstance(e,t){return ls(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});let n=r[t];if(n!==void 0)return n;{let i=this.types[e],a=i?i.superTypes.some(s=>this.isSubtype(s,t)):!1;return r[t]=a,a}}getAllSubTypes(e){let t=this.allSubtypes[e];if(t)return t;{let r=this.getAllTypes(),n=[];for(let i of r)this.isSubtype(i,e)&&n.push(i);return this.allSubtypes[e]=n,n}}};_(Z0,"isCompositeCstNode");_(f2,"isLeafCstNode");_(CN,"isRootCstNode");dd=class U0{static{_(this,"StreamImpl")}constructor(t,r){this.startFn=t,this.nextFn=r}iterator(){let t={state:this.startFn(),next:_(()=>this.nextFn(t.state),"next"),[Symbol.iterator]:()=>t};return t}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let t=this.iterator(),r=0,n=t.next();for(;!n.done;)r++,n=t.next();return r}toArray(){let t=[],r=this.iterator(),n;do n=r.next(),n.value!==void 0&&t.push(n.value);while(!n.done);return t}toSet(){return new Set(this)}toMap(t,r){let n=this.map(i=>[t?t(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(t){return new U0(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),r=>{let n;if(!r.firstDone){do if(n=this.nextFn(r.first),!n.done)return n;while(!n.done);r.firstDone=!0}do if(n=r.iterator.next(),!n.done)return n;while(!n.done);return El})}join(t=","){let r=this.iterator(),n="",i,a=!1;do i=r.next(),i.done||(a&&(n+=t),n+=SBe(i.value)),a=!0;while(!i.done);return n}indexOf(t,r=0){let n=this.iterator(),i=0,a=n.next();for(;!a.done;){if(i>=r&&a.value===t)return i;a=n.next(),i++}return-1}every(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(!t(n.value))return!1;n=r.next()}return!0}some(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(t(n.value))return!0;n=r.next()}return!1}forEach(t){let r=this.iterator(),n=0,i=r.next();for(;!i.done;)t(i.value,n),i=r.next(),n++}map(t){return new U0(this.startFn,r=>{let{done:n,value:i}=this.nextFn(r);return n?El:{done:!1,value:t(i)}})}filter(t){return new U0(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&t(n.value))return n;while(!n.done);return El})}nonNullable(){return this.filter(t=>t!=null)}reduce(t,r){let n=this.iterator(),i=r,a=n.next();for(;!a.done;)i===void 0?i=a.value:i=t(i,a.value),a=n.next();return i}reduceRight(t,r){return this.recursiveReduce(this.iterator(),t,r)}recursiveReduce(t,r,n){let i=t.next();if(i.done)return n;let a=this.recursiveReduce(t,r,n);return a===void 0?i.value:r(a,i.value)}find(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(t(n.value))return n.value;n=r.next()}}findIndex(t){let r=this.iterator(),n=0,i=r.next();for(;!i.done;){if(t(i.value))return n;i=r.next(),n++}return-1}includes(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(n.value===t)return!0;n=r.next()}return!1}flatMap(t){return new U0(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}let{done:n,value:i}=this.nextFn(r.this);if(!n){let a=t(i);if(GS(a))r.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}}while(r.iterator);return El})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let r=t>1?this.flat(t-1):this;return new U0(()=>({this:r.startFn()}),n=>{do{if(n.iterator){let s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}let{done:i,value:a}=r.nextFn(n.this);if(!i)if(GS(a))n.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}while(n.iterator);return El})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(t=1){return new U0(()=>{let r=this.startFn();for(let n=0;n({size:0,state:this.startFn()}),r=>(r.size++,r.size>t?El:this.nextFn(r.state)))}distinct(t){return new U0(()=>({set:new Set,internalState:this.startFn()}),r=>{let n;do if(n=this.nextFn(r.internalState),!n.done){let i=t?t(n.value):n.value;if(!r.set.has(i))return r.set.add(i),n}while(!n.done);return El})}exclude(t,r){let n=new Set;for(let i of t){let a=r?r(i):i;n.add(a)}return this.filter(i=>{let a=r?r(i):i;return!n.has(a)})}};_(SBe,"toString");_(GS,"isIterable");Iw=new dd(()=>{},()=>El),El=Object.freeze({done:!0,value:void 0});_(ki,"stream");Mw=class extends dd{static{_(this,"TreeStreamImpl")}constructor(e,t,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),n=>{for(n.pruned&&(n.iterators.pop(),n.pruned=!1);n.iterators.length>0;){let a=n.iterators[n.iterators.length-1].next();if(a.done)n.iterators.pop();else return n.iterators.push(t(a.value)[Symbol.iterator]()),a}return El})}iterator(){let e={state:this.startFn(),next:_(()=>this.nextFn(e.state),"next"),prune:_(()=>{e.state.pruned=!0},"prune"),[Symbol.iterator]:()=>e};return e}};(function(e){function t(a){return a.reduce((s,o)=>s+o,0)}_(t,"sum"),e.sum=t;function r(a){return a.reduce((s,o)=>s*o,0)}_(r,"product"),e.product=r;function n(a){return a.reduce((s,o)=>Math.min(s,o))}_(n,"min"),e.min=n;function i(a){return a.reduce((s,o)=>Math.max(s,o))}_(i,"max"),e.max=i})(qS||(qS={}));nte={};Hg(nte,{assignMandatoryProperties:()=>ite,copyAstNode:()=>OM,findRootNode:()=>Aw,getContainerOfType:()=>d2,getDocument:()=>Mh,getReferenceNodes:()=>NM,hasContainerOfType:()=>EBe,linkContentToContainer:()=>Nw,streamAllContents:()=>op,streamAst:()=>Nh,streamContents:()=>o6,streamReferences:()=>Dw});_(Nw,"linkContentToContainer");_(d2,"getContainerOfType");_(EBe,"hasContainerOfType");_(Mh,"getDocument");_(Aw,"findRootNode");_(NM,"getReferenceNodes");_(o6,"streamContents");_(op,"streamAllContents");_(Nh,"streamAst");_(DM,"isAstNodeInRange");_(Dw,"streamReferences");_(ite,"assignMandatoryProperties");_(ate,"copyDefaultValue");_(OM,"copyAstNode");ABe={};Hg(ABe,{AbstractElement:()=>lc,AbstractParserRule:()=>TS,AbstractRule:()=>yw,AbstractType:()=>Yc,Action:()=>Mg,Alternatives:()=>CS,ArrayLiteral:()=>PM,ArrayType:()=>BM,Assignment:()=>Ng,BooleanLiteral:()=>FM,CharacterRange:()=>Dg,Condition:()=>Og,Conjunction:()=>SS,CrossReference:()=>Pg,Disjunction:()=>ES,EndOfFile:()=>$M,Grammar:()=>X0,GrammarImport:()=>zM,Group:()=>Ov,InferredType:()=>GM,InfixRule:()=>ud,InfixRuleOperatorList:()=>AS,InfixRuleOperators:()=>qM,Interface:()=>vw,Keyword:()=>xw,LangiumGrammarAstReflection:()=>Cte,LangiumGrammarTerminals:()=>bOt,NamedArgument:()=>bw,NegatedToken:()=>Pv,Negation:()=>VM,NumberLiteral:()=>WM,Parameter:()=>ww,ParameterReference:()=>HM,ParserRule:()=>_h,ReferenceType:()=>_S,RegexToken:()=>Bv,ReturnType:()=>UM,RuleCall:()=>Fv,SimpleType:()=>kw,StringLiteral:()=>YM,TerminalAlternatives:()=>$v,TerminalElement:()=>cc,TerminalGroup:()=>zv,TerminalRule:()=>j0,TerminalRuleCall:()=>Gv,Type:()=>RS,TypeAttribute:()=>qv,TypeDefinition:()=>Vv,UnionType:()=>XM,UnorderedGroup:()=>LS,UntilToken:()=>Wv,ValueLiteral:()=>Hv,Wildcard:()=>Tw,isAbstractElement:()=>SN,isAbstractParserRule:()=>p2,isAbstractRule:()=>_Be,isAbstractType:()=>RBe,isAction:()=>zg,isAlternatives:()=>EN,isArrayLiteral:()=>LBe,isArrayType:()=>ste,isAssignment:()=>Q0,isBooleanLiteral:()=>ote,isCharacterRange:()=>lte,isCondition:()=>IBe,isConjunction:()=>cte,isCrossReference:()=>m2,isDisjunction:()=>ute,isEndOfFile:()=>hte,isGrammar:()=>MBe,isGrammarImport:()=>NBe,isGroup:()=>g2,isInferredType:()=>l6,isInfixRule:()=>Ow,isInfixRuleOperatorList:()=>DBe,isInfixRuleOperators:()=>OBe,isInterface:()=>fte,isKeyword:()=>J0,isNamedArgument:()=>PBe,isNegatedToken:()=>dte,isNegation:()=>pte,isNumberLiteral:()=>BBe,isParameter:()=>FBe,isParameterReference:()=>mte,isParserRule:()=>Ll,isReferenceType:()=>gte,isRegexToken:()=>yte,isReturnType:()=>vte,isRuleCall:()=>ep,isSimpleType:()=>AN,isStringLiteral:()=>$Be,isTerminalAlternatives:()=>xte,isTerminalElement:()=>zBe,isTerminalGroup:()=>bte,isTerminalRule:()=>Hu,isTerminalRuleCall:()=>_N,isType:()=>RN,isTypeAttribute:()=>GBe,isTypeDefinition:()=>qBe,isUnionType:()=>wte,isUnorderedGroup:()=>LN,isUntilToken:()=>kte,isValueLiteral:()=>VBe,isWildcard:()=>Tte,reflection:()=>Gr});bOt={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},lc={$type:"AbstractElement",cardinality:"cardinality"};_(SN,"isAbstractElement");TS={$type:"AbstractParserRule"};_(p2,"isAbstractParserRule");yw={$type:"AbstractRule"};_(_Be,"isAbstractRule");Yc={$type:"AbstractType"};_(RBe,"isAbstractType");Mg={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};_(zg,"isAction");CS={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};_(EN,"isAlternatives");PM={$type:"ArrayLiteral",elements:"elements"};_(LBe,"isArrayLiteral");BM={$type:"ArrayType",elementType:"elementType"};_(ste,"isArrayType");Ng={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};_(Q0,"isAssignment");FM={$type:"BooleanLiteral",true:"true"};_(ote,"isBooleanLiteral");Dg={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};_(lte,"isCharacterRange");Og={$type:"Condition"};_(IBe,"isCondition");SS={$type:"Conjunction",left:"left",right:"right"};_(cte,"isConjunction");Pg={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};_(m2,"isCrossReference");ES={$type:"Disjunction",left:"left",right:"right"};_(ute,"isDisjunction");$M={$type:"EndOfFile",cardinality:"cardinality"};_(hte,"isEndOfFile");X0={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"};_(MBe,"isGrammar");zM={$type:"GrammarImport",path:"path"};_(NBe,"isGrammarImport");Ov={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};_(g2,"isGroup");GM={$type:"InferredType",name:"name"};_(l6,"isInferredType");ud={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};_(Ow,"isInfixRule");AS={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"};_(DBe,"isInfixRuleOperatorList");qM={$type:"InfixRuleOperators",precedences:"precedences"};_(OBe,"isInfixRuleOperators");vw={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};_(fte,"isInterface");xw={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};_(J0,"isKeyword");bw={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"};_(PBe,"isNamedArgument");Pv={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};_(dte,"isNegatedToken");VM={$type:"Negation",value:"value"};_(pte,"isNegation");WM={$type:"NumberLiteral",value:"value"};_(BBe,"isNumberLiteral");ww={$type:"Parameter",name:"name"};_(FBe,"isParameter");HM={$type:"ParameterReference",parameter:"parameter"};_(mte,"isParameterReference");_h={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};_(Ll,"isParserRule");_S={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"};_(gte,"isReferenceType");Bv={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};_(yte,"isRegexToken");UM={$type:"ReturnType",name:"name"};_(vte,"isReturnType");Fv={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};_(ep,"isRuleCall");kw={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};_(AN,"isSimpleType");YM={$type:"StringLiteral",value:"value"};_($Be,"isStringLiteral");$v={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};_(xte,"isTerminalAlternatives");cc={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};_(zBe,"isTerminalElement");zv={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};_(bte,"isTerminalGroup");j0={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};_(Hu,"isTerminalRule");Gv={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};_(_N,"isTerminalRuleCall");RS={$type:"Type",name:"name",type:"type"};_(RN,"isType");qv={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"};_(GBe,"isTypeAttribute");Vv={$type:"TypeDefinition"};_(qBe,"isTypeDefinition");XM={$type:"UnionType",types:"types"};_(wte,"isUnionType");LS={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};_(LN,"isUnorderedGroup");Wv={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};_(kte,"isUntilToken");Hv={$type:"ValueLiteral"};_(VBe,"isValueLiteral");Tw={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};_(Tte,"isWildcard");Cte=class extends rte{static{_(this,"LangiumGrammarAstReflection")}constructor(){super(...arguments),this.types={AbstractElement:{name:lc.$type,properties:{cardinality:{name:lc.cardinality}},superTypes:[]},AbstractParserRule:{name:TS.$type,properties:{},superTypes:[yw.$type,Yc.$type]},AbstractRule:{name:yw.$type,properties:{},superTypes:[]},AbstractType:{name:Yc.$type,properties:{},superTypes:[]},Action:{name:Mg.$type,properties:{cardinality:{name:Mg.cardinality},feature:{name:Mg.feature},inferredType:{name:Mg.inferredType},operator:{name:Mg.operator},type:{name:Mg.type,referenceType:Yc.$type}},superTypes:[lc.$type]},Alternatives:{name:CS.$type,properties:{cardinality:{name:CS.cardinality},elements:{name:CS.elements,defaultValue:[]}},superTypes:[lc.$type]},ArrayLiteral:{name:PM.$type,properties:{elements:{name:PM.elements,defaultValue:[]}},superTypes:[Hv.$type]},ArrayType:{name:BM.$type,properties:{elementType:{name:BM.elementType}},superTypes:[Vv.$type]},Assignment:{name:Ng.$type,properties:{cardinality:{name:Ng.cardinality},feature:{name:Ng.feature},operator:{name:Ng.operator},predicate:{name:Ng.predicate},terminal:{name:Ng.terminal}},superTypes:[lc.$type]},BooleanLiteral:{name:FM.$type,properties:{true:{name:FM.true,defaultValue:!1}},superTypes:[Og.$type,Hv.$type]},CharacterRange:{name:Dg.$type,properties:{cardinality:{name:Dg.cardinality},left:{name:Dg.left},lookahead:{name:Dg.lookahead},parenthesized:{name:Dg.parenthesized,defaultValue:!1},right:{name:Dg.right}},superTypes:[cc.$type]},Condition:{name:Og.$type,properties:{},superTypes:[]},Conjunction:{name:SS.$type,properties:{left:{name:SS.left},right:{name:SS.right}},superTypes:[Og.$type]},CrossReference:{name:Pg.$type,properties:{cardinality:{name:Pg.cardinality},deprecatedSyntax:{name:Pg.deprecatedSyntax,defaultValue:!1},isMulti:{name:Pg.isMulti,defaultValue:!1},terminal:{name:Pg.terminal},type:{name:Pg.type,referenceType:Yc.$type}},superTypes:[lc.$type]},Disjunction:{name:ES.$type,properties:{left:{name:ES.left},right:{name:ES.right}},superTypes:[Og.$type]},EndOfFile:{name:$M.$type,properties:{cardinality:{name:$M.cardinality}},superTypes:[lc.$type]},Grammar:{name:X0.$type,properties:{imports:{name:X0.imports,defaultValue:[]},interfaces:{name:X0.interfaces,defaultValue:[]},isDeclared:{name:X0.isDeclared,defaultValue:!1},name:{name:X0.name},rules:{name:X0.rules,defaultValue:[]},types:{name:X0.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:zM.$type,properties:{path:{name:zM.path}},superTypes:[]},Group:{name:Ov.$type,properties:{cardinality:{name:Ov.cardinality},elements:{name:Ov.elements,defaultValue:[]},guardCondition:{name:Ov.guardCondition},predicate:{name:Ov.predicate}},superTypes:[lc.$type]},InferredType:{name:GM.$type,properties:{name:{name:GM.name}},superTypes:[Yc.$type]},InfixRule:{name:ud.$type,properties:{call:{name:ud.call},dataType:{name:ud.dataType},inferredType:{name:ud.inferredType},name:{name:ud.name},operators:{name:ud.operators},parameters:{name:ud.parameters,defaultValue:[]},returnType:{name:ud.returnType,referenceType:Yc.$type}},superTypes:[TS.$type]},InfixRuleOperatorList:{name:AS.$type,properties:{associativity:{name:AS.associativity},operators:{name:AS.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:qM.$type,properties:{precedences:{name:qM.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:vw.$type,properties:{attributes:{name:vw.attributes,defaultValue:[]},name:{name:vw.name},superTypes:{name:vw.superTypes,defaultValue:[],referenceType:Yc.$type}},superTypes:[Yc.$type]},Keyword:{name:xw.$type,properties:{cardinality:{name:xw.cardinality},predicate:{name:xw.predicate},value:{name:xw.value}},superTypes:[lc.$type]},NamedArgument:{name:bw.$type,properties:{calledByName:{name:bw.calledByName,defaultValue:!1},parameter:{name:bw.parameter,referenceType:ww.$type},value:{name:bw.value}},superTypes:[]},NegatedToken:{name:Pv.$type,properties:{cardinality:{name:Pv.cardinality},lookahead:{name:Pv.lookahead},parenthesized:{name:Pv.parenthesized,defaultValue:!1},terminal:{name:Pv.terminal}},superTypes:[cc.$type]},Negation:{name:VM.$type,properties:{value:{name:VM.value}},superTypes:[Og.$type]},NumberLiteral:{name:WM.$type,properties:{value:{name:WM.value}},superTypes:[Hv.$type]},Parameter:{name:ww.$type,properties:{name:{name:ww.name}},superTypes:[]},ParameterReference:{name:HM.$type,properties:{parameter:{name:HM.parameter,referenceType:ww.$type}},superTypes:[Og.$type]},ParserRule:{name:_h.$type,properties:{dataType:{name:_h.dataType},definition:{name:_h.definition},entry:{name:_h.entry,defaultValue:!1},fragment:{name:_h.fragment,defaultValue:!1},inferredType:{name:_h.inferredType},name:{name:_h.name},parameters:{name:_h.parameters,defaultValue:[]},returnType:{name:_h.returnType,referenceType:Yc.$type}},superTypes:[TS.$type]},ReferenceType:{name:_S.$type,properties:{isMulti:{name:_S.isMulti,defaultValue:!1},referenceType:{name:_S.referenceType}},superTypes:[Vv.$type]},RegexToken:{name:Bv.$type,properties:{cardinality:{name:Bv.cardinality},lookahead:{name:Bv.lookahead},parenthesized:{name:Bv.parenthesized,defaultValue:!1},regex:{name:Bv.regex}},superTypes:[cc.$type]},ReturnType:{name:UM.$type,properties:{name:{name:UM.name}},superTypes:[]},RuleCall:{name:Fv.$type,properties:{arguments:{name:Fv.arguments,defaultValue:[]},cardinality:{name:Fv.cardinality},predicate:{name:Fv.predicate},rule:{name:Fv.rule,referenceType:yw.$type}},superTypes:[lc.$type]},SimpleType:{name:kw.$type,properties:{primitiveType:{name:kw.primitiveType},stringType:{name:kw.stringType},typeRef:{name:kw.typeRef,referenceType:Yc.$type}},superTypes:[Vv.$type]},StringLiteral:{name:YM.$type,properties:{value:{name:YM.value}},superTypes:[Hv.$type]},TerminalAlternatives:{name:$v.$type,properties:{cardinality:{name:$v.cardinality},elements:{name:$v.elements,defaultValue:[]},lookahead:{name:$v.lookahead},parenthesized:{name:$v.parenthesized,defaultValue:!1}},superTypes:[cc.$type]},TerminalElement:{name:cc.$type,properties:{cardinality:{name:cc.cardinality},lookahead:{name:cc.lookahead},parenthesized:{name:cc.parenthesized,defaultValue:!1}},superTypes:[lc.$type]},TerminalGroup:{name:zv.$type,properties:{cardinality:{name:zv.cardinality},elements:{name:zv.elements,defaultValue:[]},lookahead:{name:zv.lookahead},parenthesized:{name:zv.parenthesized,defaultValue:!1}},superTypes:[cc.$type]},TerminalRule:{name:j0.$type,properties:{definition:{name:j0.definition},fragment:{name:j0.fragment,defaultValue:!1},hidden:{name:j0.hidden,defaultValue:!1},name:{name:j0.name},type:{name:j0.type}},superTypes:[yw.$type]},TerminalRuleCall:{name:Gv.$type,properties:{cardinality:{name:Gv.cardinality},lookahead:{name:Gv.lookahead},parenthesized:{name:Gv.parenthesized,defaultValue:!1},rule:{name:Gv.rule,referenceType:j0.$type}},superTypes:[cc.$type]},Type:{name:RS.$type,properties:{name:{name:RS.name},type:{name:RS.type}},superTypes:[Yc.$type]},TypeAttribute:{name:qv.$type,properties:{defaultValue:{name:qv.defaultValue},isOptional:{name:qv.isOptional,defaultValue:!1},name:{name:qv.name},type:{name:qv.type}},superTypes:[]},TypeDefinition:{name:Vv.$type,properties:{},superTypes:[]},UnionType:{name:XM.$type,properties:{types:{name:XM.types,defaultValue:[]}},superTypes:[Vv.$type]},UnorderedGroup:{name:LS.$type,properties:{cardinality:{name:LS.cardinality},elements:{name:LS.elements,defaultValue:[]}},superTypes:[lc.$type]},UntilToken:{name:Wv.$type,properties:{cardinality:{name:Wv.cardinality},lookahead:{name:Wv.lookahead},parenthesized:{name:Wv.parenthesized,defaultValue:!1},terminal:{name:Wv.terminal}},superTypes:[cc.$type]},ValueLiteral:{name:Hv.$type,properties:{},superTypes:[]},Wildcard:{name:Tw.$type,properties:{cardinality:{name:Tw.cardinality},lookahead:{name:Tw.lookahead},parenthesized:{name:Tw.parenthesized,defaultValue:!1}},superTypes:[cc.$type]}}}},Gr=new Cte;_(WBe,"getDatatypeNode");_(Pw,"streamCst");_(HBe,"flattenCst");_(Ste,"isChildNode");_(VS,"tokenToRange");_(Bw,"toDocumentSegment");(function(e){e[e.Before=0]="Before",e[e.After=1]="After",e[e.OverlapFront=2]="OverlapFront",e[e.OverlapBack=3]="OverlapBack",e[e.Inside=4]="Inside",e[e.Outside=5]="Outside"})(fd||(fd={}));_(Ete,"compareRange");_(Ate,"inRange");_te=/^[\w\p{L}]$/u;_(UBe,"findDeclarationNodeAtOffset");_(Rte,"findCommentNode");_(jM,"isCommentNode");_(IN,"findLeafNodeAtOffset");_(Lte,"findLeafNodeBeforeOffset");_(Ite,"binarySearch");_(Mte,"getPreviousNode");_(YBe,"getNextNode");_(XBe,"getStartlineNode");_(jBe,"getInteriorNodes");_(KBe,"getCommonParent");_(xJ,"getParentChain");Nte={};Hg(Nte,{findAssignment:()=>Ute,findNameAssignment:()=>$N,findNodeForKeyword:()=>Hte,findNodeForProperty:()=>PN,findNodesForKeyword:()=>nFe,findNodesForKeywordInternal:()=>FN,findNodesForProperty:()=>Wte,getActionAtElement:()=>Xte,getActionType:()=>Kte,getAllReachableRules:()=>ON,getAllRulesUsedForCrossReferences:()=>rFe,getCrossReferenceTerminal:()=>qte,getEntryRule:()=>$te,getExplicitRuleType:()=>u6,getHiddenRules:()=>zte,getRuleType:()=>Zte,getRuleTypeName:()=>lFe,getTypeName:()=>o2,isArrayCardinality:()=>aFe,isArrayOperator:()=>sFe,isCommentTerminal:()=>Vte,isDataType:()=>oFe,isDataTypeRule:()=>c6,isOptionalCardinality:()=>iFe,terminalRegex:()=>h6});MN=class extends Error{static{_(this,"ErrorWithLocation")}constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};_(Ug,"assertUnreachable");_(Dte,"assertCondition");Ote={};Hg(Ote,{NEWLINE_REGEXP:()=>QBe,escapeRegExp:()=>Ww,getTerminalParts:()=>eFe,isMultilineComment:()=>Pte,isWhitespace:()=>DN,partialMatches:()=>Bte,partialRegExp:()=>Fte,whitespaceCharacters:()=>tFe});_(rn,"cc");_(hM,"insertToSet");_(fw,"addFlag");_(Ev,"ASSERT_EXISTS");_(vS,"ASSERT_NEVER_REACH_HERE");_(bJ,"isCharacter");KM=[];for(let e=rn("0");e<=rn("9");e++)KM.push(e);ZM=[rn("_")].concat(KM);for(let e=rn("a");e<=rn("z");e++)ZM.push(e);for(let e=rn("A");e<=rn("Z");e++)ZM.push(e);EOe=[rn(" "),rn("\f"),rn(` -`),rn("\r"),rn(" "),rn("\v"),rn(" "),rn("\xA0"),rn("\u1680"),rn("\u2000"),rn("\u2001"),rn("\u2002"),rn("\u2003"),rn("\u2004"),rn("\u2005"),rn("\u2006"),rn("\u2007"),rn("\u2008"),rn("\u2009"),rn("\u200A"),rn("\u2028"),rn("\u2029"),rn("\u202F"),rn("\u205F"),rn("\u3000"),rn("\uFEFF")],wOt=/[0-9a-fA-F]/,$I=/[0-9]/,kOt=/[1-9]/,ZBe=class{static{_(this,"RegExpParser")}constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":fw(r,"global");break;case"i":fw(r,"ignoreCase");break;case"m":fw(r,"multiLine");break;case"u":fw(r,"unicode");break;case"y":fw(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}Ev(t);let r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return vS()}quantifier(e=!1){let t,r=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let n=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:n,atMost:n};break;case",":let i;this.isDigit()?(i=this.integerIncludingZero(),t={atLeast:n,atMost:i}):t={atLeast:n,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Ev(t);break}if(!(e===!0&&t===void 0)&&Ev(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Ev(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):vS()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[rn(` -`),rn("\r"),rn("\u2028"),rn("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=KM;break;case"D":e=KM,t=!0;break;case"s":e=EOe;break;case"S":e=EOe,t=!0;break;case"w":e=ZM;break;case"W":e=ZM,t=!0;break}return Ev(e)?{type:"Set",value:e,complement:t}:vS()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=rn("\f");break;case"n":e=rn(` +`)),ut){let dt=Me.error?` Request failed: ${Me.error.message} (${Me.error.code}).`:"";Te.log(`Received response '${ut.method} - (${Me.id})' in ${Date.now()-ut.timerStart}ms.${dt}`,at)}else Te.log(`Received response ${Me.id} without active response promise.`,at)}else mt("receive-response",Me)}_(De,"traceReceivedResponse");function mt(Me,ut){if(!Te||oe===d.Off)return;let at={isLSPMessage:!0,type:Me,message:ut,timestamp:Date.now()};Te.log(at)}_(mt,"logLSPMessage");function Tt(){if(Ie())throw new x(v.Closed,"Connection is closed.");if(ye())throw new x(v.Disposed,"Connection is disposed.")}_(Tt,"throwIfClosedOrDisposed");function jt(){if(ge())throw new x(v.AlreadyListening,"Connection is already listening")}_(jt,"throwIfListening");function _t(){if(!ge())throw new Error("Call listen() first.")}_(_t,"throwIfNotListening");function Rt(Me){return Me===void 0?null:Me}_(Rt,"undefinedToNull");function bt(Me){if(Me!==null)return Me}_(bt,"nullToUndefined");function ke(Me){return Me!=null&&!Array.isArray(Me)&&typeof Me=="object"}_(ke,"isNamedParam");function yt(Me,ut){switch(Me){case n.ParameterStructures.auto:return ke(ut)?bt(ut):[Rt(ut)];case n.ParameterStructures.byName:if(!ke(ut))throw new Error("Received parameters by name but param is not an object literal.");return bt(ut);case n.ParameterStructures.byPosition:return[Rt(ut)];default:throw new Error(`Unknown parameter structure ${Me.toString()}`)}}_(yt,"computeSingleParam");function xt(Me,ut){let at,dt=Me.numberOfParams;switch(dt){case 0:at=void 0;break;case 1:at=yt(Me.parameterStructures,ut[0]);break;default:at=[];for(let tr=0;tr{Tt();let at,dt;if(r.string(Me)){at=Me;let Vt=ut[0],rr=0,Dr=n.ParameterStructures.auto;n.ParameterStructures.is(Vt)&&(rr=1,Dr=Vt);let vr=ut.length,Qt=vr-rr;switch(Qt){case 0:dt=void 0;break;case 1:dt=yt(Dr,ut[rr]);break;default:if(Dr===n.ParameterStructures.byName)throw new Error(`Received ${Qt} parameters for 'by Name' notification parameter structure.`);dt=ut.slice(rr,vr).map(yr=>Rt(yr));break}}else{let Vt=ut;at=Me.method,dt=xt(Me,Vt)}let tr={jsonrpc:q,method:at,params:dt};return We(tr),N.write(tr).catch(Vt=>{throw B.error("Sending notification failed."),Vt})},"sendNotification"),onNotification:_((Me,ut)=>{Tt();let at;return r.func(Me)?H=Me:ut&&(r.string(Me)?(at=Me,j.set(Me,{type:void 0,handler:ut})):(at=Me.method,j.set(Me.method,{type:Me,handler:ut}))),{dispose:_(()=>{at!==void 0?j.delete(at):H=void 0},"dispose")}},"onNotification"),onProgress:_((Me,ut,at)=>{if(J.has(ut))throw new Error(`Progress handler for token ${ut} already registered`);return J.set(ut,at),{dispose:_(()=>{J.delete(ut)},"dispose")}},"onProgress"),sendProgress:_((Me,ut,at)=>it.sendNotification(u.type,{token:ut,value:at}),"sendProgress"),onUnhandledProgress:Ce.event,sendRequest:_((Me,...ut)=>{Tt(),_t();let at,dt,tr;if(r.string(Me)){at=Me;let vr=ut[0],Qt=ut[ut.length-1],yr=0,lt=n.ParameterStructures.auto;n.ParameterStructures.is(vr)&&(yr=1,lt=vr);let pt=ut.length;s.CancellationToken.is(Qt)&&(pt=pt-1,tr=Qt);let St=pt-yr;switch(St){case 0:dt=void 0;break;case 1:dt=yt(lt,ut[yr]);break;default:if(lt===n.ParameterStructures.byName)throw new Error(`Received ${St} parameters for 'by Name' request parameter structure.`);dt=ut.slice(yr,pt).map(Ir=>Rt(Ir));break}}else{let vr=ut;at=Me.method,dt=xt(Me,vr);let Qt=Me.numberOfParams;tr=s.CancellationToken.is(vr[Qt])?vr[Qt]:void 0}let Vt=P++,rr;tr&&(rr=tr.onCancellationRequested(()=>{let vr=de.sender.sendCancellation(it,Vt);return vr===void 0?(B.log(`Received no promise from cancellation strategy when cancelling id ${Vt}`),Promise.resolve()):vr.catch(()=>{B.log(`Sending cancellation messages for id ${Vt} failed`)})}));let Dr={jsonrpc:q,id:Vt,method:at,params:dt};return tt(Dr),typeof de.sender.enableCancellation=="function"&&de.sender.enableCancellation(Dr),new Promise(async(vr,Qt)=>{let yr=_(St=>{vr(St),de.sender.cleanup(Vt),rr?.dispose()},"resolveWithCleanup"),lt=_(St=>{Qt(St),de.sender.cleanup(Vt),rr?.dispose()},"rejectWithCleanup"),pt={method:at,timerStart:Date.now(),resolve:yr,reject:lt};try{await N.write(Dr),ee.set(Vt,pt)}catch(St){throw B.error("Sending request failed."),pt.reject(new n.ResponseError(n.ErrorCodes.MessageWriteError,St.message?St.message:"Unknown reason")),St}})},"sendRequest"),onRequest:_((Me,ut)=>{Tt();let at=null;return f.is(Me)?(at=void 0,G=Me):r.string(Me)?(at=null,ut!==void 0&&(at=Me,z.set(Me,{handler:ut,type:void 0}))):ut!==void 0&&(at=Me.method,z.set(Me.method,{type:Me,handler:ut})),{dispose:_(()=>{at!==null&&(at!==void 0?z.delete(at):G=void 0)},"dispose")}},"onRequest"),hasPendingResponse:_(()=>ee.size>0,"hasPendingResponse"),trace:_(async(Me,ut,at)=>{let dt=!1,tr=m.Text;at!==void 0&&(r.boolean(at)?dt=at:(dt=at.sendNotification||!1,tr=at.traceFormat||m.Text)),oe=Me,Re=tr,oe===d.Off?Te=void 0:Te=ut,dt&&!Ie()&&!ye()&&await it.sendNotification(g.type,{value:d.toString(Me)})},"trace"),onError:qe.event,onClose:Ge.event,onUnhandledNotification:fe.event,onDispose:_e.event,end:_(()=>{N.end()},"end"),dispose:_(()=>{if(ye())return;Oe=O.Disposed,_e.fire(void 0);let Me=new n.ResponseError(n.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let ut of ee.values())ut.reject(Me);ee=new Map,ae=new Map,ue=new Set,le=new i.LinkedMap,r.func(N.dispose)&&N.dispose(),r.func(A.dispose)&&A.dispose()},"dispose"),listen:_(()=>{Tt(),jt(),Oe=O.Listening,A.listen(je)},"listen"),inspect:_(()=>{(0,t.default)().console.log("inspect")},"inspect")};return it.onNotification(y.type,Me=>{if(oe===d.Off||!Te)return;let ut=oe===d.Verbose||oe===d.Compact;Te.log(Me.message,ut?Me.verbose:void 0)}),it.onNotification(u.type,Me=>{let ut=J.get(Me.token);ut?ut(Me.value):Ce.fire(Me)}),it}_(R,"createMessageConnection"),e.createMessageConnection=R}}),bJ=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/api.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;var t=bBe();Object.defineProperty(e,"Message",{enumerable:!0,get:_(function(){return t.Message},"get")}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:_(function(){return t.RequestType},"get")}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:_(function(){return t.RequestType0},"get")}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:_(function(){return t.RequestType1},"get")}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:_(function(){return t.RequestType2},"get")}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:_(function(){return t.RequestType3},"get")}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:_(function(){return t.RequestType4},"get")}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:_(function(){return t.RequestType5},"get")}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:_(function(){return t.RequestType6},"get")}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:_(function(){return t.RequestType7},"get")}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:_(function(){return t.RequestType8},"get")}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:_(function(){return t.RequestType9},"get")}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:_(function(){return t.ResponseError},"get")}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:_(function(){return t.ErrorCodes},"get")}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:_(function(){return t.NotificationType},"get")}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:_(function(){return t.NotificationType0},"get")}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:_(function(){return t.NotificationType1},"get")}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:_(function(){return t.NotificationType2},"get")}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:_(function(){return t.NotificationType3},"get")}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:_(function(){return t.NotificationType4},"get")}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:_(function(){return t.NotificationType5},"get")}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:_(function(){return t.NotificationType6},"get")}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:_(function(){return t.NotificationType7},"get")}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:_(function(){return t.NotificationType8},"get")}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:_(function(){return t.NotificationType9},"get")}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:_(function(){return t.ParameterStructures},"get")});var r=kBe();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:_(function(){return r.LinkedMap},"get")}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:_(function(){return r.LRUCache},"get")}),Object.defineProperty(e,"Touch",{enumerable:!0,get:_(function(){return r.Touch},"get")});var n=UDt();Object.defineProperty(e,"Disposable",{enumerable:!0,get:_(function(){return n.Disposable},"get")});var i=qw();Object.defineProperty(e,"Event",{enumerable:!0,get:_(function(){return i.Event},"get")}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:_(function(){return i.Emitter},"get")});var a=TN();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:_(function(){return a.CancellationTokenSource},"get")}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:_(function(){return a.CancellationToken},"get")});var s=YDt();Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:_(function(){return s.SharedArraySenderStrategy},"get")}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:_(function(){return s.SharedArrayReceiverStrategy},"get")});var o=XDt();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:_(function(){return o.MessageReader},"get")}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:_(function(){return o.AbstractMessageReader},"get")}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:_(function(){return o.ReadableStreamMessageReader},"get")});var l=jDt();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:_(function(){return l.MessageWriter},"get")}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:_(function(){return l.AbstractMessageWriter},"get")}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:_(function(){return l.WriteableStreamMessageWriter},"get")});var u=KDt();Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:_(function(){return u.AbstractMessageBuffer},"get")});var h=ZDt();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:_(function(){return h.ConnectionStrategy},"get")}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:_(function(){return h.ConnectionOptions},"get")}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:_(function(){return h.NullLogger},"get")}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:_(function(){return h.createMessageConnection},"get")}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:_(function(){return h.ProgressToken},"get")}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:_(function(){return h.ProgressType},"get")}),Object.defineProperty(e,"Trace",{enumerable:!0,get:_(function(){return h.Trace},"get")}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:_(function(){return h.TraceValues},"get")}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:_(function(){return h.TraceFormat},"get")}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:_(function(){return h.SetTraceNotification},"get")}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:_(function(){return h.LogTraceNotification},"get")}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:_(function(){return h.ConnectionErrors},"get")}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:_(function(){return h.ConnectionError},"get")}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:_(function(){return h.CancellationReceiverStrategy},"get")}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:_(function(){return h.CancellationSenderStrategy},"get")}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:_(function(){return h.CancellationStrategy},"get")}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:_(function(){return h.MessageStrategy},"get")});var f=h2();e.RAL=f.default}}),QDt=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/ril.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=bJ(),r=class SBe extends t.AbstractMessageBuffer{static{_(this,"MessageBuffer")}constructor(u="utf-8"){super(u),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return SBe.emptyBuffer}fromString(u,h){return new TextEncoder().encode(u)}toString(u,h){return h==="ascii"?this.asciiDecoder.decode(u):new TextDecoder(h).decode(u)}asNative(u,h){return h===void 0?u:u.slice(0,h)}allocNative(u){return new Uint8Array(u)}};r.emptyBuffer=new Uint8Array(0);var n=class{static{_(this,"ReadableStreamWrapper")}constructor(l){this.socket=l,this._onData=new t.Emitter,this._messageListener=u=>{u.data.arrayBuffer().then(f=>{this._onData.fire(new Uint8Array(f))},()=>{(0,t.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(l){return this.socket.addEventListener("close",l),t.Disposable.create(()=>this.socket.removeEventListener("close",l))}onError(l){return this.socket.addEventListener("error",l),t.Disposable.create(()=>this.socket.removeEventListener("error",l))}onEnd(l){return this.socket.addEventListener("end",l),t.Disposable.create(()=>this.socket.removeEventListener("end",l))}onData(l){return this._onData.event(l)}},i=class{static{_(this,"WritableStreamWrapper")}constructor(l){this.socket=l}onClose(l){return this.socket.addEventListener("close",l),t.Disposable.create(()=>this.socket.removeEventListener("close",l))}onError(l){return this.socket.addEventListener("error",l),t.Disposable.create(()=>this.socket.removeEventListener("error",l))}onEnd(l){return this.socket.addEventListener("end",l),t.Disposable.create(()=>this.socket.removeEventListener("end",l))}write(l,u){if(typeof l=="string"){if(u!==void 0&&u!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${u}`);this.socket.send(l)}else this.socket.send(l);return Promise.resolve()}end(){this.socket.close()}},a=new TextEncoder,s=Object.freeze({messageBuffer:Object.freeze({create:_(l=>new r(l),"create")}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:_((l,u)=>{if(u.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${u.charset}`);return Promise.resolve(a.encode(JSON.stringify(l,void 0,0)))},"encode")}),decoder:Object.freeze({name:"application/json",decode:_((l,u)=>{if(!(l instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(u.charset).decode(l)))},"decode")})}),stream:Object.freeze({asReadableStream:_(l=>new n(l),"asReadableStream"),asWritableStream:_(l=>new i(l),"asWritableStream")}),console,timer:Object.freeze({setTimeout(l,u,...h){let f=setTimeout(l,u,...h);return{dispose:_(()=>clearTimeout(f),"dispose")}},setImmediate(l,...u){let h=setTimeout(l,0,...u);return{dispose:_(()=>clearTimeout(h),"dispose")}},setInterval(l,u,...h){let f=setInterval(l,u,...h);return{dispose:_(()=>clearInterval(f),"dispose")}}})});function o(){return s}_(o,"RIL"),(function(l){function u(){t.RAL.install(s)}_(u,"install"),l.install=u})(o||(o={})),e.default=o}}),Vw=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/main.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(l,u,h,f){f===void 0&&(f=h);var d=Object.getOwnPropertyDescriptor(u,h);(!d||("get"in d?!u.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:_(function(){return u[h]},"get")}),Object.defineProperty(l,f,d)}):(function(l,u,h,f){f===void 0&&(f=h),l[f]=u[h]})),r=e&&e.__exportStar||function(l,u){for(var h in l)h!=="default"&&!Object.prototype.hasOwnProperty.call(u,h)&&t(u,l,h)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0;var n=QDt();n.default.install();var i=bJ();r(bJ(),e);var a=class extends i.AbstractMessageReader{static{_(this,"BrowserMessageReader")}constructor(l){super(),this._onData=new i.Emitter,this._messageListener=u=>{this._onData.fire(u.data)},l.addEventListener("error",u=>this.fireError(u)),l.onmessage=this._messageListener}listen(l){return this._onData.event(l)}};e.BrowserMessageReader=a;var s=class extends i.AbstractMessageWriter{static{_(this,"BrowserMessageWriter")}constructor(l){super(),this.port=l,this.errorCount=0,l.addEventListener("error",u=>this.fireError(u))}write(l){try{return this.port.postMessage(l),Promise.resolve()}catch(u){return this.handleError(u,l),Promise.reject(u)}}handleError(l,u){this.errorCount++,this.fireError(l,u,this.errorCount)}end(){}};e.BrowserMessageWriter=s;function o(l,u,h,f){return h===void 0&&(h=i.NullLogger),i.ConnectionStrategy.is(f)&&(f={connectionStrategy:f}),(0,i.createMessageConnection)(l,u,h,f)}_(o,"createMessageConnection"),e.createMessageConnection=o}}),AOe=mn({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/browser.js"(e,t){"use strict";t.exports=Vw()}}),xa=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/messages.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProtocolNotificationType=e.ProtocolNotificationType0=e.ProtocolRequestType=e.ProtocolRequestType0=e.RegistrationType=e.MessageDirection=void 0;var t=Vw(),r;(function(l){l.clientToServer="clientToServer",l.serverToClient="serverToClient",l.both="both"})(r||(e.MessageDirection=r={}));var n=class{static{_(this,"RegistrationType")}constructor(l){this.method=l}};e.RegistrationType=n;var i=class extends t.RequestType0{static{_(this,"ProtocolRequestType0")}constructor(l){super(l)}};e.ProtocolRequestType0=i;var a=class extends t.RequestType{static{_(this,"ProtocolRequestType")}constructor(l){super(l,t.ParameterStructures.byName)}};e.ProtocolRequestType=a;var s=class extends t.NotificationType0{static{_(this,"ProtocolNotificationType0")}constructor(l){super(l)}};e.ProtocolNotificationType0=s;var o=class extends t.NotificationType{static{_(this,"ProtocolNotificationType")}constructor(l){super(l,t.ParameterStructures.byName)}};e.ProtocolNotificationType=o}}),tte=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.objectLiteral=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(h){return h===!0||h===!1}_(t,"boolean"),e.boolean=t;function r(h){return typeof h=="string"||h instanceof String}_(r,"string"),e.string=r;function n(h){return typeof h=="number"||h instanceof Number}_(n,"number"),e.number=n;function i(h){return h instanceof Error}_(i,"error"),e.error=i;function a(h){return typeof h=="function"}_(a,"func"),e.func=a;function s(h){return Array.isArray(h)}_(s,"array"),e.array=s;function o(h){return s(h)&&h.every(f=>r(f))}_(o,"stringArray"),e.stringArray=o;function l(h,f){return Array.isArray(h)&&h.every(f)}_(l,"typedArray"),e.typedArray=l;function u(h){return h!==null&&typeof h=="object"}_(u,"objectLiteral"),e.objectLiteral=u}}),JDt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/implementation",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.ImplementationRequest=r={}))}}),eOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeDefinitionRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/typeDefinition",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.TypeDefinitionRequest=r={}))}}),tOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;var t=xa(),r;(function(i){i.method="workspace/workspaceFolders",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)})(r||(e.WorkspaceFoldersRequest=r={}));var n;(function(i){i.method="workspace/didChangeWorkspaceFolders",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolNotificationType(i.method)})(n||(e.DidChangeWorkspaceFoldersNotification=n={}))}}),rOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigurationRequest=void 0;var t=xa(),r;(function(n){n.method="workspace/configuration",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)})(r||(e.ConfigurationRequest=r={}))}}),nOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;var t=xa(),r;(function(i){i.method="textDocument/documentColor",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.DocumentColorRequest=r={}));var n;(function(i){i.method="textDocument/colorPresentation",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(n||(e.ColorPresentationRequest=n={}))}}),iOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=void 0;var t=xa(),r;(function(i){i.method="textDocument/foldingRange",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.FoldingRangeRequest=r={}));var n;(function(i){i.method="workspace/foldingRange/refresh",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)})(n||(e.FoldingRangeRefreshRequest=n={}))}}),aOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DeclarationRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/declaration",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.DeclarationRequest=r={}))}}),sOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionRangeRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/selectionRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.SelectionRangeRequest=r={}))}}),oOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;var t=Vw(),r=xa(),n;(function(s){s.type=new t.ProgressType;function o(l){return l===s.type}_(o,"is"),s.is=o})(n||(e.WorkDoneProgress=n={}));var i;(function(s){s.method="window/workDoneProgress/create",s.messageDirection=r.MessageDirection.serverToClient,s.type=new r.ProtocolRequestType(s.method)})(i||(e.WorkDoneProgressCreateRequest=i={}));var a;(function(s){s.method="window/workDoneProgress/cancel",s.messageDirection=r.MessageDirection.clientToServer,s.type=new r.ProtocolNotificationType(s.method)})(a||(e.WorkDoneProgressCancelNotification=a={}))}}),lOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;var t=xa(),r;(function(a){a.method="textDocument/prepareCallHierarchy",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.CallHierarchyPrepareRequest=r={}));var n;(function(a){a.method="callHierarchy/incomingCalls",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.CallHierarchyIncomingCallsRequest=n={}));var i;(function(a){a.method="callHierarchy/outgoingCalls",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.CallHierarchyOutgoingCallsRequest=i={}))}}),cOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;var t=xa(),r;(function(l){l.Relative="relative"})(r||(e.TokenFormat=r={}));var n;(function(l){l.method="textDocument/semanticTokens",l.type=new t.RegistrationType(l.method)})(n||(e.SemanticTokensRegistrationType=n={}));var i;(function(l){l.method="textDocument/semanticTokens/full",l.messageDirection=t.MessageDirection.clientToServer,l.type=new t.ProtocolRequestType(l.method),l.registrationMethod=n.method})(i||(e.SemanticTokensRequest=i={}));var a;(function(l){l.method="textDocument/semanticTokens/full/delta",l.messageDirection=t.MessageDirection.clientToServer,l.type=new t.ProtocolRequestType(l.method),l.registrationMethod=n.method})(a||(e.SemanticTokensDeltaRequest=a={}));var s;(function(l){l.method="textDocument/semanticTokens/range",l.messageDirection=t.MessageDirection.clientToServer,l.type=new t.ProtocolRequestType(l.method),l.registrationMethod=n.method})(s||(e.SemanticTokensRangeRequest=s={}));var o;(function(l){l.method="workspace/semanticTokens/refresh",l.messageDirection=t.MessageDirection.serverToClient,l.type=new t.ProtocolRequestType0(l.method)})(o||(e.SemanticTokensRefreshRequest=o={}))}}),uOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShowDocumentRequest=void 0;var t=xa(),r;(function(n){n.method="window/showDocument",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType(n.method)})(r||(e.ShowDocumentRequest=r={}))}}),hOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedEditingRangeRequest=void 0;var t=xa(),r;(function(n){n.method="textDocument/linkedEditingRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.LinkedEditingRangeRequest=r={}))}}),fOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.DidRenameFilesNotification=e.WillRenameFilesRequest=e.DidCreateFilesNotification=e.WillCreateFilesRequest=e.FileOperationPatternKind=void 0;var t=xa(),r;(function(u){u.file="file",u.folder="folder"})(r||(e.FileOperationPatternKind=r={}));var n;(function(u){u.method="workspace/willCreateFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(n||(e.WillCreateFilesRequest=n={}));var i;(function(u){u.method="workspace/didCreateFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(i||(e.DidCreateFilesNotification=i={}));var a;(function(u){u.method="workspace/willRenameFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(a||(e.WillRenameFilesRequest=a={}));var s;(function(u){u.method="workspace/didRenameFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(s||(e.DidRenameFilesNotification=s={}));var o;(function(u){u.method="workspace/didDeleteFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolNotificationType(u.method)})(o||(e.DidDeleteFilesNotification=o={}));var l;(function(u){u.method="workspace/willDeleteFiles",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method)})(l||(e.WillDeleteFilesRequest=l={}))}}),dOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;var t=xa(),r;(function(a){a.document="document",a.project="project",a.group="group",a.scheme="scheme",a.global="global"})(r||(e.UniquenessLevel=r={}));var n;(function(a){a.$import="import",a.$export="export",a.local="local"})(n||(e.MonikerKind=n={}));var i;(function(a){a.method="textDocument/moniker",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.MonikerRequest=i={}))}}),pOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;var t=xa(),r;(function(a){a.method="textDocument/prepareTypeHierarchy",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.TypeHierarchyPrepareRequest=r={}));var n;(function(a){a.method="typeHierarchy/supertypes",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.TypeHierarchySupertypesRequest=n={}));var i;(function(a){a.method="typeHierarchy/subtypes",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.TypeHierarchySubtypesRequest=i={}))}}),mOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;var t=xa(),r;(function(i){i.method="textDocument/inlineValue",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.InlineValueRequest=r={}));var n;(function(i){i.method="workspace/inlineValue/refresh",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType0(i.method)})(n||(e.InlineValueRefreshRequest=n={}))}}),gOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;var t=xa(),r;(function(a){a.method="textDocument/inlayHint",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.InlayHintRequest=r={}));var n;(function(a){a.method="inlayHint/resolve",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.InlayHintResolveRequest=n={}));var i;(function(a){a.method="workspace/inlayHint/refresh",a.messageDirection=t.MessageDirection.serverToClient,a.type=new t.ProtocolRequestType0(a.method)})(i||(e.InlayHintRefreshRequest=i={}))}}),yOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;var t=Vw(),r=tte(),n=xa(),i;(function(u){function h(f){let d=f;return d&&r.boolean(d.retriggerRequest)}_(h,"is"),u.is=h})(i||(e.DiagnosticServerCancellationData=i={}));var a;(function(u){u.Full="full",u.Unchanged="unchanged"})(a||(e.DocumentDiagnosticReportKind=a={}));var s;(function(u){u.method="textDocument/diagnostic",u.messageDirection=n.MessageDirection.clientToServer,u.type=new n.ProtocolRequestType(u.method),u.partialResult=new t.ProgressType})(s||(e.DocumentDiagnosticRequest=s={}));var o;(function(u){u.method="workspace/diagnostic",u.messageDirection=n.MessageDirection.clientToServer,u.type=new n.ProtocolRequestType(u.method),u.partialResult=new t.ProgressType})(o||(e.WorkspaceDiagnosticRequest=o={}));var l;(function(u){u.method="workspace/diagnostic/refresh",u.messageDirection=n.MessageDirection.serverToClient,u.type=new n.ProtocolRequestType0(u.method)})(l||(e.DiagnosticRefreshRequest=l={}))}}),vOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=void 0;var t=(a6(),ete(kN)),r=tte(),n=xa(),i;(function(m){m.Markup=1,m.Code=2;function g(y){return y===1||y===2}_(g,"is"),m.is=g})(i||(e.NotebookCellKind=i={}));var a;(function(m){function g(x,w){let C={executionOrder:x};return(w===!0||w===!1)&&(C.success=w),C}_(g,"create"),m.create=g;function y(x){let w=x;return r.objectLiteral(w)&&t.uinteger.is(w.executionOrder)&&(w.success===void 0||r.boolean(w.success))}_(y,"is"),m.is=y;function v(x,w){return x===w?!0:x==null||w===null||w===void 0?!1:x.executionOrder===w.executionOrder&&x.success===w.success}_(v,"equals"),m.equals=v})(a||(e.ExecutionSummary=a={}));var s;(function(m){function g(w,C){return{kind:w,document:C}}_(g,"create"),m.create=g;function y(w){let C=w;return r.objectLiteral(C)&&i.is(C.kind)&&t.DocumentUri.is(C.document)&&(C.metadata===void 0||r.objectLiteral(C.metadata))}_(y,"is"),m.is=y;function v(w,C){let T=new Set;return w.document!==C.document&&T.add("document"),w.kind!==C.kind&&T.add("kind"),w.executionSummary!==C.executionSummary&&T.add("executionSummary"),(w.metadata!==void 0||C.metadata!==void 0)&&!x(w.metadata,C.metadata)&&T.add("metadata"),(w.executionSummary!==void 0||C.executionSummary!==void 0)&&!a.equals(w.executionSummary,C.executionSummary)&&T.add("executionSummary"),T}_(v,"diff"),m.diff=v;function x(w,C){if(w===C)return!0;if(w==null||C===null||C===void 0||typeof w!=typeof C||typeof w!="object")return!1;let T=Array.isArray(w),k=Array.isArray(C);if(T!==k)return!1;if(T&&k){if(w.length!==C.length)return!1;for(let S=0;S0}_(yt,"hasId"),ke.hasId=yt})(P||(e.StaticRegistrationOptions=P={}));var $;(function(ke){function yt(xt){let it=xt;return it&&(it.documentSelector===null||R.is(it.documentSelector))}_(yt,"is"),ke.is=yt})($||(e.TextDocumentRegistrationOptions=$={}));var F;(function(ke){function yt(it){let Me=it;return n.objectLiteral(Me)&&(Me.workDoneProgress===void 0||n.boolean(Me.workDoneProgress))}_(yt,"is"),ke.is=yt;function xt(it){let Me=it;return Me&&n.boolean(Me.workDoneProgress)}_(xt,"hasWorkDoneProgress"),ke.hasWorkDoneProgress=xt})(F||(e.WorkDoneProgressOptions=F={}));var q;(function(ke){ke.method="initialize",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(q||(e.InitializeRequest=q={}));var G;(function(ke){ke.unknownProtocolVersion=1})(G||(e.InitializeErrorCodes=G={}));var z;(function(ke){ke.method="initialized",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(z||(e.InitializedNotification=z={}));var H;(function(ke){ke.method="shutdown",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType0(ke.method)})(H||(e.ShutdownRequest=H={}));var j;(function(ke){ke.method="exit",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType0(ke.method)})(j||(e.ExitNotification=j={}));var J;(function(ke){ke.method="workspace/didChangeConfiguration",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(J||(e.DidChangeConfigurationNotification=J={}));var U;(function(ke){ke.Error=1,ke.Warning=2,ke.Info=3,ke.Log=4,ke.Debug=5})(U||(e.MessageType=U={}));var le;(function(ke){ke.method="window/showMessage",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(le||(e.ShowMessageNotification=le={}));var ee;(function(ke){ke.method="window/showMessageRequest",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolRequestType(ke.method)})(ee||(e.ShowMessageRequest=ee={}));var ue;(function(ke){ke.method="window/logMessage",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(ue||(e.LogMessageNotification=ue={}));var ae;(function(ke){ke.method="telemetry/event",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(ae||(e.TelemetryEventNotification=ae={}));var oe;(function(ke){ke.None=0,ke.Full=1,ke.Incremental=2})(oe||(e.TextDocumentSyncKind=oe={}));var Re;(function(ke){ke.method="textDocument/didOpen",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Re||(e.DidOpenTextDocumentNotification=Re={}));var Te;(function(ke){function yt(it){let Me=it;return Me!=null&&typeof Me.text=="string"&&Me.range!==void 0&&(Me.rangeLength===void 0||typeof Me.rangeLength=="number")}_(yt,"isIncremental"),ke.isIncremental=yt;function xt(it){let Me=it;return Me!=null&&typeof Me.text=="string"&&Me.range===void 0&&Me.rangeLength===void 0}_(xt,"isFull"),ke.isFull=xt})(Te||(e.TextDocumentContentChangeEvent=Te={}));var Oe;(function(ke){ke.method="textDocument/didChange",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Oe||(e.DidChangeTextDocumentNotification=Oe={}));var qe;(function(ke){ke.method="textDocument/didClose",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(qe||(e.DidCloseTextDocumentNotification=qe={}));var Ge;(function(ke){ke.method="textDocument/didSave",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Ge||(e.DidSaveTextDocumentNotification=Ge={}));var fe;(function(ke){ke.Manual=1,ke.AfterDelay=2,ke.FocusOut=3})(fe||(e.TextDocumentSaveReason=fe={}));var Ce;(function(ke){ke.method="textDocument/willSave",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(Ce||(e.WillSaveTextDocumentNotification=Ce={}));var _e;(function(ke){ke.method="textDocument/willSaveWaitUntil",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(_e||(e.WillSaveTextDocumentWaitUntilRequest=_e={}));var de;(function(ke){ke.method="workspace/didChangeWatchedFiles",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolNotificationType(ke.method)})(de||(e.DidChangeWatchedFilesNotification=de={}));var ie;(function(ke){ke.Created=1,ke.Changed=2,ke.Deleted=3})(ie||(e.FileChangeType=ie={}));var Q;(function(ke){function yt(xt){let it=xt;return n.objectLiteral(it)&&(r.URI.is(it.baseUri)||r.WorkspaceFolder.is(it.baseUri))&&n.string(it.pattern)}_(yt,"is"),ke.is=yt})(Q||(e.RelativePattern=Q={}));var he;(function(ke){ke.Create=1,ke.Change=2,ke.Delete=4})(he||(e.WatchKind=he={}));var xe;(function(ke){ke.method="textDocument/publishDiagnostics",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolNotificationType(ke.method)})(xe||(e.PublishDiagnosticsNotification=xe={}));var ce;(function(ke){ke.Invoked=1,ke.TriggerCharacter=2,ke.TriggerForIncompleteCompletions=3})(ce||(e.CompletionTriggerKind=ce={}));var ge;(function(ke){ke.method="textDocument/completion",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ge||(e.CompletionRequest=ge={}));var Ie;(function(ke){ke.method="completionItem/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ie||(e.CompletionResolveRequest=Ie={}));var ye;(function(ke){ke.method="textDocument/hover",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ye||(e.HoverRequest=ye={}));var ne;(function(ke){ke.Invoked=1,ke.TriggerCharacter=2,ke.ContentChange=3})(ne||(e.SignatureHelpTriggerKind=ne={}));var V;(function(ke){ke.method="textDocument/signatureHelp",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(V||(e.SignatureHelpRequest=V={}));var pe;(function(ke){ke.method="textDocument/definition",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(pe||(e.DefinitionRequest=pe={}));var K;(function(ke){ke.method="textDocument/references",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(K||(e.ReferencesRequest=K={}));var ve;(function(ke){ke.method="textDocument/documentHighlight",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ve||(e.DocumentHighlightRequest=ve={}));var Z;(function(ke){ke.method="textDocument/documentSymbol",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Z||(e.DocumentSymbolRequest=Z={}));var je;(function(ke){ke.method="textDocument/codeAction",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(je||(e.CodeActionRequest=je={}));var Ne;(function(ke){ke.method="codeAction/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ne||(e.CodeActionResolveRequest=Ne={}));var ze;(function(ke){ke.method="workspace/symbol",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(ze||(e.WorkspaceSymbolRequest=ze={}));var Fe;(function(ke){ke.method="workspaceSymbol/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Fe||(e.WorkspaceSymbolResolveRequest=Fe={}));var Ke;(function(ke){ke.method="textDocument/codeLens",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ke||(e.CodeLensRequest=Ke={}));var Ve;(function(ke){ke.method="codeLens/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Ve||(e.CodeLensResolveRequest=Ve={}));var tt;(function(ke){ke.method="workspace/codeLens/refresh",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolRequestType0(ke.method)})(tt||(e.CodeLensRefreshRequest=tt={}));var We;(function(ke){ke.method="textDocument/documentLink",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(We||(e.DocumentLinkRequest=We={}));var rt;(function(ke){ke.method="documentLink/resolve",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(rt||(e.DocumentLinkResolveRequest=rt={}));var Se;(function(ke){ke.method="textDocument/formatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Se||(e.DocumentFormattingRequest=Se={}));var Et;(function(ke){ke.method="textDocument/rangeFormatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Et||(e.DocumentRangeFormattingRequest=Et={}));var De;(function(ke){ke.method="textDocument/rangesFormatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(De||(e.DocumentRangesFormattingRequest=De={}));var mt;(function(ke){ke.method="textDocument/onTypeFormatting",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(mt||(e.DocumentOnTypeFormattingRequest=mt={}));var Tt;(function(ke){ke.Identifier=1})(Tt||(e.PrepareSupportDefaultBehavior=Tt={}));var jt;(function(ke){ke.method="textDocument/rename",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(jt||(e.RenameRequest=jt={}));var _t;(function(ke){ke.method="textDocument/prepareRename",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(_t||(e.PrepareRenameRequest=_t={}));var Rt;(function(ke){ke.method="workspace/executeCommand",ke.messageDirection=t.MessageDirection.clientToServer,ke.type=new t.ProtocolRequestType(ke.method)})(Rt||(e.ExecuteCommandRequest=Rt={}));var bt;(function(ke){ke.method="workspace/applyEdit",ke.messageDirection=t.MessageDirection.serverToClient,ke.type=new t.ProtocolRequestType("workspace/applyEdit")})(bt||(e.ApplyWorkspaceEditRequest=bt={}))}}),wOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/connection.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var t=Vw();function r(n,i,a,s){return t.ConnectionStrategy.is(s)&&(s={connectionStrategy:s}),(0,t.createMessageConnection)(n,i,a,s)}_(r,"createProtocolConnection"),e.createProtocolConnection=r}}),kOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/api.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(a,s,o,l){l===void 0&&(l=o);var u=Object.getOwnPropertyDescriptor(s,o);(!u||("get"in u?!s.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:_(function(){return s[o]},"get")}),Object.defineProperty(a,l,u)}):(function(a,s,o,l){l===void 0&&(l=o),a[l]=s[o]})),r=e&&e.__exportStar||function(a,s){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,r(Vw(),e),r((a6(),ete(kN)),e),r(xa(),e),r(bOt(),e);var n=wOt();Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:_(function(){return n.createProtocolConnection},"get")});var i;(function(a){a.lspReservedErrorRangeStart=-32899,a.RequestFailed=-32803,a.ServerCancelled=-32802,a.ContentModified=-32801,a.RequestCancelled=-32800,a.lspReservedErrorRangeEnd=-32800})(i||(e.LSPErrorCodes=i={}))}}),TOt=mn({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/browser/main.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(a,s,o,l){l===void 0&&(l=o);var u=Object.getOwnPropertyDescriptor(s,o);(!u||("get"in u?!s.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:_(function(){return s[o]},"get")}),Object.defineProperty(a,l,u)}):(function(a,s,o,l){l===void 0&&(l=o),a[l]=s[o]})),r=e&&e.__exportStar||function(a,s){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var n=AOe();r(AOe(),e),r(kOt(),e);function i(a,s,o,l){return(0,n.createMessageConnection)(a,s,o,l)}_(i,"createProtocolConnection"),e.createProtocolConnection=i}}),EBe={};Hg(EBe,{AbstractAstReflection:()=>ite,AbstractCstNode:()=>sne,AbstractLangiumParser:()=>lne,AbstractParserErrorMessageProvider:()=>pYe,AbstractThreadedAsyncParser:()=>QUt,AstUtils:()=>ate,BiMap:()=>gN,Cancellation:()=>Gi,CompositeCstNodeImpl:()=>xD,ContextCache:()=>ED,CstNodeBuilder:()=>uYe,CstUtils:()=>rte,DEFAULT_TOKENIZE_OPTIONS:()=>Ene,DONE_RESULT:()=>Al,DatatypeSymbol:()=>fN,DefaultAstNodeDescriptionProvider:()=>WYe,DefaultAstNodeLocator:()=>UYe,DefaultAsyncParser:()=>uXe,DefaultCommentProvider:()=>cXe,DefaultConfigurationProvider:()=>YYe,DefaultDocumentBuilder:()=>XYe,DefaultDocumentValidator:()=>VYe,DefaultHydrator:()=>fXe,DefaultIndexManager:()=>jYe,DefaultJsonSerializer:()=>$Ye,DefaultLangiumDocumentFactory:()=>LYe,DefaultLangiumDocuments:()=>IYe,DefaultLangiumProfiler:()=>nYt,DefaultLexer:()=>Ane,DefaultLexerErrorMessageProvider:()=>ZYe,DefaultLinker:()=>MYe,DefaultNameProvider:()=>NYe,DefaultReferenceDescriptionProvider:()=>HYe,DefaultReferences:()=>DYe,DefaultScopeComputation:()=>OYe,DefaultScopeProvider:()=>FYe,DefaultServiceRegistry:()=>zYe,DefaultTokenBuilder:()=>kD,DefaultValueConverter:()=>mne,DefaultWorkspaceLock:()=>hXe,DefaultWorkspaceManager:()=>KYe,Deferred:()=>ap,Disposable:()=>s2,DisposableCache:()=>SD,DocumentCache:()=>BYe,DocumentState:()=>Ln,DocumentValidator:()=>Gu,EMPTY_SCOPE:()=>XUt,EMPTY_STREAM:()=>Iw,EmptyFileSystem:()=>ti,EmptyFileSystemProvider:()=>mXe,ErrorWithLocation:()=>MN,GrammarAST:()=>RBe,GrammarUtils:()=>Ote,IndentationAwareLexer:()=>eYt,IndentationAwareTokenBuilder:()=>pXe,JSDocDocumentationProvider:()=>lXe,LangiumCompletionParser:()=>mYe,LangiumParser:()=>dYe,LangiumParserErrorMessageProvider:()=>cne,LeafCstNodeImpl:()=>hN,LexingMode:()=>i2,MapScope:()=>YUt,Module:()=>tee,MultiMap:()=>sp,MultiMapScope:()=>PYe,OperationCancelled:()=>pd,ParserWorker:()=>JUt,ProfilingTask:()=>yXe,Reduction:()=>qS,RefResolving:()=>Rv,RegExpUtils:()=>Bte,RootCstNodeImpl:()=>one,SimpleCache:()=>wne,StreamImpl:()=>dd,StreamScope:()=>ZJ,TextDocument:()=>pN,TreeStreamImpl:()=>Mw,URI:()=>Xc,UriTrie:()=>xne,UriUtils:()=>Rl,VALIDATE_EACH_NODE:()=>qYe,ValidationCategory:()=>yN,ValidationRegistry:()=>GYe,ValueConverter:()=>hd,WorkspaceCache:()=>kne,assertCondition:()=>Pte,assertUnreachable:()=>Ug,createCompletionParser:()=>fne,createDefaultCoreModule:()=>Yn,createDefaultSharedCoreModule:()=>Xn,createGrammarConfig:()=>tre,createLangiumParser:()=>dne,createParser:()=>bD,delayNextTick:()=>TD,diagnosticData:()=>n2,eagerLoad:()=>Dne,getDiagnosticRange:()=>Cne,indentationBuilderDefaultOptions:()=>nee,inject:()=>an,interruptAndCheck:()=>Us,isAstNode:()=>ls,isAstNodeDescription:()=>nte,isAstNodeWithComment:()=>Tne,isCompositeCstNode:()=>Z0,isIMultiModeLexerDefinition:()=>RD,isJSDoc:()=>Rne,isLeafCstNode:()=>f2,isLinkingError:()=>Dv,isMultiReference:()=>md,isNamed:()=>bne,isOperationCancelled:()=>I2,isReference:()=>_l,isRootCstNode:()=>CN,isTokenTypeArray:()=>_D,isTokenTypeDictionary:()=>vN,loadGrammarFromJson:()=>Ys,parseJSDoc:()=>_ne,prepareLangiumParser:()=>pne,setInterruptionPeriod:()=>gne,startCancelableOperation:()=>CD,stream:()=>ki,toDiagnosticData:()=>Sne,toDiagnosticSeverity:()=>BS});rte={};Hg(rte,{DefaultNameRegexp:()=>Lte,RangeComparison:()=>fd,compareRange:()=>_te,findCommentNode:()=>Ite,findDeclarationNodeAtOffset:()=>XBe,findLeafNodeAtOffset:()=>IN,findLeafNodeBeforeOffset:()=>Mte,flattenCst:()=>YBe,getDatatypeNode:()=>UBe,getInteriorNodes:()=>ZBe,getNextNode:()=>jBe,getPreviousNode:()=>Dte,getStartlineNode:()=>KBe,inRange:()=>Rte,isChildNode:()=>Ate,isCommentNode:()=>jM,streamCst:()=>Pw,toDocumentSegment:()=>Bw,tokenToRange:()=>VS});_(ls,"isAstNode");_(_l,"isReference");_(md,"isMultiReference");_(nte,"isAstNodeDescription");_(Dv,"isLinkingError");ite=class{static{_(this,"AbstractAstReflection")}constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){let t=this.types[e.container.$type];if(!t)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);let r=t.properties[e.property]?.referenceType;if(!r)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return r}getTypeMetaData(e){let t=this.types[e];return t||{name:e,properties:{},superTypes:[]}}isInstance(e,t){return ls(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});let n=r[t];if(n!==void 0)return n;{let i=this.types[e],a=i?i.superTypes.some(s=>this.isSubtype(s,t)):!1;return r[t]=a,a}}getAllSubTypes(e){let t=this.allSubtypes[e];if(t)return t;{let r=this.getAllTypes(),n=[];for(let i of r)this.isSubtype(i,e)&&n.push(i);return this.allSubtypes[e]=n,n}}};_(Z0,"isCompositeCstNode");_(f2,"isLeafCstNode");_(CN,"isRootCstNode");dd=class U0{static{_(this,"StreamImpl")}constructor(t,r){this.startFn=t,this.nextFn=r}iterator(){let t={state:this.startFn(),next:_(()=>this.nextFn(t.state),"next"),[Symbol.iterator]:()=>t};return t}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let t=this.iterator(),r=0,n=t.next();for(;!n.done;)r++,n=t.next();return r}toArray(){let t=[],r=this.iterator(),n;do n=r.next(),n.value!==void 0&&t.push(n.value);while(!n.done);return t}toSet(){return new Set(this)}toMap(t,r){let n=this.map(i=>[t?t(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(t){return new U0(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),r=>{let n;if(!r.firstDone){do if(n=this.nextFn(r.first),!n.done)return n;while(!n.done);r.firstDone=!0}do if(n=r.iterator.next(),!n.done)return n;while(!n.done);return Al})}join(t=","){let r=this.iterator(),n="",i,a=!1;do i=r.next(),i.done||(a&&(n+=t),n+=ABe(i.value)),a=!0;while(!i.done);return n}indexOf(t,r=0){let n=this.iterator(),i=0,a=n.next();for(;!a.done;){if(i>=r&&a.value===t)return i;a=n.next(),i++}return-1}every(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(!t(n.value))return!1;n=r.next()}return!0}some(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(t(n.value))return!0;n=r.next()}return!1}forEach(t){let r=this.iterator(),n=0,i=r.next();for(;!i.done;)t(i.value,n),i=r.next(),n++}map(t){return new U0(this.startFn,r=>{let{done:n,value:i}=this.nextFn(r);return n?Al:{done:!1,value:t(i)}})}filter(t){return new U0(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&t(n.value))return n;while(!n.done);return Al})}nonNullable(){return this.filter(t=>t!=null)}reduce(t,r){let n=this.iterator(),i=r,a=n.next();for(;!a.done;)i===void 0?i=a.value:i=t(i,a.value),a=n.next();return i}reduceRight(t,r){return this.recursiveReduce(this.iterator(),t,r)}recursiveReduce(t,r,n){let i=t.next();if(i.done)return n;let a=this.recursiveReduce(t,r,n);return a===void 0?i.value:r(a,i.value)}find(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(t(n.value))return n.value;n=r.next()}}findIndex(t){let r=this.iterator(),n=0,i=r.next();for(;!i.done;){if(t(i.value))return n;i=r.next(),n++}return-1}includes(t){let r=this.iterator(),n=r.next();for(;!n.done;){if(n.value===t)return!0;n=r.next()}return!1}flatMap(t){return new U0(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}let{done:n,value:i}=this.nextFn(r.this);if(!n){let a=t(i);if(GS(a))r.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}}while(r.iterator);return Al})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let r=t>1?this.flat(t-1):this;return new U0(()=>({this:r.startFn()}),n=>{do{if(n.iterator){let s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}let{done:i,value:a}=r.nextFn(n.this);if(!i)if(GS(a))n.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}while(n.iterator);return Al})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(t=1){return new U0(()=>{let r=this.startFn();for(let n=0;n({size:0,state:this.startFn()}),r=>(r.size++,r.size>t?Al:this.nextFn(r.state)))}distinct(t){return new U0(()=>({set:new Set,internalState:this.startFn()}),r=>{let n;do if(n=this.nextFn(r.internalState),!n.done){let i=t?t(n.value):n.value;if(!r.set.has(i))return r.set.add(i),n}while(!n.done);return Al})}exclude(t,r){let n=new Set;for(let i of t){let a=r?r(i):i;n.add(a)}return this.filter(i=>{let a=r?r(i):i;return!n.has(a)})}};_(ABe,"toString");_(GS,"isIterable");Iw=new dd(()=>{},()=>Al),Al=Object.freeze({done:!0,value:void 0});_(ki,"stream");Mw=class extends dd{static{_(this,"TreeStreamImpl")}constructor(e,t,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),n=>{for(n.pruned&&(n.iterators.pop(),n.pruned=!1);n.iterators.length>0;){let a=n.iterators[n.iterators.length-1].next();if(a.done)n.iterators.pop();else return n.iterators.push(t(a.value)[Symbol.iterator]()),a}return Al})}iterator(){let e={state:this.startFn(),next:_(()=>this.nextFn(e.state),"next"),prune:_(()=>{e.state.pruned=!0},"prune"),[Symbol.iterator]:()=>e};return e}};(function(e){function t(a){return a.reduce((s,o)=>s+o,0)}_(t,"sum"),e.sum=t;function r(a){return a.reduce((s,o)=>s*o,0)}_(r,"product"),e.product=r;function n(a){return a.reduce((s,o)=>Math.min(s,o))}_(n,"min"),e.min=n;function i(a){return a.reduce((s,o)=>Math.max(s,o))}_(i,"max"),e.max=i})(qS||(qS={}));ate={};Hg(ate,{assignMandatoryProperties:()=>ste,copyAstNode:()=>OM,findRootNode:()=>Aw,getContainerOfType:()=>d2,getDocument:()=>Mh,getReferenceNodes:()=>NM,hasContainerOfType:()=>_Be,linkContentToContainer:()=>Nw,streamAllContents:()=>op,streamAst:()=>Nh,streamContents:()=>o6,streamReferences:()=>Dw});_(Nw,"linkContentToContainer");_(d2,"getContainerOfType");_(_Be,"hasContainerOfType");_(Mh,"getDocument");_(Aw,"findRootNode");_(NM,"getReferenceNodes");_(o6,"streamContents");_(op,"streamAllContents");_(Nh,"streamAst");_(DM,"isAstNodeInRange");_(Dw,"streamReferences");_(ste,"assignMandatoryProperties");_(ote,"copyDefaultValue");_(OM,"copyAstNode");RBe={};Hg(RBe,{AbstractElement:()=>cc,AbstractParserRule:()=>TS,AbstractRule:()=>yw,AbstractType:()=>Yc,Action:()=>Mg,Alternatives:()=>CS,ArrayLiteral:()=>PM,ArrayType:()=>BM,Assignment:()=>Ng,BooleanLiteral:()=>FM,CharacterRange:()=>Dg,Condition:()=>Og,Conjunction:()=>SS,CrossReference:()=>Pg,Disjunction:()=>ES,EndOfFile:()=>$M,Grammar:()=>X0,GrammarImport:()=>zM,Group:()=>Ov,InferredType:()=>GM,InfixRule:()=>ud,InfixRuleOperatorList:()=>AS,InfixRuleOperators:()=>qM,Interface:()=>vw,Keyword:()=>xw,LangiumGrammarAstReflection:()=>Ete,LangiumGrammarTerminals:()=>COt,NamedArgument:()=>bw,NegatedToken:()=>Pv,Negation:()=>VM,NumberLiteral:()=>WM,Parameter:()=>ww,ParameterReference:()=>HM,ParserRule:()=>_h,ReferenceType:()=>_S,RegexToken:()=>Bv,ReturnType:()=>UM,RuleCall:()=>Fv,SimpleType:()=>kw,StringLiteral:()=>YM,TerminalAlternatives:()=>$v,TerminalElement:()=>uc,TerminalGroup:()=>zv,TerminalRule:()=>j0,TerminalRuleCall:()=>Gv,Type:()=>RS,TypeAttribute:()=>qv,TypeDefinition:()=>Vv,UnionType:()=>XM,UnorderedGroup:()=>LS,UntilToken:()=>Wv,ValueLiteral:()=>Hv,Wildcard:()=>Tw,isAbstractElement:()=>SN,isAbstractParserRule:()=>p2,isAbstractRule:()=>LBe,isAbstractType:()=>IBe,isAction:()=>zg,isAlternatives:()=>EN,isArrayLiteral:()=>MBe,isArrayType:()=>lte,isAssignment:()=>Q0,isBooleanLiteral:()=>cte,isCharacterRange:()=>ute,isCondition:()=>NBe,isConjunction:()=>hte,isCrossReference:()=>m2,isDisjunction:()=>fte,isEndOfFile:()=>dte,isGrammar:()=>DBe,isGrammarImport:()=>OBe,isGroup:()=>g2,isInferredType:()=>l6,isInfixRule:()=>Ow,isInfixRuleOperatorList:()=>PBe,isInfixRuleOperators:()=>BBe,isInterface:()=>pte,isKeyword:()=>J0,isNamedArgument:()=>FBe,isNegatedToken:()=>mte,isNegation:()=>gte,isNumberLiteral:()=>$Be,isParameter:()=>zBe,isParameterReference:()=>yte,isParserRule:()=>Il,isReferenceType:()=>vte,isRegexToken:()=>xte,isReturnType:()=>bte,isRuleCall:()=>ep,isSimpleType:()=>AN,isStringLiteral:()=>GBe,isTerminalAlternatives:()=>wte,isTerminalElement:()=>qBe,isTerminalGroup:()=>kte,isTerminalRule:()=>Hu,isTerminalRuleCall:()=>_N,isType:()=>RN,isTypeAttribute:()=>VBe,isTypeDefinition:()=>WBe,isUnionType:()=>Tte,isUnorderedGroup:()=>LN,isUntilToken:()=>Cte,isValueLiteral:()=>HBe,isWildcard:()=>Ste,reflection:()=>Gr});COt={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},cc={$type:"AbstractElement",cardinality:"cardinality"};_(SN,"isAbstractElement");TS={$type:"AbstractParserRule"};_(p2,"isAbstractParserRule");yw={$type:"AbstractRule"};_(LBe,"isAbstractRule");Yc={$type:"AbstractType"};_(IBe,"isAbstractType");Mg={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};_(zg,"isAction");CS={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};_(EN,"isAlternatives");PM={$type:"ArrayLiteral",elements:"elements"};_(MBe,"isArrayLiteral");BM={$type:"ArrayType",elementType:"elementType"};_(lte,"isArrayType");Ng={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};_(Q0,"isAssignment");FM={$type:"BooleanLiteral",true:"true"};_(cte,"isBooleanLiteral");Dg={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};_(ute,"isCharacterRange");Og={$type:"Condition"};_(NBe,"isCondition");SS={$type:"Conjunction",left:"left",right:"right"};_(hte,"isConjunction");Pg={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};_(m2,"isCrossReference");ES={$type:"Disjunction",left:"left",right:"right"};_(fte,"isDisjunction");$M={$type:"EndOfFile",cardinality:"cardinality"};_(dte,"isEndOfFile");X0={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"};_(DBe,"isGrammar");zM={$type:"GrammarImport",path:"path"};_(OBe,"isGrammarImport");Ov={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};_(g2,"isGroup");GM={$type:"InferredType",name:"name"};_(l6,"isInferredType");ud={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};_(Ow,"isInfixRule");AS={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"};_(PBe,"isInfixRuleOperatorList");qM={$type:"InfixRuleOperators",precedences:"precedences"};_(BBe,"isInfixRuleOperators");vw={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};_(pte,"isInterface");xw={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};_(J0,"isKeyword");bw={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"};_(FBe,"isNamedArgument");Pv={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};_(mte,"isNegatedToken");VM={$type:"Negation",value:"value"};_(gte,"isNegation");WM={$type:"NumberLiteral",value:"value"};_($Be,"isNumberLiteral");ww={$type:"Parameter",name:"name"};_(zBe,"isParameter");HM={$type:"ParameterReference",parameter:"parameter"};_(yte,"isParameterReference");_h={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};_(Il,"isParserRule");_S={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"};_(vte,"isReferenceType");Bv={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};_(xte,"isRegexToken");UM={$type:"ReturnType",name:"name"};_(bte,"isReturnType");Fv={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};_(ep,"isRuleCall");kw={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};_(AN,"isSimpleType");YM={$type:"StringLiteral",value:"value"};_(GBe,"isStringLiteral");$v={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};_(wte,"isTerminalAlternatives");uc={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};_(qBe,"isTerminalElement");zv={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};_(kte,"isTerminalGroup");j0={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};_(Hu,"isTerminalRule");Gv={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};_(_N,"isTerminalRuleCall");RS={$type:"Type",name:"name",type:"type"};_(RN,"isType");qv={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"};_(VBe,"isTypeAttribute");Vv={$type:"TypeDefinition"};_(WBe,"isTypeDefinition");XM={$type:"UnionType",types:"types"};_(Tte,"isUnionType");LS={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};_(LN,"isUnorderedGroup");Wv={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};_(Cte,"isUntilToken");Hv={$type:"ValueLiteral"};_(HBe,"isValueLiteral");Tw={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};_(Ste,"isWildcard");Ete=class extends ite{static{_(this,"LangiumGrammarAstReflection")}constructor(){super(...arguments),this.types={AbstractElement:{name:cc.$type,properties:{cardinality:{name:cc.cardinality}},superTypes:[]},AbstractParserRule:{name:TS.$type,properties:{},superTypes:[yw.$type,Yc.$type]},AbstractRule:{name:yw.$type,properties:{},superTypes:[]},AbstractType:{name:Yc.$type,properties:{},superTypes:[]},Action:{name:Mg.$type,properties:{cardinality:{name:Mg.cardinality},feature:{name:Mg.feature},inferredType:{name:Mg.inferredType},operator:{name:Mg.operator},type:{name:Mg.type,referenceType:Yc.$type}},superTypes:[cc.$type]},Alternatives:{name:CS.$type,properties:{cardinality:{name:CS.cardinality},elements:{name:CS.elements,defaultValue:[]}},superTypes:[cc.$type]},ArrayLiteral:{name:PM.$type,properties:{elements:{name:PM.elements,defaultValue:[]}},superTypes:[Hv.$type]},ArrayType:{name:BM.$type,properties:{elementType:{name:BM.elementType}},superTypes:[Vv.$type]},Assignment:{name:Ng.$type,properties:{cardinality:{name:Ng.cardinality},feature:{name:Ng.feature},operator:{name:Ng.operator},predicate:{name:Ng.predicate},terminal:{name:Ng.terminal}},superTypes:[cc.$type]},BooleanLiteral:{name:FM.$type,properties:{true:{name:FM.true,defaultValue:!1}},superTypes:[Og.$type,Hv.$type]},CharacterRange:{name:Dg.$type,properties:{cardinality:{name:Dg.cardinality},left:{name:Dg.left},lookahead:{name:Dg.lookahead},parenthesized:{name:Dg.parenthesized,defaultValue:!1},right:{name:Dg.right}},superTypes:[uc.$type]},Condition:{name:Og.$type,properties:{},superTypes:[]},Conjunction:{name:SS.$type,properties:{left:{name:SS.left},right:{name:SS.right}},superTypes:[Og.$type]},CrossReference:{name:Pg.$type,properties:{cardinality:{name:Pg.cardinality},deprecatedSyntax:{name:Pg.deprecatedSyntax,defaultValue:!1},isMulti:{name:Pg.isMulti,defaultValue:!1},terminal:{name:Pg.terminal},type:{name:Pg.type,referenceType:Yc.$type}},superTypes:[cc.$type]},Disjunction:{name:ES.$type,properties:{left:{name:ES.left},right:{name:ES.right}},superTypes:[Og.$type]},EndOfFile:{name:$M.$type,properties:{cardinality:{name:$M.cardinality}},superTypes:[cc.$type]},Grammar:{name:X0.$type,properties:{imports:{name:X0.imports,defaultValue:[]},interfaces:{name:X0.interfaces,defaultValue:[]},isDeclared:{name:X0.isDeclared,defaultValue:!1},name:{name:X0.name},rules:{name:X0.rules,defaultValue:[]},types:{name:X0.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:zM.$type,properties:{path:{name:zM.path}},superTypes:[]},Group:{name:Ov.$type,properties:{cardinality:{name:Ov.cardinality},elements:{name:Ov.elements,defaultValue:[]},guardCondition:{name:Ov.guardCondition},predicate:{name:Ov.predicate}},superTypes:[cc.$type]},InferredType:{name:GM.$type,properties:{name:{name:GM.name}},superTypes:[Yc.$type]},InfixRule:{name:ud.$type,properties:{call:{name:ud.call},dataType:{name:ud.dataType},inferredType:{name:ud.inferredType},name:{name:ud.name},operators:{name:ud.operators},parameters:{name:ud.parameters,defaultValue:[]},returnType:{name:ud.returnType,referenceType:Yc.$type}},superTypes:[TS.$type]},InfixRuleOperatorList:{name:AS.$type,properties:{associativity:{name:AS.associativity},operators:{name:AS.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:qM.$type,properties:{precedences:{name:qM.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:vw.$type,properties:{attributes:{name:vw.attributes,defaultValue:[]},name:{name:vw.name},superTypes:{name:vw.superTypes,defaultValue:[],referenceType:Yc.$type}},superTypes:[Yc.$type]},Keyword:{name:xw.$type,properties:{cardinality:{name:xw.cardinality},predicate:{name:xw.predicate},value:{name:xw.value}},superTypes:[cc.$type]},NamedArgument:{name:bw.$type,properties:{calledByName:{name:bw.calledByName,defaultValue:!1},parameter:{name:bw.parameter,referenceType:ww.$type},value:{name:bw.value}},superTypes:[]},NegatedToken:{name:Pv.$type,properties:{cardinality:{name:Pv.cardinality},lookahead:{name:Pv.lookahead},parenthesized:{name:Pv.parenthesized,defaultValue:!1},terminal:{name:Pv.terminal}},superTypes:[uc.$type]},Negation:{name:VM.$type,properties:{value:{name:VM.value}},superTypes:[Og.$type]},NumberLiteral:{name:WM.$type,properties:{value:{name:WM.value}},superTypes:[Hv.$type]},Parameter:{name:ww.$type,properties:{name:{name:ww.name}},superTypes:[]},ParameterReference:{name:HM.$type,properties:{parameter:{name:HM.parameter,referenceType:ww.$type}},superTypes:[Og.$type]},ParserRule:{name:_h.$type,properties:{dataType:{name:_h.dataType},definition:{name:_h.definition},entry:{name:_h.entry,defaultValue:!1},fragment:{name:_h.fragment,defaultValue:!1},inferredType:{name:_h.inferredType},name:{name:_h.name},parameters:{name:_h.parameters,defaultValue:[]},returnType:{name:_h.returnType,referenceType:Yc.$type}},superTypes:[TS.$type]},ReferenceType:{name:_S.$type,properties:{isMulti:{name:_S.isMulti,defaultValue:!1},referenceType:{name:_S.referenceType}},superTypes:[Vv.$type]},RegexToken:{name:Bv.$type,properties:{cardinality:{name:Bv.cardinality},lookahead:{name:Bv.lookahead},parenthesized:{name:Bv.parenthesized,defaultValue:!1},regex:{name:Bv.regex}},superTypes:[uc.$type]},ReturnType:{name:UM.$type,properties:{name:{name:UM.name}},superTypes:[]},RuleCall:{name:Fv.$type,properties:{arguments:{name:Fv.arguments,defaultValue:[]},cardinality:{name:Fv.cardinality},predicate:{name:Fv.predicate},rule:{name:Fv.rule,referenceType:yw.$type}},superTypes:[cc.$type]},SimpleType:{name:kw.$type,properties:{primitiveType:{name:kw.primitiveType},stringType:{name:kw.stringType},typeRef:{name:kw.typeRef,referenceType:Yc.$type}},superTypes:[Vv.$type]},StringLiteral:{name:YM.$type,properties:{value:{name:YM.value}},superTypes:[Hv.$type]},TerminalAlternatives:{name:$v.$type,properties:{cardinality:{name:$v.cardinality},elements:{name:$v.elements,defaultValue:[]},lookahead:{name:$v.lookahead},parenthesized:{name:$v.parenthesized,defaultValue:!1}},superTypes:[uc.$type]},TerminalElement:{name:uc.$type,properties:{cardinality:{name:uc.cardinality},lookahead:{name:uc.lookahead},parenthesized:{name:uc.parenthesized,defaultValue:!1}},superTypes:[cc.$type]},TerminalGroup:{name:zv.$type,properties:{cardinality:{name:zv.cardinality},elements:{name:zv.elements,defaultValue:[]},lookahead:{name:zv.lookahead},parenthesized:{name:zv.parenthesized,defaultValue:!1}},superTypes:[uc.$type]},TerminalRule:{name:j0.$type,properties:{definition:{name:j0.definition},fragment:{name:j0.fragment,defaultValue:!1},hidden:{name:j0.hidden,defaultValue:!1},name:{name:j0.name},type:{name:j0.type}},superTypes:[yw.$type]},TerminalRuleCall:{name:Gv.$type,properties:{cardinality:{name:Gv.cardinality},lookahead:{name:Gv.lookahead},parenthesized:{name:Gv.parenthesized,defaultValue:!1},rule:{name:Gv.rule,referenceType:j0.$type}},superTypes:[uc.$type]},Type:{name:RS.$type,properties:{name:{name:RS.name},type:{name:RS.type}},superTypes:[Yc.$type]},TypeAttribute:{name:qv.$type,properties:{defaultValue:{name:qv.defaultValue},isOptional:{name:qv.isOptional,defaultValue:!1},name:{name:qv.name},type:{name:qv.type}},superTypes:[]},TypeDefinition:{name:Vv.$type,properties:{},superTypes:[]},UnionType:{name:XM.$type,properties:{types:{name:XM.types,defaultValue:[]}},superTypes:[Vv.$type]},UnorderedGroup:{name:LS.$type,properties:{cardinality:{name:LS.cardinality},elements:{name:LS.elements,defaultValue:[]}},superTypes:[cc.$type]},UntilToken:{name:Wv.$type,properties:{cardinality:{name:Wv.cardinality},lookahead:{name:Wv.lookahead},parenthesized:{name:Wv.parenthesized,defaultValue:!1},terminal:{name:Wv.terminal}},superTypes:[uc.$type]},ValueLiteral:{name:Hv.$type,properties:{},superTypes:[]},Wildcard:{name:Tw.$type,properties:{cardinality:{name:Tw.cardinality},lookahead:{name:Tw.lookahead},parenthesized:{name:Tw.parenthesized,defaultValue:!1}},superTypes:[uc.$type]}}}},Gr=new Ete;_(UBe,"getDatatypeNode");_(Pw,"streamCst");_(YBe,"flattenCst");_(Ate,"isChildNode");_(VS,"tokenToRange");_(Bw,"toDocumentSegment");(function(e){e[e.Before=0]="Before",e[e.After=1]="After",e[e.OverlapFront=2]="OverlapFront",e[e.OverlapBack=3]="OverlapBack",e[e.Inside=4]="Inside",e[e.Outside=5]="Outside"})(fd||(fd={}));_(_te,"compareRange");_(Rte,"inRange");Lte=/^[\w\p{L}]$/u;_(XBe,"findDeclarationNodeAtOffset");_(Ite,"findCommentNode");_(jM,"isCommentNode");_(IN,"findLeafNodeAtOffset");_(Mte,"findLeafNodeBeforeOffset");_(Nte,"binarySearch");_(Dte,"getPreviousNode");_(jBe,"getNextNode");_(KBe,"getStartlineNode");_(ZBe,"getInteriorNodes");_(QBe,"getCommonParent");_(wJ,"getParentChain");Ote={};Hg(Ote,{findAssignment:()=>Xte,findNameAssignment:()=>$N,findNodeForKeyword:()=>Yte,findNodeForProperty:()=>PN,findNodesForKeyword:()=>aFe,findNodesForKeywordInternal:()=>FN,findNodesForProperty:()=>Ute,getActionAtElement:()=>Kte,getActionType:()=>Qte,getAllReachableRules:()=>ON,getAllRulesUsedForCrossReferences:()=>iFe,getCrossReferenceTerminal:()=>Wte,getEntryRule:()=>Gte,getExplicitRuleType:()=>u6,getHiddenRules:()=>qte,getRuleType:()=>Jte,getRuleTypeName:()=>uFe,getTypeName:()=>o2,isArrayCardinality:()=>oFe,isArrayOperator:()=>lFe,isCommentTerminal:()=>Hte,isDataType:()=>cFe,isDataTypeRule:()=>c6,isOptionalCardinality:()=>sFe,terminalRegex:()=>h6});MN=class extends Error{static{_(this,"ErrorWithLocation")}constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};_(Ug,"assertUnreachable");_(Pte,"assertCondition");Bte={};Hg(Bte,{NEWLINE_REGEXP:()=>eFe,escapeRegExp:()=>Ww,getTerminalParts:()=>rFe,isMultilineComment:()=>Fte,isWhitespace:()=>DN,partialMatches:()=>$te,partialRegExp:()=>zte,whitespaceCharacters:()=>nFe});_(rn,"cc");_(hM,"insertToSet");_(fw,"addFlag");_(Ev,"ASSERT_EXISTS");_(vS,"ASSERT_NEVER_REACH_HERE");_(kJ,"isCharacter");KM=[];for(let e=rn("0");e<=rn("9");e++)KM.push(e);ZM=[rn("_")].concat(KM);for(let e=rn("a");e<=rn("z");e++)ZM.push(e);for(let e=rn("A");e<=rn("Z");e++)ZM.push(e);_Oe=[rn(" "),rn("\f"),rn(` +`),rn("\r"),rn(" "),rn("\v"),rn(" "),rn("\xA0"),rn("\u1680"),rn("\u2000"),rn("\u2001"),rn("\u2002"),rn("\u2003"),rn("\u2004"),rn("\u2005"),rn("\u2006"),rn("\u2007"),rn("\u2008"),rn("\u2009"),rn("\u200A"),rn("\u2028"),rn("\u2029"),rn("\u202F"),rn("\u205F"),rn("\u3000"),rn("\uFEFF")],SOt=/[0-9a-fA-F]/,$I=/[0-9]/,EOt=/[1-9]/,JBe=class{static{_(this,"RegExpParser")}constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":fw(r,"global");break;case"i":fw(r,"ignoreCase");break;case"m":fw(r,"multiLine");break;case"u":fw(r,"unicode");break;case"y":fw(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}Ev(t);let r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return vS()}quantifier(e=!1){let t,r=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let n=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:n,atMost:n};break;case",":let i;this.isDigit()?(i=this.integerIncludingZero(),t={atLeast:n,atMost:i}):t={atLeast:n,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Ev(t);break}if(!(e===!0&&t===void 0)&&Ev(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Ev(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):vS()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[rn(` +`),rn("\r"),rn("\u2028"),rn("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=KM;break;case"D":e=KM,t=!0;break;case"s":e=_Oe;break;case"S":e=_Oe,t=!0;break;case"w":e=ZM;break;case"W":e=ZM,t=!0;break}return Ev(e)?{type:"Set",value:e,complement:t}:vS()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=rn("\f");break;case"n":e=rn(` `);break;case"r":e=rn("\r");break;case"t":e=rn(" ");break;case"v":e=rn("\v");break}return Ev(e)?{type:"Character",value:e}:vS()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:rn("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:rn(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case` -`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:rn(e)}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let r=this.classAtom(),n=r.type==="Character";if(bJ(r)&&this.isRangeDash()){this.consumeChar("-");let i=this.classAtom(),a=i.type==="Character";if(bJ(i)){if(i.value=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}},NN=class{static{_(this,"BaseRegExpVisitor")}visitChildren(e){for(let t in e){let r=e[t];e.hasOwnProperty(t)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(n=>{this.visit(n)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},QBe=/\r?\n/gm,JBe=new ZBe,TOt=class extends NN{static{_(this,"TerminalRegExpVisitor")}constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===` +`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let n=0;n=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}},NN=class{static{_(this,"BaseRegExpVisitor")}visitChildren(e){for(let t in e){let r=e[t];e.hasOwnProperty(t)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(n=>{this.visit(n)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},eFe=/\r?\n/gm,tFe=new JBe,AOt=class extends NN{static{_(this,"TerminalRegExpVisitor")}constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===` `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let r=Ww(t);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(t);this.multiline=!!` -`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},t2=new TOt;_(eFe,"getTerminalParts");_(Pte,"isMultilineComment");tFe=`\f -\r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");_(DN,"isWhitespace");_(Ww,"escapeRegExp");_(Bte,"partialMatches");_(Fte,"partialRegExp");_($te,"getEntryRule");_(zte,"getHiddenRules");_(ON,"getAllReachableRules");_(Gte,"ruleDfs");_(rFe,"getAllRulesUsedForCrossReferences");_(qte,"getCrossReferenceTerminal");_(Vte,"isCommentTerminal");_(Wte,"findNodesForProperty");_(PN,"findNodeForProperty");_(BN,"findNodesForPropertyInternal");_(nFe,"findNodesForKeyword");_(Hte,"findNodeForKeyword");_(FN,"findNodesForKeywordInternal");_(Ute,"findAssignment");_($N,"findNameAssignment");_(Yte,"findNameAssignmentInternal");_(Xte,"getActionAtElement");_(iFe,"isOptionalCardinality");_(aFe,"isArrayCardinality");_(sFe,"isArrayOperator");_(c6,"isDataTypeRule");_(jte,"isDataTypeRuleInternal");_(oFe,"isDataType");_(QM,"isDataTypeInternal");_(u6,"getExplicitRuleType");_(o2,"getTypeName");_(Kte,"getActionType");_(lFe,"getRuleTypeName");_(Zte,"getRuleType");_(h6,"terminalRegex");Qte=/[\s\S]/.source;_(y2,"abstractElementToRegex");_(cFe,"terminalAlternativesToRegex");_(uFe,"terminalGroupToRegex");_(hFe,"untilTokenToRegex");_(fFe,"negateTokenToRegex");_(dFe,"characterRangeToRegex");_(fM,"keywordToRegex");_(gd,"withCardinality");_(Jte,"createGrammarConfig");COt=typeof global=="object"&&global&&global.Object===Object&&global,pFe=COt,SOt=typeof self=="object"&&self&&self.Object===Object&&self,EOt=pFe||SOt||Function("return this")(),vd=EOt,AOt=vd.Symbol,Vu=AOt,mFe=Object.prototype,_Ot=mFe.hasOwnProperty,ROt=mFe.toString,nS=Vu?Vu.toStringTag:void 0;_(gFe,"getRawTag");LOt=gFe,IOt=Object.prototype,MOt=IOt.toString;_(yFe,"objectToString");NOt=yFe,DOt="[object Null]",OOt="[object Undefined]",AOe=Vu?Vu.toStringTag:void 0;_(vFe,"baseGetTag");Yg=vFe;_(xFe,"isObjectLike");Ph=xFe,POt="[object Symbol]";_(bFe,"isSymbol");zN=bFe;_(wFe,"arrayMap");f6=wFe,BOt=Array.isArray,Un=BOt,FOt=1/0,_Oe=Vu?Vu.prototype:void 0,ROe=_Oe?_Oe.toString:void 0;_(ere,"baseToString");$Ot=ere,zOt=/\s/;_(kFe,"trimmedEndIndex");GOt=kFe,qOt=/^\s+/;_(TFe,"baseTrim");VOt=TFe;_(CFe,"isObject");Wu=CFe,LOe=NaN,WOt=/^[-+]0x[0-9a-f]+$/i,HOt=/^0b[01]+$/i,UOt=/^0o[0-7]+$/i,YOt=parseInt;_(SFe,"toNumber");XOt=SFe,IOe=1/0,jOt=17976931348623157e292;_(EFe,"toFinite");KOt=EFe;_(AFe,"toInteger");d6=AFe;_(_Fe,"identity");p6=_Fe,ZOt="[object AsyncFunction]",QOt="[object Function]",JOt="[object GeneratorFunction]",ePt="[object Proxy]";_(RFe,"isFunction");lp=RFe,tPt=vd["__core-js_shared__"],ZZ=tPt,MOe=(function(){var e=/[^.]+$/.exec(ZZ&&ZZ.keys&&ZZ.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();_(LFe,"isMasked");rPt=LFe,nPt=Function.prototype,iPt=nPt.toString;_(IFe,"toSource");v2=IFe,aPt=/[\\^$.*+?()[\]{}|]/g,sPt=/^\[object .+?Constructor\]$/,oPt=Function.prototype,lPt=Object.prototype,cPt=oPt.toString,uPt=lPt.hasOwnProperty,hPt=RegExp("^"+cPt.call(uPt).replace(aPt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");_(MFe,"baseIsNative");fPt=MFe;_(NFe,"getValue");dPt=NFe;_(DFe,"getNative");x2=DFe,pPt=x2(vd,"WeakMap"),wJ=pPt,NOe=Object.create,mPt=(function(){function e(){}return _(e,"object"),function(t){if(!Wu(t))return{};if(NOe)return NOe(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),gPt=mPt;_(OFe,"apply");yPt=OFe;_(PFe,"noop");Hs=PFe;_(BFe,"copyArray");vPt=BFe,xPt=800,bPt=16,wPt=Date.now;_(FFe,"shortOut");kPt=FFe;_($Fe,"constant");TPt=$Fe,CPt=(function(){try{var e=x2(Object,"defineProperty");return e({},"",{}),e}catch{}})(),JM=CPt,SPt=JM?function(e,t){return JM(e,"toString",{configurable:!0,enumerable:!1,value:TPt(t),writable:!0})}:p6,EPt=SPt,APt=kPt(EPt),_Pt=APt;_(zFe,"arrayEach");GFe=zFe;_(qFe,"baseFindIndex");VFe=qFe;_(WFe,"baseIsNaN");RPt=WFe;_(HFe,"strictIndexOf");LPt=HFe;_(UFe,"baseIndexOf");tre=UFe;_(YFe,"arrayIncludes");XFe=YFe,IPt=9007199254740991,MPt=/^(?:0|[1-9]\d*)$/;_(jFe,"isIndex");GN=jFe;_(KFe,"baseAssignValue");rre=KFe;_(ZFe,"eq");m6=ZFe,NPt=Object.prototype,DPt=NPt.hasOwnProperty;_(QFe,"assignValue");qN=QFe;_(JFe,"copyObject");g6=JFe,DOe=Math.max;_(e$e,"overRest");OPt=e$e;_(t$e,"baseRest");nre=t$e,PPt=9007199254740991;_(r$e,"isLength");ire=r$e;_(n$e,"isArrayLike");xd=n$e;_(i$e,"isIterateeCall");VN=i$e;_(a$e,"createAssigner");BPt=a$e,FPt=Object.prototype;_(s$e,"isPrototype");y6=s$e;_(o$e,"baseTimes");$Pt=o$e,zPt="[object Arguments]";_(l$e,"baseIsArguments");OOe=l$e,c$e=Object.prototype,GPt=c$e.hasOwnProperty,qPt=c$e.propertyIsEnumerable,VPt=OOe((function(){return arguments})())?OOe:function(e){return Ph(e)&&GPt.call(e,"callee")&&!qPt.call(e,"callee")},WN=VPt;_(u$e,"stubFalse");WPt=u$e,h$e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,POe=h$e&&typeof module=="object"&&module&&!module.nodeType&&module,HPt=POe&&POe.exports===h$e,BOe=HPt?vd.Buffer:void 0,UPt=BOe?BOe.isBuffer:void 0,YPt=UPt||WPt,WS=YPt,XPt="[object Arguments]",jPt="[object Array]",KPt="[object Boolean]",ZPt="[object Date]",QPt="[object Error]",JPt="[object Function]",eBt="[object Map]",tBt="[object Number]",rBt="[object Object]",nBt="[object RegExp]",iBt="[object Set]",aBt="[object String]",sBt="[object WeakMap]",oBt="[object ArrayBuffer]",lBt="[object DataView]",cBt="[object Float32Array]",uBt="[object Float64Array]",hBt="[object Int8Array]",fBt="[object Int16Array]",dBt="[object Int32Array]",pBt="[object Uint8Array]",mBt="[object Uint8ClampedArray]",gBt="[object Uint16Array]",yBt="[object Uint32Array]",Ki={};Ki[cBt]=Ki[uBt]=Ki[hBt]=Ki[fBt]=Ki[dBt]=Ki[pBt]=Ki[mBt]=Ki[gBt]=Ki[yBt]=!0;Ki[XPt]=Ki[jPt]=Ki[oBt]=Ki[KPt]=Ki[lBt]=Ki[ZPt]=Ki[QPt]=Ki[JPt]=Ki[eBt]=Ki[tBt]=Ki[rBt]=Ki[nBt]=Ki[iBt]=Ki[aBt]=Ki[sBt]=!1;_(f$e,"baseIsTypedArray");vBt=f$e;_(d$e,"baseUnary");v6=d$e,p$e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,IS=p$e&&typeof module=="object"&&module&&!module.nodeType&&module,xBt=IS&&IS.exports===p$e,QZ=xBt&&pFe.process,bBt=(function(){try{var e=IS&&IS.require&&IS.require("util").types;return e||QZ&&QZ.binding&&QZ.binding("util")}catch{}})(),Gg=bBt,FOe=Gg&&Gg.isTypedArray,wBt=FOe?v6(FOe):vBt,are=wBt,kBt=Object.prototype,TBt=kBt.hasOwnProperty;_(m$e,"arrayLikeKeys");g$e=m$e;_(y$e,"overArg");v$e=y$e,CBt=v$e(Object.keys,Object),SBt=CBt,EBt=Object.prototype,ABt=EBt.hasOwnProperty;_(x$e,"baseKeys");b$e=x$e;_(w$e,"keys");jc=w$e,_Bt=Object.prototype,RBt=_Bt.hasOwnProperty,LBt=BPt(function(e,t){if(y6(t)||xd(t)){g6(t,jc(t),e);return}for(var r in t)RBt.call(t,r)&&qN(e,r,t[r])}),Kc=LBt;_(k$e,"nativeKeysIn");IBt=k$e,MBt=Object.prototype,NBt=MBt.hasOwnProperty;_(T$e,"baseKeysIn");DBt=T$e;_(C$e,"keysIn");HN=C$e,OBt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,PBt=/^\w*$/;_(S$e,"isKey");sre=S$e,BBt=x2(Object,"create"),HS=BBt;_(E$e,"hashClear");FBt=E$e;_(A$e,"hashDelete");$Bt=A$e,zBt="__lodash_hash_undefined__",GBt=Object.prototype,qBt=GBt.hasOwnProperty;_(_$e,"hashGet");VBt=_$e,WBt=Object.prototype,HBt=WBt.hasOwnProperty;_(R$e,"hashHas");UBt=R$e,YBt="__lodash_hash_undefined__";_(L$e,"hashSet");XBt=L$e;_(b2,"Hash");b2.prototype.clear=FBt;b2.prototype.delete=$Bt;b2.prototype.get=VBt;b2.prototype.has=UBt;b2.prototype.set=XBt;$Oe=b2;_(I$e,"listCacheClear");jBt=I$e;_(M$e,"assocIndexOf");UN=M$e,KBt=Array.prototype,ZBt=KBt.splice;_(N$e,"listCacheDelete");QBt=N$e;_(D$e,"listCacheGet");JBt=D$e;_(O$e,"listCacheHas");eFt=O$e;_(P$e,"listCacheSet");tFt=P$e;_(w2,"ListCache");w2.prototype.clear=jBt;w2.prototype.delete=QBt;w2.prototype.get=JBt;w2.prototype.has=eFt;w2.prototype.set=tFt;YN=w2,rFt=x2(vd,"Map"),US=rFt;_(B$e,"mapCacheClear");nFt=B$e;_(F$e,"isKeyable");iFt=F$e;_($$e,"getMapData");XN=$$e;_(z$e,"mapCacheDelete");aFt=z$e;_(G$e,"mapCacheGet");sFt=G$e;_(q$e,"mapCacheHas");oFt=q$e;_(V$e,"mapCacheSet");lFt=V$e;_(k2,"MapCache");k2.prototype.clear=nFt;k2.prototype.delete=aFt;k2.prototype.get=sFt;k2.prototype.has=oFt;k2.prototype.set=lFt;jN=k2,cFt="Expected a function";_(KN,"memoize");KN.Cache=jN;uFt=KN,hFt=500;_(W$e,"memoizeCapped");fFt=W$e,dFt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pFt=/\\(\\)?/g,mFt=fFt(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(dFt,function(r,n,i,a){t.push(i?a.replace(pFt,"$1"):n||r)}),t}),gFt=mFt;_(H$e,"toString");yFt=H$e;_(U$e,"castPath");ZN=U$e,vFt=1/0;_(Y$e,"toKey");x6=Y$e;_(X$e,"baseGet");ore=X$e;_(j$e,"get");xFt=j$e;_(K$e,"arrayPush");lre=K$e,zOe=Vu?Vu.isConcatSpreadable:void 0;_(Z$e,"isFlattenable");bFt=Z$e;_(cre,"baseFlatten");ure=cre;_(Q$e,"flatten");Dh=Q$e,wFt=v$e(Object.getPrototypeOf,Object),J$e=wFt;_(eze,"baseSlice");tze=eze;_(rze,"arrayReduce");kFt=rze;_(nze,"stackClear");TFt=nze;_(ize,"stackDelete");CFt=ize;_(aze,"stackGet");SFt=aze;_(sze,"stackHas");EFt=sze,AFt=200;_(oze,"stackSet");_Ft=oze;_(T2,"Stack");T2.prototype.clear=TFt;T2.prototype.delete=CFt;T2.prototype.get=SFt;T2.prototype.has=EFt;T2.prototype.set=_Ft;MS=T2;_(lze,"baseAssign");RFt=lze;_(cze,"baseAssignIn");LFt=cze,uze=typeof exports=="object"&&exports&&!exports.nodeType&&exports,GOe=uze&&typeof module=="object"&&module&&!module.nodeType&&module,IFt=GOe&&GOe.exports===uze,qOe=IFt?vd.Buffer:void 0,VOe=qOe?qOe.allocUnsafe:void 0;_(hze,"cloneBuffer");MFt=hze;_(fze,"arrayFilter");hre=fze;_(dze,"stubArray");pze=dze,NFt=Object.prototype,DFt=NFt.propertyIsEnumerable,WOe=Object.getOwnPropertySymbols,OFt=WOe?function(e){return e==null?[]:(e=Object(e),hre(WOe(e),function(t){return DFt.call(e,t)}))}:pze,fre=OFt;_(mze,"copySymbols");PFt=mze,BFt=Object.getOwnPropertySymbols,FFt=BFt?function(e){for(var t=[];e;)lre(t,fre(e)),e=J$e(e);return t}:pze,gze=FFt;_(yze,"copySymbolsIn");$Ft=yze;_(vze,"baseGetAllKeys");xze=vze;_(bze,"getAllKeys");kJ=bze;_(wze,"getAllKeysIn");kze=wze,zFt=x2(vd,"DataView"),TJ=zFt,GFt=x2(vd,"Promise"),CJ=GFt,qFt=x2(vd,"Set"),_w=qFt,HOe="[object Map]",VFt="[object Object]",UOe="[object Promise]",YOe="[object Set]",XOe="[object WeakMap]",jOe="[object DataView]",WFt=v2(TJ),HFt=v2(US),UFt=v2(CJ),YFt=v2(_w),XFt=v2(wJ),Av=Yg;(TJ&&Av(new TJ(new ArrayBuffer(1)))!=jOe||US&&Av(new US)!=HOe||CJ&&Av(CJ.resolve())!=UOe||_w&&Av(new _w)!=YOe||wJ&&Av(new wJ)!=XOe)&&(Av=_(function(e){var t=Yg(e),r=t==VFt?e.constructor:void 0,n=r?v2(r):"";if(n)switch(n){case WFt:return jOe;case HFt:return HOe;case UFt:return UOe;case YFt:return YOe;case XFt:return XOe}return t},"getTag"));Fw=Av,jFt=Object.prototype,KFt=jFt.hasOwnProperty;_(Tze,"initCloneArray");ZFt=Tze,QFt=vd.Uint8Array,eN=QFt;_(Cze,"cloneArrayBuffer");dre=Cze;_(Sze,"cloneDataView");JFt=Sze,e$t=/\w*$/;_(Eze,"cloneRegExp");t$t=Eze,KOe=Vu?Vu.prototype:void 0,ZOe=KOe?KOe.valueOf:void 0;_(Aze,"cloneSymbol");r$t=Aze;_(_ze,"cloneTypedArray");n$t=_ze,i$t="[object Boolean]",a$t="[object Date]",s$t="[object Map]",o$t="[object Number]",l$t="[object RegExp]",c$t="[object Set]",u$t="[object String]",h$t="[object Symbol]",f$t="[object ArrayBuffer]",d$t="[object DataView]",p$t="[object Float32Array]",m$t="[object Float64Array]",g$t="[object Int8Array]",y$t="[object Int16Array]",v$t="[object Int32Array]",x$t="[object Uint8Array]",b$t="[object Uint8ClampedArray]",w$t="[object Uint16Array]",k$t="[object Uint32Array]";_(Rze,"initCloneByTag");T$t=Rze;_(Lze,"initCloneObject");C$t=Lze,S$t="[object Map]";_(Ize,"baseIsMap");E$t=Ize,QOe=Gg&&Gg.isMap,A$t=QOe?v6(QOe):E$t,_$t=A$t,R$t="[object Set]";_(Mze,"baseIsSet");L$t=Mze,JOe=Gg&&Gg.isSet,I$t=JOe?v6(JOe):L$t,M$t=I$t,N$t=1,D$t=2,O$t=4,Nze="[object Arguments]",P$t="[object Array]",B$t="[object Boolean]",F$t="[object Date]",$$t="[object Error]",Dze="[object Function]",z$t="[object GeneratorFunction]",G$t="[object Map]",q$t="[object Number]",Oze="[object Object]",V$t="[object RegExp]",W$t="[object Set]",H$t="[object String]",U$t="[object Symbol]",Y$t="[object WeakMap]",X$t="[object ArrayBuffer]",j$t="[object DataView]",K$t="[object Float32Array]",Z$t="[object Float64Array]",Q$t="[object Int8Array]",J$t="[object Int16Array]",ezt="[object Int32Array]",tzt="[object Uint8Array]",rzt="[object Uint8ClampedArray]",nzt="[object Uint16Array]",izt="[object Uint32Array]",zi={};zi[Nze]=zi[P$t]=zi[X$t]=zi[j$t]=zi[B$t]=zi[F$t]=zi[K$t]=zi[Z$t]=zi[Q$t]=zi[J$t]=zi[ezt]=zi[G$t]=zi[q$t]=zi[Oze]=zi[V$t]=zi[W$t]=zi[H$t]=zi[U$t]=zi[tzt]=zi[rzt]=zi[nzt]=zi[izt]=!0;zi[$$t]=zi[Dze]=zi[Y$t]=!1;_(NS,"baseClone");azt=NS,szt=4;_(Pze,"clone");ko=Pze;_(Bze,"compact");b6=Bze,ozt="__lodash_hash_undefined__";_(Fze,"setCacheAdd");lzt=Fze;_($ze,"setCacheHas");czt=$ze;_(YS,"SetCache");YS.prototype.add=YS.prototype.push=lzt;YS.prototype.has=czt;pre=YS;_(zze,"arraySome");Gze=zze;_(qze,"cacheHas");mre=qze,uzt=1,hzt=2;_(Vze,"equalArrays");Wze=Vze;_(Hze,"mapToArray");fzt=Hze;_(Uze,"setToArray");gre=Uze,dzt=1,pzt=2,mzt="[object Boolean]",gzt="[object Date]",yzt="[object Error]",vzt="[object Map]",xzt="[object Number]",bzt="[object RegExp]",wzt="[object Set]",kzt="[object String]",Tzt="[object Symbol]",Czt="[object ArrayBuffer]",Szt="[object DataView]",ePe=Vu?Vu.prototype:void 0,JZ=ePe?ePe.valueOf:void 0;_(Yze,"equalByTag");Ezt=Yze,Azt=1,_zt=Object.prototype,Rzt=_zt.hasOwnProperty;_(Xze,"equalObjects");Lzt=Xze,Izt=1,tPe="[object Arguments]",rPe="[object Array]",zI="[object Object]",Mzt=Object.prototype,nPe=Mzt.hasOwnProperty;_(jze,"baseIsEqualDeep");Nzt=jze;_(yre,"baseIsEqual");Kze=yre,Dzt=1,Ozt=2;_(Zze,"baseIsMatch");Pzt=Zze;_(Qze,"isStrictComparable");Jze=Qze;_(eGe,"getMatchData");Bzt=eGe;_(tGe,"matchesStrictComparable");rGe=tGe;_(nGe,"baseMatches");Fzt=nGe;_(iGe,"baseHasIn");$zt=iGe;_(aGe,"hasPath");sGe=aGe;_(oGe,"hasIn");zzt=oGe,Gzt=1,qzt=2;_(lGe,"baseMatchesProperty");Vzt=lGe;_(cGe,"baseProperty");Wzt=cGe;_(uGe,"basePropertyDeep");Hzt=uGe;_(hGe,"property");Uzt=hGe;_(fGe,"baseIteratee");bd=fGe;_(dGe,"arrayAggregator");Yzt=dGe;_(pGe,"createBaseFor");Xzt=pGe,jzt=Xzt(),Kzt=jzt;_(mGe,"baseForOwn");Zzt=mGe;_(gGe,"createBaseEach");Qzt=gGe,Jzt=Qzt(Zzt),C2=Jzt;_(yGe,"baseAggregator");eGt=yGe;_(vGe,"createAggregator");tGt=vGe,xGe=Object.prototype,rGt=xGe.hasOwnProperty,nGt=nre(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&VN(t[0],t[1],i)&&(n=1);++r{t.accept(e)})}},Il=class extends wd{static{_(this,"NonTerminal")}constructor(e){super([]),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},Hw=class extends wd{static{_(this,"Rule")}constructor(e){super(e.definition),this.orgText="",Kc(this,Fh(e,t=>t!==void 0))}},hc=class extends wd{static{_(this,"Alternative")}constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Kc(this,Fh(e,t=>t!==void 0))}},wo=class extends wd{static{_(this,"Option")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},Qc=class extends wd{static{_(this,"RepetitionMandatory")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},Jc=class extends wd{static{_(this,"RepetitionMandatoryWithSeparator")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},Ia=class extends wd{static{_(this,"Repetition")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},fc=class extends wd{static{_(this,"RepetitionWithSeparator")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},dc=class extends wd{static{_(this,"Alternation")}get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Kc(this,Fh(e,t=>t!==void 0))}},Qi=class{static{_(this,"Terminal")}constructor(e){this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}accept(e){e.visit(this)}};_(hqe,"serializeGrammar");_(DS,"serializeProduction");Uw=class{static{_(this,"GAstVisitor")}visit(e){let t=e;switch(t.constructor){case Il:return this.visitNonTerminal(t);case hc:return this.visitAlternative(t);case wo:return this.visitOption(t);case Qc:return this.visitRepetitionMandatory(t);case Jc:return this.visitRepetitionMandatoryWithSeparator(t);case fc:return this.visitRepetitionWithSeparator(t);case Ia:return this.visitRepetition(t);case dc:return this.visitAlternation(t);case Qi:return this.visitTerminal(t);case Hw:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};_(fqe,"isSequenceProd");_(jS,"isOptionalProd");_(dqe,"isBranchingProd");_(Lh,"getProductionDslName");eD=class{static{_(this,"RestWalker")}walk(e,t=[]){nn(e.definition,(r,n)=>{let i=bo(e.definition,n+1);if(r instanceof Il)this.walkProdRef(r,i,t);else if(r instanceof Qi)this.walkTerminal(r,i,t);else if(r instanceof hc)this.walkFlat(r,i,t);else if(r instanceof wo)this.walkOption(r,i,t);else if(r instanceof Qc)this.walkAtLeastOne(r,i,t);else if(r instanceof Jc)this.walkAtLeastOneSep(r,i,t);else if(r instanceof fc)this.walkManySep(r,i,t);else if(r instanceof Ia)this.walkMany(r,i,t);else if(r instanceof dc)this.walkOr(r,i,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,r){}walkProdRef(e,t,r){}walkFlat(e,t,r){let n=t.concat(r);this.walk(e,n)}walkOption(e,t,r){let n=t.concat(r);this.walk(e,n)}walkAtLeastOne(e,t,r){let n=[new wo({definition:e.definition})].concat(t,r);this.walk(e,n)}walkAtLeastOneSep(e,t,r){let n=SJ(e,t,r);this.walk(e,n)}walkMany(e,t,r){let n=[new wo({definition:e.definition})].concat(t,r);this.walk(e,n)}walkManySep(e,t,r){let n=SJ(e,t,r);this.walk(e,n)}walkOr(e,t,r){let n=t.concat(r);nn(e.definition,i=>{let a=new hc({definition:[i]});this.walk(a,n)})}};_(SJ,"restForRepetitionWithSeparator");_(Yw,"first");_(pqe,"firstForSequence");_(mqe,"firstForBranching");_(gqe,"firstForTerminal");yqe="_~IN~_",WGt=class extends eD{static{_(this,"ResyncFollowsWalker")}constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,r){}walkProdRef(e,t,r){let n=xqe(e.referencedRule,e.idx)+this.topProd.name,i=t.concat(r),a=new hc({definition:i}),s=Yw(a);this.follows[n]=s}};_(vqe,"computeAllProdsFollows");_(xqe,"buildBetweenProdsFollowPrefix");dM={},HGt=new ZBe;_(w6,"getRegExpAst");_(bqe,"clearRegExpParserCache");wqe="Complement Sets are not supported for first char optimization",rN=`Unable to use "first char" lexer optimizations: -`;_(kqe,"getOptimizedStartCodesIndices");_(nN,"firstCharOptimizedIndices");_(xS,"addOptimizedIdxToResult");_(Tqe,"handleIgnoreCase");_(EJ,"findCode");_(iN,"isWholeOptional");UGt=class extends NN{static{_(this,"CharCodeFinder")}constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){Dl(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?EJ(e,this.targetCharCodes)===void 0&&(this.found=!0):EJ(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};_(tD,"canMatchCharCode");c2="PATTERN",bS="defaultMode",GI="modes";_(Cqe,"analyzeTokenTypes");_(Sqe,"validatePatterns");_(Eqe,"validateRegExpPattern");_(Aqe,"findMissingPatterns");_(_qe,"findInvalidPatterns");YGt=/[^\\][$]/;_(Rqe,"findEndOfInputAnchor");_(Lqe,"findEmptyMatchRegExps");XGt=/[^\\[][\^]|^\^/;_(Iqe,"findStartOfInputAnchor");_(Mqe,"findUnsupportedFlags");_(Nqe,"findDuplicatePatterns");_(Dqe,"findInvalidGroupType");_(Oqe,"findModesThatDoNotExist");_(Pqe,"findUnreachablePatterns");_(Bqe,"tryToMatchStrToPattern");_(Fqe,"noMetaChar");_($qe,"usesLookAheadOrBehind");_(AJ,"addStickyFlag");_(zqe,"performRuntimeChecks");_(Gqe,"performWarningRuntimeChecks");_(qqe,"cloneEmptyGroups");_(Tre,"isCustomPattern");_(Vqe,"isShortPattern");jGt={test:_(function(e){let t=e.length;for(let r=this.lastIndex;r${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,r,n,i,a){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${r} characters.`}};(function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Ma||(Ma={}));kS={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` -`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:RJ,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(kS);Rl=class{static{_(this,"Lexer")}constructor(e,t=kS){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(n,i)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${n}>`);let{time:s,value:o}=wre(i),l=s>10?console.warn:console.log;return this.traceInitIndent time: ${s}ms`),this.traceInitIndent--,o}else return i()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. -a boolean 2nd argument is no longer supported`);this.config=Kc({},kS,t);let r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let n,i=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===kS.lineTerminatorsPattern)this.config.lineTerminatorsPattern=jGt;else if(this.config.lineTerminatorCharacters===kS.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Un(e)?n={modes:{defaultMode:ko(e)},defaultMode:bS}:(i=!1,n=ko(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(zqe(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Gqe(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},nn(n.modes,(s,o)=>{n.modes[o]=JN(s,l=>rp(l))});let a=jc(n.modes);if(nn(n.modes,(s,o)=>{this.TRACE_INIT(`Mode: <${o}> processing`,()=>{if(this.modes.push(o),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Sqe(s,a))}),qi(this.lexerDefinitionErrors)){jw(s);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=Cqe(s,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[o]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[o]=l.charCodeToPatternIdxToConfig,this.emptyGroups=Kc({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[o]=l.canBeOptimized}})}),this.defaultMode=n.defaultMode,!qi(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let o=Er(this.lexerDefinitionErrors,l=>l.message).join(`----------------------- +`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},t2=new AOt;_(rFe,"getTerminalParts");_(Fte,"isMultilineComment");nFe=`\f +\r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");_(DN,"isWhitespace");_(Ww,"escapeRegExp");_($te,"partialMatches");_(zte,"partialRegExp");_(Gte,"getEntryRule");_(qte,"getHiddenRules");_(ON,"getAllReachableRules");_(Vte,"ruleDfs");_(iFe,"getAllRulesUsedForCrossReferences");_(Wte,"getCrossReferenceTerminal");_(Hte,"isCommentTerminal");_(Ute,"findNodesForProperty");_(PN,"findNodeForProperty");_(BN,"findNodesForPropertyInternal");_(aFe,"findNodesForKeyword");_(Yte,"findNodeForKeyword");_(FN,"findNodesForKeywordInternal");_(Xte,"findAssignment");_($N,"findNameAssignment");_(jte,"findNameAssignmentInternal");_(Kte,"getActionAtElement");_(sFe,"isOptionalCardinality");_(oFe,"isArrayCardinality");_(lFe,"isArrayOperator");_(c6,"isDataTypeRule");_(Zte,"isDataTypeRuleInternal");_(cFe,"isDataType");_(QM,"isDataTypeInternal");_(u6,"getExplicitRuleType");_(o2,"getTypeName");_(Qte,"getActionType");_(uFe,"getRuleTypeName");_(Jte,"getRuleType");_(h6,"terminalRegex");ere=/[\s\S]/.source;_(y2,"abstractElementToRegex");_(hFe,"terminalAlternativesToRegex");_(fFe,"terminalGroupToRegex");_(dFe,"untilTokenToRegex");_(pFe,"negateTokenToRegex");_(mFe,"characterRangeToRegex");_(fM,"keywordToRegex");_(gd,"withCardinality");_(tre,"createGrammarConfig");_Ot=typeof global=="object"&&global&&global.Object===Object&&global,gFe=_Ot,ROt=typeof self=="object"&&self&&self.Object===Object&&self,LOt=gFe||ROt||Function("return this")(),vd=LOt,IOt=vd.Symbol,Vu=IOt,yFe=Object.prototype,MOt=yFe.hasOwnProperty,NOt=yFe.toString,nS=Vu?Vu.toStringTag:void 0;_(vFe,"getRawTag");DOt=vFe,OOt=Object.prototype,POt=OOt.toString;_(xFe,"objectToString");BOt=xFe,FOt="[object Null]",$Ot="[object Undefined]",ROe=Vu?Vu.toStringTag:void 0;_(bFe,"baseGetTag");Yg=bFe;_(wFe,"isObjectLike");Ph=wFe,zOt="[object Symbol]";_(kFe,"isSymbol");zN=kFe;_(TFe,"arrayMap");f6=TFe,GOt=Array.isArray,Un=GOt,qOt=1/0,LOe=Vu?Vu.prototype:void 0,IOe=LOe?LOe.toString:void 0;_(rre,"baseToString");VOt=rre,WOt=/\s/;_(CFe,"trimmedEndIndex");HOt=CFe,UOt=/^\s+/;_(SFe,"baseTrim");YOt=SFe;_(EFe,"isObject");Wu=EFe,MOe=NaN,XOt=/^[-+]0x[0-9a-f]+$/i,jOt=/^0b[01]+$/i,KOt=/^0o[0-7]+$/i,ZOt=parseInt;_(AFe,"toNumber");QOt=AFe,NOe=1/0,JOt=17976931348623157e292;_(_Fe,"toFinite");ePt=_Fe;_(RFe,"toInteger");d6=RFe;_(LFe,"identity");p6=LFe,tPt="[object AsyncFunction]",rPt="[object Function]",nPt="[object GeneratorFunction]",iPt="[object Proxy]";_(IFe,"isFunction");lp=IFe,aPt=vd["__core-js_shared__"],JZ=aPt,DOe=(function(){var e=/[^.]+$/.exec(JZ&&JZ.keys&&JZ.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();_(MFe,"isMasked");sPt=MFe,oPt=Function.prototype,lPt=oPt.toString;_(NFe,"toSource");v2=NFe,cPt=/[\\^$.*+?()[\]{}|]/g,uPt=/^\[object .+?Constructor\]$/,hPt=Function.prototype,fPt=Object.prototype,dPt=hPt.toString,pPt=fPt.hasOwnProperty,mPt=RegExp("^"+dPt.call(pPt).replace(cPt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");_(DFe,"baseIsNative");gPt=DFe;_(OFe,"getValue");yPt=OFe;_(PFe,"getNative");x2=PFe,vPt=x2(vd,"WeakMap"),TJ=vPt,OOe=Object.create,xPt=(function(){function e(){}return _(e,"object"),function(t){if(!Wu(t))return{};if(OOe)return OOe(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),bPt=xPt;_(BFe,"apply");wPt=BFe;_(FFe,"noop");Hs=FFe;_($Fe,"copyArray");kPt=$Fe,TPt=800,CPt=16,SPt=Date.now;_(zFe,"shortOut");EPt=zFe;_(GFe,"constant");APt=GFe,_Pt=(function(){try{var e=x2(Object,"defineProperty");return e({},"",{}),e}catch{}})(),JM=_Pt,RPt=JM?function(e,t){return JM(e,"toString",{configurable:!0,enumerable:!1,value:APt(t),writable:!0})}:p6,LPt=RPt,IPt=EPt(LPt),MPt=IPt;_(qFe,"arrayEach");VFe=qFe;_(WFe,"baseFindIndex");HFe=WFe;_(UFe,"baseIsNaN");NPt=UFe;_(YFe,"strictIndexOf");DPt=YFe;_(XFe,"baseIndexOf");nre=XFe;_(jFe,"arrayIncludes");KFe=jFe,OPt=9007199254740991,PPt=/^(?:0|[1-9]\d*)$/;_(ZFe,"isIndex");GN=ZFe;_(QFe,"baseAssignValue");ire=QFe;_(JFe,"eq");m6=JFe,BPt=Object.prototype,FPt=BPt.hasOwnProperty;_(e$e,"assignValue");qN=e$e;_(t$e,"copyObject");g6=t$e,POe=Math.max;_(r$e,"overRest");$Pt=r$e;_(n$e,"baseRest");are=n$e,zPt=9007199254740991;_(i$e,"isLength");sre=i$e;_(a$e,"isArrayLike");xd=a$e;_(s$e,"isIterateeCall");VN=s$e;_(o$e,"createAssigner");GPt=o$e,qPt=Object.prototype;_(l$e,"isPrototype");y6=l$e;_(c$e,"baseTimes");VPt=c$e,WPt="[object Arguments]";_(u$e,"baseIsArguments");BOe=u$e,h$e=Object.prototype,HPt=h$e.hasOwnProperty,UPt=h$e.propertyIsEnumerable,YPt=BOe((function(){return arguments})())?BOe:function(e){return Ph(e)&&HPt.call(e,"callee")&&!UPt.call(e,"callee")},WN=YPt;_(f$e,"stubFalse");XPt=f$e,d$e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FOe=d$e&&typeof module=="object"&&module&&!module.nodeType&&module,jPt=FOe&&FOe.exports===d$e,$Oe=jPt?vd.Buffer:void 0,KPt=$Oe?$Oe.isBuffer:void 0,ZPt=KPt||XPt,WS=ZPt,QPt="[object Arguments]",JPt="[object Array]",eBt="[object Boolean]",tBt="[object Date]",rBt="[object Error]",nBt="[object Function]",iBt="[object Map]",aBt="[object Number]",sBt="[object Object]",oBt="[object RegExp]",lBt="[object Set]",cBt="[object String]",uBt="[object WeakMap]",hBt="[object ArrayBuffer]",fBt="[object DataView]",dBt="[object Float32Array]",pBt="[object Float64Array]",mBt="[object Int8Array]",gBt="[object Int16Array]",yBt="[object Int32Array]",vBt="[object Uint8Array]",xBt="[object Uint8ClampedArray]",bBt="[object Uint16Array]",wBt="[object Uint32Array]",Ki={};Ki[dBt]=Ki[pBt]=Ki[mBt]=Ki[gBt]=Ki[yBt]=Ki[vBt]=Ki[xBt]=Ki[bBt]=Ki[wBt]=!0;Ki[QPt]=Ki[JPt]=Ki[hBt]=Ki[eBt]=Ki[fBt]=Ki[tBt]=Ki[rBt]=Ki[nBt]=Ki[iBt]=Ki[aBt]=Ki[sBt]=Ki[oBt]=Ki[lBt]=Ki[cBt]=Ki[uBt]=!1;_(p$e,"baseIsTypedArray");kBt=p$e;_(m$e,"baseUnary");v6=m$e,g$e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,IS=g$e&&typeof module=="object"&&module&&!module.nodeType&&module,TBt=IS&&IS.exports===g$e,eQ=TBt&&gFe.process,CBt=(function(){try{var e=IS&&IS.require&&IS.require("util").types;return e||eQ&&eQ.binding&&eQ.binding("util")}catch{}})(),Gg=CBt,zOe=Gg&&Gg.isTypedArray,SBt=zOe?v6(zOe):kBt,ore=SBt,EBt=Object.prototype,ABt=EBt.hasOwnProperty;_(y$e,"arrayLikeKeys");v$e=y$e;_(x$e,"overArg");b$e=x$e,_Bt=b$e(Object.keys,Object),RBt=_Bt,LBt=Object.prototype,IBt=LBt.hasOwnProperty;_(w$e,"baseKeys");k$e=w$e;_(T$e,"keys");jc=T$e,MBt=Object.prototype,NBt=MBt.hasOwnProperty,DBt=GPt(function(e,t){if(y6(t)||xd(t)){g6(t,jc(t),e);return}for(var r in t)NBt.call(t,r)&&qN(e,r,t[r])}),Kc=DBt;_(C$e,"nativeKeysIn");OBt=C$e,PBt=Object.prototype,BBt=PBt.hasOwnProperty;_(S$e,"baseKeysIn");FBt=S$e;_(E$e,"keysIn");HN=E$e,$Bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zBt=/^\w*$/;_(A$e,"isKey");lre=A$e,GBt=x2(Object,"create"),HS=GBt;_(_$e,"hashClear");qBt=_$e;_(R$e,"hashDelete");VBt=R$e,WBt="__lodash_hash_undefined__",HBt=Object.prototype,UBt=HBt.hasOwnProperty;_(L$e,"hashGet");YBt=L$e,XBt=Object.prototype,jBt=XBt.hasOwnProperty;_(I$e,"hashHas");KBt=I$e,ZBt="__lodash_hash_undefined__";_(M$e,"hashSet");QBt=M$e;_(b2,"Hash");b2.prototype.clear=qBt;b2.prototype.delete=VBt;b2.prototype.get=YBt;b2.prototype.has=KBt;b2.prototype.set=QBt;GOe=b2;_(N$e,"listCacheClear");JBt=N$e;_(D$e,"assocIndexOf");UN=D$e,eFt=Array.prototype,tFt=eFt.splice;_(O$e,"listCacheDelete");rFt=O$e;_(P$e,"listCacheGet");nFt=P$e;_(B$e,"listCacheHas");iFt=B$e;_(F$e,"listCacheSet");aFt=F$e;_(w2,"ListCache");w2.prototype.clear=JBt;w2.prototype.delete=rFt;w2.prototype.get=nFt;w2.prototype.has=iFt;w2.prototype.set=aFt;YN=w2,sFt=x2(vd,"Map"),US=sFt;_($$e,"mapCacheClear");oFt=$$e;_(z$e,"isKeyable");lFt=z$e;_(G$e,"getMapData");XN=G$e;_(q$e,"mapCacheDelete");cFt=q$e;_(V$e,"mapCacheGet");uFt=V$e;_(W$e,"mapCacheHas");hFt=W$e;_(H$e,"mapCacheSet");fFt=H$e;_(k2,"MapCache");k2.prototype.clear=oFt;k2.prototype.delete=cFt;k2.prototype.get=uFt;k2.prototype.has=hFt;k2.prototype.set=fFt;jN=k2,dFt="Expected a function";_(KN,"memoize");KN.Cache=jN;pFt=KN,mFt=500;_(U$e,"memoizeCapped");gFt=U$e,yFt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vFt=/\\(\\)?/g,xFt=gFt(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(yFt,function(r,n,i,a){t.push(i?a.replace(vFt,"$1"):n||r)}),t}),bFt=xFt;_(Y$e,"toString");wFt=Y$e;_(X$e,"castPath");ZN=X$e,kFt=1/0;_(j$e,"toKey");x6=j$e;_(K$e,"baseGet");cre=K$e;_(Z$e,"get");TFt=Z$e;_(Q$e,"arrayPush");ure=Q$e,qOe=Vu?Vu.isConcatSpreadable:void 0;_(J$e,"isFlattenable");CFt=J$e;_(hre,"baseFlatten");fre=hre;_(eze,"flatten");Dh=eze,SFt=b$e(Object.getPrototypeOf,Object),tze=SFt;_(rze,"baseSlice");nze=rze;_(ize,"arrayReduce");EFt=ize;_(aze,"stackClear");AFt=aze;_(sze,"stackDelete");_Ft=sze;_(oze,"stackGet");RFt=oze;_(lze,"stackHas");LFt=lze,IFt=200;_(cze,"stackSet");MFt=cze;_(T2,"Stack");T2.prototype.clear=AFt;T2.prototype.delete=_Ft;T2.prototype.get=RFt;T2.prototype.has=LFt;T2.prototype.set=MFt;MS=T2;_(uze,"baseAssign");NFt=uze;_(hze,"baseAssignIn");DFt=hze,fze=typeof exports=="object"&&exports&&!exports.nodeType&&exports,VOe=fze&&typeof module=="object"&&module&&!module.nodeType&&module,OFt=VOe&&VOe.exports===fze,WOe=OFt?vd.Buffer:void 0,HOe=WOe?WOe.allocUnsafe:void 0;_(dze,"cloneBuffer");PFt=dze;_(pze,"arrayFilter");dre=pze;_(mze,"stubArray");gze=mze,BFt=Object.prototype,FFt=BFt.propertyIsEnumerable,UOe=Object.getOwnPropertySymbols,$Ft=UOe?function(e){return e==null?[]:(e=Object(e),dre(UOe(e),function(t){return FFt.call(e,t)}))}:gze,pre=$Ft;_(yze,"copySymbols");zFt=yze,GFt=Object.getOwnPropertySymbols,qFt=GFt?function(e){for(var t=[];e;)ure(t,pre(e)),e=tze(e);return t}:gze,vze=qFt;_(xze,"copySymbolsIn");VFt=xze;_(bze,"baseGetAllKeys");wze=bze;_(kze,"getAllKeys");CJ=kze;_(Tze,"getAllKeysIn");Cze=Tze,WFt=x2(vd,"DataView"),SJ=WFt,HFt=x2(vd,"Promise"),EJ=HFt,UFt=x2(vd,"Set"),_w=UFt,YOe="[object Map]",YFt="[object Object]",XOe="[object Promise]",jOe="[object Set]",KOe="[object WeakMap]",ZOe="[object DataView]",XFt=v2(SJ),jFt=v2(US),KFt=v2(EJ),ZFt=v2(_w),QFt=v2(TJ),Av=Yg;(SJ&&Av(new SJ(new ArrayBuffer(1)))!=ZOe||US&&Av(new US)!=YOe||EJ&&Av(EJ.resolve())!=XOe||_w&&Av(new _w)!=jOe||TJ&&Av(new TJ)!=KOe)&&(Av=_(function(e){var t=Yg(e),r=t==YFt?e.constructor:void 0,n=r?v2(r):"";if(n)switch(n){case XFt:return ZOe;case jFt:return YOe;case KFt:return XOe;case ZFt:return jOe;case QFt:return KOe}return t},"getTag"));Fw=Av,JFt=Object.prototype,e$t=JFt.hasOwnProperty;_(Sze,"initCloneArray");t$t=Sze,r$t=vd.Uint8Array,eN=r$t;_(Eze,"cloneArrayBuffer");mre=Eze;_(Aze,"cloneDataView");n$t=Aze,i$t=/\w*$/;_(_ze,"cloneRegExp");a$t=_ze,QOe=Vu?Vu.prototype:void 0,JOe=QOe?QOe.valueOf:void 0;_(Rze,"cloneSymbol");s$t=Rze;_(Lze,"cloneTypedArray");o$t=Lze,l$t="[object Boolean]",c$t="[object Date]",u$t="[object Map]",h$t="[object Number]",f$t="[object RegExp]",d$t="[object Set]",p$t="[object String]",m$t="[object Symbol]",g$t="[object ArrayBuffer]",y$t="[object DataView]",v$t="[object Float32Array]",x$t="[object Float64Array]",b$t="[object Int8Array]",w$t="[object Int16Array]",k$t="[object Int32Array]",T$t="[object Uint8Array]",C$t="[object Uint8ClampedArray]",S$t="[object Uint16Array]",E$t="[object Uint32Array]";_(Ize,"initCloneByTag");A$t=Ize;_(Mze,"initCloneObject");_$t=Mze,R$t="[object Map]";_(Nze,"baseIsMap");L$t=Nze,ePe=Gg&&Gg.isMap,I$t=ePe?v6(ePe):L$t,M$t=I$t,N$t="[object Set]";_(Dze,"baseIsSet");D$t=Dze,tPe=Gg&&Gg.isSet,O$t=tPe?v6(tPe):D$t,P$t=O$t,B$t=1,F$t=2,$$t=4,Oze="[object Arguments]",z$t="[object Array]",G$t="[object Boolean]",q$t="[object Date]",V$t="[object Error]",Pze="[object Function]",W$t="[object GeneratorFunction]",H$t="[object Map]",U$t="[object Number]",Bze="[object Object]",Y$t="[object RegExp]",X$t="[object Set]",j$t="[object String]",K$t="[object Symbol]",Z$t="[object WeakMap]",Q$t="[object ArrayBuffer]",J$t="[object DataView]",ezt="[object Float32Array]",tzt="[object Float64Array]",rzt="[object Int8Array]",nzt="[object Int16Array]",izt="[object Int32Array]",azt="[object Uint8Array]",szt="[object Uint8ClampedArray]",ozt="[object Uint16Array]",lzt="[object Uint32Array]",zi={};zi[Oze]=zi[z$t]=zi[Q$t]=zi[J$t]=zi[G$t]=zi[q$t]=zi[ezt]=zi[tzt]=zi[rzt]=zi[nzt]=zi[izt]=zi[H$t]=zi[U$t]=zi[Bze]=zi[Y$t]=zi[X$t]=zi[j$t]=zi[K$t]=zi[azt]=zi[szt]=zi[ozt]=zi[lzt]=!0;zi[V$t]=zi[Pze]=zi[Z$t]=!1;_(NS,"baseClone");czt=NS,uzt=4;_(Fze,"clone");ko=Fze;_($ze,"compact");b6=$ze,hzt="__lodash_hash_undefined__";_(zze,"setCacheAdd");fzt=zze;_(Gze,"setCacheHas");dzt=Gze;_(YS,"SetCache");YS.prototype.add=YS.prototype.push=fzt;YS.prototype.has=dzt;gre=YS;_(qze,"arraySome");Vze=qze;_(Wze,"cacheHas");yre=Wze,pzt=1,mzt=2;_(Hze,"equalArrays");Uze=Hze;_(Yze,"mapToArray");gzt=Yze;_(Xze,"setToArray");vre=Xze,yzt=1,vzt=2,xzt="[object Boolean]",bzt="[object Date]",wzt="[object Error]",kzt="[object Map]",Tzt="[object Number]",Czt="[object RegExp]",Szt="[object Set]",Ezt="[object String]",Azt="[object Symbol]",_zt="[object ArrayBuffer]",Rzt="[object DataView]",rPe=Vu?Vu.prototype:void 0,tQ=rPe?rPe.valueOf:void 0;_(jze,"equalByTag");Lzt=jze,Izt=1,Mzt=Object.prototype,Nzt=Mzt.hasOwnProperty;_(Kze,"equalObjects");Dzt=Kze,Ozt=1,nPe="[object Arguments]",iPe="[object Array]",zI="[object Object]",Pzt=Object.prototype,aPe=Pzt.hasOwnProperty;_(Zze,"baseIsEqualDeep");Bzt=Zze;_(xre,"baseIsEqual");Qze=xre,Fzt=1,$zt=2;_(Jze,"baseIsMatch");zzt=Jze;_(eGe,"isStrictComparable");tGe=eGe;_(rGe,"getMatchData");Gzt=rGe;_(nGe,"matchesStrictComparable");iGe=nGe;_(aGe,"baseMatches");qzt=aGe;_(sGe,"baseHasIn");Vzt=sGe;_(oGe,"hasPath");lGe=oGe;_(cGe,"hasIn");Wzt=cGe,Hzt=1,Uzt=2;_(uGe,"baseMatchesProperty");Yzt=uGe;_(hGe,"baseProperty");Xzt=hGe;_(fGe,"basePropertyDeep");jzt=fGe;_(dGe,"property");Kzt=dGe;_(pGe,"baseIteratee");bd=pGe;_(mGe,"arrayAggregator");Zzt=mGe;_(gGe,"createBaseFor");Qzt=gGe,Jzt=Qzt(),eGt=Jzt;_(yGe,"baseForOwn");tGt=yGe;_(vGe,"createBaseEach");rGt=vGe,nGt=rGt(tGt),C2=nGt;_(xGe,"baseAggregator");iGt=xGe;_(bGe,"createAggregator");aGt=bGe,wGe=Object.prototype,sGt=wGe.hasOwnProperty,oGt=are(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&VN(t[0],t[1],i)&&(n=1);++r{t.accept(e)})}},Ml=class extends wd{static{_(this,"NonTerminal")}constructor(e){super([]),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},Hw=class extends wd{static{_(this,"Rule")}constructor(e){super(e.definition),this.orgText="",Kc(this,Fh(e,t=>t!==void 0))}},fc=class extends wd{static{_(this,"Alternative")}constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Kc(this,Fh(e,t=>t!==void 0))}},wo=class extends wd{static{_(this,"Option")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},Qc=class extends wd{static{_(this,"RepetitionMandatory")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},Jc=class extends wd{static{_(this,"RepetitionMandatoryWithSeparator")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},Ia=class extends wd{static{_(this,"Repetition")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},dc=class extends wd{static{_(this,"RepetitionWithSeparator")}constructor(e){super(e.definition),this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}},pc=class extends wd{static{_(this,"Alternation")}get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Kc(this,Fh(e,t=>t!==void 0))}},Qi=class{static{_(this,"Terminal")}constructor(e){this.idx=1,Kc(this,Fh(e,t=>t!==void 0))}accept(e){e.visit(this)}};_(dqe,"serializeGrammar");_(DS,"serializeProduction");Uw=class{static{_(this,"GAstVisitor")}visit(e){let t=e;switch(t.constructor){case Ml:return this.visitNonTerminal(t);case fc:return this.visitAlternative(t);case wo:return this.visitOption(t);case Qc:return this.visitRepetitionMandatory(t);case Jc:return this.visitRepetitionMandatoryWithSeparator(t);case dc:return this.visitRepetitionWithSeparator(t);case Ia:return this.visitRepetition(t);case pc:return this.visitAlternation(t);case Qi:return this.visitTerminal(t);case Hw:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};_(pqe,"isSequenceProd");_(jS,"isOptionalProd");_(mqe,"isBranchingProd");_(Lh,"getProductionDslName");eD=class{static{_(this,"RestWalker")}walk(e,t=[]){nn(e.definition,(r,n)=>{let i=bo(e.definition,n+1);if(r instanceof Ml)this.walkProdRef(r,i,t);else if(r instanceof Qi)this.walkTerminal(r,i,t);else if(r instanceof fc)this.walkFlat(r,i,t);else if(r instanceof wo)this.walkOption(r,i,t);else if(r instanceof Qc)this.walkAtLeastOne(r,i,t);else if(r instanceof Jc)this.walkAtLeastOneSep(r,i,t);else if(r instanceof dc)this.walkManySep(r,i,t);else if(r instanceof Ia)this.walkMany(r,i,t);else if(r instanceof pc)this.walkOr(r,i,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,r){}walkProdRef(e,t,r){}walkFlat(e,t,r){let n=t.concat(r);this.walk(e,n)}walkOption(e,t,r){let n=t.concat(r);this.walk(e,n)}walkAtLeastOne(e,t,r){let n=[new wo({definition:e.definition})].concat(t,r);this.walk(e,n)}walkAtLeastOneSep(e,t,r){let n=AJ(e,t,r);this.walk(e,n)}walkMany(e,t,r){let n=[new wo({definition:e.definition})].concat(t,r);this.walk(e,n)}walkManySep(e,t,r){let n=AJ(e,t,r);this.walk(e,n)}walkOr(e,t,r){let n=t.concat(r);nn(e.definition,i=>{let a=new fc({definition:[i]});this.walk(a,n)})}};_(AJ,"restForRepetitionWithSeparator");_(Yw,"first");_(gqe,"firstForSequence");_(yqe,"firstForBranching");_(vqe,"firstForTerminal");xqe="_~IN~_",XGt=class extends eD{static{_(this,"ResyncFollowsWalker")}constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,r){}walkProdRef(e,t,r){let n=wqe(e.referencedRule,e.idx)+this.topProd.name,i=t.concat(r),a=new fc({definition:i}),s=Yw(a);this.follows[n]=s}};_(bqe,"computeAllProdsFollows");_(wqe,"buildBetweenProdsFollowPrefix");dM={},jGt=new JBe;_(w6,"getRegExpAst");_(kqe,"clearRegExpParserCache");Tqe="Complement Sets are not supported for first char optimization",rN=`Unable to use "first char" lexer optimizations: +`;_(Cqe,"getOptimizedStartCodesIndices");_(nN,"firstCharOptimizedIndices");_(xS,"addOptimizedIdxToResult");_(Sqe,"handleIgnoreCase");_(_J,"findCode");_(iN,"isWholeOptional");KGt=class extends NN{static{_(this,"CharCodeFinder")}constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){Ol(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?_J(e,this.targetCharCodes)===void 0&&(this.found=!0):_J(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};_(tD,"canMatchCharCode");c2="PATTERN",bS="defaultMode",GI="modes";_(Eqe,"analyzeTokenTypes");_(Aqe,"validatePatterns");_(_qe,"validateRegExpPattern");_(Rqe,"findMissingPatterns");_(Lqe,"findInvalidPatterns");ZGt=/[^\\][$]/;_(Iqe,"findEndOfInputAnchor");_(Mqe,"findEmptyMatchRegExps");QGt=/[^\\[][\^]|^\^/;_(Nqe,"findStartOfInputAnchor");_(Dqe,"findUnsupportedFlags");_(Oqe,"findDuplicatePatterns");_(Pqe,"findInvalidGroupType");_(Bqe,"findModesThatDoNotExist");_(Fqe,"findUnreachablePatterns");_($qe,"tryToMatchStrToPattern");_(zqe,"noMetaChar");_(Gqe,"usesLookAheadOrBehind");_(RJ,"addStickyFlag");_(qqe,"performRuntimeChecks");_(Vqe,"performWarningRuntimeChecks");_(Wqe,"cloneEmptyGroups");_(Sre,"isCustomPattern");_(Hqe,"isShortPattern");JGt={test:_(function(e){let t=e.length;for(let r=this.lastIndex;r${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,r,n,i,a){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${r} characters.`}};(function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Ma||(Ma={}));kS={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` +`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:IJ,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(kS);Ll=class{static{_(this,"Lexer")}constructor(e,t=kS){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(n,i)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${n}>`);let{time:s,value:o}=Tre(i),l=s>10?console.warn:console.log;return this.traceInitIndent time: ${s}ms`),this.traceInitIndent--,o}else return i()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. +a boolean 2nd argument is no longer supported`);this.config=Kc({},kS,t);let r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let n,i=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===kS.lineTerminatorsPattern)this.config.lineTerminatorsPattern=JGt;else if(this.config.lineTerminatorCharacters===kS.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Un(e)?n={modes:{defaultMode:ko(e)},defaultMode:bS}:(i=!1,n=ko(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(qqe(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Vqe(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},nn(n.modes,(s,o)=>{n.modes[o]=JN(s,l=>rp(l))});let a=jc(n.modes);if(nn(n.modes,(s,o)=>{this.TRACE_INIT(`Mode: <${o}> processing`,()=>{if(this.modes.push(o),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Aqe(s,a))}),qi(this.lexerDefinitionErrors)){jw(s);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=Eqe(s,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[o]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[o]=l.charCodeToPatternIdxToConfig,this.emptyGroups=Kc({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[o]=l.canBeOptimized}})}),this.defaultMode=n.defaultMode,!qi(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let o=Er(this.lexerDefinitionErrors,l=>l.message).join(`----------------------- `);throw new Error(`Errors detected in definition of Lexer: -`+o)}nn(this.lexerDefinitionWarning,s=>{bre(s.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(i&&(this.handleModes=Hs),this.trackStartLines===!1&&(this.computeNewColumn=p6),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Hs),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let s=Zc(this.canModeBeOptimized,(o,l,u)=>(l===!1&&o.push(u),o),[]);if(t.ensureOptimizations&&!qi(s))throw Error(`Lexer Modes: < ${s.join(", ")} > cannot be optimized. +`+o)}nn(this.lexerDefinitionWarning,s=>{kre(s.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(i&&(this.handleModes=Hs),this.trackStartLines===!1&&(this.computeNewColumn=p6),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Hs),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let s=Zc(this.canModeBeOptimized,(o,l,u)=>(l===!1&&o.push(u),o),[]);if(t.ensureOptimizations&&!qi(s))throw Error(`Lexer Modes: < ${s.join(", ")} > cannot be optimized. Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. - Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{bqe()}),this.TRACE_INIT("toFastProperties",()=>{kre(this)})})}tokenize(e,t=this.defaultMode){if(!qi(this.lexerDefinitionErrors)){let n=Er(this.lexerDefinitionErrors,i=>i.message).join(`----------------------- + Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{kqe()}),this.TRACE_INIT("toFastProperties",()=>{Cre(this)})})}tokenize(e,t=this.defaultMode){if(!qi(this.lexerDefinitionErrors)){let n=Er(this.lexerDefinitionErrors,i=>i.message).join(`----------------------- `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: -`+n)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let r,n,i,a,s,o,l,u,h,f,d,p,m,g,y,v=e,x=v.length,w=0,C=0,T=this.hasCustom?0:Math.floor(e.length/10),k=new Array(T),S=[],E=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0,L=qqe(this.emptyGroups),O=this.trackStartLines,R=this.config.lineTerminatorsPattern,A=0,N=[],M=[],D=[],B=[];Object.freeze(B);let P=!1,$=_(z=>{if(D.length===1&&z.tokenType.PUSH_MODE===void 0){let H=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(z);S.push({offset:z.startOffset,line:z.startLine,column:z.startColumn,length:z.image.length,message:H})}else{D.pop();let H=l2(D);N=this.patternIdxToConfig[H],M=this.charCodeToPatternIdxToConfig[H],A=N.length;let j=this.canModeBeOptimized[H]&&this.config.safeMode===!1;M&&j?P=!0:P=!1}},"pop_mode");function F(z){D.push(z),M=this.charCodeToPatternIdxToConfig[z],N=this.patternIdxToConfig[z],A=N.length,A=N.length;let H=this.canModeBeOptimized[z]&&this.config.safeMode===!1;M&&H?P=!0:P=!1}_(F,"push_mode"),F.call(this,t);let q,G=this.config.recoveryEnabled;for(;wo.length){o=a,h=a.length,l=u,q=ee;break}}}break}}if(h!==-1){if(f=q.group,f!==void 0&&(o=o!==null?o:e.substring(w,w+h),d=q.tokenTypeIdx,p=this.createTokenInstance(o,w,d,q.tokenType,E,I,h),this.handlePayload(p,l),f===!1?C=this.addToken(k,C,p):L[f].push(p)),O===!0&&q.canLineTerminator===!0){let J=0,U,le;R.lastIndex=0;do o=o!==null?o:e.substring(w,w+h),U=R.test(o),U===!0&&(le=R.lastIndex-1,J++);while(U===!0);J!==0?(E=E+J,I=h-le,this.updateTokenEndLineColumnLocation(p,f,le,J,E,I,h)):I=this.computeNewColumn(I,h)}else I=this.computeNewColumn(I,h);w=w+h,this.handleModes(q,$,F,p)}else{let J=w,U=E,le=I,ee=G===!1;for(;ee===!1&&w ${a2(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:r,customUserDescription:n,ruleName:i}){let a="Expecting: ",o=` +`+n)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let r,n,i,a,s,o,l,u,h,f,d,p,m,g,y,v=e,x=v.length,w=0,C=0,T=this.hasCustom?0:Math.floor(e.length/10),k=new Array(T),S=[],E=this.trackStartLines?1:void 0,I=this.trackStartLines?1:void 0,L=Wqe(this.emptyGroups),O=this.trackStartLines,R=this.config.lineTerminatorsPattern,A=0,N=[],M=[],D=[],B=[];Object.freeze(B);let P=!1,$=_(z=>{if(D.length===1&&z.tokenType.PUSH_MODE===void 0){let H=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(z);S.push({offset:z.startOffset,line:z.startLine,column:z.startColumn,length:z.image.length,message:H})}else{D.pop();let H=l2(D);N=this.patternIdxToConfig[H],M=this.charCodeToPatternIdxToConfig[H],A=N.length;let j=this.canModeBeOptimized[H]&&this.config.safeMode===!1;M&&j?P=!0:P=!1}},"pop_mode");function F(z){D.push(z),M=this.charCodeToPatternIdxToConfig[z],N=this.patternIdxToConfig[z],A=N.length,A=N.length;let H=this.canModeBeOptimized[z]&&this.config.safeMode===!1;M&&H?P=!0:P=!1}_(F,"push_mode"),F.call(this,t);let q,G=this.config.recoveryEnabled;for(;wo.length){o=a,h=a.length,l=u,q=ee;break}}}break}}if(h!==-1){if(f=q.group,f!==void 0&&(o=o!==null?o:e.substring(w,w+h),d=q.tokenTypeIdx,p=this.createTokenInstance(o,w,d,q.tokenType,E,I,h),this.handlePayload(p,l),f===!1?C=this.addToken(k,C,p):L[f].push(p)),O===!0&&q.canLineTerminator===!0){let J=0,U,le;R.lastIndex=0;do o=o!==null?o:e.substring(w,w+h),U=R.test(o),U===!0&&(le=R.lastIndex-1,J++);while(U===!0);J!==0?(E=E+J,I=h-le,this.updateTokenEndLineColumnLocation(p,f,le,J,E,I,h)):I=this.computeNewColumn(I,h)}else I=this.computeNewColumn(I,h);w=w+h,this.handleModes(q,$,F,p)}else{let J=w,U=E,le=I,ee=G===!1;for(;ee===!1&&w ${a2(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:r,customUserDescription:n,ruleName:i}){let a="Expecting: ",o=` but found: '`+Bh(t).image+"'";if(n)return a+n+o;{let l=Zc(e,(d,p)=>d.concat(p),[]),u=Er(l,d=>`[${Er(d,p=>a2(p)).join(", ")}]`),f=`one of these possible Token sequences: ${Er(u,(d,p)=>` ${p+1}. ${d}`).join(` `)}`;return a+f+o}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:r,ruleName:n}){let i="Expecting: ",s=` but found: '`+Bh(t).image+"'";if(r)return i+r+s;{let l=`expecting at least one iteration which starts with one of these possible Token sequences:: - <${Er(e,u=>`[${Er(u,h=>a2(h)).join(",")}]`).join(" ,")}>`;return i+l+s}}};Object.freeze(Cw);ZGt={buildRuleNotFoundError(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+`<- -inside top level rule: ->`+e.name+"<-"}},r2={buildDuplicateFoundError(e,t){function r(h){return h instanceof Qi?h.terminalType.name:h instanceof Il?h.nonTerminalName:""}_(r,"getExtraProductionArgument");let n=e.name,i=Bh(t),a=i.idx,s=Lh(i),o=r(i),l=a>0,u=`->${s}${l?a:""}<- ${o?`with argument: ->${o}<-`:""} + <${Er(e,u=>`[${Er(u,h=>a2(h)).join(",")}]`).join(" ,")}>`;return i+l+s}}};Object.freeze(Cw);tqt={buildRuleNotFoundError(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+`<- +inside top level rule: ->`+e.name+"<-"}},r2={buildDuplicateFoundError(e,t){function r(h){return h instanceof Qi?h.terminalType.name:h instanceof Ml?h.nonTerminalName:""}_(r,"getExtraProductionArgument");let n=e.name,i=Bh(t),a=i.idx,s=Lh(i),o=r(i),l=a>0,u=`->${s}${l?a:""}<- ${o?`with argument: ->${o}<-`:""} appears more than once (${t.length} times) in the top level rule: ->${n}<-. For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES `;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,` @@ -1277,38 +1277,38 @@ rule: <${t}> can be invoked from itself (directly or indirectly) without consuming any Tokens. The grammar path that causes this is: ${n} To fix this refactor your grammar to remove the left recursion. -see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let t;return e.topLevelRule instanceof Hw?t=e.topLevelRule.name:t=e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};_(tVe,"resolveGrammar");QGt=class extends Uw{static{_(this,"GastRefResolverVisitor")}constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){nn(Ss(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:Ml.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},JGt=class extends eD{static{_(this,"AbstractNextPossibleTokensWalker")}constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=ko(this.path.ruleStack).reverse(),this.occurrenceStack=ko(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let n=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){qi(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},eqt=class extends JGt{static{_(this,"NextAfterTokenWalker")}constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let n=t.concat(r),i=new hc({definition:n});this.possibleTokTypes=Yw(i),this.found=!0}}},rD=class extends eD{static{_(this,"AbstractNextTerminalAfterProductionWalker")}constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},tqt=class extends rD{static{_(this,"NextTerminalAfterManyWalker")}walkMany(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkMany(e,t,r)}},gPe=class extends rD{static{_(this,"NextTerminalAfterManySepWalker")}walkManySep(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkManySep(e,t,r)}},rqt=class extends rD{static{_(this,"NextTerminalAfterAtLeastOneWalker")}walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkAtLeastOne(e,t,r)}},yPe=class extends rD{static{_(this,"NextTerminalAfterAtLeastOneSepWalker")}walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkAtLeastOneSep(e,t,r)}};_(aN,"possiblePathsFrom");_(Lre,"nextPossibleTokensAfter");_(rVe,"expandTopLevelRule");(function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"})(va||(va={}));_(nD,"getProdType");_(LJ,"getLookaheadPaths");_(nVe,"buildLookaheadFuncForOr");_(iVe,"buildLookaheadFuncForOptionalProd");_(aVe,"buildAlternativesLookAheadFunc");_(sVe,"buildSingleAlternativeLookaheadFunction");nqt=class extends eD{static{_(this,"RestDefinitionFinderWalker")}constructor(e,t,r){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,r,n){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=r.concat(n),!0):!1}walkOption(e,t,r){this.checkIsTarget(e,va.OPTION,t,r)||super.walkOption(e,t,r)}walkAtLeastOne(e,t,r){this.checkIsTarget(e,va.REPETITION_MANDATORY,t,r)||super.walkOption(e,t,r)}walkAtLeastOneSep(e,t,r){this.checkIsTarget(e,va.REPETITION_MANDATORY_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}walkMany(e,t,r){this.checkIsTarget(e,va.REPETITION,t,r)||super.walkOption(e,t,r)}walkManySep(e,t,r){this.checkIsTarget(e,va.REPETITION_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}},oVe=class extends Uw{static{_(this,"InsideDefinitionFinderVisitor")}constructor(e,t,r){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=r,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,va.OPTION)}visitRepetition(e){this.checkIsTarget(e,va.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,va.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,va.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,va.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,va.ALTERNATION)}};_(IJ,"initializeArrayOfArrays");_(gM,"pathToHashKeys");_(lVe,"isUniquePrefixHash");_(Ire,"lookAheadSequenceFromAlternatives");_(T6,"getLookaheadPathsForOr");_(C6,"getLookaheadPathsForOptionalProd");_(sN,"containsPath");_(cVe,"isStrictPrefixOfPath");_(Mre,"areTokenCategoriesNotUsed");_(uVe,"validateLookahead");_(hVe,"validateGrammar");_(fVe,"validateDuplicateProductions");_(dVe,"identifyProductionForDuplicates");_(Nre,"getExtraProductionArgument");iqt=class extends Uw{static{_(this,"OccurrenceValidationCollector")}constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};_(pVe,"validateRuleDoesNotAlreadyExist");_(mVe,"validateRuleIsOverridden");_(Dre,"validateNoLeftRecursion");_(OS,"getFirstNoneTerminal");Ore=class extends Uw{static{_(this,"OrCollector")}constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};_(gVe,"validateEmptyOrAlternative");_(yVe,"validateAmbiguousAlternationAlternatives");aqt=class extends Uw{static{_(this,"RepetitionCollector")}constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};_(vVe,"validateTooManyAlts");_(xVe,"validateSomeNonEmptyLookaheadPath");_(bVe,"checkAlternativesAmbiguities");_(wVe,"checkPrefixAlternativesAmbiguities");_(kVe,"checkTerminalAndNoneTerminalsNameSpace");_(TVe,"resolveGrammar");_(CVe,"validateGrammar");SVe="MismatchedTokenException",EVe="NoViableAltException",AVe="EarlyExitException",_Ve="NotAllInputParsedException",RVe=[SVe,EVe,AVe,_Ve];Object.freeze(RVe);_(ZS,"isRecognitionException");iD=class extends Error{static{_(this,"RecognitionException")}constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},LVe=class extends iD{static{_(this,"MismatchedTokenException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=SVe}},sqt=class extends iD{static{_(this,"NoViableAltException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=EVe}},oqt=class extends iD{static{_(this,"NotAllInputParsedException")}constructor(e,t){super(e,t),this.name=_Ve}},lqt=class extends iD{static{_(this,"EarlyExitException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=AVe}},eQ={},IVe="InRuleRecoveryException",cqt=class extends Error{static{_(this,"InRuleRecoveryException")}constructor(e){super(e),this.name=IVe}},uqt=class{static{_(this,"Recoverable")}initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Ur(e,"recoveryEnabled")?e.recoveryEnabled:ip.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=MVe)}getTokenToInsert(e){let t=k6(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,r,n){let i=this.findReSyncTokenType(),a=this.exportLexerState(),s=[],o=!1,l=this.LA(1),u=this.LA(1),h=_(()=>{let f=this.LA(0),d=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:l,previous:f,ruleName:this.getCurrRuleFullName()}),p=new LVe(d,l,this.LA(0));p.resyncedTokens=XS(s),this.SAVE_ERROR(p)},"generateErrorMessage");for(;!o;)if(this.tokenMatcher(u,n)){h();return}else if(r.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(u,i)?o=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,s));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){let r=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new cqt("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||qi(t))return!1;let r=this.LA(1);return $w(t,i=>this.tokenMatcher(r,i))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(t);return Dl(r,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA(1),r=2;for(;;){let n=$w(e,i=>Rre(t,i));if(n!==void 0)return n;t=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return eQ;let e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return Er(e,(r,n)=>n===0?eQ:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:t[n],inRule:this.shortRuleNameToFullName(e[n-1])})}flattenFollowSet(){let e=Er(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return Dh(e)}getFollowSetFromFollowKey(e){if(e===eQ)return[qg];let t=e.ruleName+e.idxInCallingRule+yqe+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,qg)||t.push(e),t}reSyncTo(e){let t=[],r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return XS(t)}attemptInRepetitionRecovery(e,t,r,n,i,a,s){}getCurrentGrammarPath(e,t){let r=this.getHumanReadableRuleStack(),n=ko(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:n,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return Er(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};_(MVe,"attemptInRepetitionRecovery");hqt=4,Xg=8,fqt=8,NVe=1<Dre(t,t,r2))}validateEmptyOrAlternatives(e){return qu(e,t=>gVe(t,r2))}validateAmbiguousAlternationAlternatives(e,t){return qu(e,r=>yVe(r,t,r2))}validateSomeNonEmptyLookaheadPath(e,t){return xVe(e,t,r2)}buildLookaheadForAlternation(e){return nVe(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,aVe)}buildLookaheadForOptional(e){return iVe(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,nD(e.prodType),sVe)}},dqt=class{static{_(this,"LooksAhead")}initLooksAhead(e){this.dynamicTokensEnabled=Ur(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ip.dynamicTokensEnabled,this.maxLookahead=Ur(e,"maxLookahead")?e.maxLookahead:ip.maxLookahead,this.lookaheadStrategy=Ur(e,"lookaheadStrategy")?e.lookaheadStrategy:new Pre({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){nn(e,t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{let{alternation:r,repetition:n,option:i,repetitionMandatory:a,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:o}=OVe(t);nn(r,l=>{let u=l.idx===0?"":l.idx;this.TRACE_INIT(`${Lh(l)}${u}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:l.idx,rule:t,maxLookahead:l.maxLookahead||this.maxLookahead,hasPredicates:l.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=vM(this.fullRuleNameToShort[t.name],NVe,l.idx);this.setLaFuncCache(f,h)})}),nn(n,l=>{this.computeLookaheadFunc(t,l.idx,MJ,"Repetition",l.maxLookahead,Lh(l))}),nn(i,l=>{this.computeLookaheadFunc(t,l.idx,DVe,"Option",l.maxLookahead,Lh(l))}),nn(a,l=>{this.computeLookaheadFunc(t,l.idx,NJ,"RepetitionMandatory",l.maxLookahead,Lh(l))}),nn(s,l=>{this.computeLookaheadFunc(t,l.idx,yM,"RepetitionMandatoryWithSeparator",l.maxLookahead,Lh(l))}),nn(o,l=>{this.computeLookaheadFunc(t,l.idx,DJ,"RepetitionWithSeparator",l.maxLookahead,Lh(l))})})})}computeLookaheadFunc(e,t,r,n,i,a){this.TRACE_INIT(`${a}${t===0?"":t}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:n}),o=vM(this.fullRuleNameToShort[e.name],r,t);this.setLaFuncCache(o,s)})}getKeyForAutomaticLookahead(e,t){let r=this.getLastExplicitRuleShortName();return vM(r,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},pqt=class extends Uw{static{_(this,"DslMethodsCollectorVisitor")}constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},qI=new pqt;_(OVe,"collectMethods");_(OJ,"setNodeLocationOnlyOffset");_(PJ,"setNodeLocationFull");_(PVe,"addTerminalToCst");_(BVe,"addNoneTerminalToCst");mqt="name";_(Bre,"defineNameProp");_(FVe,"defaultVisit");_($Ve,"createBaseSemanticVisitorConstructor");_(zVe,"createBaseVisitorConstructorWithDefaults");(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(BJ||(BJ={}));_(GVe,"validateVisitor");_(qVe,"validateMissingCstMethods");gqt=class{static{_(this,"TreeBuilder")}initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Ur(e,"nodeLocationTracking")?e.nodeLocationTracking:ip.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Hs,this.cstFinallyStateUpdate=Hs,this.cstPostTerminal=Hs,this.cstPostNonTerminal=Hs,this.cstPostRule=Hs;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=PJ,this.setNodeLocationFromNode=PJ,this.cstPostRule=Hs,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Hs,this.setNodeLocationFromNode=Hs,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=OJ,this.setNodeLocationFromNode=OJ,this.cstPostRule=Hs,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Hs,this.setNodeLocationFromNode=Hs,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Hs,this.setNodeLocationFromNode=Hs,this.cstPostRule=Hs,this.setInitialNodeLocation=Hs;else throw Error(`Invalid config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?r.endOffset=t.endOffset:r.startOffset=NaN}cstPostTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];PVe(r,t,e),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];BVe(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(rp(this.baseCstVisitorConstructor)){let e=$Ve(this.className,jc(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(rp(this.baseCstVisitorWithDefaultsConstructor)){let e=zVe(this.className,jc(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}},yqt=class{static{_(this,"LexerAdapter")}initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):oN}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?oN:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}},vqt=class{static{_(this,"RecognizerApi")}ACTION(e){return e.call(this)}consume(e,t,r){return this.consumeInternal(t,e,r)}subrule(e,t,r){return this.subruleInternal(t,e,r)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,r=lN){if(Dl(this.definedRulesNames,e)){let a={message:r2.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Ml.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);let n=this.defineRule(e,t,r);return this[e]=n,n}OVERRIDE_RULE(e,t,r=lN){let n=mVe(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(n);let i=this.defineRule(e,t,r);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);let r=this.saveRecogState();try{return e.apply(this,t),!0}catch(n){if(ZS(n))return!1;throw n}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return hqe(Ss(this.gastProductionsCache))}},xqt=class{static{_(this,"RecognizerEngine")}initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=KS,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},Ur(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. +see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let t;return e.topLevelRule instanceof Hw?t=e.topLevelRule.name:t=e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};_(nVe,"resolveGrammar");rqt=class extends Uw{static{_(this,"GastRefResolverVisitor")}constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){nn(Ss(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:Nl.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},nqt=class extends eD{static{_(this,"AbstractNextPossibleTokensWalker")}constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=ko(this.path.ruleStack).reverse(),this.occurrenceStack=ko(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let n=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,n)}}updateExpectedNext(){qi(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},iqt=class extends nqt{static{_(this,"NextAfterTokenWalker")}constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let n=t.concat(r),i=new fc({definition:n});this.possibleTokTypes=Yw(i),this.found=!0}}},rD=class extends eD{static{_(this,"AbstractNextTerminalAfterProductionWalker")}constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},aqt=class extends rD{static{_(this,"NextTerminalAfterManyWalker")}walkMany(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkMany(e,t,r)}},vPe=class extends rD{static{_(this,"NextTerminalAfterManySepWalker")}walkManySep(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkManySep(e,t,r)}},sqt=class extends rD{static{_(this,"NextTerminalAfterAtLeastOneWalker")}walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkAtLeastOne(e,t,r)}},xPe=class extends rD{static{_(this,"NextTerminalAfterAtLeastOneSepWalker")}walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){let n=Bh(t.concat(r));this.result.isEndOfRule=n===void 0,n instanceof Qi&&(this.result.token=n.terminalType,this.result.occurrence=n.idx)}else super.walkAtLeastOneSep(e,t,r)}};_(aN,"possiblePathsFrom");_(Mre,"nextPossibleTokensAfter");_(iVe,"expandTopLevelRule");(function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"})(va||(va={}));_(nD,"getProdType");_(MJ,"getLookaheadPaths");_(aVe,"buildLookaheadFuncForOr");_(sVe,"buildLookaheadFuncForOptionalProd");_(oVe,"buildAlternativesLookAheadFunc");_(lVe,"buildSingleAlternativeLookaheadFunction");oqt=class extends eD{static{_(this,"RestDefinitionFinderWalker")}constructor(e,t,r){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,r,n){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=r.concat(n),!0):!1}walkOption(e,t,r){this.checkIsTarget(e,va.OPTION,t,r)||super.walkOption(e,t,r)}walkAtLeastOne(e,t,r){this.checkIsTarget(e,va.REPETITION_MANDATORY,t,r)||super.walkOption(e,t,r)}walkAtLeastOneSep(e,t,r){this.checkIsTarget(e,va.REPETITION_MANDATORY_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}walkMany(e,t,r){this.checkIsTarget(e,va.REPETITION,t,r)||super.walkOption(e,t,r)}walkManySep(e,t,r){this.checkIsTarget(e,va.REPETITION_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}},cVe=class extends Uw{static{_(this,"InsideDefinitionFinderVisitor")}constructor(e,t,r){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=r,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,va.OPTION)}visitRepetition(e){this.checkIsTarget(e,va.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,va.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,va.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,va.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,va.ALTERNATION)}};_(NJ,"initializeArrayOfArrays");_(gM,"pathToHashKeys");_(uVe,"isUniquePrefixHash");_(Nre,"lookAheadSequenceFromAlternatives");_(T6,"getLookaheadPathsForOr");_(C6,"getLookaheadPathsForOptionalProd");_(sN,"containsPath");_(hVe,"isStrictPrefixOfPath");_(Dre,"areTokenCategoriesNotUsed");_(fVe,"validateLookahead");_(dVe,"validateGrammar");_(pVe,"validateDuplicateProductions");_(mVe,"identifyProductionForDuplicates");_(Ore,"getExtraProductionArgument");lqt=class extends Uw{static{_(this,"OccurrenceValidationCollector")}constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};_(gVe,"validateRuleDoesNotAlreadyExist");_(yVe,"validateRuleIsOverridden");_(Pre,"validateNoLeftRecursion");_(OS,"getFirstNoneTerminal");Bre=class extends Uw{static{_(this,"OrCollector")}constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};_(vVe,"validateEmptyOrAlternative");_(xVe,"validateAmbiguousAlternationAlternatives");cqt=class extends Uw{static{_(this,"RepetitionCollector")}constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};_(bVe,"validateTooManyAlts");_(wVe,"validateSomeNonEmptyLookaheadPath");_(kVe,"checkAlternativesAmbiguities");_(TVe,"checkPrefixAlternativesAmbiguities");_(CVe,"checkTerminalAndNoneTerminalsNameSpace");_(SVe,"resolveGrammar");_(EVe,"validateGrammar");AVe="MismatchedTokenException",_Ve="NoViableAltException",RVe="EarlyExitException",LVe="NotAllInputParsedException",IVe=[AVe,_Ve,RVe,LVe];Object.freeze(IVe);_(ZS,"isRecognitionException");iD=class extends Error{static{_(this,"RecognitionException")}constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},MVe=class extends iD{static{_(this,"MismatchedTokenException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=AVe}},uqt=class extends iD{static{_(this,"NoViableAltException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=_Ve}},hqt=class extends iD{static{_(this,"NotAllInputParsedException")}constructor(e,t){super(e,t),this.name=LVe}},fqt=class extends iD{static{_(this,"EarlyExitException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=RVe}},rQ={},NVe="InRuleRecoveryException",dqt=class extends Error{static{_(this,"InRuleRecoveryException")}constructor(e){super(e),this.name=NVe}},pqt=class{static{_(this,"Recoverable")}initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=Ur(e,"recoveryEnabled")?e.recoveryEnabled:ip.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=DVe)}getTokenToInsert(e){let t=k6(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,r,n){let i=this.findReSyncTokenType(),a=this.exportLexerState(),s=[],o=!1,l=this.LA(1),u=this.LA(1),h=_(()=>{let f=this.LA(0),d=this.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:l,previous:f,ruleName:this.getCurrRuleFullName()}),p=new MVe(d,l,this.LA(0));p.resyncedTokens=XS(s),this.SAVE_ERROR(p)},"generateErrorMessage");for(;!o;)if(this.tokenMatcher(u,n)){h();return}else if(r.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(u,i)?o=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,s));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){let r=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new dqt("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||qi(t))return!1;let r=this.LA(1);return $w(t,i=>this.tokenMatcher(r,i))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(t);return Ol(r,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA(1),r=2;for(;;){let n=$w(e,i=>Ire(t,i));if(n!==void 0)return n;t=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return rQ;let e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return Er(e,(r,n)=>n===0?rQ:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:t[n],inRule:this.shortRuleNameToFullName(e[n-1])})}flattenFollowSet(){let e=Er(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return Dh(e)}getFollowSetFromFollowKey(e){if(e===rQ)return[qg];let t=e.ruleName+e.idxInCallingRule+xqe+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,qg)||t.push(e),t}reSyncTo(e){let t=[],r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return XS(t)}attemptInRepetitionRecovery(e,t,r,n,i,a,s){}getCurrentGrammarPath(e,t){let r=this.getHumanReadableRuleStack(),n=ko(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:n,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return Er(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};_(DVe,"attemptInRepetitionRecovery");mqt=4,Xg=8,gqt=8,OVe=1<Pre(t,t,r2))}validateEmptyOrAlternatives(e){return qu(e,t=>vVe(t,r2))}validateAmbiguousAlternationAlternatives(e,t){return qu(e,r=>xVe(r,t,r2))}validateSomeNonEmptyLookaheadPath(e,t){return wVe(e,t,r2)}buildLookaheadForAlternation(e){return aVe(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,oVe)}buildLookaheadForOptional(e){return sVe(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,nD(e.prodType),lVe)}},yqt=class{static{_(this,"LooksAhead")}initLooksAhead(e){this.dynamicTokensEnabled=Ur(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ip.dynamicTokensEnabled,this.maxLookahead=Ur(e,"maxLookahead")?e.maxLookahead:ip.maxLookahead,this.lookaheadStrategy=Ur(e,"lookaheadStrategy")?e.lookaheadStrategy:new Fre({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){nn(e,t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{let{alternation:r,repetition:n,option:i,repetitionMandatory:a,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:o}=BVe(t);nn(r,l=>{let u=l.idx===0?"":l.idx;this.TRACE_INIT(`${Lh(l)}${u}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:l.idx,rule:t,maxLookahead:l.maxLookahead||this.maxLookahead,hasPredicates:l.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=vM(this.fullRuleNameToShort[t.name],OVe,l.idx);this.setLaFuncCache(f,h)})}),nn(n,l=>{this.computeLookaheadFunc(t,l.idx,DJ,"Repetition",l.maxLookahead,Lh(l))}),nn(i,l=>{this.computeLookaheadFunc(t,l.idx,PVe,"Option",l.maxLookahead,Lh(l))}),nn(a,l=>{this.computeLookaheadFunc(t,l.idx,OJ,"RepetitionMandatory",l.maxLookahead,Lh(l))}),nn(s,l=>{this.computeLookaheadFunc(t,l.idx,yM,"RepetitionMandatoryWithSeparator",l.maxLookahead,Lh(l))}),nn(o,l=>{this.computeLookaheadFunc(t,l.idx,PJ,"RepetitionWithSeparator",l.maxLookahead,Lh(l))})})})}computeLookaheadFunc(e,t,r,n,i,a){this.TRACE_INIT(`${a}${t===0?"":t}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:n}),o=vM(this.fullRuleNameToShort[e.name],r,t);this.setLaFuncCache(o,s)})}getKeyForAutomaticLookahead(e,t){let r=this.getLastExplicitRuleShortName();return vM(r,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},vqt=class extends Uw{static{_(this,"DslMethodsCollectorVisitor")}constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},qI=new vqt;_(BVe,"collectMethods");_(BJ,"setNodeLocationOnlyOffset");_(FJ,"setNodeLocationFull");_(FVe,"addTerminalToCst");_($Ve,"addNoneTerminalToCst");xqt="name";_($re,"defineNameProp");_(zVe,"defaultVisit");_(GVe,"createBaseSemanticVisitorConstructor");_(qVe,"createBaseVisitorConstructorWithDefaults");(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})($J||($J={}));_(VVe,"validateVisitor");_(WVe,"validateMissingCstMethods");bqt=class{static{_(this,"TreeBuilder")}initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Ur(e,"nodeLocationTracking")?e.nodeLocationTracking:ip.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Hs,this.cstFinallyStateUpdate=Hs,this.cstPostTerminal=Hs,this.cstPostNonTerminal=Hs,this.cstPostRule=Hs;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=FJ,this.setNodeLocationFromNode=FJ,this.cstPostRule=Hs,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Hs,this.setNodeLocationFromNode=Hs,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=BJ,this.setNodeLocationFromNode=BJ,this.cstPostRule=Hs,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Hs,this.setNodeLocationFromNode=Hs,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Hs,this.setNodeLocationFromNode=Hs,this.cstPostRule=Hs,this.setInitialNodeLocation=Hs;else throw Error(`Invalid config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?r.endOffset=t.endOffset:r.startOffset=NaN}cstPostTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];FVe(r,t,e),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];$Ve(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(rp(this.baseCstVisitorConstructor)){let e=GVe(this.className,jc(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(rp(this.baseCstVisitorWithDefaultsConstructor)){let e=qVe(this.className,jc(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}},wqt=class{static{_(this,"LexerAdapter")}initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):oN}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?oN:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}},kqt=class{static{_(this,"RecognizerApi")}ACTION(e){return e.call(this)}consume(e,t,r){return this.consumeInternal(t,e,r)}subrule(e,t,r){return this.subruleInternal(t,e,r)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,r=lN){if(Ol(this.definedRulesNames,e)){let a={message:r2.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Nl.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);let n=this.defineRule(e,t,r);return this[e]=n,n}OVERRIDE_RULE(e,t,r=lN){let n=yVe(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(n);let i=this.defineRule(e,t,r);return this[e]=i,i}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);let r=this.saveRecogState();try{return e.apply(this,t),!0}catch(n){if(ZS(n))return!1;throw n}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return dqe(Ss(this.gastProductionsCache))}},Tqt=class{static{_(this,"RecognizerEngine")}initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=KS,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},Ur(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 For Further details.`);if(Un(e)){if(qi(e))throw Error(`A Token Vocabulary cannot be empty. Note that the first argument for the parser constructor is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 - For Further details.`)}if(Un(e))this.tokensMap=Zc(e,(i,a)=>(i[a.name]=a,i),{});else if(Ur(e,"modes")&&Oh(Dh(Ss(e.modes)),Jqe)){let i=Dh(Ss(e.modes)),a=xre(i);this.tokensMap=Zc(a,(s,o)=>(s[o.name]=o,s),{})}else if(Wu(e))this.tokensMap=ko(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=qg;let r=Ur(e,"modes")?Dh(Ss(e.modes)):Ss(e),n=Oh(r,i=>qi(i.categoryMatches));this.tokenMatcher=n?KS:Xw,jw(Ss(this.tokensMap))}defineRule(e,t,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' -Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=Ur(r,"resyncEnabled")?r.resyncEnabled:lN.resyncEnabled,i=Ur(r,"recoveryValueFunc")?r.recoveryValueFunc:lN.recoveryValueFunc,a=this.ruleShortNameIdx<a.call(this)&&s.call(this),"lookAheadFunc")}}else i=e;if(n.call(this)===!0)return i.call(this)}atLeastOneInternal(e,t){let r=this.getKeyForAutomaticLookahead(NJ,e);return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let n=this.getLaFuncFromCache(r),i;if(typeof t!="function"){i=t.DEF;let a=t.GATE;if(a!==void 0){let s=n;n=_(()=>a.call(this)&&s.call(this),"lookAheadFunc")}}else i=t;if(n.call(this)===!0){let a=this.doSingleRepetition(i);for(;n.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,va.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],n,NJ,e,rqt)}atLeastOneSepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(yM,e);this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){let n=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){n.call(this);let s=_(()=>this.tokenMatcher(this.LA(1),i),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,n,yPe],s,yM,e,yPe)}else throw this.raiseEarlyExitException(e,va.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let r=this.getKeyForAutomaticLookahead(MJ,e);return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let n=this.getLaFuncFromCache(r),i;if(typeof t!="function"){i=t.DEF;let s=t.GATE;if(s!==void 0){let o=n;n=_(()=>s.call(this)&&o.call(this),"lookaheadFunction")}}else i=t;let a=!0;for(;n.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],n,MJ,e,tqt,a)}manySepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(DJ,e);this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){let n=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){n.call(this);let s=_(()=>this.tokenMatcher(this.LA(1),i),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,n,gPe],s,DJ,e,gPe)}}repetitionSepSecondInternal(e,t,r,n,i){for(;r();)this.CONSUME(t),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,n,i],r,yM,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let r=this.getKeyForAutomaticLookahead(NVe,t),n=Un(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,n);if(a!==void 0)return n[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new oqt(t,e))}}subruleInternal(e,t,r){let n;try{let i=r!==void 0?r.ARGS:void 0;return this.subruleIdx=t,n=e.apply(this,i),this.cstPostNonTerminal(n,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),n}catch(i){throw this.subruleInternalError(i,r,e.ruleName)}}subruleInternalError(e,t,r){throw ZS(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,t,r){let n;try{let i=this.LA(1);this.tokenMatcher(i,e)===!0?(this.consumeToken(),n=i):this.consumeInternalError(e,i,r)}catch(i){n=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,n),n}consumeInternalError(e,t,r){let n,i=this.LA(0);throw r!==void 0&&r.ERR_MSG?n=r.ERR_MSG:n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new LVe(n,t,i))}consumeInternalRecovery(e,t,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){let n=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,n)}catch(i){throw i.name===IVe?r:i}}else throw r}saveRecogState(){let e=this.errors,t=ko(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),qg)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},bqt=class{static{_(this,"ErrorHandler")}initErrorHandler(e){this._errors=[],this.errorMessageProvider=Ur(e,"errorMessageProvider")?e.errorMessageProvider:ip.errorMessageProvider}SAVE_ERROR(e){if(ZS(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:ko(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return ko(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,r){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],s=C6(e,i,t,this.maxLookahead)[0],o=[];for(let u=1;u<=this.maxLookahead;u++)o.push(this.LA(u));let l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:o,previous:this.LA(0),customUserDescription:r,ruleName:n});throw this.SAVE_ERROR(new lqt(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let r=this.getCurrRuleFullName(),n=this.getGAstProductions()[r],i=T6(e,n,this.maxLookahead),a=[];for(let l=1;l<=this.maxLookahead;l++)a.push(this.LA(l));let s=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:a,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new sqt(o,this.LA(1),s))}},wqt=class{static{_(this,"ContentAssist")}initContentAssist(){}computeContentAssist(e,t){let r=this.gastProductionsCache[e];if(rp(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Lre([r],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let t=Bh(e.ruleStack),n=this.getGAstProductions()[t];return new eqt(n,e).startWalking()}},aD={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(aD);vPe=!0,xPe=Math.pow(2,Xg)-1,VVe=Rw({name:"RECORDING_PHASE_TOKEN",pattern:Rl.NA});jw([VVe]);WVe=k6(VVe,`This IToken indicates the Parser is in Recording Phase - See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(WVe);kqt={name:`This CSTNode indicates the Parser is in Recording Phase - See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Tqt=class{static{_(this,"GastRecorder")}initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(r,n){return this.consumeInternalRecord(r,e,n)},this[`SUBRULE${t}`]=function(r,n){return this.subruleInternalRecord(r,e,n)},this[`OPTION${t}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${t}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${t}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${t}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${t}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${t}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,t,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let t=0;t<10;t++){let r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return oN}topLevelRuleRecord(e,t){try{let r=new Hw({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+` + For Further details.`)}if(Un(e))this.tokensMap=Zc(e,(i,a)=>(i[a.name]=a,i),{});else if(Ur(e,"modes")&&Oh(Dh(Ss(e.modes)),tVe)){let i=Dh(Ss(e.modes)),a=wre(i);this.tokensMap=Zc(a,(s,o)=>(s[o.name]=o,s),{})}else if(Wu(e))this.tokensMap=ko(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=qg;let r=Ur(e,"modes")?Dh(Ss(e.modes)):Ss(e),n=Oh(r,i=>qi(i.categoryMatches));this.tokenMatcher=n?KS:Xw,jw(Ss(this.tokensMap))}defineRule(e,t,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' +Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=Ur(r,"resyncEnabled")?r.resyncEnabled:lN.resyncEnabled,i=Ur(r,"recoveryValueFunc")?r.recoveryValueFunc:lN.recoveryValueFunc,a=this.ruleShortNameIdx<a.call(this)&&s.call(this),"lookAheadFunc")}}else i=e;if(n.call(this)===!0)return i.call(this)}atLeastOneInternal(e,t){let r=this.getKeyForAutomaticLookahead(OJ,e);return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let n=this.getLaFuncFromCache(r),i;if(typeof t!="function"){i=t.DEF;let a=t.GATE;if(a!==void 0){let s=n;n=_(()=>a.call(this)&&s.call(this),"lookAheadFunc")}}else i=t;if(n.call(this)===!0){let a=this.doSingleRepetition(i);for(;n.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,va.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],n,OJ,e,sqt)}atLeastOneSepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(yM,e);this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){let n=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){n.call(this);let s=_(()=>this.tokenMatcher(this.LA(1),i),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,n,xPe],s,yM,e,xPe)}else throw this.raiseEarlyExitException(e,va.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let r=this.getKeyForAutomaticLookahead(DJ,e);return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let n=this.getLaFuncFromCache(r),i;if(typeof t!="function"){i=t.DEF;let s=t.GATE;if(s!==void 0){let o=n;n=_(()=>s.call(this)&&o.call(this),"lookaheadFunction")}}else i=t;let a=!0;for(;n.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],n,DJ,e,aqt,a)}manySepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(PJ,e);this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){let n=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){n.call(this);let s=_(()=>this.tokenMatcher(this.LA(1),i),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,n,vPe],s,PJ,e,vPe)}}repetitionSepSecondInternal(e,t,r,n,i){for(;r();)this.CONSUME(t),n.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,n,i],r,yM,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let r=this.getKeyForAutomaticLookahead(OVe,t),n=Un(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,n);if(a!==void 0)return n[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new hqt(t,e))}}subruleInternal(e,t,r){let n;try{let i=r!==void 0?r.ARGS:void 0;return this.subruleIdx=t,n=e.apply(this,i),this.cstPostNonTerminal(n,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),n}catch(i){throw this.subruleInternalError(i,r,e.ruleName)}}subruleInternalError(e,t,r){throw ZS(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,t,r){let n;try{let i=this.LA(1);this.tokenMatcher(i,e)===!0?(this.consumeToken(),n=i):this.consumeInternalError(e,i,r)}catch(i){n=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,n),n}consumeInternalError(e,t,r){let n,i=this.LA(0);throw r!==void 0&&r.ERR_MSG?n=r.ERR_MSG:n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new MVe(n,t,i))}consumeInternalRecovery(e,t,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){let n=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,n)}catch(i){throw i.name===NVe?r:i}}else throw r}saveRecogState(){let e=this.errors,t=ko(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),qg)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},Cqt=class{static{_(this,"ErrorHandler")}initErrorHandler(e){this._errors=[],this.errorMessageProvider=Ur(e,"errorMessageProvider")?e.errorMessageProvider:ip.errorMessageProvider}SAVE_ERROR(e){if(ZS(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:ko(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return ko(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,r){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],s=C6(e,i,t,this.maxLookahead)[0],o=[];for(let u=1;u<=this.maxLookahead;u++)o.push(this.LA(u));let l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:o,previous:this.LA(0),customUserDescription:r,ruleName:n});throw this.SAVE_ERROR(new fqt(l,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let r=this.getCurrRuleFullName(),n=this.getGAstProductions()[r],i=T6(e,n,this.maxLookahead),a=[];for(let l=1;l<=this.maxLookahead;l++)a.push(this.LA(l));let s=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:a,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new uqt(o,this.LA(1),s))}},Sqt=class{static{_(this,"ContentAssist")}initContentAssist(){}computeContentAssist(e,t){let r=this.gastProductionsCache[e];if(rp(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Mre([r],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let t=Bh(e.ruleStack),n=this.getGAstProductions()[t];return new iqt(n,e).startWalking()}},aD={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(aD);bPe=!0,wPe=Math.pow(2,Xg)-1,HVe=Rw({name:"RECORDING_PHASE_TOKEN",pattern:Ll.NA});jw([HVe]);UVe=k6(HVe,`This IToken indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(UVe);Eqt={name:`This CSTNode indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Aqt=class{static{_(this,"GastRecorder")}initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(r,n){return this.consumeInternalRecord(r,e,n)},this[`SUBRULE${t}`]=function(r,n){return this.subruleInternalRecord(r,e,n)},this[`OPTION${t}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${t}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${t}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${t}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${t}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${t}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,t,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let t=0;t<10;t++){let r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return oN}topLevelRuleRecord(e,t){try{let r=new Hw({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+` This error was thrown during the "grammar recording phase" For more info see: - https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,t){return dw.call(this,wo,e,t)}atLeastOneInternalRecord(e,t){dw.call(this,Qc,t,e)}atLeastOneSepFirstInternalRecord(e,t){dw.call(this,Jc,t,e,vPe)}manyInternalRecord(e,t){dw.call(this,Ia,t,e)}manySepFirstInternalRecord(e,t){dw.call(this,fc,t,e,vPe)}orInternalRecord(e,t){return HVe.call(this,e,t)}subruleInternalRecord(e,t,r){if(QS(t),!e||Ur(e,"ruleName")===!1){let s=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> - inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let n=l2(this.recordingProdStack),i=e.ruleName,a=new Il({idx:t,nonTerminalName:i,label:r?.LABEL,referencedRule:void 0});return n.definition.push(a),this.outputCst?kqt:aD}consumeInternalRecord(e,t,r){if(QS(t),!Are(e)){let a=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> - inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let n=l2(this.recordingProdStack),i=new Qi({idx:t,terminalType:e,label:r?.LABEL});return n.definition.push(i),WVe}};_(dw,"recordProd");_(HVe,"recordOrProd");_(FJ,"getIdxSuffix");_(QS,"assertMethodIdxIsValid");Cqt=class{static{_(this,"PerformanceTracer")}initPerformanceTracer(e){if(Ur(e,"traceInitPerf")){let t=e.traceInitPerf,r=typeof t=="number";this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=ip.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);let{time:n,value:i}=wre(t),a=n>10?console.warn:console.log;return this.traceInitIndent time: ${n}ms`),this.traceInitIndent--,i}else return t()}};_(UVe,"applyMixins");oN=k6(qg,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(oN);ip=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Cw,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),lN=Object.freeze({recoveryValueFunc:_(()=>{},"recoveryValueFunc"),resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Ml||(Ml={}));_($J,"EMPTY_ALT");Fre=class YVe{static{_(this,"Parser")}static performSelfAnalysis(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let t;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{kre(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),nn(this.definedRulesNames,i=>{let s=this[i].originalGrammarAction,o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=TVe({rules:Ss(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(qi(n)&&this.skipValidations===!1){let i=CVe({rules:Ss(this.gastProductionsCache),tokenTypes:Ss(this.tokensMap),errMsgProvider:r2,grammarName:r}),a=uVe({lookaheadStrategy:this.lookaheadStrategy,rules:Ss(this.gastProductionsCache),tokenTypes:Ss(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,a)}}),qi(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=vqe(Ss(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,a;(a=(i=this.lookaheadStrategy).initialize)===null||a===void 0||a.call(i,{rules:Ss(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Ss(this.gastProductionsCache))})),!YVe.DEFER_DEFINITION_ERRORS_HANDLING&&!qi(this.definitionErrors))throw t=Er(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected: + https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,t){return dw.call(this,wo,e,t)}atLeastOneInternalRecord(e,t){dw.call(this,Qc,t,e)}atLeastOneSepFirstInternalRecord(e,t){dw.call(this,Jc,t,e,bPe)}manyInternalRecord(e,t){dw.call(this,Ia,t,e)}manySepFirstInternalRecord(e,t){dw.call(this,dc,t,e,bPe)}orInternalRecord(e,t){return YVe.call(this,e,t)}subruleInternalRecord(e,t,r){if(QS(t),!e||Ur(e,"ruleName")===!1){let s=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let n=l2(this.recordingProdStack),i=e.ruleName,a=new Ml({idx:t,nonTerminalName:i,label:r?.LABEL,referencedRule:void 0});return n.definition.push(a),this.outputCst?Eqt:aD}consumeInternalRecord(e,t,r){if(QS(t),!Rre(e)){let a=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let n=l2(this.recordingProdStack),i=new Qi({idx:t,terminalType:e,label:r?.LABEL});return n.definition.push(i),UVe}};_(dw,"recordProd");_(YVe,"recordOrProd");_(zJ,"getIdxSuffix");_(QS,"assertMethodIdxIsValid");_qt=class{static{_(this,"PerformanceTracer")}initPerformanceTracer(e){if(Ur(e,"traceInitPerf")){let t=e.traceInitPerf,r=typeof t=="number";this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=ip.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);let{time:n,value:i}=Tre(t),a=n>10?console.warn:console.log;return this.traceInitIndent time: ${n}ms`),this.traceInitIndent--,i}else return t()}};_(XVe,"applyMixins");oN=k6(qg,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(oN);ip=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Cw,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),lN=Object.freeze({recoveryValueFunc:_(()=>{},"recoveryValueFunc"),resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Nl||(Nl={}));_(GJ,"EMPTY_ALT");zre=class jVe{static{_(this,"Parser")}static performSelfAnalysis(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let t;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{Cre(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),nn(this.definedRulesNames,i=>{let s=this[i].originalGrammarAction,o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=SVe({rules:Ss(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(qi(n)&&this.skipValidations===!1){let i=EVe({rules:Ss(this.gastProductionsCache),tokenTypes:Ss(this.tokensMap),errMsgProvider:r2,grammarName:r}),a=fVe({lookaheadStrategy:this.lookaheadStrategy,rules:Ss(this.gastProductionsCache),tokenTypes:Ss(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,a)}}),qi(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=bqe(Ss(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,a;(a=(i=this.lookaheadStrategy).initialize)===null||a===void 0||a.call(i,{rules:Ss(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Ss(this.gastProductionsCache))})),!jVe.DEFER_DEFINITION_ERRORS_HANDLING&&!qi(this.definitionErrors))throw t=Er(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected: ${t.join(` ------------------------------- `)}`)})}constructor(t,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(t,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),Ur(r,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. Please use the flag on the relevant DSL method instead. See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES - For further details.`);this.skipValidations=Ur(r,"skipValidations")?r.skipValidations:ip.skipValidations}};Fre.DEFER_DEFINITION_ERRORS_HANDLING=!1;UVe(Fre,[uqt,dqt,gqt,yqt,xqt,vqt,bqt,wqt,Tqt,Cqt]);Sqt=class extends Fre{static{_(this,"EmbeddedActionsParser")}constructor(e,t=ip){let r=ko(t);r.outputCst=!1,super(e,r)}};_(XVe,"arrayMap");jVe=XVe;_(KVe,"listCacheClear");Eqt=KVe;_(ZVe,"eq");QVe=ZVe;_(JVe,"assocIndexOf");sD=JVe,Aqt=Array.prototype,_qt=Aqt.splice;_(eWe,"listCacheDelete");Rqt=eWe;_(tWe,"listCacheGet");Lqt=tWe;_(rWe,"listCacheHas");Iqt=rWe;_(nWe,"listCacheSet");Mqt=nWe;_(S2,"ListCache");S2.prototype.clear=Eqt;S2.prototype.delete=Rqt;S2.prototype.get=Lqt;S2.prototype.has=Iqt;S2.prototype.set=Mqt;oD=S2;_(iWe,"stackClear");Nqt=iWe;_(aWe,"stackDelete");Dqt=aWe;_(sWe,"stackGet");Oqt=sWe;_(oWe,"stackHas");Pqt=oWe,Bqt=typeof global=="object"&&global&&global.Object===Object&&global,lWe=Bqt,Fqt=typeof self=="object"&&self&&self.Object===Object&&self,$qt=lWe||Fqt||Function("return this")(),cp=$qt,zqt=cp.Symbol,yd=zqt,cWe=Object.prototype,Gqt=cWe.hasOwnProperty,qqt=cWe.toString,iS=yd?yd.toStringTag:void 0;_(uWe,"getRawTag");Vqt=uWe,Wqt=Object.prototype,Hqt=Wqt.toString;_(hWe,"objectToString");Uqt=hWe,Yqt="[object Null]",Xqt="[object Undefined]",bPe=yd?yd.toStringTag:void 0;_(fWe,"baseGetTag");Kw=fWe;_(dWe,"isObject");$re=dWe,jqt="[object AsyncFunction]",Kqt="[object Function]",Zqt="[object GeneratorFunction]",Qqt="[object Proxy]";_(pWe,"isFunction");mWe=pWe,Jqt=cp["__core-js_shared__"],tQ=Jqt,wPe=(function(){var e=/[^.]+$/.exec(tQ&&tQ.keys&&tQ.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();_(gWe,"isMasked");eVt=gWe,tVt=Function.prototype,rVt=tVt.toString;_(yWe,"toSource");E2=yWe,nVt=/[\\^$.*+?()[\]{}|]/g,iVt=/^\[object .+?Constructor\]$/,aVt=Function.prototype,sVt=Object.prototype,oVt=aVt.toString,lVt=sVt.hasOwnProperty,cVt=RegExp("^"+oVt.call(lVt).replace(nVt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");_(vWe,"baseIsNative");uVt=vWe;_(xWe,"getValue");hVt=xWe;_(bWe,"getNative");Zw=bWe,fVt=Zw(cp,"Map"),JS=fVt,dVt=Zw(Object,"create"),e6=dVt;_(wWe,"hashClear");pVt=wWe;_(kWe,"hashDelete");mVt=kWe,gVt="__lodash_hash_undefined__",yVt=Object.prototype,vVt=yVt.hasOwnProperty;_(TWe,"hashGet");xVt=TWe,bVt=Object.prototype,wVt=bVt.hasOwnProperty;_(CWe,"hashHas");kVt=CWe,TVt="__lodash_hash_undefined__";_(SWe,"hashSet");CVt=SWe;_(A2,"Hash");A2.prototype.clear=pVt;A2.prototype.delete=mVt;A2.prototype.get=xVt;A2.prototype.has=kVt;A2.prototype.set=CVt;kPe=A2;_(EWe,"mapCacheClear");SVt=EWe;_(AWe,"isKeyable");EVt=AWe;_(_We,"getMapData");lD=_We;_(RWe,"mapCacheDelete");AVt=RWe;_(LWe,"mapCacheGet");_Vt=LWe;_(IWe,"mapCacheHas");RVt=IWe;_(MWe,"mapCacheSet");LVt=MWe;_(_2,"MapCache");_2.prototype.clear=SVt;_2.prototype.delete=AVt;_2.prototype.get=_Vt;_2.prototype.has=RVt;_2.prototype.set=LVt;cD=_2,IVt=200;_(NWe,"stackSet");MVt=NWe;_(R2,"Stack");R2.prototype.clear=Nqt;R2.prototype.delete=Dqt;R2.prototype.get=Oqt;R2.prototype.has=Pqt;R2.prototype.set=MVt;xM=R2,NVt="__lodash_hash_undefined__";_(DWe,"setCacheAdd");DVt=DWe;_(OWe,"setCacheHas");OVt=OWe;_(t6,"SetCache");t6.prototype.add=t6.prototype.push=DVt;t6.prototype.has=OVt;PWe=t6;_(BWe,"arraySome");PVt=BWe;_(FWe,"cacheHas");$We=FWe,BVt=1,FVt=2;_(zWe,"equalArrays");GWe=zWe,$Vt=cp.Uint8Array,TPe=$Vt;_(qWe,"mapToArray");zVt=qWe;_(VWe,"setToArray");zre=VWe,GVt=1,qVt=2,VVt="[object Boolean]",WVt="[object Date]",HVt="[object Error]",UVt="[object Map]",YVt="[object Number]",XVt="[object RegExp]",jVt="[object Set]",KVt="[object String]",ZVt="[object Symbol]",QVt="[object ArrayBuffer]",JVt="[object DataView]",CPe=yd?yd.prototype:void 0,rQ=CPe?CPe.valueOf:void 0;_(WWe,"equalByTag");eWt=WWe;_(HWe,"arrayPush");UWe=HWe,tWt=Array.isArray,Nl=tWt;_(YWe,"baseGetAllKeys");rWt=YWe;_(XWe,"arrayFilter");jWe=XWe;_(KWe,"stubArray");nWt=KWe,iWt=Object.prototype,aWt=iWt.propertyIsEnumerable,SPe=Object.getOwnPropertySymbols,sWt=SPe?function(e){return e==null?[]:(e=Object(e),jWe(SPe(e),function(t){return aWt.call(e,t)}))}:nWt,oWt=sWt;_(ZWe,"baseTimes");lWt=ZWe;_(QWe,"isObjectLike");zw=QWe,cWt="[object Arguments]";_(JWe,"baseIsArguments");EPe=JWe,eHe=Object.prototype,uWt=eHe.hasOwnProperty,hWt=eHe.propertyIsEnumerable,fWt=EPe((function(){return arguments})())?EPe:function(e){return zw(e)&&uWt.call(e,"callee")&&!hWt.call(e,"callee")},uD=fWt;_(tHe,"stubFalse");dWt=tHe,rHe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,APe=rHe&&typeof module=="object"&&module&&!module.nodeType&&module,pWt=APe&&APe.exports===rHe,_Pe=pWt?cp.Buffer:void 0,mWt=_Pe?_Pe.isBuffer:void 0,gWt=mWt||dWt,cN=gWt,yWt=9007199254740991,vWt=/^(?:0|[1-9]\d*)$/;_(nHe,"isIndex");iHe=nHe,xWt=9007199254740991;_(aHe,"isLength");Gre=aHe,bWt="[object Arguments]",wWt="[object Array]",kWt="[object Boolean]",TWt="[object Date]",CWt="[object Error]",SWt="[object Function]",EWt="[object Map]",AWt="[object Number]",_Wt="[object Object]",RWt="[object RegExp]",LWt="[object Set]",IWt="[object String]",MWt="[object WeakMap]",NWt="[object ArrayBuffer]",DWt="[object DataView]",OWt="[object Float32Array]",PWt="[object Float64Array]",BWt="[object Int8Array]",FWt="[object Int16Array]",$Wt="[object Int32Array]",zWt="[object Uint8Array]",GWt="[object Uint8ClampedArray]",qWt="[object Uint16Array]",VWt="[object Uint32Array]",Zi={};Zi[OWt]=Zi[PWt]=Zi[BWt]=Zi[FWt]=Zi[$Wt]=Zi[zWt]=Zi[GWt]=Zi[qWt]=Zi[VWt]=!0;Zi[bWt]=Zi[wWt]=Zi[NWt]=Zi[kWt]=Zi[DWt]=Zi[TWt]=Zi[CWt]=Zi[SWt]=Zi[EWt]=Zi[AWt]=Zi[_Wt]=Zi[RWt]=Zi[LWt]=Zi[IWt]=Zi[MWt]=!1;_(sHe,"baseIsTypedArray");WWt=sHe;_(oHe,"baseUnary");HWt=oHe,lHe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,PS=lHe&&typeof module=="object"&&module&&!module.nodeType&&module,UWt=PS&&PS.exports===lHe,nQ=UWt&&lWe.process,YWt=(function(){try{var e=PS&&PS.require&&PS.require("util").types;return e||nQ&&nQ.binding&&nQ.binding("util")}catch{}})(),RPe=YWt,LPe=RPe&&RPe.isTypedArray,XWt=LPe?HWt(LPe):WWt,qre=XWt,jWt=Object.prototype,KWt=jWt.hasOwnProperty;_(cHe,"arrayLikeKeys");ZWt=cHe,QWt=Object.prototype;_(uHe,"isPrototype");hHe=uHe;_(fHe,"overArg");JWt=fHe,eHt=JWt(Object.keys,Object),tHt=eHt,rHt=Object.prototype,nHt=rHt.hasOwnProperty;_(dHe,"baseKeys");pHe=dHe;_(mHe,"isArrayLike");hD=mHe;_(gHe,"keys");Vre=gHe;_(yHe,"getAllKeys");IPe=yHe,iHt=1,aHt=Object.prototype,sHt=aHt.hasOwnProperty;_(vHe,"equalObjects");oHt=vHe,lHt=Zw(cp,"DataView"),zJ=lHt,cHt=Zw(cp,"Promise"),GJ=cHt,uHt=Zw(cp,"Set"),Lw=uHt,hHt=Zw(cp,"WeakMap"),qJ=hHt,MPe="[object Map]",fHt="[object Object]",NPe="[object Promise]",DPe="[object Set]",OPe="[object WeakMap]",PPe="[object DataView]",dHt=E2(zJ),pHt=E2(JS),mHt=E2(GJ),gHt=E2(Lw),yHt=E2(qJ),_v=Kw;(zJ&&_v(new zJ(new ArrayBuffer(1)))!=PPe||JS&&_v(new JS)!=MPe||GJ&&_v(GJ.resolve())!=NPe||Lw&&_v(new Lw)!=DPe||qJ&&_v(new qJ)!=OPe)&&(_v=_(function(e){var t=Kw(e),r=t==fHt?e.constructor:void 0,n=r?E2(r):"";if(n)switch(n){case dHt:return PPe;case pHt:return MPe;case mHt:return NPe;case gHt:return DPe;case yHt:return OPe}return t},"getTag"));VJ=_v,vHt=1,BPe="[object Arguments]",FPe="[object Array]",VI="[object Object]",xHt=Object.prototype,$Pe=xHt.hasOwnProperty;_(xHe,"baseIsEqualDeep");bHt=xHe;_(Wre,"baseIsEqual");bHe=Wre,wHt=1,kHt=2;_(wHe,"baseIsMatch");THt=wHe;_(kHe,"isStrictComparable");THe=kHe;_(CHe,"getMatchData");CHt=CHe;_(SHe,"matchesStrictComparable");EHe=SHe;_(AHe,"baseMatches");SHt=AHe,EHt="[object Symbol]";_(_He,"isSymbol");fD=_He,AHt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_Ht=/^\w*$/;_(RHe,"isKey");Hre=RHe,RHt="Expected a function";_(dD,"memoize");dD.Cache=cD;LHt=dD,IHt=500;_(LHe,"memoizeCapped");MHt=LHe,NHt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,DHt=/\\(\\)?/g,OHt=MHt(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(NHt,function(r,n,i,a){t.push(i?a.replace(DHt,"$1"):n||r)}),t}),PHt=OHt,BHt=1/0,zPe=yd?yd.prototype:void 0,GPe=zPe?zPe.toString:void 0;_(Ure,"baseToString");FHt=Ure;_(IHe,"toString");$Ht=IHe;_(MHe,"castPath");NHe=MHe,zHt=1/0;_(DHe,"toKey");pD=DHe;_(OHe,"baseGet");PHe=OHe;_(BHe,"get");GHt=BHe;_(FHe,"baseHasIn");qHt=FHe;_($He,"hasPath");VHt=$He;_(zHe,"hasIn");WHt=zHe,HHt=1,UHt=2;_(GHe,"baseMatchesProperty");YHt=GHe;_(qHe,"identity");Yre=qHe;_(VHe,"baseProperty");XHt=VHe;_(WHe,"basePropertyDeep");jHt=WHe;_(HHe,"property");KHt=HHe;_(UHe,"baseIteratee");mD=UHe;_(YHe,"createBaseFor");ZHt=YHe,QHt=ZHt(),JHt=QHt;_(XHe,"baseForOwn");eUt=XHe;_(jHe,"createBaseEach");tUt=jHe,rUt=tUt(eUt),gD=rUt;_(KHe,"baseMap");nUt=KHe;_(ZHe,"map");K0=ZHe;_(QHe,"baseFilter");iUt=QHe;_(JHe,"filter");aUt=JHe;_(u2,"buildATNKey");Vg=1,sUt=2,eUe=4,tUe=5,S6=7,oUt=8,lUt=9,cUt=10,uUt=11,rUe=12,Xre=class{static{_(this,"AbstractTransition")}constructor(e){this.target=e}isEpsilon(){return!1}},jre=class extends Xre{static{_(this,"AtomTransition")}constructor(e,t){super(e),this.tokenType=t}},nUe=class extends Xre{static{_(this,"EpsilonTransition")}constructor(e){super(e)}isEpsilon(){return!0}},Kre=class extends Xre{static{_(this,"RuleTransition")}constructor(e,t,r){super(e),this.rule=t,this.followState=r}isEpsilon(){return!0}};_(iUe,"createATN");_(aUe,"createRuleStartAndStopATNStates");_(Zre,"atom");_(sUe,"repetition");_(oUe,"repetitionSep");_(lUe,"repetitionMandatory");_(cUe,"repetitionMandatorySep");_(uUe,"alternation");_(hUe,"option");_(jg,"block");_(Qre,"plus");_(Jre,"star");_(fUe,"optional");_(up,"defineDecisionState");_(L2,"makeAlts");_(dUe,"getProdType");_(pUe,"makeBlock");_(yD,"tokenRef");_(mUe,"ruleRef");_(gUe,"buildRuleHandle");_(Va,"epsilon");_(Es,"newState");_(vD,"addTransition");_(yUe,"removeState");uN={},WJ=class{static{_(this,"ATNConfigSet")}constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let t=ene(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return K0(this.configs,e=>e.alt)}get key(){let e="";for(let t in this.map)e+=t+":";return e}};_(ene,"getATNConfigKey");_(vUe,"baseExtremum");hUt=vUe;_(xUe,"baseLt");fUt=xUe;_(bUe,"min");dUt=bUe,qPe=yd?yd.isConcatSpreadable:void 0;_(wUe,"isFlattenable");pUt=wUe;_(tne,"baseFlatten");kUe=tne;_(TUe,"flatMap");mUt=TUe;_(CUe,"baseFindIndex");gUt=CUe;_(SUe,"baseIsNaN");yUt=SUe;_(EUe,"strictIndexOf");vUt=EUe;_(AUe,"baseIndexOf");xUt=AUe;_(_Ue,"arrayIncludes");bUt=_Ue;_(RUe,"arrayIncludesWith");wUt=RUe;_(LUe,"noop");kUt=LUe,TUt=1/0,CUt=Lw&&1/zre(new Lw([,-0]))[1]==TUt?function(e){return new Lw(e)}:kUt,SUt=CUt,EUt=200;_(IUe,"baseUniq");AUt=IUe;_(MUe,"uniqBy");_Ut=MUe;_(NUe,"flatten");RUt=NUe;_(DUe,"arrayEach");LUt=DUe;_(OUe,"castFunction");IUt=OUe;_(PUe,"forEach");iQ=PUe,MUt="[object Map]",NUt="[object Set]",DUt=Object.prototype,OUt=DUt.hasOwnProperty;_(BUe,"isEmpty");PUt=BUe;_(FUe,"arrayReduce");BUt=FUe;_($Ue,"baseReduce");FUt=$Ue;_(zUe,"reduce");VPe=zUe;_(GUe,"createDFACache");qUe=class{static{_(this,"PredicateSet")}constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e="",t=this.predicates.length;for(let r=0;rconsole.log(r))}initialize(e){this.atn=iUe(e.rules),this.dfas=VUe(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:t,rule:r,hasPredicates:n,dynamicTokensEnabled:i}=e,a=this.dfas,s=this.logging,o=u2(r,"Alternation",t),u=this.atn.decisionMap[o].decision,h=K0(LJ({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:r}),f=>K0(f,d=>d[0]));if(HJ(h,!1)&&!i){let f=VPe(h,(d,p,m)=>(iQ(p,g=>{g&&(d[g.tokenTypeIdx]=m,iQ(g.categoryMatches,y=>{d[y]=m}))}),d),{});return n?function(d){var p;let m=this.LA(1),g=f[m.tokenTypeIdx];if(d!==void 0&&g!==void 0){let y=(p=d[g])===null||p===void 0?void 0:p.GATE;if(y!==void 0&&y.call(this)===!1)return}return g}:function(){let d=this.LA(1);return f[d.tokenTypeIdx]}}else return n?function(f){let d=new qUe,p=f===void 0?0:f.length;for(let g=0;gK0(f,d=>d[0]));if(HJ(h)&&h[0][0]&&!i){let f=h[0],d=RUt(f);if(d.length===1&&PUt(d[0].categoryMatches)){let m=d[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===m}}else{let p=VPe(d,(m,g)=>(g!==void 0&&(m[g.tokenTypeIdx]=!0,iQ(g.categoryMatches,y=>{m[y]=!0})),m),{});return function(){let m=this.LA(1);return p[m.tokenTypeIdx]===!0}}}return function(){let f=bM.call(this,a,u,WPe,s);return typeof f=="object"?!1:f===0}}};_(HJ,"isLL1Sequence");_(VUe,"initATNSimulator");_(bM,"adaptivePredict");_(WUe,"performLookahead");_(HUe,"computeLookaheadTarget");_(UUe,"reportLookaheadAmbiguity");_(YUe,"buildAmbiguityError");_(XUe,"getProductionDslName");_(jUe,"buildAdaptivePredictError");_(KUe,"getExistingTargetState");_(ZUe,"computeReachSet");_(QUe,"getReachableTarget");_(JUe,"getUniqueAlt");_(rne,"newDFAState");_(UJ,"addDFAEdge");_(nne,"addDFAState");_(eYe,"computeStartState");_(r6,"closure");_(tYe,"getEpsilonTarget");_(rYe,"hasConfigInRuleStopState");_(nYe,"allConfigsInRuleStopStates");_(iYe,"hasConflictTerminatingPrediction");_(aYe,"getConflictingAltSets");_(sYe,"hasConflictingAltSet");_(oYe,"hasStateAssociatedWithOneAlt");a6();lYe=class{static{_(this,"CstNodeBuilder")}constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new ane(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new xD;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let r=new hN(e.startOffset,e.image.length,VS(e),e.tokenType,!t);return r.grammarSource=t,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){let t=e.container;if(t){let r=t.content.indexOf(e);r>=0&&t.content.splice(r,1)}}addHiddenNodes(e){let t=[];for(let i of e){let a=new hN(i.startOffset,i.image.length,VS(i),i.tokenType,!0);a.root=this.rootNode,t.push(a)}let r=this.current,n=!1;if(r.content.length>0){r.content.push(...t);return}for(;r.container;){let i=r.container.content.indexOf(r);if(i>0){r.container.content.splice(i,0,...t),n=!0;break}r=r.container}n||this.rootNode.content.unshift(...t)}construct(e){let t=this.current;typeof e.$type=="string"&&!e.$infix&&(this.current.astNode=e),e.$cstNode=t;let r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}},ine=class{static{_(this,"AbstractCstNode")}get hidden(){return!1}get astNode(){let e=typeof this._astNode?.$type=="string"?this._astNode:this.container?.astNode;if(!e)throw new Error("This node has no associated AST element");return e}set astNode(e){this._astNode=e}get text(){return this.root.fullText.substring(this.offset,this.end)}},hN=class extends ine{static{_(this,"LeafCstNodeImpl")}get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,t,r,n,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=n,this._length=t,this._range=r}},xD=class extends ine{static{_(this,"CompositeCstNodeImpl")}constructor(){super(...arguments),this.content=new zUt(this)}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){let{range:r}=e,{range:n}=t;this._rangeCache={start:r.start,end:n.end.line=0;e--){let t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}},zUt=class cYe extends Array{static{_(this,"CstNodeContainer")}constructor(t){super(),this.parent=t,Object.setPrototypeOf(this,cYe.prototype)}push(...t){return this.addParents(t),super.push(...t)}unshift(...t){return this.addParents(t),super.unshift(...t)}splice(t,r,...n){return this.addParents(n),super.splice(t,r,...n)}addParents(t){for(let r of t)r.container=this.parent}},ane=class extends xD{static{_(this,"RootCstNodeImpl")}get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}},fN=Symbol("Datatype");_(wM,"isDataTypeNode");HPe="\u200B",uYe=_(e=>e.endsWith(HPe)?e:e+HPe,"withRuleSuffix"),sne=class{static{_(this,"AbstractLangiumParser")}constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let t=this.lexer.definition,r=e.LanguageMetaData.mode==="production";e.shared.profilers.LangiumProfiler?.isActive("parsing")?this.wrapper=new qUt(t,{...e.parser.ParserConfig,skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider},e.shared.profilers.LangiumProfiler.createTask("parsing",e.LanguageMetaData.languageId)):this.wrapper=new pYe(t,{...e.parser.ParserConfig,skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider})}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},hYe=class extends sne{static{_(this,"LangiumParser")}get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new lYe,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){let r=this.computeRuleType(e),n;Ow(e)&&(n=e.name,this.registerPrecedenceMap(e));let i=this.wrapper.DEFINE_RULE(uYe(e.name),this.startImplementation(r,n,t).bind(this));return this.allRules.set(e.name,i),Ll(e)&&e.entry&&(this.mainRule=i),i}registerPrecedenceMap(e){let t=e.name,r=new Map;for(let n=0;n0&&(t=this.construct()),t===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return t}startImplementation(e,t,r){return n=>{let i=!this.isRecording()&&e!==void 0;if(i){let a={$type:e};this.stack.push(a),e===fN?a.value="":t!==void 0&&(a.$infixName=t)}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){let t=this.lexerResult.hidden;if(!t.length)return[];let r=e.startOffset;for(let n=0;nr)return t.splice(0,n);return t.splice(0,t.length)}consume(e,t,r){let n=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(n)){let i=this.extractHiddenTokens(n);this.nodeBuilder.addHiddenNodes(i);let a=this.nodeBuilder.buildLeafNode(n,r),{assignment:s,crossRef:o}=this.getAssignment(r),l=this.current;if(s){let u=J0(r)?n.image:this.converter.convert(n.image,a);this.assign(s.operator,s.feature,u,a,o)}else if(wM(l)){let u=n.image;J0(r)||(u=this.converter.convert(u,a).toString()),l.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,t,r,n,i){let a;!this.isRecording()&&!r&&(a=this.nodeBuilder.buildCompositeNode(n));let s;try{s=this.wrapper.wrapSubrule(e,t,i)}finally{this.isRecording()||(s===void 0&&!r&&(s=this.construct()),s!==void 0&&a&&a.length>0&&this.performSubruleAssignment(s,n,a))}}performSubruleAssignment(e,t,r){let{assignment:n,crossRef:i}=this.getAssignment(t);if(n)this.assign(n.operator,n.feature,e,r,i);else if(!n){let a=this.current;if(wM(a))a.value+=e.toString();else if(typeof e=="object"&&e){let o=this.assignWithoutOverride(e,a);this.stack.pop(),this.stack.push(o)}}}action(e,t){if(!this.isRecording()){let r=this.current;if(t.feature&&t.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode),this.nodeBuilder.buildCompositeNode(t).content.push(r.$cstNode);let i={$type:e};this.stack.push(i),this.assign(t.operator,t.feature,r,r.$cstNode)}else r.$type=e}}construct(){if(this.isRecording())return;let e=this.stack.pop();return this.nodeBuilder.construct(e),"$infixName"in e?this.constructInfix(e,this.operatorPrecedence.get(e.$infixName)):wM(e)?this.converter.convert(e.value,e.$cstNode):(ite(this.astReflection,e),e)}constructInfix(e,t){let r=e.parts;if(!Array.isArray(r)||r.length===0)return;let n=e.operators;if(!Array.isArray(n)||r.length<2)return r[0];let i=0,a=-1;for(let m=0;ma?(a=y.precedence,i=m):y.precedence===a&&(y.rightAssoc||(i=m))}let s=n.slice(0,i),o=n.slice(i+1),l=r.slice(0,i+1),u=r.slice(i+1),h={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:l,operators:s},f={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:u,operators:o},d=this.constructInfix(h,t),p=this.constructInfix(f,t);return{$type:e.$type,$cstNode:e.$cstNode,left:d,operator:n[i],right:p}}getAssignment(e){if(!this.assignmentMap.has(e)){let t=d2(e,Q0);this.assignmentMap.set(e,{assignment:t,crossRef:t&&m2(t.terminal)?t.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(e)}assign(e,t,r,n,i){let a=this.current,s;switch(i==="single"&&typeof r=="string"?s=this.linker.buildReference(a,t,n,r):i==="multi"&&typeof r=="string"?s=this.linker.buildMultiReference(a,t,n,r):s=r,e){case"=":{a[t]=s;break}case"?=":{a[t]=!0;break}case"+=":Array.isArray(a[t])||(a[t]=[]),a[t].push(s)}}assignWithoutOverride(e,t){for(let[n,i]of Object.entries(t)){let a=e[n];a===void 0?e[n]=i:Array.isArray(a)&&Array.isArray(i)&&(i.push(...a),e[n]=i)}let r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},fYe=class{static{_(this,"AbstractParserErrorMessageProvider")}buildMismatchTokenMessage(e){return Cw.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Cw.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Cw.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Cw.buildEarlyExitMessage(e)}},one=class extends fYe{static{_(this,"LangiumParserErrorMessageProvider")}buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},dYe=class extends sne{static{_(this,"LangiumCompletionParser")}constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let t=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=t.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let r=this.wrapper.DEFINE_RULE(uYe(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let r=this.keepStackSize();try{e(t)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,r){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,r,n,i){this.before(n),this.wrapper.wrapSubrule(e,t,i),this.after(n)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}},GUt={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new one},pYe=class extends Sqt{static{_(this,"ChevrotainWrapper")}constructor(e,t){let r=t&&"maxLookahead"in t;super(e,{...GUt,lookaheadStrategy:r?new Pre({maxLookahead:t.maxLookahead}):new $Ut({logging:t.skipValidations?()=>{}:void 0}),...t})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t,r){return this.RULE(e,t,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t,void 0)}wrapSubrule(e,t,r){return this.subrule(e,t,{ARGS:[r]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}rule(e){return e.call(this,{})}},qUt=class extends pYe{static{_(this,"ProfilerWrapper")}constructor(e,t,r){super(e,t),this.task=r}rule(e){this.task.start(),this.task.startSubTask(this.ruleName(e));try{return super.rule(e)}finally{this.task.stopSubTask(this.ruleName(e)),this.task.stop()}}ruleName(e){return e.ruleName}subrule(e,t,r){this.task.startSubTask(this.ruleName(t));try{return super.subrule(e,t,r)}finally{this.task.stopSubTask(this.ruleName(t))}}};_(bD,"createParser");_(mYe,"buildRules");_(gYe,"buildInfixRule");_(Wg,"buildElement");_(yYe,"buildAction");_(vYe,"buildRuleCall");_(xYe,"buildRuleCallPredicate");_(Ih,"buildPredicate");_(bYe,"buildAlternatives");_(wYe,"buildUnorderedGroup");_(kYe,"buildGroup");_(n6,"getGuardCondition");_(lne,"buildCrossReference");_(TYe,"buildKeyword");_(cne,"wrap");_(wD,"getRule");_(CYe,"getRuleName");_(dN,"getToken");_(une,"createCompletionParser");_(hne,"createLangiumParser");_(fne,"prepareLangiumParser");kD=class{static{_(this,"DefaultTokenBuilder")}constructor(){this.diagnostics=[]}buildTokens(e,t){let r=ki(ON(e,!1)),n=this.buildTerminalTokens(r),i=this.buildKeywordTokens(r,n,t);return i.push(...n),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Hu).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){let t=h6(e),r=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,n={name:e.name,PATTERN:r};return typeof r=="function"&&(n.LINE_BREAKS=!0),e.hidden&&(n.GROUP=DN(t)?Rl.SKIPPED:"hidden"),n}requiresCustomPattern(e){return!!(e.flags.includes("u")||e.flags.includes("s"))}regexPatternFunction(e){let t=new RegExp(e,e.flags+"y");return(r,n)=>(t.lastIndex=n,t.exec(r))}buildKeywordTokens(e,t,r){return e.filter(p2).flatMap(n=>op(n).filter(J0)).distinct(n=>n.value).toArray().sort((n,i)=>i.value.length-n.value.length).map(n=>this.buildKeywordToken(n,t,!!r?.caseInsensitive))}buildKeywordToken(e,t,r){let n=this.buildKeywordPattern(e,r),i={name:e.value,PATTERN:n,LONGER_ALT:this.findLongerAlt(e,t)};return typeof n=="function"&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(Ww(e.value),"i"):e.value}findLongerAlt(e,t){return t.reduce((r,n)=>{let i=n?.PATTERN;return i?.source&&Bte("^"+i.source+"$",e.value)&&r.push(n),r},[])}},dne=class{static{_(this,"DefaultValueConverter")}convert(e,t){let r=t.grammarSource;if(m2(r)&&(r=qte(r)),ep(r)){let n=r.rule.ref;if(!n)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(n,e,t)}return e}runConverter(e,t,r){switch(e.name.toUpperCase()){case"INT":return hd.convertInt(t);case"STRING":return hd.convertString(t);case"ID":return hd.convertID(t)}switch(Zte(e)?.toLowerCase()){case"number":return hd.convertNumber(t);case"boolean":return hd.convertBoolean(t);case"bigint":return hd.convertBigint(t);case"date":return hd.convertDate(t);default:return t}}};(function(e){function t(u){let h="";for(let f=1;f{this.resolve=r=>(e(r),this),this.reject=r=>(t(r),this)})}},UPe=class YJ{static{_(this,"FullTextDocument")}constructor(t,r,n,i){this._uri=t,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){for(let n of t)if(YJ.isIncremental(n)){let i=gne(n.range),a=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,a)+n.text+this._content.substring(s,this._content.length);let o=Math.max(i.start.line,0),l=Math.max(i.end.line,0),u=this._lineOffsets,h=XJ(n.text,!1,a);if(l-o===h.length)for(let d=0,p=h.length;dt?i=s:n=s+1}let a=n-1;return t=this.ensureBeforeEOL(t,r[a]),{line:a,character:t-r[a]}}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line];if(t.character<=0)return n;let i=t.line+1r&&mne(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}};(function(e){function t(i,a,s,o){return new UPe(i,a,s,o)}_(t,"create"),e.create=t;function r(i,a,s){if(i instanceof UPe)return i.update(a,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}_(r,"update"),e.update=r;function n(i,a){let s=i.getText(),o=mN(a.map(EYe),(h,f)=>{let d=h.range.start.line-f.range.start.line;return d===0?h.range.start.character-f.range.start.character:d}),l=0,u=[];for(let h of o){let f=i.offsetAt(h.range.start);if(fl&&u.push(s.substring(l,f)),h.newText.length&&u.push(h.newText),l=i.offsetAt(h.range.end)}return u.push(s.substr(l)),u.join("")}_(n,"applyEdits"),e.applyEdits=n})(pN||(pN={}));_(mN,"mergeSort");_(XJ,"computeLineOffsets");_(mne,"isEOL");_(gne,"getWellformedRange");_(EYe,"getWellformedEdit");(()=>{"use strict";var e={975:O=>{function R(M){if(typeof M!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(M))}_(R,"e");function A(M,D){for(var B,P="",$=0,F=-1,q=0,G=0;G<=M.length;++G){if(G2){var z=P.lastIndexOf("/");if(z!==P.length-1){z===-1?(P="",$=0):$=(P=P.slice(0,z)).length-1-P.lastIndexOf("/"),F=G,q=0;continue}}else if(P.length===2||P.length===1){P="",$=0,F=G,q=0;continue}}D&&(P.length>0?P+="/..":P="..",$=2)}else P.length>0?P+="/"+M.slice(F+1,G):P=M.slice(F+1,G),$=G-F-1;F=G,q=0}else B===46&&q!==-1?++q:q=-1}return P}_(A,"r");var N={resolve:_(function(){for(var M,D="",B=!1,P=arguments.length-1;P>=-1&&!B;P--){var $;P>=0?$=arguments[P]:(M===void 0&&(M=process.cwd()),$=M),R($),$.length!==0&&(D=$+"/"+D,B=$.charCodeAt(0)===47)}return D=A(D,!B),B?D.length>0?"/"+D:"/":D.length>0?D:"."},"resolve"),normalize:_(function(M){if(R(M),M.length===0)return".";var D=M.charCodeAt(0)===47,B=M.charCodeAt(M.length-1)===47;return(M=A(M,!D)).length!==0||D||(M="."),M.length>0&&B&&(M+="/"),D?"/"+M:M},"normalize"),isAbsolute:_(function(M){return R(M),M.length>0&&M.charCodeAt(0)===47},"isAbsolute"),join:_(function(){if(arguments.length===0)return".";for(var M,D=0;D0&&(M===void 0?M=B:M+="/"+B)}return M===void 0?".":N.normalize(M)},"join"),relative:_(function(M,D){if(R(M),R(D),M===D||(M=N.resolve(M))===(D=N.resolve(D)))return"";for(var B=1;BG){if(D.charCodeAt(F+H)===47)return D.slice(F+H+1);if(H===0)return D.slice(F+H)}else $>G&&(M.charCodeAt(B+H)===47?z=H:H===0&&(z=0));break}var j=M.charCodeAt(B+H);if(j!==D.charCodeAt(F+H))break;j===47&&(z=H)}var J="";for(H=B+z+1;H<=P;++H)H!==P&&M.charCodeAt(H)!==47||(J.length===0?J+="..":J+="/..");return J.length>0?J+D.slice(F+z):(F+=z,D.charCodeAt(F)===47&&++F,D.slice(F))},"relative"),_makeLong:_(function(M){return M},"_makeLong"),dirname:_(function(M){if(R(M),M.length===0)return".";for(var D=M.charCodeAt(0),B=D===47,P=-1,$=!0,F=M.length-1;F>=1;--F)if((D=M.charCodeAt(F))===47){if(!$){P=F;break}}else $=!1;return P===-1?B?"/":".":B&&P===1?"//":M.slice(0,P)},"dirname"),basename:_(function(M,D){if(D!==void 0&&typeof D!="string")throw new TypeError('"ext" argument must be a string');R(M);var B,P=0,$=-1,F=!0;if(D!==void 0&&D.length>0&&D.length<=M.length){if(D.length===M.length&&D===M)return"";var q=D.length-1,G=-1;for(B=M.length-1;B>=0;--B){var z=M.charCodeAt(B);if(z===47){if(!F){P=B+1;break}}else G===-1&&(F=!1,G=B+1),q>=0&&(z===D.charCodeAt(q)?--q==-1&&($=B):(q=-1,$=G))}return P===$?$=G:$===-1&&($=M.length),M.slice(P,$)}for(B=M.length-1;B>=0;--B)if(M.charCodeAt(B)===47){if(!F){P=B+1;break}}else $===-1&&(F=!1,$=B+1);return $===-1?"":M.slice(P,$)},"basename"),extname:_(function(M){R(M);for(var D=-1,B=0,P=-1,$=!0,F=0,q=M.length-1;q>=0;--q){var G=M.charCodeAt(q);if(G!==47)P===-1&&($=!1,P=q+1),G===46?D===-1?D=q:F!==1&&(F=1):D!==-1&&(F=-1);else if(!$){B=q+1;break}}return D===-1||P===-1||F===0||F===1&&D===P-1&&D===B+1?"":M.slice(D,P)},"extname"),format:_(function(M){if(M===null||typeof M!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof M);return(function(D,B){var P=B.dir||B.root,$=B.base||(B.name||"")+(B.ext||"");return P?P===B.root?P+$:P+"/"+$:$})(0,M)},"format"),parse:_(function(M){R(M);var D={root:"",dir:"",base:"",ext:"",name:""};if(M.length===0)return D;var B,P=M.charCodeAt(0),$=P===47;$?(D.root="/",B=1):B=0;for(var F=-1,q=0,G=-1,z=!0,H=M.length-1,j=0;H>=B;--H)if((P=M.charCodeAt(H))!==47)G===-1&&(z=!1,G=H+1),P===46?F===-1?F=H:j!==1&&(j=1):F!==-1&&(j=-1);else if(!z){q=H+1;break}return F===-1||G===-1||j===0||j===1&&F===G-1&&F===q+1?G!==-1&&(D.base=D.name=q===0&&$?M.slice(1,G):M.slice(q,G)):(q===0&&$?(D.name=M.slice(1,F),D.base=M.slice(1,G)):(D.name=M.slice(q,F),D.base=M.slice(q,G)),D.ext=M.slice(F,G)),q>0?D.dir=M.slice(0,q-1):$&&(D.dir="/"),D},"parse"),sep:"/",delimiter:":",win32:null,posix:null};N.posix=N,O.exports=N}},t={};function r(O){var R=t[O];if(R!==void 0)return R.exports;var A=t[O]={exports:{}};return e[O](A,A.exports,r),A.exports}_(r,"r"),r.d=(O,R)=>{for(var A in R)r.o(R,A)&&!r.o(O,A)&&Object.defineProperty(O,A,{enumerable:!0,get:R[A]})},r.o=(O,R)=>Object.prototype.hasOwnProperty.call(O,R),r.r=O=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(O,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(O,"__esModule",{value:!0})};var n={};let i;r.r(n),r.d(n,{URI:_(()=>d,"URI"),Utils:_(()=>L,"Utils")}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let a=/^\w[\w\d+.-]*$/,s=/^\//,o=/^\/\//;function l(O,R){if(!O.scheme&&R)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${O.authority}", path: "${O.path}", query: "${O.query}", fragment: "${O.fragment}"}`);if(O.scheme&&!a.test(O.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(O.path){if(O.authority){if(!s.test(O.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test(O.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}_(l,"a");let u="",h="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static{_(this,"l")}static isUri(R){return R instanceof d||!!R&&typeof R.authority=="string"&&typeof R.fragment=="string"&&typeof R.path=="string"&&typeof R.query=="string"&&typeof R.scheme=="string"&&typeof R.fsPath=="string"&&typeof R.with=="function"&&typeof R.toString=="function"}scheme;authority;path;query;fragment;constructor(R,A,N,M,D,B=!1){typeof R=="object"?(this.scheme=R.scheme||u,this.authority=R.authority||u,this.path=R.path||u,this.query=R.query||u,this.fragment=R.fragment||u):(this.scheme=(function(P,$){return P||$?P:"file"})(R,B),this.authority=A||u,this.path=(function(P,$){switch(P){case"https":case"http":case"file":$?$[0]!==h&&($=h+$):$=h}return $})(this.scheme,N||u),this.query=M||u,this.fragment=D||u,l(this,B))}get fsPath(){return x(this,!1)}with(R){if(!R)return this;let{scheme:A,authority:N,path:M,query:D,fragment:B}=R;return A===void 0?A=this.scheme:A===null&&(A=u),N===void 0?N=this.authority:N===null&&(N=u),M===void 0?M=this.path:M===null&&(M=u),D===void 0?D=this.query:D===null&&(D=u),B===void 0?B=this.fragment:B===null&&(B=u),A===this.scheme&&N===this.authority&&M===this.path&&D===this.query&&B===this.fragment?this:new m(A,N,M,D,B)}static parse(R,A=!1){let N=f.exec(R);return N?new m(N[2]||u,k(N[4]||u),k(N[5]||u),k(N[7]||u),k(N[9]||u),A):new m(u,u,u,u,u)}static file(R){let A=u;if(i&&(R=R.replace(/\\/g,h)),R[0]===h&&R[1]===h){let N=R.indexOf(h,2);N===-1?(A=R.substring(2),R=h):(A=R.substring(2,N),R=R.substring(N)||h)}return new m("file",A,R,u,u)}static from(R){let A=new m(R.scheme,R.authority,R.path,R.query,R.fragment);return l(A,!0),A}toString(R=!1){return w(this,R)}toJSON(){return this}static revive(R){if(R){if(R instanceof d)return R;{let A=new m(R);return A._formatted=R.external,A._fsPath=R._sep===p?R.fsPath:null,A}}return R}}let p=i?1:void 0;class m extends d{static{_(this,"d")}_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=x(this,!1)),this._fsPath}toString(R=!1){return R?w(this,!0):(this._formatted||(this._formatted=w(this,!1)),this._formatted)}toJSON(){let R={$mid:1};return this._fsPath&&(R.fsPath=this._fsPath,R._sep=p),this._formatted&&(R.external=this._formatted),this.path&&(R.path=this.path),this.scheme&&(R.scheme=this.scheme),this.authority&&(R.authority=this.authority),this.query&&(R.query=this.query),this.fragment&&(R.fragment=this.fragment),R}}let g={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function y(O,R,A){let N,M=-1;for(let D=0;D=97&&B<=122||B>=65&&B<=90||B>=48&&B<=57||B===45||B===46||B===95||B===126||R&&B===47||A&&B===91||A&&B===93||A&&B===58)M!==-1&&(N+=encodeURIComponent(O.substring(M,D)),M=-1),N!==void 0&&(N+=O.charAt(D));else{N===void 0&&(N=O.substr(0,D));let P=g[B];P!==void 0?(M!==-1&&(N+=encodeURIComponent(O.substring(M,D)),M=-1),N+=P):M===-1&&(M=D)}}return M!==-1&&(N+=encodeURIComponent(O.substring(M))),N!==void 0?N:O}_(y,"m");function v(O){let R;for(let A=0;A1&&O.scheme==="file"?`//${O.authority}${O.path}`:O.path.charCodeAt(0)===47&&(O.path.charCodeAt(1)>=65&&O.path.charCodeAt(1)<=90||O.path.charCodeAt(1)>=97&&O.path.charCodeAt(1)<=122)&&O.path.charCodeAt(2)===58?R?O.path.substr(1):O.path[1].toLowerCase()+O.path.substr(2):O.path,i&&(A=A.replace(/\//g,"\\")),A}_(x,"v");function w(O,R){let A=R?v:y,N="",{scheme:M,authority:D,path:B,query:P,fragment:$}=O;if(M&&(N+=M,N+=":"),(D||M==="file")&&(N+=h,N+=h),D){let F=D.indexOf("@");if(F!==-1){let q=D.substr(0,F);D=D.substr(F+1),F=q.lastIndexOf(":"),F===-1?N+=A(q,!1,!1):(N+=A(q.substr(0,F),!1,!1),N+=":",N+=A(q.substr(F+1),!1,!0)),N+="@"}D=D.toLowerCase(),F=D.lastIndexOf(":"),F===-1?N+=A(D,!1,!0):(N+=A(D.substr(0,F),!1,!0),N+=D.substr(F))}if(B){if(B.length>=3&&B.charCodeAt(0)===47&&B.charCodeAt(2)===58){let F=B.charCodeAt(1);F>=65&&F<=90&&(B=`/${String.fromCharCode(F+32)}:${B.substr(3)}`)}else if(B.length>=2&&B.charCodeAt(1)===58){let F=B.charCodeAt(0);F>=65&&F<=90&&(B=`${String.fromCharCode(F+32)}:${B.substr(2)}`)}N+=A(B,!0,!1)}return P&&(N+="?",N+=A(P,!1,!1)),$&&(N+="#",N+=R?$:y($,!1,!1)),N}_(w,"b");function C(O){try{return decodeURIComponent(O)}catch{return O.length>3?O.substr(0,3)+C(O.substr(3)):O}}_(C,"C");let T=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function k(O){return O.match(T)?O.replace(T,(R=>C(R))):O}_(k,"w");var S=r(975);let E=S.posix||S,I="/";var L;(function(O){O.joinPath=function(R,...A){return R.with({path:E.join(R.path,...A)})},O.resolvePath=function(R,...A){let N=R.path,M=!1;N[0]!==I&&(N=I+N,M=!0);let D=E.resolve(N,...A);return M&&D[0]===I&&!R.authority&&(D=D.substring(1)),R.with({path:D})},O.dirname=function(R){if(R.path.length===0||R.path===I)return R;let A=E.dirname(R.path);return A.length===1&&A.charCodeAt(0)===46&&(A=""),R.with({path:A})},O.basename=function(R){return E.basename(R.path)},O.extname=function(R){return E.extname(R.path)}})(L||(L={})),AYe=n})();({URI:Xc,Utils:aS}=AYe);(function(e){e.basename=aS.basename,e.dirname=aS.dirname,e.extname=aS.extname,e.joinPath=aS.joinPath,e.resolvePath=aS.resolvePath;let t=typeof process=="object"&&process?.platform==="win32";function r(s,o){return s?.toString()===o?.toString()}_(r,"equals"),e.equals=r;function n(s,o){let l=typeof s=="string"?Xc.parse(s).path:s.path,u=typeof o=="string"?Xc.parse(o).path:o.path,h=l.split("/").filter(g=>g.length>0),f=u.split("/").filter(g=>g.length>0);if(t){let g=/^[A-Z]:$/;if(h[0]&&g.test(h[0])&&(h[0]=h[0].toLowerCase()),f[0]&&g.test(f[0])&&(f[0]=f[0].toLowerCase()),h[0]!==f[0])return u.substring(1)}let d=0;for(;d({name:n.name,uri:_l.joinPath(Xc.parse(t),n.name).toString(),element:n.element})):[]}all(){return this.collectValues(this.root)}findAll(e){let t=this.getNode(_l.normalize(e),!1);return t?this.collectValues(t):[]}getNode(e,t){let r=e.split("/");e.charAt(e.length-1)==="/"&&r.pop();let n=this.root;for(let i of r){let a=n.children.get(i);if(!a)if(t)a={name:i,children:new Map,parent:n},n.children.set(i,a);else return;n=a}return n}collectValues(e){let t=[];e.element&&t.push(e.element);for(let r of e.children.values())t.push(...this.collectValues(r));return t}};(function(e){e[e.Changed=0]="Changed",e[e.Parsed=1]="Parsed",e[e.IndexedContent=2]="IndexedContent",e[e.ComputedScopes=3]="ComputedScopes",e[e.Linked=4]="Linked",e[e.IndexedReferences=5]="IndexedReferences",e[e.Validated=6]="Validated"})(Ln||(Ln={}));_Ye=class{static{_(this,"DefaultLangiumDocumentFactory")}constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Gi.CancellationToken.None){let r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,t)}fromTextDocument(e,t,r){return t=t??Xc.parse(e.uri),Gi.CancellationToken.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromString(e,t,r){return Gi.CancellationToken.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,r){if(typeof t=="string"){let n=this.parse(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}else if("$model"in t){let n={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let n=this.parse(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}async createAsync(e,t,r){if(typeof t=="string"){let n=await this.parseAsync(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}else{let n=await this.parseAsync(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}createLangiumDocument(e,t,r,n){let i;if(r)i={parseResult:e,uri:t,state:Ln.Parsed,references:[],textDocument:r};else{let a=this.createTextDocumentGetter(t,n);i={parseResult:e,uri:t,state:Ln.Parsed,references:[],get textDocument(){return a()}}}return e.value.$document=i,i}async update(e,t){let r=e.parseResult.value.$cstNode?.root.fullText,n=this.textDocuments?.get(e.uri.toString()),i=n?n.getText():await this.fileSystemProvider.readFile(e.uri);if(n)Object.defineProperty(e,"textDocument",{value:n});else{let a=this.createTextDocumentGetter(e.uri,i);Object.defineProperty(e,"textDocument",{get:a})}return r!==i&&(e.parseResult=await this.parseAsync(e.uri,i,t),e.parseResult.value.$document=e),e.state=Ln.Parsed,e}parse(e,t,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,r)}parseAsync(e,t,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,r)}createTextDocumentGetter(e,t){let r=this.serviceRegistry,n;return()=>n??(n=pN.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,t??""))}},RYe=class{static{_(this,"DefaultLangiumDocuments")}constructor(e){this.documentTrie=new yne,this.services=e,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.documentBuilder=()=>e.workspace.DocumentBuilder}get all(){return ki(this.documentTrie.all())}addDocument(e){let t=e.uri.toString();if(this.documentTrie.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentTrie.insert(t,e)}getDocument(e){let t=e.toString();return this.documentTrie.find(t)}getDocuments(e){let t=e.toString();return this.documentTrie.findAll(t)}async getOrCreateDocument(e,t){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(r),r)}createDocument(e,t,r){if(r)return this.langiumDocumentFactory.fromString(t,e,r).then(n=>(this.addDocument(n),n));{let n=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(n),n}}hasDocument(e){return this.documentTrie.has(e.toString())}invalidateDocument(e){let t=e.toString(),r=this.documentTrie.find(t);return r&&this.documentBuilder().resetToState(r,Ln.Changed),r}deleteDocument(e){let t=e.toString(),r=this.documentTrie.find(t);return r&&(r.state=Ln.Changed,this.documentTrie.delete(t)),r}deleteDocuments(e){let t=e.toString(),r=this.documentTrie.findAll(t);for(let n of r)n.state=Ln.Changed;return this.documentTrie.delete(t),r}},Rv=Symbol("RefResolving"),LYe=class{static{_(this,"DefaultLinker")}constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async link(e,t=Gi.CancellationToken.None){if(this.profiler?.isActive("linking")){let r=this.profiler.createTask("linking",this.languageId);r.start();try{for(let n of Nh(e.parseResult.value))await Us(t),Dw(n).forEach(i=>{let a=`${n.$type}:${i.property}`;r.startSubTask(a);try{this.doLink(i,e)}finally{r.stopSubTask(a)}})}finally{r.stop()}}else for(let r of Nh(e.parseResult.value))await Us(t),Dw(r).forEach(n=>this.doLink(n,e))}doLink(e,t){let r=e.reference;if("_ref"in r&&r._ref===void 0){r._ref=Rv;try{let n=this.getCandidate(e);if(Dv(n))r._ref=n;else{r._nodeDescription=n;let i=this.loadAstNode(n);r._ref=i??this.createLinkingError(e,n)}}catch(n){console.error(`An error occurred while resolving reference to '${r.$refText}':`,n);let i=n.message??String(n);r._ref={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${i}`}}t.references.push(r)}else if("_items"in r&&r._items===void 0){r._items=Rv;try{let n=this.getCandidates(e),i=[];if(Dv(n))r._linkingError=n;else for(let a of n){let s=this.loadAstNode(a);s&&i.push({ref:s,$nodeDescription:a})}r._items=i}catch(n){r._linkingError={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${n}`},r._items=[]}t.references.push(r)}}unlink(e){for(let t of e.references)"_ref"in t?(t._ref=void 0,delete t._nodeDescription):"_items"in t&&(t._items=void 0,delete t._linkingError);e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}getCandidates(e){let r=this.scopeProvider.getScope(e).getElements(e.reference.$refText).distinct(n=>`${n.documentUri}#${n.path}`).toArray();return r.length>0?r:this.createLinkingError(e)}buildReference(e,t,r,n){let i=this,a={$refNode:r,$refText:n,_ref:void 0,get ref(){if(ls(this._ref))return this._ref;if(tte(this._nodeDescription)){let s=i.loadAstNode(this._nodeDescription);this._ref=s??i.createLinkingError({reference:a,container:e,property:t},this._nodeDescription)}else if(this._ref===void 0){this._ref=Rv;let s=Aw(e).$document,o=i.getLinkedNode({reference:a,container:e,property:t});if(o.error&&s&&s.state0))return this._linkingError=i.createLinkingError({reference:a,container:e,property:t})}};return a}throwCyclicReferenceError(e,t,r){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`)}getLinkedNode(e){try{let t=this.getCandidate(e);if(Dv(t))return{error:t};let r=this.loadAstNode(t);return r?{node:r,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,t);let r=t.message??String(t);return{error:{info:e,message:`An error occurred while resolving reference to '${e.reference.$refText}': ${r}`}}}}loadAstNode(e){if(e.node)return e.node;let t=this.langiumDocuments().getDocument(e.documentUri);if(t)return this.astNodeLocator.getAstNode(t.parseResult.value,e.path)}createLinkingError(e,t){let r=Aw(e.container).$document;r&&r.statem2(t)&&t.isMulti)}findDeclarations(e){if(e){let t=Ute(e),r=e.astNode;if(t&&r){let n=r[t.feature];if(Al(n)||md(n))return NM(n);if(Array.isArray(n)){for(let i of n)if((Al(i)||md(i))&&i.$refNode&&i.$refNode.offset<=e.offset&&i.$refNode.end>=e.end)return NM(i)}}if(r){let n=this.nameProvider.getNameNode(r);if(n&&(n===e||Ste(e,n)))return this.getSelfNodes(r)}}return[]}getSelfNodes(e){if(this.hasMultiReference){let t=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)),r=this.getNodeFromReferenceDescription(t.head());if(r){for(let n of Dw(r))if(md(n.reference)&&n.reference.items.some(i=>i.ref===e))return n.reference.items.map(i=>i.ref)}return[e]}else return[e]}getNodeFromReferenceDescription(e){if(!e)return;let t=this.documents.getDocument(e.sourceUri);if(t)return this.nodeLocator.getAstNode(t.parseResult.value,e.sourcePath)}findDeclarationNodes(e){let t=this.findDeclarations(e),r=[];for(let n of t){let i=this.nameProvider.getNameNode(n)??n.$cstNode;i&&r.push(i)}return r}findReferences(e,t){let r=[];t.includeDeclaration&&r.push(...this.getSelfReferences(e));let n=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(n=n.filter(i=>_l.equals(i.sourceUri,t.documentUri))),r.push(...n),ki(r)}getSelfReferences(e){let t=this.getSelfNodes(e),r=[];for(let n of t){let i=this.nameProvider.getNameNode(n);if(i){let a=Mh(n),s=this.nodeLocator.getAstNodePath(n);r.push({sourceUri:a.uri,sourcePath:s,targetUri:a.uri,targetPath:s,segment:Bw(i),local:!0})}}return r}},sp=class{static{_(this,"MultiMap")}constructor(e){if(this.map=new Map,e)for(let[t,r]of e)this.add(t,r)}get size(){return qS.sum(ki(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let r=this.map.get(e);if(r){let n=r.indexOf(t);if(n>=0)return r.length===1?this.map.delete(e):r.splice(n,1),!0}return!1}}get(e){return this.map.get(e)??[]}getStream(e){let t=this.map.get(e);return t?ki(t):Iw}has(e,t){if(t===void 0)return this.map.has(e);{let r=this.map.get(e);return r?r.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,r)=>t.forEach(n=>e(n,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ki(this.map.entries()).flatMap(([e,t])=>t.map(r=>[e,r]))}keys(){return ki(this.map.keys())}values(){return ki(this.map.values()).flat()}entriesGroupedByKey(){return ki(this.map.entries())}},gN=class{static{_(this,"BiMap")}get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[t,r]of e)this.set(t,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let t=this.map.get(e);return t!==void 0?(this.map.delete(e),this.inverse.delete(t),!0):!1}},NYe=class{static{_(this,"DefaultScopeComputation")}constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(e,t=Gi.CancellationToken.None){return this.collectExportedSymbolsForNode(e.parseResult.value,e,void 0,t)}async collectExportedSymbolsForNode(e,t,r=o6,n=Gi.CancellationToken.None){let i=[];this.addExportedSymbol(e,i,t);for(let a of r(e))await Us(n),this.addExportedSymbol(a,i,t);return i}addExportedSymbol(e,t,r){let n=this.nameProvider.getName(e);n&&t.push(this.descriptions.createDescription(e,n,r))}async collectLocalSymbols(e,t=Gi.CancellationToken.None){let r=e.parseResult.value,n=new sp;for(let i of op(r))await Us(t),this.addLocalSymbol(i,e,n);return n}addLocalSymbol(e,t,r){let n=e.$container;if(n){let i=this.nameProvider.getName(e);i&&r.add(n,this.descriptions.createDescription(e,i,t))}}},jJ=class{static{_(this,"StreamScope")}constructor(e,t,r){this.elements=e,this.outerScope=t,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===t):this.elements.find(n=>n.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.filter(n=>n.name.toLowerCase()===t):this.elements.filter(n=>n.name===e);return(this.concatOuterScope||r.isEmpty())&&this.outerScope?r.concat(this.outerScope.getElements(e)):r}},VUt=class{static{_(this,"MapScope")}constructor(e,t,r){this.elements=new Map,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let n of e){let i=this.caseInsensitive?n.name.toLowerCase():n.name;this.elements.set(i,n)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t),n=r?[r]:[];return(this.concatOuterScope||n.length>0)&&this.outerScope?ki(n).concat(this.outerScope.getElements(e)):ki(n)}getAllElements(){let e=ki(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},DYe=class{static{_(this,"MultiMapScope")}constructor(e,t,r){this.elements=new sp,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let n of e){let i=this.caseInsensitive?n.name.toLowerCase():n.name;this.elements.add(i,n)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t)[0];if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);return(this.concatOuterScope||r.length===0)&&this.outerScope?ki(r).concat(this.outerScope.getElements(e)):ki(r)}getAllElements(){let e=ki(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},WUt={getElement(){},getElements(){return Iw},getAllElements(){return Iw}},SD=class{static{_(this,"DisposableCache")}constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},xne=class extends SD{static{_(this,"SimpleCache")}constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){let r=t();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},ED=class extends SD{static{_(this,"ContextCache")}constructor(e){super(),this.cache=new Map,this.converter=e??(t=>t)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,r){this.throwIfDisposed(),this.cacheForContext(e).set(t,r)}get(e,t,r){this.throwIfDisposed();let n=this.cacheForContext(e);if(n.has(t))return n.get(t);if(r){let i=r();return n.set(t,i),i}else return}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){let t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){let t=this.converter(e),r=this.cache.get(t);return r||(r=new Map,this.cache.set(t,r)),r}},OYe=class extends ED{static{_(this,"DocumentCache")}constructor(e,t){super(r=>r.toString()),t?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(t,r=>{this.clear(r.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,n)=>{for(let i of n)this.clear(i)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,n)=>{let i=r.concat(n);for(let a of i)this.clear(a)}))}},bne=class extends xne{static{_(this,"WorkspaceCache")}constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,n)=>{n.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}},PYe=class{static{_(this,"DefaultScopeProvider")}constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new bne(e.shared)}getScope(e){let t=[],r=this.reflection.getReferenceType(e),n=Mh(e.container).localSymbols;if(n){let a=e.container;do n.has(a)&&t.push(n.getStream(a).filter(s=>this.reflection.isSubtype(s.type,r))),a=a.$container;while(a)}let i=this.getGlobalScope(r,e);for(let a=t.length-1;a>=0;a--)i=this.createScope(t[a],i);return i}createScope(e,t,r){return new jJ(ki(e),t,r)}createScopeForNodes(e,t,r){let n=ki(e).map(i=>{let a=this.nameProvider.getName(i);if(a)return this.descriptions.createDescription(i,a)}).nonNullable();return new jJ(n,t,r)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new DYe(this.indexManager.allElements(e)))}};_(wne,"isAstNodeWithComment");_(KJ,"isIntermediateReference");BYe=class{static{_(this,"DefaultJsonSerializer")}constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,t){let r=t??{},n=t?.replacer,i=_((s,o)=>this.replacer(s,o,r),"defaultReplacer"),a=n?(s,o)=>n(s,o,i):i;try{return this.currentDocument=Mh(e),JSON.stringify(e,a,t?.space)}finally{this.currentDocument=void 0}}deserialize(e,t){let r=t??{},n=JSON.parse(e);return this.linkNode(n,n,r),n}replacer(e,t,{refText:r,sourceText:n,textRegions:i,comments:a,uriConverter:s}){if(!this.ignoreProperties.has(e))if(Al(t)){let o=t.ref,l=r?t.$refText:void 0;if(o){let u=Mh(o),h="";this.currentDocument&&this.currentDocument!==u&&(s?h=s(u.uri,o):h=u.uri.toString());let f=this.astNodeLocator.getAstNodePath(o);return{$ref:`${h}#${f}`,$refText:l}}else return{$error:t.error?.message??"Could not resolve reference",$refText:l}}else if(md(t)){let o=r?t.$refText:void 0,l=[];for(let u of t.items){let h=u.ref,f=Mh(u.ref),d="";this.currentDocument&&this.currentDocument!==f&&(s?d=s(f.uri,h):d=f.uri.toString());let p=this.astNodeLocator.getAstNodePath(h);l.push(`${d}#${p}`)}return{$refs:l,$refText:o}}else if(ls(t)){let o;if(i&&(o=this.addAstNodeRegionWithAssignmentsTo({...t}),(!e||t.$document)&&o?.$textRegion&&(o.$textRegion.documentURI=this.currentDocument?.uri.toString())),n&&!e&&(o??(o={...t}),o.$sourceText=t.$cstNode?.text),a){o??(o={...t});let l=this.commentProvider.getComment(t);l&&(o.$comment=l.replace(/\r/g,""))}return o??t}else return t}addAstNodeRegionWithAssignmentsTo(e){let t=_(r=>({offset:r.offset,end:r.end,length:r.length,range:r.range}),"createDocumentSegment");if(e.$cstNode){let r=e.$textRegion=t(e.$cstNode),n=r.assignments={};return Object.keys(e).filter(i=>!i.startsWith("$")).forEach(i=>{let a=Wte(e.$cstNode,i).map(t);a.length!==0&&(n[i]=a)}),e}}linkNode(e,t,r,n,i,a){for(let[o,l]of Object.entries(e))if(Array.isArray(l))for(let u=0;u{await this.handleException(()=>e.call(t,r,n,i),"An error occurred during validation",n,r)}}async handleException(e,t,r,n){try{await e()}catch(i){if(I2(i))throw i;console.error(`${t}:`,i),i instanceof Error&&i.stack&&console.error(i.stack);let a=i instanceof Error?i.message:String(i);r("error",`${t}: ${a}`,{node:n})}}addEntry(e,t){if(e==="AstNode"){this.entries.add("AstNode",t);return}for(let r of this.reflection.getAllSubTypes(e))this.entries.add(r,t)}getChecks(e,t){let r=ki(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(r=r.filter(n=>t.includes(n.category))),r.map(n=>n.check)}registerBeforeDocument(e,t=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",t))}registerAfterDocument(e,t=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",t))}wrapPreparationException(e,t,r){return async(n,i,a,s)=>{await this.handleException(()=>e.call(r,n,i,a,s),t,i,n)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(e){return this.knownCategories}},zYe=Object.freeze({validateNode:!0,validateChildren:!0}),GYe=class{static{_(this,"DefaultDocumentValidator")}constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async validateDocument(e,t={},r=Gi.CancellationToken.None){let n=e.parseResult,i=[];if(await Us(r),(!t.categories||t.categories.includes("built-in"))&&(this.processLexingErrors(n,i,t),t.stopAfterLexingErrors&&i.some(a=>a.data?.code===Gu.LexingError)||(this.processParsingErrors(n,i,t),t.stopAfterParsingErrors&&i.some(a=>a.data?.code===Gu.ParsingError))||(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some(a=>a.data?.code===Gu.LinkingError))))return i;try{i.push(...await this.validateAst(n.value,t,r))}catch(a){if(I2(a))throw a;console.error("An error occurred during validation:",a)}return await Us(r),i}processLexingErrors(e,t,r){let n=[...e.lexerErrors,...e.lexerReport?.diagnostics??[]];for(let i of n){let a=i.severity??"error",s={severity:BS(a),range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:Tne(a),source:this.getSource()};t.push(s)}}processParsingErrors(e,t,r){for(let n of e.parserErrors){let i;if(isNaN(n.token.startOffset)){if("previousToken"in n){let a=n.previousToken;if(isNaN(a.startOffset)){let s={line:0,character:0};i={start:s,end:s}}else{let s={line:a.endLine-1,character:a.endColumn};i={start:s,end:s}}}}else i=VS(n.token);if(i){let a={severity:BS("error"),range:i,message:n.message,data:n2(Gu.ParsingError),source:this.getSource()};t.push(a)}}}processLinkingErrors(e,t,r){for(let n of e.references){let i=n.error;if(i){let a={node:i.info.container,range:n.$refNode?.range,property:i.info.property,index:i.info.index,data:{code:Gu.LinkingError,containerType:i.info.container.$type,property:i.info.property,refText:i.info.reference.$refText}};t.push(this.toDiagnostic("error",i.message,a))}}}async validateAst(e,t,r=Gi.CancellationToken.None){let n=[],i=_((a,s,o)=>{n.push(this.toDiagnostic(a,s,o))},"acceptor");return await this.validateAstBefore(e,t,i,r),await this.validateAstNodes(e,t,i,r),await this.validateAstAfter(e,t,i,r),n}async validateAstBefore(e,t,r,n=Gi.CancellationToken.None){let i=this.validationRegistry.checksBefore;for(let a of i)await Us(n),await a(e,r,t.categories??[],n)}async validateAstNodes(e,t,r,n=Gi.CancellationToken.None){if(this.profiler?.isActive("validating")){let i=this.profiler.createTask("validating",this.languageId);i.start();try{let a=Nh(e).iterator();for(let s of a){i.startSubTask(s.$type);let o=this.validateSingleNodeOptions(s,t);if(o.validateNode)try{let l=this.validationRegistry.getChecks(s.$type,t.categories);for(let u of l)await u(s,r,n)}finally{i.stopSubTask(s.$type)}o.validateChildren||a.prune()}}finally{i.stop()}}else{let i=Nh(e).iterator();for(let a of i){await Us(n);let s=this.validateSingleNodeOptions(a,t);if(s.validateNode){let o=this.validationRegistry.getChecks(a.$type,t.categories);for(let l of o)await l(a,r,n)}s.validateChildren||i.prune()}}}validateSingleNodeOptions(e,t){return zYe}async validateAstAfter(e,t,r,n=Gi.CancellationToken.None){let i=this.validationRegistry.checksAfter;for(let a of i)await Us(n),await a(e,r,t.categories??[],n)}toDiagnostic(e,t,r){return{message:t,range:kne(r),severity:BS(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};_(kne,"getDiagnosticRange");_(BS,"toDiagnosticSeverity");_(Tne,"toDiagnosticData");(function(e){e.LexingError="lexing-error",e.LexingWarning="lexing-warning",e.LexingInfo="lexing-info",e.LexingHint="lexing-hint",e.ParsingError="parsing-error",e.LinkingError="linking-error"})(Gu||(Gu={}));qYe=class{static{_(this,"DefaultAstNodeDescriptionProvider")}constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,r){let n=r??Mh(e);t??(t=this.nameProvider.getName(e));let i=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${i} has no name.`);let a,s=_(()=>a??(a=Bw(this.nameProvider.getNameNode(e)??e.$cstNode)),"nameSegmentGetter");return{node:e,name:t,get nameSegment(){return s()},selectionSegment:Bw(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}},VYe=class{static{_(this,"DefaultReferenceDescriptionProvider")}constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Gi.CancellationToken.None){let r=[],n=e.parseResult.value;for(let i of Nh(n))await Us(t),Dw(i).forEach(a=>{a.reference.error||r.push(...this.createInfoDescriptions(a))});return r}createInfoDescriptions(e){let t=e.reference;if(t.error||!t.$refNode)return[];let r=[];Al(t)&&t.$nodeDescription?r=[t.$nodeDescription]:md(t)&&(r=t.items.map(o=>o.$nodeDescription).filter(o=>o!==void 0));let n=Mh(e.container).uri,i=this.nodeLocator.getAstNodePath(e.container),a=[],s=Bw(t.$refNode);for(let o of r)a.push({sourceUri:n,sourcePath:i,targetUri:o.documentUri,targetPath:o.path,segment:s,local:_l.equals(o.documentUri,n)});return a}},WYe=class{static{_(this,"DefaultAstNodeLocator")}constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return t+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return t!==void 0?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((n,i)=>{if(!n||i.length===0)return n;let a=i.indexOf(this.indexSeparator);if(a>0){let s=i.substring(0,a),o=parseInt(i.substring(a+1));return n[s]?.[o]}return n[i]},e)}},AD={};wN(AD,Zee(qw(),1));HYe=class{static{_(this,"DefaultConfigurationProvider")}constructor(e){this._ready=new ap,this.onConfigurationSectionUpdateEmitter=new AD.Emitter,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){this.workspaceConfig=e.capabilities.workspace?.configuration??!1}async initialized(e){if(this.workspaceConfig){if(e.register){let t=this.serviceRegistry.all;e.register({section:t.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let t=this.serviceRegistry.all.map(n=>({section:this.toSectionName(n.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(t);t.forEach((n,i)=>{this.updateSectionConfiguration(n.section,r[i])})}}this._ready.resolve()}updateConfiguration(e){typeof e.settings!="object"||e.settings===null||Object.entries(e.settings).forEach(([t,r])=>{this.updateSectionConfiguration(t,r),this.onConfigurationSectionUpdateEmitter.fire({section:t,configuration:r})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;let r=this.toSectionName(e);if(this.settings[r])return this.settings[r][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}},WI=Zee(xOt(),1);(function(e){function t(r){return{dispose:_(async()=>await r(),"dispose")}}_(t,"create"),e.create=t})(s2||(s2={}));UYe=class{static{_(this,"DefaultDocumentBuilder")}constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new sp,this.documentPhaseListeners=new sp,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Ln.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.fileSystemProvider=e.workspace.FileSystemProvider,this.workspaceManager=()=>e.workspace.WorkspaceManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},r=Gi.CancellationToken.None){for(let n of e){let i=n.uri.toString();if(n.state===Ln.Validated){if(typeof t.validation=="boolean"&&t.validation)this.resetToState(n,Ln.IndexedReferences);else if(typeof t.validation=="object"){let a=this.findMissingValidationCategories(n,t);a.length>0&&(this.buildState.set(i,{completed:!1,options:{validation:{categories:a}},result:this.buildState.get(i)?.result}),n.state=Ln.IndexedReferences)}}else this.buildState.delete(i)}this.currentState=Ln.Changed,await this.emitUpdate(e.map(n=>n.uri),[]),await this.buildDocuments(e,t,r)}async update(e,t,r=Gi.CancellationToken.None){this.currentState=Ln.Changed;let n=[];for(let o of t){let l=this.langiumDocuments.deleteDocuments(o);for(let u of l)n.push(u.uri),this.cleanUpDeleted(u)}let i=(await Promise.all(e.map(o=>this.findChangedUris(o)))).flat();for(let o of i){let l=this.langiumDocuments.getDocument(o);l===void 0&&(l=this.langiumDocumentFactory.fromModel({$type:"INVALID"},o),l.state=Ln.Changed,this.langiumDocuments.addDocument(l)),this.resetToState(l,Ln.Changed)}let a=ki(i).concat(n).map(o=>o.toString()).toSet();this.langiumDocuments.all.filter(o=>!a.has(o.uri.toString())&&this.shouldRelink(o,a)).forEach(o=>this.resetToState(o,Ln.ComputedScopes)),await this.emitUpdate(i,n),await Us(r);let s=this.sortDocuments(this.langiumDocuments.all.filter(o=>o.state=1}findMissingValidationCategories(e,t){let r=this.buildState.get(e.uri.toString()),n=this.serviceRegistry.getServices(e.uri).validation.ValidationRegistry.getAllValidationCategories(e),i=r?.result?.validationChecks?new Set(r?.result?.validationChecks):r?.completed?n:new Set,a=t===void 0||t.validation===!0?n:typeof t.validation=="object"?t.validation.categories??n:[];return ki(a).filter(s=>!i.has(s)).toArray()}async findChangedUris(e){if(this.langiumDocuments.getDocument(e)??this.textDocuments?.get(e))return[e];try{let r=await this.fileSystemProvider.stat(e);if(r.isDirectory)return await this.workspaceManager().searchFolder(e);if(this.workspaceManager().shouldIncludeEntry(r))return[e]}catch{}return[]}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(r=>r(e,t)))}sortDocuments(e){let t=0,r=e.length-1;for(;t=0&&!this.hasTextDocument(e[r]);)r--;tr.error!==void 0)?!0:this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),s2.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}resetToState(e,t){switch(t){case Ln.Changed:case Ln.Parsed:this.indexManager.removeContent(e.uri);case Ln.IndexedContent:e.localSymbols=void 0;case Ln.ComputedScopes:this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e);case Ln.Linked:this.indexManager.removeReferences(e.uri);case Ln.IndexedReferences:e.diagnostics=void 0,this.buildState.delete(e.uri.toString());case Ln.Validated:}e.state>t&&(e.state=t)}cleanUpDeleted(e){this.buildState.delete(e.uri.toString()),this.indexManager.remove(e.uri),e.state=Ln.Changed}async buildDocuments(e,t,r){this.prepareBuild(e,t),await this.runCancelable(e,Ln.Parsed,r,a=>this.langiumDocumentFactory.update(a,r)),await this.runCancelable(e,Ln.IndexedContent,r,a=>this.indexManager.updateContent(a,r)),await this.runCancelable(e,Ln.ComputedScopes,r,async a=>{let s=this.serviceRegistry.getServices(a.uri).references.ScopeComputation;a.localSymbols=await s.collectLocalSymbols(a,r)});let n=e.filter(a=>this.shouldLink(a));await this.runCancelable(n,Ln.Linked,r,a=>this.serviceRegistry.getServices(a.uri).references.Linker.link(a,r)),await this.runCancelable(n,Ln.IndexedReferences,r,a=>this.indexManager.updateReferences(a,r));let i=e.filter(a=>this.shouldValidate(a)?!0:(this.markAsCompleted(a),!1));await this.runCancelable(i,Ln.Validated,r,async a=>{await this.validate(a,r),this.markAsCompleted(a)})}markAsCompleted(e){let t=this.buildState.get(e.uri.toString());t&&(t.completed=!0)}prepareBuild(e,t){for(let r of e){let n=r.uri.toString(),i=this.buildState.get(n);(!i||i.completed)&&this.buildState.set(n,{completed:!1,options:t,result:i?.result})}}async runCancelable(e,t,r,n){for(let a of e)a.statea.state===t);await this.notifyBuildPhase(i,t,r),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),s2.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),s2.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,r){let n;return t&&"path"in t?n=t:r=t,r??(r=Gi.CancellationToken.None),n?this.awaitDocumentState(e,n,r):this.awaitBuilderState(e,r)}awaitDocumentState(e,t,r){let n=this.langiumDocuments.getDocument(t);if(n){if(n.state>=e)return Promise.resolve(t);if(r.isCancellationRequested)return Promise.reject(pd);if(this.currentState>=e&&e>n.state)return Promise.reject(new WI.ResponseError(WI.LSPErrorCodes.RequestFailed,`Document state of ${t.toString()} is ${Ln[n.state]}, requiring ${Ln[e]}, but workspace state is already ${Ln[this.currentState]}. Returning undefined.`))}else return Promise.reject(new WI.ResponseError(WI.LSPErrorCodes.ServerCancelled,`No document found for URI: ${t.toString()}`));return new Promise((i,a)=>{let s=this.onDocumentPhase(e,l=>{_l.equals(l.uri,t)&&(s.dispose(),o.dispose(),i(l.uri))}),o=r.onCancellationRequested(()=>{s.dispose(),o.dispose(),a(pd)})})}awaitBuilderState(e,t){return this.currentState>=e?Promise.resolve():t.isCancellationRequested?Promise.reject(pd):new Promise((r,n)=>{let i=this.onBuildPhase(e,()=>{i.dispose(),a.dispose(),r()}),a=t.onCancellationRequested(()=>{i.dispose(),a.dispose(),n(pd)})})}async notifyDocumentPhase(e,t,r){let i=this.documentPhaseListeners.get(t).slice();for(let a of i)try{await Us(r),await a(e,r)}catch(s){if(!I2(s))throw s}}async notifyBuildPhase(e,t,r){if(e.length===0)return;let i=this.buildPhaseListeners.get(t).slice();for(let a of i)await Us(r),await a(e,r)}shouldLink(e){return this.getBuildOptions(e).eagerLinking??!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,t){let r=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,n=this.getBuildOptions(e),i=typeof n.validation=="object"?{...n.validation}:{};i.categories=this.findMissingValidationCategories(e,n);let a=await r.validateDocument(e,i,t);e.diagnostics?e.diagnostics.push(...a):e.diagnostics=a;let s=this.buildState.get(e.uri.toString());s&&(s.result??(s.result={}),s.result.validationChecks?s.result.validationChecks=ki(s.result.validationChecks).concat(i.categories).distinct().toArray():s.result.validationChecks=[...i.categories])}getBuildOptions(e){return this.buildState.get(e.uri.toString())?.options??{}}},YYe=class{static{_(this,"DefaultIndexManager")}constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new ED,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){let r=Mh(e).uri,n=[];return this.referenceIndex.forEach(i=>{i.forEach(a=>{_l.equals(a.targetUri,r)&&a.targetPath===t&&n.push(a)})}),ki(n)}allElements(e,t){let r=ki(this.symbolIndex.keys());return t&&(r=r.filter(n=>!t||t.has(n))),r.map(n=>this.getFileDescriptions(n,e)).flat()}getFileDescriptions(e,t){return t?this.symbolByTypeIndex.get(e,t,()=>(this.symbolIndex.get(e)??[]).filter(i=>this.astReflection.isSubtype(i.type,t))):this.symbolIndex.get(e)??[]}remove(e){this.removeContent(e),this.removeReferences(e)}removeContent(e){let t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t)}removeReferences(e){let t=e.toString();this.referenceIndex.delete(t)}async updateContent(e,t=Gi.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.collectExportedSymbols(e,t),i=e.uri.toString();this.symbolIndex.set(i,n),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=Gi.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),n)}isAffected(e,t){let r=this.referenceIndex.get(e.uri.toString());return r?r.some(n=>!n.local&&t.has(n.targetUri.toString())):!1}},XYe=class{static{_(this,"DefaultWorkspaceManager")}constructor(e){this.initialBuildOptions={},this._ready=new ap,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){this.folders=e.workspaceFolders??void 0}initialized(e){return this.mutex.write(t=>this.initializeWorkspace(this.folders??[],t))}async initializeWorkspace(e,t=Gi.CancellationToken.None){let r=await this.performStartup(e);await Us(t),await this.documentBuilder.build(r,this.initialBuildOptions,t)}async performStartup(e){let t=[],r=_(a=>{t.push(a),this.langiumDocuments.hasDocument(a.uri)||this.langiumDocuments.addDocument(a)},"collector");await this.loadAdditionalDocuments(e,r);let n=[];await Promise.all(e.map(a=>this.getRootFolder(a)).map(async a=>this.traverseFolder(a,n)));let i=ki(n).distinct(a=>a.toString()).filter(a=>!this.langiumDocuments.hasDocument(a));return await this.loadWorkspaceDocuments(i,r),this._ready.resolve(),t}async loadWorkspaceDocuments(e,t){await Promise.all(e.map(async r=>{let n=await this.langiumDocuments.getOrCreateDocument(r);t(n)}))}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Xc.parse(e.uri)}async traverseFolder(e,t){try{let r=await this.fileSystemProvider.readDirectory(e);await Promise.all(r.map(async n=>{this.shouldIncludeEntry(n)&&(n.isDirectory?await this.traverseFolder(n.uri,t):n.isFile&&t.push(n.uri))}))}catch(r){console.error("Failure to read directory content of "+e.toString(!0),r)}}async searchFolder(e){let t=[];return await this.traverseFolder(e,t),t}shouldIncludeEntry(e){let t=_l.basename(e.uri);return t.startsWith(".")?!1:e.isDirectory?t!=="node_modules"&&t!=="out":e.isFile?this.serviceRegistry.hasServices(e.uri):!1}},jYe=class{static{_(this,"DefaultLexerErrorMessageProvider")}buildUnexpectedCharactersMessage(e,t,r,n,i){return RJ.buildUnexpectedCharactersMessage(e,t,r,n,i)}buildUnableToPopLexerModeMessage(e){return RJ.buildUnableToPopLexerModeMessage(e)}},Cne={mode:"full"},Sne=class{static{_(this,"DefaultLexer")}constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let t=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t);let r=vN(t)?Object.values(t):t,n=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new Rl(r,{positionTracking:"full",skipValidations:n,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Cne){let r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:r.groups.hidden??[],report:this.tokenBuilder.flushLexingReport?.(e)}}toTokenTypeDictionary(e){if(vN(e))return e;let t=RD(e)?Object.values(e.modes).flat():e,r={};return t.forEach(n=>r[n.name]=n),r}};_(_D,"isTokenTypeArray");_(RD,"isIMultiModeLexerDefinition");_(vN,"isTokenTypeDictionary");a6();_(Ene,"parseJSDoc");_(Ane,"isJSDoc");_(_ne,"getLines");YPe=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,HUt=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;_(KYe,"tokenize");_(ZYe,"buildInlineTokens");UUt=/\S/,YUt=/\s*$/;_(xN,"skipWhitespace");_(QYe,"lastCharacter");_(JYe,"parseJSDocComment");_(eXe,"parseJSDocElement");_(tXe,"appendEmptyLine");_(Rne,"parseJSDocText");_(rXe,"parseJSDocInline");_(Lne,"parseJSDocTag");_(Ine,"parseJSDocLine");_(LD,"normalizeOptions");_(TM,"normalizeOption");XPe=class{static{_(this,"JSDocCommentImpl")}constructor(e,t){this.elements=e,this.range=t}getTag(e){return this.getAllTags().find(t=>t.name===e)}getTags(e){return this.getAllTags().filter(t=>t.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let t of this.elements)if(e.length===0)e=t.toString();else{let r=t.toString();e+=QJ(e)+r}return e.trim()}toMarkdown(e){let t="";for(let r of this.elements)if(t.length===0)t=r.toMarkdown(e);else{let n=r.toMarkdown(e);t+=QJ(t)+n}return t.trim()}},aQ=class{static{_(this,"JSDocTagImpl")}constructor(e,t,r,n){this.name=e,this.content=t,this.inline=r,this.range=n}toString(){let e=`@${this.name}`,t=this.content.toString();return this.content.inlines.length===1?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e} -${t}`),this.inline?`{${e}}`:e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let i=nXe(this.name,t,e??{});if(typeof i=="string")return i}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let n=`${r}@${this.name}${r}`;return this.content.inlines.length===1?n=`${n} \u2014 ${t}`:this.content.inlines.length>1&&(n=`${n} -${t}`),this.inline?`{${n}}`:n}};_(nXe,"renderInlineTag");_(iXe,"renderLinkDefault");ZJ=class{static{_(this,"JSDocTextImpl")}constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;tr.range.start.line&&(e+=` + For further details.`);this.skipValidations=Ur(r,"skipValidations")?r.skipValidations:ip.skipValidations}};zre.DEFER_DEFINITION_ERRORS_HANDLING=!1;XVe(zre,[pqt,yqt,bqt,wqt,Tqt,kqt,Cqt,Sqt,Aqt,_qt]);Rqt=class extends zre{static{_(this,"EmbeddedActionsParser")}constructor(e,t=ip){let r=ko(t);r.outputCst=!1,super(e,r)}};_(KVe,"arrayMap");ZVe=KVe;_(QVe,"listCacheClear");Lqt=QVe;_(JVe,"eq");eWe=JVe;_(tWe,"assocIndexOf");sD=tWe,Iqt=Array.prototype,Mqt=Iqt.splice;_(rWe,"listCacheDelete");Nqt=rWe;_(nWe,"listCacheGet");Dqt=nWe;_(iWe,"listCacheHas");Oqt=iWe;_(aWe,"listCacheSet");Pqt=aWe;_(S2,"ListCache");S2.prototype.clear=Lqt;S2.prototype.delete=Nqt;S2.prototype.get=Dqt;S2.prototype.has=Oqt;S2.prototype.set=Pqt;oD=S2;_(sWe,"stackClear");Bqt=sWe;_(oWe,"stackDelete");Fqt=oWe;_(lWe,"stackGet");$qt=lWe;_(cWe,"stackHas");zqt=cWe,Gqt=typeof global=="object"&&global&&global.Object===Object&&global,uWe=Gqt,qqt=typeof self=="object"&&self&&self.Object===Object&&self,Vqt=uWe||qqt||Function("return this")(),cp=Vqt,Wqt=cp.Symbol,yd=Wqt,hWe=Object.prototype,Hqt=hWe.hasOwnProperty,Uqt=hWe.toString,iS=yd?yd.toStringTag:void 0;_(fWe,"getRawTag");Yqt=fWe,Xqt=Object.prototype,jqt=Xqt.toString;_(dWe,"objectToString");Kqt=dWe,Zqt="[object Null]",Qqt="[object Undefined]",kPe=yd?yd.toStringTag:void 0;_(pWe,"baseGetTag");Kw=pWe;_(mWe,"isObject");Gre=mWe,Jqt="[object AsyncFunction]",eVt="[object Function]",tVt="[object GeneratorFunction]",rVt="[object Proxy]";_(gWe,"isFunction");yWe=gWe,nVt=cp["__core-js_shared__"],nQ=nVt,TPe=(function(){var e=/[^.]+$/.exec(nQ&&nQ.keys&&nQ.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();_(vWe,"isMasked");iVt=vWe,aVt=Function.prototype,sVt=aVt.toString;_(xWe,"toSource");E2=xWe,oVt=/[\\^$.*+?()[\]{}|]/g,lVt=/^\[object .+?Constructor\]$/,cVt=Function.prototype,uVt=Object.prototype,hVt=cVt.toString,fVt=uVt.hasOwnProperty,dVt=RegExp("^"+hVt.call(fVt).replace(oVt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");_(bWe,"baseIsNative");pVt=bWe;_(wWe,"getValue");mVt=wWe;_(kWe,"getNative");Zw=kWe,gVt=Zw(cp,"Map"),JS=gVt,yVt=Zw(Object,"create"),e6=yVt;_(TWe,"hashClear");vVt=TWe;_(CWe,"hashDelete");xVt=CWe,bVt="__lodash_hash_undefined__",wVt=Object.prototype,kVt=wVt.hasOwnProperty;_(SWe,"hashGet");TVt=SWe,CVt=Object.prototype,SVt=CVt.hasOwnProperty;_(EWe,"hashHas");EVt=EWe,AVt="__lodash_hash_undefined__";_(AWe,"hashSet");_Vt=AWe;_(A2,"Hash");A2.prototype.clear=vVt;A2.prototype.delete=xVt;A2.prototype.get=TVt;A2.prototype.has=EVt;A2.prototype.set=_Vt;CPe=A2;_(_We,"mapCacheClear");RVt=_We;_(RWe,"isKeyable");LVt=RWe;_(LWe,"getMapData");lD=LWe;_(IWe,"mapCacheDelete");IVt=IWe;_(MWe,"mapCacheGet");MVt=MWe;_(NWe,"mapCacheHas");NVt=NWe;_(DWe,"mapCacheSet");DVt=DWe;_(_2,"MapCache");_2.prototype.clear=RVt;_2.prototype.delete=IVt;_2.prototype.get=MVt;_2.prototype.has=NVt;_2.prototype.set=DVt;cD=_2,OVt=200;_(OWe,"stackSet");PVt=OWe;_(R2,"Stack");R2.prototype.clear=Bqt;R2.prototype.delete=Fqt;R2.prototype.get=$qt;R2.prototype.has=zqt;R2.prototype.set=PVt;xM=R2,BVt="__lodash_hash_undefined__";_(PWe,"setCacheAdd");FVt=PWe;_(BWe,"setCacheHas");$Vt=BWe;_(t6,"SetCache");t6.prototype.add=t6.prototype.push=FVt;t6.prototype.has=$Vt;FWe=t6;_($We,"arraySome");zVt=$We;_(zWe,"cacheHas");GWe=zWe,GVt=1,qVt=2;_(qWe,"equalArrays");VWe=qWe,VVt=cp.Uint8Array,SPe=VVt;_(WWe,"mapToArray");WVt=WWe;_(HWe,"setToArray");qre=HWe,HVt=1,UVt=2,YVt="[object Boolean]",XVt="[object Date]",jVt="[object Error]",KVt="[object Map]",ZVt="[object Number]",QVt="[object RegExp]",JVt="[object Set]",eWt="[object String]",tWt="[object Symbol]",rWt="[object ArrayBuffer]",nWt="[object DataView]",EPe=yd?yd.prototype:void 0,iQ=EPe?EPe.valueOf:void 0;_(UWe,"equalByTag");iWt=UWe;_(YWe,"arrayPush");XWe=YWe,aWt=Array.isArray,Dl=aWt;_(jWe,"baseGetAllKeys");sWt=jWe;_(KWe,"arrayFilter");ZWe=KWe;_(QWe,"stubArray");oWt=QWe,lWt=Object.prototype,cWt=lWt.propertyIsEnumerable,APe=Object.getOwnPropertySymbols,uWt=APe?function(e){return e==null?[]:(e=Object(e),ZWe(APe(e),function(t){return cWt.call(e,t)}))}:oWt,hWt=uWt;_(JWe,"baseTimes");fWt=JWe;_(eHe,"isObjectLike");zw=eHe,dWt="[object Arguments]";_(tHe,"baseIsArguments");_Pe=tHe,rHe=Object.prototype,pWt=rHe.hasOwnProperty,mWt=rHe.propertyIsEnumerable,gWt=_Pe((function(){return arguments})())?_Pe:function(e){return zw(e)&&pWt.call(e,"callee")&&!mWt.call(e,"callee")},uD=gWt;_(nHe,"stubFalse");yWt=nHe,iHe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,RPe=iHe&&typeof module=="object"&&module&&!module.nodeType&&module,vWt=RPe&&RPe.exports===iHe,LPe=vWt?cp.Buffer:void 0,xWt=LPe?LPe.isBuffer:void 0,bWt=xWt||yWt,cN=bWt,wWt=9007199254740991,kWt=/^(?:0|[1-9]\d*)$/;_(aHe,"isIndex");sHe=aHe,TWt=9007199254740991;_(oHe,"isLength");Vre=oHe,CWt="[object Arguments]",SWt="[object Array]",EWt="[object Boolean]",AWt="[object Date]",_Wt="[object Error]",RWt="[object Function]",LWt="[object Map]",IWt="[object Number]",MWt="[object Object]",NWt="[object RegExp]",DWt="[object Set]",OWt="[object String]",PWt="[object WeakMap]",BWt="[object ArrayBuffer]",FWt="[object DataView]",$Wt="[object Float32Array]",zWt="[object Float64Array]",GWt="[object Int8Array]",qWt="[object Int16Array]",VWt="[object Int32Array]",WWt="[object Uint8Array]",HWt="[object Uint8ClampedArray]",UWt="[object Uint16Array]",YWt="[object Uint32Array]",Zi={};Zi[$Wt]=Zi[zWt]=Zi[GWt]=Zi[qWt]=Zi[VWt]=Zi[WWt]=Zi[HWt]=Zi[UWt]=Zi[YWt]=!0;Zi[CWt]=Zi[SWt]=Zi[BWt]=Zi[EWt]=Zi[FWt]=Zi[AWt]=Zi[_Wt]=Zi[RWt]=Zi[LWt]=Zi[IWt]=Zi[MWt]=Zi[NWt]=Zi[DWt]=Zi[OWt]=Zi[PWt]=!1;_(lHe,"baseIsTypedArray");XWt=lHe;_(cHe,"baseUnary");jWt=cHe,uHe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,PS=uHe&&typeof module=="object"&&module&&!module.nodeType&&module,KWt=PS&&PS.exports===uHe,aQ=KWt&&uWe.process,ZWt=(function(){try{var e=PS&&PS.require&&PS.require("util").types;return e||aQ&&aQ.binding&&aQ.binding("util")}catch{}})(),IPe=ZWt,MPe=IPe&&IPe.isTypedArray,QWt=MPe?jWt(MPe):XWt,Wre=QWt,JWt=Object.prototype,eHt=JWt.hasOwnProperty;_(hHe,"arrayLikeKeys");tHt=hHe,rHt=Object.prototype;_(fHe,"isPrototype");dHe=fHe;_(pHe,"overArg");nHt=pHe,iHt=nHt(Object.keys,Object),aHt=iHt,sHt=Object.prototype,oHt=sHt.hasOwnProperty;_(mHe,"baseKeys");gHe=mHe;_(yHe,"isArrayLike");hD=yHe;_(vHe,"keys");Hre=vHe;_(xHe,"getAllKeys");NPe=xHe,lHt=1,cHt=Object.prototype,uHt=cHt.hasOwnProperty;_(bHe,"equalObjects");hHt=bHe,fHt=Zw(cp,"DataView"),qJ=fHt,dHt=Zw(cp,"Promise"),VJ=dHt,pHt=Zw(cp,"Set"),Lw=pHt,mHt=Zw(cp,"WeakMap"),WJ=mHt,DPe="[object Map]",gHt="[object Object]",OPe="[object Promise]",PPe="[object Set]",BPe="[object WeakMap]",FPe="[object DataView]",yHt=E2(qJ),vHt=E2(JS),xHt=E2(VJ),bHt=E2(Lw),wHt=E2(WJ),_v=Kw;(qJ&&_v(new qJ(new ArrayBuffer(1)))!=FPe||JS&&_v(new JS)!=DPe||VJ&&_v(VJ.resolve())!=OPe||Lw&&_v(new Lw)!=PPe||WJ&&_v(new WJ)!=BPe)&&(_v=_(function(e){var t=Kw(e),r=t==gHt?e.constructor:void 0,n=r?E2(r):"";if(n)switch(n){case yHt:return FPe;case vHt:return DPe;case xHt:return OPe;case bHt:return PPe;case wHt:return BPe}return t},"getTag"));HJ=_v,kHt=1,$Pe="[object Arguments]",zPe="[object Array]",VI="[object Object]",THt=Object.prototype,GPe=THt.hasOwnProperty;_(wHe,"baseIsEqualDeep");CHt=wHe;_(Ure,"baseIsEqual");kHe=Ure,SHt=1,EHt=2;_(THe,"baseIsMatch");AHt=THe;_(CHe,"isStrictComparable");SHe=CHe;_(EHe,"getMatchData");_Ht=EHe;_(AHe,"matchesStrictComparable");_He=AHe;_(RHe,"baseMatches");RHt=RHe,LHt="[object Symbol]";_(LHe,"isSymbol");fD=LHe,IHt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,MHt=/^\w*$/;_(IHe,"isKey");Yre=IHe,NHt="Expected a function";_(dD,"memoize");dD.Cache=cD;DHt=dD,OHt=500;_(MHe,"memoizeCapped");PHt=MHe,BHt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,FHt=/\\(\\)?/g,$Ht=PHt(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(BHt,function(r,n,i,a){t.push(i?a.replace(FHt,"$1"):n||r)}),t}),zHt=$Ht,GHt=1/0,qPe=yd?yd.prototype:void 0,VPe=qPe?qPe.toString:void 0;_(Xre,"baseToString");qHt=Xre;_(NHe,"toString");VHt=NHe;_(DHe,"castPath");OHe=DHe,WHt=1/0;_(PHe,"toKey");pD=PHe;_(BHe,"baseGet");FHe=BHe;_($He,"get");HHt=$He;_(zHe,"baseHasIn");UHt=zHe;_(GHe,"hasPath");YHt=GHe;_(qHe,"hasIn");XHt=qHe,jHt=1,KHt=2;_(VHe,"baseMatchesProperty");ZHt=VHe;_(WHe,"identity");jre=WHe;_(HHe,"baseProperty");QHt=HHe;_(UHe,"basePropertyDeep");JHt=UHe;_(YHe,"property");eUt=YHe;_(XHe,"baseIteratee");mD=XHe;_(jHe,"createBaseFor");tUt=jHe,rUt=tUt(),nUt=rUt;_(KHe,"baseForOwn");iUt=KHe;_(ZHe,"createBaseEach");aUt=ZHe,sUt=aUt(iUt),gD=sUt;_(QHe,"baseMap");oUt=QHe;_(JHe,"map");K0=JHe;_(eUe,"baseFilter");lUt=eUe;_(tUe,"filter");cUt=tUe;_(u2,"buildATNKey");Vg=1,uUt=2,rUe=4,nUe=5,S6=7,hUt=8,fUt=9,dUt=10,pUt=11,iUe=12,Kre=class{static{_(this,"AbstractTransition")}constructor(e){this.target=e}isEpsilon(){return!1}},Zre=class extends Kre{static{_(this,"AtomTransition")}constructor(e,t){super(e),this.tokenType=t}},aUe=class extends Kre{static{_(this,"EpsilonTransition")}constructor(e){super(e)}isEpsilon(){return!0}},Qre=class extends Kre{static{_(this,"RuleTransition")}constructor(e,t,r){super(e),this.rule=t,this.followState=r}isEpsilon(){return!0}};_(sUe,"createATN");_(oUe,"createRuleStartAndStopATNStates");_(Jre,"atom");_(lUe,"repetition");_(cUe,"repetitionSep");_(uUe,"repetitionMandatory");_(hUe,"repetitionMandatorySep");_(fUe,"alternation");_(dUe,"option");_(jg,"block");_(ene,"plus");_(tne,"star");_(pUe,"optional");_(up,"defineDecisionState");_(L2,"makeAlts");_(mUe,"getProdType");_(gUe,"makeBlock");_(yD,"tokenRef");_(yUe,"ruleRef");_(vUe,"buildRuleHandle");_(Va,"epsilon");_(Es,"newState");_(vD,"addTransition");_(xUe,"removeState");uN={},UJ=class{static{_(this,"ATNConfigSet")}constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let t=rne(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return K0(this.configs,e=>e.alt)}get key(){let e="";for(let t in this.map)e+=t+":";return e}};_(rne,"getATNConfigKey");_(bUe,"baseExtremum");mUt=bUe;_(wUe,"baseLt");gUt=wUe;_(kUe,"min");yUt=kUe,WPe=yd?yd.isConcatSpreadable:void 0;_(TUe,"isFlattenable");vUt=TUe;_(nne,"baseFlatten");CUe=nne;_(SUe,"flatMap");xUt=SUe;_(EUe,"baseFindIndex");bUt=EUe;_(AUe,"baseIsNaN");wUt=AUe;_(_Ue,"strictIndexOf");kUt=_Ue;_(RUe,"baseIndexOf");TUt=RUe;_(LUe,"arrayIncludes");CUt=LUe;_(IUe,"arrayIncludesWith");SUt=IUe;_(MUe,"noop");EUt=MUe,AUt=1/0,_Ut=Lw&&1/qre(new Lw([,-0]))[1]==AUt?function(e){return new Lw(e)}:EUt,RUt=_Ut,LUt=200;_(NUe,"baseUniq");IUt=NUe;_(DUe,"uniqBy");MUt=DUe;_(OUe,"flatten");NUt=OUe;_(PUe,"arrayEach");DUt=PUe;_(BUe,"castFunction");OUt=BUe;_(FUe,"forEach");sQ=FUe,PUt="[object Map]",BUt="[object Set]",FUt=Object.prototype,$Ut=FUt.hasOwnProperty;_($Ue,"isEmpty");zUt=$Ue;_(zUe,"arrayReduce");GUt=zUe;_(GUe,"baseReduce");qUt=GUe;_(qUe,"reduce");HPe=qUe;_(VUe,"createDFACache");WUe=class{static{_(this,"PredicateSet")}constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e="",t=this.predicates.length;for(let r=0;rconsole.log(r))}initialize(e){this.atn=sUe(e.rules),this.dfas=HUe(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:t,rule:r,hasPredicates:n,dynamicTokensEnabled:i}=e,a=this.dfas,s=this.logging,o=u2(r,"Alternation",t),u=this.atn.decisionMap[o].decision,h=K0(MJ({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:r}),f=>K0(f,d=>d[0]));if(YJ(h,!1)&&!i){let f=HPe(h,(d,p,m)=>(sQ(p,g=>{g&&(d[g.tokenTypeIdx]=m,sQ(g.categoryMatches,y=>{d[y]=m}))}),d),{});return n?function(d){var p;let m=this.LA(1),g=f[m.tokenTypeIdx];if(d!==void 0&&g!==void 0){let y=(p=d[g])===null||p===void 0?void 0:p.GATE;if(y!==void 0&&y.call(this)===!1)return}return g}:function(){let d=this.LA(1);return f[d.tokenTypeIdx]}}else return n?function(f){let d=new WUe,p=f===void 0?0:f.length;for(let g=0;gK0(f,d=>d[0]));if(YJ(h)&&h[0][0]&&!i){let f=h[0],d=NUt(f);if(d.length===1&&zUt(d[0].categoryMatches)){let m=d[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===m}}else{let p=HPe(d,(m,g)=>(g!==void 0&&(m[g.tokenTypeIdx]=!0,sQ(g.categoryMatches,y=>{m[y]=!0})),m),{});return function(){let m=this.LA(1);return p[m.tokenTypeIdx]===!0}}}return function(){let f=bM.call(this,a,u,UPe,s);return typeof f=="object"?!1:f===0}}};_(YJ,"isLL1Sequence");_(HUe,"initATNSimulator");_(bM,"adaptivePredict");_(UUe,"performLookahead");_(YUe,"computeLookaheadTarget");_(XUe,"reportLookaheadAmbiguity");_(jUe,"buildAmbiguityError");_(KUe,"getProductionDslName");_(ZUe,"buildAdaptivePredictError");_(QUe,"getExistingTargetState");_(JUe,"computeReachSet");_(eYe,"getReachableTarget");_(tYe,"getUniqueAlt");_(ine,"newDFAState");_(XJ,"addDFAEdge");_(ane,"addDFAState");_(rYe,"computeStartState");_(r6,"closure");_(nYe,"getEpsilonTarget");_(iYe,"hasConfigInRuleStopState");_(aYe,"allConfigsInRuleStopStates");_(sYe,"hasConflictTerminatingPrediction");_(oYe,"getConflictingAltSets");_(lYe,"hasConflictingAltSet");_(cYe,"hasStateAssociatedWithOneAlt");a6();uYe=class{static{_(this,"CstNodeBuilder")}constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new one(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new xD;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let r=new hN(e.startOffset,e.image.length,VS(e),e.tokenType,!t);return r.grammarSource=t,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){let t=e.container;if(t){let r=t.content.indexOf(e);r>=0&&t.content.splice(r,1)}}addHiddenNodes(e){let t=[];for(let i of e){let a=new hN(i.startOffset,i.image.length,VS(i),i.tokenType,!0);a.root=this.rootNode,t.push(a)}let r=this.current,n=!1;if(r.content.length>0){r.content.push(...t);return}for(;r.container;){let i=r.container.content.indexOf(r);if(i>0){r.container.content.splice(i,0,...t),n=!0;break}r=r.container}n||this.rootNode.content.unshift(...t)}construct(e){let t=this.current;typeof e.$type=="string"&&!e.$infix&&(this.current.astNode=e),e.$cstNode=t;let r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}},sne=class{static{_(this,"AbstractCstNode")}get hidden(){return!1}get astNode(){let e=typeof this._astNode?.$type=="string"?this._astNode:this.container?.astNode;if(!e)throw new Error("This node has no associated AST element");return e}set astNode(e){this._astNode=e}get text(){return this.root.fullText.substring(this.offset,this.end)}},hN=class extends sne{static{_(this,"LeafCstNodeImpl")}get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,t,r,n,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=n,this._length=t,this._range=r}},xD=class extends sne{static{_(this,"CompositeCstNodeImpl")}constructor(){super(...arguments),this.content=new WUt(this)}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){let{range:r}=e,{range:n}=t;this._rangeCache={start:r.start,end:n.end.line=0;e--){let t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}},WUt=class hYe extends Array{static{_(this,"CstNodeContainer")}constructor(t){super(),this.parent=t,Object.setPrototypeOf(this,hYe.prototype)}push(...t){return this.addParents(t),super.push(...t)}unshift(...t){return this.addParents(t),super.unshift(...t)}splice(t,r,...n){return this.addParents(n),super.splice(t,r,...n)}addParents(t){for(let r of t)r.container=this.parent}},one=class extends xD{static{_(this,"RootCstNodeImpl")}get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}},fN=Symbol("Datatype");_(wM,"isDataTypeNode");YPe="\u200B",fYe=_(e=>e.endsWith(YPe)?e:e+YPe,"withRuleSuffix"),lne=class{static{_(this,"AbstractLangiumParser")}constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let t=this.lexer.definition,r=e.LanguageMetaData.mode==="production";e.shared.profilers.LangiumProfiler?.isActive("parsing")?this.wrapper=new UUt(t,{...e.parser.ParserConfig,skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider},e.shared.profilers.LangiumProfiler.createTask("parsing",e.LanguageMetaData.languageId)):this.wrapper=new gYe(t,{...e.parser.ParserConfig,skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider})}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},dYe=class extends lne{static{_(this,"LangiumParser")}get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new uYe,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){let r=this.computeRuleType(e),n;Ow(e)&&(n=e.name,this.registerPrecedenceMap(e));let i=this.wrapper.DEFINE_RULE(fYe(e.name),this.startImplementation(r,n,t).bind(this));return this.allRules.set(e.name,i),Il(e)&&e.entry&&(this.mainRule=i),i}registerPrecedenceMap(e){let t=e.name,r=new Map;for(let n=0;n0&&(t=this.construct()),t===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return t}startImplementation(e,t,r){return n=>{let i=!this.isRecording()&&e!==void 0;if(i){let a={$type:e};this.stack.push(a),e===fN?a.value="":t!==void 0&&(a.$infixName=t)}return r(n),i?this.construct():void 0}}extractHiddenTokens(e){let t=this.lexerResult.hidden;if(!t.length)return[];let r=e.startOffset;for(let n=0;nr)return t.splice(0,n);return t.splice(0,t.length)}consume(e,t,r){let n=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(n)){let i=this.extractHiddenTokens(n);this.nodeBuilder.addHiddenNodes(i);let a=this.nodeBuilder.buildLeafNode(n,r),{assignment:s,crossRef:o}=this.getAssignment(r),l=this.current;if(s){let u=J0(r)?n.image:this.converter.convert(n.image,a);this.assign(s.operator,s.feature,u,a,o)}else if(wM(l)){let u=n.image;J0(r)||(u=this.converter.convert(u,a).toString()),l.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,t,r,n,i){let a;!this.isRecording()&&!r&&(a=this.nodeBuilder.buildCompositeNode(n));let s;try{s=this.wrapper.wrapSubrule(e,t,i)}finally{this.isRecording()||(s===void 0&&!r&&(s=this.construct()),s!==void 0&&a&&a.length>0&&this.performSubruleAssignment(s,n,a))}}performSubruleAssignment(e,t,r){let{assignment:n,crossRef:i}=this.getAssignment(t);if(n)this.assign(n.operator,n.feature,e,r,i);else if(!n){let a=this.current;if(wM(a))a.value+=e.toString();else if(typeof e=="object"&&e){let o=this.assignWithoutOverride(e,a);this.stack.pop(),this.stack.push(o)}}}action(e,t){if(!this.isRecording()){let r=this.current;if(t.feature&&t.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode),this.nodeBuilder.buildCompositeNode(t).content.push(r.$cstNode);let i={$type:e};this.stack.push(i),this.assign(t.operator,t.feature,r,r.$cstNode)}else r.$type=e}}construct(){if(this.isRecording())return;let e=this.stack.pop();return this.nodeBuilder.construct(e),"$infixName"in e?this.constructInfix(e,this.operatorPrecedence.get(e.$infixName)):wM(e)?this.converter.convert(e.value,e.$cstNode):(ste(this.astReflection,e),e)}constructInfix(e,t){let r=e.parts;if(!Array.isArray(r)||r.length===0)return;let n=e.operators;if(!Array.isArray(n)||r.length<2)return r[0];let i=0,a=-1;for(let m=0;ma?(a=y.precedence,i=m):y.precedence===a&&(y.rightAssoc||(i=m))}let s=n.slice(0,i),o=n.slice(i+1),l=r.slice(0,i+1),u=r.slice(i+1),h={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:l,operators:s},f={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:u,operators:o},d=this.constructInfix(h,t),p=this.constructInfix(f,t);return{$type:e.$type,$cstNode:e.$cstNode,left:d,operator:n[i],right:p}}getAssignment(e){if(!this.assignmentMap.has(e)){let t=d2(e,Q0);this.assignmentMap.set(e,{assignment:t,crossRef:t&&m2(t.terminal)?t.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(e)}assign(e,t,r,n,i){let a=this.current,s;switch(i==="single"&&typeof r=="string"?s=this.linker.buildReference(a,t,n,r):i==="multi"&&typeof r=="string"?s=this.linker.buildMultiReference(a,t,n,r):s=r,e){case"=":{a[t]=s;break}case"?=":{a[t]=!0;break}case"+=":Array.isArray(a[t])||(a[t]=[]),a[t].push(s)}}assignWithoutOverride(e,t){for(let[n,i]of Object.entries(t)){let a=e[n];a===void 0?e[n]=i:Array.isArray(a)&&Array.isArray(i)&&(i.push(...a),e[n]=i)}let r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},pYe=class{static{_(this,"AbstractParserErrorMessageProvider")}buildMismatchTokenMessage(e){return Cw.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Cw.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Cw.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Cw.buildEarlyExitMessage(e)}},cne=class extends pYe{static{_(this,"LangiumParserErrorMessageProvider")}buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},mYe=class extends lne{static{_(this,"LangiumCompletionParser")}constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let t=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=t.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let r=this.wrapper.DEFINE_RULE(fYe(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let r=this.keepStackSize();try{e(t)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,r){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,r,n,i){this.before(n),this.wrapper.wrapSubrule(e,t,i),this.after(n)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}},HUt={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new cne},gYe=class extends Rqt{static{_(this,"ChevrotainWrapper")}constructor(e,t){let r=t&&"maxLookahead"in t;super(e,{...HUt,lookaheadStrategy:r?new Fre({maxLookahead:t.maxLookahead}):new VUt({logging:t.skipValidations?()=>{}:void 0}),...t})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t,r){return this.RULE(e,t,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t,void 0)}wrapSubrule(e,t,r){return this.subrule(e,t,{ARGS:[r]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}rule(e){return e.call(this,{})}},UUt=class extends gYe{static{_(this,"ProfilerWrapper")}constructor(e,t,r){super(e,t),this.task=r}rule(e){this.task.start(),this.task.startSubTask(this.ruleName(e));try{return super.rule(e)}finally{this.task.stopSubTask(this.ruleName(e)),this.task.stop()}}ruleName(e){return e.ruleName}subrule(e,t,r){this.task.startSubTask(this.ruleName(t));try{return super.subrule(e,t,r)}finally{this.task.stopSubTask(this.ruleName(t))}}};_(bD,"createParser");_(yYe,"buildRules");_(vYe,"buildInfixRule");_(Wg,"buildElement");_(xYe,"buildAction");_(bYe,"buildRuleCall");_(wYe,"buildRuleCallPredicate");_(Ih,"buildPredicate");_(kYe,"buildAlternatives");_(TYe,"buildUnorderedGroup");_(CYe,"buildGroup");_(n6,"getGuardCondition");_(une,"buildCrossReference");_(SYe,"buildKeyword");_(hne,"wrap");_(wD,"getRule");_(EYe,"getRuleName");_(dN,"getToken");_(fne,"createCompletionParser");_(dne,"createLangiumParser");_(pne,"prepareLangiumParser");kD=class{static{_(this,"DefaultTokenBuilder")}constructor(){this.diagnostics=[]}buildTokens(e,t){let r=ki(ON(e,!1)),n=this.buildTerminalTokens(r),i=this.buildKeywordTokens(r,n,t);return i.push(...n),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Hu).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){let t=h6(e),r=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,n={name:e.name,PATTERN:r};return typeof r=="function"&&(n.LINE_BREAKS=!0),e.hidden&&(n.GROUP=DN(t)?Ll.SKIPPED:"hidden"),n}requiresCustomPattern(e){return!!(e.flags.includes("u")||e.flags.includes("s"))}regexPatternFunction(e){let t=new RegExp(e,e.flags+"y");return(r,n)=>(t.lastIndex=n,t.exec(r))}buildKeywordTokens(e,t,r){return e.filter(p2).flatMap(n=>op(n).filter(J0)).distinct(n=>n.value).toArray().sort((n,i)=>i.value.length-n.value.length).map(n=>this.buildKeywordToken(n,t,!!r?.caseInsensitive))}buildKeywordToken(e,t,r){let n=this.buildKeywordPattern(e,r),i={name:e.value,PATTERN:n,LONGER_ALT:this.findLongerAlt(e,t)};return typeof n=="function"&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(Ww(e.value),"i"):e.value}findLongerAlt(e,t){return t.reduce((r,n)=>{let i=n?.PATTERN;return i?.source&&$te("^"+i.source+"$",e.value)&&r.push(n),r},[])}},mne=class{static{_(this,"DefaultValueConverter")}convert(e,t){let r=t.grammarSource;if(m2(r)&&(r=Wte(r)),ep(r)){let n=r.rule.ref;if(!n)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(n,e,t)}return e}runConverter(e,t,r){switch(e.name.toUpperCase()){case"INT":return hd.convertInt(t);case"STRING":return hd.convertString(t);case"ID":return hd.convertID(t)}switch(Jte(e)?.toLowerCase()){case"number":return hd.convertNumber(t);case"boolean":return hd.convertBoolean(t);case"bigint":return hd.convertBigint(t);case"date":return hd.convertDate(t);default:return t}}};(function(e){function t(u){let h="";for(let f=1;f{this.resolve=r=>(e(r),this),this.reject=r=>(t(r),this)})}},XPe=class jJ{static{_(this,"FullTextDocument")}constructor(t,r,n,i){this._uri=t,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){for(let n of t)if(jJ.isIncremental(n)){let i=vne(n.range),a=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,a)+n.text+this._content.substring(s,this._content.length);let o=Math.max(i.start.line,0),l=Math.max(i.end.line,0),u=this._lineOffsets,h=KJ(n.text,!1,a);if(l-o===h.length)for(let d=0,p=h.length;dt?i=s:n=s+1}let a=n-1;return t=this.ensureBeforeEOL(t,r[a]),{line:a,character:t-r[a]}}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line];if(t.character<=0)return n;let i=t.line+1r&&yne(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}};(function(e){function t(i,a,s,o){return new XPe(i,a,s,o)}_(t,"create"),e.create=t;function r(i,a,s){if(i instanceof XPe)return i.update(a,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}_(r,"update"),e.update=r;function n(i,a){let s=i.getText(),o=mN(a.map(_Ye),(h,f)=>{let d=h.range.start.line-f.range.start.line;return d===0?h.range.start.character-f.range.start.character:d}),l=0,u=[];for(let h of o){let f=i.offsetAt(h.range.start);if(fl&&u.push(s.substring(l,f)),h.newText.length&&u.push(h.newText),l=i.offsetAt(h.range.end)}return u.push(s.substr(l)),u.join("")}_(n,"applyEdits"),e.applyEdits=n})(pN||(pN={}));_(mN,"mergeSort");_(KJ,"computeLineOffsets");_(yne,"isEOL");_(vne,"getWellformedRange");_(_Ye,"getWellformedEdit");(()=>{"use strict";var e={975:O=>{function R(M){if(typeof M!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(M))}_(R,"e");function A(M,D){for(var B,P="",$=0,F=-1,q=0,G=0;G<=M.length;++G){if(G2){var z=P.lastIndexOf("/");if(z!==P.length-1){z===-1?(P="",$=0):$=(P=P.slice(0,z)).length-1-P.lastIndexOf("/"),F=G,q=0;continue}}else if(P.length===2||P.length===1){P="",$=0,F=G,q=0;continue}}D&&(P.length>0?P+="/..":P="..",$=2)}else P.length>0?P+="/"+M.slice(F+1,G):P=M.slice(F+1,G),$=G-F-1;F=G,q=0}else B===46&&q!==-1?++q:q=-1}return P}_(A,"r");var N={resolve:_(function(){for(var M,D="",B=!1,P=arguments.length-1;P>=-1&&!B;P--){var $;P>=0?$=arguments[P]:(M===void 0&&(M=process.cwd()),$=M),R($),$.length!==0&&(D=$+"/"+D,B=$.charCodeAt(0)===47)}return D=A(D,!B),B?D.length>0?"/"+D:"/":D.length>0?D:"."},"resolve"),normalize:_(function(M){if(R(M),M.length===0)return".";var D=M.charCodeAt(0)===47,B=M.charCodeAt(M.length-1)===47;return(M=A(M,!D)).length!==0||D||(M="."),M.length>0&&B&&(M+="/"),D?"/"+M:M},"normalize"),isAbsolute:_(function(M){return R(M),M.length>0&&M.charCodeAt(0)===47},"isAbsolute"),join:_(function(){if(arguments.length===0)return".";for(var M,D=0;D0&&(M===void 0?M=B:M+="/"+B)}return M===void 0?".":N.normalize(M)},"join"),relative:_(function(M,D){if(R(M),R(D),M===D||(M=N.resolve(M))===(D=N.resolve(D)))return"";for(var B=1;BG){if(D.charCodeAt(F+H)===47)return D.slice(F+H+1);if(H===0)return D.slice(F+H)}else $>G&&(M.charCodeAt(B+H)===47?z=H:H===0&&(z=0));break}var j=M.charCodeAt(B+H);if(j!==D.charCodeAt(F+H))break;j===47&&(z=H)}var J="";for(H=B+z+1;H<=P;++H)H!==P&&M.charCodeAt(H)!==47||(J.length===0?J+="..":J+="/..");return J.length>0?J+D.slice(F+z):(F+=z,D.charCodeAt(F)===47&&++F,D.slice(F))},"relative"),_makeLong:_(function(M){return M},"_makeLong"),dirname:_(function(M){if(R(M),M.length===0)return".";for(var D=M.charCodeAt(0),B=D===47,P=-1,$=!0,F=M.length-1;F>=1;--F)if((D=M.charCodeAt(F))===47){if(!$){P=F;break}}else $=!1;return P===-1?B?"/":".":B&&P===1?"//":M.slice(0,P)},"dirname"),basename:_(function(M,D){if(D!==void 0&&typeof D!="string")throw new TypeError('"ext" argument must be a string');R(M);var B,P=0,$=-1,F=!0;if(D!==void 0&&D.length>0&&D.length<=M.length){if(D.length===M.length&&D===M)return"";var q=D.length-1,G=-1;for(B=M.length-1;B>=0;--B){var z=M.charCodeAt(B);if(z===47){if(!F){P=B+1;break}}else G===-1&&(F=!1,G=B+1),q>=0&&(z===D.charCodeAt(q)?--q==-1&&($=B):(q=-1,$=G))}return P===$?$=G:$===-1&&($=M.length),M.slice(P,$)}for(B=M.length-1;B>=0;--B)if(M.charCodeAt(B)===47){if(!F){P=B+1;break}}else $===-1&&(F=!1,$=B+1);return $===-1?"":M.slice(P,$)},"basename"),extname:_(function(M){R(M);for(var D=-1,B=0,P=-1,$=!0,F=0,q=M.length-1;q>=0;--q){var G=M.charCodeAt(q);if(G!==47)P===-1&&($=!1,P=q+1),G===46?D===-1?D=q:F!==1&&(F=1):D!==-1&&(F=-1);else if(!$){B=q+1;break}}return D===-1||P===-1||F===0||F===1&&D===P-1&&D===B+1?"":M.slice(D,P)},"extname"),format:_(function(M){if(M===null||typeof M!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof M);return(function(D,B){var P=B.dir||B.root,$=B.base||(B.name||"")+(B.ext||"");return P?P===B.root?P+$:P+"/"+$:$})(0,M)},"format"),parse:_(function(M){R(M);var D={root:"",dir:"",base:"",ext:"",name:""};if(M.length===0)return D;var B,P=M.charCodeAt(0),$=P===47;$?(D.root="/",B=1):B=0;for(var F=-1,q=0,G=-1,z=!0,H=M.length-1,j=0;H>=B;--H)if((P=M.charCodeAt(H))!==47)G===-1&&(z=!1,G=H+1),P===46?F===-1?F=H:j!==1&&(j=1):F!==-1&&(j=-1);else if(!z){q=H+1;break}return F===-1||G===-1||j===0||j===1&&F===G-1&&F===q+1?G!==-1&&(D.base=D.name=q===0&&$?M.slice(1,G):M.slice(q,G)):(q===0&&$?(D.name=M.slice(1,F),D.base=M.slice(1,G)):(D.name=M.slice(q,F),D.base=M.slice(q,G)),D.ext=M.slice(F,G)),q>0?D.dir=M.slice(0,q-1):$&&(D.dir="/"),D},"parse"),sep:"/",delimiter:":",win32:null,posix:null};N.posix=N,O.exports=N}},t={};function r(O){var R=t[O];if(R!==void 0)return R.exports;var A=t[O]={exports:{}};return e[O](A,A.exports,r),A.exports}_(r,"r"),r.d=(O,R)=>{for(var A in R)r.o(R,A)&&!r.o(O,A)&&Object.defineProperty(O,A,{enumerable:!0,get:R[A]})},r.o=(O,R)=>Object.prototype.hasOwnProperty.call(O,R),r.r=O=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(O,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(O,"__esModule",{value:!0})};var n={};let i;r.r(n),r.d(n,{URI:_(()=>d,"URI"),Utils:_(()=>L,"Utils")}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let a=/^\w[\w\d+.-]*$/,s=/^\//,o=/^\/\//;function l(O,R){if(!O.scheme&&R)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${O.authority}", path: "${O.path}", query: "${O.query}", fragment: "${O.fragment}"}`);if(O.scheme&&!a.test(O.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(O.path){if(O.authority){if(!s.test(O.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test(O.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}_(l,"a");let u="",h="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static{_(this,"l")}static isUri(R){return R instanceof d||!!R&&typeof R.authority=="string"&&typeof R.fragment=="string"&&typeof R.path=="string"&&typeof R.query=="string"&&typeof R.scheme=="string"&&typeof R.fsPath=="string"&&typeof R.with=="function"&&typeof R.toString=="function"}scheme;authority;path;query;fragment;constructor(R,A,N,M,D,B=!1){typeof R=="object"?(this.scheme=R.scheme||u,this.authority=R.authority||u,this.path=R.path||u,this.query=R.query||u,this.fragment=R.fragment||u):(this.scheme=(function(P,$){return P||$?P:"file"})(R,B),this.authority=A||u,this.path=(function(P,$){switch(P){case"https":case"http":case"file":$?$[0]!==h&&($=h+$):$=h}return $})(this.scheme,N||u),this.query=M||u,this.fragment=D||u,l(this,B))}get fsPath(){return x(this,!1)}with(R){if(!R)return this;let{scheme:A,authority:N,path:M,query:D,fragment:B}=R;return A===void 0?A=this.scheme:A===null&&(A=u),N===void 0?N=this.authority:N===null&&(N=u),M===void 0?M=this.path:M===null&&(M=u),D===void 0?D=this.query:D===null&&(D=u),B===void 0?B=this.fragment:B===null&&(B=u),A===this.scheme&&N===this.authority&&M===this.path&&D===this.query&&B===this.fragment?this:new m(A,N,M,D,B)}static parse(R,A=!1){let N=f.exec(R);return N?new m(N[2]||u,k(N[4]||u),k(N[5]||u),k(N[7]||u),k(N[9]||u),A):new m(u,u,u,u,u)}static file(R){let A=u;if(i&&(R=R.replace(/\\/g,h)),R[0]===h&&R[1]===h){let N=R.indexOf(h,2);N===-1?(A=R.substring(2),R=h):(A=R.substring(2,N),R=R.substring(N)||h)}return new m("file",A,R,u,u)}static from(R){let A=new m(R.scheme,R.authority,R.path,R.query,R.fragment);return l(A,!0),A}toString(R=!1){return w(this,R)}toJSON(){return this}static revive(R){if(R){if(R instanceof d)return R;{let A=new m(R);return A._formatted=R.external,A._fsPath=R._sep===p?R.fsPath:null,A}}return R}}let p=i?1:void 0;class m extends d{static{_(this,"d")}_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=x(this,!1)),this._fsPath}toString(R=!1){return R?w(this,!0):(this._formatted||(this._formatted=w(this,!1)),this._formatted)}toJSON(){let R={$mid:1};return this._fsPath&&(R.fsPath=this._fsPath,R._sep=p),this._formatted&&(R.external=this._formatted),this.path&&(R.path=this.path),this.scheme&&(R.scheme=this.scheme),this.authority&&(R.authority=this.authority),this.query&&(R.query=this.query),this.fragment&&(R.fragment=this.fragment),R}}let g={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function y(O,R,A){let N,M=-1;for(let D=0;D=97&&B<=122||B>=65&&B<=90||B>=48&&B<=57||B===45||B===46||B===95||B===126||R&&B===47||A&&B===91||A&&B===93||A&&B===58)M!==-1&&(N+=encodeURIComponent(O.substring(M,D)),M=-1),N!==void 0&&(N+=O.charAt(D));else{N===void 0&&(N=O.substr(0,D));let P=g[B];P!==void 0?(M!==-1&&(N+=encodeURIComponent(O.substring(M,D)),M=-1),N+=P):M===-1&&(M=D)}}return M!==-1&&(N+=encodeURIComponent(O.substring(M))),N!==void 0?N:O}_(y,"m");function v(O){let R;for(let A=0;A1&&O.scheme==="file"?`//${O.authority}${O.path}`:O.path.charCodeAt(0)===47&&(O.path.charCodeAt(1)>=65&&O.path.charCodeAt(1)<=90||O.path.charCodeAt(1)>=97&&O.path.charCodeAt(1)<=122)&&O.path.charCodeAt(2)===58?R?O.path.substr(1):O.path[1].toLowerCase()+O.path.substr(2):O.path,i&&(A=A.replace(/\//g,"\\")),A}_(x,"v");function w(O,R){let A=R?v:y,N="",{scheme:M,authority:D,path:B,query:P,fragment:$}=O;if(M&&(N+=M,N+=":"),(D||M==="file")&&(N+=h,N+=h),D){let F=D.indexOf("@");if(F!==-1){let q=D.substr(0,F);D=D.substr(F+1),F=q.lastIndexOf(":"),F===-1?N+=A(q,!1,!1):(N+=A(q.substr(0,F),!1,!1),N+=":",N+=A(q.substr(F+1),!1,!0)),N+="@"}D=D.toLowerCase(),F=D.lastIndexOf(":"),F===-1?N+=A(D,!1,!0):(N+=A(D.substr(0,F),!1,!0),N+=D.substr(F))}if(B){if(B.length>=3&&B.charCodeAt(0)===47&&B.charCodeAt(2)===58){let F=B.charCodeAt(1);F>=65&&F<=90&&(B=`/${String.fromCharCode(F+32)}:${B.substr(3)}`)}else if(B.length>=2&&B.charCodeAt(1)===58){let F=B.charCodeAt(0);F>=65&&F<=90&&(B=`${String.fromCharCode(F+32)}:${B.substr(2)}`)}N+=A(B,!0,!1)}return P&&(N+="?",N+=A(P,!1,!1)),$&&(N+="#",N+=R?$:y($,!1,!1)),N}_(w,"b");function C(O){try{return decodeURIComponent(O)}catch{return O.length>3?O.substr(0,3)+C(O.substr(3)):O}}_(C,"C");let T=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function k(O){return O.match(T)?O.replace(T,(R=>C(R))):O}_(k,"w");var S=r(975);let E=S.posix||S,I="/";var L;(function(O){O.joinPath=function(R,...A){return R.with({path:E.join(R.path,...A)})},O.resolvePath=function(R,...A){let N=R.path,M=!1;N[0]!==I&&(N=I+N,M=!0);let D=E.resolve(N,...A);return M&&D[0]===I&&!R.authority&&(D=D.substring(1)),R.with({path:D})},O.dirname=function(R){if(R.path.length===0||R.path===I)return R;let A=E.dirname(R.path);return A.length===1&&A.charCodeAt(0)===46&&(A=""),R.with({path:A})},O.basename=function(R){return E.basename(R.path)},O.extname=function(R){return E.extname(R.path)}})(L||(L={})),RYe=n})();({URI:Xc,Utils:aS}=RYe);(function(e){e.basename=aS.basename,e.dirname=aS.dirname,e.extname=aS.extname,e.joinPath=aS.joinPath,e.resolvePath=aS.resolvePath;let t=typeof process=="object"&&process?.platform==="win32";function r(s,o){return s?.toString()===o?.toString()}_(r,"equals"),e.equals=r;function n(s,o){let l=typeof s=="string"?Xc.parse(s).path:s.path,u=typeof o=="string"?Xc.parse(o).path:o.path,h=l.split("/").filter(g=>g.length>0),f=u.split("/").filter(g=>g.length>0);if(t){let g=/^[A-Z]:$/;if(h[0]&&g.test(h[0])&&(h[0]=h[0].toLowerCase()),f[0]&&g.test(f[0])&&(f[0]=f[0].toLowerCase()),h[0]!==f[0])return u.substring(1)}let d=0;for(;d({name:n.name,uri:Rl.joinPath(Xc.parse(t),n.name).toString(),element:n.element})):[]}all(){return this.collectValues(this.root)}findAll(e){let t=this.getNode(Rl.normalize(e),!1);return t?this.collectValues(t):[]}getNode(e,t){let r=e.split("/");e.charAt(e.length-1)==="/"&&r.pop();let n=this.root;for(let i of r){let a=n.children.get(i);if(!a)if(t)a={name:i,children:new Map,parent:n},n.children.set(i,a);else return;n=a}return n}collectValues(e){let t=[];e.element&&t.push(e.element);for(let r of e.children.values())t.push(...this.collectValues(r));return t}};(function(e){e[e.Changed=0]="Changed",e[e.Parsed=1]="Parsed",e[e.IndexedContent=2]="IndexedContent",e[e.ComputedScopes=3]="ComputedScopes",e[e.Linked=4]="Linked",e[e.IndexedReferences=5]="IndexedReferences",e[e.Validated=6]="Validated"})(Ln||(Ln={}));LYe=class{static{_(this,"DefaultLangiumDocumentFactory")}constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Gi.CancellationToken.None){let r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,t)}fromTextDocument(e,t,r){return t=t??Xc.parse(e.uri),Gi.CancellationToken.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromString(e,t,r){return Gi.CancellationToken.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,r){if(typeof t=="string"){let n=this.parse(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}else if("$model"in t){let n={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let n=this.parse(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}async createAsync(e,t,r){if(typeof t=="string"){let n=await this.parseAsync(e,t,r);return this.createLangiumDocument(n,e,void 0,t)}else{let n=await this.parseAsync(e,t.getText(),r);return this.createLangiumDocument(n,e,t)}}createLangiumDocument(e,t,r,n){let i;if(r)i={parseResult:e,uri:t,state:Ln.Parsed,references:[],textDocument:r};else{let a=this.createTextDocumentGetter(t,n);i={parseResult:e,uri:t,state:Ln.Parsed,references:[],get textDocument(){return a()}}}return e.value.$document=i,i}async update(e,t){let r=e.parseResult.value.$cstNode?.root.fullText,n=this.textDocuments?.get(e.uri.toString()),i=n?n.getText():await this.fileSystemProvider.readFile(e.uri);if(n)Object.defineProperty(e,"textDocument",{value:n});else{let a=this.createTextDocumentGetter(e.uri,i);Object.defineProperty(e,"textDocument",{get:a})}return r!==i&&(e.parseResult=await this.parseAsync(e.uri,i,t),e.parseResult.value.$document=e),e.state=Ln.Parsed,e}parse(e,t,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,r)}parseAsync(e,t,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,r)}createTextDocumentGetter(e,t){let r=this.serviceRegistry,n;return()=>n??(n=pN.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,t??""))}},IYe=class{static{_(this,"DefaultLangiumDocuments")}constructor(e){this.documentTrie=new xne,this.services=e,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.documentBuilder=()=>e.workspace.DocumentBuilder}get all(){return ki(this.documentTrie.all())}addDocument(e){let t=e.uri.toString();if(this.documentTrie.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentTrie.insert(t,e)}getDocument(e){let t=e.toString();return this.documentTrie.find(t)}getDocuments(e){let t=e.toString();return this.documentTrie.findAll(t)}async getOrCreateDocument(e,t){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(r),r)}createDocument(e,t,r){if(r)return this.langiumDocumentFactory.fromString(t,e,r).then(n=>(this.addDocument(n),n));{let n=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(n),n}}hasDocument(e){return this.documentTrie.has(e.toString())}invalidateDocument(e){let t=e.toString(),r=this.documentTrie.find(t);return r&&this.documentBuilder().resetToState(r,Ln.Changed),r}deleteDocument(e){let t=e.toString(),r=this.documentTrie.find(t);return r&&(r.state=Ln.Changed,this.documentTrie.delete(t)),r}deleteDocuments(e){let t=e.toString(),r=this.documentTrie.findAll(t);for(let n of r)n.state=Ln.Changed;return this.documentTrie.delete(t),r}},Rv=Symbol("RefResolving"),MYe=class{static{_(this,"DefaultLinker")}constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async link(e,t=Gi.CancellationToken.None){if(this.profiler?.isActive("linking")){let r=this.profiler.createTask("linking",this.languageId);r.start();try{for(let n of Nh(e.parseResult.value))await Us(t),Dw(n).forEach(i=>{let a=`${n.$type}:${i.property}`;r.startSubTask(a);try{this.doLink(i,e)}finally{r.stopSubTask(a)}})}finally{r.stop()}}else for(let r of Nh(e.parseResult.value))await Us(t),Dw(r).forEach(n=>this.doLink(n,e))}doLink(e,t){let r=e.reference;if("_ref"in r&&r._ref===void 0){r._ref=Rv;try{let n=this.getCandidate(e);if(Dv(n))r._ref=n;else{r._nodeDescription=n;let i=this.loadAstNode(n);r._ref=i??this.createLinkingError(e,n)}}catch(n){console.error(`An error occurred while resolving reference to '${r.$refText}':`,n);let i=n.message??String(n);r._ref={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${i}`}}t.references.push(r)}else if("_items"in r&&r._items===void 0){r._items=Rv;try{let n=this.getCandidates(e),i=[];if(Dv(n))r._linkingError=n;else for(let a of n){let s=this.loadAstNode(a);s&&i.push({ref:s,$nodeDescription:a})}r._items=i}catch(n){r._linkingError={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${n}`},r._items=[]}t.references.push(r)}}unlink(e){for(let t of e.references)"_ref"in t?(t._ref=void 0,delete t._nodeDescription):"_items"in t&&(t._items=void 0,delete t._linkingError);e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}getCandidates(e){let r=this.scopeProvider.getScope(e).getElements(e.reference.$refText).distinct(n=>`${n.documentUri}#${n.path}`).toArray();return r.length>0?r:this.createLinkingError(e)}buildReference(e,t,r,n){let i=this,a={$refNode:r,$refText:n,_ref:void 0,get ref(){if(ls(this._ref))return this._ref;if(nte(this._nodeDescription)){let s=i.loadAstNode(this._nodeDescription);this._ref=s??i.createLinkingError({reference:a,container:e,property:t},this._nodeDescription)}else if(this._ref===void 0){this._ref=Rv;let s=Aw(e).$document,o=i.getLinkedNode({reference:a,container:e,property:t});if(o.error&&s&&s.state0))return this._linkingError=i.createLinkingError({reference:a,container:e,property:t})}};return a}throwCyclicReferenceError(e,t,r){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`)}getLinkedNode(e){try{let t=this.getCandidate(e);if(Dv(t))return{error:t};let r=this.loadAstNode(t);return r?{node:r,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,t);let r=t.message??String(t);return{error:{info:e,message:`An error occurred while resolving reference to '${e.reference.$refText}': ${r}`}}}}loadAstNode(e){if(e.node)return e.node;let t=this.langiumDocuments().getDocument(e.documentUri);if(t)return this.astNodeLocator.getAstNode(t.parseResult.value,e.path)}createLinkingError(e,t){let r=Aw(e.container).$document;r&&r.statem2(t)&&t.isMulti)}findDeclarations(e){if(e){let t=Xte(e),r=e.astNode;if(t&&r){let n=r[t.feature];if(_l(n)||md(n))return NM(n);if(Array.isArray(n)){for(let i of n)if((_l(i)||md(i))&&i.$refNode&&i.$refNode.offset<=e.offset&&i.$refNode.end>=e.end)return NM(i)}}if(r){let n=this.nameProvider.getNameNode(r);if(n&&(n===e||Ate(e,n)))return this.getSelfNodes(r)}}return[]}getSelfNodes(e){if(this.hasMultiReference){let t=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)),r=this.getNodeFromReferenceDescription(t.head());if(r){for(let n of Dw(r))if(md(n.reference)&&n.reference.items.some(i=>i.ref===e))return n.reference.items.map(i=>i.ref)}return[e]}else return[e]}getNodeFromReferenceDescription(e){if(!e)return;let t=this.documents.getDocument(e.sourceUri);if(t)return this.nodeLocator.getAstNode(t.parseResult.value,e.sourcePath)}findDeclarationNodes(e){let t=this.findDeclarations(e),r=[];for(let n of t){let i=this.nameProvider.getNameNode(n)??n.$cstNode;i&&r.push(i)}return r}findReferences(e,t){let r=[];t.includeDeclaration&&r.push(...this.getSelfReferences(e));let n=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(n=n.filter(i=>Rl.equals(i.sourceUri,t.documentUri))),r.push(...n),ki(r)}getSelfReferences(e){let t=this.getSelfNodes(e),r=[];for(let n of t){let i=this.nameProvider.getNameNode(n);if(i){let a=Mh(n),s=this.nodeLocator.getAstNodePath(n);r.push({sourceUri:a.uri,sourcePath:s,targetUri:a.uri,targetPath:s,segment:Bw(i),local:!0})}}return r}},sp=class{static{_(this,"MultiMap")}constructor(e){if(this.map=new Map,e)for(let[t,r]of e)this.add(t,r)}get size(){return qS.sum(ki(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let r=this.map.get(e);if(r){let n=r.indexOf(t);if(n>=0)return r.length===1?this.map.delete(e):r.splice(n,1),!0}return!1}}get(e){return this.map.get(e)??[]}getStream(e){let t=this.map.get(e);return t?ki(t):Iw}has(e,t){if(t===void 0)return this.map.has(e);{let r=this.map.get(e);return r?r.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,r)=>t.forEach(n=>e(n,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ki(this.map.entries()).flatMap(([e,t])=>t.map(r=>[e,r]))}keys(){return ki(this.map.keys())}values(){return ki(this.map.values()).flat()}entriesGroupedByKey(){return ki(this.map.entries())}},gN=class{static{_(this,"BiMap")}get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[t,r]of e)this.set(t,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let t=this.map.get(e);return t!==void 0?(this.map.delete(e),this.inverse.delete(t),!0):!1}},OYe=class{static{_(this,"DefaultScopeComputation")}constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(e,t=Gi.CancellationToken.None){return this.collectExportedSymbolsForNode(e.parseResult.value,e,void 0,t)}async collectExportedSymbolsForNode(e,t,r=o6,n=Gi.CancellationToken.None){let i=[];this.addExportedSymbol(e,i,t);for(let a of r(e))await Us(n),this.addExportedSymbol(a,i,t);return i}addExportedSymbol(e,t,r){let n=this.nameProvider.getName(e);n&&t.push(this.descriptions.createDescription(e,n,r))}async collectLocalSymbols(e,t=Gi.CancellationToken.None){let r=e.parseResult.value,n=new sp;for(let i of op(r))await Us(t),this.addLocalSymbol(i,e,n);return n}addLocalSymbol(e,t,r){let n=e.$container;if(n){let i=this.nameProvider.getName(e);i&&r.add(n,this.descriptions.createDescription(e,i,t))}}},ZJ=class{static{_(this,"StreamScope")}constructor(e,t,r){this.elements=e,this.outerScope=t,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===t):this.elements.find(n=>n.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.filter(n=>n.name.toLowerCase()===t):this.elements.filter(n=>n.name===e);return(this.concatOuterScope||r.isEmpty())&&this.outerScope?r.concat(this.outerScope.getElements(e)):r}},YUt=class{static{_(this,"MapScope")}constructor(e,t,r){this.elements=new Map,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let n of e){let i=this.caseInsensitive?n.name.toLowerCase():n.name;this.elements.set(i,n)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t),n=r?[r]:[];return(this.concatOuterScope||n.length>0)&&this.outerScope?ki(n).concat(this.outerScope.getElements(e)):ki(n)}getAllElements(){let e=ki(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},PYe=class{static{_(this,"MultiMapScope")}constructor(e,t,r){this.elements=new sp,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let n of e){let i=this.caseInsensitive?n.name.toLowerCase():n.name;this.elements.add(i,n)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t)[0];if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);return(this.concatOuterScope||r.length===0)&&this.outerScope?ki(r).concat(this.outerScope.getElements(e)):ki(r)}getAllElements(){let e=ki(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},XUt={getElement(){},getElements(){return Iw},getAllElements(){return Iw}},SD=class{static{_(this,"DisposableCache")}constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},wne=class extends SD{static{_(this,"SimpleCache")}constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){let r=t();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},ED=class extends SD{static{_(this,"ContextCache")}constructor(e){super(),this.cache=new Map,this.converter=e??(t=>t)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,r){this.throwIfDisposed(),this.cacheForContext(e).set(t,r)}get(e,t,r){this.throwIfDisposed();let n=this.cacheForContext(e);if(n.has(t))return n.get(t);if(r){let i=r();return n.set(t,i),i}else return}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){let t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){let t=this.converter(e),r=this.cache.get(t);return r||(r=new Map,this.cache.set(t,r)),r}},BYe=class extends ED{static{_(this,"DocumentCache")}constructor(e,t){super(r=>r.toString()),t?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(t,r=>{this.clear(r.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,n)=>{for(let i of n)this.clear(i)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,n)=>{let i=r.concat(n);for(let a of i)this.clear(a)}))}},kne=class extends wne{static{_(this,"WorkspaceCache")}constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,n)=>{n.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}},FYe=class{static{_(this,"DefaultScopeProvider")}constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new kne(e.shared)}getScope(e){let t=[],r=this.reflection.getReferenceType(e),n=Mh(e.container).localSymbols;if(n){let a=e.container;do n.has(a)&&t.push(n.getStream(a).filter(s=>this.reflection.isSubtype(s.type,r))),a=a.$container;while(a)}let i=this.getGlobalScope(r,e);for(let a=t.length-1;a>=0;a--)i=this.createScope(t[a],i);return i}createScope(e,t,r){return new ZJ(ki(e),t,r)}createScopeForNodes(e,t,r){let n=ki(e).map(i=>{let a=this.nameProvider.getName(i);if(a)return this.descriptions.createDescription(i,a)}).nonNullable();return new ZJ(n,t,r)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new PYe(this.indexManager.allElements(e)))}};_(Tne,"isAstNodeWithComment");_(QJ,"isIntermediateReference");$Ye=class{static{_(this,"DefaultJsonSerializer")}constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,t){let r=t??{},n=t?.replacer,i=_((s,o)=>this.replacer(s,o,r),"defaultReplacer"),a=n?(s,o)=>n(s,o,i):i;try{return this.currentDocument=Mh(e),JSON.stringify(e,a,t?.space)}finally{this.currentDocument=void 0}}deserialize(e,t){let r=t??{},n=JSON.parse(e);return this.linkNode(n,n,r),n}replacer(e,t,{refText:r,sourceText:n,textRegions:i,comments:a,uriConverter:s}){if(!this.ignoreProperties.has(e))if(_l(t)){let o=t.ref,l=r?t.$refText:void 0;if(o){let u=Mh(o),h="";this.currentDocument&&this.currentDocument!==u&&(s?h=s(u.uri,o):h=u.uri.toString());let f=this.astNodeLocator.getAstNodePath(o);return{$ref:`${h}#${f}`,$refText:l}}else return{$error:t.error?.message??"Could not resolve reference",$refText:l}}else if(md(t)){let o=r?t.$refText:void 0,l=[];for(let u of t.items){let h=u.ref,f=Mh(u.ref),d="";this.currentDocument&&this.currentDocument!==f&&(s?d=s(f.uri,h):d=f.uri.toString());let p=this.astNodeLocator.getAstNodePath(h);l.push(`${d}#${p}`)}return{$refs:l,$refText:o}}else if(ls(t)){let o;if(i&&(o=this.addAstNodeRegionWithAssignmentsTo({...t}),(!e||t.$document)&&o?.$textRegion&&(o.$textRegion.documentURI=this.currentDocument?.uri.toString())),n&&!e&&(o??(o={...t}),o.$sourceText=t.$cstNode?.text),a){o??(o={...t});let l=this.commentProvider.getComment(t);l&&(o.$comment=l.replace(/\r/g,""))}return o??t}else return t}addAstNodeRegionWithAssignmentsTo(e){let t=_(r=>({offset:r.offset,end:r.end,length:r.length,range:r.range}),"createDocumentSegment");if(e.$cstNode){let r=e.$textRegion=t(e.$cstNode),n=r.assignments={};return Object.keys(e).filter(i=>!i.startsWith("$")).forEach(i=>{let a=Ute(e.$cstNode,i).map(t);a.length!==0&&(n[i]=a)}),e}}linkNode(e,t,r,n,i,a){for(let[o,l]of Object.entries(e))if(Array.isArray(l))for(let u=0;u{await this.handleException(()=>e.call(t,r,n,i),"An error occurred during validation",n,r)}}async handleException(e,t,r,n){try{await e()}catch(i){if(I2(i))throw i;console.error(`${t}:`,i),i instanceof Error&&i.stack&&console.error(i.stack);let a=i instanceof Error?i.message:String(i);r("error",`${t}: ${a}`,{node:n})}}addEntry(e,t){if(e==="AstNode"){this.entries.add("AstNode",t);return}for(let r of this.reflection.getAllSubTypes(e))this.entries.add(r,t)}getChecks(e,t){let r=ki(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(r=r.filter(n=>t.includes(n.category))),r.map(n=>n.check)}registerBeforeDocument(e,t=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",t))}registerAfterDocument(e,t=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",t))}wrapPreparationException(e,t,r){return async(n,i,a,s)=>{await this.handleException(()=>e.call(r,n,i,a,s),t,i,n)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(e){return this.knownCategories}},qYe=Object.freeze({validateNode:!0,validateChildren:!0}),VYe=class{static{_(this,"DefaultDocumentValidator")}constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async validateDocument(e,t={},r=Gi.CancellationToken.None){let n=e.parseResult,i=[];if(await Us(r),(!t.categories||t.categories.includes("built-in"))&&(this.processLexingErrors(n,i,t),t.stopAfterLexingErrors&&i.some(a=>a.data?.code===Gu.LexingError)||(this.processParsingErrors(n,i,t),t.stopAfterParsingErrors&&i.some(a=>a.data?.code===Gu.ParsingError))||(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some(a=>a.data?.code===Gu.LinkingError))))return i;try{i.push(...await this.validateAst(n.value,t,r))}catch(a){if(I2(a))throw a;console.error("An error occurred during validation:",a)}return await Us(r),i}processLexingErrors(e,t,r){let n=[...e.lexerErrors,...e.lexerReport?.diagnostics??[]];for(let i of n){let a=i.severity??"error",s={severity:BS(a),range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:Sne(a),source:this.getSource()};t.push(s)}}processParsingErrors(e,t,r){for(let n of e.parserErrors){let i;if(isNaN(n.token.startOffset)){if("previousToken"in n){let a=n.previousToken;if(isNaN(a.startOffset)){let s={line:0,character:0};i={start:s,end:s}}else{let s={line:a.endLine-1,character:a.endColumn};i={start:s,end:s}}}}else i=VS(n.token);if(i){let a={severity:BS("error"),range:i,message:n.message,data:n2(Gu.ParsingError),source:this.getSource()};t.push(a)}}}processLinkingErrors(e,t,r){for(let n of e.references){let i=n.error;if(i){let a={node:i.info.container,range:n.$refNode?.range,property:i.info.property,index:i.info.index,data:{code:Gu.LinkingError,containerType:i.info.container.$type,property:i.info.property,refText:i.info.reference.$refText}};t.push(this.toDiagnostic("error",i.message,a))}}}async validateAst(e,t,r=Gi.CancellationToken.None){let n=[],i=_((a,s,o)=>{n.push(this.toDiagnostic(a,s,o))},"acceptor");return await this.validateAstBefore(e,t,i,r),await this.validateAstNodes(e,t,i,r),await this.validateAstAfter(e,t,i,r),n}async validateAstBefore(e,t,r,n=Gi.CancellationToken.None){let i=this.validationRegistry.checksBefore;for(let a of i)await Us(n),await a(e,r,t.categories??[],n)}async validateAstNodes(e,t,r,n=Gi.CancellationToken.None){if(this.profiler?.isActive("validating")){let i=this.profiler.createTask("validating",this.languageId);i.start();try{let a=Nh(e).iterator();for(let s of a){i.startSubTask(s.$type);let o=this.validateSingleNodeOptions(s,t);if(o.validateNode)try{let l=this.validationRegistry.getChecks(s.$type,t.categories);for(let u of l)await u(s,r,n)}finally{i.stopSubTask(s.$type)}o.validateChildren||a.prune()}}finally{i.stop()}}else{let i=Nh(e).iterator();for(let a of i){await Us(n);let s=this.validateSingleNodeOptions(a,t);if(s.validateNode){let o=this.validationRegistry.getChecks(a.$type,t.categories);for(let l of o)await l(a,r,n)}s.validateChildren||i.prune()}}}validateSingleNodeOptions(e,t){return qYe}async validateAstAfter(e,t,r,n=Gi.CancellationToken.None){let i=this.validationRegistry.checksAfter;for(let a of i)await Us(n),await a(e,r,t.categories??[],n)}toDiagnostic(e,t,r){return{message:t,range:Cne(r),severity:BS(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};_(Cne,"getDiagnosticRange");_(BS,"toDiagnosticSeverity");_(Sne,"toDiagnosticData");(function(e){e.LexingError="lexing-error",e.LexingWarning="lexing-warning",e.LexingInfo="lexing-info",e.LexingHint="lexing-hint",e.ParsingError="parsing-error",e.LinkingError="linking-error"})(Gu||(Gu={}));WYe=class{static{_(this,"DefaultAstNodeDescriptionProvider")}constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,r){let n=r??Mh(e);t??(t=this.nameProvider.getName(e));let i=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${i} has no name.`);let a,s=_(()=>a??(a=Bw(this.nameProvider.getNameNode(e)??e.$cstNode)),"nameSegmentGetter");return{node:e,name:t,get nameSegment(){return s()},selectionSegment:Bw(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}},HYe=class{static{_(this,"DefaultReferenceDescriptionProvider")}constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Gi.CancellationToken.None){let r=[],n=e.parseResult.value;for(let i of Nh(n))await Us(t),Dw(i).forEach(a=>{a.reference.error||r.push(...this.createInfoDescriptions(a))});return r}createInfoDescriptions(e){let t=e.reference;if(t.error||!t.$refNode)return[];let r=[];_l(t)&&t.$nodeDescription?r=[t.$nodeDescription]:md(t)&&(r=t.items.map(o=>o.$nodeDescription).filter(o=>o!==void 0));let n=Mh(e.container).uri,i=this.nodeLocator.getAstNodePath(e.container),a=[],s=Bw(t.$refNode);for(let o of r)a.push({sourceUri:n,sourcePath:i,targetUri:o.documentUri,targetPath:o.path,segment:s,local:Rl.equals(o.documentUri,n)});return a}},UYe=class{static{_(this,"DefaultAstNodeLocator")}constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return t+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return t!==void 0?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((n,i)=>{if(!n||i.length===0)return n;let a=i.indexOf(this.indexSeparator);if(a>0){let s=i.substring(0,a),o=parseInt(i.substring(a+1));return n[s]?.[o]}return n[i]},e)}},AD={};wN(AD,Jee(qw(),1));YYe=class{static{_(this,"DefaultConfigurationProvider")}constructor(e){this._ready=new ap,this.onConfigurationSectionUpdateEmitter=new AD.Emitter,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){this.workspaceConfig=e.capabilities.workspace?.configuration??!1}async initialized(e){if(this.workspaceConfig){if(e.register){let t=this.serviceRegistry.all;e.register({section:t.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let t=this.serviceRegistry.all.map(n=>({section:this.toSectionName(n.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(t);t.forEach((n,i)=>{this.updateSectionConfiguration(n.section,r[i])})}}this._ready.resolve()}updateConfiguration(e){typeof e.settings!="object"||e.settings===null||Object.entries(e.settings).forEach(([t,r])=>{this.updateSectionConfiguration(t,r),this.onConfigurationSectionUpdateEmitter.fire({section:t,configuration:r})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;let r=this.toSectionName(e);if(this.settings[r])return this.settings[r][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}},WI=Jee(TOt(),1);(function(e){function t(r){return{dispose:_(async()=>await r(),"dispose")}}_(t,"create"),e.create=t})(s2||(s2={}));XYe=class{static{_(this,"DefaultDocumentBuilder")}constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new sp,this.documentPhaseListeners=new sp,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Ln.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.fileSystemProvider=e.workspace.FileSystemProvider,this.workspaceManager=()=>e.workspace.WorkspaceManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},r=Gi.CancellationToken.None){for(let n of e){let i=n.uri.toString();if(n.state===Ln.Validated){if(typeof t.validation=="boolean"&&t.validation)this.resetToState(n,Ln.IndexedReferences);else if(typeof t.validation=="object"){let a=this.findMissingValidationCategories(n,t);a.length>0&&(this.buildState.set(i,{completed:!1,options:{validation:{categories:a}},result:this.buildState.get(i)?.result}),n.state=Ln.IndexedReferences)}}else this.buildState.delete(i)}this.currentState=Ln.Changed,await this.emitUpdate(e.map(n=>n.uri),[]),await this.buildDocuments(e,t,r)}async update(e,t,r=Gi.CancellationToken.None){this.currentState=Ln.Changed;let n=[];for(let o of t){let l=this.langiumDocuments.deleteDocuments(o);for(let u of l)n.push(u.uri),this.cleanUpDeleted(u)}let i=(await Promise.all(e.map(o=>this.findChangedUris(o)))).flat();for(let o of i){let l=this.langiumDocuments.getDocument(o);l===void 0&&(l=this.langiumDocumentFactory.fromModel({$type:"INVALID"},o),l.state=Ln.Changed,this.langiumDocuments.addDocument(l)),this.resetToState(l,Ln.Changed)}let a=ki(i).concat(n).map(o=>o.toString()).toSet();this.langiumDocuments.all.filter(o=>!a.has(o.uri.toString())&&this.shouldRelink(o,a)).forEach(o=>this.resetToState(o,Ln.ComputedScopes)),await this.emitUpdate(i,n),await Us(r);let s=this.sortDocuments(this.langiumDocuments.all.filter(o=>o.state=1}findMissingValidationCategories(e,t){let r=this.buildState.get(e.uri.toString()),n=this.serviceRegistry.getServices(e.uri).validation.ValidationRegistry.getAllValidationCategories(e),i=r?.result?.validationChecks?new Set(r?.result?.validationChecks):r?.completed?n:new Set,a=t===void 0||t.validation===!0?n:typeof t.validation=="object"?t.validation.categories??n:[];return ki(a).filter(s=>!i.has(s)).toArray()}async findChangedUris(e){if(this.langiumDocuments.getDocument(e)??this.textDocuments?.get(e))return[e];try{let r=await this.fileSystemProvider.stat(e);if(r.isDirectory)return await this.workspaceManager().searchFolder(e);if(this.workspaceManager().shouldIncludeEntry(r))return[e]}catch{}return[]}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(r=>r(e,t)))}sortDocuments(e){let t=0,r=e.length-1;for(;t=0&&!this.hasTextDocument(e[r]);)r--;tr.error!==void 0)?!0:this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),s2.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}resetToState(e,t){switch(t){case Ln.Changed:case Ln.Parsed:this.indexManager.removeContent(e.uri);case Ln.IndexedContent:e.localSymbols=void 0;case Ln.ComputedScopes:this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e);case Ln.Linked:this.indexManager.removeReferences(e.uri);case Ln.IndexedReferences:e.diagnostics=void 0,this.buildState.delete(e.uri.toString());case Ln.Validated:}e.state>t&&(e.state=t)}cleanUpDeleted(e){this.buildState.delete(e.uri.toString()),this.indexManager.remove(e.uri),e.state=Ln.Changed}async buildDocuments(e,t,r){this.prepareBuild(e,t),await this.runCancelable(e,Ln.Parsed,r,a=>this.langiumDocumentFactory.update(a,r)),await this.runCancelable(e,Ln.IndexedContent,r,a=>this.indexManager.updateContent(a,r)),await this.runCancelable(e,Ln.ComputedScopes,r,async a=>{let s=this.serviceRegistry.getServices(a.uri).references.ScopeComputation;a.localSymbols=await s.collectLocalSymbols(a,r)});let n=e.filter(a=>this.shouldLink(a));await this.runCancelable(n,Ln.Linked,r,a=>this.serviceRegistry.getServices(a.uri).references.Linker.link(a,r)),await this.runCancelable(n,Ln.IndexedReferences,r,a=>this.indexManager.updateReferences(a,r));let i=e.filter(a=>this.shouldValidate(a)?!0:(this.markAsCompleted(a),!1));await this.runCancelable(i,Ln.Validated,r,async a=>{await this.validate(a,r),this.markAsCompleted(a)})}markAsCompleted(e){let t=this.buildState.get(e.uri.toString());t&&(t.completed=!0)}prepareBuild(e,t){for(let r of e){let n=r.uri.toString(),i=this.buildState.get(n);(!i||i.completed)&&this.buildState.set(n,{completed:!1,options:t,result:i?.result})}}async runCancelable(e,t,r,n){for(let a of e)a.statea.state===t);await this.notifyBuildPhase(i,t,r),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),s2.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),s2.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,r){let n;return t&&"path"in t?n=t:r=t,r??(r=Gi.CancellationToken.None),n?this.awaitDocumentState(e,n,r):this.awaitBuilderState(e,r)}awaitDocumentState(e,t,r){let n=this.langiumDocuments.getDocument(t);if(n){if(n.state>=e)return Promise.resolve(t);if(r.isCancellationRequested)return Promise.reject(pd);if(this.currentState>=e&&e>n.state)return Promise.reject(new WI.ResponseError(WI.LSPErrorCodes.RequestFailed,`Document state of ${t.toString()} is ${Ln[n.state]}, requiring ${Ln[e]}, but workspace state is already ${Ln[this.currentState]}. Returning undefined.`))}else return Promise.reject(new WI.ResponseError(WI.LSPErrorCodes.ServerCancelled,`No document found for URI: ${t.toString()}`));return new Promise((i,a)=>{let s=this.onDocumentPhase(e,l=>{Rl.equals(l.uri,t)&&(s.dispose(),o.dispose(),i(l.uri))}),o=r.onCancellationRequested(()=>{s.dispose(),o.dispose(),a(pd)})})}awaitBuilderState(e,t){return this.currentState>=e?Promise.resolve():t.isCancellationRequested?Promise.reject(pd):new Promise((r,n)=>{let i=this.onBuildPhase(e,()=>{i.dispose(),a.dispose(),r()}),a=t.onCancellationRequested(()=>{i.dispose(),a.dispose(),n(pd)})})}async notifyDocumentPhase(e,t,r){let i=this.documentPhaseListeners.get(t).slice();for(let a of i)try{await Us(r),await a(e,r)}catch(s){if(!I2(s))throw s}}async notifyBuildPhase(e,t,r){if(e.length===0)return;let i=this.buildPhaseListeners.get(t).slice();for(let a of i)await Us(r),await a(e,r)}shouldLink(e){return this.getBuildOptions(e).eagerLinking??!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,t){let r=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,n=this.getBuildOptions(e),i=typeof n.validation=="object"?{...n.validation}:{};i.categories=this.findMissingValidationCategories(e,n);let a=await r.validateDocument(e,i,t);e.diagnostics?e.diagnostics.push(...a):e.diagnostics=a;let s=this.buildState.get(e.uri.toString());s&&(s.result??(s.result={}),s.result.validationChecks?s.result.validationChecks=ki(s.result.validationChecks).concat(i.categories).distinct().toArray():s.result.validationChecks=[...i.categories])}getBuildOptions(e){return this.buildState.get(e.uri.toString())?.options??{}}},jYe=class{static{_(this,"DefaultIndexManager")}constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new ED,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){let r=Mh(e).uri,n=[];return this.referenceIndex.forEach(i=>{i.forEach(a=>{Rl.equals(a.targetUri,r)&&a.targetPath===t&&n.push(a)})}),ki(n)}allElements(e,t){let r=ki(this.symbolIndex.keys());return t&&(r=r.filter(n=>!t||t.has(n))),r.map(n=>this.getFileDescriptions(n,e)).flat()}getFileDescriptions(e,t){return t?this.symbolByTypeIndex.get(e,t,()=>(this.symbolIndex.get(e)??[]).filter(i=>this.astReflection.isSubtype(i.type,t))):this.symbolIndex.get(e)??[]}remove(e){this.removeContent(e),this.removeReferences(e)}removeContent(e){let t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t)}removeReferences(e){let t=e.toString();this.referenceIndex.delete(t)}async updateContent(e,t=Gi.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.collectExportedSymbols(e,t),i=e.uri.toString();this.symbolIndex.set(i,n),this.symbolByTypeIndex.clear(i)}async updateReferences(e,t=Gi.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),n)}isAffected(e,t){let r=this.referenceIndex.get(e.uri.toString());return r?r.some(n=>!n.local&&t.has(n.targetUri.toString())):!1}},KYe=class{static{_(this,"DefaultWorkspaceManager")}constructor(e){this.initialBuildOptions={},this._ready=new ap,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){this.folders=e.workspaceFolders??void 0}initialized(e){return this.mutex.write(t=>this.initializeWorkspace(this.folders??[],t))}async initializeWorkspace(e,t=Gi.CancellationToken.None){let r=await this.performStartup(e);await Us(t),await this.documentBuilder.build(r,this.initialBuildOptions,t)}async performStartup(e){let t=[],r=_(a=>{t.push(a),this.langiumDocuments.hasDocument(a.uri)||this.langiumDocuments.addDocument(a)},"collector");await this.loadAdditionalDocuments(e,r);let n=[];await Promise.all(e.map(a=>this.getRootFolder(a)).map(async a=>this.traverseFolder(a,n)));let i=ki(n).distinct(a=>a.toString()).filter(a=>!this.langiumDocuments.hasDocument(a));return await this.loadWorkspaceDocuments(i,r),this._ready.resolve(),t}async loadWorkspaceDocuments(e,t){await Promise.all(e.map(async r=>{let n=await this.langiumDocuments.getOrCreateDocument(r);t(n)}))}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Xc.parse(e.uri)}async traverseFolder(e,t){try{let r=await this.fileSystemProvider.readDirectory(e);await Promise.all(r.map(async n=>{this.shouldIncludeEntry(n)&&(n.isDirectory?await this.traverseFolder(n.uri,t):n.isFile&&t.push(n.uri))}))}catch(r){console.error("Failure to read directory content of "+e.toString(!0),r)}}async searchFolder(e){let t=[];return await this.traverseFolder(e,t),t}shouldIncludeEntry(e){let t=Rl.basename(e.uri);return t.startsWith(".")?!1:e.isDirectory?t!=="node_modules"&&t!=="out":e.isFile?this.serviceRegistry.hasServices(e.uri):!1}},ZYe=class{static{_(this,"DefaultLexerErrorMessageProvider")}buildUnexpectedCharactersMessage(e,t,r,n,i){return IJ.buildUnexpectedCharactersMessage(e,t,r,n,i)}buildUnableToPopLexerModeMessage(e){return IJ.buildUnableToPopLexerModeMessage(e)}},Ene={mode:"full"},Ane=class{static{_(this,"DefaultLexer")}constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let t=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t);let r=vN(t)?Object.values(t):t,n=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new Ll(r,{positionTracking:"full",skipValidations:n,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Ene){let r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:r.groups.hidden??[],report:this.tokenBuilder.flushLexingReport?.(e)}}toTokenTypeDictionary(e){if(vN(e))return e;let t=RD(e)?Object.values(e.modes).flat():e,r={};return t.forEach(n=>r[n.name]=n),r}};_(_D,"isTokenTypeArray");_(RD,"isIMultiModeLexerDefinition");_(vN,"isTokenTypeDictionary");a6();_(_ne,"parseJSDoc");_(Rne,"isJSDoc");_(Lne,"getLines");jPe=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,jUt=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;_(QYe,"tokenize");_(JYe,"buildInlineTokens");KUt=/\S/,ZUt=/\s*$/;_(xN,"skipWhitespace");_(eXe,"lastCharacter");_(tXe,"parseJSDocComment");_(rXe,"parseJSDocElement");_(nXe,"appendEmptyLine");_(Ine,"parseJSDocText");_(iXe,"parseJSDocInline");_(Mne,"parseJSDocTag");_(Nne,"parseJSDocLine");_(LD,"normalizeOptions");_(TM,"normalizeOption");KPe=class{static{_(this,"JSDocCommentImpl")}constructor(e,t){this.elements=e,this.range=t}getTag(e){return this.getAllTags().find(t=>t.name===e)}getTags(e){return this.getAllTags().filter(t=>t.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let t of this.elements)if(e.length===0)e=t.toString();else{let r=t.toString();e+=eee(e)+r}return e.trim()}toMarkdown(e){let t="";for(let r of this.elements)if(t.length===0)t=r.toMarkdown(e);else{let n=r.toMarkdown(e);t+=eee(t)+n}return t.trim()}},oQ=class{static{_(this,"JSDocTagImpl")}constructor(e,t,r,n){this.name=e,this.content=t,this.inline=r,this.range=n}toString(){let e=`@${this.name}`,t=this.content.toString();return this.content.inlines.length===1?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e} +${t}`),this.inline?`{${e}}`:e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let i=aXe(this.name,t,e??{});if(typeof i=="string")return i}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let n=`${r}@${this.name}${r}`;return this.content.inlines.length===1?n=`${n} \u2014 ${t}`:this.content.inlines.length>1&&(n=`${n} +${t}`),this.inline?`{${n}}`:n}};_(aXe,"renderInlineTag");_(sXe,"renderLinkDefault");JJ=class{static{_(this,"JSDocTextImpl")}constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;tr.range.start.line&&(e+=` `)}return e}toMarkdown(e){let t="";for(let r=0;rn.range.start.line&&(t+=` -`)}return t}},aXe=class{static{_(this,"JSDocLineImpl")}constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};_(QJ,"fillNewlines");sXe=class{static{_(this,"JSDocDocumentationProvider")}constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&Ane(t))return Ene(t).toMarkdown({renderLink:_((n,i)=>this.documentationLinkRenderer(e,n,i),"renderLink"),renderTag:_(n=>this.documentationTagRenderer(e,n),"renderTag")})}documentationLinkRenderer(e,t,r){let n=this.findNameInLocalSymbols(e,t)??this.findNameInGlobalScope(e,t);if(n&&n.nameSegment){let i=n.nameSegment.range.start.line+1,a=n.nameSegment.range.start.character+1,s=n.documentUri.with({fragment:`L${i},${a}`});return`[${r}](${s.toString()})`}else return}documentationTagRenderer(e,t){}findNameInLocalSymbols(e,t){let n=Mh(e).localSymbols;if(!n)return;let i=e;do{let s=n.getStream(i).find(o=>o.name===t);if(s)return s;i=i.$container}while(i)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(n=>n.name===t)}},oXe=class{static{_(this,"DefaultCommentProvider")}constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return wne(e)?e.$comment:Rte(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},lXe=class{static{_(this,"DefaultAsyncParser")}constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},XUt=class{static{_(this,"AbstractThreadedAsyncParser")}constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length{if(this.queue.length>0){let t=this.queue.shift();t&&(e.lock(),t.resolve(e))}}),this.workerPool.push(e)}}async parse(e,t){let r=await this.acquireParserWorker(t),n=new ap,i,a=t.onCancellationRequested(()=>{i=setTimeout(()=>{this.terminateWorker(r)},this.terminationDelay)});return r.parse(e).then(s=>{let o=this.hydrator.hydrate(s);n.resolve(o)}).catch(s=>{n.reject(s)}).finally(()=>{a.dispose(),clearTimeout(i)}),n.promise}terminateWorker(e){e.terminate();let t=this.workerPool.indexOf(e);t>=0&&this.workerPool.splice(t,1)}async acquireParserWorker(e){this.initializeWorkers();for(let r of this.workerPool)if(r.ready)return r.lock(),r;let t=new ap;return e.onCancellationRequested(()=>{let r=this.queue.indexOf(t);r>=0&&this.queue.splice(r,1),t.reject(pd)}),this.queue.push(t),t.promise}},jUt=class{static{_(this,"ParserWorker")}get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,r,n){this.onReadyEmitter=new AD.Emitter,this.deferred=new ap,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=n,t(i=>{let a=i;this.deferred.resolve(a),this.unlock()}),r(i=>{this.deferred.reject(i),this.unlock()})}terminate(){this.deferred.reject(pd),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw new Error("Parser worker is busy");return this._parsing=!0,this.deferred=new ap,this.sendMessage(e),this.deferred.promise}},cXe=class{static{_(this,"DefaultWorkspaceLock")}constructor(){this.previousTokenSource=new Gi.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=CD();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r=Gi.CancellationToken.None){let n=new ap,i={action:t,deferred:n,cancellationToken:r};return e.push(i),this.performNextOperation(),n.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:t,deferred:r,cancellationToken:n})=>{try{let i=await Promise.resolve().then(()=>t(n));r.resolve(i)}catch(i){I2(i)?r.resolve(void 0):r.reject(i)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}},uXe=class{static{_(this,"DefaultHydrator")}constructor(e){this.grammarElementIdMap=new gN,this.tokenTypeIdMap=new gN,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(t=>({...t,message:t.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let t=new Map,r=new Map;for(let n of Nh(e))t.set(n,{});if(e.$cstNode)for(let n of Pw(e.$cstNode))r.set(n,{});return{astNodes:t,cstNodes:r}}dehydrateAstNode(e,t){let r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(let[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){let a=[];r[n]=a;for(let s of i)ls(s)?a.push(this.dehydrateAstNode(s,t)):Al(s)?a.push(this.dehydrateReference(s,t)):a.push(s)}else ls(i)?r[n]=this.dehydrateAstNode(i,t):Al(i)?r[n]=this.dehydrateReference(i,t):i!==void 0&&(r[n]=i);return r}dehydrateReference(e,t){let r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=t.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,t){let r=t.cstNodes.get(e);return CN(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=t.astNodes.get(e.astNode),Z0(e)?r.content=e.content.map(n=>this.dehydrateCstNode(n,t)):f2(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){let t=e.value,r=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,r)}}createHydrationContext(e){let t=new Map,r=new Map;for(let i of Nh(e))t.set(i,{});let n;if(e.$cstNode)for(let i of Pw(e.$cstNode)){let a;"fullText"in i?(a=new ane(i.fullText),n=a):"content"in i?a=new xD:"tokenType"in i&&(a=this.hydrateCstLeafNode(i)),a&&(r.set(i,a),a.root=n)}return{astNodes:t,cstNodes:r}}hydrateAstNode(e,t){let r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=t.cstNodes.get(e.$cstNode));for(let[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){let a=[];r[n]=a;for(let s of i)ls(s)?a.push(this.setParent(this.hydrateAstNode(s,t),r)):Al(s)?a.push(this.hydrateReference(s,r,n,t)):a.push(s)}else ls(i)?r[n]=this.setParent(this.hydrateAstNode(i,t),r):Al(i)?r[n]=this.hydrateReference(i,r,n,t):i!==void 0&&(r[n]=i);return r}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,r,n){return this.linker.buildReference(t,r,n.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,r=0){let n=t.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(n.grammarSource=this.getGrammarElement(e.grammarSource)),n.astNode=t.astNodes.get(e.astNode),Z0(n))for(let i of e.content){let a=this.hydrateCstNode(i,t,r++);n.content.push(a)}return n}hydrateCstLeafNode(e){let t=this.getTokenType(e.tokenType),r=e.offset,n=e.length,i=e.startLine,a=e.startColumn,s=e.endLine,o=e.endColumn,l=e.hidden;return new hN(r,n,{start:{line:i,character:a},end:{line:s,character:o}},t,l)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(let t of Nh(this.grammar))SN(t)&&this.grammarElementIdMap.set(t,e++)}};_(Yn,"createDefaultCoreModule");_(Xn,"createDefaultSharedCoreModule");(function(e){e.merge=(t,r)=>Gw(Gw({},t),r)})(JJ||(JJ={}));_(an,"inject");hXe=Symbol("isProxy");_(Mne,"eagerLoad");_(Nne,"_inject");jPe=Symbol();_(eee,"_resolve");_(Gw,"_merge");tee={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]};(function(e){e.REGULAR="indentation-sensitive",e.IGNORE_INDENTATION="ignore-indentation"})(i2||(i2={}));fXe=class extends kD{static{_(this,"IndentationAwareTokenBuilder")}constructor(e=tee){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options={...tee,...e},this.indentTokenType=Rw({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=Rw({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(e,t){let r=super.buildTokens(e,t);if(!_D(r))throw new Error("Invalid tokens built by default builder");let{indentTokenName:n,dedentTokenName:i,whitespaceTokenName:a,ignoreIndentationDelimiters:s}=this.options,o,l,u,h=[];for(let f of r){for(let[d,p]of s)f.name===d?f.PUSH_MODE=i2.IGNORE_INDENTATION:f.name===p&&(f.POP_MODE=!0);f.name===i?o=f:f.name===n?l=f:f.name===a?u=f:h.push(f)}if(!o||!l||!u)throw new Error("Some indentation/whitespace tokens not found!");return s.length>0?{modes:{[i2.REGULAR]:[o,l,...h,u],[i2.IGNORE_INDENTATION]:[...h,u]},defaultMode:i2.REGULAR}:[o,l,u,...h]}flushLexingReport(e){return{...super.flushLexingReport(e),remainingDedents:this.flushRemainingDedents(e)}}isStartOfLine(e,t){return t===0||`\r -`.includes(e[t-1])}matchWhitespace(e,t,r,n){this.whitespaceRegExp.lastIndex=t;let i=this.whitespaceRegExp.exec(e);return{currIndentLevel:i?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:i}}createIndentationTokenInstance(e,t,r,n){let i=this.getLineNumber(t,n);return k6(e,r,n,n+r.length,i,i,1,r.length)}getLineNumber(e,t){return e.substring(0,t).split(/\r\n|\r|\n/).length}indentMatcher(e,t,r,n){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:s}=this.matchWhitespace(e,t,r,n);return i<=a?null:(this.indentationStack.push(i),s)}dedentMatcher(e,t,r,n){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:s}=this.matchWhitespace(e,t,r,n);if(i>=a)return null;let o=this.indentationStack.lastIndexOf(i);if(o===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${i} at offset: ${t}. Current indentation stack: ${this.indentationStack}`,offset:t,length:s?.[0]?.length??0,line:this.getLineNumber(e,t),column:1}),null;let l=this.indentationStack.length-o-1,u=e.substring(0,t).match(/[\r\n]+$/)?.[0].length??1;for(let h=0;h1;)t.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],t}},KUt=class extends Sne{static{_(this,"IndentationAwareLexer")}constructor(e){if(super(e),e.parser.TokenBuilder instanceof fXe)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,t=Cne){let r=super.tokenize(e),n=r.report;t?.mode==="full"&&r.tokens.push(...n.remainingDedents),n.remainingDedents=[];let{indentTokenType:i,dedentTokenType:a}=this.indentationTokenBuilder,s=i.tokenTypeIdx,o=a.tokenTypeIdx,l=[],u=r.tokens.length-1;for(let h=0;h=0&&l.push(r.tokens[u]),r.tokens=l,r}},Dne={};Hg(Dne,{AstUtils:()=>nte,BiMap:()=>gN,Cancellation:()=>Gi,ContextCache:()=>ED,CstUtils:()=>ete,DONE_RESULT:()=>El,Deferred:()=>ap,Disposable:()=>s2,DisposableCache:()=>SD,DocumentCache:()=>OYe,EMPTY_STREAM:()=>Iw,ErrorWithLocation:()=>MN,GrammarUtils:()=>Nte,MultiMap:()=>sp,OperationCancelled:()=>pd,Reduction:()=>qS,RegExpUtils:()=>Ote,SimpleCache:()=>xne,StreamImpl:()=>dd,TreeStreamImpl:()=>Mw,URI:()=>Xc,UriTrie:()=>yne,UriUtils:()=>_l,WorkspaceCache:()=>bne,assertCondition:()=>Dte,assertUnreachable:()=>Ug,delayNextTick:()=>TD,interruptAndCheck:()=>Us,isOperationCancelled:()=>I2,loadGrammarFromJson:()=>Ys,setInterruptionPeriod:()=>pne,startCancelableOperation:()=>CD,stream:()=>ki});wN(Dne,AD);dXe=class{static{_(this,"EmptyFileSystemProvider")}stat(e){throw new Error("No file system is available.")}statSync(e){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}},ti={fileSystemProvider:_(()=>new dXe,"fileSystemProvider")},ZUt={Grammar:_(()=>{},"Grammar"),LanguageMetaData:_(()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"}),"LanguageMetaData")},QUt={AstReflection:_(()=>new Cte,"AstReflection")};_(pXe,"createMinimalGrammarServices");_(Ys,"loadGrammarFromJson");wN(CBe,Dne);JUt=class{static{_(this,"DefaultLangiumProfiler")}constructor(e){this.activeCategories=new Set,this.allCategories=new Set(["validating","parsing","linking"]),this.activeCategories=e??new Set(this.allCategories),this.records=new sp}isActive(e){return this.activeCategories.has(e)}start(...e){e?e.forEach(t=>this.activeCategories.add(t)):this.activeCategories=new Set(this.allCategories)}stop(...e){e?e.forEach(t=>this.activeCategories.delete(t)):this.activeCategories.clear()}createTask(e,t){if(!this.isActive(e))throw new Error(`Category "${e}" is not active.`);return console.log(`Creating profiling task for '${e}.${t}'.`),new mXe(r=>this.records.add(e,this.dumpRecord(e,r)),t)}dumpRecord(e,t){console.info(`Task ${e}.${t.identifier} executed in ${t.duration.toFixed(2)}ms and ended at ${t.date.toISOString()}`);let r=[];for(let a of t.entries.keys()){let s=t.entries.get(a),o=s.reduce((l,u)=>l+u);r.push({name:`${t.identifier}.${a}`,count:s.length,duration:o})}let n=t.duration-r.map(a=>a.duration).reduce((a,s)=>a+s,0);r.push({name:t.identifier,count:1,duration:n}),r.sort((a,s)=>s.duration-a.duration);function i(a){return Math.round(100*a)/100}return _(i,"Round"),console.table(r.map(a=>({Element:a.name,Count:a.count,"Self %":i(100*a.duration/t.duration),"Time (ms)":i(a.duration)}))),t}getRecords(...e){return e.length===0?this.records.values():this.records.entries().filter(t=>e.some(r=>r===t[0])).flatMap(t=>t[1])}},mXe=class{static{_(this,"ProfilingTask")}constructor(e,t){this.stack=[],this.entries=new sp,this.addRecord=e,this.identifier=t}start(){if(this.startTime!==void 0)throw new Error(`Task "${this.identifier}" is already started.`);this.startTime=performance.now()}stop(){if(this.startTime===void 0)throw new Error(`Task "${this.identifier}" was not started.`);if(this.stack.length!==0)throw new Error(`Task "${this.identifier}" cannot be stopped before sub-task(s): ${this.stack.map(t=>t.id).join(", ")}.`);let e={identifier:this.identifier,date:new Date,duration:performance.now()-this.startTime,entries:this.entries};this.addRecord(e),this.startTime=void 0,this.entries.clear()}startSubTask(e){this.stack.push({id:e,start:performance.now(),content:0})}stopSubTask(e){let t=this.stack.pop();if(!t)throw new Error(`Task "${this.identifier}.${e}" was not started.`);if(t.id!==e)throw new Error(`Sub-Task "${t.id}" is not already stopped.`);let r=performance.now()-t.start;this.stack.at(-1)!==void 0&&(this.stack[this.stack.length-1].content+=r);let n=r-t.content;this.entries.add(e,n)}};(e=>{e.Terminals={ARROW_DIRECTION:/L|R|T|B/,ARROW_GROUP:/\{group\}/,ARROW_INTO:/<|>/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ARCH_ICON:/\([\w-:]+\)/,ARCH_TITLE:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[\w ]+)\]/}})(ree||(ree={}));(e=>{e.Terminals={DOMAIN_NAME:/complex|complicated|clear|chaotic|confusion/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(nee||(nee={}));(e=>{e.Terminals={EM_ID:/[_a-zA-Z][\w_]*/,EM_FID:/\d{1,3}/,EM_DATA_INLINE:/\{(.*)\}|"(.*)"|'(.*)'/,EM_DATA_BLOCK:/\{[\t ]*\r?\n(?:[\S\s]*?\r?\n)?\}(?:\r?\n|(?!\S))/,EM_ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,EM_ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,EM_TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,EM_WS:/\s+/,EM_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,EM_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,EM_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,EM_ML_COMMENT:/\/\*[\s\S]*?\*\//,EM_SL_COMMENT:/\/\/[^\n\r]*/}})(iee||(iee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,REFERENCE:/\w([-\./\w]*[-\w])?/}})(aee||(aee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(see||(see={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(oee||(oee={}));(e=>{e.Terminals={NUMBER_PIE:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(lee||(lee={}));(e=>{e.Terminals={GRATICULE:/circle|polygon/,BOOLEAN:/true|false/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NUMBER:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(cee||(cee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ABNF_RULENAME:/[A-Za-z][A-Za-z0-9-]*/,ABNF_STRING:/"[^"]*"/,ABNF_NUMVAL:/%[xXdDbB][0-9A-Fa-f]+(?:-[0-9A-Fa-f]+|\.[0-9A-Fa-f]+)*/,ABNF_REPEAT:/[0-9]*\*[0-9]*/,ABNF_EXACT_REPEAT:/[0-9]+/,ABNF_WHITESPACE:/[\t \r\n]+/,ABNF_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,ABNF_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,ABNF_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ABNF_COMMENT:/;[^\n\r]*/}})(uee||(uee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,EBNF_ID:/[A-Z_a-z][\w-]*/,EBNF_STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,EBNF_SPECIAL_SEQUENCE:/\?(?=[^?;]*[^?\s;][^?;]*\?)[^?;]*\?/,EBNF_WHITESPACE:/[\t \r\n]+/,EBNF_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,EBNF_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,EBNF_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,EBNF_BLOCK_COMMENT:/\/\*[\s\S]*?\*\//,EBNF_ISO_COMMENT:/\(\*[\s\S]*?\*\)/}})(hee||(hee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,RR_ID:/[A-Z_a-z][\w-]*/,RR_STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,RR_WHITESPACE:/[\t \r\n]+/,RR_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,RR_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,RR_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,RR_BLOCK_COMMENT:/\/\*[\s\S]*?\*\//}})(fee||(fee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,PEG_ID:/[A-Z_a-z][\w-]*/,PEG_STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,PEG_WHITESPACE:/[\t \r\n]+/,PEG_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,PEG_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,PEG_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,PEG_LINE_COMMENT:/#[^\n\r]*/}})(dee||(dee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,TREEMAP_KEYWORD:/treemap-beta|treemap/,CLASS_DEF:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,STYLE_SEPARATOR:/:::/,SEPARATOR:/:/,COMMA:/,/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,ID2:/[a-zA-Z_][a-zA-Z0-9_]*/,NUMBER2:/[0-9_\.\,]+/,STRING2:/"[^"]*"|'[^']*'/}})(pee||(pee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,CLASS_ANNOTATION:/[ \t]+:::[ \t]*[A-Za-z_][\w-]*/,ICON_ANNOTATION:/[ \t]+icon\([\w-]*(?::[\w-]+)?\)/,DESC_ANNOTATION:/[ \t]+##[^\n\r]*/,INDENTATION:/[ \t]{1,}/,QUOTED_NAME:/"[^"]*"|'[^']*'/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,BARE_NAME:/(?!:::|icon\(|##)[^ \t\n\r"'](?:(?![ \t]+:::[ \t]*[A-Za-z_]|[ \t]+icon\(|[ \t]+##)[^\n\r])*/}})(mee||(mee={}));(e=>{e.Terminals={WARDLEY_NUMBER:/[0-9]+\.[0-9]+/,ARROW:/->/,LINK_PORT:/\+<>|\+>|\+|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/,LINK_LABEL:/;[^\n\r]+/,STRATEGY:/build|buy|outsource|market/,KW_WARDLEY:/wardley-beta/,KW_SIZE:/size/,KW_EVOLUTION:/evolution/,KW_ANCHOR:/anchor/,KW_COMPONENT:/component/,KW_LABEL:/label/,KW_INERTIA:/inertia/,KW_EVOLVE:/evolve/,KW_PIPELINE:/pipeline/,KW_NOTE:/note/,KW_ANNOTATIONS:/annotations/,KW_ANNOTATION:/annotation/,KW_ACCELERATOR:/accelerator/,KW_DEACCELERATOR:/deaccelerator/,NAME_WITH_SPACES:/(?!title\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/,WS:/[ \t]+/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(gee||(gee={}));Njr={...ree.Terminals,...nee.Terminals,...iee.Terminals,...aee.Terminals,...see.Terminals,...oee.Terminals,...lee.Terminals,...cee.Terminals,...uee.Terminals,...hee.Terminals,...fee.Terminals,...dee.Terminals,...mee.Terminals,...pee.Terminals,...gee.Terminals},yee={$type:"AbnfAlternation",alternatives:"alternatives"},vee={$type:"AbnfConcatenation",elements:"elements"},CM={$type:"AbnfElement",primary:"primary",repeat:"repeat"},xee={$type:"AbnfGroup",element:"element"},bee={$type:"AbnfNumVal",value:"value"},wee={$type:"AbnfOptionalGroup",element:"element"},Lv={$type:"AbnfPrimary"},SM={$type:"AbnfRule",definition:"definition",name:"name"},kee={$type:"AbnfRuleName",name:"name"},Tee={$type:"AbnfStringLiteral",value:"value"},HI={$type:"Accelerator",name:"name",x:"x",y:"y"},sQ={$type:"Alignment",direction:"direction",members:"members"},UI={$type:"Anchor",evolution:"evolution",name:"name",visibility:"visibility"},sS={$type:"Annotation",number:"number",text:"text",x:"x",y:"y"},oQ={$type:"Annotations",x:"x",y:"y"},Rh={$type:"Architecture",accDescr:"accDescr",accTitle:"accTitle",alignments:"alignments",edges:"edges",groups:"groups",junctions:"junctions",services:"services",title:"title"};_(gXe,"isArchitecture");YI={$type:"Axis",label:"label",name:"name"},FS={$type:"Branch",name:"name",order:"order"};_(yXe,"isBranch");KPe={$type:"Checkout",branch:"branch"},XI={$type:"CherryPicking",id:"id",parent:"parent",tags:"tags"},lQ={$type:"ClassDefStatement",className:"className",styleText:"styleText"},Uv={$type:"Commit",id:"id",message:"message",tags:"tags",type:"type"};_(vXe,"isCommit");jI={$type:"Common",accDescr:"accDescr",accTitle:"accTitle",title:"title"},kv={$type:"Component",decorator:"decorator",evolution:"evolution",inertia:"inertia",label:"label",name:"name",visibility:"visibility"},KI={$type:"Curve",entries:"entries",label:"label",name:"name"},Bg={$type:"Cynefin",accDescr:"accDescr",accTitle:"accTitle",domains:"domains",title:"title",transitions:"transitions"};_(xXe,"isCynefin");ZI={$type:"Deaccelerator",name:"name",x:"x",y:"y"},ZPe={$type:"Decorator",strategy:"strategy"},sw={$type:"Direction",accDescr:"accDescr",accTitle:"accTitle",dir:"dir",statements:"statements",title:"title"},$S={$type:"DomainBlock",domain:"domain",items:"items"};_(bXe,"isDomainBlock");bN={$type:"DomainItem",label:"label"};_(wXe,"isDomainItem");Cee={$type:"EbnfChoice",alternatives:"alternatives"},See={$type:"EbnfExceptionPostfix",except:"except"},Eee={$type:"EbnfGroup",element:"element"},Aee={$type:"EbnfNonTerminal",name:"name"},_ee={$type:"EbnfOneOrMorePostfix",operator:"operator"},Ree={$type:"EbnfOptional",element:"element"},Lee={$type:"EbnfOptionalPostfix",operator:"operator"},pw={$type:"EbnfPostfix"},Rg={$type:"EbnfPrimary"},Iee={$type:"EbnfRepetition",element:"element"},EM={$type:"EbnfRule",definition:"definition",name:"name"},Mee={$type:"EbnfSequence",elements:"elements"},Nee={$type:"EbnfSpecial",text:"text"},AM={$type:"EbnfTerm",base:"base",postfixes:"postfixes"},Dee={$type:"EbnfTerminal",value:"value"},Oee={$type:"EbnfZeroOrMorePostfix",operator:"operator"},sd={$type:"Edge",lhsDir:"lhsDir",lhsGroup:"lhsGroup",lhsId:"lhsId",lhsInto:"lhsInto",rhsDir:"rhsDir",rhsGroup:"rhsGroup",rhsId:"rhsId",rhsInto:"rhsInto",title:"title"},Iv={$type:"EmDataEntity",dataBlockValue:"dataBlockValue",dataType:"dataType",name:"name"},Lg={$type:"EmFrame"},oS={$type:"EmGwt",givenStatements:"givenStatements",sourceFrame:"sourceFrame",thenStatements:"thenStatements",whenStatements:"whenStatements"},QPe={$type:"EmGwtStatement",entityIdentifier:"entityIdentifier"},cQ={$type:"EmModelEntity",name:"name"};_(kXe,"isEmModelEntityType");QI={$type:"EmNoteEntity",dataBlockValue:"dataBlockValue",dataType:"dataType",sourceFrame:"sourceFrame"},Y0={$type:"EmResetFrame",dataInlineValue:"dataInlineValue",dataReference:"dataReference",dataType:"dataType",entityIdentifier:"entityIdentifier",modelEntityType:"modelEntityType",name:"name",sourceFrames:"sourceFrames"};_(ID,"isEmResetFrame");_g={$type:"EmTimeFrame",dataInlineValue:"dataInlineValue",dataReference:"dataReference",dataType:"dataType",entityIdentifier:"entityIdentifier",modelEntityType:"modelEntityType",name:"name",sourceFrames:"sourceFrames"},uQ={$type:"Entry",axis:"axis",value:"value"},ld={$type:"EventModel",accDescr:"accDescr",accTitle:"accTitle",dataEntities:"dataEntities",frames:"frames",gwtEntities:"gwtEntities",modelEntities:"modelEntities",noteEntities:"noteEntities",title:"title"},JPe={$type:"Evolution",stages:"stages"},JI={$type:"EvolutionStage",boundary:"boundary",name:"name",secondName:"secondName"},hQ={$type:"Evolve",component:"component",target:"target"},Fg={$type:"GitGraph",accDescr:"accDescr",accTitle:"accTitle",statements:"statements",title:"title"};_(TXe,"isGitGraph");lS={$type:"Group",icon:"icon",id:"id",in:"in",title:"title"},Sw={$type:"Info",accDescr:"accDescr",accTitle:"accTitle",title:"title"};_(CXe,"isInfo");cS={$type:"Item",classSelector:"classSelector",name:"name"},fQ={$type:"Junction",id:"id",in:"in"},uS={$type:"Label",negX:"negX",negY:"negY",offsetX:"offsetX",offsetY:"offsetY"},eM={$type:"Leaf",classSelector:"classSelector",name:"name",value:"value"},Tv={$type:"Link",arrow:"arrow",from:"from",fromPort:"fromPort",linkLabel:"linkLabel",to:"to",toPort:"toPort"},Yv={$type:"Merge",branch:"branch",id:"id",tags:"tags",type:"type"};_(SXe,"isMerge");tM={$type:"Note",evolution:"evolution",text:"text",visibility:"visibility"},dQ={$type:"Option",name:"name",value:"value"},Xv={$type:"Packet",accDescr:"accDescr",accTitle:"accTitle",blocks:"blocks",title:"title"};_(EXe,"isPacket");jv={$type:"PacketBlock",bits:"bits",end:"end",label:"label",start:"start"};_(AXe,"isPacketBlock");Pee={$type:"PegAny",dot:"dot"},Bee={$type:"PegGroup",element:"element"},Fee={$type:"PegIdentifier",name:"name"},$ee={$type:"PegLiteral",value:"value"},zee={$type:"PegOrderedChoice",alternatives:"alternatives"},_M={$type:"PegPrefix",operator:"operator",suffix:"suffix"},mw={$type:"PegPrimary"},RM={$type:"PegRule",definition:"definition",name:"name"},Gee={$type:"PegSequence",elements:"elements"},LM={$type:"PegSuffix",operator:"operator",primary:"primary"},$g={$type:"Pie",accDescr:"accDescr",accTitle:"accTitle",sections:"sections",showData:"showData",title:"title"};_(_Xe,"isPie");zS={$type:"PieSection",label:"label",value:"value"};_(RXe,"isPieSection");pQ={$type:"Pipeline",components:"components",parent:"parent"},rM={$type:"PipelineComponent",evolution:"evolution",label:"label",name:"name"},Ig={$type:"Radar",accDescr:"accDescr",accTitle:"accTitle",axes:"axes",curves:"curves",options:"options",title:"title"},Kv={$type:"Railroad",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(LXe,"isRailroad");Zv={$type:"RailroadAbnf",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(IXe,"isRailroadAbnf");qee={$type:"RailroadChoiceExpr",alternatives:"alternatives"},Qv={$type:"RailroadEbnf",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(MXe,"isRailroadEbnf");cd={$type:"RailroadExpression"},Vee={$type:"RailroadNonTerminalExpr",name:"name"},Wee={$type:"RailroadOneOrMoreExpr",element:"element"},Hee={$type:"RailroadOptionalExpr",element:"element"},Jv={$type:"RailroadPeg",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(NXe,"isRailroadPeg");IM={$type:"RailroadRule",definition:"definition",name:"name"},Uee={$type:"RailroadSequenceExpr",elements:"elements"},Yee={$type:"RailroadSpecialExpr",text:"text"},Xee={$type:"RailroadTerminalExpr",value:"value"},jee={$type:"RailroadZeroOrMoreExpr",element:"element"},mQ={$type:"Section",classSelector:"classSelector",name:"name"},ow={$type:"Service",icon:"icon",iconText:"iconText",id:"id",in:"in",title:"title"},gQ={$type:"Size",height:"height",width:"width"},Mv={$type:"Statement"},Ew={$type:"Transition",from:"from",label:"label",to:"to"};_(DXe,"isTransition");e2={$type:"Treemap",accDescr:"accDescr",accTitle:"accTitle",title:"title",TreemapRows:"TreemapRows"};_(OXe,"isTreemap");yQ={$type:"TreemapRow",indent:"indent",item:"item"},Nv={$type:"TreeNode",classAnnotation:"classAnnotation",descAnnotation:"descAnnotation",iconAnnotation:"iconAnnotation",indent:"indent",name:"name"},gw={$type:"TreeView",accDescr:"accDescr",accTitle:"accTitle",nodes:"nodes",title:"title"},Ws={$type:"Wardley",accDescr:"accDescr",accelerators:"accelerators",accTitle:"accTitle",anchors:"anchors",annotation:"annotation",annotations:"annotations",components:"components",deaccelerators:"deaccelerators",evolution:"evolution",evolves:"evolves",links:"links",notes:"notes",pipelines:"pipelines",size:"size",title:"title"};_(PXe,"isWardley");BXe=class extends rte{constructor(){super(...arguments),this.types={AbnfAlternation:{name:yee.$type,properties:{alternatives:{name:yee.alternatives,defaultValue:[]}},superTypes:[]},AbnfConcatenation:{name:vee.$type,properties:{elements:{name:vee.elements,defaultValue:[]}},superTypes:[]},AbnfElement:{name:CM.$type,properties:{primary:{name:CM.primary},repeat:{name:CM.repeat}},superTypes:[]},AbnfGroup:{name:xee.$type,properties:{element:{name:xee.element}},superTypes:[Lv.$type]},AbnfNumVal:{name:bee.$type,properties:{value:{name:bee.value}},superTypes:[Lv.$type]},AbnfOptionalGroup:{name:wee.$type,properties:{element:{name:wee.element}},superTypes:[Lv.$type]},AbnfPrimary:{name:Lv.$type,properties:{},superTypes:[]},AbnfRule:{name:SM.$type,properties:{definition:{name:SM.definition},name:{name:SM.name}},superTypes:[]},AbnfRuleName:{name:kee.$type,properties:{name:{name:kee.name}},superTypes:[Lv.$type]},AbnfStringLiteral:{name:Tee.$type,properties:{value:{name:Tee.value}},superTypes:[Lv.$type]},Accelerator:{name:HI.$type,properties:{name:{name:HI.name},x:{name:HI.x},y:{name:HI.y}},superTypes:[]},Alignment:{name:sQ.$type,properties:{direction:{name:sQ.direction},members:{name:sQ.members,defaultValue:[]}},superTypes:[]},Anchor:{name:UI.$type,properties:{evolution:{name:UI.evolution},name:{name:UI.name},visibility:{name:UI.visibility}},superTypes:[]},Annotation:{name:sS.$type,properties:{number:{name:sS.number},text:{name:sS.text},x:{name:sS.x},y:{name:sS.y}},superTypes:[]},Annotations:{name:oQ.$type,properties:{x:{name:oQ.x},y:{name:oQ.y}},superTypes:[]},Architecture:{name:Rh.$type,properties:{accDescr:{name:Rh.accDescr},accTitle:{name:Rh.accTitle},alignments:{name:Rh.alignments,defaultValue:[]},edges:{name:Rh.edges,defaultValue:[]},groups:{name:Rh.groups,defaultValue:[]},junctions:{name:Rh.junctions,defaultValue:[]},services:{name:Rh.services,defaultValue:[]},title:{name:Rh.title}},superTypes:[]},Axis:{name:YI.$type,properties:{label:{name:YI.label},name:{name:YI.name}},superTypes:[]},Branch:{name:FS.$type,properties:{name:{name:FS.name},order:{name:FS.order}},superTypes:[Mv.$type]},Checkout:{name:KPe.$type,properties:{branch:{name:KPe.branch}},superTypes:[Mv.$type]},CherryPicking:{name:XI.$type,properties:{id:{name:XI.id},parent:{name:XI.parent},tags:{name:XI.tags,defaultValue:[]}},superTypes:[Mv.$type]},ClassDefStatement:{name:lQ.$type,properties:{className:{name:lQ.className},styleText:{name:lQ.styleText}},superTypes:[]},Commit:{name:Uv.$type,properties:{id:{name:Uv.id},message:{name:Uv.message},tags:{name:Uv.tags,defaultValue:[]},type:{name:Uv.type}},superTypes:[Mv.$type]},Common:{name:jI.$type,properties:{accDescr:{name:jI.accDescr},accTitle:{name:jI.accTitle},title:{name:jI.title}},superTypes:[]},Component:{name:kv.$type,properties:{decorator:{name:kv.decorator},evolution:{name:kv.evolution},inertia:{name:kv.inertia,defaultValue:!1},label:{name:kv.label},name:{name:kv.name},visibility:{name:kv.visibility}},superTypes:[]},Curve:{name:KI.$type,properties:{entries:{name:KI.entries,defaultValue:[]},label:{name:KI.label},name:{name:KI.name}},superTypes:[]},Cynefin:{name:Bg.$type,properties:{accDescr:{name:Bg.accDescr},accTitle:{name:Bg.accTitle},domains:{name:Bg.domains,defaultValue:[]},title:{name:Bg.title},transitions:{name:Bg.transitions,defaultValue:[]}},superTypes:[]},Deaccelerator:{name:ZI.$type,properties:{name:{name:ZI.name},x:{name:ZI.x},y:{name:ZI.y}},superTypes:[]},Decorator:{name:ZPe.$type,properties:{strategy:{name:ZPe.strategy}},superTypes:[]},Direction:{name:sw.$type,properties:{accDescr:{name:sw.accDescr},accTitle:{name:sw.accTitle},dir:{name:sw.dir},statements:{name:sw.statements,defaultValue:[]},title:{name:sw.title}},superTypes:[Fg.$type]},DomainBlock:{name:$S.$type,properties:{domain:{name:$S.domain},items:{name:$S.items,defaultValue:[]}},superTypes:[]},DomainItem:{name:bN.$type,properties:{label:{name:bN.label}},superTypes:[]},EbnfChoice:{name:Cee.$type,properties:{alternatives:{name:Cee.alternatives,defaultValue:[]}},superTypes:[]},EbnfExceptionPostfix:{name:See.$type,properties:{except:{name:See.except}},superTypes:[pw.$type]},EbnfGroup:{name:Eee.$type,properties:{element:{name:Eee.element}},superTypes:[Rg.$type]},EbnfNonTerminal:{name:Aee.$type,properties:{name:{name:Aee.name}},superTypes:[Rg.$type]},EbnfOneOrMorePostfix:{name:_ee.$type,properties:{operator:{name:_ee.operator}},superTypes:[pw.$type]},EbnfOptional:{name:Ree.$type,properties:{element:{name:Ree.element}},superTypes:[Rg.$type]},EbnfOptionalPostfix:{name:Lee.$type,properties:{operator:{name:Lee.operator}},superTypes:[pw.$type]},EbnfPostfix:{name:pw.$type,properties:{},superTypes:[]},EbnfPrimary:{name:Rg.$type,properties:{},superTypes:[]},EbnfRepetition:{name:Iee.$type,properties:{element:{name:Iee.element}},superTypes:[Rg.$type]},EbnfRule:{name:EM.$type,properties:{definition:{name:EM.definition},name:{name:EM.name}},superTypes:[]},EbnfSequence:{name:Mee.$type,properties:{elements:{name:Mee.elements,defaultValue:[]}},superTypes:[]},EbnfSpecial:{name:Nee.$type,properties:{text:{name:Nee.text}},superTypes:[Rg.$type]},EbnfTerm:{name:AM.$type,properties:{base:{name:AM.base},postfixes:{name:AM.postfixes,defaultValue:[]}},superTypes:[]},EbnfTerminal:{name:Dee.$type,properties:{value:{name:Dee.value}},superTypes:[Rg.$type]},EbnfZeroOrMorePostfix:{name:Oee.$type,properties:{operator:{name:Oee.operator}},superTypes:[pw.$type]},Edge:{name:sd.$type,properties:{lhsDir:{name:sd.lhsDir},lhsGroup:{name:sd.lhsGroup,defaultValue:!1},lhsId:{name:sd.lhsId},lhsInto:{name:sd.lhsInto,defaultValue:!1},rhsDir:{name:sd.rhsDir},rhsGroup:{name:sd.rhsGroup,defaultValue:!1},rhsId:{name:sd.rhsId},rhsInto:{name:sd.rhsInto,defaultValue:!1},title:{name:sd.title}},superTypes:[]},EmDataEntity:{name:Iv.$type,properties:{dataBlockValue:{name:Iv.dataBlockValue},dataType:{name:Iv.dataType},name:{name:Iv.name}},superTypes:[]},EmFrame:{name:Lg.$type,properties:{},superTypes:[]},EmGwt:{name:oS.$type,properties:{givenStatements:{name:oS.givenStatements,defaultValue:[]},sourceFrame:{name:oS.sourceFrame,referenceType:Lg.$type},thenStatements:{name:oS.thenStatements,defaultValue:[]},whenStatements:{name:oS.whenStatements,defaultValue:[]}},superTypes:[]},EmGwtStatement:{name:QPe.$type,properties:{entityIdentifier:{name:QPe.entityIdentifier,referenceType:cQ.$type}},superTypes:[]},EmModelEntity:{name:cQ.$type,properties:{name:{name:cQ.name}},superTypes:[]},EmNoteEntity:{name:QI.$type,properties:{dataBlockValue:{name:QI.dataBlockValue},dataType:{name:QI.dataType},sourceFrame:{name:QI.sourceFrame,referenceType:Lg.$type}},superTypes:[]},EmResetFrame:{name:Y0.$type,properties:{dataInlineValue:{name:Y0.dataInlineValue},dataReference:{name:Y0.dataReference,referenceType:Iv.$type},dataType:{name:Y0.dataType},entityIdentifier:{name:Y0.entityIdentifier},modelEntityType:{name:Y0.modelEntityType},name:{name:Y0.name},sourceFrames:{name:Y0.sourceFrames,defaultValue:[],referenceType:Lg.$type}},superTypes:[Lg.$type]},EmTimeFrame:{name:_g.$type,properties:{dataInlineValue:{name:_g.dataInlineValue},dataReference:{name:_g.dataReference,referenceType:Iv.$type},dataType:{name:_g.dataType},entityIdentifier:{name:_g.entityIdentifier},modelEntityType:{name:_g.modelEntityType},name:{name:_g.name},sourceFrames:{name:_g.sourceFrames,defaultValue:[],referenceType:Lg.$type}},superTypes:[Lg.$type]},Entry:{name:uQ.$type,properties:{axis:{name:uQ.axis,referenceType:YI.$type},value:{name:uQ.value}},superTypes:[]},EventModel:{name:ld.$type,properties:{accDescr:{name:ld.accDescr},accTitle:{name:ld.accTitle},dataEntities:{name:ld.dataEntities,defaultValue:[]},frames:{name:ld.frames,defaultValue:[]},gwtEntities:{name:ld.gwtEntities,defaultValue:[]},modelEntities:{name:ld.modelEntities,defaultValue:[]},noteEntities:{name:ld.noteEntities,defaultValue:[]},title:{name:ld.title}},superTypes:[]},Evolution:{name:JPe.$type,properties:{stages:{name:JPe.stages,defaultValue:[]}},superTypes:[]},EvolutionStage:{name:JI.$type,properties:{boundary:{name:JI.boundary},name:{name:JI.name},secondName:{name:JI.secondName}},superTypes:[]},Evolve:{name:hQ.$type,properties:{component:{name:hQ.component},target:{name:hQ.target}},superTypes:[]},GitGraph:{name:Fg.$type,properties:{accDescr:{name:Fg.accDescr},accTitle:{name:Fg.accTitle},statements:{name:Fg.statements,defaultValue:[]},title:{name:Fg.title}},superTypes:[]},Group:{name:lS.$type,properties:{icon:{name:lS.icon},id:{name:lS.id},in:{name:lS.in},title:{name:lS.title}},superTypes:[]},Info:{name:Sw.$type,properties:{accDescr:{name:Sw.accDescr},accTitle:{name:Sw.accTitle},title:{name:Sw.title}},superTypes:[]},Item:{name:cS.$type,properties:{classSelector:{name:cS.classSelector},name:{name:cS.name}},superTypes:[]},Junction:{name:fQ.$type,properties:{id:{name:fQ.id},in:{name:fQ.in}},superTypes:[]},Label:{name:uS.$type,properties:{negX:{name:uS.negX,defaultValue:!1},negY:{name:uS.negY,defaultValue:!1},offsetX:{name:uS.offsetX},offsetY:{name:uS.offsetY}},superTypes:[]},Leaf:{name:eM.$type,properties:{classSelector:{name:eM.classSelector},name:{name:eM.name},value:{name:eM.value}},superTypes:[cS.$type]},Link:{name:Tv.$type,properties:{arrow:{name:Tv.arrow},from:{name:Tv.from},fromPort:{name:Tv.fromPort},linkLabel:{name:Tv.linkLabel},to:{name:Tv.to},toPort:{name:Tv.toPort}},superTypes:[]},Merge:{name:Yv.$type,properties:{branch:{name:Yv.branch},id:{name:Yv.id},tags:{name:Yv.tags,defaultValue:[]},type:{name:Yv.type}},superTypes:[Mv.$type]},Note:{name:tM.$type,properties:{evolution:{name:tM.evolution},text:{name:tM.text},visibility:{name:tM.visibility}},superTypes:[]},Option:{name:dQ.$type,properties:{name:{name:dQ.name},value:{name:dQ.value,defaultValue:!1}},superTypes:[]},Packet:{name:Xv.$type,properties:{accDescr:{name:Xv.accDescr},accTitle:{name:Xv.accTitle},blocks:{name:Xv.blocks,defaultValue:[]},title:{name:Xv.title}},superTypes:[]},PacketBlock:{name:jv.$type,properties:{bits:{name:jv.bits},end:{name:jv.end},label:{name:jv.label},start:{name:jv.start}},superTypes:[]},PegAny:{name:Pee.$type,properties:{dot:{name:Pee.dot}},superTypes:[mw.$type]},PegGroup:{name:Bee.$type,properties:{element:{name:Bee.element}},superTypes:[mw.$type]},PegIdentifier:{name:Fee.$type,properties:{name:{name:Fee.name}},superTypes:[mw.$type]},PegLiteral:{name:$ee.$type,properties:{value:{name:$ee.value}},superTypes:[mw.$type]},PegOrderedChoice:{name:zee.$type,properties:{alternatives:{name:zee.alternatives,defaultValue:[]}},superTypes:[]},PegPrefix:{name:_M.$type,properties:{operator:{name:_M.operator},suffix:{name:_M.suffix}},superTypes:[]},PegPrimary:{name:mw.$type,properties:{},superTypes:[]},PegRule:{name:RM.$type,properties:{definition:{name:RM.definition},name:{name:RM.name}},superTypes:[]},PegSequence:{name:Gee.$type,properties:{elements:{name:Gee.elements,defaultValue:[]}},superTypes:[]},PegSuffix:{name:LM.$type,properties:{operator:{name:LM.operator},primary:{name:LM.primary}},superTypes:[]},Pie:{name:$g.$type,properties:{accDescr:{name:$g.accDescr},accTitle:{name:$g.accTitle},sections:{name:$g.sections,defaultValue:[]},showData:{name:$g.showData,defaultValue:!1},title:{name:$g.title}},superTypes:[]},PieSection:{name:zS.$type,properties:{label:{name:zS.label},value:{name:zS.value}},superTypes:[]},Pipeline:{name:pQ.$type,properties:{components:{name:pQ.components,defaultValue:[]},parent:{name:pQ.parent}},superTypes:[]},PipelineComponent:{name:rM.$type,properties:{evolution:{name:rM.evolution},label:{name:rM.label},name:{name:rM.name}},superTypes:[]},Radar:{name:Ig.$type,properties:{accDescr:{name:Ig.accDescr},accTitle:{name:Ig.accTitle},axes:{name:Ig.axes,defaultValue:[]},curves:{name:Ig.curves,defaultValue:[]},options:{name:Ig.options,defaultValue:[]},title:{name:Ig.title}},superTypes:[]},Railroad:{name:Kv.$type,properties:{accDescr:{name:Kv.accDescr},accTitle:{name:Kv.accTitle},rules:{name:Kv.rules,defaultValue:[]},title:{name:Kv.title}},superTypes:[]},RailroadAbnf:{name:Zv.$type,properties:{accDescr:{name:Zv.accDescr},accTitle:{name:Zv.accTitle},rules:{name:Zv.rules,defaultValue:[]},title:{name:Zv.title}},superTypes:[]},RailroadChoiceExpr:{name:qee.$type,properties:{alternatives:{name:qee.alternatives,defaultValue:[]}},superTypes:[cd.$type]},RailroadEbnf:{name:Qv.$type,properties:{accDescr:{name:Qv.accDescr},accTitle:{name:Qv.accTitle},rules:{name:Qv.rules,defaultValue:[]},title:{name:Qv.title}},superTypes:[]},RailroadExpression:{name:cd.$type,properties:{},superTypes:[]},RailroadNonTerminalExpr:{name:Vee.$type,properties:{name:{name:Vee.name}},superTypes:[cd.$type]},RailroadOneOrMoreExpr:{name:Wee.$type,properties:{element:{name:Wee.element}},superTypes:[cd.$type]},RailroadOptionalExpr:{name:Hee.$type,properties:{element:{name:Hee.element}},superTypes:[cd.$type]},RailroadPeg:{name:Jv.$type,properties:{accDescr:{name:Jv.accDescr},accTitle:{name:Jv.accTitle},rules:{name:Jv.rules,defaultValue:[]},title:{name:Jv.title}},superTypes:[]},RailroadRule:{name:IM.$type,properties:{definition:{name:IM.definition},name:{name:IM.name}},superTypes:[]},RailroadSequenceExpr:{name:Uee.$type,properties:{elements:{name:Uee.elements,defaultValue:[]}},superTypes:[cd.$type]},RailroadSpecialExpr:{name:Yee.$type,properties:{text:{name:Yee.text}},superTypes:[cd.$type]},RailroadTerminalExpr:{name:Xee.$type,properties:{value:{name:Xee.value}},superTypes:[cd.$type]},RailroadZeroOrMoreExpr:{name:jee.$type,properties:{element:{name:jee.element}},superTypes:[cd.$type]},Section:{name:mQ.$type,properties:{classSelector:{name:mQ.classSelector},name:{name:mQ.name}},superTypes:[cS.$type]},Service:{name:ow.$type,properties:{icon:{name:ow.icon},iconText:{name:ow.iconText},id:{name:ow.id},in:{name:ow.in},title:{name:ow.title}},superTypes:[]},Size:{name:gQ.$type,properties:{height:{name:gQ.height},width:{name:gQ.width}},superTypes:[]},Statement:{name:Mv.$type,properties:{},superTypes:[]},Transition:{name:Ew.$type,properties:{from:{name:Ew.from},label:{name:Ew.label},to:{name:Ew.to}},superTypes:[]},TreeNode:{name:Nv.$type,properties:{classAnnotation:{name:Nv.classAnnotation},descAnnotation:{name:Nv.descAnnotation},iconAnnotation:{name:Nv.iconAnnotation},indent:{name:Nv.indent},name:{name:Nv.name}},superTypes:[]},TreeView:{name:gw.$type,properties:{accDescr:{name:gw.accDescr},accTitle:{name:gw.accTitle},nodes:{name:gw.nodes,defaultValue:[]},title:{name:gw.title}},superTypes:[]},Treemap:{name:e2.$type,properties:{accDescr:{name:e2.accDescr},accTitle:{name:e2.accTitle},title:{name:e2.title},TreemapRows:{name:e2.TreemapRows,defaultValue:[]}},superTypes:[]},TreemapRow:{name:yQ.$type,properties:{indent:{name:yQ.indent},item:{name:yQ.item}},superTypes:[]},Wardley:{name:Ws.$type,properties:{accDescr:{name:Ws.accDescr},accelerators:{name:Ws.accelerators,defaultValue:[]},accTitle:{name:Ws.accTitle},anchors:{name:Ws.anchors,defaultValue:[]},annotation:{name:Ws.annotation,defaultValue:[]},annotations:{name:Ws.annotations,defaultValue:[]},components:{name:Ws.components,defaultValue:[]},deaccelerators:{name:Ws.deaccelerators,defaultValue:[]},evolution:{name:Ws.evolution},evolves:{name:Ws.evolves,defaultValue:[]},links:{name:Ws.links,defaultValue:[]},notes:{name:Ws.notes,defaultValue:[]},pipelines:{name:Ws.pipelines,defaultValue:[]},size:{name:Ws.size},title:{name:Ws.title}},superTypes:[]}}}static{_(this,"MermaidAstReflection")}},Wa=new BXe,eYt=_(()=>eBe??(eBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"alignments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Alignment","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"align"},{"$type":"Assignment","feature":"direction","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"row"},{"$type":"Keyword","value":"column"}]}},{"$type":"Assignment","feature":"members","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"members","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@20"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[(?:\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'|[\\\\w ]+)\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)),"ArchitectureGrammarGrammar"),tYt=_(()=>tBe??(tBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"CynefinGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Cynefin","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"cynefin-beta"},{"$type":"Keyword","value":"cynefin-beta:"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"domains","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"transitions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"DomainBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"domain","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"items","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"DomainItem","definition":{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Transition","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":"-->"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"DOMAIN_NAME","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"complex"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"complicated"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"clear"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"chaotic"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"confusion"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"CynefinGrammarGrammar"),rYt=_(()=>rBe??(rBe=Ys('{"$type":"Grammar","isDeclared":true,"name":"EventModeling","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","entry":true,"name":"EventModel","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"eventmodeling"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"frames","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"dataEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"noteEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"gwtEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntityType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rmo"},{"$type":"Keyword","value":"readmodel"},{"$type":"Keyword","value":"ui"},{"$type":"Keyword","value":"cmd"},{"$type":"Keyword","value":"command"},{"$type":"Keyword","value":"evt"},{"$type":"Keyword","value":"event"},{"$type":"Keyword","value":"pcr"},{"$type":"Keyword","value":"processor"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"json"},{"$type":"Keyword","value":"jsobj"},{"$type":"Keyword","value":"figma"},{"$type":"Keyword","value":"salt"},{"$type":"Keyword","value":"uri"},{"$type":"Keyword","value":"md"},{"$type":"Keyword","value":"html"},{"$type":"Keyword","value":"text"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataInline","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataInlineValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataBlock","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataBlockValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"QualifiedName","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"."},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmTimeFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"tf"},{"$type":"Keyword","value":"timeframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmResetFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rf"},{"$type":"Keyword","value":"resetframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmFrame","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"entity"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"data"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmNoteEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"note"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwt","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"gwt"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"given"},{"$type":"Assignment","feature":"givenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"},{"$type":"Group","elements":[{"$type":"Keyword","value":"when"},{"$type":"Assignment","feature":"whenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"},{"$type":"Keyword","value":"then"},{"$type":"Assignment","feature":"thenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwtStatement","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@9"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_EID","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_FI","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"EM_ID","definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_FID","definition":{"$type":"RegexToken","regex":"/\\\\d{1,3}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_INLINE","definition":{"$type":"RegexToken","regex":"/\\\\{(.*)\\\\}|\\"(.*)\\"|\'(.*)\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_BLOCK","definition":{"$type":"RegexToken","regex":"/\\\\{[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?\\\\}(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"EM_WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"imports":[],"types":[]}')),"EventModelingGrammar"),nYt=_(()=>nBe??(nBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)),"GitGraphGrammarGrammar"),iYt=_(()=>iBe??(iBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"InfoGrammarGrammar"),aYt=_(()=>aBe??(aBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"PacketGrammarGrammar"),sYt=_(()=>sBe??(sBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"PieGrammarGrammar"),oYt=_(()=>oBe??(oBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}`)),"RadarGrammarGrammar"),lYt=_(()=>lBe??(lBe=Ys('{"$type":"Grammar","isDeclared":true,"name":"RailroadAbnfGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_RULENAME","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Za-z][A-Za-z0-9-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_NUMVAL","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/%[xXdDbB][0-9A-Fa-f]+(?:-[0-9A-Fa-f]+|\\\\.[0-9A-Fa-f]+)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_REPEAT","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[0-9]*\\\\*[0-9]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_EXACT_REPEAT","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_COMMENT","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"RailroadAbnf","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-abnf-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Keyword","value":"="},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfAlternation","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfConcatenation","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"cardinality":"+"},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfElement","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"repeat","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"repeat","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"primary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfPrimary","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfStringLiteral","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfNumVal","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfRuleName","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfGroup","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfOptionalGroup","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"RailroadAbnf","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfAlternation","attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@3"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfConcatenation","attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@4"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfElement","attributes":[{"$type":"TypeAttribute","name":"repeat","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"primary","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfPrimary","attributes":[],"superTypes":[]},{"$type":"Interface","name":"AbnfStringLiteral","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"AbnfNumVal","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"AbnfRuleName","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"AbnfGroup","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"AbnfOptionalGroup","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]}],"imports":[],"types":[]}')),"RailroadAbnfGrammarGrammar"),cYt=_(()=>cBe??(cBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RailroadEbnfGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EBNF_ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Z_a-z][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EBNF_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EBNF_SPECIAL_SEQUENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\?(?=[^?;]*[^?\\\\s;][^?;]*\\\\?)[^?;]*\\\\?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_BLOCK_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_ISO_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\(\\\\*[\\\\s\\\\S]*?\\\\*\\\\)/","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"RailroadEbnf","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-ebnf-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"="},{"$type":"Keyword","value":"::="}]},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfChoice","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfSequence","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":",","cardinality":"?"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfTerm","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"base","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"postfixes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfPrimary","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfTerminal","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfNonTerminal","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfSpecial","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfGroup","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfOptional","returnType":{"$ref":"#/interfaces@11"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfRepetition","returnType":{"$ref":"#/interfaces@12"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfPostfix","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfOptionalPostfix","returnType":{"$ref":"#/interfaces@13"},"definition":{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"?"}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfZeroOrMorePostfix","returnType":{"$ref":"#/interfaces@14"},"definition":{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"*"}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfOneOrMorePostfix","returnType":{"$ref":"#/interfaces@15"},"definition":{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"+"}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfExceptionPostfix","returnType":{"$ref":"#/interfaces@16"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"except","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"RailroadEbnf","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfChoice","attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@3"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfSequence","attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@4"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfTerm","attributes":[{"$type":"TypeAttribute","name":"base","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false},{"$type":"TypeAttribute","name":"postfixes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@6"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfPrimary","attributes":[],"superTypes":[]},{"$type":"Interface","name":"EbnfPostfix","attributes":[],"superTypes":[]},{"$type":"Interface","name":"EbnfTerminal","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfNonTerminal","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfSpecial","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"text","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfGroup","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"EbnfOptional","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"EbnfRepetition","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"EbnfOptionalPostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"operator","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfZeroOrMorePostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"operator","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfOneOrMorePostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"operator","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfExceptionPostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"except","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false}]}],"imports":[],"types":[]}`)),"RailroadEbnfGrammarGrammar"),uYt=_(()=>uBe??(uBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RailroadGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"RR_ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Z_a-z][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"RR_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"RR_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_BLOCK_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"Railroad","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Keyword","value":"="},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadExpression","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadSequenceExpr","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"sequence"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadChoiceExpr","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"choice"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadOptionalExpr","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"optional"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadOneOrMoreExpr","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"oneOrMore"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadZeroOrMoreExpr","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"zeroOrMore"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadTerminalExpr","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"terminal"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadNonTerminalExpr","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"nonterminal"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadSpecialExpr","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"special"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"Railroad","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"RailroadRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"RailroadExpression","attributes":[],"superTypes":[]},{"$type":"Interface","name":"RailroadSequenceExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}}},"isOptional":false}]},{"$type":"Interface","name":"RailroadChoiceExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}}},"isOptional":false}]},{"$type":"Interface","name":"RailroadOptionalExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"RailroadOneOrMoreExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"RailroadZeroOrMoreExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"RailroadTerminalExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"RailroadNonTerminalExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"RailroadSpecialExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"text","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]}],"imports":[],"types":[]}`)),"RailroadGrammarGrammar"),hYt=_(()=>hBe??(hBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RailroadPegGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PEG_ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Z_a-z][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PEG_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/#[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"RailroadPeg","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-peg-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Keyword","value":"<-"},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegOrderedChoice","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegSequence","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"+"},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegPrefix","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"&"}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"!"}}],"cardinality":"?"},{"$type":"Assignment","feature":"suffix","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegSuffix","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"primary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"?"}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"*"}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"+"}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegPrimary","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegLiteral","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegIdentifier","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegGroup","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegAny","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Assignment","feature":"dot","operator":"=","terminal":{"$type":"Keyword","value":"."}},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"RailroadPeg","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegOrderedChoice","attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@3"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegSequence","attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@4"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegPrefix","attributes":[{"$type":"TypeAttribute","name":"operator","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"suffix","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegSuffix","attributes":[{"$type":"TypeAttribute","name":"primary","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@6"}},"isOptional":false},{"$type":"TypeAttribute","name":"operator","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"PegPrimary","attributes":[],"superTypes":[]},{"$type":"Interface","name":"PegLiteral","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"PegIdentifier","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"PegGroup","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"PegAny","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"dot","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]}],"imports":[],"types":[]}`)),"RailroadPegGrammarGrammar"),fYt=_(()=>fBe??(fBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)),"TreemapGrammarGrammar"),dYt=_(()=>dBe??(dBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"TreeViewGrammar","rules":[{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"TreeView","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"treeView-beta"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"nodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"CLASS_ANNOTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+:::[ \\\\t]*[A-Za-z_][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ICON_ANNOTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+icon\\\\([\\\\w-]*(?::[\\\\w-]+)?\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DESC_ANNOTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+##[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"QUOTED_NAME","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"BARE_NAME","definition":{"$type":"RegexToken","regex":"/(?!:::|icon\\\\(|##)[^ \\\\t\\\\n\\\\r\\"'](?:(?![ \\\\t]+:::[ \\\\t]*[A-Za-z_]|[ \\\\t]+icon\\\\(|[ \\\\t]+##)[^\\\\n\\\\r])*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TreeNode","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"classAnnotation","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"iconAnnotation","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"descAnnotation","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"TreeView","attributes":[{"$type":"TypeAttribute","name":"nodes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@14"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * TreeView grammar for Langium\\n *\\n * Supports both quoted labels (\\"my file\\") and bare labels (index.js).\\n * Annotations (:::class, icon(), ## description) are parsed directly into\\n * AST fields by the grammar. Value conversion for stripping quotes, extracting\\n * class names, icon names, and description text happens in valueConverter.ts.\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treeView keyword, allowing for empty lines and comments before the\\n * treeView declaration.\\n */"}`)),"TreeViewGrammarGrammar"),pYt=_(()=>pBe??(pBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"WardleyGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Wardley","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"size","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"anchors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"links","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"evolves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"pipelines","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"notes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"annotations","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"annotation","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"deaccelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Size","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"width","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"height","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolution","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EvolutionStage","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"boundary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"secondName","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Anchor","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Component","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"decorator","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Keyword","value":")"}]}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Label","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"negX","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetX","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"negY","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetY","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Decorator","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"strategy","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Link","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"fromPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"arrow","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"cardinality":"?"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"toPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"linkLabel","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolve","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Assignment","feature":"component","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Pipeline","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PipelineComponent","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Note","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotations","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotation","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"Assignment","feature":"number","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CoordinateValue","dataType":"number","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Accelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Deaccelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"WARDLEY_NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"->"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_PORT","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<>"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+>"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_ARROW","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-->"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-.->"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":">"},"parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'<>/","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'/","parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_LABEL","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRATEGY","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"build"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"buy"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"outsource"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"market"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_WARDLEY","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"wardley-beta"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_SIZE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"size"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLUTION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolution"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANCHOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"anchor"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_COMPONENT","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"component"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_LABEL","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"label"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_INERTIA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"inertia"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLVE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolve"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_PIPELINE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"pipeline"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_NOTE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"note"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATIONS","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotations"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotation"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"accelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_DEACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"deaccelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NAME_WITH_SPACES","definition":{"$type":"RegexToken","regex":"/(?!title\\\\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \\\\t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@47"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@48"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"WardleyGrammarGrammar"),mYt={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},gYt={languageId:"cynefin",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},yYt={languageId:"eventmodeling",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},vYt={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},xYt={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},bYt={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},wYt={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},kYt={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},TYt={languageId:"railroadAbnf",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},CYt={languageId:"railroadEbnf",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},SYt={languageId:"railroad",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},EYt={languageId:"railroadPeg",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},AYt={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},_Yt={languageId:"treeView",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},RYt={languageId:"wardley",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},pi={AstReflection:_(()=>new BXe,"AstReflection")},One={Grammar:_(()=>eYt(),"Grammar"),LanguageMetaData:_(()=>mYt,"LanguageMetaData"),parser:{}},Pne={Grammar:_(()=>tYt(),"Grammar"),LanguageMetaData:_(()=>gYt,"LanguageMetaData"),parser:{}},Bne={Grammar:_(()=>rYt(),"Grammar"),LanguageMetaData:_(()=>yYt,"LanguageMetaData"),parser:{}},Fne={Grammar:_(()=>nYt(),"Grammar"),LanguageMetaData:_(()=>vYt,"LanguageMetaData"),parser:{}},$ne={Grammar:_(()=>iYt(),"Grammar"),LanguageMetaData:_(()=>xYt,"LanguageMetaData"),parser:{}},zne={Grammar:_(()=>aYt(),"Grammar"),LanguageMetaData:_(()=>bYt,"LanguageMetaData"),parser:{}},Gne={Grammar:_(()=>sYt(),"Grammar"),LanguageMetaData:_(()=>wYt,"LanguageMetaData"),parser:{}},qne={Grammar:_(()=>oYt(),"Grammar"),LanguageMetaData:_(()=>kYt,"LanguageMetaData"),parser:{}},Vne={Grammar:_(()=>lYt(),"Grammar"),LanguageMetaData:_(()=>TYt,"LanguageMetaData"),parser:{}},Wne={Grammar:_(()=>cYt(),"Grammar"),LanguageMetaData:_(()=>CYt,"LanguageMetaData"),parser:{}},Hne={Grammar:_(()=>uYt(),"Grammar"),LanguageMetaData:_(()=>SYt,"LanguageMetaData"),parser:{}},Une={Grammar:_(()=>hYt(),"Grammar"),LanguageMetaData:_(()=>EYt,"LanguageMetaData"),parser:{}},Yne={Grammar:_(()=>fYt(),"Grammar"),LanguageMetaData:_(()=>AYt,"LanguageMetaData"),parser:{}},Xne={Grammar:_(()=>dYt(),"Grammar"),LanguageMetaData:_(()=>_Yt,"LanguageMetaData"),parser:{}},jne={Grammar:_(()=>pYt(),"Grammar"),LanguageMetaData:_(()=>RYt,"LanguageMetaData"),parser:{}},LYt=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,IYt=/accTitle[\t ]*:([^\n\r]*)/,MYt=/title([\t ][^\n\r]*|)/,NYt={ACC_DESCR:LYt,ACC_TITLE:IYt,TITLE:MYt},cs=class extends dne{static{_(this,"AbstractMermaidValueConverter")}runConverter(e,t,r){let n=this.runCommonConverter(e,t,r);return n===void 0&&(n=this.runCustomConverter(e,t,r)),n===void 0?super.runConverter(e,t,r):n}runCommonConverter(e,t,r){let n=NYt[e.name];if(n===void 0)return;let i=n.exec(t);if(i!==null){if(i[1]!==void 0)return i[1].trim().replace(/[\t ]{2,}/gm," ");if(i[2]!==void 0)return i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,` -`)}}},eu=class extends cs{static{_(this,"CommonValueConverter")}runCustomConverter(e,t,r){}},xi=class extends kD{static{_(this,"AbstractMermaidTokenBuilder")}constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,r){let n=super.buildKeywordTokens(e,t,r);return n.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}},DYt=class extends xi{static{_(this,"CommonTokenBuilder")}};});function ND(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),qne,MD);return t.ServiceRegistry.register(r),{shared:t,Radar:r}}var OYt,MD,Kne=W(()=>{ri();OYt=class extends xi{static{_(this,"RadarTokenBuilder")}constructor(){super(["radar-beta"])}},MD={parser:{TokenBuilder:_(()=>new OYt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(ND,"createRadarServices")});function Qw(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Hne,DD);return t.ServiceRegistry.register(r),{shared:t,Railroad:r}}var PYt,FXe,BYt,DD,Zne=W(()=>{ri();PYt=class extends xi{static{_(this,"RailroadTokenBuilder")}constructor(){super(["railroad-beta"])}},FXe=_(e=>{let t=e.slice(1,-1),r="";for(let n=0;nnew PYt,"TokenBuilder"),ValueConverter:_(()=>new BYt,"ValueConverter")}};_(Qw,"createRailroadServices")});function Jw(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Wne,OD);return t.ServiceRegistry.register(r),{shared:t,RailroadEbnf:r}}var FYt,$Xe,$Yt,OD,Qne=W(()=>{ri();FYt=class extends xi{static{_(this,"RailroadEbnfTokenBuilder")}constructor(){super(["railroad-ebnf-beta"])}},$Xe=_(e=>{let t=e.slice(1,-1),r="";for(let n=0;nnew FYt,"TokenBuilder"),ValueConverter:_(()=>new $Yt,"ValueConverter")}};_(Jw,"createRailroadEbnfServices")});function ek(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Vne,PD);return t.ServiceRegistry.register(r),{shared:t,RailroadAbnf:r}}var zYt,GYt,PD,Jne=W(()=>{ri();zYt=class extends xi{static{_(this,"RailroadAbnfTokenBuilder")}constructor(){super(["railroad-abnf-beta"])}},GYt=class extends cs{static{_(this,"RailroadAbnfValueConverter")}runConverter(e,t,r){let n=super.runConverter(e,t,r);if(e.name==="TITLE"&&typeof n=="string"){let i=n.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1)}return n}runCustomConverter(e,t,r){if(e.name==="ABNF_STRING")return t.slice(1,-1)}},PD={parser:{TokenBuilder:_(()=>new zYt,"TokenBuilder"),ValueConverter:_(()=>new GYt,"ValueConverter")}};_(ek,"createRailroadAbnfServices")});function tk(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Une,BD);return t.ServiceRegistry.register(r),{shared:t,RailroadPeg:r}}var qYt,zXe,VYt,BD,eie=W(()=>{ri();qYt=class extends xi{static{_(this,"RailroadPegTokenBuilder")}constructor(){super(["railroad-peg-beta"])}},zXe=_(e=>{let t=e.slice(1,-1),r="";for(let n=0;nnew qYt,"TokenBuilder"),ValueConverter:_(()=>new VYt,"ValueConverter")}};_(tk,"createRailroadPegServices")});function GXe(e){let t=e.validation.TreemapValidator,r=e.validation.ValidationRegistry;if(r){let n={Treemap:t.checkSingleRoot.bind(t)};r.register(n,t)}}function $D(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Yne,FD);return t.ServiceRegistry.register(r),GXe(r),{shared:t,Treemap:r}}var WYt,HYt,UYt,YYt,FD,tie=W(()=>{ri();WYt=class extends xi{static{_(this,"TreemapTokenBuilder")}constructor(){super(["treemap"])}},HYt=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,UYt=class extends cs{static{_(this,"TreemapValueConverter")}runCustomConverter(e,t,r){if(e.name==="NUMBER2")return parseFloat(t.replace(/,/g,""));if(e.name==="SEPARATOR")return t.substring(1,t.length-1);if(e.name==="STRING2")return t.substring(1,t.length-1);if(e.name==="INDENTATION")return t.length;if(e.name==="ClassDef"){if(typeof t!="string")return t;let n=HYt.exec(t);if(n)return{$type:"ClassDefStatement",className:n[1],styleText:n[2]||void 0}}}};_(GXe,"registerValidationChecks");YYt=class{static{_(this,"TreemapValidator")}checkSingleRoot(e,t){let r;for(let n of e.TreemapRows)n.item&&(r===void 0&&n.indent===void 0?r=0:n.indent===void 0?t("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}):r!==void 0&&r>=parseInt(n.indent,10)&&t("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}))}},FD={parser:{TokenBuilder:_(()=>new WYt,"TokenBuilder"),ValueConverter:_(()=>new UYt,"ValueConverter")},validation:{TreemapValidator:_(()=>new YYt,"TreemapValidator")}};_($D,"createTreemapServices")});function GD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),jne,zD);return t.ServiceRegistry.register(r),{shared:t,Wardley:r}}var XYt,zD,rie=W(()=>{ri();XYt=class extends cs{static{_(this,"WardleyValueConverter")}runCustomConverter(e,t,r){if(e.name.toUpperCase()==="LINK_LABEL")return t.substring(1).trim()}},zD={parser:{ValueConverter:_(()=>new XYt,"ValueConverter")}};_(GD,"createWardleyServices")});function VD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Pne,qD);return t.ServiceRegistry.register(r),{shared:t,Cynefin:r}}var jYt,qD,nie=W(()=>{ri();jYt=class extends xi{static{_(this,"CynefinTokenBuilder")}constructor(){super(["cynefin-beta"])}},qD={parser:{TokenBuilder:_(()=>new jYt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(VD,"createCynefinServices")});function HD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Fne,WD);return t.ServiceRegistry.register(r),{shared:t,GitGraph:r}}var KYt,WD,iie=W(()=>{ri();KYt=class extends xi{static{_(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},WD={parser:{TokenBuilder:_(()=>new KYt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(HD,"createGitGraphServices")});function YD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),$ne,UD);return t.ServiceRegistry.register(r),{shared:t,Info:r}}var ZYt,UD,aie=W(()=>{ri();ZYt=class extends xi{static{_(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},UD={parser:{TokenBuilder:_(()=>new ZYt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(YD,"createInfoServices")});function jD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),zne,XD);return t.ServiceRegistry.register(r),{shared:t,Packet:r}}var QYt,XD,sie=W(()=>{ri();QYt=class extends xi{static{_(this,"PacketTokenBuilder")}constructor(){super(["packet"])}},XD={parser:{TokenBuilder:_(()=>new QYt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(jD,"createPacketServices")});function ZD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Gne,KD);return t.ServiceRegistry.register(r),{shared:t,Pie:r}}var JYt,eXt,KD,oie=W(()=>{ri();JYt=class extends xi{static{_(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},eXt=class extends cs{static{_(this,"PieValueConverter")}runCustomConverter(e,t,r){if(e.name==="PIE_SECTION_LABEL")return t.replace(/"/g,"").trim()}},KD={parser:{TokenBuilder:_(()=>new JYt,"TokenBuilder"),ValueConverter:_(()=>new eXt,"ValueConverter")}};_(ZD,"createPieServices")});function JD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Xne,QD);return t.ServiceRegistry.register(r),{shared:t,TreeView:r}}var tXt,rXt,QD,lie=W(()=>{ri();tXt=class extends cs{static{_(this,"TreeViewValueConverter")}runCustomConverter(e,t,r){if(e.name==="INDENTATION")return t?.length||0;if(e.name==="QUOTED_NAME")return t.substring(1,t.length-1);if(e.name==="BARE_NAME")return t.replace(/[\t ]+$/,"");if(e.name==="CLASS_ANNOTATION")return t.trim().substring(3).trim();if(e.name==="ICON_ANNOTATION"){let n=t.trim();return n.substring(5,n.length-1)}if(e.name==="DESC_ANNOTATION")return t.trim().substring(2).trim()}},rXt=class extends xi{static{_(this,"TreeViewTokenBuilder")}constructor(){super(["treeView-beta"])}},QD={parser:{TokenBuilder:_(()=>new rXt,"TokenBuilder"),ValueConverter:_(()=>new tXt,"ValueConverter")}};_(JD,"createTreeViewServices")});function tO(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),One,eO);return t.ServiceRegistry.register(r),{shared:t,Architecture:r}}var nXt,iXt,eO,cie=W(()=>{ri();nXt=class extends xi{static{_(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},iXt=class extends cs{static{_(this,"ArchitectureValueConverter")}runCustomConverter(e,t,r){if(e.name==="ARCH_ICON")return t.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return t.replace(/["()]/g,"");if(e.name==="ARCH_TITLE"){let n=t.replace(/^\[|]$/g,"").trim();return(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))&&(n=n.slice(1,-1),n=n.replace(/\\"/g,'"').replace(/\\'/g,"'")),n.trim()}}},eO={parser:{TokenBuilder:_(()=>new nXt,"TokenBuilder"),ValueConverter:_(()=>new iXt,"ValueConverter")}};_(tO,"createArchitectureServices")});function UXe(e){let t=e.validation.EventModelingValidator,r=e.validation.ValidationRegistry;if(r){let n={EmTimeFrame:t.checkSourceFrameTypes.bind(t),EmResetFrame:t.checkSourceFrameTypes.bind(t)};r.register(n,t)}}function nO(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Bne,rO);return t.ServiceRegistry.register(r),UXe(r),{shared:t,EventModel:r}}var aXt,qXe,VXe,uie,WXe,HXe,sXt,rO,hie=W(()=>{ri();aXt=class extends xi{static{_(this,"EventModelingTokenBuilder")}constructor(){super(["eventmodeling"])}},qXe=new Set(["cmd","command"]),VXe=new Set(["evt","event"]),uie=new Set(["rmo","readmodel"]),WXe=new Set(["pcr","processor"]),HXe=new Set(["ui"]);_(UXe,"registerValidationChecks");sXt=class{static{_(this,"EventModelingValidator")}checkSourceFrameTypes(e,t){e.sourceFrames.length!==0&&(qXe.has(e.modelEntityType)?this.validateSources(e,new Set([...HXe,...WXe]),"command","ui or processor",t):VXe.has(e.modelEntityType)?this.validateSources(e,qXe,"event","command",t):uie.has(e.modelEntityType)?this.validateSources(e,VXe,"read model","event",t):WXe.has(e.modelEntityType)?this.validateSources(e,uie,"processor","read model",t):HXe.has(e.modelEntityType)&&this.validateSources(e,uie,"ui","read model",t))}validateSources(e,t,r,n,i){for(let a of e.sourceFrames){let s=a.ref;s!==void 0&&!t.has(s.modelEntityType)&&i("error",`A ${r} can only receive input from a ${n}, not from '${s.modelEntityType}'.`,{node:e,property:"sourceFrames"})}}},rO={parser:{TokenBuilder:_(()=>new aXt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")},validation:{EventModelingValidator:_(()=>new sXt,"EventModelingValidator")}};_(nO,"createEventModelingServices")});var YXe={};Tr(YXe,{InfoModule:()=>UD,createInfoServices:()=>YD});var XXe=W(()=>{aie();ri()});var jXe={};Tr(jXe,{PacketModule:()=>XD,createPacketServices:()=>jD});var KXe=W(()=>{sie();ri()});var ZXe={};Tr(ZXe,{PieModule:()=>KD,createPieServices:()=>ZD});var QXe=W(()=>{oie();ri()});var JXe={};Tr(JXe,{TreeViewModule:()=>QD,createTreeViewServices:()=>JD});var eje=W(()=>{lie();ri()});var tje={};Tr(tje,{ArchitectureModule:()=>eO,createArchitectureServices:()=>tO});var rje=W(()=>{cie();ri()});var nje={};Tr(nje,{GitGraphModule:()=>WD,createGitGraphServices:()=>HD});var ije=W(()=>{iie();ri()});var aje={};Tr(aje,{EventModelingModule:()=>rO,createEventModelingServices:()=>nO});var sje=W(()=>{hie();ri()});var oje={};Tr(oje,{RadarModule:()=>MD,createRadarServices:()=>ND});var lje=W(()=>{Kne();ri()});var cje={};Tr(cje,{RailroadModule:()=>DD,createRailroadServices:()=>Qw});var uje=W(()=>{Zne();ri()});var hje={};Tr(hje,{RailroadEbnfModule:()=>OD,createRailroadEbnfServices:()=>Jw});var fje=W(()=>{Qne();ri()});var dje={};Tr(dje,{RailroadAbnfModule:()=>PD,createRailroadAbnfServices:()=>ek});var pje=W(()=>{Jne();ri()});var mje={};Tr(mje,{RailroadPegModule:()=>BD,createRailroadPegServices:()=>tk});var gje=W(()=>{eie();ri()});var yje={};Tr(yje,{TreemapModule:()=>FD,createTreemapServices:()=>$D});var vje=W(()=>{tie();ri()});var xje={};Tr(xje,{WardleyModule:()=>zD,createWardleyServices:()=>GD});var bje=W(()=>{rie();ri()});var wje={};Tr(wje,{CynefinModule:()=>qD,createCynefinServices:()=>VD});var kje=W(()=>{nie();ri()});async function ba(e,t){let r=oXt[e];if(!r)throw new Error(`Unknown diagram type: ${e}`);To[e]||await r();let i=To[e].parse(t);if(i.lexerErrors.length>0||i.parserErrors.length>0)throw new hp(i);return i.value}var To,oXt,hp,Co=W(()=>{Kne();Zne();Qne();Jne();eie();tie();rie();nie();iie();aie();sie();oie();lie();cie();hie();ri();To={},oXt={info:_(async()=>{let{createInfoServices:e}=await Promise.resolve().then(()=>(XXe(),YXe)),t=e().Info.parser.LangiumParser;To.info=t},"info"),packet:_(async()=>{let{createPacketServices:e}=await Promise.resolve().then(()=>(KXe(),jXe)),t=e().Packet.parser.LangiumParser;To.packet=t},"packet"),pie:_(async()=>{let{createPieServices:e}=await Promise.resolve().then(()=>(QXe(),ZXe)),t=e().Pie.parser.LangiumParser;To.pie=t},"pie"),treeView:_(async()=>{let{createTreeViewServices:e}=await Promise.resolve().then(()=>(eje(),JXe)),t=e().TreeView.parser.LangiumParser;To.treeView=t},"treeView"),architecture:_(async()=>{let{createArchitectureServices:e}=await Promise.resolve().then(()=>(rje(),tje)),t=e().Architecture.parser.LangiumParser;To.architecture=t},"architecture"),gitGraph:_(async()=>{let{createGitGraphServices:e}=await Promise.resolve().then(()=>(ije(),nje)),t=e().GitGraph.parser.LangiumParser;To.gitGraph=t},"gitGraph"),eventmodeling:_(async()=>{let{createEventModelingServices:e}=await Promise.resolve().then(()=>(sje(),aje)),t=e().EventModel.parser.LangiumParser;To.eventmodeling=t},"eventmodeling"),radar:_(async()=>{let{createRadarServices:e}=await Promise.resolve().then(()=>(lje(),oje)),t=e().Radar.parser.LangiumParser;To.radar=t},"radar"),railroad:_(async()=>{let{createRailroadServices:e}=await Promise.resolve().then(()=>(uje(),cje)),t=e().Railroad.parser.LangiumParser;To.railroad=t},"railroad"),railroadEbnf:_(async()=>{let{createRailroadEbnfServices:e}=await Promise.resolve().then(()=>(fje(),hje)),t=e().RailroadEbnf.parser.LangiumParser;To.railroadEbnf=t},"railroadEbnf"),railroadAbnf:_(async()=>{let{createRailroadAbnfServices:e}=await Promise.resolve().then(()=>(pje(),dje)),t=e().RailroadAbnf.parser.LangiumParser;To.railroadAbnf=t},"railroadAbnf"),railroadPeg:_(async()=>{let{createRailroadPegServices:e}=await Promise.resolve().then(()=>(gje(),mje)),t=e().RailroadPeg.parser.LangiumParser;To.railroadPeg=t},"railroadPeg"),treemap:_(async()=>{let{createTreemapServices:e}=await Promise.resolve().then(()=>(vje(),yje)),t=e().Treemap.parser.LangiumParser;To.treemap=t},"treemap"),wardley:_(async()=>{let{createWardleyServices:e}=await Promise.resolve().then(()=>(bje(),xje)),t=e().Wardley.parser.LangiumParser;To.wardley=t},"wardley"),cynefin:_(async()=>{let{createCynefinServices:e}=await Promise.resolve().then(()=>(kje(),wje)),t=e().Cynefin.parser.LangiumParser;To.cynefin=t},"cynefin")};_(ba,"parse");hp=class extends Error{constructor(e){let t=e.lexerErrors.map(n=>{let i=n.line!==void 0&&!isNaN(n.line)?n.line:"?",a=n.column!==void 0&&!isNaN(n.column)?n.column:"?";return`Lexer error on line ${i}, column ${a}: ${n.message}`}).join(` +`)}return t}},oXe=class{static{_(this,"JSDocLineImpl")}constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};_(eee,"fillNewlines");lXe=class{static{_(this,"JSDocDocumentationProvider")}constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&Rne(t))return _ne(t).toMarkdown({renderLink:_((n,i)=>this.documentationLinkRenderer(e,n,i),"renderLink"),renderTag:_(n=>this.documentationTagRenderer(e,n),"renderTag")})}documentationLinkRenderer(e,t,r){let n=this.findNameInLocalSymbols(e,t)??this.findNameInGlobalScope(e,t);if(n&&n.nameSegment){let i=n.nameSegment.range.start.line+1,a=n.nameSegment.range.start.character+1,s=n.documentUri.with({fragment:`L${i},${a}`});return`[${r}](${s.toString()})`}else return}documentationTagRenderer(e,t){}findNameInLocalSymbols(e,t){let n=Mh(e).localSymbols;if(!n)return;let i=e;do{let s=n.getStream(i).find(o=>o.name===t);if(s)return s;i=i.$container}while(i)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(n=>n.name===t)}},cXe=class{static{_(this,"DefaultCommentProvider")}constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return Tne(e)?e.$comment:Ite(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},uXe=class{static{_(this,"DefaultAsyncParser")}constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},QUt=class{static{_(this,"AbstractThreadedAsyncParser")}constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length{if(this.queue.length>0){let t=this.queue.shift();t&&(e.lock(),t.resolve(e))}}),this.workerPool.push(e)}}async parse(e,t){let r=await this.acquireParserWorker(t),n=new ap,i,a=t.onCancellationRequested(()=>{i=setTimeout(()=>{this.terminateWorker(r)},this.terminationDelay)});return r.parse(e).then(s=>{let o=this.hydrator.hydrate(s);n.resolve(o)}).catch(s=>{n.reject(s)}).finally(()=>{a.dispose(),clearTimeout(i)}),n.promise}terminateWorker(e){e.terminate();let t=this.workerPool.indexOf(e);t>=0&&this.workerPool.splice(t,1)}async acquireParserWorker(e){this.initializeWorkers();for(let r of this.workerPool)if(r.ready)return r.lock(),r;let t=new ap;return e.onCancellationRequested(()=>{let r=this.queue.indexOf(t);r>=0&&this.queue.splice(r,1),t.reject(pd)}),this.queue.push(t),t.promise}},JUt=class{static{_(this,"ParserWorker")}get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,r,n){this.onReadyEmitter=new AD.Emitter,this.deferred=new ap,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=n,t(i=>{let a=i;this.deferred.resolve(a),this.unlock()}),r(i=>{this.deferred.reject(i),this.unlock()})}terminate(){this.deferred.reject(pd),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw new Error("Parser worker is busy");return this._parsing=!0,this.deferred=new ap,this.sendMessage(e),this.deferred.promise}},hXe=class{static{_(this,"DefaultWorkspaceLock")}constructor(){this.previousTokenSource=new Gi.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=CD();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r=Gi.CancellationToken.None){let n=new ap,i={action:t,deferred:n,cancellationToken:r};return e.push(i),this.performNextOperation(),n.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:t,deferred:r,cancellationToken:n})=>{try{let i=await Promise.resolve().then(()=>t(n));r.resolve(i)}catch(i){I2(i)?r.resolve(void 0):r.reject(i)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}},fXe=class{static{_(this,"DefaultHydrator")}constructor(e){this.grammarElementIdMap=new gN,this.tokenTypeIdMap=new gN,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(t=>({...t,message:t.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let t=new Map,r=new Map;for(let n of Nh(e))t.set(n,{});if(e.$cstNode)for(let n of Pw(e.$cstNode))r.set(n,{});return{astNodes:t,cstNodes:r}}dehydrateAstNode(e,t){let r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(let[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){let a=[];r[n]=a;for(let s of i)ls(s)?a.push(this.dehydrateAstNode(s,t)):_l(s)?a.push(this.dehydrateReference(s,t)):a.push(s)}else ls(i)?r[n]=this.dehydrateAstNode(i,t):_l(i)?r[n]=this.dehydrateReference(i,t):i!==void 0&&(r[n]=i);return r}dehydrateReference(e,t){let r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=t.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,t){let r=t.cstNodes.get(e);return CN(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=t.astNodes.get(e.astNode),Z0(e)?r.content=e.content.map(n=>this.dehydrateCstNode(n,t)):f2(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){let t=e.value,r=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,r)}}createHydrationContext(e){let t=new Map,r=new Map;for(let i of Nh(e))t.set(i,{});let n;if(e.$cstNode)for(let i of Pw(e.$cstNode)){let a;"fullText"in i?(a=new one(i.fullText),n=a):"content"in i?a=new xD:"tokenType"in i&&(a=this.hydrateCstLeafNode(i)),a&&(r.set(i,a),a.root=n)}return{astNodes:t,cstNodes:r}}hydrateAstNode(e,t){let r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=t.cstNodes.get(e.$cstNode));for(let[n,i]of Object.entries(e))if(!n.startsWith("$"))if(Array.isArray(i)){let a=[];r[n]=a;for(let s of i)ls(s)?a.push(this.setParent(this.hydrateAstNode(s,t),r)):_l(s)?a.push(this.hydrateReference(s,r,n,t)):a.push(s)}else ls(i)?r[n]=this.setParent(this.hydrateAstNode(i,t),r):_l(i)?r[n]=this.hydrateReference(i,r,n,t):i!==void 0&&(r[n]=i);return r}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,r,n){return this.linker.buildReference(t,r,n.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,r=0){let n=t.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(n.grammarSource=this.getGrammarElement(e.grammarSource)),n.astNode=t.astNodes.get(e.astNode),Z0(n))for(let i of e.content){let a=this.hydrateCstNode(i,t,r++);n.content.push(a)}return n}hydrateCstLeafNode(e){let t=this.getTokenType(e.tokenType),r=e.offset,n=e.length,i=e.startLine,a=e.startColumn,s=e.endLine,o=e.endColumn,l=e.hidden;return new hN(r,n,{start:{line:i,character:a},end:{line:s,character:o}},t,l)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(let t of Nh(this.grammar))SN(t)&&this.grammarElementIdMap.set(t,e++)}};_(Yn,"createDefaultCoreModule");_(Xn,"createDefaultSharedCoreModule");(function(e){e.merge=(t,r)=>Gw(Gw({},t),r)})(tee||(tee={}));_(an,"inject");dXe=Symbol("isProxy");_(Dne,"eagerLoad");_(One,"_inject");ZPe=Symbol();_(ree,"_resolve");_(Gw,"_merge");nee={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]};(function(e){e.REGULAR="indentation-sensitive",e.IGNORE_INDENTATION="ignore-indentation"})(i2||(i2={}));pXe=class extends kD{static{_(this,"IndentationAwareTokenBuilder")}constructor(e=nee){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options={...nee,...e},this.indentTokenType=Rw({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=Rw({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(e,t){let r=super.buildTokens(e,t);if(!_D(r))throw new Error("Invalid tokens built by default builder");let{indentTokenName:n,dedentTokenName:i,whitespaceTokenName:a,ignoreIndentationDelimiters:s}=this.options,o,l,u,h=[];for(let f of r){for(let[d,p]of s)f.name===d?f.PUSH_MODE=i2.IGNORE_INDENTATION:f.name===p&&(f.POP_MODE=!0);f.name===i?o=f:f.name===n?l=f:f.name===a?u=f:h.push(f)}if(!o||!l||!u)throw new Error("Some indentation/whitespace tokens not found!");return s.length>0?{modes:{[i2.REGULAR]:[o,l,...h,u],[i2.IGNORE_INDENTATION]:[...h,u]},defaultMode:i2.REGULAR}:[o,l,u,...h]}flushLexingReport(e){return{...super.flushLexingReport(e),remainingDedents:this.flushRemainingDedents(e)}}isStartOfLine(e,t){return t===0||`\r +`.includes(e[t-1])}matchWhitespace(e,t,r,n){this.whitespaceRegExp.lastIndex=t;let i=this.whitespaceRegExp.exec(e);return{currIndentLevel:i?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:i}}createIndentationTokenInstance(e,t,r,n){let i=this.getLineNumber(t,n);return k6(e,r,n,n+r.length,i,i,1,r.length)}getLineNumber(e,t){return e.substring(0,t).split(/\r\n|\r|\n/).length}indentMatcher(e,t,r,n){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:s}=this.matchWhitespace(e,t,r,n);return i<=a?null:(this.indentationStack.push(i),s)}dedentMatcher(e,t,r,n){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:s}=this.matchWhitespace(e,t,r,n);if(i>=a)return null;let o=this.indentationStack.lastIndexOf(i);if(o===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${i} at offset: ${t}. Current indentation stack: ${this.indentationStack}`,offset:t,length:s?.[0]?.length??0,line:this.getLineNumber(e,t),column:1}),null;let l=this.indentationStack.length-o-1,u=e.substring(0,t).match(/[\r\n]+$/)?.[0].length??1;for(let h=0;h1;)t.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],t}},eYt=class extends Ane{static{_(this,"IndentationAwareLexer")}constructor(e){if(super(e),e.parser.TokenBuilder instanceof pXe)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,t=Ene){let r=super.tokenize(e),n=r.report;t?.mode==="full"&&r.tokens.push(...n.remainingDedents),n.remainingDedents=[];let{indentTokenType:i,dedentTokenType:a}=this.indentationTokenBuilder,s=i.tokenTypeIdx,o=a.tokenTypeIdx,l=[],u=r.tokens.length-1;for(let h=0;h=0&&l.push(r.tokens[u]),r.tokens=l,r}},Pne={};Hg(Pne,{AstUtils:()=>ate,BiMap:()=>gN,Cancellation:()=>Gi,ContextCache:()=>ED,CstUtils:()=>rte,DONE_RESULT:()=>Al,Deferred:()=>ap,Disposable:()=>s2,DisposableCache:()=>SD,DocumentCache:()=>BYe,EMPTY_STREAM:()=>Iw,ErrorWithLocation:()=>MN,GrammarUtils:()=>Ote,MultiMap:()=>sp,OperationCancelled:()=>pd,Reduction:()=>qS,RegExpUtils:()=>Bte,SimpleCache:()=>wne,StreamImpl:()=>dd,TreeStreamImpl:()=>Mw,URI:()=>Xc,UriTrie:()=>xne,UriUtils:()=>Rl,WorkspaceCache:()=>kne,assertCondition:()=>Pte,assertUnreachable:()=>Ug,delayNextTick:()=>TD,interruptAndCheck:()=>Us,isOperationCancelled:()=>I2,loadGrammarFromJson:()=>Ys,setInterruptionPeriod:()=>gne,startCancelableOperation:()=>CD,stream:()=>ki});wN(Pne,AD);mXe=class{static{_(this,"EmptyFileSystemProvider")}stat(e){throw new Error("No file system is available.")}statSync(e){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}},ti={fileSystemProvider:_(()=>new mXe,"fileSystemProvider")},tYt={Grammar:_(()=>{},"Grammar"),LanguageMetaData:_(()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"}),"LanguageMetaData")},rYt={AstReflection:_(()=>new Ete,"AstReflection")};_(gXe,"createMinimalGrammarServices");_(Ys,"loadGrammarFromJson");wN(EBe,Pne);nYt=class{static{_(this,"DefaultLangiumProfiler")}constructor(e){this.activeCategories=new Set,this.allCategories=new Set(["validating","parsing","linking"]),this.activeCategories=e??new Set(this.allCategories),this.records=new sp}isActive(e){return this.activeCategories.has(e)}start(...e){e?e.forEach(t=>this.activeCategories.add(t)):this.activeCategories=new Set(this.allCategories)}stop(...e){e?e.forEach(t=>this.activeCategories.delete(t)):this.activeCategories.clear()}createTask(e,t){if(!this.isActive(e))throw new Error(`Category "${e}" is not active.`);return console.log(`Creating profiling task for '${e}.${t}'.`),new yXe(r=>this.records.add(e,this.dumpRecord(e,r)),t)}dumpRecord(e,t){console.info(`Task ${e}.${t.identifier} executed in ${t.duration.toFixed(2)}ms and ended at ${t.date.toISOString()}`);let r=[];for(let a of t.entries.keys()){let s=t.entries.get(a),o=s.reduce((l,u)=>l+u);r.push({name:`${t.identifier}.${a}`,count:s.length,duration:o})}let n=t.duration-r.map(a=>a.duration).reduce((a,s)=>a+s,0);r.push({name:t.identifier,count:1,duration:n}),r.sort((a,s)=>s.duration-a.duration);function i(a){return Math.round(100*a)/100}return _(i,"Round"),console.table(r.map(a=>({Element:a.name,Count:a.count,"Self %":i(100*a.duration/t.duration),"Time (ms)":i(a.duration)}))),t}getRecords(...e){return e.length===0?this.records.values():this.records.entries().filter(t=>e.some(r=>r===t[0])).flatMap(t=>t[1])}},yXe=class{static{_(this,"ProfilingTask")}constructor(e,t){this.stack=[],this.entries=new sp,this.addRecord=e,this.identifier=t}start(){if(this.startTime!==void 0)throw new Error(`Task "${this.identifier}" is already started.`);this.startTime=performance.now()}stop(){if(this.startTime===void 0)throw new Error(`Task "${this.identifier}" was not started.`);if(this.stack.length!==0)throw new Error(`Task "${this.identifier}" cannot be stopped before sub-task(s): ${this.stack.map(t=>t.id).join(", ")}.`);let e={identifier:this.identifier,date:new Date,duration:performance.now()-this.startTime,entries:this.entries};this.addRecord(e),this.startTime=void 0,this.entries.clear()}startSubTask(e){this.stack.push({id:e,start:performance.now(),content:0})}stopSubTask(e){let t=this.stack.pop();if(!t)throw new Error(`Task "${this.identifier}.${e}" was not started.`);if(t.id!==e)throw new Error(`Sub-Task "${t.id}" is not already stopped.`);let r=performance.now()-t.start;this.stack.at(-1)!==void 0&&(this.stack[this.stack.length-1].content+=r);let n=r-t.content;this.entries.add(e,n)}};(e=>{e.Terminals={ARROW_DIRECTION:/L|R|T|B/,ARROW_GROUP:/\{group\}/,ARROW_INTO:/<|>/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ARCH_ICON:/\([\w-:]+\)/,ARCH_TITLE:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[\w ]+)\]/}})(iee||(iee={}));(e=>{e.Terminals={DOMAIN_NAME:/complex|complicated|clear|chaotic|confusion/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(aee||(aee={}));(e=>{e.Terminals={EM_ID:/[_a-zA-Z][\w_]*/,EM_FID:/\d{1,3}/,EM_DATA_INLINE:/\{(.*)\}|"(.*)"|'(.*)'/,EM_DATA_BLOCK:/\{[\t ]*\r?\n(?:[\S\s]*?\r?\n)?\}(?:\r?\n|(?!\S))/,EM_ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,EM_ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,EM_TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,EM_WS:/\s+/,EM_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,EM_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,EM_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,EM_ML_COMMENT:/\/\*[\s\S]*?\*\//,EM_SL_COMMENT:/\/\/[^\n\r]*/}})(see||(see={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,REFERENCE:/\w([-\./\w]*[-\w])?/}})(oee||(oee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(lee||(lee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(cee||(cee={}));(e=>{e.Terminals={NUMBER_PIE:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(uee||(uee={}));(e=>{e.Terminals={GRATICULE:/circle|polygon/,BOOLEAN:/true|false/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NUMBER:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(hee||(hee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ABNF_RULENAME:/[A-Za-z][A-Za-z0-9-]*/,ABNF_STRING:/"[^"]*"/,ABNF_NUMVAL:/%[xXdDbB][0-9A-Fa-f]+(?:-[0-9A-Fa-f]+|\.[0-9A-Fa-f]+)*/,ABNF_REPEAT:/[0-9]*\*[0-9]*/,ABNF_EXACT_REPEAT:/[0-9]+/,ABNF_WHITESPACE:/[\t \r\n]+/,ABNF_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,ABNF_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,ABNF_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ABNF_COMMENT:/;[^\n\r]*/}})(fee||(fee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,EBNF_ID:/[A-Z_a-z][\w-]*/,EBNF_STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,EBNF_SPECIAL_SEQUENCE:/\?(?=[^?;]*[^?\s;][^?;]*\?)[^?;]*\?/,EBNF_WHITESPACE:/[\t \r\n]+/,EBNF_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,EBNF_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,EBNF_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,EBNF_BLOCK_COMMENT:/\/\*[\s\S]*?\*\//,EBNF_ISO_COMMENT:/\(\*[\s\S]*?\*\)/}})(dee||(dee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,RR_ID:/[A-Z_a-z][\w-]*/,RR_STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,RR_WHITESPACE:/[\t \r\n]+/,RR_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,RR_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,RR_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,RR_BLOCK_COMMENT:/\/\*[\s\S]*?\*\//}})(pee||(pee={}));(e=>{e.Terminals={TITLE:/title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,ACC_TITLE:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,ACC_DESCR:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,PEG_ID:/[A-Z_a-z][\w-]*/,PEG_STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,PEG_WHITESPACE:/[\t \r\n]+/,PEG_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,PEG_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,PEG_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,PEG_LINE_COMMENT:/#[^\n\r]*/}})(mee||(mee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,TREEMAP_KEYWORD:/treemap-beta|treemap/,CLASS_DEF:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,STYLE_SEPARATOR:/:::/,SEPARATOR:/:/,COMMA:/,/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,ID2:/[a-zA-Z_][a-zA-Z0-9_]*/,NUMBER2:/[0-9_\.\,]+/,STRING2:/"[^"]*"|'[^']*'/}})(gee||(gee={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,CLASS_ANNOTATION:/[ \t]+:::[ \t]*[A-Za-z_][\w-]*/,ICON_ANNOTATION:/[ \t]+icon\([\w-]*(?::[\w-]+)?\)/,DESC_ANNOTATION:/[ \t]+##[^\n\r]*/,INDENTATION:/[ \t]{1,}/,QUOTED_NAME:/"[^"]*"|'[^']*'/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,BARE_NAME:/(?!:::|icon\(|##)[^ \t\n\r"'](?:(?![ \t]+:::[ \t]*[A-Za-z_]|[ \t]+icon\(|[ \t]+##)[^\n\r])*/}})(yee||(yee={}));(e=>{e.Terminals={WARDLEY_NUMBER:/[0-9]+\.[0-9]+/,ARROW:/->/,LINK_PORT:/\+<>|\+>|\+|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/,LINK_LABEL:/;[^\n\r]+/,STRATEGY:/build|buy|outsource|market/,KW_WARDLEY:/wardley-beta/,KW_SIZE:/size/,KW_EVOLUTION:/evolution/,KW_ANCHOR:/anchor/,KW_COMPONENT:/component/,KW_LABEL:/label/,KW_INERTIA:/inertia/,KW_EVOLVE:/evolve/,KW_PIPELINE:/pipeline/,KW_NOTE:/note/,KW_ANNOTATIONS:/annotations/,KW_ANNOTATION:/annotation/,KW_ACCELERATOR:/accelerator/,KW_DEACCELERATOR:/deaccelerator/,NAME_WITH_SPACES:/(?!title\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/,WS:/[ \t]+/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(vee||(vee={}));Fjr={...iee.Terminals,...aee.Terminals,...see.Terminals,...oee.Terminals,...lee.Terminals,...cee.Terminals,...uee.Terminals,...hee.Terminals,...fee.Terminals,...dee.Terminals,...pee.Terminals,...mee.Terminals,...yee.Terminals,...gee.Terminals,...vee.Terminals},xee={$type:"AbnfAlternation",alternatives:"alternatives"},bee={$type:"AbnfConcatenation",elements:"elements"},CM={$type:"AbnfElement",primary:"primary",repeat:"repeat"},wee={$type:"AbnfGroup",element:"element"},kee={$type:"AbnfNumVal",value:"value"},Tee={$type:"AbnfOptionalGroup",element:"element"},Lv={$type:"AbnfPrimary"},SM={$type:"AbnfRule",definition:"definition",name:"name"},Cee={$type:"AbnfRuleName",name:"name"},See={$type:"AbnfStringLiteral",value:"value"},HI={$type:"Accelerator",name:"name",x:"x",y:"y"},lQ={$type:"Alignment",direction:"direction",members:"members"},UI={$type:"Anchor",evolution:"evolution",name:"name",visibility:"visibility"},sS={$type:"Annotation",number:"number",text:"text",x:"x",y:"y"},cQ={$type:"Annotations",x:"x",y:"y"},Rh={$type:"Architecture",accDescr:"accDescr",accTitle:"accTitle",alignments:"alignments",edges:"edges",groups:"groups",junctions:"junctions",services:"services",title:"title"};_(vXe,"isArchitecture");YI={$type:"Axis",label:"label",name:"name"},FS={$type:"Branch",name:"name",order:"order"};_(xXe,"isBranch");QPe={$type:"Checkout",branch:"branch"},XI={$type:"CherryPicking",id:"id",parent:"parent",tags:"tags"},uQ={$type:"ClassDefStatement",className:"className",styleText:"styleText"},Uv={$type:"Commit",id:"id",message:"message",tags:"tags",type:"type"};_(bXe,"isCommit");jI={$type:"Common",accDescr:"accDescr",accTitle:"accTitle",title:"title"},kv={$type:"Component",decorator:"decorator",evolution:"evolution",inertia:"inertia",label:"label",name:"name",visibility:"visibility"},KI={$type:"Curve",entries:"entries",label:"label",name:"name"},Bg={$type:"Cynefin",accDescr:"accDescr",accTitle:"accTitle",domains:"domains",title:"title",transitions:"transitions"};_(wXe,"isCynefin");ZI={$type:"Deaccelerator",name:"name",x:"x",y:"y"},JPe={$type:"Decorator",strategy:"strategy"},sw={$type:"Direction",accDescr:"accDescr",accTitle:"accTitle",dir:"dir",statements:"statements",title:"title"},$S={$type:"DomainBlock",domain:"domain",items:"items"};_(kXe,"isDomainBlock");bN={$type:"DomainItem",label:"label"};_(TXe,"isDomainItem");Eee={$type:"EbnfChoice",alternatives:"alternatives"},Aee={$type:"EbnfExceptionPostfix",except:"except"},_ee={$type:"EbnfGroup",element:"element"},Ree={$type:"EbnfNonTerminal",name:"name"},Lee={$type:"EbnfOneOrMorePostfix",operator:"operator"},Iee={$type:"EbnfOptional",element:"element"},Mee={$type:"EbnfOptionalPostfix",operator:"operator"},pw={$type:"EbnfPostfix"},Rg={$type:"EbnfPrimary"},Nee={$type:"EbnfRepetition",element:"element"},EM={$type:"EbnfRule",definition:"definition",name:"name"},Dee={$type:"EbnfSequence",elements:"elements"},Oee={$type:"EbnfSpecial",text:"text"},AM={$type:"EbnfTerm",base:"base",postfixes:"postfixes"},Pee={$type:"EbnfTerminal",value:"value"},Bee={$type:"EbnfZeroOrMorePostfix",operator:"operator"},sd={$type:"Edge",lhsDir:"lhsDir",lhsGroup:"lhsGroup",lhsId:"lhsId",lhsInto:"lhsInto",rhsDir:"rhsDir",rhsGroup:"rhsGroup",rhsId:"rhsId",rhsInto:"rhsInto",title:"title"},Iv={$type:"EmDataEntity",dataBlockValue:"dataBlockValue",dataType:"dataType",name:"name"},Lg={$type:"EmFrame"},oS={$type:"EmGwt",givenStatements:"givenStatements",sourceFrame:"sourceFrame",thenStatements:"thenStatements",whenStatements:"whenStatements"},eBe={$type:"EmGwtStatement",entityIdentifier:"entityIdentifier"},hQ={$type:"EmModelEntity",name:"name"};_(CXe,"isEmModelEntityType");QI={$type:"EmNoteEntity",dataBlockValue:"dataBlockValue",dataType:"dataType",sourceFrame:"sourceFrame"},Y0={$type:"EmResetFrame",dataInlineValue:"dataInlineValue",dataReference:"dataReference",dataType:"dataType",entityIdentifier:"entityIdentifier",modelEntityType:"modelEntityType",name:"name",sourceFrames:"sourceFrames"};_(ID,"isEmResetFrame");_g={$type:"EmTimeFrame",dataInlineValue:"dataInlineValue",dataReference:"dataReference",dataType:"dataType",entityIdentifier:"entityIdentifier",modelEntityType:"modelEntityType",name:"name",sourceFrames:"sourceFrames"},fQ={$type:"Entry",axis:"axis",value:"value"},ld={$type:"EventModel",accDescr:"accDescr",accTitle:"accTitle",dataEntities:"dataEntities",frames:"frames",gwtEntities:"gwtEntities",modelEntities:"modelEntities",noteEntities:"noteEntities",title:"title"},tBe={$type:"Evolution",stages:"stages"},JI={$type:"EvolutionStage",boundary:"boundary",name:"name",secondName:"secondName"},dQ={$type:"Evolve",component:"component",target:"target"},Fg={$type:"GitGraph",accDescr:"accDescr",accTitle:"accTitle",statements:"statements",title:"title"};_(SXe,"isGitGraph");lS={$type:"Group",icon:"icon",id:"id",in:"in",title:"title"},Sw={$type:"Info",accDescr:"accDescr",accTitle:"accTitle",title:"title"};_(EXe,"isInfo");cS={$type:"Item",classSelector:"classSelector",name:"name"},pQ={$type:"Junction",id:"id",in:"in"},uS={$type:"Label",negX:"negX",negY:"negY",offsetX:"offsetX",offsetY:"offsetY"},eM={$type:"Leaf",classSelector:"classSelector",name:"name",value:"value"},Tv={$type:"Link",arrow:"arrow",from:"from",fromPort:"fromPort",linkLabel:"linkLabel",to:"to",toPort:"toPort"},Yv={$type:"Merge",branch:"branch",id:"id",tags:"tags",type:"type"};_(AXe,"isMerge");tM={$type:"Note",evolution:"evolution",text:"text",visibility:"visibility"},mQ={$type:"Option",name:"name",value:"value"},Xv={$type:"Packet",accDescr:"accDescr",accTitle:"accTitle",blocks:"blocks",title:"title"};_(_Xe,"isPacket");jv={$type:"PacketBlock",bits:"bits",end:"end",label:"label",start:"start"};_(RXe,"isPacketBlock");Fee={$type:"PegAny",dot:"dot"},$ee={$type:"PegGroup",element:"element"},zee={$type:"PegIdentifier",name:"name"},Gee={$type:"PegLiteral",value:"value"},qee={$type:"PegOrderedChoice",alternatives:"alternatives"},_M={$type:"PegPrefix",operator:"operator",suffix:"suffix"},mw={$type:"PegPrimary"},RM={$type:"PegRule",definition:"definition",name:"name"},Vee={$type:"PegSequence",elements:"elements"},LM={$type:"PegSuffix",operator:"operator",primary:"primary"},$g={$type:"Pie",accDescr:"accDescr",accTitle:"accTitle",sections:"sections",showData:"showData",title:"title"};_(LXe,"isPie");zS={$type:"PieSection",label:"label",value:"value"};_(IXe,"isPieSection");gQ={$type:"Pipeline",components:"components",parent:"parent"},rM={$type:"PipelineComponent",evolution:"evolution",label:"label",name:"name"},Ig={$type:"Radar",accDescr:"accDescr",accTitle:"accTitle",axes:"axes",curves:"curves",options:"options",title:"title"},Kv={$type:"Railroad",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(MXe,"isRailroad");Zv={$type:"RailroadAbnf",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(NXe,"isRailroadAbnf");Wee={$type:"RailroadChoiceExpr",alternatives:"alternatives"},Qv={$type:"RailroadEbnf",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(DXe,"isRailroadEbnf");cd={$type:"RailroadExpression"},Hee={$type:"RailroadNonTerminalExpr",name:"name"},Uee={$type:"RailroadOneOrMoreExpr",element:"element"},Yee={$type:"RailroadOptionalExpr",element:"element"},Jv={$type:"RailroadPeg",accDescr:"accDescr",accTitle:"accTitle",rules:"rules",title:"title"};_(OXe,"isRailroadPeg");IM={$type:"RailroadRule",definition:"definition",name:"name"},Xee={$type:"RailroadSequenceExpr",elements:"elements"},jee={$type:"RailroadSpecialExpr",text:"text"},Kee={$type:"RailroadTerminalExpr",value:"value"},Zee={$type:"RailroadZeroOrMoreExpr",element:"element"},yQ={$type:"Section",classSelector:"classSelector",name:"name"},ow={$type:"Service",icon:"icon",iconText:"iconText",id:"id",in:"in",title:"title"},vQ={$type:"Size",height:"height",width:"width"},Mv={$type:"Statement"},Ew={$type:"Transition",from:"from",label:"label",to:"to"};_(PXe,"isTransition");e2={$type:"Treemap",accDescr:"accDescr",accTitle:"accTitle",title:"title",TreemapRows:"TreemapRows"};_(BXe,"isTreemap");xQ={$type:"TreemapRow",indent:"indent",item:"item"},Nv={$type:"TreeNode",classAnnotation:"classAnnotation",descAnnotation:"descAnnotation",iconAnnotation:"iconAnnotation",indent:"indent",name:"name"},gw={$type:"TreeView",accDescr:"accDescr",accTitle:"accTitle",nodes:"nodes",title:"title"},Ws={$type:"Wardley",accDescr:"accDescr",accelerators:"accelerators",accTitle:"accTitle",anchors:"anchors",annotation:"annotation",annotations:"annotations",components:"components",deaccelerators:"deaccelerators",evolution:"evolution",evolves:"evolves",links:"links",notes:"notes",pipelines:"pipelines",size:"size",title:"title"};_(FXe,"isWardley");$Xe=class extends ite{constructor(){super(...arguments),this.types={AbnfAlternation:{name:xee.$type,properties:{alternatives:{name:xee.alternatives,defaultValue:[]}},superTypes:[]},AbnfConcatenation:{name:bee.$type,properties:{elements:{name:bee.elements,defaultValue:[]}},superTypes:[]},AbnfElement:{name:CM.$type,properties:{primary:{name:CM.primary},repeat:{name:CM.repeat}},superTypes:[]},AbnfGroup:{name:wee.$type,properties:{element:{name:wee.element}},superTypes:[Lv.$type]},AbnfNumVal:{name:kee.$type,properties:{value:{name:kee.value}},superTypes:[Lv.$type]},AbnfOptionalGroup:{name:Tee.$type,properties:{element:{name:Tee.element}},superTypes:[Lv.$type]},AbnfPrimary:{name:Lv.$type,properties:{},superTypes:[]},AbnfRule:{name:SM.$type,properties:{definition:{name:SM.definition},name:{name:SM.name}},superTypes:[]},AbnfRuleName:{name:Cee.$type,properties:{name:{name:Cee.name}},superTypes:[Lv.$type]},AbnfStringLiteral:{name:See.$type,properties:{value:{name:See.value}},superTypes:[Lv.$type]},Accelerator:{name:HI.$type,properties:{name:{name:HI.name},x:{name:HI.x},y:{name:HI.y}},superTypes:[]},Alignment:{name:lQ.$type,properties:{direction:{name:lQ.direction},members:{name:lQ.members,defaultValue:[]}},superTypes:[]},Anchor:{name:UI.$type,properties:{evolution:{name:UI.evolution},name:{name:UI.name},visibility:{name:UI.visibility}},superTypes:[]},Annotation:{name:sS.$type,properties:{number:{name:sS.number},text:{name:sS.text},x:{name:sS.x},y:{name:sS.y}},superTypes:[]},Annotations:{name:cQ.$type,properties:{x:{name:cQ.x},y:{name:cQ.y}},superTypes:[]},Architecture:{name:Rh.$type,properties:{accDescr:{name:Rh.accDescr},accTitle:{name:Rh.accTitle},alignments:{name:Rh.alignments,defaultValue:[]},edges:{name:Rh.edges,defaultValue:[]},groups:{name:Rh.groups,defaultValue:[]},junctions:{name:Rh.junctions,defaultValue:[]},services:{name:Rh.services,defaultValue:[]},title:{name:Rh.title}},superTypes:[]},Axis:{name:YI.$type,properties:{label:{name:YI.label},name:{name:YI.name}},superTypes:[]},Branch:{name:FS.$type,properties:{name:{name:FS.name},order:{name:FS.order}},superTypes:[Mv.$type]},Checkout:{name:QPe.$type,properties:{branch:{name:QPe.branch}},superTypes:[Mv.$type]},CherryPicking:{name:XI.$type,properties:{id:{name:XI.id},parent:{name:XI.parent},tags:{name:XI.tags,defaultValue:[]}},superTypes:[Mv.$type]},ClassDefStatement:{name:uQ.$type,properties:{className:{name:uQ.className},styleText:{name:uQ.styleText}},superTypes:[]},Commit:{name:Uv.$type,properties:{id:{name:Uv.id},message:{name:Uv.message},tags:{name:Uv.tags,defaultValue:[]},type:{name:Uv.type}},superTypes:[Mv.$type]},Common:{name:jI.$type,properties:{accDescr:{name:jI.accDescr},accTitle:{name:jI.accTitle},title:{name:jI.title}},superTypes:[]},Component:{name:kv.$type,properties:{decorator:{name:kv.decorator},evolution:{name:kv.evolution},inertia:{name:kv.inertia,defaultValue:!1},label:{name:kv.label},name:{name:kv.name},visibility:{name:kv.visibility}},superTypes:[]},Curve:{name:KI.$type,properties:{entries:{name:KI.entries,defaultValue:[]},label:{name:KI.label},name:{name:KI.name}},superTypes:[]},Cynefin:{name:Bg.$type,properties:{accDescr:{name:Bg.accDescr},accTitle:{name:Bg.accTitle},domains:{name:Bg.domains,defaultValue:[]},title:{name:Bg.title},transitions:{name:Bg.transitions,defaultValue:[]}},superTypes:[]},Deaccelerator:{name:ZI.$type,properties:{name:{name:ZI.name},x:{name:ZI.x},y:{name:ZI.y}},superTypes:[]},Decorator:{name:JPe.$type,properties:{strategy:{name:JPe.strategy}},superTypes:[]},Direction:{name:sw.$type,properties:{accDescr:{name:sw.accDescr},accTitle:{name:sw.accTitle},dir:{name:sw.dir},statements:{name:sw.statements,defaultValue:[]},title:{name:sw.title}},superTypes:[Fg.$type]},DomainBlock:{name:$S.$type,properties:{domain:{name:$S.domain},items:{name:$S.items,defaultValue:[]}},superTypes:[]},DomainItem:{name:bN.$type,properties:{label:{name:bN.label}},superTypes:[]},EbnfChoice:{name:Eee.$type,properties:{alternatives:{name:Eee.alternatives,defaultValue:[]}},superTypes:[]},EbnfExceptionPostfix:{name:Aee.$type,properties:{except:{name:Aee.except}},superTypes:[pw.$type]},EbnfGroup:{name:_ee.$type,properties:{element:{name:_ee.element}},superTypes:[Rg.$type]},EbnfNonTerminal:{name:Ree.$type,properties:{name:{name:Ree.name}},superTypes:[Rg.$type]},EbnfOneOrMorePostfix:{name:Lee.$type,properties:{operator:{name:Lee.operator}},superTypes:[pw.$type]},EbnfOptional:{name:Iee.$type,properties:{element:{name:Iee.element}},superTypes:[Rg.$type]},EbnfOptionalPostfix:{name:Mee.$type,properties:{operator:{name:Mee.operator}},superTypes:[pw.$type]},EbnfPostfix:{name:pw.$type,properties:{},superTypes:[]},EbnfPrimary:{name:Rg.$type,properties:{},superTypes:[]},EbnfRepetition:{name:Nee.$type,properties:{element:{name:Nee.element}},superTypes:[Rg.$type]},EbnfRule:{name:EM.$type,properties:{definition:{name:EM.definition},name:{name:EM.name}},superTypes:[]},EbnfSequence:{name:Dee.$type,properties:{elements:{name:Dee.elements,defaultValue:[]}},superTypes:[]},EbnfSpecial:{name:Oee.$type,properties:{text:{name:Oee.text}},superTypes:[Rg.$type]},EbnfTerm:{name:AM.$type,properties:{base:{name:AM.base},postfixes:{name:AM.postfixes,defaultValue:[]}},superTypes:[]},EbnfTerminal:{name:Pee.$type,properties:{value:{name:Pee.value}},superTypes:[Rg.$type]},EbnfZeroOrMorePostfix:{name:Bee.$type,properties:{operator:{name:Bee.operator}},superTypes:[pw.$type]},Edge:{name:sd.$type,properties:{lhsDir:{name:sd.lhsDir},lhsGroup:{name:sd.lhsGroup,defaultValue:!1},lhsId:{name:sd.lhsId},lhsInto:{name:sd.lhsInto,defaultValue:!1},rhsDir:{name:sd.rhsDir},rhsGroup:{name:sd.rhsGroup,defaultValue:!1},rhsId:{name:sd.rhsId},rhsInto:{name:sd.rhsInto,defaultValue:!1},title:{name:sd.title}},superTypes:[]},EmDataEntity:{name:Iv.$type,properties:{dataBlockValue:{name:Iv.dataBlockValue},dataType:{name:Iv.dataType},name:{name:Iv.name}},superTypes:[]},EmFrame:{name:Lg.$type,properties:{},superTypes:[]},EmGwt:{name:oS.$type,properties:{givenStatements:{name:oS.givenStatements,defaultValue:[]},sourceFrame:{name:oS.sourceFrame,referenceType:Lg.$type},thenStatements:{name:oS.thenStatements,defaultValue:[]},whenStatements:{name:oS.whenStatements,defaultValue:[]}},superTypes:[]},EmGwtStatement:{name:eBe.$type,properties:{entityIdentifier:{name:eBe.entityIdentifier,referenceType:hQ.$type}},superTypes:[]},EmModelEntity:{name:hQ.$type,properties:{name:{name:hQ.name}},superTypes:[]},EmNoteEntity:{name:QI.$type,properties:{dataBlockValue:{name:QI.dataBlockValue},dataType:{name:QI.dataType},sourceFrame:{name:QI.sourceFrame,referenceType:Lg.$type}},superTypes:[]},EmResetFrame:{name:Y0.$type,properties:{dataInlineValue:{name:Y0.dataInlineValue},dataReference:{name:Y0.dataReference,referenceType:Iv.$type},dataType:{name:Y0.dataType},entityIdentifier:{name:Y0.entityIdentifier},modelEntityType:{name:Y0.modelEntityType},name:{name:Y0.name},sourceFrames:{name:Y0.sourceFrames,defaultValue:[],referenceType:Lg.$type}},superTypes:[Lg.$type]},EmTimeFrame:{name:_g.$type,properties:{dataInlineValue:{name:_g.dataInlineValue},dataReference:{name:_g.dataReference,referenceType:Iv.$type},dataType:{name:_g.dataType},entityIdentifier:{name:_g.entityIdentifier},modelEntityType:{name:_g.modelEntityType},name:{name:_g.name},sourceFrames:{name:_g.sourceFrames,defaultValue:[],referenceType:Lg.$type}},superTypes:[Lg.$type]},Entry:{name:fQ.$type,properties:{axis:{name:fQ.axis,referenceType:YI.$type},value:{name:fQ.value}},superTypes:[]},EventModel:{name:ld.$type,properties:{accDescr:{name:ld.accDescr},accTitle:{name:ld.accTitle},dataEntities:{name:ld.dataEntities,defaultValue:[]},frames:{name:ld.frames,defaultValue:[]},gwtEntities:{name:ld.gwtEntities,defaultValue:[]},modelEntities:{name:ld.modelEntities,defaultValue:[]},noteEntities:{name:ld.noteEntities,defaultValue:[]},title:{name:ld.title}},superTypes:[]},Evolution:{name:tBe.$type,properties:{stages:{name:tBe.stages,defaultValue:[]}},superTypes:[]},EvolutionStage:{name:JI.$type,properties:{boundary:{name:JI.boundary},name:{name:JI.name},secondName:{name:JI.secondName}},superTypes:[]},Evolve:{name:dQ.$type,properties:{component:{name:dQ.component},target:{name:dQ.target}},superTypes:[]},GitGraph:{name:Fg.$type,properties:{accDescr:{name:Fg.accDescr},accTitle:{name:Fg.accTitle},statements:{name:Fg.statements,defaultValue:[]},title:{name:Fg.title}},superTypes:[]},Group:{name:lS.$type,properties:{icon:{name:lS.icon},id:{name:lS.id},in:{name:lS.in},title:{name:lS.title}},superTypes:[]},Info:{name:Sw.$type,properties:{accDescr:{name:Sw.accDescr},accTitle:{name:Sw.accTitle},title:{name:Sw.title}},superTypes:[]},Item:{name:cS.$type,properties:{classSelector:{name:cS.classSelector},name:{name:cS.name}},superTypes:[]},Junction:{name:pQ.$type,properties:{id:{name:pQ.id},in:{name:pQ.in}},superTypes:[]},Label:{name:uS.$type,properties:{negX:{name:uS.negX,defaultValue:!1},negY:{name:uS.negY,defaultValue:!1},offsetX:{name:uS.offsetX},offsetY:{name:uS.offsetY}},superTypes:[]},Leaf:{name:eM.$type,properties:{classSelector:{name:eM.classSelector},name:{name:eM.name},value:{name:eM.value}},superTypes:[cS.$type]},Link:{name:Tv.$type,properties:{arrow:{name:Tv.arrow},from:{name:Tv.from},fromPort:{name:Tv.fromPort},linkLabel:{name:Tv.linkLabel},to:{name:Tv.to},toPort:{name:Tv.toPort}},superTypes:[]},Merge:{name:Yv.$type,properties:{branch:{name:Yv.branch},id:{name:Yv.id},tags:{name:Yv.tags,defaultValue:[]},type:{name:Yv.type}},superTypes:[Mv.$type]},Note:{name:tM.$type,properties:{evolution:{name:tM.evolution},text:{name:tM.text},visibility:{name:tM.visibility}},superTypes:[]},Option:{name:mQ.$type,properties:{name:{name:mQ.name},value:{name:mQ.value,defaultValue:!1}},superTypes:[]},Packet:{name:Xv.$type,properties:{accDescr:{name:Xv.accDescr},accTitle:{name:Xv.accTitle},blocks:{name:Xv.blocks,defaultValue:[]},title:{name:Xv.title}},superTypes:[]},PacketBlock:{name:jv.$type,properties:{bits:{name:jv.bits},end:{name:jv.end},label:{name:jv.label},start:{name:jv.start}},superTypes:[]},PegAny:{name:Fee.$type,properties:{dot:{name:Fee.dot}},superTypes:[mw.$type]},PegGroup:{name:$ee.$type,properties:{element:{name:$ee.element}},superTypes:[mw.$type]},PegIdentifier:{name:zee.$type,properties:{name:{name:zee.name}},superTypes:[mw.$type]},PegLiteral:{name:Gee.$type,properties:{value:{name:Gee.value}},superTypes:[mw.$type]},PegOrderedChoice:{name:qee.$type,properties:{alternatives:{name:qee.alternatives,defaultValue:[]}},superTypes:[]},PegPrefix:{name:_M.$type,properties:{operator:{name:_M.operator},suffix:{name:_M.suffix}},superTypes:[]},PegPrimary:{name:mw.$type,properties:{},superTypes:[]},PegRule:{name:RM.$type,properties:{definition:{name:RM.definition},name:{name:RM.name}},superTypes:[]},PegSequence:{name:Vee.$type,properties:{elements:{name:Vee.elements,defaultValue:[]}},superTypes:[]},PegSuffix:{name:LM.$type,properties:{operator:{name:LM.operator},primary:{name:LM.primary}},superTypes:[]},Pie:{name:$g.$type,properties:{accDescr:{name:$g.accDescr},accTitle:{name:$g.accTitle},sections:{name:$g.sections,defaultValue:[]},showData:{name:$g.showData,defaultValue:!1},title:{name:$g.title}},superTypes:[]},PieSection:{name:zS.$type,properties:{label:{name:zS.label},value:{name:zS.value}},superTypes:[]},Pipeline:{name:gQ.$type,properties:{components:{name:gQ.components,defaultValue:[]},parent:{name:gQ.parent}},superTypes:[]},PipelineComponent:{name:rM.$type,properties:{evolution:{name:rM.evolution},label:{name:rM.label},name:{name:rM.name}},superTypes:[]},Radar:{name:Ig.$type,properties:{accDescr:{name:Ig.accDescr},accTitle:{name:Ig.accTitle},axes:{name:Ig.axes,defaultValue:[]},curves:{name:Ig.curves,defaultValue:[]},options:{name:Ig.options,defaultValue:[]},title:{name:Ig.title}},superTypes:[]},Railroad:{name:Kv.$type,properties:{accDescr:{name:Kv.accDescr},accTitle:{name:Kv.accTitle},rules:{name:Kv.rules,defaultValue:[]},title:{name:Kv.title}},superTypes:[]},RailroadAbnf:{name:Zv.$type,properties:{accDescr:{name:Zv.accDescr},accTitle:{name:Zv.accTitle},rules:{name:Zv.rules,defaultValue:[]},title:{name:Zv.title}},superTypes:[]},RailroadChoiceExpr:{name:Wee.$type,properties:{alternatives:{name:Wee.alternatives,defaultValue:[]}},superTypes:[cd.$type]},RailroadEbnf:{name:Qv.$type,properties:{accDescr:{name:Qv.accDescr},accTitle:{name:Qv.accTitle},rules:{name:Qv.rules,defaultValue:[]},title:{name:Qv.title}},superTypes:[]},RailroadExpression:{name:cd.$type,properties:{},superTypes:[]},RailroadNonTerminalExpr:{name:Hee.$type,properties:{name:{name:Hee.name}},superTypes:[cd.$type]},RailroadOneOrMoreExpr:{name:Uee.$type,properties:{element:{name:Uee.element}},superTypes:[cd.$type]},RailroadOptionalExpr:{name:Yee.$type,properties:{element:{name:Yee.element}},superTypes:[cd.$type]},RailroadPeg:{name:Jv.$type,properties:{accDescr:{name:Jv.accDescr},accTitle:{name:Jv.accTitle},rules:{name:Jv.rules,defaultValue:[]},title:{name:Jv.title}},superTypes:[]},RailroadRule:{name:IM.$type,properties:{definition:{name:IM.definition},name:{name:IM.name}},superTypes:[]},RailroadSequenceExpr:{name:Xee.$type,properties:{elements:{name:Xee.elements,defaultValue:[]}},superTypes:[cd.$type]},RailroadSpecialExpr:{name:jee.$type,properties:{text:{name:jee.text}},superTypes:[cd.$type]},RailroadTerminalExpr:{name:Kee.$type,properties:{value:{name:Kee.value}},superTypes:[cd.$type]},RailroadZeroOrMoreExpr:{name:Zee.$type,properties:{element:{name:Zee.element}},superTypes:[cd.$type]},Section:{name:yQ.$type,properties:{classSelector:{name:yQ.classSelector},name:{name:yQ.name}},superTypes:[cS.$type]},Service:{name:ow.$type,properties:{icon:{name:ow.icon},iconText:{name:ow.iconText},id:{name:ow.id},in:{name:ow.in},title:{name:ow.title}},superTypes:[]},Size:{name:vQ.$type,properties:{height:{name:vQ.height},width:{name:vQ.width}},superTypes:[]},Statement:{name:Mv.$type,properties:{},superTypes:[]},Transition:{name:Ew.$type,properties:{from:{name:Ew.from},label:{name:Ew.label},to:{name:Ew.to}},superTypes:[]},TreeNode:{name:Nv.$type,properties:{classAnnotation:{name:Nv.classAnnotation},descAnnotation:{name:Nv.descAnnotation},iconAnnotation:{name:Nv.iconAnnotation},indent:{name:Nv.indent},name:{name:Nv.name}},superTypes:[]},TreeView:{name:gw.$type,properties:{accDescr:{name:gw.accDescr},accTitle:{name:gw.accTitle},nodes:{name:gw.nodes,defaultValue:[]},title:{name:gw.title}},superTypes:[]},Treemap:{name:e2.$type,properties:{accDescr:{name:e2.accDescr},accTitle:{name:e2.accTitle},title:{name:e2.title},TreemapRows:{name:e2.TreemapRows,defaultValue:[]}},superTypes:[]},TreemapRow:{name:xQ.$type,properties:{indent:{name:xQ.indent},item:{name:xQ.item}},superTypes:[]},Wardley:{name:Ws.$type,properties:{accDescr:{name:Ws.accDescr},accelerators:{name:Ws.accelerators,defaultValue:[]},accTitle:{name:Ws.accTitle},anchors:{name:Ws.anchors,defaultValue:[]},annotation:{name:Ws.annotation,defaultValue:[]},annotations:{name:Ws.annotations,defaultValue:[]},components:{name:Ws.components,defaultValue:[]},deaccelerators:{name:Ws.deaccelerators,defaultValue:[]},evolution:{name:Ws.evolution},evolves:{name:Ws.evolves,defaultValue:[]},links:{name:Ws.links,defaultValue:[]},notes:{name:Ws.notes,defaultValue:[]},pipelines:{name:Ws.pipelines,defaultValue:[]},size:{name:Ws.size},title:{name:Ws.title}},superTypes:[]}}}static{_(this,"MermaidAstReflection")}},Wa=new $Xe,iYt=_(()=>rBe??(rBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"alignments","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Alignment","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"align"},{"$type":"Assignment","feature":"direction","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"row"},{"$type":"Keyword","value":"column"}]}},{"$type":"Assignment","feature":"members","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Assignment","feature":"members","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@20"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[(?:\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'|[\\\\w ]+)\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)),"ArchitectureGrammarGrammar"),aYt=_(()=>nBe??(nBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"CynefinGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Cynefin","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"cynefin-beta"},{"$type":"Keyword","value":"cynefin-beta:"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"domains","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"transitions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"DomainBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"domain","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Assignment","feature":"items","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"DomainItem","definition":{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Transition","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":"-->"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"DOMAIN_NAME","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"complex"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"complicated"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"clear"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"chaotic"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"confusion"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"CynefinGrammarGrammar"),sYt=_(()=>iBe??(iBe=Ys('{"$type":"Grammar","isDeclared":true,"name":"EventModeling","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","entry":true,"name":"EventModel","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"eventmodeling"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"frames","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"dataEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"noteEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"gwtEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntityType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rmo"},{"$type":"Keyword","value":"readmodel"},{"$type":"Keyword","value":"ui"},{"$type":"Keyword","value":"cmd"},{"$type":"Keyword","value":"command"},{"$type":"Keyword","value":"evt"},{"$type":"Keyword","value":"event"},{"$type":"Keyword","value":"pcr"},{"$type":"Keyword","value":"processor"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"json"},{"$type":"Keyword","value":"jsobj"},{"$type":"Keyword","value":"figma"},{"$type":"Keyword","value":"salt"},{"$type":"Keyword","value":"uri"},{"$type":"Keyword","value":"md"},{"$type":"Keyword","value":"html"},{"$type":"Keyword","value":"text"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataInline","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataInlineValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataBlock","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataBlockValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"QualifiedName","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"."},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmTimeFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"tf"},{"$type":"Keyword","value":"timeframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmResetFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rf"},{"$type":"Keyword","value":"resetframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmFrame","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"entity"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"data"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmNoteEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"note"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwt","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"gwt"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"given"},{"$type":"Assignment","feature":"givenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"},{"$type":"Group","elements":[{"$type":"Keyword","value":"when"},{"$type":"Assignment","feature":"whenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"},{"$type":"Keyword","value":"then"},{"$type":"Assignment","feature":"thenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwtStatement","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@9"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_EID","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_FI","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"EM_ID","definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_FID","definition":{"$type":"RegexToken","regex":"/\\\\d{1,3}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_INLINE","definition":{"$type":"RegexToken","regex":"/\\\\{(.*)\\\\}|\\"(.*)\\"|\'(.*)\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_BLOCK","definition":{"$type":"RegexToken","regex":"/\\\\{[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?\\\\}(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"EM_WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"imports":[],"types":[]}')),"EventModelingGrammar"),oYt=_(()=>aBe??(aBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)),"GitGraphGrammarGrammar"),lYt=_(()=>sBe??(sBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"InfoGrammarGrammar"),cYt=_(()=>oBe??(oBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"PacketGrammarGrammar"),uYt=_(()=>lBe??(lBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"PieGrammarGrammar"),hYt=_(()=>cBe??(cBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}`)),"RadarGrammarGrammar"),fYt=_(()=>uBe??(uBe=Ys('{"$type":"Grammar","isDeclared":true,"name":"RailroadAbnfGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_RULENAME","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Za-z][A-Za-z0-9-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_NUMVAL","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/%[xXdDbB][0-9A-Fa-f]+(?:-[0-9A-Fa-f]+|\\\\.[0-9A-Fa-f]+)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_REPEAT","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[0-9]*\\\\*[0-9]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ABNF_EXACT_REPEAT","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ABNF_COMMENT","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"RailroadAbnf","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-abnf-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Keyword","value":"="},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfAlternation","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfConcatenation","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"cardinality":"+"},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfElement","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"repeat","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"repeat","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"primary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfPrimary","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfStringLiteral","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfNumVal","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfRuleName","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfGroup","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"AbnfOptionalGroup","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"RailroadAbnf","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfAlternation","attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@3"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfConcatenation","attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@4"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfElement","attributes":[{"$type":"TypeAttribute","name":"repeat","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"primary","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"AbnfPrimary","attributes":[],"superTypes":[]},{"$type":"Interface","name":"AbnfStringLiteral","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"AbnfNumVal","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"AbnfRuleName","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"AbnfGroup","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"AbnfOptionalGroup","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]}],"imports":[],"types":[]}')),"RailroadAbnfGrammarGrammar"),dYt=_(()=>hBe??(hBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RailroadEbnfGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EBNF_ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Z_a-z][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EBNF_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EBNF_SPECIAL_SEQUENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\?(?=[^?;]*[^?\\\\s;][^?;]*\\\\?)[^?;]*\\\\?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_BLOCK_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EBNF_ISO_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\(\\\\*[\\\\s\\\\S]*?\\\\*\\\\)/","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"RailroadEbnf","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-ebnf-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"="},{"$type":"Keyword","value":"::="}]},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfChoice","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"|"},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfSequence","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":",","cardinality":"?"},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfTerm","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"base","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"postfixes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfPrimary","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfTerminal","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfNonTerminal","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfSpecial","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfGroup","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfOptional","returnType":{"$ref":"#/interfaces@11"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfRepetition","returnType":{"$ref":"#/interfaces@12"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"{"},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfPostfix","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfOptionalPostfix","returnType":{"$ref":"#/interfaces@13"},"definition":{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"?"}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfZeroOrMorePostfix","returnType":{"$ref":"#/interfaces@14"},"definition":{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"*"}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfOneOrMorePostfix","returnType":{"$ref":"#/interfaces@15"},"definition":{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"+"}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EbnfExceptionPostfix","returnType":{"$ref":"#/interfaces@16"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"except","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"RailroadEbnf","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfChoice","attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@3"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfSequence","attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@4"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfTerm","attributes":[{"$type":"TypeAttribute","name":"base","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false},{"$type":"TypeAttribute","name":"postfixes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@6"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"EbnfPrimary","attributes":[],"superTypes":[]},{"$type":"Interface","name":"EbnfPostfix","attributes":[],"superTypes":[]},{"$type":"Interface","name":"EbnfTerminal","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfNonTerminal","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfSpecial","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"text","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfGroup","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"EbnfOptional","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"EbnfRepetition","superTypes":[{"$ref":"#/interfaces@5"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"EbnfOptionalPostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"operator","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfZeroOrMorePostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"operator","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfOneOrMorePostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"operator","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"EbnfExceptionPostfix","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"except","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false}]}],"imports":[],"types":[]}`)),"RailroadEbnfGrammarGrammar"),pYt=_(()=>fBe??(fBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RailroadGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"RR_ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Z_a-z][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"RR_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"RR_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"RR_BLOCK_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"Railroad","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Keyword","value":"="},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadExpression","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadSequenceExpr","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"sequence"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadChoiceExpr","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"choice"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadOptionalExpr","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"optional"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadOneOrMoreExpr","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"oneOrMore"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadZeroOrMoreExpr","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"zeroOrMore"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadTerminalExpr","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"terminal"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadNonTerminalExpr","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"nonterminal"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"RailroadSpecialExpr","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"special"},{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"Railroad","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"RailroadRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"RailroadExpression","attributes":[],"superTypes":[]},{"$type":"Interface","name":"RailroadSequenceExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}}},"isOptional":false}]},{"$type":"Interface","name":"RailroadChoiceExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}}},"isOptional":false}]},{"$type":"Interface","name":"RailroadOptionalExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"RailroadOneOrMoreExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"RailroadZeroOrMoreExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"RailroadTerminalExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"RailroadNonTerminalExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"RailroadSpecialExpr","superTypes":[{"$ref":"#/interfaces@2"}],"attributes":[{"$type":"TypeAttribute","name":"text","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]}],"imports":[],"types":[]}`)),"RailroadGrammarGrammar"),mYt=_(()=>dBe??(dBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"RailroadPegGrammar","rules":[{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PEG_ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[A-Z_a-z][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PEG_STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t \\\\r\\\\n]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"PEG_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/#[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"ParserRule","entry":true,"name":"RailroadPeg","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"railroad-peg-beta"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"},{"$type":"Assignment","feature":"rules","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegRule","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Keyword","value":"<-"},{"$type":"Assignment","feature":"definition","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":";"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegOrderedChoice","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"alternatives","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegSequence","returnType":{"$ref":"#/interfaces@3"},"definition":{"$type":"Assignment","feature":"elements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"+"},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegPrefix","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"&"}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"!"}}],"cardinality":"?"},{"$type":"Assignment","feature":"suffix","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegSuffix","returnType":{"$ref":"#/interfaces@5"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"primary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"?"}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"*"}},{"$type":"Assignment","feature":"operator","operator":"=","terminal":{"$type":"Keyword","value":"+"}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegPrimary","returnType":{"$ref":"#/interfaces@6"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegLiteral","returnType":{"$ref":"#/interfaces@7"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegIdentifier","returnType":{"$ref":"#/interfaces@8"},"definition":{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegGroup","returnType":{"$ref":"#/interfaces@9"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"element","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PegAny","returnType":{"$ref":"#/interfaces@10"},"definition":{"$type":"Assignment","feature":"dot","operator":"=","terminal":{"$type":"Keyword","value":"."}},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"RailroadPeg","attributes":[{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"rules","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@1"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegRule","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"definition","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegOrderedChoice","attributes":[{"$type":"TypeAttribute","name":"alternatives","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@3"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegSequence","attributes":[{"$type":"TypeAttribute","name":"elements","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@4"}}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegPrefix","attributes":[{"$type":"TypeAttribute","name":"operator","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"suffix","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@5"}},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"PegSuffix","attributes":[{"$type":"TypeAttribute","name":"primary","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@6"}},"isOptional":false},{"$type":"TypeAttribute","name":"operator","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"PegPrimary","attributes":[],"superTypes":[]},{"$type":"Interface","name":"PegLiteral","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"PegIdentifier","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]},{"$type":"Interface","name":"PegGroup","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"element","type":{"$type":"SimpleType","typeRef":{"$ref":"#/interfaces@2"}},"isOptional":false}]},{"$type":"Interface","name":"PegAny","superTypes":[{"$ref":"#/interfaces@6"}],"attributes":[{"$type":"TypeAttribute","name":"dot","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}]}],"imports":[],"types":[]}`)),"RailroadPegGrammarGrammar"),gYt=_(()=>pBe??(pBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)),"TreemapGrammarGrammar"),yYt=_(()=>mBe??(mBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"TreeViewGrammar","rules":[{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"TreeView","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"treeView-beta"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"nodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"CLASS_ANNOTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+:::[ \\\\t]*[A-Za-z_][\\\\w-]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ICON_ANNOTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+icon\\\\([\\\\w-]*(?::[\\\\w-]+)?\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"DESC_ANNOTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+##[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"QUOTED_NAME","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"BARE_NAME","definition":{"$type":"RegexToken","regex":"/(?!:::|icon\\\\(|##)[^ \\\\t\\\\n\\\\r\\"'](?:(?![ \\\\t]+:::[ \\\\t]*[A-Za-z_]|[ \\\\t]+icon\\\\(|[ \\\\t]+##)[^\\\\n\\\\r])*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TreeNode","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"classAnnotation","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"iconAnnotation","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"descAnnotation","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]}],"interfaces":[{"$type":"Interface","name":"TreeView","attributes":[{"$type":"TypeAttribute","name":"nodes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@14"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * TreeView grammar for Langium\\n *\\n * Supports both quoted labels (\\"my file\\") and bare labels (index.js).\\n * Annotations (:::class, icon(), ## description) are parsed directly into\\n * AST fields by the grammar. Value conversion for stripping quotes, extracting\\n * class names, icon names, and description text happens in valueConverter.ts.\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treeView keyword, allowing for empty lines and comments before the\\n * treeView declaration.\\n */"}`)),"TreeViewGrammarGrammar"),vYt=_(()=>gBe??(gBe=Ys(`{"$type":"Grammar","isDeclared":true,"name":"WardleyGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Wardley","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"size","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"anchors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"links","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"evolves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"pipelines","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"notes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"annotations","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"annotation","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"deaccelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Size","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"width","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"height","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolution","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EvolutionStage","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"boundary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"secondName","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Anchor","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Component","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"decorator","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Keyword","value":")"}]}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Label","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"negX","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetX","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"negY","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetY","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Decorator","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"strategy","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Link","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"fromPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"arrow","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"cardinality":"?"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"toPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"linkLabel","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolve","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Assignment","feature":"component","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Pipeline","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PipelineComponent","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Note","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotations","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotation","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"Assignment","feature":"number","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CoordinateValue","dataType":"number","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Accelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Deaccelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"WARDLEY_NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"->"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_PORT","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<>"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+>"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_ARROW","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-->"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-.->"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":">"},"parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'<>/","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'/","parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_LABEL","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRATEGY","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"build"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"buy"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"outsource"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"market"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_WARDLEY","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"wardley-beta"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_SIZE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"size"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLUTION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolution"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANCHOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"anchor"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_COMPONENT","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"component"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_LABEL","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"label"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_INERTIA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"inertia"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLVE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolve"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_PIPELINE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"pipeline"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_NOTE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"note"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATIONS","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotations"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotation"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"accelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_DEACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"deaccelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NAME_WITH_SPACES","definition":{"$type":"RegexToken","regex":"/(?!title\\\\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \\\\t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@47"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@48"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"WardleyGrammarGrammar"),xYt={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},bYt={languageId:"cynefin",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},wYt={languageId:"eventmodeling",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},kYt={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},TYt={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},CYt={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},SYt={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},EYt={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},AYt={languageId:"railroadAbnf",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},_Yt={languageId:"railroadEbnf",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},RYt={languageId:"railroad",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},LYt={languageId:"railroadPeg",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},IYt={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},MYt={languageId:"treeView",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},NYt={languageId:"wardley",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},pi={AstReflection:_(()=>new $Xe,"AstReflection")},Bne={Grammar:_(()=>iYt(),"Grammar"),LanguageMetaData:_(()=>xYt,"LanguageMetaData"),parser:{}},Fne={Grammar:_(()=>aYt(),"Grammar"),LanguageMetaData:_(()=>bYt,"LanguageMetaData"),parser:{}},$ne={Grammar:_(()=>sYt(),"Grammar"),LanguageMetaData:_(()=>wYt,"LanguageMetaData"),parser:{}},zne={Grammar:_(()=>oYt(),"Grammar"),LanguageMetaData:_(()=>kYt,"LanguageMetaData"),parser:{}},Gne={Grammar:_(()=>lYt(),"Grammar"),LanguageMetaData:_(()=>TYt,"LanguageMetaData"),parser:{}},qne={Grammar:_(()=>cYt(),"Grammar"),LanguageMetaData:_(()=>CYt,"LanguageMetaData"),parser:{}},Vne={Grammar:_(()=>uYt(),"Grammar"),LanguageMetaData:_(()=>SYt,"LanguageMetaData"),parser:{}},Wne={Grammar:_(()=>hYt(),"Grammar"),LanguageMetaData:_(()=>EYt,"LanguageMetaData"),parser:{}},Hne={Grammar:_(()=>fYt(),"Grammar"),LanguageMetaData:_(()=>AYt,"LanguageMetaData"),parser:{}},Une={Grammar:_(()=>dYt(),"Grammar"),LanguageMetaData:_(()=>_Yt,"LanguageMetaData"),parser:{}},Yne={Grammar:_(()=>pYt(),"Grammar"),LanguageMetaData:_(()=>RYt,"LanguageMetaData"),parser:{}},Xne={Grammar:_(()=>mYt(),"Grammar"),LanguageMetaData:_(()=>LYt,"LanguageMetaData"),parser:{}},jne={Grammar:_(()=>gYt(),"Grammar"),LanguageMetaData:_(()=>IYt,"LanguageMetaData"),parser:{}},Kne={Grammar:_(()=>yYt(),"Grammar"),LanguageMetaData:_(()=>MYt,"LanguageMetaData"),parser:{}},Zne={Grammar:_(()=>vYt(),"Grammar"),LanguageMetaData:_(()=>NYt,"LanguageMetaData"),parser:{}},DYt=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,OYt=/accTitle[\t ]*:([^\n\r]*)/,PYt=/title([\t ][^\n\r]*|)/,BYt={ACC_DESCR:DYt,ACC_TITLE:OYt,TITLE:PYt},cs=class extends mne{static{_(this,"AbstractMermaidValueConverter")}runConverter(e,t,r){let n=this.runCommonConverter(e,t,r);return n===void 0&&(n=this.runCustomConverter(e,t,r)),n===void 0?super.runConverter(e,t,r):n}runCommonConverter(e,t,r){let n=BYt[e.name];if(n===void 0)return;let i=n.exec(t);if(i!==null){if(i[1]!==void 0)return i[1].trim().replace(/[\t ]{2,}/gm," ");if(i[2]!==void 0)return i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,` +`)}}},eu=class extends cs{static{_(this,"CommonValueConverter")}runCustomConverter(e,t,r){}},xi=class extends kD{static{_(this,"AbstractMermaidTokenBuilder")}constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,r){let n=super.buildKeywordTokens(e,t,r);return n.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}},FYt=class extends xi{static{_(this,"CommonTokenBuilder")}};});function ND(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Wne,MD);return t.ServiceRegistry.register(r),{shared:t,Radar:r}}var $Yt,MD,Qne=W(()=>{ri();$Yt=class extends xi{static{_(this,"RadarTokenBuilder")}constructor(){super(["radar-beta"])}},MD={parser:{TokenBuilder:_(()=>new $Yt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(ND,"createRadarServices")});function Qw(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Yne,DD);return t.ServiceRegistry.register(r),{shared:t,Railroad:r}}var zYt,zXe,GYt,DD,Jne=W(()=>{ri();zYt=class extends xi{static{_(this,"RailroadTokenBuilder")}constructor(){super(["railroad-beta"])}},zXe=_(e=>{let t=e.slice(1,-1),r="";for(let n=0;nnew zYt,"TokenBuilder"),ValueConverter:_(()=>new GYt,"ValueConverter")}};_(Qw,"createRailroadServices")});function Jw(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Une,OD);return t.ServiceRegistry.register(r),{shared:t,RailroadEbnf:r}}var qYt,GXe,VYt,OD,eie=W(()=>{ri();qYt=class extends xi{static{_(this,"RailroadEbnfTokenBuilder")}constructor(){super(["railroad-ebnf-beta"])}},GXe=_(e=>{let t=e.slice(1,-1),r="";for(let n=0;nnew qYt,"TokenBuilder"),ValueConverter:_(()=>new VYt,"ValueConverter")}};_(Jw,"createRailroadEbnfServices")});function ek(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Hne,PD);return t.ServiceRegistry.register(r),{shared:t,RailroadAbnf:r}}var WYt,HYt,PD,tie=W(()=>{ri();WYt=class extends xi{static{_(this,"RailroadAbnfTokenBuilder")}constructor(){super(["railroad-abnf-beta"])}},HYt=class extends cs{static{_(this,"RailroadAbnfValueConverter")}runConverter(e,t,r){let n=super.runConverter(e,t,r);if(e.name==="TITLE"&&typeof n=="string"){let i=n.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1)}return n}runCustomConverter(e,t,r){if(e.name==="ABNF_STRING")return t.slice(1,-1)}},PD={parser:{TokenBuilder:_(()=>new WYt,"TokenBuilder"),ValueConverter:_(()=>new HYt,"ValueConverter")}};_(ek,"createRailroadAbnfServices")});function tk(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Xne,BD);return t.ServiceRegistry.register(r),{shared:t,RailroadPeg:r}}var UYt,qXe,YYt,BD,rie=W(()=>{ri();UYt=class extends xi{static{_(this,"RailroadPegTokenBuilder")}constructor(){super(["railroad-peg-beta"])}},qXe=_(e=>{let t=e.slice(1,-1),r="";for(let n=0;nnew UYt,"TokenBuilder"),ValueConverter:_(()=>new YYt,"ValueConverter")}};_(tk,"createRailroadPegServices")});function VXe(e){let t=e.validation.TreemapValidator,r=e.validation.ValidationRegistry;if(r){let n={Treemap:t.checkSingleRoot.bind(t)};r.register(n,t)}}function $D(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),jne,FD);return t.ServiceRegistry.register(r),VXe(r),{shared:t,Treemap:r}}var XYt,jYt,KYt,ZYt,FD,nie=W(()=>{ri();XYt=class extends xi{static{_(this,"TreemapTokenBuilder")}constructor(){super(["treemap"])}},jYt=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,KYt=class extends cs{static{_(this,"TreemapValueConverter")}runCustomConverter(e,t,r){if(e.name==="NUMBER2")return parseFloat(t.replace(/,/g,""));if(e.name==="SEPARATOR")return t.substring(1,t.length-1);if(e.name==="STRING2")return t.substring(1,t.length-1);if(e.name==="INDENTATION")return t.length;if(e.name==="ClassDef"){if(typeof t!="string")return t;let n=jYt.exec(t);if(n)return{$type:"ClassDefStatement",className:n[1],styleText:n[2]||void 0}}}};_(VXe,"registerValidationChecks");ZYt=class{static{_(this,"TreemapValidator")}checkSingleRoot(e,t){let r;for(let n of e.TreemapRows)n.item&&(r===void 0&&n.indent===void 0?r=0:n.indent===void 0?t("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}):r!==void 0&&r>=parseInt(n.indent,10)&&t("error","Multiple root nodes are not allowed in a treemap.",{node:n,property:"item"}))}},FD={parser:{TokenBuilder:_(()=>new XYt,"TokenBuilder"),ValueConverter:_(()=>new KYt,"ValueConverter")},validation:{TreemapValidator:_(()=>new ZYt,"TreemapValidator")}};_($D,"createTreemapServices")});function GD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Zne,zD);return t.ServiceRegistry.register(r),{shared:t,Wardley:r}}var QYt,zD,iie=W(()=>{ri();QYt=class extends cs{static{_(this,"WardleyValueConverter")}runCustomConverter(e,t,r){if(e.name.toUpperCase()==="LINK_LABEL")return t.substring(1).trim()}},zD={parser:{ValueConverter:_(()=>new QYt,"ValueConverter")}};_(GD,"createWardleyServices")});function VD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Fne,qD);return t.ServiceRegistry.register(r),{shared:t,Cynefin:r}}var JYt,qD,aie=W(()=>{ri();JYt=class extends xi{static{_(this,"CynefinTokenBuilder")}constructor(){super(["cynefin-beta"])}},qD={parser:{TokenBuilder:_(()=>new JYt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(VD,"createCynefinServices")});function HD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),zne,WD);return t.ServiceRegistry.register(r),{shared:t,GitGraph:r}}var eXt,WD,sie=W(()=>{ri();eXt=class extends xi{static{_(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},WD={parser:{TokenBuilder:_(()=>new eXt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(HD,"createGitGraphServices")});function YD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Gne,UD);return t.ServiceRegistry.register(r),{shared:t,Info:r}}var tXt,UD,oie=W(()=>{ri();tXt=class extends xi{static{_(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},UD={parser:{TokenBuilder:_(()=>new tXt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(YD,"createInfoServices")});function jD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),qne,XD);return t.ServiceRegistry.register(r),{shared:t,Packet:r}}var rXt,XD,lie=W(()=>{ri();rXt=class extends xi{static{_(this,"PacketTokenBuilder")}constructor(){super(["packet"])}},XD={parser:{TokenBuilder:_(()=>new rXt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")}};_(jD,"createPacketServices")});function ZD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Vne,KD);return t.ServiceRegistry.register(r),{shared:t,Pie:r}}var nXt,iXt,KD,cie=W(()=>{ri();nXt=class extends xi{static{_(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},iXt=class extends cs{static{_(this,"PieValueConverter")}runCustomConverter(e,t,r){if(e.name==="PIE_SECTION_LABEL")return t.replace(/"/g,"").trim()}},KD={parser:{TokenBuilder:_(()=>new nXt,"TokenBuilder"),ValueConverter:_(()=>new iXt,"ValueConverter")}};_(ZD,"createPieServices")});function JD(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Kne,QD);return t.ServiceRegistry.register(r),{shared:t,TreeView:r}}var aXt,sXt,QD,uie=W(()=>{ri();aXt=class extends cs{static{_(this,"TreeViewValueConverter")}runCustomConverter(e,t,r){if(e.name==="INDENTATION")return t?.length||0;if(e.name==="QUOTED_NAME")return t.substring(1,t.length-1);if(e.name==="BARE_NAME")return t.replace(/[\t ]+$/,"");if(e.name==="CLASS_ANNOTATION")return t.trim().substring(3).trim();if(e.name==="ICON_ANNOTATION"){let n=t.trim();return n.substring(5,n.length-1)}if(e.name==="DESC_ANNOTATION")return t.trim().substring(2).trim()}},sXt=class extends xi{static{_(this,"TreeViewTokenBuilder")}constructor(){super(["treeView-beta"])}},QD={parser:{TokenBuilder:_(()=>new sXt,"TokenBuilder"),ValueConverter:_(()=>new aXt,"ValueConverter")}};_(JD,"createTreeViewServices")});function tO(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),Bne,eO);return t.ServiceRegistry.register(r),{shared:t,Architecture:r}}var oXt,lXt,eO,hie=W(()=>{ri();oXt=class extends xi{static{_(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},lXt=class extends cs{static{_(this,"ArchitectureValueConverter")}runCustomConverter(e,t,r){if(e.name==="ARCH_ICON")return t.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return t.replace(/["()]/g,"");if(e.name==="ARCH_TITLE"){let n=t.replace(/^\[|]$/g,"").trim();return(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))&&(n=n.slice(1,-1),n=n.replace(/\\"/g,'"').replace(/\\'/g,"'")),n.trim()}}},eO={parser:{TokenBuilder:_(()=>new oXt,"TokenBuilder"),ValueConverter:_(()=>new lXt,"ValueConverter")}};_(tO,"createArchitectureServices")});function XXe(e){let t=e.validation.EventModelingValidator,r=e.validation.ValidationRegistry;if(r){let n={EmTimeFrame:t.checkSourceFrameTypes.bind(t),EmResetFrame:t.checkSourceFrameTypes.bind(t)};r.register(n,t)}}function nO(e=ti){let t=an(Xn(e),pi),r=an(Yn({shared:t}),$ne,rO);return t.ServiceRegistry.register(r),XXe(r),{shared:t,EventModel:r}}var cXt,WXe,HXe,fie,UXe,YXe,uXt,rO,die=W(()=>{ri();cXt=class extends xi{static{_(this,"EventModelingTokenBuilder")}constructor(){super(["eventmodeling"])}},WXe=new Set(["cmd","command"]),HXe=new Set(["evt","event"]),fie=new Set(["rmo","readmodel"]),UXe=new Set(["pcr","processor"]),YXe=new Set(["ui"]);_(XXe,"registerValidationChecks");uXt=class{static{_(this,"EventModelingValidator")}checkSourceFrameTypes(e,t){e.sourceFrames.length!==0&&(WXe.has(e.modelEntityType)?this.validateSources(e,new Set([...YXe,...UXe]),"command","ui or processor",t):HXe.has(e.modelEntityType)?this.validateSources(e,WXe,"event","command",t):fie.has(e.modelEntityType)?this.validateSources(e,HXe,"read model","event",t):UXe.has(e.modelEntityType)?this.validateSources(e,fie,"processor","read model",t):YXe.has(e.modelEntityType)&&this.validateSources(e,fie,"ui","read model",t))}validateSources(e,t,r,n,i){for(let a of e.sourceFrames){let s=a.ref;s!==void 0&&!t.has(s.modelEntityType)&&i("error",`A ${r} can only receive input from a ${n}, not from '${s.modelEntityType}'.`,{node:e,property:"sourceFrames"})}}},rO={parser:{TokenBuilder:_(()=>new cXt,"TokenBuilder"),ValueConverter:_(()=>new eu,"ValueConverter")},validation:{EventModelingValidator:_(()=>new uXt,"EventModelingValidator")}};_(nO,"createEventModelingServices")});var jXe={};Tr(jXe,{InfoModule:()=>UD,createInfoServices:()=>YD});var KXe=W(()=>{oie();ri()});var ZXe={};Tr(ZXe,{PacketModule:()=>XD,createPacketServices:()=>jD});var QXe=W(()=>{lie();ri()});var JXe={};Tr(JXe,{PieModule:()=>KD,createPieServices:()=>ZD});var eje=W(()=>{cie();ri()});var tje={};Tr(tje,{TreeViewModule:()=>QD,createTreeViewServices:()=>JD});var rje=W(()=>{uie();ri()});var nje={};Tr(nje,{ArchitectureModule:()=>eO,createArchitectureServices:()=>tO});var ije=W(()=>{hie();ri()});var aje={};Tr(aje,{GitGraphModule:()=>WD,createGitGraphServices:()=>HD});var sje=W(()=>{sie();ri()});var oje={};Tr(oje,{EventModelingModule:()=>rO,createEventModelingServices:()=>nO});var lje=W(()=>{die();ri()});var cje={};Tr(cje,{RadarModule:()=>MD,createRadarServices:()=>ND});var uje=W(()=>{Qne();ri()});var hje={};Tr(hje,{RailroadModule:()=>DD,createRailroadServices:()=>Qw});var fje=W(()=>{Jne();ri()});var dje={};Tr(dje,{RailroadEbnfModule:()=>OD,createRailroadEbnfServices:()=>Jw});var pje=W(()=>{eie();ri()});var mje={};Tr(mje,{RailroadAbnfModule:()=>PD,createRailroadAbnfServices:()=>ek});var gje=W(()=>{tie();ri()});var yje={};Tr(yje,{RailroadPegModule:()=>BD,createRailroadPegServices:()=>tk});var vje=W(()=>{rie();ri()});var xje={};Tr(xje,{TreemapModule:()=>FD,createTreemapServices:()=>$D});var bje=W(()=>{nie();ri()});var wje={};Tr(wje,{WardleyModule:()=>zD,createWardleyServices:()=>GD});var kje=W(()=>{iie();ri()});var Tje={};Tr(Tje,{CynefinModule:()=>qD,createCynefinServices:()=>VD});var Cje=W(()=>{aie();ri()});async function ba(e,t){let r=hXt[e];if(!r)throw new Error(`Unknown diagram type: ${e}`);To[e]||await r();let i=To[e].parse(t);if(i.lexerErrors.length>0||i.parserErrors.length>0)throw new hp(i);return i.value}var To,hXt,hp,Co=W(()=>{Qne();Jne();eie();tie();rie();nie();iie();aie();sie();oie();lie();cie();uie();hie();die();ri();To={},hXt={info:_(async()=>{let{createInfoServices:e}=await Promise.resolve().then(()=>(KXe(),jXe)),t=e().Info.parser.LangiumParser;To.info=t},"info"),packet:_(async()=>{let{createPacketServices:e}=await Promise.resolve().then(()=>(QXe(),ZXe)),t=e().Packet.parser.LangiumParser;To.packet=t},"packet"),pie:_(async()=>{let{createPieServices:e}=await Promise.resolve().then(()=>(eje(),JXe)),t=e().Pie.parser.LangiumParser;To.pie=t},"pie"),treeView:_(async()=>{let{createTreeViewServices:e}=await Promise.resolve().then(()=>(rje(),tje)),t=e().TreeView.parser.LangiumParser;To.treeView=t},"treeView"),architecture:_(async()=>{let{createArchitectureServices:e}=await Promise.resolve().then(()=>(ije(),nje)),t=e().Architecture.parser.LangiumParser;To.architecture=t},"architecture"),gitGraph:_(async()=>{let{createGitGraphServices:e}=await Promise.resolve().then(()=>(sje(),aje)),t=e().GitGraph.parser.LangiumParser;To.gitGraph=t},"gitGraph"),eventmodeling:_(async()=>{let{createEventModelingServices:e}=await Promise.resolve().then(()=>(lje(),oje)),t=e().EventModel.parser.LangiumParser;To.eventmodeling=t},"eventmodeling"),radar:_(async()=>{let{createRadarServices:e}=await Promise.resolve().then(()=>(uje(),cje)),t=e().Radar.parser.LangiumParser;To.radar=t},"radar"),railroad:_(async()=>{let{createRailroadServices:e}=await Promise.resolve().then(()=>(fje(),hje)),t=e().Railroad.parser.LangiumParser;To.railroad=t},"railroad"),railroadEbnf:_(async()=>{let{createRailroadEbnfServices:e}=await Promise.resolve().then(()=>(pje(),dje)),t=e().RailroadEbnf.parser.LangiumParser;To.railroadEbnf=t},"railroadEbnf"),railroadAbnf:_(async()=>{let{createRailroadAbnfServices:e}=await Promise.resolve().then(()=>(gje(),mje)),t=e().RailroadAbnf.parser.LangiumParser;To.railroadAbnf=t},"railroadAbnf"),railroadPeg:_(async()=>{let{createRailroadPegServices:e}=await Promise.resolve().then(()=>(vje(),yje)),t=e().RailroadPeg.parser.LangiumParser;To.railroadPeg=t},"railroadPeg"),treemap:_(async()=>{let{createTreemapServices:e}=await Promise.resolve().then(()=>(bje(),xje)),t=e().Treemap.parser.LangiumParser;To.treemap=t},"treemap"),wardley:_(async()=>{let{createWardleyServices:e}=await Promise.resolve().then(()=>(kje(),wje)),t=e().Wardley.parser.LangiumParser;To.wardley=t},"wardley"),cynefin:_(async()=>{let{createCynefinServices:e}=await Promise.resolve().then(()=>(Cje(),Tje)),t=e().Cynefin.parser.LangiumParser;To.cynefin=t},"cynefin")};_(ba,"parse");hp=class extends Error{constructor(e){let t=e.lexerErrors.map(n=>{let i=n.line!==void 0&&!isNaN(n.line)?n.line:"?",a=n.column!==void 0&&!isNaN(n.column)?n.column:"?";return`Lexer error on line ${i}, column ${a}: ${n.message}`}).join(` `),r=e.parserErrors.map(n=>{let i=n.token.startLine!==void 0&&!isNaN(n.token.startLine)?n.token.startLine:"?",a=n.token.startColumn!==void 0&&!isNaN(n.token.startColumn)?n.token.startColumn:"?";return`Parse error on line ${i}, column ${a}: ${n.message}`}).join(` -`);super(`Parsing failed: ${t} ${r}`),this.result=e}static{_(this,"MermaidParseError")}}});var Mje={};Tr(Mje,{diagram:()=>ljt});function sO(){return _U({length:7})}function Cje(e,t){let r=Object.create(null);return e.reduce((n,i)=>{let a=t(i);return r[a]||(r[a]=!0,n.push(i)),n},[])}function fie(e,t,r){let n=e.indexOf(t);n===-1?e.push(r):e.splice(n,1,r)}function pie(e){let t=e.reduce((i,a)=>i.seq>a.seq?i:a,e[0]),r="";e.forEach(function(i){i===t?r+=" *":r+=" |"});let n=[r,t.id,t.seq];for(let i in Jt.records.branches)Jt.records.branches.get(i)===t.id&&n.push(i);if(se.debug(n.join(" ")),t.parents&&t.parents.length==2&&t.parents[0]&&t.parents[1]){let i=Jt.records.commits.get(t.parents[0]);fie(e,t,i),t.parents[1]&&e.push(Jt.records.commits.get(t.parents[1]))}else{if(t.parents.length==0)return;if(t.parents[0]){let i=Jt.records.commits.get(t.parents[0]);fie(e,t,i)}}e=Cje(e,i=>i.id),pie(e)}var Ai,lXt,D2,Jt,cXt,uXt,hXt,fXt,dXt,pXt,mXt,Sje,gXt,yXt,vXt,xXt,bXt,Eje,wXt,kXt,TXt,Aje,CXt,SXt,EXt,AXt,_Xt,RXt,LXt,IXt,Kg,Zg,kd,fp,M2,oO,die,mie,MXt,N2,pc,mc,iO,E6,aO,dp,Mn,NXt,_je,Rje,DXt,OXt,PXt,BXt,FXt,$Xt,zXt,GXt,qXt,VXt,WXt,HXt,Tje,UXt,A6,YXt,XXt,jXt,KXt,ZXt,QXt,Lje,Ije,JXt,ejt,tjt,rjt,njt,ijt,ajt,sjt,ojt,ljt,Nje=W(()=>{FI();Sl();Sn();_r();Rr();hr();Co();fn();Ai={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},lXt=Lr.gitGraph,D2=b(()=>Rn({...lXt,...qt().gitGraph}),"getConfig"),Jt=new aw(()=>{let e=D2(),t=e.mainBranchName,r=e.mainBranchOrder;return{mainBranchName:t,commits:new Map,head:null,branchConfig:new Map([[t,{name:t,order:r}]]),branches:new Map([[t,null]]),currBranch:t,direction:"LR",seq:0,options:{}}});b(sO,"getID");b(Cje,"uniqBy");cXt=b(function(e){Jt.records.direction=e},"setDirection"),uXt=b(function(e){se.debug("options str",e),e=e?.trim(),e=e||"{}";try{Jt.records.options=JSON.parse(e)}catch(t){se.error("error while parsing gitGraph options",t.message)}},"setOptions"),hXt=b(function(){return Jt.records.options},"getOptions"),fXt=b(function(e){let t=e.msg,r=e.id,n=e.type,i=e.tags;se.info("commit",t,r,n,i),se.debug("Entering commit:",t,r,n,i);let a=D2();r=Ct.sanitizeText(r,a),t=Ct.sanitizeText(t,a),i=i?.map(o=>Ct.sanitizeText(o,a));let s={id:r||Jt.records.seq+"-"+sO(),message:t,seq:Jt.records.seq++,type:n??Ai.NORMAL,tags:i??[],parents:Jt.records.head==null?[]:[Jt.records.head.id],branch:Jt.records.currBranch};Jt.records.head=s,se.info("main branch",a.mainBranchName),Jt.records.commits.has(s.id)&&se.warn(`Commit ID ${s.id} already exists`),Jt.records.commits.set(s.id,s),Jt.records.branches.set(Jt.records.currBranch,s.id),se.debug("in pushCommit "+s.id)},"commit"),dXt=b(function(e){let t=e.name,r=e.order;if(t=Ct.sanitizeText(t,D2()),Jt.records.branches.has(t))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${t}")`);Jt.records.branches.set(t,Jt.records.head!=null?Jt.records.head.id:null),Jt.records.branchConfig.set(t,{name:t,order:r}),Sje(t),se.debug("in createBranch")},"branch"),pXt=b(e=>{let t=e.branch,r=e.id,n=e.type,i=e.tags,a=D2();t=Ct.sanitizeText(t,a),r&&(r=Ct.sanitizeText(r,a));let s=Jt.records.branches.get(Jt.records.currBranch),o=Jt.records.branches.get(t),l=s?Jt.records.commits.get(s):void 0,u=o?Jt.records.commits.get(o):void 0;if(l&&u&&l.branch===t)throw new Error(`Cannot merge branch '${t}' into itself.`);if(Jt.records.currBranch===t){let d=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},d}if(l===void 0||!l){let d=new Error(`Incorrect usage of "merge". Current branch (${Jt.records.currBranch})has no commits`);throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["commit"]},d}if(!Jt.records.branches.has(t)){let d=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") does not exist");throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:[`branch ${t}`]},d}if(u===void 0||!u){let d=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") has no commits");throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:['"commit"']},d}if(l===u){let d=new Error('Incorrect usage of "merge". Both branches have same head');throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},d}if(r&&Jt.records.commits.has(r)){let d=new Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw d.hash={text:`merge ${t} ${r} ${n} ${i?.join(" ")}`,token:`merge ${t} ${r} ${n} ${i?.join(" ")}`,expected:[`merge ${t} ${r}_UNIQUE ${n} ${i?.join(" ")}`]},d}let h=o||"",f={id:r||`${Jt.records.seq}-${sO()}`,message:`merged branch ${t} into ${Jt.records.currBranch}`,seq:Jt.records.seq++,parents:Jt.records.head==null?[]:[Jt.records.head.id,h],branch:Jt.records.currBranch,type:Ai.MERGE,customType:n,customId:!!r,tags:i??[]};Jt.records.head=f,Jt.records.commits.set(f.id,f),Jt.records.branches.set(Jt.records.currBranch,f.id),se.debug(Jt.records.branches),se.debug("in mergeBranch")},"merge"),mXt=b(function(e){let t=e.id,r=e.targetId,n=e.tags,i=e.parent;se.debug("Entering cherryPick:",t,r,n);let a=D2();if(t=Ct.sanitizeText(t,a),r=Ct.sanitizeText(r,a),n=n?.map(l=>Ct.sanitizeText(l,a)),i=Ct.sanitizeText(i,a),!t||!Jt.records.commits.has(t)){let l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},l}let s=Jt.records.commits.get(t);if(s===void 0||!s)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(i&&!(Array.isArray(s.parents)&&s.parents.includes(i)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let o=s.branch;if(s.type===Ai.MERGE&&!i)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!Jt.records.commits.has(r)){if(o===Jt.records.currBranch){let f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let l=Jt.records.branches.get(Jt.records.currBranch);if(l===void 0||!l){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${Jt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let u=Jt.records.commits.get(l);if(u===void 0||!u){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${Jt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let h={id:Jt.records.seq+"-"+sO(),message:`cherry-picked ${s?.message} into ${Jt.records.currBranch}`,seq:Jt.records.seq++,parents:Jt.records.head==null?[]:[Jt.records.head.id,s.id],branch:Jt.records.currBranch,type:Ai.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${s.id}${s.type===Ai.MERGE?`|parent:${i}`:""}`]};Jt.records.head=h,Jt.records.commits.set(h.id,h),Jt.records.branches.set(Jt.records.currBranch,h.id),se.debug(Jt.records.branches),se.debug("in cherryPick")}},"cherryPick"),Sje=b(function(e){if(e=Ct.sanitizeText(e,D2()),Jt.records.branches.has(e)){Jt.records.currBranch=e;let t=Jt.records.branches.get(Jt.records.currBranch);t===void 0||!t?Jt.records.head=null:Jt.records.head=Jt.records.commits.get(t)??null}else{let t=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw t.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},t}},"checkout");b(fie,"upsert");b(pie,"prettyPrintCommitHistory");gXt=b(function(){se.debug(Jt.records.commits);let e=Eje()[0];pie([e])},"prettyPrint"),yXt=b(function(){Jt.reset(),Nr()},"clear"),vXt=b(function(){return[...Jt.records.branchConfig.values()].map((t,r)=>t.order!==null&&t.order!==void 0?t:{...t,order:parseFloat(`0.${r}`)}).sort((t,r)=>(t.order??0)-(r.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),xXt=b(function(){return Jt.records.branches},"getBranches"),bXt=b(function(){return Jt.records.commits},"getCommits"),Eje=b(function(){let e=[...Jt.records.commits.values()];return e.forEach(function(t){se.debug(t.id)}),e.sort((t,r)=>t.seq-r.seq),e},"getCommitsArray"),wXt=b(function(){return Jt.records.currBranch},"getCurrentBranch"),kXt=b(function(){return Jt.records.direction},"getDirection"),TXt=b(function(){return Jt.records.head},"getHead"),Aje={commitType:Ai,getConfig:D2,setDirection:cXt,setOptions:uXt,getOptions:hXt,commit:fXt,branch:dXt,merge:pXt,cherryPick:mXt,checkout:Sje,prettyPrint:gXt,clear:yXt,getBranchesAsObjArray:vXt,getBranches:xXt,getCommits:bXt,getCommitsArray:Eje,getCurrentBranch:wXt,getDirection:kXt,getHead:TXt,setAccTitle:Yr,getAccTitle:Qr,getAccDescription:en,setAccDescription:Jr,setDiagramTitle:ln,getDiagramTitle:tn},CXt=b((e,t)=>{wi(e,t),e.dir&&t.setDirection(e.dir);for(let r of e.statements)SXt(r,t)},"populate"),SXt=b((e,t)=>{let n={Commit:b(i=>t.commit(EXt(i)),"Commit"),Branch:b(i=>t.branch(AXt(i)),"Branch"),Merge:b(i=>t.merge(_Xt(i)),"Merge"),Checkout:b(i=>t.checkout(RXt(i)),"Checkout"),CherryPicking:b(i=>t.cherryPick(LXt(i)),"CherryPicking")}[e.$type];n?n(e):se.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),EXt=b(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?Ai[e.type]:Ai.NORMAL,tags:e.tags??void 0}),"parseCommit"),AXt=b(e=>({name:e.name,order:e.order??0}),"parseBranch"),_Xt=b(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?Ai[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),RXt=b(e=>e.branch,"parseCheckout"),LXt=b(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),IXt={parse:b(async e=>{let t=await ba("gitGraph",e);se.debug(t),CXt(t,Aje)},"parse")},Kg=10,Zg=40,kd=4,fp=2,M2=8,oO=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),die=12,mie=new Set(["redux-color","redux-dark-color"]),MXt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),N2=b((e,t,r=!1)=>r&&e>0?(e-1)%(t-1)+1:e%t,"calcColorIndex"),pc=new Map,mc=new Map,iO=30,E6=new Map,aO=[],dp=0,Mn="LR",NXt=b(()=>{pc.clear(),mc.clear(),E6.clear(),dp=0,aO=[],Mn="LR"},"clear"),_je=b(e=>{let t=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(n=>{let i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),i.setAttribute("dy","1em"),i.setAttribute("x","0"),i.setAttribute("class","row"),i.textContent=n.trim(),t.appendChild(i)}),t},"drawText"),Rje=b(e=>{let t,r,n;return Mn==="BT"?(r=b((i,a)=>i<=a,"comparisonFunc"),n=1/0):(r=b((i,a)=>i>=a,"comparisonFunc"),n=0),e.forEach(i=>{let a=Mn==="TB"||Mn=="BT"?mc.get(i)?.y:mc.get(i)?.x;a!==void 0&&r(a,n)&&(t=i,n=a)}),t},"findClosestParent"),DXt=b(e=>{let t="",r=1/0;return e.forEach(n=>{let i=mc.get(n).y;i<=r&&(t=n,r=i)}),t||void 0},"findClosestParentBT"),OXt=b((e,t,r)=>{let n=r,i=r,a=[];e.forEach(s=>{let o=t.get(s);if(!o)throw new Error(`Commit not found for key ${s}`);o.parents.length?(n=BXt(o),i=Math.max(n,i)):a.push(o),FXt(o,n)}),n=i,a.forEach(s=>{$Xt(s,n,r)}),e.forEach(s=>{let o=t.get(s);if(o?.parents.length){let l=DXt(o.parents);n=mc.get(l).y-Zg,n<=i&&(i=n);let u=pc.get(o.branch).pos,h=n-Kg;mc.set(o.id,{x:u,y:h})}})},"setParallelBTPos"),PXt=b(e=>{let t=Rje(e.parents.filter(n=>n!==null));if(!t)throw new Error(`Closest parent not found for commit ${e.id}`);let r=mc.get(t)?.y;if(r===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return r},"findClosestParentPos"),BXt=b(e=>PXt(e)+Zg,"calculateCommitPosition"),FXt=b((e,t)=>{let r=pc.get(e.branch);if(!r)throw new Error(`Branch not found for commit ${e.id}`);let n=r.pos,i=t+Kg;return mc.set(e.id,{x:n,y:i}),{x:n,y:i}},"setCommitPosition"),$Xt=b((e,t,r)=>{let n=pc.get(e.branch);if(!n)throw new Error(`Branch not found for commit ${e.id}`);let i=t+r,a=n.pos;mc.set(e.id,{x:a,y:i})},"setRootPosition"),zXt=b((e,t,r,n,i,a)=>{let{theme:s}=Be(),o=oO.has(s??""),l=mie.has(s??""),u=MXt.has(s??"");if(a===Ai.HIGHLIGHT)e.append("rect").attr("x",r.x-10+(o?3:0)).attr("y",r.y-10+(o?3:0)).attr("width",o?14:20).attr("height",o?14:20).attr("class",`commit ${t.id} commit-highlight${N2(i,M2,l)} ${n}-outer`),e.append("rect").attr("x",r.x-6+(o?2:0)).attr("y",r.y-6+(o?2:0)).attr("width",o?8:12).attr("height",o?8:12).attr("class",`commit ${t.id} commit${N2(i,M2,l)} ${n}-inner`);else if(a===Ai.CHERRY_PICK)e.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",o?7:10).attr("class",`commit ${t.id} ${n}`),e.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",o?2.5:2.75).attr("fill",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`),e.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",o?2.5:2.75).attr("fill",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`),e.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`),e.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`);else{let h=e.append("circle");if(h.attr("cx",r.x),h.attr("cy",r.y),h.attr("r",o?7:10),h.attr("class",`commit ${t.id} commit${N2(i,M2,l)}`),a===Ai.MERGE){let f=e.append("circle");f.attr("cx",r.x),f.attr("cy",r.y),f.attr("r",o?5:6),f.attr("class",`commit ${n} ${t.id} commit${N2(i,M2,l)}`)}if(a===Ai.REVERSE){let f=e.append("path"),d=o?4:5;f.attr("d",`M ${r.x-d},${r.y-d}L${r.x+d},${r.y+d}M${r.x-d},${r.y+d}L${r.x+d},${r.y-d}`).attr("class",`commit ${n} ${t.id} commit${N2(i,M2,l)}`)}}},"drawCommitBullet"),GXt=b((e,t,r,n,i)=>{if(t.type!==Ai.CHERRY_PICK&&(t.customId&&t.type===Ai.MERGE||t.type!==Ai.MERGE)&&i.showCommitLabel){let a=e.append("g"),s=a.insert("rect").attr("class","commit-label-bkg"),o=a.append("text").attr("x",n).attr("y",r.y+25).attr("class","commit-label").text(t.id),l=o.node()?.getBBox();if(l&&(s.attr("x",r.posWithOffset-l.width/2-fp).attr("y",r.y+13.5).attr("width",l.width+2*fp).attr("height",l.height+2*fp),Mn==="TB"||Mn==="BT"?(s.attr("x",r.x-(l.width+4*kd+5)).attr("y",r.y-12),o.attr("x",r.x-(l.width+4*kd)).attr("y",r.y+l.height-12)):o.attr("x",r.posWithOffset-l.width/2),i.rotateCommitLabel))if(Mn==="TB"||Mn==="BT")o.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),s.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let u=-7.5-(l.width+10)/25*9.5,h=10+l.width/25*8.5;a.attr("transform","translate("+u+", "+h+") rotate(-45, "+n+", "+r.y+")")}}},"drawCommitLabel"),qXt=b((e,t,r,n)=>{if(t.tags.length>0){let i=0,a=0,s=0,o=[];for(let l of t.tags.reverse()){let u=e.insert("polygon"),h=e.append("circle"),f=e.append("text").attr("y",r.y-16-i).attr("class","tag-label").text(l),d=f.node()?.getBBox();if(!d)throw new Error("Tag bbox not found");a=Math.max(a,d.width),s=Math.max(s,d.height),f.attr("x",r.posWithOffset-d.width/2),o.push({tag:f,hole:h,rect:u,yOffset:i}),i+=20}for(let{tag:l,hole:u,rect:h,yOffset:f}of o){let d=s/2,p=r.y-19.2-f;if(h.attr("class","tag-label-bkg").attr("points",` +`);super(`Parsing failed: ${t} ${r}`),this.result=e}static{_(this,"MermaidParseError")}}});var Dje={};Tr(Dje,{diagram:()=>fjt});function sO(){return LU({length:7})}function Eje(e,t){let r=Object.create(null);return e.reduce((n,i)=>{let a=t(i);return r[a]||(r[a]=!0,n.push(i)),n},[])}function pie(e,t,r){let n=e.indexOf(t);n===-1?e.push(r):e.splice(n,1,r)}function gie(e){let t=e.reduce((i,a)=>i.seq>a.seq?i:a,e[0]),r="";e.forEach(function(i){i===t?r+=" *":r+=" |"});let n=[r,t.id,t.seq];for(let i in Jt.records.branches)Jt.records.branches.get(i)===t.id&&n.push(i);if(se.debug(n.join(" ")),t.parents&&t.parents.length==2&&t.parents[0]&&t.parents[1]){let i=Jt.records.commits.get(t.parents[0]);pie(e,t,i),t.parents[1]&&e.push(Jt.records.commits.get(t.parents[1]))}else{if(t.parents.length==0)return;if(t.parents[0]){let i=Jt.records.commits.get(t.parents[0]);pie(e,t,i)}}e=Eje(e,i=>i.id),gie(e)}var Ai,fXt,D2,Jt,dXt,pXt,mXt,gXt,yXt,vXt,xXt,Aje,bXt,wXt,kXt,TXt,CXt,_je,SXt,EXt,AXt,Rje,_Xt,RXt,LXt,IXt,MXt,NXt,DXt,OXt,Kg,Zg,kd,fp,M2,oO,mie,yie,PXt,N2,mc,gc,iO,E6,aO,dp,Mn,BXt,Lje,Ije,FXt,$Xt,zXt,GXt,qXt,VXt,WXt,HXt,UXt,YXt,XXt,jXt,Sje,KXt,A6,ZXt,QXt,JXt,ejt,tjt,rjt,Mje,Nje,njt,ijt,ajt,sjt,ojt,ljt,cjt,ujt,hjt,fjt,Oje=W(()=>{FI();El();Sn();_r();Rr();hr();Co();fn();Ai={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},fXt=Lr.gitGraph,D2=b(()=>Rn({...fXt,...qt().gitGraph}),"getConfig"),Jt=new aw(()=>{let e=D2(),t=e.mainBranchName,r=e.mainBranchOrder;return{mainBranchName:t,commits:new Map,head:null,branchConfig:new Map([[t,{name:t,order:r}]]),branches:new Map([[t,null]]),currBranch:t,direction:"LR",seq:0,options:{}}});b(sO,"getID");b(Eje,"uniqBy");dXt=b(function(e){Jt.records.direction=e},"setDirection"),pXt=b(function(e){se.debug("options str",e),e=e?.trim(),e=e||"{}";try{Jt.records.options=JSON.parse(e)}catch(t){se.error("error while parsing gitGraph options",t.message)}},"setOptions"),mXt=b(function(){return Jt.records.options},"getOptions"),gXt=b(function(e){let t=e.msg,r=e.id,n=e.type,i=e.tags;se.info("commit",t,r,n,i),se.debug("Entering commit:",t,r,n,i);let a=D2();r=Ct.sanitizeText(r,a),t=Ct.sanitizeText(t,a),i=i?.map(o=>Ct.sanitizeText(o,a));let s={id:r||Jt.records.seq+"-"+sO(),message:t,seq:Jt.records.seq++,type:n??Ai.NORMAL,tags:i??[],parents:Jt.records.head==null?[]:[Jt.records.head.id],branch:Jt.records.currBranch};Jt.records.head=s,se.info("main branch",a.mainBranchName),Jt.records.commits.has(s.id)&&se.warn(`Commit ID ${s.id} already exists`),Jt.records.commits.set(s.id,s),Jt.records.branches.set(Jt.records.currBranch,s.id),se.debug("in pushCommit "+s.id)},"commit"),yXt=b(function(e){let t=e.name,r=e.order;if(t=Ct.sanitizeText(t,D2()),Jt.records.branches.has(t))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${t}")`);Jt.records.branches.set(t,Jt.records.head!=null?Jt.records.head.id:null),Jt.records.branchConfig.set(t,{name:t,order:r}),Aje(t),se.debug("in createBranch")},"branch"),vXt=b(e=>{let t=e.branch,r=e.id,n=e.type,i=e.tags,a=D2();t=Ct.sanitizeText(t,a),r&&(r=Ct.sanitizeText(r,a));let s=Jt.records.branches.get(Jt.records.currBranch),o=Jt.records.branches.get(t),l=s?Jt.records.commits.get(s):void 0,u=o?Jt.records.commits.get(o):void 0;if(l&&u&&l.branch===t)throw new Error(`Cannot merge branch '${t}' into itself.`);if(Jt.records.currBranch===t){let d=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},d}if(l===void 0||!l){let d=new Error(`Incorrect usage of "merge". Current branch (${Jt.records.currBranch})has no commits`);throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["commit"]},d}if(!Jt.records.branches.has(t)){let d=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") does not exist");throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:[`branch ${t}`]},d}if(u===void 0||!u){let d=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") has no commits");throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:['"commit"']},d}if(l===u){let d=new Error('Incorrect usage of "merge". Both branches have same head');throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},d}if(r&&Jt.records.commits.has(r)){let d=new Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw d.hash={text:`merge ${t} ${r} ${n} ${i?.join(" ")}`,token:`merge ${t} ${r} ${n} ${i?.join(" ")}`,expected:[`merge ${t} ${r}_UNIQUE ${n} ${i?.join(" ")}`]},d}let h=o||"",f={id:r||`${Jt.records.seq}-${sO()}`,message:`merged branch ${t} into ${Jt.records.currBranch}`,seq:Jt.records.seq++,parents:Jt.records.head==null?[]:[Jt.records.head.id,h],branch:Jt.records.currBranch,type:Ai.MERGE,customType:n,customId:!!r,tags:i??[]};Jt.records.head=f,Jt.records.commits.set(f.id,f),Jt.records.branches.set(Jt.records.currBranch,f.id),se.debug(Jt.records.branches),se.debug("in mergeBranch")},"merge"),xXt=b(function(e){let t=e.id,r=e.targetId,n=e.tags,i=e.parent;se.debug("Entering cherryPick:",t,r,n);let a=D2();if(t=Ct.sanitizeText(t,a),r=Ct.sanitizeText(r,a),n=n?.map(l=>Ct.sanitizeText(l,a)),i=Ct.sanitizeText(i,a),!t||!Jt.records.commits.has(t)){let l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},l}let s=Jt.records.commits.get(t);if(s===void 0||!s)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(i&&!(Array.isArray(s.parents)&&s.parents.includes(i)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let o=s.branch;if(s.type===Ai.MERGE&&!i)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!Jt.records.commits.has(r)){if(o===Jt.records.currBranch){let f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let l=Jt.records.branches.get(Jt.records.currBranch);if(l===void 0||!l){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${Jt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let u=Jt.records.commits.get(l);if(u===void 0||!u){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${Jt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let h={id:Jt.records.seq+"-"+sO(),message:`cherry-picked ${s?.message} into ${Jt.records.currBranch}`,seq:Jt.records.seq++,parents:Jt.records.head==null?[]:[Jt.records.head.id,s.id],branch:Jt.records.currBranch,type:Ai.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${s.id}${s.type===Ai.MERGE?`|parent:${i}`:""}`]};Jt.records.head=h,Jt.records.commits.set(h.id,h),Jt.records.branches.set(Jt.records.currBranch,h.id),se.debug(Jt.records.branches),se.debug("in cherryPick")}},"cherryPick"),Aje=b(function(e){if(e=Ct.sanitizeText(e,D2()),Jt.records.branches.has(e)){Jt.records.currBranch=e;let t=Jt.records.branches.get(Jt.records.currBranch);t===void 0||!t?Jt.records.head=null:Jt.records.head=Jt.records.commits.get(t)??null}else{let t=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw t.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},t}},"checkout");b(pie,"upsert");b(gie,"prettyPrintCommitHistory");bXt=b(function(){se.debug(Jt.records.commits);let e=_je()[0];gie([e])},"prettyPrint"),wXt=b(function(){Jt.reset(),Nr()},"clear"),kXt=b(function(){return[...Jt.records.branchConfig.values()].map((t,r)=>t.order!==null&&t.order!==void 0?t:{...t,order:parseFloat(`0.${r}`)}).sort((t,r)=>(t.order??0)-(r.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),TXt=b(function(){return Jt.records.branches},"getBranches"),CXt=b(function(){return Jt.records.commits},"getCommits"),_je=b(function(){let e=[...Jt.records.commits.values()];return e.forEach(function(t){se.debug(t.id)}),e.sort((t,r)=>t.seq-r.seq),e},"getCommitsArray"),SXt=b(function(){return Jt.records.currBranch},"getCurrentBranch"),EXt=b(function(){return Jt.records.direction},"getDirection"),AXt=b(function(){return Jt.records.head},"getHead"),Rje={commitType:Ai,getConfig:D2,setDirection:dXt,setOptions:pXt,getOptions:mXt,commit:gXt,branch:yXt,merge:vXt,cherryPick:xXt,checkout:Aje,prettyPrint:bXt,clear:wXt,getBranchesAsObjArray:kXt,getBranches:TXt,getCommits:CXt,getCommitsArray:_je,getCurrentBranch:SXt,getDirection:EXt,getHead:AXt,setAccTitle:Yr,getAccTitle:Qr,getAccDescription:en,setAccDescription:Jr,setDiagramTitle:ln,getDiagramTitle:tn},_Xt=b((e,t)=>{wi(e,t),e.dir&&t.setDirection(e.dir);for(let r of e.statements)RXt(r,t)},"populate"),RXt=b((e,t)=>{let n={Commit:b(i=>t.commit(LXt(i)),"Commit"),Branch:b(i=>t.branch(IXt(i)),"Branch"),Merge:b(i=>t.merge(MXt(i)),"Merge"),Checkout:b(i=>t.checkout(NXt(i)),"Checkout"),CherryPicking:b(i=>t.cherryPick(DXt(i)),"CherryPicking")}[e.$type];n?n(e):se.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),LXt=b(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?Ai[e.type]:Ai.NORMAL,tags:e.tags??void 0}),"parseCommit"),IXt=b(e=>({name:e.name,order:e.order??0}),"parseBranch"),MXt=b(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?Ai[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),NXt=b(e=>e.branch,"parseCheckout"),DXt=b(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),OXt={parse:b(async e=>{let t=await ba("gitGraph",e);se.debug(t),_Xt(t,Rje)},"parse")},Kg=10,Zg=40,kd=4,fp=2,M2=8,oO=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),mie=12,yie=new Set(["redux-color","redux-dark-color"]),PXt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),N2=b((e,t,r=!1)=>r&&e>0?(e-1)%(t-1)+1:e%t,"calcColorIndex"),mc=new Map,gc=new Map,iO=30,E6=new Map,aO=[],dp=0,Mn="LR",BXt=b(()=>{mc.clear(),gc.clear(),E6.clear(),dp=0,aO=[],Mn="LR"},"clear"),Lje=b(e=>{let t=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(n=>{let i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),i.setAttribute("dy","1em"),i.setAttribute("x","0"),i.setAttribute("class","row"),i.textContent=n.trim(),t.appendChild(i)}),t},"drawText"),Ije=b(e=>{let t,r,n;return Mn==="BT"?(r=b((i,a)=>i<=a,"comparisonFunc"),n=1/0):(r=b((i,a)=>i>=a,"comparisonFunc"),n=0),e.forEach(i=>{let a=Mn==="TB"||Mn=="BT"?gc.get(i)?.y:gc.get(i)?.x;a!==void 0&&r(a,n)&&(t=i,n=a)}),t},"findClosestParent"),FXt=b(e=>{let t="",r=1/0;return e.forEach(n=>{let i=gc.get(n).y;i<=r&&(t=n,r=i)}),t||void 0},"findClosestParentBT"),$Xt=b((e,t,r)=>{let n=r,i=r,a=[];e.forEach(s=>{let o=t.get(s);if(!o)throw new Error(`Commit not found for key ${s}`);o.parents.length?(n=GXt(o),i=Math.max(n,i)):a.push(o),qXt(o,n)}),n=i,a.forEach(s=>{VXt(s,n,r)}),e.forEach(s=>{let o=t.get(s);if(o?.parents.length){let l=FXt(o.parents);n=gc.get(l).y-Zg,n<=i&&(i=n);let u=mc.get(o.branch).pos,h=n-Kg;gc.set(o.id,{x:u,y:h})}})},"setParallelBTPos"),zXt=b(e=>{let t=Ije(e.parents.filter(n=>n!==null));if(!t)throw new Error(`Closest parent not found for commit ${e.id}`);let r=gc.get(t)?.y;if(r===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return r},"findClosestParentPos"),GXt=b(e=>zXt(e)+Zg,"calculateCommitPosition"),qXt=b((e,t)=>{let r=mc.get(e.branch);if(!r)throw new Error(`Branch not found for commit ${e.id}`);let n=r.pos,i=t+Kg;return gc.set(e.id,{x:n,y:i}),{x:n,y:i}},"setCommitPosition"),VXt=b((e,t,r)=>{let n=mc.get(e.branch);if(!n)throw new Error(`Branch not found for commit ${e.id}`);let i=t+r,a=n.pos;gc.set(e.id,{x:a,y:i})},"setRootPosition"),WXt=b((e,t,r,n,i,a)=>{let{theme:s}=Be(),o=oO.has(s??""),l=yie.has(s??""),u=PXt.has(s??"");if(a===Ai.HIGHLIGHT)e.append("rect").attr("x",r.x-10+(o?3:0)).attr("y",r.y-10+(o?3:0)).attr("width",o?14:20).attr("height",o?14:20).attr("class",`commit ${t.id} commit-highlight${N2(i,M2,l)} ${n}-outer`),e.append("rect").attr("x",r.x-6+(o?2:0)).attr("y",r.y-6+(o?2:0)).attr("width",o?8:12).attr("height",o?8:12).attr("class",`commit ${t.id} commit${N2(i,M2,l)} ${n}-inner`);else if(a===Ai.CHERRY_PICK)e.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",o?7:10).attr("class",`commit ${t.id} ${n}`),e.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",o?2.5:2.75).attr("fill",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`),e.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",o?2.5:2.75).attr("fill",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`),e.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`),e.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",u?"#000000":"#fff").attr("class",`commit ${t.id} ${n}`);else{let h=e.append("circle");if(h.attr("cx",r.x),h.attr("cy",r.y),h.attr("r",o?7:10),h.attr("class",`commit ${t.id} commit${N2(i,M2,l)}`),a===Ai.MERGE){let f=e.append("circle");f.attr("cx",r.x),f.attr("cy",r.y),f.attr("r",o?5:6),f.attr("class",`commit ${n} ${t.id} commit${N2(i,M2,l)}`)}if(a===Ai.REVERSE){let f=e.append("path"),d=o?4:5;f.attr("d",`M ${r.x-d},${r.y-d}L${r.x+d},${r.y+d}M${r.x-d},${r.y+d}L${r.x+d},${r.y-d}`).attr("class",`commit ${n} ${t.id} commit${N2(i,M2,l)}`)}}},"drawCommitBullet"),HXt=b((e,t,r,n,i)=>{if(t.type!==Ai.CHERRY_PICK&&(t.customId&&t.type===Ai.MERGE||t.type!==Ai.MERGE)&&i.showCommitLabel){let a=e.append("g"),s=a.insert("rect").attr("class","commit-label-bkg"),o=a.append("text").attr("x",n).attr("y",r.y+25).attr("class","commit-label").text(t.id),l=o.node()?.getBBox();if(l&&(s.attr("x",r.posWithOffset-l.width/2-fp).attr("y",r.y+13.5).attr("width",l.width+2*fp).attr("height",l.height+2*fp),Mn==="TB"||Mn==="BT"?(s.attr("x",r.x-(l.width+4*kd+5)).attr("y",r.y-12),o.attr("x",r.x-(l.width+4*kd)).attr("y",r.y+l.height-12)):o.attr("x",r.posWithOffset-l.width/2),i.rotateCommitLabel))if(Mn==="TB"||Mn==="BT")o.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),s.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let u=-7.5-(l.width+10)/25*9.5,h=10+l.width/25*8.5;a.attr("transform","translate("+u+", "+h+") rotate(-45, "+n+", "+r.y+")")}}},"drawCommitLabel"),UXt=b((e,t,r,n)=>{if(t.tags.length>0){let i=0,a=0,s=0,o=[];for(let l of t.tags.reverse()){let u=e.insert("polygon"),h=e.append("circle"),f=e.append("text").attr("y",r.y-16-i).attr("class","tag-label").text(l),d=f.node()?.getBBox();if(!d)throw new Error("Tag bbox not found");a=Math.max(a,d.width),s=Math.max(s,d.height),f.attr("x",r.posWithOffset-d.width/2),o.push({tag:f,hole:h,rect:u,yOffset:i}),i+=20}for(let{tag:l,hole:u,rect:h,yOffset:f}of o){let d=s/2,p=r.y-19.2-f;if(h.attr("class","tag-label-bkg").attr("points",` ${n-a/2-kd/2},${p+fp} ${n-a/2-kd/2},${p-fp} ${r.posWithOffset-a/2-kd},${p-d-fp} @@ -1320,22 +1320,22 @@ ${t}`),this.inline?`{${n}}`:n}};_(nXe,"renderInlineTag");_(iXe,"renderLinkDefaul ${r.x+Kg},${m-d-2} ${r.x+Kg+a+4},${m-d-2} ${r.x+Kg+a+4},${m+d+2} - ${r.x+Kg},${m+d+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+n+")"),u.attr("cx",r.x+kd/2).attr("cy",m).attr("transform","translate(12,12) rotate(45, "+r.x+","+n+")"),l.attr("x",r.x+5).attr("y",m+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+n+")")}}}},"drawCommitTags"),VXt=b(e=>{switch(e.customType??e.type){case Ai.NORMAL:return"commit-normal";case Ai.REVERSE:return"commit-reverse";case Ai.HIGHLIGHT:return"commit-highlight";case Ai.MERGE:return"commit-merge";case Ai.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),WXt=b((e,t,r,n)=>{let i={x:0,y:0};if(e.parents.length>0){let a=Rje(e.parents);if(a){let s=n.get(a)??i;return t==="TB"?s.y+Zg:t==="BT"?(n.get(e.id)??i).y-Zg:s.x+Zg}}else return t==="TB"?iO:t==="BT"?(n.get(e.id)??i).y-Zg:0;return 0},"calculatePosition"),HXt=b((e,t,r)=>{let n=Mn==="BT"&&r?t:t+Kg,i=pc.get(e.branch)?.pos,a=Mn==="TB"||Mn==="BT"?pc.get(e.branch)?.pos:n;if(a===void 0||i===void 0)throw new Error(`Position were undefined for commit ${e.id}`);let s=oO.has(Be().theme??""),o=Mn==="TB"||Mn==="BT"?n:i+(s?die/2+1:-2);return{x:a,y:o,posWithOffset:n}},"getCommitPosition"),Tje=b((e,t,r,n)=>{let i=e.append("g").attr("class","commit-bullets"),a=e.append("g").attr("class","commit-labels"),s=Mn==="TB"||Mn==="BT"?iO:0,o=[...t.keys()],l=n.parallelCommits??!1,u=b((f,d)=>{let p=t.get(f)?.seq,m=t.get(d)?.seq;return p!==void 0&&m!==void 0?p-m:0},"sortKeys"),h=o.sort(u);Mn==="BT"&&(l&&OXt(h,t,s),h=h.reverse()),h.forEach(f=>{let d=t.get(f);if(!d)throw new Error(`Commit not found for key ${f}`);l&&(s=WXt(d,Mn,s,mc));let p=HXt(d,s,l);if(r){let m=VXt(d),g=d.customType??d.type,y=pc.get(d.branch)?.index??0;zXt(i,d,p,m,y,g),GXt(a,d,p,s,n),qXt(a,d,p,s)}Mn==="TB"||Mn==="BT"?mc.set(d.id,{x:p.x,y:p.posWithOffset}):mc.set(d.id,{x:p.posWithOffset,y:p.y}),s=Mn==="BT"&&l?s+Zg:s+Zg+Kg,s>dp&&(dp=s)})},"drawCommits"),UXt=b((e,t,r,n,i)=>{let s=(Mn==="TB"||Mn==="BT"?r.xu.branch===s,"isOnBranchToGetCurve"),l=b(u=>u.seq>e.seq&&u.seql(u)&&o(u))},"shouldRerouteArrow"),A6=b((e,t,r=0)=>{let n=e+Math.abs(e-t)/2;if(r>5)return n;if(aO.every(s=>Math.abs(s-n)>=10))return aO.push(n),n;let a=Math.abs(e-t);return A6(e,t-a/5,r+1)},"findLane"),YXt=b((e,t,r,n)=>{let{theme:i}=Be(),a=mie.has(i??""),s=mc.get(t.id),o=mc.get(r.id);if(s===void 0||o===void 0)throw new Error(`Commit positions not found for commits ${t.id} and ${r.id}`);let l=UXt(t,r,s,o,n),u="",h="",f=0,d=0,p=pc.get(r.branch)?.index;r.type===Ai.MERGE&&t.id!==r.parents[0]&&(p=pc.get(t.branch)?.index);let m;if(l){u="A 10 10, 0, 0, 0,",h="A 10 10, 0, 0, 1,",f=10,d=10;let g=s.yo.x&&(u="A 20 20, 0, 0, 0,",h="A 20 20, 0, 0, 1,",f=20,d=20,r.type===Ai.MERGE&&t.id!==r.parents[0]?m=`M ${s.x} ${s.y} L ${s.x} ${o.y-f} ${h} ${s.x-d} ${o.y} L ${o.x} ${o.y}`:m=`M ${s.x} ${s.y} L ${o.x+f} ${s.y} ${u} ${o.x} ${s.y+d} L ${o.x} ${o.y}`),s.x===o.x&&(m=`M ${s.x} ${s.y} L ${o.x} ${o.y}`)):Mn==="BT"?(s.xo.x&&(u="A 20 20, 0, 0, 0,",h="A 20 20, 0, 0, 1,",f=20,d=20,r.type===Ai.MERGE&&t.id!==r.parents[0]?m=`M ${s.x} ${s.y} L ${s.x} ${o.y+f} ${u} ${s.x-d} ${o.y} L ${o.x} ${o.y}`:m=`M ${s.x} ${s.y} L ${o.x+f} ${s.y} ${h} ${o.x} ${s.y-d} L ${o.x} ${o.y}`),s.x===o.x&&(m=`M ${s.x} ${s.y} L ${o.x} ${o.y}`)):(s.yo.y&&(r.type===Ai.MERGE&&t.id!==r.parents[0]?m=`M ${s.x} ${s.y} L ${o.x-f} ${s.y} ${u} ${o.x} ${s.y-d} L ${o.x} ${o.y}`:m=`M ${s.x} ${s.y} L ${s.x} ${o.y+f} ${h} ${s.x+d} ${o.y} L ${o.x} ${o.y}`),s.y===o.y&&(m=`M ${s.x} ${s.y} L ${o.x} ${o.y}`));if(m===void 0)throw new Error("Line definition not found");e.append("path").attr("d",m).attr("class","arrow arrow"+N2(p,M2,a))},"drawArrow"),XXt=b((e,t)=>{let r=e.append("g").attr("class","commit-arrows");[...t.keys()].forEach(n=>{let i=t.get(n);i.parents&&i.parents.length>0&&i.parents.forEach(a=>{YXt(r,t.get(a),i,t)})})},"drawArrows"),jXt=b((e,t,r,n)=>{let{look:i,theme:a,themeVariables:s}=Be(),{dropShadow:o,THEME_COLOR_LIMIT:l}=s,u=oO.has(a??""),h=mie.has(a??""),f=e.append("g");t.forEach((d,p)=>{let m=N2(p,u?l:M2,h),g=pc.get(d.name)?.pos;if(g===void 0)throw new Error(`Position not found for branch ${d.name}`);let y=Mn==="TB"||Mn==="BT"?g:u?g+die/2+1:g-2,v=f.append("line");v.attr("x1",0),v.attr("y1",y),v.attr("x2",dp),v.attr("y2",y),v.attr("class","branch branch"+m),Mn==="TB"?(v.attr("y1",iO),v.attr("x1",g),v.attr("y2",dp),v.attr("x2",g)):Mn==="BT"&&(v.attr("y1",dp),v.attr("x1",g),v.attr("y2",iO),v.attr("x2",g)),aO.push(y);let x=d.name,w=_je(x),C=f.insert("rect"),k=f.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+m);k.node().appendChild(w);let S=w.getBBox(),E=u?0:4,I=u?16:0,L=u?die:0;i==="neo"&&C.attr("data-look","neo"),C.attr("class","branchLabelBkg label"+m).attr("style",i==="neo"?`filter:${u?`url(#${n}-drop-shadow)`:o}`:"").attr("rx",E).attr("ry",E).attr("x",-S.width-4-(r.rotateCommitLabel===!0?30:0)).attr("y",-S.height/2+10).attr("width",S.width+18+I).attr("height",S.height+4+L),k.attr("transform","translate("+(-S.width-14-(r.rotateCommitLabel===!0?30:0)+I/2)+", "+(y-S.height/2-2)+")"),Mn==="TB"?(C.attr("x",g-S.width/2-10).attr("y",0),k.attr("transform","translate("+(g-S.width/2-5)+", 0)"),u&&(C.attr("transform",`translate(${-I/2-3}, ${-L-10})`),k.attr("transform","translate("+(g-S.width/2-5)+", "+(-L*2+7)+")"))):Mn==="BT"?(C.attr("x",g-S.width/2-10).attr("y",dp),k.attr("transform","translate("+(g-S.width/2-5)+", "+dp+")"),u&&(C.attr("transform",`translate(${-I/2-3}, ${L+10})`),k.attr("transform","translate("+(g-S.width/2-5)+", "+(dp+L*2+4)+")"))):C.attr("transform","translate(-19, "+(y-12-L/2)+")")})},"drawBranches"),KXt=b(function(e,t,r,n,i){return pc.set(e,{pos:t,index:r}),t+=50+(i?40:0)+(Mn==="TB"||Mn==="BT"?n.width/2:0),t},"setBranchPosition"),ZXt=b(function(e,t,r,n){NXt(),se.debug("in gitgraph renderer",e+` -`,"id:",t,r);let i=n.db;if(!i.getConfig){se.error("getConfig method is not available on db");return}let a=i.getConfig(),s=a.rotateCommitLabel??!1;E6=i.getCommits();let o=i.getBranchesAsObjArray();Mn=i.getDirection();let l=ct(`[id="${t}"]`),{look:u,theme:h,themeVariables:f}=Be(),{useGradient:d,gradientStart:p,gradientStop:m,filterColor:g}=f;if(d){let v=l.append("defs").append("linearGradient").attr("id",t+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");v.append("stop").attr("offset","0%").attr("stop-color",p).attr("stop-opacity",1),v.append("stop").attr("offset","100%").attr("stop-color",m).attr("stop-opacity",1)}u==="neo"&&oO.has(h??"")&&l.append("defs").append("filter").attr("id",t+"-drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",g);let y=0;o.forEach((v,x)=>{let w=_je(v.name),C=l.append("g"),T=C.insert("g").attr("class","branchLabel"),k=T.insert("g").attr("class","label branch-label");k.node()?.appendChild(w);let S=w.getBBox();y=KXt(v.name,y,x,S,s),k.remove(),T.remove(),C.remove()}),Tje(l,E6,!1,a),a.showBranches&&jXt(l,o,a,t),XXt(l,E6),Tje(l,E6,!0,a),pr.insertTitle(l,"gitTitleText",a.titleTopMargin??0,i.getDiagramTitle()),B5(void 0,l,a.diagramPadding,a.useMaxWidth)},"draw"),QXt={draw:ZXt},Lje=8,Ije=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),JXt=new Set(["redux-color","redux-dark-color"]),ejt=new Set(["neo","neo-dark"]),tjt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),rjt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),njt=b(e=>{let{svgId:t}=e,r="";if(e.useGradient&&t)for(let n=0;n{switch(e.customType??e.type){case Ai.NORMAL:return"commit-normal";case Ai.REVERSE:return"commit-reverse";case Ai.HIGHLIGHT:return"commit-highlight";case Ai.MERGE:return"commit-merge";case Ai.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),XXt=b((e,t,r,n)=>{let i={x:0,y:0};if(e.parents.length>0){let a=Ije(e.parents);if(a){let s=n.get(a)??i;return t==="TB"?s.y+Zg:t==="BT"?(n.get(e.id)??i).y-Zg:s.x+Zg}}else return t==="TB"?iO:t==="BT"?(n.get(e.id)??i).y-Zg:0;return 0},"calculatePosition"),jXt=b((e,t,r)=>{let n=Mn==="BT"&&r?t:t+Kg,i=mc.get(e.branch)?.pos,a=Mn==="TB"||Mn==="BT"?mc.get(e.branch)?.pos:n;if(a===void 0||i===void 0)throw new Error(`Position were undefined for commit ${e.id}`);let s=oO.has(Be().theme??""),o=Mn==="TB"||Mn==="BT"?n:i+(s?mie/2+1:-2);return{x:a,y:o,posWithOffset:n}},"getCommitPosition"),Sje=b((e,t,r,n)=>{let i=e.append("g").attr("class","commit-bullets"),a=e.append("g").attr("class","commit-labels"),s=Mn==="TB"||Mn==="BT"?iO:0,o=[...t.keys()],l=n.parallelCommits??!1,u=b((f,d)=>{let p=t.get(f)?.seq,m=t.get(d)?.seq;return p!==void 0&&m!==void 0?p-m:0},"sortKeys"),h=o.sort(u);Mn==="BT"&&(l&&$Xt(h,t,s),h=h.reverse()),h.forEach(f=>{let d=t.get(f);if(!d)throw new Error(`Commit not found for key ${f}`);l&&(s=XXt(d,Mn,s,gc));let p=jXt(d,s,l);if(r){let m=YXt(d),g=d.customType??d.type,y=mc.get(d.branch)?.index??0;WXt(i,d,p,m,y,g),HXt(a,d,p,s,n),UXt(a,d,p,s)}Mn==="TB"||Mn==="BT"?gc.set(d.id,{x:p.x,y:p.posWithOffset}):gc.set(d.id,{x:p.posWithOffset,y:p.y}),s=Mn==="BT"&&l?s+Zg:s+Zg+Kg,s>dp&&(dp=s)})},"drawCommits"),KXt=b((e,t,r,n,i)=>{let s=(Mn==="TB"||Mn==="BT"?r.xu.branch===s,"isOnBranchToGetCurve"),l=b(u=>u.seq>e.seq&&u.seql(u)&&o(u))},"shouldRerouteArrow"),A6=b((e,t,r=0)=>{let n=e+Math.abs(e-t)/2;if(r>5)return n;if(aO.every(s=>Math.abs(s-n)>=10))return aO.push(n),n;let a=Math.abs(e-t);return A6(e,t-a/5,r+1)},"findLane"),ZXt=b((e,t,r,n)=>{let{theme:i}=Be(),a=yie.has(i??""),s=gc.get(t.id),o=gc.get(r.id);if(s===void 0||o===void 0)throw new Error(`Commit positions not found for commits ${t.id} and ${r.id}`);let l=KXt(t,r,s,o,n),u="",h="",f=0,d=0,p=mc.get(r.branch)?.index;r.type===Ai.MERGE&&t.id!==r.parents[0]&&(p=mc.get(t.branch)?.index);let m;if(l){u="A 10 10, 0, 0, 0,",h="A 10 10, 0, 0, 1,",f=10,d=10;let g=s.yo.x&&(u="A 20 20, 0, 0, 0,",h="A 20 20, 0, 0, 1,",f=20,d=20,r.type===Ai.MERGE&&t.id!==r.parents[0]?m=`M ${s.x} ${s.y} L ${s.x} ${o.y-f} ${h} ${s.x-d} ${o.y} L ${o.x} ${o.y}`:m=`M ${s.x} ${s.y} L ${o.x+f} ${s.y} ${u} ${o.x} ${s.y+d} L ${o.x} ${o.y}`),s.x===o.x&&(m=`M ${s.x} ${s.y} L ${o.x} ${o.y}`)):Mn==="BT"?(s.xo.x&&(u="A 20 20, 0, 0, 0,",h="A 20 20, 0, 0, 1,",f=20,d=20,r.type===Ai.MERGE&&t.id!==r.parents[0]?m=`M ${s.x} ${s.y} L ${s.x} ${o.y+f} ${u} ${s.x-d} ${o.y} L ${o.x} ${o.y}`:m=`M ${s.x} ${s.y} L ${o.x+f} ${s.y} ${h} ${o.x} ${s.y-d} L ${o.x} ${o.y}`),s.x===o.x&&(m=`M ${s.x} ${s.y} L ${o.x} ${o.y}`)):(s.yo.y&&(r.type===Ai.MERGE&&t.id!==r.parents[0]?m=`M ${s.x} ${s.y} L ${o.x-f} ${s.y} ${u} ${o.x} ${s.y-d} L ${o.x} ${o.y}`:m=`M ${s.x} ${s.y} L ${s.x} ${o.y+f} ${h} ${s.x+d} ${o.y} L ${o.x} ${o.y}`),s.y===o.y&&(m=`M ${s.x} ${s.y} L ${o.x} ${o.y}`));if(m===void 0)throw new Error("Line definition not found");e.append("path").attr("d",m).attr("class","arrow arrow"+N2(p,M2,a))},"drawArrow"),QXt=b((e,t)=>{let r=e.append("g").attr("class","commit-arrows");[...t.keys()].forEach(n=>{let i=t.get(n);i.parents&&i.parents.length>0&&i.parents.forEach(a=>{ZXt(r,t.get(a),i,t)})})},"drawArrows"),JXt=b((e,t,r,n)=>{let{look:i,theme:a,themeVariables:s}=Be(),{dropShadow:o,THEME_COLOR_LIMIT:l}=s,u=oO.has(a??""),h=yie.has(a??""),f=e.append("g");t.forEach((d,p)=>{let m=N2(p,u?l:M2,h),g=mc.get(d.name)?.pos;if(g===void 0)throw new Error(`Position not found for branch ${d.name}`);let y=Mn==="TB"||Mn==="BT"?g:u?g+mie/2+1:g-2,v=f.append("line");v.attr("x1",0),v.attr("y1",y),v.attr("x2",dp),v.attr("y2",y),v.attr("class","branch branch"+m),Mn==="TB"?(v.attr("y1",iO),v.attr("x1",g),v.attr("y2",dp),v.attr("x2",g)):Mn==="BT"&&(v.attr("y1",dp),v.attr("x1",g),v.attr("y2",iO),v.attr("x2",g)),aO.push(y);let x=d.name,w=Lje(x),C=f.insert("rect"),k=f.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+m);k.node().appendChild(w);let S=w.getBBox(),E=u?0:4,I=u?16:0,L=u?mie:0;i==="neo"&&C.attr("data-look","neo"),C.attr("class","branchLabelBkg label"+m).attr("style",i==="neo"?`filter:${u?`url(#${n}-drop-shadow)`:o}`:"").attr("rx",E).attr("ry",E).attr("x",-S.width-4-(r.rotateCommitLabel===!0?30:0)).attr("y",-S.height/2+10).attr("width",S.width+18+I).attr("height",S.height+4+L),k.attr("transform","translate("+(-S.width-14-(r.rotateCommitLabel===!0?30:0)+I/2)+", "+(y-S.height/2-2)+")"),Mn==="TB"?(C.attr("x",g-S.width/2-10).attr("y",0),k.attr("transform","translate("+(g-S.width/2-5)+", 0)"),u&&(C.attr("transform",`translate(${-I/2-3}, ${-L-10})`),k.attr("transform","translate("+(g-S.width/2-5)+", "+(-L*2+7)+")"))):Mn==="BT"?(C.attr("x",g-S.width/2-10).attr("y",dp),k.attr("transform","translate("+(g-S.width/2-5)+", "+dp+")"),u&&(C.attr("transform",`translate(${-I/2-3}, ${L+10})`),k.attr("transform","translate("+(g-S.width/2-5)+", "+(dp+L*2+4)+")"))):C.attr("transform","translate(-19, "+(y-12-L/2)+")")})},"drawBranches"),ejt=b(function(e,t,r,n,i){return mc.set(e,{pos:t,index:r}),t+=50+(i?40:0)+(Mn==="TB"||Mn==="BT"?n.width/2:0),t},"setBranchPosition"),tjt=b(function(e,t,r,n){BXt(),se.debug("in gitgraph renderer",e+` +`,"id:",t,r);let i=n.db;if(!i.getConfig){se.error("getConfig method is not available on db");return}let a=i.getConfig(),s=a.rotateCommitLabel??!1;E6=i.getCommits();let o=i.getBranchesAsObjArray();Mn=i.getDirection();let l=ct(`[id="${t}"]`),{look:u,theme:h,themeVariables:f}=Be(),{useGradient:d,gradientStart:p,gradientStop:m,filterColor:g}=f;if(d){let v=l.append("defs").append("linearGradient").attr("id",t+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");v.append("stop").attr("offset","0%").attr("stop-color",p).attr("stop-opacity",1),v.append("stop").attr("offset","100%").attr("stop-color",m).attr("stop-opacity",1)}u==="neo"&&oO.has(h??"")&&l.append("defs").append("filter").attr("id",t+"-drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",g);let y=0;o.forEach((v,x)=>{let w=Lje(v.name),C=l.append("g"),T=C.insert("g").attr("class","branchLabel"),k=T.insert("g").attr("class","label branch-label");k.node()?.appendChild(w);let S=w.getBBox();y=ejt(v.name,y,x,S,s),k.remove(),T.remove(),C.remove()}),Sje(l,E6,!1,a),a.showBranches&&JXt(l,o,a,t),QXt(l,E6),Sje(l,E6,!0,a),pr.insertTitle(l,"gitTitleText",a.titleTopMargin??0,i.getDiagramTitle()),B5(void 0,l,a.diagramPadding,a.useMaxWidth)},"draw"),rjt={draw:tjt},Mje=8,Nje=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),njt=new Set(["redux-color","redux-dark-color"]),ijt=new Set(["neo","neo-dark"]),ajt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),sjt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),ojt=b(e=>{let{svgId:t}=e,r="";if(e.useGradient&&t)for(let n=0;n{let t=qt(),{theme:r,themeVariables:n}=t,{borderColorArray:i}=n,a=Ije.has(r);if(ejt.has(r)){let s="";for(let o=0;o{let t=qt(),{theme:r,themeVariables:n}=t,{borderColorArray:i}=n,a=Nje.has(r);if(ijt.has(r)){let s="";for(let o=0;o`${Array.from({length:e.THEME_COLOR_LIMIT},(t,r)=>r).map(t=>{let r=t%Lje;return` + `;return s}},"genColor"),cjt=b(e=>`${Array.from({length:e.THEME_COLOR_LIMIT},(t,r)=>r).map(t=>{let r=t%Mje;return` .branch-label${t} { fill: ${e["gitBranchLabel"+r]}; } .commit${t} { stroke: ${e["git"+r]}; fill: ${e["git"+r]}; } .commit-highlight${t} { stroke: ${e["gitInv"+r]}; fill: ${e["gitInv"+r]}; } .label${t} { fill: ${e["git"+r]}; } .arrow${t} { stroke: ${e["git"+r]}; } `}).join(` -`)}`,"normalTheme"),sjt=b(e=>{let t=qt(),{theme:r}=t,n=rjt.has(r);return` +`)}`,"normalTheme"),ujt=b(e=>{let t=qt(),{theme:r}=t,n=sjt.has(r);return` .commit-id, .commit-msg, .branch-label { @@ -1373,7 +1373,7 @@ ${t}`),this.inline?`{${n}}`:n}};_(nXe,"renderInlineTag");_(iXe,"renderLinkDefaul font-family: var(--mermaid-font-family); } - ${n?ijt(e):ajt(e)} + ${n?ljt(e):cjt(e)} .branch { stroke-width: ${e.strokeWidth}; @@ -1404,7 +1404,7 @@ ${t}`),this.inline?`{${n}}`:n}};_(nXe,"renderInlineTag");_(iXe,"renderLinkDefaul .arrow { /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */ - stroke-width: ${Ije.has(r)?e.strokeWidth:8}; + stroke-width: ${Nje.has(r)?e.strokeWidth:8}; stroke-linecap: round; fill: none } @@ -1413,12 +1413,12 @@ ${t}`),this.inline?`{${n}}`:n}};_(nXe,"renderInlineTag");_(iXe,"renderLinkDefaul font-size: 18px; fill: ${e.textColor}; } -`},"getStyles"),ojt=sjt,ljt={parser:IXt,db:Aje,renderer:QXt,styles:ojt}});var Dje=Qo((gie,yie)=>{(function(e,t){typeof gie=="object"&&typeof yie<"u"?yie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_isoWeek=t()})(gie,(function(){"use strict";var e="day";return function(t,r,n){var i=function(o){return o.add(4-o.isoWeekday(),e)},a=r.prototype;a.isoWeekYear=function(){return i(this).year()},a.isoWeek=function(o){if(!this.$utils().u(o))return this.add(7*(o-this.isoWeek()),e);var l,u,h,f,d=i(this),p=(l=this.isoWeekYear(),u=this.$u,h=(u?n.utc:n)().year(l).startOf("year"),f=4-h.isoWeekday(),h.isoWeekday()>4&&(f+=7),h.add(f,e));return d.diff(p,"week")+1},a.isoWeekday=function(o){return this.$utils().u(o)?this.day()||7:this.day(this.day()%7?o:o-7)};var s=a.startOf;a.startOf=function(o,l){var u=this.$utils(),h=!!u.u(l)||l;return u.p(o)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):s.bind(this)(o,l)}}}))});var Oje=Qo((vie,xie)=>{(function(e,t){typeof vie=="object"&&typeof xie<"u"?xie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_customParseFormat=t()})(vie,(function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},o=function(m){return(m=+m)+(m>68?1900:2e3)},l=function(m){return function(g){this[m]=+g}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(g){if(!g||g==="Z")return 0;var y=g.match(/([+-]|\d\d)/g),v=60*y[1]+(+y[2]||0);return v===0?0:y[0]==="+"?-v:v})(m)}],h=function(m){var g=s[m];return g&&(g.indexOf?g:g.s.concat(g.f))},f=function(m,g){var y,v=s.meridiem;if(v){for(var x=1;x<=24;x+=1)if(m.indexOf(v(x,0,g))>-1){y=x>12;break}}else y=m===(g?"pm":"PM");return y},d={A:[a,function(m){this.afternoon=f(m,!1)}],a:[a,function(m){this.afternoon=f(m,!0)}],Q:[r,function(m){this.month=3*(m-1)+1}],S:[r,function(m){this.milliseconds=100*+m}],SS:[n,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[i,l("seconds")],ss:[i,l("seconds")],m:[i,l("minutes")],mm:[i,l("minutes")],H:[i,l("hours")],h:[i,l("hours")],HH:[i,l("hours")],hh:[i,l("hours")],D:[i,l("day")],DD:[n,l("day")],Do:[a,function(m){var g=s.ordinal,y=m.match(/\d+/);if(this.day=y[0],g)for(var v=1;v<=31;v+=1)g(v).replace(/\[|\]/g,"")===m&&(this.day=v)}],w:[i,l("week")],ww:[n,l("week")],M:[i,l("month")],MM:[n,l("month")],MMM:[a,function(m){var g=h("months"),y=(h("monthsShort")||g.map((function(v){return v.slice(0,3)}))).indexOf(m)+1;if(y<1)throw new Error;this.month=y%12||y}],MMMM:[a,function(m){var g=h("months").indexOf(m)+1;if(g<1)throw new Error;this.month=g%12||g}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(m){this.year=o(m)}],YYYY:[/\d{4}/,l("year")],Z:u,ZZ:u};function p(m){var g,y;g=m,y=s&&s.formats;for(var v=(m=g.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(E,I,L){var O=L&&L.toUpperCase();return I||y[L]||e[L]||y[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(R,A,N){return A||N.slice(1)}))}))).match(t),x=v.length,w=0;w-1)return new Date((D==="X"?1e3:1)*M);var $=p(D)(M),F=$.year,q=$.month,G=$.day,z=$.hours,H=$.minutes,j=$.seconds,J=$.milliseconds,U=$.zone,le=$.week,ee=new Date,ue=G||(F||q?1:ee.getDate()),ae=F||ee.getFullYear(),oe=0;F&&!q||(oe=q>0?q-1:ee.getMonth());var Re,Te=z||0,Oe=H||0,qe=j||0,Ge=J||0;return U?new Date(Date.UTC(ae,oe,ue,Te,Oe,qe,Ge+60*U.offset*1e3)):B?new Date(Date.UTC(ae,oe,ue,Te,Oe,qe,Ge)):(Re=new Date(ae,oe,ue,Te,Oe,qe,Ge),le&&(Re=P(Re).week(le).toDate()),Re)}catch{return new Date("")}})(C,S,T,y),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),L&&C!=this.format(S)&&(this.$d=new Date("")),s={}}else if(S instanceof Array)for(var R=S.length,A=1;A<=R;A+=1){k[1]=S[A-1];var N=y.apply(this,k);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}A===R&&(this.$d=new Date(""))}else x.call(this,w)}}}))});var Pje=Qo((bie,wie)=>{(function(e,t){typeof bie=="object"&&typeof wie<"u"?wie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_advancedFormat=t()})(bie,(function(){"use strict";return function(e,t){var r=t.prototype,n=r.format;r.format=function(i){var a=this,s=this.$locale();if(!this.isValid())return n.bind(this)(i);var o=this.$utils(),l=(i||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(u){switch(u){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return s.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return s.ordinal(a.week(),"W");case"w":case"ww":return o.s(a.week(),u==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),u==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),u==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return u}}));return n.bind(this)(l)}}}))});var Bje=Qo((kie,Tie)=>{(function(e,t){typeof kie=="object"&&typeof Tie<"u"?Tie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_duration=t()})(kie,(function(){"use strict";var e,t,r=1e3,n=6e4,i=36e5,a=864e5,s=31536e6,o=2628e6,l=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,u=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,h={years:s,months:o,days:a,hours:i,minutes:n,seconds:r,milliseconds:1,weeks:6048e5},f=function(C){return C instanceof x},d=function(C,T,k){return new x(C,k,T.$l)},p=function(C){return t.p(C)+"s"},m=function(C){return C<0},g=function(C){return m(C)?Math.ceil(C):Math.floor(C)},y=function(C){return Math.abs(C)},v=function(C,T){return C?m(C)?{negative:!0,format:""+y(C)+T}:{negative:!1,format:""+C+T}:{negative:!1,format:""}},x=(function(){function C(k,S,E){var I=this;if(this.$d={},this.$l=E,k===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return d(k*h[p(S)],this);if(typeof k=="number")return this.$ms=k,this.parseFromMilliseconds(),this;if(typeof k=="object")return Object.keys(k).forEach((function(R){I.$d[p(R)]=k[R]})),this.calMilliseconds(),this;if(typeof k=="string"){var L=k.match(l);if(L){var O=L.slice(2).map((function(R){return R!=null?Number(R):0}));return this.$d.years=O[0],this.$d.months=O[1],this.$d.weeks=O[2],this.$d.days=O[3],this.$d.hours=O[4],this.$d.minutes=O[5],this.$d.seconds=O[6],this.calMilliseconds(),this}}return this}var T=C.prototype;return T.calMilliseconds=function(){var k=this;this.$ms=Object.keys(this.$d).reduce((function(S,E){return S+(k.$d[E]||0)*h[E]}),0)},T.parseFromMilliseconds=function(){var k=this.$ms;this.$d.years=g(k/s),k%=s,this.$d.months=g(k/o),k%=o,this.$d.days=g(k/a),k%=a,this.$d.hours=g(k/i),k%=i,this.$d.minutes=g(k/n),k%=n,this.$d.seconds=g(k/r),k%=r,this.$d.milliseconds=k},T.toISOString=function(){var k=v(this.$d.years,"Y"),S=v(this.$d.months,"M"),E=+this.$d.days||0;this.$d.weeks&&(E+=7*this.$d.weeks);var I=v(E,"D"),L=v(this.$d.hours,"H"),O=v(this.$d.minutes,"M"),R=this.$d.seconds||0;this.$d.milliseconds&&(R+=this.$d.milliseconds/1e3,R=Math.round(1e3*R)/1e3);var A=v(R,"S"),N=k.negative||S.negative||I.negative||L.negative||O.negative||A.negative,M=L.format||O.format||A.format?"T":"",D=(N?"-":"")+"P"+k.format+S.format+I.format+M+L.format+O.format+A.format;return D==="P"||D==="-P"?"P0D":D},T.toJSON=function(){return this.toISOString()},T.format=function(k){var S=k||"YYYY-MM-DDTHH:mm:ss",E={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return S.replace(u,(function(I,L){return L||String(E[I])}))},T.as=function(k){return this.$ms/h[p(k)]},T.get=function(k){var S=this.$ms,E=p(k);return E==="milliseconds"?S%=1e3:S=E==="weeks"?g(S/h[E]):this.$d[E],S||0},T.add=function(k,S,E){var I;return I=S?k*h[p(S)]:f(k)?k.$ms:d(k,this).$ms,d(this.$ms+I*(E?-1:1),this)},T.subtract=function(k,S){return this.add(k,S,!0)},T.locale=function(k){var S=this.clone();return S.$l=k,S},T.clone=function(){return d(this.$ms,this)},T.humanize=function(k){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!k)},T.valueOf=function(){return this.asMilliseconds()},T.milliseconds=function(){return this.get("milliseconds")},T.asMilliseconds=function(){return this.as("milliseconds")},T.seconds=function(){return this.get("seconds")},T.asSeconds=function(){return this.as("seconds")},T.minutes=function(){return this.get("minutes")},T.asMinutes=function(){return this.as("minutes")},T.hours=function(){return this.get("hours")},T.asHours=function(){return this.as("hours")},T.days=function(){return this.get("days")},T.asDays=function(){return this.as("days")},T.weeks=function(){return this.get("weeks")},T.asWeeks=function(){return this.as("weeks")},T.months=function(){return this.get("months")},T.asMonths=function(){return this.as("months")},T.years=function(){return this.get("years")},T.asYears=function(){return this.as("years")},C})(),w=function(C,T,k){return C.add(T.years()*k,"y").add(T.months()*k,"M").add(T.days()*k,"d").add(T.hours()*k,"h").add(T.minutes()*k,"m").add(T.seconds()*k,"s").add(T.milliseconds()*k,"ms")};return function(C,T,k){e=k,t=k().$utils(),k.duration=function(I,L){var O=k.locale();return d(I,{$l:O},L)},k.isDuration=f;var S=T.prototype.add,E=T.prototype.subtract;T.prototype.add=function(I,L){return f(I)?w(this,I,1):S.bind(this)(I,L)},T.prototype.subtract=function(I,L){return f(I)?w(this,I,-1):E.bind(this)(I,L)}}}))});var tKe={};Tr(tKe,{diagram:()=>Jjt});function Fie(e,t,r){let n=!0;for(;n;)n=!1,r.forEach(function(i){let a="^\\s*"+i+"\\s*$",s=new RegExp(a);e[0].match(s)&&(t[i]=!0,e.shift(1),n=!0)})}var Gje,tu,qje,Vje,Wje,nk,eKe,Sie,cjt,Fje,Td,Rie,Lie,Iie,ak,sk,Mie,Nie,uO,ok,Die,Hje,Oie,rk,_6,Pie,Bie,hO,Eie,ujt,hjt,fjt,djt,pjt,mjt,gjt,yjt,vjt,xjt,bjt,wjt,kjt,Tjt,Cjt,Sjt,Uje,Ejt,Ajt,_jt,Rjt,Ljt,Ijt,Mjt,Njt,Yje,Djt,Ojt,Pjt,Xje,Bjt,Aie,jje,Kje,lO,ik,Fjt,$jt,_ie,cO,As,Zje,zjt,O2,Gjt,$je,qjt,Qje,Vjt,Jje,Wjt,Hjt,Ujt,Yjt,zje,Xjt,pp,Cie,jjt,Kjt,Zjt,Qjt,Jjt,rKe=W(()=>{Sn();_r();Rr();hr();Gje=Ro(n4(),1),tu=Ro(hA(),1),qje=Ro(Dje(),1),Vje=Ro(Oje(),1),Wje=Ro(Pje(),1),nk=Ro(hA(),1),eKe=Ro(Bje(),1);fn();Sie=(function(){var e=b(function(A,N,M,D){for(M=M||{},D=A.length;D--;M[A[D]]=N);return M},"o"),t=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],r=[1,26],n=[1,27],i=[1,28],a=[1,29],s=[1,30],o=[1,31],l=[1,32],u=[1,33],h=[1,34],f=[1,9],d=[1,10],p=[1,11],m=[1,12],g=[1,13],y=[1,14],v=[1,15],x=[1,16],w=[1,19],C=[1,20],T=[1,21],k=[1,22],S=[1,23],E=[1,25],I=[1,35],L={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:b(function(N,M,D,B,P,$,F){var q=$.length-1;switch(P){case 1:return $[q-1];case 2:this.$=[];break;case 3:$[q-1].push($[q]),this.$=$[q-1];break;case 4:case 5:this.$=$[q];break;case 6:case 7:this.$=[];break;case 8:B.setWeekday("monday");break;case 9:B.setWeekday("tuesday");break;case 10:B.setWeekday("wednesday");break;case 11:B.setWeekday("thursday");break;case 12:B.setWeekday("friday");break;case 13:B.setWeekday("saturday");break;case 14:B.setWeekday("sunday");break;case 15:B.setWeekend("friday");break;case 16:B.setWeekend("saturday");break;case 17:B.setDateFormat($[q].substr(11)),this.$=$[q].substr(11);break;case 18:B.enableInclusiveEndDates(),this.$=$[q].substr(18);break;case 19:B.TopAxis(),this.$=$[q].substr(8);break;case 20:B.setAxisFormat($[q].substr(11)),this.$=$[q].substr(11);break;case 21:B.setTickInterval($[q].substr(13)),this.$=$[q].substr(13);break;case 22:B.setExcludes($[q].substr(9)),this.$=$[q].substr(9);break;case 23:B.setIncludes($[q].substr(9)),this.$=$[q].substr(9);break;case 24:B.setTodayMarker($[q].substr(12)),this.$=$[q].substr(12);break;case 27:B.setDiagramTitle($[q].substr(6)),this.$=$[q].substr(6);break;case 28:this.$=$[q].trim(),B.setAccTitle(this.$);break;case 29:case 30:this.$=$[q].trim(),B.setAccDescription(this.$);break;case 31:B.addSection($[q].substr(8)),this.$=$[q].substr(8);break;case 33:B.addTask($[q-1],$[q]),this.$="task";break;case 34:this.$=$[q-1],B.setClickEvent($[q-1],$[q],null);break;case 35:this.$=$[q-2],B.setClickEvent($[q-2],$[q-1],$[q]);break;case 36:this.$=$[q-2],B.setClickEvent($[q-2],$[q-1],null),B.setLink($[q-2],$[q]);break;case 37:this.$=$[q-3],B.setClickEvent($[q-3],$[q-2],$[q-1]),B.setLink($[q-3],$[q]);break;case 38:this.$=$[q-2],B.setClickEvent($[q-2],$[q],null),B.setLink($[q-2],$[q-1]);break;case 39:this.$=$[q-3],B.setClickEvent($[q-3],$[q-1],$[q]),B.setLink($[q-3],$[q-2]);break;case 40:this.$=$[q-1],B.setLink($[q-1],$[q]);break;case 41:case 47:this.$=$[q-1]+" "+$[q];break;case 42:case 43:case 45:this.$=$[q-2]+" "+$[q-1]+" "+$[q];break;case 44:case 46:this.$=$[q-3]+" "+$[q-2]+" "+$[q-1]+" "+$[q];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:r,13:n,14:i,15:a,16:s,17:o,18:l,19:18,20:u,21:h,22:f,23:d,24:p,25:m,26:g,27:y,28:v,29:x,30:w,31:C,33:T,35:k,36:S,37:24,38:E,40:I},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:36,11:17,12:r,13:n,14:i,15:a,16:s,17:o,18:l,19:18,20:u,21:h,22:f,23:d,24:p,25:m,26:g,27:y,28:v,29:x,30:w,31:C,33:T,35:k,36:S,37:24,38:E,40:I},e(t,[2,5]),e(t,[2,6]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,20]),e(t,[2,21]),e(t,[2,22]),e(t,[2,23]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),e(t,[2,27]),{32:[1,37]},{34:[1,38]},e(t,[2,30]),e(t,[2,31]),e(t,[2,32]),{39:[1,39]},e(t,[2,8]),e(t,[2,9]),e(t,[2,10]),e(t,[2,11]),e(t,[2,12]),e(t,[2,13]),e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),{41:[1,40],43:[1,41]},e(t,[2,4]),e(t,[2,28]),e(t,[2,29]),e(t,[2,33]),e(t,[2,34],{42:[1,42],43:[1,43]}),e(t,[2,40],{41:[1,44]}),e(t,[2,35],{43:[1,45]}),e(t,[2,36]),e(t,[2,38],{42:[1,46]}),e(t,[2,37]),e(t,[2,39])],defaultActions:{},parseError:b(function(N,M){if(M.recoverable)this.trace(N);else{var D=new Error(N);throw D.hash=M,D}},"parseError"),parse:b(function(N){var M=this,D=[0],B=[],P=[null],$=[],F=this.table,q="",G=0,z=0,H=0,j=2,J=1,U=$.slice.call(arguments,1),le=Object.create(this.lexer),ee={yy:{}};for(var ue in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ue)&&(ee.yy[ue]=this.yy[ue]);le.setInput(N,ee.yy),ee.yy.lexer=le,ee.yy.parser=this,typeof le.yylloc>"u"&&(le.yylloc={});var ae=le.yylloc;$.push(ae);var oe=le.options&&le.options.ranges;typeof ee.yy.parseError=="function"?this.parseError=ee.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Re(ge){D.length=D.length-2*ge,P.length=P.length-ge,$.length=$.length-ge}b(Re,"popStack");function Te(){var ge;return ge=B.pop()||le.lex()||J,typeof ge!="number"&&(ge instanceof Array&&(B=ge,ge=B.pop()),ge=M.symbols_[ge]||ge),ge}b(Te,"lex");for(var Oe,qe,Ge,fe,Ce,_e,de={},ie,Q,he,xe;;){if(Ge=D[D.length-1],this.defaultActions[Ge]?fe=this.defaultActions[Ge]:((Oe===null||typeof Oe>"u")&&(Oe=Te()),fe=F[Ge]&&F[Ge][Oe]),typeof fe>"u"||!fe.length||!fe[0]){var ce="";xe=[];for(ie in F[Ge])this.terminals_[ie]&&ie>j&&xe.push("'"+this.terminals_[ie]+"'");le.showPosition?ce="Parse error on line "+(G+1)+`: +`},"getStyles"),hjt=ujt,fjt={parser:OXt,db:Rje,renderer:rjt,styles:hjt}});var Pje=Jo((vie,xie)=>{(function(e,t){typeof vie=="object"&&typeof xie<"u"?xie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_isoWeek=t()})(vie,(function(){"use strict";var e="day";return function(t,r,n){var i=function(o){return o.add(4-o.isoWeekday(),e)},a=r.prototype;a.isoWeekYear=function(){return i(this).year()},a.isoWeek=function(o){if(!this.$utils().u(o))return this.add(7*(o-this.isoWeek()),e);var l,u,h,f,d=i(this),p=(l=this.isoWeekYear(),u=this.$u,h=(u?n.utc:n)().year(l).startOf("year"),f=4-h.isoWeekday(),h.isoWeekday()>4&&(f+=7),h.add(f,e));return d.diff(p,"week")+1},a.isoWeekday=function(o){return this.$utils().u(o)?this.day()||7:this.day(this.day()%7?o:o-7)};var s=a.startOf;a.startOf=function(o,l){var u=this.$utils(),h=!!u.u(l)||l;return u.p(o)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):s.bind(this)(o,l)}}}))});var Bje=Jo((bie,wie)=>{(function(e,t){typeof bie=="object"&&typeof wie<"u"?wie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_customParseFormat=t()})(bie,(function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},o=function(m){return(m=+m)+(m>68?1900:2e3)},l=function(m){return function(g){this[m]=+g}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(g){if(!g||g==="Z")return 0;var y=g.match(/([+-]|\d\d)/g),v=60*y[1]+(+y[2]||0);return v===0?0:y[0]==="+"?-v:v})(m)}],h=function(m){var g=s[m];return g&&(g.indexOf?g:g.s.concat(g.f))},f=function(m,g){var y,v=s.meridiem;if(v){for(var x=1;x<=24;x+=1)if(m.indexOf(v(x,0,g))>-1){y=x>12;break}}else y=m===(g?"pm":"PM");return y},d={A:[a,function(m){this.afternoon=f(m,!1)}],a:[a,function(m){this.afternoon=f(m,!0)}],Q:[r,function(m){this.month=3*(m-1)+1}],S:[r,function(m){this.milliseconds=100*+m}],SS:[n,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[i,l("seconds")],ss:[i,l("seconds")],m:[i,l("minutes")],mm:[i,l("minutes")],H:[i,l("hours")],h:[i,l("hours")],HH:[i,l("hours")],hh:[i,l("hours")],D:[i,l("day")],DD:[n,l("day")],Do:[a,function(m){var g=s.ordinal,y=m.match(/\d+/);if(this.day=y[0],g)for(var v=1;v<=31;v+=1)g(v).replace(/\[|\]/g,"")===m&&(this.day=v)}],w:[i,l("week")],ww:[n,l("week")],M:[i,l("month")],MM:[n,l("month")],MMM:[a,function(m){var g=h("months"),y=(h("monthsShort")||g.map((function(v){return v.slice(0,3)}))).indexOf(m)+1;if(y<1)throw new Error;this.month=y%12||y}],MMMM:[a,function(m){var g=h("months").indexOf(m)+1;if(g<1)throw new Error;this.month=g%12||g}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(m){this.year=o(m)}],YYYY:[/\d{4}/,l("year")],Z:u,ZZ:u};function p(m){var g,y;g=m,y=s&&s.formats;for(var v=(m=g.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(E,I,L){var O=L&&L.toUpperCase();return I||y[L]||e[L]||y[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(R,A,N){return A||N.slice(1)}))}))).match(t),x=v.length,w=0;w-1)return new Date((D==="X"?1e3:1)*M);var $=p(D)(M),F=$.year,q=$.month,G=$.day,z=$.hours,H=$.minutes,j=$.seconds,J=$.milliseconds,U=$.zone,le=$.week,ee=new Date,ue=G||(F||q?1:ee.getDate()),ae=F||ee.getFullYear(),oe=0;F&&!q||(oe=q>0?q-1:ee.getMonth());var Re,Te=z||0,Oe=H||0,qe=j||0,Ge=J||0;return U?new Date(Date.UTC(ae,oe,ue,Te,Oe,qe,Ge+60*U.offset*1e3)):B?new Date(Date.UTC(ae,oe,ue,Te,Oe,qe,Ge)):(Re=new Date(ae,oe,ue,Te,Oe,qe,Ge),le&&(Re=P(Re).week(le).toDate()),Re)}catch{return new Date("")}})(C,S,T,y),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),L&&C!=this.format(S)&&(this.$d=new Date("")),s={}}else if(S instanceof Array)for(var R=S.length,A=1;A<=R;A+=1){k[1]=S[A-1];var N=y.apply(this,k);if(N.isValid()){this.$d=N.$d,this.$L=N.$L,this.init();break}A===R&&(this.$d=new Date(""))}else x.call(this,w)}}}))});var Fje=Jo((kie,Tie)=>{(function(e,t){typeof kie=="object"&&typeof Tie<"u"?Tie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_advancedFormat=t()})(kie,(function(){"use strict";return function(e,t){var r=t.prototype,n=r.format;r.format=function(i){var a=this,s=this.$locale();if(!this.isValid())return n.bind(this)(i);var o=this.$utils(),l=(i||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(u){switch(u){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return s.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return s.ordinal(a.week(),"W");case"w":case"ww":return o.s(a.week(),u==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),u==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),u==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return u}}));return n.bind(this)(l)}}}))});var $je=Jo((Cie,Sie)=>{(function(e,t){typeof Cie=="object"&&typeof Sie<"u"?Sie.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_duration=t()})(Cie,(function(){"use strict";var e,t,r=1e3,n=6e4,i=36e5,a=864e5,s=31536e6,o=2628e6,l=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,u=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,h={years:s,months:o,days:a,hours:i,minutes:n,seconds:r,milliseconds:1,weeks:6048e5},f=function(C){return C instanceof x},d=function(C,T,k){return new x(C,k,T.$l)},p=function(C){return t.p(C)+"s"},m=function(C){return C<0},g=function(C){return m(C)?Math.ceil(C):Math.floor(C)},y=function(C){return Math.abs(C)},v=function(C,T){return C?m(C)?{negative:!0,format:""+y(C)+T}:{negative:!1,format:""+C+T}:{negative:!1,format:""}},x=(function(){function C(k,S,E){var I=this;if(this.$d={},this.$l=E,k===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return d(k*h[p(S)],this);if(typeof k=="number")return this.$ms=k,this.parseFromMilliseconds(),this;if(typeof k=="object")return Object.keys(k).forEach((function(R){I.$d[p(R)]=k[R]})),this.calMilliseconds(),this;if(typeof k=="string"){var L=k.match(l);if(L){var O=L.slice(2).map((function(R){return R!=null?Number(R):0}));return this.$d.years=O[0],this.$d.months=O[1],this.$d.weeks=O[2],this.$d.days=O[3],this.$d.hours=O[4],this.$d.minutes=O[5],this.$d.seconds=O[6],this.calMilliseconds(),this}}return this}var T=C.prototype;return T.calMilliseconds=function(){var k=this;this.$ms=Object.keys(this.$d).reduce((function(S,E){return S+(k.$d[E]||0)*h[E]}),0)},T.parseFromMilliseconds=function(){var k=this.$ms;this.$d.years=g(k/s),k%=s,this.$d.months=g(k/o),k%=o,this.$d.days=g(k/a),k%=a,this.$d.hours=g(k/i),k%=i,this.$d.minutes=g(k/n),k%=n,this.$d.seconds=g(k/r),k%=r,this.$d.milliseconds=k},T.toISOString=function(){var k=v(this.$d.years,"Y"),S=v(this.$d.months,"M"),E=+this.$d.days||0;this.$d.weeks&&(E+=7*this.$d.weeks);var I=v(E,"D"),L=v(this.$d.hours,"H"),O=v(this.$d.minutes,"M"),R=this.$d.seconds||0;this.$d.milliseconds&&(R+=this.$d.milliseconds/1e3,R=Math.round(1e3*R)/1e3);var A=v(R,"S"),N=k.negative||S.negative||I.negative||L.negative||O.negative||A.negative,M=L.format||O.format||A.format?"T":"",D=(N?"-":"")+"P"+k.format+S.format+I.format+M+L.format+O.format+A.format;return D==="P"||D==="-P"?"P0D":D},T.toJSON=function(){return this.toISOString()},T.format=function(k){var S=k||"YYYY-MM-DDTHH:mm:ss",E={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return S.replace(u,(function(I,L){return L||String(E[I])}))},T.as=function(k){return this.$ms/h[p(k)]},T.get=function(k){var S=this.$ms,E=p(k);return E==="milliseconds"?S%=1e3:S=E==="weeks"?g(S/h[E]):this.$d[E],S||0},T.add=function(k,S,E){var I;return I=S?k*h[p(S)]:f(k)?k.$ms:d(k,this).$ms,d(this.$ms+I*(E?-1:1),this)},T.subtract=function(k,S){return this.add(k,S,!0)},T.locale=function(k){var S=this.clone();return S.$l=k,S},T.clone=function(){return d(this.$ms,this)},T.humanize=function(k){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!k)},T.valueOf=function(){return this.asMilliseconds()},T.milliseconds=function(){return this.get("milliseconds")},T.asMilliseconds=function(){return this.as("milliseconds")},T.seconds=function(){return this.get("seconds")},T.asSeconds=function(){return this.as("seconds")},T.minutes=function(){return this.get("minutes")},T.asMinutes=function(){return this.as("minutes")},T.hours=function(){return this.get("hours")},T.asHours=function(){return this.as("hours")},T.days=function(){return this.get("days")},T.asDays=function(){return this.as("days")},T.weeks=function(){return this.get("weeks")},T.asWeeks=function(){return this.as("weeks")},T.months=function(){return this.get("months")},T.asMonths=function(){return this.as("months")},T.years=function(){return this.get("years")},T.asYears=function(){return this.as("years")},C})(),w=function(C,T,k){return C.add(T.years()*k,"y").add(T.months()*k,"M").add(T.days()*k,"d").add(T.hours()*k,"h").add(T.minutes()*k,"m").add(T.seconds()*k,"s").add(T.milliseconds()*k,"ms")};return function(C,T,k){e=k,t=k().$utils(),k.duration=function(I,L){var O=k.locale();return d(I,{$l:O},L)},k.isDuration=f;var S=T.prototype.add,E=T.prototype.subtract;T.prototype.add=function(I,L){return f(I)?w(this,I,1):S.bind(this)(I,L)},T.prototype.subtract=function(I,L){return f(I)?w(this,I,-1):E.bind(this)(I,L)}}}))});var nKe={};Tr(nKe,{diagram:()=>nKt});function zie(e,t,r){let n=!0;for(;n;)n=!1,r.forEach(function(i){let a="^\\s*"+i+"\\s*$",s=new RegExp(a);e[0].match(s)&&(t[i]=!0,e.shift(1),n=!0)})}var Vje,tu,Wje,Hje,Uje,nk,rKe,Aie,djt,zje,Td,Iie,Mie,Nie,ak,sk,Die,Oie,uO,ok,Pie,Yje,Bie,rk,_6,Fie,$ie,hO,_ie,pjt,mjt,gjt,yjt,vjt,xjt,bjt,wjt,kjt,Tjt,Cjt,Sjt,Ejt,Ajt,_jt,Rjt,Xje,Ljt,Ijt,Mjt,Njt,Djt,Ojt,Pjt,Bjt,jje,Fjt,$jt,zjt,Kje,Gjt,Rie,Zje,Qje,lO,ik,qjt,Vjt,Lie,cO,As,Jje,Wjt,O2,Hjt,Gje,Ujt,eKe,Yjt,tKe,Xjt,jjt,Kjt,Zjt,qje,Qjt,pp,Eie,Jjt,eKt,tKt,rKt,nKt,iKe=W(()=>{Sn();_r();Rr();hr();Vje=Ro(n4(),1),tu=Ro(hA(),1),Wje=Ro(Pje(),1),Hje=Ro(Bje(),1),Uje=Ro(Fje(),1),nk=Ro(hA(),1),rKe=Ro($je(),1);fn();Aie=(function(){var e=b(function(A,N,M,D){for(M=M||{},D=A.length;D--;M[A[D]]=N);return M},"o"),t=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],r=[1,26],n=[1,27],i=[1,28],a=[1,29],s=[1,30],o=[1,31],l=[1,32],u=[1,33],h=[1,34],f=[1,9],d=[1,10],p=[1,11],m=[1,12],g=[1,13],y=[1,14],v=[1,15],x=[1,16],w=[1,19],C=[1,20],T=[1,21],k=[1,22],S=[1,23],E=[1,25],I=[1,35],L={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:b(function(N,M,D,B,P,$,F){var q=$.length-1;switch(P){case 1:return $[q-1];case 2:this.$=[];break;case 3:$[q-1].push($[q]),this.$=$[q-1];break;case 4:case 5:this.$=$[q];break;case 6:case 7:this.$=[];break;case 8:B.setWeekday("monday");break;case 9:B.setWeekday("tuesday");break;case 10:B.setWeekday("wednesday");break;case 11:B.setWeekday("thursday");break;case 12:B.setWeekday("friday");break;case 13:B.setWeekday("saturday");break;case 14:B.setWeekday("sunday");break;case 15:B.setWeekend("friday");break;case 16:B.setWeekend("saturday");break;case 17:B.setDateFormat($[q].substr(11)),this.$=$[q].substr(11);break;case 18:B.enableInclusiveEndDates(),this.$=$[q].substr(18);break;case 19:B.TopAxis(),this.$=$[q].substr(8);break;case 20:B.setAxisFormat($[q].substr(11)),this.$=$[q].substr(11);break;case 21:B.setTickInterval($[q].substr(13)),this.$=$[q].substr(13);break;case 22:B.setExcludes($[q].substr(9)),this.$=$[q].substr(9);break;case 23:B.setIncludes($[q].substr(9)),this.$=$[q].substr(9);break;case 24:B.setTodayMarker($[q].substr(12)),this.$=$[q].substr(12);break;case 27:B.setDiagramTitle($[q].substr(6)),this.$=$[q].substr(6);break;case 28:this.$=$[q].trim(),B.setAccTitle(this.$);break;case 29:case 30:this.$=$[q].trim(),B.setAccDescription(this.$);break;case 31:B.addSection($[q].substr(8)),this.$=$[q].substr(8);break;case 33:B.addTask($[q-1],$[q]),this.$="task";break;case 34:this.$=$[q-1],B.setClickEvent($[q-1],$[q],null);break;case 35:this.$=$[q-2],B.setClickEvent($[q-2],$[q-1],$[q]);break;case 36:this.$=$[q-2],B.setClickEvent($[q-2],$[q-1],null),B.setLink($[q-2],$[q]);break;case 37:this.$=$[q-3],B.setClickEvent($[q-3],$[q-2],$[q-1]),B.setLink($[q-3],$[q]);break;case 38:this.$=$[q-2],B.setClickEvent($[q-2],$[q],null),B.setLink($[q-2],$[q-1]);break;case 39:this.$=$[q-3],B.setClickEvent($[q-3],$[q-1],$[q]),B.setLink($[q-3],$[q-2]);break;case 40:this.$=$[q-1],B.setLink($[q-1],$[q]);break;case 41:case 47:this.$=$[q-1]+" "+$[q];break;case 42:case 43:case 45:this.$=$[q-2]+" "+$[q-1]+" "+$[q];break;case 44:case 46:this.$=$[q-3]+" "+$[q-2]+" "+$[q-1]+" "+$[q];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:r,13:n,14:i,15:a,16:s,17:o,18:l,19:18,20:u,21:h,22:f,23:d,24:p,25:m,26:g,27:y,28:v,29:x,30:w,31:C,33:T,35:k,36:S,37:24,38:E,40:I},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:36,11:17,12:r,13:n,14:i,15:a,16:s,17:o,18:l,19:18,20:u,21:h,22:f,23:d,24:p,25:m,26:g,27:y,28:v,29:x,30:w,31:C,33:T,35:k,36:S,37:24,38:E,40:I},e(t,[2,5]),e(t,[2,6]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,20]),e(t,[2,21]),e(t,[2,22]),e(t,[2,23]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),e(t,[2,27]),{32:[1,37]},{34:[1,38]},e(t,[2,30]),e(t,[2,31]),e(t,[2,32]),{39:[1,39]},e(t,[2,8]),e(t,[2,9]),e(t,[2,10]),e(t,[2,11]),e(t,[2,12]),e(t,[2,13]),e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),{41:[1,40],43:[1,41]},e(t,[2,4]),e(t,[2,28]),e(t,[2,29]),e(t,[2,33]),e(t,[2,34],{42:[1,42],43:[1,43]}),e(t,[2,40],{41:[1,44]}),e(t,[2,35],{43:[1,45]}),e(t,[2,36]),e(t,[2,38],{42:[1,46]}),e(t,[2,37]),e(t,[2,39])],defaultActions:{},parseError:b(function(N,M){if(M.recoverable)this.trace(N);else{var D=new Error(N);throw D.hash=M,D}},"parseError"),parse:b(function(N){var M=this,D=[0],B=[],P=[null],$=[],F=this.table,q="",G=0,z=0,H=0,j=2,J=1,U=$.slice.call(arguments,1),le=Object.create(this.lexer),ee={yy:{}};for(var ue in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ue)&&(ee.yy[ue]=this.yy[ue]);le.setInput(N,ee.yy),ee.yy.lexer=le,ee.yy.parser=this,typeof le.yylloc>"u"&&(le.yylloc={});var ae=le.yylloc;$.push(ae);var oe=le.options&&le.options.ranges;typeof ee.yy.parseError=="function"?this.parseError=ee.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Re(ge){D.length=D.length-2*ge,P.length=P.length-ge,$.length=$.length-ge}b(Re,"popStack");function Te(){var ge;return ge=B.pop()||le.lex()||J,typeof ge!="number"&&(ge instanceof Array&&(B=ge,ge=B.pop()),ge=M.symbols_[ge]||ge),ge}b(Te,"lex");for(var Oe,qe,Ge,fe,Ce,_e,de={},ie,Q,he,xe;;){if(Ge=D[D.length-1],this.defaultActions[Ge]?fe=this.defaultActions[Ge]:((Oe===null||typeof Oe>"u")&&(Oe=Te()),fe=F[Ge]&&F[Ge][Oe]),typeof fe>"u"||!fe.length||!fe[0]){var ce="";xe=[];for(ie in F[Ge])this.terminals_[ie]&&ie>j&&xe.push("'"+this.terminals_[ie]+"'");le.showPosition?ce="Parse error on line "+(G+1)+`: `+le.showPosition()+` Expecting `+xe.join(", ")+", got '"+(this.terminals_[Oe]||Oe)+"'":ce="Parse error on line "+(G+1)+": Unexpected "+(Oe==J?"end of input":"'"+(this.terminals_[Oe]||Oe)+"'"),this.parseError(ce,{text:le.match,token:this.terminals_[Oe]||Oe,line:le.yylineno,loc:ae,expected:xe})}if(fe[0]instanceof Array&&fe.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Ge+", token: "+Oe);switch(fe[0]){case 1:D.push(Oe),P.push(le.yytext),$.push(le.yylloc),D.push(fe[1]),Oe=null,qe?(Oe=qe,qe=null):(z=le.yyleng,q=le.yytext,G=le.yylineno,ae=le.yylloc,H>0&&H--);break;case 2:if(Q=this.productions_[fe[1]][1],de.$=P[P.length-Q],de._$={first_line:$[$.length-(Q||1)].first_line,last_line:$[$.length-1].last_line,first_column:$[$.length-(Q||1)].first_column,last_column:$[$.length-1].last_column},oe&&(de._$.range=[$[$.length-(Q||1)].range[0],$[$.length-1].range[1]]),_e=this.performAction.apply(de,[q,z,G,ee.yy,fe[1],P,$].concat(U)),typeof _e<"u")return _e;Q&&(D=D.slice(0,-1*Q*2),P=P.slice(0,-1*Q),$=$.slice(0,-1*Q)),D.push(this.productions_[fe[1]][0]),P.push(de.$),$.push(de._$),he=F[D[D.length-2]][D[D.length-1]],D.push(he);break;case 3:return!0}}return!0},"parse")},O=(function(){var A={EOF:1,parseError:b(function(M,D){if(this.yy.parser)this.yy.parser.parseError(M,D);else throw new Error(M)},"parseError"),setInput:b(function(N,M){return this.yy=M||this.yy||{},this._input=N,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var N=this._input[0];this.yytext+=N,this.yyleng++,this.offset++,this.match+=N,this.matched+=N;var M=N.match(/(?:\r\n?|\n).*/g);return M?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),N},"input"),unput:b(function(N){var M=N.length,D=N.split(/(?:\r\n?|\n)/g);this._input=N+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-M),this.offset-=M;var B=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),D.length-1&&(this.yylineno-=D.length-1);var P=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:D?(D.length===B.length?this.yylloc.first_column:0)+B[B.length-D.length].length-D[0].length:this.yylloc.first_column-M},this.options.ranges&&(this.yylloc.range=[P[0],P[0]+this.yyleng-M]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(N){this.unput(this.match.slice(N))},"less"),pastInput:b(function(){var N=this.matched.substr(0,this.matched.length-this.match.length);return(N.length>20?"...":"")+N.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var N=this.match;return N.length<20&&(N+=this._input.substr(0,20-N.length)),(N.substr(0,20)+(N.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var N=this.pastInput(),M=new Array(N.length+1).join("-");return N+this.upcomingInput()+` `+M+"^"},"showPosition"),test_match:b(function(N,M){var D,B,P;if(this.options.backtrack_lexer&&(P={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(P.yylloc.range=this.yylloc.range.slice(0))),B=N[0].match(/(?:\r\n?|\n).*/g),B&&(this.yylineno+=B.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:B?B[B.length-1].length-B[B.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+N[0].length},this.yytext+=N[0],this.match+=N[0],this.matches=N,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(N[0].length),this.matched+=N[0],D=this.performAction.call(this,this.yy,this,M,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),D)return D;if(this._backtrack){for(var $ in P)this[$]=P[$];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var N,M,D,B;this._more||(this.yytext="",this.match="");for(var P=this._currentRules(),$=0;$M[0].length)){if(M=D,B=$,this.options.backtrack_lexer){if(N=this.test_match(D,P[$]),N!==!1)return N;if(this._backtrack){M=!1;continue}else return!1}else if(!this.options.flex)break}return M?(N=this.test_match(M,P[B]),N!==!1?N:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var M=this.next();return M||this.lex()},"lex"),begin:b(function(M){this.conditionStack.push(M)},"begin"),popState:b(function(){var M=this.conditionStack.length-1;return M>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(M){return M=this.conditionStack.length-1-Math.abs(M||0),M>=0?this.conditionStack[M]:"INITIAL"},"topState"),pushState:b(function(M){this.begin(M)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(M,D,B,P){var $=P;switch(B){case 0:return this.begin("open_directive"),"open_directive";break;case 1:return this.begin("acc_title"),31;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),33;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:break;case 9:break;case 10:break;case 11:return 10;case 12:break;case 13:break;case 14:this.begin("href");break;case 15:this.popState();break;case 16:return 43;case 17:this.begin("callbackname");break;case 18:this.popState();break;case 19:this.popState(),this.begin("callbackargs");break;case 20:return 41;case 21:this.popState();break;case 22:return 42;case 23:this.begin("click");break;case 24:this.popState();break;case 25:return 40;case 26:return 4;case 27:return 22;case 28:return 23;case 29:return 24;case 30:return 25;case 31:return 26;case 32:return 28;case 33:return 27;case 34:return 29;case 35:return 12;case 36:return 13;case 37:return 14;case 38:return 15;case 39:return 16;case 40:return 17;case 41:return 18;case 42:return 20;case 43:return 21;case 44:return"date";case 45:return 30;case 46:return"accDescription";case 47:return 36;case 48:return 38;case 49:return 39;case 50:return":";case 51:return 6;case 52:return"INVALID"}},"anonymous"),rules:[/^(?:%%\{)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:tickInterval\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:weekday\s+monday\b)/i,/^(?:weekday\s+tuesday\b)/i,/^(?:weekday\s+wednesday\b)/i,/^(?:weekday\s+thursday\b)/i,/^(?:weekday\s+friday\b)/i,/^(?:weekday\s+saturday\b)/i,/^(?:weekday\s+sunday\b)/i,/^(?:weekend\s+friday\b)/i,/^(?:weekend\s+saturday\b)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^\n]+)/i,/^(?:[^:\n]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[6,7],inclusive:!1},acc_descr:{rules:[4],inclusive:!1},acc_title:{rules:[2],inclusive:!1},callbackargs:{rules:[21,22],inclusive:!1},callbackname:{rules:[18,19,20],inclusive:!1},href:{rules:[15,16],inclusive:!1},click:{rules:[24,25],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,17,23,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return A})();L.lexer=O;function R(){this.yy={}}return b(R,"Parser"),R.prototype=L,L.Parser=R,new R})();Sie.parser=Sie;cjt=Sie;tu.default.extend(qje.default);tu.default.extend(Vje.default);tu.default.extend(Wje.default);Fje={friday:5,saturday:6},Td="",Rie="",Lie=void 0,Iie="",ak=[],sk=[],Mie=new Map,Nie=[],uO=[],ok="",Die="",Hje=["active","done","crit","milestone","vert"],Oie=[],rk="",_6=!1,Pie=!1,Bie="sunday",hO="saturday",Eie=0,ujt=b(function(){Nie=[],uO=[],ok="",Oie=[],lO=0,_ie=void 0,cO=void 0,As=[],Td="",Rie="",Die="",Lie=void 0,Iie="",ak=[],sk=[],_6=!1,Pie=!1,Eie=0,Mie=new Map,rk="",Nr(),Bie="sunday",hO="saturday"},"clear"),hjt=b(function(e){rk=e},"setDiagramId"),fjt=b(function(e){Rie=e},"setAxisFormat"),djt=b(function(){return Rie},"getAxisFormat"),pjt=b(function(e){Lie=e},"setTickInterval"),mjt=b(function(){return Lie},"getTickInterval"),gjt=b(function(e){Iie=e},"setTodayMarker"),yjt=b(function(){return Iie},"getTodayMarker"),vjt=b(function(e){Td=e},"setDateFormat"),xjt=b(function(){_6=!0},"enableInclusiveEndDates"),bjt=b(function(){return _6},"endDatesAreInclusive"),wjt=b(function(){Pie=!0},"enableTopAxis"),kjt=b(function(){return Pie},"topAxisEnabled"),Tjt=b(function(e){Die=e},"setDisplayMode"),Cjt=b(function(){return Die},"getDisplayMode"),Sjt=b(function(){return Td},"getDateFormat"),Uje=b((e,t)=>{let r=t.toLowerCase().split(/[\s,]+/).filter(n=>n!=="");return[...new Set([...e,...r])]},"mergeTokens"),Ejt=b(function(e){ak=Uje(ak,e)},"setIncludes"),Ajt=b(function(){return ak},"getIncludes"),_jt=b(function(e){sk=Uje(sk,e)},"setExcludes"),Rjt=b(function(){return sk},"getExcludes"),Ljt=b(function(){return Mie},"getLinks"),Ijt=b(function(e){ok=e,Nie.push(e)},"addSection"),Mjt=b(function(){return Nie},"getSections"),Njt=b(function(){let e=$je(),t=10,r=0;for(;!e&&ro))throw new Error("Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.");e=e.add(1,"d")}return[t,s]},"fixTaskDates"),Aie=b(function(e,t,r){if(r=r.trim(),b(o=>{let l=o.trim();return l==="x"||l==="X"},"isTimestampFormat")(t)&&/^\d+$/.test(r))return new Date(Number(r));let a=/^after\s+(?[\d\w- ]+)/.exec(r);if(a!==null){let o=null;for(let u of a.groups.ids.split(" ")){let h=O2(u);h!==void 0&&(!o||h.endTime>o.endTime)&&(o=h)}if(o)return o.endTime;let l=new Date;return l.setHours(0,0,0,0),l}let s=(0,tu.default)(r,t.trim(),!0);if(s.isValid())return s.toDate();{se.debug("Invalid date:"+r),se.debug("With date format:"+t.trim());let o=new Date(r);if(o===void 0||isNaN(o.getTime())||o.getFullYear()<-1e4||o.getFullYear()>1e4)throw new Error("Invalid date:"+r);return o}},"getStartDate"),jje=b(function(e){let t=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(e.trim());return t!==null?[Number.parseFloat(t[1]),t[2]]:[NaN,"ms"]},"parseDuration"),Kje=b(function(e,t,r,n=!1){r=r.trim();let a=/^until\s+(?[\d\w- ]+)/.exec(r);if(a!==null){let h=null;for(let d of a.groups.ids.split(" ")){let p=O2(d);p!==void 0&&(!h||p.startTime{window.open(r,"_self")}),Mie.set(n,r))}),Qje(e,"clickable")},"setLink"),Qje=b(function(e,t){e.split(",").forEach(function(r){let n=O2(r);n!==void 0&&n.classes.push(t)})},"setClass"),Vjt=b(function(e,t,r){if(Be().securityLevel!=="loose"||t===void 0)return;let n=[];if(typeof r=="string"){n=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let a=0;a{pr.runFunc(t,...n)})},"setClickFun"),Jje=b(function(e,t){Oie.push(function(){let r=rk?`${rk}-${e}`:e,n=document.querySelector(`[id="${r}"]`);n!==null&&n.addEventListener("click",function(){t()})},function(){let r=rk?`${rk}-${e}`:e,n=document.querySelector(`[id="${r}-text"]`);n!==null&&n.addEventListener("click",function(){t()})})},"pushFun"),Wjt=b(function(e,t,r){e.split(",").forEach(function(n){Vjt(n,t,r)}),Qje(e,"clickable")},"setClickEvent"),Hjt=b(function(e){Oie.forEach(function(t){t(e)})},"bindFunctions"),Ujt={getConfig:b(()=>Be().gantt,"getConfig"),clear:ujt,setDateFormat:vjt,getDateFormat:Sjt,enableInclusiveEndDates:xjt,endDatesAreInclusive:bjt,enableTopAxis:wjt,topAxisEnabled:kjt,setAxisFormat:fjt,getAxisFormat:djt,setTickInterval:pjt,getTickInterval:mjt,setTodayMarker:gjt,getTodayMarker:yjt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,setDiagramId:hjt,setDisplayMode:Tjt,getDisplayMode:Cjt,setAccDescription:Jr,getAccDescription:en,addSection:Ijt,getSections:Mjt,getTasks:Njt,addTask:zjt,findTaskById:O2,addTaskOrg:Gjt,setIncludes:Ejt,getIncludes:Ajt,setExcludes:_jt,getExcludes:Rjt,setClickEvent:Wjt,setLink:qjt,getLinks:Ljt,bindFunctions:Hjt,parseDuration:jje,isInvalidDate:Yje,setWeekday:Djt,getWeekday:Ojt,setWeekend:Pjt};b(Fie,"getTaskTags");nk.default.extend(eKe.default);Yjt=b(function(){se.debug("Something is calling, setConf, remove the call")},"setConf"),zje={monday:zm,tuesday:t_,wednesday:r_,thursday:Of,friday:n_,saturday:i_,sunday:dh},Xjt=b((e,t)=>{let r=[...e].map(()=>-1/0),n=[...e].sort((a,s)=>a.startTime-s.startTime||a.order-s.order),i=0;for(let a of n)for(let s=0;s=r[s]){r[s]=a.endTime,a.order=s+t,s>i&&(i=s);break}return i},"getMaxIntersections"),Cie=1e4,jjt=b(function(e,t,r,n){let i=Be().gantt;n.db.setDiagramId(t);let a=Be().securityLevel,s;a==="sandbox"&&(s=ct("#i"+t));let o=a==="sandbox"?ct(s.nodes()[0].contentDocument.body):ct("body"),l=a==="sandbox"?s.nodes()[0].contentDocument:document,u=l.getElementById(t);pp=u.parentElement.offsetWidth,pp===void 0&&(pp=1200),i.useWidth!==void 0&&(pp=i.useWidth);let h=n.db.getTasks(),f=h.filter(L=>!L.vert),d=[];for(let L of f)d.push(L.type);d=I(d);let p={},m=2*i.topPadding;if(n.db.getDisplayMode()==="compact"||i.displayMode==="compact"){let L={};for(let R of f)L[R.section]===void 0?L[R.section]=[R]:L[R.section].push(R);let O=0;for(let R of Object.keys(L)){let A=Xjt(L[R],O)+1;O+=A,m+=A*(i.barHeight+i.barGap),p[R]=A}}else{m+=f.length*(i.barHeight+i.barGap);for(let L of d)p[L]=f.filter(O=>O.type===L).length}u.setAttribute("viewBox","0 0 "+pp+" "+m);let g=o.select(`[id="${t}"]`),y=o_().domain([p9(h,function(L){return L.startTime}),d9(h,function(L){return L.endTime})]).rangeRound([0,pp-i.leftPadding-i.rightPadding]);function v(L,O){let R=L.startTime,A=O.startTime,N=0;return R>A?N=1:Rz.vert===H.vert?0:z.vert?1:-1);let B=L.filter(z=>!z.vert),$=[...new Set(B.map(z=>z.order))].map(z=>B.find(H=>H.order===z));g.append("g").selectAll("rect").data($).enter().append("rect").attr("x",0).attr("y",function(z,H){return H=z.order,H*O+R-2}).attr("width",function(){return D-i.rightPadding/2}).attr("height",O).attr("class",function(z){for(let[H,j]of d.entries())if(z.type===j)return"section section"+H%i.numberSectionStyles;return"section section0"}).enter();let F=g.append("g").selectAll("rect").data(L).enter(),q=n.db.getLinks();if(F.append("rect").attr("id",function(z){return t+"-"+z.id}).attr("rx",3).attr("ry",3).attr("x",function(z){return z.milestone?y(z.startTime)+A+.5*(y(z.endTime)-y(z.startTime))-.5*N:y(z.startTime)+A}).attr("y",function(z,H){return H=z.order,z.vert?i.gridLineStartPadding:H*O+R}).attr("width",function(z){return z.milestone?N:z.vert?.08*N:y(z.renderEndTime||z.endTime)-y(z.startTime)}).attr("height",function(z){return z.vert?B.length*(i.barHeight+i.barGap)+i.barHeight*2:N}).attr("transform-origin",function(z,H){return H=z.order,(y(z.startTime)+A+.5*(y(z.endTime)-y(z.startTime))).toString()+"px "+(H*O+R+.5*N).toString()+"px"}).attr("class",function(z){let H="task",j="";z.classes.length>0&&(j=z.classes.join(" "));let J=0;for(let[le,ee]of d.entries())z.type===ee&&(J=le%i.numberSectionStyles);let U="";return z.active?z.crit?U+=" activeCrit":U=" active":z.done?z.crit?U=" doneCrit":U=" done":z.crit&&(U+=" crit"),U.length===0&&(U=" task"),z.milestone&&(U=" milestone "+U),z.vert&&(U=" vert "+U),U+=J,U+=" "+j,H+U}),F.append("text").attr("id",function(z){return t+"-"+z.id+"-text"}).text(function(z){return z.task}).attr("font-size",i.fontSize).attr("x",function(z){let H=y(z.startTime),j=y(z.renderEndTime||z.endTime);if(z.milestone&&(H+=.5*(y(z.endTime)-y(z.startTime))-.5*N,j=H+N),z.vert)return y(z.startTime)+A;let J=this.getBBox().width;return J>j-H?j+J+1.5*i.leftPadding>D?H+A-5:j+A+5:(j-H)/2+H+A}).attr("y",function(z,H){return z.vert?i.gridLineStartPadding+B.length*(i.barHeight+i.barGap)+60:(H=z.order,H*O+i.barHeight/2+(i.fontSize/2-2)+R)}).attr("text-height",N).attr("class",function(z){let H=y(z.startTime),j=y(z.endTime);z.milestone&&(j=H+N);let J=this.getBBox().width,U="";z.classes.length>0&&(U=z.classes.join(" "));let le=0;for(let[ue,ae]of d.entries())z.type===ae&&(le=ue%i.numberSectionStyles);let ee="";return z.active&&(z.crit?ee="activeCritText"+le:ee="activeText"+le),z.done?z.crit?ee=ee+" doneCritText"+le:ee=ee+" doneText"+le:z.crit&&(ee=ee+" critText"+le),z.milestone&&(ee+=" milestoneText"),z.vert&&(ee+=" vertText"),J>j-H?j+J+1.5*i.leftPadding>D?U+" taskTextOutsideLeft taskTextOutside"+le+" "+ee:U+" taskTextOutsideRight taskTextOutside"+le+" "+ee+" width-"+J:U+" taskText taskText"+le+" "+ee+" width-"+J}),Be().securityLevel==="sandbox"){let z;z=ct("#i"+t);let H=z.nodes()[0].contentDocument;F.filter(function(j){return q.has(j.id)}).each(function(j){var J=H.querySelector("#"+CSS.escape(t+"-"+j.id)),U=H.querySelector("#"+CSS.escape(t+"-"+j.id+"-text"));let le=J.parentNode;var ee=H.createElement("a");ee.setAttribute("xlink:href",q.get(j.id)),ee.setAttribute("target","_top"),le.appendChild(ee),ee.appendChild(J),ee.appendChild(U)})}}b(w,"drawRects");function C(L,O,R,A,N,M,D,B){if(D.length===0&&B.length===0)return;let P,$;for(let{startTime:j,endTime:J}of M)(P===void 0||j$)&&($=J);if(!P||!$)return;if((0,nk.default)($).diff((0,nk.default)(P),"year")>5){se.warn("The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days.");return}let F=n.db.getDateFormat(),q=[],G=null,z=(0,nk.default)(P);for(;z.valueOf()<=$;)n.db.isInvalidDate(z,F,D,B)?G?G.end=z:G={start:z,end:z}:G&&(q.push(G),G=null),z=z.add(1,"d");g.append("g").selectAll("rect").data(q).enter().append("rect").attr("id",j=>t+"-exclude-"+j.start.format("YYYY-MM-DD")).attr("x",j=>y(j.start.startOf("day"))+R).attr("y",i.gridLineStartPadding).attr("width",j=>y(j.end.endOf("day"))-y(j.start.startOf("day"))).attr("height",N-O-i.gridLineStartPadding).attr("transform-origin",function(j,J){return(y(j.start)+R+.5*(y(j.end)-y(j.start))).toString()+"px "+(J*L+.5*N).toString()+"px"}).attr("class","exclude-range")}b(C,"drawExcludeDays");function T(L,O,R,A){if(R<=0||L>O)return 1/0;let N=O-L,M=nk.default.duration({[A??"day"]:R}).asMilliseconds();return M<=0?1/0:Math.ceil(N/M)}b(T,"getEstimatedTickCount");function k(L,O,R,A){let N=n.db.getDateFormat(),M=n.db.getAxisFormat(),D;M?D=M:N==="D"?D="%d":D=i.axisFormat??"%Y-%m-%d";let B=ZV(y).tickSize(-A+O+i.gridLineStartPadding).tickFormat(Oy(D)),$=/^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(n.db.getTickInterval()||i.tickInterval);if($!==null){let F=parseInt($[1],10);if(isNaN(F)||F<=0)se.warn(`Invalid tick interval value: "${$[1]}". Skipping custom tick interval.`);else{let q=$[2],G=n.db.getWeekday()||i.weekday,z=y.domain(),H=z[0],j=z[1],J=T(H,j,F,q);if(J>Cie)se.warn(`The tick interval "${F}${q}" would generate ${J} ticks, which exceeds the maximum allowed (${Cie}). This may indicate an invalid date or time range. Skipping custom tick interval.`);else switch(q){case"millisecond":B.ticks(Nf.every(F));break;case"second":B.ticks(Bc.every(F));break;case"minute":B.ticks(k0.every(F));break;case"hour":B.ticks(T0.every(F));break;case"day":B.ticks(Su.every(F));break;case"week":B.ticks(zje[G].every(F));break;case"month":B.ticks(C0.every(F));break}}}if(g.append("g").attr("class","grid").attr("transform","translate("+L+", "+(A-50)+")").call(B).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10).attr("dy","1em"),n.db.topAxisEnabled()||i.topAxis){let F=KV(y).tickSize(-A+O+i.gridLineStartPadding).tickFormat(Oy(D));if($!==null){let q=parseInt($[1],10);if(isNaN(q)||q<=0)se.warn(`Invalid tick interval value: "${$[1]}". Skipping custom tick interval.`);else{let G=$[2],z=n.db.getWeekday()||i.weekday,H=y.domain(),j=H[0],J=H[1];if(T(j,J,q,G)<=Cie)switch(G){case"millisecond":F.ticks(Nf.every(q));break;case"second":F.ticks(Bc.every(q));break;case"minute":F.ticks(k0.every(q));break;case"hour":F.ticks(T0.every(q));break;case"day":F.ticks(Su.every(q));break;case"week":F.ticks(zje[z].every(q));break;case"month":F.ticks(C0.every(q));break}}}g.append("g").attr("class","grid").attr("transform","translate("+L+", "+O+")").call(F).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10)}}b(k,"makeGrid");function S(L,O){let R=0,A=Object.keys(p).map(N=>[N,p[N]]);g.append("g").selectAll("text").data(A).enter().append(function(N){let M=N[0].split(Ct.lineBreakRegex),D=-(M.length-1)/2,B=l.createElementNS("http://www.w3.org/2000/svg","text");B.setAttribute("dy",D+"em");for(let[P,$]of M.entries()){let F=l.createElementNS("http://www.w3.org/2000/svg","tspan");F.setAttribute("alignment-baseline","central"),F.setAttribute("x","10"),P>0&&F.setAttribute("dy","1em"),F.textContent=$,B.appendChild(F)}return B}).attr("x",10).attr("y",function(N,M){if(M>0)for(let D=0;D` +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var M=this.next();return M||this.lex()},"lex"),begin:b(function(M){this.conditionStack.push(M)},"begin"),popState:b(function(){var M=this.conditionStack.length-1;return M>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(M){return M=this.conditionStack.length-1-Math.abs(M||0),M>=0?this.conditionStack[M]:"INITIAL"},"topState"),pushState:b(function(M){this.begin(M)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(M,D,B,P){var $=P;switch(B){case 0:return this.begin("open_directive"),"open_directive";break;case 1:return this.begin("acc_title"),31;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),33;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:break;case 9:break;case 10:break;case 11:return 10;case 12:break;case 13:break;case 14:this.begin("href");break;case 15:this.popState();break;case 16:return 43;case 17:this.begin("callbackname");break;case 18:this.popState();break;case 19:this.popState(),this.begin("callbackargs");break;case 20:return 41;case 21:this.popState();break;case 22:return 42;case 23:this.begin("click");break;case 24:this.popState();break;case 25:return 40;case 26:return 4;case 27:return 22;case 28:return 23;case 29:return 24;case 30:return 25;case 31:return 26;case 32:return 28;case 33:return 27;case 34:return 29;case 35:return 12;case 36:return 13;case 37:return 14;case 38:return 15;case 39:return 16;case 40:return 17;case 41:return 18;case 42:return 20;case 43:return 21;case 44:return"date";case 45:return 30;case 46:return"accDescription";case 47:return 36;case 48:return 38;case 49:return 39;case 50:return":";case 51:return 6;case 52:return"INVALID"}},"anonymous"),rules:[/^(?:%%\{)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:tickInterval\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:weekday\s+monday\b)/i,/^(?:weekday\s+tuesday\b)/i,/^(?:weekday\s+wednesday\b)/i,/^(?:weekday\s+thursday\b)/i,/^(?:weekday\s+friday\b)/i,/^(?:weekday\s+saturday\b)/i,/^(?:weekday\s+sunday\b)/i,/^(?:weekend\s+friday\b)/i,/^(?:weekend\s+saturday\b)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^\n]+)/i,/^(?:[^:\n]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[6,7],inclusive:!1},acc_descr:{rules:[4],inclusive:!1},acc_title:{rules:[2],inclusive:!1},callbackargs:{rules:[21,22],inclusive:!1},callbackname:{rules:[18,19,20],inclusive:!1},href:{rules:[15,16],inclusive:!1},click:{rules:[24,25],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,17,23,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return A})();L.lexer=O;function R(){this.yy={}}return b(R,"Parser"),R.prototype=L,L.Parser=R,new R})();Aie.parser=Aie;djt=Aie;tu.default.extend(Wje.default);tu.default.extend(Hje.default);tu.default.extend(Uje.default);zje={friday:5,saturday:6},Td="",Iie="",Mie=void 0,Nie="",ak=[],sk=[],Die=new Map,Oie=[],uO=[],ok="",Pie="",Yje=["active","done","crit","milestone","vert"],Bie=[],rk="",_6=!1,Fie=!1,$ie="sunday",hO="saturday",_ie=0,pjt=b(function(){Oie=[],uO=[],ok="",Bie=[],lO=0,Lie=void 0,cO=void 0,As=[],Td="",Iie="",Pie="",Mie=void 0,Nie="",ak=[],sk=[],_6=!1,Fie=!1,_ie=0,Die=new Map,rk="",Nr(),$ie="sunday",hO="saturday"},"clear"),mjt=b(function(e){rk=e},"setDiagramId"),gjt=b(function(e){Iie=e},"setAxisFormat"),yjt=b(function(){return Iie},"getAxisFormat"),vjt=b(function(e){Mie=e},"setTickInterval"),xjt=b(function(){return Mie},"getTickInterval"),bjt=b(function(e){Nie=e},"setTodayMarker"),wjt=b(function(){return Nie},"getTodayMarker"),kjt=b(function(e){Td=e},"setDateFormat"),Tjt=b(function(){_6=!0},"enableInclusiveEndDates"),Cjt=b(function(){return _6},"endDatesAreInclusive"),Sjt=b(function(){Fie=!0},"enableTopAxis"),Ejt=b(function(){return Fie},"topAxisEnabled"),Ajt=b(function(e){Pie=e},"setDisplayMode"),_jt=b(function(){return Pie},"getDisplayMode"),Rjt=b(function(){return Td},"getDateFormat"),Xje=b((e,t)=>{let r=t.toLowerCase().split(/[\s,]+/).filter(n=>n!=="");return[...new Set([...e,...r])]},"mergeTokens"),Ljt=b(function(e){ak=Xje(ak,e)},"setIncludes"),Ijt=b(function(){return ak},"getIncludes"),Mjt=b(function(e){sk=Xje(sk,e)},"setExcludes"),Njt=b(function(){return sk},"getExcludes"),Djt=b(function(){return Die},"getLinks"),Ojt=b(function(e){ok=e,Oie.push(e)},"addSection"),Pjt=b(function(){return Oie},"getSections"),Bjt=b(function(){let e=Gje(),t=10,r=0;for(;!e&&ro))throw new Error("Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.");e=e.add(1,"d")}return[t,s]},"fixTaskDates"),Rie=b(function(e,t,r){if(r=r.trim(),b(o=>{let l=o.trim();return l==="x"||l==="X"},"isTimestampFormat")(t)&&/^\d+$/.test(r))return new Date(Number(r));let a=/^after\s+(?[\d\w- ]+)/.exec(r);if(a!==null){let o=null;for(let u of a.groups.ids.split(" ")){let h=O2(u);h!==void 0&&(!o||h.endTime>o.endTime)&&(o=h)}if(o)return o.endTime;let l=new Date;return l.setHours(0,0,0,0),l}let s=(0,tu.default)(r,t.trim(),!0);if(s.isValid())return s.toDate();{se.debug("Invalid date:"+r),se.debug("With date format:"+t.trim());let o=new Date(r);if(o===void 0||isNaN(o.getTime())||o.getFullYear()<-1e4||o.getFullYear()>1e4)throw new Error("Invalid date:"+r);return o}},"getStartDate"),Zje=b(function(e){let t=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(e.trim());return t!==null?[Number.parseFloat(t[1]),t[2]]:[NaN,"ms"]},"parseDuration"),Qje=b(function(e,t,r,n=!1){r=r.trim();let a=/^until\s+(?[\d\w- ]+)/.exec(r);if(a!==null){let h=null;for(let d of a.groups.ids.split(" ")){let p=O2(d);p!==void 0&&(!h||p.startTime{window.open(r,"_self")}),Die.set(n,r))}),eKe(e,"clickable")},"setLink"),eKe=b(function(e,t){e.split(",").forEach(function(r){let n=O2(r);n!==void 0&&n.classes.push(t)})},"setClass"),Yjt=b(function(e,t,r){if(Be().securityLevel!=="loose"||t===void 0)return;let n=[];if(typeof r=="string"){n=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let a=0;a{pr.runFunc(t,...n)})},"setClickFun"),tKe=b(function(e,t){Bie.push(function(){let r=rk?`${rk}-${e}`:e,n=document.querySelector(`[id="${r}"]`);n!==null&&n.addEventListener("click",function(){t()})},function(){let r=rk?`${rk}-${e}`:e,n=document.querySelector(`[id="${r}-text"]`);n!==null&&n.addEventListener("click",function(){t()})})},"pushFun"),Xjt=b(function(e,t,r){e.split(",").forEach(function(n){Yjt(n,t,r)}),eKe(e,"clickable")},"setClickEvent"),jjt=b(function(e){Bie.forEach(function(t){t(e)})},"bindFunctions"),Kjt={getConfig:b(()=>Be().gantt,"getConfig"),clear:pjt,setDateFormat:kjt,getDateFormat:Rjt,enableInclusiveEndDates:Tjt,endDatesAreInclusive:Cjt,enableTopAxis:Sjt,topAxisEnabled:Ejt,setAxisFormat:gjt,getAxisFormat:yjt,setTickInterval:vjt,getTickInterval:xjt,setTodayMarker:bjt,getTodayMarker:wjt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,setDiagramId:mjt,setDisplayMode:Ajt,getDisplayMode:_jt,setAccDescription:Jr,getAccDescription:en,addSection:Ojt,getSections:Pjt,getTasks:Bjt,addTask:Wjt,findTaskById:O2,addTaskOrg:Hjt,setIncludes:Ljt,getIncludes:Ijt,setExcludes:Mjt,getExcludes:Njt,setClickEvent:Xjt,setLink:Ujt,getLinks:Djt,bindFunctions:jjt,parseDuration:Zje,isInvalidDate:jje,setWeekday:Fjt,getWeekday:$jt,setWeekend:zjt};b(zie,"getTaskTags");nk.default.extend(rKe.default);Zjt=b(function(){se.debug("Something is calling, setConf, remove the call")},"setConf"),qje={monday:zm,tuesday:t_,wednesday:r_,thursday:Of,friday:n_,saturday:i_,sunday:dh},Qjt=b((e,t)=>{let r=[...e].map(()=>-1/0),n=[...e].sort((a,s)=>a.startTime-s.startTime||a.order-s.order),i=0;for(let a of n)for(let s=0;s=r[s]){r[s]=a.endTime,a.order=s+t,s>i&&(i=s);break}return i},"getMaxIntersections"),Eie=1e4,Jjt=b(function(e,t,r,n){let i=Be().gantt;n.db.setDiagramId(t);let a=Be().securityLevel,s;a==="sandbox"&&(s=ct("#i"+t));let o=a==="sandbox"?ct(s.nodes()[0].contentDocument.body):ct("body"),l=a==="sandbox"?s.nodes()[0].contentDocument:document,u=l.getElementById(t);pp=u.parentElement.offsetWidth,pp===void 0&&(pp=1200),i.useWidth!==void 0&&(pp=i.useWidth);let h=n.db.getTasks(),f=h.filter(L=>!L.vert),d=[];for(let L of f)d.push(L.type);d=I(d);let p={},m=2*i.topPadding;if(n.db.getDisplayMode()==="compact"||i.displayMode==="compact"){let L={};for(let R of f)L[R.section]===void 0?L[R.section]=[R]:L[R.section].push(R);let O=0;for(let R of Object.keys(L)){let A=Qjt(L[R],O)+1;O+=A,m+=A*(i.barHeight+i.barGap),p[R]=A}}else{m+=f.length*(i.barHeight+i.barGap);for(let L of d)p[L]=f.filter(O=>O.type===L).length}u.setAttribute("viewBox","0 0 "+pp+" "+m);let g=o.select(`[id="${t}"]`),y=o_().domain([p9(h,function(L){return L.startTime}),d9(h,function(L){return L.endTime})]).rangeRound([0,pp-i.leftPadding-i.rightPadding]);function v(L,O){let R=L.startTime,A=O.startTime,N=0;return R>A?N=1:Rz.vert===H.vert?0:z.vert?1:-1);let B=L.filter(z=>!z.vert),$=[...new Set(B.map(z=>z.order))].map(z=>B.find(H=>H.order===z));g.append("g").selectAll("rect").data($).enter().append("rect").attr("x",0).attr("y",function(z,H){return H=z.order,H*O+R-2}).attr("width",function(){return D-i.rightPadding/2}).attr("height",O).attr("class",function(z){for(let[H,j]of d.entries())if(z.type===j)return"section section"+H%i.numberSectionStyles;return"section section0"}).enter();let F=g.append("g").selectAll("rect").data(L).enter(),q=n.db.getLinks();if(F.append("rect").attr("id",function(z){return t+"-"+z.id}).attr("rx",3).attr("ry",3).attr("x",function(z){return z.milestone?y(z.startTime)+A+.5*(y(z.endTime)-y(z.startTime))-.5*N:y(z.startTime)+A}).attr("y",function(z,H){return H=z.order,z.vert?i.gridLineStartPadding:H*O+R}).attr("width",function(z){return z.milestone?N:z.vert?.08*N:y(z.renderEndTime||z.endTime)-y(z.startTime)}).attr("height",function(z){return z.vert?B.length*(i.barHeight+i.barGap)+i.barHeight*2:N}).attr("transform-origin",function(z,H){return H=z.order,(y(z.startTime)+A+.5*(y(z.endTime)-y(z.startTime))).toString()+"px "+(H*O+R+.5*N).toString()+"px"}).attr("class",function(z){let H="task",j="";z.classes.length>0&&(j=z.classes.join(" "));let J=0;for(let[le,ee]of d.entries())z.type===ee&&(J=le%i.numberSectionStyles);let U="";return z.active?z.crit?U+=" activeCrit":U=" active":z.done?z.crit?U=" doneCrit":U=" done":z.crit&&(U+=" crit"),U.length===0&&(U=" task"),z.milestone&&(U=" milestone "+U),z.vert&&(U=" vert "+U),U+=J,U+=" "+j,H+U}),F.append("text").attr("id",function(z){return t+"-"+z.id+"-text"}).text(function(z){return z.task}).attr("font-size",i.fontSize).attr("x",function(z){let H=y(z.startTime),j=y(z.renderEndTime||z.endTime);if(z.milestone&&(H+=.5*(y(z.endTime)-y(z.startTime))-.5*N,j=H+N),z.vert)return y(z.startTime)+A;let J=this.getBBox().width;return J>j-H?j+J+1.5*i.leftPadding>D?H+A-5:j+A+5:(j-H)/2+H+A}).attr("y",function(z,H){return z.vert?i.gridLineStartPadding+B.length*(i.barHeight+i.barGap)+60:(H=z.order,H*O+i.barHeight/2+(i.fontSize/2-2)+R)}).attr("text-height",N).attr("class",function(z){let H=y(z.startTime),j=y(z.endTime);z.milestone&&(j=H+N);let J=this.getBBox().width,U="";z.classes.length>0&&(U=z.classes.join(" "));let le=0;for(let[ue,ae]of d.entries())z.type===ae&&(le=ue%i.numberSectionStyles);let ee="";return z.active&&(z.crit?ee="activeCritText"+le:ee="activeText"+le),z.done?z.crit?ee=ee+" doneCritText"+le:ee=ee+" doneText"+le:z.crit&&(ee=ee+" critText"+le),z.milestone&&(ee+=" milestoneText"),z.vert&&(ee+=" vertText"),J>j-H?j+J+1.5*i.leftPadding>D?U+" taskTextOutsideLeft taskTextOutside"+le+" "+ee:U+" taskTextOutsideRight taskTextOutside"+le+" "+ee+" width-"+J:U+" taskText taskText"+le+" "+ee+" width-"+J}),Be().securityLevel==="sandbox"){let z;z=ct("#i"+t);let H=z.nodes()[0].contentDocument;F.filter(function(j){return q.has(j.id)}).each(function(j){var J=H.querySelector("#"+CSS.escape(t+"-"+j.id)),U=H.querySelector("#"+CSS.escape(t+"-"+j.id+"-text"));let le=J.parentNode;var ee=H.createElement("a");ee.setAttribute("xlink:href",q.get(j.id)),ee.setAttribute("target","_top"),le.appendChild(ee),ee.appendChild(J),ee.appendChild(U)})}}b(w,"drawRects");function C(L,O,R,A,N,M,D,B){if(D.length===0&&B.length===0)return;let P,$;for(let{startTime:j,endTime:J}of M)(P===void 0||j$)&&($=J);if(!P||!$)return;if((0,nk.default)($).diff((0,nk.default)(P),"year")>5){se.warn("The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days.");return}let F=n.db.getDateFormat(),q=[],G=null,z=(0,nk.default)(P);for(;z.valueOf()<=$;)n.db.isInvalidDate(z,F,D,B)?G?G.end=z:G={start:z,end:z}:G&&(q.push(G),G=null),z=z.add(1,"d");g.append("g").selectAll("rect").data(q).enter().append("rect").attr("id",j=>t+"-exclude-"+j.start.format("YYYY-MM-DD")).attr("x",j=>y(j.start.startOf("day"))+R).attr("y",i.gridLineStartPadding).attr("width",j=>y(j.end.endOf("day"))-y(j.start.startOf("day"))).attr("height",N-O-i.gridLineStartPadding).attr("transform-origin",function(j,J){return(y(j.start)+R+.5*(y(j.end)-y(j.start))).toString()+"px "+(J*L+.5*N).toString()+"px"}).attr("class","exclude-range")}b(C,"drawExcludeDays");function T(L,O,R,A){if(R<=0||L>O)return 1/0;let N=O-L,M=nk.default.duration({[A??"day"]:R}).asMilliseconds();return M<=0?1/0:Math.ceil(N/M)}b(T,"getEstimatedTickCount");function k(L,O,R,A){let N=n.db.getDateFormat(),M=n.db.getAxisFormat(),D;M?D=M:N==="D"?D="%d":D=i.axisFormat??"%Y-%m-%d";let B=JV(y).tickSize(-A+O+i.gridLineStartPadding).tickFormat(Oy(D)),$=/^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(n.db.getTickInterval()||i.tickInterval);if($!==null){let F=parseInt($[1],10);if(isNaN(F)||F<=0)se.warn(`Invalid tick interval value: "${$[1]}". Skipping custom tick interval.`);else{let q=$[2],G=n.db.getWeekday()||i.weekday,z=y.domain(),H=z[0],j=z[1],J=T(H,j,F,q);if(J>Eie)se.warn(`The tick interval "${F}${q}" would generate ${J} ticks, which exceeds the maximum allowed (${Eie}). This may indicate an invalid date or time range. Skipping custom tick interval.`);else switch(q){case"millisecond":B.ticks(Nf.every(F));break;case"second":B.ticks(Bc.every(F));break;case"minute":B.ticks(k0.every(F));break;case"hour":B.ticks(T0.every(F));break;case"day":B.ticks(Su.every(F));break;case"week":B.ticks(qje[G].every(F));break;case"month":B.ticks(C0.every(F));break}}}if(g.append("g").attr("class","grid").attr("transform","translate("+L+", "+(A-50)+")").call(B).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10).attr("dy","1em"),n.db.topAxisEnabled()||i.topAxis){let F=QV(y).tickSize(-A+O+i.gridLineStartPadding).tickFormat(Oy(D));if($!==null){let q=parseInt($[1],10);if(isNaN(q)||q<=0)se.warn(`Invalid tick interval value: "${$[1]}". Skipping custom tick interval.`);else{let G=$[2],z=n.db.getWeekday()||i.weekday,H=y.domain(),j=H[0],J=H[1];if(T(j,J,q,G)<=Eie)switch(G){case"millisecond":F.ticks(Nf.every(q));break;case"second":F.ticks(Bc.every(q));break;case"minute":F.ticks(k0.every(q));break;case"hour":F.ticks(T0.every(q));break;case"day":F.ticks(Su.every(q));break;case"week":F.ticks(qje[z].every(q));break;case"month":F.ticks(C0.every(q));break}}}g.append("g").attr("class","grid").attr("transform","translate("+L+", "+O+")").call(F).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10)}}b(k,"makeGrid");function S(L,O){let R=0,A=Object.keys(p).map(N=>[N,p[N]]);g.append("g").selectAll("text").data(A).enter().append(function(N){let M=N[0].split(Ct.lineBreakRegex),D=-(M.length-1)/2,B=l.createElementNS("http://www.w3.org/2000/svg","text");B.setAttribute("dy",D+"em");for(let[P,$]of M.entries()){let F=l.createElementNS("http://www.w3.org/2000/svg","tspan");F.setAttribute("alignment-baseline","central"),F.setAttribute("x","10"),P>0&&F.setAttribute("dy","1em"),F.textContent=$,B.appendChild(F)}return B}).attr("x",10).attr("y",function(N,M){if(M>0)for(let D=0;D` .mermaid-main-font { font-family: ${e.fontFamily}; } @@ -1704,8 +1704,8 @@ Expecting `+xe.join(", ")+", got '"+(this.terminals_[Oe]||Oe)+"'":ce="Parse erro fill: ${e.titleColor||e.textColor}; font-family: ${e.fontFamily}; } -`,"getStyles"),Qjt=Zjt,Jjt={parser:cjt,db:Ujt,renderer:Kjt,styles:Qjt}});var nKe={};Tr(nKe,{diagram:()=>sKt});var eKt,tKt,rKt,nKt,iKt,aKt,sKt,iKe=W(()=>{za();_r();Rr();hr();Co();eKt={parse:b(async e=>{let t=await ba("info",e);se.debug(t)},"parse")},tKt={version:"11.16.0"},rKt=b(()=>tKt.version,"getVersion"),nKt={getVersion:rKt},iKt=b((e,t,r)=>{se.debug(`rendering info diagram -`+e);let n=Qn(t);vn(n,100,400,!0),n.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${r}`)},"draw"),aKt={draw:iKt},sKt={parser:eKt,db:nKt,renderer:aKt}});var oKe={};Tr(oKe,{diagram:()=>wKt});var aKe,$ie,fO,zie,oKt,lKt,cKt,uKt,hKt,fKt,dKt,sKe,pKt,mKt,gKt,yKt,vKt,xKt,bKt,wKt,lKe=W(()=>{Sl();za();Sn();_r();Rr();hr();Co();fn();aKe=Lr.pie,$ie={sections:new Map,showData:!1,config:aKe},fO=$ie.sections,zie=$ie.showData,oKt=structuredClone(aKe),lKt=b(()=>structuredClone(oKt),"getConfig"),cKt=b(()=>{fO=new Map,zie=$ie.showData,Nr()},"clear"),uKt=b(({label:e,value:t})=>{if(t<0)throw new Error(`"${e}" has invalid value: ${t}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);fO.has(e)||(fO.set(e,t),se.debug(`added new section: ${e}, with value: ${t}`))},"addSection"),hKt=b(()=>fO,"getSections"),fKt=b(e=>{zie=e},"setShowData"),dKt=b(()=>zie,"getShowData"),sKe={getConfig:lKt,clear:cKt,setDiagramTitle:ln,getDiagramTitle:tn,setAccTitle:Yr,getAccTitle:Qr,setAccDescription:Jr,getAccDescription:en,addSection:uKt,getSections:hKt,setShowData:fKt,getShowData:dKt},pKt=b((e,t)=>{wi(e,t),t.setShowData(e.showData),e.sections.map(t.addSection)},"populateDb"),mKt={parse:b(async e=>{let t=await ba("pie",e);se.debug(t),pKt(t,sKe)},"parse")},gKt=b(e=>` +`,"getStyles"),rKt=tKt,nKt={parser:djt,db:Kjt,renderer:eKt,styles:rKt}});var aKe={};Tr(aKe,{diagram:()=>uKt});var iKt,aKt,sKt,oKt,lKt,cKt,uKt,sKe=W(()=>{za();_r();Rr();hr();Co();iKt={parse:b(async e=>{let t=await ba("info",e);se.debug(t)},"parse")},aKt={version:"11.16.0"},sKt=b(()=>aKt.version,"getVersion"),oKt={getVersion:sKt},lKt=b((e,t,r)=>{se.debug(`rendering info diagram +`+e);let n=Qn(t);vn(n,100,400,!0),n.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${r}`)},"draw"),cKt={draw:lKt},uKt={parser:iKt,db:oKt,renderer:cKt}});var cKe={};Tr(cKe,{diagram:()=>SKt});var oKe,Gie,fO,qie,hKt,fKt,dKt,pKt,mKt,gKt,yKt,lKe,vKt,xKt,bKt,wKt,kKt,TKt,CKt,SKt,uKe=W(()=>{El();za();Sn();_r();Rr();hr();Co();fn();oKe=Lr.pie,Gie={sections:new Map,showData:!1,config:oKe},fO=Gie.sections,qie=Gie.showData,hKt=structuredClone(oKe),fKt=b(()=>structuredClone(hKt),"getConfig"),dKt=b(()=>{fO=new Map,qie=Gie.showData,Nr()},"clear"),pKt=b(({label:e,value:t})=>{if(t<0)throw new Error(`"${e}" has invalid value: ${t}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);fO.has(e)||(fO.set(e,t),se.debug(`added new section: ${e}, with value: ${t}`))},"addSection"),mKt=b(()=>fO,"getSections"),gKt=b(e=>{qie=e},"setShowData"),yKt=b(()=>qie,"getShowData"),lKe={getConfig:fKt,clear:dKt,setDiagramTitle:ln,getDiagramTitle:tn,setAccTitle:Yr,getAccTitle:Qr,setAccDescription:Jr,getAccDescription:en,addSection:pKt,getSections:mKt,setShowData:gKt,getShowData:yKt},vKt=b((e,t)=>{wi(e,t),t.setShowData(e.showData),e.sections.map(t.addSection)},"populateDb"),xKt={parse:b(async e=>{let t=await ba("pie",e);se.debug(t),vKt(t,lKe)},"parse")},bKt=b(e=>` .pieCircle{ stroke: ${e.pieStrokeColor}; stroke-width : ${e.pieStrokeWidth}; @@ -1742,25 +1742,25 @@ Expecting `+xe.join(", ")+", got '"+(this.terminals_[Oe]||Oe)+"'":ce="Parse erro font-family: ${e.fontFamily}; font-size: ${e.pieLegendTextSize}; } -`,"getStyles"),yKt=gKt,vKt=b(e=>{let t=[...e.values()].reduce((i,a)=>i+a,0),r=[...e.entries()].map(([i,a])=>({label:i,value:a})).filter(i=>i.value/t*100>=1);return RH().value(i=>i.value).sort(null)(r)},"createPieArcs"),xKt=b((e,t,r,n)=>{se.debug(`rendering pie chart -`+e);let i=n.db,a=Be(),s=Rn(i.getConfig(),a.pie),o=40,l=18,u=4,h=450,f=h,d=Qn(t),p=d.append("g");p.attr("transform","translate("+f/2+","+h/2+")");let{themeVariables:m}=a,[g]=Zl(m.pieOuterStrokeWidth);g??=2;let y=s.legendPosition,v=s.textPosition,x=s.donutHole>0&&s.donutHole<=.9?s.donutHole:0,w=Math.min(f,h)/2-o,C=Pf().innerRadius(x*w).outerRadius(w),T=Pf().innerRadius(w*v).outerRadius(w*v),k=p.append("g");k.append("circle").attr("cx",0).attr("cy",0).attr("r",w+g/2).attr("class","pieOuterCircle");let S=i.getSections(),E=vKt(S),I=[m.pie1,m.pie2,m.pie3,m.pie4,m.pie5,m.pie6,m.pie7,m.pie8,m.pie9,m.pie10,m.pie11,m.pie12],L=0;S.forEach(U=>{L+=U});let O=E.filter(U=>(U.data.value/L*100).toFixed(0)!=="0"),R=Pc(I).domain([...S.keys()]);k.selectAll("mySlices").data(O).enter().append("path").attr("d",C).attr("fill",U=>R(U.data.label)).attr("class",U=>{let le="pieCircle";return s.highlightSlice==="hover"?le+=" highlightedOnHover":s.highlightSlice===U.data.label&&(le+=" highlighted"),le}),k.selectAll("mySlices").data(O).enter().append("text").text(U=>(U.data.value/L*100).toFixed(0)+"%").attr("transform",U=>"translate("+T.centroid(U)+")").style("text-anchor","middle").attr("class","slice");let A=p.append("text").text(i.getDiagramTitle()).attr("x",0).attr("y",-(h-50)/2).attr("class","pieTitleText"),N=[...S.entries()].map(([U,le])=>({label:U,value:le})),M=p.selectAll(".legend").data(N).enter().append("g").attr("class","legend");M.append("rect").attr("width",l).attr("height",l).style("fill",U=>R(U.label)).style("stroke",U=>R(U.label)),M.append("text").attr("x",l+u).attr("y",l-u).text(U=>i.getShowData()?`${U.label} [${U.value}]`:U.label);let D=Math.max(...M.selectAll("text").nodes().map(U=>U?.getBoundingClientRect().width??0)),B=h,P=f+o,$=l+u,F=N.length*$;switch(y){case"center":M.attr("transform",(U,le)=>{let ee=$*N.length/2,ue=-D/2-(l+u),ae=le*$-ee;return"translate("+ue+","+ae+")"});break;case"top":B+=F,M.attr("transform",(U,le)=>{let ee=w,ue=-D/2-(l+u),ae=le*$-ee;return`translate(${ue}, ${ae})`}),k.attr("transform",()=>`translate(0, ${F+$})`);break;case"bottom":B+=F,M.attr("transform",(U,le)=>{let ee=-w-$,ue=-D/2-(l+u),ae=le*$-ee;return"translate("+ue+","+ae+")"});break;case"left":P+=l+u+D,M.attr("transform",(U,le)=>{let ee=$*N.length/2,ue=-w-(l+u),ae=le*$-ee;return"translate("+ue+","+ae+")"}),k.attr("transform",()=>`translate(${D+l+u}, 0)`);break;default:P+=l+u+D,M.attr("transform",(U,le)=>{let ee=$*N.length/2,ue=12*l,ae=le*$-ee;return"translate("+ue+","+ae+")"});break}let q=A.node()?.getBoundingClientRect().width??0,G=f/2-q/2,z=f/2+q/2,H=Math.min(0,G),J=Math.max(P,z)-H;d.attr("viewBox",`${H} 0 ${J} ${B}`),vn(d,B,J,s.useMaxWidth)},"draw"),bKt={draw:xKt},wKt={parser:mKt,db:sKe,renderer:bKt,styles:yKt}});var CKe={};Tr(CKe,{diagram:()=>_Kt});function qie(e){return!/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(e)}function cKe(e){return!/^\d+$/.test(e)}function uKe(e){return!/^\d+px$/.test(e)}function Cd(e){return Mr(e.trim(),Be())}function hKe(e){So.setData({quadrant1Text:Cd(e.text)})}function fKe(e){So.setData({quadrant2Text:Cd(e.text)})}function dKe(e){So.setData({quadrant3Text:Cd(e.text)})}function pKe(e){So.setData({quadrant4Text:Cd(e.text)})}function mKe(e){So.setData({xAxisLeftText:Cd(e.text)})}function gKe(e){So.setData({xAxisRightText:Cd(e.text)})}function yKe(e){So.setData({yAxisTopText:Cd(e.text)})}function vKe(e){So.setData({yAxisBottomText:Cd(e.text)})}function pO(e){let t={};for(let r of e){let[n,i]=r.trim().split(/\s*:\s*/);if(n==="radius"){if(cKe(i))throw new dO(n,i,"number");t.radius=parseInt(i)}else if(n==="color"){if(qie(i))throw new dO(n,i,"hex code");t.color=i}else if(n==="stroke-color"){if(qie(i))throw new dO(n,i,"hex code");t.strokeColor=i}else if(n==="stroke-width"){if(uKe(i))throw new dO(n,i,"number of pixels (eg. 10px)");t.strokeWidth=i}else throw new Error(`style named ${n} is not supported.`)}return t}function xKe(e,t,r,n,i){let a=pO(i);So.addPoints([{x:r,y:n,text:Cd(e.text),className:t,...a}])}function bKe(e,t){So.addClass(e,pO(t))}function wKe(e){So.setConfig({chartWidth:e})}function kKe(e){So.setConfig({chartHeight:e})}function TKe(){let e=Be(),{themeVariables:t,quadrantChart:r}=e;return r&&So.setConfig(r),So.setThemeConfig({quadrant1Fill:t.quadrant1Fill,quadrant2Fill:t.quadrant2Fill,quadrant3Fill:t.quadrant3Fill,quadrant4Fill:t.quadrant4Fill,quadrant1TextFill:t.quadrant1TextFill,quadrant2TextFill:t.quadrant2TextFill,quadrant3TextFill:t.quadrant3TextFill,quadrant4TextFill:t.quadrant4TextFill,quadrantPointFill:t.quadrantPointFill,quadrantPointTextFill:t.quadrantPointTextFill,quadrantXAxisTextFill:t.quadrantXAxisTextFill,quadrantYAxisTextFill:t.quadrantYAxisTextFill,quadrantExternalBorderStrokeFill:t.quadrantExternalBorderStrokeFill,quadrantInternalBorderStrokeFill:t.quadrantInternalBorderStrokeFill,quadrantTitleFill:t.quadrantTitleFill}),So.setData({titleText:tn()}),So.build()}var Gie,kKt,Ol,TKt,dO,So,CKt,SKt,EKt,AKt,_Kt,SKe=W(()=>{_r();Rr();hr();fn();fn();Gie=(function(){var e=b(function(K,ve,Z,je){for(Z=Z||{},je=K.length;je--;Z[K[je]]=ve);return Z},"o"),t=[1,3],r=[1,4],n=[1,5],i=[1,6],a=[1,7],s=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],o=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],l=[55,56,57],u=[2,36],h=[1,37],f=[1,36],d=[1,38],p=[1,35],m=[1,43],g=[1,41],y=[1,45],v=[1,14],x=[1,23],w=[1,18],C=[1,19],T=[1,20],k=[1,21],S=[1,22],E=[1,24],I=[1,25],L=[1,26],O=[1,27],R=[1,28],A=[1,29],N=[1,32],M=[1,33],D=[1,34],B=[1,39],P=[1,40],$=[1,42],F=[1,44],q=[1,63],G=[1,62],z=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],H=[1,66],j=[1,67],J=[1,68],U=[1,69],le=[1,70],ee=[1,71],ue=[1,72],ae=[1,73],oe=[1,74],Re=[1,75],Te=[1,76],Oe=[1,77],qe=[4,5,6,7,8,9,10,11,12,13,14,15,18],Ge=[1,91],fe=[1,92],Ce=[1,93],_e=[1,100],de=[1,94],ie=[1,97],Q=[1,95],he=[1,96],xe=[1,98],ce=[1,99],ge=[1,103],Ie=[10,55,56,57],ye=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],ne={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:b(function(ve,Z,je,Ne,ze,Fe,Ke){var Ve=Fe.length-1;switch(ze){case 23:this.$=Fe[Ve];break;case 24:this.$=Fe[Ve-1]+""+Fe[Ve];break;case 26:this.$=Fe[Ve-1]+Fe[Ve];break;case 27:this.$=[Fe[Ve].trim()];break;case 28:Fe[Ve-2].push(Fe[Ve].trim()),this.$=Fe[Ve-2];break;case 29:this.$=Fe[Ve-4],Ne.addClass(Fe[Ve-2],Fe[Ve]);break;case 37:this.$=[];break;case 42:this.$=Fe[Ve].trim(),Ne.setDiagramTitle(this.$);break;case 43:this.$=Fe[Ve].trim(),Ne.setAccTitle(this.$);break;case 44:case 45:this.$=Fe[Ve].trim(),Ne.setAccDescription(this.$);break;case 46:Ne.addSection(Fe[Ve].substr(8)),this.$=Fe[Ve].substr(8);break;case 47:Ne.addPoint(Fe[Ve-3],"",Fe[Ve-1],Fe[Ve],[]);break;case 48:Ne.addPoint(Fe[Ve-4],Fe[Ve-3],Fe[Ve-1],Fe[Ve],[]);break;case 49:Ne.addPoint(Fe[Ve-4],"",Fe[Ve-2],Fe[Ve-1],Fe[Ve]);break;case 50:Ne.addPoint(Fe[Ve-5],Fe[Ve-4],Fe[Ve-2],Fe[Ve-1],Fe[Ve]);break;case 51:Ne.setXAxisLeftText(Fe[Ve-2]),Ne.setXAxisRightText(Fe[Ve]);break;case 52:Fe[Ve-1].text+=" \u27F6 ",Ne.setXAxisLeftText(Fe[Ve-1]);break;case 53:Ne.setXAxisLeftText(Fe[Ve]);break;case 54:Ne.setYAxisBottomText(Fe[Ve-2]),Ne.setYAxisTopText(Fe[Ve]);break;case 55:Fe[Ve-1].text+=" \u27F6 ",Ne.setYAxisBottomText(Fe[Ve-1]);break;case 56:Ne.setYAxisBottomText(Fe[Ve]);break;case 57:Ne.setQuadrant1Text(Fe[Ve]);break;case 58:Ne.setQuadrant2Text(Fe[Ve]);break;case 59:Ne.setQuadrant3Text(Fe[Ve]);break;case 60:Ne.setQuadrant4Text(Fe[Ve]);break;case 64:this.$={text:Fe[Ve],type:"text"};break;case 65:this.$={text:Fe[Ve-1].text+""+Fe[Ve],type:Fe[Ve-1].type};break;case 66:this.$={text:Fe[Ve],type:"text"};break;case 67:this.$={text:Fe[Ve],type:"markdown"};break;case 68:this.$=Fe[Ve];break;case 69:this.$=Fe[Ve-1]+""+Fe[Ve];break}},"anonymous"),table:[{18:t,26:1,27:2,28:r,55:n,56:i,57:a},{1:[3]},{18:t,26:8,27:2,28:r,55:n,56:i,57:a},{18:t,26:9,27:2,28:r,55:n,56:i,57:a},e(s,[2,33],{29:10}),e(o,[2,61]),e(o,[2,62]),e(o,[2,63]),{1:[2,30]},{1:[2,31]},e(l,u,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:h,5:f,10:d,12:p,13:m,14:g,15:y,18:v,25:x,35:w,37:C,39:T,41:k,42:S,48:E,50:I,51:L,52:O,53:R,54:A,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),e(s,[2,34]),{27:46,55:n,56:i,57:a},e(l,[2,37]),e(l,u,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:h,5:f,10:d,12:p,13:m,14:g,15:y,18:v,25:x,35:w,37:C,39:T,41:k,42:S,48:E,50:I,51:L,52:O,53:R,54:A,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),e(l,[2,39]),e(l,[2,40]),e(l,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},e(l,[2,45]),e(l,[2,46]),{18:[1,51]},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:52,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:53,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:54,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:55,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:56,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:57,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,44:[1,58],47:[1,59],58:61,59:60,63:D,64:B,65:P,66:$,67:F},e(z,[2,64]),e(z,[2,66]),e(z,[2,67]),e(z,[2,70]),e(z,[2,71]),e(z,[2,72]),e(z,[2,73]),e(z,[2,74]),e(z,[2,75]),e(z,[2,76]),e(z,[2,77]),e(z,[2,78]),e(z,[2,79]),e(z,[2,80]),e(z,[2,81]),e(s,[2,35]),e(l,[2,38]),e(l,[2,42]),e(l,[2,43]),e(l,[2,44]),{3:65,4:H,5:j,6:J,7:U,8:le,9:ee,10:ue,11:ae,12:oe,13:Re,14:Te,15:Oe,21:64},e(l,[2,53],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,49:[1,78],63:D,64:B,65:P,66:$,67:F}),e(l,[2,56],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,49:[1,79],63:D,64:B,65:P,66:$,67:F}),e(l,[2,57],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,58],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,59],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,60],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),{45:[1,80]},{44:[1,81]},e(z,[2,65]),e(z,[2,82]),e(z,[2,83]),e(z,[2,84]),{3:83,4:H,5:j,6:J,7:U,8:le,9:ee,10:ue,11:ae,12:oe,13:Re,14:Te,15:Oe,18:[1,82]},e(qe,[2,23]),e(qe,[2,1]),e(qe,[2,2]),e(qe,[2,3]),e(qe,[2,4]),e(qe,[2,5]),e(qe,[2,6]),e(qe,[2,7]),e(qe,[2,8]),e(qe,[2,9]),e(qe,[2,10]),e(qe,[2,11]),e(qe,[2,12]),e(l,[2,52],{58:31,43:84,4:h,5:f,10:d,12:p,13:m,14:g,15:y,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),e(l,[2,55],{58:31,43:85,4:h,5:f,10:d,12:p,13:m,14:g,15:y,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),{46:[1,86]},{45:[1,87]},{4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,16:90,17:Q,18:he,19:xe,20:ce,22:89,23:88},e(qe,[2,24]),e(l,[2,51],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,54],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,47],{22:89,16:90,23:101,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce}),{46:[1,102]},e(l,[2,29],{10:ge}),e(Ie,[2,27],{16:104,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce}),e(ye,[2,25]),e(ye,[2,13]),e(ye,[2,14]),e(ye,[2,15]),e(ye,[2,16]),e(ye,[2,17]),e(ye,[2,18]),e(ye,[2,19]),e(ye,[2,20]),e(ye,[2,21]),e(ye,[2,22]),e(l,[2,49],{10:ge}),e(l,[2,48],{22:89,16:90,23:105,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce}),{4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,16:90,17:Q,18:he,19:xe,20:ce,22:106},e(ye,[2,26]),e(l,[2,50],{10:ge}),e(Ie,[2,28],{16:104,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce})],defaultActions:{8:[2,30],9:[2,31]},parseError:b(function(ve,Z){if(Z.recoverable)this.trace(ve);else{var je=new Error(ve);throw je.hash=Z,je}},"parseError"),parse:b(function(ve){var Z=this,je=[0],Ne=[],ze=[null],Fe=[],Ke=this.table,Ve="",tt=0,We=0,rt=0,Se=2,Et=1,De=Fe.slice.call(arguments,1),mt=Object.create(this.lexer),Tt={yy:{}};for(var jt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,jt)&&(Tt.yy[jt]=this.yy[jt]);mt.setInput(ve,Tt.yy),Tt.yy.lexer=mt,Tt.yy.parser=this,typeof mt.yylloc>"u"&&(mt.yylloc={});var _t=mt.yylloc;Fe.push(_t);var Rt=mt.options&&mt.options.ranges;typeof Tt.yy.parseError=="function"?this.parseError=Tt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function bt(Qt){je.length=je.length-2*Qt,ze.length=ze.length-Qt,Fe.length=Fe.length-Qt}b(bt,"popStack");function ke(){var Qt;return Qt=Ne.pop()||mt.lex()||Et,typeof Qt!="number"&&(Qt instanceof Array&&(Ne=Qt,Qt=Ne.pop()),Qt=Z.symbols_[Qt]||Qt),Qt}b(ke,"lex");for(var yt,xt,it,Me,ut,at,dt={},tr,Vt,rr,Dr;;){if(it=je[je.length-1],this.defaultActions[it]?Me=this.defaultActions[it]:((yt===null||typeof yt>"u")&&(yt=ke()),Me=Ke[it]&&Ke[it][yt]),typeof Me>"u"||!Me.length||!Me[0]){var vr="";Dr=[];for(tr in Ke[it])this.terminals_[tr]&&tr>Se&&Dr.push("'"+this.terminals_[tr]+"'");mt.showPosition?vr="Parse error on line "+(tt+1)+`: +`,"getStyles"),wKt=bKt,kKt=b(e=>{let t=[...e.values()].reduce((i,a)=>i+a,0),r=[...e.entries()].map(([i,a])=>({label:i,value:a})).filter(i=>i.value/t*100>=1);return IH().value(i=>i.value).sort(null)(r)},"createPieArcs"),TKt=b((e,t,r,n)=>{se.debug(`rendering pie chart +`+e);let i=n.db,a=Be(),s=Rn(i.getConfig(),a.pie),o=40,l=18,u=4,h=450,f=h,d=Qn(t),p=d.append("g");p.attr("transform","translate("+f/2+","+h/2+")");let{themeVariables:m}=a,[g]=Ql(m.pieOuterStrokeWidth);g??=2;let y=s.legendPosition,v=s.textPosition,x=s.donutHole>0&&s.donutHole<=.9?s.donutHole:0,w=Math.min(f,h)/2-o,C=Pf().innerRadius(x*w).outerRadius(w),T=Pf().innerRadius(w*v).outerRadius(w*v),k=p.append("g");k.append("circle").attr("cx",0).attr("cy",0).attr("r",w+g/2).attr("class","pieOuterCircle");let S=i.getSections(),E=kKt(S),I=[m.pie1,m.pie2,m.pie3,m.pie4,m.pie5,m.pie6,m.pie7,m.pie8,m.pie9,m.pie10,m.pie11,m.pie12],L=0;S.forEach(U=>{L+=U});let O=E.filter(U=>(U.data.value/L*100).toFixed(0)!=="0"),R=Pc(I).domain([...S.keys()]);k.selectAll("mySlices").data(O).enter().append("path").attr("d",C).attr("fill",U=>R(U.data.label)).attr("class",U=>{let le="pieCircle";return s.highlightSlice==="hover"?le+=" highlightedOnHover":s.highlightSlice===U.data.label&&(le+=" highlighted"),le}),k.selectAll("mySlices").data(O).enter().append("text").text(U=>(U.data.value/L*100).toFixed(0)+"%").attr("transform",U=>"translate("+T.centroid(U)+")").style("text-anchor","middle").attr("class","slice");let A=p.append("text").text(i.getDiagramTitle()).attr("x",0).attr("y",-(h-50)/2).attr("class","pieTitleText"),N=[...S.entries()].map(([U,le])=>({label:U,value:le})),M=p.selectAll(".legend").data(N).enter().append("g").attr("class","legend");M.append("rect").attr("width",l).attr("height",l).style("fill",U=>R(U.label)).style("stroke",U=>R(U.label)),M.append("text").attr("x",l+u).attr("y",l-u).text(U=>i.getShowData()?`${U.label} [${U.value}]`:U.label);let D=Math.max(...M.selectAll("text").nodes().map(U=>U?.getBoundingClientRect().width??0)),B=h,P=f+o,$=l+u,F=N.length*$;switch(y){case"center":M.attr("transform",(U,le)=>{let ee=$*N.length/2,ue=-D/2-(l+u),ae=le*$-ee;return"translate("+ue+","+ae+")"});break;case"top":B+=F,M.attr("transform",(U,le)=>{let ee=w,ue=-D/2-(l+u),ae=le*$-ee;return`translate(${ue}, ${ae})`}),k.attr("transform",()=>`translate(0, ${F+$})`);break;case"bottom":B+=F,M.attr("transform",(U,le)=>{let ee=-w-$,ue=-D/2-(l+u),ae=le*$-ee;return"translate("+ue+","+ae+")"});break;case"left":P+=l+u+D,M.attr("transform",(U,le)=>{let ee=$*N.length/2,ue=-w-(l+u),ae=le*$-ee;return"translate("+ue+","+ae+")"}),k.attr("transform",()=>`translate(${D+l+u}, 0)`);break;default:P+=l+u+D,M.attr("transform",(U,le)=>{let ee=$*N.length/2,ue=12*l,ae=le*$-ee;return"translate("+ue+","+ae+")"});break}let q=A.node()?.getBoundingClientRect().width??0,G=f/2-q/2,z=f/2+q/2,H=Math.min(0,G),J=Math.max(P,z)-H;d.attr("viewBox",`${H} 0 ${J} ${B}`),vn(d,B,J,s.useMaxWidth)},"draw"),CKt={draw:TKt},SKt={parser:xKt,db:lKe,renderer:CKt,styles:wKt}});var EKe={};Tr(EKe,{diagram:()=>MKt});function Wie(e){return!/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(e)}function hKe(e){return!/^\d+$/.test(e)}function fKe(e){return!/^\d+px$/.test(e)}function Cd(e){return Mr(e.trim(),Be())}function dKe(e){So.setData({quadrant1Text:Cd(e.text)})}function pKe(e){So.setData({quadrant2Text:Cd(e.text)})}function mKe(e){So.setData({quadrant3Text:Cd(e.text)})}function gKe(e){So.setData({quadrant4Text:Cd(e.text)})}function yKe(e){So.setData({xAxisLeftText:Cd(e.text)})}function vKe(e){So.setData({xAxisRightText:Cd(e.text)})}function xKe(e){So.setData({yAxisTopText:Cd(e.text)})}function bKe(e){So.setData({yAxisBottomText:Cd(e.text)})}function pO(e){let t={};for(let r of e){let[n,i]=r.trim().split(/\s*:\s*/);if(n==="radius"){if(hKe(i))throw new dO(n,i,"number");t.radius=parseInt(i)}else if(n==="color"){if(Wie(i))throw new dO(n,i,"hex code");t.color=i}else if(n==="stroke-color"){if(Wie(i))throw new dO(n,i,"hex code");t.strokeColor=i}else if(n==="stroke-width"){if(fKe(i))throw new dO(n,i,"number of pixels (eg. 10px)");t.strokeWidth=i}else throw new Error(`style named ${n} is not supported.`)}return t}function wKe(e,t,r,n,i){let a=pO(i);So.addPoints([{x:r,y:n,text:Cd(e.text),className:t,...a}])}function kKe(e,t){So.addClass(e,pO(t))}function TKe(e){So.setConfig({chartWidth:e})}function CKe(e){So.setConfig({chartHeight:e})}function SKe(){let e=Be(),{themeVariables:t,quadrantChart:r}=e;return r&&So.setConfig(r),So.setThemeConfig({quadrant1Fill:t.quadrant1Fill,quadrant2Fill:t.quadrant2Fill,quadrant3Fill:t.quadrant3Fill,quadrant4Fill:t.quadrant4Fill,quadrant1TextFill:t.quadrant1TextFill,quadrant2TextFill:t.quadrant2TextFill,quadrant3TextFill:t.quadrant3TextFill,quadrant4TextFill:t.quadrant4TextFill,quadrantPointFill:t.quadrantPointFill,quadrantPointTextFill:t.quadrantPointTextFill,quadrantXAxisTextFill:t.quadrantXAxisTextFill,quadrantYAxisTextFill:t.quadrantYAxisTextFill,quadrantExternalBorderStrokeFill:t.quadrantExternalBorderStrokeFill,quadrantInternalBorderStrokeFill:t.quadrantInternalBorderStrokeFill,quadrantTitleFill:t.quadrantTitleFill}),So.setData({titleText:tn()}),So.build()}var Vie,EKt,Pl,AKt,dO,So,_Kt,RKt,LKt,IKt,MKt,AKe=W(()=>{_r();Rr();hr();fn();fn();Vie=(function(){var e=b(function(K,ve,Z,je){for(Z=Z||{},je=K.length;je--;Z[K[je]]=ve);return Z},"o"),t=[1,3],r=[1,4],n=[1,5],i=[1,6],a=[1,7],s=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],o=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],l=[55,56,57],u=[2,36],h=[1,37],f=[1,36],d=[1,38],p=[1,35],m=[1,43],g=[1,41],y=[1,45],v=[1,14],x=[1,23],w=[1,18],C=[1,19],T=[1,20],k=[1,21],S=[1,22],E=[1,24],I=[1,25],L=[1,26],O=[1,27],R=[1,28],A=[1,29],N=[1,32],M=[1,33],D=[1,34],B=[1,39],P=[1,40],$=[1,42],F=[1,44],q=[1,63],G=[1,62],z=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],H=[1,66],j=[1,67],J=[1,68],U=[1,69],le=[1,70],ee=[1,71],ue=[1,72],ae=[1,73],oe=[1,74],Re=[1,75],Te=[1,76],Oe=[1,77],qe=[4,5,6,7,8,9,10,11,12,13,14,15,18],Ge=[1,91],fe=[1,92],Ce=[1,93],_e=[1,100],de=[1,94],ie=[1,97],Q=[1,95],he=[1,96],xe=[1,98],ce=[1,99],ge=[1,103],Ie=[10,55,56,57],ye=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],ne={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:b(function(ve,Z,je,Ne,ze,Fe,Ke){var Ve=Fe.length-1;switch(ze){case 23:this.$=Fe[Ve];break;case 24:this.$=Fe[Ve-1]+""+Fe[Ve];break;case 26:this.$=Fe[Ve-1]+Fe[Ve];break;case 27:this.$=[Fe[Ve].trim()];break;case 28:Fe[Ve-2].push(Fe[Ve].trim()),this.$=Fe[Ve-2];break;case 29:this.$=Fe[Ve-4],Ne.addClass(Fe[Ve-2],Fe[Ve]);break;case 37:this.$=[];break;case 42:this.$=Fe[Ve].trim(),Ne.setDiagramTitle(this.$);break;case 43:this.$=Fe[Ve].trim(),Ne.setAccTitle(this.$);break;case 44:case 45:this.$=Fe[Ve].trim(),Ne.setAccDescription(this.$);break;case 46:Ne.addSection(Fe[Ve].substr(8)),this.$=Fe[Ve].substr(8);break;case 47:Ne.addPoint(Fe[Ve-3],"",Fe[Ve-1],Fe[Ve],[]);break;case 48:Ne.addPoint(Fe[Ve-4],Fe[Ve-3],Fe[Ve-1],Fe[Ve],[]);break;case 49:Ne.addPoint(Fe[Ve-4],"",Fe[Ve-2],Fe[Ve-1],Fe[Ve]);break;case 50:Ne.addPoint(Fe[Ve-5],Fe[Ve-4],Fe[Ve-2],Fe[Ve-1],Fe[Ve]);break;case 51:Ne.setXAxisLeftText(Fe[Ve-2]),Ne.setXAxisRightText(Fe[Ve]);break;case 52:Fe[Ve-1].text+=" \u27F6 ",Ne.setXAxisLeftText(Fe[Ve-1]);break;case 53:Ne.setXAxisLeftText(Fe[Ve]);break;case 54:Ne.setYAxisBottomText(Fe[Ve-2]),Ne.setYAxisTopText(Fe[Ve]);break;case 55:Fe[Ve-1].text+=" \u27F6 ",Ne.setYAxisBottomText(Fe[Ve-1]);break;case 56:Ne.setYAxisBottomText(Fe[Ve]);break;case 57:Ne.setQuadrant1Text(Fe[Ve]);break;case 58:Ne.setQuadrant2Text(Fe[Ve]);break;case 59:Ne.setQuadrant3Text(Fe[Ve]);break;case 60:Ne.setQuadrant4Text(Fe[Ve]);break;case 64:this.$={text:Fe[Ve],type:"text"};break;case 65:this.$={text:Fe[Ve-1].text+""+Fe[Ve],type:Fe[Ve-1].type};break;case 66:this.$={text:Fe[Ve],type:"text"};break;case 67:this.$={text:Fe[Ve],type:"markdown"};break;case 68:this.$=Fe[Ve];break;case 69:this.$=Fe[Ve-1]+""+Fe[Ve];break}},"anonymous"),table:[{18:t,26:1,27:2,28:r,55:n,56:i,57:a},{1:[3]},{18:t,26:8,27:2,28:r,55:n,56:i,57:a},{18:t,26:9,27:2,28:r,55:n,56:i,57:a},e(s,[2,33],{29:10}),e(o,[2,61]),e(o,[2,62]),e(o,[2,63]),{1:[2,30]},{1:[2,31]},e(l,u,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:h,5:f,10:d,12:p,13:m,14:g,15:y,18:v,25:x,35:w,37:C,39:T,41:k,42:S,48:E,50:I,51:L,52:O,53:R,54:A,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),e(s,[2,34]),{27:46,55:n,56:i,57:a},e(l,[2,37]),e(l,u,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:h,5:f,10:d,12:p,13:m,14:g,15:y,18:v,25:x,35:w,37:C,39:T,41:k,42:S,48:E,50:I,51:L,52:O,53:R,54:A,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),e(l,[2,39]),e(l,[2,40]),e(l,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},e(l,[2,45]),e(l,[2,46]),{18:[1,51]},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:52,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:53,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:54,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:55,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:56,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,10:d,12:p,13:m,14:g,15:y,43:57,58:31,60:N,61:M,63:D,64:B,65:P,66:$,67:F},{4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,44:[1,58],47:[1,59],58:61,59:60,63:D,64:B,65:P,66:$,67:F},e(z,[2,64]),e(z,[2,66]),e(z,[2,67]),e(z,[2,70]),e(z,[2,71]),e(z,[2,72]),e(z,[2,73]),e(z,[2,74]),e(z,[2,75]),e(z,[2,76]),e(z,[2,77]),e(z,[2,78]),e(z,[2,79]),e(z,[2,80]),e(z,[2,81]),e(s,[2,35]),e(l,[2,38]),e(l,[2,42]),e(l,[2,43]),e(l,[2,44]),{3:65,4:H,5:j,6:J,7:U,8:le,9:ee,10:ue,11:ae,12:oe,13:Re,14:Te,15:Oe,21:64},e(l,[2,53],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,49:[1,78],63:D,64:B,65:P,66:$,67:F}),e(l,[2,56],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,49:[1,79],63:D,64:B,65:P,66:$,67:F}),e(l,[2,57],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,58],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,59],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,60],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),{45:[1,80]},{44:[1,81]},e(z,[2,65]),e(z,[2,82]),e(z,[2,83]),e(z,[2,84]),{3:83,4:H,5:j,6:J,7:U,8:le,9:ee,10:ue,11:ae,12:oe,13:Re,14:Te,15:Oe,18:[1,82]},e(qe,[2,23]),e(qe,[2,1]),e(qe,[2,2]),e(qe,[2,3]),e(qe,[2,4]),e(qe,[2,5]),e(qe,[2,6]),e(qe,[2,7]),e(qe,[2,8]),e(qe,[2,9]),e(qe,[2,10]),e(qe,[2,11]),e(qe,[2,12]),e(l,[2,52],{58:31,43:84,4:h,5:f,10:d,12:p,13:m,14:g,15:y,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),e(l,[2,55],{58:31,43:85,4:h,5:f,10:d,12:p,13:m,14:g,15:y,60:N,61:M,63:D,64:B,65:P,66:$,67:F}),{46:[1,86]},{45:[1,87]},{4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,16:90,17:Q,18:he,19:xe,20:ce,22:89,23:88},e(qe,[2,24]),e(l,[2,51],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,54],{59:60,58:61,4:h,5:f,8:q,10:d,12:p,13:m,14:g,15:y,18:G,63:D,64:B,65:P,66:$,67:F}),e(l,[2,47],{22:89,16:90,23:101,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce}),{46:[1,102]},e(l,[2,29],{10:ge}),e(Ie,[2,27],{16:104,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce}),e(ye,[2,25]),e(ye,[2,13]),e(ye,[2,14]),e(ye,[2,15]),e(ye,[2,16]),e(ye,[2,17]),e(ye,[2,18]),e(ye,[2,19]),e(ye,[2,20]),e(ye,[2,21]),e(ye,[2,22]),e(l,[2,49],{10:ge}),e(l,[2,48],{22:89,16:90,23:105,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce}),{4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,16:90,17:Q,18:he,19:xe,20:ce,22:106},e(ye,[2,26]),e(l,[2,50],{10:ge}),e(Ie,[2,28],{16:104,4:Ge,5:fe,6:Ce,8:_e,11:de,13:ie,17:Q,18:he,19:xe,20:ce})],defaultActions:{8:[2,30],9:[2,31]},parseError:b(function(ve,Z){if(Z.recoverable)this.trace(ve);else{var je=new Error(ve);throw je.hash=Z,je}},"parseError"),parse:b(function(ve){var Z=this,je=[0],Ne=[],ze=[null],Fe=[],Ke=this.table,Ve="",tt=0,We=0,rt=0,Se=2,Et=1,De=Fe.slice.call(arguments,1),mt=Object.create(this.lexer),Tt={yy:{}};for(var jt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,jt)&&(Tt.yy[jt]=this.yy[jt]);mt.setInput(ve,Tt.yy),Tt.yy.lexer=mt,Tt.yy.parser=this,typeof mt.yylloc>"u"&&(mt.yylloc={});var _t=mt.yylloc;Fe.push(_t);var Rt=mt.options&&mt.options.ranges;typeof Tt.yy.parseError=="function"?this.parseError=Tt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function bt(Qt){je.length=je.length-2*Qt,ze.length=ze.length-Qt,Fe.length=Fe.length-Qt}b(bt,"popStack");function ke(){var Qt;return Qt=Ne.pop()||mt.lex()||Et,typeof Qt!="number"&&(Qt instanceof Array&&(Ne=Qt,Qt=Ne.pop()),Qt=Z.symbols_[Qt]||Qt),Qt}b(ke,"lex");for(var yt,xt,it,Me,ut,at,dt={},tr,Vt,rr,Dr;;){if(it=je[je.length-1],this.defaultActions[it]?Me=this.defaultActions[it]:((yt===null||typeof yt>"u")&&(yt=ke()),Me=Ke[it]&&Ke[it][yt]),typeof Me>"u"||!Me.length||!Me[0]){var vr="";Dr=[];for(tr in Ke[it])this.terminals_[tr]&&tr>Se&&Dr.push("'"+this.terminals_[tr]+"'");mt.showPosition?vr="Parse error on line "+(tt+1)+`: `+mt.showPosition()+` Expecting `+Dr.join(", ")+", got '"+(this.terminals_[yt]||yt)+"'":vr="Parse error on line "+(tt+1)+": Unexpected "+(yt==Et?"end of input":"'"+(this.terminals_[yt]||yt)+"'"),this.parseError(vr,{text:mt.match,token:this.terminals_[yt]||yt,line:mt.yylineno,loc:_t,expected:Dr})}if(Me[0]instanceof Array&&Me.length>1)throw new Error("Parse Error: multiple actions possible at state: "+it+", token: "+yt);switch(Me[0]){case 1:je.push(yt),ze.push(mt.yytext),Fe.push(mt.yylloc),je.push(Me[1]),yt=null,xt?(yt=xt,xt=null):(We=mt.yyleng,Ve=mt.yytext,tt=mt.yylineno,_t=mt.yylloc,rt>0&&rt--);break;case 2:if(Vt=this.productions_[Me[1]][1],dt.$=ze[ze.length-Vt],dt._$={first_line:Fe[Fe.length-(Vt||1)].first_line,last_line:Fe[Fe.length-1].last_line,first_column:Fe[Fe.length-(Vt||1)].first_column,last_column:Fe[Fe.length-1].last_column},Rt&&(dt._$.range=[Fe[Fe.length-(Vt||1)].range[0],Fe[Fe.length-1].range[1]]),at=this.performAction.apply(dt,[Ve,We,tt,Tt.yy,Me[1],ze,Fe].concat(De)),typeof at<"u")return at;Vt&&(je=je.slice(0,-1*Vt*2),ze=ze.slice(0,-1*Vt),Fe=Fe.slice(0,-1*Vt)),je.push(this.productions_[Me[1]][0]),ze.push(dt.$),Fe.push(dt._$),rr=Ke[je[je.length-2]][je[je.length-1]],je.push(rr);break;case 3:return!0}}return!0},"parse")},V=(function(){var K={EOF:1,parseError:b(function(Z,je){if(this.yy.parser)this.yy.parser.parseError(Z,je);else throw new Error(Z)},"parseError"),setInput:b(function(ve,Z){return this.yy=Z||this.yy||{},this._input=ve,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var ve=this._input[0];this.yytext+=ve,this.yyleng++,this.offset++,this.match+=ve,this.matched+=ve;var Z=ve.match(/(?:\r\n?|\n).*/g);return Z?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ve},"input"),unput:b(function(ve){var Z=ve.length,je=ve.split(/(?:\r\n?|\n)/g);this._input=ve+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Z),this.offset-=Z;var Ne=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),je.length-1&&(this.yylineno-=je.length-1);var ze=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:je?(je.length===Ne.length?this.yylloc.first_column:0)+Ne[Ne.length-je.length].length-je[0].length:this.yylloc.first_column-Z},this.options.ranges&&(this.yylloc.range=[ze[0],ze[0]+this.yyleng-Z]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(ve){this.unput(this.match.slice(ve))},"less"),pastInput:b(function(){var ve=this.matched.substr(0,this.matched.length-this.match.length);return(ve.length>20?"...":"")+ve.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var ve=this.match;return ve.length<20&&(ve+=this._input.substr(0,20-ve.length)),(ve.substr(0,20)+(ve.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var ve=this.pastInput(),Z=new Array(ve.length+1).join("-");return ve+this.upcomingInput()+` `+Z+"^"},"showPosition"),test_match:b(function(ve,Z){var je,Ne,ze;if(this.options.backtrack_lexer&&(ze={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(ze.yylloc.range=this.yylloc.range.slice(0))),Ne=ve[0].match(/(?:\r\n?|\n).*/g),Ne&&(this.yylineno+=Ne.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Ne?Ne[Ne.length-1].length-Ne[Ne.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+ve[0].length},this.yytext+=ve[0],this.match+=ve[0],this.matches=ve,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(ve[0].length),this.matched+=ve[0],je=this.performAction.call(this,this.yy,this,Z,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),je)return je;if(this._backtrack){for(var Fe in ze)this[Fe]=ze[Fe];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var ve,Z,je,Ne;this._more||(this.yytext="",this.match="");for(var ze=this._currentRules(),Fe=0;FeZ[0].length)){if(Z=je,Ne=Fe,this.options.backtrack_lexer){if(ve=this.test_match(je,ze[Fe]),ve!==!1)return ve;if(this._backtrack){Z=!1;continue}else return!1}else if(!this.options.flex)break}return Z?(ve=this.test_match(Z,ze[Ne]),ve!==!1?ve:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var Z=this.next();return Z||this.lex()},"lex"),begin:b(function(Z){this.conditionStack.push(Z)},"begin"),popState:b(function(){var Z=this.conditionStack.length-1;return Z>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(Z){return Z=this.conditionStack.length-1-Math.abs(Z||0),Z>=0?this.conditionStack[Z]:"INITIAL"},"topState"),pushState:b(function(Z){this.begin(Z)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(Z,je,Ne,ze){var Fe=ze;switch(Ne){case 0:break;case 1:break;case 2:return 55;case 3:break;case 4:return this.begin("title"),35;break;case 5:return this.popState(),"title_value";break;case 6:return this.begin("acc_title"),37;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),39;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 48;case 14:return 50;case 15:return 49;case 16:return 51;case 17:return 52;case 18:return 53;case 19:return 54;case 20:return 25;case 21:this.begin("md_string");break;case 22:return"MD_STR";case 23:this.popState();break;case 24:this.begin("string");break;case 25:this.popState();break;case 26:return"STR";case 27:this.begin("class_name");break;case 28:return this.popState(),47;break;case 29:return this.begin("point_start"),44;break;case 30:return this.begin("point_x"),45;break;case 31:this.popState();break;case 32:this.popState(),this.begin("point_y");break;case 33:return this.popState(),46;break;case 34:return 28;case 35:return 4;case 36:return 15;case 37:return 11;case 38:return 64;case 39:return 10;case 40:return 65;case 41:return 65;case 42:return 14;case 43:return 13;case 44:return 67;case 45:return 66;case 46:return 12;case 47:return 8;case 48:return 5;case 49:return 18;case 50:return 56;case 51:return 63;case 52:return 57}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?: *x-axis *)/i,/^(?: *y-axis *)/i,/^(?: *--+> *)/i,/^(?: *quadrant-1 *)/i,/^(?: *quadrant-2 *)/i,/^(?: *quadrant-3 *)/i,/^(?: *quadrant-4 *)/i,/^(?:classDef\b)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?::::)/i,/^(?:^\w+)/i,/^(?:\s*:\s*\[\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?:\s*\] *)/i,/^(?:\s*,\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?: *quadrantChart *)/i,/^(?:[A-Za-z]+)/i,/^(?:[^\x00-\x7F]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s)/i,/^(?:;)/i,/^(?:[!"#$%&'*+,-.`?\\_/])/i,/^(?:$)/i],conditions:{class_name:{rules:[28],inclusive:!1},point_y:{rules:[33],inclusive:!1},point_x:{rules:[32],inclusive:!1},point_start:{rules:[30,31],inclusive:!1},acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},title:{rules:[5],inclusive:!1},md_string:{rules:[22,23],inclusive:!1},string:{rules:[25,26],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,6,8,10,13,14,15,16,17,18,19,20,21,24,27,29,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return K})();ne.lexer=V;function pe(){this.yy={}}return b(pe,"Parser"),pe.prototype=ne,ne.Parser=pe,new pe})();Gie.parser=Gie;kKt=Gie,Ol=Go(),TKt=class{constructor(){this.classes=new Map,this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData()}static{b(this,"QuadrantBuilder")}getDefaultData(){return{titleText:"",quadrant1Text:"",quadrant2Text:"",quadrant3Text:"",quadrant4Text:"",xAxisLeftText:"",xAxisRightText:"",yAxisBottomText:"",yAxisTopText:"",points:[]}}getDefaultConfig(){return{showXAxis:!0,showYAxis:!0,showTitle:!0,chartHeight:Lr.quadrantChart?.chartWidth||500,chartWidth:Lr.quadrantChart?.chartHeight||500,titlePadding:Lr.quadrantChart?.titlePadding||10,titleFontSize:Lr.quadrantChart?.titleFontSize||20,quadrantPadding:Lr.quadrantChart?.quadrantPadding||5,xAxisLabelPadding:Lr.quadrantChart?.xAxisLabelPadding||5,yAxisLabelPadding:Lr.quadrantChart?.yAxisLabelPadding||5,xAxisLabelFontSize:Lr.quadrantChart?.xAxisLabelFontSize||16,yAxisLabelFontSize:Lr.quadrantChart?.yAxisLabelFontSize||16,quadrantLabelFontSize:Lr.quadrantChart?.quadrantLabelFontSize||16,quadrantTextTopPadding:Lr.quadrantChart?.quadrantTextTopPadding||5,pointTextPadding:Lr.quadrantChart?.pointTextPadding||5,pointLabelFontSize:Lr.quadrantChart?.pointLabelFontSize||12,pointRadius:Lr.quadrantChart?.pointRadius||5,xAxisPosition:Lr.quadrantChart?.xAxisPosition||"top",yAxisPosition:Lr.quadrantChart?.yAxisPosition||"left",quadrantInternalBorderStrokeWidth:Lr.quadrantChart?.quadrantInternalBorderStrokeWidth||1,quadrantExternalBorderStrokeWidth:Lr.quadrantChart?.quadrantExternalBorderStrokeWidth||2}}getDefaultThemeConfig(){return{quadrant1Fill:Ol.quadrant1Fill,quadrant2Fill:Ol.quadrant2Fill,quadrant3Fill:Ol.quadrant3Fill,quadrant4Fill:Ol.quadrant4Fill,quadrant1TextFill:Ol.quadrant1TextFill,quadrant2TextFill:Ol.quadrant2TextFill,quadrant3TextFill:Ol.quadrant3TextFill,quadrant4TextFill:Ol.quadrant4TextFill,quadrantPointFill:Ol.quadrantPointFill,quadrantPointTextFill:Ol.quadrantPointTextFill,quadrantXAxisTextFill:Ol.quadrantXAxisTextFill,quadrantYAxisTextFill:Ol.quadrantYAxisTextFill,quadrantTitleFill:Ol.quadrantTitleFill,quadrantInternalBorderStrokeFill:Ol.quadrantInternalBorderStrokeFill,quadrantExternalBorderStrokeFill:Ol.quadrantExternalBorderStrokeFill}}clear(){this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData(),this.classes=new Map,se.info("clear called")}setData(e){this.data={...this.data,...e}}addPoints(e){this.data.points=[...e,...this.data.points]}addClass(e,t){this.classes.set(e,t)}setConfig(e){se.trace("setConfig called with: ",e),this.config={...this.config,...e}}setThemeConfig(e){se.trace("setThemeConfig called with: ",e),this.themeConfig={...this.themeConfig,...e}}calculateSpace(e,t,r,n){let i=this.config.xAxisLabelPadding*2+this.config.xAxisLabelFontSize,a={top:e==="top"&&t?i:0,bottom:e==="bottom"&&t?i:0},s=this.config.yAxisLabelPadding*2+this.config.yAxisLabelFontSize,o={left:this.config.yAxisPosition==="left"&&r?s:0,right:this.config.yAxisPosition==="right"&&r?s:0},l=this.config.titleFontSize+this.config.titlePadding*2,u={top:n?l:0},h=this.config.quadrantPadding+o.left,f=this.config.quadrantPadding+a.top+u.top,d=this.config.chartWidth-this.config.quadrantPadding*2-o.left-o.right,p=this.config.chartHeight-this.config.quadrantPadding*2-a.top-a.bottom-u.top,m=d/2,g=p/2;return{xAxisSpace:a,yAxisSpace:o,titleSpace:u,quadrantSpace:{quadrantLeft:h,quadrantTop:f,quadrantWidth:d,quadrantHalfWidth:m,quadrantHeight:p,quadrantHalfHeight:g}}}getAxisLabels(e,t,r,n){let{quadrantSpace:i,titleSpace:a}=n,{quadrantHalfHeight:s,quadrantHeight:o,quadrantLeft:l,quadrantHalfWidth:u,quadrantTop:h,quadrantWidth:f}=i,d=!!this.data.xAxisRightText,p=!!this.data.yAxisTopText,m=[];return this.data.xAxisLeftText&&t&&m.push({text:this.data.xAxisLeftText,fill:this.themeConfig.quadrantXAxisTextFill,x:l+(d?u/2:0),y:e==="top"?this.config.xAxisLabelPadding+a.top:this.config.xAxisLabelPadding+h+o+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:d?"center":"left",horizontalPos:"top",rotation:0}),this.data.xAxisRightText&&t&&m.push({text:this.data.xAxisRightText,fill:this.themeConfig.quadrantXAxisTextFill,x:l+u+(d?u/2:0),y:e==="top"?this.config.xAxisLabelPadding+a.top:this.config.xAxisLabelPadding+h+o+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:d?"center":"left",horizontalPos:"top",rotation:0}),this.data.yAxisBottomText&&r&&m.push({text:this.data.yAxisBottomText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+l+f+this.config.quadrantPadding,y:h+o-(p?s/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:p?"center":"left",horizontalPos:"top",rotation:-90}),this.data.yAxisTopText&&r&&m.push({text:this.data.yAxisTopText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+l+f+this.config.quadrantPadding,y:h+s-(p?s/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:p?"center":"left",horizontalPos:"top",rotation:-90}),m}getQuadrants(e){let{quadrantSpace:t}=e,{quadrantHalfHeight:r,quadrantLeft:n,quadrantHalfWidth:i,quadrantTop:a}=t,s=[{text:{text:this.data.quadrant1Text,fill:this.themeConfig.quadrant1TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+i,y:a,width:i,height:r,fill:this.themeConfig.quadrant1Fill},{text:{text:this.data.quadrant2Text,fill:this.themeConfig.quadrant2TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:a,width:i,height:r,fill:this.themeConfig.quadrant2Fill},{text:{text:this.data.quadrant3Text,fill:this.themeConfig.quadrant3TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:a+r,width:i,height:r,fill:this.themeConfig.quadrant3Fill},{text:{text:this.data.quadrant4Text,fill:this.themeConfig.quadrant4TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+i,y:a+r,width:i,height:r,fill:this.themeConfig.quadrant4Fill}];for(let o of s)o.text.x=o.x+o.width/2,this.data.points.length===0?(o.text.y=o.y+o.height/2,o.text.horizontalPos="middle"):(o.text.y=o.y+this.config.quadrantTextTopPadding,o.text.horizontalPos="top");return s}getQuadrantPoints(e){let{quadrantSpace:t}=e,{quadrantHeight:r,quadrantLeft:n,quadrantTop:i,quadrantWidth:a}=t,s=fh().domain([0,1]).range([n,a+n]),o=fh().domain([0,1]).range([r+i,i]);return this.data.points.map(u=>{let h=this.classes.get(u.className);return h&&(u={...h,...u}),{x:s(u.x),y:o(u.y),fill:u.color??this.themeConfig.quadrantPointFill,radius:u.radius??this.config.pointRadius,text:{text:u.text,fill:this.themeConfig.quadrantPointTextFill,x:s(u.x),y:o(u.y)+this.config.pointTextPadding,verticalPos:"center",horizontalPos:"top",fontSize:this.config.pointLabelFontSize,rotation:0},strokeColor:u.strokeColor??this.themeConfig.quadrantPointFill,strokeWidth:u.strokeWidth??"0px"}})}getBorders(e){let t=this.config.quadrantExternalBorderStrokeWidth/2,{quadrantSpace:r}=e,{quadrantHalfHeight:n,quadrantHeight:i,quadrantLeft:a,quadrantHalfWidth:s,quadrantTop:o,quadrantWidth:l}=r;return[{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a-t,y1:o,x2:a+l+t,y2:o},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a+l,y1:o+t,x2:a+l,y2:o+i-t},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a-t,y1:o+i,x2:a+l+t,y2:o+i},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a,y1:o+t,x2:a,y2:o+i-t},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:a+s,y1:o+t,x2:a+s,y2:o+i-t},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:a+t,y1:o+n,x2:a+l-t,y2:o+n}]}getTitle(e){if(e)return{text:this.data.titleText,fill:this.themeConfig.quadrantTitleFill,fontSize:this.config.titleFontSize,horizontalPos:"top",verticalPos:"center",rotation:0,y:this.config.titlePadding,x:this.config.chartWidth/2}}build(){let e=this.config.showXAxis&&!!(this.data.xAxisLeftText||this.data.xAxisRightText),t=this.config.showYAxis&&!!(this.data.yAxisTopText||this.data.yAxisBottomText),r=this.config.showTitle&&!!this.data.titleText,n=this.data.points.length>0?"bottom":this.config.xAxisPosition,i=this.calculateSpace(n,e,t,r);return{points:this.getQuadrantPoints(i),quadrants:this.getQuadrants(i),axisLabels:this.getAxisLabels(n,e,t,i),borderLines:this.getBorders(i),title:this.getTitle(r)}}},dO=class extends Error{static{b(this,"InvalidStyleError")}constructor(e,t,r){super(`value for ${e} ${t} is invalid, please use a valid ${r}`),this.name="InvalidStyleError"}};b(qie,"validateHexCode");b(cKe,"validateNumber");b(uKe,"validateSizeInPixels");b(Cd,"textSanitizer");So=new TKt;b(hKe,"setQuadrant1Text");b(fKe,"setQuadrant2Text");b(dKe,"setQuadrant3Text");b(pKe,"setQuadrant4Text");b(mKe,"setXAxisLeftText");b(gKe,"setXAxisRightText");b(yKe,"setYAxisTopText");b(vKe,"setYAxisBottomText");b(pO,"parseStyles");b(xKe,"addPoint");b(bKe,"addClass");b(wKe,"setWidth");b(kKe,"setHeight");b(TKe,"getQuadrantData");CKt=b(function(){So.clear(),Nr()},"clear"),SKt={setWidth:wKe,setHeight:kKe,setQuadrant1Text:hKe,setQuadrant2Text:fKe,setQuadrant3Text:dKe,setQuadrant4Text:pKe,setXAxisLeftText:mKe,setXAxisRightText:gKe,setYAxisTopText:yKe,setYAxisBottomText:vKe,parseStyles:pO,addPoint:xKe,addClass:bKe,getQuadrantData:TKe,clear:CKt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},EKt=b((e,t,r,n)=>{function i(E){return E==="top"?"hanging":"middle"}b(i,"getDominantBaseLine");function a(E){return E==="left"?"start":"middle"}b(a,"getTextAnchor");function s(E){return`translate(${E.x}, ${E.y}) rotate(${E.rotation||0})`}b(s,"getTransformation");let o=Be();se.debug(`Rendering quadrant chart -`+e);let l=o.securityLevel,u;l==="sandbox"&&(u=ct("#i"+t));let f=(l==="sandbox"?ct(u.nodes()[0].contentDocument.body):ct("body")).select(`[id="${t}"]`),d=f.append("g").attr("class","main"),p=o.quadrantChart?.chartWidth??500,m=o.quadrantChart?.chartHeight??500;vn(f,m,p,o.quadrantChart?.useMaxWidth??!0),f.attr("viewBox","0 0 "+p+" "+m),n.db.setHeight(m),n.db.setWidth(p);let g=n.db.getQuadrantData(),y=d.append("g").attr("class","quadrants"),v=d.append("g").attr("class","border"),x=d.append("g").attr("class","data-points"),w=d.append("g").attr("class","labels"),C=d.append("g").attr("class","title");g.title&&C.append("text").attr("x",0).attr("y",0).attr("fill",g.title.fill).attr("font-size",g.title.fontSize).attr("dominant-baseline",i(g.title.horizontalPos)).attr("text-anchor",a(g.title.verticalPos)).attr("transform",s(g.title)).text(g.title.text),g.borderLines&&v.selectAll("line").data(g.borderLines).enter().append("line").attr("x1",E=>E.x1).attr("y1",E=>E.y1).attr("x2",E=>E.x2).attr("y2",E=>E.y2).style("stroke",E=>E.strokeFill).style("stroke-width",E=>E.strokeWidth);let T=y.selectAll("g.quadrant").data(g.quadrants).enter().append("g").attr("class","quadrant");T.append("rect").attr("x",E=>E.x).attr("y",E=>E.y).attr("width",E=>E.width).attr("height",E=>E.height).attr("fill",E=>E.fill),T.append("text").attr("x",0).attr("y",0).attr("fill",E=>E.text.fill).attr("font-size",E=>E.text.fontSize).attr("dominant-baseline",E=>i(E.text.horizontalPos)).attr("text-anchor",E=>a(E.text.verticalPos)).attr("transform",E=>s(E.text)).text(E=>E.text.text),w.selectAll("g.label").data(g.axisLabels).enter().append("g").attr("class","label").append("text").attr("x",0).attr("y",0).text(E=>E.text).attr("fill",E=>E.fill).attr("font-size",E=>E.fontSize).attr("dominant-baseline",E=>i(E.horizontalPos)).attr("text-anchor",E=>a(E.verticalPos)).attr("transform",E=>s(E));let S=x.selectAll("g.data-point").data(g.points).enter().append("g").attr("class","data-point");S.append("circle").attr("cx",E=>E.x).attr("cy",E=>E.y).attr("r",E=>E.radius).attr("fill",E=>E.fill).attr("stroke",E=>E.strokeColor).attr("stroke-width",E=>E.strokeWidth),S.append("text").attr("x",0).attr("y",0).text(E=>E.text.text).attr("fill",E=>E.text.fill).attr("font-size",E=>E.text.fontSize).attr("dominant-baseline",E=>i(E.text.horizontalPos)).attr("text-anchor",E=>a(E.text.verticalPos)).attr("transform",E=>s(E.text))},"draw"),AKt={draw:EKt},_Kt={parser:kKt,db:SKt,renderer:AKt,styles:b(()=>"","styles")}});var UKe={};Tr(UKe,{diagram:()=>qKt});function Wie(e){return e.type==="bar"}function mO(e){return e.type==="band"}function lk(e){return e.type==="linear"}function Hie(e,t,r,n){let i=new _Ke(n);return mO(e)?new LKt(t,r,e.categories,e.title,i):new IKt(t,r,[e.min,e.max],e.title,i)}function LKe(e,t,r,n){let i=new _Ke(n);return new MKt(i,e,t,r)}function IKe(e,t,r){return new OKt(e,t,r)}function Xie(){let e=Go(),t=qt();return Rn(e.xyChart,t.themeVariables.xyChart)}function jie(){let e=qt();return Rn(Lr.xyChart,e.xyChart)}function Kie(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function M6(e){let t=qt();return Mr(e.trim(),t)}function NKe(e){MKe=e}function DKe(e){e==="horizontal"?L6.chartOrientation="horizontal":L6.chartOrientation="vertical"}function OKe(e){jn.xAxis.title=M6(e.text)}function Zie(e,t){jn.xAxis={type:"linear",title:jn.xAxis.title,min:e,max:t},gO=!0}function PKe(e){jn.xAxis={type:"band",title:jn.xAxis.title,categories:e.map(t=>M6(t.text))},gO=!0}function BKe(e){jn.yAxis.title=M6(e.text)}function FKe(e,t){jn.yAxis={type:"linear",title:jn.yAxis.title,min:e,max:t},Yie=!0}function $Ke(e){let t=Math.min(...e),r=Math.max(...e),n=lk(jn.yAxis)?jn.yAxis.min:1/0,i=lk(jn.yAxis)?jn.yAxis.max:-1/0;jn.yAxis={type:"linear",title:jn.yAxis.title,min:Math.min(n,t),max:Math.max(i,r)}}function Qie(e){let t=[];if(e.length===0)return t;if(!gO){let r=lk(jn.xAxis)?jn.xAxis.min:1/0,n=lk(jn.xAxis)?jn.xAxis.max:-1/0;Zie(Math.min(r,1),Math.max(n,e.length))}if(mO(jn.xAxis)&&e.length>jn.xAxis.categories.length&&(e=e.slice(0,jn.xAxis.categories.length)),Yie||$Ke(e),mO(jn.xAxis)&&(t=jn.xAxis.categories.map((r,n)=>[r,e[n]])),lk(jn.xAxis)){let r=jn.xAxis.min,n=jn.xAxis.max,i=(n-r)/(e.length-1),a=[];for(let s=r;s<=n;s+=i)a.push(`${s}`);t=a.map((s,o)=>[s,e[o]])}return t}function Jie(e){return Uie[e===0?0:e%Uie.length]}function zKe(e,t){let r=t.map(s=>s.value),n=t.map(s=>s.label?M6(s.label):""),i=Qie(r),a=n.some(s=>s!=="");jn.plots.push({type:"line",strokeFill:Jie(R6),strokeWidth:2,data:i,...a?{pointLabels:n}:{}}),R6++}function GKe(e,t){let r=t.map(i=>i.value),n=Qie(r);jn.plots.push({type:"bar",fill:Jie(R6),data:n}),R6++}function qKe(){if(jn.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return jn.title=tn(),BKt.build(L6,jn,I6,MKe)}function VKe(){return I6}function WKe(){return L6}function HKe(){return jn}var Vie,RKt,_Ke,EKe,AKe,RKe,LKt,IKt,MKt,NKt,DKt,OKt,PKt,BKt,R6,MKe,L6,I6,jn,Uie,gO,Yie,FKt,$Kt,zKt,GKt,qKt,YKe=W(()=>{za();bs();ts();Sn();_r();Rr();hr();fn();fn();fn();Vie=(function(){var e=b(function(D,B,P,$){for(P=P||{},$=D.length;$--;P[D[$]]=B);return P},"o"),t=[1,10,12,14,16,18,19,21,23],r=[2,6],n=[1,3],i=[1,5],a=[1,6],s=[1,7],o=[1,5,10,12,14,16,18,19,21,23,36,37,38],l=[1,25],u=[1,26],h=[1,28],f=[1,29],d=[1,30],p=[1,31],m=[1,32],g=[1,33],y=[1,34],v=[1,35],x=[1,36],w=[1,37],C=[1,43],T=[1,42],k=[1,47],S=[1,50],E=[1,10,12,14,16,18,19,21,23,36,37,38],I=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],L=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],O=[1,65],R=[26,28],A={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:b(function(B,P,$,F,q,G,z){var H=G.length-1;switch(q){case 5:F.setOrientation(G[H]);break;case 9:F.setDiagramTitle(G[H].text.trim());break;case 12:F.setLineData({text:"",type:"text"},G[H]);break;case 13:F.setLineData(G[H-1],G[H]);break;case 14:F.setBarData({text:"",type:"text"},G[H]);break;case 15:F.setBarData(G[H-1],G[H]);break;case 16:this.$=G[H].trim(),F.setAccTitle(this.$);break;case 17:case 18:this.$=G[H].trim(),F.setAccDescription(this.$);break;case 19:this.$=G[H-1];break;case 20:case 30:this.$=[G[H-2],...G[H]];break;case 21:case 31:this.$=[G[H]];break;case 22:this.$={value:Number(G[H-1]),label:G[H]};break;case 23:this.$={value:Number(G[H]),label:""};break;case 24:F.setXAxisTitle(G[H]);break;case 25:F.setXAxisTitle(G[H-1]);break;case 26:F.setXAxisTitle({type:"text",text:""});break;case 27:F.setXAxisBand(G[H]);break;case 28:F.setXAxisRangeData(Number(G[H-2]),Number(G[H]));break;case 29:this.$=G[H-1];break;case 32:F.setYAxisTitle(G[H]);break;case 33:F.setYAxisTitle(G[H-1]);break;case 34:F.setYAxisTitle({type:"text",text:""});break;case 35:F.setYAxisRangeData(Number(G[H-2]),Number(G[H]));break;case 39:this.$={text:G[H],type:"text"};break;case 40:this.$={text:G[H],type:"text"};break;case 41:this.$={text:G[H],type:"markdown"};break;case 42:this.$=G[H];break;case 43:this.$=G[H-1]+""+G[H];break}},"anonymous"),table:[e(t,r,{3:1,4:2,7:4,5:n,36:i,37:a,38:s}),{1:[3]},e(t,r,{4:2,7:4,3:8,5:n,36:i,37:a,38:s}),e(t,r,{4:2,7:4,6:9,3:10,5:n,8:[1,11],36:i,37:a,38:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(o,[2,36]),e(o,[2,37]),e(o,[2,38]),{1:[2,1]},e(t,r,{4:2,7:4,3:21,5:n,36:i,37:a,38:s}),{1:[2,3]},e(o,[2,5]),e(t,[2,7],{4:22,36:i,37:a,38:s}),{11:23,30:l,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:39,13:38,24:C,29:T,30:l,31:40,32:41,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:45,15:44,29:k,30:l,35:46,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:49,17:48,24:S,30:l,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:52,17:51,24:S,30:l,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{20:[1,53]},{22:[1,54]},e(E,[2,18]),{1:[2,2]},e(E,[2,8]),e(E,[2,9]),e(I,[2,39],{41:55,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w}),e(I,[2,40]),e(I,[2,41]),e(L,[2,42]),e(L,[2,44]),e(L,[2,45]),e(L,[2,46]),e(L,[2,47]),e(L,[2,48]),e(L,[2,49]),e(L,[2,50]),e(L,[2,51]),e(L,[2,52]),e(L,[2,53]),e(E,[2,10]),e(E,[2,24],{32:41,31:56,24:C,29:T}),e(E,[2,26]),e(E,[2,27]),{33:[1,57]},{11:59,30:l,34:58,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},e(E,[2,11]),e(E,[2,32],{35:60,29:k}),e(E,[2,34]),{33:[1,61]},e(E,[2,12]),{17:62,24:S},{25:63,27:64,29:O},e(E,[2,14]),{17:66,24:S},e(E,[2,16]),e(E,[2,17]),e(L,[2,43]),e(E,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(E,[2,33]),{29:[1,70]},e(E,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(R,[2,23],{30:[1,73]}),e(E,[2,15]),e(E,[2,28]),e(E,[2,29]),{11:59,30:l,34:74,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},e(E,[2,35]),e(E,[2,19]),{25:75,27:64,29:O},e(R,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:b(function(B,P){if(P.recoverable)this.trace(B);else{var $=new Error(B);throw $.hash=P,$}},"parseError"),parse:b(function(B){var P=this,$=[0],F=[],q=[null],G=[],z=this.table,H="",j=0,J=0,U=0,le=2,ee=1,ue=G.slice.call(arguments,1),ae=Object.create(this.lexer),oe={yy:{}};for(var Re in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Re)&&(oe.yy[Re]=this.yy[Re]);ae.setInput(B,oe.yy),oe.yy.lexer=ae,oe.yy.parser=this,typeof ae.yylloc>"u"&&(ae.yylloc={});var Te=ae.yylloc;G.push(Te);var Oe=ae.options&&ae.options.ranges;typeof oe.yy.parseError=="function"?this.parseError=oe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function qe(ne){$.length=$.length-2*ne,q.length=q.length-ne,G.length=G.length-ne}b(qe,"popStack");function Ge(){var ne;return ne=F.pop()||ae.lex()||ee,typeof ne!="number"&&(ne instanceof Array&&(F=ne,ne=F.pop()),ne=P.symbols_[ne]||ne),ne}b(Ge,"lex");for(var fe,Ce,_e,de,ie,Q,he={},xe,ce,ge,Ie;;){if(_e=$[$.length-1],this.defaultActions[_e]?de=this.defaultActions[_e]:((fe===null||typeof fe>"u")&&(fe=Ge()),de=z[_e]&&z[_e][fe]),typeof de>"u"||!de.length||!de[0]){var ye="";Ie=[];for(xe in z[_e])this.terminals_[xe]&&xe>le&&Ie.push("'"+this.terminals_[xe]+"'");ae.showPosition?ye="Parse error on line "+(j+1)+`: +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var Z=this.next();return Z||this.lex()},"lex"),begin:b(function(Z){this.conditionStack.push(Z)},"begin"),popState:b(function(){var Z=this.conditionStack.length-1;return Z>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(Z){return Z=this.conditionStack.length-1-Math.abs(Z||0),Z>=0?this.conditionStack[Z]:"INITIAL"},"topState"),pushState:b(function(Z){this.begin(Z)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(Z,je,Ne,ze){var Fe=ze;switch(Ne){case 0:break;case 1:break;case 2:return 55;case 3:break;case 4:return this.begin("title"),35;break;case 5:return this.popState(),"title_value";break;case 6:return this.begin("acc_title"),37;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),39;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 48;case 14:return 50;case 15:return 49;case 16:return 51;case 17:return 52;case 18:return 53;case 19:return 54;case 20:return 25;case 21:this.begin("md_string");break;case 22:return"MD_STR";case 23:this.popState();break;case 24:this.begin("string");break;case 25:this.popState();break;case 26:return"STR";case 27:this.begin("class_name");break;case 28:return this.popState(),47;break;case 29:return this.begin("point_start"),44;break;case 30:return this.begin("point_x"),45;break;case 31:this.popState();break;case 32:this.popState(),this.begin("point_y");break;case 33:return this.popState(),46;break;case 34:return 28;case 35:return 4;case 36:return 15;case 37:return 11;case 38:return 64;case 39:return 10;case 40:return 65;case 41:return 65;case 42:return 14;case 43:return 13;case 44:return 67;case 45:return 66;case 46:return 12;case 47:return 8;case 48:return 5;case 49:return 18;case 50:return 56;case 51:return 63;case 52:return 57}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?: *x-axis *)/i,/^(?: *y-axis *)/i,/^(?: *--+> *)/i,/^(?: *quadrant-1 *)/i,/^(?: *quadrant-2 *)/i,/^(?: *quadrant-3 *)/i,/^(?: *quadrant-4 *)/i,/^(?:classDef\b)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?::::)/i,/^(?:^\w+)/i,/^(?:\s*:\s*\[\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?:\s*\] *)/i,/^(?:\s*,\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?: *quadrantChart *)/i,/^(?:[A-Za-z]+)/i,/^(?:[^\x00-\x7F]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s)/i,/^(?:;)/i,/^(?:[!"#$%&'*+,-.`?\\_/])/i,/^(?:$)/i],conditions:{class_name:{rules:[28],inclusive:!1},point_y:{rules:[33],inclusive:!1},point_x:{rules:[32],inclusive:!1},point_start:{rules:[30,31],inclusive:!1},acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},title:{rules:[5],inclusive:!1},md_string:{rules:[22,23],inclusive:!1},string:{rules:[25,26],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,6,8,10,13,14,15,16,17,18,19,20,21,24,27,29,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return K})();ne.lexer=V;function pe(){this.yy={}}return b(pe,"Parser"),pe.prototype=ne,ne.Parser=pe,new pe})();Vie.parser=Vie;EKt=Vie,Pl=Go(),AKt=class{constructor(){this.classes=new Map,this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData()}static{b(this,"QuadrantBuilder")}getDefaultData(){return{titleText:"",quadrant1Text:"",quadrant2Text:"",quadrant3Text:"",quadrant4Text:"",xAxisLeftText:"",xAxisRightText:"",yAxisBottomText:"",yAxisTopText:"",points:[]}}getDefaultConfig(){return{showXAxis:!0,showYAxis:!0,showTitle:!0,chartHeight:Lr.quadrantChart?.chartWidth||500,chartWidth:Lr.quadrantChart?.chartHeight||500,titlePadding:Lr.quadrantChart?.titlePadding||10,titleFontSize:Lr.quadrantChart?.titleFontSize||20,quadrantPadding:Lr.quadrantChart?.quadrantPadding||5,xAxisLabelPadding:Lr.quadrantChart?.xAxisLabelPadding||5,yAxisLabelPadding:Lr.quadrantChart?.yAxisLabelPadding||5,xAxisLabelFontSize:Lr.quadrantChart?.xAxisLabelFontSize||16,yAxisLabelFontSize:Lr.quadrantChart?.yAxisLabelFontSize||16,quadrantLabelFontSize:Lr.quadrantChart?.quadrantLabelFontSize||16,quadrantTextTopPadding:Lr.quadrantChart?.quadrantTextTopPadding||5,pointTextPadding:Lr.quadrantChart?.pointTextPadding||5,pointLabelFontSize:Lr.quadrantChart?.pointLabelFontSize||12,pointRadius:Lr.quadrantChart?.pointRadius||5,xAxisPosition:Lr.quadrantChart?.xAxisPosition||"top",yAxisPosition:Lr.quadrantChart?.yAxisPosition||"left",quadrantInternalBorderStrokeWidth:Lr.quadrantChart?.quadrantInternalBorderStrokeWidth||1,quadrantExternalBorderStrokeWidth:Lr.quadrantChart?.quadrantExternalBorderStrokeWidth||2}}getDefaultThemeConfig(){return{quadrant1Fill:Pl.quadrant1Fill,quadrant2Fill:Pl.quadrant2Fill,quadrant3Fill:Pl.quadrant3Fill,quadrant4Fill:Pl.quadrant4Fill,quadrant1TextFill:Pl.quadrant1TextFill,quadrant2TextFill:Pl.quadrant2TextFill,quadrant3TextFill:Pl.quadrant3TextFill,quadrant4TextFill:Pl.quadrant4TextFill,quadrantPointFill:Pl.quadrantPointFill,quadrantPointTextFill:Pl.quadrantPointTextFill,quadrantXAxisTextFill:Pl.quadrantXAxisTextFill,quadrantYAxisTextFill:Pl.quadrantYAxisTextFill,quadrantTitleFill:Pl.quadrantTitleFill,quadrantInternalBorderStrokeFill:Pl.quadrantInternalBorderStrokeFill,quadrantExternalBorderStrokeFill:Pl.quadrantExternalBorderStrokeFill}}clear(){this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData(),this.classes=new Map,se.info("clear called")}setData(e){this.data={...this.data,...e}}addPoints(e){this.data.points=[...e,...this.data.points]}addClass(e,t){this.classes.set(e,t)}setConfig(e){se.trace("setConfig called with: ",e),this.config={...this.config,...e}}setThemeConfig(e){se.trace("setThemeConfig called with: ",e),this.themeConfig={...this.themeConfig,...e}}calculateSpace(e,t,r,n){let i=this.config.xAxisLabelPadding*2+this.config.xAxisLabelFontSize,a={top:e==="top"&&t?i:0,bottom:e==="bottom"&&t?i:0},s=this.config.yAxisLabelPadding*2+this.config.yAxisLabelFontSize,o={left:this.config.yAxisPosition==="left"&&r?s:0,right:this.config.yAxisPosition==="right"&&r?s:0},l=this.config.titleFontSize+this.config.titlePadding*2,u={top:n?l:0},h=this.config.quadrantPadding+o.left,f=this.config.quadrantPadding+a.top+u.top,d=this.config.chartWidth-this.config.quadrantPadding*2-o.left-o.right,p=this.config.chartHeight-this.config.quadrantPadding*2-a.top-a.bottom-u.top,m=d/2,g=p/2;return{xAxisSpace:a,yAxisSpace:o,titleSpace:u,quadrantSpace:{quadrantLeft:h,quadrantTop:f,quadrantWidth:d,quadrantHalfWidth:m,quadrantHeight:p,quadrantHalfHeight:g}}}getAxisLabels(e,t,r,n){let{quadrantSpace:i,titleSpace:a}=n,{quadrantHalfHeight:s,quadrantHeight:o,quadrantLeft:l,quadrantHalfWidth:u,quadrantTop:h,quadrantWidth:f}=i,d=!!this.data.xAxisRightText,p=!!this.data.yAxisTopText,m=[];return this.data.xAxisLeftText&&t&&m.push({text:this.data.xAxisLeftText,fill:this.themeConfig.quadrantXAxisTextFill,x:l+(d?u/2:0),y:e==="top"?this.config.xAxisLabelPadding+a.top:this.config.xAxisLabelPadding+h+o+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:d?"center":"left",horizontalPos:"top",rotation:0}),this.data.xAxisRightText&&t&&m.push({text:this.data.xAxisRightText,fill:this.themeConfig.quadrantXAxisTextFill,x:l+u+(d?u/2:0),y:e==="top"?this.config.xAxisLabelPadding+a.top:this.config.xAxisLabelPadding+h+o+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:d?"center":"left",horizontalPos:"top",rotation:0}),this.data.yAxisBottomText&&r&&m.push({text:this.data.yAxisBottomText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+l+f+this.config.quadrantPadding,y:h+o-(p?s/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:p?"center":"left",horizontalPos:"top",rotation:-90}),this.data.yAxisTopText&&r&&m.push({text:this.data.yAxisTopText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+l+f+this.config.quadrantPadding,y:h+s-(p?s/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:p?"center":"left",horizontalPos:"top",rotation:-90}),m}getQuadrants(e){let{quadrantSpace:t}=e,{quadrantHalfHeight:r,quadrantLeft:n,quadrantHalfWidth:i,quadrantTop:a}=t,s=[{text:{text:this.data.quadrant1Text,fill:this.themeConfig.quadrant1TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+i,y:a,width:i,height:r,fill:this.themeConfig.quadrant1Fill},{text:{text:this.data.quadrant2Text,fill:this.themeConfig.quadrant2TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:a,width:i,height:r,fill:this.themeConfig.quadrant2Fill},{text:{text:this.data.quadrant3Text,fill:this.themeConfig.quadrant3TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:a+r,width:i,height:r,fill:this.themeConfig.quadrant3Fill},{text:{text:this.data.quadrant4Text,fill:this.themeConfig.quadrant4TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+i,y:a+r,width:i,height:r,fill:this.themeConfig.quadrant4Fill}];for(let o of s)o.text.x=o.x+o.width/2,this.data.points.length===0?(o.text.y=o.y+o.height/2,o.text.horizontalPos="middle"):(o.text.y=o.y+this.config.quadrantTextTopPadding,o.text.horizontalPos="top");return s}getQuadrantPoints(e){let{quadrantSpace:t}=e,{quadrantHeight:r,quadrantLeft:n,quadrantTop:i,quadrantWidth:a}=t,s=fh().domain([0,1]).range([n,a+n]),o=fh().domain([0,1]).range([r+i,i]);return this.data.points.map(u=>{let h=this.classes.get(u.className);return h&&(u={...h,...u}),{x:s(u.x),y:o(u.y),fill:u.color??this.themeConfig.quadrantPointFill,radius:u.radius??this.config.pointRadius,text:{text:u.text,fill:this.themeConfig.quadrantPointTextFill,x:s(u.x),y:o(u.y)+this.config.pointTextPadding,verticalPos:"center",horizontalPos:"top",fontSize:this.config.pointLabelFontSize,rotation:0},strokeColor:u.strokeColor??this.themeConfig.quadrantPointFill,strokeWidth:u.strokeWidth??"0px"}})}getBorders(e){let t=this.config.quadrantExternalBorderStrokeWidth/2,{quadrantSpace:r}=e,{quadrantHalfHeight:n,quadrantHeight:i,quadrantLeft:a,quadrantHalfWidth:s,quadrantTop:o,quadrantWidth:l}=r;return[{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a-t,y1:o,x2:a+l+t,y2:o},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a+l,y1:o+t,x2:a+l,y2:o+i-t},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a-t,y1:o+i,x2:a+l+t,y2:o+i},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a,y1:o+t,x2:a,y2:o+i-t},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:a+s,y1:o+t,x2:a+s,y2:o+i-t},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:a+t,y1:o+n,x2:a+l-t,y2:o+n}]}getTitle(e){if(e)return{text:this.data.titleText,fill:this.themeConfig.quadrantTitleFill,fontSize:this.config.titleFontSize,horizontalPos:"top",verticalPos:"center",rotation:0,y:this.config.titlePadding,x:this.config.chartWidth/2}}build(){let e=this.config.showXAxis&&!!(this.data.xAxisLeftText||this.data.xAxisRightText),t=this.config.showYAxis&&!!(this.data.yAxisTopText||this.data.yAxisBottomText),r=this.config.showTitle&&!!this.data.titleText,n=this.data.points.length>0?"bottom":this.config.xAxisPosition,i=this.calculateSpace(n,e,t,r);return{points:this.getQuadrantPoints(i),quadrants:this.getQuadrants(i),axisLabels:this.getAxisLabels(n,e,t,i),borderLines:this.getBorders(i),title:this.getTitle(r)}}},dO=class extends Error{static{b(this,"InvalidStyleError")}constructor(e,t,r){super(`value for ${e} ${t} is invalid, please use a valid ${r}`),this.name="InvalidStyleError"}};b(Wie,"validateHexCode");b(hKe,"validateNumber");b(fKe,"validateSizeInPixels");b(Cd,"textSanitizer");So=new AKt;b(dKe,"setQuadrant1Text");b(pKe,"setQuadrant2Text");b(mKe,"setQuadrant3Text");b(gKe,"setQuadrant4Text");b(yKe,"setXAxisLeftText");b(vKe,"setXAxisRightText");b(xKe,"setYAxisTopText");b(bKe,"setYAxisBottomText");b(pO,"parseStyles");b(wKe,"addPoint");b(kKe,"addClass");b(TKe,"setWidth");b(CKe,"setHeight");b(SKe,"getQuadrantData");_Kt=b(function(){So.clear(),Nr()},"clear"),RKt={setWidth:TKe,setHeight:CKe,setQuadrant1Text:dKe,setQuadrant2Text:pKe,setQuadrant3Text:mKe,setQuadrant4Text:gKe,setXAxisLeftText:yKe,setXAxisRightText:vKe,setYAxisTopText:xKe,setYAxisBottomText:bKe,parseStyles:pO,addPoint:wKe,addClass:kKe,getQuadrantData:SKe,clear:_Kt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},LKt=b((e,t,r,n)=>{function i(E){return E==="top"?"hanging":"middle"}b(i,"getDominantBaseLine");function a(E){return E==="left"?"start":"middle"}b(a,"getTextAnchor");function s(E){return`translate(${E.x}, ${E.y}) rotate(${E.rotation||0})`}b(s,"getTransformation");let o=Be();se.debug(`Rendering quadrant chart +`+e);let l=o.securityLevel,u;l==="sandbox"&&(u=ct("#i"+t));let f=(l==="sandbox"?ct(u.nodes()[0].contentDocument.body):ct("body")).select(`[id="${t}"]`),d=f.append("g").attr("class","main"),p=o.quadrantChart?.chartWidth??500,m=o.quadrantChart?.chartHeight??500;vn(f,m,p,o.quadrantChart?.useMaxWidth??!0),f.attr("viewBox","0 0 "+p+" "+m),n.db.setHeight(m),n.db.setWidth(p);let g=n.db.getQuadrantData(),y=d.append("g").attr("class","quadrants"),v=d.append("g").attr("class","border"),x=d.append("g").attr("class","data-points"),w=d.append("g").attr("class","labels"),C=d.append("g").attr("class","title");g.title&&C.append("text").attr("x",0).attr("y",0).attr("fill",g.title.fill).attr("font-size",g.title.fontSize).attr("dominant-baseline",i(g.title.horizontalPos)).attr("text-anchor",a(g.title.verticalPos)).attr("transform",s(g.title)).text(g.title.text),g.borderLines&&v.selectAll("line").data(g.borderLines).enter().append("line").attr("x1",E=>E.x1).attr("y1",E=>E.y1).attr("x2",E=>E.x2).attr("y2",E=>E.y2).style("stroke",E=>E.strokeFill).style("stroke-width",E=>E.strokeWidth);let T=y.selectAll("g.quadrant").data(g.quadrants).enter().append("g").attr("class","quadrant");T.append("rect").attr("x",E=>E.x).attr("y",E=>E.y).attr("width",E=>E.width).attr("height",E=>E.height).attr("fill",E=>E.fill),T.append("text").attr("x",0).attr("y",0).attr("fill",E=>E.text.fill).attr("font-size",E=>E.text.fontSize).attr("dominant-baseline",E=>i(E.text.horizontalPos)).attr("text-anchor",E=>a(E.text.verticalPos)).attr("transform",E=>s(E.text)).text(E=>E.text.text),w.selectAll("g.label").data(g.axisLabels).enter().append("g").attr("class","label").append("text").attr("x",0).attr("y",0).text(E=>E.text).attr("fill",E=>E.fill).attr("font-size",E=>E.fontSize).attr("dominant-baseline",E=>i(E.horizontalPos)).attr("text-anchor",E=>a(E.verticalPos)).attr("transform",E=>s(E));let S=x.selectAll("g.data-point").data(g.points).enter().append("g").attr("class","data-point");S.append("circle").attr("cx",E=>E.x).attr("cy",E=>E.y).attr("r",E=>E.radius).attr("fill",E=>E.fill).attr("stroke",E=>E.strokeColor).attr("stroke-width",E=>E.strokeWidth),S.append("text").attr("x",0).attr("y",0).text(E=>E.text.text).attr("fill",E=>E.text.fill).attr("font-size",E=>E.text.fontSize).attr("dominant-baseline",E=>i(E.text.horizontalPos)).attr("text-anchor",E=>a(E.text.verticalPos)).attr("transform",E=>s(E.text))},"draw"),IKt={draw:LKt},MKt={parser:EKt,db:RKt,renderer:IKt,styles:b(()=>"","styles")}});var XKe={};Tr(XKe,{diagram:()=>UKt});function Uie(e){return e.type==="bar"}function mO(e){return e.type==="band"}function lk(e){return e.type==="linear"}function Yie(e,t,r,n){let i=new LKe(n);return mO(e)?new DKt(t,r,e.categories,e.title,i):new OKt(t,r,[e.min,e.max],e.title,i)}function MKe(e,t,r,n){let i=new LKe(n);return new PKt(i,e,t,r)}function NKe(e,t,r){return new $Kt(e,t,r)}function Kie(){let e=Go(),t=qt();return Rn(e.xyChart,t.themeVariables.xyChart)}function Zie(){let e=qt();return Rn(Lr.xyChart,e.xyChart)}function Qie(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function M6(e){let t=qt();return Mr(e.trim(),t)}function OKe(e){DKe=e}function PKe(e){e==="horizontal"?L6.chartOrientation="horizontal":L6.chartOrientation="vertical"}function BKe(e){jn.xAxis.title=M6(e.text)}function Jie(e,t){jn.xAxis={type:"linear",title:jn.xAxis.title,min:e,max:t},gO=!0}function FKe(e){jn.xAxis={type:"band",title:jn.xAxis.title,categories:e.map(t=>M6(t.text))},gO=!0}function $Ke(e){jn.yAxis.title=M6(e.text)}function zKe(e,t){jn.yAxis={type:"linear",title:jn.yAxis.title,min:e,max:t},jie=!0}function GKe(e){let t=Math.min(...e),r=Math.max(...e),n=lk(jn.yAxis)?jn.yAxis.min:1/0,i=lk(jn.yAxis)?jn.yAxis.max:-1/0;jn.yAxis={type:"linear",title:jn.yAxis.title,min:Math.min(n,t),max:Math.max(i,r)}}function eae(e){let t=[];if(e.length===0)return t;if(!gO){let r=lk(jn.xAxis)?jn.xAxis.min:1/0,n=lk(jn.xAxis)?jn.xAxis.max:-1/0;Jie(Math.min(r,1),Math.max(n,e.length))}if(mO(jn.xAxis)&&e.length>jn.xAxis.categories.length&&(e=e.slice(0,jn.xAxis.categories.length)),jie||GKe(e),mO(jn.xAxis)&&(t=jn.xAxis.categories.map((r,n)=>[r,e[n]])),lk(jn.xAxis)){let r=jn.xAxis.min,n=jn.xAxis.max,i=(n-r)/(e.length-1),a=[];for(let s=r;s<=n;s+=i)a.push(`${s}`);t=a.map((s,o)=>[s,e[o]])}return t}function tae(e){return Xie[e===0?0:e%Xie.length]}function qKe(e,t){let r=t.map(s=>s.value),n=t.map(s=>s.label?M6(s.label):""),i=eae(r),a=n.some(s=>s!=="");jn.plots.push({type:"line",strokeFill:tae(R6),strokeWidth:2,data:i,...a?{pointLabels:n}:{}}),R6++}function VKe(e,t){let r=t.map(i=>i.value),n=eae(r);jn.plots.push({type:"bar",fill:tae(R6),data:n}),R6++}function WKe(){if(jn.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return jn.title=tn(),GKt.build(L6,jn,I6,DKe)}function HKe(){return I6}function UKe(){return L6}function YKe(){return jn}var Hie,NKt,LKe,_Ke,RKe,IKe,DKt,OKt,PKt,BKt,FKt,$Kt,zKt,GKt,R6,DKe,L6,I6,jn,Xie,gO,jie,qKt,VKt,WKt,HKt,UKt,jKe=W(()=>{za();bs();ts();Sn();_r();Rr();hr();fn();fn();fn();Hie=(function(){var e=b(function(D,B,P,$){for(P=P||{},$=D.length;$--;P[D[$]]=B);return P},"o"),t=[1,10,12,14,16,18,19,21,23],r=[2,6],n=[1,3],i=[1,5],a=[1,6],s=[1,7],o=[1,5,10,12,14,16,18,19,21,23,36,37,38],l=[1,25],u=[1,26],h=[1,28],f=[1,29],d=[1,30],p=[1,31],m=[1,32],g=[1,33],y=[1,34],v=[1,35],x=[1,36],w=[1,37],C=[1,43],T=[1,42],k=[1,47],S=[1,50],E=[1,10,12,14,16,18,19,21,23,36,37,38],I=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],L=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],O=[1,65],R=[26,28],A={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:b(function(B,P,$,F,q,G,z){var H=G.length-1;switch(q){case 5:F.setOrientation(G[H]);break;case 9:F.setDiagramTitle(G[H].text.trim());break;case 12:F.setLineData({text:"",type:"text"},G[H]);break;case 13:F.setLineData(G[H-1],G[H]);break;case 14:F.setBarData({text:"",type:"text"},G[H]);break;case 15:F.setBarData(G[H-1],G[H]);break;case 16:this.$=G[H].trim(),F.setAccTitle(this.$);break;case 17:case 18:this.$=G[H].trim(),F.setAccDescription(this.$);break;case 19:this.$=G[H-1];break;case 20:case 30:this.$=[G[H-2],...G[H]];break;case 21:case 31:this.$=[G[H]];break;case 22:this.$={value:Number(G[H-1]),label:G[H]};break;case 23:this.$={value:Number(G[H]),label:""};break;case 24:F.setXAxisTitle(G[H]);break;case 25:F.setXAxisTitle(G[H-1]);break;case 26:F.setXAxisTitle({type:"text",text:""});break;case 27:F.setXAxisBand(G[H]);break;case 28:F.setXAxisRangeData(Number(G[H-2]),Number(G[H]));break;case 29:this.$=G[H-1];break;case 32:F.setYAxisTitle(G[H]);break;case 33:F.setYAxisTitle(G[H-1]);break;case 34:F.setYAxisTitle({type:"text",text:""});break;case 35:F.setYAxisRangeData(Number(G[H-2]),Number(G[H]));break;case 39:this.$={text:G[H],type:"text"};break;case 40:this.$={text:G[H],type:"text"};break;case 41:this.$={text:G[H],type:"markdown"};break;case 42:this.$=G[H];break;case 43:this.$=G[H-1]+""+G[H];break}},"anonymous"),table:[e(t,r,{3:1,4:2,7:4,5:n,36:i,37:a,38:s}),{1:[3]},e(t,r,{4:2,7:4,3:8,5:n,36:i,37:a,38:s}),e(t,r,{4:2,7:4,6:9,3:10,5:n,8:[1,11],36:i,37:a,38:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(o,[2,36]),e(o,[2,37]),e(o,[2,38]),{1:[2,1]},e(t,r,{4:2,7:4,3:21,5:n,36:i,37:a,38:s}),{1:[2,3]},e(o,[2,5]),e(t,[2,7],{4:22,36:i,37:a,38:s}),{11:23,30:l,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:39,13:38,24:C,29:T,30:l,31:40,32:41,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:45,15:44,29:k,30:l,35:46,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:49,17:48,24:S,30:l,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{11:52,17:51,24:S,30:l,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},{20:[1,53]},{22:[1,54]},e(E,[2,18]),{1:[2,2]},e(E,[2,8]),e(E,[2,9]),e(I,[2,39],{41:55,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w}),e(I,[2,40]),e(I,[2,41]),e(L,[2,42]),e(L,[2,44]),e(L,[2,45]),e(L,[2,46]),e(L,[2,47]),e(L,[2,48]),e(L,[2,49]),e(L,[2,50]),e(L,[2,51]),e(L,[2,52]),e(L,[2,53]),e(E,[2,10]),e(E,[2,24],{32:41,31:56,24:C,29:T}),e(E,[2,26]),e(E,[2,27]),{33:[1,57]},{11:59,30:l,34:58,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},e(E,[2,11]),e(E,[2,32],{35:60,29:k}),e(E,[2,34]),{33:[1,61]},e(E,[2,12]),{17:62,24:S},{25:63,27:64,29:O},e(E,[2,14]),{17:66,24:S},e(E,[2,16]),e(E,[2,17]),e(L,[2,43]),e(E,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(E,[2,33]),{29:[1,70]},e(E,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(R,[2,23],{30:[1,73]}),e(E,[2,15]),e(E,[2,28]),e(E,[2,29]),{11:59,30:l,34:74,39:24,40:u,41:27,42:h,43:f,44:d,45:p,46:m,47:g,48:y,49:v,50:x,51:w},e(E,[2,35]),e(E,[2,19]),{25:75,27:64,29:O},e(R,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:b(function(B,P){if(P.recoverable)this.trace(B);else{var $=new Error(B);throw $.hash=P,$}},"parseError"),parse:b(function(B){var P=this,$=[0],F=[],q=[null],G=[],z=this.table,H="",j=0,J=0,U=0,le=2,ee=1,ue=G.slice.call(arguments,1),ae=Object.create(this.lexer),oe={yy:{}};for(var Re in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Re)&&(oe.yy[Re]=this.yy[Re]);ae.setInput(B,oe.yy),oe.yy.lexer=ae,oe.yy.parser=this,typeof ae.yylloc>"u"&&(ae.yylloc={});var Te=ae.yylloc;G.push(Te);var Oe=ae.options&&ae.options.ranges;typeof oe.yy.parseError=="function"?this.parseError=oe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function qe(ne){$.length=$.length-2*ne,q.length=q.length-ne,G.length=G.length-ne}b(qe,"popStack");function Ge(){var ne;return ne=F.pop()||ae.lex()||ee,typeof ne!="number"&&(ne instanceof Array&&(F=ne,ne=F.pop()),ne=P.symbols_[ne]||ne),ne}b(Ge,"lex");for(var fe,Ce,_e,de,ie,Q,he={},xe,ce,ge,Ie;;){if(_e=$[$.length-1],this.defaultActions[_e]?de=this.defaultActions[_e]:((fe===null||typeof fe>"u")&&(fe=Ge()),de=z[_e]&&z[_e][fe]),typeof de>"u"||!de.length||!de[0]){var ye="";Ie=[];for(xe in z[_e])this.terminals_[xe]&&xe>le&&Ie.push("'"+this.terminals_[xe]+"'");ae.showPosition?ye="Parse error on line "+(j+1)+`: `+ae.showPosition()+` Expecting `+Ie.join(", ")+", got '"+(this.terminals_[fe]||fe)+"'":ye="Parse error on line "+(j+1)+": Unexpected "+(fe==ee?"end of input":"'"+(this.terminals_[fe]||fe)+"'"),this.parseError(ye,{text:ae.match,token:this.terminals_[fe]||fe,line:ae.yylineno,loc:Te,expected:Ie})}if(de[0]instanceof Array&&de.length>1)throw new Error("Parse Error: multiple actions possible at state: "+_e+", token: "+fe);switch(de[0]){case 1:$.push(fe),q.push(ae.yytext),G.push(ae.yylloc),$.push(de[1]),fe=null,Ce?(fe=Ce,Ce=null):(J=ae.yyleng,H=ae.yytext,j=ae.yylineno,Te=ae.yylloc,U>0&&U--);break;case 2:if(ce=this.productions_[de[1]][1],he.$=q[q.length-ce],he._$={first_line:G[G.length-(ce||1)].first_line,last_line:G[G.length-1].last_line,first_column:G[G.length-(ce||1)].first_column,last_column:G[G.length-1].last_column},Oe&&(he._$.range=[G[G.length-(ce||1)].range[0],G[G.length-1].range[1]]),Q=this.performAction.apply(he,[H,J,j,oe.yy,de[1],q,G].concat(ue)),typeof Q<"u")return Q;ce&&($=$.slice(0,-1*ce*2),q=q.slice(0,-1*ce),G=G.slice(0,-1*ce)),$.push(this.productions_[de[1]][0]),q.push(he.$),G.push(he._$),ge=z[$[$.length-2]][$[$.length-1]],$.push(ge);break;case 3:return!0}}return!0},"parse")},N=(function(){var D={EOF:1,parseError:b(function(P,$){if(this.yy.parser)this.yy.parser.parseError(P,$);else throw new Error(P)},"parseError"),setInput:b(function(B,P){return this.yy=P||this.yy||{},this._input=B,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var B=this._input[0];this.yytext+=B,this.yyleng++,this.offset++,this.match+=B,this.matched+=B;var P=B.match(/(?:\r\n?|\n).*/g);return P?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),B},"input"),unput:b(function(B){var P=B.length,$=B.split(/(?:\r\n?|\n)/g);this._input=B+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-P),this.offset-=P;var F=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),$.length-1&&(this.yylineno-=$.length-1);var q=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:$?($.length===F.length?this.yylloc.first_column:0)+F[F.length-$.length].length-$[0].length:this.yylloc.first_column-P},this.options.ranges&&(this.yylloc.range=[q[0],q[0]+this.yyleng-P]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(B){this.unput(this.match.slice(B))},"less"),pastInput:b(function(){var B=this.matched.substr(0,this.matched.length-this.match.length);return(B.length>20?"...":"")+B.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var B=this.match;return B.length<20&&(B+=this._input.substr(0,20-B.length)),(B.substr(0,20)+(B.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var B=this.pastInput(),P=new Array(B.length+1).join("-");return B+this.upcomingInput()+` `+P+"^"},"showPosition"),test_match:b(function(B,P){var $,F,q;if(this.options.backtrack_lexer&&(q={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(q.yylloc.range=this.yylloc.range.slice(0))),F=B[0].match(/(?:\r\n?|\n).*/g),F&&(this.yylineno+=F.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:F?F[F.length-1].length-F[F.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+B[0].length},this.yytext+=B[0],this.match+=B[0],this.matches=B,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(B[0].length),this.matched+=B[0],$=this.performAction.call(this,this.yy,this,P,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),$)return $;if(this._backtrack){for(var G in q)this[G]=q[G];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var B,P,$,F;this._more||(this.yytext="",this.match="");for(var q=this._currentRules(),G=0;GP[0].length)){if(P=$,F=G,this.options.backtrack_lexer){if(B=this.test_match($,q[G]),B!==!1)return B;if(this._backtrack){P=!1;continue}else return!1}else if(!this.options.flex)break}return P?(B=this.test_match(P,q[F]),B!==!1?B:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var P=this.next();return P||this.lex()},"lex"),begin:b(function(P){this.conditionStack.push(P)},"begin"),popState:b(function(){var P=this.conditionStack.length-1;return P>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(P){return P=this.conditionStack.length-1-Math.abs(P||0),P>=0?this.conditionStack[P]:"INITIAL"},"topState"),pushState:b(function(P){this.begin(P)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(P,$,F,q){var G=q;switch(F){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return D})();A.lexer=N;function M(){this.yy={}}return b(M,"Parser"),M.prototype=A,A.Parser=M,new M})();Vie.parser=Vie;RKt=Vie;b(Wie,"isBarPlot");b(mO,"isBandAxisData");b(lk,"isLinearAxisData");_Ke=class{constructor(e){this.parentGroup=e}static{b(this,"TextDimensionCalculatorWithFont")}getMaxDimension(e,t){if(!this.parentGroup)return{width:e.reduce((i,a)=>Math.max(a.length,i),0)*t,height:t};let r={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",t);for(let i of e){let a=tY(n,1,i),s=a?a.width:i.length*t,o=a?a.height:t;r.width=Math.max(r.width,s),r.height=Math.max(r.height,o)}return n.remove(),r}},EKe=.7,AKe=.2,RKe=class{constructor(e,t,r,n){this.axisConfig=e,this.title=t,this.textDimensionCalculator=r,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{b(this,"BaseAxis")}setRange(e){this.range=e,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=e[1]-e[0]:this.boundingRect.width=e[1]-e[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(e=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){EKe*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(EKe*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let t=e.height;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let r=this.getLabelDimension(),n=AKe*e.width;this.outerPadding=Math.min(r.width/2,n);let i=r.height;this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0&&(i=Math.max(i,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*r.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*r.height))),i+=this.axisConfig.labelPadding*2,this.labelTextHeight=r.height,i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let r=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=r.height+this.axisConfig.titlePadding*2;this.titleTextHeight=r.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width,this.boundingRect.height=e.height-t}calculateSpaceIfDrawnVertical(e){let t=e.width;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let r=this.getLabelDimension(),n=AKe*e.height;this.outerPadding=Math.min(r.height/2,n);let i=r.width+this.axisConfig.labelPadding*2;i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let r=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=r.height+this.axisConfig.titlePadding*2;this.titleTextHeight=r.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width-t,this.boundingRect.height=e.height}calculateSpace(e){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(e):this.calculateSpaceIfDrawnHorizontally(e),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateOffsetByRotation(e){let t=this.normalizedLabelRotationInRad;return t===0?0:Math.sin(t)*this.getLabelDimension()[e]/2}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${t},${this.boundingRect.y} L ${t},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(t),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let t=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${t},${this.getScaleValue(r)} L ${t-this.axisConfig.tickLength},${this.getScaleValue(r)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let t=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${this.getScaleValue(r)},${t} L ${this.getScaleValue(r)},${t+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let t=this.boundingRect.y;e.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${this.getScaleValue(r)},${t+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(r)},${t+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),e}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},LKt=class extends RKe{static{b(this,"BandAxis")}constructor(e,t,r,n,i){super(e,n,i,t),this.categories=r,this.scale=Hb().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=Hb().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),se.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},IKt=class extends RKe{static{b(this,"LinearAxis")}constructor(e,t,r,n,i){super(e,n,i,t),this.domain=r,this.scale=fh().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];this.axisPosition==="left"&&e.reverse(),this.scale=fh().domain(e).range(this.getRange())}getScaleValue(e){return this.scale(e)}};b(Hie,"getAxis");MKt=class{constructor(e,t,r,n){this.textDimensionCalculator=e,this.chartConfig=t,this.chartData=r,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{b(this,"ChartTitle")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let t=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),r=Math.max(t.width,e.width),n=t.height+2*this.chartConfig.titlePadding;return t.width<=r&&t.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=r,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];return this.showChartTitle&&e.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),e}};b(LKe,"getChartTitleComponent");NKt=class{constructor(e,t,r,n,i){this.plotData=e,this.xAxis=t,this.yAxis=r,this.orientation=n,this.plotIndex=i}static{b(this,"LinePlot")}getDrawableElement(){let e=this.plotData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),t;if(this.orientation==="horizontal"?t=Bf().y(n=>n[0]).x(n=>n[1])(e):t=Bf().x(n=>n[0]).y(n=>n[1])(e),!t)return[];let r=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:t,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let a=[];for(let[s,[o,l]]of e.entries()){let u=this.plotData.pointLabels[s];u&&(this.orientation==="horizontal"?a.push({x:l+10,y:o,text:u,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0}):a.push({x:o,y:l-10,text:u,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0}))}a.length>0&&r.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:a})}return r}},DKt=class{constructor(e,t,r,n,i,a){this.barData=e,this.boundingRect=t,this.xAxis=r,this.yAxis=n,this.orientation=i,this.plotIndex=a}static{b(this,"BarPlot")}getDrawableElement(){let e=this.barData.data.map(i=>[this.xAxis.getScaleValue(i[0]),this.yAxis.getScaleValue(i[1])]),r=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),n=r/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map(i=>({x:this.boundingRect.x,y:i[0]-n,height:r,width:i[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map(i=>({x:i[0]-n,y:i[1],width:r,height:this.boundingRect.y+this.boundingRect.height-i[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},OKt=class{constructor(e,t,r){this.chartConfig=e,this.chartData=t,this.chartThemeConfig=r,this.boundingRect={x:0,y:0,width:0,height:0}}static{b(this,"BasePlot")}setAxes(e,t){this.xAxis=e,this.yAxis=t}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let e=[];for(let[t,r]of this.chartData.plots.entries())switch(r.type){case"line":{let n=new NKt(r,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...n.getDrawableElement())}break;case"bar":{let n=new DKt(r,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...n.getDrawableElement())}break}return e}};b(IKe,"getPlotComponent");PKt=class{constructor(e,t,r,n){this.chartConfig=e,this.chartData=t,this.componentStore={title:LKe(e,t,r,n),plot:IKe(e,t,r),xAxis:Hie(t.xAxis,e.xAxis,{titleColor:r.xAxisTitleColor,labelColor:r.xAxisLabelColor,tickColor:r.xAxisTickColor,axisLineColor:r.xAxisLineColor},n),yAxis:Hie(t.yAxis,e.yAxis,{titleColor:r.yAxisTitleColor,labelColor:r.yAxisLabelColor,tickColor:r.yAxisTickColor,axisLineColor:r.yAxisLineColor},n)}}static{b(this,"Orchestrator")}calculateVerticalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,r=0,n=0,i=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),s=this.componentStore.plot.calculateSpace({width:i,height:a});e-=s.width,t-=s.height,s=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),n=s.height,t-=s.height,this.componentStore.xAxis.setAxisPosition("bottom"),s=this.componentStore.xAxis.calculateSpace({width:e,height:t}),t-=s.height,this.componentStore.yAxis.setAxisPosition("left"),s=this.componentStore.yAxis.calculateSpace({width:e,height:t}),r=s.width,e-=s.width,e>0&&(i+=e,e=0),t>0&&(a+=t,t=0),this.componentStore.plot.calculateSpace({width:i,height:a}),this.componentStore.plot.setBoundingBoxXY({x:r,y:n}),this.componentStore.xAxis.setRange([r,r+i]),this.componentStore.xAxis.setBoundingBoxXY({x:r,y:n+a}),this.componentStore.yAxis.setRange([n,n+a]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(o=>Wie(o))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,r=0,n=0,i=0,a=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),s=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:a,height:s});e-=o.width,t-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),r=o.height,t-=o.height,this.componentStore.xAxis.setAxisPosition("left"),o=this.componentStore.xAxis.calculateSpace({width:e,height:t}),e-=o.width,n=o.width,this.componentStore.yAxis.setAxisPosition("top"),o=this.componentStore.yAxis.calculateSpace({width:e,height:t}),t-=o.height,i=r+o.height,e>0&&(a+=e,e=0),t>0&&(s+=t,t=0),this.componentStore.plot.calculateSpace({width:a,height:s}),this.componentStore.plot.setBoundingBoxXY({x:n,y:i}),this.componentStore.yAxis.setRange([n,n+a]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:r}),this.componentStore.xAxis.setRange([i,i+s]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:i}),this.chartData.plots.some(l=>Wie(l))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let t of Object.values(this.componentStore))e.push(...t.getDrawableElements());return e}},BKt=class{static{b(this,"XYChartBuilder")}static build(e,t,r,n){return new PKt(e,t,r,n).getDrawableElement()}},R6=0,L6=jie(),I6=Xie(),jn=Kie(),Uie=I6.plotColorPalette.split(",").map(e=>e.trim()),gO=!1,Yie=!1;b(Xie,"getChartDefaultThemeConfig");b(jie,"getChartDefaultConfig");b(Kie,"getChartDefaultData");b(M6,"textSanitizer");b(NKe,"setTmpSVGG");b(DKe,"setOrientation");b(OKe,"setXAxisTitle");b(Zie,"setXAxisRangeData");b(PKe,"setXAxisBand");b(BKe,"setYAxisTitle");b(FKe,"setYAxisRangeData");b($Ke,"setYAxisRangeFromPlotData");b(Qie,"transformDataWithoutCategory");b(Jie,"getPlotColorFromPalette");b(zKe,"setLineData");b(GKe,"setBarData");b(qKe,"getDrawableElem");b(VKe,"getChartThemeConfig");b(WKe,"getChartConfig");b(HKe,"getXYChartData");FKt=b(function(){Nr(),R6=0,L6=jie(),jn=Kie(),I6=Xie(),Uie=I6.plotColorPalette.split(",").map(e=>e.trim()),gO=!1,Yie=!1},"clear"),$Kt={getDrawableElem:qKe,clear:FKt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr,setOrientation:DKe,setXAxisTitle:OKe,setXAxisRangeData:Zie,setXAxisBand:PKe,setYAxisTitle:BKe,setYAxisRangeData:FKe,setLineData:zKe,setBarData:GKe,setTmpSVGG:NKe,getChartThemeConfig:VKe,getChartConfig:WKe,getXYChartData:HKe},zKt=b((e,t,r,n)=>{let i=n.db,a=i.getChartThemeConfig(),s=i.getChartConfig(),o=i.getXYChartData().plots[0].data.map(w=>w[1]);function l(w){return w==="top"?"text-before-edge":"middle"}b(l,"getDominantBaseLine");function u(w){return w==="left"?"start":w==="right"?"end":"middle"}b(u,"getTextAnchor");function h(w){return`translate(${w.x}, ${w.y}) rotate(${w.rotation||0})`}b(h,"getTextTransformation"),se.debug(`Rendering xychart chart -`+e);let f=Qn(t),d=f.append("g").attr("class","main"),p=d.append("rect").attr("width",s.width).attr("height",s.height).attr("class","background");vn(f,s.height,s.width,!0),f.attr("viewBox",`0 0 ${s.width} ${s.height}`),p.attr("fill",a.backgroundColor),i.setTmpSVGG(f.append("g").attr("class","mermaid-tmp-group"));let m=i.getDrawableElem(),g={};function y(w){let C=d,T="";for(let[k]of w.entries()){let S=d;k>0&&g[T]&&(S=g[T]),T+=w[k],C=g[T],C||(C=g[T]=S.append("g").attr("class",w[k]))}return C}b(y,"getGroup");for(let w of m){if(w.data.length===0)continue;let C=y(w.groupTexts);switch(w.type){case"rect":if(C.selectAll("rect").data(w.data).enter().append("rect").attr("x",T=>T.x).attr("y",T=>T.y).attr("width",T=>T.width).attr("height",T=>T.height).attr("fill",T=>T.fill).attr("stroke",T=>T.strokeFill).attr("stroke-width",T=>T.strokeWidth),s.showDataLabel){let T=s.showDataLabelOutsideBar;if(s.chartOrientation==="horizontal"){let k=function(A,N){let{data:M,label:D}=A;return N*D.length*S<=M.width-E};var v=k;b(k,"fitsHorizontally");let S=.7,E=10,I=w.data.map((A,N)=>({data:A,label:o[N].toString()})).filter(A=>A.data.width>0&&A.data.height>0),L=I.map(A=>{let{data:N}=A,M=N.height*.7;for(;!k(A,M)&&M>0;)M-=1;return M}),O=Math.floor(Math.min(...L)),R=b(A=>T?A.data.x+A.data.width+E:A.data.x+A.data.width-E,"determineLabelXPosition");C.selectAll("text").data(I).enter().append("text").attr("x",R).attr("y",A=>A.data.y+A.data.height/2).attr("text-anchor",T?"start":"end").attr("dominant-baseline","middle").attr("fill",a.dataLabelColor).attr("font-size",`${O}px`).text(A=>A.label)}else{let k=function(R,A,N){let{data:M,label:D}=R,P=A*D.length*.7,$=M.x+M.width/2,F=$-P/2,q=$+P/2,G=F>=M.x&&q<=M.x+M.width,z=M.y+N+A<=M.y+M.height;return G&&z};var x=k;b(k,"fitsInBar");let S=10,E=w.data.map((R,A)=>({data:R,label:o[A].toString()})).filter(R=>R.data.width>0&&R.data.height>0),I=E.map(R=>{let{data:A,label:N}=R,M=A.width/(N.length*.7);for(;!k(R,M,S)&&M>0;)M-=1;return M}),L=Math.floor(Math.min(...I)),O=b(R=>T?R.data.y-S:R.data.y+S,"determineLabelYPosition");C.selectAll("text").data(E).enter().append("text").attr("x",R=>R.data.x+R.data.width/2).attr("y",O).attr("text-anchor","middle").attr("dominant-baseline",T?"auto":"hanging").attr("fill",a.dataLabelColor).attr("font-size",`${L}px`).text(R=>R.label)}}break;case"text":C.selectAll("text").data(w.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",T=>T.fill).attr("font-size",T=>T.fontSize).attr("dominant-baseline",T=>l(T.verticalPos)).attr("text-anchor",T=>u(T.horizontalPos)).attr("transform",T=>h(T)).text(T=>T.text);break;case"path":C.selectAll("path").data(w.data).enter().append("path").attr("d",T=>T.path).attr("fill",T=>T.fill?T.fill:"none").attr("stroke",T=>T.strokeFill).attr("stroke-width",T=>T.strokeWidth);break}}},"draw"),GKt={draw:zKt},qKt={parser:RKt,db:$Kt,renderer:GKt}});var jKe={};Tr(jKe,{diagram:()=>jKt});var eae,VKt,WKt,HKt,UKt,YKt,XKe,XKt,jKt,KKe=W(()=>{Uc();oc();ic();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();eae=(function(){var e=b(function(ye,ne,V,pe){for(V=V||{},pe=ye.length;pe--;V[ye[pe]]=ne);return V},"o"),t=[1,3],r=[1,4],n=[1,5],i=[1,6],a=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],s=[1,22],o=[2,7],l=[1,26],u=[1,27],h=[1,28],f=[1,29],d=[1,33],p=[1,34],m=[1,35],g=[1,36],y=[1,37],v=[1,38],x=[1,24],w=[1,31],C=[1,32],T=[1,30],k=[1,39],S=[1,40],E=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],I=[1,61],L=[89,90],O=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],R=[27,29],A=[1,70],N=[1,71],M=[1,72],D=[1,73],B=[1,74],P=[1,75],$=[1,76],F=[1,83],q=[1,80],G=[1,84],z=[1,85],H=[1,86],j=[1,87],J=[1,88],U=[1,89],le=[1,90],ee=[1,91],ue=[1,92],ae=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],oe=[63,64],Re=[1,101],Te=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],Oe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],qe=[1,110],Ge=[1,106],fe=[1,107],Ce=[1,108],_e=[1,109],de=[1,111],ie=[1,116],Q=[1,117],he=[1,114],xe=[1,115],ce={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:b(function(ne,V,pe,K,ve,Z,je){var Ne=Z.length-1;switch(ve){case 4:this.$=Z[Ne].trim(),K.setAccTitle(this.$);break;case 5:case 6:this.$=Z[Ne].trim(),K.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:K.setDirection("TB");break;case 18:K.setDirection("BT");break;case 19:K.setDirection("RL");break;case 20:K.setDirection("LR");break;case 21:K.addRequirement(Z[Ne-3],Z[Ne-4]);break;case 22:K.addRequirement(Z[Ne-5],Z[Ne-6]),K.setClass([Z[Ne-5]],Z[Ne-3]);break;case 23:K.setNewReqId(Z[Ne-2]);break;case 24:K.setNewReqText(Z[Ne-2]);break;case 25:K.setNewReqRisk(Z[Ne-2]);break;case 26:K.setNewReqVerifyMethod(Z[Ne-2]);break;case 29:this.$=K.RequirementType.REQUIREMENT;break;case 30:this.$=K.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=K.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=K.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=K.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=K.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=K.RiskLevel.LOW_RISK;break;case 36:this.$=K.RiskLevel.MED_RISK;break;case 37:this.$=K.RiskLevel.HIGH_RISK;break;case 38:this.$=K.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=K.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=K.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=K.VerifyType.VERIFY_TEST;break;case 42:K.addElement(Z[Ne-3]);break;case 43:K.addElement(Z[Ne-5]),K.setClass([Z[Ne-5]],Z[Ne-3]);break;case 44:K.setNewElementType(Z[Ne-2]);break;case 45:K.setNewElementDocRef(Z[Ne-2]);break;case 48:K.addRelationship(Z[Ne-2],Z[Ne],Z[Ne-4]);break;case 49:K.addRelationship(Z[Ne-2],Z[Ne-4],Z[Ne]);break;case 50:this.$=K.Relationships.CONTAINS;break;case 51:this.$=K.Relationships.COPIES;break;case 52:this.$=K.Relationships.DERIVES;break;case 53:this.$=K.Relationships.SATISFIES;break;case 54:this.$=K.Relationships.VERIFIES;break;case 55:this.$=K.Relationships.REFINES;break;case 56:this.$=K.Relationships.TRACES;break;case 57:this.$=Z[Ne-2],K.defineClass(Z[Ne-1],Z[Ne]);break;case 58:K.setClass(Z[Ne-1],Z[Ne]);break;case 59:K.setClass([Z[Ne-2]],Z[Ne]);break;case 60:case 62:this.$=[Z[Ne]];break;case 61:case 63:this.$=Z[Ne-2].concat([Z[Ne]]);break;case 64:this.$=Z[Ne-2],K.setCssStyle(Z[Ne-1],Z[Ne]);break;case 65:this.$=[Z[Ne]];break;case 66:Z[Ne-2].push(Z[Ne]),this.$=Z[Ne-2];break;case 68:this.$=Z[Ne-1]+Z[Ne];break}},"anonymous"),table:[{3:1,4:2,6:t,9:r,11:n,13:i},{1:[3]},{3:8,4:2,5:[1,7],6:t,9:r,11:n,13:i},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(a,[2,6]),{3:12,4:2,6:t,9:r,11:n,13:i},{1:[2,2]},{4:17,5:s,7:13,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},e(a,[2,4]),e(a,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:s,7:42,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:43,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:44,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:45,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:46,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:47,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:48,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:49,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:50,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(E,[2,17]),e(E,[2,18]),e(E,[2,19]),e(E,[2,20]),{30:60,33:62,75:I,89:k,90:S},{30:63,33:62,75:I,89:k,90:S},{30:64,33:62,75:I,89:k,90:S},e(L,[2,29]),e(L,[2,30]),e(L,[2,31]),e(L,[2,32]),e(L,[2,33]),e(L,[2,34]),e(O,[2,81]),e(O,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(R,[2,79]),e(R,[2,80]),{27:[1,67],29:[1,68]},e(R,[2,85]),e(R,[2,86]),{62:69,65:A,66:N,67:M,68:D,69:B,70:P,71:$},{62:77,65:A,66:N,67:M,68:D,69:B,70:P,71:$},{30:78,33:62,75:I,89:k,90:S},{73:79,75:F,76:q,78:81,79:82,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue},e(ae,[2,60]),e(ae,[2,62]),{73:93,75:F,76:q,78:81,79:82,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue},{30:94,33:62,75:I,76:q,89:k,90:S},{5:[1,95]},{30:96,33:62,75:I,89:k,90:S},{5:[1,97]},{30:98,33:62,75:I,89:k,90:S},{63:[1,99]},e(oe,[2,50]),e(oe,[2,51]),e(oe,[2,52]),e(oe,[2,53]),e(oe,[2,54]),e(oe,[2,55]),e(oe,[2,56]),{64:[1,100]},e(E,[2,59],{76:q}),e(E,[2,64],{76:Re}),{33:103,75:[1,102],89:k,90:S},e(Te,[2,65],{79:104,75:F,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue}),e(Oe,[2,67]),e(Oe,[2,69]),e(Oe,[2,70]),e(Oe,[2,71]),e(Oe,[2,72]),e(Oe,[2,73]),e(Oe,[2,74]),e(Oe,[2,75]),e(Oe,[2,76]),e(Oe,[2,77]),e(Oe,[2,78]),e(E,[2,57],{76:Re}),e(E,[2,58],{76:q}),{5:qe,28:105,31:Ge,34:fe,36:Ce,38:_e,40:de},{27:[1,112],76:q},{5:ie,40:Q,56:113,57:he,59:xe},{27:[1,118],76:q},{33:119,89:k,90:S},{33:120,89:k,90:S},{75:F,78:121,79:82,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue},e(ae,[2,61]),e(ae,[2,63]),e(Oe,[2,68]),e(E,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:qe,28:126,31:Ge,34:fe,36:Ce,38:_e,40:de},e(E,[2,28]),{5:[1,127]},e(E,[2,42]),{32:[1,128]},{32:[1,129]},{5:ie,40:Q,56:130,57:he,59:xe},e(E,[2,47]),{5:[1,131]},e(E,[2,48]),e(E,[2,49]),e(Te,[2,66],{79:104,75:F,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue}),{33:132,89:k,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(E,[2,27]),{5:qe,28:145,31:Ge,34:fe,36:Ce,38:_e,40:de},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(E,[2,46]),{5:ie,40:Q,56:152,57:he,59:xe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(E,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(E,[2,43]),{5:qe,28:159,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:qe,28:160,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:qe,28:161,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:qe,28:162,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:ie,40:Q,56:163,57:he,59:xe},{5:ie,40:Q,56:164,57:he,59:xe},e(E,[2,23]),e(E,[2,24]),e(E,[2,25]),e(E,[2,26]),e(E,[2,44]),e(E,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:b(function(ne,V){if(V.recoverable)this.trace(ne);else{var pe=new Error(ne);throw pe.hash=V,pe}},"parseError"),parse:b(function(ne){var V=this,pe=[0],K=[],ve=[null],Z=[],je=this.table,Ne="",ze=0,Fe=0,Ke=0,Ve=2,tt=1,We=Z.slice.call(arguments,1),rt=Object.create(this.lexer),Se={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(Se.yy[Et]=this.yy[Et]);rt.setInput(ne,Se.yy),Se.yy.lexer=rt,Se.yy.parser=this,typeof rt.yylloc>"u"&&(rt.yylloc={});var De=rt.yylloc;Z.push(De);var mt=rt.options&&rt.options.ranges;typeof Se.yy.parseError=="function"?this.parseError=Se.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Tt(Vt){pe.length=pe.length-2*Vt,ve.length=ve.length-Vt,Z.length=Z.length-Vt}b(Tt,"popStack");function jt(){var Vt;return Vt=K.pop()||rt.lex()||tt,typeof Vt!="number"&&(Vt instanceof Array&&(K=Vt,Vt=K.pop()),Vt=V.symbols_[Vt]||Vt),Vt}b(jt,"lex");for(var _t,Rt,bt,ke,yt,xt,it={},Me,ut,at,dt;;){if(bt=pe[pe.length-1],this.defaultActions[bt]?ke=this.defaultActions[bt]:((_t===null||typeof _t>"u")&&(_t=jt()),ke=je[bt]&&je[bt][_t]),typeof ke>"u"||!ke.length||!ke[0]){var tr="";dt=[];for(Me in je[bt])this.terminals_[Me]&&Me>Ve&&dt.push("'"+this.terminals_[Me]+"'");rt.showPosition?tr="Parse error on line "+(ze+1)+`: +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var P=this.next();return P||this.lex()},"lex"),begin:b(function(P){this.conditionStack.push(P)},"begin"),popState:b(function(){var P=this.conditionStack.length-1;return P>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(P){return P=this.conditionStack.length-1-Math.abs(P||0),P>=0?this.conditionStack[P]:"INITIAL"},"topState"),pushState:b(function(P){this.begin(P)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(P,$,F,q){var G=q;switch(F){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return D})();A.lexer=N;function M(){this.yy={}}return b(M,"Parser"),M.prototype=A,A.Parser=M,new M})();Hie.parser=Hie;NKt=Hie;b(Uie,"isBarPlot");b(mO,"isBandAxisData");b(lk,"isLinearAxisData");LKe=class{constructor(e){this.parentGroup=e}static{b(this,"TextDimensionCalculatorWithFont")}getMaxDimension(e,t){if(!this.parentGroup)return{width:e.reduce((i,a)=>Math.max(a.length,i),0)*t,height:t};let r={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",t);for(let i of e){let a=nY(n,1,i),s=a?a.width:i.length*t,o=a?a.height:t;r.width=Math.max(r.width,s),r.height=Math.max(r.height,o)}return n.remove(),r}},_Ke=.7,RKe=.2,IKe=class{constructor(e,t,r,n){this.axisConfig=e,this.title=t,this.textDimensionCalculator=r,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{b(this,"BaseAxis")}setRange(e){this.range=e,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=e[1]-e[0]:this.boundingRect.width=e[1]-e[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(e){this.axisPosition=e,this.setRange(this.range)}getTickDistance(){let e=this.getRange();return Math.abs(e[0]-e[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(e=>e.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){_Ke*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(_Ke*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(e){let t=e.height;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let r=this.getLabelDimension(),n=RKe*e.width;this.outerPadding=Math.min(r.width/2,n);let i=r.height;this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0&&(i=Math.max(i,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*r.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*r.height))),i+=this.axisConfig.labelPadding*2,this.labelTextHeight=r.height,i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let r=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=r.height+this.axisConfig.titlePadding*2;this.titleTextHeight=r.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width,this.boundingRect.height=e.height-t}calculateSpaceIfDrawnVertical(e){let t=e.width;if(this.axisConfig.showAxisLine&&t>this.axisConfig.axisLineWidth&&(t-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let r=this.getLabelDimension(),n=RKe*e.height;this.outerPadding=Math.min(r.height/2,n);let i=r.width+this.axisConfig.labelPadding*2;i<=t&&(t-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&t>=this.axisConfig.tickLength&&(this.showTick=!0,t-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let r=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=r.height+this.axisConfig.titlePadding*2;this.titleTextHeight=r.height,n<=t&&(t-=n,this.showTitle=!0)}this.boundingRect.width=e.width-t,this.boundingRect.height=e.height}calculateSpace(e){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(e):this.calculateSpaceIfDrawnHorizontally(e),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateOffsetByRotation(e){let t=this.normalizedLabelRotationInRad;return t===0?0:Math.sin(t)*this.getLabelDimension()[e]/2}getDrawableElementsForLeftAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${t},${this.boundingRect.y} L ${t},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(t),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let t=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${t},${this.getScaleValue(r)} L ${t-this.axisConfig.tickLength},${this.getScaleValue(r)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),e}getDrawableElementsForBottomAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let t=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);e.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${this.getScaleValue(r)},${t} L ${this.getScaleValue(r)},${t+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),e}getDrawableElementsForTopAxis(){let e=[];if(this.showAxisLine){let t=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;e.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${t} L ${this.boundingRect.x+this.boundingRect.width},${t}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&e.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let t=this.boundingRect.y;e.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${this.getScaleValue(r)},${t+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(r)},${t+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&e.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),e}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},DKt=class extends IKe{static{b(this,"BandAxis")}constructor(e,t,r,n,i){super(e,n,i,t),this.categories=r,this.scale=Hb().domain(this.categories).range(this.getRange())}setRange(e){super.setRange(e)}recalculateScale(){this.scale=Hb().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),se.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(e){return this.scale(e)??this.getRange()[0]}},OKt=class extends IKe{static{b(this,"LinearAxis")}constructor(e,t,r,n,i){super(e,n,i,t),this.domain=r,this.scale=fh().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let e=[...this.domain];this.axisPosition==="left"&&e.reverse(),this.scale=fh().domain(e).range(this.getRange())}getScaleValue(e){return this.scale(e)}};b(Yie,"getAxis");PKt=class{constructor(e,t,r,n){this.textDimensionCalculator=e,this.chartConfig=t,this.chartData=r,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{b(this,"ChartTitle")}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){let t=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),r=Math.max(t.width,e.width),n=t.height+2*this.chartConfig.titlePadding;return t.width<=r&&t.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=r,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let e=[];return this.showChartTitle&&e.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),e}};b(MKe,"getChartTitleComponent");BKt=class{constructor(e,t,r,n,i){this.plotData=e,this.xAxis=t,this.yAxis=r,this.orientation=n,this.plotIndex=i}static{b(this,"LinePlot")}getDrawableElement(){let e=this.plotData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),t;if(this.orientation==="horizontal"?t=Bf().y(n=>n[0]).x(n=>n[1])(e):t=Bf().x(n=>n[0]).y(n=>n[1])(e),!t)return[];let r=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:t,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let a=[];for(let[s,[o,l]]of e.entries()){let u=this.plotData.pointLabels[s];u&&(this.orientation==="horizontal"?a.push({x:l+10,y:o,text:u,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0}):a.push({x:o,y:l-10,text:u,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0}))}a.length>0&&r.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:a})}return r}},FKt=class{constructor(e,t,r,n,i,a){this.barData=e,this.boundingRect=t,this.xAxis=r,this.yAxis=n,this.orientation=i,this.plotIndex=a}static{b(this,"BarPlot")}getDrawableElement(){let e=this.barData.data.map(i=>[this.xAxis.getScaleValue(i[0]),this.yAxis.getScaleValue(i[1])]),r=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),n=r/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map(i=>({x:this.boundingRect.x,y:i[0]-n,height:r,width:i[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:e.map(i=>({x:i[0]-n,y:i[1],width:r,height:this.boundingRect.y+this.boundingRect.height-i[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},$Kt=class{constructor(e,t,r){this.chartConfig=e,this.chartData=t,this.chartThemeConfig=r,this.boundingRect={x:0,y:0,width:0,height:0}}static{b(this,"BasePlot")}setAxes(e,t){this.xAxis=e,this.yAxis=t}setBoundingBoxXY(e){this.boundingRect.x=e.x,this.boundingRect.y=e.y}calculateSpace(e){return this.boundingRect.width=e.width,this.boundingRect.height=e.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let e=[];for(let[t,r]of this.chartData.plots.entries())switch(r.type){case"line":{let n=new BKt(r,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...n.getDrawableElement())}break;case"bar":{let n=new FKt(r,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,t);e.push(...n.getDrawableElement())}break}return e}};b(NKe,"getPlotComponent");zKt=class{constructor(e,t,r,n){this.chartConfig=e,this.chartData=t,this.componentStore={title:MKe(e,t,r,n),plot:NKe(e,t,r),xAxis:Yie(t.xAxis,e.xAxis,{titleColor:r.xAxisTitleColor,labelColor:r.xAxisLabelColor,tickColor:r.xAxisTickColor,axisLineColor:r.xAxisLineColor},n),yAxis:Yie(t.yAxis,e.yAxis,{titleColor:r.yAxisTitleColor,labelColor:r.yAxisLabelColor,tickColor:r.yAxisTickColor,axisLineColor:r.yAxisLineColor},n)}}static{b(this,"Orchestrator")}calculateVerticalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,r=0,n=0,i=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),s=this.componentStore.plot.calculateSpace({width:i,height:a});e-=s.width,t-=s.height,s=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),n=s.height,t-=s.height,this.componentStore.xAxis.setAxisPosition("bottom"),s=this.componentStore.xAxis.calculateSpace({width:e,height:t}),t-=s.height,this.componentStore.yAxis.setAxisPosition("left"),s=this.componentStore.yAxis.calculateSpace({width:e,height:t}),r=s.width,e-=s.width,e>0&&(i+=e,e=0),t>0&&(a+=t,t=0),this.componentStore.plot.calculateSpace({width:i,height:a}),this.componentStore.plot.setBoundingBoxXY({x:r,y:n}),this.componentStore.xAxis.setRange([r,r+i]),this.componentStore.xAxis.setBoundingBoxXY({x:r,y:n+a}),this.componentStore.yAxis.setRange([n,n+a]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(o=>Uie(o))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let e=this.chartConfig.width,t=this.chartConfig.height,r=0,n=0,i=0,a=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),s=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:a,height:s});e-=o.width,t-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:t}),r=o.height,t-=o.height,this.componentStore.xAxis.setAxisPosition("left"),o=this.componentStore.xAxis.calculateSpace({width:e,height:t}),e-=o.width,n=o.width,this.componentStore.yAxis.setAxisPosition("top"),o=this.componentStore.yAxis.calculateSpace({width:e,height:t}),t-=o.height,i=r+o.height,e>0&&(a+=e,e=0),t>0&&(s+=t,t=0),this.componentStore.plot.calculateSpace({width:a,height:s}),this.componentStore.plot.setBoundingBoxXY({x:n,y:i}),this.componentStore.yAxis.setRange([n,n+a]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:r}),this.componentStore.xAxis.setRange([i,i+s]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:i}),this.chartData.plots.some(l=>Uie(l))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let e=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let t of Object.values(this.componentStore))e.push(...t.getDrawableElements());return e}},GKt=class{static{b(this,"XYChartBuilder")}static build(e,t,r,n){return new zKt(e,t,r,n).getDrawableElement()}},R6=0,L6=Zie(),I6=Kie(),jn=Qie(),Xie=I6.plotColorPalette.split(",").map(e=>e.trim()),gO=!1,jie=!1;b(Kie,"getChartDefaultThemeConfig");b(Zie,"getChartDefaultConfig");b(Qie,"getChartDefaultData");b(M6,"textSanitizer");b(OKe,"setTmpSVGG");b(PKe,"setOrientation");b(BKe,"setXAxisTitle");b(Jie,"setXAxisRangeData");b(FKe,"setXAxisBand");b($Ke,"setYAxisTitle");b(zKe,"setYAxisRangeData");b(GKe,"setYAxisRangeFromPlotData");b(eae,"transformDataWithoutCategory");b(tae,"getPlotColorFromPalette");b(qKe,"setLineData");b(VKe,"setBarData");b(WKe,"getDrawableElem");b(HKe,"getChartThemeConfig");b(UKe,"getChartConfig");b(YKe,"getXYChartData");qKt=b(function(){Nr(),R6=0,L6=Zie(),jn=Qie(),I6=Kie(),Xie=I6.plotColorPalette.split(",").map(e=>e.trim()),gO=!1,jie=!1},"clear"),VKt={getDrawableElem:WKe,clear:qKt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr,setOrientation:PKe,setXAxisTitle:BKe,setXAxisRangeData:Jie,setXAxisBand:FKe,setYAxisTitle:$Ke,setYAxisRangeData:zKe,setLineData:qKe,setBarData:VKe,setTmpSVGG:OKe,getChartThemeConfig:HKe,getChartConfig:UKe,getXYChartData:YKe},WKt=b((e,t,r,n)=>{let i=n.db,a=i.getChartThemeConfig(),s=i.getChartConfig(),o=i.getXYChartData().plots[0].data.map(w=>w[1]);function l(w){return w==="top"?"text-before-edge":"middle"}b(l,"getDominantBaseLine");function u(w){return w==="left"?"start":w==="right"?"end":"middle"}b(u,"getTextAnchor");function h(w){return`translate(${w.x}, ${w.y}) rotate(${w.rotation||0})`}b(h,"getTextTransformation"),se.debug(`Rendering xychart chart +`+e);let f=Qn(t),d=f.append("g").attr("class","main"),p=d.append("rect").attr("width",s.width).attr("height",s.height).attr("class","background");vn(f,s.height,s.width,!0),f.attr("viewBox",`0 0 ${s.width} ${s.height}`),p.attr("fill",a.backgroundColor),i.setTmpSVGG(f.append("g").attr("class","mermaid-tmp-group"));let m=i.getDrawableElem(),g={};function y(w){let C=d,T="";for(let[k]of w.entries()){let S=d;k>0&&g[T]&&(S=g[T]),T+=w[k],C=g[T],C||(C=g[T]=S.append("g").attr("class",w[k]))}return C}b(y,"getGroup");for(let w of m){if(w.data.length===0)continue;let C=y(w.groupTexts);switch(w.type){case"rect":if(C.selectAll("rect").data(w.data).enter().append("rect").attr("x",T=>T.x).attr("y",T=>T.y).attr("width",T=>T.width).attr("height",T=>T.height).attr("fill",T=>T.fill).attr("stroke",T=>T.strokeFill).attr("stroke-width",T=>T.strokeWidth),s.showDataLabel){let T=s.showDataLabelOutsideBar;if(s.chartOrientation==="horizontal"){let k=function(A,N){let{data:M,label:D}=A;return N*D.length*S<=M.width-E};var v=k;b(k,"fitsHorizontally");let S=.7,E=10,I=w.data.map((A,N)=>({data:A,label:o[N].toString()})).filter(A=>A.data.width>0&&A.data.height>0),L=I.map(A=>{let{data:N}=A,M=N.height*.7;for(;!k(A,M)&&M>0;)M-=1;return M}),O=Math.floor(Math.min(...L)),R=b(A=>T?A.data.x+A.data.width+E:A.data.x+A.data.width-E,"determineLabelXPosition");C.selectAll("text").data(I).enter().append("text").attr("x",R).attr("y",A=>A.data.y+A.data.height/2).attr("text-anchor",T?"start":"end").attr("dominant-baseline","middle").attr("fill",a.dataLabelColor).attr("font-size",`${O}px`).text(A=>A.label)}else{let k=function(R,A,N){let{data:M,label:D}=R,P=A*D.length*.7,$=M.x+M.width/2,F=$-P/2,q=$+P/2,G=F>=M.x&&q<=M.x+M.width,z=M.y+N+A<=M.y+M.height;return G&&z};var x=k;b(k,"fitsInBar");let S=10,E=w.data.map((R,A)=>({data:R,label:o[A].toString()})).filter(R=>R.data.width>0&&R.data.height>0),I=E.map(R=>{let{data:A,label:N}=R,M=A.width/(N.length*.7);for(;!k(R,M,S)&&M>0;)M-=1;return M}),L=Math.floor(Math.min(...I)),O=b(R=>T?R.data.y-S:R.data.y+S,"determineLabelYPosition");C.selectAll("text").data(E).enter().append("text").attr("x",R=>R.data.x+R.data.width/2).attr("y",O).attr("text-anchor","middle").attr("dominant-baseline",T?"auto":"hanging").attr("fill",a.dataLabelColor).attr("font-size",`${L}px`).text(R=>R.label)}}break;case"text":C.selectAll("text").data(w.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",T=>T.fill).attr("font-size",T=>T.fontSize).attr("dominant-baseline",T=>l(T.verticalPos)).attr("text-anchor",T=>u(T.horizontalPos)).attr("transform",T=>h(T)).text(T=>T.text);break;case"path":C.selectAll("path").data(w.data).enter().append("path").attr("d",T=>T.path).attr("fill",T=>T.fill?T.fill:"none").attr("stroke",T=>T.strokeFill).attr("stroke-width",T=>T.strokeWidth);break}}},"draw"),HKt={draw:WKt},UKt={parser:NKt,db:VKt,renderer:HKt}});var ZKe={};Tr(ZKe,{diagram:()=>JKt});var rae,YKt,XKt,jKt,KKt,ZKt,KKe,QKt,JKt,QKe=W(()=>{Uc();lc();ac();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();rae=(function(){var e=b(function(ye,ne,V,pe){for(V=V||{},pe=ye.length;pe--;V[ye[pe]]=ne);return V},"o"),t=[1,3],r=[1,4],n=[1,5],i=[1,6],a=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],s=[1,22],o=[2,7],l=[1,26],u=[1,27],h=[1,28],f=[1,29],d=[1,33],p=[1,34],m=[1,35],g=[1,36],y=[1,37],v=[1,38],x=[1,24],w=[1,31],C=[1,32],T=[1,30],k=[1,39],S=[1,40],E=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],I=[1,61],L=[89,90],O=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],R=[27,29],A=[1,70],N=[1,71],M=[1,72],D=[1,73],B=[1,74],P=[1,75],$=[1,76],F=[1,83],q=[1,80],G=[1,84],z=[1,85],H=[1,86],j=[1,87],J=[1,88],U=[1,89],le=[1,90],ee=[1,91],ue=[1,92],ae=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],oe=[63,64],Re=[1,101],Te=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],Oe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],qe=[1,110],Ge=[1,106],fe=[1,107],Ce=[1,108],_e=[1,109],de=[1,111],ie=[1,116],Q=[1,117],he=[1,114],xe=[1,115],ce={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:b(function(ne,V,pe,K,ve,Z,je){var Ne=Z.length-1;switch(ve){case 4:this.$=Z[Ne].trim(),K.setAccTitle(this.$);break;case 5:case 6:this.$=Z[Ne].trim(),K.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:K.setDirection("TB");break;case 18:K.setDirection("BT");break;case 19:K.setDirection("RL");break;case 20:K.setDirection("LR");break;case 21:K.addRequirement(Z[Ne-3],Z[Ne-4]);break;case 22:K.addRequirement(Z[Ne-5],Z[Ne-6]),K.setClass([Z[Ne-5]],Z[Ne-3]);break;case 23:K.setNewReqId(Z[Ne-2]);break;case 24:K.setNewReqText(Z[Ne-2]);break;case 25:K.setNewReqRisk(Z[Ne-2]);break;case 26:K.setNewReqVerifyMethod(Z[Ne-2]);break;case 29:this.$=K.RequirementType.REQUIREMENT;break;case 30:this.$=K.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=K.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=K.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=K.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=K.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=K.RiskLevel.LOW_RISK;break;case 36:this.$=K.RiskLevel.MED_RISK;break;case 37:this.$=K.RiskLevel.HIGH_RISK;break;case 38:this.$=K.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=K.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=K.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=K.VerifyType.VERIFY_TEST;break;case 42:K.addElement(Z[Ne-3]);break;case 43:K.addElement(Z[Ne-5]),K.setClass([Z[Ne-5]],Z[Ne-3]);break;case 44:K.setNewElementType(Z[Ne-2]);break;case 45:K.setNewElementDocRef(Z[Ne-2]);break;case 48:K.addRelationship(Z[Ne-2],Z[Ne],Z[Ne-4]);break;case 49:K.addRelationship(Z[Ne-2],Z[Ne-4],Z[Ne]);break;case 50:this.$=K.Relationships.CONTAINS;break;case 51:this.$=K.Relationships.COPIES;break;case 52:this.$=K.Relationships.DERIVES;break;case 53:this.$=K.Relationships.SATISFIES;break;case 54:this.$=K.Relationships.VERIFIES;break;case 55:this.$=K.Relationships.REFINES;break;case 56:this.$=K.Relationships.TRACES;break;case 57:this.$=Z[Ne-2],K.defineClass(Z[Ne-1],Z[Ne]);break;case 58:K.setClass(Z[Ne-1],Z[Ne]);break;case 59:K.setClass([Z[Ne-2]],Z[Ne]);break;case 60:case 62:this.$=[Z[Ne]];break;case 61:case 63:this.$=Z[Ne-2].concat([Z[Ne]]);break;case 64:this.$=Z[Ne-2],K.setCssStyle(Z[Ne-1],Z[Ne]);break;case 65:this.$=[Z[Ne]];break;case 66:Z[Ne-2].push(Z[Ne]),this.$=Z[Ne-2];break;case 68:this.$=Z[Ne-1]+Z[Ne];break}},"anonymous"),table:[{3:1,4:2,6:t,9:r,11:n,13:i},{1:[3]},{3:8,4:2,5:[1,7],6:t,9:r,11:n,13:i},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(a,[2,6]),{3:12,4:2,6:t,9:r,11:n,13:i},{1:[2,2]},{4:17,5:s,7:13,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},e(a,[2,4]),e(a,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:s,7:42,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:43,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:44,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:45,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:46,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:47,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:48,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:49,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{4:17,5:s,7:50,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:l,22:u,23:h,24:f,25:23,33:25,41:d,42:p,43:m,44:g,45:y,46:v,54:x,72:w,74:C,77:T,89:k,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(E,[2,17]),e(E,[2,18]),e(E,[2,19]),e(E,[2,20]),{30:60,33:62,75:I,89:k,90:S},{30:63,33:62,75:I,89:k,90:S},{30:64,33:62,75:I,89:k,90:S},e(L,[2,29]),e(L,[2,30]),e(L,[2,31]),e(L,[2,32]),e(L,[2,33]),e(L,[2,34]),e(O,[2,81]),e(O,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(R,[2,79]),e(R,[2,80]),{27:[1,67],29:[1,68]},e(R,[2,85]),e(R,[2,86]),{62:69,65:A,66:N,67:M,68:D,69:B,70:P,71:$},{62:77,65:A,66:N,67:M,68:D,69:B,70:P,71:$},{30:78,33:62,75:I,89:k,90:S},{73:79,75:F,76:q,78:81,79:82,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue},e(ae,[2,60]),e(ae,[2,62]),{73:93,75:F,76:q,78:81,79:82,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue},{30:94,33:62,75:I,76:q,89:k,90:S},{5:[1,95]},{30:96,33:62,75:I,89:k,90:S},{5:[1,97]},{30:98,33:62,75:I,89:k,90:S},{63:[1,99]},e(oe,[2,50]),e(oe,[2,51]),e(oe,[2,52]),e(oe,[2,53]),e(oe,[2,54]),e(oe,[2,55]),e(oe,[2,56]),{64:[1,100]},e(E,[2,59],{76:q}),e(E,[2,64],{76:Re}),{33:103,75:[1,102],89:k,90:S},e(Te,[2,65],{79:104,75:F,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue}),e(Oe,[2,67]),e(Oe,[2,69]),e(Oe,[2,70]),e(Oe,[2,71]),e(Oe,[2,72]),e(Oe,[2,73]),e(Oe,[2,74]),e(Oe,[2,75]),e(Oe,[2,76]),e(Oe,[2,77]),e(Oe,[2,78]),e(E,[2,57],{76:Re}),e(E,[2,58],{76:q}),{5:qe,28:105,31:Ge,34:fe,36:Ce,38:_e,40:de},{27:[1,112],76:q},{5:ie,40:Q,56:113,57:he,59:xe},{27:[1,118],76:q},{33:119,89:k,90:S},{33:120,89:k,90:S},{75:F,78:121,79:82,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue},e(ae,[2,61]),e(ae,[2,63]),e(Oe,[2,68]),e(E,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:qe,28:126,31:Ge,34:fe,36:Ce,38:_e,40:de},e(E,[2,28]),{5:[1,127]},e(E,[2,42]),{32:[1,128]},{32:[1,129]},{5:ie,40:Q,56:130,57:he,59:xe},e(E,[2,47]),{5:[1,131]},e(E,[2,48]),e(E,[2,49]),e(Te,[2,66],{79:104,75:F,80:G,81:z,82:H,83:j,84:J,85:U,86:le,87:ee,88:ue}),{33:132,89:k,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(E,[2,27]),{5:qe,28:145,31:Ge,34:fe,36:Ce,38:_e,40:de},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(E,[2,46]),{5:ie,40:Q,56:152,57:he,59:xe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(E,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(E,[2,43]),{5:qe,28:159,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:qe,28:160,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:qe,28:161,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:qe,28:162,31:Ge,34:fe,36:Ce,38:_e,40:de},{5:ie,40:Q,56:163,57:he,59:xe},{5:ie,40:Q,56:164,57:he,59:xe},e(E,[2,23]),e(E,[2,24]),e(E,[2,25]),e(E,[2,26]),e(E,[2,44]),e(E,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:b(function(ne,V){if(V.recoverable)this.trace(ne);else{var pe=new Error(ne);throw pe.hash=V,pe}},"parseError"),parse:b(function(ne){var V=this,pe=[0],K=[],ve=[null],Z=[],je=this.table,Ne="",ze=0,Fe=0,Ke=0,Ve=2,tt=1,We=Z.slice.call(arguments,1),rt=Object.create(this.lexer),Se={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(Se.yy[Et]=this.yy[Et]);rt.setInput(ne,Se.yy),Se.yy.lexer=rt,Se.yy.parser=this,typeof rt.yylloc>"u"&&(rt.yylloc={});var De=rt.yylloc;Z.push(De);var mt=rt.options&&rt.options.ranges;typeof Se.yy.parseError=="function"?this.parseError=Se.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Tt(Vt){pe.length=pe.length-2*Vt,ve.length=ve.length-Vt,Z.length=Z.length-Vt}b(Tt,"popStack");function jt(){var Vt;return Vt=K.pop()||rt.lex()||tt,typeof Vt!="number"&&(Vt instanceof Array&&(K=Vt,Vt=K.pop()),Vt=V.symbols_[Vt]||Vt),Vt}b(jt,"lex");for(var _t,Rt,bt,ke,yt,xt,it={},Me,ut,at,dt;;){if(bt=pe[pe.length-1],this.defaultActions[bt]?ke=this.defaultActions[bt]:((_t===null||typeof _t>"u")&&(_t=jt()),ke=je[bt]&&je[bt][_t]),typeof ke>"u"||!ke.length||!ke[0]){var tr="";dt=[];for(Me in je[bt])this.terminals_[Me]&&Me>Ve&&dt.push("'"+this.terminals_[Me]+"'");rt.showPosition?tr="Parse error on line "+(ze+1)+`: `+rt.showPosition()+` Expecting `+dt.join(", ")+", got '"+(this.terminals_[_t]||_t)+"'":tr="Parse error on line "+(ze+1)+": Unexpected "+(_t==tt?"end of input":"'"+(this.terminals_[_t]||_t)+"'"),this.parseError(tr,{text:rt.match,token:this.terminals_[_t]||_t,line:rt.yylineno,loc:De,expected:dt})}if(ke[0]instanceof Array&&ke.length>1)throw new Error("Parse Error: multiple actions possible at state: "+bt+", token: "+_t);switch(ke[0]){case 1:pe.push(_t),ve.push(rt.yytext),Z.push(rt.yylloc),pe.push(ke[1]),_t=null,Rt?(_t=Rt,Rt=null):(Fe=rt.yyleng,Ne=rt.yytext,ze=rt.yylineno,De=rt.yylloc,Ke>0&&Ke--);break;case 2:if(ut=this.productions_[ke[1]][1],it.$=ve[ve.length-ut],it._$={first_line:Z[Z.length-(ut||1)].first_line,last_line:Z[Z.length-1].last_line,first_column:Z[Z.length-(ut||1)].first_column,last_column:Z[Z.length-1].last_column},mt&&(it._$.range=[Z[Z.length-(ut||1)].range[0],Z[Z.length-1].range[1]]),xt=this.performAction.apply(it,[Ne,Fe,ze,Se.yy,ke[1],ve,Z].concat(We)),typeof xt<"u")return xt;ut&&(pe=pe.slice(0,-1*ut*2),ve=ve.slice(0,-1*ut),Z=Z.slice(0,-1*ut)),pe.push(this.productions_[ke[1]][0]),ve.push(it.$),Z.push(it._$),at=je[pe[pe.length-2]][pe[pe.length-1]],pe.push(at);break;case 3:return!0}}return!0},"parse")},ge=(function(){var ye={EOF:1,parseError:b(function(V,pe){if(this.yy.parser)this.yy.parser.parseError(V,pe);else throw new Error(V)},"parseError"),setInput:b(function(ne,V){return this.yy=V||this.yy||{},this._input=ne,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var ne=this._input[0];this.yytext+=ne,this.yyleng++,this.offset++,this.match+=ne,this.matched+=ne;var V=ne.match(/(?:\r\n?|\n).*/g);return V?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ne},"input"),unput:b(function(ne){var V=ne.length,pe=ne.split(/(?:\r\n?|\n)/g);this._input=ne+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-V),this.offset-=V;var K=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),pe.length-1&&(this.yylineno-=pe.length-1);var ve=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:pe?(pe.length===K.length?this.yylloc.first_column:0)+K[K.length-pe.length].length-pe[0].length:this.yylloc.first_column-V},this.options.ranges&&(this.yylloc.range=[ve[0],ve[0]+this.yyleng-V]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(ne){this.unput(this.match.slice(ne))},"less"),pastInput:b(function(){var ne=this.matched.substr(0,this.matched.length-this.match.length);return(ne.length>20?"...":"")+ne.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var ne=this.match;return ne.length<20&&(ne+=this._input.substr(0,20-ne.length)),(ne.substr(0,20)+(ne.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var ne=this.pastInput(),V=new Array(ne.length+1).join("-");return ne+this.upcomingInput()+` `+V+"^"},"showPosition"),test_match:b(function(ne,V){var pe,K,ve;if(this.options.backtrack_lexer&&(ve={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(ve.yylloc.range=this.yylloc.range.slice(0))),K=ne[0].match(/(?:\r\n?|\n).*/g),K&&(this.yylineno+=K.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:K?K[K.length-1].length-K[K.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+ne[0].length},this.yytext+=ne[0],this.match+=ne[0],this.matches=ne,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(ne[0].length),this.matched+=ne[0],pe=this.performAction.call(this,this.yy,this,V,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),pe)return pe;if(this._backtrack){for(var Z in ve)this[Z]=ve[Z];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var ne,V,pe,K;this._more||(this.yytext="",this.match="");for(var ve=this._currentRules(),Z=0;ZV[0].length)){if(V=pe,K=Z,this.options.backtrack_lexer){if(ne=this.test_match(pe,ve[Z]),ne!==!1)return ne;if(this._backtrack){V=!1;continue}else return!1}else if(!this.options.flex)break}return V?(ne=this.test_match(V,ve[K]),ne!==!1?ne:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var V=this.next();return V||this.lex()},"lex"),begin:b(function(V){this.conditionStack.push(V)},"begin"),popState:b(function(){var V=this.conditionStack.length-1;return V>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(V){return V=this.conditionStack.length-1-Math.abs(V||0),V>=0?this.conditionStack[V]:"INITIAL"},"topState"),pushState:b(function(V){this.begin(V)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(V,pe,K,ve){var Z=ve;switch(K){case 0:return"title";case 1:return this.begin("acc_title"),9;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),11;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:return 21;case 9:return 22;case 10:return 23;case 11:return 24;case 12:return 5;case 13:break;case 14:break;case 15:break;case 16:return 8;case 17:return 6;case 18:return 27;case 19:return 40;case 20:return 29;case 21:return 32;case 22:return 31;case 23:return 34;case 24:return 36;case 25:return 38;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;case 36:return 51;case 37:return 52;case 38:return 53;case 39:return 54;case 40:return 65;case 41:return 66;case 42:return 67;case 43:return 68;case 44:return 69;case 45:return 70;case 46:return 71;case 47:return 57;case 48:return 59;case 49:return this.begin("style"),77;break;case 50:return 75;case 51:return 81;case 52:return 88;case 53:return"PERCENT";case 54:return 86;case 55:return 84;case 56:break;case 57:this.begin("string");break;case 58:this.popState();break;case 59:return this.begin("style"),72;break;case 60:return this.begin("style"),74;break;case 61:return 61;case 62:return 64;case 63:return 63;case 64:this.begin("string");break;case 65:this.popState();break;case 66:return"qString";case 67:return pe.yytext=pe.yytext.trim(),89;break;case 68:return 75;case 69:return 80;case 70:return 76}},"anonymous"),rules:[/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::{3})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:style\b)/i,/^(?:\w+)/i,/^(?::)/i,/^(?:;)/i,/^(?:%)/i,/^(?:-)/i,/^(?:#)/i,/^(?: )/i,/^(?:["])/i,/^(?:\n)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i,/^(?:\w+)/i,/^(?:[0-9]+)/i,/^(?:,)/i],conditions:{acc_descr_multiline:{rules:[6,7,68,69,70],inclusive:!1},acc_descr:{rules:[4,68,69,70],inclusive:!1},acc_title:{rules:[2,68,69,70],inclusive:!1},style:{rules:[50,51,52,53,54,55,56,57,58,68,69,70],inclusive:!1},unqString:{rules:[68,69,70],inclusive:!1},token:{rules:[68,69,70],inclusive:!1},string:{rules:[65,66,68,69,70],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,59,60,61,62,63,64,67,68,69,70],inclusive:!0}}};return ye})();ce.lexer=ge;function Ie(){this.yy={}}return b(Ie,"Parser"),Ie.prototype=ce,ce.Parser=Ie,new Ie})();eae.parser=eae;VKt=eae,WKt=class{constructor(){this.relations=[],this.latestRequirement=this.getInitialRequirement(),this.requirements=new Map,this.latestElement=this.getInitialElement(),this.elements=new Map,this.classes=new Map,this.direction="TB",this.RequirementType={REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},this.RiskLevel={LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},this.VerifyType={VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},this.Relationships={CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},this.setAccTitle=Yr,this.getAccTitle=Qr,this.setAccDescription=Jr,this.getAccDescription=en,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getConfig=b(()=>Be().requirement,"getConfig"),this.clear(),this.setDirection=this.setDirection.bind(this),this.addRequirement=this.addRequirement.bind(this),this.setNewReqId=this.setNewReqId.bind(this),this.setNewReqRisk=this.setNewReqRisk.bind(this),this.setNewReqText=this.setNewReqText.bind(this),this.setNewReqVerifyMethod=this.setNewReqVerifyMethod.bind(this),this.addElement=this.addElement.bind(this),this.setNewElementType=this.setNewElementType.bind(this),this.setNewElementDocRef=this.setNewElementDocRef.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setCssStyle=this.setCssStyle.bind(this),this.setClass=this.setClass.bind(this),this.defineClass=this.defineClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{b(this,"RequirementDB")}getDirection(){return this.direction}setDirection(e){this.direction=e}resetLatestRequirement(){this.latestRequirement=this.getInitialRequirement()}resetLatestElement(){this.latestElement=this.getInitialElement()}getInitialRequirement(){return{requirementId:"",text:"",risk:"",verifyMethod:"",name:"",type:"",cssStyles:[],classes:["default"]}}getInitialElement(){return{name:"",type:"",docRef:"",cssStyles:[],classes:["default"]}}addRequirement(e,t){return this.requirements.has(e)||this.requirements.set(e,{name:e,type:t,requirementId:this.latestRequirement.requirementId,text:this.latestRequirement.text,risk:this.latestRequirement.risk,verifyMethod:this.latestRequirement.verifyMethod,cssStyles:[],classes:["default"]}),this.resetLatestRequirement(),this.requirements.get(e)}getRequirements(){return this.requirements}setNewReqId(e){this.latestRequirement!==void 0&&(this.latestRequirement.requirementId=e)}setNewReqText(e){this.latestRequirement!==void 0&&(this.latestRequirement.text=e)}setNewReqRisk(e){this.latestRequirement!==void 0&&(this.latestRequirement.risk=e)}setNewReqVerifyMethod(e){this.latestRequirement!==void 0&&(this.latestRequirement.verifyMethod=e)}addElement(e){return this.elements.has(e)||(this.elements.set(e,{name:e,type:this.latestElement.type,docRef:this.latestElement.docRef,cssStyles:[],classes:["default"]}),se.info("Added new element: ",e)),this.resetLatestElement(),this.elements.get(e)}getElements(){return this.elements}setNewElementType(e){this.latestElement!==void 0&&(this.latestElement.type=e)}setNewElementDocRef(e){this.latestElement!==void 0&&(this.latestElement.docRef=e)}addRelationship(e,t,r){this.relations.push({type:e,src:t,dst:r})}getRelationships(){return this.relations}clear(){this.relations=[],this.resetLatestRequirement(),this.requirements=new Map,this.resetLatestElement(),this.elements=new Map,this.classes=new Map,Nr()}setCssStyle(e,t){for(let r of e){let n=this.requirements.get(r)??this.elements.get(r);if(!t||!n)return;for(let i of t)i.includes(",")?n.cssStyles.push(...i.split(",")):n.cssStyles.push(i)}}setClass(e,t){for(let r of e){let n=this.requirements.get(r)??this.elements.get(r);if(n)for(let i of t){n.classes.push(i);let a=this.classes.get(i)?.styles;a&&n.cssStyles.push(...a)}}}defineClass(e,t){for(let r of e){let n=this.classes.get(r);n===void 0&&(n={id:r,styles:[],textStyles:[]},this.classes.set(r,n)),t&&t.forEach(function(i){if(/color/.exec(i)){let a=i.replace("fill","bgFill");n.textStyles.push(a)}n.styles.push(i)}),this.requirements.forEach(i=>{i.classes.includes(r)&&i.cssStyles.push(...t.flatMap(a=>a.split(",")))}),this.elements.forEach(i=>{i.classes.includes(r)&&i.cssStyles.push(...t.flatMap(a=>a.split(",")))})}}getClasses(){return this.classes}getData(){let e=Be(),t=[],r=[];for(let n of this.requirements.values()){let i=n;i.id=n.name,i.cssStyles=n.cssStyles,i.cssClasses=n.classes.join(" "),i.shape="requirementBox",i.look=e.look,i.colorIndex=t.length,t.push(i)}for(let n of this.elements.values()){let i=n;i.shape="requirementBox",i.look=e.look,i.id=n.name,i.cssStyles=n.cssStyles,i.cssClasses=n.classes.join(" "),i.colorIndex=t.length,t.push(i)}for(let n of this.relations){let i=0,a=n.type===this.Relationships.CONTAINS,s={id:`${n.src}-${n.dst}-${i}`,start:this.requirements.get(n.src)?.name??this.elements.get(n.src)?.name,end:this.requirements.get(n.dst)?.name??this.elements.get(n.dst)?.name,label:`<<${n.type}>>`,classes:"relationshipLine",style:["fill:none",a?"":"stroke-dasharray: 10,7"],labelpos:"c",thickness:"normal",type:"normal",pattern:a?"normal":"dashed",arrowTypeStart:a?"requirement_contains":"",arrowTypeEnd:a?"":"requirement_arrow",look:e.look,labelType:"markdown"};r.push(s),i++}return{nodes:t,edges:r,other:{},config:e,direction:this.getDirection()}}},HKt=b(e=>{let t=qt(),{themeVariables:r,look:n}=t,{bkgColorArray:i,borderColorArray:a}=r;if(!a?.length)return"";let s="";for(let o=0;o0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(V){return V=this.conditionStack.length-1-Math.abs(V||0),V>=0?this.conditionStack[V]:"INITIAL"},"topState"),pushState:b(function(V){this.begin(V)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(V,pe,K,ve){var Z=ve;switch(K){case 0:return"title";case 1:return this.begin("acc_title"),9;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),11;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:return 21;case 9:return 22;case 10:return 23;case 11:return 24;case 12:return 5;case 13:break;case 14:break;case 15:break;case 16:return 8;case 17:return 6;case 18:return 27;case 19:return 40;case 20:return 29;case 21:return 32;case 22:return 31;case 23:return 34;case 24:return 36;case 25:return 38;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;case 36:return 51;case 37:return 52;case 38:return 53;case 39:return 54;case 40:return 65;case 41:return 66;case 42:return 67;case 43:return 68;case 44:return 69;case 45:return 70;case 46:return 71;case 47:return 57;case 48:return 59;case 49:return this.begin("style"),77;break;case 50:return 75;case 51:return 81;case 52:return 88;case 53:return"PERCENT";case 54:return 86;case 55:return 84;case 56:break;case 57:this.begin("string");break;case 58:this.popState();break;case 59:return this.begin("style"),72;break;case 60:return this.begin("style"),74;break;case 61:return 61;case 62:return 64;case 63:return 63;case 64:this.begin("string");break;case 65:this.popState();break;case 66:return"qString";case 67:return pe.yytext=pe.yytext.trim(),89;break;case 68:return 75;case 69:return 80;case 70:return 76}},"anonymous"),rules:[/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::{3})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:style\b)/i,/^(?:\w+)/i,/^(?::)/i,/^(?:;)/i,/^(?:%)/i,/^(?:-)/i,/^(?:#)/i,/^(?: )/i,/^(?:["])/i,/^(?:\n)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i,/^(?:\w+)/i,/^(?:[0-9]+)/i,/^(?:,)/i],conditions:{acc_descr_multiline:{rules:[6,7,68,69,70],inclusive:!1},acc_descr:{rules:[4,68,69,70],inclusive:!1},acc_title:{rules:[2,68,69,70],inclusive:!1},style:{rules:[50,51,52,53,54,55,56,57,58,68,69,70],inclusive:!1},unqString:{rules:[68,69,70],inclusive:!1},token:{rules:[68,69,70],inclusive:!1},string:{rules:[65,66,68,69,70],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,59,60,61,62,63,64,67,68,69,70],inclusive:!0}}};return ye})();ce.lexer=ge;function Ie(){this.yy={}}return b(Ie,"Parser"),Ie.prototype=ce,ce.Parser=Ie,new Ie})();rae.parser=rae;YKt=rae,XKt=class{constructor(){this.relations=[],this.latestRequirement=this.getInitialRequirement(),this.requirements=new Map,this.latestElement=this.getInitialElement(),this.elements=new Map,this.classes=new Map,this.direction="TB",this.RequirementType={REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},this.RiskLevel={LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},this.VerifyType={VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},this.Relationships={CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},this.setAccTitle=Yr,this.getAccTitle=Qr,this.setAccDescription=Jr,this.getAccDescription=en,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getConfig=b(()=>Be().requirement,"getConfig"),this.clear(),this.setDirection=this.setDirection.bind(this),this.addRequirement=this.addRequirement.bind(this),this.setNewReqId=this.setNewReqId.bind(this),this.setNewReqRisk=this.setNewReqRisk.bind(this),this.setNewReqText=this.setNewReqText.bind(this),this.setNewReqVerifyMethod=this.setNewReqVerifyMethod.bind(this),this.addElement=this.addElement.bind(this),this.setNewElementType=this.setNewElementType.bind(this),this.setNewElementDocRef=this.setNewElementDocRef.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setCssStyle=this.setCssStyle.bind(this),this.setClass=this.setClass.bind(this),this.defineClass=this.defineClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{b(this,"RequirementDB")}getDirection(){return this.direction}setDirection(e){this.direction=e}resetLatestRequirement(){this.latestRequirement=this.getInitialRequirement()}resetLatestElement(){this.latestElement=this.getInitialElement()}getInitialRequirement(){return{requirementId:"",text:"",risk:"",verifyMethod:"",name:"",type:"",cssStyles:[],classes:["default"]}}getInitialElement(){return{name:"",type:"",docRef:"",cssStyles:[],classes:["default"]}}addRequirement(e,t){return this.requirements.has(e)||this.requirements.set(e,{name:e,type:t,requirementId:this.latestRequirement.requirementId,text:this.latestRequirement.text,risk:this.latestRequirement.risk,verifyMethod:this.latestRequirement.verifyMethod,cssStyles:[],classes:["default"]}),this.resetLatestRequirement(),this.requirements.get(e)}getRequirements(){return this.requirements}setNewReqId(e){this.latestRequirement!==void 0&&(this.latestRequirement.requirementId=e)}setNewReqText(e){this.latestRequirement!==void 0&&(this.latestRequirement.text=e)}setNewReqRisk(e){this.latestRequirement!==void 0&&(this.latestRequirement.risk=e)}setNewReqVerifyMethod(e){this.latestRequirement!==void 0&&(this.latestRequirement.verifyMethod=e)}addElement(e){return this.elements.has(e)||(this.elements.set(e,{name:e,type:this.latestElement.type,docRef:this.latestElement.docRef,cssStyles:[],classes:["default"]}),se.info("Added new element: ",e)),this.resetLatestElement(),this.elements.get(e)}getElements(){return this.elements}setNewElementType(e){this.latestElement!==void 0&&(this.latestElement.type=e)}setNewElementDocRef(e){this.latestElement!==void 0&&(this.latestElement.docRef=e)}addRelationship(e,t,r){this.relations.push({type:e,src:t,dst:r})}getRelationships(){return this.relations}clear(){this.relations=[],this.resetLatestRequirement(),this.requirements=new Map,this.resetLatestElement(),this.elements=new Map,this.classes=new Map,Nr()}setCssStyle(e,t){for(let r of e){let n=this.requirements.get(r)??this.elements.get(r);if(!t||!n)return;for(let i of t)i.includes(",")?n.cssStyles.push(...i.split(",")):n.cssStyles.push(i)}}setClass(e,t){for(let r of e){let n=this.requirements.get(r)??this.elements.get(r);if(n)for(let i of t){n.classes.push(i);let a=this.classes.get(i)?.styles;a&&n.cssStyles.push(...a)}}}defineClass(e,t){for(let r of e){let n=this.classes.get(r);n===void 0&&(n={id:r,styles:[],textStyles:[]},this.classes.set(r,n)),t&&t.forEach(function(i){if(/color/.exec(i)){let a=i.replace("fill","bgFill");n.textStyles.push(a)}n.styles.push(i)}),this.requirements.forEach(i=>{i.classes.includes(r)&&i.cssStyles.push(...t.flatMap(a=>a.split(",")))}),this.elements.forEach(i=>{i.classes.includes(r)&&i.cssStyles.push(...t.flatMap(a=>a.split(",")))})}}getClasses(){return this.classes}getData(){let e=Be(),t=[],r=[];for(let n of this.requirements.values()){let i=n;i.id=n.name,i.cssStyles=n.cssStyles,i.cssClasses=n.classes.join(" "),i.shape="requirementBox",i.look=e.look,i.colorIndex=t.length,t.push(i)}for(let n of this.elements.values()){let i=n;i.shape="requirementBox",i.look=e.look,i.id=n.name,i.cssStyles=n.cssStyles,i.cssClasses=n.classes.join(" "),i.colorIndex=t.length,t.push(i)}for(let n of this.relations){let i=0,a=n.type===this.Relationships.CONTAINS,s={id:`${n.src}-${n.dst}-${i}`,start:this.requirements.get(n.src)?.name??this.elements.get(n.src)?.name,end:this.requirements.get(n.dst)?.name??this.elements.get(n.dst)?.name,label:`<<${n.type}>>`,classes:"relationshipLine",style:["fill:none",a?"":"stroke-dasharray: 10,7"],labelpos:"c",thickness:"normal",type:"normal",pattern:a?"normal":"dashed",arrowTypeStart:a?"requirement_contains":"",arrowTypeEnd:a?"":"requirement_arrow",look:e.look,labelType:"markdown"};r.push(s),i++}return{nodes:t,edges:r,other:{},config:e,direction:this.getDirection()}}},jKt=b(e=>{let t=qt(),{themeVariables:r,look:n}=t,{bkgColorArray:i,borderColorArray:a}=r;if(!a?.length)return"";let s="";for(let o=0;o{let t=qt(),{look:r,themeVariables:n}=t,{requirementEdgeLabelBackground:i}=n;return` - ${HKt(e)} + `;return s},"genColor"),KKt=b(e=>{let t=qt(),{look:r,themeVariables:n}=t,{requirementEdgeLabelBackground:i}=n;return` + ${jKt(e)} marker { fill: ${e.relationColor}; stroke: ${e.relationColor}; @@ -1838,16 +1838,16 @@ Expecting `+dt.join(", ")+", got '"+(this.terminals_[_t]||_t)+"'":tr="Parse erro background-color: ${i??e.edgeLabelBackground}; } -`},"getStyles"),YKt=UKt,XKe={};wm(XKe,{draw:()=>XKt});XKt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing requirement diagram (unified)",t);let{securityLevel:i,state:a,layout:s,look:o}=Be(),l=n.db.getData(),u=zu(t,i);l.type=n.type,l.layoutAlgorithm=td(s),l.nodeSpacing=a?.nodeSpacing??50,l.rankSpacing=a?.rankSpacing??50,l.markers=o==="neo"?["requirement_contains_neo","requirement_arrow_neo"]:["requirement_contains","requirement_arrow"],l.diagramId=t,await Ou(l,u);let h=8;pr.insertTitle(u,"requirementDiagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),sc(u,h,"requirementDiagram",a?.useMaxWidth??!0)},"draw"),jKt={parser:VKt,get db(){return new WKt},renderer:XKe,styles:YKt}});var uZe={};Tr(uZe,{diagram:()=>WZt});async function nZe(e,t){At.bumpVerticalPos(10);let{startx:r,stopx:n,message:i}=t,a=Ct.splitBreaks(i).length,s=sa(i),o=s?await Rb(i,Be()):pr.calculateTextDimensions(i,F2(et));if(!s){let f=o.height/a;t.height+=f,At.bumpVerticalPos(f)}let l,u=o.height-10,h=o.width;if(r===n){l=At.getVerticalPos()+u,et.rightAngles||(u+=et.boxMargin,l=At.getVerticalPos()+u),u+=30;let f=Ct.getMax(h/2,et.width/2);At.insert(r-f,At.getVerticalPos()-10+u,n+f,At.getVerticalPos()+30+u)}else u+=et.boxMargin,l=At.getVerticalPos()+u,At.insert(r,l-10,n,l);return At.bumpVerticalPos(u),t.height+=u,t.stopy=t.starty+t.height,At.insert(t.fromBounds,t.starty,t.toBounds,t.stopy),l}function $h(e,t,r,n,i){At.bumpVerticalPos(r);let a=n;if(t.id&&t.message&&e[t.id]){let s=e[t.id].width,o=F2(et);t.message=pr.wrapLabel(`[${t.message}]`,s-2*et.wrapPadding,o),t.width=s,t.wrap=!0;let l=pr.calculateTextDimensions(t.message,o),u=Ct.getMax(l.height,et.labelBoxHeight);a=n+u,se.debug(`${u} - ${t.message}`)}i(t),At.bumpVerticalPos(a)}function sZe(e,t,r,n,i,a,s){function o(h,f){h.x{let s=F2(et),o=a.actorKeys.reduce((f,d)=>f+=e.get(d).width+(e.get(d).margin||0),0),l=et.boxMargin*8;o+=l,o-=2*et.boxTextMargin,a.wrap&&(a.name=pr.wrapLabel(a.name,o-2*et.wrapPadding,s));let u=pr.calculateTextDimensions(a.name,s);i=Ct.getMax(u.height,i);let h=Ct.getMax(o,u.width+2*et.wrapPadding);if(a.margin=et.boxTextMargin,oa.textMaxHeight=i),Ct.getMax(n,et.height)}var aae,rae,KKt,ZKt,QKt,JKt,yO,eZt,tZt,rZt,P2,Qg,Jg,xO,B2,mp,N6,nZt,bO,vO,uk,JKe,Dn,eZe,iZt,aZt,sZt,oZt,lZt,cZt,uZt,hZt,fZt,dZt,pZt,mZt,gZt,tZe,yZt,vZt,xZt,bZt,wZt,kZt,TZt,CZt,rZe,SZt,gp,EZt,AZt,_Zt,RZt,LZt,Vi,et,At,IZt,ZKe,F2,ck,nae,MZt,NZt,iae,iZe,aZe,wO,QKe,DZt,OZt,PZt,BZt,FZt,tae,$Zt,cZe,zZt,GZt,qZt,VZt,WZt,hZe=W(()=>{FI();Gy();Hc();Sn();_r();Rr();hr();fn();aae=Ro(n4(),1),rae=(function(){var e=b(function(Fe,Ke,Ve,tt){for(Ve=Ve||{},tt=Fe.length;tt--;Ve[Fe[tt]]=Ke);return Ve},"o"),t=[1,2],r=[1,3],n=[1,4],i=[2,4],a=[1,9],s=[1,11],o=[1,12],l=[1,14],u=[1,15],h=[1,17],f=[1,18],d=[1,19],p=[1,25],m=[1,26],g=[1,27],y=[1,28],v=[1,29],x=[1,30],w=[1,31],C=[1,32],T=[1,33],k=[1,34],S=[1,35],E=[1,36],I=[1,37],L=[1,38],O=[1,39],R=[1,40],A=[1,42],N=[1,43],M=[1,44],D=[1,45],B=[1,46],P=[1,47],$=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],F=[1,74],q=[1,80],G=[1,81],z=[1,82],H=[1,83],j=[1,84],J=[1,85],U=[1,86],le=[1,87],ee=[1,88],ue=[1,89],ae=[1,90],oe=[1,91],Re=[1,92],Te=[1,93],Oe=[1,94],qe=[1,95],Ge=[1,96],fe=[1,97],Ce=[1,98],_e=[1,99],de=[1,100],ie=[1,101],Q=[1,102],he=[1,103],xe=[1,104],ce=[1,105],ge=[2,78],Ie=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],ne=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],V=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],pe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],K=[5,52],ve=[70,71,72,73],Z=[1,151],je={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:b(function(Ke,Ve,tt,We,rt,Se,Et){var De=Se.length-1;switch(rt){case 3:return We.apply(Se[De]),Se[De];break;case 4:case 10:this.$=[];break;case 5:case 11:Se[De-1].push(Se[De]),this.$=Se[De-1];break;case 6:case 7:case 12:case 13:this.$=Se[De];break;case 8:case 9:case 14:this.$=[];break;case 16:Se[De].type="createParticipant",this.$=Se[De];break;case 17:Se[De-1].unshift({type:"boxStart",boxData:We.parseBoxData(Se[De-2])}),Se[De-1].push({type:"boxEnd",boxText:Se[De-2]}),this.$=Se[De-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(Se[De-2]),sequenceIndexStep:Number(Se[De-1]),sequenceVisible:!0,signalType:We.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(Se[De-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:We.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:We.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:We.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:We.LINETYPE.ACTIVE_START,actor:Se[De-1].actor};break;case 24:this.$={type:"activeEnd",signalType:We.LINETYPE.ACTIVE_END,actor:Se[De-1].actor};break;case 30:We.setDiagramTitle(Se[De].substring(6)),this.$=Se[De].substring(6);break;case 31:We.setDiagramTitle(Se[De].substring(7)),this.$=Se[De].substring(7);break;case 32:this.$=Se[De].trim(),We.setAccTitle(this.$);break;case 33:case 34:this.$=Se[De].trim(),We.setAccDescription(this.$);break;case 35:Se[De-1].unshift({type:"loopStart",loopText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.LOOP_START}),Se[De-1].push({type:"loopEnd",loopText:Se[De-2],signalType:We.LINETYPE.LOOP_END}),this.$=Se[De-1];break;case 36:Se[De-1].unshift({type:"rectStart",color:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.RECT_START}),Se[De-1].push({type:"rectEnd",color:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.RECT_END}),this.$=Se[De-1];break;case 37:Se[De-1].unshift({type:"optStart",optText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.OPT_START}),Se[De-1].push({type:"optEnd",optText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.OPT_END}),this.$=Se[De-1];break;case 38:Se[De-1].unshift({type:"altStart",altText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.ALT_START}),Se[De-1].push({type:"altEnd",signalType:We.LINETYPE.ALT_END}),this.$=Se[De-1];break;case 39:Se[De-1].unshift({type:"parStart",parText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.PAR_START}),Se[De-1].push({type:"parEnd",signalType:We.LINETYPE.PAR_END}),this.$=Se[De-1];break;case 40:Se[De-1].unshift({type:"parStart",parText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.PAR_OVER_START}),Se[De-1].push({type:"parEnd",signalType:We.LINETYPE.PAR_END}),this.$=Se[De-1];break;case 41:Se[De-1].unshift({type:"criticalStart",criticalText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.CRITICAL_START}),Se[De-1].push({type:"criticalEnd",signalType:We.LINETYPE.CRITICAL_END}),this.$=Se[De-1];break;case 42:Se[De-1].unshift({type:"breakStart",breakText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.BREAK_START}),Se[De-1].push({type:"breakEnd",optText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.BREAK_END}),this.$=Se[De-1];break;case 44:this.$=Se[De-3].concat([{type:"option",optionText:We.parseMessage(Se[De-1]),signalType:We.LINETYPE.CRITICAL_OPTION},Se[De]]);break;case 46:this.$=Se[De-3].concat([{type:"and",parText:We.parseMessage(Se[De-1]),signalType:We.LINETYPE.PAR_AND},Se[De]]);break;case 48:this.$=Se[De-3].concat([{type:"else",altText:We.parseMessage(Se[De-1]),signalType:We.LINETYPE.ALT_ELSE},Se[De]]);break;case 49:Se[De-3].draw="participant",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 50:Se[De-1].draw="participant",Se[De-1].type="addParticipant",this.$=Se[De-1];break;case 51:Se[De-3].draw="actor",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 52:case 57:Se[De-1].draw="actor",Se[De-1].type="addParticipant",this.$=Se[De-1];break;case 53:Se[De-1].type="destroyParticipant",this.$=Se[De-1];break;case 54:Se[De-3].draw="participant",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 55:Se[De-1].draw="participant",Se[De-1].type="addParticipant",this.$=Se[De-1];break;case 56:Se[De-3].draw="actor",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 58:this.$=[Se[De-1],{type:"addNote",placement:Se[De-2],actor:Se[De-1].actor,text:Se[De]}];break;case 59:Se[De-2]=[].concat(Se[De-1],Se[De-1]).slice(0,2),Se[De-2][0]=Se[De-2][0].actor,Se[De-2][1]=Se[De-2][1].actor,this.$=[Se[De-1],{type:"addNote",placement:We.PLACEMENT.OVER,actor:Se[De-2].slice(0,2),text:Se[De]}];break;case 60:this.$=[Se[De-1],{type:"addLinks",actor:Se[De-1].actor,text:Se[De]}];break;case 61:this.$=[Se[De-1],{type:"addALink",actor:Se[De-1].actor,text:Se[De]}];break;case 62:this.$=[Se[De-1],{type:"addProperties",actor:Se[De-1].actor,text:Se[De]}];break;case 63:this.$=[Se[De-1],{type:"addDetails",actor:Se[De-1].actor,text:Se[De]}];break;case 66:this.$=[Se[De-2],Se[De]];break;case 67:this.$=Se[De];break;case 68:this.$=We.PLACEMENT.LEFTOF;break;case 69:this.$=We.PLACEMENT.RIGHTOF;break;case 70:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De],activate:!0},{type:"activeStart",signalType:We.LINETYPE.ACTIVE_START,actor:Se[De-1].actor}];break;case 71:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De]},{type:"activeEnd",signalType:We.LINETYPE.ACTIVE_END,actor:Se[De-4].actor}];break;case 72:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De],activate:!0,centralConnection:We.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:We.LINETYPE.CENTRAL_CONNECTION,actor:Se[De-1].actor}];break;case 73:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-2],msg:Se[De],activate:!1,centralConnection:We.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:We.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:Se[De-4].actor}];break;case 74:this.$=[Se[De-5],Se[De-1],{type:"addMessage",from:Se[De-5].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De],activate:!0,centralConnection:We.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:We.LINETYPE.CENTRAL_CONNECTION,actor:Se[De-1].actor},{type:"centralConnectionReverse",signalType:We.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:Se[De-5].actor}];break;case 75:this.$=[Se[De-3],Se[De-1],{type:"addMessage",from:Se[De-3].actor,to:Se[De-1].actor,signalType:Se[De-2],msg:Se[De]}];break;case 76:this.$={type:"addParticipant",actor:Se[De-1],config:Se[De]};break;case 77:this.$=Se[De-1].trim();break;case 78:this.$={type:"addParticipant",actor:Se[De]};break;case 79:this.$=We.LINETYPE.SOLID_OPEN;break;case 80:this.$=We.LINETYPE.DOTTED_OPEN;break;case 81:this.$=We.LINETYPE.SOLID;break;case 82:this.$=We.LINETYPE.SOLID_TOP;break;case 83:this.$=We.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=We.LINETYPE.STICK_TOP;break;case 85:this.$=We.LINETYPE.STICK_BOTTOM;break;case 86:this.$=We.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=We.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=We.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=We.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=We.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=We.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=We.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=We.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=We.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=We.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=We.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=We.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=We.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=We.LINETYPE.DOTTED;break;case 100:this.$=We.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=We.LINETYPE.SOLID_CROSS;break;case 102:this.$=We.LINETYPE.DOTTED_CROSS;break;case 103:this.$=We.LINETYPE.SOLID_POINT;break;case 104:this.$=We.LINETYPE.DOTTED_POINT;break;case 105:this.$=We.parseMessage(Se[De].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:r,6:n},{1:[3]},{3:5,4:t,5:r,6:n},{3:6,4:t,5:r,6:n},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},e($,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},e($,[2,7]),e($,[2,8]),e($,[2,9]),e($,[2,15]),{13:49,51:L,53:O,54:R},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:P},{23:56,73:P},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e($,[2,30]),e($,[2,31]),{33:[1,62]},{35:[1,63]},e($,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:F},{23:75,55:76,73:F},{23:77,73:P},{69:78,72:[1,79],78:q,79:G,80:z,81:H,82:j,83:J,84:U,85:le,86:ee,87:ue,88:ae,89:oe,90:Re,91:Te,92:Oe,93:qe,94:Ge,95:fe,96:Ce,97:_e,98:de,99:ie,100:Q,101:he,102:xe,103:ce},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:P},{23:111,73:P},{23:112,73:P},{23:113,73:P},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],ge),e($,[2,6]),e($,[2,16]),e(Ie,[2,10],{11:114}),e($,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e($,[2,22]),{5:[1,118]},{5:[1,119]},e($,[2,25]),e($,[2,26]),e($,[2,27]),e($,[2,28]),e($,[2,29]),e($,[2,32]),e($,[2,33]),e(ye,i,{7:120}),e(ye,i,{7:121}),e(ye,i,{7:122}),e(ne,i,{41:123,7:124}),e(V,i,{43:125,7:126}),e(V,i,{7:126,43:127}),e(pe,i,{46:128,7:129}),e(ye,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(K,ge,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:P},{69:146,78:q,79:G,80:z,81:H,82:j,83:J,84:U,85:le,86:ee,87:ue,88:ae,89:oe,90:Re,91:Te,92:Oe,93:qe,94:Ge,95:fe,96:Ce,97:_e,98:de,99:ie,100:Q,101:he,102:xe,103:ce},e(ve,[2,79]),e(ve,[2,80]),e(ve,[2,81]),e(ve,[2,82]),e(ve,[2,83]),e(ve,[2,84]),e(ve,[2,85]),e(ve,[2,86]),e(ve,[2,87]),e(ve,[2,88]),e(ve,[2,89]),e(ve,[2,90]),e(ve,[2,91]),e(ve,[2,92]),e(ve,[2,93]),e(ve,[2,94]),e(ve,[2,95]),e(ve,[2,96]),e(ve,[2,97]),e(ve,[2,98]),e(ve,[2,99]),e(ve,[2,100]),e(ve,[2,101]),e(ve,[2,102]),e(ve,[2,103]),e(ve,[2,104]),{23:147,73:P},{23:149,60:148,73:P},{73:[2,68]},{73:[2,69]},{58:150,104:Z},{58:152,104:Z},{58:153,104:Z},{58:154,104:Z},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:L,53:O,54:R},{5:[1,160]},e($,[2,20]),e($,[2,21]),e($,[2,23]),e($,[2,24]),{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,161],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,162],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,163],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{17:[1,164]},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[2,47],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,50:[1,165],51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{17:[1,166]},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[2,45],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,49:[1,167],51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{17:[1,168]},{17:[1,169]},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[2,43],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,48:[1,170],51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,171],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{16:[1,172]},e($,[2,50]),{16:[1,173]},e($,[2,55]),e(K,[2,76]),{76:[1,174]},{16:[1,175]},e($,[2,52]),{16:[1,176]},e($,[2,57]),e($,[2,53]),{23:177,73:P},{23:178,73:P},{23:179,73:P},{58:180,104:Z},{23:181,72:[1,182],73:P},{58:183,104:Z},{58:184,104:Z},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e($,[2,17]),e(Ie,[2,11]),{13:186,51:L,53:O,54:R},e(Ie,[2,13]),e(Ie,[2,14]),e($,[2,19]),e($,[2,35]),e($,[2,36]),e($,[2,37]),e($,[2,38]),{16:[1,187]},e($,[2,39]),{16:[1,188]},e($,[2,40]),e($,[2,41]),{16:[1,189]},e($,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:Z},{58:196,104:Z},{58:197,104:Z},{5:[2,75]},{58:198,104:Z},{23:199,73:P},{5:[2,58]},{5:[2,59]},{23:200,73:P},e(Ie,[2,12]),e(ne,i,{7:124,41:201}),e(V,i,{7:126,43:202}),e(pe,i,{7:129,46:203}),e($,[2,49]),e($,[2,54]),e(K,[2,77]),e($,[2,51]),e($,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:Z},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:b(function(Ke,Ve){if(Ve.recoverable)this.trace(Ke);else{var tt=new Error(Ke);throw tt.hash=Ve,tt}},"parseError"),parse:b(function(Ke){var Ve=this,tt=[0],We=[],rt=[null],Se=[],Et=this.table,De="",mt=0,Tt=0,jt=0,_t=2,Rt=1,bt=Se.slice.call(arguments,1),ke=Object.create(this.lexer),yt={yy:{}};for(var xt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xt)&&(yt.yy[xt]=this.yy[xt]);ke.setInput(Ke,yt.yy),yt.yy.lexer=ke,yt.yy.parser=this,typeof ke.yylloc>"u"&&(ke.yylloc={});var it=ke.yylloc;Se.push(it);var Me=ke.options&&ke.options.ranges;typeof yt.yy.parseError=="function"?this.parseError=yt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ut(ur){tt.length=tt.length-2*ur,rt.length=rt.length-ur,Se.length=Se.length-ur}b(ut,"popStack");function at(){var ur;return ur=We.pop()||ke.lex()||Rt,typeof ur!="number"&&(ur instanceof Array&&(We=ur,ur=We.pop()),ur=Ve.symbols_[ur]||ur),ur}b(at,"lex");for(var dt,tr,Vt,rr,Dr,vr,Qt={},yr,lt,pt,St;;){if(Vt=tt[tt.length-1],this.defaultActions[Vt]?rr=this.defaultActions[Vt]:((dt===null||typeof dt>"u")&&(dt=at()),rr=Et[Vt]&&Et[Vt][dt]),typeof rr>"u"||!rr.length||!rr[0]){var Ir="";St=[];for(yr in Et[Vt])this.terminals_[yr]&&yr>_t&&St.push("'"+this.terminals_[yr]+"'");ke.showPosition?Ir="Parse error on line "+(mt+1)+`: +`},"getStyles"),ZKt=KKt,KKe={};wm(KKe,{draw:()=>QKt});QKt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing requirement diagram (unified)",t);let{securityLevel:i,state:a,layout:s,look:o}=Be(),l=n.db.getData(),u=zu(t,i);l.type=n.type,l.layoutAlgorithm=td(s),l.nodeSpacing=a?.nodeSpacing??50,l.rankSpacing=a?.rankSpacing??50,l.markers=o==="neo"?["requirement_contains_neo","requirement_arrow_neo"]:["requirement_contains","requirement_arrow"],l.diagramId=t,await Ou(l,u);let h=8;pr.insertTitle(u,"requirementDiagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),oc(u,h,"requirementDiagram",a?.useMaxWidth??!0)},"draw"),JKt={parser:YKt,get db(){return new XKt},renderer:KKe,styles:ZKt}});var fZe={};Tr(fZe,{diagram:()=>XZt});async function aZe(e,t){At.bumpVerticalPos(10);let{startx:r,stopx:n,message:i}=t,a=Ct.splitBreaks(i).length,s=sa(i),o=s?await Rb(i,Be()):pr.calculateTextDimensions(i,F2(et));if(!s){let f=o.height/a;t.height+=f,At.bumpVerticalPos(f)}let l,u=o.height-10,h=o.width;if(r===n){l=At.getVerticalPos()+u,et.rightAngles||(u+=et.boxMargin,l=At.getVerticalPos()+u),u+=30;let f=Ct.getMax(h/2,et.width/2);At.insert(r-f,At.getVerticalPos()-10+u,n+f,At.getVerticalPos()+30+u)}else u+=et.boxMargin,l=At.getVerticalPos()+u,At.insert(r,l-10,n,l);return At.bumpVerticalPos(u),t.height+=u,t.stopy=t.starty+t.height,At.insert(t.fromBounds,t.starty,t.toBounds,t.stopy),l}function $h(e,t,r,n,i){At.bumpVerticalPos(r);let a=n;if(t.id&&t.message&&e[t.id]){let s=e[t.id].width,o=F2(et);t.message=pr.wrapLabel(`[${t.message}]`,s-2*et.wrapPadding,o),t.width=s,t.wrap=!0;let l=pr.calculateTextDimensions(t.message,o),u=Ct.getMax(l.height,et.labelBoxHeight);a=n+u,se.debug(`${u} - ${t.message}`)}i(t),At.bumpVerticalPos(a)}function lZe(e,t,r,n,i,a,s){function o(h,f){h.x{let s=F2(et),o=a.actorKeys.reduce((f,d)=>f+=e.get(d).width+(e.get(d).margin||0),0),l=et.boxMargin*8;o+=l,o-=2*et.boxTextMargin,a.wrap&&(a.name=pr.wrapLabel(a.name,o-2*et.wrapPadding,s));let u=pr.calculateTextDimensions(a.name,s);i=Ct.getMax(u.height,i);let h=Ct.getMax(o,u.width+2*et.wrapPadding);if(a.margin=et.boxTextMargin,oa.textMaxHeight=i),Ct.getMax(n,et.height)}var oae,iae,eZt,tZt,rZt,nZt,yO,iZt,aZt,sZt,P2,Qg,Jg,xO,B2,mp,N6,oZt,bO,vO,uk,tZe,Dn,rZe,lZt,cZt,uZt,hZt,fZt,dZt,pZt,mZt,gZt,yZt,vZt,xZt,bZt,nZe,wZt,kZt,TZt,CZt,SZt,EZt,AZt,_Zt,iZe,RZt,gp,LZt,IZt,MZt,NZt,DZt,Vi,et,At,OZt,JKe,F2,ck,aae,PZt,BZt,sae,sZe,oZe,wO,eZe,FZt,$Zt,zZt,GZt,qZt,nae,VZt,hZe,WZt,HZt,UZt,YZt,XZt,dZe=W(()=>{FI();Gy();Hc();Sn();_r();Rr();hr();fn();oae=Ro(n4(),1),iae=(function(){var e=b(function(Fe,Ke,Ve,tt){for(Ve=Ve||{},tt=Fe.length;tt--;Ve[Fe[tt]]=Ke);return Ve},"o"),t=[1,2],r=[1,3],n=[1,4],i=[2,4],a=[1,9],s=[1,11],o=[1,12],l=[1,14],u=[1,15],h=[1,17],f=[1,18],d=[1,19],p=[1,25],m=[1,26],g=[1,27],y=[1,28],v=[1,29],x=[1,30],w=[1,31],C=[1,32],T=[1,33],k=[1,34],S=[1,35],E=[1,36],I=[1,37],L=[1,38],O=[1,39],R=[1,40],A=[1,42],N=[1,43],M=[1,44],D=[1,45],B=[1,46],P=[1,47],$=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],F=[1,74],q=[1,80],G=[1,81],z=[1,82],H=[1,83],j=[1,84],J=[1,85],U=[1,86],le=[1,87],ee=[1,88],ue=[1,89],ae=[1,90],oe=[1,91],Re=[1,92],Te=[1,93],Oe=[1,94],qe=[1,95],Ge=[1,96],fe=[1,97],Ce=[1,98],_e=[1,99],de=[1,100],ie=[1,101],Q=[1,102],he=[1,103],xe=[1,104],ce=[1,105],ge=[2,78],Ie=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],ne=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],V=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],pe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],K=[5,52],ve=[70,71,72,73],Z=[1,151],je={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:b(function(Ke,Ve,tt,We,rt,Se,Et){var De=Se.length-1;switch(rt){case 3:return We.apply(Se[De]),Se[De];break;case 4:case 10:this.$=[];break;case 5:case 11:Se[De-1].push(Se[De]),this.$=Se[De-1];break;case 6:case 7:case 12:case 13:this.$=Se[De];break;case 8:case 9:case 14:this.$=[];break;case 16:Se[De].type="createParticipant",this.$=Se[De];break;case 17:Se[De-1].unshift({type:"boxStart",boxData:We.parseBoxData(Se[De-2])}),Se[De-1].push({type:"boxEnd",boxText:Se[De-2]}),this.$=Se[De-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(Se[De-2]),sequenceIndexStep:Number(Se[De-1]),sequenceVisible:!0,signalType:We.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(Se[De-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:We.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:We.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:We.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:We.LINETYPE.ACTIVE_START,actor:Se[De-1].actor};break;case 24:this.$={type:"activeEnd",signalType:We.LINETYPE.ACTIVE_END,actor:Se[De-1].actor};break;case 30:We.setDiagramTitle(Se[De].substring(6)),this.$=Se[De].substring(6);break;case 31:We.setDiagramTitle(Se[De].substring(7)),this.$=Se[De].substring(7);break;case 32:this.$=Se[De].trim(),We.setAccTitle(this.$);break;case 33:case 34:this.$=Se[De].trim(),We.setAccDescription(this.$);break;case 35:Se[De-1].unshift({type:"loopStart",loopText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.LOOP_START}),Se[De-1].push({type:"loopEnd",loopText:Se[De-2],signalType:We.LINETYPE.LOOP_END}),this.$=Se[De-1];break;case 36:Se[De-1].unshift({type:"rectStart",color:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.RECT_START}),Se[De-1].push({type:"rectEnd",color:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.RECT_END}),this.$=Se[De-1];break;case 37:Se[De-1].unshift({type:"optStart",optText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.OPT_START}),Se[De-1].push({type:"optEnd",optText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.OPT_END}),this.$=Se[De-1];break;case 38:Se[De-1].unshift({type:"altStart",altText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.ALT_START}),Se[De-1].push({type:"altEnd",signalType:We.LINETYPE.ALT_END}),this.$=Se[De-1];break;case 39:Se[De-1].unshift({type:"parStart",parText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.PAR_START}),Se[De-1].push({type:"parEnd",signalType:We.LINETYPE.PAR_END}),this.$=Se[De-1];break;case 40:Se[De-1].unshift({type:"parStart",parText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.PAR_OVER_START}),Se[De-1].push({type:"parEnd",signalType:We.LINETYPE.PAR_END}),this.$=Se[De-1];break;case 41:Se[De-1].unshift({type:"criticalStart",criticalText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.CRITICAL_START}),Se[De-1].push({type:"criticalEnd",signalType:We.LINETYPE.CRITICAL_END}),this.$=Se[De-1];break;case 42:Se[De-1].unshift({type:"breakStart",breakText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.BREAK_START}),Se[De-1].push({type:"breakEnd",optText:We.parseMessage(Se[De-2]),signalType:We.LINETYPE.BREAK_END}),this.$=Se[De-1];break;case 44:this.$=Se[De-3].concat([{type:"option",optionText:We.parseMessage(Se[De-1]),signalType:We.LINETYPE.CRITICAL_OPTION},Se[De]]);break;case 46:this.$=Se[De-3].concat([{type:"and",parText:We.parseMessage(Se[De-1]),signalType:We.LINETYPE.PAR_AND},Se[De]]);break;case 48:this.$=Se[De-3].concat([{type:"else",altText:We.parseMessage(Se[De-1]),signalType:We.LINETYPE.ALT_ELSE},Se[De]]);break;case 49:Se[De-3].draw="participant",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 50:Se[De-1].draw="participant",Se[De-1].type="addParticipant",this.$=Se[De-1];break;case 51:Se[De-3].draw="actor",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 52:case 57:Se[De-1].draw="actor",Se[De-1].type="addParticipant",this.$=Se[De-1];break;case 53:Se[De-1].type="destroyParticipant",this.$=Se[De-1];break;case 54:Se[De-3].draw="participant",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 55:Se[De-1].draw="participant",Se[De-1].type="addParticipant",this.$=Se[De-1];break;case 56:Se[De-3].draw="actor",Se[De-3].type="addParticipant",Se[De-3].description=We.parseMessage(Se[De-1]),this.$=Se[De-3];break;case 58:this.$=[Se[De-1],{type:"addNote",placement:Se[De-2],actor:Se[De-1].actor,text:Se[De]}];break;case 59:Se[De-2]=[].concat(Se[De-1],Se[De-1]).slice(0,2),Se[De-2][0]=Se[De-2][0].actor,Se[De-2][1]=Se[De-2][1].actor,this.$=[Se[De-1],{type:"addNote",placement:We.PLACEMENT.OVER,actor:Se[De-2].slice(0,2),text:Se[De]}];break;case 60:this.$=[Se[De-1],{type:"addLinks",actor:Se[De-1].actor,text:Se[De]}];break;case 61:this.$=[Se[De-1],{type:"addALink",actor:Se[De-1].actor,text:Se[De]}];break;case 62:this.$=[Se[De-1],{type:"addProperties",actor:Se[De-1].actor,text:Se[De]}];break;case 63:this.$=[Se[De-1],{type:"addDetails",actor:Se[De-1].actor,text:Se[De]}];break;case 66:this.$=[Se[De-2],Se[De]];break;case 67:this.$=Se[De];break;case 68:this.$=We.PLACEMENT.LEFTOF;break;case 69:this.$=We.PLACEMENT.RIGHTOF;break;case 70:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De],activate:!0},{type:"activeStart",signalType:We.LINETYPE.ACTIVE_START,actor:Se[De-1].actor}];break;case 71:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De]},{type:"activeEnd",signalType:We.LINETYPE.ACTIVE_END,actor:Se[De-4].actor}];break;case 72:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De],activate:!0,centralConnection:We.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:We.LINETYPE.CENTRAL_CONNECTION,actor:Se[De-1].actor}];break;case 73:this.$=[Se[De-4],Se[De-1],{type:"addMessage",from:Se[De-4].actor,to:Se[De-1].actor,signalType:Se[De-2],msg:Se[De],activate:!1,centralConnection:We.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:We.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:Se[De-4].actor}];break;case 74:this.$=[Se[De-5],Se[De-1],{type:"addMessage",from:Se[De-5].actor,to:Se[De-1].actor,signalType:Se[De-3],msg:Se[De],activate:!0,centralConnection:We.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:We.LINETYPE.CENTRAL_CONNECTION,actor:Se[De-1].actor},{type:"centralConnectionReverse",signalType:We.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:Se[De-5].actor}];break;case 75:this.$=[Se[De-3],Se[De-1],{type:"addMessage",from:Se[De-3].actor,to:Se[De-1].actor,signalType:Se[De-2],msg:Se[De]}];break;case 76:this.$={type:"addParticipant",actor:Se[De-1],config:Se[De]};break;case 77:this.$=Se[De-1].trim();break;case 78:this.$={type:"addParticipant",actor:Se[De]};break;case 79:this.$=We.LINETYPE.SOLID_OPEN;break;case 80:this.$=We.LINETYPE.DOTTED_OPEN;break;case 81:this.$=We.LINETYPE.SOLID;break;case 82:this.$=We.LINETYPE.SOLID_TOP;break;case 83:this.$=We.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=We.LINETYPE.STICK_TOP;break;case 85:this.$=We.LINETYPE.STICK_BOTTOM;break;case 86:this.$=We.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=We.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=We.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=We.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=We.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=We.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=We.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=We.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=We.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=We.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=We.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=We.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=We.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=We.LINETYPE.DOTTED;break;case 100:this.$=We.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=We.LINETYPE.SOLID_CROSS;break;case 102:this.$=We.LINETYPE.DOTTED_CROSS;break;case 103:this.$=We.LINETYPE.SOLID_POINT;break;case 104:this.$=We.LINETYPE.DOTTED_POINT;break;case 105:this.$=We.parseMessage(Se[De].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:r,6:n},{1:[3]},{3:5,4:t,5:r,6:n},{3:6,4:t,5:r,6:n},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},e($,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},e($,[2,7]),e($,[2,8]),e($,[2,9]),e($,[2,15]),{13:49,51:L,53:O,54:R},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:P},{23:56,73:P},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e($,[2,30]),e($,[2,31]),{33:[1,62]},{35:[1,63]},e($,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:F},{23:75,55:76,73:F},{23:77,73:P},{69:78,72:[1,79],78:q,79:G,80:z,81:H,82:j,83:J,84:U,85:le,86:ee,87:ue,88:ae,89:oe,90:Re,91:Te,92:Oe,93:qe,94:Ge,95:fe,96:Ce,97:_e,98:de,99:ie,100:Q,101:he,102:xe,103:ce},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:P},{23:111,73:P},{23:112,73:P},{23:113,73:P},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],ge),e($,[2,6]),e($,[2,16]),e(Ie,[2,10],{11:114}),e($,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e($,[2,22]),{5:[1,118]},{5:[1,119]},e($,[2,25]),e($,[2,26]),e($,[2,27]),e($,[2,28]),e($,[2,29]),e($,[2,32]),e($,[2,33]),e(ye,i,{7:120}),e(ye,i,{7:121}),e(ye,i,{7:122}),e(ne,i,{41:123,7:124}),e(V,i,{43:125,7:126}),e(V,i,{7:126,43:127}),e(pe,i,{46:128,7:129}),e(ye,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(K,ge,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:P},{69:146,78:q,79:G,80:z,81:H,82:j,83:J,84:U,85:le,86:ee,87:ue,88:ae,89:oe,90:Re,91:Te,92:Oe,93:qe,94:Ge,95:fe,96:Ce,97:_e,98:de,99:ie,100:Q,101:he,102:xe,103:ce},e(ve,[2,79]),e(ve,[2,80]),e(ve,[2,81]),e(ve,[2,82]),e(ve,[2,83]),e(ve,[2,84]),e(ve,[2,85]),e(ve,[2,86]),e(ve,[2,87]),e(ve,[2,88]),e(ve,[2,89]),e(ve,[2,90]),e(ve,[2,91]),e(ve,[2,92]),e(ve,[2,93]),e(ve,[2,94]),e(ve,[2,95]),e(ve,[2,96]),e(ve,[2,97]),e(ve,[2,98]),e(ve,[2,99]),e(ve,[2,100]),e(ve,[2,101]),e(ve,[2,102]),e(ve,[2,103]),e(ve,[2,104]),{23:147,73:P},{23:149,60:148,73:P},{73:[2,68]},{73:[2,69]},{58:150,104:Z},{58:152,104:Z},{58:153,104:Z},{58:154,104:Z},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:L,53:O,54:R},{5:[1,160]},e($,[2,20]),e($,[2,21]),e($,[2,23]),e($,[2,24]),{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,161],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,162],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,163],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{17:[1,164]},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[2,47],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,50:[1,165],51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{17:[1,166]},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[2,45],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,49:[1,167],51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{17:[1,168]},{17:[1,169]},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[2,43],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,48:[1,170],51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{4:a,5:s,8:8,9:10,10:o,13:13,14:l,15:u,17:[1,171],18:16,19:h,22:f,23:41,24:d,25:20,26:21,27:22,28:23,29:24,30:p,31:m,32:g,34:y,36:v,37:x,38:w,39:C,40:T,42:k,44:S,45:E,47:I,51:L,53:O,54:R,56:A,61:N,62:M,63:D,64:B,73:P},{16:[1,172]},e($,[2,50]),{16:[1,173]},e($,[2,55]),e(K,[2,76]),{76:[1,174]},{16:[1,175]},e($,[2,52]),{16:[1,176]},e($,[2,57]),e($,[2,53]),{23:177,73:P},{23:178,73:P},{23:179,73:P},{58:180,104:Z},{23:181,72:[1,182],73:P},{58:183,104:Z},{58:184,104:Z},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e($,[2,17]),e(Ie,[2,11]),{13:186,51:L,53:O,54:R},e(Ie,[2,13]),e(Ie,[2,14]),e($,[2,19]),e($,[2,35]),e($,[2,36]),e($,[2,37]),e($,[2,38]),{16:[1,187]},e($,[2,39]),{16:[1,188]},e($,[2,40]),e($,[2,41]),{16:[1,189]},e($,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:Z},{58:196,104:Z},{58:197,104:Z},{5:[2,75]},{58:198,104:Z},{23:199,73:P},{5:[2,58]},{5:[2,59]},{23:200,73:P},e(Ie,[2,12]),e(ne,i,{7:124,41:201}),e(V,i,{7:126,43:202}),e(pe,i,{7:129,46:203}),e($,[2,49]),e($,[2,54]),e(K,[2,77]),e($,[2,51]),e($,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:Z},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:b(function(Ke,Ve){if(Ve.recoverable)this.trace(Ke);else{var tt=new Error(Ke);throw tt.hash=Ve,tt}},"parseError"),parse:b(function(Ke){var Ve=this,tt=[0],We=[],rt=[null],Se=[],Et=this.table,De="",mt=0,Tt=0,jt=0,_t=2,Rt=1,bt=Se.slice.call(arguments,1),ke=Object.create(this.lexer),yt={yy:{}};for(var xt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xt)&&(yt.yy[xt]=this.yy[xt]);ke.setInput(Ke,yt.yy),yt.yy.lexer=ke,yt.yy.parser=this,typeof ke.yylloc>"u"&&(ke.yylloc={});var it=ke.yylloc;Se.push(it);var Me=ke.options&&ke.options.ranges;typeof yt.yy.parseError=="function"?this.parseError=yt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ut(ur){tt.length=tt.length-2*ur,rt.length=rt.length-ur,Se.length=Se.length-ur}b(ut,"popStack");function at(){var ur;return ur=We.pop()||ke.lex()||Rt,typeof ur!="number"&&(ur instanceof Array&&(We=ur,ur=We.pop()),ur=Ve.symbols_[ur]||ur),ur}b(at,"lex");for(var dt,tr,Vt,rr,Dr,vr,Qt={},yr,lt,pt,St;;){if(Vt=tt[tt.length-1],this.defaultActions[Vt]?rr=this.defaultActions[Vt]:((dt===null||typeof dt>"u")&&(dt=at()),rr=Et[Vt]&&Et[Vt][dt]),typeof rr>"u"||!rr.length||!rr[0]){var Ir="";St=[];for(yr in Et[Vt])this.terminals_[yr]&&yr>_t&&St.push("'"+this.terminals_[yr]+"'");ke.showPosition?Ir="Parse error on line "+(mt+1)+`: `+ke.showPosition()+` Expecting `+St.join(", ")+", got '"+(this.terminals_[dt]||dt)+"'":Ir="Parse error on line "+(mt+1)+": Unexpected "+(dt==Rt?"end of input":"'"+(this.terminals_[dt]||dt)+"'"),this.parseError(Ir,{text:ke.match,token:this.terminals_[dt]||dt,line:ke.yylineno,loc:it,expected:St})}if(rr[0]instanceof Array&&rr.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Vt+", token: "+dt);switch(rr[0]){case 1:tt.push(dt),rt.push(ke.yytext),Se.push(ke.yylloc),tt.push(rr[1]),dt=null,tr?(dt=tr,tr=null):(Tt=ke.yyleng,De=ke.yytext,mt=ke.yylineno,it=ke.yylloc,jt>0&&jt--);break;case 2:if(lt=this.productions_[rr[1]][1],Qt.$=rt[rt.length-lt],Qt._$={first_line:Se[Se.length-(lt||1)].first_line,last_line:Se[Se.length-1].last_line,first_column:Se[Se.length-(lt||1)].first_column,last_column:Se[Se.length-1].last_column},Me&&(Qt._$.range=[Se[Se.length-(lt||1)].range[0],Se[Se.length-1].range[1]]),vr=this.performAction.apply(Qt,[De,Tt,mt,yt.yy,rr[1],rt,Se].concat(bt)),typeof vr<"u")return vr;lt&&(tt=tt.slice(0,-1*lt*2),rt=rt.slice(0,-1*lt),Se=Se.slice(0,-1*lt)),tt.push(this.productions_[rr[1]][0]),rt.push(Qt.$),Se.push(Qt._$),pt=Et[tt[tt.length-2]][tt[tt.length-1]],tt.push(pt);break;case 3:return!0}}return!0},"parse")},Ne=(function(){var Fe={EOF:1,parseError:b(function(Ve,tt){if(this.yy.parser)this.yy.parser.parseError(Ve,tt);else throw new Error(Ve)},"parseError"),setInput:b(function(Ke,Ve){return this.yy=Ve||this.yy||{},this._input=Ke,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var Ke=this._input[0];this.yytext+=Ke,this.yyleng++,this.offset++,this.match+=Ke,this.matched+=Ke;var Ve=Ke.match(/(?:\r\n?|\n).*/g);return Ve?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Ke},"input"),unput:b(function(Ke){var Ve=Ke.length,tt=Ke.split(/(?:\r\n?|\n)/g);this._input=Ke+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Ve),this.offset-=Ve;var We=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),tt.length-1&&(this.yylineno-=tt.length-1);var rt=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:tt?(tt.length===We.length?this.yylloc.first_column:0)+We[We.length-tt.length].length-tt[0].length:this.yylloc.first_column-Ve},this.options.ranges&&(this.yylloc.range=[rt[0],rt[0]+this.yyleng-Ve]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(Ke){this.unput(this.match.slice(Ke))},"less"),pastInput:b(function(){var Ke=this.matched.substr(0,this.matched.length-this.match.length);return(Ke.length>20?"...":"")+Ke.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var Ke=this.match;return Ke.length<20&&(Ke+=this._input.substr(0,20-Ke.length)),(Ke.substr(0,20)+(Ke.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var Ke=this.pastInput(),Ve=new Array(Ke.length+1).join("-");return Ke+this.upcomingInput()+` `+Ve+"^"},"showPosition"),test_match:b(function(Ke,Ve){var tt,We,rt;if(this.options.backtrack_lexer&&(rt={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(rt.yylloc.range=this.yylloc.range.slice(0))),We=Ke[0].match(/(?:\r\n?|\n).*/g),We&&(this.yylineno+=We.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:We?We[We.length-1].length-We[We.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Ke[0].length},this.yytext+=Ke[0],this.match+=Ke[0],this.matches=Ke,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Ke[0].length),this.matched+=Ke[0],tt=this.performAction.call(this,this.yy,this,Ve,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),tt)return tt;if(this._backtrack){for(var Se in rt)this[Se]=rt[Se];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Ke,Ve,tt,We;this._more||(this.yytext="",this.match="");for(var rt=this._currentRules(),Se=0;SeVe[0].length)){if(Ve=tt,We=Se,this.options.backtrack_lexer){if(Ke=this.test_match(tt,rt[Se]),Ke!==!1)return Ke;if(this._backtrack){Ve=!1;continue}else return!1}else if(!this.options.flex)break}return Ve?(Ke=this.test_match(Ve,rt[We]),Ke!==!1?Ke:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var Ve=this.next();return Ve||this.lex()},"lex"),begin:b(function(Ve){this.conditionStack.push(Ve)},"begin"),popState:b(function(){var Ve=this.conditionStack.length-1;return Ve>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(Ve){return Ve=this.conditionStack.length-1-Math.abs(Ve||0),Ve>=0?this.conditionStack[Ve]:"INITIAL"},"topState"),pushState:b(function(Ve){this.begin(Ve)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(Ve,tt,We,rt){var Se=rt;switch(We){case 0:return 5;case 1:break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:return 20;case 7:return this.begin("CONFIG"),75;break;case 8:return 76;case 9:return this.popState(),this.begin("ALIAS"),77;break;case 10:return this.popState(),this.popState(),77;break;case 11:return tt.yytext=tt.yytext.trim(),73;break;case 12:return tt.yytext=tt.yytext.trim(),this.begin("ALIAS"),73;break;case 13:return tt.yytext=tt.yytext.trim(),this.popState(),73;break;case 14:return this.popState(),10;break;case 15:return tt.yytext=tt.yytext.trim(),this.popState(),10;break;case 16:return this.begin("LINE"),15;break;case 17:return this.begin("ID"),51;break;case 18:return this.begin("ID"),53;break;case 19:return 14;case 20:return this.begin("ID"),54;break;case 21:return this.popState(),this.popState(),this.begin("LINE"),52;break;case 22:return this.popState(),this.popState(),5;break;case 23:return this.begin("LINE"),37;break;case 24:return this.begin("LINE"),38;break;case 25:return this.begin("LINE"),39;break;case 26:return this.begin("LINE"),40;break;case 27:return this.begin("LINE"),50;break;case 28:return this.begin("LINE"),42;break;case 29:return this.begin("LINE"),44;break;case 30:return this.begin("LINE"),49;break;case 31:return this.begin("LINE"),45;break;case 32:return this.begin("LINE"),48;break;case 33:return this.begin("LINE"),47;break;case 34:return this.popState(),16;break;case 35:return 17;case 36:return 67;case 37:return 68;case 38:return 61;case 39:return 62;case 40:return 63;case 41:return 64;case 42:return 59;case 43:return 56;case 44:return this.begin("ID"),22;break;case 45:return this.begin("ID"),24;break;case 46:return 30;case 47:return 31;case 48:return this.begin("acc_title"),32;break;case 49:return this.popState(),"acc_title_value";break;case 50:return this.begin("acc_descr"),34;break;case 51:return this.popState(),"acc_descr_value";break;case 52:this.begin("acc_descr_multiline");break;case 53:this.popState();break;case 54:return"acc_descr_multiline_value";case 55:return 6;case 56:return 19;case 57:return 21;case 58:return 66;case 59:return 5;case 60:return tt.yytext=tt.yytext.trim(),73;break;case 61:return 80;case 62:return 97;case 63:return 98;case 64:return 99;case 65:return 78;case 66:return 79;case 67:return 100;case 68:return 101;case 69:return 102;case 70:return 103;case 71:return 85;case 72:return 86;case 73:return 87;case 74:return 88;case 75:return 93;case 76:return 94;case 77:return 95;case 78:return 96;case 79:return 81;case 80:return 82;case 81:return 83;case 82:return 84;case 83:return 89;case 84:return 90;case 85:return 91;case 86:return 92;case 87:return 104;case 88:return 104;case 89:return 70;case 90:return 71;case 91:return 72;case 92:return 5;case 93:return 10}},"anonymous"),rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:([0-9]+(\.[0-9]{1,2})?|\.[0-9]{1,2})(?=[ \n]+))/i,/^(?:@\{)/i,/^(?:[^\}]+)/i,/^(?:\}(?=\s+as\s))/i,/^(?:\})/i,/^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i,/^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i,/^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i,/^(?:[^<>:\n,;@]*<[^\n]*)/i,/^(?:[^\n]+)/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:create\b)/i,/^(?:destroy\b)/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:par_over\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\/\\\+\()\+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)|-\|\\|-\\|-\/|-\/\/|-\|\/|\/\|-|\\\|-|\/\/-|\\\\-|\/\|-|--\|\\|--|\(\)))[\-]*[^\+<\->\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:<<->>)/i,/^(?:-->>)/i,/^(?:<<-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?:--\|\\)/i,/^(?:--\|\/)/i,/^(?:--\\\\)/i,/^(?:--\/\/)/i,/^(?:\/\|--)/i,/^(?:\\\|--)/i,/^(?:\/\/--)/i,/^(?:\\\\--)/i,/^(?:-\|\\)/i,/^(?:-\|\/)/i,/^(?:-\\\\)/i,/^(?:-\/\/)/i,/^(?:\/\|-)/i,/^(?:\\\|-)/i,/^(?:\/\/-)/i,/^(?:\\\\-)/i,/^(?::(?:(?:no)?wrap)?[^#\n;]*)/i,/^(?::)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\(\))/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[53,54],inclusive:!1},acc_descr:{rules:[51],inclusive:!1},acc_title:{rules:[49],inclusive:!1},ID:{rules:[2,3,7,11,12,13,14,15],inclusive:!1},ALIAS:{rules:[2,3,21,22],inclusive:!1},LINE:{rules:[2,3,34],inclusive:!1},CONFIG:{rules:[8,9,10],inclusive:!1},CONFIG_DATA:{rules:[],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,16,17,18,19,20,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,50,52,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],inclusive:!0}}};return Fe})();je.lexer=Ne;function ze(){this.yy={}}return b(ze,"Parser"),ze.prototype=je,je.Parser=ze,new ze})();rae.parser=rae;KKt=rae,ZKt={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31,PAR_OVER_START:32,BIDIRECTIONAL_SOLID:33,BIDIRECTIONAL_DOTTED:34,SOLID_TOP:41,SOLID_BOTTOM:42,STICK_TOP:43,STICK_BOTTOM:44,SOLID_ARROW_TOP_REVERSE:45,SOLID_ARROW_BOTTOM_REVERSE:46,STICK_ARROW_TOP_REVERSE:47,STICK_ARROW_BOTTOM_REVERSE:48,SOLID_TOP_DOTTED:51,SOLID_BOTTOM_DOTTED:52,STICK_TOP_DOTTED:53,STICK_BOTTOM_DOTTED:54,SOLID_ARROW_TOP_REVERSE_DOTTED:55,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:56,STICK_ARROW_TOP_REVERSE_DOTTED:57,STICK_ARROW_BOTTOM_REVERSE_DOTTED:58,CENTRAL_CONNECTION:59,CENTRAL_CONNECTION_REVERSE:60,CENTRAL_CONNECTION_DUAL:61},QKt={FILLED:0,OPEN:1},JKt={LEFTOF:0,RIGHTOF:1,OVER:2},yO={ACTOR:"actor",BOUNDARY:"boundary",COLLECTIONS:"collections",CONTROL:"control",DATABASE:"database",ENTITY:"entity",PARTICIPANT:"participant",QUEUE:"queue"},eZt=class{constructor(){this.state=new aw(()=>({prevActor:void 0,actors:new Map,createdActors:new Map,destroyedActors:new Map,boxes:[],messages:[],notes:[],sequenceNumbersEnabled:!1,wrapEnabled:void 0,currentBox:void 0,lastCreated:void 0,lastDestroyed:void 0})),this.setAccTitle=Yr,this.setAccDescription=Jr,this.setDiagramTitle=ln,this.getAccTitle=Qr,this.getAccDescription=en,this.getDiagramTitle=tn,this.apply=this.apply.bind(this),this.parseBoxData=this.parseBoxData.bind(this),this.parseMessage=this.parseMessage.bind(this),this.clear(),this.setWrap(Be().wrap),this.LINETYPE=ZKt,this.ARROWTYPE=QKt,this.PLACEMENT=JKt}static{b(this,"SequenceDB")}addBox(e){this.state.records.boxes.push({name:e.text,wrap:e.wrap??this.autoWrap(),fill:e.color,actorKeys:[]}),this.state.records.currentBox=this.state.records.boxes.slice(-1)[0]}addActor(e,t,r,n,i){let a=this.state.records.currentBox,s;if(i!==void 0){let l;i.includes(` +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var Ve=this.next();return Ve||this.lex()},"lex"),begin:b(function(Ve){this.conditionStack.push(Ve)},"begin"),popState:b(function(){var Ve=this.conditionStack.length-1;return Ve>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(Ve){return Ve=this.conditionStack.length-1-Math.abs(Ve||0),Ve>=0?this.conditionStack[Ve]:"INITIAL"},"topState"),pushState:b(function(Ve){this.begin(Ve)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(Ve,tt,We,rt){var Se=rt;switch(We){case 0:return 5;case 1:break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:return 20;case 7:return this.begin("CONFIG"),75;break;case 8:return 76;case 9:return this.popState(),this.begin("ALIAS"),77;break;case 10:return this.popState(),this.popState(),77;break;case 11:return tt.yytext=tt.yytext.trim(),73;break;case 12:return tt.yytext=tt.yytext.trim(),this.begin("ALIAS"),73;break;case 13:return tt.yytext=tt.yytext.trim(),this.popState(),73;break;case 14:return this.popState(),10;break;case 15:return tt.yytext=tt.yytext.trim(),this.popState(),10;break;case 16:return this.begin("LINE"),15;break;case 17:return this.begin("ID"),51;break;case 18:return this.begin("ID"),53;break;case 19:return 14;case 20:return this.begin("ID"),54;break;case 21:return this.popState(),this.popState(),this.begin("LINE"),52;break;case 22:return this.popState(),this.popState(),5;break;case 23:return this.begin("LINE"),37;break;case 24:return this.begin("LINE"),38;break;case 25:return this.begin("LINE"),39;break;case 26:return this.begin("LINE"),40;break;case 27:return this.begin("LINE"),50;break;case 28:return this.begin("LINE"),42;break;case 29:return this.begin("LINE"),44;break;case 30:return this.begin("LINE"),49;break;case 31:return this.begin("LINE"),45;break;case 32:return this.begin("LINE"),48;break;case 33:return this.begin("LINE"),47;break;case 34:return this.popState(),16;break;case 35:return 17;case 36:return 67;case 37:return 68;case 38:return 61;case 39:return 62;case 40:return 63;case 41:return 64;case 42:return 59;case 43:return 56;case 44:return this.begin("ID"),22;break;case 45:return this.begin("ID"),24;break;case 46:return 30;case 47:return 31;case 48:return this.begin("acc_title"),32;break;case 49:return this.popState(),"acc_title_value";break;case 50:return this.begin("acc_descr"),34;break;case 51:return this.popState(),"acc_descr_value";break;case 52:this.begin("acc_descr_multiline");break;case 53:this.popState();break;case 54:return"acc_descr_multiline_value";case 55:return 6;case 56:return 19;case 57:return 21;case 58:return 66;case 59:return 5;case 60:return tt.yytext=tt.yytext.trim(),73;break;case 61:return 80;case 62:return 97;case 63:return 98;case 64:return 99;case 65:return 78;case 66:return 79;case 67:return 100;case 68:return 101;case 69:return 102;case 70:return 103;case 71:return 85;case 72:return 86;case 73:return 87;case 74:return 88;case 75:return 93;case 76:return 94;case 77:return 95;case 78:return 96;case 79:return 81;case 80:return 82;case 81:return 83;case 82:return 84;case 83:return 89;case 84:return 90;case 85:return 91;case 86:return 92;case 87:return 104;case 88:return 104;case 89:return 70;case 90:return 71;case 91:return 72;case 92:return 5;case 93:return 10}},"anonymous"),rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:([0-9]+(\.[0-9]{1,2})?|\.[0-9]{1,2})(?=[ \n]+))/i,/^(?:@\{)/i,/^(?:[^\}]+)/i,/^(?:\}(?=\s+as\s))/i,/^(?:\})/i,/^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i,/^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i,/^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i,/^(?:[^<>:\n,;@]*<[^\n]*)/i,/^(?:[^\n]+)/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:create\b)/i,/^(?:destroy\b)/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:par_over\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\/\\\+\()\+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)|-\|\\|-\\|-\/|-\/\/|-\|\/|\/\|-|\\\|-|\/\/-|\\\\-|\/\|-|--\|\\|--|\(\)))[\-]*[^\+<\->\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:<<->>)/i,/^(?:-->>)/i,/^(?:<<-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?:--\|\\)/i,/^(?:--\|\/)/i,/^(?:--\\\\)/i,/^(?:--\/\/)/i,/^(?:\/\|--)/i,/^(?:\\\|--)/i,/^(?:\/\/--)/i,/^(?:\\\\--)/i,/^(?:-\|\\)/i,/^(?:-\|\/)/i,/^(?:-\\\\)/i,/^(?:-\/\/)/i,/^(?:\/\|-)/i,/^(?:\\\|-)/i,/^(?:\/\/-)/i,/^(?:\\\\-)/i,/^(?::(?:(?:no)?wrap)?[^#\n;]*)/i,/^(?::)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\(\))/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[53,54],inclusive:!1},acc_descr:{rules:[51],inclusive:!1},acc_title:{rules:[49],inclusive:!1},ID:{rules:[2,3,7,11,12,13,14,15],inclusive:!1},ALIAS:{rules:[2,3,21,22],inclusive:!1},LINE:{rules:[2,3,34],inclusive:!1},CONFIG:{rules:[8,9,10],inclusive:!1},CONFIG_DATA:{rules:[],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,16,17,18,19,20,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,50,52,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],inclusive:!0}}};return Fe})();je.lexer=Ne;function ze(){this.yy={}}return b(ze,"Parser"),ze.prototype=je,je.Parser=ze,new ze})();iae.parser=iae;eZt=iae,tZt={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31,PAR_OVER_START:32,BIDIRECTIONAL_SOLID:33,BIDIRECTIONAL_DOTTED:34,SOLID_TOP:41,SOLID_BOTTOM:42,STICK_TOP:43,STICK_BOTTOM:44,SOLID_ARROW_TOP_REVERSE:45,SOLID_ARROW_BOTTOM_REVERSE:46,STICK_ARROW_TOP_REVERSE:47,STICK_ARROW_BOTTOM_REVERSE:48,SOLID_TOP_DOTTED:51,SOLID_BOTTOM_DOTTED:52,STICK_TOP_DOTTED:53,STICK_BOTTOM_DOTTED:54,SOLID_ARROW_TOP_REVERSE_DOTTED:55,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:56,STICK_ARROW_TOP_REVERSE_DOTTED:57,STICK_ARROW_BOTTOM_REVERSE_DOTTED:58,CENTRAL_CONNECTION:59,CENTRAL_CONNECTION_REVERSE:60,CENTRAL_CONNECTION_DUAL:61},rZt={FILLED:0,OPEN:1},nZt={LEFTOF:0,RIGHTOF:1,OVER:2},yO={ACTOR:"actor",BOUNDARY:"boundary",COLLECTIONS:"collections",CONTROL:"control",DATABASE:"database",ENTITY:"entity",PARTICIPANT:"participant",QUEUE:"queue"},iZt=class{constructor(){this.state=new aw(()=>({prevActor:void 0,actors:new Map,createdActors:new Map,destroyedActors:new Map,boxes:[],messages:[],notes:[],sequenceNumbersEnabled:!1,wrapEnabled:void 0,currentBox:void 0,lastCreated:void 0,lastDestroyed:void 0})),this.setAccTitle=Yr,this.setAccDescription=Jr,this.setDiagramTitle=ln,this.getAccTitle=Qr,this.getAccDescription=en,this.getDiagramTitle=tn,this.apply=this.apply.bind(this),this.parseBoxData=this.parseBoxData.bind(this),this.parseMessage=this.parseMessage.bind(this),this.clear(),this.setWrap(Be().wrap),this.LINETYPE=tZt,this.ARROWTYPE=rZt,this.PLACEMENT=nZt}static{b(this,"SequenceDB")}addBox(e){this.state.records.boxes.push({name:e.text,wrap:e.wrap??this.autoWrap(),fill:e.color,actorKeys:[]}),this.state.records.currentBox=this.state.records.boxes.slice(-1)[0]}addActor(e,t,r,n,i){let a=this.state.records.currentBox,s;if(i!==void 0){let l;i.includes(` `)?l=i+` `:l=`{ `+i+` -}`,s=Ym(l,{schema:Um})}n=s?.type??n,s?.alias&&(!r||r.text===t)&&(r={text:s.alias,wrap:r?.wrap,type:n});let o=this.state.records.actors.get(e);if(o){if(this.state.records.currentBox&&o.box&&this.state.records.currentBox!==o.box)throw new Error(`A same participant should only be defined in one Box: ${o.name} can't be in '${o.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`);if(a=o.box?o.box:this.state.records.currentBox,o.box=a,o&&t===o.name&&r==null)return}if(r?.text==null&&(r={text:t,type:n}),(n==null||r.text==null)&&(r={text:t,type:n}),this.state.records.actors.set(e,{box:a,name:t,description:r.text,wrap:r.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:n??"participant"}),this.state.records.prevActor){let l=this.state.records.actors.get(this.state.records.prevActor);l&&(l.nextActor=e)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(e),this.state.records.prevActor=e}activationCount(e){let t,r=0;if(!e)return 0;for(t=0;t>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},o}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:e,to:t,message:r?.text??"",wrap:r?.wrap??this.autoWrap(),type:n,activate:i,centralConnection:a??0}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(e=>e.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(e){return this.state.records.actors.get(e)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(e){this.state.records.wrapEnabled=e}extractWrap(e){if(e===void 0)return{};e=e.trim();let t=/^:?wrap:/.exec(e)!==null?!0:/^:?nowrap:/.exec(e)!==null?!1:void 0;return{cleanedText:(t===void 0?e:e.replace(/^:?(?:no)?wrap:/,"")).trim(),wrap:t}}autoWrap(){return this.state.records.wrapEnabled!==void 0?this.state.records.wrapEnabled:Be().sequence?.wrap??!1}clear(){this.state.reset(),Nr()}parseMessage(e){let t=e.trim(),{wrap:r,cleanedText:n}=this.extractWrap(t),i={text:n,wrap:r};return se.debug(`parseMessage: ${JSON.stringify(i)}`),i}parseBoxData(e){let t=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(e),r=t?.[1]?t[1].trim():"transparent",n=t?.[2]?t[2].trim():void 0;if(window?.CSS)window.CSS.supports("color",r)||(r="transparent",n=e.trim());else{let s=new Option().style;s.color=r,s.color!==r&&(r="transparent",n=e.trim())}let{wrap:i,cleanedText:a}=this.extractWrap(n);return{text:a?Mr(a,Be()):void 0,color:r,wrap:i}}addNote(e,t,r){let n={actor:e,placement:t,message:r.text,wrap:r.wrap??this.autoWrap()},i=[].concat(e,e);this.state.records.notes.push(n),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:i[0],to:i[1],message:r.text,wrap:r.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:t})}addLinks(e,t){let r=this.getActor(e);try{let n=Mr(t.text,Be());n=n.replace(/=/g,"="),n=n.replace(/&/g,"&");let i=JSON.parse(n);this.insertLinks(r,i)}catch(n){se.error("error while parsing actor link text",n)}}addALink(e,t){let r=this.getActor(e);try{let n={},i=Mr(t.text,Be()),a=i.indexOf("@");i=i.replace(/=/g,"="),i=i.replace(/&/g,"&");let s=i.slice(0,a-1).trim(),o=i.slice(a+1).trim();n[s]=o,this.insertLinks(r,n)}catch(n){se.error("error while parsing actor link text",n)}}insertLinks(e,t){if(e.links==null)e.links=t;else for(let r in t)e.links[r]=t[r]}addProperties(e,t){let r=this.getActor(e);try{let n=Mr(t.text,Be()),i=JSON.parse(n);this.insertProperties(r,i)}catch(n){se.error("error while parsing actor properties text",n)}}insertProperties(e,t){if(e.properties==null)e.properties=t;else for(let r in t)e.properties[r]=t[r]}boxEnd(){this.state.records.currentBox=void 0}addDetails(e,t){let r=this.getActor(e),n=document.getElementById(t.text);try{let i=n.innerHTML,a=JSON.parse(i);a.properties&&this.insertProperties(r,a.properties),a.links&&this.insertLinks(r,a.links)}catch(i){se.error("error while parsing actor details text",i)}}getActorProperty(e,t){if(e?.properties!==void 0)return e.properties[t]}apply(e){if(Array.isArray(e))e.forEach(t=>{this.apply(t)});else switch(e.type){case"sequenceIndex":this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:e.sequenceIndex,step:e.sequenceIndexStep,visible:e.sequenceVisible},wrap:!1,type:e.signalType});break;case"addParticipant":this.addActor(e.actor,e.actor,e.description,e.draw,e.config);break;case"createParticipant":if(this.state.records.actors.has(e.actor))throw new Error("It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior");this.state.records.lastCreated=e.actor,this.addActor(e.actor,e.actor,e.description,e.draw,e.config),this.state.records.createdActors.set(e.actor,this.state.records.messages.length);break;case"destroyParticipant":this.state.records.lastDestroyed=e.actor,this.state.records.destroyedActors.set(e.actor,this.state.records.messages.length);break;case"activeStart":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"centralConnection":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"centralConnectionReverse":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"activeEnd":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"addNote":this.addNote(e.actor,e.placement,e.text);break;case"addLinks":this.addLinks(e.actor,e.text);break;case"addALink":this.addALink(e.actor,e.text);break;case"addProperties":this.addProperties(e.actor,e.text);break;case"addDetails":this.addDetails(e.actor,e.text);break;case"addMessage":if(this.state.records.lastCreated){if(e.to!==this.state.records.lastCreated)throw new Error("The created participant "+this.state.records.lastCreated.name+" does not have an associated creating message after its declaration. Please check the sequence diagram.");this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(e.to!==this.state.records.lastDestroyed&&e.from!==this.state.records.lastDestroyed)throw new Error("The destroyed participant "+this.state.records.lastDestroyed.name+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");this.state.records.lastDestroyed=void 0}this.addSignal(e.from,e.to,e.msg,e.signalType,e.activate,e.centralConnection);break;case"boxStart":this.addBox(e.boxData);break;case"boxEnd":this.boxEnd();break;case"loopStart":this.addSignal(void 0,void 0,e.loopText,e.signalType);break;case"loopEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"rectStart":this.addSignal(void 0,void 0,e.color,e.signalType);break;case"rectEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"optStart":this.addSignal(void 0,void 0,e.optText,e.signalType);break;case"optEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"altStart":this.addSignal(void 0,void 0,e.altText,e.signalType);break;case"else":this.addSignal(void 0,void 0,e.altText,e.signalType);break;case"altEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"setAccTitle":Yr(e.text);break;case"parStart":this.addSignal(void 0,void 0,e.parText,e.signalType);break;case"and":this.addSignal(void 0,void 0,e.parText,e.signalType);break;case"parEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"criticalStart":this.addSignal(void 0,void 0,e.criticalText,e.signalType);break;case"option":this.addSignal(void 0,void 0,e.optionText,e.signalType);break;case"criticalEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"breakStart":this.addSignal(void 0,void 0,e.breakText,e.signalType);break;case"breakEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break}}getConfig(){return Be().sequence}},tZt=b(e=>{let t=e.dropShadow??"none",{look:r}=Be();return`.actor { +}`,s=Ym(l,{schema:Um})}n=s?.type??n,s?.alias&&(!r||r.text===t)&&(r={text:s.alias,wrap:r?.wrap,type:n});let o=this.state.records.actors.get(e);if(o){if(this.state.records.currentBox&&o.box&&this.state.records.currentBox!==o.box)throw new Error(`A same participant should only be defined in one Box: ${o.name} can't be in '${o.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`);if(a=o.box?o.box:this.state.records.currentBox,o.box=a,o&&t===o.name&&r==null)return}if(r?.text==null&&(r={text:t,type:n}),(n==null||r.text==null)&&(r={text:t,type:n}),this.state.records.actors.set(e,{box:a,name:t,description:r.text,wrap:r.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:n??"participant"}),this.state.records.prevActor){let l=this.state.records.actors.get(this.state.records.prevActor);l&&(l.nextActor=e)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(e),this.state.records.prevActor=e}activationCount(e){let t,r=0;if(!e)return 0;for(t=0;t>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},o}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:e,to:t,message:r?.text??"",wrap:r?.wrap??this.autoWrap(),type:n,activate:i,centralConnection:a??0}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(e=>e.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(e){return this.state.records.actors.get(e)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(e){this.state.records.wrapEnabled=e}extractWrap(e){if(e===void 0)return{};e=e.trim();let t=/^:?wrap:/.exec(e)!==null?!0:/^:?nowrap:/.exec(e)!==null?!1:void 0;return{cleanedText:(t===void 0?e:e.replace(/^:?(?:no)?wrap:/,"")).trim(),wrap:t}}autoWrap(){return this.state.records.wrapEnabled!==void 0?this.state.records.wrapEnabled:Be().sequence?.wrap??!1}clear(){this.state.reset(),Nr()}parseMessage(e){let t=e.trim(),{wrap:r,cleanedText:n}=this.extractWrap(t),i={text:n,wrap:r};return se.debug(`parseMessage: ${JSON.stringify(i)}`),i}parseBoxData(e){let t=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(e),r=t?.[1]?t[1].trim():"transparent",n=t?.[2]?t[2].trim():void 0;if(window?.CSS)window.CSS.supports("color",r)||(r="transparent",n=e.trim());else{let s=new Option().style;s.color=r,s.color!==r&&(r="transparent",n=e.trim())}let{wrap:i,cleanedText:a}=this.extractWrap(n);return{text:a?Mr(a,Be()):void 0,color:r,wrap:i}}addNote(e,t,r){let n={actor:e,placement:t,message:r.text,wrap:r.wrap??this.autoWrap()},i=[].concat(e,e);this.state.records.notes.push(n),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:i[0],to:i[1],message:r.text,wrap:r.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:t})}addLinks(e,t){let r=this.getActor(e);try{let n=Mr(t.text,Be());n=n.replace(/=/g,"="),n=n.replace(/&/g,"&");let i=JSON.parse(n);this.insertLinks(r,i)}catch(n){se.error("error while parsing actor link text",n)}}addALink(e,t){let r=this.getActor(e);try{let n={},i=Mr(t.text,Be()),a=i.indexOf("@");i=i.replace(/=/g,"="),i=i.replace(/&/g,"&");let s=i.slice(0,a-1).trim(),o=i.slice(a+1).trim();n[s]=o,this.insertLinks(r,n)}catch(n){se.error("error while parsing actor link text",n)}}insertLinks(e,t){if(e.links==null)e.links=t;else for(let r in t)e.links[r]=t[r]}addProperties(e,t){let r=this.getActor(e);try{let n=Mr(t.text,Be()),i=JSON.parse(n);this.insertProperties(r,i)}catch(n){se.error("error while parsing actor properties text",n)}}insertProperties(e,t){if(e.properties==null)e.properties=t;else for(let r in t)e.properties[r]=t[r]}boxEnd(){this.state.records.currentBox=void 0}addDetails(e,t){let r=this.getActor(e),n=document.getElementById(t.text);try{let i=n.innerHTML,a=JSON.parse(i);a.properties&&this.insertProperties(r,a.properties),a.links&&this.insertLinks(r,a.links)}catch(i){se.error("error while parsing actor details text",i)}}getActorProperty(e,t){if(e?.properties!==void 0)return e.properties[t]}apply(e){if(Array.isArray(e))e.forEach(t=>{this.apply(t)});else switch(e.type){case"sequenceIndex":this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:e.sequenceIndex,step:e.sequenceIndexStep,visible:e.sequenceVisible},wrap:!1,type:e.signalType});break;case"addParticipant":this.addActor(e.actor,e.actor,e.description,e.draw,e.config);break;case"createParticipant":if(this.state.records.actors.has(e.actor))throw new Error("It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior");this.state.records.lastCreated=e.actor,this.addActor(e.actor,e.actor,e.description,e.draw,e.config),this.state.records.createdActors.set(e.actor,this.state.records.messages.length);break;case"destroyParticipant":this.state.records.lastDestroyed=e.actor,this.state.records.destroyedActors.set(e.actor,this.state.records.messages.length);break;case"activeStart":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"centralConnection":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"centralConnectionReverse":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"activeEnd":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"addNote":this.addNote(e.actor,e.placement,e.text);break;case"addLinks":this.addLinks(e.actor,e.text);break;case"addALink":this.addALink(e.actor,e.text);break;case"addProperties":this.addProperties(e.actor,e.text);break;case"addDetails":this.addDetails(e.actor,e.text);break;case"addMessage":if(this.state.records.lastCreated){if(e.to!==this.state.records.lastCreated)throw new Error("The created participant "+this.state.records.lastCreated.name+" does not have an associated creating message after its declaration. Please check the sequence diagram.");this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(e.to!==this.state.records.lastDestroyed&&e.from!==this.state.records.lastDestroyed)throw new Error("The destroyed participant "+this.state.records.lastDestroyed.name+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");this.state.records.lastDestroyed=void 0}this.addSignal(e.from,e.to,e.msg,e.signalType,e.activate,e.centralConnection);break;case"boxStart":this.addBox(e.boxData);break;case"boxEnd":this.boxEnd();break;case"loopStart":this.addSignal(void 0,void 0,e.loopText,e.signalType);break;case"loopEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"rectStart":this.addSignal(void 0,void 0,e.color,e.signalType);break;case"rectEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"optStart":this.addSignal(void 0,void 0,e.optText,e.signalType);break;case"optEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"altStart":this.addSignal(void 0,void 0,e.altText,e.signalType);break;case"else":this.addSignal(void 0,void 0,e.altText,e.signalType);break;case"altEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"setAccTitle":Yr(e.text);break;case"parStart":this.addSignal(void 0,void 0,e.parText,e.signalType);break;case"and":this.addSignal(void 0,void 0,e.parText,e.signalType);break;case"parEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"criticalStart":this.addSignal(void 0,void 0,e.criticalText,e.signalType);break;case"option":this.addSignal(void 0,void 0,e.optionText,e.signalType);break;case"criticalEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"breakStart":this.addSignal(void 0,void 0,e.breakText,e.signalType);break;case"breakEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break}}getConfig(){return Be().sequence}},aZt=b(e=>{let t=e.dropShadow??"none",{look:r}=Be();return`.actor { stroke: ${e.actorBorder}; fill: ${e.actorBkg}; stroke-width: ${e.strokeWidth??1}; @@ -1986,25 +1986,25 @@ Expecting `+St.join(", ")+", got '"+(this.terminals_[dt]||dt)+"'":Ir="Parse erro filter: ${t}; stroke: ${e.nodeBorder}; } -`},"getStyles"),rZt=tZt,P2=36,Qg="actor-top",Jg="actor-bottom",xO="actor-box",B2="actor-man",mp=new Set(["redux-color","redux-dark-color"]),N6=b(function(e,t){let r=wv(e,t);return qt().look==="neo"&&r.attr("data-look","neo"),r},"drawRect"),nZt=b(function(e,t,r,n,i){if(t.links===void 0||t.links===null||Object.keys(t.links).length===0)return{height:0,width:0};let a=t.links,s=t.actorCnt,o=t.rectData;var l="none";i&&(l="block !important");let u=e.append("g");u.attr("id","actor"+s+"_popup"),u.attr("class","actorPopupMenu"),u.attr("display",l);var h="";o.class!==void 0&&(h=" "+o.class);let f=o.width>r?o.width:r,d=u.append("rect");if(d.attr("class","actorPopupMenuPanel"+h),d.attr("x",o.x),d.attr("y",o.height),d.attr("fill",o.fill),d.attr("stroke",o.stroke),d.attr("width",f),d.attr("height",o.height),d.attr("rx",o.rx),d.attr("ry",o.ry),a!=null){var p=20;for(let y in a){var m=u.append("a"),g=(0,aae.sanitizeUrl)(a[y]);m.attr("xlink:href",g),m.attr("target","_blank"),EZt(n)(y,m,o.x+10,o.height+p,f,20,{class:"actor"},n),p+=30}}return d.attr("height",p),{height:o.height+p,width:f}},"drawPopup"),bO=b(function(e){return"var pu = document.getElementById('"+e+"'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"},"popupMenuToggle"),vO=b(async function(e,t,r=null){let n=e.append("foreignObject"),i=await Lb(t.text,qt()),s=n.append("xhtml:div").attr("style","width: fit-content;").attr("xmlns","http://www.w3.org/1999/xhtml").html(i).node().getBoundingClientRect();if(n.attr("height",Math.round(s.height)).attr("width",Math.round(s.width)),t.class==="noteText"){let o=e.node().firstChild;o.setAttribute("height",s.height+2*t.textMargin);let l=o.getBBox();n.attr("x",Math.round(l.x+l.width/2-s.width/2)).attr("y",Math.round(l.y+l.height/2-s.height/2))}else if(r){let{startx:o,stopx:l,starty:u}=r;if(o>l){let h=o;o=l,l=h}n.attr("x",Math.round(o+Math.abs(o-l)/2-s.width/2)),t.class==="loopText"?n.attr("y",Math.round(u)):n.attr("y",Math.round(u-s.height))}return[n]},"drawKatex"),uk=b(function(e,t){let r=0,n=0,i=t.text.split(Ct.lineBreakRegex),[a,s]=Zl(t.fontSize),o=[],l=0,u=b(()=>t.y,"yfunc");if(t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0)switch(t.valign){case"top":case"start":u=b(()=>Math.round(t.y+t.textMargin),"yfunc");break;case"middle":case"center":u=b(()=>Math.round(t.y+(r+n+t.textMargin)/2),"yfunc");break;case"bottom":case"end":u=b(()=>Math.round(t.y+(r+n+2*t.textMargin)-t.textMargin),"yfunc");break}if(t.anchor!==void 0&&t.textMargin!==void 0&&t.width!==void 0)switch(t.anchor){case"left":case"start":t.x=Math.round(t.x+t.textMargin),t.anchor="start",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"middle":case"center":t.x=Math.round(t.x+t.width/2),t.anchor="middle",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"right":case"end":t.x=Math.round(t.x+t.width-t.textMargin),t.anchor="end",t.dominantBaseline="middle",t.alignmentBaseline="middle";break}for(let[h,f]of i.entries()){t.textMargin!==void 0&&t.textMargin===0&&a!==void 0&&(l=h*a);let d=e.append("text");d.attr("x",t.x),d.attr("y",u()),t.anchor!==void 0&&d.attr("text-anchor",t.anchor).attr("dominant-baseline",t.dominantBaseline).attr("alignment-baseline",t.alignmentBaseline),t.fontFamily!==void 0&&d.style("font-family",t.fontFamily),s!==void 0&&d.style("font-size",s),t.fontWeight!==void 0&&d.style("font-weight",t.fontWeight),t.fill!==void 0&&d.attr("fill",t.fill),t.class!==void 0&&d.attr("class",t.class),t.dy!==void 0?d.attr("dy",t.dy):l!==0&&d.attr("dy",l);let p=f||CU;if(t.tspan){let m=d.append("tspan");m.attr("x",t.x),t.fill!==void 0&&m.attr("fill",t.fill),m.text(p)}else d.text(p);t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0&&(n+=(d._groups||d)[0][0].getBBox().height,r=n),o.push(d)}return o},"drawText"),JKe=b(function(e,t){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}b(r,"genPoints");let n=e.append("polygon");return n.attr("points",r(t.x,t.y,t.width,t.height,7)),n.attr("class","labelBox"),t.y=t.y+t.height/2,uk(e,t),n},"drawLabel"),Dn=-1,eZe=b((e,t,r,n)=>{e.select&&r.forEach(i=>{let a=t.get(i),s=e.select("#actor"+a.actorCnt);!n.mirrorActors&&a.stopy?s.attr("y2",a.stopy+a.height/2):n.mirrorActors&&s.attr("y2",a.stopy)})},"fixLifeLineHeights"),iZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower();var m=p;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&m.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),m=p.append("g"),t.actorCnt=Dn,t.links!=null&&m.attr("id","root-"+Dn),l==="neo"&&m.attr("data-look","neo"));let g=Xo();var y="actor";t.properties?.class?y=t.properties.class:g.fill="#eaeaea",n?y+=` ${Jg}`:y+=` ${Qg}`,g.x=t.x,g.y=a,g.width=t.width,g.height=t.height,g.class=y,g.rx=3,g.ry=3,g.name=t.name,l==="neo"&&(g.rx=6,g.ry=6);let v=N6(m,g),x=i.get(t.name)??0;if(mp.has(u)&&(v.style("stroke",d[x%d.length]),v.style("fill",f[x%d.length])),l==="neo"&&v.attr("filter","url(#drop-shadow)"),t.rectData=g,t.properties?.icon){let C=t.properties.icon.trim();C.charAt(0)==="@"?AI(m,g.x+g.width-20,g.y+10,C.substr(1)):EI(m,g.x+g.width-20,g.y+10,C)}n||(m.attr("data-et","participant"),m.attr("data-type","participant"),m.attr("data-id",t.name)),gp(r,sa(t.description))(t.description,m,g.x,g.y,g.width,g.height,{class:`actor ${xO}`},r);let w=t.height;if(v.node){let C=v.node().getBBox();t.height=C.height,w=C.height}return w},"drawActorTypeParticipant"),aZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower();var m=p;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&m.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),m=p.append("g"),t.actorCnt=Dn,t.links!=null&&m.attr("id","root-"+Dn),l==="neo"&&m.attr("data-look","neo"));let g=Xo();var y="actor";t.properties?.class?y=t.properties.class:g.fill="#eaeaea",n?y+=` ${Jg}`:y+=` ${Qg}`,g.x=t.x,g.y=a,g.width=t.width,g.height=t.height,g.class=y,g.name=t.name;let v=6,x={...g,x:g.x+-v,y:g.y+ +v,class:"actor"},w=N6(m,g),C=N6(m,x);t.rectData=g,l==="neo"&&m.attr("filter","url(#drop-shadow)");let T=i.get(t.name)??0;if(mp.has(u)&&(w.style("stroke",d[T%d.length]),w.style("fill",f[T%d.length]),C.style("stroke",d[T%d.length]),C.style("fill",f[T%d.length])),t.properties?.icon){let S=t.properties.icon.trim();S.charAt(0)==="@"?AI(m,g.x+g.width-20,g.y+10,S.substr(1)):EI(m,g.x+g.width-20,g.y+10,S)}gp(r,sa(t.description))(t.description,m,g.x-v,g.y+v,g.width,g.height,{class:`actor ${xO}`},r);let k=t.height;if(w.node){let S=w.node().getBBox();t.height=S.height,k=S.height}return n||(m.attr("data-et","participant"),m.attr("data-type","collections"),m.attr("data-id",t.name)),k},"drawActorTypeCollections"),sZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower(),m=p;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&m.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),m=p.append("g"),t.actorCnt=Dn,t.links!=null&&m.attr("id","root-"+Dn),l==="neo"&&m.attr("data-look","neo"));let g=Xo(),y="actor";t.properties?.class?y=t.properties.class:g.fill="#eaeaea",n?y+=` ${Jg}`:y+=` ${Qg}`,m.attr("class",y),g.x=t.x,g.y=a,g.width=t.width,g.height=t.height,g.name=t.name;let v=g.height/2,x=v/(2.5+g.height/50),w=m.append("g"),C=m.append("g"),T=`M ${g.x},${g.y+v} +`},"getStyles"),sZt=aZt,P2=36,Qg="actor-top",Jg="actor-bottom",xO="actor-box",B2="actor-man",mp=new Set(["redux-color","redux-dark-color"]),N6=b(function(e,t){let r=wv(e,t);return qt().look==="neo"&&r.attr("data-look","neo"),r},"drawRect"),oZt=b(function(e,t,r,n,i){if(t.links===void 0||t.links===null||Object.keys(t.links).length===0)return{height:0,width:0};let a=t.links,s=t.actorCnt,o=t.rectData;var l="none";i&&(l="block !important");let u=e.append("g");u.attr("id","actor"+s+"_popup"),u.attr("class","actorPopupMenu"),u.attr("display",l);var h="";o.class!==void 0&&(h=" "+o.class);let f=o.width>r?o.width:r,d=u.append("rect");if(d.attr("class","actorPopupMenuPanel"+h),d.attr("x",o.x),d.attr("y",o.height),d.attr("fill",o.fill),d.attr("stroke",o.stroke),d.attr("width",f),d.attr("height",o.height),d.attr("rx",o.rx),d.attr("ry",o.ry),a!=null){var p=20;for(let y in a){var m=u.append("a"),g=(0,oae.sanitizeUrl)(a[y]);m.attr("xlink:href",g),m.attr("target","_blank"),LZt(n)(y,m,o.x+10,o.height+p,f,20,{class:"actor"},n),p+=30}}return d.attr("height",p),{height:o.height+p,width:f}},"drawPopup"),bO=b(function(e){return"var pu = document.getElementById('"+e+"'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"},"popupMenuToggle"),vO=b(async function(e,t,r=null){let n=e.append("foreignObject"),i=await Lb(t.text,qt()),s=n.append("xhtml:div").attr("style","width: fit-content;").attr("xmlns","http://www.w3.org/1999/xhtml").html(i).node().getBoundingClientRect();if(n.attr("height",Math.round(s.height)).attr("width",Math.round(s.width)),t.class==="noteText"){let o=e.node().firstChild;o.setAttribute("height",s.height+2*t.textMargin);let l=o.getBBox();n.attr("x",Math.round(l.x+l.width/2-s.width/2)).attr("y",Math.round(l.y+l.height/2-s.height/2))}else if(r){let{startx:o,stopx:l,starty:u}=r;if(o>l){let h=o;o=l,l=h}n.attr("x",Math.round(o+Math.abs(o-l)/2-s.width/2)),t.class==="loopText"?n.attr("y",Math.round(u)):n.attr("y",Math.round(u-s.height))}return[n]},"drawKatex"),uk=b(function(e,t){let r=0,n=0,i=t.text.split(Ct.lineBreakRegex),[a,s]=Ql(t.fontSize),o=[],l=0,u=b(()=>t.y,"yfunc");if(t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0)switch(t.valign){case"top":case"start":u=b(()=>Math.round(t.y+t.textMargin),"yfunc");break;case"middle":case"center":u=b(()=>Math.round(t.y+(r+n+t.textMargin)/2),"yfunc");break;case"bottom":case"end":u=b(()=>Math.round(t.y+(r+n+2*t.textMargin)-t.textMargin),"yfunc");break}if(t.anchor!==void 0&&t.textMargin!==void 0&&t.width!==void 0)switch(t.anchor){case"left":case"start":t.x=Math.round(t.x+t.textMargin),t.anchor="start",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"middle":case"center":t.x=Math.round(t.x+t.width/2),t.anchor="middle",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"right":case"end":t.x=Math.round(t.x+t.width-t.textMargin),t.anchor="end",t.dominantBaseline="middle",t.alignmentBaseline="middle";break}for(let[h,f]of i.entries()){t.textMargin!==void 0&&t.textMargin===0&&a!==void 0&&(l=h*a);let d=e.append("text");d.attr("x",t.x),d.attr("y",u()),t.anchor!==void 0&&d.attr("text-anchor",t.anchor).attr("dominant-baseline",t.dominantBaseline).attr("alignment-baseline",t.alignmentBaseline),t.fontFamily!==void 0&&d.style("font-family",t.fontFamily),s!==void 0&&d.style("font-size",s),t.fontWeight!==void 0&&d.style("font-weight",t.fontWeight),t.fill!==void 0&&d.attr("fill",t.fill),t.class!==void 0&&d.attr("class",t.class),t.dy!==void 0?d.attr("dy",t.dy):l!==0&&d.attr("dy",l);let p=f||EU;if(t.tspan){let m=d.append("tspan");m.attr("x",t.x),t.fill!==void 0&&m.attr("fill",t.fill),m.text(p)}else d.text(p);t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0&&(n+=(d._groups||d)[0][0].getBBox().height,r=n),o.push(d)}return o},"drawText"),tZe=b(function(e,t){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}b(r,"genPoints");let n=e.append("polygon");return n.attr("points",r(t.x,t.y,t.width,t.height,7)),n.attr("class","labelBox"),t.y=t.y+t.height/2,uk(e,t),n},"drawLabel"),Dn=-1,rZe=b((e,t,r,n)=>{e.select&&r.forEach(i=>{let a=t.get(i),s=e.select("#actor"+a.actorCnt);!n.mirrorActors&&a.stopy?s.attr("y2",a.stopy+a.height/2):n.mirrorActors&&s.attr("y2",a.stopy)})},"fixLifeLineHeights"),lZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower();var m=p;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&m.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),m=p.append("g"),t.actorCnt=Dn,t.links!=null&&m.attr("id","root-"+Dn),l==="neo"&&m.attr("data-look","neo"));let g=Xo();var y="actor";t.properties?.class?y=t.properties.class:g.fill="#eaeaea",n?y+=` ${Jg}`:y+=` ${Qg}`,g.x=t.x,g.y=a,g.width=t.width,g.height=t.height,g.class=y,g.rx=3,g.ry=3,g.name=t.name,l==="neo"&&(g.rx=6,g.ry=6);let v=N6(m,g),x=i.get(t.name)??0;if(mp.has(u)&&(v.style("stroke",d[x%d.length]),v.style("fill",f[x%d.length])),l==="neo"&&v.attr("filter","url(#drop-shadow)"),t.rectData=g,t.properties?.icon){let C=t.properties.icon.trim();C.charAt(0)==="@"?AI(m,g.x+g.width-20,g.y+10,C.substr(1)):EI(m,g.x+g.width-20,g.y+10,C)}n||(m.attr("data-et","participant"),m.attr("data-type","participant"),m.attr("data-id",t.name)),gp(r,sa(t.description))(t.description,m,g.x,g.y,g.width,g.height,{class:`actor ${xO}`},r);let w=t.height;if(v.node){let C=v.node().getBBox();t.height=C.height,w=C.height}return w},"drawActorTypeParticipant"),cZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower();var m=p;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&m.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),m=p.append("g"),t.actorCnt=Dn,t.links!=null&&m.attr("id","root-"+Dn),l==="neo"&&m.attr("data-look","neo"));let g=Xo();var y="actor";t.properties?.class?y=t.properties.class:g.fill="#eaeaea",n?y+=` ${Jg}`:y+=` ${Qg}`,g.x=t.x,g.y=a,g.width=t.width,g.height=t.height,g.class=y,g.name=t.name;let v=6,x={...g,x:g.x+-v,y:g.y+ +v,class:"actor"},w=N6(m,g),C=N6(m,x);t.rectData=g,l==="neo"&&m.attr("filter","url(#drop-shadow)");let T=i.get(t.name)??0;if(mp.has(u)&&(w.style("stroke",d[T%d.length]),w.style("fill",f[T%d.length]),C.style("stroke",d[T%d.length]),C.style("fill",f[T%d.length])),t.properties?.icon){let S=t.properties.icon.trim();S.charAt(0)==="@"?AI(m,g.x+g.width-20,g.y+10,S.substr(1)):EI(m,g.x+g.width-20,g.y+10,S)}gp(r,sa(t.description))(t.description,m,g.x-v,g.y+v,g.width,g.height,{class:`actor ${xO}`},r);let k=t.height;if(w.node){let S=w.node().getBBox();t.height=S.height,k=S.height}return n||(m.attr("data-et","participant"),m.attr("data-type","collections"),m.attr("data-id",t.name)),k},"drawActorTypeCollections"),uZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower(),m=p;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&m.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),m=p.append("g"),t.actorCnt=Dn,t.links!=null&&m.attr("id","root-"+Dn),l==="neo"&&m.attr("data-look","neo"));let g=Xo(),y="actor";t.properties?.class?y=t.properties.class:g.fill="#eaeaea",n?y+=` ${Jg}`:y+=` ${Qg}`,m.attr("class",y),g.x=t.x,g.y=a,g.width=t.width,g.height=t.height,g.name=t.name;let v=g.height/2,x=v/(2.5+g.height/50),w=m.append("g"),C=m.append("g"),T=`M ${g.x},${g.y+v} a ${x},${v} 0 0 0 0,${g.height} h ${g.width-2*x} a ${x},${v} 0 0 0 0,-${g.height} Z `;w.append("path").attr("d",T),C.append("path").attr("d",`M ${g.x},${g.y+v} - a ${x},${v} 0 0 0 0,${g.height}`),w.attr("transform",`translate(${x}, ${-(g.height/2)})`),C.attr("transform",`translate(${g.width-x}, ${-g.height/2})`),t.rectData=g,l==="neo"&&w.attr("filter","url(#drop-shadow)");let k=i.get(t.name)??0;if(mp.has(u)&&(w.style("stroke",d[k%d.length]),w.style("fill",f[k%d.length]),C.style("stroke",d[k%d.length]),C.style("fill",f[k%d.length])),t.properties?.icon){let I=t.properties.icon.trim(),L=g.x+g.width-20,O=g.y+10;I.charAt(0)==="@"?AI(m,L,O,I.substr(1)):EI(m,L,O,I)}gp(r,sa(t.description))(t.description,m,g.x,g.y,g.width,g.height,{class:`actor ${xO}`},r);let S=t.height,E=w.select("path:last-child");if(E.node()){let I=E.node().getBBox();t.height=I.height,S=I.height}return n||(m.attr("data-et","participant"),m.attr("data-type","queue"),m.attr("data-id",t.name)),S},"drawActorTypeQueue"),oZt=b(function(e,t,r,n,i,a){let s=n?t.stopy:t.starty,o=t.x+t.width/2,l=s+75,{look:u,theme:h,themeVariables:f}=r,{bkgColorArray:d,borderColorArray:p,actorBorder:m,actorBkg:g}=f,y=e.append("g").lower();n||(Dn++,y.append("line").attr("id","actor"+Dn).attr("x1",o).attr("y1",l).attr("x2",o).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn);let v=e.append("g"),x=B2;n?x+=` ${Jg}`:x+=` ${Qg}`,v.attr("class",x),v.attr("name",t.name);let w=Xo();w.x=t.x,w.y=s,w.fill="#eaeaea",w.width=t.width,w.height=t.height,w.class="actor";let C=t.x+t.width/2,T=s+32,k=22;v.append("defs").append("marker").attr("id",i+"-filled-head-control").attr("refX",11).attr("refY",5.8).attr("markerWidth",20).attr("markerHeight",28).attr("orient","172.5").attr("stroke-width",1.2).append("path").attr("d","M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z"),v.append("circle").attr("cx",C).attr("cy",T).attr("r",k).attr("filter",`${u==="neo"?"url(#drop-shadow)":""}`),v.append("line").attr("marker-end","url(#"+i+"-filled-head-control)").attr("transform",`translate(${C}, ${T-k})`);let S=a.get(t.name)??0;mp.has(h)?(v.style("stroke",p[S%p.length]),v.style("fill",d[S%p.length])):(v.style("stroke",m),v.style("fill",g));let E=v.node().getBBox();return t.height=E.height+2*(r?.sequence?.labelBoxHeight??0),gp(r,sa(t.description))(t.description,v,w.x,w.y+k+(n?5:12),w.width,w.height,{class:`actor ${B2}`},r),n||(v.attr("data-et","participant"),v.attr("data-type","control"),v.attr("data-id",t.name)),t.height},"drawActorTypeControl"),lZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+75,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower(),m=e.append("g"),g="actor";n?g+=` ${Jg}`:g+=` ${Qg}`,m.attr("class",g),m.attr("name",t.name);let y=Xo();y.x=t.x,y.y=a,y.fill="#eaeaea",y.width=t.width,y.height=t.height,y.class="actor";let v=t.x+t.width/2,x=a+(n?10:25),w=22;m.append("circle").attr("cx",v).attr("cy",x).attr("r",w).attr("width",t.width).attr("height",t.height),m.append("line").attr("x1",v-w).attr("x2",v+w).attr("y1",x+w).attr("y2",x+w).attr("stroke-width",2),l==="neo"&&m.attr("filter","url(#drop-shadow)");let C=i.get(t.name)??0;mp.has(u)&&(m.style("stroke",d[C%d.length]),m.style("fill",f[C%d.length]));let T=m.node().getBBox();return t.height=T.height+(r?.sequence?.labelBoxHeight??0),n||(Dn++,p.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn),gp(r,sa(t.description))(t.description,m,y.x,y.y+(n?15:30),y.width,y.height,{class:`actor ${B2}`},r),n?m.attr("transform",`translate(0, ${w})`):(m.attr("transform",`translate(0, ${w/2-5})`),m.attr("data-et","participant"),m.attr("data-type","entity"),m.attr("data-id",t.name)),t.height},"drawActorTypeEntity"),cZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height+2*r.boxTextMargin,{theme:l,themeVariables:u,look:h}=r,{bkgColorArray:f,borderColorArray:d,actorBorder:p}=u,m=e.append("g").lower(),g=m;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&g.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),g.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),g=m.append("g"),t.actorCnt=Dn,t.links!=null&&g.attr("id","root-"+Dn),h==="neo"&&g.attr("data-look","neo"));let y=Xo(),v="actor";t.properties?.class?v=t.properties.class:y.fill="#eaeaea",n?v+=` ${Jg}`:v+=` ${Qg}`,y.x=t.x,y.y=a,y.width=t.width,y.height=t.height,y.class=v,y.name=t.name,y.x=t.x,y.y=a;let x=y.width/3,w=y.width/3,C=x/2,T=C/(2.5+x/50),k=g.append("g");k.attr("class",v);let S=` + a ${x},${v} 0 0 0 0,${g.height}`),w.attr("transform",`translate(${x}, ${-(g.height/2)})`),C.attr("transform",`translate(${g.width-x}, ${-g.height/2})`),t.rectData=g,l==="neo"&&w.attr("filter","url(#drop-shadow)");let k=i.get(t.name)??0;if(mp.has(u)&&(w.style("stroke",d[k%d.length]),w.style("fill",f[k%d.length]),C.style("stroke",d[k%d.length]),C.style("fill",f[k%d.length])),t.properties?.icon){let I=t.properties.icon.trim(),L=g.x+g.width-20,O=g.y+10;I.charAt(0)==="@"?AI(m,L,O,I.substr(1)):EI(m,L,O,I)}gp(r,sa(t.description))(t.description,m,g.x,g.y,g.width,g.height,{class:`actor ${xO}`},r);let S=t.height,E=w.select("path:last-child");if(E.node()){let I=E.node().getBBox();t.height=I.height,S=I.height}return n||(m.attr("data-et","participant"),m.attr("data-type","queue"),m.attr("data-id",t.name)),S},"drawActorTypeQueue"),hZt=b(function(e,t,r,n,i,a){let s=n?t.stopy:t.starty,o=t.x+t.width/2,l=s+75,{look:u,theme:h,themeVariables:f}=r,{bkgColorArray:d,borderColorArray:p,actorBorder:m,actorBkg:g}=f,y=e.append("g").lower();n||(Dn++,y.append("line").attr("id","actor"+Dn).attr("x1",o).attr("y1",l).attr("x2",o).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn);let v=e.append("g"),x=B2;n?x+=` ${Jg}`:x+=` ${Qg}`,v.attr("class",x),v.attr("name",t.name);let w=Xo();w.x=t.x,w.y=s,w.fill="#eaeaea",w.width=t.width,w.height=t.height,w.class="actor";let C=t.x+t.width/2,T=s+32,k=22;v.append("defs").append("marker").attr("id",i+"-filled-head-control").attr("refX",11).attr("refY",5.8).attr("markerWidth",20).attr("markerHeight",28).attr("orient","172.5").attr("stroke-width",1.2).append("path").attr("d","M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z"),v.append("circle").attr("cx",C).attr("cy",T).attr("r",k).attr("filter",`${u==="neo"?"url(#drop-shadow)":""}`),v.append("line").attr("marker-end","url(#"+i+"-filled-head-control)").attr("transform",`translate(${C}, ${T-k})`);let S=a.get(t.name)??0;mp.has(h)?(v.style("stroke",p[S%p.length]),v.style("fill",d[S%p.length])):(v.style("stroke",m),v.style("fill",g));let E=v.node().getBBox();return t.height=E.height+2*(r?.sequence?.labelBoxHeight??0),gp(r,sa(t.description))(t.description,v,w.x,w.y+k+(n?5:12),w.width,w.height,{class:`actor ${B2}`},r),n||(v.attr("data-et","participant"),v.attr("data-type","control"),v.attr("data-id",t.name)),t.height},"drawActorTypeControl"),fZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+75,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d}=h,p=e.append("g").lower(),m=e.append("g"),g="actor";n?g+=` ${Jg}`:g+=` ${Qg}`,m.attr("class",g),m.attr("name",t.name);let y=Xo();y.x=t.x,y.y=a,y.fill="#eaeaea",y.width=t.width,y.height=t.height,y.class="actor";let v=t.x+t.width/2,x=a+(n?10:25),w=22;m.append("circle").attr("cx",v).attr("cy",x).attr("r",w).attr("width",t.width).attr("height",t.height),m.append("line").attr("x1",v-w).attr("x2",v+w).attr("y1",x+w).attr("y2",x+w).attr("stroke-width",2),l==="neo"&&m.attr("filter","url(#drop-shadow)");let C=i.get(t.name)??0;mp.has(u)&&(m.style("stroke",d[C%d.length]),m.style("fill",f[C%d.length]));let T=m.node().getBBox();return t.height=T.height+(r?.sequence?.labelBoxHeight??0),n||(Dn++,p.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn),gp(r,sa(t.description))(t.description,m,y.x,y.y+(n?15:30),y.width,y.height,{class:`actor ${B2}`},r),n?m.attr("transform",`translate(0, ${w})`):(m.attr("transform",`translate(0, ${w/2-5})`),m.attr("data-et","participant"),m.attr("data-type","entity"),m.attr("data-id",t.name)),t.height},"drawActorTypeEntity"),dZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+t.height+2*r.boxTextMargin,{theme:l,themeVariables:u,look:h}=r,{bkgColorArray:f,borderColorArray:d,actorBorder:p}=u,m=e.append("g").lower(),g=m;n||(Dn++,Object.keys(t.links||{}).length&&!r.forceMenus&&g.attr("onclick",bO(`actor${Dn}_popup`)).attr("cursor","pointer"),g.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),g=m.append("g"),t.actorCnt=Dn,t.links!=null&&g.attr("id","root-"+Dn),h==="neo"&&g.attr("data-look","neo"));let y=Xo(),v="actor";t.properties?.class?v=t.properties.class:y.fill="#eaeaea",n?v+=` ${Jg}`:v+=` ${Qg}`,y.x=t.x,y.y=a,y.width=t.width,y.height=t.height,y.class=v,y.name=t.name,y.x=t.x,y.y=a;let x=y.width/3,w=y.width/3,C=x/2,T=C/(2.5+x/50),k=g.append("g");k.attr("class",v);let S=` M ${y.x},${y.y+T} a ${C},${T} 0 0 0 ${x},0 a ${C},${T} 0 0 0 -${x},0 l 0,${w-2*T} a ${C},${T} 0 0 0 ${x},0 l 0,-${w-2*T} -`;k.append("path").attr("d",S),h==="neo"&&k.attr("filter","url(#drop-shadow)");let E=i.get(t.name)??0;mp.has(l)?(k.style("stroke",d[E%d.length]),k.style("fill",f[E%d.length])):k.style("stroke",p),k.attr("transform",`translate(${x}, ${T})`),t.rectData=y,gp(r,sa(t.description))(t.description,g,y.x,y.y+35,y.width,y.height,{class:`actor ${xO}`},r);let I=k.select("path:last-child");if(I.node()){let L=I.node().getBBox();t.height=L.height+(r.sequence.labelBoxHeight??0)}return n||(g.attr("data-et","participant"),g.attr("data-type","database"),g.attr("data-id",t.name)),t.height},"drawActorTypeDatabase"),uZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+80,l=22,u=e.append("g").lower(),{look:h,theme:f,themeVariables:d}=r,{bkgColorArray:p,borderColorArray:m,actorBorder:g}=d;n||(Dn++,u.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn);let y=e.append("g"),v=B2;n?v+=` ${Jg}`:v+=` ${Qg}`,y.attr("class",v),y.attr("name",t.name);let x=Xo();x.x=t.x,x.y=a,x.fill="#eaeaea",x.width=t.width,x.height=t.height,x.class="actor",y.append("line").attr("id","actor-man-torso"+Dn).attr("x1",t.x+t.width/2-l*2.5).attr("y1",a+12).attr("x2",t.x+t.width/2-15).attr("y2",a+12),y.append("line").attr("id","actor-man-arms"+Dn).attr("x1",t.x+t.width/2-l*2.5).attr("y1",a+2).attr("x2",t.x+t.width/2-l*2.5).attr("y2",a+22),y.append("circle").attr("cx",t.x+t.width/2).attr("cy",a+12).attr("r",l),h==="neo"&&y.attr("filter","url(#drop-shadow)");let w=i.get(t.name)??0;mp.has(f)?(y.style("stroke",m[w%m.length]),y.style("fill",p[w%m.length])):y.style("stroke",g);let C=y.node().getBBox();return t.height=C.height+(r.sequence.labelBoxHeight??0),gp(r,sa(t.description))(t.description,y,x.x,x.y+15,x.width,x.height,{class:`actor ${B2}`},r),y.attr("transform",`translate(0,${l/2+10})`),n||(y.attr("data-et","participant"),y.attr("data-type","boundary"),y.attr("data-id",t.name)),t.height},"drawActorTypeBoundary"),hZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+80,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d,actorBorder:p}=h,m=e.append("g").lower();n||(Dn++,m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn);let g=e.append("g"),y=B2;n?y+=` ${Jg}`:y+=` ${Qg}`,g.attr("class",y),g.attr("name",t.name),n||g.attr("data-et","participant").attr("data-type","actor").attr("data-id",t.name);let v=l==="neo"?.5:1,x=l==="neo"?a+(1-v)*30:a;g.append("line").attr("id","actor-man-torso"+Dn).attr("x1",s).attr("y1",x+25*v).attr("x2",s).attr("y2",x+45*v),g.append("line").attr("id","actor-man-arms"+Dn).attr("x1",s-P2/2*v).attr("y1",x+33*v).attr("x2",s+P2/2*v).attr("y2",x+33*v),g.append("line").attr("x1",s-P2/2*v).attr("y1",x+60*v).attr("x2",s).attr("y2",x+45*v),g.append("line").attr("x1",s).attr("y1",x+45*v).attr("x2",s+(P2/2-2)*v).attr("y2",x+60*v);let w=g.append("circle");w.attr("cx",t.x+t.width/2),w.attr("cy",x+10*v),w.attr("r",15*v),w.attr("width",t.width*v),w.attr("height",t.height*v);let C=g.node().getBBox();t.height=C.height;let T=Xo();T.x=t.x,T.y=x,T.fill="#eaeaea",T.width=t.width,T.height=t.height/v,T.class="actor",T.rx=3,T.ry=3;let k=i.get(t.name)??0;return mp.has(u)?(g.style("stroke",d[k%d.length]),g.style("fill",f[k%d.length])):g.style("stroke",p),gp(r,sa(t.description))(t.description,g,T.x,x+35*v-(l==="neo"?10:0),T.width,T.height,{class:`actor ${B2}`},r),t.height},"drawActorTypeActor"),fZt=b(async function(e,t,r,n,i,a,s){let o=s??new Map([...a.db.getActors().values()].map((l,u)=>[l.name,u]));switch(t.type){case"actor":return await hZt(e,t,r,n,o);case"participant":return await iZt(e,t,r,n,o);case"boundary":return await uZt(e,t,r,n,o);case"control":return await oZt(e,t,r,n,i,o);case"entity":return await lZt(e,t,r,n,o);case"database":return await cZt(e,t,r,n,o);case"collections":return await aZt(e,t,r,n,o);case"queue":return await sZt(e,t,r,n,o)}},"drawActor"),dZt=b(function(e,t,r){let i=e.append("g");tZe(i,t),t.name&&gp(r)(t.name,i,t.x,t.y+r.boxTextMargin+(t.textMaxHeight||0)/2,t.width,0,{class:"text"},r),i.lower()},"drawBox"),pZt=b(function(e){return e.append("g")},"anchorElement"),mZt=b(function(e,t,r,n,i,a,s){let{theme:o,themeVariables:l}=n,{bkgColorArray:u,borderColorArray:h,mainBkg:f}=l,d=Xo(),p=t.anchored,m=t.actor;d.x=t.startx,d.y=t.starty,d.class="activation"+i%3,d.width=t.stopx-t.startx,d.height=r-t.starty;let g=N6(p,d),v=(s??new Map([...a.db.getActors().values()].map((x,w)=>[x.name,w]))).get(m)??0;mp.has(o)&&(g.style("stroke",h[v%h.length]),g.style("fill",u[v%h.length]??f))},"drawActivation"),gZt=b(async function(e,t,r,n,i){let{boxMargin:a,boxTextMargin:s,labelBoxHeight:o,labelBoxWidth:l,messageFontFamily:u,messageFontSize:h,messageFontWeight:f}=n,d=e.append("g").attr("data-et","control-structure").attr("data-id","i"+i.id),p=b(function(y,v,x,w){return d.append("line").attr("x1",y).attr("y1",v).attr("x2",x).attr("y2",w).attr("class","loopLine")},"drawLoopLine");p(t.startx,t.starty,t.stopx,t.starty),p(t.stopx,t.starty,t.stopx,t.stopy),p(t.startx,t.stopy,t.stopx,t.stopy),p(t.startx,t.starty,t.startx,t.stopy),t.sections!==void 0&&t.sections.forEach(function(y){p(t.startx,y.y,t.stopx,y.y).style("stroke-dasharray","3, 3")});let m=_I();m.text=r,m.x=t.startx,m.y=t.starty,m.fontFamily=u,m.fontSize=h,m.fontWeight=f,m.anchor="middle",m.valign="middle",m.tspan=!1,m.width=Math.max(l??0,50),m.height=o+(n.look==="neo"?15:0)||20,m.textMargin=s,m.class="labelText",JKe(d,m),m=rZe(),m.text=t.title,m.x=t.startx+l/2+(t.stopx-t.startx)/2,m.y=t.starty+a+s,m.anchor="middle",m.valign="middle",m.textMargin=s,m.class="loopText",m.fontFamily=u,m.fontSize=h,m.fontWeight=f,m.wrap=!0;let g=sa(m.text)?await vO(d,m,t):uk(d,m);if(t.sectionTitles!==void 0){for(let[y,v]of Object.entries(t.sectionTitles))if(v.message){m.text=v.message,m.x=t.startx+(t.stopx-t.startx)/2,m.y=t.sections[y].y+a+s,m.class="sectionTitle",m.anchor="middle",m.valign="middle",m.tspan=!1,m.fontFamily=u,m.fontSize=h,m.fontWeight=f,m.wrap=t.wrap,sa(m.text)?(t.starty=t.sections[y].y,await vO(d,m,t)):uk(d,m);let x=Math.round(g.map(w=>(w._groups||w)[0][0].getBBox().height).reduce((w,C)=>w+C));t.sections[y].height+=x-(a+s)}}return t.height=Math.round(t.stopy-t.starty),d},"drawLoop"),tZe=b(function(e,t){SI(e,t)},"drawBackgroundRect"),yZt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),vZt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),xZt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),bZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",7.9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto-start-reverse").append("path").attr("d","M -1 0 L 10 5 L 0 10 z")},"insertArrowHead"),wZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-filled-head").attr("refX",15.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),kZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertSequenceNumber"),TZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",4.5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},"insertArrowCrossHead"),CZt=b(function(e,t){let{theme:r}=t;e.append("defs").append("filter").attr("id","drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${r==="redux"||r==="redux-color"?"#000000":"#FFFFFF"}`)},"insertDropShadow"),rZe=b(function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},"getTextObj"),SZt=b(function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),gp=(function(){function e(a,s,o,l,u,h,f){let d=s.append("text").attr("x",o+u/2).attr("y",l+h/2+5).style("text-anchor","middle").text(a);i(d,f)}b(e,"byText");function t(a,s,o,l,u,h,f,d){let{actorFontSize:p,actorFontFamily:m,actorFontWeight:g}=d,[y,v]=Zl(p),x=a.split(Ct.lineBreakRegex);for(let w=0;we.height||0))+(this.loops.length===0?0:this.loops.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.messages.length===0?0:this.messages.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.notes.length===0?0:this.notes.map(e=>e.height||0).reduce((e,t)=>e+t))},"getHeight"),clear:b(function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},"clear"),addBox:b(function(e){this.boxes.push(e)},"addBox"),addActor:b(function(e){this.actors.push(e)},"addActor"),addLoop:b(function(e){this.loops.push(e)},"addLoop"),addMessage:b(function(e){this.messages.push(e)},"addMessage"),addNote:b(function(e){this.notes.push(e)},"addNote"),lastActor:b(function(){return this.actors[this.actors.length-1]},"lastActor"),lastLoop:b(function(){return this.loops[this.loops.length-1]},"lastLoop"),lastMessage:b(function(){return this.messages[this.messages.length-1]},"lastMessage"),lastNote:b(function(){return this.notes[this.notes.length-1]},"lastNote"),actors:[],boxes:[],loops:[],messages:[],notes:[]},init:b(function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,aZe(Be())},"init"),updateVal:b(function(e,t,r,n){e[t]===void 0?e[t]=r:e[t]=n(r,e[t])},"updateVal"),updateBounds:b(function(e,t,r,n){let i=this,a=0;function s(o){return b(function(u){a++;let h=i.sequenceItems.length-a+1;i.updateVal(u,"starty",t-h*et.boxMargin,Math.min),i.updateVal(u,"stopy",n+h*et.boxMargin,Math.max),i.updateVal(At.data,"startx",e-h*et.boxMargin,Math.min),i.updateVal(At.data,"stopx",r+h*et.boxMargin,Math.max),o!=="activation"&&(i.updateVal(u,"startx",e-h*et.boxMargin,Math.min),i.updateVal(u,"stopx",r+h*et.boxMargin,Math.max),i.updateVal(At.data,"starty",t-h*et.boxMargin,Math.min),i.updateVal(At.data,"stopy",n+h*et.boxMargin,Math.max))},"updateItemBounds")}b(s,"updateFn"),this.sequenceItems.forEach(s()),this.activations.forEach(s("activation"))},"updateBounds"),insert:b(function(e,t,r,n){let i=Ct.getMin(e,r),a=Ct.getMax(e,r),s=Ct.getMin(t,n),o=Ct.getMax(t,n);this.updateVal(At.data,"startx",i,Math.min),this.updateVal(At.data,"starty",s,Math.min),this.updateVal(At.data,"stopx",a,Math.max),this.updateVal(At.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},"insert"),newActivation:b(function(e,t,r){let n=r.get(e.from),i=wO(e.from).length||0,a=n.x+n.width/2+(i-1)*et.activationWidth/2;this.activations.push({startx:a,starty:this.verticalPos+2,stopx:a+et.activationWidth,stopy:void 0,actor:e.from,anchored:Vi.anchorElement(t)})},"newActivation"),endActivation:b(function(e){let t=this.activations.map(function(r){return r.actor}).lastIndexOf(e.from);return this.activations.splice(t,1)[0]},"endActivation"),createLoop:b(function(e={message:void 0,wrap:!1,width:void 0},t){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:e.message,wrap:e.wrap,width:e.width,height:0,fill:t}},"createLoop"),newLoop:b(function(e={message:void 0,wrap:!1,width:void 0},t){this.sequenceItems.push(this.createLoop(e,t))},"newLoop"),endLoop:b(function(){return this.sequenceItems.pop()},"endLoop"),isLoopOverlap:b(function(){return this.sequenceItems.length?this.sequenceItems[this.sequenceItems.length-1].overlap:!1},"isLoopOverlap"),addSectionToLoop:b(function(e){let t=this.sequenceItems.pop();t.sections=t.sections||[],t.sectionTitles=t.sectionTitles||[],t.sections.push({y:At.getVerticalPos(),height:0}),t.sectionTitles.push(e),this.sequenceItems.push(t)},"addSectionToLoop"),saveVerticalPos:b(function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},"saveVerticalPos"),resetVerticalPos:b(function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},"resetVerticalPos"),bumpVerticalPos:b(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=Ct.getMax(this.data.stopy,this.verticalPos)},"bumpVerticalPos"),getVerticalPos:b(function(){return this.verticalPos},"getVerticalPos"),getBounds:b(function(){return{bounds:this.data,models:this.models}},"getBounds")},IZt=b(async function(e,t,r){At.bumpVerticalPos(et.boxMargin),t.height=et.boxMargin,t.starty=At.getVerticalPos();let n=Xo();n.x=t.startx,n.y=t.starty,n.width=t.width||et.width,n.class="note";let i=e.append("g");i.attr("data-et","note"),i.attr("data-id","i"+r);let a=Vi.drawRect(i,n),s=_I();s.x=t.startx,s.y=t.starty,s.width=n.width,s.dy="1em",s.text=t.message,s.class="noteText",s.fontFamily=et.noteFontFamily,s.fontSize=et.noteFontSize,s.fontWeight=et.noteFontWeight,s.anchor=et.noteAlign,s.textMargin=et.noteMargin,s.valign="center";let o=sa(s.text)?await vO(i,s):uk(i,s),l=Math.round(o.map(u=>(u._groups||u)[0][0].getBBox().height).reduce((u,h)=>u+h));a.attr("height",l+2*et.noteMargin),t.height+=l+2*et.noteMargin,At.bumpVerticalPos(l+2*et.noteMargin),t.stopy=t.starty+l+2*et.noteMargin,t.stopx=t.startx+n.width,At.insert(t.startx,t.starty,t.stopx,t.stopy),At.models.addNote(t)},"drawNote"),ZKe=b(function(e,t,r,n,i,a,s){let o=n.db.getActors(),l=o.get(t.from),u=o.get(t.to),h=r.sequenceVisible,f=l.x+l.width/2,d=u.x+u.width/2,p=f<=d,m=cZe(t,n),g=e.append("g"),y=16.5,v=b((k,S)=>{let E=k?y:-y;return S?-E:E},"getCircleOffset"),x=b(k=>{g.append("circle").attr("cx",k).attr("cy",s).attr("r",5).attr("width",10).attr("height",10)},"drawCircle"),{CENTRAL_CONNECTION:w,CENTRAL_CONNECTION_REVERSE:C,CENTRAL_CONNECTION_DUAL:T}=n.db.LINETYPE;if(h)switch(t.centralConnection){case w:m&&(d+=v(p,!0));break;case C:m||(f+=v(p,!1));break;case T:m?d+=v(p,!0):f+=v(p,!1);break}switch(t.centralConnection){case w:x(d);break;case C:x(f);break;case T:x(f),x(d);break}},"drawCentralConnection"),F2=b(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont"),ck=b(e=>({fontFamily:e.noteFontFamily,fontSize:e.noteFontSize,fontWeight:e.noteFontWeight}),"noteFont"),nae=b(e=>({fontFamily:e.actorFontFamily,fontSize:e.actorFontSize,fontWeight:e.actorFontWeight}),"actorFont");b(nZe,"boundMessage");MZt=b(async function(e,t,r,n,i,a){let{startx:s,stopx:o,starty:l,message:u,type:h,sequenceIndex:f,sequenceVisible:d}=t,p=pr.calculateTextDimensions(u,F2(et)),m=_I();m.x=Math.min(s,o),m.y=l+10,m.width=Math.abs(o-s),m.class="messageText",m.dy="1em",m.text=u,m.fontFamily=et.messageFontFamily,m.fontSize=et.messageFontSize,m.fontWeight=et.messageFontWeight,m.anchor=et.messageAlign,m.valign="center",m.textMargin=et.wrapPadding,m.tspan=!1,sa(m.text)?await vO(e,m,{startx:s,stopx:o,starty:r}):uk(e,m);let g=p.width,y;if(s===o){let x=d||et.showSequenceNumbers,w=cZe(i,n),C=zZt(i,n),T=s+(x&&(w||C)?10:0);et.rightAngles?y=e.append("path").attr("d",`M ${T},${r} H ${s+Ct.getMax(et.width/2,g/2)} V ${r+25} H ${s}`):y=e.append("path").attr("d","M "+T+","+r+" C "+(T+60)+","+(r-10)+" "+(s+60)+","+(r+30)+" "+s+","+(r+20)),tae(i,n)&&ZKe(e,i,t,n,s,o,r)}else y=e.append("line"),y.attr("x1",s),y.attr("y1",r),y.attr("x2",o),y.attr("y2",r),tae(i,n)&&ZKe(e,i,t,n,s,o,r);h===n.db.LINETYPE.DOTTED||h===n.db.LINETYPE.DOTTED_CROSS||h===n.db.LINETYPE.DOTTED_POINT||h===n.db.LINETYPE.DOTTED_OPEN||h===n.db.LINETYPE.BIDIRECTIONAL_DOTTED||h===n.db.LINETYPE.SOLID_TOP_DOTTED||h===n.db.LINETYPE.SOLID_BOTTOM_DOTTED||h===n.db.LINETYPE.STICK_TOP_DOTTED||h===n.db.LINETYPE.STICK_BOTTOM_DOTTED||h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED?(y.style("stroke-dasharray","3, 3"),y.attr("class","messageLine1")):y.attr("class","messageLine0"),y.attr("data-et","message"),y.attr("data-id","i"+t.id),y.attr("data-from",t.from),y.attr("data-to",t.to);let v="";if(et.arrowMarkerAbsolute&&(v=gy(!0)),y.attr("stroke-width",2),y.attr("stroke","none"),y.style("fill","none"),(h===n.db.LINETYPE.SOLID_TOP||h===n.db.LINETYPE.SOLID_TOP_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-solidTopArrowHead)"),(h===n.db.LINETYPE.SOLID_BOTTOM||h===n.db.LINETYPE.SOLID_BOTTOM_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-solidBottomArrowHead)"),(h===n.db.LINETYPE.STICK_TOP||h===n.db.LINETYPE.STICK_TOP_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-stickTopArrowHead)"),(h===n.db.LINETYPE.STICK_BOTTOM||h===n.db.LINETYPE.STICK_BOTTOM_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-stickBottomArrowHead)"),(h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-solidBottomArrowHead)"),(h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-solidTopArrowHead)"),(h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-stickBottomArrowHead)"),(h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-stickTopArrowHead)"),(h===n.db.LINETYPE.SOLID||h===n.db.LINETYPE.DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-arrowhead)"),(h===n.db.LINETYPE.BIDIRECTIONAL_SOLID||h===n.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(y.attr("marker-start","url("+v+"#"+a+"-arrowhead)"),y.attr("marker-end","url("+v+"#"+a+"-arrowhead)")),(h===n.db.LINETYPE.SOLID_POINT||h===n.db.LINETYPE.DOTTED_POINT)&&y.attr("marker-end","url("+v+"#"+a+"-filled-head)"),(h===n.db.LINETYPE.SOLID_CROSS||h===n.db.LINETYPE.DOTTED_CROSS)&&y.attr("marker-end","url("+v+"#"+a+"-crosshead)"),d||et.showSequenceNumbers){let x=h===n.db.LINETYPE.BIDIRECTIONAL_SOLID||h===n.db.LINETYPE.BIDIRECTIONAL_DOTTED,w=h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,C=6,T=tae(i,n),k=s,S=o;x?(ss?S=o-2*C:(S=o-C,k+=i?.centralConnection===n.db.LINETYPE.CENTRAL_CONNECTION_DUAL||i?.centralConnection===n.db.LINETYPE.CENTRAL_CONNECTION_REVERSE?-7.5:0),S+=T?15:0,y.attr("x2",S),y.attr("x1",k)):y.attr("x1",s+C);let E=0,I=s===o,L=s<=o;I?E=t.fromBounds+1:w?E=L?t.toBounds-1:t.fromBounds+1:E=L?t.fromBounds+1:t.toBounds-1;let O="12px",R=f.toString().length;R>5?O="7px":R>3&&(O="9px"),e.append("line").attr("x1",E).attr("y1",r).attr("x2",E).attr("y2",r).attr("stroke-width",0).attr("marker-start","url("+v+"#"+a+"-sequencenumber)"),e.append("text").attr("x",E).attr("y",r+4).attr("font-family","sans-serif").attr("font-size",O).attr("text-anchor","middle").attr("class","sequenceNumber").text(f)}},"drawMessage"),NZt=b(function(e,t,r,n,i,a,s){let o=0,l=0,u,h=0;for(let f of n){let d=t.get(f),p=d.box;u&&u!=p&&(s||At.models.addBox(u),l+=et.boxMargin+u.margin),p&&p!=u&&(s||(p.x=o+l,p.y=i),l+=p.margin),d.width=Ct.getMax(d.width||et.width,et.width),d.height=Ct.getMax(d.height||et.height,et.height),d.margin=d.margin||et.actorMargin,h=Ct.getMax(h,d.height),r.get(d.name)&&(l+=d.width/2),d.x=o+l,d.starty=At.getVerticalPos(),At.insert(d.x,i,d.x+d.width,d.height),o+=d.width+l,d.box&&(d.box.width=o+p.margin-d.box.x),l=d.margin,u=d.box,At.models.addActor(d)}u&&!s&&At.models.addBox(u),At.bumpVerticalPos(h)},"addActorRenderingData"),iae=b(async function(e,t,r,n,i,a,s){if(n){let o=0;At.bumpVerticalPos(et.boxMargin*2);for(let l of r){let u=t.get(l);u.stopy||(u.stopy=At.getVerticalPos());let h=await Vi.drawActor(e,u,et,!0,i,a,s);o=Ct.getMax(o,h)}At.bumpVerticalPos(o+et.boxMargin)}else for(let o of r){let l=t.get(o);await Vi.drawActor(e,l,et,!1,i,a,s)}},"drawActors"),iZe=b(function(e,t,r,n){let i=0,a=0;for(let s of r){let o=t.get(s),l=OZt(o),u=Vi.drawPopup(e,o,l,et,et.forceMenus,n);u.height>i&&(i=u.height),u.width+o.x>a&&(a=u.width+o.x)}return{maxHeight:i,maxWidth:a}},"drawActorsPopup"),aZe=b(function(e){Xi(et,e),e.fontFamily&&(et.actorFontFamily=et.noteFontFamily=et.messageFontFamily=e.fontFamily),e.fontSize&&(et.actorFontSize=et.noteFontSize=et.messageFontSize=e.fontSize),e.fontWeight&&(et.actorFontWeight=et.noteFontWeight=et.messageFontWeight=e.fontWeight)},"setConf"),wO=b(function(e){return At.activations.filter(function(t){return t.actor===e})},"actorActivations"),QKe=b(function(e,t){let r=t.get(e),n=wO(e),i=n.reduce(function(s,o){return Ct.getMin(s,o.startx)},r.x+r.width/2-1),a=n.reduce(function(s,o){return Ct.getMax(s,o.stopx)},r.x+r.width/2+1);return[i,a]},"activationBounds");b($h,"adjustLoopHeightForWrap");b(sZe,"adjustCreatedDestroyedData");DZt=b(async function(e,t,r,n){let{securityLevel:i,sequence:a,look:s,themeVariables:o}=Be();et=a;let l;i==="sandbox"&&(l=ct("#i"+t));let u=i==="sandbox"?ct(l.nodes()[0].contentDocument.body):ct("body"),h=i==="sandbox"?l.nodes()[0].contentDocument:document;At.init(),se.debug(n.db);let f=i==="sandbox"?u.select(`[id="${t}"]`):ct(`[id="${t}"]`),d=n.db.getActors(),p=n.db.getCreatedActors(),m=n.db.getDestroyedActors(),g=n.db.getBoxes(),y=n.db.getActorKeys(),v=n.db.getMessages(),x=n.db.getDiagramTitle(),w=n.db.hasAtLeastOneBox(),C=n.db.hasAtLeastOneBoxWithTitle(),T=await oZe(d,v,n);if(et.height=await lZe(d,T,g),Vi.insertComputerIcon(f,t),Vi.insertDatabaseIcon(f,t),Vi.insertClockIcon(f,t),w&&(At.bumpVerticalPos(et.boxMargin),C&&At.bumpVerticalPos(g[0].textMaxHeight)),et.hideUnusedParticipants===!0){let G=new Set;v.forEach(z=>{G.add(z.from),G.add(z.to)}),y=y.filter(z=>G.has(z))}let k=new Map(y.map((G,z)=>[d.get(G)?.name??G,z]));NZt(f,d,p,y,0,v,!1);let S=await qZt(v,d,T,n);Vi.insertArrowHead(f,t),Vi.insertArrowCrossHead(f,t),Vi.insertArrowFilledHead(f,t),Vi.insertSequenceNumber(f,t),Vi.insertSolidTopArrowHead(f,t),Vi.insertSolidBottomArrowHead(f,t),Vi.insertStickTopArrowHead(f,t),Vi.insertStickBottomArrowHead(f,t),s==="neo"&&Vi.insertDropShadow(f,et);function E(G,z){let H=At.endActivation(G);H.starty+18>z&&(H.starty=z-6,z+=12),Vi.drawActivation(f,H,z,et,wO(G.from).length,n,k),At.insert(H.startx,z-10,H.stopx,z)}b(E,"activeEnd");let I=1,L=1,O=[],R=[],A=0;for(let G of v){let z,H,j;switch(G.type){case n.db.LINETYPE.NOTE:At.resetVerticalPos(),H=G.noteModel,await IZt(f,H,G.id);break;case n.db.LINETYPE.ACTIVE_START:At.newActivation(G,f,d);break;case n.db.LINETYPE.CENTRAL_CONNECTION:At.newActivation(G,f,d);break;case n.db.LINETYPE.CENTRAL_CONNECTION_REVERSE:At.newActivation(G,f,d);break;case n.db.LINETYPE.ACTIVE_END:E(G,At.getVerticalPos());break;case n.db.LINETYPE.LOOP_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.LOOP_END:z=At.endLoop(),await Vi.drawLoop(f,z,"loop",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.RECT_START:$h(S,G,et.boxMargin,et.boxMargin,J=>{let U=J.message;U||(U=o?.rectBkgColor||o?.actorBkg||"rgba(128, 128, 128, 0.5)"),At.newLoop(void 0,U)});break;case n.db.LINETYPE.RECT_END:z=At.endLoop(),R.push(z),At.models.addLoop(z),At.bumpVerticalPos(z.stopy-At.getVerticalPos());break;case n.db.LINETYPE.OPT_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.OPT_END:z=At.endLoop(),await Vi.drawLoop(f,z,"opt",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.ALT_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.ALT_ELSE:$h(S,G,et.boxMargin+et.boxTextMargin,et.boxMargin,J=>At.addSectionToLoop(J));break;case n.db.LINETYPE.ALT_END:z=At.endLoop(),await Vi.drawLoop(f,z,"alt",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.PAR_START:case n.db.LINETYPE.PAR_OVER_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J)),At.saveVerticalPos();break;case n.db.LINETYPE.PAR_AND:$h(S,G,et.boxMargin+et.boxTextMargin,et.boxMargin,J=>At.addSectionToLoop(J));break;case n.db.LINETYPE.PAR_END:z=At.endLoop(),await Vi.drawLoop(f,z,"par",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.AUTONUMBER:I=G.message.start||I,L=G.message.step||L,G.message.visible?n.db.enableSequenceNumbers():n.db.disableSequenceNumbers();break;case n.db.LINETYPE.CRITICAL_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.CRITICAL_OPTION:$h(S,G,et.boxMargin+et.boxTextMargin,et.boxMargin,J=>At.addSectionToLoop(J));break;case n.db.LINETYPE.CRITICAL_END:z=At.endLoop(),await Vi.drawLoop(f,z,"critical",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.BREAK_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.BREAK_END:z=At.endLoop(),await Vi.drawLoop(f,z,"break",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;default:try{j=G.msgModel,j.starty=At.getVerticalPos(),j.sequenceIndex=I,j.sequenceVisible=n.db.showSequenceNumbers(),j.id=G.id,j.from=G.from,j.to=G.to;let J=await nZe(f,j);sZe(G,j,J,A,d,p,m),O.push({messageModel:j,lineStartY:J,msg:G}),At.models.addMessage(j)}catch(J){se.error("error while drawing message",J)}}[n.db.LINETYPE.SOLID_OPEN,n.db.LINETYPE.DOTTED_OPEN,n.db.LINETYPE.SOLID,n.db.LINETYPE.SOLID_TOP,n.db.LINETYPE.SOLID_BOTTOM,n.db.LINETYPE.STICK_TOP,n.db.LINETYPE.STICK_BOTTOM,n.db.LINETYPE.SOLID_TOP_DOTTED,n.db.LINETYPE.SOLID_BOTTOM_DOTTED,n.db.LINETYPE.STICK_TOP_DOTTED,n.db.LINETYPE.STICK_BOTTOM_DOTTED,n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,n.db.LINETYPE.STICK_ARROW_TOP_REVERSE,n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,n.db.LINETYPE.DOTTED,n.db.LINETYPE.SOLID_CROSS,n.db.LINETYPE.DOTTED_CROSS,n.db.LINETYPE.SOLID_POINT,n.db.LINETYPE.DOTTED_POINT,n.db.LINETYPE.BIDIRECTIONAL_SOLID,n.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(G.type)&&(I=Math.round((I+L)*100)/100),A++}se.debug("createdActors",p),se.debug("destroyedActors",m),await iae(f,d,y,!1,t,n,k);for(let G of O)await MZt(f,G.messageModel,G.lineStartY,n,G.msg,t);et.mirrorActors&&await iae(f,d,y,!0,t,n,k),R.forEach(G=>Vi.drawBackgroundRect(f,G)),eZe(f,d,y,et);for(let G of At.models.boxes){G.height=At.getVerticalPos()-G.y,At.insert(G.x,G.y,G.x+G.width,G.height);let z=et.boxMargin*2;G.startx=G.x-z,G.starty=G.y-z*.25,G.stopx=G.startx+G.width+2*z,G.stopy=G.starty+G.height+z*.75,G.stroke="rgb(0,0,0, 0.5)",Vi.drawBox(f,G,et)}w&&At.bumpVerticalPos(et.boxMargin);let N=iZe(f,d,y,h),{bounds:M}=At.getBounds();M.startx===void 0&&(M.startx=0),M.starty===void 0&&(M.starty=0),M.stopx===void 0&&(M.stopx=0),M.stopy===void 0&&(M.stopy=0);let D=M.stopy-M.starty;D2,d=b(y=>l?-y:y,"adjustValue");e.from===e.to?h=u:(e.activate&&!f&&(h+=d(et.activationWidth/2-1)),[r.db.LINETYPE.SOLID_OPEN,r.db.LINETYPE.DOTTED_OPEN,r.db.LINETYPE.STICK_TOP,r.db.LINETYPE.STICK_BOTTOM,r.db.LINETYPE.STICK_TOP_DOTTED,r.db.LINETYPE.STICK_BOTTOM_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.STICK_ARROW_TOP_REVERSE,r.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,r.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE].includes(e.type)||(h+=d(3)),[r.db.LINETYPE.BIDIRECTIONAL_SOLID,r.db.LINETYPE.BIDIRECTIONAL_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE].includes(e.type)&&(u-=d(3)));let p=[i,a,s,o],m=Math.abs(u-h);e.wrap&&e.message&&(e.message=pr.wrapLabel(e.message,Ct.getMax(m+2*et.wrapPadding,et.width),F2(et)));let g=pr.calculateTextDimensions(e.message,F2(et));return{width:Ct.getMax(e.wrap?0:g.width+2*et.wrapPadding,m+2*et.wrapPadding,et.width),height:0,startx:u,stopx:h,starty:0,stopy:0,message:e.message,type:e.type,wrap:e.wrap,fromBounds:Math.min.apply(null,p),toBounds:Math.max.apply(null,p)}},"buildMessageModel"),qZt=b(async function(e,t,r,n){let i={},a=[],s,o,l;for(let u of e){switch(u.type){case n.db.LINETYPE.LOOP_START:case n.db.LINETYPE.ALT_START:case n.db.LINETYPE.OPT_START:case n.db.LINETYPE.PAR_START:case n.db.LINETYPE.PAR_OVER_START:case n.db.LINETYPE.CRITICAL_START:case n.db.LINETYPE.BREAK_START:a.push({id:u.id,msg:u.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case n.db.LINETYPE.ALT_ELSE:case n.db.LINETYPE.PAR_AND:case n.db.LINETYPE.CRITICAL_OPTION:u.message&&(s=a.pop(),i[s.id]=s,i[u.id]=s,a.push(s));break;case n.db.LINETYPE.LOOP_END:case n.db.LINETYPE.ALT_END:case n.db.LINETYPE.OPT_END:case n.db.LINETYPE.PAR_END:case n.db.LINETYPE.CRITICAL_END:case n.db.LINETYPE.BREAK_END:s=a.pop(),i[s.id]=s;break;case n.db.LINETYPE.ACTIVE_START:{let f=t.get(u.from?u.from:u.to.actor),d=wO(u.from?u.from:u.to.actor).length,p=f.x+f.width/2+(d-1)*et.activationWidth/2,m={startx:p,stopx:p+et.activationWidth,actor:u.from,enabled:!0};At.activations.push(m)}break;case n.db.LINETYPE.ACTIVE_END:{let f=At.activations.map(d=>d.actor).lastIndexOf(u.from);At.activations.splice(f,1).splice(0,1)}break}u.placement!==void 0?(o=await PZt(u,t,n),u.noteModel=o,a.forEach(f=>{s=f,s.from=Ct.getMin(s.from,o.startx),s.to=Ct.getMax(s.to,o.startx+o.width),s.width=Ct.getMax(s.width,Math.abs(s.from-s.to))-et.labelBoxWidth})):(l=GZt(u,t,n),u.msgModel=l,l.startx&&l.stopx&&a.length>0&&a.forEach(f=>{if(s=f,l.startx===l.stopx){let d=t.get(u.from),p=t.get(u.to);s.from=Ct.getMin(d.x-l.width/2,d.x-d.width/2,s.from),s.to=Ct.getMax(p.x+l.width/2,p.x+d.width/2,s.to),s.width=Ct.getMax(s.width,Math.abs(s.to-s.from))-et.labelBoxWidth}else s.from=Ct.getMin(l.startx,s.from),s.to=Ct.getMax(l.stopx,s.to),s.width=Ct.getMax(s.width,l.width)-et.labelBoxWidth}))}return At.activations=[],se.debug("Loop type widths:",i),i},"calculateLoopBounds"),VZt={bounds:At,drawActors:iae,drawActorsPopup:iZe,setConf:aZe,draw:DZt},WZt={parser:KKt,get db(){return new eZt},renderer:VZt,styles:rZt,init:b(e=>{e.sequence||(e.sequence={}),e.wrap&&(e.sequence.wrap=e.wrap,P5({sequence:{wrap:e.wrap}}))},"init")}});var sae,TO,fZe,dZe,kO,pZe,$2,CO,HZt,SO,UZt,YZt,XZt,EO,lae=W(()=>{ad();Uc();oc();ic();Hc();Sn();_r();Rr();hr();fn();xb();sae=(function(){var e=b(function(ge,Ie,ye,ne){for(ye=ye||{},ne=ge.length;ne--;ye[ge[ne]]=Ie);return ye},"o"),t=[1,18],r=[1,19],n=[1,20],i=[1,41],a=[1,26],s=[1,42],o=[1,24],l=[1,25],u=[1,32],h=[1,33],f=[1,34],d=[1,45],p=[1,35],m=[1,36],g=[1,37],y=[1,38],v=[1,27],x=[1,28],w=[1,29],C=[1,30],T=[1,31],k=[1,44],S=[1,46],E=[1,43],I=[1,47],L=[1,9],O=[1,8,9],R=[1,58],A=[1,59],N=[1,60],M=[1,61],D=[1,62],B=[1,63],P=[1,64],$=[1,8,9,41],F=[1,77],q=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],G=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],z=[13,60,86,100,102,103],H=[13,60,73,74,86,100,102,103],j=[13,60,68,69,70,71,72,86,100,102,103],J=[1,103],U=[1,121],le=[1,117],ee=[1,113],ue=[1,119],ae=[1,114],oe=[1,115],Re=[1,116],Te=[1,118],Oe=[1,120],qe=[22,50,60,61,82,86,87,88,89,90],Ge=[1,128],fe=[12,39],Ce=[1,8,9,39,41,44,46],_e=[1,8,9,22],de=[1,153],ie=[1,8,9,61],Q=[1,8,9,22,50,60,61,82,86,87,88,89,90],he={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:b(function(Ie,ye,ne,V,pe,K,ve){var Z=K.length-1;switch(pe){case 8:this.$=K[Z-1];break;case 9:case 10:case 13:case 15:this.$=K[Z];break;case 11:case 14:this.$=K[Z-2]+"."+K[Z];break;case 12:case 16:this.$=K[Z-1]+K[Z];break;case 17:case 18:this.$=K[Z-1]+"~"+K[Z]+"~";break;case 19:V.addRelation(K[Z]);break;case 20:K[Z-1].title=V.cleanupLabel(K[Z]),V.addRelation(K[Z-1]);break;case 31:this.$=K[Z].trim(),V.setAccTitle(this.$);break;case 32:case 33:this.$=K[Z].trim(),V.setAccDescription(this.$);break;case 34:V.addClassesToNamespace(K[Z-3],K[Z-1][0],K[Z-1][1]),V.popNamespace();break;case 35:V.addClassesToNamespace(K[Z-4],K[Z-1][0],K[Z-1][1]),V.popNamespace();break;case 36:this.$=V.addNamespace(K[Z]);break;case 37:this.$=V.addNamespace(K[Z-1],K[Z]);break;case 38:this.$=[[K[Z]],[]];break;case 39:this.$=[[K[Z-1]],[]];break;case 40:K[Z][0].unshift(K[Z-2]),this.$=K[Z];break;case 41:this.$=[[],[K[Z]]];break;case 42:this.$=[[],[K[Z-1]]];break;case 43:K[Z][1].unshift(K[Z-2]),this.$=K[Z];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=K[Z];break;case 48:V.setCssClass(K[Z-2],K[Z]);break;case 49:V.addMembers(K[Z-3],K[Z-1]);break;case 51:V.setCssClass(K[Z-5],K[Z-3]),V.addMembers(K[Z-5],K[Z-1]);break;case 52:V.addAnnotation(K[Z-3],K[Z-1]);break;case 53:V.addAnnotation(K[Z-6],K[Z-4]),V.addMembers(K[Z-6],K[Z-1]);break;case 54:V.addAnnotation(K[Z-5],K[Z-3]);break;case 55:this.$=K[Z],V.addClass(K[Z]);break;case 56:this.$=K[Z-1],V.addClass(K[Z-1]),V.setClassLabel(K[Z-1],K[Z]);break;case 60:V.addAnnotation(K[Z],K[Z-2]);break;case 61:case 74:this.$=[K[Z]];break;case 62:K[Z].push(K[Z-1]),this.$=K[Z];break;case 63:break;case 64:V.addMember(K[Z-1],V.cleanupLabel(K[Z]));break;case 65:break;case 66:break;case 67:this.$={id1:K[Z-2],id2:K[Z],relation:K[Z-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:K[Z-3],id2:K[Z],relation:K[Z-1],relationTitle1:K[Z-2],relationTitle2:"none"};break;case 69:this.$={id1:K[Z-3],id2:K[Z],relation:K[Z-2],relationTitle1:"none",relationTitle2:K[Z-1]};break;case 70:this.$={id1:K[Z-4],id2:K[Z],relation:K[Z-2],relationTitle1:K[Z-3],relationTitle2:K[Z-1]};break;case 71:this.$=V.addNote(K[Z],K[Z-1]);break;case 72:this.$=V.addNote(K[Z]);break;case 73:this.$=K[Z-2],V.defineClass(K[Z-1],K[Z]);break;case 75:this.$=K[Z-2].concat([K[Z]]);break;case 76:V.setDirection("TB");break;case 77:V.setDirection("BT");break;case 78:V.setDirection("RL");break;case 79:V.setDirection("LR");break;case 80:this.$={type1:K[Z-2],type2:K[Z],lineType:K[Z-1]};break;case 81:this.$={type1:"none",type2:K[Z],lineType:K[Z-1]};break;case 82:this.$={type1:K[Z-1],type2:"none",lineType:K[Z]};break;case 83:this.$={type1:"none",type2:"none",lineType:K[Z]};break;case 84:this.$=V.relationType.AGGREGATION;break;case 85:this.$=V.relationType.EXTENSION;break;case 86:this.$=V.relationType.COMPOSITION;break;case 87:this.$=V.relationType.DEPENDENCY;break;case 88:this.$=V.relationType.LOLLIPOP;break;case 89:this.$=V.lineType.LINE;break;case 90:this.$=V.lineType.DOTTED_LINE;break;case 91:case 97:this.$=K[Z-2],V.setClickEvent(K[Z-1],K[Z]);break;case 92:case 98:this.$=K[Z-3],V.setClickEvent(K[Z-2],K[Z-1]),V.setTooltip(K[Z-2],K[Z]);break;case 93:this.$=K[Z-2],V.setLink(K[Z-1],K[Z]);break;case 94:this.$=K[Z-3],V.setLink(K[Z-2],K[Z-1],K[Z]);break;case 95:this.$=K[Z-3],V.setLink(K[Z-2],K[Z-1]),V.setTooltip(K[Z-2],K[Z]);break;case 96:this.$=K[Z-4],V.setLink(K[Z-3],K[Z-2],K[Z]),V.setTooltip(K[Z-3],K[Z-1]);break;case 99:this.$=K[Z-3],V.setClickEvent(K[Z-2],K[Z-1],K[Z]);break;case 100:this.$=K[Z-4],V.setClickEvent(K[Z-3],K[Z-2],K[Z-1]),V.setTooltip(K[Z-3],K[Z]);break;case 101:this.$=K[Z-3],V.setLink(K[Z-2],K[Z]);break;case 102:this.$=K[Z-4],V.setLink(K[Z-3],K[Z-1],K[Z]);break;case 103:this.$=K[Z-4],V.setLink(K[Z-3],K[Z-1]),V.setTooltip(K[Z-3],K[Z]);break;case 104:this.$=K[Z-5],V.setLink(K[Z-4],K[Z-2],K[Z]),V.setTooltip(K[Z-4],K[Z-1]);break;case 105:this.$=K[Z-2],V.setCssStyle(K[Z-1],K[Z]);break;case 106:V.setCssClass(K[Z-1],K[Z]);break;case 107:this.$=[K[Z]];break;case 108:K[Z-2].push(K[Z]),this.$=K[Z-2];break;case 110:this.$=K[Z-1]+K[Z];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:t,35:r,37:n,38:22,42:i,43:23,46:a,48:s,51:o,52:l,54:u,56:h,57:f,60:d,62:p,63:m,64:g,65:y,75:v,76:x,78:w,82:C,83:T,86:k,100:S,102:E,103:I},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},e(L,[2,5],{8:[1,48]}),{8:[1,49]},e(O,[2,19],{22:[1,50]}),e(O,[2,21]),e(O,[2,22]),e(O,[2,23]),e(O,[2,24]),e(O,[2,25]),e(O,[2,26]),e(O,[2,27]),e(O,[2,28]),e(O,[2,29]),e(O,[2,30]),{34:[1,51]},{36:[1,52]},e(O,[2,33]),e(O,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:R,69:A,70:N,71:M,72:D,73:B,74:P}),{39:[1,65]},e($,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),e(O,[2,65]),e(O,[2,66]),{16:69,60:d,86:k,100:S,102:E},{16:39,17:40,19:70,60:d,86:k,100:S,102:E,103:I},{16:39,17:40,19:71,60:d,86:k,100:S,102:E,103:I},{16:39,17:40,19:72,60:d,86:k,100:S,102:E,103:I},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:d,86:k,100:S,102:E,103:I},{13:F,55:76},{58:78,60:[1,79]},e(O,[2,76]),e(O,[2,77]),e(O,[2,78]),e(O,[2,79]),e(q,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:d,86:k,100:S,102:E,103:I}),e(q,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:d,86:k,100:S,102:E,103:I},{16:39,17:40,19:87,60:d,86:k,100:S,102:E,103:I},e(G,[2,133]),e(G,[2,134]),e(G,[2,135]),e(G,[2,136]),e([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),e(L,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:t,35:r,37:n,42:i,46:a,48:s,51:o,52:l,54:u,56:h,57:f,60:d,62:p,63:m,64:g,65:y,75:v,76:x,78:w,82:C,83:T,86:k,100:S,102:E,103:I}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:t,35:r,37:n,38:22,42:i,43:23,46:a,48:s,51:o,52:l,54:u,56:h,57:f,60:d,62:p,63:m,64:g,65:y,75:v,76:x,78:w,82:C,83:T,86:k,100:S,102:E,103:I},e(O,[2,20]),e(O,[2,31]),e(O,[2,32]),{13:[1,91],16:39,17:40,19:90,60:d,86:k,100:S,102:E,103:I},{53:92,66:56,67:57,68:R,69:A,70:N,71:M,72:D,73:B,74:P},e(O,[2,64]),{67:93,73:B,74:P},e(z,[2,83],{66:94,68:R,69:A,70:N,71:M,72:D}),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(j,[2,89]),e(j,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:i,43:23,48:s,54:u,56:h},{16:100,60:d,86:k,100:S,102:E},{41:[1,102],45:101,51:J},{16:104,60:d,86:k,100:S,102:E},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:U,50:le,59:110,60:ee,82:ue,84:111,85:112,86:ae,87:oe,88:Re,89:Te,90:Oe},{60:[1,122]},{13:F,55:123},e($,[2,72]),e($,[2,138]),{22:U,50:le,59:124,60:ee,61:[1,125],82:ue,84:111,85:112,86:ae,87:oe,88:Re,89:Te,90:Oe},e(qe,[2,74]),{16:39,17:40,19:126,60:d,86:k,100:S,102:E,103:I},e(q,[2,16]),e(q,[2,17]),e(q,[2,18]),{11:127,12:Ge,39:[2,36]},e(fe,[2,9],{16:85,17:86,15:130,18:[1,129],60:d,86:k,100:S,102:E,103:I}),e(fe,[2,10]),e(Ce,[2,55],{11:131,12:Ge}),e(L,[2,7]),{9:[1,132]},e(_e,[2,67]),{16:39,17:40,19:133,60:d,86:k,100:S,102:E,103:I},{13:[1,135],16:39,17:40,19:134,60:d,86:k,100:S,102:E,103:I},e(z,[2,82],{66:136,68:R,69:A,70:N,71:M,72:D}),e(z,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:i,43:23,48:s,54:u,56:h},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},e($,[2,48],{39:[1,142]}),{41:[1,143]},e($,[2,50]),{41:[2,61],45:144,51:J},{47:[1,145]},{16:39,17:40,19:146,60:d,86:k,100:S,102:E,103:I},e(O,[2,91],{13:[1,147]}),e(O,[2,93],{13:[1,149],77:[1,148]}),e(O,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},e(O,[2,105],{61:de}),e(ie,[2,107],{85:154,22:U,50:le,60:ee,82:ue,86:ae,87:oe,88:Re,89:Te,90:Oe}),e(Q,[2,109]),e(Q,[2,111]),e(Q,[2,112]),e(Q,[2,113]),e(Q,[2,114]),e(Q,[2,115]),e(Q,[2,116]),e(Q,[2,117]),e(Q,[2,118]),e(Q,[2,119]),e(O,[2,106]),e($,[2,71]),e(O,[2,73],{61:de}),{60:[1,155]},e(q,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:d,86:k,100:S,102:E,103:I},e(fe,[2,12]),e(Ce,[2,56]),{1:[2,4]},e(_e,[2,69]),e(_e,[2,68]),{16:39,17:40,19:158,60:d,86:k,100:S,102:E,103:I},e(z,[2,80]),e($,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:i,43:23,48:s,54:u,56:h},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:i,43:23,48:s,54:u,56:h},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:i,43:23,48:s,54:u,56:h},{45:163,51:J},e($,[2,49]),{41:[2,62]},e($,[2,52],{39:[1,164]}),e(O,[2,60]),e(O,[2,92]),e(O,[2,94]),e(O,[2,95],{77:[1,165]}),e(O,[2,98]),e(O,[2,99],{13:[1,166]}),e(O,[2,101],{13:[1,168],77:[1,167]}),{22:U,50:le,60:ee,82:ue,84:169,85:112,86:ae,87:oe,88:Re,89:Te,90:Oe},e(Q,[2,110]),e(qe,[2,75]),{14:[1,170]},e(fe,[2,11]),e(_e,[2,70]),e($,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:J},e(O,[2,96]),e(O,[2,100]),e(O,[2,102]),e(O,[2,103],{77:[1,174]}),e(ie,[2,108],{85:154,22:U,50:le,60:ee,82:ue,86:ae,87:oe,88:Re,89:Te,90:Oe}),e(Ce,[2,8]),e($,[2,51]),{41:[1,175]},e($,[2,54]),e(O,[2,104]),e($,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:b(function(Ie,ye){if(ye.recoverable)this.trace(Ie);else{var ne=new Error(Ie);throw ne.hash=ye,ne}},"parseError"),parse:b(function(Ie){var ye=this,ne=[0],V=[],pe=[null],K=[],ve=this.table,Z="",je=0,Ne=0,ze=0,Fe=2,Ke=1,Ve=K.slice.call(arguments,1),tt=Object.create(this.lexer),We={yy:{}};for(var rt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,rt)&&(We.yy[rt]=this.yy[rt]);tt.setInput(Ie,We.yy),We.yy.lexer=tt,We.yy.parser=this,typeof tt.yylloc>"u"&&(tt.yylloc={});var Se=tt.yylloc;K.push(Se);var Et=tt.options&&tt.options.ranges;typeof We.yy.parseError=="function"?this.parseError=We.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function De(dt){ne.length=ne.length-2*dt,pe.length=pe.length-dt,K.length=K.length-dt}b(De,"popStack");function mt(){var dt;return dt=V.pop()||tt.lex()||Ke,typeof dt!="number"&&(dt instanceof Array&&(V=dt,dt=V.pop()),dt=ye.symbols_[dt]||dt),dt}b(mt,"lex");for(var Tt,jt,_t,Rt,bt,ke,yt={},xt,it,Me,ut;;){if(_t=ne[ne.length-1],this.defaultActions[_t]?Rt=this.defaultActions[_t]:((Tt===null||typeof Tt>"u")&&(Tt=mt()),Rt=ve[_t]&&ve[_t][Tt]),typeof Rt>"u"||!Rt.length||!Rt[0]){var at="";ut=[];for(xt in ve[_t])this.terminals_[xt]&&xt>Fe&&ut.push("'"+this.terminals_[xt]+"'");tt.showPosition?at="Parse error on line "+(je+1)+`: +`;k.append("path").attr("d",S),h==="neo"&&k.attr("filter","url(#drop-shadow)");let E=i.get(t.name)??0;mp.has(l)?(k.style("stroke",d[E%d.length]),k.style("fill",f[E%d.length])):k.style("stroke",p),k.attr("transform",`translate(${x}, ${T})`),t.rectData=y,gp(r,sa(t.description))(t.description,g,y.x,y.y+35,y.width,y.height,{class:`actor ${xO}`},r);let I=k.select("path:last-child");if(I.node()){let L=I.node().getBBox();t.height=L.height+(r.sequence.labelBoxHeight??0)}return n||(g.attr("data-et","participant"),g.attr("data-type","database"),g.attr("data-id",t.name)),t.height},"drawActorTypeDatabase"),pZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+80,l=22,u=e.append("g").lower(),{look:h,theme:f,themeVariables:d}=r,{bkgColorArray:p,borderColorArray:m,actorBorder:g}=d;n||(Dn++,u.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn);let y=e.append("g"),v=B2;n?v+=` ${Jg}`:v+=` ${Qg}`,y.attr("class",v),y.attr("name",t.name);let x=Xo();x.x=t.x,x.y=a,x.fill="#eaeaea",x.width=t.width,x.height=t.height,x.class="actor",y.append("line").attr("id","actor-man-torso"+Dn).attr("x1",t.x+t.width/2-l*2.5).attr("y1",a+12).attr("x2",t.x+t.width/2-15).attr("y2",a+12),y.append("line").attr("id","actor-man-arms"+Dn).attr("x1",t.x+t.width/2-l*2.5).attr("y1",a+2).attr("x2",t.x+t.width/2-l*2.5).attr("y2",a+22),y.append("circle").attr("cx",t.x+t.width/2).attr("cy",a+12).attr("r",l),h==="neo"&&y.attr("filter","url(#drop-shadow)");let w=i.get(t.name)??0;mp.has(f)?(y.style("stroke",m[w%m.length]),y.style("fill",p[w%m.length])):y.style("stroke",g);let C=y.node().getBBox();return t.height=C.height+(r.sequence.labelBoxHeight??0),gp(r,sa(t.description))(t.description,y,x.x,x.y+15,x.width,x.height,{class:`actor ${B2}`},r),y.attr("transform",`translate(0,${l/2+10})`),n||(y.attr("data-et","participant"),y.attr("data-type","boundary"),y.attr("data-id",t.name)),t.height},"drawActorTypeBoundary"),mZt=b(function(e,t,r,n,i){let a=n?t.stopy:t.starty,s=t.x+t.width/2,o=a+80,{look:l,theme:u,themeVariables:h}=r,{bkgColorArray:f,borderColorArray:d,actorBorder:p}=h,m=e.append("g").lower();n||(Dn++,m.append("line").attr("id","actor"+Dn).attr("x1",s).attr("y1",o).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Dn);let g=e.append("g"),y=B2;n?y+=` ${Jg}`:y+=` ${Qg}`,g.attr("class",y),g.attr("name",t.name),n||g.attr("data-et","participant").attr("data-type","actor").attr("data-id",t.name);let v=l==="neo"?.5:1,x=l==="neo"?a+(1-v)*30:a;g.append("line").attr("id","actor-man-torso"+Dn).attr("x1",s).attr("y1",x+25*v).attr("x2",s).attr("y2",x+45*v),g.append("line").attr("id","actor-man-arms"+Dn).attr("x1",s-P2/2*v).attr("y1",x+33*v).attr("x2",s+P2/2*v).attr("y2",x+33*v),g.append("line").attr("x1",s-P2/2*v).attr("y1",x+60*v).attr("x2",s).attr("y2",x+45*v),g.append("line").attr("x1",s).attr("y1",x+45*v).attr("x2",s+(P2/2-2)*v).attr("y2",x+60*v);let w=g.append("circle");w.attr("cx",t.x+t.width/2),w.attr("cy",x+10*v),w.attr("r",15*v),w.attr("width",t.width*v),w.attr("height",t.height*v);let C=g.node().getBBox();t.height=C.height;let T=Xo();T.x=t.x,T.y=x,T.fill="#eaeaea",T.width=t.width,T.height=t.height/v,T.class="actor",T.rx=3,T.ry=3;let k=i.get(t.name)??0;return mp.has(u)?(g.style("stroke",d[k%d.length]),g.style("fill",f[k%d.length])):g.style("stroke",p),gp(r,sa(t.description))(t.description,g,T.x,x+35*v-(l==="neo"?10:0),T.width,T.height,{class:`actor ${B2}`},r),t.height},"drawActorTypeActor"),gZt=b(async function(e,t,r,n,i,a,s){let o=s??new Map([...a.db.getActors().values()].map((l,u)=>[l.name,u]));switch(t.type){case"actor":return await mZt(e,t,r,n,o);case"participant":return await lZt(e,t,r,n,o);case"boundary":return await pZt(e,t,r,n,o);case"control":return await hZt(e,t,r,n,i,o);case"entity":return await fZt(e,t,r,n,o);case"database":return await dZt(e,t,r,n,o);case"collections":return await cZt(e,t,r,n,o);case"queue":return await uZt(e,t,r,n,o)}},"drawActor"),yZt=b(function(e,t,r){let i=e.append("g");nZe(i,t),t.name&&gp(r)(t.name,i,t.x,t.y+r.boxTextMargin+(t.textMaxHeight||0)/2,t.width,0,{class:"text"},r),i.lower()},"drawBox"),vZt=b(function(e){return e.append("g")},"anchorElement"),xZt=b(function(e,t,r,n,i,a,s){let{theme:o,themeVariables:l}=n,{bkgColorArray:u,borderColorArray:h,mainBkg:f}=l,d=Xo(),p=t.anchored,m=t.actor;d.x=t.startx,d.y=t.starty,d.class="activation"+i%3,d.width=t.stopx-t.startx,d.height=r-t.starty;let g=N6(p,d),v=(s??new Map([...a.db.getActors().values()].map((x,w)=>[x.name,w]))).get(m)??0;mp.has(o)&&(g.style("stroke",h[v%h.length]),g.style("fill",u[v%h.length]??f))},"drawActivation"),bZt=b(async function(e,t,r,n,i){let{boxMargin:a,boxTextMargin:s,labelBoxHeight:o,labelBoxWidth:l,messageFontFamily:u,messageFontSize:h,messageFontWeight:f}=n,d=e.append("g").attr("data-et","control-structure").attr("data-id","i"+i.id),p=b(function(y,v,x,w){return d.append("line").attr("x1",y).attr("y1",v).attr("x2",x).attr("y2",w).attr("class","loopLine")},"drawLoopLine");p(t.startx,t.starty,t.stopx,t.starty),p(t.stopx,t.starty,t.stopx,t.stopy),p(t.startx,t.stopy,t.stopx,t.stopy),p(t.startx,t.starty,t.startx,t.stopy),t.sections!==void 0&&t.sections.forEach(function(y){p(t.startx,y.y,t.stopx,y.y).style("stroke-dasharray","3, 3")});let m=_I();m.text=r,m.x=t.startx,m.y=t.starty,m.fontFamily=u,m.fontSize=h,m.fontWeight=f,m.anchor="middle",m.valign="middle",m.tspan=!1,m.width=Math.max(l??0,50),m.height=o+(n.look==="neo"?15:0)||20,m.textMargin=s,m.class="labelText",tZe(d,m),m=iZe(),m.text=t.title,m.x=t.startx+l/2+(t.stopx-t.startx)/2,m.y=t.starty+a+s,m.anchor="middle",m.valign="middle",m.textMargin=s,m.class="loopText",m.fontFamily=u,m.fontSize=h,m.fontWeight=f,m.wrap=!0;let g=sa(m.text)?await vO(d,m,t):uk(d,m);if(t.sectionTitles!==void 0){for(let[y,v]of Object.entries(t.sectionTitles))if(v.message){m.text=v.message,m.x=t.startx+(t.stopx-t.startx)/2,m.y=t.sections[y].y+a+s,m.class="sectionTitle",m.anchor="middle",m.valign="middle",m.tspan=!1,m.fontFamily=u,m.fontSize=h,m.fontWeight=f,m.wrap=t.wrap,sa(m.text)?(t.starty=t.sections[y].y,await vO(d,m,t)):uk(d,m);let x=Math.round(g.map(w=>(w._groups||w)[0][0].getBBox().height).reduce((w,C)=>w+C));t.sections[y].height+=x-(a+s)}}return t.height=Math.round(t.stopy-t.starty),d},"drawLoop"),nZe=b(function(e,t){SI(e,t)},"drawBackgroundRect"),wZt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),kZt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),TZt=b(function(e,t){e.append("defs").append("symbol").attr("id",t+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),CZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",7.9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto-start-reverse").append("path").attr("d","M -1 0 L 10 5 L 0 10 z")},"insertArrowHead"),SZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-filled-head").attr("refX",15.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),EZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertSequenceNumber"),AZt=b(function(e,t){e.append("defs").append("marker").attr("id",t+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",4.5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},"insertArrowCrossHead"),_Zt=b(function(e,t){let{theme:r}=t;e.append("defs").append("filter").attr("id","drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${r==="redux"||r==="redux-color"?"#000000":"#FFFFFF"}`)},"insertDropShadow"),iZe=b(function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},"getTextObj"),RZt=b(function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),gp=(function(){function e(a,s,o,l,u,h,f){let d=s.append("text").attr("x",o+u/2).attr("y",l+h/2+5).style("text-anchor","middle").text(a);i(d,f)}b(e,"byText");function t(a,s,o,l,u,h,f,d){let{actorFontSize:p,actorFontFamily:m,actorFontWeight:g}=d,[y,v]=Ql(p),x=a.split(Ct.lineBreakRegex);for(let w=0;we.height||0))+(this.loops.length===0?0:this.loops.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.messages.length===0?0:this.messages.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.notes.length===0?0:this.notes.map(e=>e.height||0).reduce((e,t)=>e+t))},"getHeight"),clear:b(function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},"clear"),addBox:b(function(e){this.boxes.push(e)},"addBox"),addActor:b(function(e){this.actors.push(e)},"addActor"),addLoop:b(function(e){this.loops.push(e)},"addLoop"),addMessage:b(function(e){this.messages.push(e)},"addMessage"),addNote:b(function(e){this.notes.push(e)},"addNote"),lastActor:b(function(){return this.actors[this.actors.length-1]},"lastActor"),lastLoop:b(function(){return this.loops[this.loops.length-1]},"lastLoop"),lastMessage:b(function(){return this.messages[this.messages.length-1]},"lastMessage"),lastNote:b(function(){return this.notes[this.notes.length-1]},"lastNote"),actors:[],boxes:[],loops:[],messages:[],notes:[]},init:b(function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,oZe(Be())},"init"),updateVal:b(function(e,t,r,n){e[t]===void 0?e[t]=r:e[t]=n(r,e[t])},"updateVal"),updateBounds:b(function(e,t,r,n){let i=this,a=0;function s(o){return b(function(u){a++;let h=i.sequenceItems.length-a+1;i.updateVal(u,"starty",t-h*et.boxMargin,Math.min),i.updateVal(u,"stopy",n+h*et.boxMargin,Math.max),i.updateVal(At.data,"startx",e-h*et.boxMargin,Math.min),i.updateVal(At.data,"stopx",r+h*et.boxMargin,Math.max),o!=="activation"&&(i.updateVal(u,"startx",e-h*et.boxMargin,Math.min),i.updateVal(u,"stopx",r+h*et.boxMargin,Math.max),i.updateVal(At.data,"starty",t-h*et.boxMargin,Math.min),i.updateVal(At.data,"stopy",n+h*et.boxMargin,Math.max))},"updateItemBounds")}b(s,"updateFn"),this.sequenceItems.forEach(s()),this.activations.forEach(s("activation"))},"updateBounds"),insert:b(function(e,t,r,n){let i=Ct.getMin(e,r),a=Ct.getMax(e,r),s=Ct.getMin(t,n),o=Ct.getMax(t,n);this.updateVal(At.data,"startx",i,Math.min),this.updateVal(At.data,"starty",s,Math.min),this.updateVal(At.data,"stopx",a,Math.max),this.updateVal(At.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},"insert"),newActivation:b(function(e,t,r){let n=r.get(e.from),i=wO(e.from).length||0,a=n.x+n.width/2+(i-1)*et.activationWidth/2;this.activations.push({startx:a,starty:this.verticalPos+2,stopx:a+et.activationWidth,stopy:void 0,actor:e.from,anchored:Vi.anchorElement(t)})},"newActivation"),endActivation:b(function(e){let t=this.activations.map(function(r){return r.actor}).lastIndexOf(e.from);return this.activations.splice(t,1)[0]},"endActivation"),createLoop:b(function(e={message:void 0,wrap:!1,width:void 0},t){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:e.message,wrap:e.wrap,width:e.width,height:0,fill:t}},"createLoop"),newLoop:b(function(e={message:void 0,wrap:!1,width:void 0},t){this.sequenceItems.push(this.createLoop(e,t))},"newLoop"),endLoop:b(function(){return this.sequenceItems.pop()},"endLoop"),isLoopOverlap:b(function(){return this.sequenceItems.length?this.sequenceItems[this.sequenceItems.length-1].overlap:!1},"isLoopOverlap"),addSectionToLoop:b(function(e){let t=this.sequenceItems.pop();t.sections=t.sections||[],t.sectionTitles=t.sectionTitles||[],t.sections.push({y:At.getVerticalPos(),height:0}),t.sectionTitles.push(e),this.sequenceItems.push(t)},"addSectionToLoop"),saveVerticalPos:b(function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},"saveVerticalPos"),resetVerticalPos:b(function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},"resetVerticalPos"),bumpVerticalPos:b(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=Ct.getMax(this.data.stopy,this.verticalPos)},"bumpVerticalPos"),getVerticalPos:b(function(){return this.verticalPos},"getVerticalPos"),getBounds:b(function(){return{bounds:this.data,models:this.models}},"getBounds")},OZt=b(async function(e,t,r){At.bumpVerticalPos(et.boxMargin),t.height=et.boxMargin,t.starty=At.getVerticalPos();let n=Xo();n.x=t.startx,n.y=t.starty,n.width=t.width||et.width,n.class="note";let i=e.append("g");i.attr("data-et","note"),i.attr("data-id","i"+r);let a=Vi.drawRect(i,n),s=_I();s.x=t.startx,s.y=t.starty,s.width=n.width,s.dy="1em",s.text=t.message,s.class="noteText",s.fontFamily=et.noteFontFamily,s.fontSize=et.noteFontSize,s.fontWeight=et.noteFontWeight,s.anchor=et.noteAlign,s.textMargin=et.noteMargin,s.valign="center";let o=sa(s.text)?await vO(i,s):uk(i,s),l=Math.round(o.map(u=>(u._groups||u)[0][0].getBBox().height).reduce((u,h)=>u+h));a.attr("height",l+2*et.noteMargin),t.height+=l+2*et.noteMargin,At.bumpVerticalPos(l+2*et.noteMargin),t.stopy=t.starty+l+2*et.noteMargin,t.stopx=t.startx+n.width,At.insert(t.startx,t.starty,t.stopx,t.stopy),At.models.addNote(t)},"drawNote"),JKe=b(function(e,t,r,n,i,a,s){let o=n.db.getActors(),l=o.get(t.from),u=o.get(t.to),h=r.sequenceVisible,f=l.x+l.width/2,d=u.x+u.width/2,p=f<=d,m=hZe(t,n),g=e.append("g"),y=16.5,v=b((k,S)=>{let E=k?y:-y;return S?-E:E},"getCircleOffset"),x=b(k=>{g.append("circle").attr("cx",k).attr("cy",s).attr("r",5).attr("width",10).attr("height",10)},"drawCircle"),{CENTRAL_CONNECTION:w,CENTRAL_CONNECTION_REVERSE:C,CENTRAL_CONNECTION_DUAL:T}=n.db.LINETYPE;if(h)switch(t.centralConnection){case w:m&&(d+=v(p,!0));break;case C:m||(f+=v(p,!1));break;case T:m?d+=v(p,!0):f+=v(p,!1);break}switch(t.centralConnection){case w:x(d);break;case C:x(f);break;case T:x(f),x(d);break}},"drawCentralConnection"),F2=b(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont"),ck=b(e=>({fontFamily:e.noteFontFamily,fontSize:e.noteFontSize,fontWeight:e.noteFontWeight}),"noteFont"),aae=b(e=>({fontFamily:e.actorFontFamily,fontSize:e.actorFontSize,fontWeight:e.actorFontWeight}),"actorFont");b(aZe,"boundMessage");PZt=b(async function(e,t,r,n,i,a){let{startx:s,stopx:o,starty:l,message:u,type:h,sequenceIndex:f,sequenceVisible:d}=t,p=pr.calculateTextDimensions(u,F2(et)),m=_I();m.x=Math.min(s,o),m.y=l+10,m.width=Math.abs(o-s),m.class="messageText",m.dy="1em",m.text=u,m.fontFamily=et.messageFontFamily,m.fontSize=et.messageFontSize,m.fontWeight=et.messageFontWeight,m.anchor=et.messageAlign,m.valign="center",m.textMargin=et.wrapPadding,m.tspan=!1,sa(m.text)?await vO(e,m,{startx:s,stopx:o,starty:r}):uk(e,m);let g=p.width,y;if(s===o){let x=d||et.showSequenceNumbers,w=hZe(i,n),C=WZt(i,n),T=s+(x&&(w||C)?10:0);et.rightAngles?y=e.append("path").attr("d",`M ${T},${r} H ${s+Ct.getMax(et.width/2,g/2)} V ${r+25} H ${s}`):y=e.append("path").attr("d","M "+T+","+r+" C "+(T+60)+","+(r-10)+" "+(s+60)+","+(r+30)+" "+s+","+(r+20)),nae(i,n)&&JKe(e,i,t,n,s,o,r)}else y=e.append("line"),y.attr("x1",s),y.attr("y1",r),y.attr("x2",o),y.attr("y2",r),nae(i,n)&&JKe(e,i,t,n,s,o,r);h===n.db.LINETYPE.DOTTED||h===n.db.LINETYPE.DOTTED_CROSS||h===n.db.LINETYPE.DOTTED_POINT||h===n.db.LINETYPE.DOTTED_OPEN||h===n.db.LINETYPE.BIDIRECTIONAL_DOTTED||h===n.db.LINETYPE.SOLID_TOP_DOTTED||h===n.db.LINETYPE.SOLID_BOTTOM_DOTTED||h===n.db.LINETYPE.STICK_TOP_DOTTED||h===n.db.LINETYPE.STICK_BOTTOM_DOTTED||h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED?(y.style("stroke-dasharray","3, 3"),y.attr("class","messageLine1")):y.attr("class","messageLine0"),y.attr("data-et","message"),y.attr("data-id","i"+t.id),y.attr("data-from",t.from),y.attr("data-to",t.to);let v="";if(et.arrowMarkerAbsolute&&(v=gy(!0)),y.attr("stroke-width",2),y.attr("stroke","none"),y.style("fill","none"),(h===n.db.LINETYPE.SOLID_TOP||h===n.db.LINETYPE.SOLID_TOP_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-solidTopArrowHead)"),(h===n.db.LINETYPE.SOLID_BOTTOM||h===n.db.LINETYPE.SOLID_BOTTOM_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-solidBottomArrowHead)"),(h===n.db.LINETYPE.STICK_TOP||h===n.db.LINETYPE.STICK_TOP_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-stickTopArrowHead)"),(h===n.db.LINETYPE.STICK_BOTTOM||h===n.db.LINETYPE.STICK_BOTTOM_DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-stickBottomArrowHead)"),(h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-solidBottomArrowHead)"),(h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-solidTopArrowHead)"),(h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-stickBottomArrowHead)"),(h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED)&&y.attr("marker-start","url("+v+"#"+a+"-stickTopArrowHead)"),(h===n.db.LINETYPE.SOLID||h===n.db.LINETYPE.DOTTED)&&y.attr("marker-end","url("+v+"#"+a+"-arrowhead)"),(h===n.db.LINETYPE.BIDIRECTIONAL_SOLID||h===n.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(y.attr("marker-start","url("+v+"#"+a+"-arrowhead)"),y.attr("marker-end","url("+v+"#"+a+"-arrowhead)")),(h===n.db.LINETYPE.SOLID_POINT||h===n.db.LINETYPE.DOTTED_POINT)&&y.attr("marker-end","url("+v+"#"+a+"-filled-head)"),(h===n.db.LINETYPE.SOLID_CROSS||h===n.db.LINETYPE.DOTTED_CROSS)&&y.attr("marker-end","url("+v+"#"+a+"-crosshead)"),d||et.showSequenceNumbers){let x=h===n.db.LINETYPE.BIDIRECTIONAL_SOLID||h===n.db.LINETYPE.BIDIRECTIONAL_DOTTED,w=h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE||h===n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE||h===n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,C=6,T=nae(i,n),k=s,S=o;x?(ss?S=o-2*C:(S=o-C,k+=i?.centralConnection===n.db.LINETYPE.CENTRAL_CONNECTION_DUAL||i?.centralConnection===n.db.LINETYPE.CENTRAL_CONNECTION_REVERSE?-7.5:0),S+=T?15:0,y.attr("x2",S),y.attr("x1",k)):y.attr("x1",s+C);let E=0,I=s===o,L=s<=o;I?E=t.fromBounds+1:w?E=L?t.toBounds-1:t.fromBounds+1:E=L?t.fromBounds+1:t.toBounds-1;let O="12px",R=f.toString().length;R>5?O="7px":R>3&&(O="9px"),e.append("line").attr("x1",E).attr("y1",r).attr("x2",E).attr("y2",r).attr("stroke-width",0).attr("marker-start","url("+v+"#"+a+"-sequencenumber)"),e.append("text").attr("x",E).attr("y",r+4).attr("font-family","sans-serif").attr("font-size",O).attr("text-anchor","middle").attr("class","sequenceNumber").text(f)}},"drawMessage"),BZt=b(function(e,t,r,n,i,a,s){let o=0,l=0,u,h=0;for(let f of n){let d=t.get(f),p=d.box;u&&u!=p&&(s||At.models.addBox(u),l+=et.boxMargin+u.margin),p&&p!=u&&(s||(p.x=o+l,p.y=i),l+=p.margin),d.width=Ct.getMax(d.width||et.width,et.width),d.height=Ct.getMax(d.height||et.height,et.height),d.margin=d.margin||et.actorMargin,h=Ct.getMax(h,d.height),r.get(d.name)&&(l+=d.width/2),d.x=o+l,d.starty=At.getVerticalPos(),At.insert(d.x,i,d.x+d.width,d.height),o+=d.width+l,d.box&&(d.box.width=o+p.margin-d.box.x),l=d.margin,u=d.box,At.models.addActor(d)}u&&!s&&At.models.addBox(u),At.bumpVerticalPos(h)},"addActorRenderingData"),sae=b(async function(e,t,r,n,i,a,s){if(n){let o=0;At.bumpVerticalPos(et.boxMargin*2);for(let l of r){let u=t.get(l);u.stopy||(u.stopy=At.getVerticalPos());let h=await Vi.drawActor(e,u,et,!0,i,a,s);o=Ct.getMax(o,h)}At.bumpVerticalPos(o+et.boxMargin)}else for(let o of r){let l=t.get(o);await Vi.drawActor(e,l,et,!1,i,a,s)}},"drawActors"),sZe=b(function(e,t,r,n){let i=0,a=0;for(let s of r){let o=t.get(s),l=$Zt(o),u=Vi.drawPopup(e,o,l,et,et.forceMenus,n);u.height>i&&(i=u.height),u.width+o.x>a&&(a=u.width+o.x)}return{maxHeight:i,maxWidth:a}},"drawActorsPopup"),oZe=b(function(e){Xi(et,e),e.fontFamily&&(et.actorFontFamily=et.noteFontFamily=et.messageFontFamily=e.fontFamily),e.fontSize&&(et.actorFontSize=et.noteFontSize=et.messageFontSize=e.fontSize),e.fontWeight&&(et.actorFontWeight=et.noteFontWeight=et.messageFontWeight=e.fontWeight)},"setConf"),wO=b(function(e){return At.activations.filter(function(t){return t.actor===e})},"actorActivations"),eZe=b(function(e,t){let r=t.get(e),n=wO(e),i=n.reduce(function(s,o){return Ct.getMin(s,o.startx)},r.x+r.width/2-1),a=n.reduce(function(s,o){return Ct.getMax(s,o.stopx)},r.x+r.width/2+1);return[i,a]},"activationBounds");b($h,"adjustLoopHeightForWrap");b(lZe,"adjustCreatedDestroyedData");FZt=b(async function(e,t,r,n){let{securityLevel:i,sequence:a,look:s,themeVariables:o}=Be();et=a;let l;i==="sandbox"&&(l=ct("#i"+t));let u=i==="sandbox"?ct(l.nodes()[0].contentDocument.body):ct("body"),h=i==="sandbox"?l.nodes()[0].contentDocument:document;At.init(),se.debug(n.db);let f=i==="sandbox"?u.select(`[id="${t}"]`):ct(`[id="${t}"]`),d=n.db.getActors(),p=n.db.getCreatedActors(),m=n.db.getDestroyedActors(),g=n.db.getBoxes(),y=n.db.getActorKeys(),v=n.db.getMessages(),x=n.db.getDiagramTitle(),w=n.db.hasAtLeastOneBox(),C=n.db.hasAtLeastOneBoxWithTitle(),T=await cZe(d,v,n);if(et.height=await uZe(d,T,g),Vi.insertComputerIcon(f,t),Vi.insertDatabaseIcon(f,t),Vi.insertClockIcon(f,t),w&&(At.bumpVerticalPos(et.boxMargin),C&&At.bumpVerticalPos(g[0].textMaxHeight)),et.hideUnusedParticipants===!0){let G=new Set;v.forEach(z=>{G.add(z.from),G.add(z.to)}),y=y.filter(z=>G.has(z))}let k=new Map(y.map((G,z)=>[d.get(G)?.name??G,z]));BZt(f,d,p,y,0,v,!1);let S=await UZt(v,d,T,n);Vi.insertArrowHead(f,t),Vi.insertArrowCrossHead(f,t),Vi.insertArrowFilledHead(f,t),Vi.insertSequenceNumber(f,t),Vi.insertSolidTopArrowHead(f,t),Vi.insertSolidBottomArrowHead(f,t),Vi.insertStickTopArrowHead(f,t),Vi.insertStickBottomArrowHead(f,t),s==="neo"&&Vi.insertDropShadow(f,et);function E(G,z){let H=At.endActivation(G);H.starty+18>z&&(H.starty=z-6,z+=12),Vi.drawActivation(f,H,z,et,wO(G.from).length,n,k),At.insert(H.startx,z-10,H.stopx,z)}b(E,"activeEnd");let I=1,L=1,O=[],R=[],A=0;for(let G of v){let z,H,j;switch(G.type){case n.db.LINETYPE.NOTE:At.resetVerticalPos(),H=G.noteModel,await OZt(f,H,G.id);break;case n.db.LINETYPE.ACTIVE_START:At.newActivation(G,f,d);break;case n.db.LINETYPE.CENTRAL_CONNECTION:At.newActivation(G,f,d);break;case n.db.LINETYPE.CENTRAL_CONNECTION_REVERSE:At.newActivation(G,f,d);break;case n.db.LINETYPE.ACTIVE_END:E(G,At.getVerticalPos());break;case n.db.LINETYPE.LOOP_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.LOOP_END:z=At.endLoop(),await Vi.drawLoop(f,z,"loop",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.RECT_START:$h(S,G,et.boxMargin,et.boxMargin,J=>{let U=J.message;U||(U=o?.rectBkgColor||o?.actorBkg||"rgba(128, 128, 128, 0.5)"),At.newLoop(void 0,U)});break;case n.db.LINETYPE.RECT_END:z=At.endLoop(),R.push(z),At.models.addLoop(z),At.bumpVerticalPos(z.stopy-At.getVerticalPos());break;case n.db.LINETYPE.OPT_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.OPT_END:z=At.endLoop(),await Vi.drawLoop(f,z,"opt",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.ALT_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.ALT_ELSE:$h(S,G,et.boxMargin+et.boxTextMargin,et.boxMargin,J=>At.addSectionToLoop(J));break;case n.db.LINETYPE.ALT_END:z=At.endLoop(),await Vi.drawLoop(f,z,"alt",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.PAR_START:case n.db.LINETYPE.PAR_OVER_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J)),At.saveVerticalPos();break;case n.db.LINETYPE.PAR_AND:$h(S,G,et.boxMargin+et.boxTextMargin,et.boxMargin,J=>At.addSectionToLoop(J));break;case n.db.LINETYPE.PAR_END:z=At.endLoop(),await Vi.drawLoop(f,z,"par",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.AUTONUMBER:I=G.message.start||I,L=G.message.step||L,G.message.visible?n.db.enableSequenceNumbers():n.db.disableSequenceNumbers();break;case n.db.LINETYPE.CRITICAL_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.CRITICAL_OPTION:$h(S,G,et.boxMargin+et.boxTextMargin,et.boxMargin,J=>At.addSectionToLoop(J));break;case n.db.LINETYPE.CRITICAL_END:z=At.endLoop(),await Vi.drawLoop(f,z,"critical",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;case n.db.LINETYPE.BREAK_START:$h(S,G,et.boxMargin,et.boxMargin+et.boxTextMargin,J=>At.newLoop(J));break;case n.db.LINETYPE.BREAK_END:z=At.endLoop(),await Vi.drawLoop(f,z,"break",et,G),At.bumpVerticalPos(z.stopy-At.getVerticalPos()),At.models.addLoop(z);break;default:try{j=G.msgModel,j.starty=At.getVerticalPos(),j.sequenceIndex=I,j.sequenceVisible=n.db.showSequenceNumbers(),j.id=G.id,j.from=G.from,j.to=G.to;let J=await aZe(f,j);lZe(G,j,J,A,d,p,m),O.push({messageModel:j,lineStartY:J,msg:G}),At.models.addMessage(j)}catch(J){se.error("error while drawing message",J)}}[n.db.LINETYPE.SOLID_OPEN,n.db.LINETYPE.DOTTED_OPEN,n.db.LINETYPE.SOLID,n.db.LINETYPE.SOLID_TOP,n.db.LINETYPE.SOLID_BOTTOM,n.db.LINETYPE.STICK_TOP,n.db.LINETYPE.STICK_BOTTOM,n.db.LINETYPE.SOLID_TOP_DOTTED,n.db.LINETYPE.SOLID_BOTTOM_DOTTED,n.db.LINETYPE.STICK_TOP_DOTTED,n.db.LINETYPE.STICK_BOTTOM_DOTTED,n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,n.db.LINETYPE.STICK_ARROW_TOP_REVERSE,n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,n.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,n.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,n.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,n.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,n.db.LINETYPE.DOTTED,n.db.LINETYPE.SOLID_CROSS,n.db.LINETYPE.DOTTED_CROSS,n.db.LINETYPE.SOLID_POINT,n.db.LINETYPE.DOTTED_POINT,n.db.LINETYPE.BIDIRECTIONAL_SOLID,n.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(G.type)&&(I=Math.round((I+L)*100)/100),A++}se.debug("createdActors",p),se.debug("destroyedActors",m),await sae(f,d,y,!1,t,n,k);for(let G of O)await PZt(f,G.messageModel,G.lineStartY,n,G.msg,t);et.mirrorActors&&await sae(f,d,y,!0,t,n,k),R.forEach(G=>Vi.drawBackgroundRect(f,G)),rZe(f,d,y,et);for(let G of At.models.boxes){G.height=At.getVerticalPos()-G.y,At.insert(G.x,G.y,G.x+G.width,G.height);let z=et.boxMargin*2;G.startx=G.x-z,G.starty=G.y-z*.25,G.stopx=G.startx+G.width+2*z,G.stopy=G.starty+G.height+z*.75,G.stroke="rgb(0,0,0, 0.5)",Vi.drawBox(f,G,et)}w&&At.bumpVerticalPos(et.boxMargin);let N=sZe(f,d,y,h),{bounds:M}=At.getBounds();M.startx===void 0&&(M.startx=0),M.starty===void 0&&(M.starty=0),M.stopx===void 0&&(M.stopx=0),M.stopy===void 0&&(M.stopy=0);let D=M.stopy-M.starty;D2,d=b(y=>l?-y:y,"adjustValue");e.from===e.to?h=u:(e.activate&&!f&&(h+=d(et.activationWidth/2-1)),[r.db.LINETYPE.SOLID_OPEN,r.db.LINETYPE.DOTTED_OPEN,r.db.LINETYPE.STICK_TOP,r.db.LINETYPE.STICK_BOTTOM,r.db.LINETYPE.STICK_TOP_DOTTED,r.db.LINETYPE.STICK_BOTTOM_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.STICK_ARROW_TOP_REVERSE,r.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,r.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE].includes(e.type)||(h+=d(3)),[r.db.LINETYPE.BIDIRECTIONAL_SOLID,r.db.LINETYPE.BIDIRECTIONAL_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE].includes(e.type)&&(u-=d(3)));let p=[i,a,s,o],m=Math.abs(u-h);e.wrap&&e.message&&(e.message=pr.wrapLabel(e.message,Ct.getMax(m+2*et.wrapPadding,et.width),F2(et)));let g=pr.calculateTextDimensions(e.message,F2(et));return{width:Ct.getMax(e.wrap?0:g.width+2*et.wrapPadding,m+2*et.wrapPadding,et.width),height:0,startx:u,stopx:h,starty:0,stopy:0,message:e.message,type:e.type,wrap:e.wrap,fromBounds:Math.min.apply(null,p),toBounds:Math.max.apply(null,p)}},"buildMessageModel"),UZt=b(async function(e,t,r,n){let i={},a=[],s,o,l;for(let u of e){switch(u.type){case n.db.LINETYPE.LOOP_START:case n.db.LINETYPE.ALT_START:case n.db.LINETYPE.OPT_START:case n.db.LINETYPE.PAR_START:case n.db.LINETYPE.PAR_OVER_START:case n.db.LINETYPE.CRITICAL_START:case n.db.LINETYPE.BREAK_START:a.push({id:u.id,msg:u.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case n.db.LINETYPE.ALT_ELSE:case n.db.LINETYPE.PAR_AND:case n.db.LINETYPE.CRITICAL_OPTION:u.message&&(s=a.pop(),i[s.id]=s,i[u.id]=s,a.push(s));break;case n.db.LINETYPE.LOOP_END:case n.db.LINETYPE.ALT_END:case n.db.LINETYPE.OPT_END:case n.db.LINETYPE.PAR_END:case n.db.LINETYPE.CRITICAL_END:case n.db.LINETYPE.BREAK_END:s=a.pop(),i[s.id]=s;break;case n.db.LINETYPE.ACTIVE_START:{let f=t.get(u.from?u.from:u.to.actor),d=wO(u.from?u.from:u.to.actor).length,p=f.x+f.width/2+(d-1)*et.activationWidth/2,m={startx:p,stopx:p+et.activationWidth,actor:u.from,enabled:!0};At.activations.push(m)}break;case n.db.LINETYPE.ACTIVE_END:{let f=At.activations.map(d=>d.actor).lastIndexOf(u.from);At.activations.splice(f,1).splice(0,1)}break}u.placement!==void 0?(o=await zZt(u,t,n),u.noteModel=o,a.forEach(f=>{s=f,s.from=Ct.getMin(s.from,o.startx),s.to=Ct.getMax(s.to,o.startx+o.width),s.width=Ct.getMax(s.width,Math.abs(s.from-s.to))-et.labelBoxWidth})):(l=HZt(u,t,n),u.msgModel=l,l.startx&&l.stopx&&a.length>0&&a.forEach(f=>{if(s=f,l.startx===l.stopx){let d=t.get(u.from),p=t.get(u.to);s.from=Ct.getMin(d.x-l.width/2,d.x-d.width/2,s.from),s.to=Ct.getMax(p.x+l.width/2,p.x+d.width/2,s.to),s.width=Ct.getMax(s.width,Math.abs(s.to-s.from))-et.labelBoxWidth}else s.from=Ct.getMin(l.startx,s.from),s.to=Ct.getMax(l.stopx,s.to),s.width=Ct.getMax(s.width,l.width)-et.labelBoxWidth}))}return At.activations=[],se.debug("Loop type widths:",i),i},"calculateLoopBounds"),YZt={bounds:At,drawActors:sae,drawActorsPopup:sZe,setConf:oZe,draw:FZt},XZt={parser:eZt,get db(){return new iZt},renderer:YZt,styles:sZt,init:b(e=>{e.sequence||(e.sequence={}),e.wrap&&(e.sequence.wrap=e.wrap,P5({sequence:{wrap:e.wrap}}))},"init")}});var lae,TO,pZe,mZe,kO,gZe,$2,CO,jZt,SO,KZt,ZZt,QZt,EO,uae=W(()=>{ad();Uc();lc();ac();Hc();Sn();_r();Rr();hr();fn();xb();lae=(function(){var e=b(function(ge,Ie,ye,ne){for(ye=ye||{},ne=ge.length;ne--;ye[ge[ne]]=Ie);return ye},"o"),t=[1,18],r=[1,19],n=[1,20],i=[1,41],a=[1,26],s=[1,42],o=[1,24],l=[1,25],u=[1,32],h=[1,33],f=[1,34],d=[1,45],p=[1,35],m=[1,36],g=[1,37],y=[1,38],v=[1,27],x=[1,28],w=[1,29],C=[1,30],T=[1,31],k=[1,44],S=[1,46],E=[1,43],I=[1,47],L=[1,9],O=[1,8,9],R=[1,58],A=[1,59],N=[1,60],M=[1,61],D=[1,62],B=[1,63],P=[1,64],$=[1,8,9,41],F=[1,77],q=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],G=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],z=[13,60,86,100,102,103],H=[13,60,73,74,86,100,102,103],j=[13,60,68,69,70,71,72,86,100,102,103],J=[1,103],U=[1,121],le=[1,117],ee=[1,113],ue=[1,119],ae=[1,114],oe=[1,115],Re=[1,116],Te=[1,118],Oe=[1,120],qe=[22,50,60,61,82,86,87,88,89,90],Ge=[1,128],fe=[12,39],Ce=[1,8,9,39,41,44,46],_e=[1,8,9,22],de=[1,153],ie=[1,8,9,61],Q=[1,8,9,22,50,60,61,82,86,87,88,89,90],he={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:b(function(Ie,ye,ne,V,pe,K,ve){var Z=K.length-1;switch(pe){case 8:this.$=K[Z-1];break;case 9:case 10:case 13:case 15:this.$=K[Z];break;case 11:case 14:this.$=K[Z-2]+"."+K[Z];break;case 12:case 16:this.$=K[Z-1]+K[Z];break;case 17:case 18:this.$=K[Z-1]+"~"+K[Z]+"~";break;case 19:V.addRelation(K[Z]);break;case 20:K[Z-1].title=V.cleanupLabel(K[Z]),V.addRelation(K[Z-1]);break;case 31:this.$=K[Z].trim(),V.setAccTitle(this.$);break;case 32:case 33:this.$=K[Z].trim(),V.setAccDescription(this.$);break;case 34:V.addClassesToNamespace(K[Z-3],K[Z-1][0],K[Z-1][1]),V.popNamespace();break;case 35:V.addClassesToNamespace(K[Z-4],K[Z-1][0],K[Z-1][1]),V.popNamespace();break;case 36:this.$=V.addNamespace(K[Z]);break;case 37:this.$=V.addNamespace(K[Z-1],K[Z]);break;case 38:this.$=[[K[Z]],[]];break;case 39:this.$=[[K[Z-1]],[]];break;case 40:K[Z][0].unshift(K[Z-2]),this.$=K[Z];break;case 41:this.$=[[],[K[Z]]];break;case 42:this.$=[[],[K[Z-1]]];break;case 43:K[Z][1].unshift(K[Z-2]),this.$=K[Z];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=K[Z];break;case 48:V.setCssClass(K[Z-2],K[Z]);break;case 49:V.addMembers(K[Z-3],K[Z-1]);break;case 51:V.setCssClass(K[Z-5],K[Z-3]),V.addMembers(K[Z-5],K[Z-1]);break;case 52:V.addAnnotation(K[Z-3],K[Z-1]);break;case 53:V.addAnnotation(K[Z-6],K[Z-4]),V.addMembers(K[Z-6],K[Z-1]);break;case 54:V.addAnnotation(K[Z-5],K[Z-3]);break;case 55:this.$=K[Z],V.addClass(K[Z]);break;case 56:this.$=K[Z-1],V.addClass(K[Z-1]),V.setClassLabel(K[Z-1],K[Z]);break;case 60:V.addAnnotation(K[Z],K[Z-2]);break;case 61:case 74:this.$=[K[Z]];break;case 62:K[Z].push(K[Z-1]),this.$=K[Z];break;case 63:break;case 64:V.addMember(K[Z-1],V.cleanupLabel(K[Z]));break;case 65:break;case 66:break;case 67:this.$={id1:K[Z-2],id2:K[Z],relation:K[Z-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:K[Z-3],id2:K[Z],relation:K[Z-1],relationTitle1:K[Z-2],relationTitle2:"none"};break;case 69:this.$={id1:K[Z-3],id2:K[Z],relation:K[Z-2],relationTitle1:"none",relationTitle2:K[Z-1]};break;case 70:this.$={id1:K[Z-4],id2:K[Z],relation:K[Z-2],relationTitle1:K[Z-3],relationTitle2:K[Z-1]};break;case 71:this.$=V.addNote(K[Z],K[Z-1]);break;case 72:this.$=V.addNote(K[Z]);break;case 73:this.$=K[Z-2],V.defineClass(K[Z-1],K[Z]);break;case 75:this.$=K[Z-2].concat([K[Z]]);break;case 76:V.setDirection("TB");break;case 77:V.setDirection("BT");break;case 78:V.setDirection("RL");break;case 79:V.setDirection("LR");break;case 80:this.$={type1:K[Z-2],type2:K[Z],lineType:K[Z-1]};break;case 81:this.$={type1:"none",type2:K[Z],lineType:K[Z-1]};break;case 82:this.$={type1:K[Z-1],type2:"none",lineType:K[Z]};break;case 83:this.$={type1:"none",type2:"none",lineType:K[Z]};break;case 84:this.$=V.relationType.AGGREGATION;break;case 85:this.$=V.relationType.EXTENSION;break;case 86:this.$=V.relationType.COMPOSITION;break;case 87:this.$=V.relationType.DEPENDENCY;break;case 88:this.$=V.relationType.LOLLIPOP;break;case 89:this.$=V.lineType.LINE;break;case 90:this.$=V.lineType.DOTTED_LINE;break;case 91:case 97:this.$=K[Z-2],V.setClickEvent(K[Z-1],K[Z]);break;case 92:case 98:this.$=K[Z-3],V.setClickEvent(K[Z-2],K[Z-1]),V.setTooltip(K[Z-2],K[Z]);break;case 93:this.$=K[Z-2],V.setLink(K[Z-1],K[Z]);break;case 94:this.$=K[Z-3],V.setLink(K[Z-2],K[Z-1],K[Z]);break;case 95:this.$=K[Z-3],V.setLink(K[Z-2],K[Z-1]),V.setTooltip(K[Z-2],K[Z]);break;case 96:this.$=K[Z-4],V.setLink(K[Z-3],K[Z-2],K[Z]),V.setTooltip(K[Z-3],K[Z-1]);break;case 99:this.$=K[Z-3],V.setClickEvent(K[Z-2],K[Z-1],K[Z]);break;case 100:this.$=K[Z-4],V.setClickEvent(K[Z-3],K[Z-2],K[Z-1]),V.setTooltip(K[Z-3],K[Z]);break;case 101:this.$=K[Z-3],V.setLink(K[Z-2],K[Z]);break;case 102:this.$=K[Z-4],V.setLink(K[Z-3],K[Z-1],K[Z]);break;case 103:this.$=K[Z-4],V.setLink(K[Z-3],K[Z-1]),V.setTooltip(K[Z-3],K[Z]);break;case 104:this.$=K[Z-5],V.setLink(K[Z-4],K[Z-2],K[Z]),V.setTooltip(K[Z-4],K[Z-1]);break;case 105:this.$=K[Z-2],V.setCssStyle(K[Z-1],K[Z]);break;case 106:V.setCssClass(K[Z-1],K[Z]);break;case 107:this.$=[K[Z]];break;case 108:K[Z-2].push(K[Z]),this.$=K[Z-2];break;case 110:this.$=K[Z-1]+K[Z];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:t,35:r,37:n,38:22,42:i,43:23,46:a,48:s,51:o,52:l,54:u,56:h,57:f,60:d,62:p,63:m,64:g,65:y,75:v,76:x,78:w,82:C,83:T,86:k,100:S,102:E,103:I},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},e(L,[2,5],{8:[1,48]}),{8:[1,49]},e(O,[2,19],{22:[1,50]}),e(O,[2,21]),e(O,[2,22]),e(O,[2,23]),e(O,[2,24]),e(O,[2,25]),e(O,[2,26]),e(O,[2,27]),e(O,[2,28]),e(O,[2,29]),e(O,[2,30]),{34:[1,51]},{36:[1,52]},e(O,[2,33]),e(O,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:R,69:A,70:N,71:M,72:D,73:B,74:P}),{39:[1,65]},e($,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),e(O,[2,65]),e(O,[2,66]),{16:69,60:d,86:k,100:S,102:E},{16:39,17:40,19:70,60:d,86:k,100:S,102:E,103:I},{16:39,17:40,19:71,60:d,86:k,100:S,102:E,103:I},{16:39,17:40,19:72,60:d,86:k,100:S,102:E,103:I},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:d,86:k,100:S,102:E,103:I},{13:F,55:76},{58:78,60:[1,79]},e(O,[2,76]),e(O,[2,77]),e(O,[2,78]),e(O,[2,79]),e(q,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:d,86:k,100:S,102:E,103:I}),e(q,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:d,86:k,100:S,102:E,103:I},{16:39,17:40,19:87,60:d,86:k,100:S,102:E,103:I},e(G,[2,133]),e(G,[2,134]),e(G,[2,135]),e(G,[2,136]),e([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),e(L,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:t,35:r,37:n,42:i,46:a,48:s,51:o,52:l,54:u,56:h,57:f,60:d,62:p,63:m,64:g,65:y,75:v,76:x,78:w,82:C,83:T,86:k,100:S,102:E,103:I}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:t,35:r,37:n,38:22,42:i,43:23,46:a,48:s,51:o,52:l,54:u,56:h,57:f,60:d,62:p,63:m,64:g,65:y,75:v,76:x,78:w,82:C,83:T,86:k,100:S,102:E,103:I},e(O,[2,20]),e(O,[2,31]),e(O,[2,32]),{13:[1,91],16:39,17:40,19:90,60:d,86:k,100:S,102:E,103:I},{53:92,66:56,67:57,68:R,69:A,70:N,71:M,72:D,73:B,74:P},e(O,[2,64]),{67:93,73:B,74:P},e(z,[2,83],{66:94,68:R,69:A,70:N,71:M,72:D}),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(j,[2,89]),e(j,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:i,43:23,48:s,54:u,56:h},{16:100,60:d,86:k,100:S,102:E},{41:[1,102],45:101,51:J},{16:104,60:d,86:k,100:S,102:E},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:U,50:le,59:110,60:ee,82:ue,84:111,85:112,86:ae,87:oe,88:Re,89:Te,90:Oe},{60:[1,122]},{13:F,55:123},e($,[2,72]),e($,[2,138]),{22:U,50:le,59:124,60:ee,61:[1,125],82:ue,84:111,85:112,86:ae,87:oe,88:Re,89:Te,90:Oe},e(qe,[2,74]),{16:39,17:40,19:126,60:d,86:k,100:S,102:E,103:I},e(q,[2,16]),e(q,[2,17]),e(q,[2,18]),{11:127,12:Ge,39:[2,36]},e(fe,[2,9],{16:85,17:86,15:130,18:[1,129],60:d,86:k,100:S,102:E,103:I}),e(fe,[2,10]),e(Ce,[2,55],{11:131,12:Ge}),e(L,[2,7]),{9:[1,132]},e(_e,[2,67]),{16:39,17:40,19:133,60:d,86:k,100:S,102:E,103:I},{13:[1,135],16:39,17:40,19:134,60:d,86:k,100:S,102:E,103:I},e(z,[2,82],{66:136,68:R,69:A,70:N,71:M,72:D}),e(z,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:i,43:23,48:s,54:u,56:h},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},e($,[2,48],{39:[1,142]}),{41:[1,143]},e($,[2,50]),{41:[2,61],45:144,51:J},{47:[1,145]},{16:39,17:40,19:146,60:d,86:k,100:S,102:E,103:I},e(O,[2,91],{13:[1,147]}),e(O,[2,93],{13:[1,149],77:[1,148]}),e(O,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},e(O,[2,105],{61:de}),e(ie,[2,107],{85:154,22:U,50:le,60:ee,82:ue,86:ae,87:oe,88:Re,89:Te,90:Oe}),e(Q,[2,109]),e(Q,[2,111]),e(Q,[2,112]),e(Q,[2,113]),e(Q,[2,114]),e(Q,[2,115]),e(Q,[2,116]),e(Q,[2,117]),e(Q,[2,118]),e(Q,[2,119]),e(O,[2,106]),e($,[2,71]),e(O,[2,73],{61:de}),{60:[1,155]},e(q,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:d,86:k,100:S,102:E,103:I},e(fe,[2,12]),e(Ce,[2,56]),{1:[2,4]},e(_e,[2,69]),e(_e,[2,68]),{16:39,17:40,19:158,60:d,86:k,100:S,102:E,103:I},e(z,[2,80]),e($,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:i,43:23,48:s,54:u,56:h},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:i,43:23,48:s,54:u,56:h},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:i,43:23,48:s,54:u,56:h},{45:163,51:J},e($,[2,49]),{41:[2,62]},e($,[2,52],{39:[1,164]}),e(O,[2,60]),e(O,[2,92]),e(O,[2,94]),e(O,[2,95],{77:[1,165]}),e(O,[2,98]),e(O,[2,99],{13:[1,166]}),e(O,[2,101],{13:[1,168],77:[1,167]}),{22:U,50:le,60:ee,82:ue,84:169,85:112,86:ae,87:oe,88:Re,89:Te,90:Oe},e(Q,[2,110]),e(qe,[2,75]),{14:[1,170]},e(fe,[2,11]),e(_e,[2,70]),e($,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:J},e(O,[2,96]),e(O,[2,100]),e(O,[2,102]),e(O,[2,103],{77:[1,174]}),e(ie,[2,108],{85:154,22:U,50:le,60:ee,82:ue,86:ae,87:oe,88:Re,89:Te,90:Oe}),e(Ce,[2,8]),e($,[2,51]),{41:[1,175]},e($,[2,54]),e(O,[2,104]),e($,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:b(function(Ie,ye){if(ye.recoverable)this.trace(Ie);else{var ne=new Error(Ie);throw ne.hash=ye,ne}},"parseError"),parse:b(function(Ie){var ye=this,ne=[0],V=[],pe=[null],K=[],ve=this.table,Z="",je=0,Ne=0,ze=0,Fe=2,Ke=1,Ve=K.slice.call(arguments,1),tt=Object.create(this.lexer),We={yy:{}};for(var rt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,rt)&&(We.yy[rt]=this.yy[rt]);tt.setInput(Ie,We.yy),We.yy.lexer=tt,We.yy.parser=this,typeof tt.yylloc>"u"&&(tt.yylloc={});var Se=tt.yylloc;K.push(Se);var Et=tt.options&&tt.options.ranges;typeof We.yy.parseError=="function"?this.parseError=We.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function De(dt){ne.length=ne.length-2*dt,pe.length=pe.length-dt,K.length=K.length-dt}b(De,"popStack");function mt(){var dt;return dt=V.pop()||tt.lex()||Ke,typeof dt!="number"&&(dt instanceof Array&&(V=dt,dt=V.pop()),dt=ye.symbols_[dt]||dt),dt}b(mt,"lex");for(var Tt,jt,_t,Rt,bt,ke,yt={},xt,it,Me,ut;;){if(_t=ne[ne.length-1],this.defaultActions[_t]?Rt=this.defaultActions[_t]:((Tt===null||typeof Tt>"u")&&(Tt=mt()),Rt=ve[_t]&&ve[_t][Tt]),typeof Rt>"u"||!Rt.length||!Rt[0]){var at="";ut=[];for(xt in ve[_t])this.terminals_[xt]&&xt>Fe&&ut.push("'"+this.terminals_[xt]+"'");tt.showPosition?at="Parse error on line "+(je+1)+`: `+tt.showPosition()+` Expecting `+ut.join(", ")+", got '"+(this.terminals_[Tt]||Tt)+"'":at="Parse error on line "+(je+1)+": Unexpected "+(Tt==Ke?"end of input":"'"+(this.terminals_[Tt]||Tt)+"'"),this.parseError(at,{text:tt.match,token:this.terminals_[Tt]||Tt,line:tt.yylineno,loc:Se,expected:ut})}if(Rt[0]instanceof Array&&Rt.length>1)throw new Error("Parse Error: multiple actions possible at state: "+_t+", token: "+Tt);switch(Rt[0]){case 1:ne.push(Tt),pe.push(tt.yytext),K.push(tt.yylloc),ne.push(Rt[1]),Tt=null,jt?(Tt=jt,jt=null):(Ne=tt.yyleng,Z=tt.yytext,je=tt.yylineno,Se=tt.yylloc,ze>0&&ze--);break;case 2:if(it=this.productions_[Rt[1]][1],yt.$=pe[pe.length-it],yt._$={first_line:K[K.length-(it||1)].first_line,last_line:K[K.length-1].last_line,first_column:K[K.length-(it||1)].first_column,last_column:K[K.length-1].last_column},Et&&(yt._$.range=[K[K.length-(it||1)].range[0],K[K.length-1].range[1]]),ke=this.performAction.apply(yt,[Z,Ne,je,We.yy,Rt[1],pe,K].concat(Ve)),typeof ke<"u")return ke;it&&(ne=ne.slice(0,-1*it*2),pe=pe.slice(0,-1*it),K=K.slice(0,-1*it)),ne.push(this.productions_[Rt[1]][0]),pe.push(yt.$),K.push(yt._$),Me=ve[ne[ne.length-2]][ne[ne.length-1]],ne.push(Me);break;case 3:return!0}}return!0},"parse")},xe=(function(){var ge={EOF:1,parseError:b(function(ye,ne){if(this.yy.parser)this.yy.parser.parseError(ye,ne);else throw new Error(ye)},"parseError"),setInput:b(function(Ie,ye){return this.yy=ye||this.yy||{},this._input=Ie,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var Ie=this._input[0];this.yytext+=Ie,this.yyleng++,this.offset++,this.match+=Ie,this.matched+=Ie;var ye=Ie.match(/(?:\r\n?|\n).*/g);return ye?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Ie},"input"),unput:b(function(Ie){var ye=Ie.length,ne=Ie.split(/(?:\r\n?|\n)/g);this._input=Ie+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-ye),this.offset-=ye;var V=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),ne.length-1&&(this.yylineno-=ne.length-1);var pe=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:ne?(ne.length===V.length?this.yylloc.first_column:0)+V[V.length-ne.length].length-ne[0].length:this.yylloc.first_column-ye},this.options.ranges&&(this.yylloc.range=[pe[0],pe[0]+this.yyleng-ye]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(Ie){this.unput(this.match.slice(Ie))},"less"),pastInput:b(function(){var Ie=this.matched.substr(0,this.matched.length-this.match.length);return(Ie.length>20?"...":"")+Ie.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var Ie=this.match;return Ie.length<20&&(Ie+=this._input.substr(0,20-Ie.length)),(Ie.substr(0,20)+(Ie.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var Ie=this.pastInput(),ye=new Array(Ie.length+1).join("-");return Ie+this.upcomingInput()+` `+ye+"^"},"showPosition"),test_match:b(function(Ie,ye){var ne,V,pe;if(this.options.backtrack_lexer&&(pe={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(pe.yylloc.range=this.yylloc.range.slice(0))),V=Ie[0].match(/(?:\r\n?|\n).*/g),V&&(this.yylineno+=V.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:V?V[V.length-1].length-V[V.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Ie[0].length},this.yytext+=Ie[0],this.match+=Ie[0],this.matches=Ie,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Ie[0].length),this.matched+=Ie[0],ne=this.performAction.call(this,this.yy,this,ye,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),ne)return ne;if(this._backtrack){for(var K in pe)this[K]=pe[K];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Ie,ye,ne,V;this._more||(this.yytext="",this.match="");for(var pe=this._currentRules(),K=0;Kye[0].length)){if(ye=ne,V=K,this.options.backtrack_lexer){if(Ie=this.test_match(ne,pe[K]),Ie!==!1)return Ie;if(this._backtrack){ye=!1;continue}else return!1}else if(!this.options.flex)break}return ye?(Ie=this.test_match(ye,pe[V]),Ie!==!1?Ie:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var ye=this.next();return ye||this.lex()},"lex"),begin:b(function(ye){this.conditionStack.push(ye)},"begin"),popState:b(function(){var ye=this.conditionStack.length-1;return ye>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(ye){return ye=this.conditionStack.length-1-Math.abs(ye||0),ye>=0?this.conditionStack[ye]:"INITIAL"},"topState"),pushState:b(function(ye){this.begin(ye)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(ye,ne,V,pe){var K=pe;switch(V){case 0:return 62;case 1:return 63;case 2:return 64;case 3:return 65;case 4:break;case 5:break;case 6:return this.begin("acc_title"),33;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),35;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 8;case 14:break;case 15:return 7;case 16:return 7;case 17:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 19:this.popState();break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 79;case 22:this.popState();break;case 23:return 80;case 24:this.popState();break;case 25:return"STR";case 26:this.begin("string");break;case 27:return 82;case 28:return 57;case 29:return this.begin("namespace"),42;break;case 30:return this.popState(),8;break;case 31:break;case 32:return this.begin("namespace-body"),39;break;case 33:this.popState(),this.less(0);break;case 34:return this.popState(),41;break;case 35:return"EOF_IN_STRUCT";case 36:return 8;case 37:break;case 38:return"EDGE_STATE";case 39:return this.begin("class"),48;break;case 40:return this.popState(),8;break;case 41:break;case 42:return this.popState(),this.popState(),41;break;case 43:return this.begin("class-body"),39;break;case 44:return this.popState(),41;break;case 45:return"EOF_IN_STRUCT";case 46:return"EDGE_STATE";case 47:return"OPEN_IN_STRUCT";case 48:break;case 49:return"MEMBER";case 50:return 83;case 51:return 75;case 52:return 76;case 53:return 78;case 54:return 54;case 55:return 56;case 56:return 46;case 57:return 47;case 58:return 81;case 59:this.popState();break;case 60:return"GENERICTYPE";case 61:this.begin("generic");break;case 62:this.popState();break;case 63:return"BQUOTE_STR";case 64:this.begin("bqstring");break;case 65:return 77;case 66:return 77;case 67:return 77;case 68:return 77;case 69:return 69;case 70:return 69;case 71:return 71;case 72:return 71;case 73:return 70;case 74:return 68;case 75:return 72;case 76:return 73;case 77:return 74;case 78:return 22;case 79:return 44;case 80:return 100;case 81:return 18;case 82:return"PLUS";case 83:return 87;case 84:return 61;case 85:return 89;case 86:return 89;case 87:return 90;case 88:return"EQUALS";case 89:return"EQUALS";case 90:return 60;case 91:return 12;case 92:return 14;case 93:return"PUNCTUATION";case 94:return 86;case 95:return 102;case 96:return 50;case 97:return 50;case 98:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,29,34,35,36,37,38,39,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},namespace:{rules:[26,29,30,31,32,33,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},"class-body":{rules:[26,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},class:{rules:[26,40,41,42,43,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_descr:{rules:[9,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_title:{rules:[7,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},callback_args:{rules:[22,23,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},callback_name:{rules:[19,20,21,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},href:{rules:[26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},struct:{rules:[26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},generic:{rules:[26,50,51,52,53,54,55,56,57,58,59,60,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},bqstring:{rules:[26,50,51,52,53,54,55,56,57,58,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},string:{rules:[24,25,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,39,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98],inclusive:!0}}};return ge})();he.lexer=xe;function ce(){this.yy={}}return b(ce,"Parser"),ce.prototype=he,he.Parser=ce,new ce})();sae.parser=sae;TO=sae,fZe=["#","+","~","-",""],dZe=class{static{b(this,"ClassMember")}constructor(e,t){this.memberType=t,this.visibility="",this.classifier="",this.text="";let r=Mr(e,Be());this.parseMember(r)}getDisplayDetails(){let e=this.visibility+Af(this.id);this.memberType==="method"&&(e+=`(${Af(this.parameters.trim())})`,this.returnType&&(e+=" : "+Af(this.returnType))),e=e.trim();let t=this.parseClassifier();return{displayText:e,cssStyle:t}}parseMember(e){let t="";if(this.memberType==="method"){let i=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(e);if(i){let a=i[1]?i[1].trim():"";if(fZe.includes(a)&&(this.visibility=a),this.id=i[2],this.parameters=i[3]?i[3].trim():"",t=i[4]?i[4].trim():"",this.returnType=i[5]?i[5].trim():"",t===""){let s=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(s)&&(t=s,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{let n=e.length,i=e.substring(0,1),a=e.substring(n-1);fZe.includes(i)&&(this.visibility=i),/[$*]/.exec(a)&&(t=a),this.id=e.substring(this.visibility===""?0:1,t===""?n:n-1)}this.classifier=t,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();let r=`${this.visibility?"\\"+this.visibility:""}${Af(this.id)}${this.memberType==="method"?`(${Af(this.parameters)})${this.returnType?" : "+Af(this.returnType):""}`:""}`;this.text=r.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},kO="classId-",pZe=0,$2=b(e=>Ct.sanitizeText(e,Be()),"sanitizeText"),CO=class oae{constructor(){this.relations=[],this.classes=new Map,this.styleClasses=new Map,this.notes=new Map,this.interfaces=[],this.namespaces=new Map,this.namespaceCounter=0,this.namespaceStack=[],this.diagramId="",this.functions=[],this.lineType={LINE:0,DOTTED_LINE:1},this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},this.setupToolTips=b(t=>{let r=iw();ct(t).select("svg").selectAll("g").filter(function(){return ct(this).attr("title")!==null}).on("mouseover",a=>{let s=ct(a.currentTarget),o=s.attr("title");if(!o)return;let l=a.currentTarget.getBoundingClientRect();r.transition().duration(200).style("opacity",".9"),r.html(Ul.sanitize(o)).style("left",`${window.scrollX+l.left+l.width/2}px`).style("top",`${window.scrollY+l.bottom+4}px`),s.classed("hover",!0)}).on("mouseout",a=>{r.transition().duration(500).style("opacity",0),ct(a.currentTarget).classed("hover",!1)})},"setupToolTips"),this.direction="TB",this.setAccTitle=Yr,this.getAccTitle=Qr,this.setAccDescription=Jr,this.getAccDescription=en,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getConfig=b(()=>Be().class,"getConfig"),this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.popNamespace=this.popNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}static{b(this,"ClassDB")}splitClassNameAndType(t){let r=Ct.sanitizeText(t,Be()),n="",i=r;if(r.indexOf("~")>0){let a=r.split("~");i=$2(a[0]),n=$2(a[1])}return{className:i,type:n}}setClassLabel(t,r){let n=Ct.sanitizeText(t,Be());r&&(r=$2(r));let{className:i}=this.splitClassNameAndType(n);this.classes.get(i).label=r,this.classes.get(i).text=`${r}${this.classes.get(i).type?`<${this.classes.get(i).type}>`:""}`}addClass(t){let r=Ct.sanitizeText(t,Be()),{className:n,type:i}=this.splitClassNameAndType(r);if(this.classes.has(n))return;let a=Ct.sanitizeText(n,Be());this.classes.set(a,{id:a,type:i,label:a,text:`${a}${i?`<${i}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:kO+a+"-"+pZe}),pZe++}addInterface(t,r){let n={id:`interface${this.interfaces.length}`,label:t,classId:r};this.interfaces.push(n)}setDiagramId(t){this.diagramId=t}lookUpDomId(t){let r=Ct.sanitizeText(t,Be());if(this.classes.has(r)){let n=this.classes.get(r).domId;return this.diagramId?`${this.diagramId}-${n}`:n}throw new Error("Class not found: "+r)}clear(){this.relations=[],this.classes=new Map,this.notes=new Map,this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.namespaceStack=[],this.diagramId="",this.direction="TB",Nr()}getClass(t){return this.classes.get(t)}getClasses(){return this.classes}getRelations(){return this.relations}getNote(t){let r=typeof t=="number"?`note${t}`:t;return this.notes.get(r)}getNotes(){return this.notes}addRelation(t){se.debug("Adding relation: "+JSON.stringify(t));let r=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];t.relation.type1===this.relationType.LOLLIPOP&&!r.includes(t.relation.type2)?(this.addClass(t.id2),this.addInterface(t.id1,t.id2),t.id1=`interface${this.interfaces.length-1}`):t.relation.type2===this.relationType.LOLLIPOP&&!r.includes(t.relation.type1)?(this.addClass(t.id1),this.addInterface(t.id2,t.id1),t.id2=`interface${this.interfaces.length-1}`):(this.addClass(t.id1),this.addClass(t.id2)),t.id1=this.splitClassNameAndType(t.id1).className,t.id2=this.splitClassNameAndType(t.id2).className,t.relationTitle1=Ct.sanitizeText(t.relationTitle1.trim(),Be()),t.relationTitle2=Ct.sanitizeText(t.relationTitle2.trim(),Be()),this.relations.push(t)}addAnnotation(t,r){let n=this.splitClassNameAndType(t).className;this.classes.get(n).annotations.push(r)}addMember(t,r){this.addClass(t);let n=this.splitClassNameAndType(t).className,i=this.classes.get(n);if(typeof r=="string"){let a=r.trim();a.startsWith("<<")&&a.endsWith(">>")?i.annotations.push($2(a.substring(2,a.length-2))):a.indexOf(")")>0?i.methods.push(new dZe(a,"method")):a&&i.members.push(new dZe(a,"attribute"))}}addMembers(t,r){Array.isArray(r)&&(r.reverse(),r.forEach(n=>this.addMember(t,n)))}addNote(t,r){let n=this.notes.size,i={id:`note${n}`,class:r,text:t,index:n};return this.notes.set(i.id,i),i.id}cleanupLabel(t){return t.startsWith(":")&&(t=t.substring(1)),$2(t.trim())}setCssClass(t,r){t.split(",").forEach(n=>{let i=n;/\d/.exec(n[0])&&(i=kO+i),i=this.splitClassNameAndType(i).className;let a=this.classes.get(i);a&&(a.cssClasses+=" "+r)})}defineClass(t,r){for(let n of t){let i=this.styleClasses.get(n);i===void 0&&(i={id:n,styles:[],textStyles:[]},this.styleClasses.set(n,i)),r&&r.forEach(a=>{if(/color/.exec(a)){let s=a.replace("fill","bgFill");i.textStyles.push(s)}i.styles.push(a)}),this.classes.forEach(a=>{a.cssClasses.includes(n)&&a.styles.push(...r.flatMap(s=>s.split(",")))})}}setTooltip(t,r){t.split(",").forEach(n=>{if(r!==void 0){let i=this.splitClassNameAndType(n).className,a=this.classes.get(i);a&&(a.tooltip=$2(r))}})}getTooltip(t,r){return r&&this.namespaces.has(r)?this.namespaces.get(r).classes.get(t).tooltip:this.classes.get(t).tooltip}setLink(t,r,n){let i=Be();t.split(",").forEach(a=>{let s=a;/\d/.exec(a[0])&&(s=kO+s),s=this.splitClassNameAndType(s).className;let o=this.classes.get(s);o&&(o.link=pr.formatUrl(r,i),i.securityLevel==="sandbox"?o.linkTarget="_top":typeof n=="string"?o.linkTarget=$2(n):o.linkTarget="_blank")}),this.setCssClass(t,"clickable")}setClickEvent(t,r,n){t.split(",").forEach(i=>{this.setClickFunc(i,r,n);let a=this.splitClassNameAndType(i).className,s=this.classes.get(a);s&&(s.haveCallback=!0)}),this.setCssClass(t,"clickable")}setClickFunc(t,r,n){let i=Ct.sanitizeText(t,Be());if(Be().securityLevel!=="loose"||r===void 0)return;let s=this.splitClassNameAndType(i).className;if(this.classes.has(s)){let o=[];if(typeof n=="string"){o=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let l=0;l{let l=this.lookUpDomId(s),u=document.querySelector(`[id="${l}"]`);u!==null&&u.addEventListener("click",()=>{pr.runFunc(r,...o)},!1)})}}bindFunctions(t){this.functions.forEach(r=>{r(t)})}escapeHtml(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}getDirection(){return this.direction}setDirection(t){this.direction=t}static resolveQualifiedId(t,r){let n=r.at(-1);return n?`${n}.${t}`:t}static getAncestorIds(t){let r=t.split("."),n=new Array(r.length);n[0]=r[0];for(let i=1;i0?a[s-1]:void 0,u=s===a.length-1,h=u&&r?r:i[s];this.namespaces.has(o)?u&&(this.namespaces.get(o).explicit=!0):this.namespaces.set(o,this.createNamespaceNode(o,h,l,u)),l&&this.linkParentChild(l,o)}return n}popNamespace(){this.namespaceStack.pop()}getNamespace(t){return this.namespaces.get(t)}getNamespaces(){return this.namespaces}addClassesToNamespace(t,r,n){if(this.namespaces.has(t)){for(let i of r){let{className:a}=this.splitClassNameAndType(i),s=this.getClass(a);s.parent=t,this.namespaces.get(t).classes.set(a,s)}for(let i of n){let a=this.getNote(i);a.parent=t,this.namespaces.get(t).notes.set(i,a)}}}setCssStyle(t,r){let n=this.classes.get(t);if(!(!r||!n))for(let i of r)i.includes(",")?n.styles.push(...i.split(",")):n.styles.push(i)}getArrowMarker(t){let r;switch(t){case 0:r="aggregation";break;case 1:r="extension";break;case 2:r="composition";break;case 3:r="dependency";break;case 4:r="lollipop";break;default:r="none"}return r}resolveExplicitAncestor(t){let r=t;for(;r;){let n=this.namespaces.get(r);if(!n)return;if(n.explicit)return r;r=n.parent}}getData(){let t=[],r=[],n=Be(),i=n.class?.hierarchicalNamespaces??!0;for(let s of this.namespaces.values()){if(!i&&!s.explicit)continue;let o={id:s.id,label:i?s.label:s.id,isGroup:!0,padding:n.class.padding??16,shape:"rect",cssStyles:[],look:n.look,parentId:i?s.parent:void 0};t.push(o)}for(let s of this.classes.values()){let o=i?s.parent:this.resolveExplicitAncestor(s.parent),l={...s,type:void 0,isGroup:!1,parentId:o,look:n.look};t.push(l)}for(let s of this.notes.values()){let o=i?s.parent:this.resolveExplicitAncestor(s.parent),l={id:s.id,label:s.text,isGroup:!1,shape:"note",padding:n.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${n.themeVariables.noteBkgColor}`,`stroke: ${n.themeVariables.noteBorderColor}`],look:n.look,parentId:o,labelType:"markdown"};t.push(l);let u=this.classes.get(s.class)?.id;if(u){let h={id:`edgeNote${s.index}`,start:s.id,end:u,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:n.look};r.push(h)}}for(let s of this.interfaces){let o={id:s.id,label:s.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:n.look};t.push(o)}let a=0;for(let s of this.relations){a++;let o={id:zf(s.id1,s.id2,{prefix:"id",counter:a}),start:s.id1,end:s.id2,type:"normal",label:s.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(s.relation.type1),arrowTypeEnd:this.getArrowMarker(s.relation.type2),startLabelRight:s.relationTitle1==="none"?"":s.relationTitle1,endLabelLeft:s.relationTitle2==="none"?"":s.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:s.style||"",pattern:s.relation.lineType==1?"dashed":"solid",look:n.look,labelType:"markdown"};r.push(o)}return{nodes:t,edges:r,other:{},config:n,direction:this.getDirection()}}},HZt=b(e=>`g.classGroup text { +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var ye=this.next();return ye||this.lex()},"lex"),begin:b(function(ye){this.conditionStack.push(ye)},"begin"),popState:b(function(){var ye=this.conditionStack.length-1;return ye>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(ye){return ye=this.conditionStack.length-1-Math.abs(ye||0),ye>=0?this.conditionStack[ye]:"INITIAL"},"topState"),pushState:b(function(ye){this.begin(ye)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(ye,ne,V,pe){var K=pe;switch(V){case 0:return 62;case 1:return 63;case 2:return 64;case 3:return 65;case 4:break;case 5:break;case 6:return this.begin("acc_title"),33;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),35;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 8;case 14:break;case 15:return 7;case 16:return 7;case 17:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 19:this.popState();break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 79;case 22:this.popState();break;case 23:return 80;case 24:this.popState();break;case 25:return"STR";case 26:this.begin("string");break;case 27:return 82;case 28:return 57;case 29:return this.begin("namespace"),42;break;case 30:return this.popState(),8;break;case 31:break;case 32:return this.begin("namespace-body"),39;break;case 33:this.popState(),this.less(0);break;case 34:return this.popState(),41;break;case 35:return"EOF_IN_STRUCT";case 36:return 8;case 37:break;case 38:return"EDGE_STATE";case 39:return this.begin("class"),48;break;case 40:return this.popState(),8;break;case 41:break;case 42:return this.popState(),this.popState(),41;break;case 43:return this.begin("class-body"),39;break;case 44:return this.popState(),41;break;case 45:return"EOF_IN_STRUCT";case 46:return"EDGE_STATE";case 47:return"OPEN_IN_STRUCT";case 48:break;case 49:return"MEMBER";case 50:return 83;case 51:return 75;case 52:return 76;case 53:return 78;case 54:return 54;case 55:return 56;case 56:return 46;case 57:return 47;case 58:return 81;case 59:this.popState();break;case 60:return"GENERICTYPE";case 61:this.begin("generic");break;case 62:this.popState();break;case 63:return"BQUOTE_STR";case 64:this.begin("bqstring");break;case 65:return 77;case 66:return 77;case 67:return 77;case 68:return 77;case 69:return 69;case 70:return 69;case 71:return 71;case 72:return 71;case 73:return 70;case 74:return 68;case 75:return 72;case 76:return 73;case 77:return 74;case 78:return 22;case 79:return 44;case 80:return 100;case 81:return 18;case 82:return"PLUS";case 83:return 87;case 84:return 61;case 85:return 89;case 86:return 89;case 87:return 90;case 88:return"EQUALS";case 89:return"EQUALS";case 90:return 60;case 91:return 12;case 92:return 14;case 93:return"PUNCTUATION";case 94:return 86;case 95:return 102;case 96:return 50;case 97:return 50;case 98:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,29,34,35,36,37,38,39,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},namespace:{rules:[26,29,30,31,32,33,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},"class-body":{rules:[26,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},class:{rules:[26,40,41,42,43,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_descr:{rules:[9,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_title:{rules:[7,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},callback_args:{rules:[22,23,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},callback_name:{rules:[19,20,21,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},href:{rules:[26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},struct:{rules:[26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},generic:{rules:[26,50,51,52,53,54,55,56,57,58,59,60,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},bqstring:{rules:[26,50,51,52,53,54,55,56,57,58,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},string:{rules:[24,25,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,39,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98],inclusive:!0}}};return ge})();he.lexer=xe;function ce(){this.yy={}}return b(ce,"Parser"),ce.prototype=he,he.Parser=ce,new ce})();lae.parser=lae;TO=lae,pZe=["#","+","~","-",""],mZe=class{static{b(this,"ClassMember")}constructor(e,t){this.memberType=t,this.visibility="",this.classifier="",this.text="";let r=Mr(e,Be());this.parseMember(r)}getDisplayDetails(){let e=this.visibility+Af(this.id);this.memberType==="method"&&(e+=`(${Af(this.parameters.trim())})`,this.returnType&&(e+=" : "+Af(this.returnType))),e=e.trim();let t=this.parseClassifier();return{displayText:e,cssStyle:t}}parseMember(e){let t="";if(this.memberType==="method"){let i=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(e);if(i){let a=i[1]?i[1].trim():"";if(pZe.includes(a)&&(this.visibility=a),this.id=i[2],this.parameters=i[3]?i[3].trim():"",t=i[4]?i[4].trim():"",this.returnType=i[5]?i[5].trim():"",t===""){let s=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(s)&&(t=s,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{let n=e.length,i=e.substring(0,1),a=e.substring(n-1);pZe.includes(i)&&(this.visibility=i),/[$*]/.exec(a)&&(t=a),this.id=e.substring(this.visibility===""?0:1,t===""?n:n-1)}this.classifier=t,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();let r=`${this.visibility?"\\"+this.visibility:""}${Af(this.id)}${this.memberType==="method"?`(${Af(this.parameters)})${this.returnType?" : "+Af(this.returnType):""}`:""}`;this.text=r.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},kO="classId-",gZe=0,$2=b(e=>Ct.sanitizeText(e,Be()),"sanitizeText"),CO=class cae{constructor(){this.relations=[],this.classes=new Map,this.styleClasses=new Map,this.notes=new Map,this.interfaces=[],this.namespaces=new Map,this.namespaceCounter=0,this.namespaceStack=[],this.diagramId="",this.functions=[],this.lineType={LINE:0,DOTTED_LINE:1},this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},this.setupToolTips=b(t=>{let r=iw();ct(t).select("svg").selectAll("g").filter(function(){return ct(this).attr("title")!==null}).on("mouseover",a=>{let s=ct(a.currentTarget),o=s.attr("title");if(!o)return;let l=a.currentTarget.getBoundingClientRect();r.transition().duration(200).style("opacity",".9"),r.html(Yl.sanitize(o)).style("left",`${window.scrollX+l.left+l.width/2}px`).style("top",`${window.scrollY+l.bottom+4}px`),s.classed("hover",!0)}).on("mouseout",a=>{r.transition().duration(500).style("opacity",0),ct(a.currentTarget).classed("hover",!1)})},"setupToolTips"),this.direction="TB",this.setAccTitle=Yr,this.getAccTitle=Qr,this.setAccDescription=Jr,this.getAccDescription=en,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getConfig=b(()=>Be().class,"getConfig"),this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.popNamespace=this.popNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}static{b(this,"ClassDB")}splitClassNameAndType(t){let r=Ct.sanitizeText(t,Be()),n="",i=r;if(r.indexOf("~")>0){let a=r.split("~");i=$2(a[0]),n=$2(a[1])}return{className:i,type:n}}setClassLabel(t,r){let n=Ct.sanitizeText(t,Be());r&&(r=$2(r));let{className:i}=this.splitClassNameAndType(n);this.classes.get(i).label=r,this.classes.get(i).text=`${r}${this.classes.get(i).type?`<${this.classes.get(i).type}>`:""}`}addClass(t){let r=Ct.sanitizeText(t,Be()),{className:n,type:i}=this.splitClassNameAndType(r);if(this.classes.has(n))return;let a=Ct.sanitizeText(n,Be());this.classes.set(a,{id:a,type:i,label:a,text:`${a}${i?`<${i}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:kO+a+"-"+gZe}),gZe++}addInterface(t,r){let n={id:`interface${this.interfaces.length}`,label:t,classId:r};this.interfaces.push(n)}setDiagramId(t){this.diagramId=t}lookUpDomId(t){let r=Ct.sanitizeText(t,Be());if(this.classes.has(r)){let n=this.classes.get(r).domId;return this.diagramId?`${this.diagramId}-${n}`:n}throw new Error("Class not found: "+r)}clear(){this.relations=[],this.classes=new Map,this.notes=new Map,this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.namespaceStack=[],this.diagramId="",this.direction="TB",Nr()}getClass(t){return this.classes.get(t)}getClasses(){return this.classes}getRelations(){return this.relations}getNote(t){let r=typeof t=="number"?`note${t}`:t;return this.notes.get(r)}getNotes(){return this.notes}addRelation(t){se.debug("Adding relation: "+JSON.stringify(t));let r=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];t.relation.type1===this.relationType.LOLLIPOP&&!r.includes(t.relation.type2)?(this.addClass(t.id2),this.addInterface(t.id1,t.id2),t.id1=`interface${this.interfaces.length-1}`):t.relation.type2===this.relationType.LOLLIPOP&&!r.includes(t.relation.type1)?(this.addClass(t.id1),this.addInterface(t.id2,t.id1),t.id2=`interface${this.interfaces.length-1}`):(this.addClass(t.id1),this.addClass(t.id2)),t.id1=this.splitClassNameAndType(t.id1).className,t.id2=this.splitClassNameAndType(t.id2).className,t.relationTitle1=Ct.sanitizeText(t.relationTitle1.trim(),Be()),t.relationTitle2=Ct.sanitizeText(t.relationTitle2.trim(),Be()),this.relations.push(t)}addAnnotation(t,r){let n=this.splitClassNameAndType(t).className;this.classes.get(n).annotations.push(r)}addMember(t,r){this.addClass(t);let n=this.splitClassNameAndType(t).className,i=this.classes.get(n);if(typeof r=="string"){let a=r.trim();a.startsWith("<<")&&a.endsWith(">>")?i.annotations.push($2(a.substring(2,a.length-2))):a.indexOf(")")>0?i.methods.push(new mZe(a,"method")):a&&i.members.push(new mZe(a,"attribute"))}}addMembers(t,r){Array.isArray(r)&&(r.reverse(),r.forEach(n=>this.addMember(t,n)))}addNote(t,r){let n=this.notes.size,i={id:`note${n}`,class:r,text:t,index:n};return this.notes.set(i.id,i),i.id}cleanupLabel(t){return t.startsWith(":")&&(t=t.substring(1)),$2(t.trim())}setCssClass(t,r){t.split(",").forEach(n=>{let i=n;/\d/.exec(n[0])&&(i=kO+i),i=this.splitClassNameAndType(i).className;let a=this.classes.get(i);a&&(a.cssClasses+=" "+r)})}defineClass(t,r){for(let n of t){let i=this.styleClasses.get(n);i===void 0&&(i={id:n,styles:[],textStyles:[]},this.styleClasses.set(n,i)),r&&r.forEach(a=>{if(/color/.exec(a)){let s=a.replace("fill","bgFill");i.textStyles.push(s)}i.styles.push(a)}),this.classes.forEach(a=>{a.cssClasses.includes(n)&&a.styles.push(...r.flatMap(s=>s.split(",")))})}}setTooltip(t,r){t.split(",").forEach(n=>{if(r!==void 0){let i=this.splitClassNameAndType(n).className,a=this.classes.get(i);a&&(a.tooltip=$2(r))}})}getTooltip(t,r){return r&&this.namespaces.has(r)?this.namespaces.get(r).classes.get(t).tooltip:this.classes.get(t).tooltip}setLink(t,r,n){let i=Be();t.split(",").forEach(a=>{let s=a;/\d/.exec(a[0])&&(s=kO+s),s=this.splitClassNameAndType(s).className;let o=this.classes.get(s);o&&(o.link=pr.formatUrl(r,i),i.securityLevel==="sandbox"?o.linkTarget="_top":typeof n=="string"?o.linkTarget=$2(n):o.linkTarget="_blank")}),this.setCssClass(t,"clickable")}setClickEvent(t,r,n){t.split(",").forEach(i=>{this.setClickFunc(i,r,n);let a=this.splitClassNameAndType(i).className,s=this.classes.get(a);s&&(s.haveCallback=!0)}),this.setCssClass(t,"clickable")}setClickFunc(t,r,n){let i=Ct.sanitizeText(t,Be());if(Be().securityLevel!=="loose"||r===void 0)return;let s=this.splitClassNameAndType(i).className;if(this.classes.has(s)){let o=[];if(typeof n=="string"){o=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let l=0;l{let l=this.lookUpDomId(s),u=document.querySelector(`[id="${l}"]`);u!==null&&u.addEventListener("click",()=>{pr.runFunc(r,...o)},!1)})}}bindFunctions(t){this.functions.forEach(r=>{r(t)})}escapeHtml(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}getDirection(){return this.direction}setDirection(t){this.direction=t}static resolveQualifiedId(t,r){let n=r.at(-1);return n?`${n}.${t}`:t}static getAncestorIds(t){let r=t.split("."),n=new Array(r.length);n[0]=r[0];for(let i=1;i0?a[s-1]:void 0,u=s===a.length-1,h=u&&r?r:i[s];this.namespaces.has(o)?u&&(this.namespaces.get(o).explicit=!0):this.namespaces.set(o,this.createNamespaceNode(o,h,l,u)),l&&this.linkParentChild(l,o)}return n}popNamespace(){this.namespaceStack.pop()}getNamespace(t){return this.namespaces.get(t)}getNamespaces(){return this.namespaces}addClassesToNamespace(t,r,n){if(this.namespaces.has(t)){for(let i of r){let{className:a}=this.splitClassNameAndType(i),s=this.getClass(a);s.parent=t,this.namespaces.get(t).classes.set(a,s)}for(let i of n){let a=this.getNote(i);a.parent=t,this.namespaces.get(t).notes.set(i,a)}}}setCssStyle(t,r){let n=this.classes.get(t);if(!(!r||!n))for(let i of r)i.includes(",")?n.styles.push(...i.split(",")):n.styles.push(i)}getArrowMarker(t){let r;switch(t){case 0:r="aggregation";break;case 1:r="extension";break;case 2:r="composition";break;case 3:r="dependency";break;case 4:r="lollipop";break;default:r="none"}return r}resolveExplicitAncestor(t){let r=t;for(;r;){let n=this.namespaces.get(r);if(!n)return;if(n.explicit)return r;r=n.parent}}getData(){let t=[],r=[],n=Be(),i=n.class?.hierarchicalNamespaces??!0;for(let s of this.namespaces.values()){if(!i&&!s.explicit)continue;let o={id:s.id,label:i?s.label:s.id,isGroup:!0,padding:n.class.padding??16,shape:"rect",cssStyles:[],look:n.look,parentId:i?s.parent:void 0};t.push(o)}for(let s of this.classes.values()){let o=i?s.parent:this.resolveExplicitAncestor(s.parent),l={...s,type:void 0,isGroup:!1,parentId:o,look:n.look};t.push(l)}for(let s of this.notes.values()){let o=i?s.parent:this.resolveExplicitAncestor(s.parent),l={id:s.id,label:s.text,isGroup:!1,shape:"note",padding:n.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${n.themeVariables.noteBkgColor}`,`stroke: ${n.themeVariables.noteBorderColor}`],look:n.look,parentId:o,labelType:"markdown"};t.push(l);let u=this.classes.get(s.class)?.id;if(u){let h={id:`edgeNote${s.index}`,start:s.id,end:u,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:n.look};r.push(h)}}for(let s of this.interfaces){let o={id:s.id,label:s.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:n.look};t.push(o)}let a=0;for(let s of this.relations){a++;let o={id:zf(s.id1,s.id2,{prefix:"id",counter:a}),start:s.id1,end:s.id2,type:"normal",label:s.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(s.relation.type1),arrowTypeEnd:this.getArrowMarker(s.relation.type2),startLabelRight:s.relationTitle1==="none"?"":s.relationTitle1,endLabelLeft:s.relationTitle2==="none"?"":s.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:s.style||"",pattern:s.relation.lineType==1?"dashed":"solid",look:n.look,labelType:"markdown"};r.push(o)}return{nodes:t,edges:r,other:{},config:n,direction:this.getDirection()}}},jZt=b(e=>`g.classGroup text { fill: ${e.nodeBorder||e.classText}; stroke: none; font-family: ${e.fontFamily}; @@ -2204,12 +2204,12 @@ g.classGroup line { text-align: center; } ${id()} -`,"getStyles"),SO=HZt,UZt=b((e,t="TB")=>{if(!e.doc)return t;let r=t;for(let n of e.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir"),YZt=b(function(e,t){return t.db.getClasses()},"getClasses"),XZt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing class diagram (v3)",t);let{securityLevel:i,state:a,layout:s}=Be();n.db.setDiagramId(t);let o=n.db.getData(),l=zu(t,i);o.type=n.type,o.layoutAlgorithm=td(s),o.nodeSpacing=a?.nodeSpacing||50,o.rankSpacing=a?.rankSpacing||50,o.markers=["aggregation","extension","composition","dependency","lollipop"],o.diagramId=t,await Ou(o,l);let u=8;pr.insertTitle(l,"classDiagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),sc(l,u,"classDiagram",a?.useMaxWidth??!0)},"draw"),EO={getClasses:YZt,draw:XZt,getDir:UZt}});var mZe={};Tr(mZe,{diagram:()=>jZt});var jZt,gZe=W(()=>{lae();ad();Uc();oc();ic();Hc();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();jZt={parser:TO,get db(){return new CO},renderer:EO,styles:SO,init:b(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var yZe={};Tr(yZe,{diagram:()=>KZt});var KZt,vZe=W(()=>{lae();ad();Uc();oc();ic();Hc();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();KZt={parser:TO,get db(){return new CO},renderer:EO,styles:SO,init:b(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});function RO(e="",t=0,r="",n=dae){let i=r!==null&&r.length>0?`${n}${r}`:"";return`${mQt}-${e}${i}-${t}`}function D6(e,t,r){if(!t.id||t.id===""||t.id==="")return;t.cssClasses&&(Array.isArray(t.cssCompiledStyles)||(t.cssCompiledStyles=[]),t.cssClasses.split(" ").forEach(i=>{let a=r.get(i);a&&(t.cssCompiledStyles=[...t.cssCompiledStyles??[],...a.styles])}));let n=e.find(i=>i.id===t.id);n?Object.assign(n,t):e.push(t)}function FZe(e){return e?.classes?.join(" ")??""}function $Ze(e){return e?.styles??[]}var hae,LO,ZZt,EZe,xZe,fk,hk,fae,QZt,JZt,eQt,P6,AZe,_Ze,RZe,LZe,IZe,MZe,cae,uae,tQt,rQt,bZe,wZe,nQt,iQt,B6,aQt,sQt,NZe,oQt,lQt,cQt,uQt,hQt,fQt,dQt,pQt,DZe,OZe,mQt,dae,gQt,kZe,PZe,yQt,vQt,BZe,_O,e1,xQt,TZe,O6,bQt,Pl,CZe,SZe,AO,yp,wQt,IO,pae=W(()=>{Uc();oc();ic();Hc();Sn();_r();Rr();hr();fn();xb();hae=(function(){var e=b(function($,F,q,G){for(q=q||{},G=$.length;G--;q[$[G]]=F);return q},"o"),t=[1,2],r=[1,3],n=[1,4],i=[2,4],a=[1,9],s=[1,11],o=[1,16],l=[1,17],u=[1,18],h=[1,19],f=[1,33],d=[1,20],p=[1,21],m=[1,22],g=[1,23],y=[1,24],v=[1,26],x=[1,27],w=[1,28],C=[1,29],T=[1,30],k=[1,31],S=[1,32],E=[1,35],I=[1,36],L=[1,37],O=[1,38],R=[1,34],A=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],N=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],M=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],D={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:b(function(F,q,G,z,H,j,J){var U=j.length-1;switch(H){case 3:return z.setRootDoc(j[U]),j[U];break;case 4:this.$=[];break;case 5:j[U]!="nl"&&(j[U-1].push(j[U]),this.$=j[U-1]);break;case 6:case 7:this.$=j[U];break;case 8:this.$="nl";break;case 12:this.$=j[U];break;case 13:let ae=j[U-1];ae.description=z.trimColon(j[U]),this.$=ae;break;case 14:this.$={stmt:"relation",state1:j[U-2],state2:j[U]};break;case 15:let oe=z.trimColon(j[U]);this.$={stmt:"relation",state1:j[U-3],state2:j[U-1],description:oe};break;case 19:this.$={stmt:"state",id:j[U-3],type:"default",description:"",doc:j[U-1]};break;case 20:var le=j[U],ee=j[U-2].trim();if(j[U].match(":")){var ue=j[U].split(":");le=ue[0],ee=[ee,ue[1]]}this.$={stmt:"state",id:le,type:"default",description:ee};break;case 21:this.$={stmt:"state",id:j[U-3],type:"default",description:j[U-5],doc:j[U-1]};break;case 22:this.$={stmt:"state",id:j[U],type:"fork"};break;case 23:this.$={stmt:"state",id:j[U],type:"join"};break;case 24:this.$={stmt:"state",id:j[U],type:"choice"};break;case 25:this.$={stmt:"state",id:z.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:j[U-1].trim(),note:{position:j[U-2].trim(),text:j[U].trim()}};break;case 29:this.$=j[U].trim(),z.setAccTitle(this.$);break;case 30:case 31:this.$=j[U].trim(),z.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:j[U-3],url:j[U-2],tooltip:j[U-1]};break;case 33:this.$={stmt:"click",id:j[U-3],url:j[U-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:j[U-1].trim(),classes:j[U].trim()};break;case 36:this.$={stmt:"style",id:j[U-1].trim(),styleClass:j[U].trim()};break;case 37:this.$={stmt:"applyClass",id:j[U-1].trim(),styleClass:j[U].trim()};break;case 38:z.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:z.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:z.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:z.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:j[U].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:j[U-2].trim(),classes:[j[U].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:j[U-2].trim(),classes:[j[U].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:t,5:r,6:n},{1:[3]},{3:5,4:t,5:r,6:n},{3:6,4:t,5:r,6:n},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:o,17:l,19:u,22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,7]),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(A,[2,11]),e(A,[2,12],{14:[1,40],15:[1,41]}),e(A,[2,16]),{18:[1,42]},e(A,[2,18],{20:[1,43]}),{23:[1,44]},e(A,[2,22]),e(A,[2,23]),e(A,[2,24]),e(A,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(A,[2,28]),{34:[1,49]},{36:[1,50]},e(A,[2,31]),{13:51,24:f,57:R},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(N,[2,44],{58:[1,56]}),e(N,[2,45],{58:[1,57]}),e(A,[2,38]),e(A,[2,39]),e(A,[2,40]),e(A,[2,41]),e(A,[2,6]),e(A,[2,13]),{13:58,24:f,57:R},e(A,[2,17]),e(M,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(A,[2,29]),e(A,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(A,[2,14],{14:[1,71]}),{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,21:[1,72],22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(A,[2,34]),e(A,[2,35]),e(A,[2,36]),e(A,[2,37]),e(N,[2,46]),e(N,[2,47]),e(A,[2,15]),e(A,[2,19]),e(M,i,{7:78}),e(A,[2,26]),e(A,[2,27]),{5:[1,79]},{5:[1,80]},{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,21:[1,81],22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,32]),e(A,[2,33]),e(A,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:b(function(F,q){if(q.recoverable)this.trace(F);else{var G=new Error(F);throw G.hash=q,G}},"parseError"),parse:b(function(F){var q=this,G=[0],z=[],H=[null],j=[],J=this.table,U="",le=0,ee=0,ue=0,ae=2,oe=1,Re=j.slice.call(arguments,1),Te=Object.create(this.lexer),Oe={yy:{}};for(var qe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,qe)&&(Oe.yy[qe]=this.yy[qe]);Te.setInput(F,Oe.yy),Oe.yy.lexer=Te,Oe.yy.parser=this,typeof Te.yylloc>"u"&&(Te.yylloc={});var Ge=Te.yylloc;j.push(Ge);var fe=Te.options&&Te.options.ranges;typeof Oe.yy.parseError=="function"?this.parseError=Oe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ce(K){G.length=G.length-2*K,H.length=H.length-K,j.length=j.length-K}b(Ce,"popStack");function _e(){var K;return K=z.pop()||Te.lex()||oe,typeof K!="number"&&(K instanceof Array&&(z=K,K=z.pop()),K=q.symbols_[K]||K),K}b(_e,"lex");for(var de,ie,Q,he,xe,ce,ge={},Ie,ye,ne,V;;){if(Q=G[G.length-1],this.defaultActions[Q]?he=this.defaultActions[Q]:((de===null||typeof de>"u")&&(de=_e()),he=J[Q]&&J[Q][de]),typeof he>"u"||!he.length||!he[0]){var pe="";V=[];for(Ie in J[Q])this.terminals_[Ie]&&Ie>ae&&V.push("'"+this.terminals_[Ie]+"'");Te.showPosition?pe="Parse error on line "+(le+1)+`: +`,"getStyles"),SO=jZt,KZt=b((e,t="TB")=>{if(!e.doc)return t;let r=t;for(let n of e.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir"),ZZt=b(function(e,t){return t.db.getClasses()},"getClasses"),QZt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing class diagram (v3)",t);let{securityLevel:i,state:a,layout:s}=Be();n.db.setDiagramId(t);let o=n.db.getData(),l=zu(t,i);o.type=n.type,o.layoutAlgorithm=td(s),o.nodeSpacing=a?.nodeSpacing||50,o.rankSpacing=a?.rankSpacing||50,o.markers=["aggregation","extension","composition","dependency","lollipop"],o.diagramId=t,await Ou(o,l);let u=8;pr.insertTitle(l,"classDiagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),oc(l,u,"classDiagram",a?.useMaxWidth??!0)},"draw"),EO={getClasses:ZZt,draw:QZt,getDir:KZt}});var yZe={};Tr(yZe,{diagram:()=>JZt});var JZt,vZe=W(()=>{uae();ad();Uc();lc();ac();Hc();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();JZt={parser:TO,get db(){return new CO},renderer:EO,styles:SO,init:b(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var xZe={};Tr(xZe,{diagram:()=>eQt});var eQt,bZe=W(()=>{uae();ad();Uc();lc();ac();Hc();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();eQt={parser:TO,get db(){return new CO},renderer:EO,styles:SO,init:b(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});function RO(e="",t=0,r="",n=mae){let i=r!==null&&r.length>0?`${n}${r}`:"";return`${xQt}-${e}${i}-${t}`}function D6(e,t,r){if(!t.id||t.id===""||t.id==="")return;t.cssClasses&&(Array.isArray(t.cssCompiledStyles)||(t.cssCompiledStyles=[]),t.cssClasses.split(" ").forEach(i=>{let a=r.get(i);a&&(t.cssCompiledStyles=[...t.cssCompiledStyles??[],...a.styles])}));let n=e.find(i=>i.id===t.id);n?Object.assign(n,t):e.push(t)}function zZe(e){return e?.classes?.join(" ")??""}function GZe(e){return e?.styles??[]}var dae,LO,tQt,_Ze,wZe,fk,hk,pae,rQt,nQt,iQt,P6,RZe,LZe,IZe,MZe,NZe,DZe,hae,fae,aQt,sQt,kZe,TZe,oQt,lQt,B6,cQt,uQt,OZe,hQt,fQt,dQt,pQt,mQt,gQt,yQt,vQt,PZe,BZe,xQt,mae,bQt,CZe,FZe,wQt,kQt,$Ze,_O,e1,TQt,SZe,O6,CQt,Bl,EZe,AZe,AO,yp,SQt,IO,gae=W(()=>{Uc();lc();ac();Hc();Sn();_r();Rr();hr();fn();xb();dae=(function(){var e=b(function($,F,q,G){for(q=q||{},G=$.length;G--;q[$[G]]=F);return q},"o"),t=[1,2],r=[1,3],n=[1,4],i=[2,4],a=[1,9],s=[1,11],o=[1,16],l=[1,17],u=[1,18],h=[1,19],f=[1,33],d=[1,20],p=[1,21],m=[1,22],g=[1,23],y=[1,24],v=[1,26],x=[1,27],w=[1,28],C=[1,29],T=[1,30],k=[1,31],S=[1,32],E=[1,35],I=[1,36],L=[1,37],O=[1,38],R=[1,34],A=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],N=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],M=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],D={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:b(function(F,q,G,z,H,j,J){var U=j.length-1;switch(H){case 3:return z.setRootDoc(j[U]),j[U];break;case 4:this.$=[];break;case 5:j[U]!="nl"&&(j[U-1].push(j[U]),this.$=j[U-1]);break;case 6:case 7:this.$=j[U];break;case 8:this.$="nl";break;case 12:this.$=j[U];break;case 13:let ae=j[U-1];ae.description=z.trimColon(j[U]),this.$=ae;break;case 14:this.$={stmt:"relation",state1:j[U-2],state2:j[U]};break;case 15:let oe=z.trimColon(j[U]);this.$={stmt:"relation",state1:j[U-3],state2:j[U-1],description:oe};break;case 19:this.$={stmt:"state",id:j[U-3],type:"default",description:"",doc:j[U-1]};break;case 20:var le=j[U],ee=j[U-2].trim();if(j[U].match(":")){var ue=j[U].split(":");le=ue[0],ee=[ee,ue[1]]}this.$={stmt:"state",id:le,type:"default",description:ee};break;case 21:this.$={stmt:"state",id:j[U-3],type:"default",description:j[U-5],doc:j[U-1]};break;case 22:this.$={stmt:"state",id:j[U],type:"fork"};break;case 23:this.$={stmt:"state",id:j[U],type:"join"};break;case 24:this.$={stmt:"state",id:j[U],type:"choice"};break;case 25:this.$={stmt:"state",id:z.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:j[U-1].trim(),note:{position:j[U-2].trim(),text:j[U].trim()}};break;case 29:this.$=j[U].trim(),z.setAccTitle(this.$);break;case 30:case 31:this.$=j[U].trim(),z.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:j[U-3],url:j[U-2],tooltip:j[U-1]};break;case 33:this.$={stmt:"click",id:j[U-3],url:j[U-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:j[U-1].trim(),classes:j[U].trim()};break;case 36:this.$={stmt:"style",id:j[U-1].trim(),styleClass:j[U].trim()};break;case 37:this.$={stmt:"applyClass",id:j[U-1].trim(),styleClass:j[U].trim()};break;case 38:z.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:z.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:z.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:z.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:j[U].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:j[U-2].trim(),classes:[j[U].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:j[U-2].trim(),classes:[j[U].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:t,5:r,6:n},{1:[3]},{3:5,4:t,5:r,6:n},{3:6,4:t,5:r,6:n},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:o,17:l,19:u,22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,7]),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(A,[2,11]),e(A,[2,12],{14:[1,40],15:[1,41]}),e(A,[2,16]),{18:[1,42]},e(A,[2,18],{20:[1,43]}),{23:[1,44]},e(A,[2,22]),e(A,[2,23]),e(A,[2,24]),e(A,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(A,[2,28]),{34:[1,49]},{36:[1,50]},e(A,[2,31]),{13:51,24:f,57:R},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(N,[2,44],{58:[1,56]}),e(N,[2,45],{58:[1,57]}),e(A,[2,38]),e(A,[2,39]),e(A,[2,40]),e(A,[2,41]),e(A,[2,6]),e(A,[2,13]),{13:58,24:f,57:R},e(A,[2,17]),e(M,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(A,[2,29]),e(A,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(A,[2,14],{14:[1,71]}),{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,21:[1,72],22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(A,[2,34]),e(A,[2,35]),e(A,[2,36]),e(A,[2,37]),e(N,[2,46]),e(N,[2,47]),e(A,[2,15]),e(A,[2,19]),e(M,i,{7:78}),e(A,[2,26]),e(A,[2,27]),{5:[1,79]},{5:[1,80]},{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,21:[1,81],22:h,24:f,25:d,26:p,27:m,28:g,29:y,32:25,33:v,35:x,37:w,38:C,41:T,45:k,48:S,51:E,52:I,53:L,54:O,57:R},e(A,[2,32]),e(A,[2,33]),e(A,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:b(function(F,q){if(q.recoverable)this.trace(F);else{var G=new Error(F);throw G.hash=q,G}},"parseError"),parse:b(function(F){var q=this,G=[0],z=[],H=[null],j=[],J=this.table,U="",le=0,ee=0,ue=0,ae=2,oe=1,Re=j.slice.call(arguments,1),Te=Object.create(this.lexer),Oe={yy:{}};for(var qe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,qe)&&(Oe.yy[qe]=this.yy[qe]);Te.setInput(F,Oe.yy),Oe.yy.lexer=Te,Oe.yy.parser=this,typeof Te.yylloc>"u"&&(Te.yylloc={});var Ge=Te.yylloc;j.push(Ge);var fe=Te.options&&Te.options.ranges;typeof Oe.yy.parseError=="function"?this.parseError=Oe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ce(K){G.length=G.length-2*K,H.length=H.length-K,j.length=j.length-K}b(Ce,"popStack");function _e(){var K;return K=z.pop()||Te.lex()||oe,typeof K!="number"&&(K instanceof Array&&(z=K,K=z.pop()),K=q.symbols_[K]||K),K}b(_e,"lex");for(var de,ie,Q,he,xe,ce,ge={},Ie,ye,ne,V;;){if(Q=G[G.length-1],this.defaultActions[Q]?he=this.defaultActions[Q]:((de===null||typeof de>"u")&&(de=_e()),he=J[Q]&&J[Q][de]),typeof he>"u"||!he.length||!he[0]){var pe="";V=[];for(Ie in J[Q])this.terminals_[Ie]&&Ie>ae&&V.push("'"+this.terminals_[Ie]+"'");Te.showPosition?pe="Parse error on line "+(le+1)+`: `+Te.showPosition()+` Expecting `+V.join(", ")+", got '"+(this.terminals_[de]||de)+"'":pe="Parse error on line "+(le+1)+": Unexpected "+(de==oe?"end of input":"'"+(this.terminals_[de]||de)+"'"),this.parseError(pe,{text:Te.match,token:this.terminals_[de]||de,line:Te.yylineno,loc:Ge,expected:V})}if(he[0]instanceof Array&&he.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+de);switch(he[0]){case 1:G.push(de),H.push(Te.yytext),j.push(Te.yylloc),G.push(he[1]),de=null,ie?(de=ie,ie=null):(ee=Te.yyleng,U=Te.yytext,le=Te.yylineno,Ge=Te.yylloc,ue>0&&ue--);break;case 2:if(ye=this.productions_[he[1]][1],ge.$=H[H.length-ye],ge._$={first_line:j[j.length-(ye||1)].first_line,last_line:j[j.length-1].last_line,first_column:j[j.length-(ye||1)].first_column,last_column:j[j.length-1].last_column},fe&&(ge._$.range=[j[j.length-(ye||1)].range[0],j[j.length-1].range[1]]),ce=this.performAction.apply(ge,[U,ee,le,Oe.yy,he[1],H,j].concat(Re)),typeof ce<"u")return ce;ye&&(G=G.slice(0,-1*ye*2),H=H.slice(0,-1*ye),j=j.slice(0,-1*ye)),G.push(this.productions_[he[1]][0]),H.push(ge.$),j.push(ge._$),ne=J[G[G.length-2]][G[G.length-1]],G.push(ne);break;case 3:return!0}}return!0},"parse")},B=(function(){var $={EOF:1,parseError:b(function(q,G){if(this.yy.parser)this.yy.parser.parseError(q,G);else throw new Error(q)},"parseError"),setInput:b(function(F,q){return this.yy=q||this.yy||{},this._input=F,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var F=this._input[0];this.yytext+=F,this.yyleng++,this.offset++,this.match+=F,this.matched+=F;var q=F.match(/(?:\r\n?|\n).*/g);return q?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),F},"input"),unput:b(function(F){var q=F.length,G=F.split(/(?:\r\n?|\n)/g);this._input=F+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-q),this.offset-=q;var z=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),G.length-1&&(this.yylineno-=G.length-1);var H=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:G?(G.length===z.length?this.yylloc.first_column:0)+z[z.length-G.length].length-G[0].length:this.yylloc.first_column-q},this.options.ranges&&(this.yylloc.range=[H[0],H[0]+this.yyleng-q]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(F){this.unput(this.match.slice(F))},"less"),pastInput:b(function(){var F=this.matched.substr(0,this.matched.length-this.match.length);return(F.length>20?"...":"")+F.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var F=this.match;return F.length<20&&(F+=this._input.substr(0,20-F.length)),(F.substr(0,20)+(F.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var F=this.pastInput(),q=new Array(F.length+1).join("-");return F+this.upcomingInput()+` `+q+"^"},"showPosition"),test_match:b(function(F,q){var G,z,H;if(this.options.backtrack_lexer&&(H={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(H.yylloc.range=this.yylloc.range.slice(0))),z=F[0].match(/(?:\r\n?|\n).*/g),z&&(this.yylineno+=z.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:z?z[z.length-1].length-z[z.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+F[0].length},this.yytext+=F[0],this.match+=F[0],this.matches=F,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(F[0].length),this.matched+=F[0],G=this.performAction.call(this,this.yy,this,q,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),G)return G;if(this._backtrack){for(var j in H)this[j]=H[j];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var F,q,G,z;this._more||(this.yytext="",this.match="");for(var H=this._currentRules(),j=0;jq[0].length)){if(q=G,z=j,this.options.backtrack_lexer){if(F=this.test_match(G,H[j]),F!==!1)return F;if(this._backtrack){q=!1;continue}else return!1}else if(!this.options.flex)break}return q?(F=this.test_match(q,H[z]),F!==!1?F:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var q=this.next();return q||this.lex()},"lex"),begin:b(function(q){this.conditionStack.push(q)},"begin"),popState:b(function(){var q=this.conditionStack.length-1;return q>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(q){return q=this.conditionStack.length-1-Math.abs(q||0),q>=0?this.conditionStack[q]:"INITIAL"},"topState"),pushState:b(function(q){this.begin(q)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(q,G,z,H){function j(){let U=G.yytext.indexOf("%%");if(U===0)return!1;if(U>0){let le=G.yytext.slice(0,U),ee=G.yytext.slice(U);ee&&q.lexer.unput(ee),G.yytext=le}return!0}b(j,"processId");var J=H;switch(z){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),G.yytext=G.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),G.yytext=G.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!j())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw new Error('Error: State name must be a single word. Found: "'+G.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!j())return;return this.popState(),"ID";break;case 66:if(!j())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),G.yytext=G.yytext.substr(2).trim(),31;break;case 68:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:return j()?24:void 0;case 74:return G.yytext=G.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return $})();D.lexer=B;function P(){this.yy={}}return b(P,"Parser"),P.prototype=D,D.Parser=P,new P})();hae.parser=hae;LO=hae,ZZt="TB",EZe="TB",xZe="dir",fk="state",hk="root",fae="relation",QZt="classDef",JZt="style",eQt="applyClass",P6="default",AZe="divider",_Ze="fill:none",RZe="fill: #333",LZe="c",IZe="markdown",MZe="normal",cae="rect",uae="rectWithTitle",tQt="stateStart",rQt="stateEnd",bZe="divider",wZe="roundedWithTitle",nQt="note",iQt="noteGroup",B6="statediagram",aQt="state",sQt=`${B6}-${aQt}`,NZe="transition",oQt="note",lQt="note-edge",cQt=`${NZe} ${lQt}`,uQt=`${B6}-${oQt}`,hQt="cluster",fQt=`${B6}-${hQt}`,dQt="cluster-alt",pQt=`${B6}-${dQt}`,DZe="parent",OZe="note",mQt="state",dae="----",gQt=`${dae}${OZe}`,kZe=`${dae}${DZe}`,PZe=b((e,t=EZe)=>{if(!e.doc)return t;let r=t;for(let n of e.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir"),yQt=b(function(e,t){return t.db.getClasses()},"getClasses"),vQt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing state diagram (v2)",t);let{securityLevel:i,state:a,layout:s}=Be();n.db.extract(n.db.getRootDocV2());let o=n.db.getData(),l=zu(t,i);o.type=n.type,o.layoutAlgorithm=s,o.nodeSpacing=a?.nodeSpacing||50,o.rankSpacing=a?.rankSpacing||50,Be().look==="neo"?o.markers=["barbNeo"]:o.markers=["barb"],o.diagramId=t,await Ou(o,l);let h=8;try{(typeof n.db.getLinks=="function"?n.db.getLinks():new Map).forEach((d,p)=>{let m=typeof p=="string"?p:typeof p?.id=="string"?p.id:"",g=o.nodes.find(T=>T.id===m);if(!m){se.warn("\u26A0\uFE0F Invalid or missing stateId from key:",JSON.stringify(p));return}let y=l.node()?.querySelectorAll("g.node, g.rough-node"),v;if(y?.forEach(T=>{let k=T.textContent?.trim();(T.id===g?.domId||k===m)&&(v=T)}),!v){se.warn("\u26A0\uFE0F Could not find node matching text:",m);return}let x=v.parentNode;if(!x){se.warn("\u26A0\uFE0F Node has no parent, cannot wrap:",m);return}let w=document.createElementNS("http://www.w3.org/2000/svg","a"),C=d.url.replace(/^"+|"+$/g,"");if(w.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",C),w.setAttribute("target","_blank"),d.tooltip){let T=d.tooltip.replace(/^"+|"+$/g,"");w.setAttribute("title",T),v.setAttribute("title",T)}x.replaceChild(w,v),w.appendChild(v),se.info("\u{1F517} Wrapped node in
tag for:",m,d.url)})}catch(f){se.error("\u274C Error injecting clickable links:",f)}pr.insertTitle(l,"statediagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),sc(l,h,B6,a?.useMaxWidth??!0)},"draw"),BZe={getClasses:yQt,draw:vQt,getDir:PZe},_O=new Map,e1=0;b(RO,"stateDomId");xQt=b((e,t,r,n,i,a,s,o)=>{se.trace("items",t),t.forEach(l=>{switch(l.stmt){case fk:O6(e,l,r,n,i,a,s,o);break;case P6:O6(e,l,r,n,i,a,s,o);break;case fae:{O6(e,l.state1,r,n,i,a,s,o),O6(e,l.state2,r,n,i,a,s,o);let u=s==="neo",h={id:"edge"+e1,start:l.state1.id,end:l.state2.id,arrowhead:"normal",arrowTypeEnd:u?"arrow_barb_neo":"arrow_barb",style:_Ze,labelStyle:"",label:Ct.sanitizeText(l.description??"",Be()),arrowheadStyle:RZe,labelpos:LZe,labelType:IZe,thickness:MZe,classes:NZe,look:s};i.push(h),e1++}break}})},"setupDoc"),TZe=b((e,t=EZe)=>{let r=t;if(e.doc)for(let n of e.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir");b(D6,"insertOrUpdateNode");b(FZe,"getClassesFromDbInfo");b($Ze,"getStylesFromDbInfo");O6=b((e,t,r,n,i,a,s,o)=>{let l=t.id,u=r.get(l),h=FZe(u),f=$Ze(u),d=Be();if(se.info("dataFetcher parsedItem",t,u,f),l!=="root"){let p=cae;t.start===!0?p=tQt:t.start===!1&&(p=rQt),t.type!==P6&&(p=t.type),_O.get(l)||_O.set(l,{id:l,shape:p,description:Ct.sanitizeText(l,d),cssClasses:`${h} ${sQt}`,cssStyles:f});let m=_O.get(l);t.description&&(Array.isArray(m.description)?(m.shape=uae,m.description.push(t.description)):m.description?.length&&m.description.length>0?(m.shape=uae,m.description===l?m.description=[t.description]:m.description=[m.description,t.description]):(m.shape=cae,m.description=t.description),m.description=Ct.sanitizeTextOrArray(m.description,d)),m.description?.length===1&&m.shape===uae&&(m.type==="group"?m.shape=wZe:m.shape=cae),!m.type&&t.doc&&(se.info("Setting cluster for XCX",l,TZe(t)),m.type="group",m.isGroup=!0,m.dir=TZe(t),m.explicitDir=t.doc.some(y=>y.stmt==="dir"),m.shape=t.type===AZe?bZe:wZe,m.cssClasses=`${m.cssClasses} ${fQt} ${a?pQt:""}`);let g={labelStyle:"",shape:m.shape,label:m.description,cssClasses:m.cssClasses,cssCompiledStyles:[],cssStyles:m.cssStyles,id:l,dir:m.dir,domId:RO(l,e1),type:m.type,isGroup:m.type==="group",padding:8,rx:10,ry:10,look:s,labelType:"markdown"};if(g.shape===bZe&&(g.label=""),e&&e.id!=="root"&&(se.trace("Setting node ",l," to be child of its parent ",e.id),g.parentId=e.id),g.centerLabel=!0,t.note){let y={labelStyle:"",shape:nQt,label:t.note.text,labelType:"markdown",cssClasses:uQt,cssStyles:[],cssCompiledStyles:[],id:l+gQt+"-"+e1,domId:RO(l,e1,OZe),type:m.type,isGroup:m.type==="group",padding:d.flowchart?.padding,look:s,position:t.note.position},v=l+kZe,x={labelStyle:"",shape:iQt,label:t.note.text,cssClasses:m.cssClasses,cssStyles:[],id:l+kZe,domId:RO(l,e1,DZe),type:"group",isGroup:!0,padding:16,look:s,position:t.note.position};e1++,x.id=v,y.parentId=v,D6(n,x,o),D6(n,y,o),D6(n,g,o);let w=l,C=y.id;t.note.position==="left of"&&(w=y.id,C=l),i.push({id:w+"-"+C,start:w,end:C,arrowhead:"none",arrowTypeEnd:"",style:_Ze,labelStyle:"",classes:cQt,arrowheadStyle:RZe,labelpos:LZe,labelType:IZe,thickness:MZe,look:s})}else D6(n,g,o)}t.doc&&(se.trace("Adding nodes children "),xQt(t,t.doc,r,n,i,!a,s,o))},"dataFetcher"),bQt=b(()=>{_O.clear(),e1=0},"reset"),Pl={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},CZe=b(()=>new Map,"newClassesList"),SZe=b(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),AO=b(e=>JSON.parse(JSON.stringify(e)),"clone"),yp=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=CZe(),this.documents={root:SZe()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=Qr,this.setAccTitle=Yr,this.getAccDescription=en,this.setAccDescription=Jr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{b(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let n of Array.isArray(e)?e:e.doc)switch(n.stmt){case fk:this.addState(n.id.trim(),n.type,n.doc,n.description,n.note);break;case fae:this.addRelation(n.state1,n.state2,n.description);break;case QZt:this.addStyleClass(n.id.trim(),n.classes);break;case JZt:this.handleStyleDef(n);break;case eQt:this.setCssClass(n.id.trim(),n.styleClass);break;case"click":this.addLink(n.id,n.url,n.tooltip);break}let t=this.getStates(),r=Be();bQt(),O6(void 0,this.getRootDocV2(),t,this.nodes,this.edges,!0,r.look,this.classes);for(let n of this.nodes)if(Array.isArray(n.label)){if(n.description=n.label.slice(1),n.isGroup&&n.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${n.id}]`);n.label=n.label[0]}}handleStyleDef(e){let t=e.id.trim().split(","),r=e.styleClass.split(",");for(let n of t){let i=this.getState(n);if(!i){let a=n.trim();this.addState(a),i=this.getState(a)}i&&(i.styles=r.map(a=>a.replace(/;/g,"")?.trim()))}}setRootDoc(e){se.info("Setting root doc",e),this.rootDoc=e,this.version===1?this.extract(e):this.extract(this.getRootDocV2())}docTranslator(e,t,r){if(t.stmt===fae){this.docTranslator(e,t.state1,!0),this.docTranslator(e,t.state2,!1);return}if(t.stmt===fk&&(t.id===Pl.START_NODE?(t.id=e.id+(r?"_start":"_end"),t.start=r):t.id=t.id.trim()),t.stmt!==hk&&t.stmt!==fk||!t.doc)return;let n=[],i=[];for(let a of t.doc)if(a.type===AZe){let s=AO(a);s.doc=AO(i),n.push(s),i=[]}else i.push(a);if(n.length>0&&i.length>0){let a={stmt:fk,id:AU(),type:"divider",doc:AO(i)};n.push(AO(a)),t.doc=n}t.doc.forEach(a=>this.docTranslator(t,a,!0))}getRootDocV2(){return this.docTranslator({id:hk,stmt:hk},{id:hk,stmt:hk,doc:this.rootDoc},!0),{id:hk,doc:this.rootDoc}}addState(e,t=P6,r=void 0,n=void 0,i=void 0,a=void 0,s=void 0,o=void 0){let l=e?.trim();if(!this.currentDocument.states.has(l))se.info("Adding state ",l,n),this.currentDocument.states.set(l,{stmt:fk,id:l,descriptions:[],type:t,doc:r,note:i,classes:[],styles:[],textStyles:[]});else{let u=this.currentDocument.states.get(l);if(!u)throw new Error(`State not found: ${l}`);u.doc||(u.doc=r),u.type||(u.type=t)}if(n&&(se.info("Setting state description",l,n),(Array.isArray(n)?n:[n]).forEach(h=>this.addDescription(l,h.trim()))),i){let u=this.currentDocument.states.get(l);if(!u)throw new Error(`State not found: ${l}`);u.note=i,u.note.text=Ct.sanitizeText(u.note.text,Be())}a&&(se.info("Setting state classes",l,a),(Array.isArray(a)?a:[a]).forEach(h=>this.setCssClass(l,h.trim()))),s&&(se.info("Setting state styles",l,s),(Array.isArray(s)?s:[s]).forEach(h=>this.setStyle(l,h.trim()))),o&&(se.info("Setting state styles",l,s),(Array.isArray(o)?o:[o]).forEach(h=>this.setTextStyle(l,h.trim())))}clear(e){this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:SZe()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=CZe(),e||(this.links=new Map,Nr())}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){se.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,t,r){this.links.set(e,{url:t,tooltip:r}),se.warn("Adding link",e,t,r)}getLinks(){return this.links}startIdIfNeeded(e=""){return e===Pl.START_NODE?(this.startEndCount++,`${Pl.START_TYPE}${this.startEndCount}`):e}startTypeIfNeeded(e="",t=P6){return e===Pl.START_NODE?Pl.START_TYPE:t}endIdIfNeeded(e=""){return e===Pl.END_NODE?(this.startEndCount++,`${Pl.END_TYPE}${this.startEndCount}`):e}endTypeIfNeeded(e="",t=P6){return e===Pl.END_NODE?Pl.END_TYPE:t}addRelationObjs(e,t,r=""){let n=this.startIdIfNeeded(e.id.trim()),i=this.startTypeIfNeeded(e.id.trim(),e.type),a=this.startIdIfNeeded(t.id.trim()),s=this.startTypeIfNeeded(t.id.trim(),t.type);this.addState(n,i,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(a,s,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.currentDocument.relations.push({id1:n,id2:a,relationTitle:Ct.sanitizeText(r,Be())})}addRelation(e,t,r){if(typeof e=="object"&&typeof t=="object")this.addRelationObjs(e,t,r);else if(typeof e=="string"&&typeof t=="string"){let n=this.startIdIfNeeded(e.trim()),i=this.startTypeIfNeeded(e),a=this.endIdIfNeeded(t.trim()),s=this.endTypeIfNeeded(t);this.addState(n,i),this.addState(a,s),this.currentDocument.relations.push({id1:n,id2:a,relationTitle:r?Ct.sanitizeText(r,Be()):void 0})}}addDescription(e,t){let r=this.currentDocument.states.get(e),n=t.startsWith(":")?t.replace(":","").trim():t;r?.descriptions?.push(Ct.sanitizeText(n,Be()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,t=""){this.classes.has(e)||this.classes.set(e,{id:e,styles:[],textStyles:[]});let r=this.classes.get(e);t&&r&&t.split(Pl.STYLECLASS_SEP).forEach(n=>{let i=n.replace(/([^;]*);/,"$1").trim();if(RegExp(Pl.COLOR_KEYWORD).exec(n)){let s=i.replace(Pl.FILL_KEYWORD,Pl.BG_FILL).replace(Pl.COLOR_KEYWORD,Pl.FILL_KEYWORD);r.textStyles.push(s)}r.styles.push(i)})}getClasses(){return this.classes}setupToolTips(e){let t=iw();ct(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover",i=>{let a=ct(i.currentTarget),s=a.attr("title");if(s===null)return;let o=i.currentTarget?.getBoundingClientRect();t.transition().duration(200).style("opacity",".9"),t.style("left",window.scrollX+o.left+(o.right-o.left)/2+"px").style("top",window.scrollY+o.bottom+"px"),t.html(Ul.sanitize(s)),a.classed("hover",!0)}).on("mouseout",i=>{t.transition().duration(500).style("opacity",0),ct(i.currentTarget).classed("hover",!1)})}setCssClass(e,t){e.split(",").forEach(r=>{let n=this.getState(r);if(!n){let i=r.trim();this.addState(i),n=this.getState(i)}n?.classes?.push(t)})}setStyle(e,t){this.getState(e)?.styles?.push(t)}setTextStyle(e,t){this.getState(e)?.textStyles?.push(t)}bindFunctions(e){this.funs.forEach(t=>{t(e)})}getDirectionStatement(){return this.rootDoc.find(e=>e.stmt===xZe)}getDirection(){return this.getDirectionStatement()?.value??ZZt}setDirection(e){let t=this.getDirectionStatement();t?t.value=e:this.rootDoc.unshift({stmt:xZe,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){let e=Be();return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:PZe(this.getRootDocV2())}}getConfig(){return Be().state}},wQt=b(e=>` +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var q=this.next();return q||this.lex()},"lex"),begin:b(function(q){this.conditionStack.push(q)},"begin"),popState:b(function(){var q=this.conditionStack.length-1;return q>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(q){return q=this.conditionStack.length-1-Math.abs(q||0),q>=0?this.conditionStack[q]:"INITIAL"},"topState"),pushState:b(function(q){this.begin(q)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(q,G,z,H){function j(){let U=G.yytext.indexOf("%%");if(U===0)return!1;if(U>0){let le=G.yytext.slice(0,U),ee=G.yytext.slice(U);ee&&q.lexer.unput(ee),G.yytext=le}return!0}b(j,"processId");var J=H;switch(z){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),G.yytext=G.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),G.yytext=G.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!j())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw new Error('Error: State name must be a single word. Found: "'+G.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!j())return;return this.popState(),"ID";break;case 66:if(!j())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),G.yytext=G.yytext.substr(2).trim(),31;break;case 68:return this.popState(),G.yytext=G.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:return j()?24:void 0;case 74:return G.yytext=G.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return $})();D.lexer=B;function P(){this.yy={}}return b(P,"Parser"),P.prototype=D,D.Parser=P,new P})();dae.parser=dae;LO=dae,tQt="TB",_Ze="TB",wZe="dir",fk="state",hk="root",pae="relation",rQt="classDef",nQt="style",iQt="applyClass",P6="default",RZe="divider",LZe="fill:none",IZe="fill: #333",MZe="c",NZe="markdown",DZe="normal",hae="rect",fae="rectWithTitle",aQt="stateStart",sQt="stateEnd",kZe="divider",TZe="roundedWithTitle",oQt="note",lQt="noteGroup",B6="statediagram",cQt="state",uQt=`${B6}-${cQt}`,OZe="transition",hQt="note",fQt="note-edge",dQt=`${OZe} ${fQt}`,pQt=`${B6}-${hQt}`,mQt="cluster",gQt=`${B6}-${mQt}`,yQt="cluster-alt",vQt=`${B6}-${yQt}`,PZe="parent",BZe="note",xQt="state",mae="----",bQt=`${mae}${BZe}`,CZe=`${mae}${PZe}`,FZe=b((e,t=_Ze)=>{if(!e.doc)return t;let r=t;for(let n of e.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir"),wQt=b(function(e,t){return t.db.getClasses()},"getClasses"),kQt=b(async function(e,t,r,n){se.info("REF0:"),se.info("Drawing state diagram (v2)",t);let{securityLevel:i,state:a,layout:s}=Be();n.db.extract(n.db.getRootDocV2());let o=n.db.getData(),l=zu(t,i);o.type=n.type,o.layoutAlgorithm=s,o.nodeSpacing=a?.nodeSpacing||50,o.rankSpacing=a?.rankSpacing||50,Be().look==="neo"?o.markers=["barbNeo"]:o.markers=["barb"],o.diagramId=t,await Ou(o,l);let h=8;try{(typeof n.db.getLinks=="function"?n.db.getLinks():new Map).forEach((d,p)=>{let m=typeof p=="string"?p:typeof p?.id=="string"?p.id:"",g=o.nodes.find(T=>T.id===m);if(!m){se.warn("\u26A0\uFE0F Invalid or missing stateId from key:",JSON.stringify(p));return}let y=l.node()?.querySelectorAll("g.node, g.rough-node"),v;if(y?.forEach(T=>{let k=T.textContent?.trim();(T.id===g?.domId||k===m)&&(v=T)}),!v){se.warn("\u26A0\uFE0F Could not find node matching text:",m);return}let x=v.parentNode;if(!x){se.warn("\u26A0\uFE0F Node has no parent, cannot wrap:",m);return}let w=document.createElementNS("http://www.w3.org/2000/svg","a"),C=d.url.replace(/^"+|"+$/g,"");if(w.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",C),w.setAttribute("target","_blank"),d.tooltip){let T=d.tooltip.replace(/^"+|"+$/g,"");w.setAttribute("title",T),v.setAttribute("title",T)}x.replaceChild(w,v),w.appendChild(v),se.info("\u{1F517} Wrapped node in tag for:",m,d.url)})}catch(f){se.error("\u274C Error injecting clickable links:",f)}pr.insertTitle(l,"statediagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),oc(l,h,B6,a?.useMaxWidth??!0)},"draw"),$Ze={getClasses:wQt,draw:kQt,getDir:FZe},_O=new Map,e1=0;b(RO,"stateDomId");TQt=b((e,t,r,n,i,a,s,o)=>{se.trace("items",t),t.forEach(l=>{switch(l.stmt){case fk:O6(e,l,r,n,i,a,s,o);break;case P6:O6(e,l,r,n,i,a,s,o);break;case pae:{O6(e,l.state1,r,n,i,a,s,o),O6(e,l.state2,r,n,i,a,s,o);let u=s==="neo",h={id:"edge"+e1,start:l.state1.id,end:l.state2.id,arrowhead:"normal",arrowTypeEnd:u?"arrow_barb_neo":"arrow_barb",style:LZe,labelStyle:"",label:Ct.sanitizeText(l.description??"",Be()),arrowheadStyle:IZe,labelpos:MZe,labelType:NZe,thickness:DZe,classes:OZe,look:s};i.push(h),e1++}break}})},"setupDoc"),SZe=b((e,t=_Ze)=>{let r=t;if(e.doc)for(let n of e.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir");b(D6,"insertOrUpdateNode");b(zZe,"getClassesFromDbInfo");b(GZe,"getStylesFromDbInfo");O6=b((e,t,r,n,i,a,s,o)=>{let l=t.id,u=r.get(l),h=zZe(u),f=GZe(u),d=Be();if(se.info("dataFetcher parsedItem",t,u,f),l!=="root"){let p=hae;t.start===!0?p=aQt:t.start===!1&&(p=sQt),t.type!==P6&&(p=t.type),_O.get(l)||_O.set(l,{id:l,shape:p,description:Ct.sanitizeText(l,d),cssClasses:`${h} ${uQt}`,cssStyles:f});let m=_O.get(l);t.description&&(Array.isArray(m.description)?(m.shape=fae,m.description.push(t.description)):m.description?.length&&m.description.length>0?(m.shape=fae,m.description===l?m.description=[t.description]:m.description=[m.description,t.description]):(m.shape=hae,m.description=t.description),m.description=Ct.sanitizeTextOrArray(m.description,d)),m.description?.length===1&&m.shape===fae&&(m.type==="group"?m.shape=TZe:m.shape=hae),!m.type&&t.doc&&(se.info("Setting cluster for XCX",l,SZe(t)),m.type="group",m.isGroup=!0,m.dir=SZe(t),m.explicitDir=t.doc.some(y=>y.stmt==="dir"),m.shape=t.type===RZe?kZe:TZe,m.cssClasses=`${m.cssClasses} ${gQt} ${a?vQt:""}`);let g={labelStyle:"",shape:m.shape,label:m.description,cssClasses:m.cssClasses,cssCompiledStyles:[],cssStyles:m.cssStyles,id:l,dir:m.dir,domId:RO(l,e1),type:m.type,isGroup:m.type==="group",padding:8,rx:10,ry:10,look:s,labelType:"markdown"};if(g.shape===kZe&&(g.label=""),e&&e.id!=="root"&&(se.trace("Setting node ",l," to be child of its parent ",e.id),g.parentId=e.id),g.centerLabel=!0,t.note){let y={labelStyle:"",shape:oQt,label:t.note.text,labelType:"markdown",cssClasses:pQt,cssStyles:[],cssCompiledStyles:[],id:l+bQt+"-"+e1,domId:RO(l,e1,BZe),type:m.type,isGroup:m.type==="group",padding:d.flowchart?.padding,look:s,position:t.note.position},v=l+CZe,x={labelStyle:"",shape:lQt,label:t.note.text,cssClasses:m.cssClasses,cssStyles:[],id:l+CZe,domId:RO(l,e1,PZe),type:"group",isGroup:!0,padding:16,look:s,position:t.note.position};e1++,x.id=v,y.parentId=v,D6(n,x,o),D6(n,y,o),D6(n,g,o);let w=l,C=y.id;t.note.position==="left of"&&(w=y.id,C=l),i.push({id:w+"-"+C,start:w,end:C,arrowhead:"none",arrowTypeEnd:"",style:LZe,labelStyle:"",classes:dQt,arrowheadStyle:IZe,labelpos:MZe,labelType:NZe,thickness:DZe,look:s})}else D6(n,g,o)}t.doc&&(se.trace("Adding nodes children "),TQt(t,t.doc,r,n,i,!a,s,o))},"dataFetcher"),CQt=b(()=>{_O.clear(),e1=0},"reset"),Bl={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},EZe=b(()=>new Map,"newClassesList"),AZe=b(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),AO=b(e=>JSON.parse(JSON.stringify(e)),"clone"),yp=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=EZe(),this.documents={root:AZe()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=Qr,this.setAccTitle=Yr,this.getAccDescription=en,this.setAccDescription=Jr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{b(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let n of Array.isArray(e)?e:e.doc)switch(n.stmt){case fk:this.addState(n.id.trim(),n.type,n.doc,n.description,n.note);break;case pae:this.addRelation(n.state1,n.state2,n.description);break;case rQt:this.addStyleClass(n.id.trim(),n.classes);break;case nQt:this.handleStyleDef(n);break;case iQt:this.setCssClass(n.id.trim(),n.styleClass);break;case"click":this.addLink(n.id,n.url,n.tooltip);break}let t=this.getStates(),r=Be();CQt(),O6(void 0,this.getRootDocV2(),t,this.nodes,this.edges,!0,r.look,this.classes);for(let n of this.nodes)if(Array.isArray(n.label)){if(n.description=n.label.slice(1),n.isGroup&&n.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${n.id}]`);n.label=n.label[0]}}handleStyleDef(e){let t=e.id.trim().split(","),r=e.styleClass.split(",");for(let n of t){let i=this.getState(n);if(!i){let a=n.trim();this.addState(a),i=this.getState(a)}i&&(i.styles=r.map(a=>a.replace(/;/g,"")?.trim()))}}setRootDoc(e){se.info("Setting root doc",e),this.rootDoc=e,this.version===1?this.extract(e):this.extract(this.getRootDocV2())}docTranslator(e,t,r){if(t.stmt===pae){this.docTranslator(e,t.state1,!0),this.docTranslator(e,t.state2,!1);return}if(t.stmt===fk&&(t.id===Bl.START_NODE?(t.id=e.id+(r?"_start":"_end"),t.start=r):t.id=t.id.trim()),t.stmt!==hk&&t.stmt!==fk||!t.doc)return;let n=[],i=[];for(let a of t.doc)if(a.type===RZe){let s=AO(a);s.doc=AO(i),n.push(s),i=[]}else i.push(a);if(n.length>0&&i.length>0){let a={stmt:fk,id:RU(),type:"divider",doc:AO(i)};n.push(AO(a)),t.doc=n}t.doc.forEach(a=>this.docTranslator(t,a,!0))}getRootDocV2(){return this.docTranslator({id:hk,stmt:hk},{id:hk,stmt:hk,doc:this.rootDoc},!0),{id:hk,doc:this.rootDoc}}addState(e,t=P6,r=void 0,n=void 0,i=void 0,a=void 0,s=void 0,o=void 0){let l=e?.trim();if(!this.currentDocument.states.has(l))se.info("Adding state ",l,n),this.currentDocument.states.set(l,{stmt:fk,id:l,descriptions:[],type:t,doc:r,note:i,classes:[],styles:[],textStyles:[]});else{let u=this.currentDocument.states.get(l);if(!u)throw new Error(`State not found: ${l}`);u.doc||(u.doc=r),u.type||(u.type=t)}if(n&&(se.info("Setting state description",l,n),(Array.isArray(n)?n:[n]).forEach(h=>this.addDescription(l,h.trim()))),i){let u=this.currentDocument.states.get(l);if(!u)throw new Error(`State not found: ${l}`);u.note=i,u.note.text=Ct.sanitizeText(u.note.text,Be())}a&&(se.info("Setting state classes",l,a),(Array.isArray(a)?a:[a]).forEach(h=>this.setCssClass(l,h.trim()))),s&&(se.info("Setting state styles",l,s),(Array.isArray(s)?s:[s]).forEach(h=>this.setStyle(l,h.trim()))),o&&(se.info("Setting state styles",l,s),(Array.isArray(o)?o:[o]).forEach(h=>this.setTextStyle(l,h.trim())))}clear(e){this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:AZe()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=EZe(),e||(this.links=new Map,Nr())}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){se.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,t,r){this.links.set(e,{url:t,tooltip:r}),se.warn("Adding link",e,t,r)}getLinks(){return this.links}startIdIfNeeded(e=""){return e===Bl.START_NODE?(this.startEndCount++,`${Bl.START_TYPE}${this.startEndCount}`):e}startTypeIfNeeded(e="",t=P6){return e===Bl.START_NODE?Bl.START_TYPE:t}endIdIfNeeded(e=""){return e===Bl.END_NODE?(this.startEndCount++,`${Bl.END_TYPE}${this.startEndCount}`):e}endTypeIfNeeded(e="",t=P6){return e===Bl.END_NODE?Bl.END_TYPE:t}addRelationObjs(e,t,r=""){let n=this.startIdIfNeeded(e.id.trim()),i=this.startTypeIfNeeded(e.id.trim(),e.type),a=this.startIdIfNeeded(t.id.trim()),s=this.startTypeIfNeeded(t.id.trim(),t.type);this.addState(n,i,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(a,s,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.currentDocument.relations.push({id1:n,id2:a,relationTitle:Ct.sanitizeText(r,Be())})}addRelation(e,t,r){if(typeof e=="object"&&typeof t=="object")this.addRelationObjs(e,t,r);else if(typeof e=="string"&&typeof t=="string"){let n=this.startIdIfNeeded(e.trim()),i=this.startTypeIfNeeded(e),a=this.endIdIfNeeded(t.trim()),s=this.endTypeIfNeeded(t);this.addState(n,i),this.addState(a,s),this.currentDocument.relations.push({id1:n,id2:a,relationTitle:r?Ct.sanitizeText(r,Be()):void 0})}}addDescription(e,t){let r=this.currentDocument.states.get(e),n=t.startsWith(":")?t.replace(":","").trim():t;r?.descriptions?.push(Ct.sanitizeText(n,Be()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,t=""){this.classes.has(e)||this.classes.set(e,{id:e,styles:[],textStyles:[]});let r=this.classes.get(e);t&&r&&t.split(Bl.STYLECLASS_SEP).forEach(n=>{let i=n.replace(/([^;]*);/,"$1").trim();if(RegExp(Bl.COLOR_KEYWORD).exec(n)){let s=i.replace(Bl.FILL_KEYWORD,Bl.BG_FILL).replace(Bl.COLOR_KEYWORD,Bl.FILL_KEYWORD);r.textStyles.push(s)}r.styles.push(i)})}getClasses(){return this.classes}setupToolTips(e){let t=iw();ct(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover",i=>{let a=ct(i.currentTarget),s=a.attr("title");if(s===null)return;let o=i.currentTarget?.getBoundingClientRect();t.transition().duration(200).style("opacity",".9"),t.style("left",window.scrollX+o.left+(o.right-o.left)/2+"px").style("top",window.scrollY+o.bottom+"px"),t.html(Yl.sanitize(s)),a.classed("hover",!0)}).on("mouseout",i=>{t.transition().duration(500).style("opacity",0),ct(i.currentTarget).classed("hover",!1)})}setCssClass(e,t){e.split(",").forEach(r=>{let n=this.getState(r);if(!n){let i=r.trim();this.addState(i),n=this.getState(i)}n?.classes?.push(t)})}setStyle(e,t){this.getState(e)?.styles?.push(t)}setTextStyle(e,t){this.getState(e)?.textStyles?.push(t)}bindFunctions(e){this.funs.forEach(t=>{t(e)})}getDirectionStatement(){return this.rootDoc.find(e=>e.stmt===wZe)}getDirection(){return this.getDirectionStatement()?.value??tQt}setDirection(e){let t=this.getDirectionStatement();t?t.value=e:this.rootDoc.unshift({stmt:wZe,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){let e=Be();return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:FZe(this.getRootDocV2())}}getConfig(){return Be().state}},SQt=b(e=>` defs [id$="-barbEnd"] { fill: ${e.transitionColor}; stroke: ${e.transitionColor}; @@ -2434,12 +2434,12 @@ g.stateGroup line { ry: ${e.radius}px; filter: ${e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${e.svgId}-drop-shadow)`):"none"} } -`,"getStyles"),IO=wQt});var VZe={};Tr(VZe,{diagram:()=>BQt});var kQt,TQt,CQt,SQt,EQt,AQt,_Qt,RQt,LQt,zZe,GZe,IQt,ru,mae,MQt,NQt,DQt,OQt,qZe,PQt,BQt,WZe=W(()=>{pae();Uc();oc();ic();Hc();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();fn();iX();qc();fn();kQt=b(e=>e.append("circle").attr("class","start-state").attr("r",Be().state.sizeUnit).attr("cx",Be().state.padding+Be().state.sizeUnit).attr("cy",Be().state.padding+Be().state.sizeUnit),"drawStartState"),TQt=b(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",Be().state.textHeight).attr("class","divider").attr("x2",Be().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),CQt=b((e,t)=>{let r=e.append("text").attr("x",2*Be().state.padding).attr("y",Be().state.textHeight+2*Be().state.padding).attr("font-size",Be().state.fontSize).attr("class","state-title").text(t.id),n=r.node().getBBox();return e.insert("rect",":first-child").attr("x",Be().state.padding).attr("y",Be().state.padding).attr("width",n.width+2*Be().state.padding).attr("height",n.height+2*Be().state.padding).attr("rx",Be().state.radius),r},"drawSimpleState"),SQt=b((e,t)=>{let r=b(function(d,p,m){let g=d.append("tspan").attr("x",2*Be().state.padding).text(p);m||g.attr("dy",Be().state.textHeight)},"addTspan"),i=e.append("text").attr("x",2*Be().state.padding).attr("y",Be().state.textHeight+1.3*Be().state.padding).attr("font-size",Be().state.fontSize).attr("class","state-title").text(t.descriptions[0]).node().getBBox(),a=i.height,s=e.append("text").attr("x",Be().state.padding).attr("y",a+Be().state.padding*.4+Be().state.dividerMargin+Be().state.textHeight).attr("class","state-description"),o=!0,l=!0;t.descriptions.forEach(function(d){o||(r(s,d,l),l=!1),o=!1});let u=e.append("line").attr("x1",Be().state.padding).attr("y1",Be().state.padding+a+Be().state.dividerMargin/2).attr("y2",Be().state.padding+a+Be().state.dividerMargin/2).attr("class","descr-divider"),h=s.node().getBBox(),f=Math.max(h.width,i.width);return u.attr("x2",f+3*Be().state.padding),e.insert("rect",":first-child").attr("x",Be().state.padding).attr("y",Be().state.padding).attr("width",f+2*Be().state.padding).attr("height",h.height+a+2*Be().state.padding).attr("rx",Be().state.radius),e},"drawDescrState"),EQt=b((e,t,r)=>{let n=Be().state.padding,i=2*Be().state.padding,a=e.node().getBBox(),s=a.width,o=a.x,l=e.append("text").attr("x",0).attr("y",Be().state.titleShift).attr("font-size",Be().state.fontSize).attr("class","state-title").text(t.id),h=l.node().getBBox().width+i,f=Math.max(h,s);f===s&&(f=f+i);let d,p=e.node().getBBox();t.doc,d=o-n,h>s&&(d=(s-f)/2+n),Math.abs(o-p.x)s&&(d=o-(h-s)/2);let m=1-Be().state.textHeight;return e.insert("rect",":first-child").attr("x",d).attr("y",m).attr("class",r?"alt-composit":"composit").attr("width",f).attr("height",p.height+Be().state.textHeight+Be().state.titleShift+1).attr("rx","0"),l.attr("x",d+n),h<=s&&l.attr("x",o+(f-i)/2-h/2+n),e.insert("rect",":first-child").attr("x",d).attr("y",Be().state.titleShift-Be().state.textHeight-Be().state.padding).attr("width",f).attr("height",Be().state.textHeight*3).attr("rx",Be().state.radius),e.insert("rect",":first-child").attr("x",d).attr("y",Be().state.titleShift-Be().state.textHeight-Be().state.padding).attr("width",f).attr("height",p.height+3+2*Be().state.textHeight).attr("rx",Be().state.radius),e},"addTitleAndBox"),AQt=b(e=>(e.append("circle").attr("class","end-state-outer").attr("r",Be().state.sizeUnit+Be().state.miniPadding).attr("cx",Be().state.padding+Be().state.sizeUnit+Be().state.miniPadding).attr("cy",Be().state.padding+Be().state.sizeUnit+Be().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",Be().state.sizeUnit).attr("cx",Be().state.padding+Be().state.sizeUnit+2).attr("cy",Be().state.padding+Be().state.sizeUnit+2)),"drawEndState"),_Qt=b((e,t)=>{let r=Be().state.forkWidth,n=Be().state.forkHeight;if(t.parentId){let i=r;r=n,n=i}return e.append("rect").style("stroke","black").style("fill","black").attr("width",r).attr("height",n).attr("x",Be().state.padding).attr("y",Be().state.padding)},"drawForkJoinState"),RQt=b((e,t,r,n)=>{let i=0,a=n.append("text");a.style("text-anchor","start"),a.attr("class","noteText");let s=e.replace(/\r\n/g,"
");s=s.replace(/\n/g,"
");let o=s.split(Ct.lineBreakRegex),l=1.25*Be().state.noteMargin;for(let u of o){let h=u.trim();if(h.length>0){let f=a.append("tspan");if(f.text(h),l===0){let d=f.node().getBBox();l+=d.height}i+=l,f.attr("x",t+Be().state.noteMargin),f.attr("y",r+i+1.25*Be().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}},"_drawLongText"),LQt=b((e,t)=>{t.attr("class","state-note");let r=t.append("rect").attr("x",0).attr("y",Be().state.padding),n=t.append("g"),{textWidth:i,textHeight:a}=RQt(e,0,0,n);return r.attr("height",a+2*Be().state.noteMargin),r.attr("width",i+Be().state.noteMargin*2),r},"drawNote"),zZe=b(function(e,t){let r=t.id,n={id:r,label:t.id,width:0,height:0},i=e.append("g").attr("id",r).attr("class","stateGroup");t.type==="start"&&kQt(i),t.type==="end"&&AQt(i),(t.type==="fork"||t.type==="join")&&_Qt(i,t),t.type==="note"&&LQt(t.note.text,i),t.type==="divider"&&TQt(i),t.type==="default"&&t.descriptions.length===0&&CQt(i,t),t.type==="default"&&t.descriptions.length>0&&SQt(i,t);let a=i.node().getBBox();return n.width=a.width+2*Be().state.padding,n.height=a.height+2*Be().state.padding,n},"drawState"),GZe=0,IQt=b(function(e,t,r){let n=b(function(l){switch(l){case yp.relationType.AGGREGATION:return"aggregation";case yp.relationType.EXTENSION:return"extension";case yp.relationType.COMPOSITION:return"composition";case yp.relationType.DEPENDENCY:return"dependency"}},"getRelationType");t.points=t.points.filter(l=>!Number.isNaN(l.y));let i=t.points,a=Bf().x(function(l){return l.x}).y(function(l){return l.y}).curve(Ff),s=e.append("path").attr("d",a(i)).attr("id","edge"+GZe).attr("class","transition"),o="";if(Be().state.arrowMarkerAbsolute&&(o=gy(!0)),s.attr("marker-end","url("+o+"#"+n(yp.relationType.DEPENDENCY)+"End)"),r.title!==void 0){let l=e.append("g").attr("class","stateLabel"),{x:u,y:h}=pr.calcLabelPosition(t.points),f=Ct.getRows(r.title),d=0,p=[],m=0,g=0;for(let x=0;x<=f.length;x++){let w=l.append("text").attr("text-anchor","middle").text(f[x]).attr("x",u).attr("y",h+d),C=w.node().getBBox();m=Math.max(m,C.width),g=Math.min(g,C.x),se.info(C.x,u,h+d),d===0&&(d=w.node().getBBox().height,se.info("Title height",d,h)),p.push(w)}let y=d*f.length;if(f.length>1){let x=(f.length-1)*d*.5;p.forEach((w,C)=>w.attr("y",h+C*d-x)),y=d*f.length}let v=l.node().getBBox();l.insert("rect",":first-child").attr("class","box").attr("x",u-m/2-Be().state.padding/2).attr("y",h-y/2-Be().state.padding/2-3.5).attr("width",m+Be().state.padding).attr("height",y+Be().state.padding),se.info(v)}GZe++},"drawEdge"),mae={},MQt=b(function(){},"setConf"),NQt=b(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),DQt=b(function(e,t,r,n){ru=Be().state;let i=Be().securityLevel,a;i==="sandbox"&&(a=ct("#i"+t));let s=i==="sandbox"?ct(a.nodes()[0].contentDocument.body):ct("body"),o=i==="sandbox"?a.nodes()[0].contentDocument:document;se.debug("Rendering diagram "+e);let l=s.select(`[id='${t}']`);NQt(l);let u=n.db.getRootDoc(),h=l.append("g").attr("id",t+"-root");qZe(u,h,void 0,!1,s,o,n);let f=ru.padding,d=l.node().getBBox(),p=d.width+f*2,m=d.height+f*2,g=p*1.75;vn(l,m,g,ru.useMaxWidth),l.attr("viewBox",`${d.x-ru.padding} ${d.y-ru.padding} `+p+" "+m)},"draw"),OQt=b(e=>e?e.length*ru.fontSizeFactor:1,"getLabelWidth"),qZe=b((e,t,r,n,i,a,s)=>{let o=new qn({compound:!0,multigraph:!0}),l,u=!0;for(l=0;l{let T=C.parentElement,k=0,S=0;T&&(T.parentElement&&(k=T.parentElement.getBBox().width),S=parseInt(T.getAttribute("data-x-shift"),10),Number.isNaN(S)&&(S=0)),C.setAttribute("x1",0-S+8),C.setAttribute("x2",k-S-8)})):se.debug("No Node "+x+": "+JSON.stringify(o.node(x)))});let y=g.getBBox();o.edges().forEach(function(x){x!==void 0&&o.edge(x)!==void 0&&(se.debug("Edge "+x.v+" -> "+x.w+": "+JSON.stringify(o.edge(x))),IQt(t,o.edge(x),o.edge(x).relation))}),y=g.getBBox();let v={id:r||"root",label:r||"root",width:0,height:0};return v.width=y.width+2*ru.padding,v.height=y.height+2*ru.padding,se.debug("Doc rendered",v,o),v},"renderDoc"),PQt={setConf:MQt,draw:DQt},BQt={parser:LO,get db(){return new yp(1)},renderer:PQt,styles:IO,init:b(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var HZe={};Tr(HZe,{diagram:()=>FQt});var FQt,UZe=W(()=>{pae();Uc();oc();ic();Hc();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();FQt={parser:LO,get db(){return new yp(2)},renderer:BZe,styles:IO,init:b(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var tQe={};Tr(tQe,{diagram:()=>aJt});function eQe(e){let t=Be().journey,r=t.maxLabelWidth;MO=0;let n=60;Object.keys(vp).forEach(i=>{let a=vp[i].color,s={cx:20,cy:n,r:7,fill:a,stroke:"#000",pos:vp[i].position};z6.drawCircle(e,s);let o=e.append("text").attr("visibility","hidden").text(i),l=o.node().getBoundingClientRect().width;o.remove();let u=[];if(l<=r)u=[i];else{let h=i.split(" "),f="";o=e.append("text").attr("visibility","hidden"),h.forEach(d=>{let p=f?`${f} ${d}`:d;if(o.text(p),o.node().getBoundingClientRect().width>r){if(f&&u.push(f),f=d,o.text(d),o.node().getBoundingClientRect().width>r){let g="";for(let y of d)g+=y,o.text(g+"-"),o.node().getBoundingClientRect().width>r&&(u.push(g.slice(0,-1)+"-"),g=y);f=g}}else f=p}),f&&u.push(f),o.remove()}u.forEach((h,f)=>{let d={x:40,y:n+7+f*20,fill:"#666",text:h,textMargin:t.boxTextMargin??5},m=z6.drawText(e,d).node().getBoundingClientRect().width;m>MO&&m>t.leftMargin-m&&(MO=m)}),n+=Math.max(20,u.length*20)})}var yae,$Qt,dk,xae,F6,$6,zQt,GQt,qQt,VQt,WQt,HQt,UQt,YZe,YQt,XZe,XQt,jQt,bae,KQt,ZZe,QZe,ZQt,QQt,vae,JQt,eJt,JZe,tJt,z6,rJt,vp,MO,zh,t1,nJt,Yu,gae,jZe,iJt,KZe,aJt,rQe=W(()=>{ad();Hc();_r();Rr();hr();fn();fn();yae=(function(){var e=b(function(f,d,p,m){for(p=p||{},m=f.length;m--;p[f[m]]=d);return p},"o"),t=[6,8,10,11,12,14,16,17,18],r=[1,9],n=[1,10],i=[1,11],a=[1,12],s=[1,13],o=[1,14],l={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:b(function(d,p,m,g,y,v,x){var w=v.length-1;switch(y){case 1:return v[w-1];case 2:this.$=[];break;case 3:v[w-1].push(v[w]),this.$=v[w-1];break;case 4:case 5:this.$=v[w];break;case 6:case 7:this.$=[];break;case 8:g.setDiagramTitle(v[w].substr(6)),this.$=v[w].substr(6);break;case 9:this.$=v[w].trim(),g.setAccTitle(this.$);break;case 10:case 11:this.$=v[w].trim(),g.setAccDescription(this.$);break;case 12:g.addSection(v[w].substr(8)),this.$=v[w].substr(8);break;case 13:g.addTask(v[w-1],v[w]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:n,14:i,16:a,17:s,18:o},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:15,11:r,12:n,14:i,16:a,17:s,18:o},e(t,[2,5]),e(t,[2,6]),e(t,[2,8]),{13:[1,16]},{15:[1,17]},e(t,[2,11]),e(t,[2,12]),{19:[1,18]},e(t,[2,4]),e(t,[2,9]),e(t,[2,10]),e(t,[2,13])],defaultActions:{},parseError:b(function(d,p){if(p.recoverable)this.trace(d);else{var m=new Error(d);throw m.hash=p,m}},"parseError"),parse:b(function(d){var p=this,m=[0],g=[],y=[null],v=[],x=this.table,w="",C=0,T=0,k=0,S=2,E=1,I=v.slice.call(arguments,1),L=Object.create(this.lexer),O={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(O.yy[R]=this.yy[R]);L.setInput(d,O.yy),O.yy.lexer=L,O.yy.parser=this,typeof L.yylloc>"u"&&(L.yylloc={});var A=L.yylloc;v.push(A);var N=L.options&&L.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function M(ee){m.length=m.length-2*ee,y.length=y.length-ee,v.length=v.length-ee}b(M,"popStack");function D(){var ee;return ee=g.pop()||L.lex()||E,typeof ee!="number"&&(ee instanceof Array&&(g=ee,ee=g.pop()),ee=p.symbols_[ee]||ee),ee}b(D,"lex");for(var B,P,$,F,q,G,z={},H,j,J,U;;){if($=m[m.length-1],this.defaultActions[$]?F=this.defaultActions[$]:((B===null||typeof B>"u")&&(B=D()),F=x[$]&&x[$][B]),typeof F>"u"||!F.length||!F[0]){var le="";U=[];for(H in x[$])this.terminals_[H]&&H>S&&U.push("'"+this.terminals_[H]+"'");L.showPosition?le="Parse error on line "+(C+1)+`: +`,"getStyles"),IO=SQt});var HZe={};Tr(HZe,{diagram:()=>GQt});var EQt,AQt,_Qt,RQt,LQt,IQt,MQt,NQt,DQt,qZe,VZe,OQt,ru,yae,PQt,BQt,FQt,$Qt,WZe,zQt,GQt,UZe=W(()=>{gae();Uc();lc();ac();Hc();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();fn();sX();qc();fn();EQt=b(e=>e.append("circle").attr("class","start-state").attr("r",Be().state.sizeUnit).attr("cx",Be().state.padding+Be().state.sizeUnit).attr("cy",Be().state.padding+Be().state.sizeUnit),"drawStartState"),AQt=b(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",Be().state.textHeight).attr("class","divider").attr("x2",Be().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),_Qt=b((e,t)=>{let r=e.append("text").attr("x",2*Be().state.padding).attr("y",Be().state.textHeight+2*Be().state.padding).attr("font-size",Be().state.fontSize).attr("class","state-title").text(t.id),n=r.node().getBBox();return e.insert("rect",":first-child").attr("x",Be().state.padding).attr("y",Be().state.padding).attr("width",n.width+2*Be().state.padding).attr("height",n.height+2*Be().state.padding).attr("rx",Be().state.radius),r},"drawSimpleState"),RQt=b((e,t)=>{let r=b(function(d,p,m){let g=d.append("tspan").attr("x",2*Be().state.padding).text(p);m||g.attr("dy",Be().state.textHeight)},"addTspan"),i=e.append("text").attr("x",2*Be().state.padding).attr("y",Be().state.textHeight+1.3*Be().state.padding).attr("font-size",Be().state.fontSize).attr("class","state-title").text(t.descriptions[0]).node().getBBox(),a=i.height,s=e.append("text").attr("x",Be().state.padding).attr("y",a+Be().state.padding*.4+Be().state.dividerMargin+Be().state.textHeight).attr("class","state-description"),o=!0,l=!0;t.descriptions.forEach(function(d){o||(r(s,d,l),l=!1),o=!1});let u=e.append("line").attr("x1",Be().state.padding).attr("y1",Be().state.padding+a+Be().state.dividerMargin/2).attr("y2",Be().state.padding+a+Be().state.dividerMargin/2).attr("class","descr-divider"),h=s.node().getBBox(),f=Math.max(h.width,i.width);return u.attr("x2",f+3*Be().state.padding),e.insert("rect",":first-child").attr("x",Be().state.padding).attr("y",Be().state.padding).attr("width",f+2*Be().state.padding).attr("height",h.height+a+2*Be().state.padding).attr("rx",Be().state.radius),e},"drawDescrState"),LQt=b((e,t,r)=>{let n=Be().state.padding,i=2*Be().state.padding,a=e.node().getBBox(),s=a.width,o=a.x,l=e.append("text").attr("x",0).attr("y",Be().state.titleShift).attr("font-size",Be().state.fontSize).attr("class","state-title").text(t.id),h=l.node().getBBox().width+i,f=Math.max(h,s);f===s&&(f=f+i);let d,p=e.node().getBBox();t.doc,d=o-n,h>s&&(d=(s-f)/2+n),Math.abs(o-p.x)s&&(d=o-(h-s)/2);let m=1-Be().state.textHeight;return e.insert("rect",":first-child").attr("x",d).attr("y",m).attr("class",r?"alt-composit":"composit").attr("width",f).attr("height",p.height+Be().state.textHeight+Be().state.titleShift+1).attr("rx","0"),l.attr("x",d+n),h<=s&&l.attr("x",o+(f-i)/2-h/2+n),e.insert("rect",":first-child").attr("x",d).attr("y",Be().state.titleShift-Be().state.textHeight-Be().state.padding).attr("width",f).attr("height",Be().state.textHeight*3).attr("rx",Be().state.radius),e.insert("rect",":first-child").attr("x",d).attr("y",Be().state.titleShift-Be().state.textHeight-Be().state.padding).attr("width",f).attr("height",p.height+3+2*Be().state.textHeight).attr("rx",Be().state.radius),e},"addTitleAndBox"),IQt=b(e=>(e.append("circle").attr("class","end-state-outer").attr("r",Be().state.sizeUnit+Be().state.miniPadding).attr("cx",Be().state.padding+Be().state.sizeUnit+Be().state.miniPadding).attr("cy",Be().state.padding+Be().state.sizeUnit+Be().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",Be().state.sizeUnit).attr("cx",Be().state.padding+Be().state.sizeUnit+2).attr("cy",Be().state.padding+Be().state.sizeUnit+2)),"drawEndState"),MQt=b((e,t)=>{let r=Be().state.forkWidth,n=Be().state.forkHeight;if(t.parentId){let i=r;r=n,n=i}return e.append("rect").style("stroke","black").style("fill","black").attr("width",r).attr("height",n).attr("x",Be().state.padding).attr("y",Be().state.padding)},"drawForkJoinState"),NQt=b((e,t,r,n)=>{let i=0,a=n.append("text");a.style("text-anchor","start"),a.attr("class","noteText");let s=e.replace(/\r\n/g,"
");s=s.replace(/\n/g,"
");let o=s.split(Ct.lineBreakRegex),l=1.25*Be().state.noteMargin;for(let u of o){let h=u.trim();if(h.length>0){let f=a.append("tspan");if(f.text(h),l===0){let d=f.node().getBBox();l+=d.height}i+=l,f.attr("x",t+Be().state.noteMargin),f.attr("y",r+i+1.25*Be().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}},"_drawLongText"),DQt=b((e,t)=>{t.attr("class","state-note");let r=t.append("rect").attr("x",0).attr("y",Be().state.padding),n=t.append("g"),{textWidth:i,textHeight:a}=NQt(e,0,0,n);return r.attr("height",a+2*Be().state.noteMargin),r.attr("width",i+Be().state.noteMargin*2),r},"drawNote"),qZe=b(function(e,t){let r=t.id,n={id:r,label:t.id,width:0,height:0},i=e.append("g").attr("id",r).attr("class","stateGroup");t.type==="start"&&EQt(i),t.type==="end"&&IQt(i),(t.type==="fork"||t.type==="join")&&MQt(i,t),t.type==="note"&&DQt(t.note.text,i),t.type==="divider"&&AQt(i),t.type==="default"&&t.descriptions.length===0&&_Qt(i,t),t.type==="default"&&t.descriptions.length>0&&RQt(i,t);let a=i.node().getBBox();return n.width=a.width+2*Be().state.padding,n.height=a.height+2*Be().state.padding,n},"drawState"),VZe=0,OQt=b(function(e,t,r){let n=b(function(l){switch(l){case yp.relationType.AGGREGATION:return"aggregation";case yp.relationType.EXTENSION:return"extension";case yp.relationType.COMPOSITION:return"composition";case yp.relationType.DEPENDENCY:return"dependency"}},"getRelationType");t.points=t.points.filter(l=>!Number.isNaN(l.y));let i=t.points,a=Bf().x(function(l){return l.x}).y(function(l){return l.y}).curve(Ff),s=e.append("path").attr("d",a(i)).attr("id","edge"+VZe).attr("class","transition"),o="";if(Be().state.arrowMarkerAbsolute&&(o=gy(!0)),s.attr("marker-end","url("+o+"#"+n(yp.relationType.DEPENDENCY)+"End)"),r.title!==void 0){let l=e.append("g").attr("class","stateLabel"),{x:u,y:h}=pr.calcLabelPosition(t.points),f=Ct.getRows(r.title),d=0,p=[],m=0,g=0;for(let x=0;x<=f.length;x++){let w=l.append("text").attr("text-anchor","middle").text(f[x]).attr("x",u).attr("y",h+d),C=w.node().getBBox();m=Math.max(m,C.width),g=Math.min(g,C.x),se.info(C.x,u,h+d),d===0&&(d=w.node().getBBox().height,se.info("Title height",d,h)),p.push(w)}let y=d*f.length;if(f.length>1){let x=(f.length-1)*d*.5;p.forEach((w,C)=>w.attr("y",h+C*d-x)),y=d*f.length}let v=l.node().getBBox();l.insert("rect",":first-child").attr("class","box").attr("x",u-m/2-Be().state.padding/2).attr("y",h-y/2-Be().state.padding/2-3.5).attr("width",m+Be().state.padding).attr("height",y+Be().state.padding),se.info(v)}VZe++},"drawEdge"),yae={},PQt=b(function(){},"setConf"),BQt=b(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),FQt=b(function(e,t,r,n){ru=Be().state;let i=Be().securityLevel,a;i==="sandbox"&&(a=ct("#i"+t));let s=i==="sandbox"?ct(a.nodes()[0].contentDocument.body):ct("body"),o=i==="sandbox"?a.nodes()[0].contentDocument:document;se.debug("Rendering diagram "+e);let l=s.select(`[id='${t}']`);BQt(l);let u=n.db.getRootDoc(),h=l.append("g").attr("id",t+"-root");WZe(u,h,void 0,!1,s,o,n);let f=ru.padding,d=l.node().getBBox(),p=d.width+f*2,m=d.height+f*2,g=p*1.75;vn(l,m,g,ru.useMaxWidth),l.attr("viewBox",`${d.x-ru.padding} ${d.y-ru.padding} `+p+" "+m)},"draw"),$Qt=b(e=>e?e.length*ru.fontSizeFactor:1,"getLabelWidth"),WZe=b((e,t,r,n,i,a,s)=>{let o=new qn({compound:!0,multigraph:!0}),l,u=!0;for(l=0;l{let T=C.parentElement,k=0,S=0;T&&(T.parentElement&&(k=T.parentElement.getBBox().width),S=parseInt(T.getAttribute("data-x-shift"),10),Number.isNaN(S)&&(S=0)),C.setAttribute("x1",0-S+8),C.setAttribute("x2",k-S-8)})):se.debug("No Node "+x+": "+JSON.stringify(o.node(x)))});let y=g.getBBox();o.edges().forEach(function(x){x!==void 0&&o.edge(x)!==void 0&&(se.debug("Edge "+x.v+" -> "+x.w+": "+JSON.stringify(o.edge(x))),OQt(t,o.edge(x),o.edge(x).relation))}),y=g.getBBox();let v={id:r||"root",label:r||"root",width:0,height:0};return v.width=y.width+2*ru.padding,v.height=y.height+2*ru.padding,se.debug("Doc rendered",v,o),v},"renderDoc"),zQt={setConf:PQt,draw:FQt},GQt={parser:LO,get db(){return new yp(1)},renderer:zQt,styles:IO,init:b(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var YZe={};Tr(YZe,{diagram:()=>qQt});var qQt,XZe=W(()=>{gae();Uc();lc();ac();Hc();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();qQt={parser:LO,get db(){return new yp(2)},renderer:$Ze,styles:IO,init:b(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var nQe={};Tr(nQe,{diagram:()=>cJt});function rQe(e){let t=Be().journey,r=t.maxLabelWidth;MO=0;let n=60;Object.keys(vp).forEach(i=>{let a=vp[i].color,s={cx:20,cy:n,r:7,fill:a,stroke:"#000",pos:vp[i].position};z6.drawCircle(e,s);let o=e.append("text").attr("visibility","hidden").text(i),l=o.node().getBoundingClientRect().width;o.remove();let u=[];if(l<=r)u=[i];else{let h=i.split(" "),f="";o=e.append("text").attr("visibility","hidden"),h.forEach(d=>{let p=f?`${f} ${d}`:d;if(o.text(p),o.node().getBoundingClientRect().width>r){if(f&&u.push(f),f=d,o.text(d),o.node().getBoundingClientRect().width>r){let g="";for(let y of d)g+=y,o.text(g+"-"),o.node().getBoundingClientRect().width>r&&(u.push(g.slice(0,-1)+"-"),g=y);f=g}}else f=p}),f&&u.push(f),o.remove()}u.forEach((h,f)=>{let d={x:40,y:n+7+f*20,fill:"#666",text:h,textMargin:t.boxTextMargin??5},m=z6.drawText(e,d).node().getBoundingClientRect().width;m>MO&&m>t.leftMargin-m&&(MO=m)}),n+=Math.max(20,u.length*20)})}var xae,VQt,dk,wae,F6,$6,WQt,HQt,UQt,YQt,XQt,jQt,KQt,jZe,ZQt,KZe,QQt,JQt,kae,eJt,JZe,eQe,tJt,rJt,bae,nJt,iJt,tQe,aJt,z6,sJt,vp,MO,zh,t1,oJt,Yu,vae,ZZe,lJt,QZe,cJt,iQe=W(()=>{ad();Hc();_r();Rr();hr();fn();fn();xae=(function(){var e=b(function(f,d,p,m){for(p=p||{},m=f.length;m--;p[f[m]]=d);return p},"o"),t=[6,8,10,11,12,14,16,17,18],r=[1,9],n=[1,10],i=[1,11],a=[1,12],s=[1,13],o=[1,14],l={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:b(function(d,p,m,g,y,v,x){var w=v.length-1;switch(y){case 1:return v[w-1];case 2:this.$=[];break;case 3:v[w-1].push(v[w]),this.$=v[w-1];break;case 4:case 5:this.$=v[w];break;case 6:case 7:this.$=[];break;case 8:g.setDiagramTitle(v[w].substr(6)),this.$=v[w].substr(6);break;case 9:this.$=v[w].trim(),g.setAccTitle(this.$);break;case 10:case 11:this.$=v[w].trim(),g.setAccDescription(this.$);break;case 12:g.addSection(v[w].substr(8)),this.$=v[w].substr(8);break;case 13:g.addTask(v[w-1],v[w]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:n,14:i,16:a,17:s,18:o},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:15,11:r,12:n,14:i,16:a,17:s,18:o},e(t,[2,5]),e(t,[2,6]),e(t,[2,8]),{13:[1,16]},{15:[1,17]},e(t,[2,11]),e(t,[2,12]),{19:[1,18]},e(t,[2,4]),e(t,[2,9]),e(t,[2,10]),e(t,[2,13])],defaultActions:{},parseError:b(function(d,p){if(p.recoverable)this.trace(d);else{var m=new Error(d);throw m.hash=p,m}},"parseError"),parse:b(function(d){var p=this,m=[0],g=[],y=[null],v=[],x=this.table,w="",C=0,T=0,k=0,S=2,E=1,I=v.slice.call(arguments,1),L=Object.create(this.lexer),O={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(O.yy[R]=this.yy[R]);L.setInput(d,O.yy),O.yy.lexer=L,O.yy.parser=this,typeof L.yylloc>"u"&&(L.yylloc={});var A=L.yylloc;v.push(A);var N=L.options&&L.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function M(ee){m.length=m.length-2*ee,y.length=y.length-ee,v.length=v.length-ee}b(M,"popStack");function D(){var ee;return ee=g.pop()||L.lex()||E,typeof ee!="number"&&(ee instanceof Array&&(g=ee,ee=g.pop()),ee=p.symbols_[ee]||ee),ee}b(D,"lex");for(var B,P,$,F,q,G,z={},H,j,J,U;;){if($=m[m.length-1],this.defaultActions[$]?F=this.defaultActions[$]:((B===null||typeof B>"u")&&(B=D()),F=x[$]&&x[$][B]),typeof F>"u"||!F.length||!F[0]){var le="";U=[];for(H in x[$])this.terminals_[H]&&H>S&&U.push("'"+this.terminals_[H]+"'");L.showPosition?le="Parse error on line "+(C+1)+`: `+L.showPosition()+` Expecting `+U.join(", ")+", got '"+(this.terminals_[B]||B)+"'":le="Parse error on line "+(C+1)+": Unexpected "+(B==E?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(le,{text:L.match,token:this.terminals_[B]||B,line:L.yylineno,loc:A,expected:U})}if(F[0]instanceof Array&&F.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+B);switch(F[0]){case 1:m.push(B),y.push(L.yytext),v.push(L.yylloc),m.push(F[1]),B=null,P?(B=P,P=null):(T=L.yyleng,w=L.yytext,C=L.yylineno,A=L.yylloc,k>0&&k--);break;case 2:if(j=this.productions_[F[1]][1],z.$=y[y.length-j],z._$={first_line:v[v.length-(j||1)].first_line,last_line:v[v.length-1].last_line,first_column:v[v.length-(j||1)].first_column,last_column:v[v.length-1].last_column},N&&(z._$.range=[v[v.length-(j||1)].range[0],v[v.length-1].range[1]]),G=this.performAction.apply(z,[w,T,C,O.yy,F[1],y,v].concat(I)),typeof G<"u")return G;j&&(m=m.slice(0,-1*j*2),y=y.slice(0,-1*j),v=v.slice(0,-1*j)),m.push(this.productions_[F[1]][0]),y.push(z.$),v.push(z._$),J=x[m[m.length-2]][m[m.length-1]],m.push(J);break;case 3:return!0}}return!0},"parse")},u=(function(){var f={EOF:1,parseError:b(function(p,m){if(this.yy.parser)this.yy.parser.parseError(p,m);else throw new Error(p)},"parseError"),setInput:b(function(d,p){return this.yy=p||this.yy||{},this._input=d,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var d=this._input[0];this.yytext+=d,this.yyleng++,this.offset++,this.match+=d,this.matched+=d;var p=d.match(/(?:\r\n?|\n).*/g);return p?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),d},"input"),unput:b(function(d){var p=d.length,m=d.split(/(?:\r\n?|\n)/g);this._input=d+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-p),this.offset-=p;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),m.length-1&&(this.yylineno-=m.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:m?(m.length===g.length?this.yylloc.first_column:0)+g[g.length-m.length].length-m[0].length:this.yylloc.first_column-p},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-p]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(d){this.unput(this.match.slice(d))},"less"),pastInput:b(function(){var d=this.matched.substr(0,this.matched.length-this.match.length);return(d.length>20?"...":"")+d.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var d=this.match;return d.length<20&&(d+=this._input.substr(0,20-d.length)),(d.substr(0,20)+(d.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var d=this.pastInput(),p=new Array(d.length+1).join("-");return d+this.upcomingInput()+` `+p+"^"},"showPosition"),test_match:b(function(d,p){var m,g,y;if(this.options.backtrack_lexer&&(y={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(y.yylloc.range=this.yylloc.range.slice(0))),g=d[0].match(/(?:\r\n?|\n).*/g),g&&(this.yylineno+=g.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+d[0].length},this.yytext+=d[0],this.match+=d[0],this.matches=d,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(d[0].length),this.matched+=d[0],m=this.performAction.call(this,this.yy,this,p,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),m)return m;if(this._backtrack){for(var v in y)this[v]=y[v];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var d,p,m,g;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),v=0;vp[0].length)){if(p=m,g=v,this.options.backtrack_lexer){if(d=this.test_match(m,y[v]),d!==!1)return d;if(this._backtrack){p=!1;continue}else return!1}else if(!this.options.flex)break}return p?(d=this.test_match(p,y[g]),d!==!1?d:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var p=this.next();return p||this.lex()},"lex"),begin:b(function(p){this.conditionStack.push(p)},"begin"),popState:b(function(){var p=this.conditionStack.length-1;return p>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(p){return p=this.conditionStack.length-1-Math.abs(p||0),p>=0?this.conditionStack[p]:"INITIAL"},"topState"),pushState:b(function(p){this.begin(p)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(p,m,g,y){var v=y;switch(g){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return f})();l.lexer=u;function h(){this.yy={}}return b(h,"Parser"),h.prototype=l,l.Parser=h,new h})();yae.parser=yae;$Qt=yae,dk="",xae=[],F6=[],$6=[],zQt=b(function(){xae.length=0,F6.length=0,dk="",$6.length=0,Nr()},"clear"),GQt=b(function(e){dk=e,xae.push(e)},"addSection"),qQt=b(function(){return xae},"getSections"),VQt=b(function(){let e=YZe(),t=100,r=0;for(;!e&&r{r.people&&e.push(...r.people)}),[...new Set(e)].sort()},"updateActors"),HQt=b(function(e,t){let r=t.substr(1).split(":"),n=0,i=[];r.length===1?(n=Number(r[0]),i=[]):(n=Number(r[0]),i=r[1].split(","));let a=i.map(o=>o.trim()),s={section:dk,type:dk,people:a,task:e,score:n};$6.push(s)},"addTask"),UQt=b(function(e){let t={section:dk,type:dk,description:e,task:e,classes:[]};F6.push(t)},"addTaskOrg"),YZe=b(function(){let e=b(function(r){return $6[r].processed},"compileTask"),t=!0;for(let[r,n]of $6.entries())e(r),t=t&&n.processed;return t},"compileTasks"),YQt=b(function(){return WQt()},"getActors"),XZe={getConfig:b(()=>Be().journey,"getConfig"),clear:zQt,setDiagramTitle:ln,getDiagramTitle:tn,setAccTitle:Yr,getAccTitle:Qr,setAccDescription:Jr,getAccDescription:en,addSection:GQt,getSections:qQt,getTasks:VQt,addTask:HQt,addTaskOrg:UQt,getActors:YQt},XQt=b(e=>`.label { +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var p=this.next();return p||this.lex()},"lex"),begin:b(function(p){this.conditionStack.push(p)},"begin"),popState:b(function(){var p=this.conditionStack.length-1;return p>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(p){return p=this.conditionStack.length-1-Math.abs(p||0),p>=0?this.conditionStack[p]:"INITIAL"},"topState"),pushState:b(function(p){this.begin(p)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(p,m,g,y){var v=y;switch(g){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return f})();l.lexer=u;function h(){this.yy={}}return b(h,"Parser"),h.prototype=l,l.Parser=h,new h})();xae.parser=xae;VQt=xae,dk="",wae=[],F6=[],$6=[],WQt=b(function(){wae.length=0,F6.length=0,dk="",$6.length=0,Nr()},"clear"),HQt=b(function(e){dk=e,wae.push(e)},"addSection"),UQt=b(function(){return wae},"getSections"),YQt=b(function(){let e=jZe(),t=100,r=0;for(;!e&&r{r.people&&e.push(...r.people)}),[...new Set(e)].sort()},"updateActors"),jQt=b(function(e,t){let r=t.substr(1).split(":"),n=0,i=[];r.length===1?(n=Number(r[0]),i=[]):(n=Number(r[0]),i=r[1].split(","));let a=i.map(o=>o.trim()),s={section:dk,type:dk,people:a,task:e,score:n};$6.push(s)},"addTask"),KQt=b(function(e){let t={section:dk,type:dk,description:e,task:e,classes:[]};F6.push(t)},"addTaskOrg"),jZe=b(function(){let e=b(function(r){return $6[r].processed},"compileTask"),t=!0;for(let[r,n]of $6.entries())e(r),t=t&&n.processed;return t},"compileTasks"),ZQt=b(function(){return XQt()},"getActors"),KZe={getConfig:b(()=>Be().journey,"getConfig"),clear:WQt,setDiagramTitle:ln,getDiagramTitle:tn,setAccTitle:Yr,getAccTitle:Qr,setAccDescription:Jr,getAccDescription:en,addSection:HQt,getSections:UQt,getTasks:YQt,addTask:jQt,addTaskOrg:KQt,getActors:ZQt},QQt=b(e=>`.label { font-family: ${e.fontFamily}; color: ${e.textColor}; } @@ -2572,12 +2572,12 @@ Expecting `+U.join(", ")+", got '"+(this.terminals_[B]||B)+"'":le="Parse error o ${e.actor5?`fill: ${e.actor5}`:""}; } ${id()} -`,"getStyles"),jQt=XQt,bae=b(function(e,t){return wv(e,t)},"drawRect"),KQt=b(function(e,t){let n=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=e.append("g");i.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(l){let u=Pf().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}b(a,"smile");function s(l){let u=Pf().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}b(s,"sad");function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return b(o,"ambivalent"),t.score>3?a(i):t.score<3?s(i):o(i),n},"drawFace"),ZZe=b(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),QZe=b(function(e,t){return tOe(e,t)},"drawText"),ZQt=b(function(e,t){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}b(r,"genPoints");let n=e.append("polygon");n.attr("points",r(t.x,t.y,50,20,7)),n.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,QZe(e,t)},"drawLabel"),QQt=b(function(e,t,r){let n=e.append("g"),i=Xo();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=r.width*t.taskCount+r.diagramMarginX*(t.taskCount-1),i.height=r.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,bae(n,i),JZe(r)(t.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),vae=-1,JQt=b(function(e,t,r,n){let i=t.x+r.width/2,a=e.append("g");vae++,a.append("line").attr("id",n+"-task"+vae).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),KQt(a,{cx:i,cy:300+(5-t.score)*30,score:t.score});let o=Xo();o.x=t.x,o.y=t.y,o.fill=t.fill,o.width=r.width,o.height=r.height,o.class="task task-type-"+t.num,o.rx=3,o.ry=3,bae(a,o);let l=t.x+14;t.people.forEach(u=>{let h=t.actors[u].color,f={cx:l,cy:t.y,r:7,fill:h,stroke:"#000",title:u,pos:t.actors[u].position};ZZe(a,f),l+=10}),JZe(r)(t.task,a,o.x,o.y,o.width,o.height,{class:"task"},r,t.colour)},"drawTask"),eJt=b(function(e,t){SI(e,t)},"drawBackgroundRect"),JZe=(function(){function e(i,a,s,o,l,u,h,f){let d=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(d,h)}b(e,"byText");function t(i,a,s,o,l,u,h,f,d){let{taskFontSize:p,taskFontFamily:m}=f,g=i.split(//gi);for(let y=0;y{vp[C]={color:zh.actorColours[g%zh.actorColours.length],position:g},g++}),eQe(f),t1=zh.leftMargin+MO,Yu.insert(0,0,t1,Object.keys(vp).length*50),iJt(f,d,0,t);let y=Yu.getBounds();p&&f.append("text").text(p).attr("x",t1).attr("font-size",s).attr("font-weight","bold").attr("y",25).attr("fill",a).attr("font-family",o);let v=y.stopy-y.starty+2*zh.diagramMarginY,x=t1+y.stopx+2*zh.diagramMarginX;vn(f,v,x,zh.useMaxWidth),f.append("line").attr("x1",t1).attr("y1",zh.height*4).attr("x2",x-t1-4).attr("y2",zh.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#"+t+"-arrowhead)");let w=p?70:0;f.attr("viewBox",`${y.startx} -25 ${x} ${v+w}`),f.attr("preserveAspectRatio","xMinYMin meet"),f.attr("height",v+w+25)},"draw"),Yu={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:b(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:b(function(e,t,r,n){e[t]===void 0?e[t]=r:e[t]=n(r,e[t])},"updateVal"),updateBounds:b(function(e,t,r,n){let i=Be().journey,a=this,s=0;function o(l){return b(function(h){s++;let f=a.sequenceItems.length-s+1;a.updateVal(h,"starty",t-f*i.boxMargin,Math.min),a.updateVal(h,"stopy",n+f*i.boxMargin,Math.max),a.updateVal(Yu.data,"startx",e-f*i.boxMargin,Math.min),a.updateVal(Yu.data,"stopx",r+f*i.boxMargin,Math.max),l!=="activation"&&(a.updateVal(h,"startx",e-f*i.boxMargin,Math.min),a.updateVal(h,"stopx",r+f*i.boxMargin,Math.max),a.updateVal(Yu.data,"starty",t-f*i.boxMargin,Math.min),a.updateVal(Yu.data,"stopy",n+f*i.boxMargin,Math.max))},"updateItemBounds")}b(o,"updateFn"),this.sequenceItems.forEach(o())},"updateBounds"),insert:b(function(e,t,r,n){let i=Math.min(e,r),a=Math.max(e,r),s=Math.min(t,n),o=Math.max(t,n);this.updateVal(Yu.data,"startx",i,Math.min),this.updateVal(Yu.data,"starty",s,Math.min),this.updateVal(Yu.data,"stopx",a,Math.max),this.updateVal(Yu.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},"insert"),bumpVerticalPos:b(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:b(function(){return this.verticalPos},"getVerticalPos"),getBounds:b(function(){return this.data},"getBounds")},gae=zh.sectionFills,jZe=zh.sectionColours,iJt=b(function(e,t,r,n){let i=Be().journey,a="",s=i.height*2+i.diagramMarginY,o=r+s,l=0,u="#CCC",h="black",f=0;for(let[d,p]of t.entries()){if(a!==p.section){u=gae[l%gae.length],f=l%gae.length,h=jZe[l%jZe.length];let g=0,y=p.section;for(let x=d;x(vp[y]&&(g[y]=vp[y]),g),{});p.x=d*i.taskMargin+d*i.width+t1,p.y=o,p.width=i.diagramMarginX,p.height=i.diagramMarginY,p.colour=h,p.fill=u,p.num=f,p.actors=m,z6.drawTask(e,p,i,n),Yu.insert(p.x,p.y,p.x+p.width+i.taskMargin,450)}},"drawTasks"),KZe={setConf:rJt,draw:nJt},aJt={parser:$Qt,db:XZe,renderer:KZe,styles:jQt,init:b(e=>{KZe.setConf(e.journey),XZe.clear()},"init")}});var EQe={};Tr(EQe,{diagram:()=>NJt});function Eae(e,t){e.each(function(){var r=ct(this),n=r.text().split(/(\s+|
)/).reverse(),i,a=[],s=1.1,o=r.attr("y"),l=parseFloat(r.attr("dy")),u=r.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",l+"em");for(let h=0;ht||i==="
")&&(a.pop(),u.text(a.join(" ").trim()),i==="
"?a=[""]:a=[i],u=r.append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em").text(i))})}var wae,sJt,lQe,pk,cQe,Tae,Cae,NO,mk,uQe,hQe,fQe,dQe,pQe,mQe,gQe,yQe,vQe,xQe,nQe,oJt,bQe,DO,lJt,cJt,wQe,uJt,hJt,kae,fJt,dJt,pJt,Sae,kQe,mJt,gJt,yJt,vJt,gc,xJt,iQe,bJt,wJt,OO,xp,kJt,Aae,TJt,TQe,CJt,aQe,CQe,sQe,SQe,SJt,oQe,EJt,AJt,_Jt,RJt,LJt,IJt,MJt,NJt,AQe=W(()=>{za();Sn();_r();Rr();hr();fn();fn();Ka();wae=(function(){var e=b(function(d,p,m,g){for(m=m||{},g=d.length;g--;m[d[g]]=p);return m},"o"),t=[6,11,13,14,15,17,19,20,23,24],r=[1,12],n=[1,13],i=[1,14],a=[1,15],s=[1,16],o=[1,19],l=[1,20],u={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:b(function(p,m,g,y,v,x,w){var C=x.length-1;switch(v){case 1:return x[C-1];case 3:y.setDirection("LR");break;case 4:y.setDirection("TD");break;case 5:this.$=[];break;case 6:x[C-1].push(x[C]),this.$=x[C-1];break;case 7:case 8:this.$=x[C];break;case 9:case 10:this.$=[];break;case 11:y.getCommonDb().setDiagramTitle(x[C].substr(6)),this.$=x[C].substr(6);break;case 12:this.$=x[C].trim(),y.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=x[C].trim(),y.getCommonDb().setAccDescription(this.$);break;case 15:y.addSection(x[C].substr(8)),this.$=x[C].substr(8);break;case 18:y.addTask(x[C],0,""),this.$=x[C];break;case 19:y.addEvent(x[C].substr(2)),this.$=x[C];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:r,15:n,17:i,19:a,20:s,21:17,22:18,23:o,24:l},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:r,15:n,17:i,19:a,20:s,21:17,22:18,23:o,24:l},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:b(function(p,m){if(m.recoverable)this.trace(p);else{var g=new Error(p);throw g.hash=m,g}},"parseError"),parse:b(function(p){var m=this,g=[0],y=[],v=[null],x=[],w=this.table,C="",T=0,k=0,S=0,E=2,I=1,L=x.slice.call(arguments,1),O=Object.create(this.lexer),R={yy:{}};for(var A in this.yy)Object.prototype.hasOwnProperty.call(this.yy,A)&&(R.yy[A]=this.yy[A]);O.setInput(p,R.yy),R.yy.lexer=O,R.yy.parser=this,typeof O.yylloc>"u"&&(O.yylloc={});var N=O.yylloc;x.push(N);var M=O.options&&O.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function D(ue){g.length=g.length-2*ue,v.length=v.length-ue,x.length=x.length-ue}b(D,"popStack");function B(){var ue;return ue=y.pop()||O.lex()||I,typeof ue!="number"&&(ue instanceof Array&&(y=ue,ue=y.pop()),ue=m.symbols_[ue]||ue),ue}b(B,"lex");for(var P,$,F,q,G,z,H={},j,J,U,le;;){if(F=g[g.length-1],this.defaultActions[F]?q=this.defaultActions[F]:((P===null||typeof P>"u")&&(P=B()),q=w[F]&&w[F][P]),typeof q>"u"||!q.length||!q[0]){var ee="";le=[];for(j in w[F])this.terminals_[j]&&j>E&&le.push("'"+this.terminals_[j]+"'");O.showPosition?ee="Parse error on line "+(T+1)+`: +`,"getStyles"),JQt=QQt,kae=b(function(e,t){return wv(e,t)},"drawRect"),eJt=b(function(e,t){let n=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=e.append("g");i.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(l){let u=Pf().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}b(a,"smile");function s(l){let u=Pf().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}b(s,"sad");function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return b(o,"ambivalent"),t.score>3?a(i):t.score<3?s(i):o(i),n},"drawFace"),JZe=b(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),eQe=b(function(e,t){return nOe(e,t)},"drawText"),tJt=b(function(e,t){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}b(r,"genPoints");let n=e.append("polygon");n.attr("points",r(t.x,t.y,50,20,7)),n.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,eQe(e,t)},"drawLabel"),rJt=b(function(e,t,r){let n=e.append("g"),i=Xo();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=r.width*t.taskCount+r.diagramMarginX*(t.taskCount-1),i.height=r.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,kae(n,i),tQe(r)(t.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),bae=-1,nJt=b(function(e,t,r,n){let i=t.x+r.width/2,a=e.append("g");bae++,a.append("line").attr("id",n+"-task"+bae).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),eJt(a,{cx:i,cy:300+(5-t.score)*30,score:t.score});let o=Xo();o.x=t.x,o.y=t.y,o.fill=t.fill,o.width=r.width,o.height=r.height,o.class="task task-type-"+t.num,o.rx=3,o.ry=3,kae(a,o);let l=t.x+14;t.people.forEach(u=>{let h=t.actors[u].color,f={cx:l,cy:t.y,r:7,fill:h,stroke:"#000",title:u,pos:t.actors[u].position};JZe(a,f),l+=10}),tQe(r)(t.task,a,o.x,o.y,o.width,o.height,{class:"task"},r,t.colour)},"drawTask"),iJt=b(function(e,t){SI(e,t)},"drawBackgroundRect"),tQe=(function(){function e(i,a,s,o,l,u,h,f){let d=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(d,h)}b(e,"byText");function t(i,a,s,o,l,u,h,f,d){let{taskFontSize:p,taskFontFamily:m}=f,g=i.split(//gi);for(let y=0;y{vp[C]={color:zh.actorColours[g%zh.actorColours.length],position:g},g++}),rQe(f),t1=zh.leftMargin+MO,Yu.insert(0,0,t1,Object.keys(vp).length*50),lJt(f,d,0,t);let y=Yu.getBounds();p&&f.append("text").text(p).attr("x",t1).attr("font-size",s).attr("font-weight","bold").attr("y",25).attr("fill",a).attr("font-family",o);let v=y.stopy-y.starty+2*zh.diagramMarginY,x=t1+y.stopx+2*zh.diagramMarginX;vn(f,v,x,zh.useMaxWidth),f.append("line").attr("x1",t1).attr("y1",zh.height*4).attr("x2",x-t1-4).attr("y2",zh.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#"+t+"-arrowhead)");let w=p?70:0;f.attr("viewBox",`${y.startx} -25 ${x} ${v+w}`),f.attr("preserveAspectRatio","xMinYMin meet"),f.attr("height",v+w+25)},"draw"),Yu={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:b(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:b(function(e,t,r,n){e[t]===void 0?e[t]=r:e[t]=n(r,e[t])},"updateVal"),updateBounds:b(function(e,t,r,n){let i=Be().journey,a=this,s=0;function o(l){return b(function(h){s++;let f=a.sequenceItems.length-s+1;a.updateVal(h,"starty",t-f*i.boxMargin,Math.min),a.updateVal(h,"stopy",n+f*i.boxMargin,Math.max),a.updateVal(Yu.data,"startx",e-f*i.boxMargin,Math.min),a.updateVal(Yu.data,"stopx",r+f*i.boxMargin,Math.max),l!=="activation"&&(a.updateVal(h,"startx",e-f*i.boxMargin,Math.min),a.updateVal(h,"stopx",r+f*i.boxMargin,Math.max),a.updateVal(Yu.data,"starty",t-f*i.boxMargin,Math.min),a.updateVal(Yu.data,"stopy",n+f*i.boxMargin,Math.max))},"updateItemBounds")}b(o,"updateFn"),this.sequenceItems.forEach(o())},"updateBounds"),insert:b(function(e,t,r,n){let i=Math.min(e,r),a=Math.max(e,r),s=Math.min(t,n),o=Math.max(t,n);this.updateVal(Yu.data,"startx",i,Math.min),this.updateVal(Yu.data,"starty",s,Math.min),this.updateVal(Yu.data,"stopx",a,Math.max),this.updateVal(Yu.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},"insert"),bumpVerticalPos:b(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:b(function(){return this.verticalPos},"getVerticalPos"),getBounds:b(function(){return this.data},"getBounds")},vae=zh.sectionFills,ZZe=zh.sectionColours,lJt=b(function(e,t,r,n){let i=Be().journey,a="",s=i.height*2+i.diagramMarginY,o=r+s,l=0,u="#CCC",h="black",f=0;for(let[d,p]of t.entries()){if(a!==p.section){u=vae[l%vae.length],f=l%vae.length,h=ZZe[l%ZZe.length];let g=0,y=p.section;for(let x=d;x(vp[y]&&(g[y]=vp[y]),g),{});p.x=d*i.taskMargin+d*i.width+t1,p.y=o,p.width=i.diagramMarginX,p.height=i.diagramMarginY,p.colour=h,p.fill=u,p.num=f,p.actors=m,z6.drawTask(e,p,i,n),Yu.insert(p.x,p.y,p.x+p.width+i.taskMargin,450)}},"drawTasks"),QZe={setConf:sJt,draw:oJt},cJt={parser:VQt,db:KZe,renderer:QZe,styles:JQt,init:b(e=>{QZe.setConf(e.journey),KZe.clear()},"init")}});var _Qe={};Tr(_Qe,{diagram:()=>BJt});function _ae(e,t){e.each(function(){var r=ct(this),n=r.text().split(/(\s+|
)/).reverse(),i,a=[],s=1.1,o=r.attr("y"),l=parseFloat(r.attr("dy")),u=r.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",l+"em");for(let h=0;ht||i==="
")&&(a.pop(),u.text(a.join(" ").trim()),i==="
"?a=[""]:a=[i],u=r.append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em").text(i))})}var Tae,uJt,uQe,pk,hQe,Sae,Eae,NO,mk,fQe,dQe,pQe,mQe,gQe,yQe,vQe,xQe,bQe,wQe,aQe,hJt,kQe,DO,fJt,dJt,TQe,pJt,mJt,Cae,gJt,yJt,vJt,Aae,CQe,xJt,bJt,wJt,kJt,yc,TJt,sQe,CJt,SJt,OO,xp,EJt,Rae,AJt,SQe,_Jt,oQe,EQe,lQe,AQe,RJt,cQe,LJt,IJt,MJt,NJt,DJt,OJt,PJt,BJt,RQe=W(()=>{za();Sn();_r();Rr();hr();fn();fn();Ka();Tae=(function(){var e=b(function(d,p,m,g){for(m=m||{},g=d.length;g--;m[d[g]]=p);return m},"o"),t=[6,11,13,14,15,17,19,20,23,24],r=[1,12],n=[1,13],i=[1,14],a=[1,15],s=[1,16],o=[1,19],l=[1,20],u={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:b(function(p,m,g,y,v,x,w){var C=x.length-1;switch(v){case 1:return x[C-1];case 3:y.setDirection("LR");break;case 4:y.setDirection("TD");break;case 5:this.$=[];break;case 6:x[C-1].push(x[C]),this.$=x[C-1];break;case 7:case 8:this.$=x[C];break;case 9:case 10:this.$=[];break;case 11:y.getCommonDb().setDiagramTitle(x[C].substr(6)),this.$=x[C].substr(6);break;case 12:this.$=x[C].trim(),y.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=x[C].trim(),y.getCommonDb().setAccDescription(this.$);break;case 15:y.addSection(x[C].substr(8)),this.$=x[C].substr(8);break;case 18:y.addTask(x[C],0,""),this.$=x[C];break;case 19:y.addEvent(x[C].substr(2)),this.$=x[C];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:r,15:n,17:i,19:a,20:s,21:17,22:18,23:o,24:l},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:r,15:n,17:i,19:a,20:s,21:17,22:18,23:o,24:l},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:b(function(p,m){if(m.recoverable)this.trace(p);else{var g=new Error(p);throw g.hash=m,g}},"parseError"),parse:b(function(p){var m=this,g=[0],y=[],v=[null],x=[],w=this.table,C="",T=0,k=0,S=0,E=2,I=1,L=x.slice.call(arguments,1),O=Object.create(this.lexer),R={yy:{}};for(var A in this.yy)Object.prototype.hasOwnProperty.call(this.yy,A)&&(R.yy[A]=this.yy[A]);O.setInput(p,R.yy),R.yy.lexer=O,R.yy.parser=this,typeof O.yylloc>"u"&&(O.yylloc={});var N=O.yylloc;x.push(N);var M=O.options&&O.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function D(ue){g.length=g.length-2*ue,v.length=v.length-ue,x.length=x.length-ue}b(D,"popStack");function B(){var ue;return ue=y.pop()||O.lex()||I,typeof ue!="number"&&(ue instanceof Array&&(y=ue,ue=y.pop()),ue=m.symbols_[ue]||ue),ue}b(B,"lex");for(var P,$,F,q,G,z,H={},j,J,U,le;;){if(F=g[g.length-1],this.defaultActions[F]?q=this.defaultActions[F]:((P===null||typeof P>"u")&&(P=B()),q=w[F]&&w[F][P]),typeof q>"u"||!q.length||!q[0]){var ee="";le=[];for(j in w[F])this.terminals_[j]&&j>E&&le.push("'"+this.terminals_[j]+"'");O.showPosition?ee="Parse error on line "+(T+1)+`: `+O.showPosition()+` Expecting `+le.join(", ")+", got '"+(this.terminals_[P]||P)+"'":ee="Parse error on line "+(T+1)+": Unexpected "+(P==I?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(ee,{text:O.match,token:this.terminals_[P]||P,line:O.yylineno,loc:N,expected:le})}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+F+", token: "+P);switch(q[0]){case 1:g.push(P),v.push(O.yytext),x.push(O.yylloc),g.push(q[1]),P=null,$?(P=$,$=null):(k=O.yyleng,C=O.yytext,T=O.yylineno,N=O.yylloc,S>0&&S--);break;case 2:if(J=this.productions_[q[1]][1],H.$=v[v.length-J],H._$={first_line:x[x.length-(J||1)].first_line,last_line:x[x.length-1].last_line,first_column:x[x.length-(J||1)].first_column,last_column:x[x.length-1].last_column},M&&(H._$.range=[x[x.length-(J||1)].range[0],x[x.length-1].range[1]]),z=this.performAction.apply(H,[C,k,T,R.yy,q[1],v,x].concat(L)),typeof z<"u")return z;J&&(g=g.slice(0,-1*J*2),v=v.slice(0,-1*J),x=x.slice(0,-1*J)),g.push(this.productions_[q[1]][0]),v.push(H.$),x.push(H._$),U=w[g[g.length-2]][g[g.length-1]],g.push(U);break;case 3:return!0}}return!0},"parse")},h=(function(){var d={EOF:1,parseError:b(function(m,g){if(this.yy.parser)this.yy.parser.parseError(m,g);else throw new Error(m)},"parseError"),setInput:b(function(p,m){return this.yy=m||this.yy||{},this._input=p,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var p=this._input[0];this.yytext+=p,this.yyleng++,this.offset++,this.match+=p,this.matched+=p;var m=p.match(/(?:\r\n?|\n).*/g);return m?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),p},"input"),unput:b(function(p){var m=p.length,g=p.split(/(?:\r\n?|\n)/g);this._input=p+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-m),this.offset-=m;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var v=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===y.length?this.yylloc.first_column:0)+y[y.length-g.length].length-g[0].length:this.yylloc.first_column-m},this.options.ranges&&(this.yylloc.range=[v[0],v[0]+this.yyleng-m]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(p){this.unput(this.match.slice(p))},"less"),pastInput:b(function(){var p=this.matched.substr(0,this.matched.length-this.match.length);return(p.length>20?"...":"")+p.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var p=this.match;return p.length<20&&(p+=this._input.substr(0,20-p.length)),(p.substr(0,20)+(p.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var p=this.pastInput(),m=new Array(p.length+1).join("-");return p+this.upcomingInput()+` `+m+"^"},"showPosition"),test_match:b(function(p,m){var g,y,v;if(this.options.backtrack_lexer&&(v={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(v.yylloc.range=this.yylloc.range.slice(0))),y=p[0].match(/(?:\r\n?|\n).*/g),y&&(this.yylineno+=y.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:y?y[y.length-1].length-y[y.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+p[0].length},this.yytext+=p[0],this.match+=p[0],this.matches=p,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(p[0].length),this.matched+=p[0],g=this.performAction.call(this,this.yy,this,m,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g)return g;if(this._backtrack){for(var x in v)this[x]=v[x];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var p,m,g,y;this._more||(this.yytext="",this.match="");for(var v=this._currentRules(),x=0;xm[0].length)){if(m=g,y=x,this.options.backtrack_lexer){if(p=this.test_match(g,v[x]),p!==!1)return p;if(this._backtrack){m=!1;continue}else return!1}else if(!this.options.flex)break}return m?(p=this.test_match(m,v[y]),p!==!1?p:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var m=this.next();return m||this.lex()},"lex"),begin:b(function(m){this.conditionStack.push(m)},"begin"),popState:b(function(){var m=this.conditionStack.length-1;return m>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:b(function(m){this.begin(m)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(m,g,y,v){var x=v;switch(y){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;break;case 10:return this.popState(),"acc_title_value";break;case 11:return this.begin("acc_descr"),17;break;case 12:return this.popState(),"acc_descr_value";break;case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return d})();u.lexer=h;function f(){this.yy={}}return b(f,"Parser"),f.prototype=u,u.Parser=f,new f})();wae.parser=wae;sJt=wae,lQe={};wm(lQe,{addEvent:()=>vQe,addSection:()=>pQe,addTask:()=>yQe,addTaskOrg:()=>xQe,clear:()=>hQe,default:()=>oJt,getCommonDb:()=>uQe,getDirection:()=>dQe,getSections:()=>mQe,getTasks:()=>gQe,setDirection:()=>fQe});pk="",cQe=0,Tae="LR",Cae=[],NO=[],mk=[],uQe=b(()=>o9,"getCommonDb"),hQe=b(function(){Cae.length=0,NO.length=0,pk="",mk.length=0,Tae="LR",Nr()},"clear"),fQe=b(function(e){Tae=e},"setDirection"),dQe=b(function(){return Tae},"getDirection"),pQe=b(function(e){pk=e,Cae.push(e)},"addSection"),mQe=b(function(){return Cae},"getSections"),gQe=b(function(){let e=nQe(),t=100,r=0;for(;!e&&rr.id===cQe-1).events.push(e)},"addEvent"),xQe=b(function(e){let t={section:pk,type:pk,description:e,task:e,classes:[]};NO.push(t)},"addTaskOrg"),nQe=b(function(){let e=b(function(r){return mk[r].processed},"compileTask"),t=!0;for(let[r,n]of mk.entries())e(r),t=t&&n.processed;return t},"compileTasks"),oJt={clear:hQe,getCommonDb:uQe,getDirection:dQe,setDirection:fQe,addSection:pQe,getSections:mQe,getTasks:gQe,addTask:yQe,addTaskOrg:xQe,addEvent:vQe},bQe=0,DO=b(function(e,t){let r=e.append("rect");return r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),r.attr("rx",t.rx),r.attr("ry",t.ry),t.class!==void 0&&r.attr("class",t.class),r},"drawRect"),lJt=b(function(e,t){let n=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=e.append("g");i.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(l){let u=Pf().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}b(a,"smile");function s(l){let u=Pf().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}b(s,"sad");function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return b(o,"ambivalent"),t.score>3?a(i):t.score<3?s(i):o(i),n},"drawFace"),cJt=b(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),wQe=b(function(e,t){let r=t.text.replace(//gi," "),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.attr("class","legend"),n.style("text-anchor",t.anchor),t.class!==void 0&&n.attr("class",t.class);let i=n.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(r),n},"drawText"),uJt=b(function(e,t){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}b(r,"genPoints");let n=e.append("polygon");n.attr("points",r(t.x,t.y,50,20,7)),n.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,wQe(e,t)},"drawLabel"),hJt=b(function(e,t,r){let n=e.append("g"),i=Sae();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=r.width,i.height=r.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,DO(n,i),kQe(r)(t.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),kae=-1,fJt=b(function(e,t,r,n){let i=t.x+r.width/2,a=e.append("g");kae++,a.append("line").attr("id",n+"-task"+kae).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),lJt(a,{cx:i,cy:300+(5-t.score)*30,score:t.score});let o=Sae();o.x=t.x,o.y=t.y,o.fill=t.fill,o.width=r.width,o.height=r.height,o.class="task task-type-"+t.num,o.rx=3,o.ry=3,DO(a,o),kQe(r)(t.task,a,o.x,o.y,o.width,o.height,{class:"task"},r,t.colour)},"drawTask"),dJt=b(function(e,t){DO(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),pJt=b(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),Sae=b(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),kQe=(function(){function e(i,a,s,o,l,u,h,f){let d=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(d,h)}b(e,"byText");function t(i,a,s,o,l,u,h,f,d){let{taskFontSize:p,taskFontFamily:m}=f,g=i.split(//gi);for(let y=0;y0?`M0 ${t.height-o} v${-t.height+2*o} q0,-${s},${s},-${s} h${t.width-2*o} q${s},0,${s},${s} v${t.height-o} H0 Z`:`M0 ${t.height-o} v${-(t.height-o)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",n+"-node-"+bQe++).attr("class","node-bkg node-"+t.type).attr("d",l),a?.includes("redux")||e.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),gc={drawRect:DO,drawCircle:cJt,drawSection:hJt,drawText:wQe,drawLabel:uJt,drawTask:fJt,drawBackgroundRect:dJt,getTextObj:pJt,getNoteRect:Sae,initGraphics:mJt,drawNode:gJt,getVirtualNodeHeight:yJt},xJt=b(function(e,t,r,n){let i=Be(),{look:a,theme:s,themeVariables:o}=i,{useGradient:l,gradientStart:u,gradientStop:h}=o,f=i.timeline?.leftMargin??50;se.debug("timeline",n.db);let d=i.securityLevel,p;d==="sandbox"&&(p=ct("#i"+t));let g=(d==="sandbox"?ct(p.nodes()[0].contentDocument.body):ct("body")).select("#"+t);g.append("g");let y=n.db.getTasks(),v=n.db.getCommonDb().getDiagramTitle();se.debug("task",y),gc.initGraphics(g,t);let x=n.db.getSections();se.debug("sections",x);let w=0,C=0,T=0,k=0,S=50+f,E=50;k=50;let I=0,L=!0;x.forEach(function(M){let D={number:I,descr:M,section:I,width:150,padding:20,maxHeight:w},B=gc.getVirtualNodeHeight(g,D,i);se.debug("sectionHeight before draw",B),w=Math.max(w,B+20)});let O=0,R=0;se.debug("tasks.length",y.length);for(let[M,D]of y.entries()){let B={number:M,descr:D,section:D.section,width:150,padding:20,maxHeight:C},P=gc.getVirtualNodeHeight(g,B,i);se.debug("taskHeight before draw",P),C=Math.max(C,P+20),O=Math.max(O,D.events.length);let $=0;for(let F of D.events){let q={descr:F,section:D.section,number:D.section,width:150,padding:20,maxHeight:50};$+=gc.getVirtualNodeHeight(g,q,i)}D.events.length>0&&($+=(D.events.length-1)*10),R=Math.max(R,$)}se.debug("maxSectionHeight before draw",w),se.debug("maxTaskHeight before draw",C),x&&x.length>0?x.forEach(M=>{let D=y.filter(F=>F.section===M),B={number:I,descr:M,section:I,width:200*Math.max(D.length,1)-50,padding:20,maxHeight:w};se.debug("sectionNode",B);let P=g.append("g"),$=gc.drawNode(P,B,I,i,t);se.debug("sectionNode output",$),P.attr("transform",`translate(${S}, ${k})`),E+=w+50,D.length>0&&iQe(g,D,I,S,E,C,i,O,R,w,!1,t),S+=200*Math.max(D.length,1),E=k,I++}):(L=!1,iQe(g,y,I,S,E,C,i,O,R,w,!0,t));let A=g.node().getBBox();if(se.debug("bounds",A),v&&g.append("text").text(v).attr("x",a==="neo"?A.x*2+f:A.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),T=L?w+C+150:C+100,g.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",T).attr("x2",A.width+3*f).attr("y2",T).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),a==="neo"&&l&&s!=="neutral"){let M=g.select("defs"),B=(M.empty()?g.append("defs"):M).append("linearGradient").attr("id",g.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");B.append("stop").attr("offset","0%").attr("stop-color",u).attr("stop-opacity",1),B.append("stop").attr("offset","100%").attr("stop-color",h).attr("stop-opacity",1)}_f(void 0,g,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),iQe=b(function(e,t,r,n,i,a,s,o,l,u,h,f){for(let d of t){let p={descr:d.task,section:r,number:r,width:150,padding:20,maxHeight:a};se.debug("taskNode",p);let m=e.append("g").attr("class","taskWrapper"),y=gc.drawNode(m,p,r,s,f).height;if(se.debug("taskHeight after draw",y),m.attr("transform",`translate(${n}, ${i})`),a=Math.max(a,y),d.events){let v=e.append("g").attr("class","lineWrapper"),x=a;i+=100,x=x+bJt(e,d.events,r,n,i,s,f),i-=100,v.append("line").attr("x1",n+190/2).attr("y1",i+a).attr("x2",n+190/2).attr("y2",i+a+100+l+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}n=n+200,h&&!s.timeline?.disableMulticolor&&r++}i=i-10},"drawTasks"),bJt=b(function(e,t,r,n,i,a,s){let o=0,l=i;i=i+100;for(let u of t){let h={descr:u,section:r,number:r,width:150,padding:20,maxHeight:50};se.debug("eventNode",h);let f=e.append("g").attr("class","eventWrapper"),p=gc.drawNode(f,h,r,a,s,!0).height;o=o+p,f.attr("transform",`translate(${n}, ${i})`),i=i+10+p}return i=l,o},"drawEvents"),wJt={setConf:b(()=>{},"setConf"),draw:xJt},OO=200,xp=5,kJt=OO+xp*2,Aae=OO+100,TJt=Aae+xp*2,TQe=10,CJt=0,aQe=20,CQe=20,sQe=30,SQe=50,SJt=b(function(e,t,r,n){let i=Be(),a=i.timeline?.leftMargin??50;se.debug("timeline",n.db);let s=Qn(t);s.append("g");let o=n.db.getTasks(),l=n.db.getCommonDb().getDiagramTitle();se.debug("task",o),gc.initGraphics(s);let u=n.db.getSections();se.debug("sections",u);let h=0,f=0,d=50+a,p=50,m=p,g=d,y=kJt+CQe,v=TJt+SQe,x=g+y,w=0,C=u&&u.length>0,T=C?x:d+y,k=Math.max(50,y+v-xp*2);u.forEach(function(M){let D={number:w,descr:M,section:w,width:k,padding:xp,maxHeight:h},B=gc.getVirtualNodeHeight(s,D,i);se.debug("sectionHeight before draw",B),h=Math.max(h,B)});let S=0;se.debug("tasks.length",o.length);for(let[M,D]of o.entries()){let B={number:M,descr:D,section:D.section,width:OO,padding:xp,maxHeight:f},P=gc.getVirtualNodeHeight(s,B,i);se.debug("taskHeight before draw",P),f=Math.max(f,P);let $=0;for(let F of D.events){let q={descr:F,section:D.section,number:D.section,width:Aae,padding:xp,maxHeight:50};$+=gc.getVirtualNodeHeight(s,q,i)}D.events.length>0&&($+=(D.events.length-1)*TQe),S=Math.max(S,$)+CJt}se.debug("maxSectionHeight before draw",h),se.debug("maxTaskHeight before draw",f);let I=Math.max(f,S)+sQe;C?u.forEach(M=>{let D=o.filter(H=>H.section===M),B={number:w,descr:M,section:w,width:k,padding:xp,maxHeight:h};se.debug("sectionNode",B);let P=s.append("g"),$=gc.drawNode(P,B,w,i);se.debug("sectionNode output",$);let F=T-y;P.attr("transform",`translate(${F}, ${p})`);let q=p+$.height+aQe;D.length>0&&oQe(s,D,w,T,q,f,i,I,!1);let G=D.length,z=$.height+aQe+I*Math.max(G,1)-(G>0?sQe*2:0);p+=z,w++}):oQe(s,o,w,T,p,f,i,I,!0);let L=s.node()?.getBBox();if(!L)throw new Error("bbox not found");if(se.debug("bounds",L),l){if(s.append("text").text(l).attr("x",L.width/2-a).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),L=s.node()?.getBBox(),!L)throw new Error("bbox not found");se.debug("bounds after title",L)}let[O]=Zl(i.fontSize),R=(O??16)*2,A=(O??16)*.5+20,N=s.append("g").attr("class","lineWrapper");N.append("line").attr("x1",T).attr("y1",m-R).attr("x2",T).attr("y2",L.y+L.height+A).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),N.lower(),_f(void 0,s,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),oQe=b(function(e,t,r,n,i,a,s,o,l){for(let u of t){let h={descr:u.task,section:r,number:r,width:OO,padding:xp,maxHeight:a};se.debug("taskNode",h);let f=e.append("g").attr("class","taskWrapper"),d=gc.drawNode(f,h,r,s),p=d.height;se.debug("taskHeight after draw",p);let m=n-CQe-d.width;if(f.attr("transform",`translate(${m}, ${i})`),a=Math.max(a,p),u.events&&u.events.length>0){let g=i,y=n+SQe;EJt(e,u.events,r,n,y,g,s)}i=i+o,l&&!s.timeline?.disableMulticolor&&r++}},"drawTasks"),EJt=b(function(e,t,r,n,i,a,s){let o=a;for(let l of t){let u={descr:l,section:r,number:r,width:Aae,padding:xp,maxHeight:0};se.debug("eventNode",u);let h=e.append("g").attr("class","eventWrapper"),d=gc.drawNode(h,u,r,s).height;h.attr("transform",`translate(${i}, ${o})`);let p=e.append("g").attr("class","lineWrapper"),m=o+d/2;p.append("line").attr("x1",n).attr("y1",m).attr("x2",i).attr("y2",m).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),o=o+d+TQe}return o-a},"drawEvents"),AJt={setConf:b(()=>{},"setConf"),draw:SJt},_Jt=b(e=>{let{theme:t}=qt(),r=t?.includes("dark"),n=t?.includes("color"),i=e.svgId?.replace(/^#/,"")??"",a=i?`url(#${i}-drop-shadow)`:e.dropShadow??"none",s="";for(let o=0;o0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:b(function(m){this.begin(m)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(m,g,y,v){var x=v;switch(y){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;break;case 10:return this.popState(),"acc_title_value";break;case 11:return this.begin("acc_descr"),17;break;case 12:return this.popState(),"acc_descr_value";break;case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return d})();u.lexer=h;function f(){this.yy={}}return b(f,"Parser"),f.prototype=u,u.Parser=f,new f})();Tae.parser=Tae;uJt=Tae,uQe={};wm(uQe,{addEvent:()=>bQe,addSection:()=>gQe,addTask:()=>xQe,addTaskOrg:()=>wQe,clear:()=>dQe,default:()=>hJt,getCommonDb:()=>fQe,getDirection:()=>mQe,getSections:()=>yQe,getTasks:()=>vQe,setDirection:()=>pQe});pk="",hQe=0,Sae="LR",Eae=[],NO=[],mk=[],fQe=b(()=>o9,"getCommonDb"),dQe=b(function(){Eae.length=0,NO.length=0,pk="",mk.length=0,Sae="LR",Nr()},"clear"),pQe=b(function(e){Sae=e},"setDirection"),mQe=b(function(){return Sae},"getDirection"),gQe=b(function(e){pk=e,Eae.push(e)},"addSection"),yQe=b(function(){return Eae},"getSections"),vQe=b(function(){let e=aQe(),t=100,r=0;for(;!e&&rr.id===hQe-1).events.push(e)},"addEvent"),wQe=b(function(e){let t={section:pk,type:pk,description:e,task:e,classes:[]};NO.push(t)},"addTaskOrg"),aQe=b(function(){let e=b(function(r){return mk[r].processed},"compileTask"),t=!0;for(let[r,n]of mk.entries())e(r),t=t&&n.processed;return t},"compileTasks"),hJt={clear:dQe,getCommonDb:fQe,getDirection:mQe,setDirection:pQe,addSection:gQe,getSections:yQe,getTasks:vQe,addTask:xQe,addTaskOrg:wQe,addEvent:bQe},kQe=0,DO=b(function(e,t){let r=e.append("rect");return r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),r.attr("rx",t.rx),r.attr("ry",t.ry),t.class!==void 0&&r.attr("class",t.class),r},"drawRect"),fJt=b(function(e,t){let n=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=e.append("g");i.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(l){let u=Pf().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}b(a,"smile");function s(l){let u=Pf().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}b(s,"sad");function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return b(o,"ambivalent"),t.score>3?a(i):t.score<3?s(i):o(i),n},"drawFace"),dJt=b(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),TQe=b(function(e,t){let r=t.text.replace(//gi," "),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.attr("class","legend"),n.style("text-anchor",t.anchor),t.class!==void 0&&n.attr("class",t.class);let i=n.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(r),n},"drawText"),pJt=b(function(e,t){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}b(r,"genPoints");let n=e.append("polygon");n.attr("points",r(t.x,t.y,50,20,7)),n.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,TQe(e,t)},"drawLabel"),mJt=b(function(e,t,r){let n=e.append("g"),i=Aae();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=r.width,i.height=r.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,DO(n,i),CQe(r)(t.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),Cae=-1,gJt=b(function(e,t,r,n){let i=t.x+r.width/2,a=e.append("g");Cae++,a.append("line").attr("id",n+"-task"+Cae).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),fJt(a,{cx:i,cy:300+(5-t.score)*30,score:t.score});let o=Aae();o.x=t.x,o.y=t.y,o.fill=t.fill,o.width=r.width,o.height=r.height,o.class="task task-type-"+t.num,o.rx=3,o.ry=3,DO(a,o),CQe(r)(t.task,a,o.x,o.y,o.width,o.height,{class:"task"},r,t.colour)},"drawTask"),yJt=b(function(e,t){DO(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),vJt=b(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),Aae=b(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),CQe=(function(){function e(i,a,s,o,l,u,h,f){let d=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(d,h)}b(e,"byText");function t(i,a,s,o,l,u,h,f,d){let{taskFontSize:p,taskFontFamily:m}=f,g=i.split(//gi);for(let y=0;y0?`M0 ${t.height-o} v${-t.height+2*o} q0,-${s},${s},-${s} h${t.width-2*o} q${s},0,${s},${s} v${t.height-o} H0 Z`:`M0 ${t.height-o} v${-(t.height-o)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",n+"-node-"+kQe++).attr("class","node-bkg node-"+t.type).attr("d",l),a?.includes("redux")||e.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),yc={drawRect:DO,drawCircle:dJt,drawSection:mJt,drawText:TQe,drawLabel:pJt,drawTask:gJt,drawBackgroundRect:yJt,getTextObj:vJt,getNoteRect:Aae,initGraphics:xJt,drawNode:bJt,getVirtualNodeHeight:wJt},TJt=b(function(e,t,r,n){let i=Be(),{look:a,theme:s,themeVariables:o}=i,{useGradient:l,gradientStart:u,gradientStop:h}=o,f=i.timeline?.leftMargin??50;se.debug("timeline",n.db);let d=i.securityLevel,p;d==="sandbox"&&(p=ct("#i"+t));let g=(d==="sandbox"?ct(p.nodes()[0].contentDocument.body):ct("body")).select("#"+t);g.append("g");let y=n.db.getTasks(),v=n.db.getCommonDb().getDiagramTitle();se.debug("task",y),yc.initGraphics(g,t);let x=n.db.getSections();se.debug("sections",x);let w=0,C=0,T=0,k=0,S=50+f,E=50;k=50;let I=0,L=!0;x.forEach(function(M){let D={number:I,descr:M,section:I,width:150,padding:20,maxHeight:w},B=yc.getVirtualNodeHeight(g,D,i);se.debug("sectionHeight before draw",B),w=Math.max(w,B+20)});let O=0,R=0;se.debug("tasks.length",y.length);for(let[M,D]of y.entries()){let B={number:M,descr:D,section:D.section,width:150,padding:20,maxHeight:C},P=yc.getVirtualNodeHeight(g,B,i);se.debug("taskHeight before draw",P),C=Math.max(C,P+20),O=Math.max(O,D.events.length);let $=0;for(let F of D.events){let q={descr:F,section:D.section,number:D.section,width:150,padding:20,maxHeight:50};$+=yc.getVirtualNodeHeight(g,q,i)}D.events.length>0&&($+=(D.events.length-1)*10),R=Math.max(R,$)}se.debug("maxSectionHeight before draw",w),se.debug("maxTaskHeight before draw",C),x&&x.length>0?x.forEach(M=>{let D=y.filter(F=>F.section===M),B={number:I,descr:M,section:I,width:200*Math.max(D.length,1)-50,padding:20,maxHeight:w};se.debug("sectionNode",B);let P=g.append("g"),$=yc.drawNode(P,B,I,i,t);se.debug("sectionNode output",$),P.attr("transform",`translate(${S}, ${k})`),E+=w+50,D.length>0&&sQe(g,D,I,S,E,C,i,O,R,w,!1,t),S+=200*Math.max(D.length,1),E=k,I++}):(L=!1,sQe(g,y,I,S,E,C,i,O,R,w,!0,t));let A=g.node().getBBox();if(se.debug("bounds",A),v&&g.append("text").text(v).attr("x",a==="neo"?A.x*2+f:A.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),T=L?w+C+150:C+100,g.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",T).attr("x2",A.width+3*f).attr("y2",T).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),a==="neo"&&l&&s!=="neutral"){let M=g.select("defs"),B=(M.empty()?g.append("defs"):M).append("linearGradient").attr("id",g.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");B.append("stop").attr("offset","0%").attr("stop-color",u).attr("stop-opacity",1),B.append("stop").attr("offset","100%").attr("stop-color",h).attr("stop-opacity",1)}_f(void 0,g,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),sQe=b(function(e,t,r,n,i,a,s,o,l,u,h,f){for(let d of t){let p={descr:d.task,section:r,number:r,width:150,padding:20,maxHeight:a};se.debug("taskNode",p);let m=e.append("g").attr("class","taskWrapper"),y=yc.drawNode(m,p,r,s,f).height;if(se.debug("taskHeight after draw",y),m.attr("transform",`translate(${n}, ${i})`),a=Math.max(a,y),d.events){let v=e.append("g").attr("class","lineWrapper"),x=a;i+=100,x=x+CJt(e,d.events,r,n,i,s,f),i-=100,v.append("line").attr("x1",n+190/2).attr("y1",i+a).attr("x2",n+190/2).attr("y2",i+a+100+l+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}n=n+200,h&&!s.timeline?.disableMulticolor&&r++}i=i-10},"drawTasks"),CJt=b(function(e,t,r,n,i,a,s){let o=0,l=i;i=i+100;for(let u of t){let h={descr:u,section:r,number:r,width:150,padding:20,maxHeight:50};se.debug("eventNode",h);let f=e.append("g").attr("class","eventWrapper"),p=yc.drawNode(f,h,r,a,s,!0).height;o=o+p,f.attr("transform",`translate(${n}, ${i})`),i=i+10+p}return i=l,o},"drawEvents"),SJt={setConf:b(()=>{},"setConf"),draw:TJt},OO=200,xp=5,EJt=OO+xp*2,Rae=OO+100,AJt=Rae+xp*2,SQe=10,_Jt=0,oQe=20,EQe=20,lQe=30,AQe=50,RJt=b(function(e,t,r,n){let i=Be(),a=i.timeline?.leftMargin??50;se.debug("timeline",n.db);let s=Qn(t);s.append("g");let o=n.db.getTasks(),l=n.db.getCommonDb().getDiagramTitle();se.debug("task",o),yc.initGraphics(s);let u=n.db.getSections();se.debug("sections",u);let h=0,f=0,d=50+a,p=50,m=p,g=d,y=EJt+EQe,v=AJt+AQe,x=g+y,w=0,C=u&&u.length>0,T=C?x:d+y,k=Math.max(50,y+v-xp*2);u.forEach(function(M){let D={number:w,descr:M,section:w,width:k,padding:xp,maxHeight:h},B=yc.getVirtualNodeHeight(s,D,i);se.debug("sectionHeight before draw",B),h=Math.max(h,B)});let S=0;se.debug("tasks.length",o.length);for(let[M,D]of o.entries()){let B={number:M,descr:D,section:D.section,width:OO,padding:xp,maxHeight:f},P=yc.getVirtualNodeHeight(s,B,i);se.debug("taskHeight before draw",P),f=Math.max(f,P);let $=0;for(let F of D.events){let q={descr:F,section:D.section,number:D.section,width:Rae,padding:xp,maxHeight:50};$+=yc.getVirtualNodeHeight(s,q,i)}D.events.length>0&&($+=(D.events.length-1)*SQe),S=Math.max(S,$)+_Jt}se.debug("maxSectionHeight before draw",h),se.debug("maxTaskHeight before draw",f);let I=Math.max(f,S)+lQe;C?u.forEach(M=>{let D=o.filter(H=>H.section===M),B={number:w,descr:M,section:w,width:k,padding:xp,maxHeight:h};se.debug("sectionNode",B);let P=s.append("g"),$=yc.drawNode(P,B,w,i);se.debug("sectionNode output",$);let F=T-y;P.attr("transform",`translate(${F}, ${p})`);let q=p+$.height+oQe;D.length>0&&cQe(s,D,w,T,q,f,i,I,!1);let G=D.length,z=$.height+oQe+I*Math.max(G,1)-(G>0?lQe*2:0);p+=z,w++}):cQe(s,o,w,T,p,f,i,I,!0);let L=s.node()?.getBBox();if(!L)throw new Error("bbox not found");if(se.debug("bounds",L),l){if(s.append("text").text(l).attr("x",L.width/2-a).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),L=s.node()?.getBBox(),!L)throw new Error("bbox not found");se.debug("bounds after title",L)}let[O]=Ql(i.fontSize),R=(O??16)*2,A=(O??16)*.5+20,N=s.append("g").attr("class","lineWrapper");N.append("line").attr("x1",T).attr("y1",m-R).attr("x2",T).attr("y2",L.y+L.height+A).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),N.lower(),_f(void 0,s,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),cQe=b(function(e,t,r,n,i,a,s,o,l){for(let u of t){let h={descr:u.task,section:r,number:r,width:OO,padding:xp,maxHeight:a};se.debug("taskNode",h);let f=e.append("g").attr("class","taskWrapper"),d=yc.drawNode(f,h,r,s),p=d.height;se.debug("taskHeight after draw",p);let m=n-EQe-d.width;if(f.attr("transform",`translate(${m}, ${i})`),a=Math.max(a,p),u.events&&u.events.length>0){let g=i,y=n+AQe;LJt(e,u.events,r,n,y,g,s)}i=i+o,l&&!s.timeline?.disableMulticolor&&r++}},"drawTasks"),LJt=b(function(e,t,r,n,i,a,s){let o=a;for(let l of t){let u={descr:l,section:r,number:r,width:Rae,padding:xp,maxHeight:0};se.debug("eventNode",u);let h=e.append("g").attr("class","eventWrapper"),d=yc.drawNode(h,u,r,s).height;h.attr("transform",`translate(${i}, ${o})`);let p=e.append("g").attr("class","lineWrapper"),m=o+d/2;p.append("line").attr("x1",n).attr("y1",m).attr("x2",i).attr("y2",m).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),o=o+d+SQe}return o-a},"drawEvents"),IJt={setConf:b(()=>{},"setConf"),draw:RJt},MJt=b(e=>{let{theme:t}=qt(),r=t?.includes("dark"),n=t?.includes("color"),i=e.svgId?.replace(/^#/,"")??"",a=i?`url(#${i}-drop-shadow)`:e.dropShadow??"none",s="";for(let o=0;o{let t="";for(let r=0;r{let t="";for(let r=0;r{let{theme:t}=qt(),r=t?.includes("redux"),n=t==="neutral",i=e.svgId?.replace(/^#/,"")??"",a="";if(e.useGradient&&i&&e.THEME_COLOR_LIMIT&&!n)for(let s=0;s{let{theme:t}=qt(),r=t?.includes("redux"),n=t==="neutral",i=e.svgId?.replace(/^#/,"")??"",a="";if(e.useGradient&&i&&e.THEME_COLOR_LIMIT&&!n)for(let s=0;s{},"setConf"),draw:b((e,t,r,n)=>(n?.db?.getDirection?.()??"LR")==="TD"?AJt.draw(e,t,r,n):wJt.draw(e,t,r,n),"draw")},NJt={db:lQe,renderer:MJt,parser:sJt,styles:IJt}});function _Qe(e,t=0){return(Eo[e[t+0]]+Eo[e[t+1]]+Eo[e[t+2]]+Eo[e[t+3]]+"-"+Eo[e[t+4]]+Eo[e[t+5]]+"-"+Eo[e[t+6]]+Eo[e[t+7]]+"-"+Eo[e[t+8]]+Eo[e[t+9]]+"-"+Eo[e[t+10]]+Eo[e[t+11]]+Eo[e[t+12]]+Eo[e[t+13]]+Eo[e[t+14]]+Eo[e[t+15]]).toLowerCase()}var Eo,RQe=W(()=>{Eo=[];for(let e=0;e<256;++e)Eo.push((e+256).toString(16).slice(1))});function _ae(){return crypto.getRandomValues(DJt)}var DJt,LQe=W(()=>{DJt=new Uint8Array(16)});function OJt(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():PJt(e,t,r)}function PJt(e,t,r){e=e||{};let n=e.random??e.rng?.()??_ae();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return _Qe(n)}var Rae,IQe=W(()=>{LQe();RQe();Rae=OJt});var MQe=W(()=>{IQe()});var NQe={};Tr(NQe,{diagram:()=>UJt});var Lae,BJt,FJt,bp,$Jt,zJt,GJt,qJt,VJt,WJt,HJt,UJt,DQe=W(()=>{Uc();oc();ic();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();MQe();Ka();Lae=(function(){var e=b(function(C,T,k,S){for(k=k||{},S=C.length;S--;k[C[S]]=T);return k},"o"),t=[1,4],r=[1,13],n=[1,12],i=[1,15],a=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],h=[1,24],f=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],m=[1,33],g=[1,34],y=[1,6,7,11,13,15,16,19,22],v={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:b(function(T,k,S,E,I,L,O){var R=L.length-1;switch(I){case 6:case 7:return E;case 8:E.getLogger().trace("Stop NL ");break;case 9:E.getLogger().trace("Stop EOF ");break;case 11:E.getLogger().trace("Stop NL2 ");break;case 12:E.getLogger().trace("Stop EOF2 ");break;case 15:E.getLogger().info("Node: ",L[R].id),E.addNode(L[R-1].length,L[R].id,L[R].descr,L[R].type);break;case 16:E.getLogger().trace("Icon: ",L[R]),E.decorateNode({icon:L[R]});break;case 17:case 21:E.decorateNode({class:L[R]});break;case 18:E.getLogger().trace("SPACELIST");break;case 19:E.getLogger().trace("Node: ",L[R].id),E.addNode(0,L[R].id,L[R].descr,L[R].type);break;case 20:E.decorateNode({icon:L[R]});break;case 25:E.getLogger().trace("node found ..",L[R-2]),this.$={id:L[R-1],descr:L[R-1],type:E.getType(L[R-2],L[R])};break;case 26:this.$={id:L[R],descr:L[R],type:E.nodeType.DEFAULT};break;case 27:E.getLogger().trace("node found ..",L[R-3]),this.$={id:L[R-3],descr:L[R-1],type:E.getType(L[R-2],L[R])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},{6:r,9:22,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},{6:u,7:h,10:23,11:f},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:h,10:32,11:f},{1:[2,7],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},e(p,[2,14],{7:m,11:g}),e(y,[2,8]),e(y,[2,9]),e(y,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:m,11:g}),e(y,[2,11]),e(y,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:b(function(T,k){if(k.recoverable)this.trace(T);else{var S=new Error(T);throw S.hash=k,S}},"parseError"),parse:b(function(T){var k=this,S=[0],E=[],I=[null],L=[],O=this.table,R="",A=0,N=0,M=0,D=2,B=1,P=L.slice.call(arguments,1),$=Object.create(this.lexer),F={yy:{}};for(var q in this.yy)Object.prototype.hasOwnProperty.call(this.yy,q)&&(F.yy[q]=this.yy[q]);$.setInput(T,F.yy),F.yy.lexer=$,F.yy.parser=this,typeof $.yylloc>"u"&&($.yylloc={});var G=$.yylloc;L.push(G);var z=$.options&&$.options.ranges;typeof F.yy.parseError=="function"?this.parseError=F.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function H(fe){S.length=S.length-2*fe,I.length=I.length-fe,L.length=L.length-fe}b(H,"popStack");function j(){var fe;return fe=E.pop()||$.lex()||B,typeof fe!="number"&&(fe instanceof Array&&(E=fe,fe=E.pop()),fe=k.symbols_[fe]||fe),fe}b(j,"lex");for(var J,U,le,ee,ue,ae,oe={},Re,Te,Oe,qe;;){if(le=S[S.length-1],this.defaultActions[le]?ee=this.defaultActions[le]:((J===null||typeof J>"u")&&(J=j()),ee=O[le]&&O[le][J]),typeof ee>"u"||!ee.length||!ee[0]){var Ge="";qe=[];for(Re in O[le])this.terminals_[Re]&&Re>D&&qe.push("'"+this.terminals_[Re]+"'");$.showPosition?Ge="Parse error on line "+(A+1)+`: +`},"getStyles"),OJt=DJt,PJt={setConf:b(()=>{},"setConf"),draw:b((e,t,r,n)=>(n?.db?.getDirection?.()??"LR")==="TD"?IJt.draw(e,t,r,n):SJt.draw(e,t,r,n),"draw")},BJt={db:uQe,renderer:PJt,parser:uJt,styles:OJt}});function LQe(e,t=0){return(Eo[e[t+0]]+Eo[e[t+1]]+Eo[e[t+2]]+Eo[e[t+3]]+"-"+Eo[e[t+4]]+Eo[e[t+5]]+"-"+Eo[e[t+6]]+Eo[e[t+7]]+"-"+Eo[e[t+8]]+Eo[e[t+9]]+"-"+Eo[e[t+10]]+Eo[e[t+11]]+Eo[e[t+12]]+Eo[e[t+13]]+Eo[e[t+14]]+Eo[e[t+15]]).toLowerCase()}var Eo,IQe=W(()=>{Eo=[];for(let e=0;e<256;++e)Eo.push((e+256).toString(16).slice(1))});function Lae(){return crypto.getRandomValues(FJt)}var FJt,MQe=W(()=>{FJt=new Uint8Array(16)});function $Jt(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():zJt(e,t,r)}function zJt(e,t,r){e=e||{};let n=e.random??e.rng?.()??Lae();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return LQe(n)}var Iae,NQe=W(()=>{MQe();IQe();Iae=$Jt});var DQe=W(()=>{NQe()});var OQe={};Tr(OQe,{diagram:()=>KJt});var Mae,GJt,qJt,bp,VJt,WJt,HJt,UJt,YJt,XJt,jJt,KJt,PQe=W(()=>{Uc();lc();ac();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();DQe();Ka();Mae=(function(){var e=b(function(C,T,k,S){for(k=k||{},S=C.length;S--;k[C[S]]=T);return k},"o"),t=[1,4],r=[1,13],n=[1,12],i=[1,15],a=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],h=[1,24],f=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],m=[1,33],g=[1,34],y=[1,6,7,11,13,15,16,19,22],v={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:b(function(T,k,S,E,I,L,O){var R=L.length-1;switch(I){case 6:case 7:return E;case 8:E.getLogger().trace("Stop NL ");break;case 9:E.getLogger().trace("Stop EOF ");break;case 11:E.getLogger().trace("Stop NL2 ");break;case 12:E.getLogger().trace("Stop EOF2 ");break;case 15:E.getLogger().info("Node: ",L[R].id),E.addNode(L[R-1].length,L[R].id,L[R].descr,L[R].type);break;case 16:E.getLogger().trace("Icon: ",L[R]),E.decorateNode({icon:L[R]});break;case 17:case 21:E.decorateNode({class:L[R]});break;case 18:E.getLogger().trace("SPACELIST");break;case 19:E.getLogger().trace("Node: ",L[R].id),E.addNode(0,L[R].id,L[R].descr,L[R].type);break;case 20:E.decorateNode({icon:L[R]});break;case 25:E.getLogger().trace("node found ..",L[R-2]),this.$={id:L[R-1],descr:L[R-1],type:E.getType(L[R-2],L[R])};break;case 26:this.$={id:L[R],descr:L[R],type:E.nodeType.DEFAULT};break;case 27:E.getLogger().trace("node found ..",L[R-3]),this.$={id:L[R-3],descr:L[R-1],type:E.getType(L[R-2],L[R])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},{6:r,9:22,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},{6:u,7:h,10:23,11:f},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:h,10:32,11:f},{1:[2,7],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},e(p,[2,14],{7:m,11:g}),e(y,[2,8]),e(y,[2,9]),e(y,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:m,11:g}),e(y,[2,11]),e(y,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:b(function(T,k){if(k.recoverable)this.trace(T);else{var S=new Error(T);throw S.hash=k,S}},"parseError"),parse:b(function(T){var k=this,S=[0],E=[],I=[null],L=[],O=this.table,R="",A=0,N=0,M=0,D=2,B=1,P=L.slice.call(arguments,1),$=Object.create(this.lexer),F={yy:{}};for(var q in this.yy)Object.prototype.hasOwnProperty.call(this.yy,q)&&(F.yy[q]=this.yy[q]);$.setInput(T,F.yy),F.yy.lexer=$,F.yy.parser=this,typeof $.yylloc>"u"&&($.yylloc={});var G=$.yylloc;L.push(G);var z=$.options&&$.options.ranges;typeof F.yy.parseError=="function"?this.parseError=F.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function H(fe){S.length=S.length-2*fe,I.length=I.length-fe,L.length=L.length-fe}b(H,"popStack");function j(){var fe;return fe=E.pop()||$.lex()||B,typeof fe!="number"&&(fe instanceof Array&&(E=fe,fe=E.pop()),fe=k.symbols_[fe]||fe),fe}b(j,"lex");for(var J,U,le,ee,ue,ae,oe={},Re,Te,Oe,qe;;){if(le=S[S.length-1],this.defaultActions[le]?ee=this.defaultActions[le]:((J===null||typeof J>"u")&&(J=j()),ee=O[le]&&O[le][J]),typeof ee>"u"||!ee.length||!ee[0]){var Ge="";qe=[];for(Re in O[le])this.terminals_[Re]&&Re>D&&qe.push("'"+this.terminals_[Re]+"'");$.showPosition?Ge="Parse error on line "+(A+1)+`: `+$.showPosition()+` Expecting `+qe.join(", ")+", got '"+(this.terminals_[J]||J)+"'":Ge="Parse error on line "+(A+1)+": Unexpected "+(J==B?"end of input":"'"+(this.terminals_[J]||J)+"'"),this.parseError(Ge,{text:$.match,token:this.terminals_[J]||J,line:$.yylineno,loc:G,expected:qe})}if(ee[0]instanceof Array&&ee.length>1)throw new Error("Parse Error: multiple actions possible at state: "+le+", token: "+J);switch(ee[0]){case 1:S.push(J),I.push($.yytext),L.push($.yylloc),S.push(ee[1]),J=null,U?(J=U,U=null):(N=$.yyleng,R=$.yytext,A=$.yylineno,G=$.yylloc,M>0&&M--);break;case 2:if(Te=this.productions_[ee[1]][1],oe.$=I[I.length-Te],oe._$={first_line:L[L.length-(Te||1)].first_line,last_line:L[L.length-1].last_line,first_column:L[L.length-(Te||1)].first_column,last_column:L[L.length-1].last_column},z&&(oe._$.range=[L[L.length-(Te||1)].range[0],L[L.length-1].range[1]]),ae=this.performAction.apply(oe,[R,N,A,F.yy,ee[1],I,L].concat(P)),typeof ae<"u")return ae;Te&&(S=S.slice(0,-1*Te*2),I=I.slice(0,-1*Te),L=L.slice(0,-1*Te)),S.push(this.productions_[ee[1]][0]),I.push(oe.$),L.push(oe._$),Oe=O[S[S.length-2]][S[S.length-1]],S.push(Oe);break;case 3:return!0}}return!0},"parse")},x=(function(){var C={EOF:1,parseError:b(function(k,S){if(this.yy.parser)this.yy.parser.parseError(k,S);else throw new Error(k)},"parseError"),setInput:b(function(T,k){return this.yy=k||this.yy||{},this._input=T,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var T=this._input[0];this.yytext+=T,this.yyleng++,this.offset++,this.match+=T,this.matched+=T;var k=T.match(/(?:\r\n?|\n).*/g);return k?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),T},"input"),unput:b(function(T){var k=T.length,S=T.split(/(?:\r\n?|\n)/g);this._input=T+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-k),this.offset-=k;var E=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),S.length-1&&(this.yylineno-=S.length-1);var I=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:S?(S.length===E.length?this.yylloc.first_column:0)+E[E.length-S.length].length-S[0].length:this.yylloc.first_column-k},this.options.ranges&&(this.yylloc.range=[I[0],I[0]+this.yyleng-k]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(T){this.unput(this.match.slice(T))},"less"),pastInput:b(function(){var T=this.matched.substr(0,this.matched.length-this.match.length);return(T.length>20?"...":"")+T.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var T=this.match;return T.length<20&&(T+=this._input.substr(0,20-T.length)),(T.substr(0,20)+(T.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var T=this.pastInput(),k=new Array(T.length+1).join("-");return T+this.upcomingInput()+` `+k+"^"},"showPosition"),test_match:b(function(T,k){var S,E,I;if(this.options.backtrack_lexer&&(I={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(I.yylloc.range=this.yylloc.range.slice(0))),E=T[0].match(/(?:\r\n?|\n).*/g),E&&(this.yylineno+=E.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:E?E[E.length-1].length-E[E.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+T[0].length},this.yytext+=T[0],this.match+=T[0],this.matches=T,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(T[0].length),this.matched+=T[0],S=this.performAction.call(this,this.yy,this,k,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),S)return S;if(this._backtrack){for(var L in I)this[L]=I[L];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var T,k,S,E;this._more||(this.yytext="",this.match="");for(var I=this._currentRules(),L=0;Lk[0].length)){if(k=S,E=L,this.options.backtrack_lexer){if(T=this.test_match(S,I[L]),T!==!1)return T;if(this._backtrack){k=!1;continue}else return!1}else if(!this.options.flex)break}return k?(T=this.test_match(k,I[E]),T!==!1?T:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var k=this.next();return k||this.lex()},"lex"),begin:b(function(k){this.conditionStack.push(k)},"begin"),popState:b(function(){var k=this.conditionStack.length-1;return k>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(k){return k=this.conditionStack.length-1-Math.abs(k||0),k>=0?this.conditionStack[k]:"INITIAL"},"topState"),pushState:b(function(k){this.begin(k)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(k,S,E,I){var L=I;switch(E){case 0:return k.getLogger().trace("Found comment",S.yytext),6;break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;break;case 4:this.popState();break;case 5:k.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return k.getLogger().trace("SPACELINE"),6;break;case 7:return 7;case 8:return 15;case 9:k.getLogger().trace("end icon"),this.popState();break;case 10:return k.getLogger().trace("Exploding node"),this.begin("NODE"),19;break;case 11:return k.getLogger().trace("Cloud"),this.begin("NODE"),19;break;case 12:return k.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;break;case 13:return k.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;break;case 14:return this.begin("NODE"),19;break;case 15:return this.begin("NODE"),19;break;case 16:return this.begin("NODE"),19;break;case 17:return this.begin("NODE"),19;break;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:k.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return k.getLogger().trace("description:",S.yytext),"NODE_DESCR";break;case 26:this.popState();break;case 27:return this.popState(),k.getLogger().trace("node end ))"),"NODE_DEND";break;case 28:return this.popState(),k.getLogger().trace("node end )"),"NODE_DEND";break;case 29:return this.popState(),k.getLogger().trace("node end ...",S.yytext),"NODE_DEND";break;case 30:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 31:return this.popState(),k.getLogger().trace("node end (-"),"NODE_DEND";break;case 32:return this.popState(),k.getLogger().trace("node end (-"),"NODE_DEND";break;case 33:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 34:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 35:return k.getLogger().trace("Long description:",S.yytext),20;break;case 36:return k.getLogger().trace("Long description:",S.yytext),20;break}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return C})();v.lexer=x;function w(){this.yy={}}return b(w,"Parser"),w.prototype=v,v.Parser=w,new w})();Lae.parser=Lae;BJt=Lae,FJt=12,bp={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},$Jt=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=bp,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{b(this,"MindmapDB")}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let t=this.nodes.length-1;t>=0;t--)if(this.nodes[t].level0?this.nodes[0]:null}addNode(e,t,r,n){se.info("addNode",e,t,r,n);let i=!1;this.nodes.length===0?(this.baseLevel=e,e=0,i=!0):this.baseLevel!==void 0&&(e=e-this.baseLevel,i=!1);let a=Be(),s=a.mindmap?.padding??Lr.mindmap.padding;switch(n){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:s*=2;break}let o={id:this.count++,nodeId:Mr(t,a),level:e,descr:Mr(r,a),type:n,children:[],width:a.mindmap?.maxNodeWidth??Lr.mindmap.maxNodeWidth,padding:s,isRoot:i},l=this.getParent(e);if(l)l.children.push(o),this.nodes.push(o);else if(i)this.nodes.push(o);else throw new Error(`There can be only one root. No parent could be found for ("${o.descr}")`)}getType(e,t){switch(se.debug("In get type",e,t),e){case"[":return this.nodeType.RECT;case"(":return t===")"?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,t){this.elements[e]=t}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;let t=Be(),r=this.nodes[this.nodes.length-1];e.icon&&(r.icon=Mr(e.icon,t)),e.class&&(r.class=Mr(e.class,t))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(e,t){if(e.level===0?e.section=void 0:e.section=t,e.children)for(let[r,n]of e.children.entries()){let i=e.level===0?r%(FJt-1):t;this.assignSections(n,i)}}flattenNodes(e,t){let r=Be(),n=["mindmap-node"];e.isRoot===!0?n.push("section-root","section--1"):e.section!==void 0&&n.push(`section-${e.section}`),e.class&&n.push(e.class);let i=n.join(" "),a=b(o=>{let u=(r.theme?.toLowerCase()??"").includes("redux");switch(o){case bp.CIRCLE:return"mindmapCircle";case bp.RECT:return"rect";case bp.ROUNDED_RECT:return"rounded";case bp.CLOUD:return"cloud";case bp.BANG:return"bang";case bp.HEXAGON:return"hexagon";case bp.DEFAULT:return u?"rounded":"defaultMindmapNode";case bp.NO_BORDER:default:return"rect"}},"getShapeFromType"),s={id:e.id.toString(),domId:"node_"+e.id.toString(),label:e.descr,labelType:"markdown",isGroup:!1,shape:a(e.type),width:e.width,height:e.height??0,padding:e.padding,cssClasses:i,cssStyles:[],look:r.look,icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(t.push(s),e.children)for(let o of e.children)this.flattenNodes(o,t)}generateEdges(e,t){if(!e.children)return;let r=Be();for(let n of e.children){let i="edge";n.section!==void 0&&(i+=` section-edge-${n.section}`);let a=e.level+1;i+=` edge-depth-${a}`;let s={id:`edge_${e.id}_${n.id}`,start:e.id.toString(),end:n.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:r.look,classes:i,depth:e.level,section:n.section};t.push(s),this.generateEdges(n,t)}}getData(){let e=this.getMindmap(),t=Be(),n=i9().layout!==void 0,i=t;if(n||(i.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:i};se.debug("getData: mindmapRoot",e,t),this.assignSections(e);let a=[],s=[];this.flattenNodes(e,a),this.generateEdges(e,s),se.debug(`getData: processed ${a.length} nodes and ${s.length} edges`);let o=new Map;for(let l of a)o.set(l.id,{shape:l.shape,width:l.width,height:l.height,padding:l.padding});return{nodes:a,edges:s,config:i,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(o),type:"mindmap",diagramId:"mindmap-"+Rae()}}getLogger(){return se}},zJt=b(async(e,t,r,n)=>{se.debug(`Rendering mindmap diagram -`+e);let i=n.db,a=i.getData(),s=zu(t,a.config.securityLevel);if(a.type=n.type,a.layoutAlgorithm=td(a.config.layout,{fallback:"cose-bilkent"}),a.diagramId=t,!i.getMindmap())return;a.nodes.forEach(d=>{d.shape==="rounded"?(d.radius=15,d.taper=15,d.stroke="none",d.width=0,d.padding=15):d.shape==="circle"?d.padding=10:d.shape==="rect"?(d.width=0,d.padding=10):d.shape==="hexagon"&&(d.width=0,d.height=0)}),await Ou(a,s);let{themeVariables:l}=qt(),{useGradient:u,gradientStart:h,gradientStop:f}=l;if(u&&h&&f){let d=s.attr("id"),p=s.append("defs").append("linearGradient").attr("id",`${d}-gradient`).attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");p.append("stop").attr("offset","0%").attr("stop-color",h).attr("stop-opacity",1),p.append("stop").attr("offset","100%").attr("stop-color",f).attr("stop-opacity",1)}sc(s,a.config.mindmap?.padding??Lr.mindmap.padding,"mindmapDiagram",a.config.mindmap?.useMaxWidth??Lr.mindmap.useMaxWidth)},"draw"),GJt={draw:zJt},qJt=b(e=>{let{theme:t,look:r}=e,n="";for(let i=0;i0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(k){return k=this.conditionStack.length-1-Math.abs(k||0),k>=0?this.conditionStack[k]:"INITIAL"},"topState"),pushState:b(function(k){this.begin(k)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(k,S,E,I){var L=I;switch(E){case 0:return k.getLogger().trace("Found comment",S.yytext),6;break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;break;case 4:this.popState();break;case 5:k.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return k.getLogger().trace("SPACELINE"),6;break;case 7:return 7;case 8:return 15;case 9:k.getLogger().trace("end icon"),this.popState();break;case 10:return k.getLogger().trace("Exploding node"),this.begin("NODE"),19;break;case 11:return k.getLogger().trace("Cloud"),this.begin("NODE"),19;break;case 12:return k.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;break;case 13:return k.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;break;case 14:return this.begin("NODE"),19;break;case 15:return this.begin("NODE"),19;break;case 16:return this.begin("NODE"),19;break;case 17:return this.begin("NODE"),19;break;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:k.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return k.getLogger().trace("description:",S.yytext),"NODE_DESCR";break;case 26:this.popState();break;case 27:return this.popState(),k.getLogger().trace("node end ))"),"NODE_DEND";break;case 28:return this.popState(),k.getLogger().trace("node end )"),"NODE_DEND";break;case 29:return this.popState(),k.getLogger().trace("node end ...",S.yytext),"NODE_DEND";break;case 30:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 31:return this.popState(),k.getLogger().trace("node end (-"),"NODE_DEND";break;case 32:return this.popState(),k.getLogger().trace("node end (-"),"NODE_DEND";break;case 33:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 34:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 35:return k.getLogger().trace("Long description:",S.yytext),20;break;case 36:return k.getLogger().trace("Long description:",S.yytext),20;break}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return C})();v.lexer=x;function w(){this.yy={}}return b(w,"Parser"),w.prototype=v,v.Parser=w,new w})();Mae.parser=Mae;GJt=Mae,qJt=12,bp={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},VJt=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=bp,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{b(this,"MindmapDB")}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let t=this.nodes.length-1;t>=0;t--)if(this.nodes[t].level0?this.nodes[0]:null}addNode(e,t,r,n){se.info("addNode",e,t,r,n);let i=!1;this.nodes.length===0?(this.baseLevel=e,e=0,i=!0):this.baseLevel!==void 0&&(e=e-this.baseLevel,i=!1);let a=Be(),s=a.mindmap?.padding??Lr.mindmap.padding;switch(n){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:s*=2;break}let o={id:this.count++,nodeId:Mr(t,a),level:e,descr:Mr(r,a),type:n,children:[],width:a.mindmap?.maxNodeWidth??Lr.mindmap.maxNodeWidth,padding:s,isRoot:i},l=this.getParent(e);if(l)l.children.push(o),this.nodes.push(o);else if(i)this.nodes.push(o);else throw new Error(`There can be only one root. No parent could be found for ("${o.descr}")`)}getType(e,t){switch(se.debug("In get type",e,t),e){case"[":return this.nodeType.RECT;case"(":return t===")"?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,t){this.elements[e]=t}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;let t=Be(),r=this.nodes[this.nodes.length-1];e.icon&&(r.icon=Mr(e.icon,t)),e.class&&(r.class=Mr(e.class,t))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(e,t){if(e.level===0?e.section=void 0:e.section=t,e.children)for(let[r,n]of e.children.entries()){let i=e.level===0?r%(qJt-1):t;this.assignSections(n,i)}}flattenNodes(e,t){let r=Be(),n=["mindmap-node"];e.isRoot===!0?n.push("section-root","section--1"):e.section!==void 0&&n.push(`section-${e.section}`),e.class&&n.push(e.class);let i=n.join(" "),a=b(o=>{let u=(r.theme?.toLowerCase()??"").includes("redux");switch(o){case bp.CIRCLE:return"mindmapCircle";case bp.RECT:return"rect";case bp.ROUNDED_RECT:return"rounded";case bp.CLOUD:return"cloud";case bp.BANG:return"bang";case bp.HEXAGON:return"hexagon";case bp.DEFAULT:return u?"rounded":"defaultMindmapNode";case bp.NO_BORDER:default:return"rect"}},"getShapeFromType"),s={id:e.id.toString(),domId:"node_"+e.id.toString(),label:e.descr,labelType:"markdown",isGroup:!1,shape:a(e.type),width:e.width,height:e.height??0,padding:e.padding,cssClasses:i,cssStyles:[],look:r.look,icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(t.push(s),e.children)for(let o of e.children)this.flattenNodes(o,t)}generateEdges(e,t){if(!e.children)return;let r=Be();for(let n of e.children){let i="edge";n.section!==void 0&&(i+=` section-edge-${n.section}`);let a=e.level+1;i+=` edge-depth-${a}`;let s={id:`edge_${e.id}_${n.id}`,start:e.id.toString(),end:n.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:r.look,classes:i,depth:e.level,section:n.section};t.push(s),this.generateEdges(n,t)}}getData(){let e=this.getMindmap(),t=Be(),n=i9().layout!==void 0,i=t;if(n||(i.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:i};se.debug("getData: mindmapRoot",e,t),this.assignSections(e);let a=[],s=[];this.flattenNodes(e,a),this.generateEdges(e,s),se.debug(`getData: processed ${a.length} nodes and ${s.length} edges`);let o=new Map;for(let l of a)o.set(l.id,{shape:l.shape,width:l.width,height:l.height,padding:l.padding});return{nodes:a,edges:s,config:i,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(o),type:"mindmap",diagramId:"mindmap-"+Iae()}}getLogger(){return se}},WJt=b(async(e,t,r,n)=>{se.debug(`Rendering mindmap diagram +`+e);let i=n.db,a=i.getData(),s=zu(t,a.config.securityLevel);if(a.type=n.type,a.layoutAlgorithm=td(a.config.layout,{fallback:"cose-bilkent"}),a.diagramId=t,!i.getMindmap())return;a.nodes.forEach(d=>{d.shape==="rounded"?(d.radius=15,d.taper=15,d.stroke="none",d.width=0,d.padding=15):d.shape==="circle"?d.padding=10:d.shape==="rect"?(d.width=0,d.padding=10):d.shape==="hexagon"&&(d.width=0,d.height=0)}),await Ou(a,s);let{themeVariables:l}=qt(),{useGradient:u,gradientStart:h,gradientStop:f}=l;if(u&&h&&f){let d=s.attr("id"),p=s.append("defs").append("linearGradient").attr("id",`${d}-gradient`).attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");p.append("stop").attr("offset","0%").attr("stop-color",h).attr("stop-opacity",1),p.append("stop").attr("offset","100%").attr("stop-color",f).attr("stop-opacity",1)}oc(s,a.config.mindmap?.padding??Lr.mindmap.padding,"mindmapDiagram",a.config.mindmap?.useMaxWidth??Lr.mindmap.useMaxWidth)},"draw"),HJt={draw:WJt},UJt=b(e=>{let{theme:t,look:r}=e,n="";for(let i=0;i{let n="";for(let i=0;i{let n="";for(let i=0;i{let{theme:t}=e,r=e.svgId,n=e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${r}-drop-shadow)`):"none";return` + }`;return n},"genGradient"),XJt=b(e=>{let{theme:t}=e,r=e.svgId,n=e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${r}-drop-shadow)`):"none";return` .edge { stroke-width: 3; } - ${qJt(e)} + ${UJt(e)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${e.git0}; } @@ -2785,18 +2785,18 @@ Expecting `+qe.join(", ")+", got '"+(this.terminals_[J]||J)+"'":Ge="Parse error [data-look="neo"].mindmap-node.section-root .text-inner-tspan { fill: ${t?.includes("redux")?e.nodeBorder:e["cScaleLabel"+(t==="neutral"?1:0)]}; } - ${e.useGradient&&r&&e.mainBkg?VJt(e.THEME_COLOR_LIMIT,r,e.mainBkg):""} -`},"getStyles"),HJt=WJt,UJt={get db(){return new $Jt},renderer:GJt,parser:BJt,styles:HJt}});var PQe={};Tr(PQe,{diagram:()=>her});var Iae,YJt,Xu,Nae,Mae,Dae,XJt,jJt,OQe,KJt,ZJt,_s,QJt,JJt,eer,ter,rer,ner,ier,aer,ser,oer,ler,cer,uer,her,BQe=W(()=>{za();ad();Gy();po();co();ho();bs();ts();Sn();_r();Rr();hr();Ka();Iae=(function(){var e=b(function(S,E,I,L){for(I=I||{},L=S.length;L--;I[S[L]]=E);return I},"o"),t=[1,4],r=[1,13],n=[1,12],i=[1,15],a=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],h=[1,24],f=[1,25],d=[6,7,11],p=[1,31],m=[6,7,11,24],g=[1,6,13,16,17,20,23],y=[1,35],v=[1,36],x=[1,6,7,11,13,16,17,20,23],w=[1,38],C={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:b(function(E,I,L,O,R,A,N){var M=A.length-1;switch(R){case 6:case 7:return O;case 8:O.getLogger().trace("Stop NL ");break;case 9:O.getLogger().trace("Stop EOF ");break;case 11:O.getLogger().trace("Stop NL2 ");break;case 12:O.getLogger().trace("Stop EOF2 ");break;case 15:O.getLogger().info("Node: ",A[M-1].id),O.addNode(A[M-2].length,A[M-1].id,A[M-1].descr,A[M-1].type,A[M]);break;case 16:O.getLogger().info("Node: ",A[M].id),O.addNode(A[M-1].length,A[M].id,A[M].descr,A[M].type);break;case 17:O.getLogger().trace("Icon: ",A[M]),O.decorateNode({icon:A[M]});break;case 18:case 23:O.decorateNode({class:A[M]});break;case 19:O.getLogger().trace("SPACELIST");break;case 20:O.getLogger().trace("Node: ",A[M-1].id),O.addNode(0,A[M-1].id,A[M-1].descr,A[M-1].type,A[M]);break;case 21:O.getLogger().trace("Node: ",A[M].id),O.addNode(0,A[M].id,A[M].descr,A[M].type);break;case 22:O.decorateNode({icon:A[M]});break;case 27:O.getLogger().trace("node found ..",A[M-2]),this.$={id:A[M-1],descr:A[M-1],type:O.getType(A[M-2],A[M])};break;case 28:this.$={id:A[M],descr:A[M],type:0};break;case 29:O.getLogger().trace("node found ..",A[M-3]),this.$={id:A[M-3],descr:A[M-1],type:O.getType(A[M-2],A[M])};break;case 30:this.$=A[M-1]+A[M];break;case 31:this.$=A[M];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},{6:r,9:22,12:11,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},{6:u,7:h,10:23,11:f},e(d,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:o}),e(d,[2,19]),e(d,[2,21],{15:30,24:p}),e(d,[2,22]),e(d,[2,23]),e(m,[2,25]),e(m,[2,26]),e(m,[2,28],{20:[1,32]}),{21:[1,33]},{6:u,7:h,10:34,11:f},{1:[2,7],6:r,12:21,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},e(g,[2,14],{7:y,11:v}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(d,[2,16],{15:37,24:p}),e(d,[2,17]),e(d,[2,18]),e(d,[2,20],{24:w}),e(m,[2,31]),{21:[1,39]},{22:[1,40]},e(g,[2,13],{7:y,11:v}),e(x,[2,11]),e(x,[2,12]),e(d,[2,15],{24:w}),e(m,[2,30]),{22:[1,41]},e(m,[2,27]),e(m,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:b(function(E,I){if(I.recoverable)this.trace(E);else{var L=new Error(E);throw L.hash=I,L}},"parseError"),parse:b(function(E){var I=this,L=[0],O=[],R=[null],A=[],N=this.table,M="",D=0,B=0,P=0,$=2,F=1,q=A.slice.call(arguments,1),G=Object.create(this.lexer),z={yy:{}};for(var H in this.yy)Object.prototype.hasOwnProperty.call(this.yy,H)&&(z.yy[H]=this.yy[H]);G.setInput(E,z.yy),z.yy.lexer=G,z.yy.parser=this,typeof G.yylloc>"u"&&(G.yylloc={});var j=G.yylloc;A.push(j);var J=G.options&&G.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(de){L.length=L.length-2*de,R.length=R.length-de,A.length=A.length-de}b(U,"popStack");function le(){var de;return de=O.pop()||G.lex()||F,typeof de!="number"&&(de instanceof Array&&(O=de,de=O.pop()),de=I.symbols_[de]||de),de}b(le,"lex");for(var ee,ue,ae,oe,Re,Te,Oe={},qe,Ge,fe,Ce;;){if(ae=L[L.length-1],this.defaultActions[ae]?oe=this.defaultActions[ae]:((ee===null||typeof ee>"u")&&(ee=le()),oe=N[ae]&&N[ae][ee]),typeof oe>"u"||!oe.length||!oe[0]){var _e="";Ce=[];for(qe in N[ae])this.terminals_[qe]&&qe>$&&Ce.push("'"+this.terminals_[qe]+"'");G.showPosition?_e="Parse error on line "+(D+1)+`: + ${e.useGradient&&r&&e.mainBkg?YJt(e.THEME_COLOR_LIMIT,r,e.mainBkg):""} +`},"getStyles"),jJt=XJt,KJt={get db(){return new VJt},renderer:HJt,parser:GJt,styles:jJt}});var FQe={};Tr(FQe,{diagram:()=>mer});var Nae,ZJt,Xu,Oae,Dae,Pae,QJt,JJt,BQe,eer,ter,_s,rer,ner,ier,aer,ser,oer,ler,cer,uer,her,fer,der,per,mer,$Qe=W(()=>{za();ad();Gy();po();co();ho();bs();ts();Sn();_r();Rr();hr();Ka();Nae=(function(){var e=b(function(S,E,I,L){for(I=I||{},L=S.length;L--;I[S[L]]=E);return I},"o"),t=[1,4],r=[1,13],n=[1,12],i=[1,15],a=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],h=[1,24],f=[1,25],d=[6,7,11],p=[1,31],m=[6,7,11,24],g=[1,6,13,16,17,20,23],y=[1,35],v=[1,36],x=[1,6,7,11,13,16,17,20,23],w=[1,38],C={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:b(function(E,I,L,O,R,A,N){var M=A.length-1;switch(R){case 6:case 7:return O;case 8:O.getLogger().trace("Stop NL ");break;case 9:O.getLogger().trace("Stop EOF ");break;case 11:O.getLogger().trace("Stop NL2 ");break;case 12:O.getLogger().trace("Stop EOF2 ");break;case 15:O.getLogger().info("Node: ",A[M-1].id),O.addNode(A[M-2].length,A[M-1].id,A[M-1].descr,A[M-1].type,A[M]);break;case 16:O.getLogger().info("Node: ",A[M].id),O.addNode(A[M-1].length,A[M].id,A[M].descr,A[M].type);break;case 17:O.getLogger().trace("Icon: ",A[M]),O.decorateNode({icon:A[M]});break;case 18:case 23:O.decorateNode({class:A[M]});break;case 19:O.getLogger().trace("SPACELIST");break;case 20:O.getLogger().trace("Node: ",A[M-1].id),O.addNode(0,A[M-1].id,A[M-1].descr,A[M-1].type,A[M]);break;case 21:O.getLogger().trace("Node: ",A[M].id),O.addNode(0,A[M].id,A[M].descr,A[M].type);break;case 22:O.decorateNode({icon:A[M]});break;case 27:O.getLogger().trace("node found ..",A[M-2]),this.$={id:A[M-1],descr:A[M-1],type:O.getType(A[M-2],A[M])};break;case 28:this.$={id:A[M],descr:A[M],type:0};break;case 29:O.getLogger().trace("node found ..",A[M-3]),this.$={id:A[M-3],descr:A[M-1],type:O.getType(A[M-2],A[M])};break;case 30:this.$=A[M-1]+A[M];break;case 31:this.$=A[M];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},{6:r,9:22,12:11,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},{6:u,7:h,10:23,11:f},e(d,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:o}),e(d,[2,19]),e(d,[2,21],{15:30,24:p}),e(d,[2,22]),e(d,[2,23]),e(m,[2,25]),e(m,[2,26]),e(m,[2,28],{20:[1,32]}),{21:[1,33]},{6:u,7:h,10:34,11:f},{1:[2,7],6:r,12:21,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},e(g,[2,14],{7:y,11:v}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(d,[2,16],{15:37,24:p}),e(d,[2,17]),e(d,[2,18]),e(d,[2,20],{24:w}),e(m,[2,31]),{21:[1,39]},{22:[1,40]},e(g,[2,13],{7:y,11:v}),e(x,[2,11]),e(x,[2,12]),e(d,[2,15],{24:w}),e(m,[2,30]),{22:[1,41]},e(m,[2,27]),e(m,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:b(function(E,I){if(I.recoverable)this.trace(E);else{var L=new Error(E);throw L.hash=I,L}},"parseError"),parse:b(function(E){var I=this,L=[0],O=[],R=[null],A=[],N=this.table,M="",D=0,B=0,P=0,$=2,F=1,q=A.slice.call(arguments,1),G=Object.create(this.lexer),z={yy:{}};for(var H in this.yy)Object.prototype.hasOwnProperty.call(this.yy,H)&&(z.yy[H]=this.yy[H]);G.setInput(E,z.yy),z.yy.lexer=G,z.yy.parser=this,typeof G.yylloc>"u"&&(G.yylloc={});var j=G.yylloc;A.push(j);var J=G.options&&G.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(de){L.length=L.length-2*de,R.length=R.length-de,A.length=A.length-de}b(U,"popStack");function le(){var de;return de=O.pop()||G.lex()||F,typeof de!="number"&&(de instanceof Array&&(O=de,de=O.pop()),de=I.symbols_[de]||de),de}b(le,"lex");for(var ee,ue,ae,oe,Re,Te,Oe={},qe,Ge,fe,Ce;;){if(ae=L[L.length-1],this.defaultActions[ae]?oe=this.defaultActions[ae]:((ee===null||typeof ee>"u")&&(ee=le()),oe=N[ae]&&N[ae][ee]),typeof oe>"u"||!oe.length||!oe[0]){var _e="";Ce=[];for(qe in N[ae])this.terminals_[qe]&&qe>$&&Ce.push("'"+this.terminals_[qe]+"'");G.showPosition?_e="Parse error on line "+(D+1)+`: `+G.showPosition()+` Expecting `+Ce.join(", ")+", got '"+(this.terminals_[ee]||ee)+"'":_e="Parse error on line "+(D+1)+": Unexpected "+(ee==F?"end of input":"'"+(this.terminals_[ee]||ee)+"'"),this.parseError(_e,{text:G.match,token:this.terminals_[ee]||ee,line:G.yylineno,loc:j,expected:Ce})}if(oe[0]instanceof Array&&oe.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ae+", token: "+ee);switch(oe[0]){case 1:L.push(ee),R.push(G.yytext),A.push(G.yylloc),L.push(oe[1]),ee=null,ue?(ee=ue,ue=null):(B=G.yyleng,M=G.yytext,D=G.yylineno,j=G.yylloc,P>0&&P--);break;case 2:if(Ge=this.productions_[oe[1]][1],Oe.$=R[R.length-Ge],Oe._$={first_line:A[A.length-(Ge||1)].first_line,last_line:A[A.length-1].last_line,first_column:A[A.length-(Ge||1)].first_column,last_column:A[A.length-1].last_column},J&&(Oe._$.range=[A[A.length-(Ge||1)].range[0],A[A.length-1].range[1]]),Te=this.performAction.apply(Oe,[M,B,D,z.yy,oe[1],R,A].concat(q)),typeof Te<"u")return Te;Ge&&(L=L.slice(0,-1*Ge*2),R=R.slice(0,-1*Ge),A=A.slice(0,-1*Ge)),L.push(this.productions_[oe[1]][0]),R.push(Oe.$),A.push(Oe._$),fe=N[L[L.length-2]][L[L.length-1]],L.push(fe);break;case 3:return!0}}return!0},"parse")},T=(function(){var S={EOF:1,parseError:b(function(I,L){if(this.yy.parser)this.yy.parser.parseError(I,L);else throw new Error(I)},"parseError"),setInput:b(function(E,I){return this.yy=I||this.yy||{},this._input=E,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var E=this._input[0];this.yytext+=E,this.yyleng++,this.offset++,this.match+=E,this.matched+=E;var I=E.match(/(?:\r\n?|\n).*/g);return I?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),E},"input"),unput:b(function(E){var I=E.length,L=E.split(/(?:\r\n?|\n)/g);this._input=E+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-I),this.offset-=I;var O=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),L.length-1&&(this.yylineno-=L.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:L?(L.length===O.length?this.yylloc.first_column:0)+O[O.length-L.length].length-L[0].length:this.yylloc.first_column-I},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-I]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(E){this.unput(this.match.slice(E))},"less"),pastInput:b(function(){var E=this.matched.substr(0,this.matched.length-this.match.length);return(E.length>20?"...":"")+E.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var E=this.match;return E.length<20&&(E+=this._input.substr(0,20-E.length)),(E.substr(0,20)+(E.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var E=this.pastInput(),I=new Array(E.length+1).join("-");return E+this.upcomingInput()+` `+I+"^"},"showPosition"),test_match:b(function(E,I){var L,O,R;if(this.options.backtrack_lexer&&(R={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(R.yylloc.range=this.yylloc.range.slice(0))),O=E[0].match(/(?:\r\n?|\n).*/g),O&&(this.yylineno+=O.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:O?O[O.length-1].length-O[O.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+E[0].length},this.yytext+=E[0],this.match+=E[0],this.matches=E,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(E[0].length),this.matched+=E[0],L=this.performAction.call(this,this.yy,this,I,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),L)return L;if(this._backtrack){for(var A in R)this[A]=R[A];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var E,I,L,O;this._more||(this.yytext="",this.match="");for(var R=this._currentRules(),A=0;AI[0].length)){if(I=L,O=A,this.options.backtrack_lexer){if(E=this.test_match(L,R[A]),E!==!1)return E;if(this._backtrack){I=!1;continue}else return!1}else if(!this.options.flex)break}return I?(E=this.test_match(I,R[O]),E!==!1?E:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var I=this.next();return I||this.lex()},"lex"),begin:b(function(I){this.conditionStack.push(I)},"begin"),popState:b(function(){var I=this.conditionStack.length-1;return I>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(I){return I=this.conditionStack.length-1-Math.abs(I||0),I>=0?this.conditionStack[I]:"INITIAL"},"topState"),pushState:b(function(I){this.begin(I)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(I,L,O,R){var A=R;switch(O){case 0:return this.pushState("shapeData"),L.yytext="",24;break;case 1:return this.pushState("shapeDataStr"),24;break;case 2:return this.popState(),24;break;case 3:let N=/\n\s*/g;return L.yytext=L.yytext.replace(N,"
"),24;break;case 4:return 24;case 5:this.popState();break;case 6:return I.getLogger().trace("Found comment",L.yytext),6;break;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;break;case 10:this.popState();break;case 11:I.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return I.getLogger().trace("SPACELINE"),6;break;case 13:return 7;case 14:return 16;case 15:I.getLogger().trace("end icon"),this.popState();break;case 16:return I.getLogger().trace("Exploding node"),this.begin("NODE"),20;break;case 17:return I.getLogger().trace("Cloud"),this.begin("NODE"),20;break;case 18:return I.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;break;case 19:return I.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;break;case 20:return this.begin("NODE"),20;break;case 21:return this.begin("NODE"),20;break;case 22:return this.begin("NODE"),20;break;case 23:return this.begin("NODE"),20;break;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 29:this.popState();break;case 30:I.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return I.getLogger().trace("description:",L.yytext),"NODE_DESCR";break;case 32:this.popState();break;case 33:return this.popState(),I.getLogger().trace("node end ))"),"NODE_DEND";break;case 34:return this.popState(),I.getLogger().trace("node end )"),"NODE_DEND";break;case 35:return this.popState(),I.getLogger().trace("node end ...",L.yytext),"NODE_DEND";break;case 36:return this.popState(),I.getLogger().trace("node end (("),"NODE_DEND";break;case 37:return this.popState(),I.getLogger().trace("node end (-"),"NODE_DEND";break;case 38:return this.popState(),I.getLogger().trace("node end (-"),"NODE_DEND";break;case 39:return this.popState(),I.getLogger().trace("node end (("),"NODE_DEND";break;case 40:return this.popState(),I.getLogger().trace("node end (("),"NODE_DEND";break;case 41:return I.getLogger().trace("Long description:",L.yytext),21;break;case 42:return I.getLogger().trace("Long description:",L.yytext),21;break}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}};return S})();C.lexer=T;function k(){this.yy={}}return b(k,"Parser"),k.prototype=C,C.Parser=k,new k})();Iae.parser=Iae;YJt=Iae,Xu=[],Nae=[],Mae=0,Dae={},XJt=b(()=>{Xu=[],Nae=[],Mae=0,Dae={}},"clear"),jJt=b(e=>{if(Xu.length===0)return null;let t=Xu[0].level,r=null;for(let n=Xu.length-1;n>=0;n--)if(Xu[n].level===t&&!r&&(r=Xu[n]),Xu[n].levelo.parentId===i.id);for(let o of s){let l={id:o.id,parentId:i.id,label:Mr(o.label??"",n),labelType:"markdown",isGroup:!1,ticket:o?.ticket,priority:o?.priority,assigned:o?.assigned,icon:o?.icon,shape:"kanbanItem",level:o.level,rx:5,ry:5,cssStyles:["text-align: left"]};t.push(l)}}return{nodes:t,edges:e,other:{},config:Be()}},"getData"),ZJt=b((e,t,r,n,i)=>{let a=Be(),s=a.mindmap?.padding??Lr.mindmap.padding;switch(n){case _s.ROUNDED_RECT:case _s.RECT:case _s.HEXAGON:s*=2}let o={id:Mr(t,a)||"kbn"+Mae++,level:e,label:Mr(r,a),width:a.mindmap?.maxNodeWidth??Lr.mindmap.maxNodeWidth,padding:s,isGroup:!1};if(i!==void 0){let u;i.includes(` +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var I=this.next();return I||this.lex()},"lex"),begin:b(function(I){this.conditionStack.push(I)},"begin"),popState:b(function(){var I=this.conditionStack.length-1;return I>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(I){return I=this.conditionStack.length-1-Math.abs(I||0),I>=0?this.conditionStack[I]:"INITIAL"},"topState"),pushState:b(function(I){this.begin(I)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(I,L,O,R){var A=R;switch(O){case 0:return this.pushState("shapeData"),L.yytext="",24;break;case 1:return this.pushState("shapeDataStr"),24;break;case 2:return this.popState(),24;break;case 3:let N=/\n\s*/g;return L.yytext=L.yytext.replace(N,"
"),24;break;case 4:return 24;case 5:this.popState();break;case 6:return I.getLogger().trace("Found comment",L.yytext),6;break;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;break;case 10:this.popState();break;case 11:I.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return I.getLogger().trace("SPACELINE"),6;break;case 13:return 7;case 14:return 16;case 15:I.getLogger().trace("end icon"),this.popState();break;case 16:return I.getLogger().trace("Exploding node"),this.begin("NODE"),20;break;case 17:return I.getLogger().trace("Cloud"),this.begin("NODE"),20;break;case 18:return I.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;break;case 19:return I.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;break;case 20:return this.begin("NODE"),20;break;case 21:return this.begin("NODE"),20;break;case 22:return this.begin("NODE"),20;break;case 23:return this.begin("NODE"),20;break;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 29:this.popState();break;case 30:I.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return I.getLogger().trace("description:",L.yytext),"NODE_DESCR";break;case 32:this.popState();break;case 33:return this.popState(),I.getLogger().trace("node end ))"),"NODE_DEND";break;case 34:return this.popState(),I.getLogger().trace("node end )"),"NODE_DEND";break;case 35:return this.popState(),I.getLogger().trace("node end ...",L.yytext),"NODE_DEND";break;case 36:return this.popState(),I.getLogger().trace("node end (("),"NODE_DEND";break;case 37:return this.popState(),I.getLogger().trace("node end (-"),"NODE_DEND";break;case 38:return this.popState(),I.getLogger().trace("node end (-"),"NODE_DEND";break;case 39:return this.popState(),I.getLogger().trace("node end (("),"NODE_DEND";break;case 40:return this.popState(),I.getLogger().trace("node end (("),"NODE_DEND";break;case 41:return I.getLogger().trace("Long description:",L.yytext),21;break;case 42:return I.getLogger().trace("Long description:",L.yytext),21;break}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}};return S})();C.lexer=T;function k(){this.yy={}}return b(k,"Parser"),k.prototype=C,C.Parser=k,new k})();Nae.parser=Nae;ZJt=Nae,Xu=[],Oae=[],Dae=0,Pae={},QJt=b(()=>{Xu=[],Oae=[],Dae=0,Pae={}},"clear"),JJt=b(e=>{if(Xu.length===0)return null;let t=Xu[0].level,r=null;for(let n=Xu.length-1;n>=0;n--)if(Xu[n].level===t&&!r&&(r=Xu[n]),Xu[n].levelo.parentId===i.id);for(let o of s){let l={id:o.id,parentId:i.id,label:Mr(o.label??"",n),labelType:"markdown",isGroup:!1,ticket:o?.ticket,priority:o?.priority,assigned:o?.assigned,icon:o?.icon,shape:"kanbanItem",level:o.level,rx:5,ry:5,cssStyles:["text-align: left"]};t.push(l)}}return{nodes:t,edges:e,other:{},config:Be()}},"getData"),ter=b((e,t,r,n,i)=>{let a=Be(),s=a.mindmap?.padding??Lr.mindmap.padding;switch(n){case _s.ROUNDED_RECT:case _s.RECT:case _s.HEXAGON:s*=2}let o={id:Mr(t,a)||"kbn"+Dae++,level:e,label:Mr(r,a),width:a.mindmap?.maxNodeWidth??Lr.mindmap.maxNodeWidth,padding:s,isGroup:!1};if(i!==void 0){let u;i.includes(` `)?u=i+` `:u=`{ `+i+` -}`;let h=Ym(u,{schema:Um});if(h.shape&&(h.shape!==h.shape.toLowerCase()||h.shape.includes("_")))throw new Error(`No such shape: ${h.shape}. Shape names should be lowercase.`);h?.shape&&h.shape==="kanbanItem"&&(o.shape=h?.shape),h?.label&&(o.label=h?.label),h?.icon&&(o.icon=h?.icon.toString()),h?.assigned&&(o.assigned=h?.assigned.toString()),h?.ticket&&(o.ticket=h?.ticket.toString()),h?.priority&&(o.priority=h?.priority)}let l=jJt(e);l?o.parentId=l.id||"kbn"+Mae++:Nae.push(o),Xu.push(o)},"addNode"),_s={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},QJt=b((e,t)=>{switch(se.debug("In get type",e,t),e){case"[":return _s.RECT;case"(":return t===")"?_s.ROUNDED_RECT:_s.CLOUD;case"((":return _s.CIRCLE;case")":return _s.CLOUD;case"))":return _s.BANG;case"{{":return _s.HEXAGON;default:return _s.DEFAULT}},"getType"),JJt=b((e,t)=>{Dae[e]=t},"setElementForId"),eer=b(e=>{if(!e)return;let t=Be(),r=Xu[Xu.length-1];e.icon&&(r.icon=Mr(e.icon,t)),e.class&&(r.cssClasses=Mr(e.class,t))},"decorateNode"),ter=b(e=>{switch(e){case _s.DEFAULT:return"no-border";case _s.RECT:return"rect";case _s.ROUNDED_RECT:return"rounded-rect";case _s.CIRCLE:return"circle";case _s.CLOUD:return"cloud";case _s.BANG:return"bang";case _s.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),rer=b(()=>se,"getLogger"),ner=b(e=>Dae[e],"getElementById"),ier={clear:XJt,addNode:ZJt,getSections:OQe,getData:KJt,nodeType:_s,getType:QJt,setElementForId:JJt,decorateNode:eer,type2Str:ter,getLogger:rer,getElementById:ner},aer=ier,ser=b(async(e,t,r,n)=>{se.debug(`Rendering kanban diagram -`+e);let a=n.db.getData(),s=Be();s.htmlLabels=!1;let o=Qn(t);for(let y of a.nodes)y.domId=`${t}-${y.id}`;let l=o.append("g");l.attr("class","sections");let u=o.append("g");u.attr("class","items");let h=a.nodes.filter(y=>y.isGroup),f=0,d=10,p=[],m=25;for(let y of h){let v=s?.kanban?.sectionWidth||200;f=f+1,y.x=v*f+(f-1)*d/2,y.width=v,y.y=0,y.height=v*3,y.rx=5,y.ry=5,y.cssClasses=y.cssClasses+" section-"+f;let x=await Jm(l,y);m=Math.max(m,x?.labelBBox?.height),p.push(x)}let g=0;for(let y of h){let v=p[g];g=g+1;let x=s?.kanban?.sectionWidth||200,w=-x*3/2+m,C=w,T=a.nodes.filter(E=>E.parentId===y.id);for(let E of T){if(E.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");E.x=y.x,E.width=x-1.5*d;let L=(await M0(u,E,{config:s})).node().getBBox();E.y=C+L.height/2,await Ky(E),C=E.y+L.height/2+d/2}let k=v.cluster.select("rect"),S=Math.max(C-w+3*d,50)+(m-25);k.attr("height",S)}_f(void 0,o,s.mindmap?.padding??Lr.kanban.padding,s.mindmap?.useMaxWidth??Lr.kanban.useMaxWidth)},"draw"),oer={draw:ser},ler=b(e=>{let t="";for(let n=0;ne.darkMode?ot(n,i):st(n,i),"adjuster");for(let n=0;n{switch(se.debug("In get type",e,t),e){case"[":return _s.RECT;case"(":return t===")"?_s.ROUNDED_RECT:_s.CLOUD;case"((":return _s.CIRCLE;case")":return _s.CLOUD;case"))":return _s.BANG;case"{{":return _s.HEXAGON;default:return _s.DEFAULT}},"getType"),ner=b((e,t)=>{Pae[e]=t},"setElementForId"),ier=b(e=>{if(!e)return;let t=Be(),r=Xu[Xu.length-1];e.icon&&(r.icon=Mr(e.icon,t)),e.class&&(r.cssClasses=Mr(e.class,t))},"decorateNode"),aer=b(e=>{switch(e){case _s.DEFAULT:return"no-border";case _s.RECT:return"rect";case _s.ROUNDED_RECT:return"rounded-rect";case _s.CIRCLE:return"circle";case _s.CLOUD:return"cloud";case _s.BANG:return"bang";case _s.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),ser=b(()=>se,"getLogger"),oer=b(e=>Pae[e],"getElementById"),ler={clear:QJt,addNode:ter,getSections:BQe,getData:eer,nodeType:_s,getType:rer,setElementForId:ner,decorateNode:ier,type2Str:aer,getLogger:ser,getElementById:oer},cer=ler,uer=b(async(e,t,r,n)=>{se.debug(`Rendering kanban diagram +`+e);let a=n.db.getData(),s=Be();s.htmlLabels=!1;let o=Qn(t);for(let y of a.nodes)y.domId=`${t}-${y.id}`;let l=o.append("g");l.attr("class","sections");let u=o.append("g");u.attr("class","items");let h=a.nodes.filter(y=>y.isGroup),f=0,d=10,p=[],m=25;for(let y of h){let v=s?.kanban?.sectionWidth||200;f=f+1,y.x=v*f+(f-1)*d/2,y.width=v,y.y=0,y.height=v*3,y.rx=5,y.ry=5,y.cssClasses=y.cssClasses+" section-"+f;let x=await Jm(l,y);m=Math.max(m,x?.labelBBox?.height),p.push(x)}let g=0;for(let y of h){let v=p[g];g=g+1;let x=s?.kanban?.sectionWidth||200,w=-x*3/2+m,C=w,T=a.nodes.filter(E=>E.parentId===y.id);for(let E of T){if(E.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");E.x=y.x,E.width=x-1.5*d;let L=(await M0(u,E,{config:s})).node().getBBox();E.y=C+L.height/2,await Ky(E),C=E.y+L.height/2+d/2}let k=v.cluster.select("rect"),S=Math.max(C-w+3*d,50)+(m-25);k.attr("height",S)}_f(void 0,o,s.mindmap?.padding??Lr.kanban.padding,s.mindmap?.useMaxWidth??Lr.kanban.useMaxWidth)},"draw"),her={draw:uer},fer=b(e=>{let t="";for(let n=0;ne.darkMode?ot(n,i):st(n,i),"adjuster");for(let n=0;n` + `}return t},"genSections"),der=b(e=>` .edge { stroke-width: 3; } - ${ler(e)} + ${fer(e)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${e.git0}; } @@ -2874,14 +2874,14 @@ Expecting `+Ce.join(", ")+", got '"+(this.terminals_[ee]||ee)+"'":_e="Parse erro text-align: center; } ${id()} -`,"getStyles"),uer=cer,her={db:aer,renderer:oer,parser:YJt,styles:uer}});function G6(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r=i)&&(r=i)}return r}var FQe=W(()=>{});function gk(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}var $Qe=W(()=>{});function yk(e,t){let r=0;if(t===void 0)for(let n of e)(n=+n)&&(r+=n);else{let n=-1;for(let i of e)(i=+t(i,++n,e))&&(r+=i)}return r}var zQe=W(()=>{});var Oae=W(()=>{FQe();$Qe();zQe()});function fer(e){return e.target.depth}function Pae(e){return e.depth}function Bae(e,t){return t-1-e.height}function q6(e,t){return e.sourceLinks.length?e.depth:t-1}function Fae(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?gk(e.sourceLinks,fer)-1:0}var $ae=W(()=>{Oae()});function vk(e){return function(){return e}}var GQe=W(()=>{});function qQe(e,t){return PO(e.source,t.source)||e.index-t.index}function VQe(e,t){return PO(e.target,t.target)||e.index-t.index}function PO(e,t){return e.y0-t.y0}function zae(e){return e.value}function der(e){return e.index}function per(e){return e.nodes}function mer(e){return e.links}function WQe(e,t){let r=e.get(t);if(!r)throw new Error("missing: "+t);return r}function HQe({nodes:e}){for(let t of e){let r=t.y0,n=r;for(let i of t.sourceLinks)i.y0=r+i.width/2,r+=i.width;for(let i of t.targetLinks)i.y1=n+i.width/2,n+=i.width}}function BO(){let e=0,t=0,r=1,n=1,i=24,a=8,s,o=der,l=q6,u,h,f=per,d=mer,p=6;function m(){let M={nodes:f.apply(null,arguments),links:d.apply(null,arguments)};return g(M),y(M),v(M),x(M),T(M),HQe(M),M}m.update=function(M){return HQe(M),M},m.nodeId=function(M){return arguments.length?(o=typeof M=="function"?M:vk(M),m):o},m.nodeAlign=function(M){return arguments.length?(l=typeof M=="function"?M:vk(M),m):l},m.nodeSort=function(M){return arguments.length?(u=M,m):u},m.nodeWidth=function(M){return arguments.length?(i=+M,m):i},m.nodePadding=function(M){return arguments.length?(a=s=+M,m):a},m.nodes=function(M){return arguments.length?(f=typeof M=="function"?M:vk(M),m):f},m.links=function(M){return arguments.length?(d=typeof M=="function"?M:vk(M),m):d},m.linkSort=function(M){return arguments.length?(h=M,m):h},m.size=function(M){return arguments.length?(e=t=0,r=+M[0],n=+M[1],m):[r-e,n-t]},m.extent=function(M){return arguments.length?(e=+M[0][0],r=+M[1][0],t=+M[0][1],n=+M[1][1],m):[[e,t],[r,n]]},m.iterations=function(M){return arguments.length?(p=+M,m):p};function g({nodes:M,links:D}){for(let[P,$]of M.entries())$.index=P,$.sourceLinks=[],$.targetLinks=[];let B=new Map(M.map((P,$)=>[o(P,$,M),P]));for(let[P,$]of D.entries()){$.index=P;let{source:F,target:q}=$;typeof F!="object"&&(F=$.source=WQe(B,F)),typeof q!="object"&&(q=$.target=WQe(B,q)),F.sourceLinks.push($),q.targetLinks.push($)}if(h!=null)for(let{sourceLinks:P,targetLinks:$}of M)P.sort(h),$.sort(h)}function y({nodes:M}){for(let D of M)D.value=D.fixedValue===void 0?Math.max(yk(D.sourceLinks,zae),yk(D.targetLinks,zae)):D.fixedValue}function v({nodes:M}){let D=M.length,B=new Set(M),P=new Set,$=0;for(;B.size;){for(let F of B){F.depth=$;for(let{target:q}of F.sourceLinks)P.add(q)}if(++$>D)throw new Error("circular link");B=P,P=new Set}}function x({nodes:M}){let D=M.length,B=new Set(M),P=new Set,$=0;for(;B.size;){for(let F of B){F.height=$;for(let{source:q}of F.targetLinks)P.add(q)}if(++$>D)throw new Error("circular link");B=P,P=new Set}}function w({nodes:M}){let D=G6(M,$=>$.depth)+1,B=(r-e-i)/(D-1),P=new Array(D);for(let $ of M){let F=Math.max(0,Math.min(D-1,Math.floor(l.call(null,$,D))));$.layer=F,$.x0=e+F*B,$.x1=$.x0+i,P[F]?P[F].push($):P[F]=[$]}if(u)for(let $ of P)$.sort(u);return P}function C(M){let D=gk(M,B=>(n-t-(B.length-1)*s)/yk(B,zae));for(let B of M){let P=t;for(let $ of B){$.y0=P,$.y1=P+$.value*D,P=$.y1+s;for(let F of $.sourceLinks)F.width=F.value*D}P=(n-P+s)/(B.length+1);for(let $=0;$B.length)-1)),C(D);for(let B=0;B0))continue;let H=(G/z-q.y0)*D;q.y0+=H,q.y1+=H,O(q)}u===void 0&&F.sort(PO),E(F,B)}}function S(M,D,B){for(let P=M.length,$=P-2;$>=0;--$){let F=M[$];for(let q of F){let G=0,z=0;for(let{target:j,value:J}of q.sourceLinks){let U=J*(j.layer-q.layer);G+=N(q,j)*U,z+=U}if(!(z>0))continue;let H=(G/z-q.y0)*D;q.y0+=H,q.y1+=H,O(q)}u===void 0&&F.sort(PO),E(F,B)}}function E(M,D){let B=M.length>>1,P=M[B];L(M,P.y0-s,B-1,D),I(M,P.y1+s,B+1,D),L(M,n,M.length-1,D),I(M,t,0,D)}function I(M,D,B,P){for(;B1e-6&&($.y0+=F,$.y1+=F),D=$.y1+s}}function L(M,D,B,P){for(;B>=0;--B){let $=M[B],F=($.y1-D)*P;F>1e-6&&($.y0-=F,$.y1-=F),D=$.y0-s}}function O({sourceLinks:M,targetLinks:D}){if(h===void 0){for(let{source:{sourceLinks:B}}of D)B.sort(VQe);for(let{target:{targetLinks:B}}of M)B.sort(qQe)}}function R(M){if(h===void 0)for(let{sourceLinks:D,targetLinks:B}of M)D.sort(VQe),B.sort(qQe)}function A(M,D){let B=M.y0-(M.sourceLinks.length-1)*s/2;for(let{target:P,width:$}of M.sourceLinks){if(P===D)break;B+=$+s}for(let{source:P,width:$}of D.targetLinks){if(P===M)break;B-=$}return B}function N(M,D){let B=D.y0-(D.targetLinks.length-1)*s/2;for(let{source:P,width:$}of D.targetLinks){if(P===M)break;B+=$+s}for(let{target:P,width:$}of M.sourceLinks){if(P===D)break;B-=$}return B}return m}var UQe=W(()=>{Oae();$ae();GQe()});function Vae(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function YQe(){return new Vae}var Gae,qae,z2,ger,Wae,XQe=W(()=>{Gae=Math.PI,qae=2*Gae,z2=1e-6,ger=qae-z2;Vae.prototype=YQe.prototype={constructor:Vae,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,r,n){this._+="Q"+ +e+","+ +t+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(e,t,r,n,i,a){this._+="C"+ +e+","+ +t+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(e,t,r,n,i){e=+e,t=+t,r=+r,n=+n,i=+i;var a=this._x1,s=this._y1,o=r-e,l=n-t,u=a-e,h=s-t,f=u*u+h*h;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(f>z2)if(!(Math.abs(h*o-l*u)>z2)||!i)this._+="L"+(this._x1=e)+","+(this._y1=t);else{var d=r-a,p=n-s,m=o*o+l*l,g=d*d+p*p,y=Math.sqrt(m),v=Math.sqrt(f),x=i*Math.tan((Gae-Math.acos((m+f-g)/(2*y*v)))/2),w=x/v,C=x/y;Math.abs(w-1)>z2&&(this._+="L"+(e+w*u)+","+(t+w*h)),this._+="A"+i+","+i+",0,0,"+ +(h*d>u*p)+","+(this._x1=e+C*o)+","+(this._y1=t+C*l)}},arc:function(e,t,r,n,i,a){e=+e,t=+t,r=+r,a=!!a;var s=r*Math.cos(n),o=r*Math.sin(n),l=e+s,u=t+o,h=1^a,f=a?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+l+","+u:(Math.abs(this._x1-l)>z2||Math.abs(this._y1-u)>z2)&&(this._+="L"+l+","+u),r&&(f<0&&(f=f%qae+qae),f>ger?this._+="A"+r+","+r+",0,1,"+h+","+(e-s)+","+(t-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=u):f>z2&&(this._+="A"+r+","+r+",0,"+ +(f>=Gae)+","+h+","+(this._x1=e+r*Math.cos(i))+","+(this._y1=t+r*Math.sin(i))))},rect:function(e,t,r,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};Wae=YQe});var jQe=W(()=>{XQe()});function Hae(e){return function(){return e}}var KQe=W(()=>{});function ZQe(e){return e[0]}function QQe(e){return e[1]}var JQe=W(()=>{});var eJe,tJe=W(()=>{eJe=Array.prototype.slice});function yer(e){return e.source}function ver(e){return e.target}function xer(e){var t=yer,r=ver,n=ZQe,i=QQe,a=null;function s(){var o,l=eJe.call(arguments),u=t.apply(this,l),h=r.apply(this,l);if(a||(a=o=Wae()),e(a,+n.apply(this,(l[0]=u,l)),+i.apply(this,l),+n.apply(this,(l[0]=h,l)),+i.apply(this,l)),o)return a=null,o+""||null}return s.source=function(o){return arguments.length?(t=o,s):t},s.target=function(o){return arguments.length?(r=o,s):r},s.x=function(o){return arguments.length?(n=typeof o=="function"?o:Hae(+o),s):n},s.y=function(o){return arguments.length?(i=typeof o=="function"?o:Hae(+o),s):i},s.context=function(o){return arguments.length?(a=o??null,s):a},s}function ber(e,t,r,n,i){e.moveTo(t,r),e.bezierCurveTo(t=(t+n)/2,r,t,i,n,i)}function Uae(){return xer(ber)}var rJe=W(()=>{jQe();tJe();KQe();JQe()});var nJe=W(()=>{rJe()});function wer(e){return[e.source.x1,e.y0]}function ker(e){return[e.target.x0,e.y1]}function Yae(){return Uae().source(wer).target(ker)}var iJe=W(()=>{nJe()});var aJe=W(()=>{UQe();$ae();iJe()});var oJe={};Tr(oJe,{diagram:()=>zer});var Xae,FO,zO,GO,$O,Ter,Cer,Ser,Eer,Aer,_er,Rer,Ler,Ier,sJe,Mer,Ner,Der,Oer,Per,Ber,Fer,$er,zer,lJe=W(()=>{_r();Rr();hr();fn();aJe();Xae=(function(){var e=b(function(o,l,u,h){for(u=u||{},h=o.length;h--;u[o[h]]=l);return u},"o"),t=[1,9],r=[1,10],n=[1,5,10,12],i={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:b(function(l,u,h,f,d,p,m){var g=p.length-1;switch(d){case 7:let y=f.findOrCreateNode(p[g-4].trim().replaceAll('""','"')),v=f.findOrCreateNode(p[g-2].trim().replaceAll('""','"')),x=parseFloat(p[g].trim());f.addLink(y,v,x);break;case 8:case 9:case 11:this.$=p[g];break;case 10:this.$=p[g-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:t,20:r},{1:[2,6],7:11,10:[1,12]},e(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},e(n,[2,8]),e(n,[2,9]),{19:[1,16]},e(n,[2,11]),{1:[2,1]},{1:[2,5]},e(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:t,20:r},{15:18,16:7,17:8,18:t,20:r},{18:[1,19]},e(r,[2,3]),{12:[1,20]},e(n,[2,10]),{15:21,16:7,17:8,18:t,20:r},e([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:b(function(l,u){if(u.recoverable)this.trace(l);else{var h=new Error(l);throw h.hash=u,h}},"parseError"),parse:b(function(l){var u=this,h=[0],f=[],d=[null],p=[],m=this.table,g="",y=0,v=0,x=0,w=2,C=1,T=p.slice.call(arguments,1),k=Object.create(this.lexer),S={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(S.yy[E]=this.yy[E]);k.setInput(l,S.yy),S.yy.lexer=k,S.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var I=k.yylloc;p.push(I);var L=k.options&&k.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(j){h.length=h.length-2*j,d.length=d.length-j,p.length=p.length-j}b(O,"popStack");function R(){var j;return j=f.pop()||k.lex()||C,typeof j!="number"&&(j instanceof Array&&(f=j,j=f.pop()),j=u.symbols_[j]||j),j}b(R,"lex");for(var A,N,M,D,B,P,$={},F,q,G,z;;){if(M=h[h.length-1],this.defaultActions[M]?D=this.defaultActions[M]:((A===null||typeof A>"u")&&(A=R()),D=m[M]&&m[M][A]),typeof D>"u"||!D.length||!D[0]){var H="";z=[];for(F in m[M])this.terminals_[F]&&F>w&&z.push("'"+this.terminals_[F]+"'");k.showPosition?H="Parse error on line "+(y+1)+`: +`,"getStyles"),per=der,mer={db:cer,renderer:her,parser:ZJt,styles:per}});function G6(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r=i)&&(r=i)}return r}var zQe=W(()=>{});function gk(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}var GQe=W(()=>{});function yk(e,t){let r=0;if(t===void 0)for(let n of e)(n=+n)&&(r+=n);else{let n=-1;for(let i of e)(i=+t(i,++n,e))&&(r+=i)}return r}var qQe=W(()=>{});var Bae=W(()=>{zQe();GQe();qQe()});function ger(e){return e.target.depth}function Fae(e){return e.depth}function $ae(e,t){return t-1-e.height}function q6(e,t){return e.sourceLinks.length?e.depth:t-1}function zae(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?gk(e.sourceLinks,ger)-1:0}var Gae=W(()=>{Bae()});function vk(e){return function(){return e}}var VQe=W(()=>{});function WQe(e,t){return PO(e.source,t.source)||e.index-t.index}function HQe(e,t){return PO(e.target,t.target)||e.index-t.index}function PO(e,t){return e.y0-t.y0}function qae(e){return e.value}function yer(e){return e.index}function ver(e){return e.nodes}function xer(e){return e.links}function UQe(e,t){let r=e.get(t);if(!r)throw new Error("missing: "+t);return r}function YQe({nodes:e}){for(let t of e){let r=t.y0,n=r;for(let i of t.sourceLinks)i.y0=r+i.width/2,r+=i.width;for(let i of t.targetLinks)i.y1=n+i.width/2,n+=i.width}}function BO(){let e=0,t=0,r=1,n=1,i=24,a=8,s,o=yer,l=q6,u,h,f=ver,d=xer,p=6;function m(){let M={nodes:f.apply(null,arguments),links:d.apply(null,arguments)};return g(M),y(M),v(M),x(M),T(M),YQe(M),M}m.update=function(M){return YQe(M),M},m.nodeId=function(M){return arguments.length?(o=typeof M=="function"?M:vk(M),m):o},m.nodeAlign=function(M){return arguments.length?(l=typeof M=="function"?M:vk(M),m):l},m.nodeSort=function(M){return arguments.length?(u=M,m):u},m.nodeWidth=function(M){return arguments.length?(i=+M,m):i},m.nodePadding=function(M){return arguments.length?(a=s=+M,m):a},m.nodes=function(M){return arguments.length?(f=typeof M=="function"?M:vk(M),m):f},m.links=function(M){return arguments.length?(d=typeof M=="function"?M:vk(M),m):d},m.linkSort=function(M){return arguments.length?(h=M,m):h},m.size=function(M){return arguments.length?(e=t=0,r=+M[0],n=+M[1],m):[r-e,n-t]},m.extent=function(M){return arguments.length?(e=+M[0][0],r=+M[1][0],t=+M[0][1],n=+M[1][1],m):[[e,t],[r,n]]},m.iterations=function(M){return arguments.length?(p=+M,m):p};function g({nodes:M,links:D}){for(let[P,$]of M.entries())$.index=P,$.sourceLinks=[],$.targetLinks=[];let B=new Map(M.map((P,$)=>[o(P,$,M),P]));for(let[P,$]of D.entries()){$.index=P;let{source:F,target:q}=$;typeof F!="object"&&(F=$.source=UQe(B,F)),typeof q!="object"&&(q=$.target=UQe(B,q)),F.sourceLinks.push($),q.targetLinks.push($)}if(h!=null)for(let{sourceLinks:P,targetLinks:$}of M)P.sort(h),$.sort(h)}function y({nodes:M}){for(let D of M)D.value=D.fixedValue===void 0?Math.max(yk(D.sourceLinks,qae),yk(D.targetLinks,qae)):D.fixedValue}function v({nodes:M}){let D=M.length,B=new Set(M),P=new Set,$=0;for(;B.size;){for(let F of B){F.depth=$;for(let{target:q}of F.sourceLinks)P.add(q)}if(++$>D)throw new Error("circular link");B=P,P=new Set}}function x({nodes:M}){let D=M.length,B=new Set(M),P=new Set,$=0;for(;B.size;){for(let F of B){F.height=$;for(let{source:q}of F.targetLinks)P.add(q)}if(++$>D)throw new Error("circular link");B=P,P=new Set}}function w({nodes:M}){let D=G6(M,$=>$.depth)+1,B=(r-e-i)/(D-1),P=new Array(D);for(let $ of M){let F=Math.max(0,Math.min(D-1,Math.floor(l.call(null,$,D))));$.layer=F,$.x0=e+F*B,$.x1=$.x0+i,P[F]?P[F].push($):P[F]=[$]}if(u)for(let $ of P)$.sort(u);return P}function C(M){let D=gk(M,B=>(n-t-(B.length-1)*s)/yk(B,qae));for(let B of M){let P=t;for(let $ of B){$.y0=P,$.y1=P+$.value*D,P=$.y1+s;for(let F of $.sourceLinks)F.width=F.value*D}P=(n-P+s)/(B.length+1);for(let $=0;$B.length)-1)),C(D);for(let B=0;B0))continue;let H=(G/z-q.y0)*D;q.y0+=H,q.y1+=H,O(q)}u===void 0&&F.sort(PO),E(F,B)}}function S(M,D,B){for(let P=M.length,$=P-2;$>=0;--$){let F=M[$];for(let q of F){let G=0,z=0;for(let{target:j,value:J}of q.sourceLinks){let U=J*(j.layer-q.layer);G+=N(q,j)*U,z+=U}if(!(z>0))continue;let H=(G/z-q.y0)*D;q.y0+=H,q.y1+=H,O(q)}u===void 0&&F.sort(PO),E(F,B)}}function E(M,D){let B=M.length>>1,P=M[B];L(M,P.y0-s,B-1,D),I(M,P.y1+s,B+1,D),L(M,n,M.length-1,D),I(M,t,0,D)}function I(M,D,B,P){for(;B1e-6&&($.y0+=F,$.y1+=F),D=$.y1+s}}function L(M,D,B,P){for(;B>=0;--B){let $=M[B],F=($.y1-D)*P;F>1e-6&&($.y0-=F,$.y1-=F),D=$.y0-s}}function O({sourceLinks:M,targetLinks:D}){if(h===void 0){for(let{source:{sourceLinks:B}}of D)B.sort(HQe);for(let{target:{targetLinks:B}}of M)B.sort(WQe)}}function R(M){if(h===void 0)for(let{sourceLinks:D,targetLinks:B}of M)D.sort(HQe),B.sort(WQe)}function A(M,D){let B=M.y0-(M.sourceLinks.length-1)*s/2;for(let{target:P,width:$}of M.sourceLinks){if(P===D)break;B+=$+s}for(let{source:P,width:$}of D.targetLinks){if(P===M)break;B-=$}return B}function N(M,D){let B=D.y0-(D.targetLinks.length-1)*s/2;for(let{source:P,width:$}of D.targetLinks){if(P===M)break;B+=$+s}for(let{target:P,width:$}of M.sourceLinks){if(P===D)break;B-=$}return B}return m}var XQe=W(()=>{Bae();Gae();VQe()});function Hae(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function jQe(){return new Hae}var Vae,Wae,z2,ber,Uae,KQe=W(()=>{Vae=Math.PI,Wae=2*Vae,z2=1e-6,ber=Wae-z2;Hae.prototype=jQe.prototype={constructor:Hae,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,r,n){this._+="Q"+ +e+","+ +t+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(e,t,r,n,i,a){this._+="C"+ +e+","+ +t+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(e,t,r,n,i){e=+e,t=+t,r=+r,n=+n,i=+i;var a=this._x1,s=this._y1,o=r-e,l=n-t,u=a-e,h=s-t,f=u*u+h*h;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(f>z2)if(!(Math.abs(h*o-l*u)>z2)||!i)this._+="L"+(this._x1=e)+","+(this._y1=t);else{var d=r-a,p=n-s,m=o*o+l*l,g=d*d+p*p,y=Math.sqrt(m),v=Math.sqrt(f),x=i*Math.tan((Vae-Math.acos((m+f-g)/(2*y*v)))/2),w=x/v,C=x/y;Math.abs(w-1)>z2&&(this._+="L"+(e+w*u)+","+(t+w*h)),this._+="A"+i+","+i+",0,0,"+ +(h*d>u*p)+","+(this._x1=e+C*o)+","+(this._y1=t+C*l)}},arc:function(e,t,r,n,i,a){e=+e,t=+t,r=+r,a=!!a;var s=r*Math.cos(n),o=r*Math.sin(n),l=e+s,u=t+o,h=1^a,f=a?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+l+","+u:(Math.abs(this._x1-l)>z2||Math.abs(this._y1-u)>z2)&&(this._+="L"+l+","+u),r&&(f<0&&(f=f%Wae+Wae),f>ber?this._+="A"+r+","+r+",0,1,"+h+","+(e-s)+","+(t-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=u):f>z2&&(this._+="A"+r+","+r+",0,"+ +(f>=Vae)+","+h+","+(this._x1=e+r*Math.cos(i))+","+(this._y1=t+r*Math.sin(i))))},rect:function(e,t,r,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};Uae=jQe});var ZQe=W(()=>{KQe()});function Yae(e){return function(){return e}}var QQe=W(()=>{});function JQe(e){return e[0]}function eJe(e){return e[1]}var tJe=W(()=>{});var rJe,nJe=W(()=>{rJe=Array.prototype.slice});function wer(e){return e.source}function ker(e){return e.target}function Ter(e){var t=wer,r=ker,n=JQe,i=eJe,a=null;function s(){var o,l=rJe.call(arguments),u=t.apply(this,l),h=r.apply(this,l);if(a||(a=o=Uae()),e(a,+n.apply(this,(l[0]=u,l)),+i.apply(this,l),+n.apply(this,(l[0]=h,l)),+i.apply(this,l)),o)return a=null,o+""||null}return s.source=function(o){return arguments.length?(t=o,s):t},s.target=function(o){return arguments.length?(r=o,s):r},s.x=function(o){return arguments.length?(n=typeof o=="function"?o:Yae(+o),s):n},s.y=function(o){return arguments.length?(i=typeof o=="function"?o:Yae(+o),s):i},s.context=function(o){return arguments.length?(a=o??null,s):a},s}function Cer(e,t,r,n,i){e.moveTo(t,r),e.bezierCurveTo(t=(t+n)/2,r,t,i,n,i)}function Xae(){return Ter(Cer)}var iJe=W(()=>{ZQe();nJe();QQe();tJe()});var aJe=W(()=>{iJe()});function Ser(e){return[e.source.x1,e.y0]}function Eer(e){return[e.target.x0,e.y1]}function jae(){return Xae().source(Ser).target(Eer)}var sJe=W(()=>{aJe()});var oJe=W(()=>{XQe();Gae();sJe()});var cJe={};Tr(cJe,{diagram:()=>Wer});var Kae,FO,zO,GO,$O,Aer,_er,Rer,Ler,Ier,Mer,Ner,Der,Oer,lJe,Per,Ber,Fer,$er,zer,Ger,qer,Ver,Wer,uJe=W(()=>{_r();Rr();hr();fn();oJe();Kae=(function(){var e=b(function(o,l,u,h){for(u=u||{},h=o.length;h--;u[o[h]]=l);return u},"o"),t=[1,9],r=[1,10],n=[1,5,10,12],i={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:b(function(l,u,h,f,d,p,m){var g=p.length-1;switch(d){case 7:let y=f.findOrCreateNode(p[g-4].trim().replaceAll('""','"')),v=f.findOrCreateNode(p[g-2].trim().replaceAll('""','"')),x=parseFloat(p[g].trim());f.addLink(y,v,x);break;case 8:case 9:case 11:this.$=p[g];break;case 10:this.$=p[g-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:t,20:r},{1:[2,6],7:11,10:[1,12]},e(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},e(n,[2,8]),e(n,[2,9]),{19:[1,16]},e(n,[2,11]),{1:[2,1]},{1:[2,5]},e(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:t,20:r},{15:18,16:7,17:8,18:t,20:r},{18:[1,19]},e(r,[2,3]),{12:[1,20]},e(n,[2,10]),{15:21,16:7,17:8,18:t,20:r},e([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:b(function(l,u){if(u.recoverable)this.trace(l);else{var h=new Error(l);throw h.hash=u,h}},"parseError"),parse:b(function(l){var u=this,h=[0],f=[],d=[null],p=[],m=this.table,g="",y=0,v=0,x=0,w=2,C=1,T=p.slice.call(arguments,1),k=Object.create(this.lexer),S={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(S.yy[E]=this.yy[E]);k.setInput(l,S.yy),S.yy.lexer=k,S.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var I=k.yylloc;p.push(I);var L=k.options&&k.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(j){h.length=h.length-2*j,d.length=d.length-j,p.length=p.length-j}b(O,"popStack");function R(){var j;return j=f.pop()||k.lex()||C,typeof j!="number"&&(j instanceof Array&&(f=j,j=f.pop()),j=u.symbols_[j]||j),j}b(R,"lex");for(var A,N,M,D,B,P,$={},F,q,G,z;;){if(M=h[h.length-1],this.defaultActions[M]?D=this.defaultActions[M]:((A===null||typeof A>"u")&&(A=R()),D=m[M]&&m[M][A]),typeof D>"u"||!D.length||!D[0]){var H="";z=[];for(F in m[M])this.terminals_[F]&&F>w&&z.push("'"+this.terminals_[F]+"'");k.showPosition?H="Parse error on line "+(y+1)+`: `+k.showPosition()+` Expecting `+z.join(", ")+", got '"+(this.terminals_[A]||A)+"'":H="Parse error on line "+(y+1)+": Unexpected "+(A==C?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(H,{text:k.match,token:this.terminals_[A]||A,line:k.yylineno,loc:I,expected:z})}if(D[0]instanceof Array&&D.length>1)throw new Error("Parse Error: multiple actions possible at state: "+M+", token: "+A);switch(D[0]){case 1:h.push(A),d.push(k.yytext),p.push(k.yylloc),h.push(D[1]),A=null,N?(A=N,N=null):(v=k.yyleng,g=k.yytext,y=k.yylineno,I=k.yylloc,x>0&&x--);break;case 2:if(q=this.productions_[D[1]][1],$.$=d[d.length-q],$._$={first_line:p[p.length-(q||1)].first_line,last_line:p[p.length-1].last_line,first_column:p[p.length-(q||1)].first_column,last_column:p[p.length-1].last_column},L&&($._$.range=[p[p.length-(q||1)].range[0],p[p.length-1].range[1]]),P=this.performAction.apply($,[g,v,y,S.yy,D[1],d,p].concat(T)),typeof P<"u")return P;q&&(h=h.slice(0,-1*q*2),d=d.slice(0,-1*q),p=p.slice(0,-1*q)),h.push(this.productions_[D[1]][0]),d.push($.$),p.push($._$),G=m[h[h.length-2]][h[h.length-1]],h.push(G);break;case 3:return!0}}return!0},"parse")},a=(function(){var o={EOF:1,parseError:b(function(u,h){if(this.yy.parser)this.yy.parser.parseError(u,h);else throw new Error(u)},"parseError"),setInput:b(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:b(function(l){var u=l.length,h=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===f.length?this.yylloc.first_column:0)+f[f.length-h.length].length-h[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(l){this.unput(this.match.slice(l))},"less"),pastInput:b(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+` `+u+"^"},"showPosition"),test_match:b(function(l,u){var h,f,d;if(this.options.backtrack_lexer&&(d={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(d.yylloc.range=this.yylloc.range.slice(0))),f=l[0].match(/(?:\r\n?|\n).*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+l[0].length},this.yytext+=l[0],this.match+=l[0],this.matches=l,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(l[0].length),this.matched+=l[0],h=this.performAction.call(this,this.yy,this,u,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),h)return h;if(this._backtrack){for(var p in d)this[p]=d[p];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var l,u,h,f;this._more||(this.yytext="",this.match="");for(var d=this._currentRules(),p=0;pu[0].length)){if(u=h,f=p,this.options.backtrack_lexer){if(l=this.test_match(h,d[p]),l!==!1)return l;if(this._backtrack){u=!1;continue}else return!1}else if(!this.options.flex)break}return u?(l=this.test_match(u,d[f]),l!==!1?l:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var u=this.next();return u||this.lex()},"lex"),begin:b(function(u){this.conditionStack.push(u)},"begin"),popState:b(function(){var u=this.conditionStack.length-1;return u>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(u){return u=this.conditionStack.length-1-Math.abs(u||0),u>=0?this.conditionStack[u]:"INITIAL"},"topState"),pushState:b(function(u){this.begin(u)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(u,h,f,d){var p=d;switch(f){case 0:return this.pushState("csv"),4;break;case 1:return this.pushState("csv"),4;break;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;break;case 6:return 20;case 7:return this.popState("escaped_text"),18;break;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return o})();i.lexer=a;function s(){this.yy={}}return b(s,"Parser"),s.prototype=i,i.Parser=s,new s})();Xae.parser=Xae;FO=Xae,zO=[],GO=[],$O=new Map,Ter=b(()=>{zO=[],GO=[],$O=new Map,Nr()},"clear"),Cer=class{constructor(e,t,r=0){this.source=e,this.target=t,this.value=r}static{b(this,"SankeyLink")}},Ser=b((e,t,r)=>{zO.push(new Cer(e,t,r))},"addLink"),Eer=class{constructor(e){this.ID=e}static{b(this,"SankeyNode")}},Aer=b(e=>{e=Ct.sanitizeText(e,Be());let t=$O.get(e);return t===void 0&&(t=new Eer(e),$O.set(e,t),GO.push(t)),t},"findOrCreateNode"),_er=b(()=>GO,"getNodes"),Rer=b(()=>zO,"getLinks"),Ler=b(()=>({nodes:GO.map(e=>({id:e.ID})),links:zO.map(e=>({source:e.source.ID,target:e.target.ID,value:e.value}))}),"getGraph"),Ier={nodesMap:$O,getConfig:b(()=>Be().sankey,"getConfig"),getNodes:_er,getLinks:Rer,getGraph:Ler,addLink:Ser,findOrCreateNode:Aer,getAccTitle:Qr,setAccTitle:Yr,getAccDescription:en,setAccDescription:Jr,getDiagramTitle:tn,setDiagramTitle:ln,clear:Ter},sJe=class jae{static{b(this,"Uid")}static{this.count=0}static next(t){return new jae(t+ ++jae.count)}constructor(t){this.id=t,this.href=`#${t}`}toString(){return"url("+this.href+")"}},Mer={left:Pae,right:Bae,center:Fae,justify:q6},Ner=b(e=>{let t=0,r=0;for(let n of e){let i=n.value??0;i>t&&(t=i,r=n.layer??0)}return r},"findCentralNodeLayer"),Der=b(function(e,t,r,n){let{securityLevel:i,sankey:a}=Be(),s=l9.sankey,o;i==="sandbox"&&(o=ct("#i"+t));let l=i==="sandbox"?ct(o.nodes()[0].contentDocument.body):ct("body"),u=i==="sandbox"?l.select(`[id="${t}"]`):ct(`[id="${t}"]`),h=a?.width??s.width,f=a?.height??s.width,d=a?.useMaxWidth??s.useMaxWidth,p=a?.nodeAlignment??s.nodeAlignment,m=a?.prefix??s.prefix,g=a?.suffix??s.suffix,y=a?.showValues??s.showValues,v=a?.nodeWidth??s.nodeWidth??10,x=a?.nodePadding??s.nodePadding??12,w=a?.labelStyle??s.labelStyle??"legacy",C=a?.nodeColors??{},T=n.db.getGraph(),k=Mer[p];BO().nodeId(P=>P.id).nodeWidth(v).nodePadding(x+(y?15:0)).nodeAlign(k).extent([[0,0],[h,f]])(T);let E=Ner(T.nodes),I=Pc(TH),L=b(P=>C[P]??I(P),"getNodeColor");u.append("g").attr("class","nodes").selectAll(".node").data(T.nodes).join("g").attr("class","node").attr("id",P=>(P.uid=sJe.next("node-")).id).attr("transform",function(P){return"translate("+P.x0+","+P.y0+")"}).attr("x",P=>P.x0).attr("y",P=>P.y0).append("rect").attr("height",P=>P.y1-P.y0).attr("width",P=>P.x1-P.x0).attr("fill",P=>L(P.id));let O=b(({id:P,value:$})=>y?`${P} -${m}${Math.round($*100)/100}${g}`:P,"getText"),R=b(P=>w==="outlined"?(P.layer??0)A.selectAll(P?`.${P}`:"text").data(T.nodes).join("text").attr("class",P??null).attr("x",$=>R($).x).attr("y",$=>($.y1+$.y0)/2).attr("dy",`${y?"0":"0.35"}em`).attr("text-anchor",$=>R($).anchor).text(O),"appendLabel");w==="outlined"?(N("sankey-label-bg"),N("sankey-label-fg")):N();let M=u.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(T.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),D=a?.linkColor??"gradient";if(D==="gradient"){let P=M.append("linearGradient").attr("id",$=>($.uid=sJe.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",$=>$.source.x1).attr("x2",$=>$.target.x0);P.append("stop").attr("offset","0%").attr("stop-color",$=>L($.source.id)),P.append("stop").attr("offset","100%").attr("stop-color",$=>L($.target.id))}let B;switch(D){case"gradient":B=b(P=>P.uid,"coloring");break;case"source":B=b(P=>L(P.source.id),"coloring");break;case"target":B=b(P=>L(P.target.id),"coloring");break;default:B=D}M.append("path").attr("d",Yae()).attr("stroke",B).attr("stroke-width",P=>Math.max(1,P.width)),_f(void 0,u,0,d)},"draw"),Oer={draw:Der},Per=b(e=>e.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,` -`).trim(),"prepareTextForParsing"),Ber=b(e=>`.label { +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var u=this.next();return u||this.lex()},"lex"),begin:b(function(u){this.conditionStack.push(u)},"begin"),popState:b(function(){var u=this.conditionStack.length-1;return u>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(u){return u=this.conditionStack.length-1-Math.abs(u||0),u>=0?this.conditionStack[u]:"INITIAL"},"topState"),pushState:b(function(u){this.begin(u)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(u,h,f,d){var p=d;switch(f){case 0:return this.pushState("csv"),4;break;case 1:return this.pushState("csv"),4;break;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;break;case 6:return 20;case 7:return this.popState("escaped_text"),18;break;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return o})();i.lexer=a;function s(){this.yy={}}return b(s,"Parser"),s.prototype=i,i.Parser=s,new s})();Kae.parser=Kae;FO=Kae,zO=[],GO=[],$O=new Map,Aer=b(()=>{zO=[],GO=[],$O=new Map,Nr()},"clear"),_er=class{constructor(e,t,r=0){this.source=e,this.target=t,this.value=r}static{b(this,"SankeyLink")}},Rer=b((e,t,r)=>{zO.push(new _er(e,t,r))},"addLink"),Ler=class{constructor(e){this.ID=e}static{b(this,"SankeyNode")}},Ier=b(e=>{e=Ct.sanitizeText(e,Be());let t=$O.get(e);return t===void 0&&(t=new Ler(e),$O.set(e,t),GO.push(t)),t},"findOrCreateNode"),Mer=b(()=>GO,"getNodes"),Ner=b(()=>zO,"getLinks"),Der=b(()=>({nodes:GO.map(e=>({id:e.ID})),links:zO.map(e=>({source:e.source.ID,target:e.target.ID,value:e.value}))}),"getGraph"),Oer={nodesMap:$O,getConfig:b(()=>Be().sankey,"getConfig"),getNodes:Mer,getLinks:Ner,getGraph:Der,addLink:Rer,findOrCreateNode:Ier,getAccTitle:Qr,setAccTitle:Yr,getAccDescription:en,setAccDescription:Jr,getDiagramTitle:tn,setDiagramTitle:ln,clear:Aer},lJe=class Zae{static{b(this,"Uid")}static{this.count=0}static next(t){return new Zae(t+ ++Zae.count)}constructor(t){this.id=t,this.href=`#${t}`}toString(){return"url("+this.href+")"}},Per={left:Fae,right:$ae,center:zae,justify:q6},Ber=b(e=>{let t=0,r=0;for(let n of e){let i=n.value??0;i>t&&(t=i,r=n.layer??0)}return r},"findCentralNodeLayer"),Fer=b(function(e,t,r,n){let{securityLevel:i,sankey:a}=Be(),s=l9.sankey,o;i==="sandbox"&&(o=ct("#i"+t));let l=i==="sandbox"?ct(o.nodes()[0].contentDocument.body):ct("body"),u=i==="sandbox"?l.select(`[id="${t}"]`):ct(`[id="${t}"]`),h=a?.width??s.width,f=a?.height??s.width,d=a?.useMaxWidth??s.useMaxWidth,p=a?.nodeAlignment??s.nodeAlignment,m=a?.prefix??s.prefix,g=a?.suffix??s.suffix,y=a?.showValues??s.showValues,v=a?.nodeWidth??s.nodeWidth??10,x=a?.nodePadding??s.nodePadding??12,w=a?.labelStyle??s.labelStyle??"legacy",C=a?.nodeColors??{},T=n.db.getGraph(),k=Per[p];BO().nodeId(P=>P.id).nodeWidth(v).nodePadding(x+(y?15:0)).nodeAlign(k).extent([[0,0],[h,f]])(T);let E=Ber(T.nodes),I=Pc(SH),L=b(P=>C[P]??I(P),"getNodeColor");u.append("g").attr("class","nodes").selectAll(".node").data(T.nodes).join("g").attr("class","node").attr("id",P=>(P.uid=lJe.next("node-")).id).attr("transform",function(P){return"translate("+P.x0+","+P.y0+")"}).attr("x",P=>P.x0).attr("y",P=>P.y0).append("rect").attr("height",P=>P.y1-P.y0).attr("width",P=>P.x1-P.x0).attr("fill",P=>L(P.id));let O=b(({id:P,value:$})=>y?`${P} +${m}${Math.round($*100)/100}${g}`:P,"getText"),R=b(P=>w==="outlined"?(P.layer??0)A.selectAll(P?`.${P}`:"text").data(T.nodes).join("text").attr("class",P??null).attr("x",$=>R($).x).attr("y",$=>($.y1+$.y0)/2).attr("dy",`${y?"0":"0.35"}em`).attr("text-anchor",$=>R($).anchor).text(O),"appendLabel");w==="outlined"?(N("sankey-label-bg"),N("sankey-label-fg")):N();let M=u.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(T.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),D=a?.linkColor??"gradient";if(D==="gradient"){let P=M.append("linearGradient").attr("id",$=>($.uid=lJe.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",$=>$.source.x1).attr("x2",$=>$.target.x0);P.append("stop").attr("offset","0%").attr("stop-color",$=>L($.source.id)),P.append("stop").attr("offset","100%").attr("stop-color",$=>L($.target.id))}let B;switch(D){case"gradient":B=b(P=>P.uid,"coloring");break;case"source":B=b(P=>L(P.source.id),"coloring");break;case"target":B=b(P=>L(P.target.id),"coloring");break;default:B=D}M.append("path").attr("d",jae()).attr("stroke",B).attr("stroke-width",P=>Math.max(1,P.width)),_f(void 0,u,0,d)},"draw"),$er={draw:Fer},zer=b(e=>e.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,` +`).trim(),"prepareTextForParsing"),Ger=b(e=>`.label { font-family: ${e.fontFamily}; } @@ -2913,7 +2913,7 @@ ${m}${Math.round($*100)/100}${g}`:P,"getText"),R=b(P=>w==="outlined"?(P.layer??0 stroke-opacity: 0.5; mix-blend-mode: multiply; } -`,"getStyles"),Fer=Ber,$er=FO.parse.bind(FO);FO.parse=e=>$er(Per(e));zer={styles:Fer,parser:FO,db:Ier,renderer:Oer}});var hJe={};Tr(hJe,{diagram:()=>Ker});var Ger,cJe,qer,Ver,Wer,uJe,Her,Uer,Yer,Xer,jer,Ker,fJe=W(()=>{Sl();za();Sn();_r();Rr();hr();Co();Ger=Lr.packet,cJe=class{constructor(){this.packet=[],this.setAccTitle=Yr,this.getAccTitle=Qr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getAccDescription=en,this.setAccDescription=Jr}static{b(this,"PacketDB")}getConfig(){let e=Rn({...Ger,...qt().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){Nr(),this.packet=[]}},qer=1e4,Ver=b((e,t)=>{wi(e,t);let r=-1,n=[],i=1,{bitsPerRow:a}=t.getConfig();for(let{start:s,end:o,bits:l,label:u}of e.blocks){if(s!==void 0&&o!==void 0&&o{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*r)return[e,void 0];let n=t*r-1,i=t*r;return[{start:e.start,end:n,label:e.label,bits:n-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},"getNextFittingBlock"),uJe={parser:{yy:void 0},parse:b(async e=>{let t=await ba("packet",e),r=uJe.parser?.yy;if(!(r instanceof cJe))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");se.debug(t),Ver(t,r)},"parse")},Her=b((e,t,r,n)=>{let i=n.db,a=i.getConfig(),{rowHeight:s,paddingY:o,bitWidth:l,bitsPerRow:u}=a,h=i.getPacket(),f=i.getDiagramTitle(),d=s+o,p=d*(h.length+1)-(f?0:s),m=l*u+2,g=Qn(t);g.attr("viewBox",`0 0 ${m} ${p}`),vn(g,p,m,a.useMaxWidth);for(let[y,v]of h.entries())Uer(g,v,y,a);g.append("text").text(f).attr("x",m/2).attr("y",p-d/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),Uer=b((e,t,r,{rowHeight:n,paddingX:i,paddingY:a,bitWidth:s,bitsPerRow:o,showBits:l})=>{let u=e.append("g"),h=r*(n+a)+a;for(let f of t){let d=f.start%o*s+1,p=(f.end-f.start+1)*s-i;if(u.append("rect").attr("x",d).attr("y",h).attr("width",p).attr("height",n).attr("class","packetBlock"),u.append("text").attr("x",d+p/2).attr("y",h+n/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(f.label),!l)continue;let m=f.end===f.start,g=h-2;u.append("text").attr("x",d+(m?p/2:0)).attr("y",g).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",m?"middle":"start").text(f.start),m||u.append("text").attr("x",d+p).attr("y",g).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(f.end)}},"drawWord"),Yer={draw:Her},Xer={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},jer=b(({packet:e}={})=>{let t=Rn(Xer,e);return` +`,"getStyles"),qer=Ger,Ver=FO.parse.bind(FO);FO.parse=e=>Ver(zer(e));Wer={styles:qer,parser:FO,db:Oer,renderer:$er}});var dJe={};Tr(dJe,{diagram:()=>etr});var Her,hJe,Uer,Yer,Xer,fJe,jer,Ker,Zer,Qer,Jer,etr,pJe=W(()=>{El();za();Sn();_r();Rr();hr();Co();Her=Lr.packet,hJe=class{constructor(){this.packet=[],this.setAccTitle=Yr,this.getAccTitle=Qr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getAccDescription=en,this.setAccDescription=Jr}static{b(this,"PacketDB")}getConfig(){let e=Rn({...Her,...qt().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){Nr(),this.packet=[]}},Uer=1e4,Yer=b((e,t)=>{wi(e,t);let r=-1,n=[],i=1,{bitsPerRow:a}=t.getConfig();for(let{start:s,end:o,bits:l,label:u}of e.blocks){if(s!==void 0&&o!==void 0&&o{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*r)return[e,void 0];let n=t*r-1,i=t*r;return[{start:e.start,end:n,label:e.label,bits:n-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},"getNextFittingBlock"),fJe={parser:{yy:void 0},parse:b(async e=>{let t=await ba("packet",e),r=fJe.parser?.yy;if(!(r instanceof hJe))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");se.debug(t),Yer(t,r)},"parse")},jer=b((e,t,r,n)=>{let i=n.db,a=i.getConfig(),{rowHeight:s,paddingY:o,bitWidth:l,bitsPerRow:u}=a,h=i.getPacket(),f=i.getDiagramTitle(),d=s+o,p=d*(h.length+1)-(f?0:s),m=l*u+2,g=Qn(t);g.attr("viewBox",`0 0 ${m} ${p}`),vn(g,p,m,a.useMaxWidth);for(let[y,v]of h.entries())Ker(g,v,y,a);g.append("text").text(f).attr("x",m/2).attr("y",p-d/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),Ker=b((e,t,r,{rowHeight:n,paddingX:i,paddingY:a,bitWidth:s,bitsPerRow:o,showBits:l})=>{let u=e.append("g"),h=r*(n+a)+a;for(let f of t){let d=f.start%o*s+1,p=(f.end-f.start+1)*s-i;if(u.append("rect").attr("x",d).attr("y",h).attr("width",p).attr("height",n).attr("class","packetBlock"),u.append("text").attr("x",d+p/2).attr("y",h+n/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(f.label),!l)continue;let m=f.end===f.start,g=h-2;u.append("text").attr("x",d+(m?p/2:0)).attr("y",g).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",m?"middle":"start").text(f.start),m||u.append("text").attr("x",d+p).attr("y",g).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(f.end)}},"drawWord"),Zer={draw:jer},Qer={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},Jer=b(({packet:e}={})=>{let t=Rn(Qer,e);return` .packetByte { font-size: ${t.byteFontSize}; } @@ -2936,7 +2936,7 @@ ${m}${Math.round($*100)/100}${g}`:P,"getText"),R=b(P=>w==="outlined"?(P.layer??0 stroke-width: ${t.blockStrokeWidth}; fill: ${t.blockFillColor}; } - `},"styles"),Ker={parser:uJe,get db(){return new cJe},renderer:Yer,styles:jer}});var xJe={};Tr(xJe,{diagram:()=>gtr});function mJe(e,t,r,n,i,a,s){let o=t.length,l=Math.min(s.width,s.height)/2;r.forEach((u,h)=>{if(u.entries.length!==o)return;let f=u.entries.map((d,p)=>{let m=2*Math.PI*p/o-Math.PI/2,g=gJe(d,n,i,l),y=g*Math.cos(m),v=g*Math.sin(m);return{x:y,y:v}});a==="circle"?e.append("path").attr("d",yJe(f,s.curveTension)).attr("class",`radarCurve-${h}`):a==="polygon"&&e.append("polygon").attr("points",f.map(d=>`${d.x},${d.y}`).join(" ")).attr("class",`radarCurve-${h}`)})}function gJe(e,t,r,n){let i=Math.min(Math.max(e,t),r);return n*(i-t)/(r-t)}function yJe(e,t){let r=e.length,n=`M${e[0].x},${e[0].y}`;for(let i=0;i{let u=e.append("g").attr("transform",`translate(${i}, ${a+l*s})`);u.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${l}`),u.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}var xk,dJe,G2,Zer,Qer,pJe,Jer,etr,ttr,rtr,ntr,itr,atr,V6,str,otr,ltr,ctr,utr,htr,ftr,dtr,ptr,mtr,gtr,bJe=W(()=>{Sl();za();Sn();_r();Rr();hr();Co();xk={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},dJe={axes:[],curves:[],options:xk},G2=structuredClone(dJe),Zer=Lr.radar,Qer=b(()=>Rn({...Zer,...qt().radar}),"getConfig"),pJe=b(()=>G2.axes,"getAxes"),Jer=b(()=>G2.curves,"getCurves"),etr=b(()=>G2.options,"getOptions"),ttr=b(e=>{G2.axes=e.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),rtr=b(e=>{G2.curves=e.map(t=>({name:t.name,label:t.label??t.name,entries:ntr(t.entries)}))},"setCurves"),ntr=b(e=>{if(e[0].axis==null)return e.map(r=>r.value);let t=pJe();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(r=>{let n=e.find(i=>i.axis?.$refText===r.name);if(n===void 0)throw new Error("Missing entry for axis "+r.label);return n.value})},"computeCurveEntries"),itr=b(e=>{let t=e.reduce((r,n)=>(r[n.name]=n,r),{});G2.options={showLegend:t.showLegend?.value??xk.showLegend,ticks:t.ticks?.value??xk.ticks,max:t.max?.value??xk.max,min:t.min?.value??xk.min,graticule:t.graticule?.value??xk.graticule}},"setOptions"),atr=b(()=>{Nr(),G2=structuredClone(dJe)},"clear"),V6={getAxes:pJe,getCurves:Jer,getOptions:etr,setAxes:ttr,setCurves:rtr,setOptions:itr,getConfig:Qer,clear:atr,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},str=b(e=>{wi(e,V6);let{axes:t,curves:r,options:n}=e;V6.setAxes(t),V6.setCurves(r),V6.setOptions(n)},"populate"),otr={parse:b(async e=>{let t=await ba("radar",e);se.debug(t),str(t)},"parse")},ltr=b((e,t,r,n)=>{let i=n.db,a=i.getAxes(),s=i.getCurves(),o=i.getOptions(),l=i.getConfig(),u=i.getDiagramTitle(),h=Qn(t),f=ctr(h,l),d=o.max??Math.max(...s.map(g=>Math.max(...g.entries))),p=o.min,m=Math.min(l.width,l.height)/2;utr(f,a,m,o.ticks,o.graticule),htr(f,a,m,l),mJe(f,a,s,p,d,o.graticule,l),vJe(f,s,o.showLegend,l),f.append("text").attr("class","radarTitle").text(u).attr("x",0).attr("y",-l.height/2-l.marginTop)},"draw"),ctr=b((e,t)=>{let r=t.width+t.marginLeft+t.marginRight,n=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return vn(e,n,r,t.useMaxWidth??!0),e.attr("viewBox",`0 0 ${r} ${n}`).attr("overflow","visible"),e.append("g").attr("transform",`translate(${i.x}, ${i.y})`)},"drawFrame"),utr=b((e,t,r,n,i)=>{if(i==="circle")for(let a=0;a{let f=2*h*Math.PI/a-Math.PI/2,d=o*Math.cos(f),p=o*Math.sin(f);return`${d},${p}`}).join(" ");e.append("polygon").attr("points",l).attr("class","radarGraticule")}}},"drawGraticule"),htr=b((e,t,r,n)=>{let i=t.length;for(let a=0;a.01?"start":l<-.01?"end":"middle",f=u>.01?"hanging":u<-.01?"auto":"central",d=4;e.append("text").text(s).attr("x",r*n.axisLabelFactor*l+d*l).attr("y",r*n.axisLabelFactor*u+d*u).attr("text-anchor",h).attr("dominant-baseline",f).attr("class","radarAxisLabel")}},"drawAxes");b(mJe,"drawCurves");b(gJe,"relativeRadius");b(yJe,"closedRoundCurve");b(vJe,"drawLegend");ftr={draw:ltr},dtr=b((e,t)=>{let r="";for(let n=0;nbtr});function yJe(e,t,r,n,i,a,s){let o=t.length,l=Math.min(s.width,s.height)/2;r.forEach((u,h)=>{if(u.entries.length!==o)return;let f=u.entries.map((d,p)=>{let m=2*Math.PI*p/o-Math.PI/2,g=vJe(d,n,i,l),y=g*Math.cos(m),v=g*Math.sin(m);return{x:y,y:v}});a==="circle"?e.append("path").attr("d",xJe(f,s.curveTension)).attr("class",`radarCurve-${h}`):a==="polygon"&&e.append("polygon").attr("points",f.map(d=>`${d.x},${d.y}`).join(" ")).attr("class",`radarCurve-${h}`)})}function vJe(e,t,r,n){let i=Math.min(Math.max(e,t),r);return n*(i-t)/(r-t)}function xJe(e,t){let r=e.length,n=`M${e[0].x},${e[0].y}`;for(let i=0;i{let u=e.append("g").attr("transform",`translate(${i}, ${a+l*s})`);u.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${l}`),u.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}var xk,mJe,G2,ttr,rtr,gJe,ntr,itr,atr,str,otr,ltr,ctr,V6,utr,htr,ftr,dtr,ptr,mtr,gtr,ytr,vtr,xtr,btr,kJe=W(()=>{El();za();Sn();_r();Rr();hr();Co();xk={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},mJe={axes:[],curves:[],options:xk},G2=structuredClone(mJe),ttr=Lr.radar,rtr=b(()=>Rn({...ttr,...qt().radar}),"getConfig"),gJe=b(()=>G2.axes,"getAxes"),ntr=b(()=>G2.curves,"getCurves"),itr=b(()=>G2.options,"getOptions"),atr=b(e=>{G2.axes=e.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),str=b(e=>{G2.curves=e.map(t=>({name:t.name,label:t.label??t.name,entries:otr(t.entries)}))},"setCurves"),otr=b(e=>{if(e[0].axis==null)return e.map(r=>r.value);let t=gJe();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(r=>{let n=e.find(i=>i.axis?.$refText===r.name);if(n===void 0)throw new Error("Missing entry for axis "+r.label);return n.value})},"computeCurveEntries"),ltr=b(e=>{let t=e.reduce((r,n)=>(r[n.name]=n,r),{});G2.options={showLegend:t.showLegend?.value??xk.showLegend,ticks:t.ticks?.value??xk.ticks,max:t.max?.value??xk.max,min:t.min?.value??xk.min,graticule:t.graticule?.value??xk.graticule}},"setOptions"),ctr=b(()=>{Nr(),G2=structuredClone(mJe)},"clear"),V6={getAxes:gJe,getCurves:ntr,getOptions:itr,setAxes:atr,setCurves:str,setOptions:ltr,getConfig:rtr,clear:ctr,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},utr=b(e=>{wi(e,V6);let{axes:t,curves:r,options:n}=e;V6.setAxes(t),V6.setCurves(r),V6.setOptions(n)},"populate"),htr={parse:b(async e=>{let t=await ba("radar",e);se.debug(t),utr(t)},"parse")},ftr=b((e,t,r,n)=>{let i=n.db,a=i.getAxes(),s=i.getCurves(),o=i.getOptions(),l=i.getConfig(),u=i.getDiagramTitle(),h=Qn(t),f=dtr(h,l),d=o.max??Math.max(...s.map(g=>Math.max(...g.entries))),p=o.min,m=Math.min(l.width,l.height)/2;ptr(f,a,m,o.ticks,o.graticule),mtr(f,a,m,l),yJe(f,a,s,p,d,o.graticule,l),bJe(f,s,o.showLegend,l),f.append("text").attr("class","radarTitle").text(u).attr("x",0).attr("y",-l.height/2-l.marginTop)},"draw"),dtr=b((e,t)=>{let r=t.width+t.marginLeft+t.marginRight,n=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return vn(e,n,r,t.useMaxWidth??!0),e.attr("viewBox",`0 0 ${r} ${n}`).attr("overflow","visible"),e.append("g").attr("transform",`translate(${i.x}, ${i.y})`)},"drawFrame"),ptr=b((e,t,r,n,i)=>{if(i==="circle")for(let a=0;a{let f=2*h*Math.PI/a-Math.PI/2,d=o*Math.cos(f),p=o*Math.sin(f);return`${d},${p}`}).join(" ");e.append("polygon").attr("points",l).attr("class","radarGraticule")}}},"drawGraticule"),mtr=b((e,t,r,n)=>{let i=t.length;for(let a=0;a.01?"start":l<-.01?"end":"middle",f=u>.01?"hanging":u<-.01?"auto":"central",d=4;e.append("text").text(s).attr("x",r*n.axisLabelFactor*l+d*l).attr("y",r*n.axisLabelFactor*u+d*u).attr("text-anchor",h).attr("dominant-baseline",f).attr("class","radarAxisLabel")}},"drawAxes");b(yJe,"drawCurves");b(vJe,"relativeRadius");b(xJe,"closedRoundCurve");b(bJe,"drawLegend");gtr={draw:ftr},ytr=b((e,t)=>{let r="";for(let n=0;nw==="outlined"?(P.layer??0 fill-opacity: ${t.curveOpacity}; stroke: ${i}; } - `}return r},"genIndexStyles"),ptr=b(e=>{let t=Go(),r=qt(),n=Rn(t,r.themeVariables),i=Rn(n.radar,e);return{themeVariables:n,radarOptions:i}},"buildRadarStyleOptions"),mtr=b(({radar:e}={})=>{let{themeVariables:t,radarOptions:r}=ptr(e);return` + `}return r},"genIndexStyles"),vtr=b(e=>{let t=Go(),r=qt(),n=Rn(t,r.themeVariables),i=Rn(n.radar,e);return{themeVariables:n,radarOptions:i}},"buildRadarStyleOptions"),xtr=b(({radar:e}={})=>{let{themeVariables:t,radarOptions:r}=vtr(e);return` .radarTitle { font-size: ${t.fontSize}; color: ${t.titleColor}; @@ -2975,13 +2975,13 @@ ${m}${Math.round($*100)/100}${g}`:P,"getText"),R=b(P=>w==="outlined"?(P.layer??0 font-size: ${r.legendFontSize}px; dominant-baseline: hanging; } - ${dtr(t,r)} - `},"styles"),gtr={parser:otr,db:V6,renderer:ftr,styles:mtr}});var ZJe={};Tr(ZJe,{diagram:()=>qrr});function MJe(e){switch(se.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return se.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}function NJe(e){return se.debug("typeStr2Type",e),e==="=="?"thick":"normal"}function DJe(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}function OJe(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}function PJe(e){return e.includes("==")?"thick":"normal"}function BJe(e){return e.includes(".-")?"dotted":"solid"}function Jae(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};let r=t%e,n=Math.floor(t/e);return{px:r,py:n}}function WO(e,t,r=0,n=0,i=8){se.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",r),e?.size?.width||(e.size={width:r,height:n,x:0,y:0});let a=0,s=0;if(e.children?.length>0){for(let m of e.children)WO(m,t,0,0,i);let o=Qtr(e);a=o.width,s=o.height,se.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",a,s);for(let m of e.children)m.size&&(se.debug(`abc95 Setting size of children of ${e.id} id=${m.id} ${a} ${s} ${JSON.stringify(m.size)}`),m.size.width=a*(m.widthInColumns??1)+i*((m.widthInColumns??1)-1),m.size.height=s,m.size.x=0,m.size.y=0,se.debug(`abc95 updating size of ${e.id} children child:${m.id} maxWidth:${a} maxHeight:${s}`));for(let m of e.children)WO(m,t,a,s,i);let l=e.columns??-1,u=0;for(let m of e.children)u+=m.widthInColumns??1;let h=e.children.length;l>0&&l0?Math.min(e.children.length,l):e.children.length;if(m>0){let g=(d-m*i-i)/m;se.debug("abc95 (growing to fit) width",e.id,d,e.size?.width,g);for(let y of e.children)y.size&&(y.size.width=g)}}e.size={width:d,height:p,x:0,y:0}}se.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}function ase(e,t,r=8){se.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let n=e.columns??-1;if(se.debug("layoutBlocks columns abc95",e.id,"=>",n,e),e.children&&e.children.length>0){let i=e?.children[0]?.size?.width??0,a=e.children.length*i+(e.children.length-1)*r;se.debug("widthOfChildren 88",a,"posX");let s=new Map;{let f=0;for(let d of e.children){if(!d.size)continue;let{py:p}=Jae(n,f),m=s.get(p)??0;d.size.height>m&&s.set(p,d.size.height);let g=d?.widthInColumns??1;n>0&&(g=Math.min(g,n-f%n)),f+=g}}let o=new Map;{let f=0,d=[...s.keys()].sort((p,m)=>p-m);for(let p of d)o.set(p,f),f+=(s.get(p)??0)+r}let l=0;se.debug("abc91 block?.size?.x",e.id,e?.size?.x);let u=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-r,h=0;for(let f of e.children){let d=e;if(!f.size)continue;let{width:p,height:m}=f.size,{px:g,py:y}=Jae(n,l);if(y!=h&&(h=y,u=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-r,se.debug("New row in layout for block",e.id," and child ",f.id,h)),se.debug(`abc89 layout blocks (child) id: ${f.id} Pos: ${l} (px, py) ${g},${y} (${d?.size?.x},${d?.size?.y}) parent: ${d.id} width: ${p}${r}`),d.size){let x=p/2;f.size.x=u+r+x,se.debug(`abc91 layout blocks (calc) px, pyid:${f.id} startingPos=X${u} new startingPosX${f.size.x} ${x} padding=${r} width=${p} halfWidth=${x} => x:${f.size.x} y:${f.size.y} ${f.widthInColumns} (width * (child?.w || 1)) / 2 ${p*(f?.widthInColumns??1)/2}`),u=f.size.x+x;let w=o.get(y)??0,C=s.get(y)??m;f.size.y=d.size.y-d.size.height/2+w+C/2+r,se.debug(`abc88 layout blocks (calc) px, pyid:${f.id}startingPosX${u}${r}${x}=>x:${f.size.x}y:${f.size.y}${f.widthInColumns}(width * (child?.w || 1)) / 2${p*(f?.widthInColumns??1)/2}`)}f.children&&ase(f,t,r);let v=f?.widthInColumns??1;n>0&&(v=Math.min(v,n-l%n)),l+=v,se.debug("abc88 columnsPos",f,l)}}se.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}function sse(e,{minX:t,minY:r,maxX:n,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:a,y:s,width:o,height:l}=e.size;a-o/2n&&(n=a+o/2),s+l/2>i&&(i=s+l/2)}if(e.children)for(let a of e.children)({minX:t,minY:r,maxX:n,maxY:i}=sse(a,{minX:t,minY:r,maxX:n,maxY:i}));return{minX:t,minY:r,maxX:n,maxY:i}}function FJe(e){let t=e.getBlock("root");if(!t)return;let r=Be()?.block?.padding??8;WO(t,e,0,0,r),ase(t,e,r),se.debug("getBlocks",JSON.stringify(t,null,2));let{minX:n,minY:i,maxX:a,maxY:s}=sse(t),o=s-i,l=a-n;return{x:n,y:i,width:l,height:o}}function W6(e,t){zn(Be())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}function $Je(e,t){return e.intersect(t)}function zJe(e,t,r,n){var i=e.x,a=e.y,s=i-n.x,o=a-n.y,l=Math.sqrt(t*t*o*o+r*r*s*s),u=Math.abs(t*r*s/l);n.x0}function WJe(e,t,r){var n=e.x,i=e.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(m){s=Math.min(s,m.x),o=Math.min(o,m.y)}):(s=Math.min(s,t.x),o=Math.min(o,t.y));for(var l=n-e.width/2-s,u=i-e.height/2-o,h=0;h1&&a.sort(function(m,g){var y=m.x-r.x,v=m.y-r.y,x=Math.sqrt(y*y+v*v),w=g.x-r.x,C=g.y-r.y,T=Math.sqrt(w*w+C*C);return x{i.push(o,0)},"addBorder"),s=b(o=>{i.push(0,o)},"skipBorder");t.includes("t")?(se.debug("add top border"),a(r)):s(r),t.includes("r")?(se.debug("add right border"),a(n)):s(n),t.includes("b")?(se.debug("add bottom border"),a(r)):s(r),t.includes("l")?(se.debug("add left border"),a(n)):s(n),e.attr("stroke-dasharray",i.join(" "))}function ose(e,t,r=!1){let n=e,i="default";(n?.classes?.length||0)>0&&(i=(n?.classes??[]).join(" ")),i=i+" flowchart-label";let a=0,s="",o;switch(n.type){case"round":a=5,s="rect";break;case"composite":a=0,s="composite",o=0;break;case"square":s="rect";break;case"diamond":s="question";break;case"hexagon":s="hexagon";break;case"block_arrow":s="block_arrow";break;case"odd":s="rect_left_inv_arrow";break;case"lean_right":s="lean_right";break;case"lean_left":s="lean_left";break;case"trapezoid":s="trapezoid";break;case"inv_trapezoid":s="inv_trapezoid";break;case"rect_left_inv_arrow":s="rect_left_inv_arrow";break;case"circle":s="circle";break;case"ellipse":s="ellipse";break;case"stadium":s="stadium";break;case"subroutine":s="subroutine";break;case"cylinder":s="cylinder";break;case"group":s="rect";break;case"doublecircle":s="doublecircle";break;default:s="rect"}let l=lR(n?.styles??[]),u=n.label,h=n.size??{width:0,height:0,x:0,y:0},f=t.getDiagramId();return{labelStyle:l.labelStyle,shape:s,labelText:u,rx:a,ry:a,class:i,style:l.style,id:n.id,domId:f?`${f}-${n.id}`:n.id,directions:n.directions,width:h.width,height:h.height,x:h.x,y:h.y,positioned:r,intersect:void 0,type:n.type,padding:o??qt()?.block?.padding??0,widthInColumns:n.widthInColumns??1}}async function UJe(e,t,r){let n=ose(t,r,!1);if(n.type==="group")return;let i=qt(),a=await HJe(e,n,{config:i}),s=a.node().getBBox(),o=r.getBlock(n.id);o.size={width:s.width,height:s.height,x:0,y:0,node:a},r.setBlock(o),a.remove()}async function YJe(e,t,r){let n=ose(t,r,!0);if(r.getBlock(n.id).type!=="space"){let a=qt();await HJe(e,n,{config:a}),t.intersect=n?.intersect,Frr(n)}}async function UO(e,t,r,n){for(let i of t)await n(e,i,r),i.children&&await UO(e,i.children,r,n)}async function XJe(e,t,r){await UO(e,t,r,UJe)}async function jJe(e,t,r){await UO(e,t,r,YJe)}async function KJe(e,t,r,n,i){let a=new qn({multigraph:!0,compound:!0});a.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let s of r)s.size&&a.setNode(s.id,{width:s.size.width,height:s.size.height,intersect:s.intersect});for(let s of t)if(s.start&&s.end){let o=n.getBlock(s.start),l=n.getBlock(s.end);if(o?.size&&l?.size){let u=o.size,h=l.size,f=[{x:u.x,y:u.y},{x:u.x+(h.x-u.x)/2,y:u.y+(h.y-u.y)/2},{x:h.x,y:h.y}],d=i?`${i}-${s.id}`:s.id,p=s.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",m=s.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",g=`${p} ${m} flowchart-link LS-a1 LE-b1`;srr(e,{v:s.start,w:s.end,name:d},{...s,id:d,arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:g},void 0,"block",a,i),s.label&&(await rrr(e,{...s,label:s.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:g}),nrr({...s,x:f[1].x,y:f[1].y},{originalPath:f}))}}}var Zae,ytr,qh,rse,Qae,wJe,kJe,vtr,LJe,VO,nse,xtr,btr,wtr,ktr,IJe,ise,H6,Ttr,TJe,Ctr,Str,Etr,Atr,_tr,Rtr,Ltr,Itr,Mtr,Ntr,Dtr,Otr,Ptr,Btr,Kae,Ftr,$tr,ztr,Gtr,qtr,Vtr,Wtr,Htr,Utr,Ytr,Xtr,jtr,Ktr,Ztr,Qtr,Jtr,Gh,err,trr,CJe,ese,jo,rrr,nrr,irr,arr,SJe,srr,orr,lrr,crr,GJe,urr,hrr,frr,drr,prr,ua,Xs,Na,mrr,grr,EJe,nu,AJe,yrr,vrr,xrr,brr,wrr,krr,Trr,Crr,Srr,Err,Arr,_rr,Rrr,Lrr,Irr,Mrr,Nrr,Drr,Orr,_Je,Prr,Brr,RJe,qO,HJe,Frr,$rr,zrr,Grr,qrr,QJe=W(()=>{ad();vl();ho();bs();ts();Sn();_r();Rr();hr();aR();Ka();fn();qc();fn();fn();fn();Zae=(function(){var e=b(function(w,C,T,k){for(T=T||{},k=w.length;k--;T[w[k]]=C);return T},"o"),t=[1,15],r=[1,7],n=[1,13],i=[1,14],a=[1,19],s=[1,16],o=[1,17],l=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],f=[1,23],d=[1,24],p=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],g=[1,49],y={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:b(function(C,T,k,S,E,I,L){var O=I.length-1;switch(E){case 4:S.getLogger().debug("Rule: separator (NL) ");break;case 5:S.getLogger().debug("Rule: separator (Space) ");break;case 6:S.getLogger().debug("Rule: separator (EOF) ");break;case 7:S.getLogger().debug("Rule: hierarchy: ",I[O-1]),S.setHierarchy(I[O-1]);break;case 8:S.getLogger().debug("Stop NL ");break;case 9:S.getLogger().debug("Stop EOF ");break;case 10:S.getLogger().debug("Stop NL2 ");break;case 11:S.getLogger().debug("Stop EOF2 ");break;case 12:S.getLogger().debug("Rule: statement: ",I[O]),typeof I[O].length=="number"?this.$=I[O]:this.$=[I[O]];break;case 13:S.getLogger().debug("Rule: statement #2: ",I[O-1]),this.$=[I[O-1]].concat(I[O]);break;case 14:S.getLogger().debug("Rule: link: ",I[O],C),this.$={edgeTypeStr:I[O],label:""};break;case 15:S.getLogger().debug("Rule: LABEL link: ",I[O-3],I[O-1],I[O]),this.$={edgeTypeStr:I[O],label:I[O-1]};break;case 18:let R=parseInt(I[O]),A=S.generateId();this.$={id:A,type:"space",label:"",width:R,children:[]};break;case 23:S.getLogger().debug("Rule: (nodeStatement link node) ",I[O-2],I[O-1],I[O]," typestr: ",I[O-1].edgeTypeStr);let N=S.edgeStrToEdgeData(I[O-1].edgeTypeStr),M=S.edgeStrToEdgeStartData(I[O-1].edgeTypeStr),D=S.edgeStrToThickness(I[O-1].edgeTypeStr),B=S.edgeStrToPattern(I[O-1].edgeTypeStr);this.$=[{id:I[O-2].id,label:I[O-2].label,type:I[O-2].type,directions:I[O-2].directions},{id:I[O-2].id+"-"+I[O].id,start:I[O-2].id,end:I[O].id,label:I[O-1].label,type:"edge",thickness:D,pattern:B,directions:I[O].directions,arrowTypeEnd:N,arrowTypeStart:M},{id:I[O].id,label:I[O].label,type:S.typeStr2Type(I[O].typeStr),directions:I[O].directions}];break;case 24:S.getLogger().debug("Rule: nodeStatement (abc88 node size) ",I[O-1],I[O]),this.$={id:I[O-1].id,label:I[O-1].label,type:S.typeStr2Type(I[O-1].typeStr),directions:I[O-1].directions,widthInColumns:parseInt(I[O],10)};break;case 25:S.getLogger().debug("Rule: nodeStatement (node) ",I[O]),this.$={id:I[O].id,label:I[O].label,type:S.typeStr2Type(I[O].typeStr),directions:I[O].directions,widthInColumns:1};break;case 26:S.getLogger().debug("APA123",this?this:"na"),S.getLogger().debug("COLUMNS: ",I[O]),this.$={type:"column-setting",columns:I[O]==="auto"?-1:parseInt(I[O])};break;case 27:S.getLogger().debug("Rule: id-block statement : ",I[O-2],I[O-1]);let P=S.generateId();this.$={...I[O-2],type:"composite",children:I[O-1]};break;case 28:S.getLogger().debug("Rule: blockStatement : ",I[O-2],I[O-1],I[O]);let $=S.generateId();this.$={id:$,type:"composite",label:"",children:I[O-1]};break;case 29:S.getLogger().debug("Rule: node (NODE_ID separator): ",I[O]),this.$={id:I[O]};break;case 30:S.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",I[O-1],I[O]),this.$={id:I[O-1],label:I[O].label,typeStr:I[O].typeStr,directions:I[O].directions};break;case 31:S.getLogger().debug("Rule: dirList: ",I[O]),this.$=[I[O]];break;case 32:S.getLogger().debug("Rule: dirList: ",I[O-1],I[O]),this.$=[I[O-1]].concat(I[O]);break;case 33:S.getLogger().debug("Rule: nodeShapeNLabel: ",I[O-2],I[O-1],I[O]),this.$={typeStr:I[O-2]+I[O],label:I[O-1]};break;case 34:S.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",I[O-3],I[O-2]," #3:",I[O-1],I[O]),this.$={typeStr:I[O-3]+I[O],label:I[O-2],directions:I[O-1]};break;case 35:case 36:this.$={type:"classDef",id:I[O-1].trim(),css:I[O].trim()};break;case 37:this.$={type:"applyClass",id:I[O-1].trim(),styleClass:I[O].trim()};break;case 38:this.$={type:"applyStyles",id:I[O-1].trim(),stylesStr:I[O].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:s,43:o,46:l},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:r,28:n,29:i,31:a,39:s,43:o,46:l}),e(h,[2,16],{14:22,15:f,16:d}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(p,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:a},{10:t,11:27,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:s,43:o,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:a},{31:[2,14]},{17:[1,36]},e(p,[2,24]),{10:t,11:37,13:4,14:22,15:f,16:d,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:s,43:o,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(p,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:g},{15:[1,50]},e(h,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:g,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:b(function(C,T){if(T.recoverable)this.trace(C);else{var k=new Error(C);throw k.hash=T,k}},"parseError"),parse:b(function(C){var T=this,k=[0],S=[],E=[null],I=[],L=this.table,O="",R=0,A=0,N=0,M=2,D=1,B=I.slice.call(arguments,1),P=Object.create(this.lexer),$={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&($.yy[F]=this.yy[F]);P.setInput(C,$.yy),$.yy.lexer=P,$.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var q=P.yylloc;I.push(q);var G=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function z(Ge){k.length=k.length-2*Ge,E.length=E.length-Ge,I.length=I.length-Ge}b(z,"popStack");function H(){var Ge;return Ge=S.pop()||P.lex()||D,typeof Ge!="number"&&(Ge instanceof Array&&(S=Ge,Ge=S.pop()),Ge=T.symbols_[Ge]||Ge),Ge}b(H,"lex");for(var j,J,U,le,ee,ue,ae={},oe,Re,Te,Oe;;){if(U=k[k.length-1],this.defaultActions[U]?le=this.defaultActions[U]:((j===null||typeof j>"u")&&(j=H()),le=L[U]&&L[U][j]),typeof le>"u"||!le.length||!le[0]){var qe="";Oe=[];for(oe in L[U])this.terminals_[oe]&&oe>M&&Oe.push("'"+this.terminals_[oe]+"'");P.showPosition?qe="Parse error on line "+(R+1)+`: + ${ytr(t,r)} + `},"styles"),btr={parser:htr,db:V6,renderer:gtr,styles:xtr}});var JJe={};Tr(JJe,{diagram:()=>Urr});function DJe(e){switch(se.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return se.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}function OJe(e){return se.debug("typeStr2Type",e),e==="=="?"thick":"normal"}function PJe(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}function BJe(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}function FJe(e){return e.includes("==")?"thick":"normal"}function $Je(e){return e.includes(".-")?"dotted":"solid"}function tse(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};let r=t%e,n=Math.floor(t/e);return{px:r,py:n}}function WO(e,t,r=0,n=0,i=8){se.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",r),e?.size?.width||(e.size={width:r,height:n,x:0,y:0});let a=0,s=0;if(e.children?.length>0){for(let m of e.children)WO(m,t,0,0,i);let o=rrr(e);a=o.width,s=o.height,se.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",a,s);for(let m of e.children)m.size&&(se.debug(`abc95 Setting size of children of ${e.id} id=${m.id} ${a} ${s} ${JSON.stringify(m.size)}`),m.size.width=a*(m.widthInColumns??1)+i*((m.widthInColumns??1)-1),m.size.height=s,m.size.x=0,m.size.y=0,se.debug(`abc95 updating size of ${e.id} children child:${m.id} maxWidth:${a} maxHeight:${s}`));for(let m of e.children)WO(m,t,a,s,i);let l=e.columns??-1,u=0;for(let m of e.children)u+=m.widthInColumns??1;let h=e.children.length;l>0&&l0?Math.min(e.children.length,l):e.children.length;if(m>0){let g=(d-m*i-i)/m;se.debug("abc95 (growing to fit) width",e.id,d,e.size?.width,g);for(let y of e.children)y.size&&(y.size.width=g)}}e.size={width:d,height:p,x:0,y:0}}se.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}function ose(e,t,r=8){se.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let n=e.columns??-1;if(se.debug("layoutBlocks columns abc95",e.id,"=>",n,e),e.children&&e.children.length>0){let i=e?.children[0]?.size?.width??0,a=e.children.length*i+(e.children.length-1)*r;se.debug("widthOfChildren 88",a,"posX");let s=new Map;{let f=0;for(let d of e.children){if(!d.size)continue;let{py:p}=tse(n,f),m=s.get(p)??0;d.size.height>m&&s.set(p,d.size.height);let g=d?.widthInColumns??1;n>0&&(g=Math.min(g,n-f%n)),f+=g}}let o=new Map;{let f=0,d=[...s.keys()].sort((p,m)=>p-m);for(let p of d)o.set(p,f),f+=(s.get(p)??0)+r}let l=0;se.debug("abc91 block?.size?.x",e.id,e?.size?.x);let u=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-r,h=0;for(let f of e.children){let d=e;if(!f.size)continue;let{width:p,height:m}=f.size,{px:g,py:y}=tse(n,l);if(y!=h&&(h=y,u=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-r,se.debug("New row in layout for block",e.id," and child ",f.id,h)),se.debug(`abc89 layout blocks (child) id: ${f.id} Pos: ${l} (px, py) ${g},${y} (${d?.size?.x},${d?.size?.y}) parent: ${d.id} width: ${p}${r}`),d.size){let x=p/2;f.size.x=u+r+x,se.debug(`abc91 layout blocks (calc) px, pyid:${f.id} startingPos=X${u} new startingPosX${f.size.x} ${x} padding=${r} width=${p} halfWidth=${x} => x:${f.size.x} y:${f.size.y} ${f.widthInColumns} (width * (child?.w || 1)) / 2 ${p*(f?.widthInColumns??1)/2}`),u=f.size.x+x;let w=o.get(y)??0,C=s.get(y)??m;f.size.y=d.size.y-d.size.height/2+w+C/2+r,se.debug(`abc88 layout blocks (calc) px, pyid:${f.id}startingPosX${u}${r}${x}=>x:${f.size.x}y:${f.size.y}${f.widthInColumns}(width * (child?.w || 1)) / 2${p*(f?.widthInColumns??1)/2}`)}f.children&&ose(f,t,r);let v=f?.widthInColumns??1;n>0&&(v=Math.min(v,n-l%n)),l+=v,se.debug("abc88 columnsPos",f,l)}}se.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}function lse(e,{minX:t,minY:r,maxX:n,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:a,y:s,width:o,height:l}=e.size;a-o/2n&&(n=a+o/2),s+l/2>i&&(i=s+l/2)}if(e.children)for(let a of e.children)({minX:t,minY:r,maxX:n,maxY:i}=lse(a,{minX:t,minY:r,maxX:n,maxY:i}));return{minX:t,minY:r,maxX:n,maxY:i}}function zJe(e){let t=e.getBlock("root");if(!t)return;let r=Be()?.block?.padding??8;WO(t,e,0,0,r),ose(t,e,r),se.debug("getBlocks",JSON.stringify(t,null,2));let{minX:n,minY:i,maxX:a,maxY:s}=lse(t),o=s-i,l=a-n;return{x:n,y:i,width:l,height:o}}function W6(e,t){zn(Be())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}function GJe(e,t){return e.intersect(t)}function qJe(e,t,r,n){var i=e.x,a=e.y,s=i-n.x,o=a-n.y,l=Math.sqrt(t*t*o*o+r*r*s*s),u=Math.abs(t*r*s/l);n.x0}function UJe(e,t,r){var n=e.x,i=e.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(m){s=Math.min(s,m.x),o=Math.min(o,m.y)}):(s=Math.min(s,t.x),o=Math.min(o,t.y));for(var l=n-e.width/2-s,u=i-e.height/2-o,h=0;h1&&a.sort(function(m,g){var y=m.x-r.x,v=m.y-r.y,x=Math.sqrt(y*y+v*v),w=g.x-r.x,C=g.y-r.y,T=Math.sqrt(w*w+C*C);return x{i.push(o,0)},"addBorder"),s=b(o=>{i.push(0,o)},"skipBorder");t.includes("t")?(se.debug("add top border"),a(r)):s(r),t.includes("r")?(se.debug("add right border"),a(n)):s(n),t.includes("b")?(se.debug("add bottom border"),a(r)):s(r),t.includes("l")?(se.debug("add left border"),a(n)):s(n),e.attr("stroke-dasharray",i.join(" "))}function cse(e,t,r=!1){let n=e,i="default";(n?.classes?.length||0)>0&&(i=(n?.classes??[]).join(" ")),i=i+" flowchart-label";let a=0,s="",o;switch(n.type){case"round":a=5,s="rect";break;case"composite":a=0,s="composite",o=0;break;case"square":s="rect";break;case"diamond":s="question";break;case"hexagon":s="hexagon";break;case"block_arrow":s="block_arrow";break;case"odd":s="rect_left_inv_arrow";break;case"lean_right":s="lean_right";break;case"lean_left":s="lean_left";break;case"trapezoid":s="trapezoid";break;case"inv_trapezoid":s="inv_trapezoid";break;case"rect_left_inv_arrow":s="rect_left_inv_arrow";break;case"circle":s="circle";break;case"ellipse":s="ellipse";break;case"stadium":s="stadium";break;case"subroutine":s="subroutine";break;case"cylinder":s="cylinder";break;case"group":s="rect";break;case"doublecircle":s="doublecircle";break;default:s="rect"}let l=lR(n?.styles??[]),u=n.label,h=n.size??{width:0,height:0,x:0,y:0},f=t.getDiagramId();return{labelStyle:l.labelStyle,shape:s,labelText:u,rx:a,ry:a,class:i,style:l.style,id:n.id,domId:f?`${f}-${n.id}`:n.id,directions:n.directions,width:h.width,height:h.height,x:h.x,y:h.y,positioned:r,intersect:void 0,type:n.type,padding:o??qt()?.block?.padding??0,widthInColumns:n.widthInColumns??1}}async function XJe(e,t,r){let n=cse(t,r,!1);if(n.type==="group")return;let i=qt(),a=await YJe(e,n,{config:i}),s=a.node().getBBox(),o=r.getBlock(n.id);o.size={width:s.width,height:s.height,x:0,y:0,node:a},r.setBlock(o),a.remove()}async function jJe(e,t,r){let n=cse(t,r,!0);if(r.getBlock(n.id).type!=="space"){let a=qt();await YJe(e,n,{config:a}),t.intersect=n?.intersect,qrr(n)}}async function UO(e,t,r,n){for(let i of t)await n(e,i,r),i.children&&await UO(e,i.children,r,n)}async function KJe(e,t,r){await UO(e,t,r,XJe)}async function ZJe(e,t,r){await UO(e,t,r,jJe)}async function QJe(e,t,r,n,i){let a=new qn({multigraph:!0,compound:!0});a.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let s of r)s.size&&a.setNode(s.id,{width:s.size.width,height:s.size.height,intersect:s.intersect});for(let s of t)if(s.start&&s.end){let o=n.getBlock(s.start),l=n.getBlock(s.end);if(o?.size&&l?.size){let u=o.size,h=l.size,f=[{x:u.x,y:u.y},{x:u.x+(h.x-u.x)/2,y:u.y+(h.y-u.y)/2},{x:h.x,y:h.y}],d=i?`${i}-${s.id}`:s.id,p=s.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",m=s.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",g=`${p} ${m} flowchart-link LS-a1 LE-b1`;urr(e,{v:s.start,w:s.end,name:d},{...s,id:d,arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:g},void 0,"block",a,i),s.label&&(await srr(e,{...s,label:s.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:g}),orr({...s,x:f[1].x,y:f[1].y},{originalPath:f}))}}}var Jae,wtr,qh,ise,ese,TJe,CJe,ktr,MJe,VO,ase,Ttr,Ctr,Str,Etr,NJe,sse,H6,Atr,SJe,_tr,Rtr,Ltr,Itr,Mtr,Ntr,Dtr,Otr,Ptr,Btr,Ftr,$tr,ztr,Gtr,Qae,qtr,Vtr,Wtr,Htr,Utr,Ytr,Xtr,jtr,Ktr,Ztr,Qtr,Jtr,err,trr,rrr,nrr,Gh,irr,arr,EJe,rse,jo,srr,orr,lrr,crr,AJe,urr,hrr,frr,drr,VJe,prr,mrr,grr,yrr,vrr,ua,Xs,Na,xrr,brr,_Je,nu,RJe,wrr,krr,Trr,Crr,Srr,Err,Arr,_rr,Rrr,Lrr,Irr,Mrr,Nrr,Drr,Orr,Prr,Brr,Frr,$rr,LJe,zrr,Grr,IJe,qO,YJe,qrr,Vrr,Wrr,Hrr,Urr,eet=W(()=>{ad();xl();ho();bs();ts();Sn();_r();Rr();hr();aR();Ka();fn();qc();fn();fn();fn();Jae=(function(){var e=b(function(w,C,T,k){for(T=T||{},k=w.length;k--;T[w[k]]=C);return T},"o"),t=[1,15],r=[1,7],n=[1,13],i=[1,14],a=[1,19],s=[1,16],o=[1,17],l=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],f=[1,23],d=[1,24],p=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],g=[1,49],y={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:b(function(C,T,k,S,E,I,L){var O=I.length-1;switch(E){case 4:S.getLogger().debug("Rule: separator (NL) ");break;case 5:S.getLogger().debug("Rule: separator (Space) ");break;case 6:S.getLogger().debug("Rule: separator (EOF) ");break;case 7:S.getLogger().debug("Rule: hierarchy: ",I[O-1]),S.setHierarchy(I[O-1]);break;case 8:S.getLogger().debug("Stop NL ");break;case 9:S.getLogger().debug("Stop EOF ");break;case 10:S.getLogger().debug("Stop NL2 ");break;case 11:S.getLogger().debug("Stop EOF2 ");break;case 12:S.getLogger().debug("Rule: statement: ",I[O]),typeof I[O].length=="number"?this.$=I[O]:this.$=[I[O]];break;case 13:S.getLogger().debug("Rule: statement #2: ",I[O-1]),this.$=[I[O-1]].concat(I[O]);break;case 14:S.getLogger().debug("Rule: link: ",I[O],C),this.$={edgeTypeStr:I[O],label:""};break;case 15:S.getLogger().debug("Rule: LABEL link: ",I[O-3],I[O-1],I[O]),this.$={edgeTypeStr:I[O],label:I[O-1]};break;case 18:let R=parseInt(I[O]),A=S.generateId();this.$={id:A,type:"space",label:"",width:R,children:[]};break;case 23:S.getLogger().debug("Rule: (nodeStatement link node) ",I[O-2],I[O-1],I[O]," typestr: ",I[O-1].edgeTypeStr);let N=S.edgeStrToEdgeData(I[O-1].edgeTypeStr),M=S.edgeStrToEdgeStartData(I[O-1].edgeTypeStr),D=S.edgeStrToThickness(I[O-1].edgeTypeStr),B=S.edgeStrToPattern(I[O-1].edgeTypeStr);this.$=[{id:I[O-2].id,label:I[O-2].label,type:I[O-2].type,directions:I[O-2].directions},{id:I[O-2].id+"-"+I[O].id,start:I[O-2].id,end:I[O].id,label:I[O-1].label,type:"edge",thickness:D,pattern:B,directions:I[O].directions,arrowTypeEnd:N,arrowTypeStart:M},{id:I[O].id,label:I[O].label,type:S.typeStr2Type(I[O].typeStr),directions:I[O].directions}];break;case 24:S.getLogger().debug("Rule: nodeStatement (abc88 node size) ",I[O-1],I[O]),this.$={id:I[O-1].id,label:I[O-1].label,type:S.typeStr2Type(I[O-1].typeStr),directions:I[O-1].directions,widthInColumns:parseInt(I[O],10)};break;case 25:S.getLogger().debug("Rule: nodeStatement (node) ",I[O]),this.$={id:I[O].id,label:I[O].label,type:S.typeStr2Type(I[O].typeStr),directions:I[O].directions,widthInColumns:1};break;case 26:S.getLogger().debug("APA123",this?this:"na"),S.getLogger().debug("COLUMNS: ",I[O]),this.$={type:"column-setting",columns:I[O]==="auto"?-1:parseInt(I[O])};break;case 27:S.getLogger().debug("Rule: id-block statement : ",I[O-2],I[O-1]);let P=S.generateId();this.$={...I[O-2],type:"composite",children:I[O-1]};break;case 28:S.getLogger().debug("Rule: blockStatement : ",I[O-2],I[O-1],I[O]);let $=S.generateId();this.$={id:$,type:"composite",label:"",children:I[O-1]};break;case 29:S.getLogger().debug("Rule: node (NODE_ID separator): ",I[O]),this.$={id:I[O]};break;case 30:S.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",I[O-1],I[O]),this.$={id:I[O-1],label:I[O].label,typeStr:I[O].typeStr,directions:I[O].directions};break;case 31:S.getLogger().debug("Rule: dirList: ",I[O]),this.$=[I[O]];break;case 32:S.getLogger().debug("Rule: dirList: ",I[O-1],I[O]),this.$=[I[O-1]].concat(I[O]);break;case 33:S.getLogger().debug("Rule: nodeShapeNLabel: ",I[O-2],I[O-1],I[O]),this.$={typeStr:I[O-2]+I[O],label:I[O-1]};break;case 34:S.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",I[O-3],I[O-2]," #3:",I[O-1],I[O]),this.$={typeStr:I[O-3]+I[O],label:I[O-2],directions:I[O-1]};break;case 35:case 36:this.$={type:"classDef",id:I[O-1].trim(),css:I[O].trim()};break;case 37:this.$={type:"applyClass",id:I[O-1].trim(),styleClass:I[O].trim()};break;case 38:this.$={type:"applyStyles",id:I[O-1].trim(),stylesStr:I[O].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:s,43:o,46:l},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:r,28:n,29:i,31:a,39:s,43:o,46:l}),e(h,[2,16],{14:22,15:f,16:d}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(p,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:a},{10:t,11:27,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:s,43:o,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:a},{31:[2,14]},{17:[1,36]},e(p,[2,24]),{10:t,11:37,13:4,14:22,15:f,16:d,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:s,43:o,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(p,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:g},{15:[1,50]},e(h,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:g,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:b(function(C,T){if(T.recoverable)this.trace(C);else{var k=new Error(C);throw k.hash=T,k}},"parseError"),parse:b(function(C){var T=this,k=[0],S=[],E=[null],I=[],L=this.table,O="",R=0,A=0,N=0,M=2,D=1,B=I.slice.call(arguments,1),P=Object.create(this.lexer),$={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&($.yy[F]=this.yy[F]);P.setInput(C,$.yy),$.yy.lexer=P,$.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var q=P.yylloc;I.push(q);var G=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function z(Ge){k.length=k.length-2*Ge,E.length=E.length-Ge,I.length=I.length-Ge}b(z,"popStack");function H(){var Ge;return Ge=S.pop()||P.lex()||D,typeof Ge!="number"&&(Ge instanceof Array&&(S=Ge,Ge=S.pop()),Ge=T.symbols_[Ge]||Ge),Ge}b(H,"lex");for(var j,J,U,le,ee,ue,ae={},oe,Re,Te,Oe;;){if(U=k[k.length-1],this.defaultActions[U]?le=this.defaultActions[U]:((j===null||typeof j>"u")&&(j=H()),le=L[U]&&L[U][j]),typeof le>"u"||!le.length||!le[0]){var qe="";Oe=[];for(oe in L[U])this.terminals_[oe]&&oe>M&&Oe.push("'"+this.terminals_[oe]+"'");P.showPosition?qe="Parse error on line "+(R+1)+`: `+P.showPosition()+` Expecting `+Oe.join(", ")+", got '"+(this.terminals_[j]||j)+"'":qe="Parse error on line "+(R+1)+": Unexpected "+(j==D?"end of input":"'"+(this.terminals_[j]||j)+"'"),this.parseError(qe,{text:P.match,token:this.terminals_[j]||j,line:P.yylineno,loc:q,expected:Oe})}if(le[0]instanceof Array&&le.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+j);switch(le[0]){case 1:k.push(j),E.push(P.yytext),I.push(P.yylloc),k.push(le[1]),j=null,J?(j=J,J=null):(A=P.yyleng,O=P.yytext,R=P.yylineno,q=P.yylloc,N>0&&N--);break;case 2:if(Re=this.productions_[le[1]][1],ae.$=E[E.length-Re],ae._$={first_line:I[I.length-(Re||1)].first_line,last_line:I[I.length-1].last_line,first_column:I[I.length-(Re||1)].first_column,last_column:I[I.length-1].last_column},G&&(ae._$.range=[I[I.length-(Re||1)].range[0],I[I.length-1].range[1]]),ue=this.performAction.apply(ae,[O,A,R,$.yy,le[1],E,I].concat(B)),typeof ue<"u")return ue;Re&&(k=k.slice(0,-1*Re*2),E=E.slice(0,-1*Re),I=I.slice(0,-1*Re)),k.push(this.productions_[le[1]][0]),E.push(ae.$),I.push(ae._$),Te=L[k[k.length-2]][k[k.length-1]],k.push(Te);break;case 3:return!0}}return!0},"parse")},v=(function(){var w={EOF:1,parseError:b(function(T,k){if(this.yy.parser)this.yy.parser.parseError(T,k);else throw new Error(T)},"parseError"),setInput:b(function(C,T){return this.yy=T||this.yy||{},this._input=C,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var T=C.match(/(?:\r\n?|\n).*/g);return T?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},"input"),unput:b(function(C){var T=C.length,k=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-T),this.offset-=T;var S=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),k.length-1&&(this.yylineno-=k.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===S.length?this.yylloc.first_column:0)+S[S.length-k.length].length-k[0].length:this.yylloc.first_column-T},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-T]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(C){this.unput(this.match.slice(C))},"less"),pastInput:b(function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var C=this.pastInput(),T=new Array(C.length+1).join("-");return C+this.upcomingInput()+` `+T+"^"},"showPosition"),test_match:b(function(C,T){var k,S,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),S=C[0].match(/(?:\r\n?|\n).*/g),S&&(this.yylineno+=S.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:S?S[S.length-1].length-S[S.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(C[0].length),this.matched+=C[0],k=this.performAction.call(this,this.yy,this,T,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),k)return k;if(this._backtrack){for(var I in E)this[I]=E[I];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,T,k,S;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),I=0;IT[0].length)){if(T=k,S=I,this.options.backtrack_lexer){if(C=this.test_match(k,E[I]),C!==!1)return C;if(this._backtrack){T=!1;continue}else return!1}else if(!this.options.flex)break}return T?(C=this.test_match(T,E[S]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var T=this.next();return T||this.lex()},"lex"),begin:b(function(T){this.conditionStack.push(T)},"begin"),popState:b(function(){var T=this.conditionStack.length-1;return T>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(T){return T=this.conditionStack.length-1-Math.abs(T||0),T>=0?this.conditionStack[T]:"INITIAL"},"topState"),pushState:b(function(T){this.begin(T)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(T,k,S,E){var I=E;switch(S){case 0:return T.getLogger().debug("Found block-beta"),10;break;case 1:return T.getLogger().debug("Found id-block"),29;break;case 2:return T.getLogger().debug("Found block"),10;break;case 3:T.getLogger().debug(".",k.yytext);break;case 4:T.getLogger().debug("_",k.yytext);break;case 5:return 5;case 6:return k.yytext=-1,28;break;case 7:return k.yytext=k.yytext.replace(/columns\s+/,""),T.getLogger().debug("COLUMNS (LEX)",k.yytext),28;break;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:T.getLogger().debug("LEX: POPPING STR:",k.yytext),this.popState();break;case 13:return T.getLogger().debug("LEX: STR end:",k.yytext),"STR";break;case 14:return k.yytext=k.yytext.replace(/space\:/,""),T.getLogger().debug("SPACE NUM (LEX)",k.yytext),21;break;case 15:return k.yytext="1",T.getLogger().debug("COLUMNS (LEX)",k.yytext),21;break;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;break;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 21:return this.popState(),this.pushState("CLASSDEFID"),40;break;case 22:return this.popState(),41;break;case 23:return this.pushState("CLASS"),43;break;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;break;case 25:return this.popState(),45;break;case 26:return this.pushState("STYLE_STMNT"),46;break;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;break;case 28:return this.popState(),48;break;case 29:return this.pushState("acc_title"),"acc_title";break;case 30:return this.popState(),"acc_title_value";break;case 31:return this.pushState("acc_descr"),"acc_descr";break;case 32:return this.popState(),"acc_descr_value";break;case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 38:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),T.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 40:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 41:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),T.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 43:return this.popState(),T.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 44:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 45:return this.popState(),T.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 46:return this.popState(),T.getLogger().debug("Lex: ("),"NODE_DEND";break;case 47:return this.popState(),T.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 48:return this.popState(),T.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 49:return this.popState(),T.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),T.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 51:return this.popState(),T.getLogger().debug("Lex: )"),"NODE_DEND";break;case 52:return this.popState(),T.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 53:return this.popState(),T.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 54:return T.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;break;case 55:return T.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;break;case 56:return T.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;break;case 57:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 58:return T.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;break;case 59:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 60:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 61:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 62:return T.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;break;case 63:return T.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;break;case 64:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 65:return this.pushState("NODE"),35;break;case 66:return this.pushState("NODE"),35;break;case 67:return this.pushState("NODE"),35;break;case 68:return this.pushState("NODE"),35;break;case 69:return this.pushState("NODE"),35;break;case 70:return this.pushState("NODE"),35;break;case 71:return this.pushState("NODE"),35;break;case 72:return T.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;break;case 73:return this.pushState("BLOCK_ARROW"),T.getLogger().debug("LEX ARR START"),37;break;case 74:return T.getLogger().debug("Lex: NODE_ID",k.yytext),31;break;case 75:return T.getLogger().debug("Lex: EOF",k.yytext),8;break;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:T.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:T.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return T.getLogger().debug("LEX: NODE_DESCR:",k.yytext),"NODE_DESCR";break;case 83:T.getLogger().debug("LEX POPPING"),this.popState();break;case 84:T.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (right): dir:",k.yytext),"DIR";break;case 86:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (left):",k.yytext),"DIR";break;case 87:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (x):",k.yytext),"DIR";break;case 88:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (y):",k.yytext),"DIR";break;case 89:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (up):",k.yytext),"DIR";break;case 90:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (down):",k.yytext),"DIR";break;case 91:return k.yytext="]>",T.getLogger().debug("Lex (ARROW_DIR end):",k.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 92:return T.getLogger().debug("Lex: LINK","#"+k.yytext+"#"),15;break;case 93:return T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 94:return T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 95:return T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 96:return T.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 97:return T.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 98:return T.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 99:this.pushState("md_string");break;case 100:return T.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 101:return this.popState(),T.getLogger().debug("Lex: LINK","#"+k.yytext+"#"),15;break;case 102:return this.popState(),T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 103:return this.popState(),T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 104:return T.getLogger().debug("Lex: COLON",k.yytext),k.yytext=k.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return w})();y.lexer=v;function x(){this.yy={}}return b(x,"Parser"),x.prototype=y,y.Parser=x,new x})();Zae.parser=Zae;ytr=Zae,qh=new Map,rse=[],Qae=new Map,wJe="color",kJe="fill",vtr="bgFill",LJe=",",VO=new Map,nse="",xtr=b(e=>Ct.sanitizeText(e,Be()),"sanitizeText"),btr=b(function(e,t=""){let r=VO.get(e);r||(r={id:e,styles:[],textStyles:[]},VO.set(e,r)),t?.split(LJe).forEach(n=>{let i=n.replace(/([^;]*);/,"$1").trim();if(RegExp(wJe).exec(n)){let s=i.replace(kJe,vtr).replace(wJe,kJe);r.textStyles.push(s)}r.styles.push(i)})},"addStyleClass"),wtr=b(function(e,t=""){let r=qh.get(e);t!=null&&(r.styles=t.split(LJe))},"addStyle2Node"),ktr=b(function(e,t){e.split(",").forEach(function(r){let n=qh.get(r);if(n===void 0){let i=r.trim();n={id:i,type:"na",children:[]},qh.set(i,n)}n.classes||(n.classes=[]),n.classes.push(t)})},"setCssClass"),IJe=b((e,t)=>{let r=e.flat(),n=[],a=r.find(s=>s?.type==="column-setting")?.columns??-1;for(let s of r){if(typeof a=="number"&&a>0&&s.type!=="column-setting"&&typeof s.widthInColumns=="number"&&s.widthInColumns>a&&se.warn(`Block ${s.id} width ${s.widthInColumns} exceeds configured column width ${a}`),s.label&&(s.label=xtr(s.label)),s.type==="classDef"){btr(s.id,s.css);continue}if(s.type==="applyClass"){ktr(s.id,s?.styleClass??"");continue}if(s.type==="applyStyles"){s?.stylesStr&&wtr(s.id,s?.stylesStr);continue}if(s.type==="column-setting")t.columns=s.columns??-1;else if(s.type==="edge"){let o=(Qae.get(s.id)??0)+1;Qae.set(s.id,o),s.id=o+"-"+s.id,rse.push(s)}else{s.label||(s.type==="composite"?s.label="":s.label=s.id);let o=qh.get(s.id);if(o===void 0?qh.set(s.id,s):(s.type!=="na"&&(o.type=s.type),s.label!==s.id&&(o.label=s.label)),s.children&&IJe(s.children,s),s.type==="space"){let l=s.width??1;for(let u=0;u{se.debug("Clear called"),Nr(),H6={id:"root",type:"composite",children:[],columns:-1},qh=new Map([["root",H6]]),ise=[],VO=new Map,rse=[],Qae=new Map,nse=""},"clear");b(MJe,"typeStr2Type");b(NJe,"edgeTypeStr2Type");b(DJe,"edgeStrToEdgeData");b(OJe,"edgeStrToEdgeStartData");b(PJe,"edgeStrToThickness");b(BJe,"edgeStrToPattern");TJe=0,Ctr=b(()=>(TJe++,"id-"+Math.random().toString(36).substr(2,12)+"-"+TJe),"generateId"),Str=b(e=>{H6.children=e,IJe(e,H6),ise=H6.children},"setHierarchy"),Etr=b(e=>{let t=qh.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),Atr=b(()=>[...qh.values()],"getBlocksFlat"),_tr=b(()=>ise||[],"getBlocks"),Rtr=b(()=>rse,"getEdges"),Ltr=b(e=>qh.get(e),"getBlock"),Itr=b(e=>{qh.set(e.id,e)},"setBlock"),Mtr=b(e=>{nse=e},"setDiagramId"),Ntr=b(()=>nse,"getDiagramId"),Dtr=b(()=>se,"getLogger"),Otr=b(function(){return VO},"getClasses"),Ptr={getConfig:b(()=>qt().block,"getConfig"),typeStr2Type:MJe,edgeTypeStr2Type:NJe,edgeStrToEdgeData:DJe,edgeStrToEdgeStartData:OJe,edgeStrToThickness:PJe,edgeStrToPattern:BJe,getLogger:Dtr,getBlocksFlat:Atr,getBlocks:_tr,getEdges:Rtr,setHierarchy:Str,getBlock:Ltr,setBlock:Itr,getColumns:Etr,getClasses:Otr,clear:Ttr,generateId:Ctr,setDiagramId:Mtr,getDiagramId:Ntr},Btr=Ptr,Kae=b((e,t)=>{let r=ly,n=r(e,"r"),i=r(e,"g"),a=r(e,"b");return $a(n,i,a,t)},"fade"),Ftr=b(e=>`.label { +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var T=this.next();return T||this.lex()},"lex"),begin:b(function(T){this.conditionStack.push(T)},"begin"),popState:b(function(){var T=this.conditionStack.length-1;return T>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(T){return T=this.conditionStack.length-1-Math.abs(T||0),T>=0?this.conditionStack[T]:"INITIAL"},"topState"),pushState:b(function(T){this.begin(T)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:b(function(T,k,S,E){var I=E;switch(S){case 0:return T.getLogger().debug("Found block-beta"),10;break;case 1:return T.getLogger().debug("Found id-block"),29;break;case 2:return T.getLogger().debug("Found block"),10;break;case 3:T.getLogger().debug(".",k.yytext);break;case 4:T.getLogger().debug("_",k.yytext);break;case 5:return 5;case 6:return k.yytext=-1,28;break;case 7:return k.yytext=k.yytext.replace(/columns\s+/,""),T.getLogger().debug("COLUMNS (LEX)",k.yytext),28;break;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:T.getLogger().debug("LEX: POPPING STR:",k.yytext),this.popState();break;case 13:return T.getLogger().debug("LEX: STR end:",k.yytext),"STR";break;case 14:return k.yytext=k.yytext.replace(/space\:/,""),T.getLogger().debug("SPACE NUM (LEX)",k.yytext),21;break;case 15:return k.yytext="1",T.getLogger().debug("COLUMNS (LEX)",k.yytext),21;break;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;break;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 21:return this.popState(),this.pushState("CLASSDEFID"),40;break;case 22:return this.popState(),41;break;case 23:return this.pushState("CLASS"),43;break;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;break;case 25:return this.popState(),45;break;case 26:return this.pushState("STYLE_STMNT"),46;break;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;break;case 28:return this.popState(),48;break;case 29:return this.pushState("acc_title"),"acc_title";break;case 30:return this.popState(),"acc_title_value";break;case 31:return this.pushState("acc_descr"),"acc_descr";break;case 32:return this.popState(),"acc_descr_value";break;case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 38:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),T.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 40:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 41:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),T.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 43:return this.popState(),T.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 44:return this.popState(),T.getLogger().debug("Lex: (("),"NODE_DEND";break;case 45:return this.popState(),T.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 46:return this.popState(),T.getLogger().debug("Lex: ("),"NODE_DEND";break;case 47:return this.popState(),T.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 48:return this.popState(),T.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 49:return this.popState(),T.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),T.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 51:return this.popState(),T.getLogger().debug("Lex: )"),"NODE_DEND";break;case 52:return this.popState(),T.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 53:return this.popState(),T.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 54:return T.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;break;case 55:return T.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;break;case 56:return T.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;break;case 57:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 58:return T.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;break;case 59:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 60:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 61:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 62:return T.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;break;case 63:return T.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;break;case 64:return T.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 65:return this.pushState("NODE"),35;break;case 66:return this.pushState("NODE"),35;break;case 67:return this.pushState("NODE"),35;break;case 68:return this.pushState("NODE"),35;break;case 69:return this.pushState("NODE"),35;break;case 70:return this.pushState("NODE"),35;break;case 71:return this.pushState("NODE"),35;break;case 72:return T.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;break;case 73:return this.pushState("BLOCK_ARROW"),T.getLogger().debug("LEX ARR START"),37;break;case 74:return T.getLogger().debug("Lex: NODE_ID",k.yytext),31;break;case 75:return T.getLogger().debug("Lex: EOF",k.yytext),8;break;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:T.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:T.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return T.getLogger().debug("LEX: NODE_DESCR:",k.yytext),"NODE_DESCR";break;case 83:T.getLogger().debug("LEX POPPING"),this.popState();break;case 84:T.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (right): dir:",k.yytext),"DIR";break;case 86:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (left):",k.yytext),"DIR";break;case 87:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (x):",k.yytext),"DIR";break;case 88:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (y):",k.yytext),"DIR";break;case 89:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (up):",k.yytext),"DIR";break;case 90:return k.yytext=k.yytext.replace(/^,\s*/,""),T.getLogger().debug("Lex (down):",k.yytext),"DIR";break;case 91:return k.yytext="]>",T.getLogger().debug("Lex (ARROW_DIR end):",k.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 92:return T.getLogger().debug("Lex: LINK","#"+k.yytext+"#"),15;break;case 93:return T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 94:return T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 95:return T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 96:return T.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 97:return T.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 98:return T.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 99:this.pushState("md_string");break;case 100:return T.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 101:return this.popState(),T.getLogger().debug("Lex: LINK","#"+k.yytext+"#"),15;break;case 102:return this.popState(),T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 103:return this.popState(),T.getLogger().debug("Lex: LINK",k.yytext),15;break;case 104:return T.getLogger().debug("Lex: COLON",k.yytext),k.yytext=k.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return w})();y.lexer=v;function x(){this.yy={}}return b(x,"Parser"),x.prototype=y,y.Parser=x,new x})();Jae.parser=Jae;wtr=Jae,qh=new Map,ise=[],ese=new Map,TJe="color",CJe="fill",ktr="bgFill",MJe=",",VO=new Map,ase="",Ttr=b(e=>Ct.sanitizeText(e,Be()),"sanitizeText"),Ctr=b(function(e,t=""){let r=VO.get(e);r||(r={id:e,styles:[],textStyles:[]},VO.set(e,r)),t?.split(MJe).forEach(n=>{let i=n.replace(/([^;]*);/,"$1").trim();if(RegExp(TJe).exec(n)){let s=i.replace(CJe,ktr).replace(TJe,CJe);r.textStyles.push(s)}r.styles.push(i)})},"addStyleClass"),Str=b(function(e,t=""){let r=qh.get(e);t!=null&&(r.styles=t.split(MJe))},"addStyle2Node"),Etr=b(function(e,t){e.split(",").forEach(function(r){let n=qh.get(r);if(n===void 0){let i=r.trim();n={id:i,type:"na",children:[]},qh.set(i,n)}n.classes||(n.classes=[]),n.classes.push(t)})},"setCssClass"),NJe=b((e,t)=>{let r=e.flat(),n=[],a=r.find(s=>s?.type==="column-setting")?.columns??-1;for(let s of r){if(typeof a=="number"&&a>0&&s.type!=="column-setting"&&typeof s.widthInColumns=="number"&&s.widthInColumns>a&&se.warn(`Block ${s.id} width ${s.widthInColumns} exceeds configured column width ${a}`),s.label&&(s.label=Ttr(s.label)),s.type==="classDef"){Ctr(s.id,s.css);continue}if(s.type==="applyClass"){Etr(s.id,s?.styleClass??"");continue}if(s.type==="applyStyles"){s?.stylesStr&&Str(s.id,s?.stylesStr);continue}if(s.type==="column-setting")t.columns=s.columns??-1;else if(s.type==="edge"){let o=(ese.get(s.id)??0)+1;ese.set(s.id,o),s.id=o+"-"+s.id,ise.push(s)}else{s.label||(s.type==="composite"?s.label="":s.label=s.id);let o=qh.get(s.id);if(o===void 0?qh.set(s.id,s):(s.type!=="na"&&(o.type=s.type),s.label!==s.id&&(o.label=s.label)),s.children&&NJe(s.children,s),s.type==="space"){let l=s.width??1;for(let u=0;u{se.debug("Clear called"),Nr(),H6={id:"root",type:"composite",children:[],columns:-1},qh=new Map([["root",H6]]),sse=[],VO=new Map,ise=[],ese=new Map,ase=""},"clear");b(DJe,"typeStr2Type");b(OJe,"edgeTypeStr2Type");b(PJe,"edgeStrToEdgeData");b(BJe,"edgeStrToEdgeStartData");b(FJe,"edgeStrToThickness");b($Je,"edgeStrToPattern");SJe=0,_tr=b(()=>(SJe++,"id-"+Math.random().toString(36).substr(2,12)+"-"+SJe),"generateId"),Rtr=b(e=>{H6.children=e,NJe(e,H6),sse=H6.children},"setHierarchy"),Ltr=b(e=>{let t=qh.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),Itr=b(()=>[...qh.values()],"getBlocksFlat"),Mtr=b(()=>sse||[],"getBlocks"),Ntr=b(()=>ise,"getEdges"),Dtr=b(e=>qh.get(e),"getBlock"),Otr=b(e=>{qh.set(e.id,e)},"setBlock"),Ptr=b(e=>{ase=e},"setDiagramId"),Btr=b(()=>ase,"getDiagramId"),Ftr=b(()=>se,"getLogger"),$tr=b(function(){return VO},"getClasses"),ztr={getConfig:b(()=>qt().block,"getConfig"),typeStr2Type:DJe,edgeTypeStr2Type:OJe,edgeStrToEdgeData:PJe,edgeStrToEdgeStartData:BJe,edgeStrToThickness:FJe,edgeStrToPattern:$Je,getLogger:Ftr,getBlocksFlat:Itr,getBlocks:Mtr,getEdges:Ntr,setHierarchy:Rtr,getBlock:Dtr,setBlock:Otr,getColumns:Ltr,getClasses:$tr,clear:Atr,generateId:_tr,setDiagramId:Ptr,getDiagramId:Btr},Gtr=ztr,Qae=b((e,t)=>{let r=ly,n=r(e,"r"),i=r(e,"g"),a=r(e,"b");return $a(n,i,a,t)},"fade"),qtr=b(e=>`.label { font-family: ${e.fontFamily}; color: ${e.nodeTextColor||e.textColor}; } @@ -3066,9 +3066,9 @@ Expecting `+Oe.join(", ")+", got '"+(this.terminals_[j]||j)+"'":qe="Parse error } .node .cluster { - // fill: ${Kae(e.mainBkg,.5)}; - fill: ${Kae(e.clusterBkg,.5)}; - stroke: ${Kae(e.clusterBorder,.2)}; + // fill: ${Qae(e.mainBkg,.5)}; + fill: ${Qae(e.clusterBkg,.5)}; + stroke: ${Qae(e.clusterBorder,.2)}; box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; stroke-width: 1px; } @@ -3104,13 +3104,13 @@ Expecting `+Oe.join(", ")+", got '"+(this.terminals_[j]||j)+"'":qe="Parse error fill: ${e.textColor}; } ${id()} -`,"getStyles"),$tr=Ftr,ztr=b((e,t,r,n)=>{t.forEach(i=>{Ktr[i](e,r,n)})},"insertMarkers"),Gtr=b((e,t,r)=>{se.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),qtr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Vtr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),Wtr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),Htr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Utr=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Ytr=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),Xtr=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),jtr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),Ktr={extension:Gtr,composition:qtr,aggregation:Vtr,dependency:Wtr,lollipop:Htr,point:Utr,circle:Ytr,cross:Xtr,barb:jtr},Ztr=ztr;b(Jae,"calculateBlockPosition");Qtr=b(e=>{let t=0,r=0;for(let n of e.children){let{width:i,height:a,x:s,y:o}=n.size??{width:0,height:0,x:0,y:0};if(se.debug("getMaxChildSize abc95 child:",n.id,"width:",i,"height:",a,"x:",s,"y:",o,n.type),n.type==="space")continue;let l=i/(n.widthInColumns??1);l>t&&(t=l),a>r&&(r=a)}return{width:t,height:r}},"getMaxChildSize");b(WO,"setBlockSizes");b(ase,"layoutBlocks");b(sse,"findBounds");b(FJe,"layout");Jtr=b(async(e,t,r,n=!1,i=!1)=>{let a=t||"";typeof a=="object"&&(a=a[0]);let s=Be(),o=zn(s);return await rs(e,a,{style:r,isTitle:n,useHtmlLabels:o,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},s)},"createLabel"),Gh=Jtr,err=b((e,t,r,n,i)=>{t.arrowTypeStart&&CJe(e,"start",t.arrowTypeStart,r,n,i),t.arrowTypeEnd&&CJe(e,"end",t.arrowTypeEnd,r,n,i)},"addEdgeMarkers"),trr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},CJe=b((e,t,r,n,i,a)=>{let s=trr[r];if(!s){se.warn(`Unknown arrow type: ${r}`);return}let o=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${n}#${i}_${a}-${s}${o})`)},"addEdgeMarker"),ese={},jo={},rrr=b(async(e,t)=>{let r=Be(),n=zn(r),i=e.insert("g").attr("class","edgeLabel"),a=i.insert("g").attr("class","label"),s=t.labelType==="markdown",o=await rs(e,t.label,{style:t.labelStyle,useHtmlLabels:n,addSvgBackground:s,isNode:!1,markdown:s,width:s?void 0:Number.POSITIVE_INFINITY},r);a.node().appendChild(o);let l=o.getBBox(),u=l;if(n){let f=o.children[0],d=ct(o);l=f.getBoundingClientRect(),u=l,d.attr("width",l.width),d.attr("height",l.height)}else{let f=ct(o).select("text").node();f&&typeof f.getBBox=="function"&&(u=f.getBBox())}a.attr("transform",_u(u,n)),ese[t.id]=i,t.width=l.width,t.height=l.height;let h;if(t.startLabelLeft){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(d,t.startLabelLeft,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].startLeft=f,W6(h,t.startLabelLeft)}if(t.startLabelRight){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(d,t.startLabelRight,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].startRight=f,W6(h,t.startLabelRight)}if(t.endLabelLeft){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(f,t.endLabelLeft,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].endLeft=f,W6(h,t.endLabelLeft)}if(t.endLabelRight){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(f,t.endLabelRight,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].endRight=f,W6(h,t.endLabelRight)}return o},"insertEdgeLabel");b(W6,"setTerminalWidth");nrr=b((e,t)=>{se.debug("Moving label abc88 ",e.id,e.label,ese[e.id],t);let r=t.updatedPath?t.updatedPath:t.originalPath,n=Be(),{subGraphTitleTotalMargin:i}=yh(n);if(e.label){let a=ese[e.id],s=e.x,o=e.y;if(r){let l=pr.calcLabelPosition(r);se.debug("Moving label "+e.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(e.startLabelLeft){let a=jo[e.id].startLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.startLabelRight){let a=jo[e.id].startRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelLeft){let a=jo[e.id].endLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelRight){let a=jo[e.id].endRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}},"positionEdgeLabel"),irr=b((e,t)=>{let r=e.x,n=e.y,i=Math.abs(t.x-r),a=Math.abs(t.y-n),s=e.width/2,o=e.height/2;return i>=s||a>=o},"outsideNode"),arr=b((e,t,r)=>{se.debug(`intersection calc abc89: +`,"getStyles"),Vtr=qtr,Wtr=b((e,t,r,n)=>{t.forEach(i=>{err[i](e,r,n)})},"insertMarkers"),Htr=b((e,t,r)=>{se.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),Utr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Ytr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),Xtr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),jtr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Ktr=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Ztr=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),Qtr=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),Jtr=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),err={extension:Htr,composition:Utr,aggregation:Ytr,dependency:Xtr,lollipop:jtr,point:Ktr,circle:Ztr,cross:Qtr,barb:Jtr},trr=Wtr;b(tse,"calculateBlockPosition");rrr=b(e=>{let t=0,r=0;for(let n of e.children){let{width:i,height:a,x:s,y:o}=n.size??{width:0,height:0,x:0,y:0};if(se.debug("getMaxChildSize abc95 child:",n.id,"width:",i,"height:",a,"x:",s,"y:",o,n.type),n.type==="space")continue;let l=i/(n.widthInColumns??1);l>t&&(t=l),a>r&&(r=a)}return{width:t,height:r}},"getMaxChildSize");b(WO,"setBlockSizes");b(ose,"layoutBlocks");b(lse,"findBounds");b(zJe,"layout");nrr=b(async(e,t,r,n=!1,i=!1)=>{let a=t||"";typeof a=="object"&&(a=a[0]);let s=Be(),o=zn(s);return await rs(e,a,{style:r,isTitle:n,useHtmlLabels:o,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},s)},"createLabel"),Gh=nrr,irr=b((e,t,r,n,i)=>{t.arrowTypeStart&&EJe(e,"start",t.arrowTypeStart,r,n,i),t.arrowTypeEnd&&EJe(e,"end",t.arrowTypeEnd,r,n,i)},"addEdgeMarkers"),arr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},EJe=b((e,t,r,n,i,a)=>{let s=arr[r];if(!s){se.warn(`Unknown arrow type: ${r}`);return}let o=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${n}#${i}_${a}-${s}${o})`)},"addEdgeMarker"),rse={},jo={},srr=b(async(e,t)=>{let r=Be(),n=zn(r),i=e.insert("g").attr("class","edgeLabel"),a=i.insert("g").attr("class","label"),s=t.labelType==="markdown",o=await rs(e,t.label,{style:t.labelStyle,useHtmlLabels:n,addSvgBackground:s,isNode:!1,markdown:s,width:s?void 0:Number.POSITIVE_INFINITY},r);a.node().appendChild(o);let l=o.getBBox(),u=l;if(n){let f=o.children[0],d=ct(o);l=f.getBoundingClientRect(),u=l,d.attr("width",l.width),d.attr("height",l.height)}else{let f=ct(o).select("text").node();f&&typeof f.getBBox=="function"&&(u=f.getBBox())}a.attr("transform",_u(u,n)),rse[t.id]=i,t.width=l.width,t.height=l.height;let h;if(t.startLabelLeft){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(d,t.startLabelLeft,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].startLeft=f,W6(h,t.startLabelLeft)}if(t.startLabelRight){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(d,t.startLabelRight,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].startRight=f,W6(h,t.startLabelRight)}if(t.endLabelLeft){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(f,t.endLabelLeft,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].endLeft=f,W6(h,t.endLabelLeft)}if(t.endLabelRight){let f=e.insert("g").attr("class","edgeTerminals"),d=f.insert("g").attr("class","inner"),p=await Gh(f,t.endLabelRight,t.labelStyle);h=p;let m=p.getBBox();if(n){let g=p.children[0],y=ct(p);m=g.getBoundingClientRect(),y.attr("width",m.width),y.attr("height",m.height)}d.attr("transform",_u(m,n)),jo[t.id]||(jo[t.id]={}),jo[t.id].endRight=f,W6(h,t.endLabelRight)}return o},"insertEdgeLabel");b(W6,"setTerminalWidth");orr=b((e,t)=>{se.debug("Moving label abc88 ",e.id,e.label,rse[e.id],t);let r=t.updatedPath?t.updatedPath:t.originalPath,n=Be(),{subGraphTitleTotalMargin:i}=yh(n);if(e.label){let a=rse[e.id],s=e.x,o=e.y;if(r){let l=pr.calcLabelPosition(r);se.debug("Moving label "+e.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(e.startLabelLeft){let a=jo[e.id].startLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.startLabelRight){let a=jo[e.id].startRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelLeft){let a=jo[e.id].endLeft,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelRight){let a=jo[e.id].endRight,s=e.x,o=e.y;if(r){let l=pr.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}},"positionEdgeLabel"),lrr=b((e,t)=>{let r=e.x,n=e.y,i=Math.abs(t.x-r),a=Math.abs(t.y-n),s=e.width/2,o=e.height/2;return i>=s||a>=o},"outsideNode"),crr=b((e,t,r)=>{se.debug(`intersection calc abc89: outsidePoint: ${JSON.stringify(t)} insidePoint : ${JSON.stringify(r)} - node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let n=e.x,i=e.y,a=Math.abs(n-r.x),s=e.width/2,o=r.xMath.abs(n-t.x)*l){let f=r.y{se.debug("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],i=!1;return e.forEach(a=>{if(!irr(t,a)&&!i){let s=arr(t,n,a),o=!1;r.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),r.some(l=>l.x===s.x&&l.y===s.y)||r.push(s),i=!0}else n=a,i||r.push(a)}),r},"cutPathAtIntersect"),srr=b(function(e,t,r,n,i,a,s){let o=r.points;se.debug("abc88 InsertEdge: edge=",r,"e=",t);let l=!1,u=a.node(t.v);var h=a.node(t.w);h?.intersect&&u?.intersect&&(o=o.slice(1,r.points.length-1),o.unshift(u.intersect(o[0])),o.push(h.intersect(o[o.length-1]))),r.toCluster&&(se.debug("to cluster abc88",n[r.toCluster]),o=SJe(r.points,n[r.toCluster].node),l=!0),r.fromCluster&&(se.debug("from cluster abc88",n[r.fromCluster]),o=SJe(o.reverse(),n[r.fromCluster].node).reverse(),l=!0);let f=o.filter(C=>!Number.isNaN(C.y)),d=Ff;r.curve&&(i==="graph"||i==="flowchart")&&(d=r.curve);let{x:p,y:m}=OR(r),g=Bf().x(p).y(m).curve(d),y;switch(r.thickness){case"normal":y="edge-thickness-normal";break;case"thick":y="edge-thickness-thick";break;case"invisible":y="edge-thickness-thick";break;default:y=""}switch(r.pattern){case"solid":y+=" edge-pattern-solid";break;case"dotted":y+=" edge-pattern-dotted";break;case"dashed":y+=" edge-pattern-dashed";break}let v=e.append("path").attr("d",g(f)).attr("id",r.id).attr("class"," "+y+(r.classes?" "+r.classes:"")).attr("style",r.style),x="";(Be().flowchart.arrowMarkerAbsolute||Be().state.arrowMarkerAbsolute)&&(x=gy(!0)),err(v,r,x,s,i);let w={};return l&&(w.updatedPath=o),w.originalPath=r.points,w},"insertEdge"),orr=b(e=>{let t=new Set;for(let r of e)switch(r){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(r);break}return t},"expandAndDeduplicateDirections"),lrr=b((e,t,r,n)=>{let i=orr(e),a=2,s=t.height+2*r.padding,o=s/a,l=n??t.width+2*o+r.padding,u=r.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:o,y:0},{x:l/2,y:2*u},{x:l-o,y:0},{x:l,y:0},{x:l,y:-s/3},{x:l+2*u,y:-s/2},{x:l,y:-2*s/3},{x:l,y:-s},{x:l-o,y:-s},{x:l/2,y:-s-2*u},{x:o,y:-s},{x:0,y:-s},{x:0,y:-2*s/3},{x:-2*u,y:-s/2},{x:0,y:-s/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:o,y:0},{x:l-o,y:0},{x:l,y:-s/2},{x:l-o,y:-s},{x:o,y:-s},{x:0,y:-s/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:o,y:-s},{x:l-o,y:-s},{x:l,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:l,y:-o},{x:l,y:-s+o},{x:0,y:-s}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:l,y:0},{x:0,y:-o},{x:0,y:-s+o},{x:l,y:-s}]:i.has("right")&&i.has("left")?[{x:o,y:0},{x:o,y:-u},{x:l-o,y:-u},{x:l-o,y:0},{x:l,y:-s/2},{x:l-o,y:-s},{x:l-o,y:-s+u},{x:o,y:-s+u},{x:o,y:-s},{x:0,y:-s/2}]:i.has("up")&&i.has("down")?[{x:l/2,y:0},{x:0,y:-u},{x:o,y:-u},{x:o,y:-s+u},{x:0,y:-s+u},{x:l/2,y:-s},{x:l,y:-s+u},{x:l-o,y:-s+u},{x:l-o,y:-u},{x:l,y:-u}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:l,y:-o},{x:0,y:-s}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:l,y:0},{x:0,y:-s}]:i.has("left")&&i.has("up")?[{x:l,y:0},{x:0,y:-o},{x:l,y:-s}]:i.has("left")&&i.has("down")?[{x:l,y:0},{x:0,y:0},{x:l,y:-s}]:i.has("right")?[{x:o,y:-u},{x:o,y:-u},{x:l-o,y:-u},{x:l-o,y:0},{x:l,y:-s/2},{x:l-o,y:-s},{x:l-o,y:-s+u},{x:o,y:-s+u},{x:o,y:-s+u}]:i.has("left")?[{x:o,y:0},{x:o,y:-u},{x:l-o,y:-u},{x:l-o,y:-s+u},{x:o,y:-s+u},{x:o,y:-s},{x:0,y:-s/2}]:i.has("up")?[{x:o,y:-u},{x:o,y:-s+u},{x:0,y:-s+u},{x:l/2,y:-s},{x:l,y:-s+u},{x:l-o,y:-s+u},{x:l-o,y:-u}]:i.has("down")?[{x:l/2,y:0},{x:0,y:-u},{x:o,y:-u},{x:o,y:-s+u},{x:l-o,y:-s+u},{x:l-o,y:-u},{x:l,y:-u}]:[{x:0,y:0}]},"getArrowPoints");b($Je,"intersectNode");crr=$Je;b(zJe,"intersectEllipse");GJe=zJe;b(qJe,"intersectCircle");urr=qJe;b(VJe,"intersectLine");b(tse,"sameSign");hrr=VJe,frr=WJe;b(WJe,"intersectPolygon");drr=b((e,t)=>{var r=e.x,n=e.y,i=t.x-r,a=t.y-n,s=e.width/2,o=e.height/2,l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=a===0?0:o*i/a,u=o):(i<0&&(s=-s),l=s,u=i===0?0:s*a/i),{x:r+l,y:n+u}},"intersectRect"),prr=drr,ua={node:crr,circle:urr,ellipse:GJe,polygon:frr,rect:prr},Xs=b(async(e,t,r,n)=>{let i=Be(),a,s=t.useHtmlLabels||zn(i);r?a=r:a="node default";let o=e.insert("g").attr("class",a).attr("id",t.domId||t.id),l=o.insert("g").attr("class","label").attr("style",t.labelStyle),u;t.labelText===void 0?u="":u=typeof t.labelText=="string"?t.labelText:t.labelText[0];let h;t.labelType==="markdown"?h=rs(l,Mr($c(u),i),{useHtmlLabels:s,width:t.width||i.flowchart.wrappingWidth,classes:"markdown-node-label"},i):h=await Gh(l,Mr($c(u),i),t.labelStyle,!1,n);let f=h.getBBox(),d=t.padding/2;if(zn(i)){let p=h.children[0],m=ct(h);await V3(p,u),f=p.getBoundingClientRect(),m.attr("width",f.width),m.attr("height",f.height)}return s?l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):l.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:o,bbox:f,halfPadding:d,label:l}},"labelHelper"),Na=b((e,t)=>{let r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds");b(Vh,"insertPolygonShape");mrr=b(async(e,t)=>{t.useHtmlLabels||zn(Be())||(t.centerLabel=!0);let{shapeSvg:n,bbox:i,halfPadding:a}=await Xs(e,t,"node "+t.classes,!0);se.info("Classes = ",t.classes);let s=n.insert("rect",":first-child");return s.attr("rx",t.rx).attr("ry",t.ry).attr("x",-i.width/2-a).attr("y",-i.height/2-a).attr("width",i.width+t.padding).attr("height",i.height+t.padding),Na(t,s),t.intersect=function(o){return ua.rect(t,o)},n},"note"),grr=mrr,EJe=b(e=>e?" "+e:"","formatClass"),nu=b((e,t)=>`${t||"node default"}${EJe(e.classes)} ${EJe(e.class)}`,"getClassesFromNode"),AJe=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=i+a,o=[{x:s/2,y:0},{x:s,y:-s/2},{x:s/2,y:-s},{x:0,y:-s/2}];se.info("Question main (Circle)");let l=Vh(r,s,s,o);return l.attr("style",t.style),Na(t,l),t.intersect=function(u){return se.warn("Intersect called"),ua.polygon(t,o,u)},r},"question"),yrr=b((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=28,i=[{x:0,y:n/2},{x:n/2,y:0},{x:0,y:-n/2},{x:-n/2,y:0}];return r.insert("polygon",":first-child").attr("points",i.map(function(s){return s.x+","+s.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(s){return ua.circle(t,14,s)},r},"choice"),vrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=4,a=t.positioned?t.height:n.height+t.padding,s=a/i,o=t.positioned?t.width:n.width+2*s+t.padding,l=[{x:s,y:0},{x:o-s,y:0},{x:o,y:-a/2},{x:o-s,y:-a},{x:s,y:-a},{x:0,y:-a/2}],u=Vh(r,o,a,l);return u.attr("style",t.style),Na(t,u),t.intersect=function(h){return ua.polygon(t,l,h)},r},"hexagon"),xrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,void 0,!0),i=2,a=n.height+2*t.padding,s=a/i,o=n.width+2*s+t.padding,u=t.positioned&&(t.widthInColumns??1)>1&&t.width>o?t.width:o,h=lrr(t.directions,n,t,u),f=Vh(r,u,a,h);return f.attr("style",t.style),Na(t,f),t.intersect=function(d){return ua.polygon(t,h,d)},r},"block_arrow"),brr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:-a/2,y:0},{x:i,y:0},{x:i,y:-a},{x:-a/2,y:-a},{x:0,y:-a/2}];return Vh(r,i,a,s).attr("style",t.style),t.width=i+a,t.height=a,t.intersect=function(l){return ua.polygon(t,s,l)},r},"rect_left_inv_arrow"),wrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:-2*a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"lean_right"),krr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:2*a/6,y:0},{x:i+a/6,y:0},{x:i-2*a/6,y:-a},{x:-a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"lean_left"),Trr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:-2*a/6,y:0},{x:i+2*a/6,y:0},{x:i-a/6,y:-a},{x:a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"trapezoid"),Crr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:-2*a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"inv_trapezoid"),Srr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:0,y:0},{x:i+a/2,y:0},{x:i,y:-a/2},{x:i+a/2,y:-a},{x:0,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"rect_right_inv_arrow"),Err=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=i/2,s=a/(2.5+i/50),o=n.height+s+t.padding,l="M 0,"+s+" a "+a+","+s+" 0,0,0 "+i+" 0 a "+a+","+s+" 0,0,0 "+-i+" 0 l 0,"+o+" a "+a+","+s+" 0,0,0 "+i+" 0 l 0,"+-o,u=r.attr("label-offset-y",s).insert("path",":first-child").attr("style",t.style).attr("d",l).attr("transform","translate("+-i/2+","+-(o/2+s)+")");return Na(t,u),t.intersect=function(h){let f=ua.rect(t,h),d=f.x-t.x;if(a!=0&&(Math.abs(d)t.height/2-s)){let p=s*s*(1-d*d/(a*a));p!=0&&(p=Math.sqrt(p)),p=s-p,h.y-t.y>0&&(p=-p),f.y+=p}return f},r},"cylinder"),Arr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,"node "+t.classes+" "+t.class,!0),a=r.insert("rect",":first-child"),s=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,l=t.positioned?-s/2:-n.width/2-i,u=t.positioned?-o/2:-n.height/2-i;if(a.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",o),t.props){let h=new Set(Object.keys(t.props));t.props.borders&&(HO(a,t.props.borders,s,o),h.delete("borders")),h.forEach(f=>{se.warn(`Unknown node property ${f}`)})}return Na(t,a),t.intersect=function(h){return ua.rect(t,h)},r},"rect"),_rr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,"node "+t.classes,!0),a=r.insert("rect",":first-child"),s=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,l=t.positioned?-s/2:-n.width/2-i,u=t.positioned?-o/2:-n.height/2-i;if(a.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",o),t.props){let h=new Set(Object.keys(t.props));t.props.borders&&(HO(a,t.props.borders,s,o),h.delete("borders")),h.forEach(f=>{se.warn(`Unknown node property ${f}`)})}return Na(t,a),t.intersect=function(h){return ua.rect(t,h)},r},"composite"),Rrr=b(async(e,t)=>{let{shapeSvg:r}=await Xs(e,t,"label",!0);se.trace("Classes = ",t.class);let n=r.insert("rect",":first-child"),i=0,a=0;if(n.attr("width",i).attr("height",a),r.attr("class","label edgeLabel"),t.props){let s=new Set(Object.keys(t.props));t.props.borders&&(HO(n,t.props.borders,i,a),s.delete("borders")),s.forEach(o=>{se.warn(`Unknown node property ${o}`)})}return Na(t,n),t.intersect=function(s){return ua.rect(t,s)},r},"labelRect");b(HO,"applyNodePropertyBorders");Lrr=b(async(e,t)=>{let r;t.classes?r="node "+t.classes:r="node default";let n=e.insert("g").attr("class",r).attr("id",t.domId||t.id),i=n.insert("rect",":first-child"),a=n.insert("line"),s=n.insert("g").attr("class","label"),o=t.labelText.flat?t.labelText.flat():t.labelText,l="";typeof o=="object"?l=o[0]:l=o,se.info("Label text abc79",l,o,typeof o=="object");let u=await Gh(s,l,t.labelStyle,!0,!0),h={width:0,height:0};if(zn(Be())){let g=u.children[0],y=ct(u);h=g.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height)}se.info("Text 2",o);let f=o.slice(1,o.length),d=u.getBBox(),p=await Gh(s,f.join?f.join("
"):f,t.labelStyle,!0,!0);if(zn(Be())){let g=p.children[0],y=ct(p);h=g.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height)}let m=t.padding/2;return ct(p).attr("transform","translate( "+(h.width>d.width?0:(d.width-h.width)/2)+", "+(d.height+m+5)+")"),ct(u).attr("transform","translate( "+(h.width{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.height+t.padding,a=n.width+i/4+t.padding,s=r.insert("rect",":first-child").attr("style",t.style).attr("rx",i/2).attr("ry",i/2).attr("x",-a/2).attr("y",-i/2).attr("width",a).attr("height",i);return Na(t,s),t.intersect=function(o){return ua.rect(t,o)},r},"stadium"),Mrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,nu(t,void 0),!0),a=r.insert("circle",":first-child");return a.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+i).attr("width",n.width+t.padding).attr("height",n.height+t.padding),se.info("Circle main"),Na(t,a),t.intersect=function(s){return se.info("Circle intersect",t,n.width/2+i,s),ua.circle(t,n.width/2+i,s)},r},"circle"),Nrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,nu(t,void 0),!0),a=5,s=r.insert("g",":first-child"),o=s.insert("circle"),l=s.insert("circle");return s.attr("class",t.class),o.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+i+a).attr("width",n.width+t.padding+a*2).attr("height",n.height+t.padding+a*2),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+i).attr("width",n.width+t.padding).attr("height",n.height+t.padding),se.info("DoubleCircle main"),Na(t,o),t.intersect=function(u){return se.info("DoubleCircle intersect",t,n.width/2+i+a,u),ua.circle(t,n.width/2+i+a,u)},r},"doublecircle"),Drr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:0,y:0},{x:i,y:0},{x:i,y:-a},{x:0,y:-a},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-a},{x:-8,y:-a},{x:-8,y:0}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"subroutine"),Orr=b((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=r.insert("circle",":first-child");return n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),Na(t,n),t.intersect=function(i){return ua.circle(t,7,i)},r},"start"),_Je=b((e,t,r)=>{let n=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=70,a=10;r==="LR"&&(i=10,a=70);let s=n.append("rect").attr("x",-1*i/2).attr("y",-1*a/2).attr("width",i).attr("height",a).attr("class","fork-join");return Na(t,s),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(o){return ua.rect(t,o)},n},"forkJoin"),Prr=b((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=r.insert("circle",":first-child"),i=r.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),n.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),Na(t,i),t.intersect=function(a){return ua.circle(t,7,a)},r},"end"),Brr=b(async(e,t)=>{let r=t.padding/2,n=4,i=8,a;t.classes?a="node "+t.classes:a="node default";let s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),o=s.insert("rect",":first-child"),l=s.insert("line"),u=s.insert("line"),h=0,f=n,d=s.insert("g").attr("class","label"),p=0,m=t.classData.annotations?.[0],g=t.classData.annotations[0]?"\xAB"+t.classData.annotations[0]+"\xBB":"",y=await Gh(d,g,t.labelStyle,!0,!0),v=y.getBBox();if(zn(Be())){let E=y.children[0],I=ct(y);v=E.getBoundingClientRect(),I.attr("width",v.width),I.attr("height",v.height)}t.classData.annotations[0]&&(f+=v.height+n,h+=v.width);let x=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(zn(Be())?x+="<"+t.classData.type+">":x+="<"+t.classData.type+">");let w=await Gh(d,x,t.labelStyle,!0,!0);ct(w).attr("class","classTitle");let C=w.getBBox();if(zn(Be())){let E=w.children[0],I=ct(w);C=E.getBoundingClientRect(),I.attr("width",C.width),I.attr("height",C.height)}f+=C.height+n,C.width>h&&(h=C.width);let T=[];t.classData.members.forEach(async E=>{let I=E.getDisplayDetails(),L=I.displayText;zn(Be())&&(L=L.replace(//g,">"));let O=await Gh(d,L,I.cssStyle?I.cssStyle:t.labelStyle,!0,!0),R=O.getBBox();if(zn(Be())){let A=O.children[0],N=ct(O);R=A.getBoundingClientRect(),N.attr("width",R.width),N.attr("height",R.height)}R.width>h&&(h=R.width),f+=R.height+n,T.push(O)}),f+=i;let k=[];if(t.classData.methods.forEach(async E=>{let I=E.getDisplayDetails(),L=I.displayText;zn(Be())&&(L=L.replace(//g,">"));let O=await Gh(d,L,I.cssStyle?I.cssStyle:t.labelStyle,!0,!0),R=O.getBBox();if(zn(Be())){let A=O.children[0],N=ct(O);R=A.getBoundingClientRect(),N.attr("width",R.width),N.attr("height",R.height)}R.width>h&&(h=R.width),f+=R.height+n,k.push(O)}),f+=i,m){let E=(h-v.width)/2;ct(y).attr("transform","translate( "+(-1*h/2+E)+", "+-1*f/2+")"),p=v.height+n}let S=(h-C.width)/2;return ct(w).attr("transform","translate( "+(-1*h/2+S)+", "+(-1*f/2+p)+")"),p+=C.height+n,l.attr("class","divider").attr("x1",-h/2-r).attr("x2",h/2+r).attr("y1",-f/2-r+i+p).attr("y2",-f/2-r+i+p),p+=i,T.forEach(E=>{ct(E).attr("transform","translate( "+-h/2+", "+(-1*f/2+p+i/2)+")");let I=E?.getBBox();p+=(I?.height??0)+n}),p+=i,u.attr("class","divider").attr("x1",-h/2-r).attr("x2",h/2+r).attr("y1",-f/2-r+i+p).attr("y2",-f/2-r+i+p),p+=i,k.forEach(E=>{ct(E).attr("transform","translate( "+-h/2+", "+(-1*f/2+p)+")");let I=E?.getBBox();p+=(I?.height??0)+n}),o.attr("style",t.style).attr("class","outer title-state").attr("x",-h/2-r).attr("y",-(f/2)-r).attr("width",h+t.padding).attr("height",f+t.padding),Na(t,o),t.intersect=function(E){return ua.rect(t,E)},s},"class_box"),RJe={rhombus:AJe,composite:_rr,question:AJe,rect:Arr,labelRect:Rrr,rectWithTitle:Lrr,choice:yrr,circle:Mrr,doublecircle:Nrr,stadium:Irr,hexagon:vrr,block_arrow:xrr,rect_left_inv_arrow:brr,lean_right:wrr,lean_left:krr,trapezoid:Trr,inv_trapezoid:Crr,rect_right_inv_arrow:Srr,cylinder:Err,start:Orr,end:Prr,note:grr,subroutine:Drr,fork:_Je,join:_Je,class_box:Brr},qO={},HJe=b(async(e,t,r)=>{let n,i;if(t.link){let a;Be().securityLevel==="sandbox"?a="_top":t.linkTarget&&(a=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",a),i=await RJe[t.shape](n,t,r)}else i=await RJe[t.shape](e,t,r),n=i;return t.tooltip&&i.attr("title",t.tooltip),t.class&&i.attr("class","node default "+t.class),qO[t.id]=n,t.haveCallback&&qO[t.id].attr("class",qO[t.id].attr("class")+" clickable"),n},"insertNode"),Frr=b(e=>{let t=qO[e.id];se.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");let r=8,n=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+n-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),n},"positionNode");b(ose,"getNodeFromBlock");b(UJe,"calculateBlockSize");b(YJe,"insertBlockPositioned");b(UO,"performOperations");b(XJe,"calculateBlockSizes");b(jJe,"insertBlocks");b(KJe,"insertEdges");$rr=b(function(e,t){return t.db.getClasses()},"getClasses"),zrr=b(async function(e,t,r,n){let{securityLevel:i,block:a}=qt(),s=n.db;s.setDiagramId(t);let o;i==="sandbox"&&(o=ct("#i"+t));let l=i==="sandbox"?ct(o.nodes()[0].contentDocument.body):ct("body"),u=i==="sandbox"?l.select(`[id="${t}"]`):ct(`[id="${t}"]`);Ztr(u,["point","circle","cross"],n.type,t);let f=s.getBlocks(),d=s.getBlocksFlat(),p=s.getEdges(),m=u.insert("g").attr("class","block");await XJe(m,f,s);let g=FJe(s);if(await jJe(m,f,s),await KJe(m,p,d,s,t),g){let y=g,v=Math.max(1,Math.round(.125*(y.width/y.height))),x=y.height+v+10,w=y.width+10,{useMaxWidth:C}=a;vn(u,x,w,!!C),se.debug("Here Bounds",g,y),u.attr("viewBox",`${y.x-5} ${y.y-5} ${y.width+10} ${y.height+10}`)}},"draw"),Grr={draw:zrr,getClasses:$rr},qrr={parser:ytr,db:Btr,renderer:Grr,styles:$tr}});var fet={};Tr(fet,{diagram:()=>hnr});function aet(e){return e.some(t=>net.test(t))}function set(e){for(let t of e){let r=iet.exec(t);if(r?.index&&r.index>0)return r.index}return 4}function oet(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(r,n)=>{let i=parseInt(n,10),a=t.get(i);return a?`line ${a}`:r})}function cet(e){let t=e.split(` -`),r=new Map,n=-1;for(let[l,u]of t.entries())if(u.trim()==="treeView-beta"){n=l;break}if(n===-1)return{text:e,lineMap:r};let i=[];for(let l=n+1;l0){let i=e.substring(n).toLowerCase(),a=t?.extensionIcons;return a?.[i]??a?.[i.slice(1)]}}function cse(e,t){return e.includes(":")?e:e in U6.icons||!t?`${U6.prefix}:${e}`:`${t}:${e}`}function hse(e,t){if(e.icon!=="none"){if(e.icon)return cse(e.icon,t.defaultIconPack);if(t.showIcons){if(e.nodeType==="file"){let r=uet(e.name,t);if(r==="none")return;if(r)return cse(r,t.defaultIconPack)}return`${U6.prefix}:${e.nodeType==="directory"?"folder":"file"}`}}}var net,iet,Vrr,JJe,eet,tet,Wrr,Sd,Hrr,Urr,Yrr,Xrr,jrr,Krr,Zrr,lse,Qrr,Jrr,U6,use,enr,tnr,het,rnr,nnr,ret,inr,anr,snr,onr,lnr,cnr,unr,hnr,det=W(()=>{FI();Sl();za();ts();Sn();_r();Rr();hr();Co();net=/[─━│┃└┗├┣]/,iet=/[└┗├┣]/,Vrr=/[─━]/,JJe=/^[\s│┃]+$/,eet=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,tet=/^\s*%%/,Wrr=" ";b(aet,"isBoxDrawingFormat");b(set,"inferSegmentWidth");b(oet,"remapErrorLines");b(cet,"preprocessBoxDrawing");Sd=new aw(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),Hrr=b(()=>{Sd.reset(),Nr()},"clear"),Urr=b(()=>Sd.records.stack[0],"getRoot"),Yrr=b(()=>Sd.records.cnt,"getCount"),Xrr=Lr.treeView,jrr=b(()=>Rn(Xrr,qt().treeView),"getConfig"),Krr=b((e,t,r,n,i,a)=>{for(;e<=Sd.records.stack[Sd.records.stack.length-1].level;)Sd.records.stack.pop();let s={id:Sd.records.cnt++,level:e,name:t,nodeType:r,icon:i,cssClass:n,description:a,children:[]};Sd.records.stack[Sd.records.stack.length-1].children.push(s),Sd.records.stack.push(s)},"addNode"),Zrr={clear:Hrr,addNode:Krr,getRoot:Urr,getCount:Yrr,getConfig:jrr,getAccTitle:Qr,getAccDescription:en,getDiagramTitle:tn,setAccDescription:Jr,setAccTitle:Yr,setDiagramTitle:ln},lse=Zrr,Qrr=b(e=>{wi(e,lse);for(let t of e.nodes){let r=typeof t.indent=="number"?t.indent:0,n=t.name,i=n.endsWith("/");i&&(n=n.slice(0,-1));let a=i?"directory":"file",s=t.classAnnotation||void 0,o=t.iconAnnotation,l=o!==void 0?o||"none":void 0,u=t.descAnnotation||void 0,h=u?Mr(u,qt()):void 0;lse.addNode(r,n,a,s,l,h)}},"populate"),Jrr={parse:b(async e=>{let{text:t,lineMap:r}=cet(e);try{let n=await ba("treeView",t);se.debug(n),Qrr(n)}catch(n){throw r.size>0&&n instanceof Error&&(n.message=oet(n.message,r)),n}},"parse")},U6={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};b(uet,"detectIcon");b(cse,"qualifyIcon");b(hse,"getNodeIcon");f4([{name:U6.prefix,icons:U6}]);use=14,enr=4,tnr=16,het=b((e,t)=>`tv-icon-${e}-${t.replace(/[^\w-]/g,"-")}`,"iconSymbolId"),rnr=b(async(e,t,r,n)=>{let i=new Set,a=b(l=>{let u=hse(l,r);u&&i.add(u),l.children.forEach(a)},"collect");if(a(t),i.size===0)return;let s=await Promise.all([...i].map(async l=>({icon:l,svg:await zc(l,{height:use,width:use})}))),o=e.append("defs");for(let{icon:l,svg:u}of s)o.append("g").attr("id",het(n,l)).html(u)},"injectIconDefs"),nnr=b((e,t,r,n,i,a)=>{let s=n.append("g"),o="treeView-node-label";r.nodeType==="directory"&&(o+=" treeView-node-dir"),r.cssClass&&(o+=` ${r.cssClass}`);let l=use+enr,u=hse(r,i),h=u!==void 0;u&&s.append("use").attr("xlink:href",`#${het(a,u)}`).attr("x",e+i.paddingX).attr("y",t+i.paddingY).attr("class","treeView-node-icon");let f=s.append("text").text(r.name).attr("dominant-baseline","middle").attr("class",o),{height:d,width:p}=f.node().getBBox(),m=d+i.paddingY*2,g=e+i.paddingX+(h?l:0);f.attr("x",g),f.attr("y",t+m/2);let y=g+p,v=p+i.paddingX*2+(h?l:0);return r.BBox={x:e,y:t,width:v,height:m},r.cssClass?.split(/\s+/).includes("highlight")&&s.insert("rect",":first-child").attr("x",e).attr("y",t+1).attr("width",0).attr("height",m-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:r,nodeGroup:s,labelRightEdge:y,centerY:t+m/2}},"positionLabel"),ret=b((e,t,r,n,i,a)=>e.append("line").attr("x1",t).attr("y1",r).attr("x2",n).attr("y2",i).attr("stroke-width",a).attr("class","treeView-node-line"),"positionLine"),inr=b((e,t,r,n)=>{let i=0,a=0,s=[],o=b((h,f,d,p)=>{let m=p*(d.rowIndent+d.paddingX),g=nnr(m,i,f,h,d,n);s.push(g);let{height:y,width:v}=f.BBox;ret(h,m-d.rowIndent,i+y/2,m,i+y/2,d.lineThickness),a=Math.max(a,m+v),i+=y},"drawNode"),l=b((h,f=0)=>{o(e,h,r,f),h.children.forEach(g=>{l(g,f+1)});let{x:d,y:p,height:m}=h.BBox;if(h.children.length){let{y:g,height:y}=h.children[h.children.length-1].BBox;ret(e,d+r.paddingX,p+m,d+r.paddingX,g+y/2+r.lineThickness/2,r.lineThickness)}},"processNode");l(t);let u=s.filter(h=>h.node.description);if(u.length>0){let f=Math.max(...s.map(d=>d.labelRightEdge))+tnr;for(let d of u){let m=d.nodeGroup.append("text").text(d.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",f).attr("y",d.centerY).node().getBBox();a=Math.max(a,f+m.width+r.paddingX)}}for(let h of s)if(h.node.cssClass?.split(/\s+/).includes("highlight")){let f=h.nodeGroup.select(".treeView-highlight-bg");if(!f.empty()){let d=a-h.node.BBox.x+8;f.attr("width",d),a=Math.max(a,h.node.BBox.x+d+2)}}return{totalHeight:i,totalWidth:a}},"drawTree"),anr=b(async(e,t,r,n)=>{se.debug(`Rendering treeView diagram -`+e);let i=n.db,a=i.getRoot(),s=i.getConfig(),o=Qn(t);await rnr(o,a,s,t);let l=o.append("g");l.attr("class","tree-view");let{totalHeight:u,totalWidth:h}=inr(l,a,s,t);o.attr("viewBox",`-${s.lineThickness/2} 0 ${h} ${u}`),vn(o,u,h,s.useMaxWidth)},"draw"),snr={draw:anr},onr=snr,lnr={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},cnr=b(({treeView:e})=>{let{labelFontSize:t,labelColor:r,lineColor:n,iconColor:i,descriptionColor:a,highlightBg:s,highlightStroke:o}=Rn(lnr,e);return` + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let n=e.x,i=e.y,a=Math.abs(n-r.x),s=e.width/2,o=r.xMath.abs(n-t.x)*l){let f=r.y{se.debug("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],i=!1;return e.forEach(a=>{if(!lrr(t,a)&&!i){let s=crr(t,n,a),o=!1;r.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),r.some(l=>l.x===s.x&&l.y===s.y)||r.push(s),i=!0}else n=a,i||r.push(a)}),r},"cutPathAtIntersect"),urr=b(function(e,t,r,n,i,a,s){let o=r.points;se.debug("abc88 InsertEdge: edge=",r,"e=",t);let l=!1,u=a.node(t.v);var h=a.node(t.w);h?.intersect&&u?.intersect&&(o=o.slice(1,r.points.length-1),o.unshift(u.intersect(o[0])),o.push(h.intersect(o[o.length-1]))),r.toCluster&&(se.debug("to cluster abc88",n[r.toCluster]),o=AJe(r.points,n[r.toCluster].node),l=!0),r.fromCluster&&(se.debug("from cluster abc88",n[r.fromCluster]),o=AJe(o.reverse(),n[r.fromCluster].node).reverse(),l=!0);let f=o.filter(C=>!Number.isNaN(C.y)),d=Ff;r.curve&&(i==="graph"||i==="flowchart")&&(d=r.curve);let{x:p,y:m}=OR(r),g=Bf().x(p).y(m).curve(d),y;switch(r.thickness){case"normal":y="edge-thickness-normal";break;case"thick":y="edge-thickness-thick";break;case"invisible":y="edge-thickness-thick";break;default:y=""}switch(r.pattern){case"solid":y+=" edge-pattern-solid";break;case"dotted":y+=" edge-pattern-dotted";break;case"dashed":y+=" edge-pattern-dashed";break}let v=e.append("path").attr("d",g(f)).attr("id",r.id).attr("class"," "+y+(r.classes?" "+r.classes:"")).attr("style",r.style),x="";(Be().flowchart.arrowMarkerAbsolute||Be().state.arrowMarkerAbsolute)&&(x=gy(!0)),irr(v,r,x,s,i);let w={};return l&&(w.updatedPath=o),w.originalPath=r.points,w},"insertEdge"),hrr=b(e=>{let t=new Set;for(let r of e)switch(r){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(r);break}return t},"expandAndDeduplicateDirections"),frr=b((e,t,r,n)=>{let i=hrr(e),a=2,s=t.height+2*r.padding,o=s/a,l=n??t.width+2*o+r.padding,u=r.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:o,y:0},{x:l/2,y:2*u},{x:l-o,y:0},{x:l,y:0},{x:l,y:-s/3},{x:l+2*u,y:-s/2},{x:l,y:-2*s/3},{x:l,y:-s},{x:l-o,y:-s},{x:l/2,y:-s-2*u},{x:o,y:-s},{x:0,y:-s},{x:0,y:-2*s/3},{x:-2*u,y:-s/2},{x:0,y:-s/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:o,y:0},{x:l-o,y:0},{x:l,y:-s/2},{x:l-o,y:-s},{x:o,y:-s},{x:0,y:-s/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:o,y:-s},{x:l-o,y:-s},{x:l,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:l,y:-o},{x:l,y:-s+o},{x:0,y:-s}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:l,y:0},{x:0,y:-o},{x:0,y:-s+o},{x:l,y:-s}]:i.has("right")&&i.has("left")?[{x:o,y:0},{x:o,y:-u},{x:l-o,y:-u},{x:l-o,y:0},{x:l,y:-s/2},{x:l-o,y:-s},{x:l-o,y:-s+u},{x:o,y:-s+u},{x:o,y:-s},{x:0,y:-s/2}]:i.has("up")&&i.has("down")?[{x:l/2,y:0},{x:0,y:-u},{x:o,y:-u},{x:o,y:-s+u},{x:0,y:-s+u},{x:l/2,y:-s},{x:l,y:-s+u},{x:l-o,y:-s+u},{x:l-o,y:-u},{x:l,y:-u}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:l,y:-o},{x:0,y:-s}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:l,y:0},{x:0,y:-s}]:i.has("left")&&i.has("up")?[{x:l,y:0},{x:0,y:-o},{x:l,y:-s}]:i.has("left")&&i.has("down")?[{x:l,y:0},{x:0,y:0},{x:l,y:-s}]:i.has("right")?[{x:o,y:-u},{x:o,y:-u},{x:l-o,y:-u},{x:l-o,y:0},{x:l,y:-s/2},{x:l-o,y:-s},{x:l-o,y:-s+u},{x:o,y:-s+u},{x:o,y:-s+u}]:i.has("left")?[{x:o,y:0},{x:o,y:-u},{x:l-o,y:-u},{x:l-o,y:-s+u},{x:o,y:-s+u},{x:o,y:-s},{x:0,y:-s/2}]:i.has("up")?[{x:o,y:-u},{x:o,y:-s+u},{x:0,y:-s+u},{x:l/2,y:-s},{x:l,y:-s+u},{x:l-o,y:-s+u},{x:l-o,y:-u}]:i.has("down")?[{x:l/2,y:0},{x:0,y:-u},{x:o,y:-u},{x:o,y:-s+u},{x:l-o,y:-s+u},{x:l-o,y:-u},{x:l,y:-u}]:[{x:0,y:0}]},"getArrowPoints");b(GJe,"intersectNode");drr=GJe;b(qJe,"intersectEllipse");VJe=qJe;b(WJe,"intersectCircle");prr=WJe;b(HJe,"intersectLine");b(nse,"sameSign");mrr=HJe,grr=UJe;b(UJe,"intersectPolygon");yrr=b((e,t)=>{var r=e.x,n=e.y,i=t.x-r,a=t.y-n,s=e.width/2,o=e.height/2,l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=a===0?0:o*i/a,u=o):(i<0&&(s=-s),l=s,u=i===0?0:s*a/i),{x:r+l,y:n+u}},"intersectRect"),vrr=yrr,ua={node:drr,circle:prr,ellipse:VJe,polygon:grr,rect:vrr},Xs=b(async(e,t,r,n)=>{let i=Be(),a,s=t.useHtmlLabels||zn(i);r?a=r:a="node default";let o=e.insert("g").attr("class",a).attr("id",t.domId||t.id),l=o.insert("g").attr("class","label").attr("style",t.labelStyle),u;t.labelText===void 0?u="":u=typeof t.labelText=="string"?t.labelText:t.labelText[0];let h;t.labelType==="markdown"?h=rs(l,Mr($c(u),i),{useHtmlLabels:s,width:t.width||i.flowchart.wrappingWidth,classes:"markdown-node-label"},i):h=await Gh(l,Mr($c(u),i),t.labelStyle,!1,n);let f=h.getBBox(),d=t.padding/2;if(zn(i)){let p=h.children[0],m=ct(h);await V3(p,u),f=p.getBoundingClientRect(),m.attr("width",f.width),m.attr("height",f.height)}return s?l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):l.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:o,bbox:f,halfPadding:d,label:l}},"labelHelper"),Na=b((e,t)=>{let r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds");b(Vh,"insertPolygonShape");xrr=b(async(e,t)=>{t.useHtmlLabels||zn(Be())||(t.centerLabel=!0);let{shapeSvg:n,bbox:i,halfPadding:a}=await Xs(e,t,"node "+t.classes,!0);se.info("Classes = ",t.classes);let s=n.insert("rect",":first-child");return s.attr("rx",t.rx).attr("ry",t.ry).attr("x",-i.width/2-a).attr("y",-i.height/2-a).attr("width",i.width+t.padding).attr("height",i.height+t.padding),Na(t,s),t.intersect=function(o){return ua.rect(t,o)},n},"note"),brr=xrr,_Je=b(e=>e?" "+e:"","formatClass"),nu=b((e,t)=>`${t||"node default"}${_Je(e.classes)} ${_Je(e.class)}`,"getClassesFromNode"),RJe=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=i+a,o=[{x:s/2,y:0},{x:s,y:-s/2},{x:s/2,y:-s},{x:0,y:-s/2}];se.info("Question main (Circle)");let l=Vh(r,s,s,o);return l.attr("style",t.style),Na(t,l),t.intersect=function(u){return se.warn("Intersect called"),ua.polygon(t,o,u)},r},"question"),wrr=b((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=28,i=[{x:0,y:n/2},{x:n/2,y:0},{x:0,y:-n/2},{x:-n/2,y:0}];return r.insert("polygon",":first-child").attr("points",i.map(function(s){return s.x+","+s.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(s){return ua.circle(t,14,s)},r},"choice"),krr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=4,a=t.positioned?t.height:n.height+t.padding,s=a/i,o=t.positioned?t.width:n.width+2*s+t.padding,l=[{x:s,y:0},{x:o-s,y:0},{x:o,y:-a/2},{x:o-s,y:-a},{x:s,y:-a},{x:0,y:-a/2}],u=Vh(r,o,a,l);return u.attr("style",t.style),Na(t,u),t.intersect=function(h){return ua.polygon(t,l,h)},r},"hexagon"),Trr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,void 0,!0),i=2,a=n.height+2*t.padding,s=a/i,o=n.width+2*s+t.padding,u=t.positioned&&(t.widthInColumns??1)>1&&t.width>o?t.width:o,h=frr(t.directions,n,t,u),f=Vh(r,u,a,h);return f.attr("style",t.style),Na(t,f),t.intersect=function(d){return ua.polygon(t,h,d)},r},"block_arrow"),Crr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:-a/2,y:0},{x:i,y:0},{x:i,y:-a},{x:-a/2,y:-a},{x:0,y:-a/2}];return Vh(r,i,a,s).attr("style",t.style),t.width=i+a,t.height=a,t.intersect=function(l){return ua.polygon(t,s,l)},r},"rect_left_inv_arrow"),Srr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:-2*a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"lean_right"),Err=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:2*a/6,y:0},{x:i+a/6,y:0},{x:i-2*a/6,y:-a},{x:-a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"lean_left"),Arr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:-2*a/6,y:0},{x:i+2*a/6,y:0},{x:i-a/6,y:-a},{x:a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"trapezoid"),_rr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:-2*a/6,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"inv_trapezoid"),Rrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:0,y:0},{x:i+a/2,y:0},{x:i,y:-a/2},{x:i+a/2,y:-a},{x:0,y:-a}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"rect_right_inv_arrow"),Lrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=i/2,s=a/(2.5+i/50),o=n.height+s+t.padding,l="M 0,"+s+" a "+a+","+s+" 0,0,0 "+i+" 0 a "+a+","+s+" 0,0,0 "+-i+" 0 l 0,"+o+" a "+a+","+s+" 0,0,0 "+i+" 0 l 0,"+-o,u=r.attr("label-offset-y",s).insert("path",":first-child").attr("style",t.style).attr("d",l).attr("transform","translate("+-i/2+","+-(o/2+s)+")");return Na(t,u),t.intersect=function(h){let f=ua.rect(t,h),d=f.x-t.x;if(a!=0&&(Math.abs(d)t.height/2-s)){let p=s*s*(1-d*d/(a*a));p!=0&&(p=Math.sqrt(p)),p=s-p,h.y-t.y>0&&(p=-p),f.y+=p}return f},r},"cylinder"),Irr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,"node "+t.classes+" "+t.class,!0),a=r.insert("rect",":first-child"),s=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,l=t.positioned?-s/2:-n.width/2-i,u=t.positioned?-o/2:-n.height/2-i;if(a.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",o),t.props){let h=new Set(Object.keys(t.props));t.props.borders&&(HO(a,t.props.borders,s,o),h.delete("borders")),h.forEach(f=>{se.warn(`Unknown node property ${f}`)})}return Na(t,a),t.intersect=function(h){return ua.rect(t,h)},r},"rect"),Mrr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,"node "+t.classes,!0),a=r.insert("rect",":first-child"),s=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,l=t.positioned?-s/2:-n.width/2-i,u=t.positioned?-o/2:-n.height/2-i;if(a.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",o),t.props){let h=new Set(Object.keys(t.props));t.props.borders&&(HO(a,t.props.borders,s,o),h.delete("borders")),h.forEach(f=>{se.warn(`Unknown node property ${f}`)})}return Na(t,a),t.intersect=function(h){return ua.rect(t,h)},r},"composite"),Nrr=b(async(e,t)=>{let{shapeSvg:r}=await Xs(e,t,"label",!0);se.trace("Classes = ",t.class);let n=r.insert("rect",":first-child"),i=0,a=0;if(n.attr("width",i).attr("height",a),r.attr("class","label edgeLabel"),t.props){let s=new Set(Object.keys(t.props));t.props.borders&&(HO(n,t.props.borders,i,a),s.delete("borders")),s.forEach(o=>{se.warn(`Unknown node property ${o}`)})}return Na(t,n),t.intersect=function(s){return ua.rect(t,s)},r},"labelRect");b(HO,"applyNodePropertyBorders");Drr=b(async(e,t)=>{let r;t.classes?r="node "+t.classes:r="node default";let n=e.insert("g").attr("class",r).attr("id",t.domId||t.id),i=n.insert("rect",":first-child"),a=n.insert("line"),s=n.insert("g").attr("class","label"),o=t.labelText.flat?t.labelText.flat():t.labelText,l="";typeof o=="object"?l=o[0]:l=o,se.info("Label text abc79",l,o,typeof o=="object");let u=await Gh(s,l,t.labelStyle,!0,!0),h={width:0,height:0};if(zn(Be())){let g=u.children[0],y=ct(u);h=g.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height)}se.info("Text 2",o);let f=o.slice(1,o.length),d=u.getBBox(),p=await Gh(s,f.join?f.join("
"):f,t.labelStyle,!0,!0);if(zn(Be())){let g=p.children[0],y=ct(p);h=g.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height)}let m=t.padding/2;return ct(p).attr("transform","translate( "+(h.width>d.width?0:(d.width-h.width)/2)+", "+(d.height+m+5)+")"),ct(u).attr("transform","translate( "+(h.width{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.height+t.padding,a=n.width+i/4+t.padding,s=r.insert("rect",":first-child").attr("style",t.style).attr("rx",i/2).attr("ry",i/2).attr("x",-a/2).attr("y",-i/2).attr("width",a).attr("height",i);return Na(t,s),t.intersect=function(o){return ua.rect(t,o)},r},"stadium"),Prr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,nu(t,void 0),!0),a=r.insert("circle",":first-child");return a.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+i).attr("width",n.width+t.padding).attr("height",n.height+t.padding),se.info("Circle main"),Na(t,a),t.intersect=function(s){return se.info("Circle intersect",t,n.width/2+i,s),ua.circle(t,n.width/2+i,s)},r},"circle"),Brr=b(async(e,t)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Xs(e,t,nu(t,void 0),!0),a=5,s=r.insert("g",":first-child"),o=s.insert("circle"),l=s.insert("circle");return s.attr("class",t.class),o.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+i+a).attr("width",n.width+t.padding+a*2).attr("height",n.height+t.padding+a*2),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+i).attr("width",n.width+t.padding).attr("height",n.height+t.padding),se.info("DoubleCircle main"),Na(t,o),t.intersect=function(u){return se.info("DoubleCircle intersect",t,n.width/2+i+a,u),ua.circle(t,n.width/2+i+a,u)},r},"doublecircle"),Frr=b(async(e,t)=>{let{shapeSvg:r,bbox:n}=await Xs(e,t,nu(t,void 0),!0),i=n.width+t.padding,a=n.height+t.padding,s=[{x:0,y:0},{x:i,y:0},{x:i,y:-a},{x:0,y:-a},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-a},{x:-8,y:-a},{x:-8,y:0}],o=Vh(r,i,a,s);return o.attr("style",t.style),Na(t,o),t.intersect=function(l){return ua.polygon(t,s,l)},r},"subroutine"),$rr=b((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=r.insert("circle",":first-child");return n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),Na(t,n),t.intersect=function(i){return ua.circle(t,7,i)},r},"start"),LJe=b((e,t,r)=>{let n=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=70,a=10;r==="LR"&&(i=10,a=70);let s=n.append("rect").attr("x",-1*i/2).attr("y",-1*a/2).attr("width",i).attr("height",a).attr("class","fork-join");return Na(t,s),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(o){return ua.rect(t,o)},n},"forkJoin"),zrr=b((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=r.insert("circle",":first-child"),i=r.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),n.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),Na(t,i),t.intersect=function(a){return ua.circle(t,7,a)},r},"end"),Grr=b(async(e,t)=>{let r=t.padding/2,n=4,i=8,a;t.classes?a="node "+t.classes:a="node default";let s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),o=s.insert("rect",":first-child"),l=s.insert("line"),u=s.insert("line"),h=0,f=n,d=s.insert("g").attr("class","label"),p=0,m=t.classData.annotations?.[0],g=t.classData.annotations[0]?"\xAB"+t.classData.annotations[0]+"\xBB":"",y=await Gh(d,g,t.labelStyle,!0,!0),v=y.getBBox();if(zn(Be())){let E=y.children[0],I=ct(y);v=E.getBoundingClientRect(),I.attr("width",v.width),I.attr("height",v.height)}t.classData.annotations[0]&&(f+=v.height+n,h+=v.width);let x=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(zn(Be())?x+="<"+t.classData.type+">":x+="<"+t.classData.type+">");let w=await Gh(d,x,t.labelStyle,!0,!0);ct(w).attr("class","classTitle");let C=w.getBBox();if(zn(Be())){let E=w.children[0],I=ct(w);C=E.getBoundingClientRect(),I.attr("width",C.width),I.attr("height",C.height)}f+=C.height+n,C.width>h&&(h=C.width);let T=[];t.classData.members.forEach(async E=>{let I=E.getDisplayDetails(),L=I.displayText;zn(Be())&&(L=L.replace(//g,">"));let O=await Gh(d,L,I.cssStyle?I.cssStyle:t.labelStyle,!0,!0),R=O.getBBox();if(zn(Be())){let A=O.children[0],N=ct(O);R=A.getBoundingClientRect(),N.attr("width",R.width),N.attr("height",R.height)}R.width>h&&(h=R.width),f+=R.height+n,T.push(O)}),f+=i;let k=[];if(t.classData.methods.forEach(async E=>{let I=E.getDisplayDetails(),L=I.displayText;zn(Be())&&(L=L.replace(//g,">"));let O=await Gh(d,L,I.cssStyle?I.cssStyle:t.labelStyle,!0,!0),R=O.getBBox();if(zn(Be())){let A=O.children[0],N=ct(O);R=A.getBoundingClientRect(),N.attr("width",R.width),N.attr("height",R.height)}R.width>h&&(h=R.width),f+=R.height+n,k.push(O)}),f+=i,m){let E=(h-v.width)/2;ct(y).attr("transform","translate( "+(-1*h/2+E)+", "+-1*f/2+")"),p=v.height+n}let S=(h-C.width)/2;return ct(w).attr("transform","translate( "+(-1*h/2+S)+", "+(-1*f/2+p)+")"),p+=C.height+n,l.attr("class","divider").attr("x1",-h/2-r).attr("x2",h/2+r).attr("y1",-f/2-r+i+p).attr("y2",-f/2-r+i+p),p+=i,T.forEach(E=>{ct(E).attr("transform","translate( "+-h/2+", "+(-1*f/2+p+i/2)+")");let I=E?.getBBox();p+=(I?.height??0)+n}),p+=i,u.attr("class","divider").attr("x1",-h/2-r).attr("x2",h/2+r).attr("y1",-f/2-r+i+p).attr("y2",-f/2-r+i+p),p+=i,k.forEach(E=>{ct(E).attr("transform","translate( "+-h/2+", "+(-1*f/2+p)+")");let I=E?.getBBox();p+=(I?.height??0)+n}),o.attr("style",t.style).attr("class","outer title-state").attr("x",-h/2-r).attr("y",-(f/2)-r).attr("width",h+t.padding).attr("height",f+t.padding),Na(t,o),t.intersect=function(E){return ua.rect(t,E)},s},"class_box"),IJe={rhombus:RJe,composite:Mrr,question:RJe,rect:Irr,labelRect:Nrr,rectWithTitle:Drr,choice:wrr,circle:Prr,doublecircle:Brr,stadium:Orr,hexagon:krr,block_arrow:Trr,rect_left_inv_arrow:Crr,lean_right:Srr,lean_left:Err,trapezoid:Arr,inv_trapezoid:_rr,rect_right_inv_arrow:Rrr,cylinder:Lrr,start:$rr,end:zrr,note:brr,subroutine:Frr,fork:LJe,join:LJe,class_box:Grr},qO={},YJe=b(async(e,t,r)=>{let n,i;if(t.link){let a;Be().securityLevel==="sandbox"?a="_top":t.linkTarget&&(a=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",a),i=await IJe[t.shape](n,t,r)}else i=await IJe[t.shape](e,t,r),n=i;return t.tooltip&&i.attr("title",t.tooltip),t.class&&i.attr("class","node default "+t.class),qO[t.id]=n,t.haveCallback&&qO[t.id].attr("class",qO[t.id].attr("class")+" clickable"),n},"insertNode"),qrr=b(e=>{let t=qO[e.id];se.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");let r=8,n=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+n-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),n},"positionNode");b(cse,"getNodeFromBlock");b(XJe,"calculateBlockSize");b(jJe,"insertBlockPositioned");b(UO,"performOperations");b(KJe,"calculateBlockSizes");b(ZJe,"insertBlocks");b(QJe,"insertEdges");Vrr=b(function(e,t){return t.db.getClasses()},"getClasses"),Wrr=b(async function(e,t,r,n){let{securityLevel:i,block:a}=qt(),s=n.db;s.setDiagramId(t);let o;i==="sandbox"&&(o=ct("#i"+t));let l=i==="sandbox"?ct(o.nodes()[0].contentDocument.body):ct("body"),u=i==="sandbox"?l.select(`[id="${t}"]`):ct(`[id="${t}"]`);trr(u,["point","circle","cross"],n.type,t);let f=s.getBlocks(),d=s.getBlocksFlat(),p=s.getEdges(),m=u.insert("g").attr("class","block");await KJe(m,f,s);let g=zJe(s);if(await ZJe(m,f,s),await QJe(m,p,d,s,t),g){let y=g,v=Math.max(1,Math.round(.125*(y.width/y.height))),x=y.height+v+10,w=y.width+10,{useMaxWidth:C}=a;vn(u,x,w,!!C),se.debug("Here Bounds",g,y),u.attr("viewBox",`${y.x-5} ${y.y-5} ${y.width+10} ${y.height+10}`)}},"draw"),Hrr={draw:Wrr,getClasses:Vrr},Urr={parser:wtr,db:Gtr,renderer:Hrr,styles:Vtr}});var pet={};Tr(pet,{diagram:()=>mnr});function oet(e){return e.some(t=>aet.test(t))}function cet(e){for(let t of e){let r=set.exec(t);if(r?.index&&r.index>0)return r.index}return 4}function uet(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(r,n)=>{let i=parseInt(n,10),a=t.get(i);return a?`line ${a}`:r})}function het(e){let t=e.split(` +`),r=new Map,n=-1;for(let[l,u]of t.entries())if(u.trim()==="treeView-beta"){n=l;break}if(n===-1)return{text:e,lineMap:r};let i=[];for(let l=n+1;l0){let i=e.substring(n).toLowerCase(),a=t?.extensionIcons;return a?.[i]??a?.[i.slice(1)]}}function hse(e,t){return e.includes(":")?e:e in U6.icons||!t?`${U6.prefix}:${e}`:`${t}:${e}`}function dse(e,t){if(e.icon!=="none"){if(e.icon)return hse(e.icon,t.defaultIconPack);if(t.showIcons){if(e.nodeType==="file"){let r=fet(e.name,t);if(r==="none")return;if(r)return hse(r,t.defaultIconPack)}return`${U6.prefix}:${e.nodeType==="directory"?"folder":"file"}`}}}var aet,set,Yrr,tet,ret,net,Xrr,Sd,jrr,Krr,Zrr,Qrr,Jrr,enr,tnr,use,rnr,nnr,U6,fse,inr,anr,det,snr,onr,iet,lnr,cnr,unr,hnr,fnr,dnr,pnr,mnr,met=W(()=>{FI();El();za();ts();Sn();_r();Rr();hr();Co();aet=/[─━│┃└┗├┣]/,set=/[└┗├┣]/,Yrr=/[─━]/,tet=/^[\s│┃]+$/,ret=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,net=/^\s*%%/,Xrr=" ";b(oet,"isBoxDrawingFormat");b(cet,"inferSegmentWidth");b(uet,"remapErrorLines");b(het,"preprocessBoxDrawing");Sd=new aw(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),jrr=b(()=>{Sd.reset(),Nr()},"clear"),Krr=b(()=>Sd.records.stack[0],"getRoot"),Zrr=b(()=>Sd.records.cnt,"getCount"),Qrr=Lr.treeView,Jrr=b(()=>Rn(Qrr,qt().treeView),"getConfig"),enr=b((e,t,r,n,i,a)=>{for(;e<=Sd.records.stack[Sd.records.stack.length-1].level;)Sd.records.stack.pop();let s={id:Sd.records.cnt++,level:e,name:t,nodeType:r,icon:i,cssClass:n,description:a,children:[]};Sd.records.stack[Sd.records.stack.length-1].children.push(s),Sd.records.stack.push(s)},"addNode"),tnr={clear:jrr,addNode:enr,getRoot:Krr,getCount:Zrr,getConfig:Jrr,getAccTitle:Qr,getAccDescription:en,getDiagramTitle:tn,setAccDescription:Jr,setAccTitle:Yr,setDiagramTitle:ln},use=tnr,rnr=b(e=>{wi(e,use);for(let t of e.nodes){let r=typeof t.indent=="number"?t.indent:0,n=t.name,i=n.endsWith("/");i&&(n=n.slice(0,-1));let a=i?"directory":"file",s=t.classAnnotation||void 0,o=t.iconAnnotation,l=o!==void 0?o||"none":void 0,u=t.descAnnotation||void 0,h=u?Mr(u,qt()):void 0;use.addNode(r,n,a,s,l,h)}},"populate"),nnr={parse:b(async e=>{let{text:t,lineMap:r}=het(e);try{let n=await ba("treeView",t);se.debug(n),rnr(n)}catch(n){throw r.size>0&&n instanceof Error&&(n.message=uet(n.message,r)),n}},"parse")},U6={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};b(fet,"detectIcon");b(hse,"qualifyIcon");b(dse,"getNodeIcon");f4([{name:U6.prefix,icons:U6}]);fse=14,inr=4,anr=16,det=b((e,t)=>`tv-icon-${e}-${t.replace(/[^\w-]/g,"-")}`,"iconSymbolId"),snr=b(async(e,t,r,n)=>{let i=new Set,a=b(l=>{let u=dse(l,r);u&&i.add(u),l.children.forEach(a)},"collect");if(a(t),i.size===0)return;let s=await Promise.all([...i].map(async l=>({icon:l,svg:await zc(l,{height:fse,width:fse})}))),o=e.append("defs");for(let{icon:l,svg:u}of s)o.append("g").attr("id",det(n,l)).html(u)},"injectIconDefs"),onr=b((e,t,r,n,i,a)=>{let s=n.append("g"),o="treeView-node-label";r.nodeType==="directory"&&(o+=" treeView-node-dir"),r.cssClass&&(o+=` ${r.cssClass}`);let l=fse+inr,u=dse(r,i),h=u!==void 0;u&&s.append("use").attr("xlink:href",`#${det(a,u)}`).attr("x",e+i.paddingX).attr("y",t+i.paddingY).attr("class","treeView-node-icon");let f=s.append("text").text(r.name).attr("dominant-baseline","middle").attr("class",o),{height:d,width:p}=f.node().getBBox(),m=d+i.paddingY*2,g=e+i.paddingX+(h?l:0);f.attr("x",g),f.attr("y",t+m/2);let y=g+p,v=p+i.paddingX*2+(h?l:0);return r.BBox={x:e,y:t,width:v,height:m},r.cssClass?.split(/\s+/).includes("highlight")&&s.insert("rect",":first-child").attr("x",e).attr("y",t+1).attr("width",0).attr("height",m-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:r,nodeGroup:s,labelRightEdge:y,centerY:t+m/2}},"positionLabel"),iet=b((e,t,r,n,i,a)=>e.append("line").attr("x1",t).attr("y1",r).attr("x2",n).attr("y2",i).attr("stroke-width",a).attr("class","treeView-node-line"),"positionLine"),lnr=b((e,t,r,n)=>{let i=0,a=0,s=[],o=b((h,f,d,p)=>{let m=p*(d.rowIndent+d.paddingX),g=onr(m,i,f,h,d,n);s.push(g);let{height:y,width:v}=f.BBox;iet(h,m-d.rowIndent,i+y/2,m,i+y/2,d.lineThickness),a=Math.max(a,m+v),i+=y},"drawNode"),l=b((h,f=0)=>{o(e,h,r,f),h.children.forEach(g=>{l(g,f+1)});let{x:d,y:p,height:m}=h.BBox;if(h.children.length){let{y:g,height:y}=h.children[h.children.length-1].BBox;iet(e,d+r.paddingX,p+m,d+r.paddingX,g+y/2+r.lineThickness/2,r.lineThickness)}},"processNode");l(t);let u=s.filter(h=>h.node.description);if(u.length>0){let f=Math.max(...s.map(d=>d.labelRightEdge))+anr;for(let d of u){let m=d.nodeGroup.append("text").text(d.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",f).attr("y",d.centerY).node().getBBox();a=Math.max(a,f+m.width+r.paddingX)}}for(let h of s)if(h.node.cssClass?.split(/\s+/).includes("highlight")){let f=h.nodeGroup.select(".treeView-highlight-bg");if(!f.empty()){let d=a-h.node.BBox.x+8;f.attr("width",d),a=Math.max(a,h.node.BBox.x+d+2)}}return{totalHeight:i,totalWidth:a}},"drawTree"),cnr=b(async(e,t,r,n)=>{se.debug(`Rendering treeView diagram +`+e);let i=n.db,a=i.getRoot(),s=i.getConfig(),o=Qn(t);await snr(o,a,s,t);let l=o.append("g");l.attr("class","tree-view");let{totalHeight:u,totalWidth:h}=lnr(l,a,s,t);o.attr("viewBox",`-${s.lineThickness/2} 0 ${h} ${u}`),vn(o,u,h,s.useMaxWidth)},"draw"),unr={draw:cnr},hnr=unr,fnr={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},dnr=b(({treeView:e})=>{let{labelFontSize:t,labelColor:r,lineColor:n,iconColor:i,descriptionColor:a,highlightBg:s,highlightStroke:o}=Rn(fnr,e);return` .treeView-node-label { font-size: ${t}; fill: ${r}; @@ -3136,7 +3136,7 @@ Expecting `+Oe.join(", ")+", got '"+(this.terminals_[j]||j)+"'":qe="Parse error stroke: ${o}; stroke-width: 1; } - `},"styles"),unr=cnr,hnr={db:lse,renderer:onr,parser:Jrr,styles:unr}});var dse=Qo((Y6,fse)=>{(function(t,r){typeof Y6=="object"&&typeof fse=="object"?fse.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Y6=="object"?Y6.layoutBase=r():t.layoutBase=r()})(Y6,function(){return(function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(n){return n},r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:a})},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=28)})([(function(e,t,r){"use strict";function n(){}n.QUALITY=1,n.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,n.DEFAULT_INCREMENTAL=!1,n.DEFAULT_ANIMATION_ON_LAYOUT=!0,n.DEFAULT_ANIMATION_DURING_LAYOUT=!1,n.DEFAULT_ANIMATION_PERIOD=50,n.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,n.DEFAULT_GRAPH_MARGIN=15,n.NODE_DIMENSIONS_INCLUDE_LABELS=!1,n.SIMPLE_NODE_SIZE=40,n.SIMPLE_NODE_HALF_SIZE=n.SIMPLE_NODE_SIZE/2,n.EMPTY_COMPOUND_NODE_SIZE=40,n.MIN_EDGE_LENGTH=1,n.WORLD_BOUNDARY=1e6,n.INITIAL_WORLD_BOUNDARY=n.WORLD_BOUNDARY/1e3,n.WORLD_CENTER_X=1200,n.WORLD_CENTER_Y=900,e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(8),a=r(9);function s(l,u,h){n.call(this,h),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=h,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var h=this.getOtherEnd(l),f=u.getGraphManager().getRoot();;){if(h.getOwner()==u)return h;if(h.getOwner()==f)break;h=h.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=s}),(function(e,t,r){"use strict";function n(i){this.vGraphObject=i}e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(13),s=r(0),o=r(16),l=r(5);function u(f,d,p,m){p==null&&m==null&&(m=d),n.call(this,m),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=m,this.edges=[],this.graphManager=f,p!=null&&d!=null?this.rect=new a(d.x,d.y,p.width,p.height):this.rect=new a}u.prototype=Object.create(n.prototype);for(var h in n)u[h]=n[h];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(f){this.rect.width=f},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(f){this.rect.height=f},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(f,d){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=d.width,this.rect.height=d.height},u.prototype.setCenter=function(f,d){this.rect.x=f-this.rect.width/2,this.rect.y=d-this.rect.height/2},u.prototype.setLocation=function(f,d){this.rect.x=f,this.rect.y=d},u.prototype.moveBy=function(f,d){this.rect.x+=f,this.rect.y+=d},u.prototype.getEdgeListToNode=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(g.target==f){if(g.source!=m)throw"Incorrect edge source!";d.push(g)}}),d},u.prototype.getEdgesBetween=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(!(g.source==m||g.target==m))throw"Incorrect edge source and/or target";(g.target==f||g.source==f)&&d.push(g)}),d},u.prototype.getNeighborsList=function(){var f=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)f.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";f.add(p.source)}}),f},u.prototype.withChildren=function(){var f=new Set,d,p;if(f.add(this),this.child!=null)for(var m=this.child.getNodes(),g=0;gd?(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(d+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(p+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>p?(this.rect.y-=(this.labelHeight-p)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(p+this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(f){var d=this.rect.x;d>s.WORLD_BOUNDARY?d=s.WORLD_BOUNDARY:d<-s.WORLD_BOUNDARY&&(d=-s.WORLD_BOUNDARY);var p=this.rect.y;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var m=new l(d,p),g=f.inverseTransformPoint(m);this.setLocation(g.x,g.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=u}),(function(e,t,r){"use strict";var n=r(0);function i(){}for(var a in n)i[a]=n[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=i.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i}),(function(e,t,r){"use strict";function n(i,a){i==null&&a==null?(this.x=0,this.y=0):(this.x=i,this.y=a)}n.prototype.getX=function(){return this.x},n.prototype.getY=function(){return this.y},n.prototype.setX=function(i){this.x=i},n.prototype.setY=function(i){this.y=i},n.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},n.prototype.getCopy=function(){return new n(this.x,this.y)},n.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(0),s=r(7),o=r(3),l=r(1),u=r(13),h=r(12),f=r(11);function d(m,g,y){n.call(this,y),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=m,g!=null&&g instanceof s?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}d.prototype=Object.create(n.prototype);for(var p in n)d[p]=n[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(m,g,y){if(g==null&&y==null){var v=m;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(v)>-1)throw"Node already in graph!";return v.owner=this,this.getNodes().push(v),v}else{var x=m;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(g.owner==y.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=y.owner?null:(x.source=g,x.target=y,x.isInterGraph=!1,this.getEdges().push(x),g.edges.push(x),y!=g&&y.edges.push(x),x)}},d.prototype.remove=function(m){var g=m;if(m instanceof o){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=g.edges.slice(),v,x=y.length,w=0;w-1&&k>-1))throw"Source and/or target doesn't know this edge!";v.source.edges.splice(T,1),v.target!=v.source&&v.target.edges.splice(k,1);var C=v.source.owner.getEdges().indexOf(v);if(C==-1)throw"Not in owner's edge list!";v.source.owner.getEdges().splice(C,1)}},d.prototype.updateLeftTop=function(){for(var m=i.MAX_VALUE,g=i.MAX_VALUE,y,v,x,w=this.getNodes(),C=w.length,T=0;Ty&&(m=y),g>v&&(g=v)}return m==i.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?x=w[0].getParent().paddingLeft:x=this.margin,this.left=g-x,this.top=m-x,new h(this.left,this.top))},d.prototype.updateBounds=function(m){for(var g=i.MAX_VALUE,y=-i.MAX_VALUE,v=i.MAX_VALUE,x=-i.MAX_VALUE,w,C,T,k,S,E=this.nodes,I=E.length,L=0;Lw&&(g=w),yT&&(v=T),xw&&(g=w),yT&&(v=T),x=this.nodes.length){var I=0;y.forEach(function(L){L.owner==m&&I++}),I==this.nodes.length&&(this.isConnected=!0)}},e.exports=d}),(function(e,t,r){"use strict";var n,i=r(1);function a(s){n=r(6),this.layout=s,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},a.prototype.add=function(s,o,l,u,h){if(l==null&&u==null&&h==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{h=l,u=o,l=s;var f=u.getOwner(),d=h.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==d)return l.isInterGraph=!1,f.add(l,u,h);if(l.isInterGraph=!0,l.source=u,l.target=h,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},a.prototype.remove=function(s){if(s instanceof n){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,h=l.length,f=0;f=s.getRight()?o[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(o[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(o[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var h=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(h=1);var f=h*o[0],d=o[1]/h;o[0]f)return o[0]=l,o[1]=p,o[2]=h,o[3]=E,!1;if(uh)return o[0]=d,o[1]=u,o[2]=k,o[3]=f,!1;if(lh?(o[0]=g,o[1]=y,R=!0):(o[0]=m,o[1]=p,R=!0):N===D&&(l>h?(o[0]=d,o[1]=p,R=!0):(o[0]=v,o[1]=y,R=!0)),-M===D?h>l?(o[2]=S,o[3]=E,A=!0):(o[2]=k,o[3]=T,A=!0):M===D&&(h>l?(o[2]=C,o[3]=T,A=!0):(o[2]=I,o[3]=E,A=!0)),R&&A)return!1;if(l>h?u>f?(B=this.getCardinalDirection(N,D,4),P=this.getCardinalDirection(M,D,2)):(B=this.getCardinalDirection(-N,D,3),P=this.getCardinalDirection(-M,D,1)):u>f?(B=this.getCardinalDirection(-N,D,1),P=this.getCardinalDirection(-M,D,3)):(B=this.getCardinalDirection(N,D,2),P=this.getCardinalDirection(M,D,4)),!R)switch(B){case 1:F=p,$=l+-w/D,o[0]=$,o[1]=F;break;case 2:$=v,F=u+x*D,o[0]=$,o[1]=F;break;case 3:F=y,$=l+w/D,o[0]=$,o[1]=F;break;case 4:$=g,F=u+-x*D,o[0]=$,o[1]=F;break}if(!A)switch(P){case 1:G=T,q=h+-O/D,o[2]=q,o[3]=G;break;case 2:q=I,G=f+L*D,o[2]=q,o[3]=G;break;case 3:G=E,q=h+O/D,o[2]=q,o[3]=G;break;case 4:q=S,G=f+-L*D,o[2]=q,o[3]=G;break}}return!1},i.getCardinalDirection=function(a,s,o){return a>s?o:1+o%4},i.getIntersection=function(a,s,o,l){if(l==null)return this.getIntersection2(a,s,o);var u=a.x,h=a.y,f=s.x,d=s.y,p=o.x,m=o.y,g=l.x,y=l.y,v=void 0,x=void 0,w=void 0,C=void 0,T=void 0,k=void 0,S=void 0,E=void 0,I=void 0;return w=d-h,T=u-f,S=f*h-u*d,C=y-m,k=p-g,E=g*m-p*y,I=w*k-C*T,I===0?null:(v=(T*E-k*S)/I,x=(C*S-w*E)/I,new n(v,x))},i.angleOfVector=function(a,s,o,l){var u=void 0;return a!==o?(u=Math.atan((l-s)/(o-a)),o=0){var y=(-p+Math.sqrt(p*p-4*d*m))/(2*d),v=(-p-Math.sqrt(p*p-4*d*m))/(2*d),x=null;return y>=0&&y<=1?[y]:v>=0&&v<=1?[v]:x}else return null},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i}),(function(e,t,r){"use strict";function n(){}n.sign=function(i){return i>0?1:i<0?-1:0},n.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},n.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},e.exports=n}),(function(e,t,r){"use strict";function n(){}n.MAX_VALUE=2147483647,n.MIN_VALUE=-2147483648,e.exports=n}),(function(e,t,r){"use strict";var n=(function(){function u(h,f){for(var d=0;d"u"?"undefined":n(a);return a==null||s!="object"&&s!="function"},e.exports=i}),(function(e,t,r){"use strict";function n(p){if(Array.isArray(p)){for(var m=0,g=Array(p.length);m0&&m;){for(w.push(T[0]);w.length>0&&m;){var k=w[0];w.splice(0,1),x.add(k);for(var S=k.getEdges(),v=0;v-1&&T.splice(O,1)}x=new Set,C=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var m=[],g=p.source,y=this.graphManager.calcLowestCommonAncestor(p.source,p.target),v=0;v0){for(var y=this.edgeToDummyNodes.get(g),v=0;v=0&&m.splice(E,1);var I=C.getNeighborsList();I.forEach(function(R){if(g.indexOf(R)<0){var A=y.get(R),N=A-1;N==1&&k.push(R),y.set(R,N)}})}g=g.concat(k),(m.length==1||m.length==2)&&(v=!0,x=m[0])}return x},d.prototype.setGraphManager=function(p){this.graphManager=p},e.exports=d}),(function(e,t,r){"use strict";function n(){}n.seed=1,n.x=0,n.nextDouble=function(){return n.x=Math.sin(n.seed++)*1e4,n.x-Math.floor(n.x)},e.exports=n}),(function(e,t,r){"use strict";var n=r(5);function i(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(a){this.lworldExtX=a},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(a){this.lworldExtY=a},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},i.prototype.transformX=function(a){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/o),s},i.prototype.transformY=function(a){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/o),s},i.prototype.inverseTransformX=function(a){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/o),s},i.prototype.inverseTransformY=function(a){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/o),s},i.prototype.inverseTransformPoint=function(a){var s=new n(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},e.exports=i}),(function(e,t,r){"use strict";function n(f){if(Array.isArray(f)){for(var d=0,p=Array(f.length);da.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),d,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,m,g,y,v=this.getAllNodes(),x;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),x=new Set,p=0;pw||x>w)&&(f.gravitationForceX=-this.gravityConstant*g,f.gravitationForceY=-this.gravityConstant*y)):(w=d.getEstimatedSize()*this.compoundGravityRangeFactor,(v>w||x>w)&&(f.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},u.prototype.isConverged=function(){var f,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=v.length||w>=v[0].length)){for(var C=0;Cu}}]),o})();e.exports=s}),(function(e,t,r){"use strict";function n(){}n.svd=function(i){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=i.length,this.n=i[0].length;var a=Math.min(this.m,this.n);this.s=(function(Rt){for(var bt=[];Rt-- >0;)bt.push(0);return bt})(Math.min(this.m+1,this.n)),this.U=(function(Rt){var bt=function ke(yt){if(yt.length==0)return 0;for(var xt=[],it=0;it0;)bt.push(0);return bt})(this.n),o=(function(Rt){for(var bt=[];Rt-- >0;)bt.push(0);return bt})(this.m),l=!0,u=!0,h=Math.min(this.m-1,this.n),f=Math.max(0,Math.min(this.n-2,this.m)),d=0;d=0;D--)if(this.s[D]!==0){for(var B=D+1;B=0;H--){if((function(Rt,bt){return Rt&&bt})(H0;){var Te=void 0,Oe=void 0;for(Te=A-2;Te>=-1&&Te!==-1;Te--)if(Math.abs(s[Te])<=Re+oe*(Math.abs(this.s[Te])+Math.abs(this.s[Te+1]))){s[Te]=0;break}if(Te===A-2)Oe=4;else{var qe=void 0;for(qe=A-1;qe>=Te&&qe!==Te;qe--){var Ge=(qe!==A?Math.abs(s[qe]):0)+(qe!==Te+1?Math.abs(s[qe-1]):0);if(Math.abs(this.s[qe])<=Re+oe*Ge){this.s[qe]=0;break}}qe===Te?Oe=3:qe===A-1?Oe=1:(Oe=2,Te=qe)}switch(Te++,Oe){case 1:{var fe=s[A-2];s[A-2]=0;for(var Ce=A-2;Ce>=Te;Ce--){var _e=n.hypot(this.s[Ce],fe),de=this.s[Ce]/_e,ie=fe/_e;if(this.s[Ce]=_e,Ce!==Te&&(fe=-ie*s[Ce-1],s[Ce-1]=de*s[Ce-1]),u)for(var Q=0;Q=this.s[Te+1]);){var mt=this.s[Te];if(this.s[Te]=this.s[Te+1],this.s[Te+1]=mt,u&&TeMath.abs(a)?(s=a/i,s=Math.abs(i)*Math.sqrt(1+s*s)):a!=0?(s=i/a,s=Math.abs(a)*Math.sqrt(1+s*s)):s=0,s},e.exports=n}),(function(e,t,r){"use strict";var n=(function(){function s(o,l){for(var u=0;u2&&arguments[2]!==void 0?arguments[2]:1,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=h,this.gap_penalty=f,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;o--){var l=this.listeners[o];l.event===a&&l.callback===s&&this.listeners.splice(o,1)}},i.emit=function(a,s){for(var o=0;o{(function(t,r){typeof X6=="object"&&typeof pse=="object"?pse.exports=r(dse()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof X6=="object"?X6.coseBase=r(dse()):t.coseBase=r(t.layoutBase)})(X6,function(e){return(()=>{"use strict";var t={45:((a,s,o)=>{var l={};l.layoutBase=o(551),l.CoSEConstants=o(806),l.CoSEEdge=o(767),l.CoSEGraph=o(880),l.CoSEGraphManager=o(578),l.CoSELayout=o(765),l.CoSENode=o(991),l.ConstraintHandler=o(902),a.exports=l}),806:((a,s,o)=>{var l=o(551).FDLayoutConstants;function u(){}for(var h in l)u[h]=l[h];u.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,u.DEFAULT_RADIAL_SEPARATION=l.DEFAULT_EDGE_LENGTH,u.DEFAULT_COMPONENT_SEPERATION=60,u.TILE=!0,u.TILING_PADDING_VERTICAL=10,u.TILING_PADDING_HORIZONTAL=10,u.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,u.ENFORCE_CONSTRAINTS=!0,u.APPLY_LAYOUT=!0,u.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,u.TREE_REDUCTION_ON_INCREMENTAL=!0,u.PURE_INCREMENTAL=u.DEFAULT_INCREMENTAL,a.exports=u}),767:((a,s,o)=>{var l=o(551).FDLayoutEdge;function u(f,d,p){l.call(this,f,d,p)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u}),880:((a,s,o)=>{var l=o(551).LGraph;function u(f,d,p){l.call(this,f,d,p)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u}),578:((a,s,o)=>{var l=o(551).LGraphManager;function u(f){l.call(this,f)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u}),765:((a,s,o)=>{var l=o(551).FDLayout,u=o(578),h=o(880),f=o(991),d=o(767),p=o(806),m=o(902),g=o(551).FDLayoutConstants,y=o(551).LayoutConstants,v=o(551).Point,x=o(551).PointD,w=o(551).DimensionD,C=o(551).Layout,T=o(551).Integer,k=o(551).IGeometry,S=o(551).LGraph,E=o(551).Transform,I=o(551).LinkedList;function L(){l.call(this),this.toBeTiled={},this.constraints={}}L.prototype=Object.create(l.prototype);for(var O in l)L[O]=l[O];L.prototype.newGraphManager=function(){var R=new u(this);return this.graphManager=R,R},L.prototype.newGraph=function(R){return new h(null,this.graphManager,R)},L.prototype.newNode=function(R){return new f(this.graphManager,R)},L.prototype.newEdge=function(R){return new d(null,null,R)},L.prototype.initParameters=function(){l.prototype.initParameters.call(this,arguments),this.isSubLayout||(p.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=p.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=p.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=g.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=g.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},L.prototype.initSpringEmbedder=function(){l.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/g.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},L.prototype.layout=function(){var R=y.DEFAULT_CREATE_BENDS_AS_NEEDED;return R&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},L.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(p.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),N=this.nodesWithGravity.filter(function(B){return A.has(B)});this.graphManager.setAllNodesToApplyGravitation(N)}}else{var R=this.getFlatForest();if(R.length>0)this.positionNodesRadially(R);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),N=this.nodesWithGravity.filter(function(M){return A.has(M)});this.graphManager.setAllNodesToApplyGravitation(N),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(m.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),p.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},L.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%g.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var R=new Set(this.getAllNodes()),A=this.nodesWithGravity.filter(function(D){return R.has(D)});this.graphManager.setAllNodesToApplyGravitation(A),this.graphManager.updateBounds(),this.updateGrid(),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var N=!this.isTreeGrowing&&!this.isGrowthFinished,M=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(N,M),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},L.prototype.getPositionsData=function(){for(var R=this.graphManager.getAllNodes(),A={},N=0;N0&&this.updateDisplacements();for(var N=0;N0&&(M.fixedNodeWeight=B)}}if(this.constraints.relativePlacementConstraint){var P=new Map,$=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(U){R.fixedNodesOnHorizontal.add(U),R.fixedNodesOnVertical.add(U)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var F=this.constraints.alignmentConstraint.vertical,N=0;N=2*U.length/3;ue--)le=Math.floor(Math.random()*(ue+1)),ee=U[ue],U[ue]=U[le],U[le]=ee;return U},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(U){if(U.left){var le=P.has(U.left)?P.get(U.left):U.left,ee=P.has(U.right)?P.get(U.right):U.right;R.nodesInRelativeHorizontal.includes(le)||(R.nodesInRelativeHorizontal.push(le),R.nodeToRelativeConstraintMapHorizontal.set(le,[]),R.dummyToNodeForVerticalAlignment.has(le)?R.nodeToTempPositionMapHorizontal.set(le,R.idToNodeMap.get(R.dummyToNodeForVerticalAlignment.get(le)[0]).getCenterX()):R.nodeToTempPositionMapHorizontal.set(le,R.idToNodeMap.get(le).getCenterX())),R.nodesInRelativeHorizontal.includes(ee)||(R.nodesInRelativeHorizontal.push(ee),R.nodeToRelativeConstraintMapHorizontal.set(ee,[]),R.dummyToNodeForVerticalAlignment.has(ee)?R.nodeToTempPositionMapHorizontal.set(ee,R.idToNodeMap.get(R.dummyToNodeForVerticalAlignment.get(ee)[0]).getCenterX()):R.nodeToTempPositionMapHorizontal.set(ee,R.idToNodeMap.get(ee).getCenterX())),R.nodeToRelativeConstraintMapHorizontal.get(le).push({right:ee,gap:U.gap}),R.nodeToRelativeConstraintMapHorizontal.get(ee).push({left:le,gap:U.gap})}else{var ue=$.has(U.top)?$.get(U.top):U.top,ae=$.has(U.bottom)?$.get(U.bottom):U.bottom;R.nodesInRelativeVertical.includes(ue)||(R.nodesInRelativeVertical.push(ue),R.nodeToRelativeConstraintMapVertical.set(ue,[]),R.dummyToNodeForHorizontalAlignment.has(ue)?R.nodeToTempPositionMapVertical.set(ue,R.idToNodeMap.get(R.dummyToNodeForHorizontalAlignment.get(ue)[0]).getCenterY()):R.nodeToTempPositionMapVertical.set(ue,R.idToNodeMap.get(ue).getCenterY())),R.nodesInRelativeVertical.includes(ae)||(R.nodesInRelativeVertical.push(ae),R.nodeToRelativeConstraintMapVertical.set(ae,[]),R.dummyToNodeForHorizontalAlignment.has(ae)?R.nodeToTempPositionMapVertical.set(ae,R.idToNodeMap.get(R.dummyToNodeForHorizontalAlignment.get(ae)[0]).getCenterY()):R.nodeToTempPositionMapVertical.set(ae,R.idToNodeMap.get(ae).getCenterY())),R.nodeToRelativeConstraintMapVertical.get(ue).push({bottom:ae,gap:U.gap}),R.nodeToRelativeConstraintMapVertical.get(ae).push({top:ue,gap:U.gap})}});else{var G=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(U){if(U.left){var le=P.has(U.left)?P.get(U.left):U.left,ee=P.has(U.right)?P.get(U.right):U.right;G.has(le)?G.get(le).push(ee):G.set(le,[ee]),G.has(ee)?G.get(ee).push(le):G.set(ee,[le])}else{var ue=$.has(U.top)?$.get(U.top):U.top,ae=$.has(U.bottom)?$.get(U.bottom):U.bottom;z.has(ue)?z.get(ue).push(ae):z.set(ue,[ae]),z.has(ae)?z.get(ae).push(ue):z.set(ae,[ue])}});var H=function(le,ee){var ue=[],ae=[],oe=new I,Re=new Set,Te=0;return le.forEach(function(Oe,qe){if(!Re.has(qe)){ue[Te]=[],ae[Te]=!1;var Ge=qe;for(oe.push(Ge),Re.add(Ge),ue[Te].push(Ge);oe.length!=0;){Ge=oe.shift(),ee.has(Ge)&&(ae[Te]=!0);var fe=le.get(Ge);fe.forEach(function(Ce){Re.has(Ce)||(oe.push(Ce),Re.add(Ce),ue[Te].push(Ce))})}Te++}}),{components:ue,isFixed:ae}},j=H(G,R.fixedNodesOnHorizontal);this.componentsOnHorizontal=j.components,this.fixedComponentsOnHorizontal=j.isFixed;var J=H(z,R.fixedNodesOnVertical);this.componentsOnVertical=J.components,this.fixedComponentsOnVertical=J.isFixed}}},L.prototype.updateDisplacements=function(){var R=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(J){var U=R.idToNodeMap.get(J.nodeId);U.displacementX=0,U.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var A=this.constraints.alignmentConstraint.vertical,N=0;N1){var $;for($=0;$M&&(M=Math.floor(P.y)),B=Math.floor(P.x+p.DEFAULT_COMPONENT_SEPERATION)}this.transform(new x(y.WORLD_CENTER_X-P.x/2,y.WORLD_CENTER_Y-P.y/2))},L.radialLayout=function(R,A,N){var M=Math.max(this.maxDiagonalInTree(R),p.DEFAULT_RADIAL_SEPARATION);L.branchRadialLayout(A,null,0,359,0,M);var D=S.calculateBounds(R),B=new E;B.setDeviceOrgX(D.getMinX()),B.setDeviceOrgY(D.getMinY()),B.setWorldOrgX(N.x),B.setWorldOrgY(N.y);for(var P=0;P1;){var ue=ee[0];ee.splice(0,1);var ae=H.indexOf(ue);ae>=0&&H.splice(ae,1),U--,j--}A!=null?le=(H.indexOf(ee[0])+1)%U:le=0;for(var oe=Math.abs(M-N)/j,Re=le;J!=j;Re=++Re%U){var Te=H[Re].getOtherEnd(R);if(Te!=A){var Oe=(N+J*oe)%360,qe=(Oe+oe)%360;L.branchRadialLayout(Te,R,Oe,qe,D+B,B),J++}}},L.maxDiagonalInTree=function(R){for(var A=T.MIN_VALUE,N=0;NA&&(A=D)}return A},L.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},L.prototype.groupZeroDegreeMembers=function(){var R=this,A={};this.memberGroups={},this.idToDummyNode={};for(var N=[],M=this.graphManager.getAllNodes(),D=0;D"u"&&(A[$]=[]),A[$]=A[$].concat(B)}Object.keys(A).forEach(function(F){if(A[F].length>1){var q="DummyCompound_"+F;R.memberGroups[q]=A[F];var G=A[F][0].getParent(),z=new f(R.graphManager);z.id=q,z.paddingLeft=G.paddingLeft||0,z.paddingRight=G.paddingRight||0,z.paddingBottom=G.paddingBottom||0,z.paddingTop=G.paddingTop||0,R.idToDummyNode[q]=z;var H=R.getGraphManager().add(R.newGraph(),z),j=G.getChild();j.add(z);for(var J=0;JD?(M.rect.x-=(M.labelWidth-D)/2,M.setWidth(M.labelWidth),M.labelMarginLeft=(M.labelWidth-D)/2):M.labelPosHorizontal=="right"&&M.setWidth(D+M.labelWidth)),M.labelHeight&&(M.labelPosVertical=="top"?(M.rect.y-=M.labelHeight,M.setHeight(B+M.labelHeight),M.labelMarginTop=M.labelHeight):M.labelPosVertical=="center"&&M.labelHeight>B?(M.rect.y-=(M.labelHeight-B)/2,M.setHeight(M.labelHeight),M.labelMarginTop=(M.labelHeight-B)/2):M.labelPosVertical=="bottom"&&M.setHeight(B+M.labelHeight))}})},L.prototype.repopulateCompounds=function(){for(var R=this.compoundOrder.length-1;R>=0;R--){var A=this.compoundOrder[R],N=A.id,M=A.paddingLeft,D=A.paddingTop,B=A.labelMarginLeft,P=A.labelMarginTop;this.adjustLocations(this.tiledMemberPack[N],A.rect.x,A.rect.y,M,D,B,P)}},L.prototype.repopulateZeroDegreeMembers=function(){var R=this,A=this.tiledZeroDegreePack;Object.keys(A).forEach(function(N){var M=R.idToDummyNode[N],D=M.paddingLeft,B=M.paddingTop,P=M.labelMarginLeft,$=M.labelMarginTop;R.adjustLocations(A[N],M.rect.x,M.rect.y,D,B,P,$)})},L.prototype.getToBeTiled=function(R){var A=R.id;if(this.toBeTiled[A]!=null)return this.toBeTiled[A];var N=R.getChild();if(N==null)return this.toBeTiled[A]=!1,!1;for(var M=N.getNodes(),D=0;D0)return this.toBeTiled[A]=!1,!1;if(B.getChild()==null){this.toBeTiled[B.id]=!1;continue}if(!this.getToBeTiled(B))return this.toBeTiled[A]=!1,!1}return this.toBeTiled[A]=!0,!0},L.prototype.getNodeDegree=function(R){for(var A=R.id,N=R.getEdges(),M=0,D=0;DG&&(G=H.rect.height)}N+=G+R.verticalPadding}},L.prototype.tileCompoundMembers=function(R,A){var N=this;this.tiledMemberPack=[],Object.keys(R).forEach(function(M){var D=A[M];if(N.tiledMemberPack[M]=N.tileNodes(R[M],D.paddingLeft+D.paddingRight),D.rect.width=N.tiledMemberPack[M].width,D.rect.height=N.tiledMemberPack[M].height,D.setCenter(N.tiledMemberPack[M].centerX,N.tiledMemberPack[M].centerY),D.labelMarginLeft=0,D.labelMarginTop=0,p.NODE_DIMENSIONS_INCLUDE_LABELS){var B=D.rect.width,P=D.rect.height;D.labelWidth&&(D.labelPosHorizontal=="left"?(D.rect.x-=D.labelWidth,D.setWidth(B+D.labelWidth),D.labelMarginLeft=D.labelWidth):D.labelPosHorizontal=="center"&&D.labelWidth>B?(D.rect.x-=(D.labelWidth-B)/2,D.setWidth(D.labelWidth),D.labelMarginLeft=(D.labelWidth-B)/2):D.labelPosHorizontal=="right"&&D.setWidth(B+D.labelWidth)),D.labelHeight&&(D.labelPosVertical=="top"?(D.rect.y-=D.labelHeight,D.setHeight(P+D.labelHeight),D.labelMarginTop=D.labelHeight):D.labelPosVertical=="center"&&D.labelHeight>P?(D.rect.y-=(D.labelHeight-P)/2,D.setHeight(D.labelHeight),D.labelMarginTop=(D.labelHeight-P)/2):D.labelPosVertical=="bottom"&&D.setHeight(P+D.labelHeight))}})},L.prototype.tileNodes=function(R,A){var N=this.tileNodesByFavoringDim(R,A,!0),M=this.tileNodesByFavoringDim(R,A,!1),D=this.getOrgRatio(N),B=this.getOrgRatio(M),P;return B$&&($=J.getWidth())});var F=B/D,q=P/D,G=Math.pow(N-M,2)+4*(F+M)*(q+N)*D,z=(M-N+Math.sqrt(G))/(2*(F+M)),H;A?(H=Math.ceil(z),H==z&&H++):H=Math.floor(z);var j=H*(F+M)-M;return $>j&&(j=$),j+=M*2,j},L.prototype.tileNodesByFavoringDim=function(R,A,N){var M=p.TILING_PADDING_VERTICAL,D=p.TILING_PADDING_HORIZONTAL,B=p.TILING_COMPARE_BY,P={rows:[],rowWidth:[],rowHeight:[],width:0,height:A,verticalPadding:M,horizontalPadding:D,centerX:0,centerY:0};B&&(P.idealRowWidth=this.calcIdealRowWidth(R,N));var $=function(U){return U.rect.width*U.rect.height},F=function(U,le){return $(le)-$(U)};R.sort(function(J,U){var le=F;return P.idealRowWidth?(le=B,le(J.id,U.id)):le(J,U)});for(var q=0,G=0,z=0;z0&&(P+=R.horizontalPadding),R.rowWidth[N]=P,R.width0&&($+=R.verticalPadding);var F=0;$>R.rowHeight[N]&&(F=R.rowHeight[N],R.rowHeight[N]=$,F=R.rowHeight[N]-F),R.height+=F,R.rows[N].push(A)},L.prototype.getShortestRowIndex=function(R){for(var A=-1,N=Number.MAX_VALUE,M=0;MN&&(A=M,N=R.rowWidth[M]);return A},L.prototype.canAddHorizontal=function(R,A,N){if(R.idealRowWidth){var M=R.rows.length-1,D=R.rowWidth[M];return D+A+R.horizontalPadding<=R.idealRowWidth}var B=this.getShortestRowIndex(R);if(B<0)return!0;var P=R.rowWidth[B];if(P+R.horizontalPadding+A<=R.width)return!0;var $=0;R.rowHeight[B]0&&($=N+R.verticalPadding-R.rowHeight[B]);var F;R.width-P>=A+R.horizontalPadding?F=(R.height+$)/(P+A+R.horizontalPadding):F=(R.height+$)/R.width,$=N+R.verticalPadding;var q;return R.widthB&&A!=N){M.splice(-1,1),R.rows[N].push(D),R.rowWidth[A]=R.rowWidth[A]-B,R.rowWidth[N]=R.rowWidth[N]+B,R.width=R.rowWidth[instance.getLongestRowIndex(R)];for(var P=Number.MIN_VALUE,$=0;$P&&(P=M[$].height);A>0&&(P+=R.verticalPadding);var F=R.rowHeight[A]+R.rowHeight[N];R.rowHeight[A]=P,R.rowHeight[N]0)for(var j=D;j<=B;j++)H[0]+=this.grid[j][P-1].length+this.grid[j][P].length-1;if(B0)for(var j=P;j<=$;j++)H[3]+=this.grid[D-1][j].length+this.grid[D][j].length-1;for(var J=T.MAX_VALUE,U,le,ee=0;ee{var l=o(551).FDLayoutNode,u=o(551).IMath;function h(d,p,m,g){l.call(this,d,p,m,g)}h.prototype=Object.create(l.prototype);for(var f in l)h[f]=l[f];h.prototype.calculateDisplacement=function(){var d=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementX=d.coolingFactor*d.maxNodeDisplacement*u.sign(this.displacementX)),Math.abs(this.displacementY)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementY=d.coolingFactor*d.maxNodeDisplacement*u.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},h.prototype.propogateDisplacementToChildren=function(d,p){for(var m=this.getChild().getNodes(),g,y=0;y{function l(m){if(Array.isArray(m)){for(var g=0,y=Array(m.length);g0){var Et=0;Se.forEach(function(mt){pe=="horizontal"?(ze.set(mt,v.has(mt)?x[v.get(mt)]:ve.get(mt)),Et+=ze.get(mt)):(ze.set(mt,v.has(mt)?w[v.get(mt)]:ve.get(mt)),Et+=ze.get(mt))}),Et=Et/Se.length,rt.forEach(function(mt){K.has(mt)||ze.set(mt,Et)})}else{var De=0;rt.forEach(function(mt){pe=="horizontal"?De+=v.has(mt)?x[v.get(mt)]:ve.get(mt):De+=v.has(mt)?w[v.get(mt)]:ve.get(mt)}),De=De/rt.length,rt.forEach(function(mt){ze.set(mt,De)})}});for(var Ve=function(){var Se=Ke.shift(),Et=V.get(Se);Et.forEach(function(De){if(ze.get(De.id)mt&&(mt=xt),itTt&&(Tt=it)}}catch(Dr){_t=!0,Rt=Dr}finally{try{!jt&&bt.return&&bt.return()}finally{if(_t)throw Rt}}var Me=(Et+mt)/2-(De+Tt)/2,ut=!0,at=!1,dt=void 0;try{for(var tr=rt[Symbol.iterator](),Vt;!(ut=(Vt=tr.next()).done);ut=!0){var rr=Vt.value;ze.set(rr,ze.get(rr)+Me)}}catch(Dr){at=!0,dt=Dr}finally{try{!ut&&tr.return&&tr.return()}finally{if(at)throw dt}}})}return ze},O=function(V){var pe=0,K=0,ve=0,Z=0;if(V.forEach(function(Fe){Fe.left?x[v.get(Fe.left)]-x[v.get(Fe.right)]>=0?pe++:K++:w[v.get(Fe.top)]-w[v.get(Fe.bottom)]>=0?ve++:Z++}),pe>K&&ve>Z)for(var je=0;jeK)for(var Ne=0;NeZ)for(var ze=0;ze1)g.fixedNodeConstraint.forEach(function(ne,V){M[V]=[ne.position.x,ne.position.y],D[V]=[x[v.get(ne.nodeId)],w[v.get(ne.nodeId)]]}),B=!0;else if(g.alignmentConstraint)(function(){var ne=0;if(g.alignmentConstraint.vertical){for(var V=g.alignmentConstraint.vertical,pe=function(ze){var Fe=new Set;V[ze].forEach(function(tt){Fe.add(tt)});var Ke=new Set([].concat(l(Fe)).filter(function(tt){return $.has(tt)})),Ve=void 0;Ke.size>0?Ve=x[v.get(Ke.values().next().value)]:Ve=I(Fe).x,V[ze].forEach(function(tt){M[ne]=[Ve,w[v.get(tt)]],D[ne]=[x[v.get(tt)],w[v.get(tt)]],ne++})},K=0;K0?Ve=x[v.get(Ke.values().next().value)]:Ve=I(Fe).y,ve[ze].forEach(function(tt){M[ne]=[x[v.get(tt)],Ve],D[ne]=[x[v.get(tt)],w[v.get(tt)]],ne++})},je=0;jez&&(z=G[j].length,H=j);if(z0){var de={x:0,y:0};g.fixedNodeConstraint.forEach(function(ne,V){var pe={x:x[v.get(ne.nodeId)],y:w[v.get(ne.nodeId)]},K=ne.position,ve=E(K,pe);de.x+=ve.x,de.y+=ve.y}),de.x/=g.fixedNodeConstraint.length,de.y/=g.fixedNodeConstraint.length,x.forEach(function(ne,V){x[V]+=de.x}),w.forEach(function(ne,V){w[V]+=de.y}),g.fixedNodeConstraint.forEach(function(ne){x[v.get(ne.nodeId)]=ne.position.x,w[v.get(ne.nodeId)]=ne.position.y})}if(g.alignmentConstraint){if(g.alignmentConstraint.vertical)for(var ie=g.alignmentConstraint.vertical,Q=function(V){var pe=new Set;ie[V].forEach(function(Z){pe.add(Z)});var K=new Set([].concat(l(pe)).filter(function(Z){return $.has(Z)})),ve=void 0;K.size>0?ve=x[v.get(K.values().next().value)]:ve=I(pe).x,pe.forEach(function(Z){$.has(Z)||(x[v.get(Z)]=ve)})},he=0;he0?ve=w[v.get(K.values().next().value)]:ve=I(pe).y,pe.forEach(function(Z){$.has(Z)||(w[v.get(Z)]=ve)})},ge=0;ge{a.exports=e})},r={};function n(a){var s=r[a];if(s!==void 0)return s.exports;var o=r[a]={exports:{}};return t[a](o,o.exports,n),o.exports}var i=n(45);return i})()})});var pet=Qo((j6,gse)=>{(function(t,r){typeof j6=="object"&&typeof gse=="object"?gse.exports=r(mse()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof j6=="object"?j6.cytoscapeFcose=r(mse()):t.cytoscapeFcose=r(t.coseBase)})(j6,function(e){return(()=>{"use strict";var t={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(s){for(var o=arguments.length,l=Array(o>1?o-1:0),u=1;u{var l=(function(){function f(d,p){var m=[],g=!0,y=!1,v=void 0;try{for(var x=d[Symbol.iterator](),w;!(g=(w=x.next()).done)&&(m.push(w.value),!(p&&m.length===p));g=!0);}catch(C){y=!0,v=C}finally{try{!g&&x.return&&x.return()}finally{if(y)throw v}}return m}return function(d,p){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return f(d,p);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),u=o(140).layoutBase.LinkedList,h={};h.getTopMostNodes=function(f){for(var d={},p=0;p0&&B.merge(q)});for(var P=0;P1){w=v[0],C=w.connectedEdges().length,v.forEach(function(D){D.connectedEdges().length0&&m.set("dummy"+(m.size+1),S),E},h.relocateComponent=function(f,d,p){if(!p.fixedNodeConstraint){var m=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,y=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;if(p.quality=="draft"){var x=!0,w=!1,C=void 0;try{for(var T=d.nodeIndexes[Symbol.iterator](),k;!(x=(k=T.next()).done);x=!0){var S=k.value,E=l(S,2),I=E[0],L=E[1],O=p.cy.getElementById(I);if(O){var R=O.boundingBox(),A=d.xCoords[L]-R.w/2,N=d.xCoords[L]+R.w/2,M=d.yCoords[L]-R.h/2,D=d.yCoords[L]+R.h/2;Ag&&(g=N),Mv&&(v=D)}}}catch(q){w=!0,C=q}finally{try{!x&&T.return&&T.return()}finally{if(w)throw C}}var B=f.x-(g+m)/2,P=f.y-(v+y)/2;d.xCoords=d.xCoords.map(function(q){return q+B}),d.yCoords=d.yCoords.map(function(q){return q+P})}else{Object.keys(d).forEach(function(q){var G=d[q],z=G.getRect().x,H=G.getRect().x+G.getRect().width,j=G.getRect().y,J=G.getRect().y+G.getRect().height;zg&&(g=H),jv&&(v=J)});var $=f.x-(g+m)/2,F=f.y-(v+y)/2;Object.keys(d).forEach(function(q){var G=d[q];G.setCenter(G.getCenterX()+$,G.getCenterY()+F)})}}},h.calcBoundingBox=function(f,d,p,m){for(var g=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER,v=Number.MAX_SAFE_INTEGER,x=Number.MIN_SAFE_INTEGER,w=void 0,C=void 0,T=void 0,k=void 0,S=f.descendants().not(":parent"),E=S.length,I=0;Iw&&(g=w),yT&&(v=T),x{var l=o(548),u=o(140).CoSELayout,h=o(140).CoSENode,f=o(140).layoutBase.PointD,d=o(140).layoutBase.DimensionD,p=o(140).layoutBase.LayoutConstants,m=o(140).layoutBase.FDLayoutConstants,g=o(140).CoSEConstants,y=function(x,w){var C=x.cy,T=x.eles,k=T.nodes(),S=T.edges(),E=void 0,I=void 0,L=void 0,O={};x.randomize&&(E=w.nodeIndexes,I=w.xCoords,L=w.yCoords);var R=function(q){return typeof q=="function"},A=function(q,G){return R(q)?q(G):q},N=l.calcParentsWithoutChildren(C,T),M=function F(q,G,z,H){for(var j=G.length,J=0;J0){var oe=void 0;oe=z.getGraphManager().add(z.newGraph(),ee),F(oe,le,z,H)}}},D=function(q,G,z){for(var H=0,j=0,J=0;J0?g.DEFAULT_EDGE_LENGTH=m.DEFAULT_EDGE_LENGTH=H/j:R(x.idealEdgeLength)?g.DEFAULT_EDGE_LENGTH=m.DEFAULT_EDGE_LENGTH=50:g.DEFAULT_EDGE_LENGTH=m.DEFAULT_EDGE_LENGTH=x.idealEdgeLength,g.MIN_REPULSION_DIST=m.MIN_REPULSION_DIST=m.DEFAULT_EDGE_LENGTH/10,g.DEFAULT_RADIAL_SEPARATION=m.DEFAULT_EDGE_LENGTH)},B=function(q,G){G.fixedNodeConstraint&&(q.constraints.fixedNodeConstraint=G.fixedNodeConstraint),G.alignmentConstraint&&(q.constraints.alignmentConstraint=G.alignmentConstraint),G.relativePlacementConstraint&&(q.constraints.relativePlacementConstraint=G.relativePlacementConstraint)};x.nestingFactor!=null&&(g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=x.nestingFactor),x.gravity!=null&&(g.DEFAULT_GRAVITY_STRENGTH=m.DEFAULT_GRAVITY_STRENGTH=x.gravity),x.numIter!=null&&(g.MAX_ITERATIONS=m.MAX_ITERATIONS=x.numIter),x.gravityRange!=null&&(g.DEFAULT_GRAVITY_RANGE_FACTOR=m.DEFAULT_GRAVITY_RANGE_FACTOR=x.gravityRange),x.gravityCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=x.gravityCompound),x.gravityRangeCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=x.gravityRangeCompound),x.initialEnergyOnIncremental!=null&&(g.DEFAULT_COOLING_FACTOR_INCREMENTAL=m.DEFAULT_COOLING_FACTOR_INCREMENTAL=x.initialEnergyOnIncremental),x.tilingCompareBy!=null&&(g.TILING_COMPARE_BY=x.tilingCompareBy),x.quality=="proof"?p.QUALITY=2:p.QUALITY=0,g.NODE_DIMENSIONS_INCLUDE_LABELS=m.NODE_DIMENSIONS_INCLUDE_LABELS=p.NODE_DIMENSIONS_INCLUDE_LABELS=x.nodeDimensionsIncludeLabels,g.DEFAULT_INCREMENTAL=m.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!x.randomize,g.ANIMATE=m.ANIMATE=p.ANIMATE=x.animate,g.TILE=x.tile,g.TILING_PADDING_VERTICAL=typeof x.tilingPaddingVertical=="function"?x.tilingPaddingVertical.call():x.tilingPaddingVertical,g.TILING_PADDING_HORIZONTAL=typeof x.tilingPaddingHorizontal=="function"?x.tilingPaddingHorizontal.call():x.tilingPaddingHorizontal,g.DEFAULT_INCREMENTAL=m.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!0,g.PURE_INCREMENTAL=!x.randomize,p.DEFAULT_UNIFORM_LEAF_NODE_SIZES=x.uniformNodeDimensions,x.step=="transformed"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!1),x.step=="enforced"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!1),x.step=="cose"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!0),x.step=="all"&&(x.randomize?g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!0),x.fixedNodeConstraint||x.alignmentConstraint||x.relativePlacementConstraint?g.TREE_REDUCTION_ON_INCREMENTAL=!1:g.TREE_REDUCTION_ON_INCREMENTAL=!0;var P=new u,$=P.newGraphManager();return M($.addRoot(),l.getTopMostNodes(k),P,x),D(P,$,S),B(P,x),P.runLayout(),O};a.exports={coseLayout:y}}),212:((a,s,o)=>{var l=(function(){function x(w,C){for(var T=0;T0)if(D){var $=f.getTopMostNodes(T.eles.nodes());if(R=f.connectComponents(k,T.eles,$),R.forEach(function(Ge){var fe=Ge.boundingBox();A.push({x:fe.x1+fe.w/2,y:fe.y1+fe.h/2})}),T.randomize&&R.forEach(function(Ge){T.eles=Ge,E.push(p(T))}),T.quality=="default"||T.quality=="proof"){var F=k.collection();if(T.tile){var q=new Map,G=[],z=[],H=0,j={nodeIndexes:q,xCoords:G,yCoords:z},J=[];if(R.forEach(function(Ge,fe){Ge.edges().length==0&&(Ge.nodes().forEach(function(Ce,_e){F.merge(Ge.nodes()[_e]),Ce.isParent()||(j.nodeIndexes.set(Ge.nodes()[_e].id(),H++),j.xCoords.push(Ge.nodes()[0].position().x),j.yCoords.push(Ge.nodes()[0].position().y))}),J.push(fe))}),F.length>1){var U=F.boundingBox();A.push({x:U.x1+U.w/2,y:U.y1+U.h/2}),R.push(F),E.push(j);for(var le=J.length-1;le>=0;le--)R.splice(J[le],1),E.splice(J[le],1),A.splice(J[le],1)}}R.forEach(function(Ge,fe){T.eles=Ge,O.push(g(T,E[fe])),f.relocateComponent(A[fe],O[fe],T)})}else R.forEach(function(Ge,fe){f.relocateComponent(A[fe],E[fe],T)});var ee=new Set;if(R.length>1){var ue=[],ae=S.filter(function(Ge){return Ge.css("display")=="none"});R.forEach(function(Ge,fe){var Ce=void 0;if(T.quality=="draft"&&(Ce=E[fe].nodeIndexes),Ge.nodes().not(ae).length>0){var _e={};_e.edges=[],_e.nodes=[];var de=void 0;Ge.nodes().not(ae).forEach(function(ie){if(T.quality=="draft")if(!ie.isParent())de=Ce.get(ie.id()),_e.nodes.push({x:E[fe].xCoords[de]-ie.boundingbox().w/2,y:E[fe].yCoords[de]-ie.boundingbox().h/2,width:ie.boundingbox().w,height:ie.boundingbox().h});else{var Q=f.calcBoundingBox(ie,E[fe].xCoords,E[fe].yCoords,Ce);_e.nodes.push({x:Q.topLeftX,y:Q.topLeftY,width:Q.width,height:Q.height})}else O[fe][ie.id()]&&_e.nodes.push({x:O[fe][ie.id()].getLeft(),y:O[fe][ie.id()].getTop(),width:O[fe][ie.id()].getWidth(),height:O[fe][ie.id()].getHeight()})}),Ge.edges().forEach(function(ie){var Q=ie.source(),he=ie.target();if(Q.css("display")!="none"&&he.css("display")!="none")if(T.quality=="draft"){var xe=Ce.get(Q.id()),ce=Ce.get(he.id()),ge=[],Ie=[];if(Q.isParent()){var ye=f.calcBoundingBox(Q,E[fe].xCoords,E[fe].yCoords,Ce);ge.push(ye.topLeftX+ye.width/2),ge.push(ye.topLeftY+ye.height/2)}else ge.push(E[fe].xCoords[xe]),ge.push(E[fe].yCoords[xe]);if(he.isParent()){var ne=f.calcBoundingBox(he,E[fe].xCoords,E[fe].yCoords,Ce);Ie.push(ne.topLeftX+ne.width/2),Ie.push(ne.topLeftY+ne.height/2)}else Ie.push(E[fe].xCoords[ce]),Ie.push(E[fe].yCoords[ce]);_e.edges.push({startX:ge[0],startY:ge[1],endX:Ie[0],endY:Ie[1]})}else O[fe][Q.id()]&&O[fe][he.id()]&&_e.edges.push({startX:O[fe][Q.id()].getCenterX(),startY:O[fe][Q.id()].getCenterY(),endX:O[fe][he.id()].getCenterX(),endY:O[fe][he.id()].getCenterY()})}),_e.nodes.length>0&&(ue.push(_e),ee.add(fe))}});var oe=M.packComponents(ue,T.randomize).shifts;if(T.quality=="draft")E.forEach(function(Ge,fe){var Ce=Ge.xCoords.map(function(de){return de+oe[fe].dx}),_e=Ge.yCoords.map(function(de){return de+oe[fe].dy});Ge.xCoords=Ce,Ge.yCoords=_e});else{var Re=0;ee.forEach(function(Ge){Object.keys(O[Ge]).forEach(function(fe){var Ce=O[Ge][fe];Ce.setCenter(Ce.getCenterX()+oe[Re].dx,Ce.getCenterY()+oe[Re].dy)}),Re++})}}}else{var B=T.eles.boundingBox();if(A.push({x:B.x1+B.w/2,y:B.y1+B.h/2}),T.randomize){var P=p(T);E.push(P)}T.quality=="default"||T.quality=="proof"?(O.push(g(T,E[0])),f.relocateComponent(A[0],O[0],T)):f.relocateComponent(A[0],E[0],T)}var Te=function(fe,Ce){if(T.quality=="default"||T.quality=="proof"){typeof fe=="number"&&(fe=Ce);var _e=void 0,de=void 0,ie=fe.data("id");return O.forEach(function(he){ie in he&&(_e={x:he[ie].getRect().getCenterX(),y:he[ie].getRect().getCenterY()},de=he[ie])}),T.nodeDimensionsIncludeLabels&&(de.labelWidth&&(de.labelPosHorizontal=="left"?_e.x+=de.labelWidth/2:de.labelPosHorizontal=="right"&&(_e.x-=de.labelWidth/2)),de.labelHeight&&(de.labelPosVertical=="top"?_e.y+=de.labelHeight/2:de.labelPosVertical=="bottom"&&(_e.y-=de.labelHeight/2))),_e==null&&(_e={x:fe.position("x"),y:fe.position("y")}),{x:_e.x,y:_e.y}}else{var Q=void 0;return E.forEach(function(he){var xe=he.nodeIndexes.get(fe.id());xe!=null&&(Q={x:he.xCoords[xe],y:he.yCoords[xe]})}),Q==null&&(Q={x:fe.position("x"),y:fe.position("y")}),{x:Q.x,y:Q.y}}};if(T.quality=="default"||T.quality=="proof"||T.randomize){var Oe=f.calcParentsWithoutChildren(k,S),qe=S.filter(function(Ge){return Ge.css("display")=="none"});T.eles=S.not(qe),S.nodes().not(":parent").not(qe).layoutPositions(C,T,Te),Oe.length>0&&Oe.forEach(function(Ge){Ge.position(Te(Ge))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),x})();a.exports=v}),657:((a,s,o)=>{var l=o(548),u=o(140).layoutBase.Matrix,h=o(140).layoutBase.SVD,f=function(p){var m=p.cy,g=p.eles,y=g.nodes(),v=g.nodes(":parent"),x=new Map,w=new Map,C=new Map,T=[],k=[],S=[],E=[],I=[],L=[],O=[],R=[],A=void 0,N=void 0,M=1e8,D=1e-9,B=p.piTol,P=p.samplingType,$=p.nodeSeparation,F=void 0,q=function(){for(var pe=0,K=0,ve=!1;K=je;){ze=Z[je++];for(var rt=T[ze],Se=0;SeVe&&(Ve=I[De],tt=De)}return tt},z=function(pe){var K=void 0;if(pe){K=Math.floor(Math.random()*N),A=K;for(var Z=0;Z=1)break;Ve=Ke}for(var rt=0;rt=1)break;Ve=Ke}for(var Et=0;Et0&&(K.isParent()?T[pe].push(C.get(K.id())):T[pe].push(K.id()))})});var Oe=function(pe){var K=w.get(pe),ve=void 0;x.get(pe).forEach(function(Z){m.getElementById(Z).isParent()?ve=C.get(Z):ve=Z,T[K].push(ve),T[w.get(ve)].push(pe)})},qe=!0,Ge=!1,fe=void 0;try{for(var Ce=x.keys()[Symbol.iterator](),_e;!(qe=(_e=Ce.next()).done);qe=!0){var de=_e.value;Oe(de)}}catch(V){Ge=!0,fe=V}finally{try{!qe&&Ce.return&&Ce.return()}finally{if(Ge)throw fe}}N=w.size;var ie=void 0;if(N>2){F=N{var l=o(212),u=function(f){f&&f("layout","fcose",l)};typeof cytoscape<"u"&&u(cytoscape),a.exports=u}),140:(a=>{a.exports=e})},r={};function n(a){var s=r[a];if(s!==void 0)return s.exports;var o=r[a]={exports:{}};return t[a](o,o.exports,n),o.exports}var i=n(579);return i})()})});var Iet={};Tr(Iet,{diagram:()=>Lnr});function vse(e,t){if(e===0)return t();let r=Math.random,n=e>>>0;Math.random=function(){n=n+1831565813>>>0;let i=n;return i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61),((i^i>>>14)>>>0)/4294967296};try{return t()}finally{Math.random=r}}function ket(e,t,r){e.forEach(n=>{t.add({group:"nodes",data:{type:"service",id:n.id,icon:n.icon,label:n.title,parent:n.in,width:r.getConfigField("iconSize"),height:r.getConfigField("iconSize")},classes:"node-service"})})}function Tet(e,t,r){e.forEach(n=>{t.add({group:"nodes",data:{type:"junction",id:n.id,parent:n.in,width:r.getConfigField("iconSize"),height:r.getConfigField("iconSize")},classes:"node-junction"})})}function Cet(e,t){t.nodes().map(r=>{let n=wk(r);if(n.type==="group")return;n.x=r.position().x,n.y=r.position().y,e.getElementById(n.id).attr("transform","translate("+(n.x||0)+","+(n.y||0)+")")})}function Eet(e,t){e.forEach(r=>{t.add({group:"nodes",data:{type:"group",id:r.id,icon:r.icon,label:r.title,parent:r.in},classes:"node-group"})})}function Aet(e,t){e.forEach(r=>{let{lhsId:n,rhsId:i,lhsInto:a,lhsGroup:s,rhsInto:o,lhsDir:l,rhsDir:u,rhsGroup:h,title:f}=r,d=xse(r.lhsDir,r.rhsDir)?"segments":"straight",p={id:`${n}-${i}`,label:f,source:n,sourceDir:l,sourceArrow:a,sourceGroup:s,sourceEndpoint:l==="L"?"0 50%":l==="R"?"100% 50%":l==="T"?"50% 0":"50% 100%",target:i,targetDir:u,targetArrow:o,targetGroup:h,targetEndpoint:u==="L"?"0 50%":u==="R"?"100% 50%":u==="T"?"50% 0":"50% 100%"};t.add({group:"edges",data:p,classes:d})})}function _et(e,t,r,n=[]){let i=b((d,p)=>Object.entries(d).reduce((m,[g,y])=>{let v=0,x=Object.entries(y);if(x.length===1)return m[g]=x[0][1],m;for(let w=0;w{let p={},m={};return Object.entries(d).forEach(([g,[y,v]])=>{let x=e.getNode(g)?.in??"default";p[v]??={},p[v][x]??=[],p[v][x].push(g),m[y]??={},m[y][x]??=[],m[y][x].push(g)}),{horiz:Object.values(i(p,"horizontal")).filter(g=>g.length>1),vert:Object.values(i(m,"vertical")).filter(g=>g.length>1)}}),[s,o]=a.reduce(([d,p],{horiz:m,vert:g})=>[[...d,...m],[...p,...g]],[[],[]]),l=new Set;n.forEach(d=>d.members.forEach(p=>l.add(p)));let u=b(d=>d.filter(p=>!p.some(m=>l.has(m))),"dropOverlapping"),h=u(s),f=u(o);return n.forEach(d=>{d.members.length<2||(d.direction==="row"?h.push([...d.members]):f.push([...d.members]))}),{horizontal:h,vertical:f}}function Ret(e,t,r=[]){let n=[],i=t.getConfigField("iconSize"),a=t.getConfigField("idealEdgeLengthMultiplier"),s=a*i,o=new Set;r.forEach(h=>{for(let f=0;f`${h[0]},${h[1]}`,"posToStr"),u=b(h=>h.split(",").map(f=>parseInt(f)),"strToPos");return e.forEach(h=>{let f=Object.fromEntries(Object.entries(h).map(([g,y])=>[l(y),g])),d=[l([0,0])],p={},m={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;d.length>0;){let g=d.shift();if(g){p[g]=1;let y=f[g];if(y){let v=u(g);Object.entries(m).forEach(([x,w])=>{let C=l([v[0]+w[0],v[1]+w[1]]),T=f[C];if(T&&!p[C]){if(d.push(C),o.has(`${y}|${T}`))return;n.push({[met[x]]:T,[met[fnr(x)]]:y,gap:a*i})}})}}}}),n}function Let(e,t,r,n,i,{spatialMaps:a,groupAlignments:s}){return new Promise(o=>{let l=ct("body").append("div").attr("id","cy").attr("style","display:none"),u=Du({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${i.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${i.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});l.remove(),Eet(r,u),ket(e,u,i),Tet(t,u,i),Aet(n,u);let h=i.getLayoutHints(),f=_et(i,a,s,h),d=Ret(a,i,h),p=i.getConfigField("iconSize"),m=i.getConfigField("idealEdgeLengthMultiplier")*p,g=.5*p,y=i.getConfigField("edgeElasticity"),v=i.getConfigField("seed"),x=u.layout({name:"fcose",quality:"proof",randomize:i.getConfigField("randomize"),nodeSeparation:i.getConfigField("nodeSeparation"),numIter:i.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(w){let[C,T]=w.connectedNodes(),{parent:k}=wk(C),{parent:S}=wk(T);return k===S?m:g},edgeElasticity(w){let[C,T]=w.connectedNodes(),{parent:k}=wk(C),{parent:S}=wk(T);return k===S?y:.001},alignmentConstraint:f,relativePlacementConstraint:d});x.one("layoutstop",()=>{function w(C,T,k,S){let E,I,{x:L,y:O}=C,{x:R,y:A}=T;I=(S-O+(L-k)*(O-A)/(L-R))/Math.sqrt(1+Math.pow((O-A)/(L-R),2)),E=Math.sqrt(Math.pow(S-O,2)+Math.pow(k-L,2)-Math.pow(I,2));let N=Math.sqrt(Math.pow(R-L,2)+Math.pow(A-O,2));E=E/N;let M=(R-L)*(S-O)-(A-O)*(k-L);switch(!0){case M>=0:M=1;break;case M<0:M=-1;break}let D=(R-L)*(k-L)+(A-O)*(S-O);switch(!0){case D>=0:D=1;break;case D<0:D=-1;break}return I=Math.abs(I)*M,E=E*D,{distances:I,weights:E}}b(w,"getSegmentWeights"),u.startBatch();for(let C of Object.values(u.edges()))if(C.data?.()){let{x:T,y:k}=C.source().position(),{x:S,y:E}=C.target().position();if(T!==S&&k!==E){let I=C.sourceEndpoint(),L=C.targetEndpoint(),{sourceDir:O}=vet(C),[R,A]=r1(O)?[I.x,L.y]:[L.x,I.y],{weights:N,distances:M}=w(I,L,R,A);C.style("segment-distances",M),C.style("segment-weights",N)}}u.endBatch(),vse(v,()=>x.run())});try{vse(v,()=>x.run())}catch(w){throw w instanceof RangeError&&w.message.includes("Invalid array length")?new Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis."):w}u.ready(w=>{se.info("Ready",w),o(u)})})}var wet,met,get,YO,fnr,yet,Bl,r1,xse,dnr,pnr,yse,mnr,gnr,ynr,vnr,xnr,vet,wk,bnr,xet,wnr,bet,knr,Tnr,bk,K6,Cnr,Snr,Enr,Anr,_nr,Rnr,Lnr,Met=W(()=>{Sl();za();bs();ts();Sn();_r();Rr();hr();Co();LZ();wet=Ro(pet(),1);fn();met={L:"left",R:"right",T:"top",B:"bottom"},get={L:b(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:b(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:b(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:b(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},YO={L:b((e,t)=>e-t+2,"L"),R:b((e,t)=>e-2,"R"),T:b((e,t)=>e-t+2,"T"),B:b((e,t)=>e-2,"B")},fnr=b(function(e){return Bl(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),yet=b(function(e){let t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),Bl=b(function(e){let t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),r1=b(function(e){let t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),xse=b(function(e,t){let r=Bl(e)&&r1(t),n=r1(e)&&Bl(t);return r||n},"isArchitectureDirectionXY"),dnr=b(function(e){let t=e[0],r=e[1],n=Bl(t)&&r1(r),i=r1(t)&&Bl(r);return n||i},"isArchitecturePairXY"),pnr=b(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),yse=b(function(e,t){let r=`${e}${t}`;return pnr(r)?r:void 0},"getArchitectureDirectionPair"),mnr=b(function([e,t],r){let n=r[0],i=r[1];return Bl(n)?r1(i)?[e+(n==="L"?-1:1),t+(i==="T"?1:-1)]:[e+(n==="L"?-1:1),t]:Bl(i)?[e+(i==="L"?1:-1),t+(n==="T"?1:-1)]:[e,t+(n==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),gnr=b(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),ynr=b(function(e,t){return xse(e,t)?"bend":Bl(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),vnr=b(function(e){return e.type==="service"},"isArchitectureService"),xnr=b(function(e){return e.type==="junction"},"isArchitectureJunction"),vet=b(e=>e.data(),"edgeData"),wk=b(e=>e.data(),"nodeData"),bnr=Lr.architecture,xet=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Yr,this.getAccTitle=Qr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getAccDescription=en,this.setAccDescription=Jr,this.clear()}static{b(this,"ArchitectureDB")}setDiagramId(e){this.diagramId=e}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",Nr()}addService({id:e,icon:t,in:r,title:n,iconText:i}){if(this.registeredIds[e]!==void 0)throw new Error(`The service id [${e}] is already in use by another ${this.registeredIds[e]}`);if(r!==void 0){if(e===r)throw new Error(`The service [${e}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The service [${e}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[r]==="node")throw new Error(`The service [${e}]'s parent is not a group`)}this.registeredIds[e]="node",this.nodes[e]={id:e,type:"service",icon:t,iconText:i,title:n,edges:[],in:r}}getServices(){return Object.values(this.nodes).filter(vnr)}addJunction({id:e,in:t}){if(this.registeredIds[e]!==void 0)throw new Error(`The junction id [${e}] is already in use by another ${this.registeredIds[e]}`);if(t!==void 0){if(e===t)throw new Error(`The junction [${e}] cannot be placed within itself`);if(this.registeredIds[t]===void 0)throw new Error(`The junction [${e}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[t]==="node")throw new Error(`The junction [${e}]'s parent is not a group`)}this.registeredIds[e]="node",this.nodes[e]={id:e,type:"junction",edges:[],in:t}}getJunctions(){return Object.values(this.nodes).filter(xnr)}getNodes(){return Object.values(this.nodes)}getNode(e){return this.nodes[e]??null}addGroup({id:e,icon:t,in:r,title:n}){if(this.registeredIds?.[e]!==void 0)throw new Error(`The group id [${e}] is already in use by another ${this.registeredIds[e]}`);if(r!==void 0){if(e===r)throw new Error(`The group [${e}] cannot be placed within itself`);if(this.registeredIds?.[r]===void 0)throw new Error(`The group [${e}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[r]==="node")throw new Error(`The group [${e}]'s parent is not a group`)}this.registeredIds[e]="group",this.groups[e]={id:e,icon:t,title:n,in:r}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:e,rhsId:t,lhsDir:r,rhsDir:n,lhsInto:i,rhsInto:a,lhsGroup:s,rhsGroup:o,title:l}){if(!yet(r))throw new Error(`Invalid direction given for left hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${String(r)}`);if(!yet(n))throw new Error(`Invalid direction given for right hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${String(n)}`);if(this.nodes[e]===void 0&&this.groups[e]===void 0)throw new Error(`The left-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The right-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);let u=this.nodes[e].in,h=this.nodes[t].in;if(s&&u&&h&&u==h)throw new Error(`The left-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(o&&u&&h&&u==h)throw new Error(`The right-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let f={lhsId:e,lhsDir:r,lhsInto:i,lhsGroup:s,rhsId:t,rhsDir:n,rhsInto:a,rhsGroup:o,title:l};this.edges.push(f),this.nodes[e]&&this.nodes[t]&&(this.nodes[e].edges.push(this.edges[this.edges.length-1]),this.nodes[t].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(e){if(e.members.length<2)throw new Error(`An align directive requires at least two members; got ${e.members.length}`);let t=new Set;e.members.forEach(r=>{if(this.registeredIds[r]!=="node")throw new Error(`align ${e.direction} references [${r}], which is not a service or junction`);if(t.has(r))throw new Error(`align ${e.direction} lists [${r}] more than once`);t.add(r)}),this.layoutHints.push(e)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){let e={},t=Object.entries(this.nodes).reduce((o,[l,u])=>(o[l]=u.edges.reduce((h,f)=>{let d=this.getNode(f.lhsId)?.in,p=this.getNode(f.rhsId)?.in;if(d&&p&&d!==p){let m=ynr(f.lhsDir,f.rhsDir);m!=="bend"&&(e[d]??={},e[d][p]=m,e[p]??={},e[p][d]=m)}if(f.lhsId===l){let m=yse(f.lhsDir,f.rhsDir);m&&(h[m]=f.rhsId)}else{let m=yse(f.rhsDir,f.lhsDir);m&&(h[m]=f.lhsId)}return h},{}),o),{}),r=Object.keys(t)[0],n={[r]:1},i=Object.keys(t).reduce((o,l)=>l===r?o:{...o,[l]:1},{}),a=b(o=>{let l={[o]:[0,0]},u=[o];for(;u.length>0;){let h=u.shift();if(h){n[h]=1,delete i[h];let f=t[h],[d,p]=l[h];Object.entries(f).forEach(([m,g])=>{n[g]||(l[g]=mnr([d,p],m),u.push(g))})}}return l},"BFS"),s=[a(r)];for(;Object.keys(i).length>0;)s.push(a(Object.keys(i)[0]));this.dataStructures={adjList:t,spatialMaps:s,groupAlignments:e}}return this.dataStructures}setElementForId(e,t){this.elements[e]=t}getElementById(e){return this.elements[e]}getConfig(){return Rn({...bnr,...qt().architecture})}getConfigField(e){return this.getConfig()[e]}},wnr=b((e,t)=>{wi(e,t),e.groups.map(r=>t.addGroup(r)),e.services.map(r=>t.addService({...r,type:"service"})),e.junctions.map(r=>t.addJunction({...r,type:"junction"})),e.edges.map(r=>t.addEdge(r)),e.alignments?.map(r=>t.addLayoutHint({direction:r.direction,members:[...r.members]}))},"populateDb"),bet={parser:{yy:void 0},parse:b(async e=>{let t=await ba("architecture",e);se.debug(t);let r=bet.parser?.yy;if(!(r instanceof xet))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");wnr(t,r)},"parse")},knr=b(e=>` + `},"styles"),pnr=dnr,mnr={db:use,renderer:hnr,parser:nnr,styles:pnr}});var mse=Jo((Y6,pse)=>{(function(t,r){typeof Y6=="object"&&typeof pse=="object"?pse.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Y6=="object"?Y6.layoutBase=r():t.layoutBase=r()})(Y6,function(){return(function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(n){return n},r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:a})},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=28)})([(function(e,t,r){"use strict";function n(){}n.QUALITY=1,n.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,n.DEFAULT_INCREMENTAL=!1,n.DEFAULT_ANIMATION_ON_LAYOUT=!0,n.DEFAULT_ANIMATION_DURING_LAYOUT=!1,n.DEFAULT_ANIMATION_PERIOD=50,n.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,n.DEFAULT_GRAPH_MARGIN=15,n.NODE_DIMENSIONS_INCLUDE_LABELS=!1,n.SIMPLE_NODE_SIZE=40,n.SIMPLE_NODE_HALF_SIZE=n.SIMPLE_NODE_SIZE/2,n.EMPTY_COMPOUND_NODE_SIZE=40,n.MIN_EDGE_LENGTH=1,n.WORLD_BOUNDARY=1e6,n.INITIAL_WORLD_BOUNDARY=n.WORLD_BOUNDARY/1e3,n.WORLD_CENTER_X=1200,n.WORLD_CENTER_Y=900,e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(8),a=r(9);function s(l,u,h){n.call(this,h),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=h,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var h=this.getOtherEnd(l),f=u.getGraphManager().getRoot();;){if(h.getOwner()==u)return h;if(h.getOwner()==f)break;h=h.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=s}),(function(e,t,r){"use strict";function n(i){this.vGraphObject=i}e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(13),s=r(0),o=r(16),l=r(5);function u(f,d,p,m){p==null&&m==null&&(m=d),n.call(this,m),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=m,this.edges=[],this.graphManager=f,p!=null&&d!=null?this.rect=new a(d.x,d.y,p.width,p.height):this.rect=new a}u.prototype=Object.create(n.prototype);for(var h in n)u[h]=n[h];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(f){this.rect.width=f},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(f){this.rect.height=f},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(f,d){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=d.width,this.rect.height=d.height},u.prototype.setCenter=function(f,d){this.rect.x=f-this.rect.width/2,this.rect.y=d-this.rect.height/2},u.prototype.setLocation=function(f,d){this.rect.x=f,this.rect.y=d},u.prototype.moveBy=function(f,d){this.rect.x+=f,this.rect.y+=d},u.prototype.getEdgeListToNode=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(g.target==f){if(g.source!=m)throw"Incorrect edge source!";d.push(g)}}),d},u.prototype.getEdgesBetween=function(f){var d=[],p,m=this;return m.edges.forEach(function(g){if(!(g.source==m||g.target==m))throw"Incorrect edge source and/or target";(g.target==f||g.source==f)&&d.push(g)}),d},u.prototype.getNeighborsList=function(){var f=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)f.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";f.add(p.source)}}),f},u.prototype.withChildren=function(){var f=new Set,d,p;if(f.add(this),this.child!=null)for(var m=this.child.getNodes(),g=0;gd?(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(d+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(p+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>p?(this.rect.y-=(this.labelHeight-p)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(p+this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(f){var d=this.rect.x;d>s.WORLD_BOUNDARY?d=s.WORLD_BOUNDARY:d<-s.WORLD_BOUNDARY&&(d=-s.WORLD_BOUNDARY);var p=this.rect.y;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var m=new l(d,p),g=f.inverseTransformPoint(m);this.setLocation(g.x,g.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=u}),(function(e,t,r){"use strict";var n=r(0);function i(){}for(var a in n)i[a]=n[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=i.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i}),(function(e,t,r){"use strict";function n(i,a){i==null&&a==null?(this.x=0,this.y=0):(this.x=i,this.y=a)}n.prototype.getX=function(){return this.x},n.prototype.getY=function(){return this.y},n.prototype.setX=function(i){this.x=i},n.prototype.setY=function(i){this.y=i},n.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},n.prototype.getCopy=function(){return new n(this.x,this.y)},n.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},e.exports=n}),(function(e,t,r){"use strict";var n=r(2),i=r(10),a=r(0),s=r(7),o=r(3),l=r(1),u=r(13),h=r(12),f=r(11);function d(m,g,y){n.call(this,y),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=m,g!=null&&g instanceof s?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}d.prototype=Object.create(n.prototype);for(var p in n)d[p]=n[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(m,g,y){if(g==null&&y==null){var v=m;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(v)>-1)throw"Node already in graph!";return v.owner=this,this.getNodes().push(v),v}else{var x=m;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(g.owner==y.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=y.owner?null:(x.source=g,x.target=y,x.isInterGraph=!1,this.getEdges().push(x),g.edges.push(x),y!=g&&y.edges.push(x),x)}},d.prototype.remove=function(m){var g=m;if(m instanceof o){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=g.edges.slice(),v,x=y.length,w=0;w-1&&k>-1))throw"Source and/or target doesn't know this edge!";v.source.edges.splice(T,1),v.target!=v.source&&v.target.edges.splice(k,1);var C=v.source.owner.getEdges().indexOf(v);if(C==-1)throw"Not in owner's edge list!";v.source.owner.getEdges().splice(C,1)}},d.prototype.updateLeftTop=function(){for(var m=i.MAX_VALUE,g=i.MAX_VALUE,y,v,x,w=this.getNodes(),C=w.length,T=0;Ty&&(m=y),g>v&&(g=v)}return m==i.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?x=w[0].getParent().paddingLeft:x=this.margin,this.left=g-x,this.top=m-x,new h(this.left,this.top))},d.prototype.updateBounds=function(m){for(var g=i.MAX_VALUE,y=-i.MAX_VALUE,v=i.MAX_VALUE,x=-i.MAX_VALUE,w,C,T,k,S,E=this.nodes,I=E.length,L=0;Lw&&(g=w),yT&&(v=T),xw&&(g=w),yT&&(v=T),x=this.nodes.length){var I=0;y.forEach(function(L){L.owner==m&&I++}),I==this.nodes.length&&(this.isConnected=!0)}},e.exports=d}),(function(e,t,r){"use strict";var n,i=r(1);function a(s){n=r(6),this.layout=s,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},a.prototype.add=function(s,o,l,u,h){if(l==null&&u==null&&h==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{h=l,u=o,l=s;var f=u.getOwner(),d=h.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==d)return l.isInterGraph=!1,f.add(l,u,h);if(l.isInterGraph=!0,l.source=u,l.target=h,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},a.prototype.remove=function(s){if(s instanceof n){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,h=l.length,f=0;f=s.getRight()?o[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(o[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(o[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var h=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(h=1);var f=h*o[0],d=o[1]/h;o[0]f)return o[0]=l,o[1]=p,o[2]=h,o[3]=E,!1;if(uh)return o[0]=d,o[1]=u,o[2]=k,o[3]=f,!1;if(lh?(o[0]=g,o[1]=y,R=!0):(o[0]=m,o[1]=p,R=!0):N===D&&(l>h?(o[0]=d,o[1]=p,R=!0):(o[0]=v,o[1]=y,R=!0)),-M===D?h>l?(o[2]=S,o[3]=E,A=!0):(o[2]=k,o[3]=T,A=!0):M===D&&(h>l?(o[2]=C,o[3]=T,A=!0):(o[2]=I,o[3]=E,A=!0)),R&&A)return!1;if(l>h?u>f?(B=this.getCardinalDirection(N,D,4),P=this.getCardinalDirection(M,D,2)):(B=this.getCardinalDirection(-N,D,3),P=this.getCardinalDirection(-M,D,1)):u>f?(B=this.getCardinalDirection(-N,D,1),P=this.getCardinalDirection(-M,D,3)):(B=this.getCardinalDirection(N,D,2),P=this.getCardinalDirection(M,D,4)),!R)switch(B){case 1:F=p,$=l+-w/D,o[0]=$,o[1]=F;break;case 2:$=v,F=u+x*D,o[0]=$,o[1]=F;break;case 3:F=y,$=l+w/D,o[0]=$,o[1]=F;break;case 4:$=g,F=u+-x*D,o[0]=$,o[1]=F;break}if(!A)switch(P){case 1:G=T,q=h+-O/D,o[2]=q,o[3]=G;break;case 2:q=I,G=f+L*D,o[2]=q,o[3]=G;break;case 3:G=E,q=h+O/D,o[2]=q,o[3]=G;break;case 4:q=S,G=f+-L*D,o[2]=q,o[3]=G;break}}return!1},i.getCardinalDirection=function(a,s,o){return a>s?o:1+o%4},i.getIntersection=function(a,s,o,l){if(l==null)return this.getIntersection2(a,s,o);var u=a.x,h=a.y,f=s.x,d=s.y,p=o.x,m=o.y,g=l.x,y=l.y,v=void 0,x=void 0,w=void 0,C=void 0,T=void 0,k=void 0,S=void 0,E=void 0,I=void 0;return w=d-h,T=u-f,S=f*h-u*d,C=y-m,k=p-g,E=g*m-p*y,I=w*k-C*T,I===0?null:(v=(T*E-k*S)/I,x=(C*S-w*E)/I,new n(v,x))},i.angleOfVector=function(a,s,o,l){var u=void 0;return a!==o?(u=Math.atan((l-s)/(o-a)),o=0){var y=(-p+Math.sqrt(p*p-4*d*m))/(2*d),v=(-p-Math.sqrt(p*p-4*d*m))/(2*d),x=null;return y>=0&&y<=1?[y]:v>=0&&v<=1?[v]:x}else return null},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i}),(function(e,t,r){"use strict";function n(){}n.sign=function(i){return i>0?1:i<0?-1:0},n.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},n.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},e.exports=n}),(function(e,t,r){"use strict";function n(){}n.MAX_VALUE=2147483647,n.MIN_VALUE=-2147483648,e.exports=n}),(function(e,t,r){"use strict";var n=(function(){function u(h,f){for(var d=0;d"u"?"undefined":n(a);return a==null||s!="object"&&s!="function"},e.exports=i}),(function(e,t,r){"use strict";function n(p){if(Array.isArray(p)){for(var m=0,g=Array(p.length);m0&&m;){for(w.push(T[0]);w.length>0&&m;){var k=w[0];w.splice(0,1),x.add(k);for(var S=k.getEdges(),v=0;v-1&&T.splice(O,1)}x=new Set,C=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var m=[],g=p.source,y=this.graphManager.calcLowestCommonAncestor(p.source,p.target),v=0;v0){for(var y=this.edgeToDummyNodes.get(g),v=0;v=0&&m.splice(E,1);var I=C.getNeighborsList();I.forEach(function(R){if(g.indexOf(R)<0){var A=y.get(R),N=A-1;N==1&&k.push(R),y.set(R,N)}})}g=g.concat(k),(m.length==1||m.length==2)&&(v=!0,x=m[0])}return x},d.prototype.setGraphManager=function(p){this.graphManager=p},e.exports=d}),(function(e,t,r){"use strict";function n(){}n.seed=1,n.x=0,n.nextDouble=function(){return n.x=Math.sin(n.seed++)*1e4,n.x-Math.floor(n.x)},e.exports=n}),(function(e,t,r){"use strict";var n=r(5);function i(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(a){this.lworldExtX=a},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(a){this.lworldExtY=a},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},i.prototype.transformX=function(a){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/o),s},i.prototype.transformY=function(a){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/o),s},i.prototype.inverseTransformX=function(a){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/o),s},i.prototype.inverseTransformY=function(a){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/o),s},i.prototype.inverseTransformPoint=function(a){var s=new n(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},e.exports=i}),(function(e,t,r){"use strict";function n(f){if(Array.isArray(f)){for(var d=0,p=Array(f.length);da.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),d,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,m,g,y,v=this.getAllNodes(),x;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),x=new Set,p=0;pw||x>w)&&(f.gravitationForceX=-this.gravityConstant*g,f.gravitationForceY=-this.gravityConstant*y)):(w=d.getEstimatedSize()*this.compoundGravityRangeFactor,(v>w||x>w)&&(f.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},u.prototype.isConverged=function(){var f,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=v.length||w>=v[0].length)){for(var C=0;Cu}}]),o})();e.exports=s}),(function(e,t,r){"use strict";function n(){}n.svd=function(i){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=i.length,this.n=i[0].length;var a=Math.min(this.m,this.n);this.s=(function(Rt){for(var bt=[];Rt-- >0;)bt.push(0);return bt})(Math.min(this.m+1,this.n)),this.U=(function(Rt){var bt=function ke(yt){if(yt.length==0)return 0;for(var xt=[],it=0;it0;)bt.push(0);return bt})(this.n),o=(function(Rt){for(var bt=[];Rt-- >0;)bt.push(0);return bt})(this.m),l=!0,u=!0,h=Math.min(this.m-1,this.n),f=Math.max(0,Math.min(this.n-2,this.m)),d=0;d=0;D--)if(this.s[D]!==0){for(var B=D+1;B=0;H--){if((function(Rt,bt){return Rt&&bt})(H0;){var Te=void 0,Oe=void 0;for(Te=A-2;Te>=-1&&Te!==-1;Te--)if(Math.abs(s[Te])<=Re+oe*(Math.abs(this.s[Te])+Math.abs(this.s[Te+1]))){s[Te]=0;break}if(Te===A-2)Oe=4;else{var qe=void 0;for(qe=A-1;qe>=Te&&qe!==Te;qe--){var Ge=(qe!==A?Math.abs(s[qe]):0)+(qe!==Te+1?Math.abs(s[qe-1]):0);if(Math.abs(this.s[qe])<=Re+oe*Ge){this.s[qe]=0;break}}qe===Te?Oe=3:qe===A-1?Oe=1:(Oe=2,Te=qe)}switch(Te++,Oe){case 1:{var fe=s[A-2];s[A-2]=0;for(var Ce=A-2;Ce>=Te;Ce--){var _e=n.hypot(this.s[Ce],fe),de=this.s[Ce]/_e,ie=fe/_e;if(this.s[Ce]=_e,Ce!==Te&&(fe=-ie*s[Ce-1],s[Ce-1]=de*s[Ce-1]),u)for(var Q=0;Q=this.s[Te+1]);){var mt=this.s[Te];if(this.s[Te]=this.s[Te+1],this.s[Te+1]=mt,u&&TeMath.abs(a)?(s=a/i,s=Math.abs(i)*Math.sqrt(1+s*s)):a!=0?(s=i/a,s=Math.abs(a)*Math.sqrt(1+s*s)):s=0,s},e.exports=n}),(function(e,t,r){"use strict";var n=(function(){function s(o,l){for(var u=0;u2&&arguments[2]!==void 0?arguments[2]:1,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=h,this.gap_penalty=f,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;o--){var l=this.listeners[o];l.event===a&&l.callback===s&&this.listeners.splice(o,1)}},i.emit=function(a,s){for(var o=0;o{(function(t,r){typeof X6=="object"&&typeof gse=="object"?gse.exports=r(mse()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof X6=="object"?X6.coseBase=r(mse()):t.coseBase=r(t.layoutBase)})(X6,function(e){return(()=>{"use strict";var t={45:((a,s,o)=>{var l={};l.layoutBase=o(551),l.CoSEConstants=o(806),l.CoSEEdge=o(767),l.CoSEGraph=o(880),l.CoSEGraphManager=o(578),l.CoSELayout=o(765),l.CoSENode=o(991),l.ConstraintHandler=o(902),a.exports=l}),806:((a,s,o)=>{var l=o(551).FDLayoutConstants;function u(){}for(var h in l)u[h]=l[h];u.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,u.DEFAULT_RADIAL_SEPARATION=l.DEFAULT_EDGE_LENGTH,u.DEFAULT_COMPONENT_SEPERATION=60,u.TILE=!0,u.TILING_PADDING_VERTICAL=10,u.TILING_PADDING_HORIZONTAL=10,u.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,u.ENFORCE_CONSTRAINTS=!0,u.APPLY_LAYOUT=!0,u.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,u.TREE_REDUCTION_ON_INCREMENTAL=!0,u.PURE_INCREMENTAL=u.DEFAULT_INCREMENTAL,a.exports=u}),767:((a,s,o)=>{var l=o(551).FDLayoutEdge;function u(f,d,p){l.call(this,f,d,p)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u}),880:((a,s,o)=>{var l=o(551).LGraph;function u(f,d,p){l.call(this,f,d,p)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u}),578:((a,s,o)=>{var l=o(551).LGraphManager;function u(f){l.call(this,f)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u}),765:((a,s,o)=>{var l=o(551).FDLayout,u=o(578),h=o(880),f=o(991),d=o(767),p=o(806),m=o(902),g=o(551).FDLayoutConstants,y=o(551).LayoutConstants,v=o(551).Point,x=o(551).PointD,w=o(551).DimensionD,C=o(551).Layout,T=o(551).Integer,k=o(551).IGeometry,S=o(551).LGraph,E=o(551).Transform,I=o(551).LinkedList;function L(){l.call(this),this.toBeTiled={},this.constraints={}}L.prototype=Object.create(l.prototype);for(var O in l)L[O]=l[O];L.prototype.newGraphManager=function(){var R=new u(this);return this.graphManager=R,R},L.prototype.newGraph=function(R){return new h(null,this.graphManager,R)},L.prototype.newNode=function(R){return new f(this.graphManager,R)},L.prototype.newEdge=function(R){return new d(null,null,R)},L.prototype.initParameters=function(){l.prototype.initParameters.call(this,arguments),this.isSubLayout||(p.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=p.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=p.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=g.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=g.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},L.prototype.initSpringEmbedder=function(){l.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/g.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},L.prototype.layout=function(){var R=y.DEFAULT_CREATE_BENDS_AS_NEEDED;return R&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},L.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(p.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),N=this.nodesWithGravity.filter(function(B){return A.has(B)});this.graphManager.setAllNodesToApplyGravitation(N)}}else{var R=this.getFlatForest();if(R.length>0)this.positionNodesRadially(R);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),N=this.nodesWithGravity.filter(function(M){return A.has(M)});this.graphManager.setAllNodesToApplyGravitation(N),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(m.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),p.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},L.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%g.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var R=new Set(this.getAllNodes()),A=this.nodesWithGravity.filter(function(D){return R.has(D)});this.graphManager.setAllNodesToApplyGravitation(A),this.graphManager.updateBounds(),this.updateGrid(),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var N=!this.isTreeGrowing&&!this.isGrowthFinished,M=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(N,M),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},L.prototype.getPositionsData=function(){for(var R=this.graphManager.getAllNodes(),A={},N=0;N0&&this.updateDisplacements();for(var N=0;N0&&(M.fixedNodeWeight=B)}}if(this.constraints.relativePlacementConstraint){var P=new Map,$=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(U){R.fixedNodesOnHorizontal.add(U),R.fixedNodesOnVertical.add(U)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var F=this.constraints.alignmentConstraint.vertical,N=0;N=2*U.length/3;ue--)le=Math.floor(Math.random()*(ue+1)),ee=U[ue],U[ue]=U[le],U[le]=ee;return U},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(U){if(U.left){var le=P.has(U.left)?P.get(U.left):U.left,ee=P.has(U.right)?P.get(U.right):U.right;R.nodesInRelativeHorizontal.includes(le)||(R.nodesInRelativeHorizontal.push(le),R.nodeToRelativeConstraintMapHorizontal.set(le,[]),R.dummyToNodeForVerticalAlignment.has(le)?R.nodeToTempPositionMapHorizontal.set(le,R.idToNodeMap.get(R.dummyToNodeForVerticalAlignment.get(le)[0]).getCenterX()):R.nodeToTempPositionMapHorizontal.set(le,R.idToNodeMap.get(le).getCenterX())),R.nodesInRelativeHorizontal.includes(ee)||(R.nodesInRelativeHorizontal.push(ee),R.nodeToRelativeConstraintMapHorizontal.set(ee,[]),R.dummyToNodeForVerticalAlignment.has(ee)?R.nodeToTempPositionMapHorizontal.set(ee,R.idToNodeMap.get(R.dummyToNodeForVerticalAlignment.get(ee)[0]).getCenterX()):R.nodeToTempPositionMapHorizontal.set(ee,R.idToNodeMap.get(ee).getCenterX())),R.nodeToRelativeConstraintMapHorizontal.get(le).push({right:ee,gap:U.gap}),R.nodeToRelativeConstraintMapHorizontal.get(ee).push({left:le,gap:U.gap})}else{var ue=$.has(U.top)?$.get(U.top):U.top,ae=$.has(U.bottom)?$.get(U.bottom):U.bottom;R.nodesInRelativeVertical.includes(ue)||(R.nodesInRelativeVertical.push(ue),R.nodeToRelativeConstraintMapVertical.set(ue,[]),R.dummyToNodeForHorizontalAlignment.has(ue)?R.nodeToTempPositionMapVertical.set(ue,R.idToNodeMap.get(R.dummyToNodeForHorizontalAlignment.get(ue)[0]).getCenterY()):R.nodeToTempPositionMapVertical.set(ue,R.idToNodeMap.get(ue).getCenterY())),R.nodesInRelativeVertical.includes(ae)||(R.nodesInRelativeVertical.push(ae),R.nodeToRelativeConstraintMapVertical.set(ae,[]),R.dummyToNodeForHorizontalAlignment.has(ae)?R.nodeToTempPositionMapVertical.set(ae,R.idToNodeMap.get(R.dummyToNodeForHorizontalAlignment.get(ae)[0]).getCenterY()):R.nodeToTempPositionMapVertical.set(ae,R.idToNodeMap.get(ae).getCenterY())),R.nodeToRelativeConstraintMapVertical.get(ue).push({bottom:ae,gap:U.gap}),R.nodeToRelativeConstraintMapVertical.get(ae).push({top:ue,gap:U.gap})}});else{var G=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(U){if(U.left){var le=P.has(U.left)?P.get(U.left):U.left,ee=P.has(U.right)?P.get(U.right):U.right;G.has(le)?G.get(le).push(ee):G.set(le,[ee]),G.has(ee)?G.get(ee).push(le):G.set(ee,[le])}else{var ue=$.has(U.top)?$.get(U.top):U.top,ae=$.has(U.bottom)?$.get(U.bottom):U.bottom;z.has(ue)?z.get(ue).push(ae):z.set(ue,[ae]),z.has(ae)?z.get(ae).push(ue):z.set(ae,[ue])}});var H=function(le,ee){var ue=[],ae=[],oe=new I,Re=new Set,Te=0;return le.forEach(function(Oe,qe){if(!Re.has(qe)){ue[Te]=[],ae[Te]=!1;var Ge=qe;for(oe.push(Ge),Re.add(Ge),ue[Te].push(Ge);oe.length!=0;){Ge=oe.shift(),ee.has(Ge)&&(ae[Te]=!0);var fe=le.get(Ge);fe.forEach(function(Ce){Re.has(Ce)||(oe.push(Ce),Re.add(Ce),ue[Te].push(Ce))})}Te++}}),{components:ue,isFixed:ae}},j=H(G,R.fixedNodesOnHorizontal);this.componentsOnHorizontal=j.components,this.fixedComponentsOnHorizontal=j.isFixed;var J=H(z,R.fixedNodesOnVertical);this.componentsOnVertical=J.components,this.fixedComponentsOnVertical=J.isFixed}}},L.prototype.updateDisplacements=function(){var R=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(J){var U=R.idToNodeMap.get(J.nodeId);U.displacementX=0,U.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var A=this.constraints.alignmentConstraint.vertical,N=0;N1){var $;for($=0;$M&&(M=Math.floor(P.y)),B=Math.floor(P.x+p.DEFAULT_COMPONENT_SEPERATION)}this.transform(new x(y.WORLD_CENTER_X-P.x/2,y.WORLD_CENTER_Y-P.y/2))},L.radialLayout=function(R,A,N){var M=Math.max(this.maxDiagonalInTree(R),p.DEFAULT_RADIAL_SEPARATION);L.branchRadialLayout(A,null,0,359,0,M);var D=S.calculateBounds(R),B=new E;B.setDeviceOrgX(D.getMinX()),B.setDeviceOrgY(D.getMinY()),B.setWorldOrgX(N.x),B.setWorldOrgY(N.y);for(var P=0;P1;){var ue=ee[0];ee.splice(0,1);var ae=H.indexOf(ue);ae>=0&&H.splice(ae,1),U--,j--}A!=null?le=(H.indexOf(ee[0])+1)%U:le=0;for(var oe=Math.abs(M-N)/j,Re=le;J!=j;Re=++Re%U){var Te=H[Re].getOtherEnd(R);if(Te!=A){var Oe=(N+J*oe)%360,qe=(Oe+oe)%360;L.branchRadialLayout(Te,R,Oe,qe,D+B,B),J++}}},L.maxDiagonalInTree=function(R){for(var A=T.MIN_VALUE,N=0;NA&&(A=D)}return A},L.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},L.prototype.groupZeroDegreeMembers=function(){var R=this,A={};this.memberGroups={},this.idToDummyNode={};for(var N=[],M=this.graphManager.getAllNodes(),D=0;D"u"&&(A[$]=[]),A[$]=A[$].concat(B)}Object.keys(A).forEach(function(F){if(A[F].length>1){var q="DummyCompound_"+F;R.memberGroups[q]=A[F];var G=A[F][0].getParent(),z=new f(R.graphManager);z.id=q,z.paddingLeft=G.paddingLeft||0,z.paddingRight=G.paddingRight||0,z.paddingBottom=G.paddingBottom||0,z.paddingTop=G.paddingTop||0,R.idToDummyNode[q]=z;var H=R.getGraphManager().add(R.newGraph(),z),j=G.getChild();j.add(z);for(var J=0;JD?(M.rect.x-=(M.labelWidth-D)/2,M.setWidth(M.labelWidth),M.labelMarginLeft=(M.labelWidth-D)/2):M.labelPosHorizontal=="right"&&M.setWidth(D+M.labelWidth)),M.labelHeight&&(M.labelPosVertical=="top"?(M.rect.y-=M.labelHeight,M.setHeight(B+M.labelHeight),M.labelMarginTop=M.labelHeight):M.labelPosVertical=="center"&&M.labelHeight>B?(M.rect.y-=(M.labelHeight-B)/2,M.setHeight(M.labelHeight),M.labelMarginTop=(M.labelHeight-B)/2):M.labelPosVertical=="bottom"&&M.setHeight(B+M.labelHeight))}})},L.prototype.repopulateCompounds=function(){for(var R=this.compoundOrder.length-1;R>=0;R--){var A=this.compoundOrder[R],N=A.id,M=A.paddingLeft,D=A.paddingTop,B=A.labelMarginLeft,P=A.labelMarginTop;this.adjustLocations(this.tiledMemberPack[N],A.rect.x,A.rect.y,M,D,B,P)}},L.prototype.repopulateZeroDegreeMembers=function(){var R=this,A=this.tiledZeroDegreePack;Object.keys(A).forEach(function(N){var M=R.idToDummyNode[N],D=M.paddingLeft,B=M.paddingTop,P=M.labelMarginLeft,$=M.labelMarginTop;R.adjustLocations(A[N],M.rect.x,M.rect.y,D,B,P,$)})},L.prototype.getToBeTiled=function(R){var A=R.id;if(this.toBeTiled[A]!=null)return this.toBeTiled[A];var N=R.getChild();if(N==null)return this.toBeTiled[A]=!1,!1;for(var M=N.getNodes(),D=0;D0)return this.toBeTiled[A]=!1,!1;if(B.getChild()==null){this.toBeTiled[B.id]=!1;continue}if(!this.getToBeTiled(B))return this.toBeTiled[A]=!1,!1}return this.toBeTiled[A]=!0,!0},L.prototype.getNodeDegree=function(R){for(var A=R.id,N=R.getEdges(),M=0,D=0;DG&&(G=H.rect.height)}N+=G+R.verticalPadding}},L.prototype.tileCompoundMembers=function(R,A){var N=this;this.tiledMemberPack=[],Object.keys(R).forEach(function(M){var D=A[M];if(N.tiledMemberPack[M]=N.tileNodes(R[M],D.paddingLeft+D.paddingRight),D.rect.width=N.tiledMemberPack[M].width,D.rect.height=N.tiledMemberPack[M].height,D.setCenter(N.tiledMemberPack[M].centerX,N.tiledMemberPack[M].centerY),D.labelMarginLeft=0,D.labelMarginTop=0,p.NODE_DIMENSIONS_INCLUDE_LABELS){var B=D.rect.width,P=D.rect.height;D.labelWidth&&(D.labelPosHorizontal=="left"?(D.rect.x-=D.labelWidth,D.setWidth(B+D.labelWidth),D.labelMarginLeft=D.labelWidth):D.labelPosHorizontal=="center"&&D.labelWidth>B?(D.rect.x-=(D.labelWidth-B)/2,D.setWidth(D.labelWidth),D.labelMarginLeft=(D.labelWidth-B)/2):D.labelPosHorizontal=="right"&&D.setWidth(B+D.labelWidth)),D.labelHeight&&(D.labelPosVertical=="top"?(D.rect.y-=D.labelHeight,D.setHeight(P+D.labelHeight),D.labelMarginTop=D.labelHeight):D.labelPosVertical=="center"&&D.labelHeight>P?(D.rect.y-=(D.labelHeight-P)/2,D.setHeight(D.labelHeight),D.labelMarginTop=(D.labelHeight-P)/2):D.labelPosVertical=="bottom"&&D.setHeight(P+D.labelHeight))}})},L.prototype.tileNodes=function(R,A){var N=this.tileNodesByFavoringDim(R,A,!0),M=this.tileNodesByFavoringDim(R,A,!1),D=this.getOrgRatio(N),B=this.getOrgRatio(M),P;return B$&&($=J.getWidth())});var F=B/D,q=P/D,G=Math.pow(N-M,2)+4*(F+M)*(q+N)*D,z=(M-N+Math.sqrt(G))/(2*(F+M)),H;A?(H=Math.ceil(z),H==z&&H++):H=Math.floor(z);var j=H*(F+M)-M;return $>j&&(j=$),j+=M*2,j},L.prototype.tileNodesByFavoringDim=function(R,A,N){var M=p.TILING_PADDING_VERTICAL,D=p.TILING_PADDING_HORIZONTAL,B=p.TILING_COMPARE_BY,P={rows:[],rowWidth:[],rowHeight:[],width:0,height:A,verticalPadding:M,horizontalPadding:D,centerX:0,centerY:0};B&&(P.idealRowWidth=this.calcIdealRowWidth(R,N));var $=function(U){return U.rect.width*U.rect.height},F=function(U,le){return $(le)-$(U)};R.sort(function(J,U){var le=F;return P.idealRowWidth?(le=B,le(J.id,U.id)):le(J,U)});for(var q=0,G=0,z=0;z0&&(P+=R.horizontalPadding),R.rowWidth[N]=P,R.width0&&($+=R.verticalPadding);var F=0;$>R.rowHeight[N]&&(F=R.rowHeight[N],R.rowHeight[N]=$,F=R.rowHeight[N]-F),R.height+=F,R.rows[N].push(A)},L.prototype.getShortestRowIndex=function(R){for(var A=-1,N=Number.MAX_VALUE,M=0;MN&&(A=M,N=R.rowWidth[M]);return A},L.prototype.canAddHorizontal=function(R,A,N){if(R.idealRowWidth){var M=R.rows.length-1,D=R.rowWidth[M];return D+A+R.horizontalPadding<=R.idealRowWidth}var B=this.getShortestRowIndex(R);if(B<0)return!0;var P=R.rowWidth[B];if(P+R.horizontalPadding+A<=R.width)return!0;var $=0;R.rowHeight[B]0&&($=N+R.verticalPadding-R.rowHeight[B]);var F;R.width-P>=A+R.horizontalPadding?F=(R.height+$)/(P+A+R.horizontalPadding):F=(R.height+$)/R.width,$=N+R.verticalPadding;var q;return R.widthB&&A!=N){M.splice(-1,1),R.rows[N].push(D),R.rowWidth[A]=R.rowWidth[A]-B,R.rowWidth[N]=R.rowWidth[N]+B,R.width=R.rowWidth[instance.getLongestRowIndex(R)];for(var P=Number.MIN_VALUE,$=0;$P&&(P=M[$].height);A>0&&(P+=R.verticalPadding);var F=R.rowHeight[A]+R.rowHeight[N];R.rowHeight[A]=P,R.rowHeight[N]0)for(var j=D;j<=B;j++)H[0]+=this.grid[j][P-1].length+this.grid[j][P].length-1;if(B0)for(var j=P;j<=$;j++)H[3]+=this.grid[D-1][j].length+this.grid[D][j].length-1;for(var J=T.MAX_VALUE,U,le,ee=0;ee{var l=o(551).FDLayoutNode,u=o(551).IMath;function h(d,p,m,g){l.call(this,d,p,m,g)}h.prototype=Object.create(l.prototype);for(var f in l)h[f]=l[f];h.prototype.calculateDisplacement=function(){var d=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementX=d.coolingFactor*d.maxNodeDisplacement*u.sign(this.displacementX)),Math.abs(this.displacementY)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementY=d.coolingFactor*d.maxNodeDisplacement*u.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},h.prototype.propogateDisplacementToChildren=function(d,p){for(var m=this.getChild().getNodes(),g,y=0;y{function l(m){if(Array.isArray(m)){for(var g=0,y=Array(m.length);g0){var Et=0;Se.forEach(function(mt){pe=="horizontal"?(ze.set(mt,v.has(mt)?x[v.get(mt)]:ve.get(mt)),Et+=ze.get(mt)):(ze.set(mt,v.has(mt)?w[v.get(mt)]:ve.get(mt)),Et+=ze.get(mt))}),Et=Et/Se.length,rt.forEach(function(mt){K.has(mt)||ze.set(mt,Et)})}else{var De=0;rt.forEach(function(mt){pe=="horizontal"?De+=v.has(mt)?x[v.get(mt)]:ve.get(mt):De+=v.has(mt)?w[v.get(mt)]:ve.get(mt)}),De=De/rt.length,rt.forEach(function(mt){ze.set(mt,De)})}});for(var Ve=function(){var Se=Ke.shift(),Et=V.get(Se);Et.forEach(function(De){if(ze.get(De.id)mt&&(mt=xt),itTt&&(Tt=it)}}catch(Dr){_t=!0,Rt=Dr}finally{try{!jt&&bt.return&&bt.return()}finally{if(_t)throw Rt}}var Me=(Et+mt)/2-(De+Tt)/2,ut=!0,at=!1,dt=void 0;try{for(var tr=rt[Symbol.iterator](),Vt;!(ut=(Vt=tr.next()).done);ut=!0){var rr=Vt.value;ze.set(rr,ze.get(rr)+Me)}}catch(Dr){at=!0,dt=Dr}finally{try{!ut&&tr.return&&tr.return()}finally{if(at)throw dt}}})}return ze},O=function(V){var pe=0,K=0,ve=0,Z=0;if(V.forEach(function(Fe){Fe.left?x[v.get(Fe.left)]-x[v.get(Fe.right)]>=0?pe++:K++:w[v.get(Fe.top)]-w[v.get(Fe.bottom)]>=0?ve++:Z++}),pe>K&&ve>Z)for(var je=0;jeK)for(var Ne=0;NeZ)for(var ze=0;ze1)g.fixedNodeConstraint.forEach(function(ne,V){M[V]=[ne.position.x,ne.position.y],D[V]=[x[v.get(ne.nodeId)],w[v.get(ne.nodeId)]]}),B=!0;else if(g.alignmentConstraint)(function(){var ne=0;if(g.alignmentConstraint.vertical){for(var V=g.alignmentConstraint.vertical,pe=function(ze){var Fe=new Set;V[ze].forEach(function(tt){Fe.add(tt)});var Ke=new Set([].concat(l(Fe)).filter(function(tt){return $.has(tt)})),Ve=void 0;Ke.size>0?Ve=x[v.get(Ke.values().next().value)]:Ve=I(Fe).x,V[ze].forEach(function(tt){M[ne]=[Ve,w[v.get(tt)]],D[ne]=[x[v.get(tt)],w[v.get(tt)]],ne++})},K=0;K0?Ve=x[v.get(Ke.values().next().value)]:Ve=I(Fe).y,ve[ze].forEach(function(tt){M[ne]=[x[v.get(tt)],Ve],D[ne]=[x[v.get(tt)],w[v.get(tt)]],ne++})},je=0;jez&&(z=G[j].length,H=j);if(z0){var de={x:0,y:0};g.fixedNodeConstraint.forEach(function(ne,V){var pe={x:x[v.get(ne.nodeId)],y:w[v.get(ne.nodeId)]},K=ne.position,ve=E(K,pe);de.x+=ve.x,de.y+=ve.y}),de.x/=g.fixedNodeConstraint.length,de.y/=g.fixedNodeConstraint.length,x.forEach(function(ne,V){x[V]+=de.x}),w.forEach(function(ne,V){w[V]+=de.y}),g.fixedNodeConstraint.forEach(function(ne){x[v.get(ne.nodeId)]=ne.position.x,w[v.get(ne.nodeId)]=ne.position.y})}if(g.alignmentConstraint){if(g.alignmentConstraint.vertical)for(var ie=g.alignmentConstraint.vertical,Q=function(V){var pe=new Set;ie[V].forEach(function(Z){pe.add(Z)});var K=new Set([].concat(l(pe)).filter(function(Z){return $.has(Z)})),ve=void 0;K.size>0?ve=x[v.get(K.values().next().value)]:ve=I(pe).x,pe.forEach(function(Z){$.has(Z)||(x[v.get(Z)]=ve)})},he=0;he0?ve=w[v.get(K.values().next().value)]:ve=I(pe).y,pe.forEach(function(Z){$.has(Z)||(w[v.get(Z)]=ve)})},ge=0;ge{a.exports=e})},r={};function n(a){var s=r[a];if(s!==void 0)return s.exports;var o=r[a]={exports:{}};return t[a](o,o.exports,n),o.exports}var i=n(45);return i})()})});var get=Jo((j6,vse)=>{(function(t,r){typeof j6=="object"&&typeof vse=="object"?vse.exports=r(yse()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof j6=="object"?j6.cytoscapeFcose=r(yse()):t.cytoscapeFcose=r(t.coseBase)})(j6,function(e){return(()=>{"use strict";var t={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(s){for(var o=arguments.length,l=Array(o>1?o-1:0),u=1;u{var l=(function(){function f(d,p){var m=[],g=!0,y=!1,v=void 0;try{for(var x=d[Symbol.iterator](),w;!(g=(w=x.next()).done)&&(m.push(w.value),!(p&&m.length===p));g=!0);}catch(C){y=!0,v=C}finally{try{!g&&x.return&&x.return()}finally{if(y)throw v}}return m}return function(d,p){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return f(d,p);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),u=o(140).layoutBase.LinkedList,h={};h.getTopMostNodes=function(f){for(var d={},p=0;p0&&B.merge(q)});for(var P=0;P1){w=v[0],C=w.connectedEdges().length,v.forEach(function(D){D.connectedEdges().length0&&m.set("dummy"+(m.size+1),S),E},h.relocateComponent=function(f,d,p){if(!p.fixedNodeConstraint){var m=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,y=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;if(p.quality=="draft"){var x=!0,w=!1,C=void 0;try{for(var T=d.nodeIndexes[Symbol.iterator](),k;!(x=(k=T.next()).done);x=!0){var S=k.value,E=l(S,2),I=E[0],L=E[1],O=p.cy.getElementById(I);if(O){var R=O.boundingBox(),A=d.xCoords[L]-R.w/2,N=d.xCoords[L]+R.w/2,M=d.yCoords[L]-R.h/2,D=d.yCoords[L]+R.h/2;Ag&&(g=N),Mv&&(v=D)}}}catch(q){w=!0,C=q}finally{try{!x&&T.return&&T.return()}finally{if(w)throw C}}var B=f.x-(g+m)/2,P=f.y-(v+y)/2;d.xCoords=d.xCoords.map(function(q){return q+B}),d.yCoords=d.yCoords.map(function(q){return q+P})}else{Object.keys(d).forEach(function(q){var G=d[q],z=G.getRect().x,H=G.getRect().x+G.getRect().width,j=G.getRect().y,J=G.getRect().y+G.getRect().height;zg&&(g=H),jv&&(v=J)});var $=f.x-(g+m)/2,F=f.y-(v+y)/2;Object.keys(d).forEach(function(q){var G=d[q];G.setCenter(G.getCenterX()+$,G.getCenterY()+F)})}}},h.calcBoundingBox=function(f,d,p,m){for(var g=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER,v=Number.MAX_SAFE_INTEGER,x=Number.MIN_SAFE_INTEGER,w=void 0,C=void 0,T=void 0,k=void 0,S=f.descendants().not(":parent"),E=S.length,I=0;Iw&&(g=w),yT&&(v=T),x{var l=o(548),u=o(140).CoSELayout,h=o(140).CoSENode,f=o(140).layoutBase.PointD,d=o(140).layoutBase.DimensionD,p=o(140).layoutBase.LayoutConstants,m=o(140).layoutBase.FDLayoutConstants,g=o(140).CoSEConstants,y=function(x,w){var C=x.cy,T=x.eles,k=T.nodes(),S=T.edges(),E=void 0,I=void 0,L=void 0,O={};x.randomize&&(E=w.nodeIndexes,I=w.xCoords,L=w.yCoords);var R=function(q){return typeof q=="function"},A=function(q,G){return R(q)?q(G):q},N=l.calcParentsWithoutChildren(C,T),M=function F(q,G,z,H){for(var j=G.length,J=0;J0){var oe=void 0;oe=z.getGraphManager().add(z.newGraph(),ee),F(oe,le,z,H)}}},D=function(q,G,z){for(var H=0,j=0,J=0;J0?g.DEFAULT_EDGE_LENGTH=m.DEFAULT_EDGE_LENGTH=H/j:R(x.idealEdgeLength)?g.DEFAULT_EDGE_LENGTH=m.DEFAULT_EDGE_LENGTH=50:g.DEFAULT_EDGE_LENGTH=m.DEFAULT_EDGE_LENGTH=x.idealEdgeLength,g.MIN_REPULSION_DIST=m.MIN_REPULSION_DIST=m.DEFAULT_EDGE_LENGTH/10,g.DEFAULT_RADIAL_SEPARATION=m.DEFAULT_EDGE_LENGTH)},B=function(q,G){G.fixedNodeConstraint&&(q.constraints.fixedNodeConstraint=G.fixedNodeConstraint),G.alignmentConstraint&&(q.constraints.alignmentConstraint=G.alignmentConstraint),G.relativePlacementConstraint&&(q.constraints.relativePlacementConstraint=G.relativePlacementConstraint)};x.nestingFactor!=null&&(g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=x.nestingFactor),x.gravity!=null&&(g.DEFAULT_GRAVITY_STRENGTH=m.DEFAULT_GRAVITY_STRENGTH=x.gravity),x.numIter!=null&&(g.MAX_ITERATIONS=m.MAX_ITERATIONS=x.numIter),x.gravityRange!=null&&(g.DEFAULT_GRAVITY_RANGE_FACTOR=m.DEFAULT_GRAVITY_RANGE_FACTOR=x.gravityRange),x.gravityCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=x.gravityCompound),x.gravityRangeCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=x.gravityRangeCompound),x.initialEnergyOnIncremental!=null&&(g.DEFAULT_COOLING_FACTOR_INCREMENTAL=m.DEFAULT_COOLING_FACTOR_INCREMENTAL=x.initialEnergyOnIncremental),x.tilingCompareBy!=null&&(g.TILING_COMPARE_BY=x.tilingCompareBy),x.quality=="proof"?p.QUALITY=2:p.QUALITY=0,g.NODE_DIMENSIONS_INCLUDE_LABELS=m.NODE_DIMENSIONS_INCLUDE_LABELS=p.NODE_DIMENSIONS_INCLUDE_LABELS=x.nodeDimensionsIncludeLabels,g.DEFAULT_INCREMENTAL=m.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!x.randomize,g.ANIMATE=m.ANIMATE=p.ANIMATE=x.animate,g.TILE=x.tile,g.TILING_PADDING_VERTICAL=typeof x.tilingPaddingVertical=="function"?x.tilingPaddingVertical.call():x.tilingPaddingVertical,g.TILING_PADDING_HORIZONTAL=typeof x.tilingPaddingHorizontal=="function"?x.tilingPaddingHorizontal.call():x.tilingPaddingHorizontal,g.DEFAULT_INCREMENTAL=m.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!0,g.PURE_INCREMENTAL=!x.randomize,p.DEFAULT_UNIFORM_LEAF_NODE_SIZES=x.uniformNodeDimensions,x.step=="transformed"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!1),x.step=="enforced"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!1),x.step=="cose"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!0),x.step=="all"&&(x.randomize?g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!0),x.fixedNodeConstraint||x.alignmentConstraint||x.relativePlacementConstraint?g.TREE_REDUCTION_ON_INCREMENTAL=!1:g.TREE_REDUCTION_ON_INCREMENTAL=!0;var P=new u,$=P.newGraphManager();return M($.addRoot(),l.getTopMostNodes(k),P,x),D(P,$,S),B(P,x),P.runLayout(),O};a.exports={coseLayout:y}}),212:((a,s,o)=>{var l=(function(){function x(w,C){for(var T=0;T0)if(D){var $=f.getTopMostNodes(T.eles.nodes());if(R=f.connectComponents(k,T.eles,$),R.forEach(function(Ge){var fe=Ge.boundingBox();A.push({x:fe.x1+fe.w/2,y:fe.y1+fe.h/2})}),T.randomize&&R.forEach(function(Ge){T.eles=Ge,E.push(p(T))}),T.quality=="default"||T.quality=="proof"){var F=k.collection();if(T.tile){var q=new Map,G=[],z=[],H=0,j={nodeIndexes:q,xCoords:G,yCoords:z},J=[];if(R.forEach(function(Ge,fe){Ge.edges().length==0&&(Ge.nodes().forEach(function(Ce,_e){F.merge(Ge.nodes()[_e]),Ce.isParent()||(j.nodeIndexes.set(Ge.nodes()[_e].id(),H++),j.xCoords.push(Ge.nodes()[0].position().x),j.yCoords.push(Ge.nodes()[0].position().y))}),J.push(fe))}),F.length>1){var U=F.boundingBox();A.push({x:U.x1+U.w/2,y:U.y1+U.h/2}),R.push(F),E.push(j);for(var le=J.length-1;le>=0;le--)R.splice(J[le],1),E.splice(J[le],1),A.splice(J[le],1)}}R.forEach(function(Ge,fe){T.eles=Ge,O.push(g(T,E[fe])),f.relocateComponent(A[fe],O[fe],T)})}else R.forEach(function(Ge,fe){f.relocateComponent(A[fe],E[fe],T)});var ee=new Set;if(R.length>1){var ue=[],ae=S.filter(function(Ge){return Ge.css("display")=="none"});R.forEach(function(Ge,fe){var Ce=void 0;if(T.quality=="draft"&&(Ce=E[fe].nodeIndexes),Ge.nodes().not(ae).length>0){var _e={};_e.edges=[],_e.nodes=[];var de=void 0;Ge.nodes().not(ae).forEach(function(ie){if(T.quality=="draft")if(!ie.isParent())de=Ce.get(ie.id()),_e.nodes.push({x:E[fe].xCoords[de]-ie.boundingbox().w/2,y:E[fe].yCoords[de]-ie.boundingbox().h/2,width:ie.boundingbox().w,height:ie.boundingbox().h});else{var Q=f.calcBoundingBox(ie,E[fe].xCoords,E[fe].yCoords,Ce);_e.nodes.push({x:Q.topLeftX,y:Q.topLeftY,width:Q.width,height:Q.height})}else O[fe][ie.id()]&&_e.nodes.push({x:O[fe][ie.id()].getLeft(),y:O[fe][ie.id()].getTop(),width:O[fe][ie.id()].getWidth(),height:O[fe][ie.id()].getHeight()})}),Ge.edges().forEach(function(ie){var Q=ie.source(),he=ie.target();if(Q.css("display")!="none"&&he.css("display")!="none")if(T.quality=="draft"){var xe=Ce.get(Q.id()),ce=Ce.get(he.id()),ge=[],Ie=[];if(Q.isParent()){var ye=f.calcBoundingBox(Q,E[fe].xCoords,E[fe].yCoords,Ce);ge.push(ye.topLeftX+ye.width/2),ge.push(ye.topLeftY+ye.height/2)}else ge.push(E[fe].xCoords[xe]),ge.push(E[fe].yCoords[xe]);if(he.isParent()){var ne=f.calcBoundingBox(he,E[fe].xCoords,E[fe].yCoords,Ce);Ie.push(ne.topLeftX+ne.width/2),Ie.push(ne.topLeftY+ne.height/2)}else Ie.push(E[fe].xCoords[ce]),Ie.push(E[fe].yCoords[ce]);_e.edges.push({startX:ge[0],startY:ge[1],endX:Ie[0],endY:Ie[1]})}else O[fe][Q.id()]&&O[fe][he.id()]&&_e.edges.push({startX:O[fe][Q.id()].getCenterX(),startY:O[fe][Q.id()].getCenterY(),endX:O[fe][he.id()].getCenterX(),endY:O[fe][he.id()].getCenterY()})}),_e.nodes.length>0&&(ue.push(_e),ee.add(fe))}});var oe=M.packComponents(ue,T.randomize).shifts;if(T.quality=="draft")E.forEach(function(Ge,fe){var Ce=Ge.xCoords.map(function(de){return de+oe[fe].dx}),_e=Ge.yCoords.map(function(de){return de+oe[fe].dy});Ge.xCoords=Ce,Ge.yCoords=_e});else{var Re=0;ee.forEach(function(Ge){Object.keys(O[Ge]).forEach(function(fe){var Ce=O[Ge][fe];Ce.setCenter(Ce.getCenterX()+oe[Re].dx,Ce.getCenterY()+oe[Re].dy)}),Re++})}}}else{var B=T.eles.boundingBox();if(A.push({x:B.x1+B.w/2,y:B.y1+B.h/2}),T.randomize){var P=p(T);E.push(P)}T.quality=="default"||T.quality=="proof"?(O.push(g(T,E[0])),f.relocateComponent(A[0],O[0],T)):f.relocateComponent(A[0],E[0],T)}var Te=function(fe,Ce){if(T.quality=="default"||T.quality=="proof"){typeof fe=="number"&&(fe=Ce);var _e=void 0,de=void 0,ie=fe.data("id");return O.forEach(function(he){ie in he&&(_e={x:he[ie].getRect().getCenterX(),y:he[ie].getRect().getCenterY()},de=he[ie])}),T.nodeDimensionsIncludeLabels&&(de.labelWidth&&(de.labelPosHorizontal=="left"?_e.x+=de.labelWidth/2:de.labelPosHorizontal=="right"&&(_e.x-=de.labelWidth/2)),de.labelHeight&&(de.labelPosVertical=="top"?_e.y+=de.labelHeight/2:de.labelPosVertical=="bottom"&&(_e.y-=de.labelHeight/2))),_e==null&&(_e={x:fe.position("x"),y:fe.position("y")}),{x:_e.x,y:_e.y}}else{var Q=void 0;return E.forEach(function(he){var xe=he.nodeIndexes.get(fe.id());xe!=null&&(Q={x:he.xCoords[xe],y:he.yCoords[xe]})}),Q==null&&(Q={x:fe.position("x"),y:fe.position("y")}),{x:Q.x,y:Q.y}}};if(T.quality=="default"||T.quality=="proof"||T.randomize){var Oe=f.calcParentsWithoutChildren(k,S),qe=S.filter(function(Ge){return Ge.css("display")=="none"});T.eles=S.not(qe),S.nodes().not(":parent").not(qe).layoutPositions(C,T,Te),Oe.length>0&&Oe.forEach(function(Ge){Ge.position(Te(Ge))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),x})();a.exports=v}),657:((a,s,o)=>{var l=o(548),u=o(140).layoutBase.Matrix,h=o(140).layoutBase.SVD,f=function(p){var m=p.cy,g=p.eles,y=g.nodes(),v=g.nodes(":parent"),x=new Map,w=new Map,C=new Map,T=[],k=[],S=[],E=[],I=[],L=[],O=[],R=[],A=void 0,N=void 0,M=1e8,D=1e-9,B=p.piTol,P=p.samplingType,$=p.nodeSeparation,F=void 0,q=function(){for(var pe=0,K=0,ve=!1;K=je;){ze=Z[je++];for(var rt=T[ze],Se=0;SeVe&&(Ve=I[De],tt=De)}return tt},z=function(pe){var K=void 0;if(pe){K=Math.floor(Math.random()*N),A=K;for(var Z=0;Z=1)break;Ve=Ke}for(var rt=0;rt=1)break;Ve=Ke}for(var Et=0;Et0&&(K.isParent()?T[pe].push(C.get(K.id())):T[pe].push(K.id()))})});var Oe=function(pe){var K=w.get(pe),ve=void 0;x.get(pe).forEach(function(Z){m.getElementById(Z).isParent()?ve=C.get(Z):ve=Z,T[K].push(ve),T[w.get(ve)].push(pe)})},qe=!0,Ge=!1,fe=void 0;try{for(var Ce=x.keys()[Symbol.iterator](),_e;!(qe=(_e=Ce.next()).done);qe=!0){var de=_e.value;Oe(de)}}catch(V){Ge=!0,fe=V}finally{try{!qe&&Ce.return&&Ce.return()}finally{if(Ge)throw fe}}N=w.size;var ie=void 0;if(N>2){F=N{var l=o(212),u=function(f){f&&f("layout","fcose",l)};typeof cytoscape<"u"&&u(cytoscape),a.exports=u}),140:(a=>{a.exports=e})},r={};function n(a){var s=r[a];if(s!==void 0)return s.exports;var o=r[a]={exports:{}};return t[a](o,o.exports,n),o.exports}var i=n(579);return i})()})});var Net={};Tr(Net,{diagram:()=>Dnr});function bse(e,t){if(e===0)return t();let r=Math.random,n=e>>>0;Math.random=function(){n=n+1831565813>>>0;let i=n;return i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61),((i^i>>>14)>>>0)/4294967296};try{return t()}finally{Math.random=r}}function Cet(e,t,r){e.forEach(n=>{t.add({group:"nodes",data:{type:"service",id:n.id,icon:n.icon,label:n.title,parent:n.in,width:r.getConfigField("iconSize"),height:r.getConfigField("iconSize")},classes:"node-service"})})}function Eet(e,t,r){e.forEach(n=>{t.add({group:"nodes",data:{type:"junction",id:n.id,parent:n.in,width:r.getConfigField("iconSize"),height:r.getConfigField("iconSize")},classes:"node-junction"})})}function Aet(e,t){t.nodes().map(r=>{let n=wk(r);if(n.type==="group")return;n.x=r.position().x,n.y=r.position().y,e.getElementById(n.id).attr("transform","translate("+(n.x||0)+","+(n.y||0)+")")})}function _et(e,t){e.forEach(r=>{t.add({group:"nodes",data:{type:"group",id:r.id,icon:r.icon,label:r.title,parent:r.in},classes:"node-group"})})}function Ret(e,t){e.forEach(r=>{let{lhsId:n,rhsId:i,lhsInto:a,lhsGroup:s,rhsInto:o,lhsDir:l,rhsDir:u,rhsGroup:h,title:f}=r,d=wse(r.lhsDir,r.rhsDir)?"segments":"straight",p={id:`${n}-${i}`,label:f,source:n,sourceDir:l,sourceArrow:a,sourceGroup:s,sourceEndpoint:l==="L"?"0 50%":l==="R"?"100% 50%":l==="T"?"50% 0":"50% 100%",target:i,targetDir:u,targetArrow:o,targetGroup:h,targetEndpoint:u==="L"?"0 50%":u==="R"?"100% 50%":u==="T"?"50% 0":"50% 100%"};t.add({group:"edges",data:p,classes:d})})}function Let(e,t,r,n=[]){let i=b((d,p)=>Object.entries(d).reduce((m,[g,y])=>{let v=0,x=Object.entries(y);if(x.length===1)return m[g]=x[0][1],m;for(let w=0;w{let p={},m={};return Object.entries(d).forEach(([g,[y,v]])=>{let x=e.getNode(g)?.in??"default";p[v]??={},p[v][x]??=[],p[v][x].push(g),m[y]??={},m[y][x]??=[],m[y][x].push(g)}),{horiz:Object.values(i(p,"horizontal")).filter(g=>g.length>1),vert:Object.values(i(m,"vertical")).filter(g=>g.length>1)}}),[s,o]=a.reduce(([d,p],{horiz:m,vert:g})=>[[...d,...m],[...p,...g]],[[],[]]),l=new Set;n.forEach(d=>d.members.forEach(p=>l.add(p)));let u=b(d=>d.filter(p=>!p.some(m=>l.has(m))),"dropOverlapping"),h=u(s),f=u(o);return n.forEach(d=>{d.members.length<2||(d.direction==="row"?h.push([...d.members]):f.push([...d.members]))}),{horizontal:h,vertical:f}}function Iet(e,t,r=[]){let n=[],i=t.getConfigField("iconSize"),a=t.getConfigField("idealEdgeLengthMultiplier"),s=a*i,o=new Set;r.forEach(h=>{for(let f=0;f`${h[0]},${h[1]}`,"posToStr"),u=b(h=>h.split(",").map(f=>parseInt(f)),"strToPos");return e.forEach(h=>{let f=Object.fromEntries(Object.entries(h).map(([g,y])=>[l(y),g])),d=[l([0,0])],p={},m={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;d.length>0;){let g=d.shift();if(g){p[g]=1;let y=f[g];if(y){let v=u(g);Object.entries(m).forEach(([x,w])=>{let C=l([v[0]+w[0],v[1]+w[1]]),T=f[C];if(T&&!p[C]){if(d.push(C),o.has(`${y}|${T}`))return;n.push({[yet[x]]:T,[yet[gnr(x)]]:y,gap:a*i})}})}}}}),n}function Met(e,t,r,n,i,{spatialMaps:a,groupAlignments:s}){return new Promise(o=>{let l=ct("body").append("div").attr("id","cy").attr("style","display:none"),u=Du({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${i.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${i.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});l.remove(),_et(r,u),Cet(e,u,i),Eet(t,u,i),Ret(n,u);let h=i.getLayoutHints(),f=Let(i,a,s,h),d=Iet(a,i,h),p=i.getConfigField("iconSize"),m=i.getConfigField("idealEdgeLengthMultiplier")*p,g=.5*p,y=i.getConfigField("edgeElasticity"),v=i.getConfigField("seed"),x=u.layout({name:"fcose",quality:"proof",randomize:i.getConfigField("randomize"),nodeSeparation:i.getConfigField("nodeSeparation"),numIter:i.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(w){let[C,T]=w.connectedNodes(),{parent:k}=wk(C),{parent:S}=wk(T);return k===S?m:g},edgeElasticity(w){let[C,T]=w.connectedNodes(),{parent:k}=wk(C),{parent:S}=wk(T);return k===S?y:.001},alignmentConstraint:f,relativePlacementConstraint:d});x.one("layoutstop",()=>{function w(C,T,k,S){let E,I,{x:L,y:O}=C,{x:R,y:A}=T;I=(S-O+(L-k)*(O-A)/(L-R))/Math.sqrt(1+Math.pow((O-A)/(L-R),2)),E=Math.sqrt(Math.pow(S-O,2)+Math.pow(k-L,2)-Math.pow(I,2));let N=Math.sqrt(Math.pow(R-L,2)+Math.pow(A-O,2));E=E/N;let M=(R-L)*(S-O)-(A-O)*(k-L);switch(!0){case M>=0:M=1;break;case M<0:M=-1;break}let D=(R-L)*(k-L)+(A-O)*(S-O);switch(!0){case D>=0:D=1;break;case D<0:D=-1;break}return I=Math.abs(I)*M,E=E*D,{distances:I,weights:E}}b(w,"getSegmentWeights"),u.startBatch();for(let C of Object.values(u.edges()))if(C.data?.()){let{x:T,y:k}=C.source().position(),{x:S,y:E}=C.target().position();if(T!==S&&k!==E){let I=C.sourceEndpoint(),L=C.targetEndpoint(),{sourceDir:O}=bet(C),[R,A]=r1(O)?[I.x,L.y]:[L.x,I.y],{weights:N,distances:M}=w(I,L,R,A);C.style("segment-distances",M),C.style("segment-weights",N)}}u.endBatch(),bse(v,()=>x.run())});try{bse(v,()=>x.run())}catch(w){throw w instanceof RangeError&&w.message.includes("Invalid array length")?new Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis."):w}u.ready(w=>{se.info("Ready",w),o(u)})})}var Tet,yet,vet,YO,gnr,xet,Fl,r1,wse,ynr,vnr,xse,xnr,bnr,wnr,knr,Tnr,bet,wk,Cnr,wet,Snr,ket,Enr,Anr,bk,K6,_nr,Rnr,Lnr,Inr,Mnr,Nnr,Dnr,Det=W(()=>{El();za();bs();ts();Sn();_r();Rr();hr();Co();MZ();Tet=Ro(get(),1);fn();yet={L:"left",R:"right",T:"top",B:"bottom"},vet={L:b(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:b(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:b(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:b(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},YO={L:b((e,t)=>e-t+2,"L"),R:b((e,t)=>e-2,"R"),T:b((e,t)=>e-t+2,"T"),B:b((e,t)=>e-2,"B")},gnr=b(function(e){return Fl(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),xet=b(function(e){let t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),Fl=b(function(e){let t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),r1=b(function(e){let t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),wse=b(function(e,t){let r=Fl(e)&&r1(t),n=r1(e)&&Fl(t);return r||n},"isArchitectureDirectionXY"),ynr=b(function(e){let t=e[0],r=e[1],n=Fl(t)&&r1(r),i=r1(t)&&Fl(r);return n||i},"isArchitecturePairXY"),vnr=b(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),xse=b(function(e,t){let r=`${e}${t}`;return vnr(r)?r:void 0},"getArchitectureDirectionPair"),xnr=b(function([e,t],r){let n=r[0],i=r[1];return Fl(n)?r1(i)?[e+(n==="L"?-1:1),t+(i==="T"?1:-1)]:[e+(n==="L"?-1:1),t]:Fl(i)?[e+(i==="L"?1:-1),t+(n==="T"?1:-1)]:[e,t+(n==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),bnr=b(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),wnr=b(function(e,t){return wse(e,t)?"bend":Fl(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),knr=b(function(e){return e.type==="service"},"isArchitectureService"),Tnr=b(function(e){return e.type==="junction"},"isArchitectureJunction"),bet=b(e=>e.data(),"edgeData"),wk=b(e=>e.data(),"nodeData"),Cnr=Lr.architecture,wet=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Yr,this.getAccTitle=Qr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getAccDescription=en,this.setAccDescription=Jr,this.clear()}static{b(this,"ArchitectureDB")}setDiagramId(e){this.diagramId=e}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",Nr()}addService({id:e,icon:t,in:r,title:n,iconText:i}){if(this.registeredIds[e]!==void 0)throw new Error(`The service id [${e}] is already in use by another ${this.registeredIds[e]}`);if(r!==void 0){if(e===r)throw new Error(`The service [${e}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The service [${e}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[r]==="node")throw new Error(`The service [${e}]'s parent is not a group`)}this.registeredIds[e]="node",this.nodes[e]={id:e,type:"service",icon:t,iconText:i,title:n,edges:[],in:r}}getServices(){return Object.values(this.nodes).filter(knr)}addJunction({id:e,in:t}){if(this.registeredIds[e]!==void 0)throw new Error(`The junction id [${e}] is already in use by another ${this.registeredIds[e]}`);if(t!==void 0){if(e===t)throw new Error(`The junction [${e}] cannot be placed within itself`);if(this.registeredIds[t]===void 0)throw new Error(`The junction [${e}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[t]==="node")throw new Error(`The junction [${e}]'s parent is not a group`)}this.registeredIds[e]="node",this.nodes[e]={id:e,type:"junction",edges:[],in:t}}getJunctions(){return Object.values(this.nodes).filter(Tnr)}getNodes(){return Object.values(this.nodes)}getNode(e){return this.nodes[e]??null}addGroup({id:e,icon:t,in:r,title:n}){if(this.registeredIds?.[e]!==void 0)throw new Error(`The group id [${e}] is already in use by another ${this.registeredIds[e]}`);if(r!==void 0){if(e===r)throw new Error(`The group [${e}] cannot be placed within itself`);if(this.registeredIds?.[r]===void 0)throw new Error(`The group [${e}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[r]==="node")throw new Error(`The group [${e}]'s parent is not a group`)}this.registeredIds[e]="group",this.groups[e]={id:e,icon:t,title:n,in:r}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:e,rhsId:t,lhsDir:r,rhsDir:n,lhsInto:i,rhsInto:a,lhsGroup:s,rhsGroup:o,title:l}){if(!xet(r))throw new Error(`Invalid direction given for left hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${String(r)}`);if(!xet(n))throw new Error(`Invalid direction given for right hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${String(n)}`);if(this.nodes[e]===void 0&&this.groups[e]===void 0)throw new Error(`The left-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The right-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);let u=this.nodes[e].in,h=this.nodes[t].in;if(s&&u&&h&&u==h)throw new Error(`The left-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(o&&u&&h&&u==h)throw new Error(`The right-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let f={lhsId:e,lhsDir:r,lhsInto:i,lhsGroup:s,rhsId:t,rhsDir:n,rhsInto:a,rhsGroup:o,title:l};this.edges.push(f),this.nodes[e]&&this.nodes[t]&&(this.nodes[e].edges.push(this.edges[this.edges.length-1]),this.nodes[t].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(e){if(e.members.length<2)throw new Error(`An align directive requires at least two members; got ${e.members.length}`);let t=new Set;e.members.forEach(r=>{if(this.registeredIds[r]!=="node")throw new Error(`align ${e.direction} references [${r}], which is not a service or junction`);if(t.has(r))throw new Error(`align ${e.direction} lists [${r}] more than once`);t.add(r)}),this.layoutHints.push(e)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){let e={},t=Object.entries(this.nodes).reduce((o,[l,u])=>(o[l]=u.edges.reduce((h,f)=>{let d=this.getNode(f.lhsId)?.in,p=this.getNode(f.rhsId)?.in;if(d&&p&&d!==p){let m=wnr(f.lhsDir,f.rhsDir);m!=="bend"&&(e[d]??={},e[d][p]=m,e[p]??={},e[p][d]=m)}if(f.lhsId===l){let m=xse(f.lhsDir,f.rhsDir);m&&(h[m]=f.rhsId)}else{let m=xse(f.rhsDir,f.lhsDir);m&&(h[m]=f.lhsId)}return h},{}),o),{}),r=Object.keys(t)[0],n={[r]:1},i=Object.keys(t).reduce((o,l)=>l===r?o:{...o,[l]:1},{}),a=b(o=>{let l={[o]:[0,0]},u=[o];for(;u.length>0;){let h=u.shift();if(h){n[h]=1,delete i[h];let f=t[h],[d,p]=l[h];Object.entries(f).forEach(([m,g])=>{n[g]||(l[g]=xnr([d,p],m),u.push(g))})}}return l},"BFS"),s=[a(r)];for(;Object.keys(i).length>0;)s.push(a(Object.keys(i)[0]));this.dataStructures={adjList:t,spatialMaps:s,groupAlignments:e}}return this.dataStructures}setElementForId(e,t){this.elements[e]=t}getElementById(e){return this.elements[e]}getConfig(){return Rn({...Cnr,...qt().architecture})}getConfigField(e){return this.getConfig()[e]}},Snr=b((e,t)=>{wi(e,t),e.groups.map(r=>t.addGroup(r)),e.services.map(r=>t.addService({...r,type:"service"})),e.junctions.map(r=>t.addJunction({...r,type:"junction"})),e.edges.map(r=>t.addEdge(r)),e.alignments?.map(r=>t.addLayoutHint({direction:r.direction,members:[...r.members]}))},"populateDb"),ket={parser:{yy:void 0},parse:b(async e=>{let t=await ba("architecture",e);se.debug(t);let r=ket.parser?.yy;if(!(r instanceof wet))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Snr(t,r)},"parse")},Enr=b(e=>` .edge { stroke-width: ${e.archEdgeWidth}; stroke: ${e.archEdgeColor}; @@ -3167,19 +3167,19 @@ Expecting `+Oe.join(", ")+", got '"+(this.terminals_[j]||j)+"'":qe="Parse error display: -webkit-box; -webkit-box-orient: vertical; } -`,"getStyles"),Tnr=knr;b(vse,"withSeededRandom");bk=b(e=>`${e}`,"wrapIcon"),K6={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:bk('')},server:{body:bk('')},disk:{body:bk('')},internet:{body:bk('')},cloud:{body:bk('')},unknown:FU,blank:{body:bk("")}}},Cnr=b(async function(e,t,r,n){let i=r.getConfigField("padding"),a=r.getConfigField("iconSize"),s=a/2,o=a/6,l=o/2;await Promise.all(t.edges().map(async u=>{let{source:h,sourceDir:f,sourceArrow:d,sourceGroup:p,target:m,targetDir:g,targetArrow:y,targetGroup:v,label:x}=vet(u),{x:w,y:C}=u[0].sourceEndpoint(),{x:T,y:k}=u[0].midpoint(),{x:S,y:E}=u[0].targetEndpoint(),I=i+4;if(p&&(Bl(f)?w+=f==="L"?-I:I:C+=f==="T"?-I:I+18),v&&(Bl(g)?S+=g==="L"?-I:I:E+=g==="T"?-I:I+18),!p&&r.getNode(h)?.type==="junction"&&(Bl(f)?w+=f==="L"?s:-s:C+=f==="T"?s:-s),!v&&r.getNode(m)?.type==="junction"&&(Bl(g)?S+=g==="L"?s:-s:E+=g==="T"?s:-s),u[0]._private.rscratch){let L=e.insert("g");if(L.insert("path").attr("d",`M ${w},${C} L ${T},${k} L${S},${E} `).attr("class","edge").attr("id",`${n}-${zf(h,m,{prefix:"L"})}`),d){let O=Bl(f)?YO[f](w,o):w-l,R=r1(f)?YO[f](C,o):C-l;L.insert("polygon").attr("points",get[f](o)).attr("transform",`translate(${O},${R})`).attr("class","arrow")}if(y){let O=Bl(g)?YO[g](S,o):S-l,R=r1(g)?YO[g](E,o):E-l;L.insert("polygon").attr("points",get[g](o)).attr("transform",`translate(${O},${R})`).attr("class","arrow")}if(x){let O=xse(f,g)?"XY":Bl(f)?"X":"Y",R=0;O==="X"?R=Math.abs(w-S):O==="Y"?R=Math.abs(C-E)/1.5:R=Math.abs(w-S)/2;let A=L.append("g");if(await rs(A,x,{useHtmlLabels:!1,width:R,classes:"architecture-service-label"},Be()),A.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),O==="X")A.attr("transform","translate("+T+", "+k+")");else if(O==="Y")A.attr("transform","translate("+T+", "+k+") rotate(-90)");else if(O==="XY"){let N=yse(f,g);if(N&&dnr(N)){let M=A.node().getBoundingClientRect(),[D,B]=gnr(N);A.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*D*B*45})`);let P=A.node().getBoundingClientRect();A.attr("transform",` +`,"getStyles"),Anr=Enr;b(bse,"withSeededRandom");bk=b(e=>`${e}`,"wrapIcon"),K6={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:bk('')},server:{body:bk('')},disk:{body:bk('')},internet:{body:bk('')},cloud:{body:bk('')},unknown:zU,blank:{body:bk("")}}},_nr=b(async function(e,t,r,n){let i=r.getConfigField("padding"),a=r.getConfigField("iconSize"),s=a/2,o=a/6,l=o/2;await Promise.all(t.edges().map(async u=>{let{source:h,sourceDir:f,sourceArrow:d,sourceGroup:p,target:m,targetDir:g,targetArrow:y,targetGroup:v,label:x}=bet(u),{x:w,y:C}=u[0].sourceEndpoint(),{x:T,y:k}=u[0].midpoint(),{x:S,y:E}=u[0].targetEndpoint(),I=i+4;if(p&&(Fl(f)?w+=f==="L"?-I:I:C+=f==="T"?-I:I+18),v&&(Fl(g)?S+=g==="L"?-I:I:E+=g==="T"?-I:I+18),!p&&r.getNode(h)?.type==="junction"&&(Fl(f)?w+=f==="L"?s:-s:C+=f==="T"?s:-s),!v&&r.getNode(m)?.type==="junction"&&(Fl(g)?S+=g==="L"?s:-s:E+=g==="T"?s:-s),u[0]._private.rscratch){let L=e.insert("g");if(L.insert("path").attr("d",`M ${w},${C} L ${T},${k} L${S},${E} `).attr("class","edge").attr("id",`${n}-${zf(h,m,{prefix:"L"})}`),d){let O=Fl(f)?YO[f](w,o):w-l,R=r1(f)?YO[f](C,o):C-l;L.insert("polygon").attr("points",vet[f](o)).attr("transform",`translate(${O},${R})`).attr("class","arrow")}if(y){let O=Fl(g)?YO[g](S,o):S-l,R=r1(g)?YO[g](E,o):E-l;L.insert("polygon").attr("points",vet[g](o)).attr("transform",`translate(${O},${R})`).attr("class","arrow")}if(x){let O=wse(f,g)?"XY":Fl(f)?"X":"Y",R=0;O==="X"?R=Math.abs(w-S):O==="Y"?R=Math.abs(C-E)/1.5:R=Math.abs(w-S)/2;let A=L.append("g");if(await rs(A,x,{useHtmlLabels:!1,width:R,classes:"architecture-service-label"},Be()),A.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),O==="X")A.attr("transform","translate("+T+", "+k+")");else if(O==="Y")A.attr("transform","translate("+T+", "+k+") rotate(-90)");else if(O==="XY"){let N=xse(f,g);if(N&&ynr(N)){let M=A.node().getBoundingClientRect(),[D,B]=bnr(N);A.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*D*B*45})`);let P=A.node().getBoundingClientRect();A.attr("transform",` translate(${T}, ${k-M.height/2}) translate(${D*P.width/2}, ${B*P.height/2}) rotate(${-1*D*B*45}, 0, ${M.height/2}) - `)}}}}}))},"drawEdges"),Snr=b(async function(e,t,r,n){let a=r.getConfigField("padding")*.75,s=r.getConfigField("fontSize"),l=r.getConfigField("iconSize")/2;await Promise.all(t.nodes().map(async u=>{let h=wk(u);if(h.type==="group"){let{h:f,w:d,x1:p,y1:m}=u.boundingBox(),g=e.append("rect");g.attr("id",`${n}-group-${h.id}`).attr("x",p+l).attr("y",m+l).attr("width",d).attr("height",f).attr("class","node-bkg");let y=e.append("g"),v=p,x=m;if(h.icon){let w=y.append("g");w.html(`${await zc(h.icon,{height:a,width:a,fallbackPrefix:K6.prefix})}`),w.attr("transform","translate("+(v+l+1)+", "+(x+l+1)+")"),v+=a,x+=s/2-1-2}if(h.label){let w=y.append("g");await rs(w,h.label,{useHtmlLabels:!1,width:d,classes:"architecture-service-label"},Be()),w.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),w.attr("transform","translate("+(v+l+4)+", "+(x+l+2)+")")}r.setElementForId(h.id,g)}}))},"drawGroups"),Enr=b(async function(e,t,r,n){let i=Be();for(let a of r){let s=t.append("g"),o=e.getConfigField("iconSize");if(a.title){let f=s.append("g");await rs(f,a.title,{useHtmlLabels:!1,width:o*1.5,classes:"architecture-service-label"},i),f.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),f.attr("transform","translate("+o/2+", "+o+")")}let l=s.append("g");if(a.icon)l.html(`${await zc(a.icon,{height:o,width:o,fallbackPrefix:K6.prefix})}`);else if(a.iconText){l.html(`${await zc("blank",{height:o,width:o,fallbackPrefix:K6.prefix})}`);let p=l.append("g").append("foreignObject").attr("width",o).attr("height",o).append("div").attr("class","node-icon-text").attr("style",`height: ${o}px;`).append("div").html(Mr(a.iconText,i)),m=parseInt(window.getComputedStyle(p.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;p.attr("style",`-webkit-line-clamp: ${Math.floor((o-2)/m)};`)}else l.append("path").attr("class","node-bkg").attr("id",`${n}-node-${a.id}`).attr("d",`M0,${o} V5 Q0,0 5,0 H${o-5} Q${o},0 ${o},5 V${o} Z`);s.attr("id",`${n}-service-${a.id}`).attr("class","architecture-service");let{width:u,height:h}=s.node().getBBox();a.width=u,a.height=h,e.setElementForId(a.id,s)}return 0},"drawServices"),Anr=b(function(e,t,r,n){r.forEach(i=>{let a=t.append("g"),s=e.getConfigField("iconSize");a.append("g").append("rect").attr("id",`${n}-node-${i.id}`).attr("fill-opacity","0").attr("width",s).attr("height",s),a.attr("class","architecture-junction");let{width:l,height:u}=a._groups[0][0].getBBox();a.width=l,a.height=u,e.setElementForId(i.id,a)})},"drawJunctions");f4([{name:K6.prefix,icons:K6}]);Du.use(wet.default);b(ket,"addServices");b(Tet,"addJunctions");b(Cet,"positionNodes");b(Eet,"addGroups");b(Aet,"addEdges");b(_et,"getAlignments");b(Ret,"getRelativeConstraints");b(Let,"layoutArchitecture");_nr=b(async(e,t,r,n)=>{let i=n.db;i.setDiagramId(t);let a=i.getServices(),s=i.getJunctions(),o=i.getGroups(),l=i.getEdges(),u=i.getDataStructures(),h=Qn(t),f=h.append("g");f.attr("class","architecture-edges");let d=h.append("g");d.attr("class","architecture-services");let p=h.append("g");p.attr("class","architecture-groups"),await Enr(i,d,a,t),Anr(i,d,s,t);let m=await Let(a,s,o,l,i,u);await Cnr(f,m,i,t),await Snr(p,m,i,t),Cet(i,m),_f(void 0,h,i.getConfigField("padding"),i.getConfigField("useMaxWidth"))},"draw"),Rnr={draw:_nr},Lnr={parser:bet,get db(){return new xet},renderer:Rnr,styles:Tnr}});var stt={};Tr(stt,{diagram:()=>Unr});function Pet(){Tse={}}function Bet(){let e=Pnr,{ast:t}=Tse,r=Cse();if(!t)throw new Error("No data for EventModel");return t.frames.forEach((n,i)=>{let a=Wet(n,t.dataEntities,r);e=jO(e,{$kind:Net,index:i,frame:n,textProps:a});let s;Ket(n)?(se.debug("source frame",n.sourceFrames),s=t.frames.filter(o=>n.sourceFrames.some(l=>l.$refText===o.name)),s.forEach(o=>{e=jO(e,{$kind:bse,index:i,frame:n,sourceFrame:o})})):e=jO(e,{$kind:bse,index:i,frame:n})}),e={...e,sortedSwimlanesArray:Sse(e.swimlanes)},e}function Fet(e){Tse.ast=e}function Cse(){return ni}function $et(e){let t=e.split(".");if(t.length===2)return t[0]}function zet(e){let t=e.split(".");return t.length===2?t[1]:e}function Get(e,t){if(!(!t||t.length===0))return Object.values(e).find(r=>r.namespace===t)}function XO(e,t,r){return Math.max(t,...Object.keys(e).filter(n=>{let i=Number.parseInt(n);return i>t&&iNumber.parseInt(n)))+1}function qet(e,t){let r=$et(e.entityIdentifier),n=Get(t,r);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return n?{index:n.index,label:n.namespace||ni.labelUiAutomation}:r?{index:XO(t,0,100),label:ni.labelUiAutomationPrefix+r}:{index:0,label:ni.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return n?{index:n.index,label:n.namespace||ni.labelCommandReadModel}:r?{index:XO(t,100,200),label:ni.labelCommandReadModelPrefix+r}:{index:100,label:ni.labelCommandReadModel};default:return n?{index:n.index,label:n.namespace||ni.labelEvents}:r?{index:XO(t,200,300),label:ni.labelEventsPrefix+r}:{index:200,label:ni.labelEvents}}}function Vet(e){let{themeVariables:t}=qt();switch(e.modelEntityType){case"ui":return{fill:t.emUiFill??"white",stroke:t.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:t.emProcessorFill??"#edb3f6",stroke:t.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:t.emReadModelFill??"#d3f1a2",stroke:t.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:t.emCommandFill??"#bcd6fe",stroke:t.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:t.emEventFill??"#ffb778",stroke:t.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}function Wet(e,t,r){let n=qt(),i=Mr(zet(e.entityIdentifier)??"",n),a,s={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"},l=`${Wy(i,r.textMaxWidth,s)}`;if(e.dataInlineValue&&(a=e.dataInlineValue,a=a.substring(a.indexOf("{")+1),a=a.substring(0,a.lastIndexOf("}")-1),a=Mr(a,n),a=Wy(a,r.textMaxWidth,s),a=a.replaceAll(" "," ")),e.dataReference){let m=t.find(g=>g.name===e.dataReference?.$refText);m&&(a=m.dataBlockValue,a=a.substring(a.indexOf(`{ -`)+2),a=a.substring(0,a.lastIndexOf("}")-1),a=Mr(a,n),a=Wy(a,r.textMaxWidth,s),a=a.replaceAll(" "," "),a+="
")}let u=a!==void 0;u&&(l+=`

${a}`);let h={fontSize:s.fontSize,fontWeight:s.fontWeight,fontFamily:s.fontFamily},f=q3(l,h),d=u?f.width/3:f.width,p={content:l,width:d,height:f.height};return se.debug(`[${e.name}] ${e.entityIdentifier} text`,p),p}function Het(e,t){let r=t,n=Vet(r.frame),i={width:r.textProps.width+2*ni.boxTextPadding,height:r.textProps.height+2*ni.boxTextPadding};return[{$kind:Det,frame:r.frame,index:r.index,visual:n,dimension:i,textProps:r.textProps}]}function Uet(e,t,r){return t===void 0?ni.contentStartX:t.index===e.index&&e.r?e.r+ni.boxPadding:r===void 0?ni.contentStartX:r.r-ni.boxOverlap+ni.boxPadding}function Yet(e,t){let r=[...e.map(n=>n.r),t];return Math.max(...r)}function Sse(e){return Object.values(e).sort((t,r)=>t.index-r.index)}function Xet(e,t){let r=t,n=qet(r.frame,e.swimlanes),i;n.index in e.swimlanes?i=e.swimlanes[n.index]:i={index:n.index,label:n.label,r:0,y:n.index*ni.swimlaneMinHeight+ni.swimlaneGap,height:ni.swimlaneMinHeight,maxHeight:ni.swimlaneMinHeight};let a=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,s=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,o={width:Math.max(ni.boxMinWidth,Math.min(ni.boxMaxWidth,r.dimension.width))+2*ni.boxPadding,height:Math.max(ni.boxMinHeight,Math.min(ni.boxMaxHeight,r.dimension.height))+2*ni.boxPadding},l=Uet(i,s,a),u=l+o.width+ni.boxPadding,h=Yet(Object.values(e.swimlanes),u);i.r=l+o.width,i.maxHeight=Math.max(i.maxHeight,o.height),i.height=Math.max(ni.swimlaneMinHeight,i.maxHeight)+2*ni.swimlanePadding;let f={x:l,y:ni.swimlanePadding+i.y,r:u,dimension:o,leftSibling:!1,swimlane:i,visual:r.visual,text:r.textProps.content,frame:r.frame,index:r.index},d={...e,boxes:[...e.boxes,f],swimlanes:{...e.swimlanes,[`${i.index}`]:i},previousSwimlaneNumber:n.index,previousFrame:r.frame,maxR:h},p=Sse(d.swimlanes);p.length>0&&(p[0].y=0);for(let m=1;m0}function wse(e,t){if(t!=null)return e.find(r=>r.frame.name===t.name)}function Zet(e,t,r){if(!(r<0))for(let n=r;n>=0;n--){let i=e[n];if(i.swimlane.index!==t)return i}}function Qet(e,t){let r=t;if(ID(r.frame)||jet(r.index,r.frame))return[];let n=wse(e.boxes,r.frame);if(n===void 0)throw new Error(`Target box not found for frame ${r.frame.name}`);let i;return r.sourceFrame?i=wse(e.boxes,r.sourceFrame):i=Zet(e.boxes,n.swimlane.index,r.index-1),i===void 0?[]:[{$kind:Oet,frame:r.frame,index:r.index,sourceBox:i,targetBox:n}]}function Jet(e,t){let r=t,n={visual:{fill:"none",stroke:"#000"},source:{x:r.sourceBox.x,y:r.sourceBox.y},target:{x:r.targetBox.x,y:r.targetBox.y},sourceBox:r.sourceBox,targetBox:r.targetBox};return{...e,relations:[...e.relations,n]}}function ett(e,t){let r=Bnr[t.$kind];if(r==null)return[];let n=r(e,t);return se.debug("decided events",n),n}function ttt(e,t){let r=t.reduce((n,i)=>{let a=Fnr[i.$kind];return a==null?n:a(n,i)},e);return se.debug("evolve events",{state:e,newState:r,events:t}),r}function jO(e,t){let r=ett(e,t);return ttt(e,r)}function rtt(e,t){return r=>{let n=r.swimlane.y+t.swimlanePadding,i=e.append("g").attr("class","em-box");i.append("rect").attr("x",r.x).attr("y",n).attr("rx","3").attr("width",r.dimension.width).attr("height",r.dimension.height).attr("stroke",r.visual.stroke).attr("fill",r.visual.fill),i.append("foreignObject").attr("x",r.x+t.boxPadding).attr("y",n+10).attr("width",r.dimension.width-2*t.boxPadding).attr("height",r.dimension.height-2*t.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(r.text)}}function ntt(e,t){return e>t}function itt(e,t,r,n){return i=>{let a=i.sourceBox.swimlane.y+t.swimlanePadding,s=i.targetBox.swimlane.y+t.swimlanePadding,o=ntt(a,s),l=i.sourceBox.x+i.sourceBox.dimension.width*2/3,u=i.targetBox.x+i.targetBox.dimension.width/3,h,f;se.debug(`rendering relation up=${o} for `,{sourceBox:i.sourceBox,targetBox:i.targetBox}),o?(h=a,f=s+i.targetBox.dimension.height):(h=a+i.sourceBox.dimension.height,f=s);let d=n.emRelationStroke??i.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",i.visual.fill).attr("stroke",d).attr("stroke-width","1").attr("marker-end",`url(#${r})`).attr("d",`M${l} ${h} L${u} ${f}`)}}function att(e,t,r,n){return i=>{let a=e.append("g").attr("class","em-swimlane"),s=n.emSwimlaneBackgroundOdd??"rgb(250,250,250)",o=n.emSwimlaneBackgroundStroke??"rgb(240,240,240)";a.append("rect").attr("x",0).attr("y",i.y).attr("rx","3").attr("width",t+r.swimlanePadding).attr("height",i.height).attr("fill",s).attr("stroke",o),a.append("text").attr("font-weight",r.swimlaneTextFontWeight).attr("x",30).attr("y",i.y+30).text(i.label)}}var Net,Det,bse,Oet,Inr,Mnr,Nnr,Dnr,Onr,Tse,ni,Pnr,Bnr,Fnr,kse,$nr,znr,Gnr,qnr,Vnr,Wnr,Hnr,Unr,ott=W(()=>{Sl();Sn();_r();Rr();hr();Co();Co();fn();Net="position frame",Det="frame positioned",bse="position relation",Oet="relation positioned",Inr=b(function(e){se.debug("options str",e)},"setOptions"),Mnr=b(function(){return{}},"getOptions"),Nnr=b(function(){Pet(),Nr()},"clear");b(Pet,"reset");Dnr=Lr.eventmodeling,Onr=b(()=>Rn({...Dnr,...qt().eventmodeling}),"getConfig"),Tse={};b(Bet,"getState");b(Fet,"setAst");ni={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};b(Cse,"getDiagramProps");Pnr={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};b($et,"extractNamespace");b(zet,"extractName");b(Get,"findSwimlaneByNamespace");b(XO,"findNextAvailableIndex");b(qet,"calculateSwimlaneProps");b(Vet,"calculateEntityVisualProps");b(Wet,"calculateTextProps");b(Het,"decidePositionFrame");b(Uet,"calculateX");b(Yet,"calculateMaxRight");b(Sse,"sortedSwimlanesArray");b(Xet,"evolveFramePositioned");b(jet,"isFirstFrame");b(Ket,"hasSourceFrame");b(wse,"findBoxByFrame");b(Zet,"findBoxByLineIndex");b(Qet,"decidePositionRelation");b(Jet,"evolveRelationPositioned");Bnr={[Net]:Het,[bse]:Qet},Fnr={[Det]:Xet,[Oet]:Jet};b(ett,"decide");b(ttt,"evolve");b(jO,"dispatch");kse={getConfig:Onr,setOptions:Inr,getOptions:Mnr,clear:Nnr,setAccTitle:Yr,getAccTitle:Qr,getAccDescription:en,setAccDescription:Jr,setDiagramTitle:ln,getDiagramTitle:tn,setAst:Fet,getDiagramProps:Cse,getState:Bet},$nr={parse:b(async e=>{let t=await ba("eventmodeling",e);se.debug(t),kse.setAst(t),wi(t,kse)},"parse")},znr=Be(),Gnr=znr?.eventmodeling;b(rtt,"renderD3Box");b(ntt,"dirUpwards");b(itt,"renderD3Relation");b(att,"renderD3Swimlane");qnr=b(function(e,t,r,n){if(se.debug("in eventmodeling renderer",e+` -`,"id:",t,r),!Gnr)throw new Error("EventModeling config not found");let i=n.db,{themeVariables:a,eventmodeling:s}=Be(),o=ct(`[id="${t}"]`),l=i.getDiagramProps(),u=i.getState(),h=`em-arrowhead-${t}`,f=a.emArrowhead??"#000000";u.sortedSwimlanesArray.forEach(att(o,u.maxR,l,a)),u.boxes.forEach(rtt(o,l)),u.relations.forEach(itt(o,l,h,a)),o.append("defs").append("marker").attr("id",h).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",f),B5(void 0,o,s?.padding??30,s?.useMaxWidth)},"draw"),Vnr={draw:qnr},Wnr=b(e=>"","getStyles"),Hnr=Wnr,Unr={parser:$nr,db:kse,renderer:Vnr,styles:Hnr}});var mtt={};Tr(mtt,{diagram:()=>lir});var Ase,Ynr,Xnr,jnr,kk,Knr,Znr,Qnr,dtt,ltt,ctt,utt,Jnr,htt,eir,tir,rir,Ese,nir,iir,ptt,KO,ftt,Tk,air,sir,oir,lir,gtt=W(()=>{za();Sn();_r();Rr();hr();dr();Ase=(function(){var e=b(function(v,x,w,C){for(w=w||{},C=v.length;C--;w[v[C]]=x);return w},"o"),t=[1,4],r=[1,14],n=[1,12],i=[1,13],a=[6,7,8],s=[1,20],o=[1,18],l=[1,19],u=[6,7,11],h=[1,6,13,14],f=[1,23],d=[1,24],p=[1,6,7,11,13,14],m={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:b(function(x,w,C,T,k,S,E){var I=S.length-1;switch(k){case 6:case 7:return T;case 15:T.addNode(S[I-1].length,S[I].trim());break;case 16:T.addNode(0,S[I].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:i},e(a,[2,3]),{1:[2,2]},e(a,[2,4]),e(a,[2,5]),{1:[2,6],6:r,12:15,13:n,14:i},{6:r,9:16,12:11,13:n,14:i},{6:s,7:o,10:17,11:l},e(u,[2,18],{14:[1,21]}),e(u,[2,16]),e(u,[2,17]),{6:s,7:o,10:22,11:l},{1:[2,7],6:r,12:15,13:n,14:i},e(h,[2,14],{7:f,11:d}),e(p,[2,8]),e(p,[2,9]),e(p,[2,10]),e(u,[2,15]),e(h,[2,13],{7:f,11:d}),e(p,[2,11]),e(p,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:b(function(x,w){if(w.recoverable)this.trace(x);else{var C=new Error(x);throw C.hash=w,C}},"parseError"),parse:b(function(x){var w=this,C=[0],T=[],k=[null],S=[],E=this.table,I="",L=0,O=0,R=0,A=2,N=1,M=S.slice.call(arguments,1),D=Object.create(this.lexer),B={yy:{}};for(var P in this.yy)Object.prototype.hasOwnProperty.call(this.yy,P)&&(B.yy[P]=this.yy[P]);D.setInput(x,B.yy),B.yy.lexer=D,B.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var $=D.yylloc;S.push($);var F=D.options&&D.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function q(Oe){C.length=C.length-2*Oe,k.length=k.length-Oe,S.length=S.length-Oe}b(q,"popStack");function G(){var Oe;return Oe=T.pop()||D.lex()||N,typeof Oe!="number"&&(Oe instanceof Array&&(T=Oe,Oe=T.pop()),Oe=w.symbols_[Oe]||Oe),Oe}b(G,"lex");for(var z,H,j,J,U,le,ee={},ue,ae,oe,Re;;){if(j=C[C.length-1],this.defaultActions[j]?J=this.defaultActions[j]:((z===null||typeof z>"u")&&(z=G()),J=E[j]&&E[j][z]),typeof J>"u"||!J.length||!J[0]){var Te="";Re=[];for(ue in E[j])this.terminals_[ue]&&ue>A&&Re.push("'"+this.terminals_[ue]+"'");D.showPosition?Te="Parse error on line "+(L+1)+`: + `)}}}}}))},"drawEdges"),Rnr=b(async function(e,t,r,n){let a=r.getConfigField("padding")*.75,s=r.getConfigField("fontSize"),l=r.getConfigField("iconSize")/2;await Promise.all(t.nodes().map(async u=>{let h=wk(u);if(h.type==="group"){let{h:f,w:d,x1:p,y1:m}=u.boundingBox(),g=e.append("rect");g.attr("id",`${n}-group-${h.id}`).attr("x",p+l).attr("y",m+l).attr("width",d).attr("height",f).attr("class","node-bkg");let y=e.append("g"),v=p,x=m;if(h.icon){let w=y.append("g");w.html(`${await zc(h.icon,{height:a,width:a,fallbackPrefix:K6.prefix})}`),w.attr("transform","translate("+(v+l+1)+", "+(x+l+1)+")"),v+=a,x+=s/2-1-2}if(h.label){let w=y.append("g");await rs(w,h.label,{useHtmlLabels:!1,width:d,classes:"architecture-service-label"},Be()),w.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),w.attr("transform","translate("+(v+l+4)+", "+(x+l+2)+")")}r.setElementForId(h.id,g)}}))},"drawGroups"),Lnr=b(async function(e,t,r,n){let i=Be();for(let a of r){let s=t.append("g"),o=e.getConfigField("iconSize");if(a.title){let f=s.append("g");await rs(f,a.title,{useHtmlLabels:!1,width:o*1.5,classes:"architecture-service-label"},i),f.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),f.attr("transform","translate("+o/2+", "+o+")")}let l=s.append("g");if(a.icon)l.html(`${await zc(a.icon,{height:o,width:o,fallbackPrefix:K6.prefix})}`);else if(a.iconText){l.html(`${await zc("blank",{height:o,width:o,fallbackPrefix:K6.prefix})}`);let p=l.append("g").append("foreignObject").attr("width",o).attr("height",o).append("div").attr("class","node-icon-text").attr("style",`height: ${o}px;`).append("div").html(Mr(a.iconText,i)),m=parseInt(window.getComputedStyle(p.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;p.attr("style",`-webkit-line-clamp: ${Math.floor((o-2)/m)};`)}else l.append("path").attr("class","node-bkg").attr("id",`${n}-node-${a.id}`).attr("d",`M0,${o} V5 Q0,0 5,0 H${o-5} Q${o},0 ${o},5 V${o} Z`);s.attr("id",`${n}-service-${a.id}`).attr("class","architecture-service");let{width:u,height:h}=s.node().getBBox();a.width=u,a.height=h,e.setElementForId(a.id,s)}return 0},"drawServices"),Inr=b(function(e,t,r,n){r.forEach(i=>{let a=t.append("g"),s=e.getConfigField("iconSize");a.append("g").append("rect").attr("id",`${n}-node-${i.id}`).attr("fill-opacity","0").attr("width",s).attr("height",s),a.attr("class","architecture-junction");let{width:l,height:u}=a._groups[0][0].getBBox();a.width=l,a.height=u,e.setElementForId(i.id,a)})},"drawJunctions");f4([{name:K6.prefix,icons:K6}]);Du.use(Tet.default);b(Cet,"addServices");b(Eet,"addJunctions");b(Aet,"positionNodes");b(_et,"addGroups");b(Ret,"addEdges");b(Let,"getAlignments");b(Iet,"getRelativeConstraints");b(Met,"layoutArchitecture");Mnr=b(async(e,t,r,n)=>{let i=n.db;i.setDiagramId(t);let a=i.getServices(),s=i.getJunctions(),o=i.getGroups(),l=i.getEdges(),u=i.getDataStructures(),h=Qn(t),f=h.append("g");f.attr("class","architecture-edges");let d=h.append("g");d.attr("class","architecture-services");let p=h.append("g");p.attr("class","architecture-groups"),await Lnr(i,d,a,t),Inr(i,d,s,t);let m=await Met(a,s,o,l,i,u);await _nr(f,m,i,t),await Rnr(p,m,i,t),Aet(i,m),_f(void 0,h,i.getConfigField("padding"),i.getConfigField("useMaxWidth"))},"draw"),Nnr={draw:Mnr},Dnr={parser:ket,get db(){return new wet},renderer:Nnr,styles:Anr}});var ltt={};Tr(ltt,{diagram:()=>Knr});function Fet(){Sse={}}function $et(){let e=znr,{ast:t}=Sse,r=Ese();if(!t)throw new Error("No data for EventModel");return t.frames.forEach((n,i)=>{let a=Uet(n,t.dataEntities,r);e=jO(e,{$kind:Oet,index:i,frame:n,textProps:a});let s;Qet(n)?(se.debug("source frame",n.sourceFrames),s=t.frames.filter(o=>n.sourceFrames.some(l=>l.$refText===o.name)),s.forEach(o=>{e=jO(e,{$kind:kse,index:i,frame:n,sourceFrame:o})})):e=jO(e,{$kind:kse,index:i,frame:n})}),e={...e,sortedSwimlanesArray:Ase(e.swimlanes)},e}function zet(e){Sse.ast=e}function Ese(){return ni}function Get(e){let t=e.split(".");if(t.length===2)return t[0]}function qet(e){let t=e.split(".");return t.length===2?t[1]:e}function Vet(e,t){if(!(!t||t.length===0))return Object.values(e).find(r=>r.namespace===t)}function XO(e,t,r){return Math.max(t,...Object.keys(e).filter(n=>{let i=Number.parseInt(n);return i>t&&iNumber.parseInt(n)))+1}function Wet(e,t){let r=Get(e.entityIdentifier),n=Vet(t,r);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return n?{index:n.index,label:n.namespace||ni.labelUiAutomation}:r?{index:XO(t,0,100),label:ni.labelUiAutomationPrefix+r}:{index:0,label:ni.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return n?{index:n.index,label:n.namespace||ni.labelCommandReadModel}:r?{index:XO(t,100,200),label:ni.labelCommandReadModelPrefix+r}:{index:100,label:ni.labelCommandReadModel};default:return n?{index:n.index,label:n.namespace||ni.labelEvents}:r?{index:XO(t,200,300),label:ni.labelEventsPrefix+r}:{index:200,label:ni.labelEvents}}}function Het(e){let{themeVariables:t}=qt();switch(e.modelEntityType){case"ui":return{fill:t.emUiFill??"white",stroke:t.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:t.emProcessorFill??"#edb3f6",stroke:t.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:t.emReadModelFill??"#d3f1a2",stroke:t.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:t.emCommandFill??"#bcd6fe",stroke:t.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:t.emEventFill??"#ffb778",stroke:t.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}function Uet(e,t,r){let n=qt(),i=Mr(qet(e.entityIdentifier)??"",n),a,s={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"},l=`${Wy(i,r.textMaxWidth,s)}`;if(e.dataInlineValue&&(a=e.dataInlineValue,a=a.substring(a.indexOf("{")+1),a=a.substring(0,a.lastIndexOf("}")-1),a=Mr(a,n),a=Wy(a,r.textMaxWidth,s),a=a.replaceAll(" "," ")),e.dataReference){let m=t.find(g=>g.name===e.dataReference?.$refText);m&&(a=m.dataBlockValue,a=a.substring(a.indexOf(`{ +`)+2),a=a.substring(0,a.lastIndexOf("}")-1),a=Mr(a,n),a=Wy(a,r.textMaxWidth,s),a=a.replaceAll(" "," "),a+="
")}let u=a!==void 0;u&&(l+=`

${a}`);let h={fontSize:s.fontSize,fontWeight:s.fontWeight,fontFamily:s.fontFamily},f=q3(l,h),d=u?f.width/3:f.width,p={content:l,width:d,height:f.height};return se.debug(`[${e.name}] ${e.entityIdentifier} text`,p),p}function Yet(e,t){let r=t,n=Het(r.frame),i={width:r.textProps.width+2*ni.boxTextPadding,height:r.textProps.height+2*ni.boxTextPadding};return[{$kind:Pet,frame:r.frame,index:r.index,visual:n,dimension:i,textProps:r.textProps}]}function Xet(e,t,r){return t===void 0?ni.contentStartX:t.index===e.index&&e.r?e.r+ni.boxPadding:r===void 0?ni.contentStartX:r.r-ni.boxOverlap+ni.boxPadding}function jet(e,t){let r=[...e.map(n=>n.r),t];return Math.max(...r)}function Ase(e){return Object.values(e).sort((t,r)=>t.index-r.index)}function Ket(e,t){let r=t,n=Wet(r.frame,e.swimlanes),i;n.index in e.swimlanes?i=e.swimlanes[n.index]:i={index:n.index,label:n.label,r:0,y:n.index*ni.swimlaneMinHeight+ni.swimlaneGap,height:ni.swimlaneMinHeight,maxHeight:ni.swimlaneMinHeight};let a=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,s=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,o={width:Math.max(ni.boxMinWidth,Math.min(ni.boxMaxWidth,r.dimension.width))+2*ni.boxPadding,height:Math.max(ni.boxMinHeight,Math.min(ni.boxMaxHeight,r.dimension.height))+2*ni.boxPadding},l=Xet(i,s,a),u=l+o.width+ni.boxPadding,h=jet(Object.values(e.swimlanes),u);i.r=l+o.width,i.maxHeight=Math.max(i.maxHeight,o.height),i.height=Math.max(ni.swimlaneMinHeight,i.maxHeight)+2*ni.swimlanePadding;let f={x:l,y:ni.swimlanePadding+i.y,r:u,dimension:o,leftSibling:!1,swimlane:i,visual:r.visual,text:r.textProps.content,frame:r.frame,index:r.index},d={...e,boxes:[...e.boxes,f],swimlanes:{...e.swimlanes,[`${i.index}`]:i},previousSwimlaneNumber:n.index,previousFrame:r.frame,maxR:h},p=Ase(d.swimlanes);p.length>0&&(p[0].y=0);for(let m=1;m0}function Tse(e,t){if(t!=null)return e.find(r=>r.frame.name===t.name)}function Jet(e,t,r){if(!(r<0))for(let n=r;n>=0;n--){let i=e[n];if(i.swimlane.index!==t)return i}}function ett(e,t){let r=t;if(ID(r.frame)||Zet(r.index,r.frame))return[];let n=Tse(e.boxes,r.frame);if(n===void 0)throw new Error(`Target box not found for frame ${r.frame.name}`);let i;return r.sourceFrame?i=Tse(e.boxes,r.sourceFrame):i=Jet(e.boxes,n.swimlane.index,r.index-1),i===void 0?[]:[{$kind:Bet,frame:r.frame,index:r.index,sourceBox:i,targetBox:n}]}function ttt(e,t){let r=t,n={visual:{fill:"none",stroke:"#000"},source:{x:r.sourceBox.x,y:r.sourceBox.y},target:{x:r.targetBox.x,y:r.targetBox.y},sourceBox:r.sourceBox,targetBox:r.targetBox};return{...e,relations:[...e.relations,n]}}function rtt(e,t){let r=Gnr[t.$kind];if(r==null)return[];let n=r(e,t);return se.debug("decided events",n),n}function ntt(e,t){let r=t.reduce((n,i)=>{let a=qnr[i.$kind];return a==null?n:a(n,i)},e);return se.debug("evolve events",{state:e,newState:r,events:t}),r}function jO(e,t){let r=rtt(e,t);return ntt(e,r)}function itt(e,t){return r=>{let n=r.swimlane.y+t.swimlanePadding,i=e.append("g").attr("class","em-box");i.append("rect").attr("x",r.x).attr("y",n).attr("rx","3").attr("width",r.dimension.width).attr("height",r.dimension.height).attr("stroke",r.visual.stroke).attr("fill",r.visual.fill),i.append("foreignObject").attr("x",r.x+t.boxPadding).attr("y",n+10).attr("width",r.dimension.width-2*t.boxPadding).attr("height",r.dimension.height-2*t.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(r.text)}}function att(e,t){return e>t}function stt(e,t,r,n){return i=>{let a=i.sourceBox.swimlane.y+t.swimlanePadding,s=i.targetBox.swimlane.y+t.swimlanePadding,o=att(a,s),l=i.sourceBox.x+i.sourceBox.dimension.width*2/3,u=i.targetBox.x+i.targetBox.dimension.width/3,h,f;se.debug(`rendering relation up=${o} for `,{sourceBox:i.sourceBox,targetBox:i.targetBox}),o?(h=a,f=s+i.targetBox.dimension.height):(h=a+i.sourceBox.dimension.height,f=s);let d=n.emRelationStroke??i.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",i.visual.fill).attr("stroke",d).attr("stroke-width","1").attr("marker-end",`url(#${r})`).attr("d",`M${l} ${h} L${u} ${f}`)}}function ott(e,t,r,n){return i=>{let a=e.append("g").attr("class","em-swimlane"),s=n.emSwimlaneBackgroundOdd??"rgb(250,250,250)",o=n.emSwimlaneBackgroundStroke??"rgb(240,240,240)";a.append("rect").attr("x",0).attr("y",i.y).attr("rx","3").attr("width",t+r.swimlanePadding).attr("height",i.height).attr("fill",s).attr("stroke",o),a.append("text").attr("font-weight",r.swimlaneTextFontWeight).attr("x",30).attr("y",i.y+30).text(i.label)}}var Oet,Pet,kse,Bet,Onr,Pnr,Bnr,Fnr,$nr,Sse,ni,znr,Gnr,qnr,Cse,Vnr,Wnr,Hnr,Unr,Ynr,Xnr,jnr,Knr,ctt=W(()=>{El();Sn();_r();Rr();hr();Co();Co();fn();Oet="position frame",Pet="frame positioned",kse="position relation",Bet="relation positioned",Onr=b(function(e){se.debug("options str",e)},"setOptions"),Pnr=b(function(){return{}},"getOptions"),Bnr=b(function(){Fet(),Nr()},"clear");b(Fet,"reset");Fnr=Lr.eventmodeling,$nr=b(()=>Rn({...Fnr,...qt().eventmodeling}),"getConfig"),Sse={};b($et,"getState");b(zet,"setAst");ni={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};b(Ese,"getDiagramProps");znr={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};b(Get,"extractNamespace");b(qet,"extractName");b(Vet,"findSwimlaneByNamespace");b(XO,"findNextAvailableIndex");b(Wet,"calculateSwimlaneProps");b(Het,"calculateEntityVisualProps");b(Uet,"calculateTextProps");b(Yet,"decidePositionFrame");b(Xet,"calculateX");b(jet,"calculateMaxRight");b(Ase,"sortedSwimlanesArray");b(Ket,"evolveFramePositioned");b(Zet,"isFirstFrame");b(Qet,"hasSourceFrame");b(Tse,"findBoxByFrame");b(Jet,"findBoxByLineIndex");b(ett,"decidePositionRelation");b(ttt,"evolveRelationPositioned");Gnr={[Oet]:Yet,[kse]:ett},qnr={[Pet]:Ket,[Bet]:ttt};b(rtt,"decide");b(ntt,"evolve");b(jO,"dispatch");Cse={getConfig:$nr,setOptions:Onr,getOptions:Pnr,clear:Bnr,setAccTitle:Yr,getAccTitle:Qr,getAccDescription:en,setAccDescription:Jr,setDiagramTitle:ln,getDiagramTitle:tn,setAst:zet,getDiagramProps:Ese,getState:$et},Vnr={parse:b(async e=>{let t=await ba("eventmodeling",e);se.debug(t),Cse.setAst(t),wi(t,Cse)},"parse")},Wnr=Be(),Hnr=Wnr?.eventmodeling;b(itt,"renderD3Box");b(att,"dirUpwards");b(stt,"renderD3Relation");b(ott,"renderD3Swimlane");Unr=b(function(e,t,r,n){if(se.debug("in eventmodeling renderer",e+` +`,"id:",t,r),!Hnr)throw new Error("EventModeling config not found");let i=n.db,{themeVariables:a,eventmodeling:s}=Be(),o=ct(`[id="${t}"]`),l=i.getDiagramProps(),u=i.getState(),h=`em-arrowhead-${t}`,f=a.emArrowhead??"#000000";u.sortedSwimlanesArray.forEach(ott(o,u.maxR,l,a)),u.boxes.forEach(itt(o,l)),u.relations.forEach(stt(o,l,h,a)),o.append("defs").append("marker").attr("id",h).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",f),B5(void 0,o,s?.padding??30,s?.useMaxWidth)},"draw"),Ynr={draw:Unr},Xnr=b(e=>"","getStyles"),jnr=Xnr,Knr={parser:Vnr,db:Cse,renderer:Ynr,styles:jnr}});var ytt={};Tr(ytt,{diagram:()=>fir});var Rse,Znr,Qnr,Jnr,kk,eir,tir,rir,mtt,utt,htt,ftt,nir,dtt,iir,air,sir,_se,oir,lir,gtt,KO,ptt,Tk,cir,uir,hir,fir,vtt=W(()=>{za();Sn();_r();Rr();hr();dr();Rse=(function(){var e=b(function(v,x,w,C){for(w=w||{},C=v.length;C--;w[v[C]]=x);return w},"o"),t=[1,4],r=[1,14],n=[1,12],i=[1,13],a=[6,7,8],s=[1,20],o=[1,18],l=[1,19],u=[6,7,11],h=[1,6,13,14],f=[1,23],d=[1,24],p=[1,6,7,11,13,14],m={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:b(function(x,w,C,T,k,S,E){var I=S.length-1;switch(k){case 6:case 7:return T;case 15:T.addNode(S[I-1].length,S[I].trim());break;case 16:T.addNode(0,S[I].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:i},e(a,[2,3]),{1:[2,2]},e(a,[2,4]),e(a,[2,5]),{1:[2,6],6:r,12:15,13:n,14:i},{6:r,9:16,12:11,13:n,14:i},{6:s,7:o,10:17,11:l},e(u,[2,18],{14:[1,21]}),e(u,[2,16]),e(u,[2,17]),{6:s,7:o,10:22,11:l},{1:[2,7],6:r,12:15,13:n,14:i},e(h,[2,14],{7:f,11:d}),e(p,[2,8]),e(p,[2,9]),e(p,[2,10]),e(u,[2,15]),e(h,[2,13],{7:f,11:d}),e(p,[2,11]),e(p,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:b(function(x,w){if(w.recoverable)this.trace(x);else{var C=new Error(x);throw C.hash=w,C}},"parseError"),parse:b(function(x){var w=this,C=[0],T=[],k=[null],S=[],E=this.table,I="",L=0,O=0,R=0,A=2,N=1,M=S.slice.call(arguments,1),D=Object.create(this.lexer),B={yy:{}};for(var P in this.yy)Object.prototype.hasOwnProperty.call(this.yy,P)&&(B.yy[P]=this.yy[P]);D.setInput(x,B.yy),B.yy.lexer=D,B.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var $=D.yylloc;S.push($);var F=D.options&&D.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function q(Oe){C.length=C.length-2*Oe,k.length=k.length-Oe,S.length=S.length-Oe}b(q,"popStack");function G(){var Oe;return Oe=T.pop()||D.lex()||N,typeof Oe!="number"&&(Oe instanceof Array&&(T=Oe,Oe=T.pop()),Oe=w.symbols_[Oe]||Oe),Oe}b(G,"lex");for(var z,H,j,J,U,le,ee={},ue,ae,oe,Re;;){if(j=C[C.length-1],this.defaultActions[j]?J=this.defaultActions[j]:((z===null||typeof z>"u")&&(z=G()),J=E[j]&&E[j][z]),typeof J>"u"||!J.length||!J[0]){var Te="";Re=[];for(ue in E[j])this.terminals_[ue]&&ue>A&&Re.push("'"+this.terminals_[ue]+"'");D.showPosition?Te="Parse error on line "+(L+1)+`: `+D.showPosition()+` Expecting `+Re.join(", ")+", got '"+(this.terminals_[z]||z)+"'":Te="Parse error on line "+(L+1)+": Unexpected "+(z==N?"end of input":"'"+(this.terminals_[z]||z)+"'"),this.parseError(Te,{text:D.match,token:this.terminals_[z]||z,line:D.yylineno,loc:$,expected:Re})}if(J[0]instanceof Array&&J.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+z);switch(J[0]){case 1:C.push(z),k.push(D.yytext),S.push(D.yylloc),C.push(J[1]),z=null,H?(z=H,H=null):(O=D.yyleng,I=D.yytext,L=D.yylineno,$=D.yylloc,R>0&&R--);break;case 2:if(ae=this.productions_[J[1]][1],ee.$=k[k.length-ae],ee._$={first_line:S[S.length-(ae||1)].first_line,last_line:S[S.length-1].last_line,first_column:S[S.length-(ae||1)].first_column,last_column:S[S.length-1].last_column},F&&(ee._$.range=[S[S.length-(ae||1)].range[0],S[S.length-1].range[1]]),le=this.performAction.apply(ee,[I,O,L,B.yy,J[1],k,S].concat(M)),typeof le<"u")return le;ae&&(C=C.slice(0,-1*ae*2),k=k.slice(0,-1*ae),S=S.slice(0,-1*ae)),C.push(this.productions_[J[1]][0]),k.push(ee.$),S.push(ee._$),oe=E[C[C.length-2]][C[C.length-1]],C.push(oe);break;case 3:return!0}}return!0},"parse")},g=(function(){var v={EOF:1,parseError:b(function(w,C){if(this.yy.parser)this.yy.parser.parseError(w,C);else throw new Error(w)},"parseError"),setInput:b(function(x,w){return this.yy=w||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var w=x.match(/(?:\r\n?|\n).*/g);return w?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:b(function(x){var w=x.length,C=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-w),this.offset-=w;var T=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),C.length-1&&(this.yylineno-=C.length-1);var k=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:C?(C.length===T.length?this.yylloc.first_column:0)+T[T.length-C.length].length-C[0].length:this.yylloc.first_column-w},this.options.ranges&&(this.yylloc.range=[k[0],k[0]+this.yyleng-w]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(x){this.unput(this.match.slice(x))},"less"),pastInput:b(function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var x=this.pastInput(),w=new Array(x.length+1).join("-");return x+this.upcomingInput()+` `+w+"^"},"showPosition"),test_match:b(function(x,w){var C,T,k;if(this.options.backtrack_lexer&&(k={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(k.yylloc.range=this.yylloc.range.slice(0))),T=x[0].match(/(?:\r\n?|\n).*/g),T&&(this.yylineno+=T.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:T?T[T.length-1].length-T[T.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],C=this.performAction.call(this,this.yy,this,w,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),C)return C;if(this._backtrack){for(var S in k)this[S]=k[S];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,w,C,T;this._more||(this.yytext="",this.match="");for(var k=this._currentRules(),S=0;Sw[0].length)){if(w=C,T=S,this.options.backtrack_lexer){if(x=this.test_match(C,k[S]),x!==!1)return x;if(this._backtrack){w=!1;continue}else return!1}else if(!this.options.flex)break}return w?(x=this.test_match(w,k[T]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var w=this.next();return w||this.lex()},"lex"),begin:b(function(w){this.conditionStack.push(w)},"begin"),popState:b(function(){var w=this.conditionStack.length-1;return w>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(w){return w=this.conditionStack.length-1-Math.abs(w||0),w>=0?this.conditionStack[w]:"INITIAL"},"topState"),pushState:b(function(w){this.begin(w)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(w,C,T,k){var S=k;switch(T){case 0:return 6;case 1:return 8;case 2:return 8;case 3:return 6;case 4:return 7;case 5:return 13;case 6:return 14;case 7:return 11}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:ishikawa-beta\b)/i,/^(?:ishikawa\b)/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:[^\n]+)/i,/^(?:$)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return v})();m.lexer=g;function y(){this.yy={}}return b(y,"Parser"),y.prototype=m,m.Parser=y,new y})();Ase.parser=Ase;Ynr=Ase,Xnr=class{constructor(){this.stack=[],this.clear=this.clear.bind(this),this.addNode=this.addNode.bind(this),this.getRoot=this.getRoot.bind(this)}static{b(this,"IshikawaDB")}clear(){this.root=void 0,this.stack=[],this.baseLevel=void 0,Nr()}getRoot(){return this.root}addNode(e,t){let r=Ct.sanitizeText(t,Be());if(!this.root){this.root={text:r,children:[]},this.stack=[{level:0,node:this.root}],ln(r);return}this.baseLevel??=e;let n=e-this.baseLevel+1;for(n<=0&&(n=1);this.stack.length>1&&this.stack[this.stack.length-1].level>=n;)this.stack.pop();let i=this.stack[this.stack.length-1].node,a={text:r,children:[]};i.children.push(a),this.stack.push({level:n,node:a})}getAccTitle(){return Qr()}setAccTitle(e){Yr(e)}getAccDescription(){return en()}setAccDescription(e){Jr(e)}getDiagramTitle(){return tn()}setDiagramTitle(e){ln(e)}},jnr=14,kk=250,Knr=30,Znr=60,Qnr=5,dtt=82*Math.PI/180,ltt=Math.cos(dtt),ctt=Math.sin(dtt),utt=b((e,t,r)=>{let n=e.node().getBBox(),i=n.width+t*2,a=n.height+t*2;vn(e,a,i,r),e.attr("viewBox",`${n.x-t} ${n.y-t} ${i} ${a}`)},"applyPaddedViewBox"),Jnr=b((e,t,r,n)=>{let a=n.db.getRoot();if(!a)return;let s=Be(),{look:o,handDrawnSeed:l,themeVariables:u}=s,h=Zl(s.fontSize)[0]??jnr,f=o==="handDrawn",d=a.children??[],p=s.ishikawa?.diagramPadding??20,m=s.ishikawa?.useMaxWidth??!1,g=Qn(t),y=g.append("g").attr("class","ishikawa"),v=f?gt.svg(g.node()):void 0,x=v?{roughSvg:v,seed:l??0,lineColor:u?.lineColor??"#333",fillColor:u?.mainBkg??"#fff"}:void 0,w=`ishikawa-arrow-${t}`;f||y.append("defs").append("marker").attr("id",w).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 Z").attr("class","ishikawa-arrow");let C=0,T=kk,k=f?void 0:Tk(y,C,T,C,T,"ishikawa-spine");if(eir(y,C,T,a.text,h,x),!d.length){f&&Tk(y,C,T,C,T,"ishikawa-spine",x),utt(g,p,m);return}C-=20;let S=d.filter((D,B)=>B%2===0),E=d.filter((D,B)=>B%2===1),I=htt(S),L=htt(E),O=I.total+L.total,R=kk,A=kk;if(O>0){let D=kk*2,B=kk*.3;R=Math.max(B,D*(I.total/O)),A=Math.max(B,D*(L.total/O))}let N=h*2;R=Math.max(R,I.max*N),A=Math.max(A,L.max*N),T=Math.max(R,kk),k&&k.attr("y1",T).attr("y2",T),y.select(".ishikawa-head-group").attr("transform",`translate(0,${T})`);let M=Math.ceil(d.length/2);for(let D=0;DMath.min(P,$.getBBox().x),1/0)}if(f)Tk(y,C,T,0,T,"ishikawa-spine",x);else{k.attr("x1",C);let D=`url(#${w})`;y.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start",D)}utt(g,p,m)},"draw"),htt=b(e=>{let t=b(r=>r.children.reduce((n,i)=>n+1+t(i),0),"countDescendants");return e.reduce((r,n)=>{let i=t(n);return r.total+=i,r.max=Math.max(r.max,i),r},{total:0,max:0})},"sideStats"),eir=b((e,t,r,n,i,a)=>{let s=Math.max(6,Math.floor(110/(i*.6))),o=e.append("g").attr("class","ishikawa-head-group").attr("transform",`translate(${t},${r})`),l=KO(o,ptt(n,s),0,0,"ishikawa-head-label","start",i),u=l.node().getBBox(),h=Math.max(60,u.width+6),f=Math.max(40,u.height*2+40),d=`M 0 ${-f/2} L 0 ${f/2} Q ${h*2.4} 0 0 ${-f/2} Z`;if(a){let p=a.roughSvg.path(d,{roughness:1.5,seed:a.seed,fill:a.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:a.lineColor,strokeWidth:2});o.insert(()=>p,":first-child").attr("class","ishikawa-head")}else o.insert("path",":first-child").attr("class","ishikawa-head").attr("d",d);l.attr("transform",`translate(${(h-u.width)/2-u.x+3},${-u.y-u.height/2})`)},"drawHead"),tir=b((e,t)=>{let r=[],n=[],i=b((a,s,o)=>{let l=t===-1?[...a].reverse():a;for(let u of l){let h=r.length,f=u.children??[];r.push({depth:o,text:ptt(u.text,15),parentIndex:s,childCount:f.length}),o%2===0?(n.push(h),f.length&&i(f,h,o+1)):(f.length&&i(f,h,o+1),n.push(h))}},"walk");return i(e,-1,2),{entries:r,yOrder:n}},"flattenTree"),rir=b((e,t,r,n,i,a,s)=>{let o=e.append("g").attr("class","ishikawa-label-group"),u=KO(o,t,r,n+11*i,"ishikawa-label cause","middle",a).node().getBBox();if(s){let h=s.roughSvg.rectangle(u.x-20,u.y-2,u.width+40,u.height+4,{roughness:1.5,seed:s.seed,fill:s.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:s.lineColor,strokeWidth:2});o.insert(()=>h,":first-child").attr("class","ishikawa-label-box")}else o.insert("rect",":first-child").attr("class","ishikawa-label-box").attr("x",u.x-20).attr("y",u.y-2).attr("width",u.width+40).attr("height",u.height+4)},"drawCauseLabel"),Ese=b((e,t,r,n,i,a)=>{let s=Math.sqrt(n*n+i*i);if(s===0)return;let o=n/s,l=i/s,u=6,h=-l*u,f=o*u,d=t,p=r,m=`M ${d} ${p} L ${d-o*u*2+h} ${p-l*u*2+f} L ${d-o*u*2-h} ${p-l*u*2-f} Z`,g=a.roughSvg.path(m,{roughness:1,seed:a.seed,fill:a.lineColor,fillStyle:"solid",stroke:a.lineColor,strokeWidth:1});e.append(()=>g)},"drawArrowMarker"),nir=b((e,t,r,n,i,a,s,o)=>{let l=t.children??[],u=a*(l.length?1:.2),h=-ltt*u,f=ctt*u*i,d=r+h,p=n+f;if(Tk(e,r,n,d,p,"ishikawa-branch",o),o&&Ese(e,r,n,r-d,n-p,o),rir(e,t.text,d,p,i,s,o),!l.length)return;let{entries:m,yOrder:g}=tir(l,i),y=m.length,v=new Array(y);for(let[k,S]of g.entries())v[S]=n+f*((k+1)/(y+1));let x=new Map;x.set(-1,{x0:r,y0:n,x1:d,y1:p,childCount:l.length,childrenDrawn:0});let w=-ltt,C=ctt*i,T=i<0?"ishikawa-label up":"ishikawa-label down";for(let[k,S]of m.entries()){let E=v[k],I=x.get(S.parentIndex),L=e.append("g").attr("class","ishikawa-sub-group"),O=0,R=0,A=0;if(S.depth%2===0){let N=I.y1-I.y0;O=ftt(I.x0,I.x1,N?(E-I.y0)/N:.5),R=E,A=O-(S.childCount>0?Znr+S.childCount*Qnr:Knr),Tk(L,O,E,A,E,"ishikawa-sub-branch",o),o&&Ese(L,O,E,1,0,o),KO(L,S.text,A,E,"ishikawa-label align","end",s)}else{let N=I.childrenDrawn++;O=ftt(I.x0,I.x1,(I.childCount-N)/(I.childCount+1)),R=I.y0,A=O+w*((E-R)/C),Tk(L,O,R,A,E,"ishikawa-sub-branch",o),o&&Ese(L,O,R,O-A,R-E,o),KO(L,S.text,A,E,T,"end",s)}S.childCount>0&&x.set(k,{x0:O,y0:R,x1:A,y1:E,childCount:S.childCount,childrenDrawn:0})}},"drawBranch"),iir=b(e=>e.split(/|\n/),"splitLines"),ptt=b((e,t)=>{if(e.length<=t)return e;let r=[];for(let n of e.split(/\s+/)){let i=r.length-1;i>=0&&r[i].length+1+n.length<=t?r[i]+=" "+n:r.push(n)}return r.join(` -`)},"wrapText"),KO=b((e,t,r,n,i,a,s)=>{let o=iir(t),l=s*1.05,u=e.append("text").attr("class",i).attr("text-anchor",a).attr("x",r).attr("y",n-(o.length-1)*l/2);for(let[h,f]of o.entries())u.append("tspan").attr("x",r).attr("dy",h===0?0:l).text(f);return u},"drawMultilineText"),ftt=b((e,t,r)=>e+(t-e)*r,"lerp"),Tk=b((e,t,r,n,i,a,s)=>{if(s){let o=s.roughSvg.line(t,r,n,i,{roughness:1.5,seed:s.seed,stroke:s.lineColor,strokeWidth:2});e.append(()=>o).attr("class",a);return}return e.append("line").attr("class",a).attr("x1",t).attr("y1",r).attr("x2",n).attr("y2",i)},"drawLine"),air={draw:Jnr},sir=b(e=>` +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var w=this.next();return w||this.lex()},"lex"),begin:b(function(w){this.conditionStack.push(w)},"begin"),popState:b(function(){var w=this.conditionStack.length-1;return w>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(w){return w=this.conditionStack.length-1-Math.abs(w||0),w>=0?this.conditionStack[w]:"INITIAL"},"topState"),pushState:b(function(w){this.begin(w)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(w,C,T,k){var S=k;switch(T){case 0:return 6;case 1:return 8;case 2:return 8;case 3:return 6;case 4:return 7;case 5:return 13;case 6:return 14;case 7:return 11}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:ishikawa-beta\b)/i,/^(?:ishikawa\b)/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:[^\n]+)/i,/^(?:$)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return v})();m.lexer=g;function y(){this.yy={}}return b(y,"Parser"),y.prototype=m,m.Parser=y,new y})();Rse.parser=Rse;Znr=Rse,Qnr=class{constructor(){this.stack=[],this.clear=this.clear.bind(this),this.addNode=this.addNode.bind(this),this.getRoot=this.getRoot.bind(this)}static{b(this,"IshikawaDB")}clear(){this.root=void 0,this.stack=[],this.baseLevel=void 0,Nr()}getRoot(){return this.root}addNode(e,t){let r=Ct.sanitizeText(t,Be());if(!this.root){this.root={text:r,children:[]},this.stack=[{level:0,node:this.root}],ln(r);return}this.baseLevel??=e;let n=e-this.baseLevel+1;for(n<=0&&(n=1);this.stack.length>1&&this.stack[this.stack.length-1].level>=n;)this.stack.pop();let i=this.stack[this.stack.length-1].node,a={text:r,children:[]};i.children.push(a),this.stack.push({level:n,node:a})}getAccTitle(){return Qr()}setAccTitle(e){Yr(e)}getAccDescription(){return en()}setAccDescription(e){Jr(e)}getDiagramTitle(){return tn()}setDiagramTitle(e){ln(e)}},Jnr=14,kk=250,eir=30,tir=60,rir=5,mtt=82*Math.PI/180,utt=Math.cos(mtt),htt=Math.sin(mtt),ftt=b((e,t,r)=>{let n=e.node().getBBox(),i=n.width+t*2,a=n.height+t*2;vn(e,a,i,r),e.attr("viewBox",`${n.x-t} ${n.y-t} ${i} ${a}`)},"applyPaddedViewBox"),nir=b((e,t,r,n)=>{let a=n.db.getRoot();if(!a)return;let s=Be(),{look:o,handDrawnSeed:l,themeVariables:u}=s,h=Ql(s.fontSize)[0]??Jnr,f=o==="handDrawn",d=a.children??[],p=s.ishikawa?.diagramPadding??20,m=s.ishikawa?.useMaxWidth??!1,g=Qn(t),y=g.append("g").attr("class","ishikawa"),v=f?gt.svg(g.node()):void 0,x=v?{roughSvg:v,seed:l??0,lineColor:u?.lineColor??"#333",fillColor:u?.mainBkg??"#fff"}:void 0,w=`ishikawa-arrow-${t}`;f||y.append("defs").append("marker").attr("id",w).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 Z").attr("class","ishikawa-arrow");let C=0,T=kk,k=f?void 0:Tk(y,C,T,C,T,"ishikawa-spine");if(iir(y,C,T,a.text,h,x),!d.length){f&&Tk(y,C,T,C,T,"ishikawa-spine",x),ftt(g,p,m);return}C-=20;let S=d.filter((D,B)=>B%2===0),E=d.filter((D,B)=>B%2===1),I=dtt(S),L=dtt(E),O=I.total+L.total,R=kk,A=kk;if(O>0){let D=kk*2,B=kk*.3;R=Math.max(B,D*(I.total/O)),A=Math.max(B,D*(L.total/O))}let N=h*2;R=Math.max(R,I.max*N),A=Math.max(A,L.max*N),T=Math.max(R,kk),k&&k.attr("y1",T).attr("y2",T),y.select(".ishikawa-head-group").attr("transform",`translate(0,${T})`);let M=Math.ceil(d.length/2);for(let D=0;DMath.min(P,$.getBBox().x),1/0)}if(f)Tk(y,C,T,0,T,"ishikawa-spine",x);else{k.attr("x1",C);let D=`url(#${w})`;y.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start",D)}ftt(g,p,m)},"draw"),dtt=b(e=>{let t=b(r=>r.children.reduce((n,i)=>n+1+t(i),0),"countDescendants");return e.reduce((r,n)=>{let i=t(n);return r.total+=i,r.max=Math.max(r.max,i),r},{total:0,max:0})},"sideStats"),iir=b((e,t,r,n,i,a)=>{let s=Math.max(6,Math.floor(110/(i*.6))),o=e.append("g").attr("class","ishikawa-head-group").attr("transform",`translate(${t},${r})`),l=KO(o,gtt(n,s),0,0,"ishikawa-head-label","start",i),u=l.node().getBBox(),h=Math.max(60,u.width+6),f=Math.max(40,u.height*2+40),d=`M 0 ${-f/2} L 0 ${f/2} Q ${h*2.4} 0 0 ${-f/2} Z`;if(a){let p=a.roughSvg.path(d,{roughness:1.5,seed:a.seed,fill:a.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:a.lineColor,strokeWidth:2});o.insert(()=>p,":first-child").attr("class","ishikawa-head")}else o.insert("path",":first-child").attr("class","ishikawa-head").attr("d",d);l.attr("transform",`translate(${(h-u.width)/2-u.x+3},${-u.y-u.height/2})`)},"drawHead"),air=b((e,t)=>{let r=[],n=[],i=b((a,s,o)=>{let l=t===-1?[...a].reverse():a;for(let u of l){let h=r.length,f=u.children??[];r.push({depth:o,text:gtt(u.text,15),parentIndex:s,childCount:f.length}),o%2===0?(n.push(h),f.length&&i(f,h,o+1)):(f.length&&i(f,h,o+1),n.push(h))}},"walk");return i(e,-1,2),{entries:r,yOrder:n}},"flattenTree"),sir=b((e,t,r,n,i,a,s)=>{let o=e.append("g").attr("class","ishikawa-label-group"),u=KO(o,t,r,n+11*i,"ishikawa-label cause","middle",a).node().getBBox();if(s){let h=s.roughSvg.rectangle(u.x-20,u.y-2,u.width+40,u.height+4,{roughness:1.5,seed:s.seed,fill:s.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:s.lineColor,strokeWidth:2});o.insert(()=>h,":first-child").attr("class","ishikawa-label-box")}else o.insert("rect",":first-child").attr("class","ishikawa-label-box").attr("x",u.x-20).attr("y",u.y-2).attr("width",u.width+40).attr("height",u.height+4)},"drawCauseLabel"),_se=b((e,t,r,n,i,a)=>{let s=Math.sqrt(n*n+i*i);if(s===0)return;let o=n/s,l=i/s,u=6,h=-l*u,f=o*u,d=t,p=r,m=`M ${d} ${p} L ${d-o*u*2+h} ${p-l*u*2+f} L ${d-o*u*2-h} ${p-l*u*2-f} Z`,g=a.roughSvg.path(m,{roughness:1,seed:a.seed,fill:a.lineColor,fillStyle:"solid",stroke:a.lineColor,strokeWidth:1});e.append(()=>g)},"drawArrowMarker"),oir=b((e,t,r,n,i,a,s,o)=>{let l=t.children??[],u=a*(l.length?1:.2),h=-utt*u,f=htt*u*i,d=r+h,p=n+f;if(Tk(e,r,n,d,p,"ishikawa-branch",o),o&&_se(e,r,n,r-d,n-p,o),sir(e,t.text,d,p,i,s,o),!l.length)return;let{entries:m,yOrder:g}=air(l,i),y=m.length,v=new Array(y);for(let[k,S]of g.entries())v[S]=n+f*((k+1)/(y+1));let x=new Map;x.set(-1,{x0:r,y0:n,x1:d,y1:p,childCount:l.length,childrenDrawn:0});let w=-utt,C=htt*i,T=i<0?"ishikawa-label up":"ishikawa-label down";for(let[k,S]of m.entries()){let E=v[k],I=x.get(S.parentIndex),L=e.append("g").attr("class","ishikawa-sub-group"),O=0,R=0,A=0;if(S.depth%2===0){let N=I.y1-I.y0;O=ptt(I.x0,I.x1,N?(E-I.y0)/N:.5),R=E,A=O-(S.childCount>0?tir+S.childCount*rir:eir),Tk(L,O,E,A,E,"ishikawa-sub-branch",o),o&&_se(L,O,E,1,0,o),KO(L,S.text,A,E,"ishikawa-label align","end",s)}else{let N=I.childrenDrawn++;O=ptt(I.x0,I.x1,(I.childCount-N)/(I.childCount+1)),R=I.y0,A=O+w*((E-R)/C),Tk(L,O,R,A,E,"ishikawa-sub-branch",o),o&&_se(L,O,R,O-A,R-E,o),KO(L,S.text,A,E,T,"end",s)}S.childCount>0&&x.set(k,{x0:O,y0:R,x1:A,y1:E,childCount:S.childCount,childrenDrawn:0})}},"drawBranch"),lir=b(e=>e.split(/|\n/),"splitLines"),gtt=b((e,t)=>{if(e.length<=t)return e;let r=[];for(let n of e.split(/\s+/)){let i=r.length-1;i>=0&&r[i].length+1+n.length<=t?r[i]+=" "+n:r.push(n)}return r.join(` +`)},"wrapText"),KO=b((e,t,r,n,i,a,s)=>{let o=lir(t),l=s*1.05,u=e.append("text").attr("class",i).attr("text-anchor",a).attr("x",r).attr("y",n-(o.length-1)*l/2);for(let[h,f]of o.entries())u.append("tspan").attr("x",r).attr("dy",h===0?0:l).text(f);return u},"drawMultilineText"),ptt=b((e,t,r)=>e+(t-e)*r,"lerp"),Tk=b((e,t,r,n,i,a,s)=>{if(s){let o=s.roughSvg.line(t,r,n,i,{roughness:1.5,seed:s.seed,stroke:s.lineColor,strokeWidth:2});e.append(()=>o).attr("class",a);return}return e.append("line").attr("class",a).attr("x1",t).attr("y1",r).attr("x2",n).attr("y2",i)},"drawLine"),cir={draw:nir},uir=b(e=>` .ishikawa .ishikawa-spine, .ishikawa .ishikawa-branch, .ishikawa .ishikawa-sub-branch { @@ -3242,18 +3242,18 @@ Expecting `+Re.join(", ")+", got '"+(this.terminals_[z]||z)+"'":Te="Parse error .ishikawa .ishikawa-label.down { dominant-baseline: hanging; } -`,"getStyles"),oir=sir,lir={parser:Ynr,get db(){return new Xnr},renderer:air,styles:oir}});function ZO(e,t){let r=uir(e),n=r.filter(o=>cir(o,e)),i=0,a=0,s=[];if(n.length>1){let o=btt(n);for(let u=0;uh.angle-u.angle);let l=n[n.length-1];for(let u=0;um.radius*2&&(w=m.radius*2),(d==null||d.width>w)&&(d={circle:m,width:w,p1:h,p2:l,large:w>m.radius,sweep:!0})}d!=null&&(s.push(d),i+=Lse(d.circle.radius,d.width),l=h)}}else{let o=e[0];for(let u=1;uMath.abs(o.radius-e[u].radius)){l=!0;break}l?i=a=0:(i=o.radius*o.radius*Math.PI,s.push({circle:o,p1:{x:o.x,y:o.y+o.radius},p2:{x:o.x-1e-10,y:o.y+o.radius},width:o.radius*2,large:!0,sweep:!0}))}return a/=2,t&&(t.area=i+a,t.arcArea=i,t.polygonArea=a,t.arcs=s,t.innerPoints=n,t.intersectionPoints=r),i+a}function cir(e,t){return t.every(r=>yc(e,r)=e+t)return 0;if(r<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);let n=e-(r*r-t*t+e*e)/(2*r),i=t-(r*r-e*e+t*t)/(2*r);return Lse(e,n)+Lse(t,i)}function xtt(e,t){let r=yc(e,t),n=e.radius,i=t.radius;if(r>=n+i||r<=Math.abs(n-i))return[];let a=(n*n-i*i+r*r)/(2*r),s=Math.sqrt(n*n-a*a),o=e.x+a*(t.x-e.x)/r,l=e.y+a*(t.y-e.y)/r,u=-(t.y-e.y)*(s/r),h=-(t.x-e.x)*(s/r);return[{x:o+u,y:l-h},{x:o-u,y:l+h}]}function btt(e){let t={x:0,y:0};for(let r of e)t.x+=r.x,t.y+=r.y;return t.x/=e.length,t.y/=e.length,t}function hir(e,t,r,n){n=n||{};let i=n.maxIterations||100,a=n.tolerance||1e-10,s=e(t),o=e(r),l=r-t;if(s*o>0)throw"Initial bisect points must have opposite signs";if(s===0)return t;if(o===0)return r;for(let u=0;u=0&&(t=h),Math.abs(l)Ise(t))}function Ck(e,t){let r=0;for(let n=0;nT.fx-k.fx,v=t.slice(),x=t.slice(),w=t.slice(),C=t.slice();for(let T=0;T{let I=E.slice();return I.fx=E.fx,I.id=E.id,I});S.sort((E,I)=>E.id-I.id),r.history.push({x:m[0].slice(),fx:m[0].fx,simplex:S})}d=0;for(let S=0;S=m[p-1].fx){let S=!1;if(x.fx>k.fx?(wp(w,1+h,v,-h,k),w.fx=e(w),w.fx=1)break;for(let E=1;Eo+a*i*l||u>=y)g=i;else{if(Math.abs(f)<=-s*l)return i;f*(g-m)>=0&&(g=m),m=i,y=u}return 0}for(let m=0;m<10;++m){if(wp(n.x,1,r.x,i,t),u=n.fx=e(n.x,n.fxprime),f=Ck(n.fxprime,t),u>o+a*i*l||m&&u>=h)return p(d,i,h);if(Math.abs(f)<=-s*l)return i;if(f>=0)return p(i,d,u);h=u,d=i,i*=2}return i}function dir(e,t,r){let n={x:t.slice(),fx:0,fxprime:t.slice()},i={x:t.slice(),fx:0,fxprime:t.slice()},a=t.slice(),s,o,l=1,u;r=r||{},u=r.maxIterations||t.length*20,n.fx=e(n.x,n.fxprime),s=n.fxprime.slice(),Nse(s,n.fxprime,-1);for(let h=0;h{let f={};for(let d=0;dPse(e,t,n)-r,0,e+t)}function pir(e,t={}){let r=t.distinct,n=e.map(o=>Object.assign({},o));function i(o){return o.join(";")}if(r){let o=new Map;for(let l of n)for(let u=0;uo===l?0:oa.sets.length===2).forEach(a=>{let s=r[a.sets[0]],o=r[a.sets[1]],l=Math.sqrt(t[s].size/Math.PI),u=Math.sqrt(t[o].size/Math.PI),h=Dse(l,u,a.size);n[s][o]=n[o][s]=h;let f=0;a.size+1e-10>=Math.min(t[s].size,t[o].size)?f=1:a.size<=1e-10&&(f=-1),i[s][o]=i[o][s]=f}),{distances:n,constraints:i}}function gir(e,t,r,n){for(let a=0;a0&&m<=f||d<0&&m>=f||(i+=2*g*g,t[2*a]+=4*g*(s-u),t[2*a+1]+=4*g*(o-h),t[2*l]+=4*g*(u-s),t[2*l+1]+=4*g*(h-o))}}return i}function yir(e,t={}){let r=xir(e,t),n=t.lossFunction||Sk;if(e.length>=8){let i=vir(e,t),a=n(i,e),s=n(r,e);a+1e-8d.map(p=>p/o));let l=(d,p)=>gir(d,p,a,s),u=null;for(let d=0;df.sets.length===2);for(let f of e){let d=f.weight!=null?f.weight:1,p=f.sets[0],m=f.sets[1];f.size+Ttt>=Math.min(n[p].size,n[m].size)&&(d=0),i[p].push({set:m,size:f.size,weight:d}),i[m].push({set:p,size:f.size,weight:d})}let a=[];Object.keys(i).forEach(f=>{let d=0;for(let p=0;pe[s]));let a=n.weight!=null?n.weight:1;r+=a*(i-n.size)*(i-n.size)}return r}function Ctt(e,t){let r=0;for(let n of t){if(n.sets.length===1)continue;let i;if(n.sets.length===2){let o=e[n.sets[0]],l=e[n.sets[1]];i=Pse(o.radius,l.radius,yc(o,l))}else i=ZO(n.sets.map(o=>e[o]));let a=n.weight!=null?n.weight:1,s=Math.log((i+1)/(n.size+1));r+=a*s*s}return r}function bir(e,t,r){if(r==null?e.sort((i,a)=>a.radius-i.radius):e.sort(r),e.length>0){let i=e[0].x,a=e[0].y;for(let s of e)s.x-=i,s.y-=a}if(e.length===2&&yc(e[0],e[1])1){let i=Math.atan2(e[1].x,e[1].y)-t,a=Math.cos(i),s=Math.sin(i);for(let o of e){let l=o.x,u=o.y;o.x=a*l-s*u,o.y=s*l+a*u}}if(e.length>2){let i=Math.atan2(e[2].x,e[2].y)-t;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){let a=e[1].y/(1e-10+e[1].x);for(let s of e){var n=(s.x+a*s.y)/(1+a*a);s.x=2*n-s.x,s.y=2*n*a-s.y}}}}function wir(e){e.forEach(i=>{i.parent=i});function t(i){return i.parent!==i&&(i.parent=t(i.parent)),i.parent}function r(i,a){let s=t(i),o=t(a);s.parent=o}for(let i=0;i{delete i.parent}),Array.from(n.values())}function Ose(e){let t=r=>{let n=e.reduce((a,s)=>Math.max(a,s[r]+s.radius),Number.NEGATIVE_INFINITY),i=e.reduce((a,s)=>Math.min(a,s[r]-s.radius),Number.POSITIVE_INFINITY);return{max:n,min:i}};return{xRange:t("x"),yRange:t("y")}}function Stt(e,t,r){t==null&&(t=Math.PI/2);let n=_tt(e).map(u=>Object.assign({},u)),i=wir(n);for(let u of i){bir(u,t,r);let h=Ose(u);u.size=(h.xRange.max-h.xRange.min)*(h.yRange.max-h.yRange.min),u.bounds=h}i.sort((u,h)=>h.size-u.size),n=i[0];let a=n.bounds,s=(a.xRange.max-a.xRange.min)/50;function o(u,h,f){if(!u)return;let d=u.bounds,p,m;if(h)p=a.xRange.max-d.xRange.min+s;else{p=a.xRange.max-d.xRange.max;let g=(d.xRange.max-d.xRange.min)/2-(a.xRange.max-a.xRange.min)/2;g<0&&(p+=g)}if(f)m=a.yRange.max-d.yRange.min+s;else{m=a.yRange.max-d.yRange.max;let g=(d.yRange.max-d.yRange.min)/2-(a.yRange.max-a.yRange.min)/2;g<0&&(m+=g)}for(let g of u)g.x+=p,g.y+=m,n.push(g)}let l=1;for(;l({radius:h*p.radius,x:n+f+(p.x-s.min)*h,y:n+d+(p.y-o.min)*h,setid:p.setid})))}function Att(e){let t={};for(let r of e)t[r.setid]=r;return t}function _tt(e){return Object.keys(e).map(r=>Object.assign(e[r],{setid:r}))}function Rtt(e={}){let t=!1,r=600,n=350,i=15,a=1e3,s=Math.PI/2,o=!0,l=null,u=!0,h=!0,f=null,d=null,p=!1,m=null,g=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,y={},v=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],x=0,w=function(S){if(S in y)return y[S];var E=y[S]=v[x];return x+=1,x>=v.length&&(x=0),E},C=ktt,T=Sk;function k(S){let E=S.datum(),I=new Set;E.forEach(U=>{U.size==0&&U.sets.length==1&&I.add(U.sets[0])}),E=E.filter(U=>!U.sets.some(le=>I.has(le)));let L={},O={};if(E.length>0){let U=C(E,{lossFunction:T,distinct:p});o&&(U=Stt(U,s,d)),L=Ett(U,r,n,i,l),O=Itt(L,E,g)}let R={};E.forEach(U=>{U.label&&(R[U.sets]=U.label)});function A(U){if(U.sets in R)return R[U.sets];if(U.sets.length==1)return""+U.sets[0]}S.selectAll("svg").data([L]).enter().append("svg");let N=S.select("svg");t?N.attr("viewBox",`0 0 ${r} ${n}`):N.attr("width",r).attr("height",n);let M={},D=!1;N.selectAll(".venn-area path").each(function(U){let le=this.getAttribute("d");U.sets.length==1&&le&&!p&&(D=!0,M[U.sets[0]]=Cir(le))});function B(U){return le=>{let ee=U.sets.map(ue=>{let ae=M[ue],oe=L[ue];return ae||(ae={x:r/2,y:n/2,radius:1}),oe||(oe={x:r/2,y:n/2,radius:1}),{x:ae.x*(1-le)+oe.x*le,y:ae.y*(1-le)+oe.y*le,radius:ae.radius*(1-le)+oe.radius*le}});return vtt(ee,m)}}let P=N.selectAll(".venn-area").data(E,U=>U.sets),$=P.enter().append("g").attr("class",U=>`venn-area venn-${U.sets.length==1?"circle":"intersection"}${U.colour||U.color?" venn-coloured":""}`).attr("data-venn-sets",U=>U.sets.join("_")),F=$.append("path"),q=$.append("text").attr("class","label").text(U=>A(U)).attr("text-anchor","middle").attr("dy",".35em").attr("x",r/2).attr("y",n/2);h&&(F.style("fill-opacity","0").filter(U=>U.sets.length==1).style("fill",U=>U.colour?U.colour:U.color?U.color:w(U.sets)).style("fill-opacity",".25"),q.style("fill",U=>U.colour||U.color?"#FFF":e.textFill?e.textFill:U.sets.length==1?w(U.sets):"#444"));function G(U){return typeof U.transition=="function"?U.transition("venn").duration(a):U}let z=S;D&&typeof z.transition=="function"?(z=G(S),z.selectAll("path").attrTween("d",B)):z.selectAll("path").attr("d",U=>vtt(U.sets.map(le=>L[le])),m);let H=z.selectAll("text").filter(U=>U.sets in O).text(U=>A(U)).attr("x",U=>Math.floor(O[U.sets].x)).attr("y",U=>Math.floor(O[U.sets].y));u&&(D?"on"in H?H.on("end",_se(L,A)):H.each("end",_se(L,A)):H.each(_se(L,A)));let j=G(P.exit()).remove();typeof P.transition=="function"&&j.selectAll("path").attrTween("d",B);let J=j.selectAll("text").attr("x",r/2).attr("y",n/2);return f!==null&&(q.style("font-size","0px"),H.style("font-size",f),J.style("font-size","0px")),{circles:L,textCentres:O,nodes:P,enter:$,update:z,exit:j}}return k.wrap=function(S){return arguments.length?(u=S,k):u},k.useViewBox=function(){return t=!0,k},k.width=function(S){return arguments.length?(r=S,k):r},k.height=function(S){return arguments.length?(n=S,k):n},k.padding=function(S){return arguments.length?(i=S,k):i},k.distinct=function(S){return arguments.length?(p=S,k):p},k.colours=function(S){return arguments.length?(w=S,k):w},k.colors=function(S){return arguments.length?(w=S,k):w},k.fontSize=function(S){return arguments.length?(f=S,k):f},k.round=function(S){return arguments.length?(m=S,k):m},k.duration=function(S){return arguments.length?(a=S,k):a},k.layoutFunction=function(S){return arguments.length?(C=S,k):C},k.normalize=function(S){return arguments.length?(o=S,k):o},k.scaleToFit=function(S){return arguments.length?(l=S,k):l},k.styled=function(S){return arguments.length?(h=S,k):h},k.orientation=function(S){return arguments.length?(s=S,k):s},k.orientationOrder=function(S){return arguments.length?(d=S,k):d},k.lossFunction=function(S){return arguments.length?(T=S==="default"?Sk:S==="logRatio"?Ctt:S,k):T},k}function _se(e,t){return function(r){let n=this,i=e[r.sets[0]].radius||50,a=t(r)||"",s=a.split(/\s+/).reverse(),l=(a.length+s.length)/3,u=s.pop(),h=[u],f=0,d=1.1;n.textContent=null;let p=[];function m(w){let C=n.ownerDocument.createElementNS(n.namespaceURI,"tspan");return C.textContent=w,p.push(C),n.append(C),C}let g=m(u);for(;u=s.pop(),!!u;){h.push(u);let w=h.join(" ");g.textContent=w,w.length>l&&g.getComputedTextLength()>i&&(h.pop(),g.textContent=h.join(" "),h=[u],g=m(u),f++)}let y=.35-f*d/2,v=n.getAttribute("x"),x=n.getAttribute("y");p.forEach((w,C)=>{w.setAttribute("x",v),w.setAttribute("y",x),w.setAttribute("dy",`${y+C*d}em`)})}}function Rse(e,t,r){let n=t[0].radius-yc(t[0],e);for(let i=1;i=a&&(i=n[h],a=f)}let s=wtt(h=>-1*Rse({x:h[0],y:h[1]},e,t),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,o={x:r?0:s[0],y:s[1]},l=!0;for(let h of e)if(yc(o,h)>h.radius){l=!1;break}for(let h of t)if(yc(o,h)h.p1))}function kir(e){let t={},r=Object.keys(e);for(let n of r)t[n]=[];for(let n=0;n0&&console.log("WARNING: area "+s+" not represented on screen")}return n}function Tir(e,t,r){let n=[];return n.push(` +`,"getStyles"),hir=uir,fir={parser:Znr,get db(){return new Qnr},renderer:cir,styles:hir}});function ZO(e,t){let r=pir(e),n=r.filter(o=>dir(o,e)),i=0,a=0,s=[];if(n.length>1){let o=ktt(n);for(let u=0;uh.angle-u.angle);let l=n[n.length-1];for(let u=0;um.radius*2&&(w=m.radius*2),(d==null||d.width>w)&&(d={circle:m,width:w,p1:h,p2:l,large:w>m.radius,sweep:!0})}d!=null&&(s.push(d),i+=Mse(d.circle.radius,d.width),l=h)}}else{let o=e[0];for(let u=1;uMath.abs(o.radius-e[u].radius)){l=!0;break}l?i=a=0:(i=o.radius*o.radius*Math.PI,s.push({circle:o,p1:{x:o.x,y:o.y+o.radius},p2:{x:o.x-1e-10,y:o.y+o.radius},width:o.radius*2,large:!0,sweep:!0}))}return a/=2,t&&(t.area=i+a,t.arcArea=i,t.polygonArea=a,t.arcs=s,t.innerPoints=n,t.intersectionPoints=r),i+a}function dir(e,t){return t.every(r=>vc(e,r)=e+t)return 0;if(r<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);let n=e-(r*r-t*t+e*e)/(2*r),i=t-(r*r-e*e+t*t)/(2*r);return Mse(e,n)+Mse(t,i)}function wtt(e,t){let r=vc(e,t),n=e.radius,i=t.radius;if(r>=n+i||r<=Math.abs(n-i))return[];let a=(n*n-i*i+r*r)/(2*r),s=Math.sqrt(n*n-a*a),o=e.x+a*(t.x-e.x)/r,l=e.y+a*(t.y-e.y)/r,u=-(t.y-e.y)*(s/r),h=-(t.x-e.x)*(s/r);return[{x:o+u,y:l-h},{x:o-u,y:l+h}]}function ktt(e){let t={x:0,y:0};for(let r of e)t.x+=r.x,t.y+=r.y;return t.x/=e.length,t.y/=e.length,t}function mir(e,t,r,n){n=n||{};let i=n.maxIterations||100,a=n.tolerance||1e-10,s=e(t),o=e(r),l=r-t;if(s*o>0)throw"Initial bisect points must have opposite signs";if(s===0)return t;if(o===0)return r;for(let u=0;u=0&&(t=h),Math.abs(l)Nse(t))}function Ck(e,t){let r=0;for(let n=0;nT.fx-k.fx,v=t.slice(),x=t.slice(),w=t.slice(),C=t.slice();for(let T=0;T{let I=E.slice();return I.fx=E.fx,I.id=E.id,I});S.sort((E,I)=>E.id-I.id),r.history.push({x:m[0].slice(),fx:m[0].fx,simplex:S})}d=0;for(let S=0;S=m[p-1].fx){let S=!1;if(x.fx>k.fx?(wp(w,1+h,v,-h,k),w.fx=e(w),w.fx=1)break;for(let E=1;Eo+a*i*l||u>=y)g=i;else{if(Math.abs(f)<=-s*l)return i;f*(g-m)>=0&&(g=m),m=i,y=u}return 0}for(let m=0;m<10;++m){if(wp(n.x,1,r.x,i,t),u=n.fx=e(n.x,n.fxprime),f=Ck(n.fxprime,t),u>o+a*i*l||m&&u>=h)return p(d,i,h);if(Math.abs(f)<=-s*l)return i;if(f>=0)return p(i,d,u);h=u,d=i,i*=2}return i}function yir(e,t,r){let n={x:t.slice(),fx:0,fxprime:t.slice()},i={x:t.slice(),fx:0,fxprime:t.slice()},a=t.slice(),s,o,l=1,u;r=r||{},u=r.maxIterations||t.length*20,n.fx=e(n.x,n.fxprime),s=n.fxprime.slice(),Ose(s,n.fxprime,-1);for(let h=0;h{let f={};for(let d=0;dFse(e,t,n)-r,0,e+t)}function vir(e,t={}){let r=t.distinct,n=e.map(o=>Object.assign({},o));function i(o){return o.join(";")}if(r){let o=new Map;for(let l of n)for(let u=0;uo===l?0:oa.sets.length===2).forEach(a=>{let s=r[a.sets[0]],o=r[a.sets[1]],l=Math.sqrt(t[s].size/Math.PI),u=Math.sqrt(t[o].size/Math.PI),h=Pse(l,u,a.size);n[s][o]=n[o][s]=h;let f=0;a.size+1e-10>=Math.min(t[s].size,t[o].size)?f=1:a.size<=1e-10&&(f=-1),i[s][o]=i[o][s]=f}),{distances:n,constraints:i}}function bir(e,t,r,n){for(let a=0;a0&&m<=f||d<0&&m>=f||(i+=2*g*g,t[2*a]+=4*g*(s-u),t[2*a+1]+=4*g*(o-h),t[2*l]+=4*g*(u-s),t[2*l+1]+=4*g*(h-o))}}return i}function wir(e,t={}){let r=Tir(e,t),n=t.lossFunction||Sk;if(e.length>=8){let i=kir(e,t),a=n(i,e),s=n(r,e);a+1e-8d.map(p=>p/o));let l=(d,p)=>bir(d,p,a,s),u=null;for(let d=0;df.sets.length===2);for(let f of e){let d=f.weight!=null?f.weight:1,p=f.sets[0],m=f.sets[1];f.size+Stt>=Math.min(n[p].size,n[m].size)&&(d=0),i[p].push({set:m,size:f.size,weight:d}),i[m].push({set:p,size:f.size,weight:d})}let a=[];Object.keys(i).forEach(f=>{let d=0;for(let p=0;pe[s]));let a=n.weight!=null?n.weight:1;r+=a*(i-n.size)*(i-n.size)}return r}function Ett(e,t){let r=0;for(let n of t){if(n.sets.length===1)continue;let i;if(n.sets.length===2){let o=e[n.sets[0]],l=e[n.sets[1]];i=Fse(o.radius,l.radius,vc(o,l))}else i=ZO(n.sets.map(o=>e[o]));let a=n.weight!=null?n.weight:1,s=Math.log((i+1)/(n.size+1));r+=a*s*s}return r}function Cir(e,t,r){if(r==null?e.sort((i,a)=>a.radius-i.radius):e.sort(r),e.length>0){let i=e[0].x,a=e[0].y;for(let s of e)s.x-=i,s.y-=a}if(e.length===2&&vc(e[0],e[1])1){let i=Math.atan2(e[1].x,e[1].y)-t,a=Math.cos(i),s=Math.sin(i);for(let o of e){let l=o.x,u=o.y;o.x=a*l-s*u,o.y=s*l+a*u}}if(e.length>2){let i=Math.atan2(e[2].x,e[2].y)-t;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){let a=e[1].y/(1e-10+e[1].x);for(let s of e){var n=(s.x+a*s.y)/(1+a*a);s.x=2*n-s.x,s.y=2*n*a-s.y}}}}function Sir(e){e.forEach(i=>{i.parent=i});function t(i){return i.parent!==i&&(i.parent=t(i.parent)),i.parent}function r(i,a){let s=t(i),o=t(a);s.parent=o}for(let i=0;i{delete i.parent}),Array.from(n.values())}function Bse(e){let t=r=>{let n=e.reduce((a,s)=>Math.max(a,s[r]+s.radius),Number.NEGATIVE_INFINITY),i=e.reduce((a,s)=>Math.min(a,s[r]-s.radius),Number.POSITIVE_INFINITY);return{max:n,min:i}};return{xRange:t("x"),yRange:t("y")}}function Att(e,t,r){t==null&&(t=Math.PI/2);let n=Ltt(e).map(u=>Object.assign({},u)),i=Sir(n);for(let u of i){Cir(u,t,r);let h=Bse(u);u.size=(h.xRange.max-h.xRange.min)*(h.yRange.max-h.yRange.min),u.bounds=h}i.sort((u,h)=>h.size-u.size),n=i[0];let a=n.bounds,s=(a.xRange.max-a.xRange.min)/50;function o(u,h,f){if(!u)return;let d=u.bounds,p,m;if(h)p=a.xRange.max-d.xRange.min+s;else{p=a.xRange.max-d.xRange.max;let g=(d.xRange.max-d.xRange.min)/2-(a.xRange.max-a.xRange.min)/2;g<0&&(p+=g)}if(f)m=a.yRange.max-d.yRange.min+s;else{m=a.yRange.max-d.yRange.max;let g=(d.yRange.max-d.yRange.min)/2-(a.yRange.max-a.yRange.min)/2;g<0&&(m+=g)}for(let g of u)g.x+=p,g.y+=m,n.push(g)}let l=1;for(;l({radius:h*p.radius,x:n+f+(p.x-s.min)*h,y:n+d+(p.y-o.min)*h,setid:p.setid})))}function Rtt(e){let t={};for(let r of e)t[r.setid]=r;return t}function Ltt(e){return Object.keys(e).map(r=>Object.assign(e[r],{setid:r}))}function Itt(e={}){let t=!1,r=600,n=350,i=15,a=1e3,s=Math.PI/2,o=!0,l=null,u=!0,h=!0,f=null,d=null,p=!1,m=null,g=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,y={},v=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],x=0,w=function(S){if(S in y)return y[S];var E=y[S]=v[x];return x+=1,x>=v.length&&(x=0),E},C=Ctt,T=Sk;function k(S){let E=S.datum(),I=new Set;E.forEach(U=>{U.size==0&&U.sets.length==1&&I.add(U.sets[0])}),E=E.filter(U=>!U.sets.some(le=>I.has(le)));let L={},O={};if(E.length>0){let U=C(E,{lossFunction:T,distinct:p});o&&(U=Att(U,s,d)),L=_tt(U,r,n,i,l),O=Ntt(L,E,g)}let R={};E.forEach(U=>{U.label&&(R[U.sets]=U.label)});function A(U){if(U.sets in R)return R[U.sets];if(U.sets.length==1)return""+U.sets[0]}S.selectAll("svg").data([L]).enter().append("svg");let N=S.select("svg");t?N.attr("viewBox",`0 0 ${r} ${n}`):N.attr("width",r).attr("height",n);let M={},D=!1;N.selectAll(".venn-area path").each(function(U){let le=this.getAttribute("d");U.sets.length==1&&le&&!p&&(D=!0,M[U.sets[0]]=_ir(le))});function B(U){return le=>{let ee=U.sets.map(ue=>{let ae=M[ue],oe=L[ue];return ae||(ae={x:r/2,y:n/2,radius:1}),oe||(oe={x:r/2,y:n/2,radius:1}),{x:ae.x*(1-le)+oe.x*le,y:ae.y*(1-le)+oe.y*le,radius:ae.radius*(1-le)+oe.radius*le}});return btt(ee,m)}}let P=N.selectAll(".venn-area").data(E,U=>U.sets),$=P.enter().append("g").attr("class",U=>`venn-area venn-${U.sets.length==1?"circle":"intersection"}${U.colour||U.color?" venn-coloured":""}`).attr("data-venn-sets",U=>U.sets.join("_")),F=$.append("path"),q=$.append("text").attr("class","label").text(U=>A(U)).attr("text-anchor","middle").attr("dy",".35em").attr("x",r/2).attr("y",n/2);h&&(F.style("fill-opacity","0").filter(U=>U.sets.length==1).style("fill",U=>U.colour?U.colour:U.color?U.color:w(U.sets)).style("fill-opacity",".25"),q.style("fill",U=>U.colour||U.color?"#FFF":e.textFill?e.textFill:U.sets.length==1?w(U.sets):"#444"));function G(U){return typeof U.transition=="function"?U.transition("venn").duration(a):U}let z=S;D&&typeof z.transition=="function"?(z=G(S),z.selectAll("path").attrTween("d",B)):z.selectAll("path").attr("d",U=>btt(U.sets.map(le=>L[le])),m);let H=z.selectAll("text").filter(U=>U.sets in O).text(U=>A(U)).attr("x",U=>Math.floor(O[U.sets].x)).attr("y",U=>Math.floor(O[U.sets].y));u&&(D?"on"in H?H.on("end",Lse(L,A)):H.each("end",Lse(L,A)):H.each(Lse(L,A)));let j=G(P.exit()).remove();typeof P.transition=="function"&&j.selectAll("path").attrTween("d",B);let J=j.selectAll("text").attr("x",r/2).attr("y",n/2);return f!==null&&(q.style("font-size","0px"),H.style("font-size",f),J.style("font-size","0px")),{circles:L,textCentres:O,nodes:P,enter:$,update:z,exit:j}}return k.wrap=function(S){return arguments.length?(u=S,k):u},k.useViewBox=function(){return t=!0,k},k.width=function(S){return arguments.length?(r=S,k):r},k.height=function(S){return arguments.length?(n=S,k):n},k.padding=function(S){return arguments.length?(i=S,k):i},k.distinct=function(S){return arguments.length?(p=S,k):p},k.colours=function(S){return arguments.length?(w=S,k):w},k.colors=function(S){return arguments.length?(w=S,k):w},k.fontSize=function(S){return arguments.length?(f=S,k):f},k.round=function(S){return arguments.length?(m=S,k):m},k.duration=function(S){return arguments.length?(a=S,k):a},k.layoutFunction=function(S){return arguments.length?(C=S,k):C},k.normalize=function(S){return arguments.length?(o=S,k):o},k.scaleToFit=function(S){return arguments.length?(l=S,k):l},k.styled=function(S){return arguments.length?(h=S,k):h},k.orientation=function(S){return arguments.length?(s=S,k):s},k.orientationOrder=function(S){return arguments.length?(d=S,k):d},k.lossFunction=function(S){return arguments.length?(T=S==="default"?Sk:S==="logRatio"?Ett:S,k):T},k}function Lse(e,t){return function(r){let n=this,i=e[r.sets[0]].radius||50,a=t(r)||"",s=a.split(/\s+/).reverse(),l=(a.length+s.length)/3,u=s.pop(),h=[u],f=0,d=1.1;n.textContent=null;let p=[];function m(w){let C=n.ownerDocument.createElementNS(n.namespaceURI,"tspan");return C.textContent=w,p.push(C),n.append(C),C}let g=m(u);for(;u=s.pop(),!!u;){h.push(u);let w=h.join(" ");g.textContent=w,w.length>l&&g.getComputedTextLength()>i&&(h.pop(),g.textContent=h.join(" "),h=[u],g=m(u),f++)}let y=.35-f*d/2,v=n.getAttribute("x"),x=n.getAttribute("y");p.forEach((w,C)=>{w.setAttribute("x",v),w.setAttribute("y",x),w.setAttribute("dy",`${y+C*d}em`)})}}function Ise(e,t,r){let n=t[0].radius-vc(t[0],e);for(let i=1;i=a&&(i=n[h],a=f)}let s=Ttt(h=>-1*Ise({x:h[0],y:h[1]},e,t),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,o={x:r?0:s[0],y:s[1]},l=!0;for(let h of e)if(vc(o,h)>h.radius){l=!1;break}for(let h of t)if(vc(o,h)h.p1))}function Eir(e){let t={},r=Object.keys(e);for(let n of r)t[n]=[];for(let n=0;n0&&console.log("WARNING: area "+s+" not represented on screen")}return n}function Air(e,t,r){let n=[];return n.push(` M`,e,t),n.push(` m`,-r,0),n.push(` a`,r,r,0,1,0,r*2,0),n.push(` -a`,r,r,0,1,0,-r*2,0),n.join(" ")}function Cir(e){let t=e.split(" ");return{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),radius:-Number.parseFloat(t[4])}}function Mtt(e){if(e.length===0)return[];let t={};return ZO(e,t),t.arcs}function Ntt(e,t){if(e.length===0)return"M 0 0";let r=Math.pow(10,t||0),n=t!=null?a=>Math.round(a*r)/r:a=>a;if(e.length==1){let a=e[0].circle;return Tir(n(a.x),n(a.y),n(a.radius))}let i=[` +a`,r,r,0,1,0,-r*2,0),n.join(" ")}function _ir(e){let t=e.split(" ");return{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),radius:-Number.parseFloat(t[4])}}function Dtt(e){if(e.length===0)return[];let t={};return ZO(e,t),t.arcs}function Ott(e,t){if(e.length===0)return"M 0 0";let r=Math.pow(10,t||0),n=t!=null?a=>Math.round(a*r)/r:a=>a;if(e.length==1){let a=e[0].circle;return Air(n(a.x),n(a.y),n(a.radius))}let i=[` M`,n(e[0].p2.x),n(e[0].p2.y)];for(let a of e){let s=n(a.circle.radius);i.push(` -A`,s,s,0,a.large?1:0,a.sweep?1:0,n(a.p1.x),n(a.p1.y))}return i.join(" ")}function vtt(e,t){return Ntt(Mtt(e),t)}function Dtt(e,t={}){let{lossFunction:r,layoutFunction:n=ktt,normalize:i=!0,orientation:a=Math.PI/2,orientationOrder:s,width:o=600,height:l=350,padding:u=15,scaleToFit:h=!1,symmetricalTextCentre:f=!1,distinct:d,round:p=2}=t,m=n(e,{lossFunction:r==="default"||!r?Sk:r==="logRatio"?Ctt:r,distinct:d});i&&(m=Stt(m,a,s));let g=Ett(m,o,l,u,h),y=Itt(g,e,f),v=new Map(Object.keys(g).map(C=>[C,{set:C,x:g[C].x,y:g[C].y,radius:g[C].radius}])),x=e.map(C=>{let T=C.sets.map(E=>v.get(E)),k=Mtt(T),S=Ntt(k,p);return{circles:T,arcs:k,path:S,area:C,has:new Set(C.sets)}});function w(C){let T="";for(let k of x)k.has.size>C.length&&C.every(S=>k.has.has(S))&&(T+=" "+k.path);return T}return x.map(({circles:C,arcs:T,path:k,area:S})=>({data:S,text:y[S.sets],circles:C,arcs:T,path:k,distinctPath:k+w(S.sets)}))}var Ttt,Ott=W(()=>{Ttt=1e-10});var ztt={};Tr(ztt,{diagram:()=>Hir});function Ptt(){return Rn(Fir,qt().venn)}function Btt(e){let t=new Map;for(let r of e){let n=r.targets.join("|"),i=t.get(n);i?Object.assign(i,r.styles):t.set(n,{...r.styles})}return t}function n1(e){return e.join("|")}function Ftt(e,t,r,n,i,a){let s=e?.useDebugLayout??!1,l=r.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(let h of n){let f=n1(h.sets),d=u.get(f);d?d.push(h):u.set(f,[h])}for(let[h,f]of u.entries()){let d=t.get(h);if(!d?.text)continue;let p=d.text.x,m=d.text.y,g=Math.min(...d.circles.map(N=>N.radius)),y=Math.min(...d.circles.map(N=>N.radius-Math.hypot(p-N.x,m-N.y))),v=Number.isFinite(y)?Math.max(0,y):0;v===0&&Number.isFinite(g)&&(v=g*.6);let x=l.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);s&&x.append("circle").attr("class","venn-text-debug-circle").attr("cx",p).attr("cy",m).attr("r",v).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);let w=Math.max(80*i,v*2*.95),C=Math.max(60*i,v*2*.95),S=(d.data.label&&d.data.label.length>0?Math.min(32*i,v*.25):0)+(f.length<=2?30*i:0),E=p-w/2,I=m-C/2+S,L=Math.max(1,Math.ceil(Math.sqrt(f.length))),O=Math.max(1,Math.ceil(f.length/L)),R=w/L,A=C/O;for(let[N,M]of f.entries()){let D=N%L,B=Math.floor(N/L),P=E+R*(D+.5),$=I+A*(B+.5);s&&x.append("rect").attr("class","venn-text-debug-cell").attr("x",E+R*D).attr("y",I+A*B).attr("width",R).attr("height",A).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);let F=R*.9,q=A*.9,G=x.append("foreignObject").attr("class","venn-text-node-fo").attr("width",F).attr("height",q).attr("x",P-F/2).attr("y",$-q/2).attr("overflow","visible"),z=a.get(M.id)?.color,H=G.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(M.label??M.id);z&&H.style("color",z)}}}function $tt(e){let t=new Set(e.map(i=>[...i.sets].sort().join("|"))),r=new Map(e.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),n=[];for(let i of e){if(i.sets.length<3)continue;let a=[...i.sets].sort();for(let s=0;s0?[...e,...n]:e}var Bse,Eir,Fse,$se,zse,Gse,qse,Vse,Air,_ir,Z6,Rir,Lir,Iir,Mir,QO,Nir,Dir,Oir,Pir,Bir,Fir,$ir,zir,Gir,qir,Vir,Wir,Hir,Gtt=W(()=>{za();Sn();_r();Rr();hr();fn();Ka();Ott();dr();Bse=(function(){var e=b(function(x,w,C,T){for(C=C||{},T=x.length;T--;C[x[T]]=w);return C},"o"),t=[5,8],r=[7,8,11,12,17,19,22,24],n=[1,17],i=[1,18],a=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],s=[1,31],o=[1,39],l=[7,8,11,12,17,19,22,24,27],u=[1,57],h=[1,56],f=[1,58],d=[1,59],p=[1,60],m=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:b(function(w,C,T,k,S,E,I){var L=E.length-1;switch(S){case 1:return E[L-1];case 2:case 3:case 4:this.$=[];break;case 5:E[L-1].push(E[L]),this.$=E[L-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=E[L];break;case 8:k.setDiagramTitle(E[L].substr(6)),this.$=E[L].substr(6);break;case 9:k.addSubsetData([E[L]],void 0,void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 10:k.addSubsetData([E[L-1]],E[L],void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 11:k.addSubsetData([E[L-2]],void 0,parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 12:k.addSubsetData([E[L-3]],E[L-2],parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 13:if(E[L].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L]),k.addSubsetData(E[L],void 0,void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 14:if(E[L-1].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L-1]),k.addSubsetData(E[L-1],E[L],void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 15:if(E[L-2].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L-2]),k.addSubsetData(E[L-2],void 0,parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 16:if(E[L-3].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L-3]),k.addSubsetData(E[L-3],E[L-2],parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 17:case 18:case 19:k.addTextData(E[L-1],E[L],void 0);break;case 20:case 21:k.addTextData(E[L-2],E[L-1],E[L]);break;case 23:k.addStyleData(E[L-1],E[L]);break;case 24:case 25:case 26:var O=k.getCurrentSets();if(!O)throw new Error("text requires set");k.addTextData(O,E[L],void 0);break;case 27:case 28:var O=k.getCurrentSets();if(!O)throw new Error("text requires set");k.addTextData(O,E[L-1],E[L]);break;case 29:case 41:this.$=[E[L]];break;case 30:case 42:this.$=[...E[L-2],E[L]];break;case 31:this.$=[E[L-2],E[L]];break;case 33:this.$=E[L].join(" ");break;case 34:this.$=[E[L]];break;case 35:E[L-1].push(E[L]),this.$=E[L-1];break;case 43:case 44:this.$=E[L];break}},"anonymous"),table:[e(t,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},e(r,[2,4],{6:5}),e(t,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},e(r,[2,5]),e(r,[2,6]),e(r,[2,7]),e(r,[2,8]),{13:16,20:n,21:i},{13:20,18:19,20:n,21:i},{13:20,18:21,20:n,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:n,21:i},e(r,[2,9],{14:[1,27],15:[1,28]}),e(a,[2,43]),e(a,[2,44]),e(r,[2,13],{14:[1,29],15:[1,30],27:s}),e(a,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:s},e(r,[2,22]),e(r,[2,24],{14:[1,35]}),e(r,[2,25],{14:[1,36]}),e(r,[2,26]),{20:o,25:37,26:38,27:s},e(r,[2,10],{15:[1,40]}),{16:[1,41]},e(r,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:n,21:i},e(r,[2,17],{14:[1,45]}),e(r,[2,18],{14:[1,46]}),e(r,[2,19]),e(r,[2,27]),e(r,[2,28]),e(r,[2,23],{27:[1,47]}),e(l,[2,29]),{15:[1,48]},{16:[1,49]},e(r,[2,11]),{16:[1,50]},e(r,[2,15]),e(a,[2,42]),e(r,[2,20]),e(r,[2,21]),{20:o,26:51},{16:u,20:h,21:[1,53],28:52,29:54,30:55,31:f,32:d,33:p},e(r,[2,12]),e(r,[2,16]),e(l,[2,30]),e(l,[2,31]),e(l,[2,32]),e(l,[2,33],{30:61,16:u,20:h,31:f,32:d,33:p}),e(m,[2,34]),e(m,[2,36]),e(m,[2,37]),e(m,[2,38]),e(m,[2,39]),e(m,[2,40]),e(m,[2,35])],defaultActions:{6:[2,1]},parseError:b(function(w,C){if(C.recoverable)this.trace(w);else{var T=new Error(w);throw T.hash=C,T}},"parseError"),parse:b(function(w){var C=this,T=[0],k=[],S=[null],E=[],I=this.table,L="",O=0,R=0,A=0,N=2,M=1,D=E.slice.call(arguments,1),B=Object.create(this.lexer),P={yy:{}};for(var $ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,$)&&(P.yy[$]=this.yy[$]);B.setInput(w,P.yy),P.yy.lexer=B,P.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var F=B.yylloc;E.push(F);var q=B.options&&B.options.ranges;typeof P.yy.parseError=="function"?this.parseError=P.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function G(qe){T.length=T.length-2*qe,S.length=S.length-qe,E.length=E.length-qe}b(G,"popStack");function z(){var qe;return qe=k.pop()||B.lex()||M,typeof qe!="number"&&(qe instanceof Array&&(k=qe,qe=k.pop()),qe=C.symbols_[qe]||qe),qe}b(z,"lex");for(var H,j,J,U,le,ee,ue={},ae,oe,Re,Te;;){if(J=T[T.length-1],this.defaultActions[J]?U=this.defaultActions[J]:((H===null||typeof H>"u")&&(H=z()),U=I[J]&&I[J][H]),typeof U>"u"||!U.length||!U[0]){var Oe="";Te=[];for(ae in I[J])this.terminals_[ae]&&ae>N&&Te.push("'"+this.terminals_[ae]+"'");B.showPosition?Oe="Parse error on line "+(O+1)+`: +A`,s,s,0,a.large?1:0,a.sweep?1:0,n(a.p1.x),n(a.p1.y))}return i.join(" ")}function btt(e,t){return Ott(Dtt(e),t)}function Ptt(e,t={}){let{lossFunction:r,layoutFunction:n=Ctt,normalize:i=!0,orientation:a=Math.PI/2,orientationOrder:s,width:o=600,height:l=350,padding:u=15,scaleToFit:h=!1,symmetricalTextCentre:f=!1,distinct:d,round:p=2}=t,m=n(e,{lossFunction:r==="default"||!r?Sk:r==="logRatio"?Ett:r,distinct:d});i&&(m=Att(m,a,s));let g=_tt(m,o,l,u,h),y=Ntt(g,e,f),v=new Map(Object.keys(g).map(C=>[C,{set:C,x:g[C].x,y:g[C].y,radius:g[C].radius}])),x=e.map(C=>{let T=C.sets.map(E=>v.get(E)),k=Dtt(T),S=Ott(k,p);return{circles:T,arcs:k,path:S,area:C,has:new Set(C.sets)}});function w(C){let T="";for(let k of x)k.has.size>C.length&&C.every(S=>k.has.has(S))&&(T+=" "+k.path);return T}return x.map(({circles:C,arcs:T,path:k,area:S})=>({data:S,text:y[S.sets],circles:C,arcs:T,path:k,distinctPath:k+w(S.sets)}))}var Stt,Btt=W(()=>{Stt=1e-10});var qtt={};Tr(qtt,{diagram:()=>jir});function Ftt(){return Rn(qir,qt().venn)}function $tt(e){let t=new Map;for(let r of e){let n=r.targets.join("|"),i=t.get(n);i?Object.assign(i,r.styles):t.set(n,{...r.styles})}return t}function n1(e){return e.join("|")}function ztt(e,t,r,n,i,a){let s=e?.useDebugLayout??!1,l=r.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(let h of n){let f=n1(h.sets),d=u.get(f);d?d.push(h):u.set(f,[h])}for(let[h,f]of u.entries()){let d=t.get(h);if(!d?.text)continue;let p=d.text.x,m=d.text.y,g=Math.min(...d.circles.map(N=>N.radius)),y=Math.min(...d.circles.map(N=>N.radius-Math.hypot(p-N.x,m-N.y))),v=Number.isFinite(y)?Math.max(0,y):0;v===0&&Number.isFinite(g)&&(v=g*.6);let x=l.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);s&&x.append("circle").attr("class","venn-text-debug-circle").attr("cx",p).attr("cy",m).attr("r",v).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);let w=Math.max(80*i,v*2*.95),C=Math.max(60*i,v*2*.95),S=(d.data.label&&d.data.label.length>0?Math.min(32*i,v*.25):0)+(f.length<=2?30*i:0),E=p-w/2,I=m-C/2+S,L=Math.max(1,Math.ceil(Math.sqrt(f.length))),O=Math.max(1,Math.ceil(f.length/L)),R=w/L,A=C/O;for(let[N,M]of f.entries()){let D=N%L,B=Math.floor(N/L),P=E+R*(D+.5),$=I+A*(B+.5);s&&x.append("rect").attr("class","venn-text-debug-cell").attr("x",E+R*D).attr("y",I+A*B).attr("width",R).attr("height",A).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);let F=R*.9,q=A*.9,G=x.append("foreignObject").attr("class","venn-text-node-fo").attr("width",F).attr("height",q).attr("x",P-F/2).attr("y",$-q/2).attr("overflow","visible"),z=a.get(M.id)?.color,H=G.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(M.label??M.id);z&&H.style("color",z)}}}function Gtt(e){let t=new Set(e.map(i=>[...i.sets].sort().join("|"))),r=new Map(e.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),n=[];for(let i of e){if(i.sets.length<3)continue;let a=[...i.sets].sort();for(let s=0;s0?[...e,...n]:e}var $se,Lir,zse,Gse,qse,Vse,Wse,Hse,Iir,Mir,Z6,Nir,Dir,Oir,Pir,QO,Bir,Fir,$ir,zir,Gir,qir,Vir,Wir,Hir,Uir,Yir,Xir,jir,Vtt=W(()=>{za();Sn();_r();Rr();hr();fn();Ka();Btt();dr();$se=(function(){var e=b(function(x,w,C,T){for(C=C||{},T=x.length;T--;C[x[T]]=w);return C},"o"),t=[5,8],r=[7,8,11,12,17,19,22,24],n=[1,17],i=[1,18],a=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],s=[1,31],o=[1,39],l=[7,8,11,12,17,19,22,24,27],u=[1,57],h=[1,56],f=[1,58],d=[1,59],p=[1,60],m=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:b(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:b(function(w,C,T,k,S,E,I){var L=E.length-1;switch(S){case 1:return E[L-1];case 2:case 3:case 4:this.$=[];break;case 5:E[L-1].push(E[L]),this.$=E[L-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=E[L];break;case 8:k.setDiagramTitle(E[L].substr(6)),this.$=E[L].substr(6);break;case 9:k.addSubsetData([E[L]],void 0,void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 10:k.addSubsetData([E[L-1]],E[L],void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 11:k.addSubsetData([E[L-2]],void 0,parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 12:k.addSubsetData([E[L-3]],E[L-2],parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 13:if(E[L].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L]),k.addSubsetData(E[L],void 0,void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 14:if(E[L-1].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L-1]),k.addSubsetData(E[L-1],E[L],void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 15:if(E[L-2].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L-2]),k.addSubsetData(E[L-2],void 0,parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 16:if(E[L-3].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(E[L-3]),k.addSubsetData(E[L-3],E[L-2],parseFloat(E[L])),k.setIndentMode&&k.setIndentMode(!0);break;case 17:case 18:case 19:k.addTextData(E[L-1],E[L],void 0);break;case 20:case 21:k.addTextData(E[L-2],E[L-1],E[L]);break;case 23:k.addStyleData(E[L-1],E[L]);break;case 24:case 25:case 26:var O=k.getCurrentSets();if(!O)throw new Error("text requires set");k.addTextData(O,E[L],void 0);break;case 27:case 28:var O=k.getCurrentSets();if(!O)throw new Error("text requires set");k.addTextData(O,E[L-1],E[L]);break;case 29:case 41:this.$=[E[L]];break;case 30:case 42:this.$=[...E[L-2],E[L]];break;case 31:this.$=[E[L-2],E[L]];break;case 33:this.$=E[L].join(" ");break;case 34:this.$=[E[L]];break;case 35:E[L-1].push(E[L]),this.$=E[L-1];break;case 43:case 44:this.$=E[L];break}},"anonymous"),table:[e(t,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},e(r,[2,4],{6:5}),e(t,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},e(r,[2,5]),e(r,[2,6]),e(r,[2,7]),e(r,[2,8]),{13:16,20:n,21:i},{13:20,18:19,20:n,21:i},{13:20,18:21,20:n,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:n,21:i},e(r,[2,9],{14:[1,27],15:[1,28]}),e(a,[2,43]),e(a,[2,44]),e(r,[2,13],{14:[1,29],15:[1,30],27:s}),e(a,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:s},e(r,[2,22]),e(r,[2,24],{14:[1,35]}),e(r,[2,25],{14:[1,36]}),e(r,[2,26]),{20:o,25:37,26:38,27:s},e(r,[2,10],{15:[1,40]}),{16:[1,41]},e(r,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:n,21:i},e(r,[2,17],{14:[1,45]}),e(r,[2,18],{14:[1,46]}),e(r,[2,19]),e(r,[2,27]),e(r,[2,28]),e(r,[2,23],{27:[1,47]}),e(l,[2,29]),{15:[1,48]},{16:[1,49]},e(r,[2,11]),{16:[1,50]},e(r,[2,15]),e(a,[2,42]),e(r,[2,20]),e(r,[2,21]),{20:o,26:51},{16:u,20:h,21:[1,53],28:52,29:54,30:55,31:f,32:d,33:p},e(r,[2,12]),e(r,[2,16]),e(l,[2,30]),e(l,[2,31]),e(l,[2,32]),e(l,[2,33],{30:61,16:u,20:h,31:f,32:d,33:p}),e(m,[2,34]),e(m,[2,36]),e(m,[2,37]),e(m,[2,38]),e(m,[2,39]),e(m,[2,40]),e(m,[2,35])],defaultActions:{6:[2,1]},parseError:b(function(w,C){if(C.recoverable)this.trace(w);else{var T=new Error(w);throw T.hash=C,T}},"parseError"),parse:b(function(w){var C=this,T=[0],k=[],S=[null],E=[],I=this.table,L="",O=0,R=0,A=0,N=2,M=1,D=E.slice.call(arguments,1),B=Object.create(this.lexer),P={yy:{}};for(var $ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,$)&&(P.yy[$]=this.yy[$]);B.setInput(w,P.yy),P.yy.lexer=B,P.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var F=B.yylloc;E.push(F);var q=B.options&&B.options.ranges;typeof P.yy.parseError=="function"?this.parseError=P.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function G(qe){T.length=T.length-2*qe,S.length=S.length-qe,E.length=E.length-qe}b(G,"popStack");function z(){var qe;return qe=k.pop()||B.lex()||M,typeof qe!="number"&&(qe instanceof Array&&(k=qe,qe=k.pop()),qe=C.symbols_[qe]||qe),qe}b(z,"lex");for(var H,j,J,U,le,ee,ue={},ae,oe,Re,Te;;){if(J=T[T.length-1],this.defaultActions[J]?U=this.defaultActions[J]:((H===null||typeof H>"u")&&(H=z()),U=I[J]&&I[J][H]),typeof U>"u"||!U.length||!U[0]){var Oe="";Te=[];for(ae in I[J])this.terminals_[ae]&&ae>N&&Te.push("'"+this.terminals_[ae]+"'");B.showPosition?Oe="Parse error on line "+(O+1)+`: `+B.showPosition()+` Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":Oe="Parse error on line "+(O+1)+": Unexpected "+(H==M?"end of input":"'"+(this.terminals_[H]||H)+"'"),this.parseError(Oe,{text:B.match,token:this.terminals_[H]||H,line:B.yylineno,loc:F,expected:Te})}if(U[0]instanceof Array&&U.length>1)throw new Error("Parse Error: multiple actions possible at state: "+J+", token: "+H);switch(U[0]){case 1:T.push(H),S.push(B.yytext),E.push(B.yylloc),T.push(U[1]),H=null,j?(H=j,j=null):(R=B.yyleng,L=B.yytext,O=B.yylineno,F=B.yylloc,A>0&&A--);break;case 2:if(oe=this.productions_[U[1]][1],ue.$=S[S.length-oe],ue._$={first_line:E[E.length-(oe||1)].first_line,last_line:E[E.length-1].last_line,first_column:E[E.length-(oe||1)].first_column,last_column:E[E.length-1].last_column},q&&(ue._$.range=[E[E.length-(oe||1)].range[0],E[E.length-1].range[1]]),ee=this.performAction.apply(ue,[L,R,O,P.yy,U[1],S,E].concat(D)),typeof ee<"u")return ee;oe&&(T=T.slice(0,-1*oe*2),S=S.slice(0,-1*oe),E=E.slice(0,-1*oe)),T.push(this.productions_[U[1]][0]),S.push(ue.$),E.push(ue._$),Re=I[T[T.length-2]][T[T.length-1]],T.push(Re);break;case 3:return!0}}return!0},"parse")},y=(function(){var x={EOF:1,parseError:b(function(C,T){if(this.yy.parser)this.yy.parser.parseError(C,T);else throw new Error(C)},"parseError"),setInput:b(function(w,C){return this.yy=C||this.yy||{},this._input=w,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:b(function(){var w=this._input[0];this.yytext+=w,this.yyleng++,this.offset++,this.match+=w,this.matched+=w;var C=w.match(/(?:\r\n?|\n).*/g);return C?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),w},"input"),unput:b(function(w){var C=w.length,T=w.split(/(?:\r\n?|\n)/g);this._input=w+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-C),this.offset-=C;var k=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),T.length-1&&(this.yylineno-=T.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:T?(T.length===k.length?this.yylloc.first_column:0)+k[k.length-T.length].length-T[0].length:this.yylloc.first_column-C},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-C]),this.yyleng=this.yytext.length,this},"unput"),more:b(function(){return this._more=!0,this},"more"),reject:b(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:b(function(w){this.unput(this.match.slice(w))},"less"),pastInput:b(function(){var w=this.matched.substr(0,this.matched.length-this.match.length);return(w.length>20?"...":"")+w.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:b(function(){var w=this.match;return w.length<20&&(w+=this._input.substr(0,20-w.length)),(w.substr(0,20)+(w.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:b(function(){var w=this.pastInput(),C=new Array(w.length+1).join("-");return w+this.upcomingInput()+` `+C+"^"},"showPosition"),test_match:b(function(w,C){var T,k,S;if(this.options.backtrack_lexer&&(S={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(S.yylloc.range=this.yylloc.range.slice(0))),k=w[0].match(/(?:\r\n?|\n).*/g),k&&(this.yylineno+=k.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:k?k[k.length-1].length-k[k.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+w[0].length},this.yytext+=w[0],this.match+=w[0],this.matches=w,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(w[0].length),this.matched+=w[0],T=this.performAction.call(this,this.yy,this,C,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),T)return T;if(this._backtrack){for(var E in S)this[E]=S[E];return!1}return!1},"test_match"),next:b(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var w,C,T,k;this._more||(this.yytext="",this.match="");for(var S=this._currentRules(),E=0;EC[0].length)){if(C=T,k=E,this.options.backtrack_lexer){if(w=this.test_match(T,S[E]),w!==!1)return w;if(this._backtrack){C=!1;continue}else return!1}else if(!this.options.flex)break}return C?(w=this.test_match(C,S[k]),w!==!1?w:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. -`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var C=this.next();return C||this.lex()},"lex"),begin:b(function(C){this.conditionStack.push(C)},"begin"),popState:b(function(){var C=this.conditionStack.length-1;return C>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(C){return C=this.conditionStack.length-1-Math.abs(C||0),C>=0?this.conditionStack[C]:"INITIAL"},"topState"),pushState:b(function(C){this.begin(C)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(C,T,k,S){var E=S;switch(k){case 0:break;case 1:break;case 2:break;case 3:if(C.getIndentMode&&C.getIndentMode())return C.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:C.setIndentMode&&C.setIndentMode(!1),this.begin("INITIAL"),this.unput(T.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(C.consumeIndentText)C.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return T.yytext=T.yytext.slice(2,-2),14;break;case 17:return T.yytext=T.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return x})();g.lexer=y;function v(){this.yy={}}return b(v,"Parser"),v.prototype=g,g.Parser=v,new v})();Bse.parser=Bse;Eir=Bse,Fse=[],$se=[],zse=[],Gse=new Set,Vse=!1,Air=b((e,t,r)=>{let n=QO(e).sort(),i=r??10/Math.pow(e.length,2);qse=n,n.length===1&&Gse.add(n[0]),Fse.push({sets:n,size:i,label:t?Z6(t):void 0})},"addSubsetData"),_ir=b(()=>Fse,"getSubsetData"),Z6=b(e=>{let t=e.trim();return t.length>=2&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t},"normalizeText"),Rir=b(e=>e&&Z6(e),"normalizeStyleValue"),Lir=b((e,t,r)=>{let n=Z6(t);$se.push({sets:QO(e).sort(),id:n,label:r?Z6(r):void 0})},"addTextData"),Iir=b((e,t)=>{let r=QO(e).sort(),n={};for(let[i,a]of t)n[i]=Rir(a)??a;zse.push({targets:r,styles:n})},"addStyleData"),Mir=b(()=>zse,"getStyleData"),QO=b(e=>e.map(t=>Z6(t)),"normalizeIdentifierList"),Nir=b(e=>{let r=QO(e).filter(n=>!Gse.has(n));if(r.length>0)throw new Error(`unknown set identifier: ${r.join(", ")}`)},"validateUnionIdentifiers"),Dir=b(()=>$se,"getTextData"),Oir=b(()=>qse,"getCurrentSets"),Pir=b(()=>Vse,"getIndentMode"),Bir=b(e=>{Vse=e},"setIndentMode"),Fir=Lr.venn;b(Ptt,"getConfig");$ir=b(()=>{Nr(),Fse.length=0,$se.length=0,zse.length=0,Gse.clear(),qse=void 0,Vse=!1},"customClear"),zir={getConfig:Ptt,clear:$ir,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr,addSubsetData:Air,getSubsetData:_ir,addTextData:Lir,addStyleData:Iir,validateUnionIdentifiers:Nir,getTextData:Dir,getStyleData:Mir,getCurrentSets:Oir,getIndentMode:Pir,setIndentMode:Bir},Gir=b(e=>` +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:b(function(){var C=this.next();return C||this.lex()},"lex"),begin:b(function(C){this.conditionStack.push(C)},"begin"),popState:b(function(){var C=this.conditionStack.length-1;return C>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:b(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:b(function(C){return C=this.conditionStack.length-1-Math.abs(C||0),C>=0?this.conditionStack[C]:"INITIAL"},"topState"),pushState:b(function(C){this.begin(C)},"pushState"),stateStackSize:b(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:b(function(C,T,k,S){var E=S;switch(k){case 0:break;case 1:break;case 2:break;case 3:if(C.getIndentMode&&C.getIndentMode())return C.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:C.setIndentMode&&C.setIndentMode(!1),this.begin("INITIAL"),this.unput(T.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(C.consumeIndentText)C.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return T.yytext=T.yytext.slice(2,-2),14;break;case 17:return T.yytext=T.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return x})();g.lexer=y;function v(){this.yy={}}return b(v,"Parser"),v.prototype=g,g.Parser=v,new v})();$se.parser=$se;Lir=$se,zse=[],Gse=[],qse=[],Vse=new Set,Hse=!1,Iir=b((e,t,r)=>{let n=QO(e).sort(),i=r??10/Math.pow(e.length,2);Wse=n,n.length===1&&Vse.add(n[0]),zse.push({sets:n,size:i,label:t?Z6(t):void 0})},"addSubsetData"),Mir=b(()=>zse,"getSubsetData"),Z6=b(e=>{let t=e.trim();return t.length>=2&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t},"normalizeText"),Nir=b(e=>e&&Z6(e),"normalizeStyleValue"),Dir=b((e,t,r)=>{let n=Z6(t);Gse.push({sets:QO(e).sort(),id:n,label:r?Z6(r):void 0})},"addTextData"),Oir=b((e,t)=>{let r=QO(e).sort(),n={};for(let[i,a]of t)n[i]=Nir(a)??a;qse.push({targets:r,styles:n})},"addStyleData"),Pir=b(()=>qse,"getStyleData"),QO=b(e=>e.map(t=>Z6(t)),"normalizeIdentifierList"),Bir=b(e=>{let r=QO(e).filter(n=>!Vse.has(n));if(r.length>0)throw new Error(`unknown set identifier: ${r.join(", ")}`)},"validateUnionIdentifiers"),Fir=b(()=>Gse,"getTextData"),$ir=b(()=>Wse,"getCurrentSets"),zir=b(()=>Hse,"getIndentMode"),Gir=b(e=>{Hse=e},"setIndentMode"),qir=Lr.venn;b(Ftt,"getConfig");Vir=b(()=>{Nr(),zse.length=0,Gse.length=0,qse.length=0,Vse.clear(),Wse=void 0,Hse=!1},"customClear"),Wir={getConfig:Ftt,clear:Vir,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr,addSubsetData:Iir,getSubsetData:Mir,addTextData:Dir,addStyleData:Oir,validateUnionIdentifiers:Bir,getTextData:Fir,getStyleData:Pir,getCurrentSets:$ir,getIndentMode:zir,setIndentMode:Gir},Hir=b(e=>` .venn-title { font-size: 32px; fill: ${e.vennTitleTextColor}; @@ -3275,7 +3275,7 @@ Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":Oe="Parse error font-family: ${e.fontFamily}; color: ${e.vennSetTextColor}; } -`,"getStyles"),qir=Gir;b(Btt,"buildStyleByKey");Vir=b((e,t,r,n)=>{let i=n.db,a=i.getConfig?.(),{themeVariables:s,look:o,handDrawnSeed:l}=qt(),u=o==="handDrawn",h=[s.venn1,s.venn2,s.venn3,s.venn4,s.venn5,s.venn6,s.venn7,s.venn8].filter(Boolean),f=i.getDiagramTitle?.(),d=i.getSubsetData(),p=i.getTextData(),m=Btt(i.getStyleData()),g=$tt(d),y=a?.width??800,v=a?.height??450,w=y/1600,C=f?48*w:0,T=s.primaryTextColor??s.textColor,k=Qn(t);k.attr("viewBox",`0 0 ${y} ${v}`),f&&k.append("text").text(f).attr("class","venn-title").attr("font-size",`${32*w}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*w).style("fill",s.vennTitleTextColor||s.titleColor);let S=ct(document.createElement("div")),E=Rtt().width(y).height(v-C);S.datum(g).call(E);let I=u?gt.svg(S.select("svg").node()):void 0,L=Dtt(g,{width:y,height:v-C,padding:a?.padding??15}),O=new Map;for(let M of L){let D=n1([...M.data.sets].sort());O.set(D,M)}p.length>0&&Ftt(a,O,S,p,w,m);let R=ci(s.background||"#f4f4f4");S.selectAll(".venn-circle").each(function(M,D){let B=ct(this),$=n1([...M.sets].sort()),F=m.get($),q=F?.fill||h[D%h.length]||s.primaryColor;B.classed(`venn-set-${D%8}`,!0);let G=F?.["fill-opacity"]??.1,z=F?.stroke||q,H=F?.["stroke-width"]||`${5*w}`;if(u&&I){let J=O.get($);if(J&&J.circles.length>0){let U=J.circles[0],le=I.circle(U.x,U.y,U.radius*2,{roughness:.7,seed:l,fill:yA(q,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+D*60,stroke:z,strokeWidth:parseFloat(String(H))});B.select("path").remove(),B.node()?.insertBefore(le,B.select("text").node())}}else B.select("path").style("fill",q).style("fill-opacity",G).style("stroke",z).style("stroke-width",H).style("stroke-opacity",.95);let j=F?.color||(R?st(q,30):ot(q,30));B.select("text").style("font-size",`${48*w}px`).style("fill",j)}),u&&I?S.selectAll(".venn-intersection").each(function(M){let D=ct(this),P=n1([...M.sets].sort()),$=m.get(P),F=$?.fill;if(F){let q=D.select("path"),G=q.attr("d");if(G){let z=I.path(G,{roughness:.7,seed:l,fill:yA(F,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),H=q.node();H?.parentNode?.insertBefore(z,H),q.remove()}}else D.select("path").style("fill-opacity",0);D.select("text").style("font-size",`${48*w}px`).style("fill",$?.color??s.vennSetTextColor??T)}):(S.selectAll(".venn-intersection text").style("font-size",`${48*w}px`).style("fill",M=>{let B=n1([...M.sets].sort());return m.get(B)?.color??s.vennSetTextColor??T}),S.selectAll(".venn-intersection path").style("fill-opacity",M=>{let B=n1([...M.sets].sort());return m.get(B)?.fill?1:0}).style("fill",M=>{let B=n1([...M.sets].sort());return m.get(B)?.fill??"transparent"}));let A=k.append("g").attr("transform",`translate(0, ${C})`),N=S.select("svg").node();if(N&&"childNodes"in N)for(let M of[...N.childNodes])A.node()?.appendChild(M);vn(k,v,y,a?.useMaxWidth??!0)},"draw");b(n1,"stableSetsKey");b(Ftt,"renderTextNodes");b($tt,"ensurePairwiseSubsets");Wir={draw:Vir},Hir={parser:Eir,db:zir,renderer:Wir,styles:qir}});var Htt={};Tr(Htt,{diagram:()=>tar});function Vtt(e){if(!e.length)return[];let t=[],r=[];return e.forEach(n=>{let i={name:n.name,children:n.type==="Leaf"?void 0:[]};for(i.classSelector=n?.classSelector,n?.cssCompiledStyles&&(i.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(i.value=n.value);r.length>0&&r[r.length-1].level>=n.level;)r.pop();if(r.length===0)t.push(i);else{let a=r[r.length-1].node;a.children?a.children.push(i):a.children=[i]}n.type!=="Leaf"&&r.push({node:i,level:n.level})}),t}var qtt,Uir,Yir,Wtt,Xir,Ek,Q6,jir,Kir,Zir,Qir,Jir,ear,tar,Utt=W(()=>{Sl();za();oc();co();Sn();_r();Rr();hr();Co();fn();qtt=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=Yr,this.getAccTitle=Qr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getAccDescription=en,this.setAccDescription=Jr}static{b(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let e=Lr,t=qt();return Rn({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,t){let r=this.classes.get(e)??{id:e,styles:[],textStyles:[]},n=t.replace(/\\,/g,"\xA7\xA7\xA7").replace(/,/g,";").replace(/§§§/g,",").split(";");n&&n.forEach(i=>{P3(i)&&(r?.textStyles?r.textStyles.push(i):r.textStyles=[i]),r?.styles?r.styles.push(i):r.styles=[i]}),this.classes.set(e,r)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){Nr(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};b(Vtt,"buildHierarchy");Uir=b((e,t)=>{wi(e,t);let r=[];for(let a of e.TreemapRows??[])a.$type==="ClassDefStatement"&&t.addClass(a.className??"",a.styleText??"");for(let a of e.TreemapRows??[]){let s=a.item;if(!s)continue;let o=a.indent?parseInt(a.indent):0,l=Yir(s),u=s.classSelector?t.getStylesForClass(s.classSelector):[],h=u.length>0?u:void 0,f={level:o,name:l,type:s.$type,value:s.value,classSelector:s.classSelector,cssCompiledStyles:h};r.push(f)}let n=Vtt(r),i=b((a,s)=>{for(let o of a)t.addNode(o,s),o.children&&o.children.length>0&&i(o.children,s+1)},"addNodesRecursively");i(n,0)},"populate"),Yir=b(e=>e.name?String(e.name):"","getItemName"),Wtt={parser:{yy:void 0},parse:b(async e=>{try{let r=await ba("treemap",e);se.debug("Treemap AST:",r);let n=Wtt.parser?.yy;if(!(n instanceof qtt))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Uir(r,n)}catch(t){throw se.error("Error parsing treemap:",t),t}},"parse")},Xir=10,Ek=10,Q6=25,jir=b((e,t,r,n)=>{let i=n.db,a=i.getConfig(),s=a.padding??Xir,o=i.getDiagramTitle(),l=i.getRoot(),{themeVariables:u}=qt();if(!l)return;let h=o?30:0,f=Qn(t),d=a.nodeWidth?a.nodeWidth*Ek:960,p=a.nodeHeight?a.nodeHeight*Ek:500,m=d,g=p+h;f.attr("viewBox",`0 0 ${m} ${g}`),vn(f,g,m,a.useMaxWidth);let y;try{let G=a.valueFormat||",";if(G==="$0,0")y=b(z=>"$"+Mf(",")(z),"valueFormat");else if(G.startsWith("$")&&G.includes(",")){let z=/\.\d+/.exec(G),H=z?z[0]:"";y=b(j=>"$"+Mf(","+H)(j),"valueFormat")}else if(G.startsWith("$")){let z=G.substring(1);y=b(H=>"$"+Mf(z||"")(H),"valueFormat")}else y=Mf(G)}catch(G){se.error("Error creating format function:",G),y=Mf(",")}let v=Pc().range(["transparent",u.cScale0,u.cScale1,u.cScale2,u.cScale3,u.cScale4,u.cScale5,u.cScale6,u.cScale7,u.cScale8,u.cScale9,u.cScale10,u.cScale11]),x=Pc().range(["transparent",u.cScalePeer0,u.cScalePeer1,u.cScalePeer2,u.cScalePeer3,u.cScalePeer4,u.cScalePeer5,u.cScalePeer6,u.cScalePeer7,u.cScalePeer8,u.cScalePeer9,u.cScalePeer10,u.cScalePeer11]),w=Pc().range([u.cScaleLabel0,u.cScaleLabel1,u.cScaleLabel2,u.cScaleLabel3,u.cScaleLabel4,u.cScaleLabel5,u.cScaleLabel6,u.cScaleLabel7,u.cScaleLabel8,u.cScaleLabel9,u.cScaleLabel10,u.cScaleLabel11]);o&&f.append("text").attr("x",m/2).attr("y",h/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(o);let C=f.append("g").attr("transform",`translate(0, ${h})`).attr("class","treemapContainer"),T=qb(l).sum(G=>G.value??0).sort((G,z)=>(z.value??0)-(G.value??0)),S=ZW().size([d,p]).paddingTop(G=>G.children&&G.children.length>0?Q6+Ek:0).paddingInner(s).paddingLeft(G=>G.children&&G.children.length>0?Ek:0).paddingRight(G=>G.children&&G.children.length>0?Ek:0).paddingBottom(G=>G.children&&G.children.length>0?Ek:0).round(!0)(T),E=S.descendants().filter(G=>G.children&&G.children.length>0),I=C.selectAll(".treemapSection").data(E).enter().append("g").attr("class","treemapSection").attr("transform",G=>`translate(${G.x0},${G.y0})`);I.append("rect").attr("width",G=>G.x1-G.x0).attr("height",Q6).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",G=>G.depth===0?"display: none;":""),I.append("clipPath").attr("id",(G,z)=>`clip-section-${t}-${z}`).append("rect").attr("width",G=>Math.max(0,G.x1-G.x0-12)).attr("height",Q6),I.append("rect").attr("width",G=>G.x1-G.x0).attr("height",G=>G.y1-G.y0).attr("class",(G,z)=>`treemapSection section${z}`).attr("fill",G=>v(G.data.name)).attr("fill-opacity",.6).attr("stroke",G=>x(G.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",G=>{if(G.depth===0)return"display: none;";let z=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z.nodeStyles+";"+z.borderStyles.join(";")}),I.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",Q6/2).attr("dominant-baseline","middle").text(G=>G.depth===0?"":G.data.name).attr("font-weight","bold").attr("clip-path",(G,z)=>`url(#clip-section-${t}-${z})`).attr("style",G=>{if(G.depth===0)return"display: none;";let z="dominant-baseline: middle; font-size: 12px; fill:"+w(G.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",H=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z+H.labelStyles.replace("color:","fill:")}).each(function(G){if(G.depth===0)return;let z=ct(this),H=G.data.name;z.text(H);let j=G.x1-G.x0,J=6,U;a.showValues!==!1&&G.value?U=j-10-30-10-J:U=j-J-6;let ee=Math.max(15,U),ue=z.node();if(ue.getComputedTextLength()>ee){let Re=H;for(;Re.length>0;){if(Re=H.substring(0,Re.length-1),Re.length===0){z.text("..."),ue.getComputedTextLength()>ee&&z.text("");break}if(z.text(Re+"..."),ue.getComputedTextLength()<=ee)break}}}),a.showValues!==!1&&I.append("text").attr("class","treemapSectionValue").attr("x",G=>G.x1-G.x0-10).attr("y",Q6/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(G=>G.value?y(G.value):"").attr("font-style","italic").attr("style",G=>{if(G.depth===0)return"display: none;";let z="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+w(G.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",H=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z+H.labelStyles.replace("color:","fill:")});let L=S.leaves(),O=L.length>20,R=O?16:38,A=O?14:28,N=O?4:8,M=O?4:6,D=O?2:4,B=O?8:10,P=O?1:2,$=C.selectAll(".treemapLeafGroup").data(L).enter().append("g").attr("class",(G,z)=>`treemapNode treemapLeafGroup leaf${z}${G.data.classSelector?` ${G.data.classSelector}`:""}x`).attr("transform",G=>`translate(${G.x0},${G.y0})`);$.append("rect").attr("width",G=>G.x1-G.x0).attr("height",G=>G.y1-G.y0).attr("class","treemapLeaf").attr("fill",G=>G.parent?v(G.parent.data.name):v(G.data.name)).attr("style",G=>ar({cssCompiledStyles:G.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",G=>G.parent?v(G.parent.data.name):v(G.data.name)).attr("stroke-width",3),$.append("clipPath").attr("id",(G,z)=>`clip-${t}-${z}`).append("rect").attr("width",G=>Math.max(0,G.x1-G.x0-4)).attr("height",G=>Math.max(0,G.y1-G.y0-4)),$.append("text").attr("class","treemapLabel").attr("x",G=>(G.x1-G.x0)/2).attr("y",G=>(G.y1-G.y0)/2).attr("style",G=>{let z=`text-anchor: middle; dominant-baseline: middle; font-size: ${R}px;fill:`+w(G.data.name)+";",H=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z+H.labelStyles.replace("color:","fill:")}).attr("clip-path",(G,z)=>`url(#clip-${t}-${z})`).text(G=>G.data.name).each(function(G){let z=ct(this),H=G.x1-G.x0,j=G.y1-G.y0,J=z.node(),U=H-2*D,le=j-2*D;if(UU&&ee>N;)ee--,z.style("font-size",`${ee}px`);let ae=Math.max(M,Math.min(A,Math.round(ee*ue))),oe=ee+P+ae;for(;oe>le&&ee>N&&(ee--,ae=Math.max(M,Math.min(A,Math.round(ee*ue))),!(aele;z.style("font-size",`${ee}px`),O?(eeU||ee(z.x1-z.x0)/2).attr("y",function(z){return(z.y1-z.y0)/2}).attr("style",z=>{let H=`text-anchor: middle; dominant-baseline: hanging; font-size: ${A}px;fill:`+w(z.data.name)+";",j=ar({cssCompiledStyles:z.data.cssCompiledStyles});return H+j.labelStyles.replace("color:","fill:")}).attr("clip-path",(z,H)=>`url(#clip-${t}-${H})`).text(z=>z.value?y(z.value):"").each(function(z){let H=ct(this),j=this.parentNode;if(!j){H.style("display","none");return}let J=ct(j).select(".treemapLabel");if(J.empty()||J.style("display")==="none"){H.style("display","none");return}let U=parseFloat(J.style("font-size")),ee=Math.max(M,Math.min(A,Math.round(U*.6)));H.style("font-size",`${ee}px`);let ae=(z.y1-z.y0)/2+U/2+P;H.attr("y",ae);let oe=z.x1-z.x0,Oe=z.y1-z.y0-4,qe=oe-2*D;H.node().getComputedTextLength()>qe||ae+ee>Oe||ee{let t=Go(),r=qt(),n=Rn(t,r.themeVariables),i=Rn(Qir,e),a=i.titleColor??n.titleColor,s=i.labelColor??n.textColor,o=i.valueColor??n.textColor;return` +`,"getStyles"),Uir=Hir;b($tt,"buildStyleByKey");Yir=b((e,t,r,n)=>{let i=n.db,a=i.getConfig?.(),{themeVariables:s,look:o,handDrawnSeed:l}=qt(),u=o==="handDrawn",h=[s.venn1,s.venn2,s.venn3,s.venn4,s.venn5,s.venn6,s.venn7,s.venn8].filter(Boolean),f=i.getDiagramTitle?.(),d=i.getSubsetData(),p=i.getTextData(),m=$tt(i.getStyleData()),g=Gtt(d),y=a?.width??800,v=a?.height??450,w=y/1600,C=f?48*w:0,T=s.primaryTextColor??s.textColor,k=Qn(t);k.attr("viewBox",`0 0 ${y} ${v}`),f&&k.append("text").text(f).attr("class","venn-title").attr("font-size",`${32*w}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*w).style("fill",s.vennTitleTextColor||s.titleColor);let S=ct(document.createElement("div")),E=Itt().width(y).height(v-C);S.datum(g).call(E);let I=u?gt.svg(S.select("svg").node()):void 0,L=Ptt(g,{width:y,height:v-C,padding:a?.padding??15}),O=new Map;for(let M of L){let D=n1([...M.data.sets].sort());O.set(D,M)}p.length>0&&ztt(a,O,S,p,w,m);let R=ci(s.background||"#f4f4f4");S.selectAll(".venn-circle").each(function(M,D){let B=ct(this),$=n1([...M.sets].sort()),F=m.get($),q=F?.fill||h[D%h.length]||s.primaryColor;B.classed(`venn-set-${D%8}`,!0);let G=F?.["fill-opacity"]??.1,z=F?.stroke||q,H=F?.["stroke-width"]||`${5*w}`;if(u&&I){let J=O.get($);if(J&&J.circles.length>0){let U=J.circles[0],le=I.circle(U.x,U.y,U.radius*2,{roughness:.7,seed:l,fill:yA(q,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+D*60,stroke:z,strokeWidth:parseFloat(String(H))});B.select("path").remove(),B.node()?.insertBefore(le,B.select("text").node())}}else B.select("path").style("fill",q).style("fill-opacity",G).style("stroke",z).style("stroke-width",H).style("stroke-opacity",.95);let j=F?.color||(R?st(q,30):ot(q,30));B.select("text").style("font-size",`${48*w}px`).style("fill",j)}),u&&I?S.selectAll(".venn-intersection").each(function(M){let D=ct(this),P=n1([...M.sets].sort()),$=m.get(P),F=$?.fill;if(F){let q=D.select("path"),G=q.attr("d");if(G){let z=I.path(G,{roughness:.7,seed:l,fill:yA(F,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),H=q.node();H?.parentNode?.insertBefore(z,H),q.remove()}}else D.select("path").style("fill-opacity",0);D.select("text").style("font-size",`${48*w}px`).style("fill",$?.color??s.vennSetTextColor??T)}):(S.selectAll(".venn-intersection text").style("font-size",`${48*w}px`).style("fill",M=>{let B=n1([...M.sets].sort());return m.get(B)?.color??s.vennSetTextColor??T}),S.selectAll(".venn-intersection path").style("fill-opacity",M=>{let B=n1([...M.sets].sort());return m.get(B)?.fill?1:0}).style("fill",M=>{let B=n1([...M.sets].sort());return m.get(B)?.fill??"transparent"}));let A=k.append("g").attr("transform",`translate(0, ${C})`),N=S.select("svg").node();if(N&&"childNodes"in N)for(let M of[...N.childNodes])A.node()?.appendChild(M);vn(k,v,y,a?.useMaxWidth??!0)},"draw");b(n1,"stableSetsKey");b(ztt,"renderTextNodes");b(Gtt,"ensurePairwiseSubsets");Xir={draw:Yir},jir={parser:Lir,db:Wir,renderer:Xir,styles:Uir}});var Ytt={};Tr(Ytt,{diagram:()=>aar});function Htt(e){if(!e.length)return[];let t=[],r=[];return e.forEach(n=>{let i={name:n.name,children:n.type==="Leaf"?void 0:[]};for(i.classSelector=n?.classSelector,n?.cssCompiledStyles&&(i.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(i.value=n.value);r.length>0&&r[r.length-1].level>=n.level;)r.pop();if(r.length===0)t.push(i);else{let a=r[r.length-1].node;a.children?a.children.push(i):a.children=[i]}n.type!=="Leaf"&&r.push({node:i,level:n.level})}),t}var Wtt,Kir,Zir,Utt,Qir,Ek,Q6,Jir,ear,tar,rar,nar,iar,aar,Xtt=W(()=>{El();za();lc();co();Sn();_r();Rr();hr();Co();fn();Wtt=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=Yr,this.getAccTitle=Qr,this.setDiagramTitle=ln,this.getDiagramTitle=tn,this.getAccDescription=en,this.setAccDescription=Jr}static{b(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let e=Lr,t=qt();return Rn({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,t){let r=this.classes.get(e)??{id:e,styles:[],textStyles:[]},n=t.replace(/\\,/g,"\xA7\xA7\xA7").replace(/,/g,";").replace(/§§§/g,",").split(";");n&&n.forEach(i=>{P3(i)&&(r?.textStyles?r.textStyles.push(i):r.textStyles=[i]),r?.styles?r.styles.push(i):r.styles=[i]}),this.classes.set(e,r)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){Nr(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};b(Htt,"buildHierarchy");Kir=b((e,t)=>{wi(e,t);let r=[];for(let a of e.TreemapRows??[])a.$type==="ClassDefStatement"&&t.addClass(a.className??"",a.styleText??"");for(let a of e.TreemapRows??[]){let s=a.item;if(!s)continue;let o=a.indent?parseInt(a.indent):0,l=Zir(s),u=s.classSelector?t.getStylesForClass(s.classSelector):[],h=u.length>0?u:void 0,f={level:o,name:l,type:s.$type,value:s.value,classSelector:s.classSelector,cssCompiledStyles:h};r.push(f)}let n=Htt(r),i=b((a,s)=>{for(let o of a)t.addNode(o,s),o.children&&o.children.length>0&&i(o.children,s+1)},"addNodesRecursively");i(n,0)},"populate"),Zir=b(e=>e.name?String(e.name):"","getItemName"),Utt={parser:{yy:void 0},parse:b(async e=>{try{let r=await ba("treemap",e);se.debug("Treemap AST:",r);let n=Utt.parser?.yy;if(!(n instanceof Wtt))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Kir(r,n)}catch(t){throw se.error("Error parsing treemap:",t),t}},"parse")},Qir=10,Ek=10,Q6=25,Jir=b((e,t,r,n)=>{let i=n.db,a=i.getConfig(),s=a.padding??Qir,o=i.getDiagramTitle(),l=i.getRoot(),{themeVariables:u}=qt();if(!l)return;let h=o?30:0,f=Qn(t),d=a.nodeWidth?a.nodeWidth*Ek:960,p=a.nodeHeight?a.nodeHeight*Ek:500,m=d,g=p+h;f.attr("viewBox",`0 0 ${m} ${g}`),vn(f,g,m,a.useMaxWidth);let y;try{let G=a.valueFormat||",";if(G==="$0,0")y=b(z=>"$"+Mf(",")(z),"valueFormat");else if(G.startsWith("$")&&G.includes(",")){let z=/\.\d+/.exec(G),H=z?z[0]:"";y=b(j=>"$"+Mf(","+H)(j),"valueFormat")}else if(G.startsWith("$")){let z=G.substring(1);y=b(H=>"$"+Mf(z||"")(H),"valueFormat")}else y=Mf(G)}catch(G){se.error("Error creating format function:",G),y=Mf(",")}let v=Pc().range(["transparent",u.cScale0,u.cScale1,u.cScale2,u.cScale3,u.cScale4,u.cScale5,u.cScale6,u.cScale7,u.cScale8,u.cScale9,u.cScale10,u.cScale11]),x=Pc().range(["transparent",u.cScalePeer0,u.cScalePeer1,u.cScalePeer2,u.cScalePeer3,u.cScalePeer4,u.cScalePeer5,u.cScalePeer6,u.cScalePeer7,u.cScalePeer8,u.cScalePeer9,u.cScalePeer10,u.cScalePeer11]),w=Pc().range([u.cScaleLabel0,u.cScaleLabel1,u.cScaleLabel2,u.cScaleLabel3,u.cScaleLabel4,u.cScaleLabel5,u.cScaleLabel6,u.cScaleLabel7,u.cScaleLabel8,u.cScaleLabel9,u.cScaleLabel10,u.cScaleLabel11]);o&&f.append("text").attr("x",m/2).attr("y",h/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(o);let C=f.append("g").attr("transform",`translate(0, ${h})`).attr("class","treemapContainer"),T=qb(l).sum(G=>G.value??0).sort((G,z)=>(z.value??0)-(G.value??0)),S=JW().size([d,p]).paddingTop(G=>G.children&&G.children.length>0?Q6+Ek:0).paddingInner(s).paddingLeft(G=>G.children&&G.children.length>0?Ek:0).paddingRight(G=>G.children&&G.children.length>0?Ek:0).paddingBottom(G=>G.children&&G.children.length>0?Ek:0).round(!0)(T),E=S.descendants().filter(G=>G.children&&G.children.length>0),I=C.selectAll(".treemapSection").data(E).enter().append("g").attr("class","treemapSection").attr("transform",G=>`translate(${G.x0},${G.y0})`);I.append("rect").attr("width",G=>G.x1-G.x0).attr("height",Q6).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",G=>G.depth===0?"display: none;":""),I.append("clipPath").attr("id",(G,z)=>`clip-section-${t}-${z}`).append("rect").attr("width",G=>Math.max(0,G.x1-G.x0-12)).attr("height",Q6),I.append("rect").attr("width",G=>G.x1-G.x0).attr("height",G=>G.y1-G.y0).attr("class",(G,z)=>`treemapSection section${z}`).attr("fill",G=>v(G.data.name)).attr("fill-opacity",.6).attr("stroke",G=>x(G.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",G=>{if(G.depth===0)return"display: none;";let z=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z.nodeStyles+";"+z.borderStyles.join(";")}),I.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",Q6/2).attr("dominant-baseline","middle").text(G=>G.depth===0?"":G.data.name).attr("font-weight","bold").attr("clip-path",(G,z)=>`url(#clip-section-${t}-${z})`).attr("style",G=>{if(G.depth===0)return"display: none;";let z="dominant-baseline: middle; font-size: 12px; fill:"+w(G.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",H=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z+H.labelStyles.replace("color:","fill:")}).each(function(G){if(G.depth===0)return;let z=ct(this),H=G.data.name;z.text(H);let j=G.x1-G.x0,J=6,U;a.showValues!==!1&&G.value?U=j-10-30-10-J:U=j-J-6;let ee=Math.max(15,U),ue=z.node();if(ue.getComputedTextLength()>ee){let Re=H;for(;Re.length>0;){if(Re=H.substring(0,Re.length-1),Re.length===0){z.text("..."),ue.getComputedTextLength()>ee&&z.text("");break}if(z.text(Re+"..."),ue.getComputedTextLength()<=ee)break}}}),a.showValues!==!1&&I.append("text").attr("class","treemapSectionValue").attr("x",G=>G.x1-G.x0-10).attr("y",Q6/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(G=>G.value?y(G.value):"").attr("font-style","italic").attr("style",G=>{if(G.depth===0)return"display: none;";let z="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+w(G.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",H=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z+H.labelStyles.replace("color:","fill:")});let L=S.leaves(),O=L.length>20,R=O?16:38,A=O?14:28,N=O?4:8,M=O?4:6,D=O?2:4,B=O?8:10,P=O?1:2,$=C.selectAll(".treemapLeafGroup").data(L).enter().append("g").attr("class",(G,z)=>`treemapNode treemapLeafGroup leaf${z}${G.data.classSelector?` ${G.data.classSelector}`:""}x`).attr("transform",G=>`translate(${G.x0},${G.y0})`);$.append("rect").attr("width",G=>G.x1-G.x0).attr("height",G=>G.y1-G.y0).attr("class","treemapLeaf").attr("fill",G=>G.parent?v(G.parent.data.name):v(G.data.name)).attr("style",G=>ar({cssCompiledStyles:G.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",G=>G.parent?v(G.parent.data.name):v(G.data.name)).attr("stroke-width",3),$.append("clipPath").attr("id",(G,z)=>`clip-${t}-${z}`).append("rect").attr("width",G=>Math.max(0,G.x1-G.x0-4)).attr("height",G=>Math.max(0,G.y1-G.y0-4)),$.append("text").attr("class","treemapLabel").attr("x",G=>(G.x1-G.x0)/2).attr("y",G=>(G.y1-G.y0)/2).attr("style",G=>{let z=`text-anchor: middle; dominant-baseline: middle; font-size: ${R}px;fill:`+w(G.data.name)+";",H=ar({cssCompiledStyles:G.data.cssCompiledStyles});return z+H.labelStyles.replace("color:","fill:")}).attr("clip-path",(G,z)=>`url(#clip-${t}-${z})`).text(G=>G.data.name).each(function(G){let z=ct(this),H=G.x1-G.x0,j=G.y1-G.y0,J=z.node(),U=H-2*D,le=j-2*D;if(UU&&ee>N;)ee--,z.style("font-size",`${ee}px`);let ae=Math.max(M,Math.min(A,Math.round(ee*ue))),oe=ee+P+ae;for(;oe>le&&ee>N&&(ee--,ae=Math.max(M,Math.min(A,Math.round(ee*ue))),!(aele;z.style("font-size",`${ee}px`),O?(eeU||ee(z.x1-z.x0)/2).attr("y",function(z){return(z.y1-z.y0)/2}).attr("style",z=>{let H=`text-anchor: middle; dominant-baseline: hanging; font-size: ${A}px;fill:`+w(z.data.name)+";",j=ar({cssCompiledStyles:z.data.cssCompiledStyles});return H+j.labelStyles.replace("color:","fill:")}).attr("clip-path",(z,H)=>`url(#clip-${t}-${H})`).text(z=>z.value?y(z.value):"").each(function(z){let H=ct(this),j=this.parentNode;if(!j){H.style("display","none");return}let J=ct(j).select(".treemapLabel");if(J.empty()||J.style("display")==="none"){H.style("display","none");return}let U=parseFloat(J.style("font-size")),ee=Math.max(M,Math.min(A,Math.round(U*.6)));H.style("font-size",`${ee}px`);let ae=(z.y1-z.y0)/2+U/2+P;H.attr("y",ae);let oe=z.x1-z.x0,Oe=z.y1-z.y0-4,qe=oe-2*D;H.node().getComputedTextLength()>qe||ae+ee>Oe||ee{let t=Go(),r=qt(),n=Rn(t,r.themeVariables),i=Rn(rar,e),a=i.titleColor??n.titleColor,s=i.labelColor??n.textColor,o=i.valueColor??n.textColor;return` .treemapNode.section { stroke: ${i.sectionStrokeColor}; stroke-width: ${i.sectionStrokeWidth}; @@ -3298,8 +3298,8 @@ Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":Oe="Parse error fill: ${a}; font-size: ${i.titleFontSize}; } - `},"getStyles"),ear=Jir,tar={parser:Wtt,get db(){return new qtt},renderer:Zir,styles:ear}});var frt={};Tr(frt,{diagram:()=>far});function jtt(){return Be()["wardley-beta"]}function Ktt(e,t,r,n,i,a,s,o,l){Ko.addNode({id:e,label:t,x:r,y:n,className:i,labelOffsetX:a,labelOffsetY:s,inertia:o,sourceStrategy:l})}function Ztt(e,t,r=!1,n,i){Ko.addLink({source:e,target:t,dashed:r,label:n,flow:i})}function Qtt(e,t,r){Ko.addTrend({nodeId:e,targetX:t,targetY:r})}function Jtt(e,t,r){Ko.addAnnotation({number:e,coordinates:t,text:r})}function ert(e,t,r){Ko.addNote({text:e,x:t,y:r})}function trt(e,t,r){Ko.addAccelerator({name:e,x:t,y:r})}function rrt(e,t,r){Ko.addDeaccelerator({name:e,x:t,y:r})}function nrt(e,t){Ko.setAnnotationsBox(e,t)}function irt(e,t){Ko.setSize(e,t)}function art(e){Ko.startPipeline(e)}function srt(e,t){Ko.addPipelineComponent(e,t)}function ort(e){Ko.setAxes(e)}function lrt(e){return Ko.getNode(e)}function crt(e){return Ko.resolveNodeId(e)}function urt(){return Ko.build()}function hrt(){Ko.clear(),Nr()}var JO,q2,Ytt,rar,nar,Xtt,iar,Ko,aar,sar,oar,lar,car,uar,har,far,drt=W(()=>{Sl();za();Sn();_r();Rr();hr();Co();JO=b((e,t)=>{let r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),q2=b((e,t,r)=>({x:JO(t,`${r} evolution`),y:JO(e,`${r} visibility`)}),"toCoordinates"),Ytt=b(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),rar=b(e=>{if(!e?.startsWith("+"))return{};let r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),nar=b((e,t)=>{if(wi(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let r=e.evolution.stages.map(i=>i.secondName?`${i.name.trim()} / ${i.secondName.trim()}`:i.name.trim()),n=e.evolution.stages.filter(i=>i.boundary!==void 0).map(i=>i.boundary);t.updateAxes({stages:r,stageBoundaries:n})}if(e.anchors.forEach(r=>{let n=q2(r.visibility,r.evolution,`Anchor "${r.name}"`);t.addNode(r.name,r.name,n.x,n.y,"anchor")}),e.components.forEach(r=>{let n=q2(r.visibility,r.evolution,`Component "${r.name}"`),i=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,a=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,s=r.decorator?.strategy;t.addNode(r.name,r.name,n.x,n.y,"component",i,a,r.inertia,s)}),e.notes.forEach(r=>{let n=q2(r.visibility,r.evolution,`Note "${r.text}"`);t.addNote(r.text,n.x,n.y)}),e.pipelines.forEach(r=>{let n=t.getNode(r.parent);if(!n||typeof n.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);let i=n.y;t.startPipeline(r.parent),r.components.forEach(a=>{let s=`${r.parent}_${a.name}`,o=a.label?(a.label.negX?-1:1)*a.label.offsetX:void 0,l=a.label?(a.label.negY?-1:1)*a.label.offsetY:void 0,u=JO(a.evolution,`Pipeline component "${a.name}" evolution`);t.addNode(s,a.name,u,i,"pipeline-component",o,l),t.addPipelineComponent(r.parent,s)})}),e.links.forEach(r=>{let n=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-.")),i=Ytt(r.fromPort)??Ytt(r.toPort),{flow:a,label:s}=rar(r.arrow);!i&&a&&(i=a);let o=r.linkLabel,l=s??o;t.addLink(t.resolveNodeId(r.from),t.resolveNodeId(r.to),n,l,i)}),e.evolves.forEach(r=>{let n=t.getNode(r.component);if(n?.y!==void 0){let i=JO(r.target,`Evolve target for "${r.component}"`);t.addTrend(r.component,i,n.y)}}),e.annotations.length>0){let r=e.annotations[0],n=q2(r.x,r.y,"Annotations box");t.setAnnotationsBox(n.x,n.y)}e.annotation.forEach(r=>{let n=q2(r.x,r.y,`Annotation ${r.number}`);t.addAnnotation(r.number,[{x:n.x,y:n.y}],r.text)}),e.accelerators.forEach(r=>{let n=q2(r.x,r.y,`Accelerator "${r.name}"`);t.addAccelerator(r.name,n.x,n.y)}),e.deaccelerators.forEach(r=>{let n=q2(r.x,r.y,`Deaccelerator "${r.name}"`);t.addDeaccelerator(r.name,n.x,n.y)})},"populateDb"),Xtt={parser:{yy:void 0},parse:b(async e=>{let t=await ba("wardley",e);se.debug(t);let r=Xtt.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");nar(t,r)},"parse")},iar=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{b(this,"WardleyBuilder")}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},r={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,r)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let r=this.pipelines.get(e);r&&r.componentIds.push(t);let n=this.nodes.get(t);n&&(n.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,r]of this.nodes)if(r.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!="number"||typeof t.y!="number")throw new Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},Ko=new iar;b(jtt,"getConfig");b(Ktt,"addNode");b(Ztt,"addLink");b(Qtt,"addTrend");b(Jtt,"addAnnotation");b(ert,"addNote");b(trt,"addAccelerator");b(rrt,"addDeaccelerator");b(nrt,"setAnnotationsBox");b(irt,"setSize");b(art,"startPipeline");b(srt,"addPipelineComponent");b(ort,"updateAxes");b(lrt,"getNode");b(crt,"resolveNodeId");b(urt,"getWardleyData");b(hrt,"clear");aar={getConfig:jtt,addNode:Ktt,addLink:Ztt,addTrend:Qtt,addAnnotation:Jtt,addNote:ert,addAccelerator:trt,addDeaccelerator:rrt,setAnnotationsBox:nrt,setSize:irt,startPipeline:art,addPipelineComponent:srt,updateAxes:ort,getNode:lrt,resolveNodeId:crt,getWardleyData:urt,clear:hrt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},sar=["Genesis","Custom Built","Product","Commodity"],oar=b(()=>{let{themeVariables:e}=Be();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),lar=b(()=>{let e=Be()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),car=b((e,t,r,n)=>{se.debug(`Rendering Wardley map -`+e);let i=lar(),a=oar(),s=i.nodeRadius*1.6,o=n.db,l=o.getWardleyData(),u=o.getDiagramTitle(),h=l.size?.width??i.width,f=l.size?.height??i.height,d=Qn(t);d.selectAll("*").remove(),vn(d,f,h,i.useMaxWidth),d.attr("viewBox",`0 0 ${h} ${f}`);let p=d.append("g").attr("class","wardley-map"),m=d.append("defs");m.append("marker").attr("id",`arrow-${t}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",a.evolutionStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-end-${t}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",a.linkStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-start-${t}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",a.linkStroke).attr("stroke","none"),p.append("rect").attr("class","wardley-background").attr("width",h).attr("height",f).attr("fill",a.backgroundColor);let g=h-i.padding*2,y=f-i.padding*2;u&&p.append("text").attr("class","wardley-title").attr("x",h/2).attr("y",i.padding/2).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(u);let v=b(P=>i.padding+P/100*g,"projectX"),x=b(P=>f-i.padding-P/100*y,"projectY"),w=p.append("g").attr("class","wardley-axes");w.append("line").attr("x1",i.padding).attr("x2",h-i.padding).attr("y1",f-i.padding).attr("y2",f-i.padding).attr("stroke",a.axisColor).attr("stroke-width",1),w.append("line").attr("x1",i.padding).attr("x2",i.padding).attr("y1",i.padding).attr("y2",f-i.padding).attr("stroke",a.axisColor).attr("stroke-width",1);let C=l.axes.xLabel??"Evolution",T=l.axes.yLabel??"Visibility";w.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",i.padding+g/2).attr("y",f-i.padding/4).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(C),w.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",i.padding/3).attr("y",i.padding+y/2).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${i.padding/3} ${i.padding+y/2})`).text(T);let k=l.axes.stages&&l.axes.stages.length>0?l.axes.stages:sar;if(k.length>0){let P=p.append("g").attr("class","wardley-stages"),$=l.axes.stageBoundaries,F=[];if($&&$.length===k.length){let q=0;$.forEach(G=>{F.push({start:q,end:G}),q=G})}else{let q=1/k.length;k.forEach((G,z)=>{F.push({start:z*q,end:(z+1)*q})})}k.forEach((q,G)=>{let z=F[G],H=i.padding+z.start*g,j=i.padding+z.end*g,J=(H+j)/2;G>0&&P.append("line").attr("x1",H).attr("x2",H).attr("y1",i.padding).attr("y2",f-i.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),P.append("text").attr("class","wardley-stage-label").attr("x",J).attr("y",f-i.padding/1.5).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize-2).attr("text-anchor","middle").text(q)})}if(i.showGrid){let P=p.append("g").attr("class","wardley-grid");for(let $=1;$<4;$++){let F=$/4,q=i.padding+g*F;P.append("line").attr("x1",q).attr("x2",q).attr("y1",i.padding).attr("y2",f-i.padding).attr("stroke",a.gridColor).attr("stroke-dasharray","2 6"),P.append("line").attr("x1",i.padding).attr("x2",h-i.padding).attr("y1",f-i.padding-y*F).attr("y2",f-i.padding-y*F).attr("stroke",a.gridColor).attr("stroke-dasharray","2 6")}}let S=new Map;if(l.nodes.forEach(P=>{S.set(P.id,{x:v(P.x),y:x(P.y),node:P})}),l.pipelines.length>0){let P=p.append("g").attr("class","wardley-pipelines"),$=p.append("g").attr("class","wardley-pipeline-links");l.pipelines.forEach(F=>{if(F.componentIds.length===0)return;let q=F.componentIds.map(j=>({id:j,pos:S.get(j),node:l.nodes.find(J=>J.id===j)})).filter(j=>j.pos&&j.node).sort((j,J)=>j.node.x-J.node.x);for(let j=0;j{let J=S.get(j);J&&(G=Math.min(G,J.x),z=Math.max(z,J.x),H=J.y)}),G!==1/0&&z!==-1/0){let J=i.nodeRadius*4,U=H-J/2,le=S.get(F.nodeId);if(le){let ee=(G+z)/2;le.x=ee,le.y=U-s/6}P.append("rect").attr("class","wardley-pipeline-box").attr("x",G-15).attr("y",U).attr("width",z-G+30).attr("height",J).attr("fill","none").attr("stroke",a.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let E=p.append("g").attr("class","wardley-links"),I=new Map;l.pipelines.forEach(P=>{I.set(P.nodeId,new Set(P.componentIds))});let L=l.links.filter(P=>!(!S.has(P.source)||!S.has(P.target)||I.get(P.target)?.has(P.source)));E.selectAll("line").data(L).enter().append("line").attr("class",P=>`wardley-link${P.dashed?" wardley-link--dashed":""}`).attr("x1",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.source).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=F.x-$.x,H=F.y-$.y,j=Math.sqrt(z*z+H*H);return $.x+z/j*G}).attr("y1",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.source).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=F.x-$.x,H=F.y-$.y,j=Math.sqrt(z*z+H*H);return $.y+H/j*G}).attr("x2",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.target).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=$.x-F.x,H=$.y-F.y,j=Math.sqrt(z*z+H*H);return F.x+z/j*G}).attr("y2",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.target).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=$.x-F.x,H=$.y-F.y,j=Math.sqrt(z*z+H*H);return F.y+H/j*G}).attr("stroke",a.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",P=>P.dashed?"6 6":null).attr("marker-end",P=>P.flow==="forward"||P.flow==="bidirectional"?`url(#link-arrow-end-${t})`:null).attr("marker-start",P=>P.flow==="backward"||P.flow==="bidirectional"?`url(#link-arrow-start-${t})`:null),E.selectAll("text").data(L.filter(P=>P.label)).enter().append("text").attr("class","wardley-link-label").attr("x",P=>{let $=S.get(P.source),F=S.get(P.target),q=($.x+F.x)/2,G=F.y-$.y,z=F.x-$.x,H=Math.sqrt(z*z+G*G),j=8,J=G/H;return q+J*j}).attr("y",P=>{let $=S.get(P.source),F=S.get(P.target),q=($.y+F.y)/2,G=F.x-$.x,z=F.y-$.y,H=Math.sqrt(G*G+z*z),j=8,J=-G/H;return q+J*j}).attr("fill",a.axisTextColor).attr("font-size",i.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",P=>{let $=S.get(P.source),F=S.get(P.target),q=($.x+F.x)/2,G=($.y+F.y)/2,z=F.x-$.x,H=F.y-$.y,j=Math.sqrt(z*z+H*H),J=8,U=H/j,le=-z/j,ee=q+U*J,ue=G+le*J,ae=Math.atan2(H,z)*180/Math.PI;return(ae>90||ae<-90)&&(ae+=180),`rotate(${ae} ${ee} ${ue})`}).text(P=>P.label);let O=p.append("g").attr("class","wardley-trends"),R=l.trends.map(P=>{let $=S.get(P.nodeId);if(!$)return null;let F=v(P.targetX),q=x(P.targetY),G=F-$.x,z=q-$.y,H=Math.sqrt(G*G+z*z),j=i.nodeRadius+2,J=H>j?F-G/H*j:F,U=H>j?q-z/H*j:q;return{origin:$,targetX:F,targetY:q,adjustedX2:J,adjustedY2:U}}).filter(P=>P!==null);O.selectAll("line").data(R).enter().append("line").attr("class","wardley-trend").attr("x1",P=>P.origin.x).attr("y1",P=>P.origin.y).attr("x2",P=>P.adjustedX2).attr("y2",P=>P.adjustedY2).attr("stroke",a.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${t})`);let N=p.append("g").attr("class","wardley-nodes").selectAll("g").data(l.nodes).enter().append("g").attr("class",P=>["wardley-node",P.className?`wardley-node--${P.className}`:""].filter(Boolean).join(" "));N.filter(P=>P.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","#666").attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>P.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","#ccc").attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>P.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let M=N.filter(P=>P.sourceStrategy==="market");M.append("circle").attr("class","wardley-market-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>!P.isPipelineParent&&P.sourceStrategy!=="market"&&P.className!=="anchor").append("circle").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius).attr("fill",a.componentFill).attr("stroke",a.componentStroke).attr("stroke-width",1);let D=i.nodeRadius*.7,B=i.nodeRadius*1.2;if(M.append("line").attr("class","wardley-market-line").attr("x1",P=>S.get(P.id).x).attr("y1",P=>S.get(P.id).y-B).attr("x2",P=>S.get(P.id).x-B*Math.cos(Math.PI/6)).attr("y2",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("line").attr("class","wardley-market-line").attr("x1",P=>S.get(P.id).x-B*Math.cos(Math.PI/6)).attr("y1",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("x2",P=>S.get(P.id).x+B*Math.cos(Math.PI/6)).attr("y2",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("line").attr("class","wardley-market-line").attr("x1",P=>S.get(P.id).x+B*Math.cos(Math.PI/6)).attr("y1",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("x2",P=>S.get(P.id).x).attr("y2",P=>S.get(P.id).y-B).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("circle").attr("class","wardley-market-dot").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y-B).attr("r",D).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),M.append("circle").attr("class","wardley-market-dot").attr("cx",P=>S.get(P.id).x-B*Math.cos(Math.PI/6)).attr("cy",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("r",D).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),M.append("circle").attr("class","wardley-market-dot").attr("cx",P=>S.get(P.id).x+B*Math.cos(Math.PI/6)).attr("cy",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("r",D).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),N.filter(P=>P.isPipelineParent===!0).append("rect").attr("x",P=>S.get(P.id).x-s/2).attr("y",P=>S.get(P.id).y-s/2).attr("width",s).attr("height",s).attr("fill",a.componentFill).attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>P.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",P=>{let $=S.get(P.id),F=P.isPipelineParent?s/2+15:i.nodeRadius+15;return P.sourceStrategy&&(F+=i.nodeRadius+10),$.x+F}).attr("y1",P=>{let $=S.get(P.id),F=P.isPipelineParent?s:i.nodeRadius*2;return $.y-F/2}).attr("x2",P=>{let $=S.get(P.id),F=P.isPipelineParent?s/2+15:i.nodeRadius+15;return P.sourceStrategy&&(F+=i.nodeRadius+10),$.x+F}).attr("y2",P=>{let $=S.get(P.id),F=P.isPipelineParent?s:i.nodeRadius*2;return $.y+F/2}).attr("stroke",a.componentStroke).attr("stroke-width",6),N.append("text").attr("x",P=>{let $=S.get(P.id);if(P.className==="anchor")return P.labelOffsetX!==void 0?$.x+P.labelOffsetX:$.x;let F=i.nodeLabelOffset;P.sourceStrategy&&P.labelOffsetX===void 0&&(F+=10);let q=P.labelOffsetX??F;return $.x+q}).attr("y",P=>{let $=S.get(P.id);if(P.className==="anchor")return P.labelOffsetY!==void 0?$.y+P.labelOffsetY:$.y-3;let F=-i.nodeLabelOffset;P.sourceStrategy&&P.labelOffsetY===void 0&&(F-=10);let q=P.labelOffsetY??F;return $.y+q}).attr("class","wardley-node-label").attr("fill",P=>P.className==="evolved"?a.evolutionStroke:P.className==="anchor"?"#000":a.componentLabelColor).attr("font-size",i.labelFontSize).attr("font-weight",P=>P.className==="anchor"?"bold":"normal").attr("text-anchor",P=>P.className==="anchor"?"middle":"start").attr("dominant-baseline",P=>P.className==="anchor"?"middle":"auto").text(P=>P.label),l.annotations.length>0){let P=p.append("g").attr("class","wardley-annotations");if(l.annotations.forEach($=>{let F=$.coordinates.map(q=>({x:v(q.x),y:x(q.y)}));if(F.length>1)for(let q=0;q{let G=P.append("g").attr("class","wardley-annotation");G.append("circle").attr("cx",q.x).attr("cy",q.y).attr("r",10).attr("fill","white").attr("stroke",a.axisColor).attr("stroke-width",1.5),G.append("text").attr("x",q.x).attr("y",q.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.number)})}),l.annotationsBox){let $=v(l.annotationsBox.x),F=x(l.annotationsBox.y),q=10,G=16,z=11,H=P.append("g").attr("class","wardley-annotations-box"),j=[...l.annotations].filter(U=>U.text).sort((U,le)=>U.number-le.number),J=[];if(j.forEach((U,le)=>{let ee=H.append("text").attr("x",$+q).attr("y",F+q+(le+1)*G).attr("font-size",z).attr("fill",a.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${U.number}. ${U.text}`);J.push(ee)}),J.length>0){let U=0,le=0;J.forEach(Oe=>{let qe=Oe.node(),Ge=qe.getComputedTextLength();U=Math.max(U,Ge);let fe=qe.getBBox();le=Math.max(le,fe.height)});let ee=U+q*2+105,ue=j.length*G+q*2+le/2,ae=i.padding,oe=h-i.padding-ee,Re=i.padding,Te=f-i.padding-ue;$=Math.max(ae,Math.min($,oe)),F=Math.max(Re,Math.min(F,Te)),J.forEach((Oe,qe)=>{Oe.attr("x",$+q).attr("y",F+q+(qe+1)*G)}),H.insert("rect","text").attr("x",$).attr("y",F).attr("width",ee).attr("height",ue).attr("fill","white").attr("stroke",a.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(l.notes.length>0){let P=p.append("g").attr("class","wardley-notes");l.notes.forEach($=>{let F=v($.x),q=x($.y);P.append("text").attr("x",F).attr("y",q).attr("text-anchor","start").attr("font-size",11).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.text)})}if(l.accelerators.length>0){let P=p.append("g").attr("class","wardley-accelerators");l.accelerators.forEach($=>{let F=v($.x),q=x($.y),G=60,z=30,H=20,j=` + `},"getStyles"),iar=nar,aar={parser:Utt,get db(){return new Wtt},renderer:tar,styles:iar}});var prt={};Tr(prt,{diagram:()=>gar});function Ztt(){return Be()["wardley-beta"]}function Qtt(e,t,r,n,i,a,s,o,l){Ko.addNode({id:e,label:t,x:r,y:n,className:i,labelOffsetX:a,labelOffsetY:s,inertia:o,sourceStrategy:l})}function Jtt(e,t,r=!1,n,i){Ko.addLink({source:e,target:t,dashed:r,label:n,flow:i})}function ert(e,t,r){Ko.addTrend({nodeId:e,targetX:t,targetY:r})}function trt(e,t,r){Ko.addAnnotation({number:e,coordinates:t,text:r})}function rrt(e,t,r){Ko.addNote({text:e,x:t,y:r})}function nrt(e,t,r){Ko.addAccelerator({name:e,x:t,y:r})}function irt(e,t,r){Ko.addDeaccelerator({name:e,x:t,y:r})}function art(e,t){Ko.setAnnotationsBox(e,t)}function srt(e,t){Ko.setSize(e,t)}function ort(e){Ko.startPipeline(e)}function lrt(e,t){Ko.addPipelineComponent(e,t)}function crt(e){Ko.setAxes(e)}function urt(e){return Ko.getNode(e)}function hrt(e){return Ko.resolveNodeId(e)}function frt(){return Ko.build()}function drt(){Ko.clear(),Nr()}var JO,q2,jtt,sar,oar,Ktt,lar,Ko,car,uar,har,far,dar,par,mar,gar,mrt=W(()=>{El();za();Sn();_r();Rr();hr();Co();JO=b((e,t)=>{let r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),q2=b((e,t,r)=>({x:JO(t,`${r} evolution`),y:JO(e,`${r} visibility`)}),"toCoordinates"),jtt=b(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),sar=b(e=>{if(!e?.startsWith("+"))return{};let r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),oar=b((e,t)=>{if(wi(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let r=e.evolution.stages.map(i=>i.secondName?`${i.name.trim()} / ${i.secondName.trim()}`:i.name.trim()),n=e.evolution.stages.filter(i=>i.boundary!==void 0).map(i=>i.boundary);t.updateAxes({stages:r,stageBoundaries:n})}if(e.anchors.forEach(r=>{let n=q2(r.visibility,r.evolution,`Anchor "${r.name}"`);t.addNode(r.name,r.name,n.x,n.y,"anchor")}),e.components.forEach(r=>{let n=q2(r.visibility,r.evolution,`Component "${r.name}"`),i=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,a=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,s=r.decorator?.strategy;t.addNode(r.name,r.name,n.x,n.y,"component",i,a,r.inertia,s)}),e.notes.forEach(r=>{let n=q2(r.visibility,r.evolution,`Note "${r.text}"`);t.addNote(r.text,n.x,n.y)}),e.pipelines.forEach(r=>{let n=t.getNode(r.parent);if(!n||typeof n.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);let i=n.y;t.startPipeline(r.parent),r.components.forEach(a=>{let s=`${r.parent}_${a.name}`,o=a.label?(a.label.negX?-1:1)*a.label.offsetX:void 0,l=a.label?(a.label.negY?-1:1)*a.label.offsetY:void 0,u=JO(a.evolution,`Pipeline component "${a.name}" evolution`);t.addNode(s,a.name,u,i,"pipeline-component",o,l),t.addPipelineComponent(r.parent,s)})}),e.links.forEach(r=>{let n=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-.")),i=jtt(r.fromPort)??jtt(r.toPort),{flow:a,label:s}=sar(r.arrow);!i&&a&&(i=a);let o=r.linkLabel,l=s??o;t.addLink(t.resolveNodeId(r.from),t.resolveNodeId(r.to),n,l,i)}),e.evolves.forEach(r=>{let n=t.getNode(r.component);if(n?.y!==void 0){let i=JO(r.target,`Evolve target for "${r.component}"`);t.addTrend(r.component,i,n.y)}}),e.annotations.length>0){let r=e.annotations[0],n=q2(r.x,r.y,"Annotations box");t.setAnnotationsBox(n.x,n.y)}e.annotation.forEach(r=>{let n=q2(r.x,r.y,`Annotation ${r.number}`);t.addAnnotation(r.number,[{x:n.x,y:n.y}],r.text)}),e.accelerators.forEach(r=>{let n=q2(r.x,r.y,`Accelerator "${r.name}"`);t.addAccelerator(r.name,n.x,n.y)}),e.deaccelerators.forEach(r=>{let n=q2(r.x,r.y,`Deaccelerator "${r.name}"`);t.addDeaccelerator(r.name,n.x,n.y)})},"populateDb"),Ktt={parser:{yy:void 0},parse:b(async e=>{let t=await ba("wardley",e);se.debug(t);let r=Ktt.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");oar(t,r)},"parse")},lar=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{b(this,"WardleyBuilder")}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},r={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,r)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let r=this.pipelines.get(e);r&&r.componentIds.push(t);let n=this.nodes.get(t);n&&(n.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,r]of this.nodes)if(r.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!="number"||typeof t.y!="number")throw new Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},Ko=new lar;b(Ztt,"getConfig");b(Qtt,"addNode");b(Jtt,"addLink");b(ert,"addTrend");b(trt,"addAnnotation");b(rrt,"addNote");b(nrt,"addAccelerator");b(irt,"addDeaccelerator");b(art,"setAnnotationsBox");b(srt,"setSize");b(ort,"startPipeline");b(lrt,"addPipelineComponent");b(crt,"updateAxes");b(urt,"getNode");b(hrt,"resolveNodeId");b(frt,"getWardleyData");b(drt,"clear");car={getConfig:Ztt,addNode:Qtt,addLink:Jtt,addTrend:ert,addAnnotation:trt,addNote:rrt,addAccelerator:nrt,addDeaccelerator:irt,setAnnotationsBox:art,setSize:srt,startPipeline:ort,addPipelineComponent:lrt,updateAxes:crt,getNode:urt,resolveNodeId:hrt,getWardleyData:frt,clear:drt,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},uar=["Genesis","Custom Built","Product","Commodity"],har=b(()=>{let{themeVariables:e}=Be();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),far=b(()=>{let e=Be()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),dar=b((e,t,r,n)=>{se.debug(`Rendering Wardley map +`+e);let i=far(),a=har(),s=i.nodeRadius*1.6,o=n.db,l=o.getWardleyData(),u=o.getDiagramTitle(),h=l.size?.width??i.width,f=l.size?.height??i.height,d=Qn(t);d.selectAll("*").remove(),vn(d,f,h,i.useMaxWidth),d.attr("viewBox",`0 0 ${h} ${f}`);let p=d.append("g").attr("class","wardley-map"),m=d.append("defs");m.append("marker").attr("id",`arrow-${t}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",a.evolutionStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-end-${t}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",a.linkStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-start-${t}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",a.linkStroke).attr("stroke","none"),p.append("rect").attr("class","wardley-background").attr("width",h).attr("height",f).attr("fill",a.backgroundColor);let g=h-i.padding*2,y=f-i.padding*2;u&&p.append("text").attr("class","wardley-title").attr("x",h/2).attr("y",i.padding/2).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(u);let v=b(P=>i.padding+P/100*g,"projectX"),x=b(P=>f-i.padding-P/100*y,"projectY"),w=p.append("g").attr("class","wardley-axes");w.append("line").attr("x1",i.padding).attr("x2",h-i.padding).attr("y1",f-i.padding).attr("y2",f-i.padding).attr("stroke",a.axisColor).attr("stroke-width",1),w.append("line").attr("x1",i.padding).attr("x2",i.padding).attr("y1",i.padding).attr("y2",f-i.padding).attr("stroke",a.axisColor).attr("stroke-width",1);let C=l.axes.xLabel??"Evolution",T=l.axes.yLabel??"Visibility";w.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",i.padding+g/2).attr("y",f-i.padding/4).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(C),w.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",i.padding/3).attr("y",i.padding+y/2).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${i.padding/3} ${i.padding+y/2})`).text(T);let k=l.axes.stages&&l.axes.stages.length>0?l.axes.stages:uar;if(k.length>0){let P=p.append("g").attr("class","wardley-stages"),$=l.axes.stageBoundaries,F=[];if($&&$.length===k.length){let q=0;$.forEach(G=>{F.push({start:q,end:G}),q=G})}else{let q=1/k.length;k.forEach((G,z)=>{F.push({start:z*q,end:(z+1)*q})})}k.forEach((q,G)=>{let z=F[G],H=i.padding+z.start*g,j=i.padding+z.end*g,J=(H+j)/2;G>0&&P.append("line").attr("x1",H).attr("x2",H).attr("y1",i.padding).attr("y2",f-i.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),P.append("text").attr("class","wardley-stage-label").attr("x",J).attr("y",f-i.padding/1.5).attr("fill",a.axisTextColor).attr("font-size",i.axisFontSize-2).attr("text-anchor","middle").text(q)})}if(i.showGrid){let P=p.append("g").attr("class","wardley-grid");for(let $=1;$<4;$++){let F=$/4,q=i.padding+g*F;P.append("line").attr("x1",q).attr("x2",q).attr("y1",i.padding).attr("y2",f-i.padding).attr("stroke",a.gridColor).attr("stroke-dasharray","2 6"),P.append("line").attr("x1",i.padding).attr("x2",h-i.padding).attr("y1",f-i.padding-y*F).attr("y2",f-i.padding-y*F).attr("stroke",a.gridColor).attr("stroke-dasharray","2 6")}}let S=new Map;if(l.nodes.forEach(P=>{S.set(P.id,{x:v(P.x),y:x(P.y),node:P})}),l.pipelines.length>0){let P=p.append("g").attr("class","wardley-pipelines"),$=p.append("g").attr("class","wardley-pipeline-links");l.pipelines.forEach(F=>{if(F.componentIds.length===0)return;let q=F.componentIds.map(j=>({id:j,pos:S.get(j),node:l.nodes.find(J=>J.id===j)})).filter(j=>j.pos&&j.node).sort((j,J)=>j.node.x-J.node.x);for(let j=0;j{let J=S.get(j);J&&(G=Math.min(G,J.x),z=Math.max(z,J.x),H=J.y)}),G!==1/0&&z!==-1/0){let J=i.nodeRadius*4,U=H-J/2,le=S.get(F.nodeId);if(le){let ee=(G+z)/2;le.x=ee,le.y=U-s/6}P.append("rect").attr("class","wardley-pipeline-box").attr("x",G-15).attr("y",U).attr("width",z-G+30).attr("height",J).attr("fill","none").attr("stroke",a.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let E=p.append("g").attr("class","wardley-links"),I=new Map;l.pipelines.forEach(P=>{I.set(P.nodeId,new Set(P.componentIds))});let L=l.links.filter(P=>!(!S.has(P.source)||!S.has(P.target)||I.get(P.target)?.has(P.source)));E.selectAll("line").data(L).enter().append("line").attr("class",P=>`wardley-link${P.dashed?" wardley-link--dashed":""}`).attr("x1",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.source).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=F.x-$.x,H=F.y-$.y,j=Math.sqrt(z*z+H*H);return $.x+z/j*G}).attr("y1",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.source).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=F.x-$.x,H=F.y-$.y,j=Math.sqrt(z*z+H*H);return $.y+H/j*G}).attr("x2",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.target).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=$.x-F.x,H=$.y-F.y,j=Math.sqrt(z*z+H*H);return F.x+z/j*G}).attr("y2",P=>{let $=S.get(P.source),F=S.get(P.target),G=l.nodes.find(J=>J.id===P.target).isPipelineParent?s/Math.sqrt(2):i.nodeRadius,z=$.x-F.x,H=$.y-F.y,j=Math.sqrt(z*z+H*H);return F.y+H/j*G}).attr("stroke",a.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",P=>P.dashed?"6 6":null).attr("marker-end",P=>P.flow==="forward"||P.flow==="bidirectional"?`url(#link-arrow-end-${t})`:null).attr("marker-start",P=>P.flow==="backward"||P.flow==="bidirectional"?`url(#link-arrow-start-${t})`:null),E.selectAll("text").data(L.filter(P=>P.label)).enter().append("text").attr("class","wardley-link-label").attr("x",P=>{let $=S.get(P.source),F=S.get(P.target),q=($.x+F.x)/2,G=F.y-$.y,z=F.x-$.x,H=Math.sqrt(z*z+G*G),j=8,J=G/H;return q+J*j}).attr("y",P=>{let $=S.get(P.source),F=S.get(P.target),q=($.y+F.y)/2,G=F.x-$.x,z=F.y-$.y,H=Math.sqrt(G*G+z*z),j=8,J=-G/H;return q+J*j}).attr("fill",a.axisTextColor).attr("font-size",i.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",P=>{let $=S.get(P.source),F=S.get(P.target),q=($.x+F.x)/2,G=($.y+F.y)/2,z=F.x-$.x,H=F.y-$.y,j=Math.sqrt(z*z+H*H),J=8,U=H/j,le=-z/j,ee=q+U*J,ue=G+le*J,ae=Math.atan2(H,z)*180/Math.PI;return(ae>90||ae<-90)&&(ae+=180),`rotate(${ae} ${ee} ${ue})`}).text(P=>P.label);let O=p.append("g").attr("class","wardley-trends"),R=l.trends.map(P=>{let $=S.get(P.nodeId);if(!$)return null;let F=v(P.targetX),q=x(P.targetY),G=F-$.x,z=q-$.y,H=Math.sqrt(G*G+z*z),j=i.nodeRadius+2,J=H>j?F-G/H*j:F,U=H>j?q-z/H*j:q;return{origin:$,targetX:F,targetY:q,adjustedX2:J,adjustedY2:U}}).filter(P=>P!==null);O.selectAll("line").data(R).enter().append("line").attr("class","wardley-trend").attr("x1",P=>P.origin.x).attr("y1",P=>P.origin.y).attr("x2",P=>P.adjustedX2).attr("y2",P=>P.adjustedY2).attr("stroke",a.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${t})`);let N=p.append("g").attr("class","wardley-nodes").selectAll("g").data(l.nodes).enter().append("g").attr("class",P=>["wardley-node",P.className?`wardley-node--${P.className}`:""].filter(Boolean).join(" "));N.filter(P=>P.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","#666").attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>P.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","#ccc").attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>P.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let M=N.filter(P=>P.sourceStrategy==="market");M.append("circle").attr("class","wardley-market-overlay").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius*2).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>!P.isPipelineParent&&P.sourceStrategy!=="market"&&P.className!=="anchor").append("circle").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y).attr("r",i.nodeRadius).attr("fill",a.componentFill).attr("stroke",a.componentStroke).attr("stroke-width",1);let D=i.nodeRadius*.7,B=i.nodeRadius*1.2;if(M.append("line").attr("class","wardley-market-line").attr("x1",P=>S.get(P.id).x).attr("y1",P=>S.get(P.id).y-B).attr("x2",P=>S.get(P.id).x-B*Math.cos(Math.PI/6)).attr("y2",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("line").attr("class","wardley-market-line").attr("x1",P=>S.get(P.id).x-B*Math.cos(Math.PI/6)).attr("y1",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("x2",P=>S.get(P.id).x+B*Math.cos(Math.PI/6)).attr("y2",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("line").attr("class","wardley-market-line").attr("x1",P=>S.get(P.id).x+B*Math.cos(Math.PI/6)).attr("y1",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("x2",P=>S.get(P.id).x).attr("y2",P=>S.get(P.id).y-B).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("circle").attr("class","wardley-market-dot").attr("cx",P=>S.get(P.id).x).attr("cy",P=>S.get(P.id).y-B).attr("r",D).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),M.append("circle").attr("class","wardley-market-dot").attr("cx",P=>S.get(P.id).x-B*Math.cos(Math.PI/6)).attr("cy",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("r",D).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),M.append("circle").attr("class","wardley-market-dot").attr("cx",P=>S.get(P.id).x+B*Math.cos(Math.PI/6)).attr("cy",P=>S.get(P.id).y+B*Math.sin(Math.PI/6)).attr("r",D).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),N.filter(P=>P.isPipelineParent===!0).append("rect").attr("x",P=>S.get(P.id).x-s/2).attr("y",P=>S.get(P.id).y-s/2).attr("width",s).attr("height",s).attr("fill",a.componentFill).attr("stroke",a.componentStroke).attr("stroke-width",1),N.filter(P=>P.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",P=>{let $=S.get(P.id),F=P.isPipelineParent?s/2+15:i.nodeRadius+15;return P.sourceStrategy&&(F+=i.nodeRadius+10),$.x+F}).attr("y1",P=>{let $=S.get(P.id),F=P.isPipelineParent?s:i.nodeRadius*2;return $.y-F/2}).attr("x2",P=>{let $=S.get(P.id),F=P.isPipelineParent?s/2+15:i.nodeRadius+15;return P.sourceStrategy&&(F+=i.nodeRadius+10),$.x+F}).attr("y2",P=>{let $=S.get(P.id),F=P.isPipelineParent?s:i.nodeRadius*2;return $.y+F/2}).attr("stroke",a.componentStroke).attr("stroke-width",6),N.append("text").attr("x",P=>{let $=S.get(P.id);if(P.className==="anchor")return P.labelOffsetX!==void 0?$.x+P.labelOffsetX:$.x;let F=i.nodeLabelOffset;P.sourceStrategy&&P.labelOffsetX===void 0&&(F+=10);let q=P.labelOffsetX??F;return $.x+q}).attr("y",P=>{let $=S.get(P.id);if(P.className==="anchor")return P.labelOffsetY!==void 0?$.y+P.labelOffsetY:$.y-3;let F=-i.nodeLabelOffset;P.sourceStrategy&&P.labelOffsetY===void 0&&(F-=10);let q=P.labelOffsetY??F;return $.y+q}).attr("class","wardley-node-label").attr("fill",P=>P.className==="evolved"?a.evolutionStroke:P.className==="anchor"?"#000":a.componentLabelColor).attr("font-size",i.labelFontSize).attr("font-weight",P=>P.className==="anchor"?"bold":"normal").attr("text-anchor",P=>P.className==="anchor"?"middle":"start").attr("dominant-baseline",P=>P.className==="anchor"?"middle":"auto").text(P=>P.label),l.annotations.length>0){let P=p.append("g").attr("class","wardley-annotations");if(l.annotations.forEach($=>{let F=$.coordinates.map(q=>({x:v(q.x),y:x(q.y)}));if(F.length>1)for(let q=0;q{let G=P.append("g").attr("class","wardley-annotation");G.append("circle").attr("cx",q.x).attr("cy",q.y).attr("r",10).attr("fill","white").attr("stroke",a.axisColor).attr("stroke-width",1.5),G.append("text").attr("x",q.x).attr("y",q.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.number)})}),l.annotationsBox){let $=v(l.annotationsBox.x),F=x(l.annotationsBox.y),q=10,G=16,z=11,H=P.append("g").attr("class","wardley-annotations-box"),j=[...l.annotations].filter(U=>U.text).sort((U,le)=>U.number-le.number),J=[];if(j.forEach((U,le)=>{let ee=H.append("text").attr("x",$+q).attr("y",F+q+(le+1)*G).attr("font-size",z).attr("fill",a.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${U.number}. ${U.text}`);J.push(ee)}),J.length>0){let U=0,le=0;J.forEach(Oe=>{let qe=Oe.node(),Ge=qe.getComputedTextLength();U=Math.max(U,Ge);let fe=qe.getBBox();le=Math.max(le,fe.height)});let ee=U+q*2+105,ue=j.length*G+q*2+le/2,ae=i.padding,oe=h-i.padding-ee,Re=i.padding,Te=f-i.padding-ue;$=Math.max(ae,Math.min($,oe)),F=Math.max(Re,Math.min(F,Te)),J.forEach((Oe,qe)=>{Oe.attr("x",$+q).attr("y",F+q+(qe+1)*G)}),H.insert("rect","text").attr("x",$).attr("y",F).attr("width",ee).attr("height",ue).attr("fill","white").attr("stroke",a.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(l.notes.length>0){let P=p.append("g").attr("class","wardley-notes");l.notes.forEach($=>{let F=v($.x),q=x($.y);P.append("text").attr("x",F).attr("y",q).attr("text-anchor","start").attr("font-size",11).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.text)})}if(l.accelerators.length>0){let P=p.append("g").attr("class","wardley-accelerators");l.accelerators.forEach($=>{let F=v($.x),q=x($.y),G=60,z=30,H=20,j=` M ${F} ${q-z/2} L ${F+G-H} ${q-z/2} L ${F+G-H} ${q-z/2-8} @@ -3317,7 +3317,7 @@ Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":Oe="Parse error L ${F+H} ${q+z/2} L ${F+G} ${q+z/2} Z - `;P.append("path").attr("d",j).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",1),P.append("text").attr("x",F+G/2).attr("y",q+z/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.name)})}},"draw"),uar={draw:car},har=b(({wardley:e}={})=>{let t=Go(),r=qt(),n=Rn(t,r.themeVariables),i=Rn(n.wardley,e);return` + `;P.append("path").attr("d",j).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",1),P.append("text").attr("x",F+G/2).attr("y",q+z/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.name)})}},"draw"),par={draw:dar},mar=b(({wardley:e}={})=>{let t=Go(),r=qt(),n=Rn(t,r.themeVariables),i=Rn(n.wardley,e);return` .wardley-background { fill: ${i.backgroundColor}; } @@ -3375,7 +3375,7 @@ Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":Oe="Parse error .wardley-notes text { fill: ${i.axisTextColor}; } - `},"styles"),far={parser:Xtt,db:aar,renderer:uar,styles:har}});var krt={};Tr(krt,{diagram:()=>Rar});function J6(e){let t=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function grt(e){let t=0;for(let r=0;r{Sl();za();Sn();_r();Rr();hr();Co();mrt=b(()=>({domains:new Map,transitions:[]}),"createDefaultData"),eE=mrt(),dar=b(()=>eE.domains,"getDomains"),par=b(()=>eE.transitions,"getTransitions"),mar=b(e=>{if(e)for(let t of e){let r=t.domain,n=(t.items??[]).map(i=>({label:i.label}));eE.domains.set(r,{name:r,items:n})}},"setDomains"),gar=b(e=>{e&&(eE.transitions=e.filter(t=>t.from===t.to?(se.warn(`Cynefin: self-loop transition on domain "${t.from}" is not meaningful and will be skipped.`),!1):!0).map(t=>({from:t.from,to:t.to,label:t.label||void 0})))},"setTransitions"),yar=b(()=>Rn({...Lr.cynefin,...qt().cynefin}),"getConfig"),xar=b(()=>{Nr(),eE=mrt()},"clear"),eP={getDomains:dar,getTransitions:par,setDomains:mar,setTransitions:gar,getConfig:yar,clear:xar,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},bar=b(e=>{wi(e,eP),eP.setDomains(e.domains),eP.setTransitions(e.transitions)},"populate"),war={parse:b(async e=>{let t=await ba("cynefin",e);se.debug(t),bar(t)},"parse")};b(J6,"seededRandom");b(grt,"hashString");b(yrt,"resolveSeed");b(vrt,"generateFoldPath");b(xrt,"generateHorizontalBoundary");b(brt,"generateCliffPath");b(wrt,"generateConfusionPath");prt={complex:{model:"Probe \u2192 Sense \u2192 Respond",practice:"Emergent Practices"},complicated:{model:"Sense \u2192 Analyse \u2192 Respond",practice:"Good Practices"},clear:{model:"Sense \u2192 Categorise \u2192 Respond",practice:"Best Practices"},chaotic:{model:"Act \u2192 Sense \u2192 Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},kar=b((e,t)=>{let r=e/2,n=t/2;return{complex:{cx:r/2,cy:n/2,x:0,y:0,w:r,h:n},complicated:{cx:r+r/2,cy:n/2,x:r,y:0,w:r,h:n},chaotic:{cx:r/2,cy:n+n/2,x:0,y:n,w:r,h:n},clear:{cx:r+r/2,cy:n+n/2,x:r,y:n,w:r,h:n},confusion:{cx:r,cy:n,x:r*.7,y:n*.7,w:r*.6,h:n*.6}}},"getDomainLayouts"),Tar=b(()=>{let e=Go(),t=qt();return Rn(e,t.themeVariables).cynefin},"getCynefinDomainColors"),Wse=3,Car=b((e,t,r,n)=>{let i=n.db,a=i.getDomains(),s=i.getTransitions(),o=i.getDiagramTitle(),l=i.getAccTitle(),u=i.getAccDescription(),h=i.getConfig(),f=Tar();se.debug("Rendering Cynefin diagram");let d=h.width,p=h.height,m=h.padding,g=h.showDomainDescriptions,y=h.boundaryAmplitude,v=d+m*2,x=p+m*2,w={complex:f.complexBg,complicated:f.complicatedBg,clear:f.clearBg,chaotic:f.chaoticBg,confusion:f.confusionBg},C=Qn(t);vn(C,x,v,h.useMaxWidth??!0),C.attr("viewBox",`0 0 ${v} ${x}`),l&&C.append("title").text(l),u&&C.append("desc").text(u);let T=C.append("g").attr("transform",`translate(${m}, ${m})`),k=kar(d,p),S=yrt(h.seed,t),E=T.append("g").attr("class","cynefin-backgrounds"),I=["complex","complicated","chaotic","clear"];for(let P of I){let $=k[P];E.append("rect").attr("class","cynefinDomain").attr("x",$.x).attr("y",$.y).attr("width",$.w).attr("height",$.h).attr("fill",w[P]).attr("fill-opacity",.4).attr("stroke","none")}let L=T.append("g").attr("class","cynefin-boundaries");L.append("path").attr("class","cynefinBoundary").attr("d",vrt(d,p,S,y)).attr("fill","none"),L.append("path").attr("class","cynefinBoundary").attr("d",xrt(d,p,S+100,y)).attr("fill","none"),L.append("path").attr("class","cynefinCliff").attr("d",brt(d,p)).attr("fill","none");let O=d*.15,R=p*.15;T.append("path").attr("class","cynefinConfusion").attr("d",wrt(d/2,p/2,O,R)).attr("fill",w.confusion).attr("fill-opacity",.5);let A=T.append("g").attr("class","cynefin-labels");for(let P of I){let $=k[P];A.append("text").attr("class","cynefinDomainLabel").attr("x",$.cx).attr("y",g?$.cy-30:$.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(P.charAt(0).toUpperCase()+P.slice(1))}if(A.append("text").attr("class","cynefinDomainLabel").attr("x",d/2).attr("y",g?p/2-10:p/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),g){let P=T.append("g").attr("class","cynefin-subtitles");for(let $ of I){let F=k[$],q=prt[$];P.append("text").attr("class","cynefinSubtitle").attr("x",F.cx).attr("y",F.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(q.model),P.append("text").attr("class","cynefinSubtitle").attr("x",F.cx).attr("y",F.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(q.practice)}P.append("text").attr("class","cynefinSubtitle").attr("x",d/2).attr("y",p/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(prt.confusion.practice)}let N=T.append("g").attr("class","cynefin-items"),M=26,D=10,B=["complex","complicated","chaotic","clear","confusion"];for(let P of B){let $=a.get(P);if(!$||$.items.length===0)continue;let F=k[P],q=P==="confusion",G=$.items,z=0;q&&$.items.length>Wse&&(z=$.items.length-Wse,G=$.items.slice(0,Wse));let H;if(q){let j=g?22:14;H=F.cy+j}else H=F.cy+(g?25:15);if([...G].forEach((j,J)=>{let U=H+J*(M+4),le=N.append("g"),ee=le.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",M/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(j.label),ue=j.label.length*7,ae=ee.node();if(ae&&typeof ae.getBBox=="function"){let Te=ae.getBBox();Te.width>0&&(ue=Te.width)}let oe=ue+D*2,Re=F.cx-oe/2;le.attr("transform",`translate(${Re}, ${U})`),le.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",oe).attr("height",M).attr("rx",4).attr("ry",4).attr("fill",w[P]).attr("fill-opacity",.95),ee.attr("x",oe/2).attr("y",M/2)}),z>0){let j=H+G.length*(M+4),J=`+${z} more`,U=N.append("g"),le=U.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",M/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(J),ee=J.length*7,ue=le.node();if(ue&&typeof ue.getBBox=="function"){let Re=ue.getBBox();Re.width>0&&(ee=Re.width)}let ae=ee+D*2,oe=F.cx-ae/2;U.attr("transform",`translate(${oe}, ${j})`),U.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",ae).attr("height",M).attr("rx",4).attr("ry",4).attr("fill",w[P]).attr("fill-opacity",.6),le.attr("x",ae/2).attr("y",M/2)}}if(s.length>0){let P=C.select("defs").empty()?C.append("defs"):C.select("defs"),$=`cynefin-arrow-${t}`;P.append("marker").attr("id",$).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");let F=T.append("g").attr("class","cynefin-arrows");s.forEach(q=>{let G=k[q.from],z=k[q.to];if(!G||!z)return;if(q.from===q.to){se.warn(`Cynefin renderer: skipping self-loop on domain "${q.from}"`);return}let H=G.cx,j=G.cy,J=z.cx,U=z.cy,le=(H+J)/2,ee=(j+U)/2,ue=J-H,ae=U-j,oe=Math.sqrt(ue*ue+ae*ae),Re=oe*.15,Te=-ae/oe,Oe=ue/oe,qe=le+Te*Re,Ge=ee+Oe*Re;F.append("path").attr("class","cynefinArrowLine").attr("d",`M${H},${j} Q${qe},${Ge} ${J},${U}`).attr("fill","none").attr("marker-end",`url(#${$})`),q.label&&F.append("text").attr("class","cynefinArrowLabel").attr("x",qe).attr("y",Ge-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(q.label)})}o&&T.append("text").attr("class","cynefinTitle").attr("x",d/2).attr("y",-m/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(o)},"draw"),Sar={draw:Car},Ear=b(()=>{let e=Go(),t=qt();return Rn(e,t.themeVariables).cynefin},"getCynefinTheme"),Aar=b(()=>{let e=Ear();return` + `},"styles"),gar={parser:Ktt,db:car,renderer:par,styles:mar}});var Crt={};Tr(Crt,{diagram:()=>Nar});function J6(e){let t=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function vrt(e){let t=0;for(let r=0;r{El();za();Sn();_r();Rr();hr();Co();yrt=b(()=>({domains:new Map,transitions:[]}),"createDefaultData"),eE=yrt(),yar=b(()=>eE.domains,"getDomains"),xar=b(()=>eE.transitions,"getTransitions"),bar=b(e=>{if(e)for(let t of e){let r=t.domain,n=(t.items??[]).map(i=>({label:i.label}));eE.domains.set(r,{name:r,items:n})}},"setDomains"),war=b(e=>{e&&(eE.transitions=e.filter(t=>t.from===t.to?(se.warn(`Cynefin: self-loop transition on domain "${t.from}" is not meaningful and will be skipped.`),!1):!0).map(t=>({from:t.from,to:t.to,label:t.label||void 0})))},"setTransitions"),kar=b(()=>Rn({...Lr.cynefin,...qt().cynefin}),"getConfig"),Tar=b(()=>{Nr(),eE=yrt()},"clear"),eP={getDomains:yar,getTransitions:xar,setDomains:bar,setTransitions:war,getConfig:kar,clear:Tar,setAccTitle:Yr,getAccTitle:Qr,setDiagramTitle:ln,getDiagramTitle:tn,getAccDescription:en,setAccDescription:Jr},Car=b(e=>{wi(e,eP),eP.setDomains(e.domains),eP.setTransitions(e.transitions)},"populate"),Sar={parse:b(async e=>{let t=await ba("cynefin",e);se.debug(t),Car(t)},"parse")};b(J6,"seededRandom");b(vrt,"hashString");b(xrt,"resolveSeed");b(brt,"generateFoldPath");b(wrt,"generateHorizontalBoundary");b(krt,"generateCliffPath");b(Trt,"generateConfusionPath");grt={complex:{model:"Probe \u2192 Sense \u2192 Respond",practice:"Emergent Practices"},complicated:{model:"Sense \u2192 Analyse \u2192 Respond",practice:"Good Practices"},clear:{model:"Sense \u2192 Categorise \u2192 Respond",practice:"Best Practices"},chaotic:{model:"Act \u2192 Sense \u2192 Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Ear=b((e,t)=>{let r=e/2,n=t/2;return{complex:{cx:r/2,cy:n/2,x:0,y:0,w:r,h:n},complicated:{cx:r+r/2,cy:n/2,x:r,y:0,w:r,h:n},chaotic:{cx:r/2,cy:n+n/2,x:0,y:n,w:r,h:n},clear:{cx:r+r/2,cy:n+n/2,x:r,y:n,w:r,h:n},confusion:{cx:r,cy:n,x:r*.7,y:n*.7,w:r*.6,h:n*.6}}},"getDomainLayouts"),Aar=b(()=>{let e=Go(),t=qt();return Rn(e,t.themeVariables).cynefin},"getCynefinDomainColors"),Use=3,_ar=b((e,t,r,n)=>{let i=n.db,a=i.getDomains(),s=i.getTransitions(),o=i.getDiagramTitle(),l=i.getAccTitle(),u=i.getAccDescription(),h=i.getConfig(),f=Aar();se.debug("Rendering Cynefin diagram");let d=h.width,p=h.height,m=h.padding,g=h.showDomainDescriptions,y=h.boundaryAmplitude,v=d+m*2,x=p+m*2,w={complex:f.complexBg,complicated:f.complicatedBg,clear:f.clearBg,chaotic:f.chaoticBg,confusion:f.confusionBg},C=Qn(t);vn(C,x,v,h.useMaxWidth??!0),C.attr("viewBox",`0 0 ${v} ${x}`),l&&C.append("title").text(l),u&&C.append("desc").text(u);let T=C.append("g").attr("transform",`translate(${m}, ${m})`),k=Ear(d,p),S=xrt(h.seed,t),E=T.append("g").attr("class","cynefin-backgrounds"),I=["complex","complicated","chaotic","clear"];for(let P of I){let $=k[P];E.append("rect").attr("class","cynefinDomain").attr("x",$.x).attr("y",$.y).attr("width",$.w).attr("height",$.h).attr("fill",w[P]).attr("fill-opacity",.4).attr("stroke","none")}let L=T.append("g").attr("class","cynefin-boundaries");L.append("path").attr("class","cynefinBoundary").attr("d",brt(d,p,S,y)).attr("fill","none"),L.append("path").attr("class","cynefinBoundary").attr("d",wrt(d,p,S+100,y)).attr("fill","none"),L.append("path").attr("class","cynefinCliff").attr("d",krt(d,p)).attr("fill","none");let O=d*.15,R=p*.15;T.append("path").attr("class","cynefinConfusion").attr("d",Trt(d/2,p/2,O,R)).attr("fill",w.confusion).attr("fill-opacity",.5);let A=T.append("g").attr("class","cynefin-labels");for(let P of I){let $=k[P];A.append("text").attr("class","cynefinDomainLabel").attr("x",$.cx).attr("y",g?$.cy-30:$.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(P.charAt(0).toUpperCase()+P.slice(1))}if(A.append("text").attr("class","cynefinDomainLabel").attr("x",d/2).attr("y",g?p/2-10:p/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),g){let P=T.append("g").attr("class","cynefin-subtitles");for(let $ of I){let F=k[$],q=grt[$];P.append("text").attr("class","cynefinSubtitle").attr("x",F.cx).attr("y",F.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(q.model),P.append("text").attr("class","cynefinSubtitle").attr("x",F.cx).attr("y",F.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(q.practice)}P.append("text").attr("class","cynefinSubtitle").attr("x",d/2).attr("y",p/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(grt.confusion.practice)}let N=T.append("g").attr("class","cynefin-items"),M=26,D=10,B=["complex","complicated","chaotic","clear","confusion"];for(let P of B){let $=a.get(P);if(!$||$.items.length===0)continue;let F=k[P],q=P==="confusion",G=$.items,z=0;q&&$.items.length>Use&&(z=$.items.length-Use,G=$.items.slice(0,Use));let H;if(q){let j=g?22:14;H=F.cy+j}else H=F.cy+(g?25:15);if([...G].forEach((j,J)=>{let U=H+J*(M+4),le=N.append("g"),ee=le.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",M/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(j.label),ue=j.label.length*7,ae=ee.node();if(ae&&typeof ae.getBBox=="function"){let Te=ae.getBBox();Te.width>0&&(ue=Te.width)}let oe=ue+D*2,Re=F.cx-oe/2;le.attr("transform",`translate(${Re}, ${U})`),le.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",oe).attr("height",M).attr("rx",4).attr("ry",4).attr("fill",w[P]).attr("fill-opacity",.95),ee.attr("x",oe/2).attr("y",M/2)}),z>0){let j=H+G.length*(M+4),J=`+${z} more`,U=N.append("g"),le=U.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",M/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(J),ee=J.length*7,ue=le.node();if(ue&&typeof ue.getBBox=="function"){let Re=ue.getBBox();Re.width>0&&(ee=Re.width)}let ae=ee+D*2,oe=F.cx-ae/2;U.attr("transform",`translate(${oe}, ${j})`),U.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",ae).attr("height",M).attr("rx",4).attr("ry",4).attr("fill",w[P]).attr("fill-opacity",.6),le.attr("x",ae/2).attr("y",M/2)}}if(s.length>0){let P=C.select("defs").empty()?C.append("defs"):C.select("defs"),$=`cynefin-arrow-${t}`;P.append("marker").attr("id",$).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");let F=T.append("g").attr("class","cynefin-arrows");s.forEach(q=>{let G=k[q.from],z=k[q.to];if(!G||!z)return;if(q.from===q.to){se.warn(`Cynefin renderer: skipping self-loop on domain "${q.from}"`);return}let H=G.cx,j=G.cy,J=z.cx,U=z.cy,le=(H+J)/2,ee=(j+U)/2,ue=J-H,ae=U-j,oe=Math.sqrt(ue*ue+ae*ae),Re=oe*.15,Te=-ae/oe,Oe=ue/oe,qe=le+Te*Re,Ge=ee+Oe*Re;F.append("path").attr("class","cynefinArrowLine").attr("d",`M${H},${j} Q${qe},${Ge} ${J},${U}`).attr("fill","none").attr("marker-end",`url(#${$})`),q.label&&F.append("text").attr("class","cynefinArrowLabel").attr("x",qe).attr("y",Ge-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(q.label)})}o&&T.append("text").attr("class","cynefinTitle").attr("x",d/2).attr("y",-m/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(o)},"draw"),Rar={draw:_ar},Lar=b(()=>{let e=Go(),t=qt();return Rn(e,t.themeVariables).cynefin},"getCynefinTheme"),Iar=b(()=>{let e=Lar();return` .cynefinDomain { stroke: none; } @@ -3436,8 +3436,8 @@ Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":Oe="Parse error font-weight: bold; fill: ${e.labelColor}; } - `},"styles"),_ar=Aar,Rar={parser:war,db:eP,renderer:Sar,styles:_ar}});var Hse,Use,Yse,Xse,tP,i1,Ak,Lar,Srt,Ert,Iar,Mar,Nar,Dar,Oar,Par,Bar,Far,$ar,Ti,Ao,zar,Gar,qar,Art,Var,War,_i,_rt,V2,Har,Uar,jse,a1,ju,Yar,Crt,Xar,s1,tE=W(()=>{za();_r();Rr();hr();Hse="",Use="",Yse="",Xse=[],tP=new Map,i1=b(e=>Mr(e,Be()),"sanitizeText"),Ak=b(e=>{switch(e.type){case"terminal":return{...e,value:i1(e.value)};case"nonterminal":return{...e,name:i1(e.name)};case"sequence":return{...e,elements:e.elements.map(Ak)};case"choice":return{...e,alternatives:e.alternatives.map(Ak)};case"optional":return{...e,element:Ak(e.element)};case"repetition":return{...e,element:Ak(e.element),separator:e.separator?Ak(e.separator):void 0};case"special":return{...e,text:i1(e.text)}}},"sanitizeAstNode"),Lar=b(()=>{Hse="",Use="",Yse="",Xse.length=0,tP.clear(),Nr(),se.debug("[Railroad] Database cleared")},"clear"),Srt=b(e=>{Hse=i1(e),se.debug("[Railroad] Title set:",e)},"setTitle"),Ert=b(()=>Hse,"getTitle"),Iar=b(e=>{let t={...e,name:i1(e.name),definition:Ak(e.definition),comment:e.comment?i1(e.comment):void 0};se.debug("[Railroad] Adding rule:",t.name),tP.has(t.name)&&se.warn(`[Railroad] Rule '${t.name}' is already defined. Overwriting.`),Xse.push(t),tP.set(t.name,t)},"addRule"),Mar=b(()=>Xse,"getRules"),Nar=b(e=>tP.get(e),"getRule"),Dar=b(e=>{Use=i1(e).replace(/^\s+/g,""),se.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),Oar=b(()=>Use,"getAccTitle"),Par=b(e=>{Yse=i1(e).replace(/\n\s+/g,` -`),se.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),Bar=b(()=>Yse,"getAccDescription"),Far=Srt,$ar=Ert,Ti={clear:Lar,setTitle:Srt,getTitle:Ert,addRule:Iar,getRules:Mar,getRule:Nar,setAccTitle:Dar,getAccTitle:Oar,setAccDescription:Par,getAccDescription:Bar,setDiagramTitle:Far,getDiagramTitle:$ar},Ao={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},zar=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,Gar=/^[\w "',.-]+$/,qar=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),Art=b(e=>e?Object.keys(e).every(t=>t==="railroad"||qar.has(t)):!1,"isRailroadStyleOptions"),Var=b(e=>e?"railroad"in e&&e.railroad?e.railroad:Art(e)?e:{}:{},"extractRailroadOverrides"),War=b(e=>{if(!e||Art(e))return{};let{railroad:t,svgId:r,theme:n,look:i,...a}=e;return a},"extractThemeOverrides"),_i=b((e,t)=>{if(typeof e!="string")return t;let r=e.trim();return zar.test(r)?r:t},"sanitizeColorValue"),_rt=b((e,t)=>{if(typeof e!="string")return t;let r=e.trim();return Gar.test(r)?r:t},"sanitizeFontFamilyValue"),V2=b((e,t)=>{let r=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(r)&&r>=0?r:t},"sanitizeNumberValue"),Har=b(e=>{let t=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(t)&&t>0?t:void 0},"parseThemeFontSize"),Uar=b(e=>{let t=_rt(e.fontFamily,Ao.fontFamily),r=Har(e.fontSize)??Ao.fontSize;return{...Ao,fontFamily:t,fontSize:r,terminalFill:_i(e.secondBkg??e.secondaryColor,Ao.terminalFill),terminalStroke:_i(e.secondaryBorderColor??e.lineColor,Ao.terminalStroke),terminalTextColor:_i(e.secondaryTextColor??e.textColor,Ao.terminalTextColor),nonTerminalFill:_i(e.mainBkg??e.background,Ao.nonTerminalFill),nonTerminalStroke:_i(e.primaryBorderColor??e.lineColor,Ao.nonTerminalStroke),nonTerminalTextColor:_i(e.primaryTextColor??e.textColor,Ao.nonTerminalTextColor),lineColor:_i(e.lineColor,Ao.lineColor),markerFill:_i(e.lineColor,Ao.markerFill),commentFill:_i(e.labelBackground??e.tertiaryColor,Ao.commentFill),commentStroke:_i(e.tertiaryBorderColor??e.lineColor,Ao.commentStroke),commentTextColor:_i(e.tertiaryTextColor??e.textColor,Ao.commentTextColor),specialFill:_i(e.tertiaryColor??e.secondaryColor,Ao.specialFill),specialStroke:_i(e.tertiaryBorderColor??e.secondaryBorderColor,Ao.specialStroke),ruleNameColor:_i(e.titleColor??e.textColor,Ao.ruleNameColor)}},"buildThemeDefaults"),jse=b(e=>{let t=qt(),r={...Go(),...t.themeVariables??{},...War(e)},n=Uar(r),i={...t.railroad??{},...Var(e)};return{compactMode:i.compactMode??n.compactMode,padding:V2(i.padding,n.padding),verticalSeparation:V2(i.verticalSeparation,n.verticalSeparation),horizontalSeparation:V2(i.horizontalSeparation,n.horizontalSeparation),arcRadius:V2(i.arcRadius,n.arcRadius),fontSize:V2(i.fontSize,n.fontSize),fontFamily:_rt(i.fontFamily,n.fontFamily),terminalFill:_i(i.terminalFill,n.terminalFill),terminalStroke:_i(i.terminalStroke,n.terminalStroke),terminalTextColor:_i(i.terminalTextColor,n.terminalTextColor),nonTerminalFill:_i(i.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:_i(i.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:_i(i.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:_i(i.lineColor,n.lineColor),strokeWidth:V2(i.strokeWidth,n.strokeWidth),markerFill:_i(i.markerFill,n.markerFill),commentFill:_i(i.commentFill,n.commentFill),commentStroke:_i(i.commentStroke,n.commentStroke),commentTextColor:_i(i.commentTextColor,n.commentTextColor),specialFill:_i(i.specialFill,n.specialFill),specialStroke:_i(i.specialStroke,n.specialStroke),ruleNameColor:_i(i.ruleNameColor,n.ruleNameColor),showMarkers:i.showMarkers??n.showMarkers,markerRadius:V2(i.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),a1=b(e=>{let{fontFamily:t,fontSize:r,terminalFill:n,terminalStroke:i,terminalTextColor:a,nonTerminalFill:s,nonTerminalStroke:o,nonTerminalTextColor:l,lineColor:u,strokeWidth:h,markerFill:f,commentFill:d,commentStroke:p,commentTextColor:m,specialFill:g,specialStroke:y,ruleNameColor:v}=jse(e);return` + `},"styles"),Mar=Iar,Nar={parser:Sar,db:eP,renderer:Rar,styles:Mar}});var Yse,Xse,jse,Kse,tP,i1,Ak,Dar,Art,_rt,Oar,Par,Bar,Far,$ar,zar,Gar,qar,Var,Ti,Ao,War,Har,Uar,Rrt,Yar,Xar,_i,Lrt,V2,jar,Kar,Zse,a1,ju,Zar,Ert,Qar,s1,tE=W(()=>{za();_r();Rr();hr();Yse="",Xse="",jse="",Kse=[],tP=new Map,i1=b(e=>Mr(e,Be()),"sanitizeText"),Ak=b(e=>{switch(e.type){case"terminal":return{...e,value:i1(e.value)};case"nonterminal":return{...e,name:i1(e.name)};case"sequence":return{...e,elements:e.elements.map(Ak)};case"choice":return{...e,alternatives:e.alternatives.map(Ak)};case"optional":return{...e,element:Ak(e.element)};case"repetition":return{...e,element:Ak(e.element),separator:e.separator?Ak(e.separator):void 0};case"special":return{...e,text:i1(e.text)}}},"sanitizeAstNode"),Dar=b(()=>{Yse="",Xse="",jse="",Kse.length=0,tP.clear(),Nr(),se.debug("[Railroad] Database cleared")},"clear"),Art=b(e=>{Yse=i1(e),se.debug("[Railroad] Title set:",e)},"setTitle"),_rt=b(()=>Yse,"getTitle"),Oar=b(e=>{let t={...e,name:i1(e.name),definition:Ak(e.definition),comment:e.comment?i1(e.comment):void 0};se.debug("[Railroad] Adding rule:",t.name),tP.has(t.name)&&se.warn(`[Railroad] Rule '${t.name}' is already defined. Overwriting.`),Kse.push(t),tP.set(t.name,t)},"addRule"),Par=b(()=>Kse,"getRules"),Bar=b(e=>tP.get(e),"getRule"),Far=b(e=>{Xse=i1(e).replace(/^\s+/g,""),se.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),$ar=b(()=>Xse,"getAccTitle"),zar=b(e=>{jse=i1(e).replace(/\n\s+/g,` +`),se.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),Gar=b(()=>jse,"getAccDescription"),qar=Art,Var=_rt,Ti={clear:Dar,setTitle:Art,getTitle:_rt,addRule:Oar,getRules:Par,getRule:Bar,setAccTitle:Far,getAccTitle:$ar,setAccDescription:zar,getAccDescription:Gar,setDiagramTitle:qar,getDiagramTitle:Var},Ao={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},War=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,Har=/^[\w "',.-]+$/,Uar=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),Rrt=b(e=>e?Object.keys(e).every(t=>t==="railroad"||Uar.has(t)):!1,"isRailroadStyleOptions"),Yar=b(e=>e?"railroad"in e&&e.railroad?e.railroad:Rrt(e)?e:{}:{},"extractRailroadOverrides"),Xar=b(e=>{if(!e||Rrt(e))return{};let{railroad:t,svgId:r,theme:n,look:i,...a}=e;return a},"extractThemeOverrides"),_i=b((e,t)=>{if(typeof e!="string")return t;let r=e.trim();return War.test(r)?r:t},"sanitizeColorValue"),Lrt=b((e,t)=>{if(typeof e!="string")return t;let r=e.trim();return Har.test(r)?r:t},"sanitizeFontFamilyValue"),V2=b((e,t)=>{let r=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(r)&&r>=0?r:t},"sanitizeNumberValue"),jar=b(e=>{let t=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(t)&&t>0?t:void 0},"parseThemeFontSize"),Kar=b(e=>{let t=Lrt(e.fontFamily,Ao.fontFamily),r=jar(e.fontSize)??Ao.fontSize;return{...Ao,fontFamily:t,fontSize:r,terminalFill:_i(e.secondBkg??e.secondaryColor,Ao.terminalFill),terminalStroke:_i(e.secondaryBorderColor??e.lineColor,Ao.terminalStroke),terminalTextColor:_i(e.secondaryTextColor??e.textColor,Ao.terminalTextColor),nonTerminalFill:_i(e.mainBkg??e.background,Ao.nonTerminalFill),nonTerminalStroke:_i(e.primaryBorderColor??e.lineColor,Ao.nonTerminalStroke),nonTerminalTextColor:_i(e.primaryTextColor??e.textColor,Ao.nonTerminalTextColor),lineColor:_i(e.lineColor,Ao.lineColor),markerFill:_i(e.lineColor,Ao.markerFill),commentFill:_i(e.labelBackground??e.tertiaryColor,Ao.commentFill),commentStroke:_i(e.tertiaryBorderColor??e.lineColor,Ao.commentStroke),commentTextColor:_i(e.tertiaryTextColor??e.textColor,Ao.commentTextColor),specialFill:_i(e.tertiaryColor??e.secondaryColor,Ao.specialFill),specialStroke:_i(e.tertiaryBorderColor??e.secondaryBorderColor,Ao.specialStroke),ruleNameColor:_i(e.titleColor??e.textColor,Ao.ruleNameColor)}},"buildThemeDefaults"),Zse=b(e=>{let t=qt(),r={...Go(),...t.themeVariables??{},...Xar(e)},n=Kar(r),i={...t.railroad??{},...Yar(e)};return{compactMode:i.compactMode??n.compactMode,padding:V2(i.padding,n.padding),verticalSeparation:V2(i.verticalSeparation,n.verticalSeparation),horizontalSeparation:V2(i.horizontalSeparation,n.horizontalSeparation),arcRadius:V2(i.arcRadius,n.arcRadius),fontSize:V2(i.fontSize,n.fontSize),fontFamily:Lrt(i.fontFamily,n.fontFamily),terminalFill:_i(i.terminalFill,n.terminalFill),terminalStroke:_i(i.terminalStroke,n.terminalStroke),terminalTextColor:_i(i.terminalTextColor,n.terminalTextColor),nonTerminalFill:_i(i.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:_i(i.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:_i(i.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:_i(i.lineColor,n.lineColor),strokeWidth:V2(i.strokeWidth,n.strokeWidth),markerFill:_i(i.markerFill,n.markerFill),commentFill:_i(i.commentFill,n.commentFill),commentStroke:_i(i.commentStroke,n.commentStroke),commentTextColor:_i(i.commentTextColor,n.commentTextColor),specialFill:_i(i.specialFill,n.specialFill),specialStroke:_i(i.specialStroke,n.specialStroke),ruleNameColor:_i(i.ruleNameColor,n.ruleNameColor),showMarkers:i.showMarkers??n.showMarkers,markerRadius:V2(i.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),a1=b(e=>{let{fontFamily:t,fontSize:r,terminalFill:n,terminalStroke:i,terminalTextColor:a,nonTerminalFill:s,nonTerminalStroke:o,nonTerminalTextColor:l,lineColor:u,strokeWidth:h,markerFill:f,commentFill:d,commentStroke:p,commentTextColor:m,specialFill:g,specialStroke:y,ruleNameColor:v}=Zse(e);return` .railroad-diagram { font-family: ${t}; font-size: ${r}px; @@ -3522,58 +3522,58 @@ Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":Oe="Parse error .railroad-group { /* Grouping container, no specific styles */ } -`},"getStyles"),ju=class{constructor(){this.d=""}static{b(this,"PathBuilder")}moveTo(e,t){return this.d+=`M ${e} ${t} `,this}lineTo(e,t){return this.d+=`L ${e} ${t} `,this}horizontalTo(e){return this.d+=`H ${e} `,this}verticalTo(e){return this.d+=`V ${e} `,this}arcTo(e,t,r,n,i,a,s){return this.d+=`A ${e} ${t} ${r} ${n?1:0} ${i?1:0} ${a} ${s} `,this}build(){return this.d.trim()}},Yar=class{constructor(e,t=jse()){this.textCache=new Map,this.svg=e,this.config=t}static{b(this,"RailroadRenderer")}measureText(e){if(this.textCache.has(e))return this.textCache.get(e);let t=this.svg.append("text").attr("font-family",this.config.fontFamily).attr("font-size",this.config.fontSize).text(e),r=t.node().getBBox(),n={width:r.width,height:r.height};return t.remove(),this.textCache.set(e,n),n}renderTerminal(e,t){let r=this.measureText(t),n=r.width+this.config.padding*2,i=r.height+this.config.padding*2,a=e.append("g").attr("class","railroad-terminal");return a.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i).attr("rx",10).attr("ry",10),a.append("text").attr("x",n/2).attr("y",i/2).text(t),{element:a.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderNonTerminal(e,t){let r=this.measureText(t),n=r.width+this.config.padding*2,i=r.height+this.config.padding*2,a=e.append("g").attr("class","railroad-nonterminal");return a.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i),a.append("text").attr("x",n/2).attr("y",i/2).text(t),{element:a.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderSequence(e,t){let r=t.map(l=>this.renderExpression(e,l)),n=0,i=0,a=0;for(let l of r)n+=l.dimensions.width,i=Math.max(i,l.dimensions.up),a=Math.max(a,l.dimensions.down);n+=(r.length-1)*this.config.horizontalSeparation;let s=e.append("g").attr("class","railroad-sequence"),o=0;for(let l=0;lthis.renderExpression(e,f)),n=0,i=0;for(let f of r)n=Math.max(n,f.dimensions.width),i+=f.dimensions.height;i+=(r.length-1)*this.config.verticalSeparation;let a=this.config.arcRadius,s=a*4,o=n+s,l=e.append("g").attr("class","railroad-choice"),u=0,h=i/2;for(let f of r){let d=u,p=d+f.dimensions.up,m=a*2+(n-f.dimensions.width)/2;l.node().appendChild(f.element).setAttribute("transform",`translate(${m}, ${d})`);let y=new ju,v=p>h;p===h?y.moveTo(0,h).lineTo(m,p):y.moveTo(0,h).arcTo(a,a,0,!1,v,a,h+(v?a:-a)).lineTo(a,p-(v?a:-a)).arcTo(a,a,0,!1,!v,a*2,p).lineTo(m,p),l.append("path").attr("class","railroad-line").attr("d",y.build());let x=new ju,w=m+f.dimensions.width,C=o-a*2;p===h?x.moveTo(w,p).lineTo(o,h):x.moveTo(w,p).lineTo(C,p).arcTo(a,a,0,!1,!v,o-a,p+(v?-a:a)).lineTo(o-a,h+(v?a:-a)).arcTo(a,a,0,!1,v,o,h),l.append("path").attr("class","railroad-line").attr("d",x.build()),u+=f.dimensions.height+this.config.verticalSeparation}return{element:l.node(),dimensions:{width:o,height:i,up:h,down:i-h}}}renderOptional(e,t){let r=this.renderExpression(e,t),n=this.config.arcRadius,i=n*2,a=r.dimensions.width+n*4,s=r.dimensions.height+i,o=e.append("g").attr("class","railroad-optional"),l=n*2,u=i;o.node().appendChild(r.element).setAttribute("transform",`translate(${l}, ${u})`);let f=u+r.dimensions.up,d=new ju().moveTo(0,f).lineTo(n*2,f);o.append("path").attr("class","railroad-line").attr("d",d.build());let p=new ju().moveTo(l+r.dimensions.width,f).lineTo(a,f);o.append("path").attr("class","railroad-line").attr("d",p.build());let m=new ju().moveTo(0,f).arcTo(n,n,0,!1,!1,n,f-n).lineTo(n,n).arcTo(n,n,0,!1,!0,n*2,0).lineTo(a-n*2,0).arcTo(n,n,0,!1,!0,a-n,n).lineTo(a-n,f-n).arcTo(n,n,0,!1,!1,a,f);return o.append("path").attr("class","railroad-line").attr("d",m.build()),{element:o.node(),dimensions:{width:a,height:s,up:f,down:s-f}}}renderRepetition(e,t,r){let n=this.renderExpression(e,t),i=this.config.arcRadius,a=i*2,s=n.dimensions.width+i*4,o=r===0,l=n.dimensions.height+a+(o?a:0),u=e.append("g").attr("class","railroad-repetition"),h=i*2,f=o?a:0;u.node().appendChild(n.element).setAttribute("transform",`translate(${h}, ${f})`);let p=f+n.dimensions.up;u.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(0,p).lineTo(i*2,p).build()),u.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(h+n.dimensions.width,p).lineTo(s,p).build());let m=f+n.dimensions.height+i,g=new ju().moveTo(h+n.dimensions.width,p).arcTo(i,i,0,!1,!0,h+n.dimensions.width+i,p+i).lineTo(h+n.dimensions.width+i,m).arcTo(i,i,0,!1,!0,h+n.dimensions.width,m+i).lineTo(i*2,m+i).arcTo(i,i,0,!1,!0,i,m).lineTo(i,p+i).arcTo(i,i,0,!1,!0,i*2,p);if(u.append("path").attr("class","railroad-line").attr("d",g.build()),o){let y=new ju().moveTo(0,p).arcTo(i,i,0,!1,!1,i,p-i).lineTo(i,i).arcTo(i,i,0,!1,!0,i*2,0).lineTo(s-i*2,0).arcTo(i,i,0,!1,!0,s-i,i).lineTo(s-i,p-i).arcTo(i,i,0,!1,!1,s,p);u.append("path").attr("class","railroad-line").attr("d",y.build())}return{element:u.node(),dimensions:{width:s,height:l,up:p,down:l-p}}}renderSpecial(e,t){let r=this.measureText("? "+t+" ?"),n=r.width+this.config.padding*2,i=r.height+this.config.padding*2,a=e.append("g").attr("class","railroad-special");return a.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i),a.append("text").attr("x",n/2).attr("y",i/2).text("? "+t+" ?"),{element:a.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderExpression(e,t){switch(t.type){case"terminal":return this.renderTerminal(e,t.value);case"nonterminal":return this.renderNonTerminal(e,t.name);case"sequence":return this.renderSequence(e,t.elements);case"choice":return this.renderChoice(e,t.alternatives);case"optional":return this.renderOptional(e,t.element);case"repetition":return this.renderRepetition(e,t.element,t.min);case"special":return this.renderSpecial(e,t.text);default:throw new Error(`Unknown node type: ${t.type}`)}}renderRule(e,t){let r=this.svg.append("g").attr("class","railroad-rule").attr("transform",`translate(0, ${t})`),n=e.name+" =",i=this.measureText(n).width+20,a=i+20,s=r.append("g"),o=this.renderExpression(s,e.definition),l=Math.max(20,o.dimensions.up),u=l-o.dimensions.up;return s.attr("transform",`translate(${a}, ${u})`),r.append("g").attr("class","railroad-rule-name-group").append("text").attr("class","railroad-rule-name").attr("x",0).attr("y",l).text(n),r.append("g").attr("class","railroad-start").append("circle").attr("cx",i).attr("cy",l).attr("r",this.config.markerRadius),r.append("g").attr("class","railroad-end").append("circle").attr("cx",a+o.dimensions.width+10).attr("cy",l).attr("r",this.config.markerRadius),r.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(i+this.config.markerRadius,l).lineTo(a,l).build()),r.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(a+o.dimensions.width,l).lineTo(a+o.dimensions.width+10-this.config.markerRadius,l).build()),{height:Math.max(40,u+o.dimensions.height+this.config.padding*2),width:a+o.dimensions.width+10+this.config.markerRadius}}renderDiagram(e){let t=this.config.padding,r=0;for(let n of e){let i=this.renderRule(n,t);t+=i.height+this.config.verticalSeparation,r=Math.max(r,i.width)}return{width:r+this.config.padding*2,height:t+this.config.padding}}},Crt=b((e,t,r)=>{vn(e,t.height,t.width,r),e.attr("viewBox",`0 0 ${t.width} ${t.height}`)},"configureRailroadSvgSize"),Xar=b((e,t,r)=>{se.debug(`[Railroad] Rendering diagram -`+e);try{let n=Qn(t);n.attr("class","railroad-diagram");let a=qt().railroad?.useMaxWidth??!0,s=Ti.getRules();if(se.debug(`[Railroad] Rendering ${s.length} rules`),s.length===0){se.warn("[Railroad] No rules to render"),Crt(n,{height:100,width:200},a);return}let l=new Yar(n,jse()).renderDiagram(s);Crt(n,l,a),se.debug("[Railroad] Render complete")}catch(n){throw se.error("[Railroad] Render error:",n),n}},"draw"),s1={draw:Xar}});var Lrt={};Tr(Lrt,{default:()=>Jar,diagram:()=>Rrt});var jar,_k,Kar,Zar,Qar,Rrt,Jar,Irt=W(()=>{tE();Sl();za();_r();Rr();hr();Co();jar=Qw().Railroad.parser.LangiumParser,_k=b(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{let t=e.elements.map(_k);return t.length===1?t[0]:{type:"sequence",elements:t}}case"RailroadChoiceExpr":{let t=e.alternatives.map(_k);return t.length===1?t[0]:{type:"choice",alternatives:t}}case"RailroadOptionalExpr":return{type:"optional",element:_k(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:_k(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:_k(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),Kar=b(e=>({name:e.name,definition:_k(e.definition)}),"transformRule"),Zar=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(Kar(t)))},"populateDb"),Qar={parse:b(e=>{Ti.clear(),se.debug("[Railroad Parser] Starting Langium parse");let t=jar.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[Railroad Parser] Parsed rules:",r.rules.length),Zar(r),se.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:Ti}},Rrt={parser:Qar,db:Ti,renderer:s1,styles:a1},Jar=Rrt});var Nrt={};Tr(Nrt,{diagram:()=>osr});var esr,rP,tsr,Mrt,rsr,nsr,isr,asr,ssr,osr,Drt=W(()=>{tE();Sl();za();_r();Rr();hr();Co();esr=Jw().RailroadEbnf.parser.LangiumParser,rP=b(e=>{let t=e.alternatives.map(tsr);return t.length===1?t[0]:{type:"choice",alternatives:t}},"transformChoice"),tsr=b(e=>{let t=e.elements.map(nsr);return t.length===1?t[0]:{type:"sequence",elements:t}},"transformSequence"),Mrt=b(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return rP(e.element);case"EbnfOptional":return{type:"optional",element:rP(e.element)};case"EbnfRepetition":return{type:"repetition",element:rP(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),rsr=b((e,t)=>{switch(t.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},Mrt(t.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${t.$type}`)}},"transformPostfix"),nsr=b(e=>e.postfixes.reduce((t,r)=>rsr(t,r),Mrt(e.base)),"transformTerm"),isr=b(e=>({name:e.name,definition:rP(e.definition)}),"transformRule"),asr=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(isr(t)))},"populateDb"),ssr={parse:b(e=>{Ti.clear(),se.debug("[EBNF Parser] Starting Langium parse");let t=esr.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[EBNF Parser] Parsed rules:",r.rules.length),asr(r),se.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:Ti}},osr={parser:ssr,db:Ti,renderer:s1,styles:a1}});var Ort={};Tr(Ort,{diagram:()=>gsr});var lsr,Kse,csr,usr,hsr,fsr,dsr,psr,msr,gsr,Prt=W(()=>{tE();Sl();za();_r();Rr();hr();Co();lsr=ek().RailroadAbnf.parser.LangiumParser,Kse=b(e=>{let t=e.alternatives.map(csr);return t.length===1?t[0]:{type:"choice",alternatives:t}},"transformAlternation"),csr=b(e=>{let t=e.elements.map(hsr);return t.length===1?t[0]:{type:"sequence",elements:t}},"transformConcatenation"),usr=b(e=>{if(e.includes("*")){let[r,n]=e.split("*"),i=r?parseInt(r,10):0,a=n?parseInt(n,10):1/0;return{min:i,max:a}}let t=parseInt(e,10);return{min:t,max:t}},"parseRepeat"),hsr=b(e=>{let t=fsr(e.primary);if(!e.repeat)return t;let{min:r,max:n}=usr(e.repeat);return r===0&&n===1?{type:"optional",element:t}:{type:"repetition",element:t,min:r,max:n}},"transformElement"),fsr=b(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return Kse(e.element);case"AbnfOptionalGroup":return{type:"optional",element:Kse(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),dsr=b(e=>({name:e.name,definition:Kse(e.definition)}),"transformRule"),psr=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(dsr(t)))},"populateDb"),msr={parse:b(e=>{Ti.clear(),se.debug("[ABNF Parser] Starting Langium parse");let t=lsr.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[ABNF Parser] Parsed rules:",r.rules.length),psr(r),se.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:Ti}},gsr={parser:msr,db:Ti,renderer:s1,styles:a1}});var $rt={};Tr($rt,{diagram:()=>Ssr});var ysr,Frt,vsr,xsr,Brt,bsr,wsr,ksr,Tsr,Csr,Ssr,zrt=W(()=>{tE();Sl();za();_r();Rr();hr();Co();ysr=tk().RailroadPeg.parser.LangiumParser,Frt=b(e=>{let t=e.alternatives.map(vsr);return t.length===1?t[0]:{type:"choice",alternatives:t}},"transformOrderedChoice"),vsr=b(e=>{let t=e.elements.map(xsr);return t.length===1?t[0]:{type:"sequence",elements:t}},"transformSequence"),xsr=b(e=>{let t=bsr(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${Brt(t)}`:`!${Brt(t)}`}:t},"transformPrefix"),Brt=b(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),bsr=b(e=>{let t=wsr(e.primary);if(!e.operator)return t;switch(e.operator){case"?":return{type:"optional",element:t};case"*":return{type:"repetition",element:t,min:0,max:1/0};case"+":return{type:"repetition",element:t,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),wsr=b(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return Frt(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),ksr=b(e=>({name:e.name,definition:Frt(e.definition)}),"transformRule"),Tsr=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(ksr(t)))},"populateDb"),Csr={parse:b(e=>{Ti.clear(),se.debug("[PEG Parser] Starting Langium parse");let t=ysr.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[PEG Parser] Parsed rules:",r.rules.length),Tsr(r),se.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:Ti}},Ssr={parser:Csr,db:Ti,renderer:s1,styles:a1}});var Wnt=Qo((Zln,aP)=>{var Ucr=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var br=(function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,n={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function g(y){return y instanceof a?new a(y.type,g(y.content),y.alias):Array.isArray(y)?y.map(g):y.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(x){var g=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(x.stack)||[])[1];if(g){var y=document.getElementsByTagName("script");for(var v in y)if(y[v].src==g)return y[v]}return null}},isActive:function(g,y,v){for(var x="no-"+y;g;){var w=g.classList;if(w.contains(y))return!0;if(w.contains(x))return!1;g=g.parentElement}return!!v}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(g,y){var v=i.util.clone(i.languages[g]);for(var x in y)v[x]=y[x];return v},insertBefore:function(g,y,v,x){x=x||i.languages;var w=x[g],C={};for(var T in w)if(w.hasOwnProperty(T)){if(T==y)for(var k in v)v.hasOwnProperty(k)&&(C[k]=v[k]);v.hasOwnProperty(T)||(C[T]=w[T])}var S=x[g];return x[g]=C,i.languages.DFS(i.languages,function(E,I){I===S&&E!=g&&(this[E]=C)}),C},DFS:function g(y,v,x,w){w=w||{};var C=i.util.objId;for(var T in y)if(y.hasOwnProperty(T)){v.call(y,T,y[T],x||T);var k=y[T],S=i.util.type(k);S==="Object"&&!w[C(k)]?(w[C(k)]=!0,g(k,v,null,w)):S==="Array"&&!w[C(k)]&&(w[C(k)]=!0,g(k,v,T,w))}}},plugins:{},highlightAll:function(g,y){i.highlightAllUnder(document,g,y)},highlightAllUnder:function(g,y,v){var x={callback:v,container:g,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",x),x.elements=Array.prototype.slice.apply(x.container.querySelectorAll(x.selector)),i.hooks.run("before-all-elements-highlight",x);for(var w=0,C;C=x.elements[w++];)i.highlightElement(C,y===!0,x.callback)},highlightElement:function(g,y,v){var x=i.util.getLanguage(g),w=i.languages[x];i.util.setLanguage(g,x);var C=g.parentElement;C&&C.nodeName.toLowerCase()==="pre"&&i.util.setLanguage(C,x);var T=g.textContent,k={element:g,language:x,grammar:w,code:T};function S(I){k.highlightedCode=I,i.hooks.run("before-insert",k),k.element.innerHTML=k.highlightedCode,i.hooks.run("after-highlight",k),i.hooks.run("complete",k),v&&v.call(k.element)}if(i.hooks.run("before-sanity-check",k),C=k.element.parentElement,C&&C.nodeName.toLowerCase()==="pre"&&!C.hasAttribute("tabindex")&&C.setAttribute("tabindex","0"),!k.code){i.hooks.run("complete",k),v&&v.call(k.element);return}if(i.hooks.run("before-highlight",k),!k.grammar){S(i.util.encode(k.code));return}if(y&&e.Worker){var E=new Worker(i.filename);E.onmessage=function(I){S(I.data)},E.postMessage(JSON.stringify({language:k.language,code:k.code,immediateClose:!0}))}else S(i.highlight(k.code,k.grammar,k.language))},highlight:function(g,y,v){var x={code:g,grammar:y,language:v};if(i.hooks.run("before-tokenize",x),!x.grammar)throw new Error('The language "'+x.language+'" has no grammar.');return x.tokens=i.tokenize(x.code,x.grammar),i.hooks.run("after-tokenize",x),a.stringify(i.util.encode(x.tokens),x.language)},tokenize:function(g,y){var v=y.rest;if(v){for(var x in v)y[x]=v[x];delete y.rest}var w=new l;return u(w,w.head,g),o(g,w,y,w.head,0),f(w)},hooks:{all:{},add:function(g,y){var v=i.hooks.all;v[g]=v[g]||[],v[g].push(y)},run:function(g,y){var v=i.hooks.all[g];if(!(!v||!v.length))for(var x=0,w;w=v[x++];)w(y)}},Token:a};e.Prism=i;function a(g,y,v,x){this.type=g,this.content=y,this.alias=v,this.length=(x||"").length|0}a.stringify=function g(y,v){if(typeof y=="string")return y;if(Array.isArray(y)){var x="";return y.forEach(function(S){x+=g(S,v)}),x}var w={type:y.type,content:g(y.content,v),tag:"span",classes:["token",y.type],attributes:{},language:v},C=y.alias;C&&(Array.isArray(C)?Array.prototype.push.apply(w.classes,C):w.classes.push(C)),i.hooks.run("wrap",w);var T="";for(var k in w.attributes)T+=" "+k+'="'+(w.attributes[k]||"").replace(/"/g,""")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+T+">"+w.content+""};function s(g,y,v,x){g.lastIndex=y;var w=g.exec(v);if(w&&x&&w[1]){var C=w[1].length;w.index+=C,w[0]=w[0].slice(C)}return w}function o(g,y,v,x,w,C){for(var T in v)if(!(!v.hasOwnProperty(T)||!v[T])){var k=v[T];k=Array.isArray(k)?k:[k];for(var S=0;S=C.reach);D+=M.value.length,M=M.next){var B=M.value;if(y.length>g.length)return;if(!(B instanceof a)){var P=1,$;if(O){if($=s(N,D,g,L),!$||$.index>=g.length)break;var z=$.index,F=$.index+$[0].length,q=D;for(q+=M.value.length;z>=q;)M=M.next,q+=M.value.length;if(q-=M.value.length,D=q,M.value instanceof a)continue;for(var G=M;G!==y.tail&&(qC.reach&&(C.reach=U);var le=M.prev;j&&(le=u(y,le,j),D+=j.length),h(y,le,P);var ee=new a(T,I?i.tokenize(H,I):H,R,H);if(M=u(y,le,ee),J&&u(y,M,J),P>1){var ue={cause:T+","+S,reach:U};o(g,y,v,M.prev,D,ue),C&&ue.reach>C.reach&&(C.reach=ue.reach)}}}}}}function l(){var g={value:null,prev:null,next:null},y={value:null,prev:g,next:null};g.next=y,this.head=g,this.tail=y,this.length=0}function u(g,y,v){var x=y.next,w={value:v,prev:y,next:x};return y.next=w,x.prev=w,g.length++,w}function h(g,y,v){for(var x=y.next,w=0;w/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};br.languages.markup.tag.inside["attr-value"].inside.entity=br.languages.markup.entity;br.languages.markup.doctype.inside["internal-subset"].inside=br.languages.markup;br.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});Object.defineProperty(br.languages.markup.tag,"addInlined",{value:function(t,r){var n={};n["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:br.languages[r]},n.cdata=/^$/i;var i={"included-cdata":{pattern://i,inside:n}};i["language-"+r]={pattern:/[\s\S]+/,inside:br.languages[r]};var a={};a[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:i},br.languages.insertBefore("markup","cdata",a)}});Object.defineProperty(br.languages.markup.tag,"addAttribute",{value:function(e,t){br.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:br.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});br.languages.html=br.languages.markup;br.languages.mathml=br.languages.markup;br.languages.svg=br.languages.markup;br.languages.xml=br.languages.extend("markup",{});br.languages.ssml=br.languages.xml;br.languages.atom=br.languages.xml;br.languages.rss=br.languages.xml;(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(br);br.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};br.languages.javascript=br.languages.extend("clike",{"class-name":[br.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});br.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;br.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:br.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:br.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:br.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:br.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:br.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});br.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:br.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});br.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});br.languages.markup&&(br.languages.markup.tag.addInlined("script","javascript"),br.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));br.languages.js=br.languages.javascript;(function(){if(typeof br>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e="Loading\u2026",t=function(d,p){return"\u2716 Error "+d+" while fetching file: "+p},r="\u2716 Error: File does not exist or is empty",n={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},i="data-src-status",a="loading",s="loaded",o="failed",l="pre[data-src]:not(["+i+'="'+s+'"]):not(['+i+'="'+a+'"])';function u(d,p,m){var g=new XMLHttpRequest;g.open("GET",d,!0),g.onreadystatechange=function(){g.readyState==4&&(g.status<400&&g.responseText?p(g.responseText):g.status>=400?m(t(g.status,g.statusText)):m(r))},g.send(null)}function h(d){var p=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(d||"");if(p){var m=Number(p[1]),g=p[2],y=p[3];return g?y?[m,Number(y)]:[m,void 0]:[m,m]}}br.hooks.add("before-highlightall",function(d){d.selector+=", "+l}),br.hooks.add("before-sanity-check",function(d){var p=d.element;if(p.matches(l)){d.code="",p.setAttribute(i,a);var m=p.appendChild(document.createElement("CODE"));m.textContent=e;var g=p.getAttribute("data-src"),y=d.language;if(y==="none"){var v=(/\.(\w+)$/.exec(g)||[,"none"])[1];y=n[v]||v}br.util.setLanguage(m,y),br.util.setLanguage(p,y);var x=br.plugins.autoloader;x&&x.loadLanguages(y),u(g,function(w){p.setAttribute(i,s);var C=h(p.getAttribute("data-range"));if(C){var T=w.split(/\r\n?|\n/g),k=C[0],S=C[1]==null?T.length:C[1];k<0&&(k+=T.length),k=Math.max(0,Math.min(k-1,T.length)),S<0&&(S+=T.length),S=Math.max(0,Math.min(S,T.length)),w=T.slice(k,S).join(` -`),p.hasAttribute("data-start")||p.setAttribute("data-start",String(k+1))}m.textContent=w,br.highlightElement(m)},function(w){p.setAttribute(i,o),m.textContent=w})}}),br.plugins.fileHighlight={highlight:function(p){for(var m=(p||document).querySelectorAll(l),g=0,y;y=m[g++];)br.highlightElement(y)}};var f=!1;br.fileHighlight=function(){f||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),f=!0),br.plugins.fileHighlight.highlight.apply(this,arguments)}})()});var iu=(function(e){return e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e.aiProviderError="aiProviderError",e.aiBuildContextError="aiBuildContextError",e})({}),au=class extends Error{constructor(e,t,r){super(t,r),this.name="MilkdownError",this.code=e,r?.cause!==void 0&&(this.cause=r.cause)}},Bit=(e,t)=>typeof t=="function"?"[Function]":t,sE=e=>JSON.stringify(e,Bit);function boe(e){return new au(iu.docTypeError,`Doc type error, unsupported type: ${sE(e)}`)}function woe(e){return new au(iu.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}function koe(e){return new au(iu.timerNotFound,`Timer "${e}" not found, do you forget to record it?`)}function j2(){return new au(iu.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function Toe(e,t,r){let n=`Cannot create node for ${"name"in e?e.name:e}`,i=s=>{if(s==null)return"null";if(Array.isArray(s))return`[${s.map(i).join(", ")}]`;if(typeof s=="object")return"toJSON"in s&&typeof s.toJSON=="function"?JSON.stringify(s.toJSON()):"spec"in s?JSON.stringify(s.spec):JSON.stringify(s);if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")return JSON.stringify(s);if(typeof s=="function")return`[Function: ${s.name||"anonymous"}]`;try{return String(s)}catch{return"[Unserializable]"}},a=[["[Description]",n],["[Attributes]",t],["[Content]",(r??[]).map(s=>s?typeof s=="object"&&"type"in s?`${s}`:i(s):"null")]].reduce((s,[o,l])=>{let u=`${o}: ${i(l)}.`;return s.concat(u)},[]);return new au(iu.createNodeInParserFail,a.join(` -`))}function dP(){return new au(iu.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function Coe(e){return new au(iu.parserMatchError,`Cannot match target parser for node: ${sE(e)}.`)}function Soe(e){return new au(iu.serializerMatchError,`Cannot match target serializer for node: ${sE(e)}.`)}function su(e){return new au(iu.expectDomTypeError,`Expect to be a dom, but get: ${sE(e)}.`)}function oE(){return new au(iu.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function lE(e){return new au(iu.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}function Eoe(e){return new au(iu.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)}var pP=class{constructor(){this.sliceMap=new Map,this.get=e=>{let t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);if(!t)throw woe(typeof e=="string"?e:e.name);return t},this.remove=e=>{let t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>typeof e=="string"?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},Fit=class{#t;#e;#n;constructor(e,t,r){this.#t=[],this.#n=()=>{this.#t.forEach(n=>n(this.#e))},this.set=n=>{this.#e=n,this.#n()},this.get=()=>this.#e,this.update=n=>{this.#e=n(this.#e),this.#n()},this.type=r,this.#e=t,e.set(r.id,this)}on(e){return this.#t.push(e),()=>{this.#t=this.#t.filter(t=>t!==e)}}once(e){let t=this.on(r=>{e(r),t()});return t}off(e){this.#t=this.#t.filter(t=>t!==e)}offAll(){this.#t=[]}},$it=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw j2()}}create(e,t=this._defaultValue){return new Fit(e,t,this)}},bn=(e,t)=>new $it(e,t),zit=class{#t;#e;#n;#r;#s;#a;#i;constructor(e,t,r){this.#r=new Set,this.#s=new Set,this.#a=new Map,this.#i=new Map,this.read=()=>({metadata:this.#t,injectedSlices:[...this.#r].map(n=>({name:typeof n=="string"?n:n.name,value:this.#o(n)})),consumedSlices:[...this.#s].map(n=>({name:typeof n=="string"?n:n.name,value:this.#o(n)})),recordedTimers:[...this.#a].map(([n,{duration:i}])=>({name:n.name,duration:i,status:this.#l(n)})),waitTimers:[...this.#i].map(([n,{duration:i}])=>({name:n.name,duration:i,status:this.#l(n)}))}),this.onRecord=n=>{this.#a.set(n,{start:Date.now(),duration:0})},this.onClear=n=>{this.#a.delete(n)},this.onDone=n=>{let i=this.#a.get(n);i&&(i.duration=Date.now()-i.start)},this.onWait=(n,i)=>{let a=Date.now();i.finally(()=>{this.#i.set(n,{duration:Date.now()-a})}).catch(console.error)},this.onInject=n=>{this.#r.add(n)},this.onRemove=n=>{this.#r.delete(n)},this.onUse=n=>{this.#s.add(n)},this.#o=n=>this.#e.get(n).get(),this.#l=n=>this.#n.get(n).status,this.#e=e,this.#n=t,this.#t=r}#o;#l},Aoe=class _oe{#t;#e;#n;#r;constructor(t,r,n){this.produce=i=>i&&Object.keys(i).length?new _oe(this.#t,this.#e,{...i}):this,this.inject=(i,a)=>{let s=i.create(this.#t.sliceMap);return a!=null&&s.set(a),this.#r?.onInject(i),this},this.remove=i=>(this.#t.remove(i),this.#r?.onRemove(i),this),this.record=i=>(i.create(this.#e.store),this.#r?.onRecord(i),this),this.clearTimer=i=>(this.#e.remove(i),this.#r?.onClear(i),this),this.isInjected=i=>this.#t.has(i),this.isRecorded=i=>this.#e.has(i),this.use=i=>(this.#r?.onUse(i),this.#t.get(i)),this.get=i=>this.use(i).get(),this.set=(i,a)=>this.use(i).set(a),this.update=(i,a)=>this.use(i).update(a),this.timer=i=>this.#e.get(i),this.done=i=>{this.timer(i).done(),this.#r?.onDone(i)},this.wait=i=>{let a=this.timer(i).start();return this.#r?.onWait(i,a),a},this.waitTimers=async i=>{await Promise.all(this.get(i).map(a=>this.wait(a)))},this.#t=t,this.#e=r,this.#n=n,n&&(this.#r=new zit(t,r,n))}get meta(){return this.#n}get inspector(){return this.#r}},Roe=class{constructor(){this.store=new Map,this.get=e=>{let t=this.store.get(e.id);if(!t)throw koe(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},Git=class{#t;#e;#n;#r;constructor(e,t){this.#t=null,this.#e=null,this.#r="pending",this.start=()=>(this.#t??=new Promise((r,n)=>{this.#e=i=>{i instanceof CustomEvent&&i.detail.id===this.#n&&(this.#r="resolved",this.#s(),i.stopImmediatePropagation(),r())},this.#a(()=>{this.#r==="pending"&&(this.#r="rejected"),this.#s(),n(new Error(`Timing ${this.type.name} timeout.`))}),this.#r="pending",addEventListener(this.type.name,this.#e)}),this.#t),this.done=()=>{let r=new CustomEvent(this.type.name,{detail:{id:this.#n}});dispatchEvent(r)},this.#s=()=>{this.#e&&removeEventListener(this.type.name,this.#e)},this.#a=r=>{setTimeout(()=>{r()},this.type.timeout)},this.#n=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#r}#s;#a},qit=class{constructor(e,t=3e3){this.create=r=>new Git(r,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},wc=(e,t=3e3)=>new qit(e,t);var Vit={};function l1(e,t){let r=t||Vit,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Ioe(e,n,i)}function Ioe(e,t,r){if(Wit(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Loe(e.children,t,r)}return Array.isArray(e)?Loe(e,t,r):""}function Loe(e,t,r){let n=[],i=-1;for(;++ii?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)s=Array.from(n),s.unshift(t,r),e.splice(...s);else for(r&&e.splice(t,r);a0?(Oa(e,e.length,0,t),e):t}var Noe={}.hasOwnProperty;function cE(e){let t={},r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function Lo(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var us=Ap(/[A-Za-z]/),hs=Ap(/[\dA-Za-z]/),Doe=Ap(/[#-'*+\--9=?A-Z^-~]/);function c1(e){return e!==null&&(e<32||e===127)}var Ik=Ap(/\d/),Ooe=Ap(/[\dA-Fa-f]/),Poe=Ap(/[!-/:-@[-`{-~]/);function Kt(e){return e!==null&&e<-2}function _n(e){return e!==null&&(e<0||e===32)}function Or(e){return e===-2||e===-1||e===32}var u1=Ap(/\p{P}|\p{S}/u),Wh=Ap(/\s/);function Ap(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function kr(e,t,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,a=0;return s;function s(l){return Or(l)?(e.enter(r),o(l)):t(l)}function o(l){return Or(l)&&a++s))return;let S=t.events.length,E=S,I,L;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(I){L=t.events[E][1].end;break}I=!0}for(v(n),k=S;kw;){let T=r[C];t.containerState=T[1],T[0].exit.call(t,e)}r.length=w}function x(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function jit(e,t,r){return kr(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rd(e){if(e===null||_n(e)||Wh(e))return 1;if(u1(e))return 2}function _p(e,t,r){let n=[],i=-1;for(;++i1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;let f={...e[n][1].end},d={...e[r][1].start};zoe(f,-l),zoe(d,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[n][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:d},a={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[r][1].start={...o.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Jo(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Jo(u,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",a,t]]),u=Jo(u,_p(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),u=Jo(u,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,u=Jo(u,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,Oa(e,n-1,r-n+3,u),r=n+u.length-h-2;break}}for(r=-1;++r0&&Or(k)?kr(e,x,"linePrefix",a+1)(k):x(k)}function x(k){return k===null||Kt(k)?e.check(Goe,g,C)(k):(e.enter("codeFlowValue"),w(k))}function w(k){return k===null||Kt(k)?(e.exit("codeFlowValue"),x(k)):(e.consume(k),w)}function C(k){return e.exit("codeFenced"),t(k)}function T(k,S,E){let I=0;return L;function L(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),O}function O(M){return k.enter("codeFencedFence"),Or(M)?kr(k,R,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):R(M)}function R(M){return M===o?(k.enter("codeFencedFenceSequence"),A(M)):E(M)}function A(M){return M===o?(I++,k.consume(M),A):I>=s?(k.exit("codeFencedFenceSequence"),Or(M)?kr(k,N,"whitespace")(M):N(M)):E(M)}function N(M){return M===null||Kt(M)?(k.exit("codeFencedFence"),S(M)):E(M)}}}function sat(e,t,r){let n=this;return i;function i(s){return s===null?r(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return n.parser.lazy[n.now().line]?r(s):t(s)}}var Nk={name:"codeIndented",tokenize:lat},oat={partial:!0,tokenize:cat};function lat(e,t,r){let n=this;return i;function i(u){return e.enter("codeIndented"),kr(e,a,"linePrefix",5)(u)}function a(u){let h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?s(u):r(u)}function s(u){return u===null?l(u):Kt(u)?e.attempt(oat,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Kt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function cat(e,t,r){let n=this;return i;function i(s){return n.parser.lazy[n.now().line]?r(s):Kt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):kr(e,a,"linePrefix",5)(s)}function a(s){let o=n.events[n.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):Kt(s)?i(s):r(s)}}var gP={name:"codeText",previous:hat,resolve:uat,tokenize:fat};function uat(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){let i=r||0;this.setCursor(Math.trunc(t));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Dk(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Dk(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Dk(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(s):e.interrupt(n.parser.constructs.flow,r,t)(s)}}function yE(e,t,r,n,i,a,s,o,l){let u=l||Number.POSITIVE_INFINITY,h=0;return f;function f(v){return v===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(v),e.exit(a),d):v===null||v===32||v===41||c1(v)?r(v):(e.enter(n),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(v))}function d(v){return v===62?(e.enter(a),e.consume(v),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(o),d(v)):v===null||v===60||Kt(v)?r(v):(e.consume(v),v===92?m:p)}function m(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function g(v){return!h&&(v===null||v===41||_n(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(n),t(v)):h999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?r(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):Kt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Kt(p)||o++>999?(e.exit("chunkString"),h(p)):(e.consume(p),l||(l=!Or(p)),p===92?d:f)}function d(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function xE(e,t,r,n,i,a){let s;return o;function o(d){return d===34||d===39||d===40?(e.enter(n),e.enter(i),e.consume(d),e.exit(i),s=d===40?41:d,l):r(d)}function l(d){return d===s?(e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):(e.enter(a),u(d))}function u(d){return d===s?(e.exit(a),l(s)):d===null?r(d):Kt(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),kr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===s||d===null||Kt(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?f:h)}function f(d){return d===s||d===92?(e.consume(d),h):h(d)}}function h1(e,t){let r;return n;function n(i){return Kt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Or(i)?kr(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}var vP={name:"definition",tokenize:xat},vat={partial:!0,tokenize:bat};function xat(e,t,r){let n=this,i;return a;function a(p){return e.enter("definition"),s(p)}function s(p){return vE.call(n,e,o,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return i=Lo(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):r(p)}function l(p){return _n(p)?h1(e,u)(p):u(p)}function u(p){return yE(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(vat,f,f)(p)}function f(p){return Or(p)?kr(e,d,"whitespace")(p):d(p)}function d(p){return p===null||Kt(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function bat(e,t,r){return n;function n(o){return _n(o)?h1(e,i)(o):r(o)}function i(o){return xE(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Or(o)?kr(e,s,"whitespace")(o):s(o)}function s(o){return o===null||Kt(o)?t(o):r(o)}}var xP={name:"hardBreakEscape",tokenize:wat};function wat(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Kt(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}var bP={name:"headingAtx",resolve:kat,tokenize:Tat};function kat(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Oa(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Tat(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),a(h)}function a(h){return e.enter("atxHeadingSequence"),s(h)}function s(h){return h===35&&n++<6?(e.consume(h),s):h===null||_n(h)?(e.exit("atxHeadingSequence"),o(h)):r(h)}function o(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||Kt(h)?(e.exit("atxHeading"),t(h)):Or(h)?kr(e,o,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function l(h){return h===35?(e.consume(h),l):(e.exit("atxHeadingSequence"),o(h))}function u(h){return h===null||h===35||_n(h)?(e.exit("atxHeadingText"),o(h)):(e.consume(h),u)}}var qoe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wP=["pre","script","style","textarea"];var kP={concrete:!0,name:"htmlFlow",resolveTo:Eat,tokenize:Aat},Cat={partial:!0,tokenize:Rat},Sat={partial:!0,tokenize:_at};function Eat(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Aat(e,t,r){let n=this,i,a,s,o,l;return u;function u(z){return h(z)}function h(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),f}function f(z){return z===33?(e.consume(z),d):z===47?(e.consume(z),a=!0,g):z===63?(e.consume(z),i=3,n.interrupt?t:F):us(z)?(e.consume(z),s=String.fromCharCode(z),y):r(z)}function d(z){return z===45?(e.consume(z),i=2,p):z===91?(e.consume(z),i=5,o=0,m):us(z)?(e.consume(z),i=4,n.interrupt?t:F):r(z)}function p(z){return z===45?(e.consume(z),n.interrupt?t:F):r(z)}function m(z){let H="CDATA[";return z===H.charCodeAt(o++)?(e.consume(z),o===H.length?n.interrupt?t:R:m):r(z)}function g(z){return us(z)?(e.consume(z),s=String.fromCharCode(z),y):r(z)}function y(z){if(z===null||z===47||z===62||_n(z)){let H=z===47,j=s.toLowerCase();return!H&&!a&&wP.includes(j)?(i=1,n.interrupt?t(z):R(z)):qoe.includes(s.toLowerCase())?(i=6,H?(e.consume(z),v):n.interrupt?t(z):R(z)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(z):a?x(z):w(z))}return z===45||hs(z)?(e.consume(z),s+=String.fromCharCode(z),y):r(z)}function v(z){return z===62?(e.consume(z),n.interrupt?t:R):r(z)}function x(z){return Or(z)?(e.consume(z),x):L(z)}function w(z){return z===47?(e.consume(z),L):z===58||z===95||us(z)?(e.consume(z),C):Or(z)?(e.consume(z),w):L(z)}function C(z){return z===45||z===46||z===58||z===95||hs(z)?(e.consume(z),C):T(z)}function T(z){return z===61?(e.consume(z),k):Or(z)?(e.consume(z),T):w(z)}function k(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(e.consume(z),l=z,S):Or(z)?(e.consume(z),k):E(z)}function S(z){return z===l?(e.consume(z),l=null,I):z===null||Kt(z)?r(z):(e.consume(z),S)}function E(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||_n(z)?T(z):(e.consume(z),E)}function I(z){return z===47||z===62||Or(z)?w(z):r(z)}function L(z){return z===62?(e.consume(z),O):r(z)}function O(z){return z===null||Kt(z)?R(z):Or(z)?(e.consume(z),O):r(z)}function R(z){return z===45&&i===2?(e.consume(z),D):z===60&&i===1?(e.consume(z),B):z===62&&i===4?(e.consume(z),q):z===63&&i===3?(e.consume(z),F):z===93&&i===5?(e.consume(z),$):Kt(z)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Cat,G,A)(z)):z===null||Kt(z)?(e.exit("htmlFlowData"),A(z)):(e.consume(z),R)}function A(z){return e.check(Sat,N,G)(z)}function N(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),M}function M(z){return z===null||Kt(z)?A(z):(e.enter("htmlFlowData"),R(z))}function D(z){return z===45?(e.consume(z),F):R(z)}function B(z){return z===47?(e.consume(z),s="",P):R(z)}function P(z){if(z===62){let H=s.toLowerCase();return wP.includes(H)?(e.consume(z),q):R(z)}return us(z)&&s.length<8?(e.consume(z),s+=String.fromCharCode(z),P):R(z)}function $(z){return z===93?(e.consume(z),F):R(z)}function F(z){return z===62?(e.consume(z),q):z===45&&i===2?(e.consume(z),F):R(z)}function q(z){return z===null||Kt(z)?(e.exit("htmlFlowData"),G(z)):(e.consume(z),q)}function G(z){return e.exit("htmlFlow"),t(z)}}function _at(e,t,r){let n=this;return i;function i(s){return Kt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):r(s)}function a(s){return n.parser.lazy[n.now().line]?r(s):t(s)}}function Rat(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Hh,t,r)}}var TP={name:"htmlText",tokenize:Lat};function Lat(e,t,r){let n=this,i,a,s;return o;function o(F){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(F),l}function l(F){return F===33?(e.consume(F),u):F===47?(e.consume(F),T):F===63?(e.consume(F),w):us(F)?(e.consume(F),E):r(F)}function u(F){return F===45?(e.consume(F),h):F===91?(e.consume(F),a=0,m):us(F)?(e.consume(F),x):r(F)}function h(F){return F===45?(e.consume(F),p):r(F)}function f(F){return F===null?r(F):F===45?(e.consume(F),d):Kt(F)?(s=f,B(F)):(e.consume(F),f)}function d(F){return F===45?(e.consume(F),p):f(F)}function p(F){return F===62?D(F):F===45?d(F):f(F)}function m(F){let q="CDATA[";return F===q.charCodeAt(a++)?(e.consume(F),a===q.length?g:m):r(F)}function g(F){return F===null?r(F):F===93?(e.consume(F),y):Kt(F)?(s=g,B(F)):(e.consume(F),g)}function y(F){return F===93?(e.consume(F),v):g(F)}function v(F){return F===62?D(F):F===93?(e.consume(F),v):g(F)}function x(F){return F===null||F===62?D(F):Kt(F)?(s=x,B(F)):(e.consume(F),x)}function w(F){return F===null?r(F):F===63?(e.consume(F),C):Kt(F)?(s=w,B(F)):(e.consume(F),w)}function C(F){return F===62?D(F):w(F)}function T(F){return us(F)?(e.consume(F),k):r(F)}function k(F){return F===45||hs(F)?(e.consume(F),k):S(F)}function S(F){return Kt(F)?(s=S,B(F)):Or(F)?(e.consume(F),S):D(F)}function E(F){return F===45||hs(F)?(e.consume(F),E):F===47||F===62||_n(F)?I(F):r(F)}function I(F){return F===47?(e.consume(F),D):F===58||F===95||us(F)?(e.consume(F),L):Kt(F)?(s=I,B(F)):Or(F)?(e.consume(F),I):D(F)}function L(F){return F===45||F===46||F===58||F===95||hs(F)?(e.consume(F),L):O(F)}function O(F){return F===61?(e.consume(F),R):Kt(F)?(s=O,B(F)):Or(F)?(e.consume(F),O):I(F)}function R(F){return F===null||F===60||F===61||F===62||F===96?r(F):F===34||F===39?(e.consume(F),i=F,A):Kt(F)?(s=R,B(F)):Or(F)?(e.consume(F),R):(e.consume(F),N)}function A(F){return F===i?(e.consume(F),i=void 0,M):F===null?r(F):Kt(F)?(s=A,B(F)):(e.consume(F),A)}function N(F){return F===null||F===34||F===39||F===60||F===61||F===96?r(F):F===47||F===62||_n(F)?I(F):(e.consume(F),N)}function M(F){return F===47||F===62||_n(F)?I(F):r(F)}function D(F){return F===62?(e.consume(F),e.exit("htmlTextData"),e.exit("htmlText"),t):r(F)}function B(F){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),P}function P(F){return Or(F)?kr(e,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):$(F)}function $(F){return e.enter("htmlTextData"),s(F)}}var f1={name:"labelEnd",resolveAll:Dat,resolveTo:Oat,tokenize:Pat},Iat={tokenize:Bat},Mat={tokenize:Fat},Nat={tokenize:$at};function Dat(e){let t=-1,r=[];for(;++t=3&&(u===null||Kt(u))?(e.exit("thematicBreak"),t(u)):r(u)}function l(u){return u===i?(e.consume(u),n++,l):(e.exit("thematicBreakSequence"),Or(u)?kr(e,o,"whitespace")(u):o(u))}}var Io={continuation:{tokenize:Yat},exit:jat,name:"list",tokenize:Uat},Wat={partial:!0,tokenize:Kat},Hat={partial:!0,tokenize:Xat};function Uat(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(p){let m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Ik(p)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(d1,r,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return r(p)}function l(p){return Ik(p)&&++s<10?(e.consume(p),l):(!n.interrupt||s<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):r(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(Hh,n.interrupt?r:h,e.attempt(Wat,d,f))}function h(p){return n.containerState.initialBlankLine=!0,a++,d(p)}function f(p){return Or(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),d):r(p)}function d(p){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Yat(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(Hh,i,a);function i(o){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,kr(e,t,"listItemIndent",n.containerState.size+1)(o)}function a(o){return n.containerState.furtherBlankLines||!Or(o)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,s(o)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Hat,t,s)(o))}function s(o){return n.containerState._closeFlow=!0,n.interrupt=void 0,kr(e,e.attempt(Io,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Xat(e,t,r){let n=this;return kr(e,i,"listItemIndent",n.containerState.size+1);function i(a){let s=n.events[n.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===n.containerState.size?t(a):r(a)}}function jat(e){e.exit(this.containerState.type)}function Kat(e,t,r){let n=this;return kr(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let s=n.events[n.events.length-1];return!Or(a)&&s&&s[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}var bE={name:"setextUnderline",resolveTo:Zat,tokenize:Qat};function Zat(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);let s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",s,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=s,e.push(["exit",s,t]),e}function Qat(e,t,r){let n=this,i;return a;function a(u){let h=n.events.length,f;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){f=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||f)?(e.enter("setextHeadingLine"),i=u,s(u)):r(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Or(u)?kr(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Kt(u)?(e.exit("setextHeadingLine"),t(u)):r(u)}}var Voe={tokenize:Jat};function Jat(e){let t=this,r=e.attempt(Hh,n,e.attempt(this.parser.constructs.flowInitial,i,kr(e,e.attempt(this.parser.constructs.flow,i,e.attempt(yP,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}var Woe={resolveAll:Xoe()},Hoe=Yoe("string"),Uoe=Yoe("text");function Yoe(e){return{resolveAll:Xoe(e==="text"?est:void 0),tokenize:t};function t(r){let n=this,i=this.parser.constructs[e],a=r.attempt(i,s,o);return s;function s(h){return u(h)?a(h):o(h)}function o(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),l}function l(h){return u(h)?(r.exit("data"),a(h)):(r.consume(h),l)}function u(h){if(h===null)return!0;let f=i[h],d=-1;if(f)for(;++dlst,contentInitial:()=>rst,disable:()=>cst,document:()=>tst,flow:()=>ist,flowInitial:()=>nst,insideSpan:()=>ost,string:()=>ast,text:()=>sst});var tst={42:Io,43:Io,45:Io,48:Io,49:Io,50:Io,51:Io,52:Io,53:Io,54:Io,55:Io,56:Io,57:Io,62:hE},rst={91:vP},nst={[-2]:Nk,[-1]:Nk,32:Nk},ist={35:bP,42:d1,45:[bE,d1],60:kP,61:bE,95:d1,96:pE,126:pE},ast={38:dE,92:fE},sst={[-5]:Ok,[-4]:Ok,[-3]:Ok,33:CP,38:dE,42:Mk,60:[mP,TP],91:SP,92:[xP,fE],93:f1,95:Mk,96:gP},ost={null:[Mk,Woe]},lst={null:[42,95]},cst={null:[]};function joe(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},i={},a=[],s=[],o=[],l=!0,u={attempt:I(S),check:I(E),consume:C,enter:T,exit:k,interrupt:I(E,{interrupt:!0})},h={code:null,containerState:{},defineSkip:v,events:[],now:y,parser:e,previous:null,sliceSerialize:m,sliceStream:g,write:p},f=t.tokenize.call(h,u),d;return t.resolveAll&&a.push(t),h;function p(A){return s=Jo(s,A),x(),s[s.length-1]!==null?[]:(L(t,0),h.events=_p(a,h.events,h),h.events)}function m(A,N){return hst(g(A),N)}function g(A){return ust(s,A)}function y(){let{_bufferIndex:A,_index:N,line:M,column:D,offset:B}=n;return{_bufferIndex:A,_index:N,line:M,column:D,offset:B}}function v(A){i[A.line]=A.column,R()}function x(){let A;for(;n._index-1){let o=s[0];typeof o=="string"?s[0]=o.slice(n):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function hst(e,t){let r=-1,n=[],i;for(;++rthis.renderExpression(e,l)),n=0,i=0,a=0;for(let l of r)n+=l.dimensions.width,i=Math.max(i,l.dimensions.up),a=Math.max(a,l.dimensions.down);n+=(r.length-1)*this.config.horizontalSeparation;let s=e.append("g").attr("class","railroad-sequence"),o=0;for(let l=0;lthis.renderExpression(e,f)),n=0,i=0;for(let f of r)n=Math.max(n,f.dimensions.width),i+=f.dimensions.height;i+=(r.length-1)*this.config.verticalSeparation;let a=this.config.arcRadius,s=a*4,o=n+s,l=e.append("g").attr("class","railroad-choice"),u=0,h=i/2;for(let f of r){let d=u,p=d+f.dimensions.up,m=a*2+(n-f.dimensions.width)/2;l.node().appendChild(f.element).setAttribute("transform",`translate(${m}, ${d})`);let y=new ju,v=p>h;p===h?y.moveTo(0,h).lineTo(m,p):y.moveTo(0,h).arcTo(a,a,0,!1,v,a,h+(v?a:-a)).lineTo(a,p-(v?a:-a)).arcTo(a,a,0,!1,!v,a*2,p).lineTo(m,p),l.append("path").attr("class","railroad-line").attr("d",y.build());let x=new ju,w=m+f.dimensions.width,C=o-a*2;p===h?x.moveTo(w,p).lineTo(o,h):x.moveTo(w,p).lineTo(C,p).arcTo(a,a,0,!1,!v,o-a,p+(v?-a:a)).lineTo(o-a,h+(v?a:-a)).arcTo(a,a,0,!1,v,o,h),l.append("path").attr("class","railroad-line").attr("d",x.build()),u+=f.dimensions.height+this.config.verticalSeparation}return{element:l.node(),dimensions:{width:o,height:i,up:h,down:i-h}}}renderOptional(e,t){let r=this.renderExpression(e,t),n=this.config.arcRadius,i=n*2,a=r.dimensions.width+n*4,s=r.dimensions.height+i,o=e.append("g").attr("class","railroad-optional"),l=n*2,u=i;o.node().appendChild(r.element).setAttribute("transform",`translate(${l}, ${u})`);let f=u+r.dimensions.up,d=new ju().moveTo(0,f).lineTo(n*2,f);o.append("path").attr("class","railroad-line").attr("d",d.build());let p=new ju().moveTo(l+r.dimensions.width,f).lineTo(a,f);o.append("path").attr("class","railroad-line").attr("d",p.build());let m=new ju().moveTo(0,f).arcTo(n,n,0,!1,!1,n,f-n).lineTo(n,n).arcTo(n,n,0,!1,!0,n*2,0).lineTo(a-n*2,0).arcTo(n,n,0,!1,!0,a-n,n).lineTo(a-n,f-n).arcTo(n,n,0,!1,!1,a,f);return o.append("path").attr("class","railroad-line").attr("d",m.build()),{element:o.node(),dimensions:{width:a,height:s,up:f,down:s-f}}}renderRepetition(e,t,r){let n=this.renderExpression(e,t),i=this.config.arcRadius,a=i*2,s=n.dimensions.width+i*4,o=r===0,l=n.dimensions.height+a+(o?a:0),u=e.append("g").attr("class","railroad-repetition"),h=i*2,f=o?a:0;u.node().appendChild(n.element).setAttribute("transform",`translate(${h}, ${f})`);let p=f+n.dimensions.up;u.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(0,p).lineTo(i*2,p).build()),u.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(h+n.dimensions.width,p).lineTo(s,p).build());let m=f+n.dimensions.height+i,g=new ju().moveTo(h+n.dimensions.width,p).arcTo(i,i,0,!1,!0,h+n.dimensions.width+i,p+i).lineTo(h+n.dimensions.width+i,m).arcTo(i,i,0,!1,!0,h+n.dimensions.width,m+i).lineTo(i*2,m+i).arcTo(i,i,0,!1,!0,i,m).lineTo(i,p+i).arcTo(i,i,0,!1,!0,i*2,p);if(u.append("path").attr("class","railroad-line").attr("d",g.build()),o){let y=new ju().moveTo(0,p).arcTo(i,i,0,!1,!1,i,p-i).lineTo(i,i).arcTo(i,i,0,!1,!0,i*2,0).lineTo(s-i*2,0).arcTo(i,i,0,!1,!0,s-i,i).lineTo(s-i,p-i).arcTo(i,i,0,!1,!1,s,p);u.append("path").attr("class","railroad-line").attr("d",y.build())}return{element:u.node(),dimensions:{width:s,height:l,up:p,down:l-p}}}renderSpecial(e,t){let r=this.measureText("? "+t+" ?"),n=r.width+this.config.padding*2,i=r.height+this.config.padding*2,a=e.append("g").attr("class","railroad-special");return a.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i),a.append("text").attr("x",n/2).attr("y",i/2).text("? "+t+" ?"),{element:a.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderExpression(e,t){switch(t.type){case"terminal":return this.renderTerminal(e,t.value);case"nonterminal":return this.renderNonTerminal(e,t.name);case"sequence":return this.renderSequence(e,t.elements);case"choice":return this.renderChoice(e,t.alternatives);case"optional":return this.renderOptional(e,t.element);case"repetition":return this.renderRepetition(e,t.element,t.min);case"special":return this.renderSpecial(e,t.text);default:throw new Error(`Unknown node type: ${t.type}`)}}renderRule(e,t){let r=this.svg.append("g").attr("class","railroad-rule").attr("transform",`translate(0, ${t})`),n=e.name+" =",i=this.measureText(n).width+20,a=i+20,s=r.append("g"),o=this.renderExpression(s,e.definition),l=Math.max(20,o.dimensions.up),u=l-o.dimensions.up;return s.attr("transform",`translate(${a}, ${u})`),r.append("g").attr("class","railroad-rule-name-group").append("text").attr("class","railroad-rule-name").attr("x",0).attr("y",l).text(n),r.append("g").attr("class","railroad-start").append("circle").attr("cx",i).attr("cy",l).attr("r",this.config.markerRadius),r.append("g").attr("class","railroad-end").append("circle").attr("cx",a+o.dimensions.width+10).attr("cy",l).attr("r",this.config.markerRadius),r.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(i+this.config.markerRadius,l).lineTo(a,l).build()),r.append("path").attr("class","railroad-line").attr("d",new ju().moveTo(a+o.dimensions.width,l).lineTo(a+o.dimensions.width+10-this.config.markerRadius,l).build()),{height:Math.max(40,u+o.dimensions.height+this.config.padding*2),width:a+o.dimensions.width+10+this.config.markerRadius}}renderDiagram(e){let t=this.config.padding,r=0;for(let n of e){let i=this.renderRule(n,t);t+=i.height+this.config.verticalSeparation,r=Math.max(r,i.width)}return{width:r+this.config.padding*2,height:t+this.config.padding}}},Ert=b((e,t,r)=>{vn(e,t.height,t.width,r),e.attr("viewBox",`0 0 ${t.width} ${t.height}`)},"configureRailroadSvgSize"),Qar=b((e,t,r)=>{se.debug(`[Railroad] Rendering diagram +`+e);try{let n=Qn(t);n.attr("class","railroad-diagram");let a=qt().railroad?.useMaxWidth??!0,s=Ti.getRules();if(se.debug(`[Railroad] Rendering ${s.length} rules`),s.length===0){se.warn("[Railroad] No rules to render"),Ert(n,{height:100,width:200},a);return}let l=new Zar(n,Zse()).renderDiagram(s);Ert(n,l,a),se.debug("[Railroad] Render complete")}catch(n){throw se.error("[Railroad] Render error:",n),n}},"draw"),s1={draw:Qar}});var Mrt={};Tr(Mrt,{default:()=>nsr,diagram:()=>Irt});var Jar,_k,esr,tsr,rsr,Irt,nsr,Nrt=W(()=>{tE();El();za();_r();Rr();hr();Co();Jar=Qw().Railroad.parser.LangiumParser,_k=b(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{let t=e.elements.map(_k);return t.length===1?t[0]:{type:"sequence",elements:t}}case"RailroadChoiceExpr":{let t=e.alternatives.map(_k);return t.length===1?t[0]:{type:"choice",alternatives:t}}case"RailroadOptionalExpr":return{type:"optional",element:_k(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:_k(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:_k(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),esr=b(e=>({name:e.name,definition:_k(e.definition)}),"transformRule"),tsr=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(esr(t)))},"populateDb"),rsr={parse:b(e=>{Ti.clear(),se.debug("[Railroad Parser] Starting Langium parse");let t=Jar.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[Railroad Parser] Parsed rules:",r.rules.length),tsr(r),se.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:Ti}},Irt={parser:rsr,db:Ti,renderer:s1,styles:a1},nsr=Irt});var Ort={};Tr(Ort,{diagram:()=>hsr});var isr,rP,asr,Drt,ssr,osr,lsr,csr,usr,hsr,Prt=W(()=>{tE();El();za();_r();Rr();hr();Co();isr=Jw().RailroadEbnf.parser.LangiumParser,rP=b(e=>{let t=e.alternatives.map(asr);return t.length===1?t[0]:{type:"choice",alternatives:t}},"transformChoice"),asr=b(e=>{let t=e.elements.map(osr);return t.length===1?t[0]:{type:"sequence",elements:t}},"transformSequence"),Drt=b(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return rP(e.element);case"EbnfOptional":return{type:"optional",element:rP(e.element)};case"EbnfRepetition":return{type:"repetition",element:rP(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),ssr=b((e,t)=>{switch(t.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},Drt(t.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${t.$type}`)}},"transformPostfix"),osr=b(e=>e.postfixes.reduce((t,r)=>ssr(t,r),Drt(e.base)),"transformTerm"),lsr=b(e=>({name:e.name,definition:rP(e.definition)}),"transformRule"),csr=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(lsr(t)))},"populateDb"),usr={parse:b(e=>{Ti.clear(),se.debug("[EBNF Parser] Starting Langium parse");let t=isr.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[EBNF Parser] Parsed rules:",r.rules.length),csr(r),se.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:Ti}},hsr={parser:usr,db:Ti,renderer:s1,styles:a1}});var Brt={};Tr(Brt,{diagram:()=>bsr});var fsr,Qse,dsr,psr,msr,gsr,ysr,vsr,xsr,bsr,Frt=W(()=>{tE();El();za();_r();Rr();hr();Co();fsr=ek().RailroadAbnf.parser.LangiumParser,Qse=b(e=>{let t=e.alternatives.map(dsr);return t.length===1?t[0]:{type:"choice",alternatives:t}},"transformAlternation"),dsr=b(e=>{let t=e.elements.map(msr);return t.length===1?t[0]:{type:"sequence",elements:t}},"transformConcatenation"),psr=b(e=>{if(e.includes("*")){let[r,n]=e.split("*"),i=r?parseInt(r,10):0,a=n?parseInt(n,10):1/0;return{min:i,max:a}}let t=parseInt(e,10);return{min:t,max:t}},"parseRepeat"),msr=b(e=>{let t=gsr(e.primary);if(!e.repeat)return t;let{min:r,max:n}=psr(e.repeat);return r===0&&n===1?{type:"optional",element:t}:{type:"repetition",element:t,min:r,max:n}},"transformElement"),gsr=b(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return Qse(e.element);case"AbnfOptionalGroup":return{type:"optional",element:Qse(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),ysr=b(e=>({name:e.name,definition:Qse(e.definition)}),"transformRule"),vsr=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(ysr(t)))},"populateDb"),xsr={parse:b(e=>{Ti.clear(),se.debug("[ABNF Parser] Starting Langium parse");let t=fsr.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[ABNF Parser] Parsed rules:",r.rules.length),vsr(r),se.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:Ti}},bsr={parser:xsr,db:Ti,renderer:s1,styles:a1}});var Grt={};Tr(Grt,{diagram:()=>Rsr});var wsr,zrt,ksr,Tsr,$rt,Csr,Ssr,Esr,Asr,_sr,Rsr,qrt=W(()=>{tE();El();za();_r();Rr();hr();Co();wsr=tk().RailroadPeg.parser.LangiumParser,zrt=b(e=>{let t=e.alternatives.map(ksr);return t.length===1?t[0]:{type:"choice",alternatives:t}},"transformOrderedChoice"),ksr=b(e=>{let t=e.elements.map(Tsr);return t.length===1?t[0]:{type:"sequence",elements:t}},"transformSequence"),Tsr=b(e=>{let t=Csr(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${$rt(t)}`:`!${$rt(t)}`}:t},"transformPrefix"),$rt=b(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),Csr=b(e=>{let t=Ssr(e.primary);if(!e.operator)return t;switch(e.operator){case"?":return{type:"optional",element:t};case"*":return{type:"repetition",element:t,min:0,max:1/0};case"+":return{type:"repetition",element:t,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),Ssr=b(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return zrt(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),Esr=b(e=>({name:e.name,definition:zrt(e.definition)}),"transformRule"),Asr=b(e=>{wi(e,Ti),e.title&&Ti.setTitle(e.title),e.rules.map(t=>Ti.addRule(Esr(t)))},"populateDb"),_sr={parse:b(e=>{Ti.clear(),se.debug("[PEG Parser] Starting Langium parse");let t=wsr.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new hp(t);let r=t.value;se.debug("[PEG Parser] Parsed rules:",r.rules.length),Asr(r),se.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:Ti}},Rsr={parser:_sr,db:Ti,renderer:s1,styles:a1}});var Unt=Jo((rcn,aP)=>{var Kcr=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var br=(function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,n={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function g(y){return y instanceof a?new a(y.type,g(y.content),y.alias):Array.isArray(y)?y.map(g):y.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(x){var g=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(x.stack)||[])[1];if(g){var y=document.getElementsByTagName("script");for(var v in y)if(y[v].src==g)return y[v]}return null}},isActive:function(g,y,v){for(var x="no-"+y;g;){var w=g.classList;if(w.contains(y))return!0;if(w.contains(x))return!1;g=g.parentElement}return!!v}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(g,y){var v=i.util.clone(i.languages[g]);for(var x in y)v[x]=y[x];return v},insertBefore:function(g,y,v,x){x=x||i.languages;var w=x[g],C={};for(var T in w)if(w.hasOwnProperty(T)){if(T==y)for(var k in v)v.hasOwnProperty(k)&&(C[k]=v[k]);v.hasOwnProperty(T)||(C[T]=w[T])}var S=x[g];return x[g]=C,i.languages.DFS(i.languages,function(E,I){I===S&&E!=g&&(this[E]=C)}),C},DFS:function g(y,v,x,w){w=w||{};var C=i.util.objId;for(var T in y)if(y.hasOwnProperty(T)){v.call(y,T,y[T],x||T);var k=y[T],S=i.util.type(k);S==="Object"&&!w[C(k)]?(w[C(k)]=!0,g(k,v,null,w)):S==="Array"&&!w[C(k)]&&(w[C(k)]=!0,g(k,v,T,w))}}},plugins:{},highlightAll:function(g,y){i.highlightAllUnder(document,g,y)},highlightAllUnder:function(g,y,v){var x={callback:v,container:g,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",x),x.elements=Array.prototype.slice.apply(x.container.querySelectorAll(x.selector)),i.hooks.run("before-all-elements-highlight",x);for(var w=0,C;C=x.elements[w++];)i.highlightElement(C,y===!0,x.callback)},highlightElement:function(g,y,v){var x=i.util.getLanguage(g),w=i.languages[x];i.util.setLanguage(g,x);var C=g.parentElement;C&&C.nodeName.toLowerCase()==="pre"&&i.util.setLanguage(C,x);var T=g.textContent,k={element:g,language:x,grammar:w,code:T};function S(I){k.highlightedCode=I,i.hooks.run("before-insert",k),k.element.innerHTML=k.highlightedCode,i.hooks.run("after-highlight",k),i.hooks.run("complete",k),v&&v.call(k.element)}if(i.hooks.run("before-sanity-check",k),C=k.element.parentElement,C&&C.nodeName.toLowerCase()==="pre"&&!C.hasAttribute("tabindex")&&C.setAttribute("tabindex","0"),!k.code){i.hooks.run("complete",k),v&&v.call(k.element);return}if(i.hooks.run("before-highlight",k),!k.grammar){S(i.util.encode(k.code));return}if(y&&e.Worker){var E=new Worker(i.filename);E.onmessage=function(I){S(I.data)},E.postMessage(JSON.stringify({language:k.language,code:k.code,immediateClose:!0}))}else S(i.highlight(k.code,k.grammar,k.language))},highlight:function(g,y,v){var x={code:g,grammar:y,language:v};if(i.hooks.run("before-tokenize",x),!x.grammar)throw new Error('The language "'+x.language+'" has no grammar.');return x.tokens=i.tokenize(x.code,x.grammar),i.hooks.run("after-tokenize",x),a.stringify(i.util.encode(x.tokens),x.language)},tokenize:function(g,y){var v=y.rest;if(v){for(var x in v)y[x]=v[x];delete y.rest}var w=new l;return u(w,w.head,g),o(g,w,y,w.head,0),f(w)},hooks:{all:{},add:function(g,y){var v=i.hooks.all;v[g]=v[g]||[],v[g].push(y)},run:function(g,y){var v=i.hooks.all[g];if(!(!v||!v.length))for(var x=0,w;w=v[x++];)w(y)}},Token:a};e.Prism=i;function a(g,y,v,x){this.type=g,this.content=y,this.alias=v,this.length=(x||"").length|0}a.stringify=function g(y,v){if(typeof y=="string")return y;if(Array.isArray(y)){var x="";return y.forEach(function(S){x+=g(S,v)}),x}var w={type:y.type,content:g(y.content,v),tag:"span",classes:["token",y.type],attributes:{},language:v},C=y.alias;C&&(Array.isArray(C)?Array.prototype.push.apply(w.classes,C):w.classes.push(C)),i.hooks.run("wrap",w);var T="";for(var k in w.attributes)T+=" "+k+'="'+(w.attributes[k]||"").replace(/"/g,""")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+T+">"+w.content+""};function s(g,y,v,x){g.lastIndex=y;var w=g.exec(v);if(w&&x&&w[1]){var C=w[1].length;w.index+=C,w[0]=w[0].slice(C)}return w}function o(g,y,v,x,w,C){for(var T in v)if(!(!v.hasOwnProperty(T)||!v[T])){var k=v[T];k=Array.isArray(k)?k:[k];for(var S=0;S=C.reach);D+=M.value.length,M=M.next){var B=M.value;if(y.length>g.length)return;if(!(B instanceof a)){var P=1,$;if(O){if($=s(N,D,g,L),!$||$.index>=g.length)break;var z=$.index,F=$.index+$[0].length,q=D;for(q+=M.value.length;z>=q;)M=M.next,q+=M.value.length;if(q-=M.value.length,D=q,M.value instanceof a)continue;for(var G=M;G!==y.tail&&(qC.reach&&(C.reach=U);var le=M.prev;j&&(le=u(y,le,j),D+=j.length),h(y,le,P);var ee=new a(T,I?i.tokenize(H,I):H,R,H);if(M=u(y,le,ee),J&&u(y,M,J),P>1){var ue={cause:T+","+S,reach:U};o(g,y,v,M.prev,D,ue),C&&ue.reach>C.reach&&(C.reach=ue.reach)}}}}}}function l(){var g={value:null,prev:null,next:null},y={value:null,prev:g,next:null};g.next=y,this.head=g,this.tail=y,this.length=0}function u(g,y,v){var x=y.next,w={value:v,prev:y,next:x};return y.next=w,x.prev=w,g.length++,w}function h(g,y,v){for(var x=y.next,w=0;w/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};br.languages.markup.tag.inside["attr-value"].inside.entity=br.languages.markup.entity;br.languages.markup.doctype.inside["internal-subset"].inside=br.languages.markup;br.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});Object.defineProperty(br.languages.markup.tag,"addInlined",{value:function(t,r){var n={};n["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:br.languages[r]},n.cdata=/^$/i;var i={"included-cdata":{pattern://i,inside:n}};i["language-"+r]={pattern:/[\s\S]+/,inside:br.languages[r]};var a={};a[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:i},br.languages.insertBefore("markup","cdata",a)}});Object.defineProperty(br.languages.markup.tag,"addAttribute",{value:function(e,t){br.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:br.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});br.languages.html=br.languages.markup;br.languages.mathml=br.languages.markup;br.languages.svg=br.languages.markup;br.languages.xml=br.languages.extend("markup",{});br.languages.ssml=br.languages.xml;br.languages.atom=br.languages.xml;br.languages.rss=br.languages.xml;(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(br);br.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};br.languages.javascript=br.languages.extend("clike",{"class-name":[br.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});br.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;br.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:br.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:br.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:br.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:br.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:br.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});br.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:br.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});br.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});br.languages.markup&&(br.languages.markup.tag.addInlined("script","javascript"),br.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));br.languages.js=br.languages.javascript;(function(){if(typeof br>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e="Loading\u2026",t=function(d,p){return"\u2716 Error "+d+" while fetching file: "+p},r="\u2716 Error: File does not exist or is empty",n={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},i="data-src-status",a="loading",s="loaded",o="failed",l="pre[data-src]:not(["+i+'="'+s+'"]):not(['+i+'="'+a+'"])';function u(d,p,m){var g=new XMLHttpRequest;g.open("GET",d,!0),g.onreadystatechange=function(){g.readyState==4&&(g.status<400&&g.responseText?p(g.responseText):g.status>=400?m(t(g.status,g.statusText)):m(r))},g.send(null)}function h(d){var p=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(d||"");if(p){var m=Number(p[1]),g=p[2],y=p[3];return g?y?[m,Number(y)]:[m,void 0]:[m,m]}}br.hooks.add("before-highlightall",function(d){d.selector+=", "+l}),br.hooks.add("before-sanity-check",function(d){var p=d.element;if(p.matches(l)){d.code="",p.setAttribute(i,a);var m=p.appendChild(document.createElement("CODE"));m.textContent=e;var g=p.getAttribute("data-src"),y=d.language;if(y==="none"){var v=(/\.(\w+)$/.exec(g)||[,"none"])[1];y=n[v]||v}br.util.setLanguage(m,y),br.util.setLanguage(p,y);var x=br.plugins.autoloader;x&&x.loadLanguages(y),u(g,function(w){p.setAttribute(i,s);var C=h(p.getAttribute("data-range"));if(C){var T=w.split(/\r\n?|\n/g),k=C[0],S=C[1]==null?T.length:C[1];k<0&&(k+=T.length),k=Math.max(0,Math.min(k-1,T.length)),S<0&&(S+=T.length),S=Math.max(0,Math.min(S,T.length)),w=T.slice(k,S).join(` +`),p.hasAttribute("data-start")||p.setAttribute("data-start",String(k+1))}m.textContent=w,br.highlightElement(m)},function(w){p.setAttribute(i,o),m.textContent=w})}}),br.plugins.fileHighlight={highlight:function(p){for(var m=(p||document).querySelectorAll(l),g=0,y;y=m[g++];)br.highlightElement(y)}};var f=!1;br.fileHighlight=function(){f||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),f=!0),br.plugins.fileHighlight.highlight.apply(this,arguments)}})()});var iu=(function(e){return e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e.aiProviderError="aiProviderError",e.aiBuildContextError="aiBuildContextError",e})({}),au=class extends Error{constructor(e,t,r){super(t,r),this.name="MilkdownError",this.code=e,r?.cause!==void 0&&(this.cause=r.cause)}},Git=(e,t)=>typeof t=="function"?"[Function]":t,sE=e=>JSON.stringify(e,Git);function koe(e){return new au(iu.docTypeError,`Doc type error, unsupported type: ${sE(e)}`)}function Toe(e){return new au(iu.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}function Coe(e){return new au(iu.timerNotFound,`Timer "${e}" not found, do you forget to record it?`)}function j2(){return new au(iu.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function Soe(e,t,r){let n=`Cannot create node for ${"name"in e?e.name:e}`,i=s=>{if(s==null)return"null";if(Array.isArray(s))return`[${s.map(i).join(", ")}]`;if(typeof s=="object")return"toJSON"in s&&typeof s.toJSON=="function"?JSON.stringify(s.toJSON()):"spec"in s?JSON.stringify(s.spec):JSON.stringify(s);if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")return JSON.stringify(s);if(typeof s=="function")return`[Function: ${s.name||"anonymous"}]`;try{return String(s)}catch{return"[Unserializable]"}},a=[["[Description]",n],["[Attributes]",t],["[Content]",(r??[]).map(s=>s?typeof s=="object"&&"type"in s?`${s}`:i(s):"null")]].reduce((s,[o,l])=>{let u=`${o}: ${i(l)}.`;return s.concat(u)},[]);return new au(iu.createNodeInParserFail,a.join(` +`))}function mP(){return new au(iu.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function Eoe(e){return new au(iu.parserMatchError,`Cannot match target parser for node: ${sE(e)}.`)}function Aoe(e){return new au(iu.serializerMatchError,`Cannot match target serializer for node: ${sE(e)}.`)}function su(e){return new au(iu.expectDomTypeError,`Expect to be a dom, but get: ${sE(e)}.`)}function oE(){return new au(iu.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function lE(e){return new au(iu.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}function _oe(e){return new au(iu.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)}var gP=class{constructor(){this.sliceMap=new Map,this.get=e=>{let t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);if(!t)throw Toe(typeof e=="string"?e:e.name);return t},this.remove=e=>{let t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>typeof e=="string"?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},qit=class{#t;#e;#n;constructor(e,t,r){this.#t=[],this.#n=()=>{this.#t.forEach(n=>n(this.#e))},this.set=n=>{this.#e=n,this.#n()},this.get=()=>this.#e,this.update=n=>{this.#e=n(this.#e),this.#n()},this.type=r,this.#e=t,e.set(r.id,this)}on(e){return this.#t.push(e),()=>{this.#t=this.#t.filter(t=>t!==e)}}once(e){let t=this.on(r=>{e(r),t()});return t}off(e){this.#t=this.#t.filter(t=>t!==e)}offAll(){this.#t=[]}},Vit=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw j2()}}create(e,t=this._defaultValue){return new qit(e,t,this)}},bn=(e,t)=>new Vit(e,t),Wit=class{#t;#e;#n;#r;#s;#a;#i;constructor(e,t,r){this.#r=new Set,this.#s=new Set,this.#a=new Map,this.#i=new Map,this.read=()=>({metadata:this.#t,injectedSlices:[...this.#r].map(n=>({name:typeof n=="string"?n:n.name,value:this.#o(n)})),consumedSlices:[...this.#s].map(n=>({name:typeof n=="string"?n:n.name,value:this.#o(n)})),recordedTimers:[...this.#a].map(([n,{duration:i}])=>({name:n.name,duration:i,status:this.#l(n)})),waitTimers:[...this.#i].map(([n,{duration:i}])=>({name:n.name,duration:i,status:this.#l(n)}))}),this.onRecord=n=>{this.#a.set(n,{start:Date.now(),duration:0})},this.onClear=n=>{this.#a.delete(n)},this.onDone=n=>{let i=this.#a.get(n);i&&(i.duration=Date.now()-i.start)},this.onWait=(n,i)=>{let a=Date.now();i.finally(()=>{this.#i.set(n,{duration:Date.now()-a})}).catch(console.error)},this.onInject=n=>{this.#r.add(n)},this.onRemove=n=>{this.#r.delete(n)},this.onUse=n=>{this.#s.add(n)},this.#o=n=>this.#e.get(n).get(),this.#l=n=>this.#n.get(n).status,this.#e=e,this.#n=t,this.#t=r}#o;#l},Roe=class Loe{#t;#e;#n;#r;constructor(t,r,n){this.produce=i=>i&&Object.keys(i).length?new Loe(this.#t,this.#e,{...i}):this,this.inject=(i,a)=>{let s=i.create(this.#t.sliceMap);return a!=null&&s.set(a),this.#r?.onInject(i),this},this.remove=i=>(this.#t.remove(i),this.#r?.onRemove(i),this),this.record=i=>(i.create(this.#e.store),this.#r?.onRecord(i),this),this.clearTimer=i=>(this.#e.remove(i),this.#r?.onClear(i),this),this.isInjected=i=>this.#t.has(i),this.isRecorded=i=>this.#e.has(i),this.use=i=>(this.#r?.onUse(i),this.#t.get(i)),this.get=i=>this.use(i).get(),this.set=(i,a)=>this.use(i).set(a),this.update=(i,a)=>this.use(i).update(a),this.timer=i=>this.#e.get(i),this.done=i=>{this.timer(i).done(),this.#r?.onDone(i)},this.wait=i=>{let a=this.timer(i).start();return this.#r?.onWait(i,a),a},this.waitTimers=async i=>{await Promise.all(this.get(i).map(a=>this.wait(a)))},this.#t=t,this.#e=r,this.#n=n,n&&(this.#r=new Wit(t,r,n))}get meta(){return this.#n}get inspector(){return this.#r}},Ioe=class{constructor(){this.store=new Map,this.get=e=>{let t=this.store.get(e.id);if(!t)throw Coe(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},Hit=class{#t;#e;#n;#r;constructor(e,t){this.#t=null,this.#e=null,this.#r="pending",this.start=()=>(this.#t??=new Promise((r,n)=>{this.#e=i=>{i instanceof CustomEvent&&i.detail.id===this.#n&&(this.#r="resolved",this.#s(),i.stopImmediatePropagation(),r())},this.#a(()=>{this.#r==="pending"&&(this.#r="rejected"),this.#s(),n(new Error(`Timing ${this.type.name} timeout.`))}),this.#r="pending",addEventListener(this.type.name,this.#e)}),this.#t),this.done=()=>{let r=new CustomEvent(this.type.name,{detail:{id:this.#n}});dispatchEvent(r)},this.#s=()=>{this.#e&&removeEventListener(this.type.name,this.#e)},this.#a=r=>{setTimeout(()=>{r()},this.type.timeout)},this.#n=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#r}#s;#a},Uit=class{constructor(e,t=3e3){this.create=r=>new Hit(r,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},wc=(e,t=3e3)=>new Uit(e,t);var Yit={};function l1(e,t){let r=t||Yit,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Noe(e,n,i)}function Noe(e,t,r){if(Xit(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Moe(e.children,t,r)}return Array.isArray(e)?Moe(e,t,r):""}function Moe(e,t,r){let n=[],i=-1;for(;++ii?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)s=Array.from(n),s.unshift(t,r),e.splice(...s);else for(r&&e.splice(t,r);a0?(Oa(e,e.length,0,t),e):t}var Ooe={}.hasOwnProperty;function cE(e){let t={},r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCodePoint(r)}function Lo(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var us=Ap(/[A-Za-z]/),hs=Ap(/[\dA-Za-z]/),Poe=Ap(/[#-'*+\--9=?A-Z^-~]/);function c1(e){return e!==null&&(e<32||e===127)}var Ik=Ap(/\d/),Boe=Ap(/[\dA-Fa-f]/),Foe=Ap(/[!-/:-@[-`{-~]/);function Kt(e){return e!==null&&e<-2}function _n(e){return e!==null&&(e<0||e===32)}function Or(e){return e===-2||e===-1||e===32}var u1=Ap(/\p{P}|\p{S}/u),Wh=Ap(/\s/);function Ap(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function kr(e,t,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,a=0;return s;function s(l){return Or(l)?(e.enter(r),o(l)):t(l)}function o(l){return Or(l)&&a++s))return;let S=t.events.length,E=S,I,L;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(I){L=t.events[E][1].end;break}I=!0}for(v(n),k=S;kw;){let T=r[C];t.containerState=T[1],T[0].exit.call(t,e)}r.length=w}function x(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Jit(e,t,r){return kr(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rd(e){if(e===null||_n(e)||Wh(e))return 1;if(u1(e))return 2}function _p(e,t,r){let n=[],i=-1;for(;++i1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;let f={...e[n][1].end},d={...e[r][1].start};qoe(f,-l),qoe(d,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[n][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:d},a={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[r][1].start={...o.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=el(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=el(u,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",a,t]]),u=el(u,_p(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),u=el(u,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,u=el(u,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,Oa(e,n-1,r-n+3,u),r=n+u.length-h-2;break}}for(r=-1;++r0&&Or(k)?kr(e,x,"linePrefix",a+1)(k):x(k)}function x(k){return k===null||Kt(k)?e.check(Voe,g,C)(k):(e.enter("codeFlowValue"),w(k))}function w(k){return k===null||Kt(k)?(e.exit("codeFlowValue"),x(k)):(e.consume(k),w)}function C(k){return e.exit("codeFenced"),t(k)}function T(k,S,E){let I=0;return L;function L(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),O}function O(M){return k.enter("codeFencedFence"),Or(M)?kr(k,R,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):R(M)}function R(M){return M===o?(k.enter("codeFencedFenceSequence"),A(M)):E(M)}function A(M){return M===o?(I++,k.consume(M),A):I>=s?(k.exit("codeFencedFenceSequence"),Or(M)?kr(k,N,"whitespace")(M):N(M)):E(M)}function N(M){return M===null||Kt(M)?(k.exit("codeFencedFence"),S(M)):E(M)}}}function uat(e,t,r){let n=this;return i;function i(s){return s===null?r(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return n.parser.lazy[n.now().line]?r(s):t(s)}}var Nk={name:"codeIndented",tokenize:fat},hat={partial:!0,tokenize:dat};function fat(e,t,r){let n=this;return i;function i(u){return e.enter("codeIndented"),kr(e,a,"linePrefix",5)(u)}function a(u){let h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?s(u):r(u)}function s(u){return u===null?l(u):Kt(u)?e.attempt(hat,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Kt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function dat(e,t,r){let n=this;return i;function i(s){return n.parser.lazy[n.now().line]?r(s):Kt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):kr(e,a,"linePrefix",5)(s)}function a(s){let o=n.events[n.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):Kt(s)?i(s):r(s)}}var vP={name:"codeText",previous:mat,resolve:pat,tokenize:gat};function pat(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){let i=r||0;this.setCursor(Math.trunc(t));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Dk(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Dk(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Dk(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(s):e.interrupt(n.parser.constructs.flow,r,t)(s)}}function yE(e,t,r,n,i,a,s,o,l){let u=l||Number.POSITIVE_INFINITY,h=0;return f;function f(v){return v===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(v),e.exit(a),d):v===null||v===32||v===41||c1(v)?r(v):(e.enter(n),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(v))}function d(v){return v===62?(e.enter(a),e.consume(v),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(o),d(v)):v===null||v===60||Kt(v)?r(v):(e.consume(v),v===92?m:p)}function m(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function g(v){return!h&&(v===null||v===41||_n(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(n),t(v)):h999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?r(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):Kt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Kt(p)||o++>999?(e.exit("chunkString"),h(p)):(e.consume(p),l||(l=!Or(p)),p===92?d:f)}function d(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function xE(e,t,r,n,i,a){let s;return o;function o(d){return d===34||d===39||d===40?(e.enter(n),e.enter(i),e.consume(d),e.exit(i),s=d===40?41:d,l):r(d)}function l(d){return d===s?(e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):(e.enter(a),u(d))}function u(d){return d===s?(e.exit(a),l(s)):d===null?r(d):Kt(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),kr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===s||d===null||Kt(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?f:h)}function f(d){return d===s||d===92?(e.consume(d),h):h(d)}}function h1(e,t){let r;return n;function n(i){return Kt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Or(i)?kr(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}var bP={name:"definition",tokenize:Tat},kat={partial:!0,tokenize:Cat};function Tat(e,t,r){let n=this,i;return a;function a(p){return e.enter("definition"),s(p)}function s(p){return vE.call(n,e,o,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return i=Lo(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):r(p)}function l(p){return _n(p)?h1(e,u)(p):u(p)}function u(p){return yE(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(kat,f,f)(p)}function f(p){return Or(p)?kr(e,d,"whitespace")(p):d(p)}function d(p){return p===null||Kt(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function Cat(e,t,r){return n;function n(o){return _n(o)?h1(e,i)(o):r(o)}function i(o){return xE(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Or(o)?kr(e,s,"whitespace")(o):s(o)}function s(o){return o===null||Kt(o)?t(o):r(o)}}var wP={name:"hardBreakEscape",tokenize:Sat};function Sat(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Kt(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}var kP={name:"headingAtx",resolve:Eat,tokenize:Aat};function Eat(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Oa(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Aat(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),a(h)}function a(h){return e.enter("atxHeadingSequence"),s(h)}function s(h){return h===35&&n++<6?(e.consume(h),s):h===null||_n(h)?(e.exit("atxHeadingSequence"),o(h)):r(h)}function o(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||Kt(h)?(e.exit("atxHeading"),t(h)):Or(h)?kr(e,o,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function l(h){return h===35?(e.consume(h),l):(e.exit("atxHeadingSequence"),o(h))}function u(h){return h===null||h===35||_n(h)?(e.exit("atxHeadingText"),o(h)):(e.consume(h),u)}}var Woe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],TP=["pre","script","style","textarea"];var CP={concrete:!0,name:"htmlFlow",resolveTo:Lat,tokenize:Iat},_at={partial:!0,tokenize:Nat},Rat={partial:!0,tokenize:Mat};function Lat(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Iat(e,t,r){let n=this,i,a,s,o,l;return u;function u(z){return h(z)}function h(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),f}function f(z){return z===33?(e.consume(z),d):z===47?(e.consume(z),a=!0,g):z===63?(e.consume(z),i=3,n.interrupt?t:F):us(z)?(e.consume(z),s=String.fromCharCode(z),y):r(z)}function d(z){return z===45?(e.consume(z),i=2,p):z===91?(e.consume(z),i=5,o=0,m):us(z)?(e.consume(z),i=4,n.interrupt?t:F):r(z)}function p(z){return z===45?(e.consume(z),n.interrupt?t:F):r(z)}function m(z){let H="CDATA[";return z===H.charCodeAt(o++)?(e.consume(z),o===H.length?n.interrupt?t:R:m):r(z)}function g(z){return us(z)?(e.consume(z),s=String.fromCharCode(z),y):r(z)}function y(z){if(z===null||z===47||z===62||_n(z)){let H=z===47,j=s.toLowerCase();return!H&&!a&&TP.includes(j)?(i=1,n.interrupt?t(z):R(z)):Woe.includes(s.toLowerCase())?(i=6,H?(e.consume(z),v):n.interrupt?t(z):R(z)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(z):a?x(z):w(z))}return z===45||hs(z)?(e.consume(z),s+=String.fromCharCode(z),y):r(z)}function v(z){return z===62?(e.consume(z),n.interrupt?t:R):r(z)}function x(z){return Or(z)?(e.consume(z),x):L(z)}function w(z){return z===47?(e.consume(z),L):z===58||z===95||us(z)?(e.consume(z),C):Or(z)?(e.consume(z),w):L(z)}function C(z){return z===45||z===46||z===58||z===95||hs(z)?(e.consume(z),C):T(z)}function T(z){return z===61?(e.consume(z),k):Or(z)?(e.consume(z),T):w(z)}function k(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(e.consume(z),l=z,S):Or(z)?(e.consume(z),k):E(z)}function S(z){return z===l?(e.consume(z),l=null,I):z===null||Kt(z)?r(z):(e.consume(z),S)}function E(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||_n(z)?T(z):(e.consume(z),E)}function I(z){return z===47||z===62||Or(z)?w(z):r(z)}function L(z){return z===62?(e.consume(z),O):r(z)}function O(z){return z===null||Kt(z)?R(z):Or(z)?(e.consume(z),O):r(z)}function R(z){return z===45&&i===2?(e.consume(z),D):z===60&&i===1?(e.consume(z),B):z===62&&i===4?(e.consume(z),q):z===63&&i===3?(e.consume(z),F):z===93&&i===5?(e.consume(z),$):Kt(z)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(_at,G,A)(z)):z===null||Kt(z)?(e.exit("htmlFlowData"),A(z)):(e.consume(z),R)}function A(z){return e.check(Rat,N,G)(z)}function N(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),M}function M(z){return z===null||Kt(z)?A(z):(e.enter("htmlFlowData"),R(z))}function D(z){return z===45?(e.consume(z),F):R(z)}function B(z){return z===47?(e.consume(z),s="",P):R(z)}function P(z){if(z===62){let H=s.toLowerCase();return TP.includes(H)?(e.consume(z),q):R(z)}return us(z)&&s.length<8?(e.consume(z),s+=String.fromCharCode(z),P):R(z)}function $(z){return z===93?(e.consume(z),F):R(z)}function F(z){return z===62?(e.consume(z),q):z===45&&i===2?(e.consume(z),F):R(z)}function q(z){return z===null||Kt(z)?(e.exit("htmlFlowData"),G(z)):(e.consume(z),q)}function G(z){return e.exit("htmlFlow"),t(z)}}function Mat(e,t,r){let n=this;return i;function i(s){return Kt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):r(s)}function a(s){return n.parser.lazy[n.now().line]?r(s):t(s)}}function Nat(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Hh,t,r)}}var SP={name:"htmlText",tokenize:Dat};function Dat(e,t,r){let n=this,i,a,s;return o;function o(F){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(F),l}function l(F){return F===33?(e.consume(F),u):F===47?(e.consume(F),T):F===63?(e.consume(F),w):us(F)?(e.consume(F),E):r(F)}function u(F){return F===45?(e.consume(F),h):F===91?(e.consume(F),a=0,m):us(F)?(e.consume(F),x):r(F)}function h(F){return F===45?(e.consume(F),p):r(F)}function f(F){return F===null?r(F):F===45?(e.consume(F),d):Kt(F)?(s=f,B(F)):(e.consume(F),f)}function d(F){return F===45?(e.consume(F),p):f(F)}function p(F){return F===62?D(F):F===45?d(F):f(F)}function m(F){let q="CDATA[";return F===q.charCodeAt(a++)?(e.consume(F),a===q.length?g:m):r(F)}function g(F){return F===null?r(F):F===93?(e.consume(F),y):Kt(F)?(s=g,B(F)):(e.consume(F),g)}function y(F){return F===93?(e.consume(F),v):g(F)}function v(F){return F===62?D(F):F===93?(e.consume(F),v):g(F)}function x(F){return F===null||F===62?D(F):Kt(F)?(s=x,B(F)):(e.consume(F),x)}function w(F){return F===null?r(F):F===63?(e.consume(F),C):Kt(F)?(s=w,B(F)):(e.consume(F),w)}function C(F){return F===62?D(F):w(F)}function T(F){return us(F)?(e.consume(F),k):r(F)}function k(F){return F===45||hs(F)?(e.consume(F),k):S(F)}function S(F){return Kt(F)?(s=S,B(F)):Or(F)?(e.consume(F),S):D(F)}function E(F){return F===45||hs(F)?(e.consume(F),E):F===47||F===62||_n(F)?I(F):r(F)}function I(F){return F===47?(e.consume(F),D):F===58||F===95||us(F)?(e.consume(F),L):Kt(F)?(s=I,B(F)):Or(F)?(e.consume(F),I):D(F)}function L(F){return F===45||F===46||F===58||F===95||hs(F)?(e.consume(F),L):O(F)}function O(F){return F===61?(e.consume(F),R):Kt(F)?(s=O,B(F)):Or(F)?(e.consume(F),O):I(F)}function R(F){return F===null||F===60||F===61||F===62||F===96?r(F):F===34||F===39?(e.consume(F),i=F,A):Kt(F)?(s=R,B(F)):Or(F)?(e.consume(F),R):(e.consume(F),N)}function A(F){return F===i?(e.consume(F),i=void 0,M):F===null?r(F):Kt(F)?(s=A,B(F)):(e.consume(F),A)}function N(F){return F===null||F===34||F===39||F===60||F===61||F===96?r(F):F===47||F===62||_n(F)?I(F):(e.consume(F),N)}function M(F){return F===47||F===62||_n(F)?I(F):r(F)}function D(F){return F===62?(e.consume(F),e.exit("htmlTextData"),e.exit("htmlText"),t):r(F)}function B(F){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),P}function P(F){return Or(F)?kr(e,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):$(F)}function $(F){return e.enter("htmlTextData"),s(F)}}var f1={name:"labelEnd",resolveAll:Fat,resolveTo:$at,tokenize:zat},Oat={tokenize:Gat},Pat={tokenize:qat},Bat={tokenize:Vat};function Fat(e){let t=-1,r=[];for(;++t=3&&(u===null||Kt(u))?(e.exit("thematicBreak"),t(u)):r(u)}function l(u){return u===i?(e.consume(u),n++,l):(e.exit("thematicBreakSequence"),Or(u)?kr(e,o,"whitespace")(u):o(u))}}var Io={continuation:{tokenize:Zat},exit:Jat,name:"list",tokenize:Kat},Xat={partial:!0,tokenize:est},jat={partial:!0,tokenize:Qat};function Kat(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(p){let m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Ik(p)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(d1,r,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return r(p)}function l(p){return Ik(p)&&++s<10?(e.consume(p),l):(!n.interrupt||s<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):r(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(Hh,n.interrupt?r:h,e.attempt(Xat,d,f))}function h(p){return n.containerState.initialBlankLine=!0,a++,d(p)}function f(p){return Or(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),d):r(p)}function d(p){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Zat(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(Hh,i,a);function i(o){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,kr(e,t,"listItemIndent",n.containerState.size+1)(o)}function a(o){return n.containerState.furtherBlankLines||!Or(o)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,s(o)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(jat,t,s)(o))}function s(o){return n.containerState._closeFlow=!0,n.interrupt=void 0,kr(e,e.attempt(Io,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Qat(e,t,r){let n=this;return kr(e,i,"listItemIndent",n.containerState.size+1);function i(a){let s=n.events[n.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===n.containerState.size?t(a):r(a)}}function Jat(e){e.exit(this.containerState.type)}function est(e,t,r){let n=this;return kr(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let s=n.events[n.events.length-1];return!Or(a)&&s&&s[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}var bE={name:"setextUnderline",resolveTo:tst,tokenize:rst};function tst(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);let s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",s,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=s,e.push(["exit",s,t]),e}function rst(e,t,r){let n=this,i;return a;function a(u){let h=n.events.length,f;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){f=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||f)?(e.enter("setextHeadingLine"),i=u,s(u)):r(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Or(u)?kr(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Kt(u)?(e.exit("setextHeadingLine"),t(u)):r(u)}}var Hoe={tokenize:nst};function nst(e){let t=this,r=e.attempt(Hh,n,e.attempt(this.parser.constructs.flowInitial,i,kr(e,e.attempt(this.parser.constructs.flow,i,e.attempt(xP,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}var Uoe={resolveAll:Koe()},Yoe=joe("string"),Xoe=joe("text");function joe(e){return{resolveAll:Koe(e==="text"?ist:void 0),tokenize:t};function t(r){let n=this,i=this.parser.constructs[e],a=r.attempt(i,s,o);return s;function s(h){return u(h)?a(h):o(h)}function o(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),l}function l(h){return u(h)?(r.exit("data"),a(h)):(r.consume(h),l)}function u(h){if(h===null)return!0;let f=i[h],d=-1;if(f)for(;++dfst,contentInitial:()=>sst,disable:()=>dst,document:()=>ast,flow:()=>lst,flowInitial:()=>ost,insideSpan:()=>hst,string:()=>cst,text:()=>ust});var ast={42:Io,43:Io,45:Io,48:Io,49:Io,50:Io,51:Io,52:Io,53:Io,54:Io,55:Io,56:Io,57:Io,62:hE},sst={91:bP},ost={[-2]:Nk,[-1]:Nk,32:Nk},lst={35:kP,42:d1,45:[bE,d1],60:CP,61:bE,95:d1,96:pE,126:pE},cst={38:dE,92:fE},ust={[-5]:Ok,[-4]:Ok,[-3]:Ok,33:EP,38:dE,42:Mk,60:[yP,SP],91:AP,92:[wP,fE],93:f1,95:Mk,96:vP},hst={null:[Mk,Uoe]},fst={null:[42,95]},dst={null:[]};function Zoe(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},i={},a=[],s=[],o=[],l=!0,u={attempt:I(S),check:I(E),consume:C,enter:T,exit:k,interrupt:I(E,{interrupt:!0})},h={code:null,containerState:{},defineSkip:v,events:[],now:y,parser:e,previous:null,sliceSerialize:m,sliceStream:g,write:p},f=t.tokenize.call(h,u),d;return t.resolveAll&&a.push(t),h;function p(A){return s=el(s,A),x(),s[s.length-1]!==null?[]:(L(t,0),h.events=_p(a,h.events,h),h.events)}function m(A,N){return mst(g(A),N)}function g(A){return pst(s,A)}function y(){let{_bufferIndex:A,_index:N,line:M,column:D,offset:B}=n;return{_bufferIndex:A,_index:N,line:M,column:D,offset:B}}function v(A){i[A.line]=A.column,R()}function x(){let A;for(;n._index-1){let o=s[0];typeof o=="string"?s[0]=o.slice(n):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function mst(e,t){let r=-1,n=[],i;for(;++r0){let V=Ie.tokenStack[Ie.tokenStack.length-1];(V[1]||Joe).call(Ie,void 0,V[0])}for(ge.position={start:Lp(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Lp(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},ne=-1;++ne "),a.shift(2);let s=r.indentLines(r.containerFlow(e,a.current()),vst);return i(),s}function vst(e,t,r){return">"+(r?"":" ")+e}function kE(e,t){return sle(e,t.inConstruct,!0)&&!sle(e,t.notInConstruct,!1)}function sle(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++n0){let V=Ie.tokenStack[Ie.tokenStack.length-1];(V[1]||tle).call(Ie,void 0,V[0])}for(ge.position={start:Lp(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Lp(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},ne=-1;++ne "),a.shift(2);let s=r.indentLines(r.containerFlow(e,a.current()),kst);return i(),s}function kst(e,t,r){return">"+(r?"":" ")+e}function kE(e,t){return lle(e,t.inConstruct,!0)&&!lle(e,t.notInConstruct,!1)}function lle(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++ns&&(s=a):a=1,i=n+t.length,n=r.indexOf(t,i);return s}function Pk(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function ole(e){let t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function lle(e,t,r,n){let i=ole(r),a=e.value||"",s=i==="`"?"GraveAccent":"Tilde";if(Pk(e,r)){let f=r.enter("codeIndented"),d=r.indentLines(a,xst);return f(),d}let o=r.createTracker(n),l=i.repeat(Math.max(TE(a,i)+1,3)),u=r.enter("codeFenced"),h=o.move(l);if(e.lang){let f=r.enter(`codeFencedLang${s}`);h+=o.move(r.safe(e.lang,{before:h,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){let f=r.enter(`codeFencedMeta${s}`);h+=o.move(" "),h+=o.move(r.safe(e.meta,{before:h,after:` +`}function TE(e,t){let r=String(e),n=r.indexOf(t),i=n,a=0,s=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++a>s&&(s=a):a=1,i=n+t.length,n=r.indexOf(t,i);return s}function Pk(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function cle(e){let t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function ule(e,t,r,n){let i=cle(r),a=e.value||"",s=i==="`"?"GraveAccent":"Tilde";if(Pk(e,r)){let f=r.enter("codeIndented"),d=r.indentLines(a,Tst);return f(),d}let o=r.createTracker(n),l=i.repeat(Math.max(TE(a,i)+1,3)),u=r.enter("codeFenced"),h=o.move(l);if(e.lang){let f=r.enter(`codeFencedLang${s}`);h+=o.move(r.safe(e.lang,{before:h,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){let f=r.enter(`codeFencedMeta${s}`);h+=o.move(" "),h+=o.move(r.safe(e.meta,{before:h,after:` `,encode:["`"],...o.current()})),f()}return h+=o.move(` `),a&&(h+=o.move(a+` -`)),h+=o.move(l),u(),h}function xst(e,t,r){return(r?"":" ")+e}function Q2(e){let t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function cle(e,t,r,n){let i=Q2(r),a=i==='"'?"Quote":"Apostrophe",s=r.enter("definition"),o=r.enter("label"),l=r.createTracker(n),u=l.move("[");return u+=l.move(r.safe(r.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=r.enter("destinationRaw"),u+=l.move(r.safe(e.url,{before:u,after:e.title?" ":` -`,...l.current()}))),o(),e.title&&(o=r.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(r.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),s(),u}function ule(e){let t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function kc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function J2(e,t,r){let n=Rd(e),i=Rd(t);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}DP.peek=bst;function DP(e,t,r,n){let i=ule(r),a=r.enter("emphasis"),s=r.createTracker(n),o=s.move(i),l=s.move(r.containerPhrasing(e,{after:i,before:o,...s.current()})),u=l.charCodeAt(0),h=J2(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(l=kc(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=J2(n.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+kc(f));let p=s.move(i);return a(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},o+l+p}function bst(e,t,r){return r.options.emphasis||"*"}var Ip=(function(e){if(e==null)return Cst;if(typeof e=="function")return CE(e);if(typeof e=="object")return Array.isArray(e)?wst(e):kst(e);if(typeof e=="string")return Tst(e);throw new Error("Expected function, string, or object as test")});function wst(e){let t=[],r=-1;for(;++r":""))+")"})}return d;function d(){let p=hle,m,g,y;if((!t||a(l,u,h[h.length-1]||void 0))&&(p=Est(r(l,h)),p[0]===p1))return p;if("children"in l&&l.children){let v=l;if(v.children&&p[0]!==m1)for(g=(n?v.children.length:-1)+s,y=h.concat(v);g>-1&&g",...l.current()})),u+=l.move(">")):(o=r.enter("destinationRaw"),u+=l.move(r.safe(e.url,{before:u,after:e.title?" ":` +`,...l.current()}))),o(),e.title&&(o=r.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(r.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),s(),u}function fle(e){let t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function kc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function J2(e,t,r){let n=Rd(e),i=Rd(t);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}PP.peek=Cst;function PP(e,t,r,n){let i=fle(r),a=r.enter("emphasis"),s=r.createTracker(n),o=s.move(i),l=s.move(r.containerPhrasing(e,{after:i,before:o,...s.current()})),u=l.charCodeAt(0),h=J2(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(l=kc(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=J2(n.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+kc(f));let p=s.move(i);return a(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},o+l+p}function Cst(e,t,r){return r.options.emphasis||"*"}var Ip=(function(e){if(e==null)return _st;if(typeof e=="function")return CE(e);if(typeof e=="object")return Array.isArray(e)?Sst(e):Est(e);if(typeof e=="string")return Ast(e);throw new Error("Expected function, string, or object as test")});function Sst(e){let t=[],r=-1;for(;++r":""))+")"})}return d;function d(){let p=dle,m,g,y;if((!t||a(l,u,h[h.length-1]||void 0))&&(p=Lst(r(l,h)),p[0]===p1))return p;if("children"in l&&l.children){let v=l;if(v.children&&p[0]!==m1)for(g=(n?v.children.length:-1)+s,y=h.concat(v);g>-1&&g",...l.current()})),u+=l.move(">")):(o=r.enter("destinationRaw"),u+=l.move(r.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=r.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(r.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),u+=l.move(")"),s(),u}function _st(){return"!"}BP.peek=Rst;function BP(e,t,r,n){let i=e.referenceType,a=r.enter("imageReference"),s=r.enter("label"),o=r.createTracker(n),l=o.move("!["),u=r.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();let h=r.stack;r.stack=[],s=r.enter("reference");let f=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return s(),r.stack=h,a(),i==="full"||!u||u!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function Rst(){return"!"}FP.peek=Lst;function FP(e,t,r){let n=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++a\u007F]/.test(e.url))}zP.peek=Ist;function zP(e,t,r,n){let i=Q2(r),a=i==='"'?"Quote":"Apostrophe",s=r.createTracker(n),o,l;if($P(e,r)){let h=r.stack;r.stack=[],o=r.enter("autolink");let f=s.move("<");return f+=s.move(r.containerPhrasing(e,{before:f,after:">",...s.current()})),f+=s.move(">"),o(),r.stack=h,f}o=r.enter("link"),l=r.enter("label");let u=s.move("[");return u+=s.move(r.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(r.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=r.enter("destinationRaw"),u+=s.move(r.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=r.enter(`title${a}`),u+=s.move(" "+i),u+=s.move(r.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),l()),u+=s.move(")"),o(),u}function Ist(e,t,r){return $P(e,r)?"<":"["}GP.peek=Mst;function GP(e,t,r,n){let i=e.referenceType,a=r.enter("linkReference"),s=r.enter("label"),o=r.createTracker(n),l=o.move("["),u=r.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();let h=r.stack;r.stack=[],s=r.enter("reference");let f=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return s(),r.stack=h,a(),i==="full"||!u||u!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function Mst(){return"["}function ex(e){let t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function dle(e){let t=ex(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function ple(e){let t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function AE(e){let t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function mle(e,t,r,n){let i=r.enter("list"),a=r.bulletCurrent,s=e.ordered?ple(r):ex(r),o=e.ordered?s==="."?")":".":dle(r),l=t&&r.bulletLastUsed?s===r.bulletLastUsed:!1;if(!e.ordered){let h=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&h&&(!h.children||!h.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),AE(r)===s&&h){let f=-1;for(;++f-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let s=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);let o=r.createTracker(n);o.move(a+" ".repeat(s-a.length)),o.shift(s);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,o.current()),h);return l(),u;function h(f,d,p){return d?(p?"":" ".repeat(s))+f:(p?a:a+" ".repeat(s-a.length))+f}}function vle(e,t,r,n){let i=r.enter("paragraph"),a=r.enter("phrasing"),s=r.containerPhrasing(e,n);return a(),i(),s}var qP=Ip(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xle(e,t,r,n){return(e.children.some(function(s){return qP(s)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function ble(e){let t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}VP.peek=Nst;function VP(e,t,r,n){let i=ble(r),a=r.enter("strong"),s=r.createTracker(n),o=s.move(i+i),l=s.move(r.containerPhrasing(e,{after:i,before:o,...s.current()})),u=l.charCodeAt(0),h=J2(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(l=kc(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=J2(n.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+kc(f));let p=s.move(i+i);return a(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},o+l+p}function Nst(e,t,r){return r.options.strong||"*"}function wle(e,t,r,n){return r.safe(e.value,n)}function kle(e){let t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Tle(e,t,r){let n=(AE(r)+(r.options.ruleSpaces?" ":"")).repeat(kle(r));return r.options.ruleSpaces?n.slice(0,-1):n}var y1={blockquote:ale,break:NP,code:lle,definition:cle,emphasis:DP,hardBreak:NP,heading:fle,html:OP,image:PP,imageReference:BP,inlineCode:FP,link:zP,linkReference:GP,list:mle,listItem:yle,paragraph:vle,root:xle,strong:VP,text:wle,thematicBreak:Tle};var Cle=[Dst];function Dst(e,t,r,n){if(t.type==="code"&&Pk(t,n)&&(e.type==="list"||e.type===t.type&&Pk(e,n)))return!1;if("spread"in r&&typeof r.spread=="boolean")return e.type==="paragraph"&&(e.type===t.type||t.type==="definition"||t.type==="heading"&&EE(t,n))?void 0:r.spread?1:0}var v1=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Sle=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:` +`,...a.current()});return/^[\t ]/.test(u)&&(u=kc(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,r.options.closeAtx&&(u+=" "+s),l(),o(),u}BP.peek=Ist;function BP(e){return e.value||""}function Ist(){return"<"}FP.peek=Mst;function FP(e,t,r,n){let i=Q2(r),a=i==='"'?"Quote":"Apostrophe",s=r.enter("image"),o=r.enter("label"),l=r.createTracker(n),u=l.move("![");return u+=l.move(r.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=r.enter("destinationRaw"),u+=l.move(r.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=r.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(r.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),u+=l.move(")"),s(),u}function Mst(){return"!"}$P.peek=Nst;function $P(e,t,r,n){let i=e.referenceType,a=r.enter("imageReference"),s=r.enter("label"),o=r.createTracker(n),l=o.move("!["),u=r.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();let h=r.stack;r.stack=[],s=r.enter("reference");let f=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return s(),r.stack=h,a(),i==="full"||!u||u!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function Nst(){return"!"}zP.peek=Dst;function zP(e,t,r){let n=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++a\u007F]/.test(e.url))}qP.peek=Ost;function qP(e,t,r,n){let i=Q2(r),a=i==='"'?"Quote":"Apostrophe",s=r.createTracker(n),o,l;if(GP(e,r)){let h=r.stack;r.stack=[],o=r.enter("autolink");let f=s.move("<");return f+=s.move(r.containerPhrasing(e,{before:f,after:">",...s.current()})),f+=s.move(">"),o(),r.stack=h,f}o=r.enter("link"),l=r.enter("label");let u=s.move("[");return u+=s.move(r.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(r.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=r.enter("destinationRaw"),u+=s.move(r.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=r.enter(`title${a}`),u+=s.move(" "+i),u+=s.move(r.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),l()),u+=s.move(")"),o(),u}function Ost(e,t,r){return GP(e,r)?"<":"["}VP.peek=Pst;function VP(e,t,r,n){let i=e.referenceType,a=r.enter("linkReference"),s=r.enter("label"),o=r.createTracker(n),l=o.move("["),u=r.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();let h=r.stack;r.stack=[],s=r.enter("reference");let f=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return s(),r.stack=h,a(),i==="full"||!u||u!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function Pst(){return"["}function ex(e){let t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function mle(e){let t=ex(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function gle(e){let t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function AE(e){let t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function yle(e,t,r,n){let i=r.enter("list"),a=r.bulletCurrent,s=e.ordered?gle(r):ex(r),o=e.ordered?s==="."?")":".":mle(r),l=t&&r.bulletLastUsed?s===r.bulletLastUsed:!1;if(!e.ordered){let h=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&h&&(!h.children||!h.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),AE(r)===s&&h){let f=-1;for(;++f-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let s=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);let o=r.createTracker(n);o.move(a+" ".repeat(s-a.length)),o.shift(s);let l=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,o.current()),h);return l(),u;function h(f,d,p){return d?(p?"":" ".repeat(s))+f:(p?a:a+" ".repeat(s-a.length))+f}}function ble(e,t,r,n){let i=r.enter("paragraph"),a=r.enter("phrasing"),s=r.containerPhrasing(e,n);return a(),i(),s}var WP=Ip(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function wle(e,t,r,n){return(e.children.some(function(s){return WP(s)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function kle(e){let t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}HP.peek=Bst;function HP(e,t,r,n){let i=kle(r),a=r.enter("strong"),s=r.createTracker(n),o=s.move(i+i),l=s.move(r.containerPhrasing(e,{after:i,before:o,...s.current()})),u=l.charCodeAt(0),h=J2(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(l=kc(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=J2(n.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+kc(f));let p=s.move(i+i);return a(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},o+l+p}function Bst(e,t,r){return r.options.strong||"*"}function Tle(e,t,r,n){return r.safe(e.value,n)}function Cle(e){let t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Sle(e,t,r){let n=(AE(r)+(r.options.ruleSpaces?" ":"")).repeat(Cle(r));return r.options.ruleSpaces?n.slice(0,-1):n}var y1={blockquote:ole,break:OP,code:ule,definition:hle,emphasis:PP,hardBreak:OP,heading:ple,html:BP,image:FP,imageReference:$P,inlineCode:zP,link:qP,linkReference:VP,list:yle,listItem:xle,paragraph:ble,root:wle,strong:HP,text:Tle,thematicBreak:Sle};var Ele=[Fst];function Fst(e,t,r,n){if(t.type==="code"&&Pk(t,n)&&(e.type==="list"||e.type===t.type&&Pk(e,n)))return!1;if("spread"in r&&typeof r.spread=="boolean")return e.type==="paragraph"&&(e.type===t.type||t.type==="definition"||t.type==="heading"&&EE(t,n))?void 0:r.spread?1:0}var v1=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Ale=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:` `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:v1},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:v1},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r *])`},{character:"*",inConstruct:"phrasing",notInConstruct:v1},{atBreak:!0,character:"+",after:`(?:[ \r ])`},{atBreak:!0,character:"-",after:`(?:[ \r -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r -]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:v1},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:v1},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:v1},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:v1},{atBreak:!0,character:"~"}];function Ele(e){return e.label||!e.identifier?e.label||"":wE(e.identifier)}function Ale(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function _le(e,t,r){let n=t.indexStack,i=e.children||[],a=[],s=-1,o=r.before,l;n.push(-1);let u=t.createTracker(r);for(;++s0&&(o==="\r"||o===` -`)&&h.type==="html"&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/," "),o=" ",u=t.createTracker(r),u.move(a.join("")));let d=t.handle(h,e,t,{...u.current(),after:f,before:o});l&&l===d.slice(0,1)&&(d=kc(l.charCodeAt(0))+d.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,l=void 0,p&&(a.length>0&&p.before&&o===a[a.length-1].slice(-1)&&(a[a.length-1]=a[a.length-1].slice(0,-1)+kc(o.charCodeAt(0))),p.after&&(l=f)),u.move(d),a.push(d),o=d.slice(-1)}return n.pop(),a.join("")}function Rle(e,t,r){let n=t.indexStack,i=e.children||[],a=t.createTracker(r),s=[],o=-1;for(n.push(-1);++o"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:v1},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:v1},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:v1},{atBreak:!0,character:"~"}];function _le(e){return e.label||!e.identifier?e.label||"":wE(e.identifier)}function Rle(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function Lle(e,t,r){let n=t.indexStack,i=e.children||[],a=[],s=-1,o=r.before,l;n.push(-1);let u=t.createTracker(r);for(;++s0&&(o==="\r"||o===` +`)&&h.type==="html"&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/," "),o=" ",u=t.createTracker(r),u.move(a.join("")));let d=t.handle(h,e,t,{...u.current(),after:f,before:o});l&&l===d.slice(0,1)&&(d=kc(l.charCodeAt(0))+d.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,l=void 0,p&&(a.length>0&&p.before&&o===a[a.length-1].slice(-1)&&(a[a.length-1]=a[a.length-1].slice(0,-1)+kc(o.charCodeAt(0))),p.after&&(l=f)),u.move(d),a.push(d),o=d.slice(-1)}return n.pop(),a.join("")}function Ile(e,t,r){let n=t.indexStack,i=e.children||[],a=t.createTracker(r),s=[],o=-1;for(n.push(-1);++o `}return` -`}var Pst=/\r?\n|\r/g;function Lle(e,t){let r=[],n=0,i=0,a;for(;a=Pst.exec(e);)s(e.slice(n,a.index)),r.push(a[0]),n=a.index+a[0].length,i++;return s(e.slice(n)),r.join("");function s(o){r.push(t(o,i,!o))}}function Mle(e,t,r){let n=(r.before||"")+(t||"")+(r.after||""),i=[],a=[],s={},o=-1;for(;++o=u||h+1=u||h+1s.length,l;o&&s.push(i);try{l=e.apply(this,s)}catch(u){let h=u;if(o&&r)throw h;return i(h)}o||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(s,...o){r||(r=!0,t(s,...o))}function a(s){i(null,s)}}var Ls=class extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},s=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(s=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?a.ruleId=n:(a.source=n.slice(0,l),a.ruleId=n.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=Rp(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Ls.prototype.file="";Ls.prototype.name="";Ls.prototype.reason="";Ls.prototype.message="";Ls.prototype.stack="";Ls.prototype.column=void 0;Ls.prototype.line=void 0;Ls.prototype.ancestors=void 0;Ls.prototype.cause=void 0;Ls.prototype.fatal=void 0;Ls.prototype.place=void 0;Ls.prototype.ruleId=void 0;Ls.prototype.source=void 0;var Qu={basename:Wst,dirname:Hst,extname:Ust,join:Yst,sep:"/"};function Wst(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fk(e);let r=0,n=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let s=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else s<0&&(a=!0,s=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(n=i):(o=-1,n=s));return r===n?n=s:n<0&&(n=e.length),e.slice(r,n)}function Hst(e){if(Fk(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Ust(e){Fk(e);let t=e.length,r=-1,n=0,i=-1,a=0,s;for(;t--;){let o=e.codePointAt(t);if(o===47){if(s){n=t+1;break}continue}r<0&&(s=!0,r=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function Yst(...e){let t=-1,r;for(;++t0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function jst(e,t){let r="",n=0,i=-1,a=0,s=-1,o,l;for(;++s<=e.length;){if(s2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=s,a=0;continue}}else if(r.length>0){r="",n=0,i=s,a=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,s):r=e.slice(i+1,s),n=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return r}function Fk(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var Wle={cwd:Kst};function Kst(){return"/"}function rx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Hle(e){if(typeof e=="string")e=new URL(e);else if(!rx(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Zst(e)}function Zst(e){if(e.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let t=e.pathname,r=-1;for(;++r0){let[p,...m]=h,g=n[d][1];Bk(g)&&Bk(p)&&(p=(0,LE.default)(!0,g,p)),n[d]=[u,p,...m]}}}},zk=new JP().freeze();function KP(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ZP(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function QP(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Xle(e){if(!Bk(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jle(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function RE(e){return eot(e)?e:new $k(e)}function eot(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function tot(e){return typeof e=="string"||rot(e)}function rot(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}function Mo(e){this.content=e}Mo.prototype={constructor:Mo,find:function(e){for(var t=0;t>1}};Mo.from=function(e){if(e instanceof Mo)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new Mo(t)};var eB=Mo;function ace(e,t,r){for(let n=0;;n++){if(n==e.childCount||n==t.childCount)return e.childCount==t.childCount?null:r;let i=e.child(n),a=t.child(n);if(i==a){r+=i.nodeSize;continue}if(!i.sameMarkup(a))return r;if(i.isText&&i.text!=a.text){let s=i.text,o=a.text,l=0;for(;s[l]==o[l];l++)r++;return l&&l0&&d>0&&u[f-1]==h[d-1];)f--,d--,r--,n--;return f&&d&&f=56320&&e<57344}function lce(e){return e>=55296&&e<56320}var Lt=class e{constructor(t,r){if(this.content=t,this.size=r||0,r==null)for(let n=0;nt&&n(l,i+o,a||null,s)!==!1&&l.content.size){let h=o+1;l.nodesBetween(Math.max(0,t-h),Math.min(l.content.size,r-h),n,i+h)}o=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,r,n,i){let a="",s=!0;return this.nodesBetween(t,r,(o,l)=>{let u=o.isText?o.text.slice(Math.max(t,l)-l,r-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&n&&(s?s=!1:a+=n),a+=u},0),a}append(t){if(!t.size)return this;if(!this.size)return t;let r=this.lastChild,n=t.firstChild,i=this.content.slice(),a=0;for(r.isText&&r.sameMarkup(n)&&(i[i.length-1]=r.withText(r.text+n.text),a=1);at)for(let a=0,s=0;st&&((sr)&&(o.isText?o=o.cut(Math.max(0,t-s),Math.min(o.text.length,r-s)):o=o.cut(Math.max(0,t-s-1),Math.min(o.content.size,r-s-1))),n.push(o),i+=o.nodeSize),s=l}return new e(n,i)}cutByIndex(t,r){return t==r?e.empty:t==0&&r==this.content.length?this:new e(this.content.slice(t,r))}replaceChild(t,r){let n=this.content[t];if(n==r)return this;let i=this.content.slice(),a=this.size+r.nodeSize-n.nodeSize;return i[t]=r,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let r=0;rthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=this.child(r),a=n+i.nodeSize;if(a>=t)return a==t?IE(r+1,a):IE(r,n);n=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,r){if(!r)return e.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(r.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let r,n=0;for(let i=0;ithis.type.rank&&(r||(r=t.slice(0,i)),r.push(this),n=!0),r&&r.push(a)}}return r||(r=t.slice()),n||r.push(this),r}removeFromSet(t){for(let r=0;rn.type.rank-i.type.rank),r}};In.none=[];var Mp=class extends Error{},Xt=class e{constructor(t,r,n){this.content=t,this.openStart=r,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,r){let n=uce(this.content,t+this.openStart,r,this.openStart+1,this.openEnd+1);return n&&new e(n,this.openStart,this.openEnd)}removeBetween(t,r){return new e(cce(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,r){if(!r)return e.empty;let n=r.openStart||0,i=r.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new e(Lt.fromJSON(t,r.content),n,i)}static maxOpen(t,r=!0){let n=0,i=0;for(let a=t.firstChild;a&&!a.isLeaf&&(r||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=t.lastChild;a&&!a.isLeaf&&(r||!a.type.spec.isolating);a=a.lastChild)i++;return new e(t,n,i)}};Xt.empty=new Xt(Lt.empty,0,0);function cce(e,t,r){let{index:n,offset:i}=e.findIndex(t),a=e.maybeChild(n),{index:s,offset:o}=e.findIndex(r);if(i==t||a.isText){if(o!=r&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(r))}if(n!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(n,a.copy(cce(a.content,t-i-1,r-i-1)))}function uce(e,t,r,n,i,a){let{index:s,offset:o}=e.findIndex(t),l=e.maybeChild(s);if(o==t||l.isText)return a&&n<=0&&i<=0&&!a.canReplace(s,s,r)?null:e.cut(0,t).append(r).append(e.cut(t));let u=uce(l.content,t-o-1,r,s==0?n-1:0,s==e.childCount-1?i-1:0,l);return u&&e.replaceChild(s,l.copy(u))}function not(e,t,r){if(r.openStart>e.depth)throw new Mp("Inserted content deeper than insertion position");if(e.depth-r.openStart!=t.depth-r.openEnd)throw new Mp("Inconsistent open depths");return hce(e,t,r,0)}function hce(e,t,r,n){let i=e.index(n),a=e.node(n);if(i==t.index(n)&&n=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function Gk(e,t,r,n){let i=(t||e).node(r),a=0,s=t?t.index(r):i.childCount;e&&(a=e.index(r),e.depth>r?a++:e.textOffset&&(x1(e.nodeAfter,n),a++));for(let o=a;oi&&rB(e,t,i+1),s=n.depth>i&&rB(r,n,i+1),o=[];return Gk(null,e,i,o),a&&s&&t.index(i)==r.index(i)?(fce(a,s),x1(b1(a,dce(e,t,r,n,i+1)),o)):(a&&x1(b1(a,OE(e,t,i+1)),o),Gk(t,r,i,o),s&&x1(b1(s,OE(r,n,i+1)),o)),Gk(n,null,i,o),new Lt(o)}function OE(e,t,r){let n=[];if(Gk(null,e,r,n),e.depth>r){let i=rB(e,t,r+1);x1(b1(i,OE(e,t,r+1)),n)}return Gk(t,null,r,n),new Lt(n)}function iot(e,t){let r=t.depth-e.openStart,i=t.node(r).copy(e.content);for(let a=r-1;a>=0;a--)i=t.node(a).copy(Lt.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}var PE=class e{constructor(t,r,n){this.pos=t,this.path=r,this.parentOffset=n,this.depth=r.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,r=this.index(this.depth);if(r==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=t.child(r);return n?t.child(r).cut(n):i}get nodeBefore(){let t=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(t).cut(0,r):t==0?null:this.parent.child(t-1)}posAtIndex(t,r){r=this.resolveDepth(r);let n=this.path[r*3],i=r==0?0:this.path[r*3-1]+1;for(let a=0;a0;r--)if(this.start(r)<=t&&this.end(r)>=t)return r;return 0}blockRange(t=this,r){if(t.pos=0;n--)if(t.pos<=this.end(n)&&(!r||r(this.node(n))))return new Vk(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&r<=t.content.size))throw new RangeError("Position "+r+" out of range");let n=[],i=0,a=r;for(let s=t;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(n.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new e(r,n,a)}static resolveCached(t,r){let n=Kle.get(t);if(n)for(let a=0;at&&this.nodesBetween(t,r,a=>(n.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),pce(this.marks,t)}contentMatchAt(t){let r=this.type.contentMatch.matchFragment(this.content,0,t);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(t,r,n=Lt.empty,i=0,a=n.childCount){let s=this.contentMatchAt(t).matchFragment(n,i,a),o=s&&s.matchFragment(this.content,r);if(!o||!o.validEnd)return!1;for(let l=i;lr.type.name)}`);this.content.forEach(r=>r.check())}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(r=>r.toJSON())),t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let n;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=r.marks.map(t.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(r.text,n)}let i=Lt.fromJSON(t,r.content),a=t.nodeType(r.type).create(r.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};Fl.prototype.text=void 0;var iB=class e extends Fl{constructor(t,r,n,i){if(super(t,r,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pce(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,r){return this.text.slice(t,r)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(t=0,r=this.text.length){return t==0&&r==this.text.length?this:this.withText(this.text.slice(t,r))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}};function pce(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}var w1=class e{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,r){let n=new aB(t,r);if(n.next==null)return e.empty;let i=mce(n);n.next&&n.err("Unexpected trailing text");let a=dot(fot(i));return pot(a,n),a}matchType(t){for(let r=0;ru.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function r(n){t.push(n);for(let i=0;i{let a=i+(n.validEnd?"*":" ")+" ";for(let s=0;s"+t.indexOf(n.next[s].next);return a}).join(` -`)}};w1.empty=new w1(!0);var aB=class{constructor(t,r){this.string=t,this.nodeTypes=r,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function mce(e){let t=[];do t.push(oot(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function oot(e){let t=[];do t.push(lot(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function lot(e){let t=hot(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=cot(e,t);else break;return t}function Zle(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function cot(e,t){let r=Zle(e),n=r;return e.eat(",")&&(e.next!="}"?n=Zle(e):n=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}function uot(e,t){let r=e.nodeTypes,n=r[t];if(n)return[n];let i=[];for(let a in r){let s=r[a];s.isInGroup(t)&&i.push(s)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function hot(e){if(e.eat("(")){let t=mce(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=uot(e,e.next).map(r=>(e.inline==null?e.inline=r.isInline:e.inline!=r.isInline&&e.err("Mixing inline and block content"),{type:"name",value:r}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function fot(e){let t=[[]];return i(a(e,0),r()),t;function r(){return t.push([])-1}function n(s,o,l){let u={term:l,to:o};return t[s].push(u),u}function i(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(a(u,o)),[]);if(s.type=="seq")for(let l=0;;l++){let u=a(s.exprs[l],o);if(l==s.exprs.length-1)return u;i(u,o=r())}else if(s.type=="star"){let l=r();return n(o,l),i(a(s.expr,l),l),[n(l)]}else if(s.type=="plus"){let l=r();return i(a(s.expr,o),l),i(a(s.expr,l),l),[n(l)]}else{if(s.type=="opt")return[n(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let u=0;u{e[s].forEach(({term:o,to:l})=>{if(!o)return;let u;for(let h=0;h{u||i.push([o,u=[]]),u.indexOf(h)==-1&&u.push(h)})})});let a=t[n.join(",")]=new w1(n.indexOf(e.length-1)>-1);for(let s=0;s-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:vce(this.attrs,t)}create(t=null,r,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Fl(this,this.computeAttrs(t),Lt.from(r),In.setFrom(n))}createChecked(t=null,r,n){return r=Lt.from(r),this.checkContent(r),new Fl(this,this.computeAttrs(t),r,In.setFrom(n))}createAndFill(t=null,r,n){if(t=this.computeAttrs(t),r=Lt.from(r),r.size){let s=this.contentMatch.fillBefore(r);if(!s)return null;r=s.append(r)}let i=this.contentMatch.matchFragment(r),a=i&&i.fillBefore(Lt.empty,!0);return a?new Fl(this,t,r.append(a),In.setFrom(n)):null}validContent(t){let r=this.contentMatch.matchFragment(t);if(!r||!r.validEnd)return!1;for(let n=0;n-1}allowsMarks(t){if(this.markSet==null)return!0;for(let r=0;rn[a]=new e(a,r,s));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let a in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function mot(e,t,r){let n=r.split("|");return i=>{let a=i===null?"null":typeof i;if(n.indexOf(a)<0)throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${a}`)}}var sB=class{constructor(t,r,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?mot(t,r,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Hk=class e{constructor(t,r,n,i){this.name=t,this.rank=r,this.schema=n,this.spec=i,this.attrs=bce(t,i.attrs),this.excluded=null;let a=yce(this.attrs);this.instance=a?new In(this,a):null}create(t=null){return!t&&this.instance?this.instance:new In(this,vce(this.attrs,t))}static compile(t,r){let n=Object.create(null),i=0;return t.forEach((a,s)=>n[a]=new e(a,i++,r,s)),n}removeFromSet(t){for(var r=0;r-1}},BE=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let i in t)r[i]=t[i];r.nodes=eB.from(t.nodes),r.marks=eB.from(t.marks||{}),this.nodes=Wk.compile(this.spec.nodes,this),this.marks=Hk.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=n[s]||(n[s]=w1.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?Jle(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:Jle(this,s.split(" "))}this.nodeFromJSON=i=>Fl.fromJSON(this,i),this.markFromJSON=i=>In.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,r=null,n,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Wk){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(r,n,i)}text(t,r){let n=this.nodes.text;return new iB(n,n.defaultAttrs,t,In.setFrom(r))}mark(t,r){return typeof t=="string"&&(t=this.marks[t]),t.create(r)}nodeType(t){let r=this.nodes[t];if(!r)throw new RangeError("Unknown node type: "+t);return r}};function Jle(e,t){let r=[];for(let n=0;n-1)&&r.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[n]+"'")}return r}function got(e){return e.tag!=null}function yot(e){return e.style!=null}var Uh=class e{constructor(t,r){this.schema=t,this.rules=r,this.tags=[],this.styles=[];let n=this.matchedStyles=[];r.forEach(i=>{if(got(i))this.tags.push(i);else if(yot(i)){let a=/[^=]*/.exec(i.style)[0];n.indexOf(a)<0&&n.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=t.nodes[i.node];return a.contentMatch.matchType(a)})}parse(t,r={}){let n=new FE(this,r,!1);return n.addAll(t,In.none,r.from,r.to),n.finish()}parseSlice(t,r={}){let n=new FE(this,r,!0);return n.addAll(t,In.none,r.from,r.to),Xt.maxOpen(n.finish())}matchTag(t,r,n){for(let i=n?this.tags.indexOf(n)+1:0;it.length&&(o.charCodeAt(t.length)!=61||o.slice(t.length+1)!=r))){if(s.getAttrs){let l=s.getAttrs(r);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let r=[];function n(i){let a=i.priority==null?50:i.priority,s=0;for(;s{n(s=tce(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in t.nodes){let a=t.nodes[i].spec.parseDOM;a&&a.forEach(s=>{n(s=tce(s)),s.node||s.ignore||s.mark||(s.node=i)})}return r}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},wce={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},vot={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},kce={ol:!0,ul:!0},Uk=1,oB=2,qk=4;function ece(e,t,r){return t!=null?(t?Uk:0)|(t==="full"?oB:0):e&&e.whitespace=="pre"?Uk|oB:r&~qk}var nx=class{constructor(t,r,n,i,a,s){this.type=t,this.attrs=r,this.marks=n,this.solid=i,this.options=s,this.content=[],this.activeMarks=In.none,this.match=a||(s&qk?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let r=this.type.contentMatch.fillBefore(Lt.from(t));if(r)this.match=this.type.contentMatch.matchFragment(r);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(t.type))?(this.match=n,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Uk)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let a=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let r=Lt.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(Lt.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!wce.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}},FE=class{constructor(t,r,n){this.parser=t,this.options=r,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=r.topNode,a,s=ece(null,r.preserveWhitespace,0)|(n?qk:0);i?a=new nx(i.type,i.attrs,In.none,!0,r.topMatch||i.type.contentMatch,s):n?a=new nx(null,null,In.none,!0,null,s):a=new nx(t.schema.topNodeType,null,In.none,!0,null,s),this.nodes=[a],this.find=r.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,r){t.nodeType==3?this.addTextNode(t,r):t.nodeType==1&&this.addElement(t,r)}addTextNode(t,r){let n=t.nodeValue,i=this.top,a=i.options&oB?"full":this.localPreserveWS||(i.options&Uk)>0,{schema:s}=this.parser;if(a==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(a)if(a==="full")n=n.replace(/\r\n?/g,` -`);else if(s.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=n.split(/\r?\n|\r/);for(let l=0;l!l.clearMark(u)):r=r.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return r}addElementByRule(t,r,n,i){let a,s;if(r.node)if(s=this.parser.schema.nodes[r.node],s.isLeaf)this.insertNode(s.create(r.attrs),n,t.nodeName=="BR")||this.leafFallback(t,n);else{let l=this.enter(s,r.attrs||null,n,r.preserveWhitespace);l&&(a=!0,n=l)}else{let l=this.parser.schema.marks[r.mark];n=n.concat(l.create(r.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(t);else if(i)this.addElement(t,n,i);else if(r.getContent)this.findInside(t),r.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=t;typeof r.contentElement=="string"?l=t.querySelector(r.contentElement):typeof r.contentElement=="function"?l=r.contentElement(t):r.contentElement&&(l=r.contentElement),this.findAround(t,l,!0),this.addAll(l,n),this.findAround(t,l,!1)}a&&this.sync(o)&&this.open--}addAll(t,r,n,i){let a=n||0;for(let s=n?t.childNodes[n]:t.firstChild,o=i==null?null:t.childNodes[i];s!=o;s=s.nextSibling,++a)this.findAtPoint(t,a),this.addDOM(s,r);this.findAtPoint(t,a)}findPlace(t,r,n){let i,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(t);if(u&&(!i||i.length>u.length+o)&&(i=u,a=l,!u.length))break;if(l.solid){if(n)break;o+=2}}if(!i)return null;this.sync(a);for(let s=0;s(s.type?s.type.allowsMarkType(u.type):rce(u.type,t))?(l=u.addToSet(l),!1):!0),this.nodes.push(new nx(t,r,l,i,null,o)),this.open++,n}closeExtra(t=!1){let r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let r=this.open;r>=0;r--){if(this.nodes[r]==t)return this.open=r,!0;this.localPreserveWS&&(this.nodes[r].options|=Uk)}return!1}get currentPos(){this.closeExtra();let t=0;for(let r=this.open;r>=0;r--){let n=this.nodes[r].content;for(let i=n.length-1;i>=0;i--)t+=n[i].nodeSize;r&&t++}return t}findAtPoint(t,r){if(this.find)for(let n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let r=t.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),a=-(n?n.depth+1:0)+(i?0:1),s=(o,l)=>{for(;o>=0;o--){let u=r[o];if(u==""){if(o==r.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let h=l>0||l==0&&i?this.nodes[l].type:n&&l>=a?n.node(l-a).type:null;if(!h||h.name!=u&&!h.isInGroup(u))return!1;l--}}return!0};return s(r.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let r=t.depth;r>=0;r--){let n=t.node(r).contentMatchAt(t.indexAfter(r)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let r in this.parser.schema.nodes){let n=this.parser.schema.nodes[r];if(n.isTextblock&&n.defaultAttrs)return n}}};function xot(e){for(let t=e.firstChild,r=null;t;t=t.nextSibling){let n=t.nodeType==1?t.nodeName.toLowerCase():null;n&&kce.hasOwnProperty(n)&&r?(r.appendChild(t),t=r):n=="li"?r=t:n&&(r=null)}}function bot(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function tce(e){let t={};for(let r in e)t[r]=e[r];return t}function rce(e,t){let r=t.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let a=[],s=o=>{a.push(o);for(let l=0;l{if(a.length||s.marks.length){let o=0,l=0;for(;o=0;i--){let a=this.serializeMark(t.marks[i],t.isInline,r);a&&((a.contentDOM||a.dom).appendChild(n),n=a.dom)}return n}serializeMark(t,r,n={}){let i=this.marks[t.type.name];return i&&NE(ME(n),i(t,r),null,t.attrs)}static renderSpec(t,r,n=null,i){return typeof r=="string"?{dom:t.createTextNode(r)}:NE(t,r,n,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let r=nce(t.nodes);return r.text||(r.text=n=>n.text),r}static marksFromSchema(t){return nce(t.marks)}};function nce(e){let t={};for(let r in e){let n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function ME(e){return e.document||window.document}var ice=new WeakMap;function wot(e){let t=ice.get(e);return t===void 0&&ice.set(e,t=kot(e)),t}function kot(e){let t=null;function r(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")t||(t=[]),t.push(n);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),u=t[1],h=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){h=2;for(let f in u)if(u[f]!=null){let d=f.indexOf(" ");d>0?l.setAttributeNS(f.slice(0,d),f.slice(d+1),u[f]):f=="style"&&l.style?l.style.cssText=u[f]:l.setAttribute(f,u[f])}}for(let f=h;fh)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof d=="string")l.appendChild(e.createTextNode(d));else{let{dom:p,contentDOM:m}=NE(e,d,r,n);if(l.appendChild(p),m){if(o)throw new RangeError("Multiple content holes");o=m}}}return{dom:l,contentDOM:o}}var Sce=65535,Ece=Math.pow(2,16);function Tot(e,t){return e+t*Ece}function Tce(e){return e&Sce}function Cot(e){return(e-(e&Sce))/Ece}var Ace=1,_ce=2,$E=4,Rce=8,jk=class{constructor(t,r,n){this.pos=t,this.delInfo=r,this.recover=n}get deleted(){return(this.delInfo&Rce)>0}get deletedBefore(){return(this.delInfo&(Ace|$E))>0}get deletedAfter(){return(this.delInfo&(_ce|$E))>0}get deletedAcross(){return(this.delInfo&$E)>0}},Ld=class e{constructor(t,r=!1){if(this.ranges=t,this.inverted=r,!t.length&&e.empty)return e.empty}recover(t){let r=0,n=Tce(t);if(!this.inverted)for(let i=0;it)break;let u=this.ranges[o+a],h=this.ranges[o+s],f=l+u;if(t<=f){let d=u?t==l?-1:t==f?1:r:r,p=l+i+(d<0?0:h);if(n)return p;let m=t==(r<0?l:f)?null:Tot(o/3,t-l),g=t==l?_ce:t==f?Ace:$E;return(r<0?t!=l:t!=f)&&(g|=Rce),new jk(p,g,m)}i+=h-u}return n?t+i:new jk(t+i,0,null)}touches(t,r){let n=0,i=Tce(r),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;ot)break;let u=this.ranges[o+a],h=l+u;if(t<=h&&o==i*3)return!0;n+=this.ranges[o+s]-u}return!1}forEach(t){let r=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,a=0;i=0;r--){let i=t.getMirror(r);this.appendMap(t._maps[r].invert(),i!=null&&i>r?n-i-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(t,r=1){if(this.mirror)return this._map(t,r,!0);for(let n=this.from;na&&l!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),r.openStart,r.openEnd);return js.fromReplace(t,this.from,this.to,a)}invert(){return new T1(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};Is.jsonID("addMark",k1);var T1=class e extends Is{constructor(t,r,n){super(),this.from=t,this.to=r,this.mark=n}apply(t){let r=t.slice(this.from,this.to),n=new Xt(pB(r.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),r.openStart,r.openEnd);return js.fromReplace(t,this.from,this.to,n)}invert(){return new k1(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};Is.jsonID("removeMark",T1);var Kk=class e extends Is{constructor(t,r){super(),this.pos=t,this.mark=r}apply(t){let r=t.nodeAt(this.pos);if(!r)return js.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.addToSet(r.marks));return js.fromReplace(t,this.pos,this.pos+1,new Xt(Lt.from(n),0,r.isLeaf?0:1))}invert(t){let r=t.nodeAt(this.pos);if(r){let n=this.mark.addToSet(r.marks);if(n.length==r.marks.length){for(let i=0;in.pos?null:new e(r.pos,n.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number"||typeof r.gapFrom!="number"||typeof r.gapTo!="number"||typeof r.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(r.from,r.to,r.gapFrom,r.gapTo,Xt.fromJSON(t,r.slice),r.insert,!!r.structure)}};Is.jsonID("replaceAround",Zs);function fB(e,t,r){let n=e.resolve(t),i=r-t,a=n.depth;for(;i>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,i--;if(i>0){let s=n.node(a).maybeChild(n.indexAfter(a));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Sot(e,t,r,n){let i=[],a=[],s,o;e.doc.nodesBetween(t,r,(l,u,h)=>{if(!l.isInline)return;let f=l.marks;if(!n.isInSet(f)&&h.type.allowsMarkType(n.type)){let d=Math.max(u,t),p=Math.min(u+l.nodeSize,r),m=n.addToSet(f);for(let g=0;ge.step(l)),a.forEach(l=>e.step(l))}function Eot(e,t,r,n){let i=[],a=0;e.doc.nodesBetween(t,r,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(n instanceof Hk){let u=s.marks,h;for(;h=n.isInSet(u);)(l||(l=[])).push(h),u=h.removeFromSet(u)}else n?n.isInSet(s.marks)&&(l=[n]):l=s.marks;if(l&&l.length){let u=Math.min(o+s.nodeSize,r);for(let h=0;he.step(new T1(s.from,s.to,s.style)))}function mB(e,t,r,n=r.contentMatch,i=!0){let a=e.doc.nodeAt(t),s=[],o=t+1;for(let l=0;l=0;l--)e.step(s[l])}function Aot(e,t,r){return(t==0||e.canReplace(t,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function ox(e){let r=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,i=0,a=0;;--n){let s=e.$from.node(n),o=e.$from.index(n)+i,l=e.$to.indexAfter(n)-a;if(nr;m--)g||n.index(m)>0?(g=!0,h=Lt.from(n.node(m).copy(h)),f++):l--;let d=Lt.empty,p=0;for(let m=a,g=!1;m>r;m--)g||i.after(m+1)=0;s--){if(n.size){let o=r[s].type.contentMatch.matchFragment(n);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Lt.from(r[s].type.create(r[s].attrs,n))}let i=t.start,a=t.end;e.step(new Zs(i,a,i,a,new Xt(n,0,0),r.length,!0))}function Mot(e,t,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=e.steps.length;e.doc.nodesBetween(t,r,(s,o)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(n,l)&&Not(e.doc,e.mapping.slice(a).map(o),n)){let u=null;if(n.schema.linebreakReplacement){let p=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&Ice(e,s,o,a),mB(e,e.mapping.slice(a).map(o,1),n,void 0,u===null);let h=e.mapping.slice(a),f=h.map(o,1),d=h.map(o+s.nodeSize,1);return e.step(new Zs(f,d,f+1,d-1,new Xt(Lt.from(n.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Lce(e,s,o,a),!1}})}function Lce(e,t,r,n){t.forEach((i,a)=>{if(i.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(i.text);){let l=e.mapping.slice(n).map(r+1+a+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function Ice(e,t,r,n){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let s=e.mapping.slice(n).map(r+1+a);e.replaceWith(s,s+1,t.type.schema.text(` -`))}})}function Not(e,t,r){let n=e.resolve(t),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}function Dot(e,t,r,n,i){let a=e.doc.nodeAt(t);if(!a)throw new RangeError("No node at given position");r||(r=a.type);let s=r.create(n,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,s);if(!r.validContent(a.content))throw new RangeError("Invalid content for node type "+r.name);e.step(new Zs(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new Xt(Lt.from(s),0,0),1,!0))}function S1(e,t,r=1,n){let i=e.resolve(t),a=i.depth-r,s=n&&n[n.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,h=r-2;u>a;u--,h--){let f=i.node(u),d=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),m=n&&n[h+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=n&&n[h]||f;if(!f.canReplace(d+1,f.childCount)||!g.type.validContent(p))return!1}let o=i.indexAfter(a),l=n&&n[0];return i.node(a).canReplaceWith(o,o,l?l.type:i.node(a+1).type)}function Oot(e,t,r=1,n){let i=e.doc.resolve(t),a=Lt.empty,s=Lt.empty;for(let o=i.depth,l=i.depth-r,u=r-1;o>l;o--,u--){a=Lt.from(i.node(o).copy(a));let h=n&&n[u];s=Lt.from(h?h.type.create(h.attrs,s):i.node(o).copy(s))}e.step(new Ks(t,t,new Xt(a.append(s),r,r),!0))}function E1(e,t){let r=e.resolve(t),n=r.index();return Bot(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function Pot(e,t){t.content.size||e.type.compatibleContent(t.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i=0;i--){let a=n.index(i);if(n.node(i).canReplaceWith(a,a,r))return n.before(i+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let a=n.indexAfter(i);if(n.node(i).canReplaceWith(a,a,r))return n.after(i+1);if(a=0;s--){let o=s==n.depth?0:n.pos<=(n.start(s+1)+n.end(s+1))/2?-1:1,l=n.index(s)+(o>0?1:0),u=n.node(s),h=!1;if(a==1)h=u.canReplace(l,l,i);else{let f=u.contentMatchAt(l).findWrapping(i.firstChild.type);h=f&&u.canReplaceWith(l,l,f[0])}if(h)return o==0?n.pos:o<0?n.before(s+1):n.after(s+1)}return null}function Zk(e,t,r=t,n=Xt.empty){if(t==r&&!n.size)return null;let i=e.resolve(t),a=e.resolve(r);return Nce(i,a,n)?new Ks(t,r,n):new dB(i,a,n).fit()}function Nce(e,t,r){return!r.openStart&&!r.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),r.content)}var dB=class{constructor(t,r,n){this.$from=t,this.$to=r,this.unplaced=n,this.frontier=[],this.placed=Lt.empty;for(let i=0;i<=t.depth;i++){let a=t.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=Lt.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(t<0?this.$to:n.doc.resolve(t));if(!i)return null;let a=this.placed,s=n.depth,o=i.depth;for(;s&&o&&a.childCount==1;)a=a.firstChild.content,s--,o--;let l=new Xt(a,s,o);return t>-1?new Zs(n.pos,t,this.$to.pos,this.$to.end(),l,r):l.size||n.pos!=this.$to.pos?new Ks(n.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let r=this.unplaced.content,n=0,i=this.unplaced.openEnd;n1&&(i=0),a.type.spec.isolating&&i<=n){t=n;break}r=a.content}for(let r=1;r<=2;r++)for(let n=r==1?t:this.unplaced.openStart;n>=0;n--){let i,a=null;n?(a=cB(this.unplaced.content,n-1).firstChild,i=a.content):i=this.unplaced.content;let s=i.firstChild;for(let o=this.depth;o>=0;o--){let{type:l,match:u}=this.frontier[o],h,f=null;if(r==1&&(s?u.matchType(s.type)||(f=u.fillBefore(Lt.from(s),!1)):a&&l.compatibleContent(a.type)))return{sliceDepth:n,frontierDepth:o,parent:a,inject:f};if(r==2&&s&&(h=u.findWrapping(s.type)))return{sliceDepth:n,frontierDepth:o,parent:a,wrap:h};if(a&&u.matchType(a.type))break}}}openMore(){let{content:t,openStart:r,openEnd:n}=this.unplaced,i=cB(t,r);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Xt(t,r+1,Math.max(n,i.size+r>=t.size-n?r+1:0)),!0)}dropNode(){let{content:t,openStart:r,openEnd:n}=this.unplaced,i=cB(t,r);if(i.childCount<=1&&r>0){let a=t.size-r<=r+i.size;this.unplaced=new Xt(Yk(t,r-1,1),r-1,a?r-1:n)}else this.unplaced=new Xt(Yk(t,r,1),r,n)}placeNodes({sliceDepth:t,frontierDepth:r,parent:n,inject:i,wrap:a}){for(;this.depth>r;)this.closeFrontierNode();if(a)for(let g=0;g1||l==0||g.content.size)&&(f=y,h.push(Dce(g.mark(d.allowedMarks(g.marks)),u==1?l:0,u==o.childCount?p:-1)))}let m=u==o.childCount;m||(p=-1),this.placed=Xk(this.placed,r,Lt.from(h)),this.frontier[r].match=f,m&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=o;g1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(t){e:for(let r=Math.min(this.depth,t.depth);r>=0;r--){let{match:n,type:i}=this.frontier[r],a=r=0;o--){let{match:l,type:u}=this.frontier[o],h=uB(t,o,u,l,!0);if(!h||h.childCount)continue e}return{depth:r,fit:s,move:a?t.doc.resolve(t.after(r+1)):t}}}}close(t){let r=this.findCloseLevel(t);if(!r)return null;for(;this.depth>r.depth;)this.closeFrontierNode();r.fit.childCount&&(this.placed=Xk(this.placed,r.depth,r.fit)),t=r.move;for(let n=r.depth+1;n<=t.depth;n++){let i=t.node(n),a=i.type.contentMatch.fillBefore(i.content,!0,t.index(n));this.openFrontierNode(i.type,i.attrs,a)}return t}openFrontierNode(t,r=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Xk(this.placed,this.depth,Lt.from(t.create(r,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let r=this.frontier.pop().match.fillBefore(Lt.empty,!0);r.childCount&&(this.placed=Xk(this.placed,this.frontier.length,r))}};function Yk(e,t,r){return t==0?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(Yk(e.firstChild.content,t-1,r)))}function Xk(e,t,r){return t==0?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(Xk(e.lastChild.content,t-1,r)))}function cB(e,t){for(let r=0;r1&&(n=n.replaceChild(0,Dce(n.firstChild,t-1,n.childCount==1?r-1:0))),t>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(Lt.empty,!0)))),e.copy(n)}function uB(e,t,r,n,i){let a=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==a.childCount&&!r.compatibleContent(a.type))return null;let o=n.fillBefore(a.content,!0,s);return o&&!zot(r,a.content,s)?o:null}function zot(e,t,r){for(let n=r;n0;d--,p--){let m=i.node(d).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(d)>-1?o=d:i.before(d)==p&&s.splice(1,0,-d)}let l=s.indexOf(o),u=[],h=n.openStart;for(let d=n.content,p=0;;p++){let m=d.firstChild;if(u.push(m),p==n.openStart)break;d=m.content}for(let d=h-1;d>=0;d--){let p=u[d],m=Got(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(o)-1)))h=d;else if(m||!p.type.isTextblock)break}for(let d=n.openStart;d>=0;d--){let p=(d+h+1)%(n.openStart+1),m=u[p];if(m)for(let g=0;g=0&&(e.replace(t,r,n),!(e.steps.length>f));d--){let p=s[d];p<0||(t=i.before(p),r=a.after(p))}}function Oce(e,t,r,n,i){if(tn){let a=i.contentMatchAt(0),s=a.fillBefore(e).append(e);e=s.append(a.matchFragment(s).fillBefore(Lt.empty,!0))}return e}function Vot(e,t,r,n){if(!n.isInline&&t==r&&e.doc.resolve(t).parent.content.size){let i=$ot(e.doc,t,n.type);i!=null&&(t=r=i)}e.replaceRange(t,r,new Xt(Lt.from(n),0,0))}function Wot(e,t,r){let n=e.doc.resolve(t),i=e.doc.resolve(r);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&n.parentOffset==0&&i.parentOffset==0){let s=n.sharedDepth(r),o=!1;for(let l=n.depth;l>s;l--)n.node(l).type.spec.isolating&&(o=!0);for(let l=i.depth;l>s;l--)i.node(l).type.spec.isolating&&(o=!0);if(!o){for(let l=n.depth;l>0&&t==n.start(l);l--)t=n.before(l);for(let l=i.depth;l>0&&r==i.start(l);l--)r=i.before(l);n=e.doc.resolve(t),i=e.doc.resolve(r)}}let a=Pce(n,i);for(let s=0;s0&&(l||n.node(o-1).canReplace(n.index(o-1),i.indexAfter(o-1))))return e.delete(n.before(o),i.after(o))}for(let s=1;s<=n.depth&&s<=i.depth;s++)if(t-n.start(s)==n.depth-s&&r>n.end(s)&&i.end(s)-r!=i.depth-s&&n.start(s-1)==i.start(s-1)&&n.node(s-1).canReplace(n.index(s-1),i.index(s-1)))return e.delete(n.before(s),r);e.delete(t,r)}function Pce(e,t){let r=[],n=Math.min(e.depth,t.depth);for(let i=n;i>=0;i--){let a=e.start(i);if(at.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(a==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==a-1)&&r.push(i)}return r}var zE=class e extends Is{constructor(t,r,n){super(),this.pos=t,this.attr=r,this.value=n}apply(t){let r=t.nodeAt(this.pos);if(!r)return js.fail("No node at attribute step's position");let n=Object.create(null);for(let a in r.attrs)n[a]=r.attrs[a];n[this.attr]=this.value;let i=r.type.create(n,null,r.marks);return js.fromReplace(t,this.pos,this.pos+1,new Xt(Lt.from(i),0,r.isLeaf?0:1))}getMap(){return Ld.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,r){if(typeof r.pos!="number"||typeof r.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(r.pos,r.attr,r.value)}};Is.jsonID("attr",zE);var GE=class e extends Is{constructor(t,r){super(),this.attr=t,this.value=r}apply(t){let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let n=t.type.create(r,t.content,t.marks);return js.ok(n)}getMap(){return Ld.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,r){if(typeof r.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(r.attr,r.value)}};Is.jsonID("docAttr",GE);var ax=class extends Error{};ax=function e(t){let r=Error.call(this,t);return r.__proto__=e.prototype,r};ax.prototype=Object.create(Error.prototype);ax.prototype.constructor=ax;ax.prototype.name="TransformError";var sx=class{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new hB}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let r=this.maybeStep(t);if(r.failed)throw new ax(r.failed);return this}maybeStep(t){let r=t.apply(this.doc);return r.failed||this.addStep(t,r.doc),r}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,r=-1e9;for(let n=0;n{t=Math.min(t,o),r=Math.max(r,l)})}return t==1e9?null:{from:t,to:r}}addStep(t,r){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=r}replace(t,r=t,n=Xt.empty){let i=Zk(this.doc,t,r,n);return i&&this.step(i),this}replaceWith(t,r,n){return this.replace(t,r,new Xt(Lt.from(n),0,0))}delete(t,r){return this.replace(t,r,Xt.empty)}insert(t,r){return this.replaceWith(t,t,r)}replaceRange(t,r,n){return qot(this,t,r,n),this}replaceRangeWith(t,r,n){return Vot(this,t,r,n),this}deleteRange(t,r){return Wot(this,t,r),this}lift(t,r){return _ot(this,t,r),this}join(t,r=1){return Fot(this,t,r),this}wrap(t,r){return Iot(this,t,r),this}setBlockType(t,r=t,n,i=null){return Mot(this,t,r,n,i),this}setNodeMarkup(t,r,n=null,i){return Dot(this,t,r,n,i),this}setNodeAttribute(t,r,n){return this.step(new zE(t,r,n)),this}setDocAttribute(t,r){return this.step(new GE(t,r)),this}addNodeMark(t,r){return this.step(new Kk(t,r)),this}removeNodeMark(t,r){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(r instanceof In)r.isInSet(n.marks)&&this.step(new ix(t,r));else{let i=n.marks,a,s=[];for(;a=r.isInSet(i);)s.push(new ix(t,a)),i=a.removeFromSet(i);for(let o=s.length-1;o>=0;o--)this.step(s[o])}return this}split(t,r=1,n){return Oot(this,t,r,n),this}addMark(t,r,n){return Sot(this,t,r,n),this}removeMark(t,r,n){return Eot(this,t,r,n),this}clearIncompatible(t,r,n){return mB(this,t,r,n),this}};var gB=Object.create(null),Vr=class{constructor(t,r,n){this.$anchor=t,this.$head=r,this.ranges=n||[new Np(t.min(r),t.max(r))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let r=0;r=0;a--){let s=r<0?lx(t.node(0),t.node(a),t.before(a+1),t.index(a),r,n):lx(t.node(0),t.node(a),t.after(a+1),t.index(a)+1,r,n);if(s)return s}return null}static near(t,r=1){return this.findFrom(t,r)||this.findFrom(t,-r)||new Tc(t.node(0))}static atStart(t){return lx(t,t,0,0,1)||new Tc(t)}static atEnd(t){return lx(t,t,t.content.size,t.childCount,-1)||new Tc(t)}static fromJSON(t,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=gB[r.type];if(!n)throw new RangeError(`No selection type ${r.type} defined`);return n.fromJSON(t,r)}static jsonID(t,r){if(t in gB)throw new RangeError("Duplicate use of selection JSON ID "+t);return gB[t]=r,r.prototype.jsonID=t,r}getBookmark(){return Pr.between(this.$anchor,this.$head).getBookmark()}};Vr.prototype.visible=!0;var Np=class{constructor(t,r){this.$from=t,this.$to=r}},Bce=!1;function Fce(e){!Bce&&!e.parent.inlineContent&&(Bce=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var Pr=class e extends Vr{constructor(t,r=t){Fce(t),Fce(r),super(t,r)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,r){let n=t.resolve(r.map(this.head));if(!n.parent.inlineContent)return Vr.near(n);let i=t.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:n,n)}replace(t,r=Xt.empty){if(super.replace(t,r),r==Xt.empty){let n=this.$from.marksAcross(this.$to);n&&t.ensureMarks(n)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new VE(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,r){if(typeof r.anchor!="number"||typeof r.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(r.anchor),t.resolve(r.head))}static create(t,r,n=r){let i=t.resolve(r);return new this(i,n==r?i:t.resolve(n))}static between(t,r,n){let i=t.pos-r.pos;if((!n||i)&&(n=i>=0?1:-1),!r.parent.inlineContent){let a=Vr.findFrom(r,n,!0)||Vr.findFrom(r,-n,!0);if(a)r=a.$head;else return Vr.near(r,n)}return t.parent.inlineContent||(i==0?t=r:(t=(Vr.findFrom(t,-n,!0)||Vr.findFrom(t,n,!0)).$anchor,t.pos0?0:1);i>0?s=0;s+=i){let o=t.child(s);if(o.isAtom){if(!a&&cn.isSelectable(o))return cn.create(e,r-(i<0?o.nodeSize:0))}else{let l=lx(e,o,r+i,i<0?o.childCount:0,i,a);if(l)return l}r+=o.nodeSize*i}return null}function $ce(e,t,r){let n=e.steps.length-1;if(n{s==null&&(s=h)}),e.setSelection(Vr.near(e.doc.resolve(s),r))}var zce=1,qE=2,Gce=4,xB=class extends sx{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=qE,this}ensureMarks(t){return In.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&qE)>0}addStep(t,r){super.addStep(t,r),this.updated=this.updated&~qE,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,r=!0){let n=this.selection;return r&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||In.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,r,n){let i=this.doc.type.schema;if(r==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(n==null&&(n=r),!t)return this.deleteRange(r,n);let a=this.storedMarks;if(!a){let s=this.doc.resolve(r);a=n==r?s.marks():s.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(r,n,i.text(t,a)),!this.selection.empty&&this.selection.to==r+t.length&&this.setSelection(Vr.near(this.selection.$to)),this}}setMeta(t,r){return this.meta[typeof t=="string"?t:t.key]=r,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Gce,this}get scrolledIntoView(){return(this.updated&Gce)>0}};function qce(e,t){return!t||!e?e:e.bind(t)}var A1=class{constructor(t,r,n){this.name=t,this.init=qce(r.init,n),this.apply=qce(r.apply,n)}},Uot=[new A1("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new A1("selection",{init(e,t){return e.selection||Vr.atStart(t.doc)},apply(e){return e.selection}}),new A1("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,r,n){return n.selection.$cursor?e.storedMarks:null}}),new A1("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Qk=class{constructor(t,r){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Uot.slice(),r&&r.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new A1(n.key,n.spec.state,n))})}},cx=class e{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,r=-1){for(let n=0;nn.toJSON())),t&&typeof t=="object")for(let n in t){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[n],a=i.spec.state;a&&a.toJSON&&(r[n]=a.toJSON.call(i,this[i.key]))}return r}static fromJSON(t,r,n){if(!r)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new Qk(t.schema,t.plugins),a=new e(i);return i.fields.forEach(s=>{if(s.name=="doc")a.doc=Fl.fromJSON(t.schema,r.doc);else if(s.name=="selection")a.selection=Vr.fromJSON(a.doc,r.selection);else if(s.name=="storedMarks")r.storedMarks&&(a.storedMarks=r.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let o in n){let l=n[o],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(r,o)){a[s.name]=u.fromJSON.call(l,t,r[o],a);return}}a[s.name]=s.init(t,a)}}),a}};function Vce(e,t,r){for(let n in e){let i=e[n];i instanceof Function?i=i.bind(t):n=="handleDOMEvents"&&(i=Vce(i,t,{})),r[n]=i}return r}var Ci=class{constructor(t){this.spec=t,this.props={},t.props&&Vce(t.props,this,this.props),this.key=t.key?t.key.key:Wce("plugin")}getState(t){return t[this.key]}},yB=Object.create(null);function Wce(e){return e in yB?e+"$"+ ++yB[e]:(yB[e]=0,e+"$")}var Hi=class{constructor(t="key"){this.key=Wce(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}};var WE=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Uce(e,t){let{$cursor:r}=e.selection;return!r||(t?!t.endOfTextblock("backward",e):r.parentOffset>0)?null:r}var wB=(e,t,r)=>{let n=Uce(e,r);if(!n)return!1;let i=TB(n);if(!i){let s=n.blockRange(),o=s&&ox(s);return o==null?!1:(t&&t(e.tr.lift(s,o).scrollIntoView()),!0)}let a=i.nodeBefore;if(jce(e,i,t,-1))return!0;if(n.parent.content.size==0&&(ux(a,"end")||cn.isSelectable(a)))for(let s=n.depth;;s--){let o=Zk(e.doc,n.before(s),n.after(s),Xt.empty);if(o&&o.slice.size1)break}return a.isAtom&&i.depth==n.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Yce=(e,t,r)=>{let n=Uce(e,r);if(!n)return!1;let i=TB(n);return i?Yot(e,i,t):!1};function Yot(e,t,r){let n=t.nodeBefore,i=n,a=t.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let h=i.lastChild;if(!h)return!1;i=h}let s=t.nodeAfter,o=s,l=t.pos+1;for(;!o.isTextblock;l++){if(o.type.spec.isolating)return!1;let h=o.firstChild;if(!h)return!1;o=h}let u=Zk(e.doc,a,l,Xt.empty);if(!u||u.from!=a||u instanceof Ks&&u.slice.size>=l-a)return!1;if(r){let h=e.tr.step(u);h.setSelection(Pr.create(h.doc,a)),r(h.scrollIntoView())}return!0}function ux(e,t,r=!1){for(let n=e;n;n=t=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&n.childCount!=1)return!1}return!1}var kB=(e,t,r)=>{let{$head:n,empty:i}=e.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;a=TB(n)}let s=a&&a.nodeBefore;return!s||!cn.isSelectable(s)?!1:(t&&t(e.tr.setSelection(cn.create(e.doc,a.pos-s.nodeSize)).scrollIntoView()),!0)};function TB(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Xot(e,t){let{$cursor:r}=e.selection;return!r||(t?!t.endOfTextblock("forward",e):r.parentOffset{let n=Xot(e,r);if(!n)return!1;let i=Xce(n);if(!i)return!1;let a=i.nodeAfter;if(jce(e,i,t,1))return!0;if(n.parent.content.size==0&&(ux(a,"start")||cn.isSelectable(a))){let s=Zk(e.doc,n.before(),n.after(),Xt.empty);if(s&&s.slice.size{let{$head:n,empty:i}=e.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset=0;t--){let r=e.node(t);if(e.index(t)+1{let{$head:r,$anchor:n}=e.selection;return!r.parent.type.spec.code||!r.sameParent(n)?!1:(t&&t(e.tr.insertText(` -`).scrollIntoView()),!0)};function CB(e){for(let t=0;t{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),a=r.indexAfter(-1),s=CB(i.contentMatchAt(a));if(!s||!i.canReplaceWith(a,a,s))return!1;if(t){let o=r.after(),l=e.tr.replaceWith(o,o,s.createAndFill());l.setSelection(Vr.near(l.doc.resolve(o),1)),t(l.scrollIntoView())}return!0},Jot=(e,t)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof Tc||n.parent.inlineContent||i.parent.inlineContent)return!1;let a=CB(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let s=(!n.parentOffset&&i.index(){let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let a=r.before();if(S1(e.doc,a))return t&&t(e.tr.split(a).scrollIntoView()),!0}let n=r.blockRange(),i=n&&ox(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)};function tlt(e){return(t,r)=>{let{$from:n,$to:i}=t.selection;if(t.selection instanceof cn&&t.selection.node.isBlock)return!n.parentOffset||!S1(t.doc,n.pos)?!1:(r&&r(t.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let a=[],s,o,l=!1,u=!1;for(let p=n.depth;;p--)if(n.node(p).isBlock){l=n.end(p)==n.pos+(n.depth-p),u=n.start(p)==n.pos-(n.depth-p),o=CB(n.node(p-1).contentMatchAt(n.indexAfter(p-1)));let g=e&&e(i.parent,l,n);a.unshift(g||(l&&o?{type:o}:null)),s=p;break}else{if(p==1)return!1;a.unshift(null)}let h=t.tr;(t.selection instanceof Pr||t.selection instanceof Tc)&&h.deleteSelection();let f=h.mapping.map(n.pos),d=S1(h.doc,f,a.length,a);if(d||(a[0]=o?{type:o}:null,d=S1(h.doc,f,a.length,a)),!d)return!1;if(h.split(f,a.length,a),!l&&u&&n.node(s).type!=o){let p=h.mapping.map(n.before(s)),m=h.doc.resolve(p);o&&n.node(s-1).canReplaceWith(m.index(),m.index()+1,o)&&h.setNodeMarkup(h.mapping.map(n.before(s)),o)}return r&&r(h.scrollIntoView()),!0}}var rlt=tlt();var nlt=(e,t)=>(t&&t(e.tr.setSelection(new Tc(e.doc))),!0);function ilt(e,t,r){let n=t.nodeBefore,i=t.nodeAfter,a=t.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&t.parent.canReplace(a-1,a)?(r&&r(e.tr.delete(t.pos-n.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||E1(e.doc,t.pos))?!1:(r&&r(e.tr.join(t.pos).scrollIntoView()),!0)}function jce(e,t,r,n){let i=t.nodeBefore,a=t.nodeAfter,s,o,l=i.type.spec.isolating||a.type.spec.isolating;if(!l&&ilt(e,t,r))return!0;let u=!l&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(s=(o=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&o.matchType(s[0]||a.type).validEnd){if(r){let p=t.pos+a.nodeSize,m=Lt.empty;for(let v=s.length-1;v>=0;v--)m=Lt.from(s[v].create(null,m));m=Lt.from(i.copy(m));let g=e.tr.step(new Zs(t.pos-1,p,t.pos,p,new Xt(m,1,0),s.length,!0)),y=g.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&E1(g.doc,y.pos)&&g.join(y.pos),r(g.scrollIntoView())}return!0}let h=a.type.spec.isolating||n>0&&l?null:Vr.findFrom(t,1),f=h&&h.$from.blockRange(h.$to),d=f&&ox(f);if(d!=null&&d>=t.depth)return r&&r(e.tr.lift(f,d).scrollIntoView()),!0;if(u&&ux(a,"start",!0)&&ux(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=a,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(r){let v=Lt.empty;for(let w=m.length-1;w>=0;w--)v=Lt.from(m[w].copy(v));let x=e.tr.step(new Zs(t.pos-m.length,t.pos+a.nodeSize,t.pos+y,t.pos+a.nodeSize-y,new Xt(v,m.length,0),0,!0));r(x.scrollIntoView())}return!0}}return!1}function Kce(e){return function(t,r){let n=t.selection,i=e<0?n.$from:n.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(r&&r(t.tr.setSelection(Pr.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var alt=Kce(-1),slt=Kce(1);function HE(e,t=null){return function(r,n){let{$from:i,$to:a}=r.selection,s=i.blockRange(a),o=s&&C1(s,e,t);return o?(n&&n(r.tr.wrap(s,o).scrollIntoView()),!0):!1}}function hx(e,t=null){return function(r,n){let i=!1;for(let a=0;a{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(e,t)))if(l.type==e)i=!0;else{let h=r.doc.resolve(u),f=h.index();i=h.parent.canReplaceWith(f,f+1,e)}})}if(!i)return!1;if(n){let a=r.tr;for(let s=0;s{if(o||!n&&l.isAtom&&l.isInline&&u>=a.pos&&u+l.nodeSize<=s.pos)return!1;o=l.inlineContent&&l.type.allowsMarkType(r)}),o)return!0}return!1}function llt(e){let t=[];for(let r=0;r{if(a.isAtom&&a.content.size&&a.isInline&&s>=n.pos&&s+a.nodeSize<=i.pos)return s+1>n.pos&&t.push(new Np(n,n.doc.resolve(s+1))),n=n.doc.resolve(s+1+a.content.size),!1}),n.poss.doc.rangeHasMark(p.$from.pos,p.$to.pos,e)):f=!h.every(p=>{let m=!1;return d.doc.nodesBetween(p.$from.pos,p.$to.pos,(g,y,v)=>{if(m)return!1;m=!e.isInSet(g.marks)&&!!v&&v.type.allowsMarkType(e)&&!(g.isText&&/^\s*$/.test(g.textBetween(Math.max(0,p.$from.pos-y),Math.min(g.nodeSize,p.$to.pos-y))))}),!m});for(let p=0;p0&&(a=r[0].slice(s-o,s)+a,n=i)}return t.tr.insertText(a,n,i)}}var Jce=(e,t)=>{let r=e.plugins;for(let n=0;n=0;l--)s.step(o.steps[l].invert(o.docs[l]));if(a.text){let l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,e.schema.text(a.text,l))}else s.delete(a.from,a.to);t(s)}return!0}}return!1},n1r=new Pa(/--$/,"\u2014",{inCodeMark:!1}),i1r=new Pa(/\.\.\.$/,"\u2026",{inCodeMark:!1}),a1r=new Pa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C",{inCodeMark:!1}),s1r=new Pa(/"$/,"\u201D",{inCodeMark:!1}),o1r=new Pa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018",{inCodeMark:!1}),l1r=new Pa(/'$/,"\u2019",{inCodeMark:!1});function UE(e,t,r=null,n){return new Pa(e,(i,a,s,o)=>{let l=r instanceof Function?r(a):r,u=i.tr.delete(s,o),h=u.doc.resolve(s),f=h.blockRange(),d=f&&C1(f,t,l);if(!d)return null;u.wrap(f,d);let p=u.doc.resolve(s-1).nodeBefore;return p&&p.type==t&&E1(u.doc,s-1)&&(!n||n(a,p))&&u.join(s-1),u})}function SB(e,t,r=null){return new Pa(e,(n,i,a,s)=>{let o=n.doc.resolve(a),l=r instanceof Function?r(i):r;return o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t)?n.tr.delete(a,s).setBlockType(a,a,t,l):null})}var Dp=typeof navigator<"u"?navigator:null,eue=typeof document<"u"?document:null,Op=Dp&&Dp.userAgent||"",AB=/Edge\/(\d+)/.exec(Op),tue=/MSIE \d/.exec(Op),_B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Op),LB=!!(tue||_B||AB),f1r=tue?document.documentMode:_B?+_B[1]:AB?+AB[1]:0,hlt=!LB&&/gecko\/(\d+)/i.test(Op),d1r=hlt&&+(/Firefox\/(\d+)/.exec(Op)||[0,0])[1],RB=!LB&&/Chrome\/(\d+)/.exec(Op),flt=!!RB,p1r=RB?+RB[1]:0,dlt=!LB&&!!Dp&&/Apple Computer/.test(Dp.vendor),plt=dlt&&(/Mobile\/\w+/.test(Op)||!!Dp&&Dp.maxTouchPoints>2),m1r=plt||(Dp?/Mac/.test(Dp.platform):!1),mlt=/Android \d/.test(Op),glt=!!eue&&"webkitFontSmoothing"in eue.documentElement.style,g1r=glt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function EB(e,t,r,n,i,a){if(e.composing)return!1;let s=e.state,o=s.doc.resolve(t);if(o.parent.type.spec.code)return!1;let l=o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,void 0,"\uFFFC")+n;for(let u of i){let h=u,f=h.match.exec(l),d=f&&f[0]&&h.handler(s,f,t-(f[0].length-n.length),r);if(d)return h.undoable!==!1&&d.setMeta(a,{transform:d,from:t,to:r,text:n}),e.dispatch(d),!0}return!1}var ylt=new Hi("MILKDOWN_CUSTOM_INPUTRULES");function rue({rules:e}){let t=new Ci({key:ylt,isInputRules:!0,state:{init(){return null},apply(r,n){let i=r.getMeta(this);return i||(r.selectionSet||r.docChanged?null:n)}},props:{handleTextInput(r,n,i,a){return EB(r,n,i,a,e,t)},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{let{$cursor:n}=r.state.selection;n&&EB(r,n.pos,n.pos,"",e,t)}),!1),keydown:(r,n)=>!(mlt&&flt&&n.key==="Enter")||r.composing?!1:r.someProp("handleKeyDown",i=>i(r,n))?(n.preventDefault(),!0):!1},handleKeyDown(r,n){if(n.key!=="Enter")return!1;let{$cursor:i}=r.state.selection;return i?EB(r,i.pos,i.pos,` -`,e,t):!1}}});return t}function R1(e,t,r={}){return new Pa(e,(n,i,a,s)=>{var o,l,u,h;let{tr:f}=n,d=i.length,p=i[d-1],m=i[0],g=[],y,v={group:p,fullMatch:m,start:a,end:s},x=(o=r.updateCaptured)==null?void 0:o.call(r,v);if(Object.assign(v,x),{group:p,fullMatch:m,start:a,end:s}=v,m===null||p?.trim()==="")return null;if(p){let w=m.search(/\S/),C=a+m.indexOf(p),T=C+p.length;g=(l=f.storedMarks)!=null?l:[],Ta&&f.delete(a+w,C),y=a+w+p.length;let k=(u=r.getAttr)==null?void 0:u.call(r,i);f.addMark(a,y,t.create(k)),f.setStoredMarks(g),(h=r.beforeDispatch)==null||h.call(r,{match:i,start:a,end:s,tr:f})}return f})}function nue(e,t,r={}){return new Pa(e,(n,i,a,s)=>{var o,l,u;let{tr:h}=n,f=i[1],d=i[0],p={group:f,fullMatch:d,start:a,end:s},m=(o=r.updateCaptured)==null?void 0:o.call(r,p);if(Object.assign(p,m),{group:f,fullMatch:d,start:a,end:s}=p,d===null||!f||f.trim()==="")return null;let g=(l=r.getAttr)==null?void 0:l.call(r,i),y=t.createAndFill(g);return y&&(h.replaceRangeWith(t.isBlock?h.doc.resolve(a).before():a,s,y),(u=r.beforeDispatch)==null||u.call(r,{match:[d,f],start:a,end:s,tr:h})),h})}function IB(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function vlt(e,t){return Array.isArray(e)&&e.includes(t.type)||t.type===e}function iue(e){if(e.content.childCount===1){let t=e.content.firstChild;if(t?.type.name==="text"&&t.marks.length===0)return t;if(t?.type.name==="paragraph"&&t.childCount===1){let r=t.firstChild;if(r?.type.name==="text"&&r.marks.length===0)return r}}return!1}function xlt(e){return t=>{for(let r=t.depth;r>0;r-=1){let n=t.node(r);if(e(n)){let i=t.before(r),a=t.after(r);return{from:i,to:a,node:n}}}}}function aue(e,t){return xlt(r=>r.type===t)(e)}function sue(e){return t=>{for(let r=t.depth;r>0;r--){let n=t.node(r);if(e(n))return{pos:t.before(r),start:t.start(r),depth:r,node:n}}}}function oue(e,t){if(!(e instanceof cn))return;let{node:r,$from:n}=e;if(vlt(t,r))return{node:r,pos:n.pos,start:n.start(n.depth),depth:n.depth}}var lue=(e,t)=>{let{selection:r,doc:n}=e;if(r instanceof cn)return{hasNode:r.node.type===t,pos:r.from,target:r.node};let{from:i,to:a}=r,s=!1,o=-1,l=null;return n.nodesBetween(i,a,(u,h)=>l?!1:u.type===t?(s=!0,o=h,l=u,!1):!0),{hasNode:s,pos:o,target:l}};var Md={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},XE={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},blt=typeof navigator<"u"&&/Mac/.test(navigator.platform),wlt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ua=0;Ua<10;Ua++)Md[48+Ua]=Md[96+Ua]=String(Ua);var Ua;for(Ua=1;Ua<=24;Ua++)Md[Ua+111]="F"+Ua;var Ua;for(Ua=65;Ua<=90;Ua++)Md[Ua]=String.fromCharCode(Ua+32),XE[Ua]=String.fromCharCode(Ua);var Ua;for(YE in Md)XE.hasOwnProperty(YE)||(XE[YE]=Md[YE]);var YE;function cue(e){var t=blt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||wlt&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",r=!t&&e.key||(e.shiftKey?XE:Md)[e.keyCode]||e.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}var klt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Tlt=typeof navigator<"u"&&/Win/.test(navigator.platform);function Clt(e){let t=e.split(/-(?!$)/),r=t[t.length-1];r=="Space"&&(r=" ");let n,i,a,s;for(let o=0;othis.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw dP();return e}}},Elt=class pue extends fue{constructor(t,r,n){super(),this.type=t,this.content=r,this.attrs=n}push(t,...r){this.content.push(t,...r)}pop(){return this.content.pop()}static create(t,r,n){return new pue(t,r,n)}},mue=class extends due{#t;static{this.create=(e,t)=>{let r=new this(e);return n=>(r.run(t,n),r.toDoc())}}constructor(e){super(),this.#t=In.none,this.#e=t=>t.isText,this.#n=(t,r)=>{if(this.#e(t)&&this.#e(r)&&In.sameSet(t.marks,r.marks))return this.schema.text(t.text+r.text,t.marks)},this.#r=t=>{let r=Object.values({...this.schema.nodes,...this.schema.marks}).find(n=>n.spec.parseMarkdown.match(t));if(!r)throw Coe(t);return r},this.#s=t=>{let r=this.#r(t);r.spec.parseMarkdown.runner(this,t,r)},this.injectRoot=(t,r,n)=>(this.openNode(r,n),this.next(t.children),this),this.openNode=(t,r)=>(this.open(Elt.create(t,[],r)),this),this.#a=()=>{this.#t=In.none;let t=this.close();return this.#i(t.type,t.attrs,t.content)},this.closeNode=()=>{try{this.#a()}catch(t){console.error(t)}return this},this.#i=(t,r,n)=>{let i=t.createAndFill(r,n,this.#t);if(!i)throw Toe(t,r,n);return this.push(i),i},this.addNode=(t,r,n)=>{try{this.#i(t,r,n)}catch(i){console.error(i)}return this},this.openMark=(t,r)=>{let n=t.create(r);return this.#t=n.addToSet(this.#t),this},this.closeMark=t=>(this.#t=t.removeFromSet(this.#t),this),this.addText=t=>{try{let r=this.top();if(!r)throw dP();let n=r.pop(),i=this.schema.text(t,this.#t);if(!n)return r.push(i),this;let a=this.#n(n,i);return a?(r.push(a),this):(r.push(n,i),this)}catch(r){return console.error(r),this}},this.build=()=>{let t;do t=this.#a();while(this.size());return t},this.next=(t=[])=>([t].flat().forEach(r=>this.#s(r)),this),this.toDoc=()=>this.build(),this.run=(t,r)=>{let n=t.runSync(t.parse(r),r);return this.next(n),this},this.schema=e}#e;#n;#r;#s;#a;#i},hue=class gue extends fue{constructor(t,r,n,i={}){super(),this.type=t,this.children=r,this.value=n,this.props=i,this.push=(a,...s)=>{this.children||(this.children=[]),this.children.push(a,...s)},this.pop=()=>this.children?.pop()}static{this.create=(t,r,n,i={})=>new gue(t,r,n,i)}},Alt=e=>Object.prototype.hasOwnProperty.call(e,"size"),yue=class extends due{#t;static{this.create=(e,t)=>{let r=new this(e);return n=>(r.run(n),r.toString(t))}}constructor(e){super(),this.#t=In.none,this.#e=t=>{let r=Object.values({...this.schema.nodes,...this.schema.marks}).find(n=>n.spec.toMarkdown.match(t));if(!r)throw Soe(t.type);return r},this.#n=t=>this.#e(t).spec.toMarkdown.runner(this,t),this.#r=(t,r)=>this.#e(t).spec.toMarkdown.runner(this,t,r),this.#s=t=>{let{marks:r}=t,n=i=>i.type.spec.priority??50;[...r].sort((i,a)=>n(i)-n(a)).every(i=>!this.#r(i,t))&&this.#n(t),r.forEach(i=>this.#f(i))},this.#a=(t,r)=>{if(t.type===r||t.children?.length!==1)return t;let n=o=>{if(o.type===r)return o.value!=null?null:o;if(o.children?.length!==1)return null;let[l]=o.children;return l?n(l):null},i=n(t);if(!i)return t;let a=i.children?[...i.children]:void 0,s={...t,children:a};return s.children=a,i.children=[s],i},this.#i=t=>{let{children:r}=t;return r&&(t.children=r.reduce((n,i,a)=>{if(a===0)return[i];let s=n.at(-1);if(s&&s.isMark&&i.isMark){i=this.#a(i,s.type);let{children:o,...l}=i,{children:u,...h}=s;if(i.type===s.type&&o&&u&&JSON.stringify(l)===JSON.stringify(h)){let f={...h,children:[...u,...o]};return n.slice(0,-1).concat(this.#i(f))}}return n.concat(i)},[])),t},this.#o=t=>{let r={...t.props,type:t.type};return t.children&&(r.children=t.children),t.value&&(r.value=t.value),r},this.openNode=(t,r,n)=>(this.open(hue.create(t,void 0,r,n)),this),this.#l=(t,r)=>{let n="",i="",a=t.children,s=-1,o=-1,l=h=>{h&&h.forEach((f,d)=>{f.type==="text"&&f.value&&(s<0&&(s=d),o=d)})};if(a){l(a);let h=a?.[o],f=a?.[s];if(h&&h.value.endsWith(" ")){let d=h.value,p=d.trimEnd();i=d.slice(p.length),h.value=p}if(f&&f.value.startsWith(" ")){let d=f.value,p=d.trimStart();n=d.slice(0,d.length-p.length),f.value=p}}n.length&&this.#c("text",void 0,n);let u=r();return i.length&&this.#c("text",void 0,i),u},this.#u=(t=!1)=>{let r=this.close(),n=()=>this.#c(r.type,r.children,r.value,r.props);return t?this.#l(r,n):n()},this.closeNode=()=>(this.#u(),this),this.#c=(t,r,n,i)=>{let a=hue.create(t,r,n,i),s=this.#i(this.#o(a));return this.push(s),s},this.addNode=(t,r,n,i)=>(this.#c(t,r,n,i),this),this.#h=(t,r,n,i)=>t.isInSet(this.#t)?this:(this.#t=t.addToSet(this.#t),this.openNode(r,n,{...i,isMark:!0})),this.#f=t=>{t.isInSet(this.#t)&&(this.#t=t.type.removeFromSet(this.#t),this.#u(!0))},this.withMark=(t,r,n,i)=>(this.#h(t,r,n,i),this),this.closeMark=t=>(this.#f(t),this),this.build=()=>{let t=null;do t=this.#u();while(this.size());return t},this.next=t=>Alt(t)?(t.forEach(r=>{this.#s(r)}),this):(this.#s(t),this),this.toString=t=>t.stringify(this.build()),this.run=t=>(this.next(t),this),this.schema=e}#e;#n;#r;#s;#a;#i;#o;#l;#u;#c;#h;#f};var Qs=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},gx=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},$B=null,Dd=function(e,t,r){let n=$B||($B=document.createRange());return n.setEnd(e,r??e.nodeValue.length),n.setStart(e,t||0),n},_lt=function(){$B=null},B1=function(e,t,r,n){return r&&(vue(e,t,r,n,-1)||vue(e,t,r,n,1))},Rlt=/^(img|br|input|textarea|hr)$/i;function vue(e,t,r,n,i){for(var a;;){if(e==r&&t==n)return!0;if(t==(i<0?0:lu(e))){let s=e.parentNode;if(!s||s.nodeType!=1||sT(e)||Rlt.test(e.nodeName)||e.contentEditable=="false")return!1;t=Qs(e)+(i<0?0:1),e=s}else if(e.nodeType==1){let s=e.childNodes[t+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((a=s.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)t+=i;else return!1;else e=s,t=i<0?lu(e):0}else return!1}}function lu(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Llt(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=lu(e)}else if(e.parentNode&&!sT(e))t=Qs(e),e=e.parentNode;else return null}}function Ilt(e,t){for(;;){if(e.nodeType==3&&t2),ou=yx||(Xh?/Mac/.test(Xh.platform):!1),Zue=Xh?/Win/.test(Xh.platform):!1,Od=/Android \d/.test(zp),oT=!!xue&&"webkitFontSmoothing"in xue.documentElement.style,Olt=oT?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Plt(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Nd(e,t){return typeof e=="number"?e:e[t]}function Blt(e){let t=e.getBoundingClientRect(),r=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*r,top:t.top,bottom:t.top+e.clientHeight*n}}function bue(e,t,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,a=e.dom.ownerDocument;for(let s=r||e.dom;s;){if(s.nodeType!=1){s=gx(s);continue}let o=s,l=o==a.body,u=l?Plt(a):Blt(o),h=0,f=0;if(t.topu.bottom-Nd(n,"bottom")&&(f=t.bottom-t.top>u.bottom-u.top?t.top+Nd(i,"top")-u.top:t.bottom-u.bottom+Nd(i,"bottom")),t.leftu.right-Nd(n,"right")&&(h=t.right-u.right+Nd(i,"right")),h||f)if(l)a.defaultView.scrollBy(h,f);else{let p=o.scrollLeft,m=o.scrollTop;f&&(o.scrollTop+=f),h&&(o.scrollLeft+=h);let g=o.scrollLeft-p,y=o.scrollTop-m;t={left:t.left-g,top:t.top-y,right:t.right-g,bottom:t.bottom-y}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:gx(s)}}function Flt(e){let t=e.dom.getBoundingClientRect(),r=Math.max(0,t.top),n,i;for(let a=(t.left+t.right)/2,s=r+1;s=r-20){n=o,i=l.top;break}}return{refDOM:n,refTop:i,stack:Que(e.dom)}}function Que(e){let t=[],r=e.ownerDocument;for(let n=e;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=gx(n));return t}function $lt({refDOM:e,refTop:t,stack:r}){let n=e?e.getBoundingClientRect().top:0;Jue(r,n==0?0:n-t)}function Jue(e,t){for(let r=0;r=o){s=Math.max(m.bottom,s),o=Math.min(m.top,o);let g=m.left>t.left?m.left-t.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=h,u={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!r&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(a=f+1)}}return!r&&l&&(r=l,i=u,n=0),r&&r.nodeType==3?Glt(r,i):!r||n&&r.nodeType==1?{node:e,offset:a}:ehe(r,i)}function Glt(e,t){let r=e.nodeValue.length,n=document.createRange(),i;for(let a=0;a=(s.left+s.right)/2?1:0)};break}}return n.detach(),i||{node:e,offset:0}}function iF(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function qlt(e,t){let r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&t.left(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(n,i,a)}function Wlt(e,t,r,n){let i=-1;for(let a=t,s=!1;a!=e.dom;){let o=e.docView.nearestDesc(a,!0),l;if(!o)return null;if(o.dom.nodeType==1&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((l=o.dom.getBoundingClientRect()).width||l.height)&&(o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(!s&&l.left>n.left||l.top>n.top?i=o.posBefore:(!s&&l.right-1?i:e.docView.posFromDOM(t,r,-1)}function the(e,t,r){let n=e.childNodes.length;if(n&&r.topt.top&&i++}let u;oT&&i&&n.nodeType==1&&(u=n.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&t.top>n.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(o=Wlt(e,n,i,t))}o==null&&(o=Vlt(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function wue(e){return e.top=0&&i==n.nodeValue.length?(l--,h=1):r<0?l--:u++,Jk(Pp(Dd(n,l,u),h),h<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(r<0||i==lu(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return DB(l.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(r<0||i==lu(n))){let l=n.childNodes[i-1],u=l.nodeType==3?Dd(l,lu(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return Jk(Pp(u,1),!1)}if(a==null&&i=0)}function Jk(e,t){if(e.width==0)return e;let r=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function DB(e,t){if(e.height==0)return e;let r=t?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function nhe(e,t,r){let n=e.state,i=e.root.activeElement;n!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return r()}finally{n!=t&&e.updateState(n),i!=e.dom&&i&&i.focus()}}function Ylt(e,t,r){let n=t.selection,i=r=="up"?n.$from:n.$to;return nhe(e,t,()=>{let{node:a}=e.docView.domFromPos(i.pos,r=="up"?-1:1);for(;;){let o=e.docView.nearestDesc(a,!0);if(!o)break;if(o.node.isBlock){a=o.contentDOM||o.dom;break}a=o.dom.parentNode}let s=rhe(e,i.pos,1);for(let o=a.firstChild;o;o=o.nextSibling){let l;if(o.nodeType==1)l=o.getClientRects();else if(o.nodeType==3)l=Dd(o,0,o.nodeValue.length).getClientRects();else continue;for(let u=0;uh.top+1&&(r=="up"?s.top-h.top>(h.bottom-s.top)*2:h.bottom-s.bottom>(s.bottom-h.top)*2))return!1}}return!0})}var Xlt=/[\u0590-\u08ac]/;function jlt(e,t,r){let{$head:n}=t.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,a=!i,s=i==n.parent.content.size,o=e.domSelection();return o?!Xlt.test(n.parent.textContent)||!o.modify?r=="left"||r=="backward"?a:s:nhe(e,t,()=>{let{focusNode:l,focusOffset:u,anchorNode:h,anchorOffset:f}=e.domSelectionRange(),d=o.caretBidiLevel;o.modify("move",r,"character");let p=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:m,focusOffset:g}=e.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==g;try{o.collapse(h,f),l&&(l!=h||u!=f)&&o.extend&&o.extend(l,u)}catch{}return d!=null&&(o.caretBidiLevel=d),y}):n.pos==n.start()||n.pos==n.end()}var kue=null,Tue=null,Cue=!1;function Klt(e,t,r){return kue==t&&Tue==r?Cue:(kue=t,Tue=r,Cue=r=="up"||r=="down"?Ylt(e,t,r):jlt(e,t,r))}var uu=0,Sue=1,I1=2,Ju=3,F1=class{constructor(t,r,n,i){this.parent=t,this.children=r,this.dom=n,this.contentDOM=i,this.dirty=uu,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,r,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let r=0;rQs(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(r==0)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&r==t.childNodes.length)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(t,r=!1){for(let n=!0,i=t;i;i=i.parentNode){let a=this.getDesc(i),s;if(a&&(!r||a.node))if(n&&(s=a.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))n=!1;else return a}}getDesc(t){let r=t.pmViewDesc;for(let n=r;n;n=n.parent)if(n==this)return r}posFromDOM(t,r,n){for(let i=t;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(t,r,n)}return-1}descAt(t){for(let r=0,n=0;rt||s instanceof ZE){i=t-a;break}a=o}if(i)return this.children[n].domFromPos(i-this.children[n].border,r);for(let a;n&&!(a=this.children[n-1]).size&&a instanceof jE&&a.side>=0;n--);if(r<=0){let a,s=!0;for(;a=n?this.children[n-1]:null,!(!a||a.dom.parentNode==this.contentDOM);n--,s=!1);return a&&r&&s&&!a.border&&!a.domAtom?a.domFromPos(a.size,r):{node:this.contentDOM,offset:a?Qs(a.dom)+1:0}}else{let a,s=!0;for(;a=n=h&&r<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,r,h);t=s;for(let f=o;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=Qs(d.dom)+1;break}t-=d.size}i==-1&&(i=0)}if(i>-1&&(u>r||o==this.children.length-1)){r=u;for(let h=o+1;hm&&sr){let m=o;o=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(o.node,o.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,r){for(let n=0,i=0;i=n:tn){let o=n+a.border,l=s-a.border;if(t>=o&&r<=l){this.dirty=t==n||r==s?I1:Sue,t==o&&r==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Ju:a.markDirty(t-o,r-o);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?I1:Ju}n=s}this.dirty=I1}markParentsDirty(){let t=1;for(let r=this.parent;r;r=r.parent,t++){let n=t==1?I1:Sue;r.dirty{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!r.type.spec.raw){if(s.nodeType!=1){let o=document.createElement("span");o.appendChild(s),s=o}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=r,this.widget=r,a=this}matchesWidget(t){return this.dirty==uu&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let r=this.widget.spec.stopEvent;return r?r(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},VB=class extends F1{constructor(t,r,n,i){super(t,[],r,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(t,r){return t!=this.textDOM?this.posAtStart+(r?this.size:0):this.posAtStart+r}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}},N1=class e extends F1{constructor(t,r,n,i,a){super(t,[],n,i),this.mark=r,this.spec=a}static create(t,r,n,i){let a=i.nodeViews[r.type.name],s=a&&a(r,i,n);return(!s||!s.dom)&&(s=Yh.renderSpec(document,r.type.spec.toDOM(r,n),null,r.attrs)),new e(t,r,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Ju||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Ju&&this.mark.eq(t)}markDirty(t,r){if(super.markDirty(t,r),this.dirty!=uu){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty0&&(a=YB(a,0,t,n));for(let o=0;o{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},n,i),h=u&&u.dom,f=u&&u.contentDOM;if(r.isText){if(!h)h=document.createTextNode(r.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:f}=Yh.renderSpec(document,r.type.spec.toDOM(r),null,r.attrs));!f&&!r.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),r.type.spec.draggable&&(h.draggable=!0));let d=h;return h=she(h,n,r),u?l=new WB(t,r,n,i,h,f||null,d,u):r.isText?new KE(t,r,n,i,h,d):new e(t,r,n,i,h,f||null,d)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let n=this.children[r];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>Lt.empty)}return t}matchesNode(t,r,n){return this.dirty==uu&&t.eq(this.node)&&QE(r,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,r){let n=this.node.inlineContent,i=r,a=t.composing?this.localCompositionInfo(t,r):null,s=a&&a.pos>-1?a:null,o=a&&a.pos<0,l=new UB(this,s&&s.node,t);ect(this.node,this.innerDeco,(u,h,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,n,t,h):u.type.side>=0&&!f&&l.syncToMarks(h==this.node.childCount?In.none:this.node.child(h).marks,n,t,h),l.placeWidget(u,t,i)},(u,h,f,d)=>{l.syncToMarks(u.marks,n,t,d);let p;l.findNodeMatch(u,h,f,d)||o&&t.state.selection.from>i&&t.state.selection.to-1&&l.updateNodeAt(u,h,f,p,t)||l.updateNextNode(u,h,f,t,d,i)||l.addNode(u,h,f,t,i),i+=u.nodeSize}),l.syncToMarks([],n,t,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==I1)&&(s&&this.protectLocalComposition(t,s),ihe(this.contentDOM,this.children,t),yx&&tct(this.dom))}localCompositionInfo(t,r){let{from:n,to:i}=t.state.selection;if(!(t.state.selection instanceof Pr)||nr+this.node.content.size)return null;let a=t.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let s=a.nodeValue,o=rct(this.node.content,s,n-r,i-r);return o<0?null:{node:a,pos:o,text:s}}else return{node:a,pos:-1,text:""}}protectLocalComposition(t,{node:r,pos:n,text:i}){if(this.getDesc(r))return;let a=r;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let s=new VB(this,a,r,i);t.input.compositionNodes.push(s),this.children=YB(this.children,n,n+i.length,t,s)}update(t,r,n,i){return this.dirty==Ju||!t.sameMarkup(this.node)?!1:(this.updateInner(t,r,n,i),!0)}updateInner(t,r,n,i){this.updateOuterDeco(r),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=uu}updateOuterDeco(t){if(QE(t,this.outerDeco))return;let r=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=ahe(this.dom,this.nodeDOM,HB(this.outerDeco,this.node,r),HB(t,this.node,r)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function Eue(e,t,r,n,i){she(n,t,e);let a=new $p(void 0,e,t,r,n,n,n);return a.contentDOM&&a.updateChildren(i,0),a}var KE=class e extends $p{constructor(t,r,n,i,a,s){super(t,r,n,i,a,null,s)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,r,n,i){return this.dirty==Ju||this.dirty!=uu&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(r),(this.dirty!=uu||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=uu,!0)}inParent(){let t=this.parent.contentDOM;for(let r=this.nodeDOM;r;r=r.parentNode)if(r==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,r,n){return t==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):super.localPosFromDOM(t,r,n)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,r,n){let i=this.node.cut(t,r),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(t,r){super.markDirty(t,r),this.dom!=this.nodeDOM&&(t==0||r==this.nodeDOM.nodeValue.length)&&(this.dirty=Ju)}get domAtom(){return!1}isText(t){return this.node.text==t}},ZE=class extends F1{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==uu&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},WB=class extends $p{constructor(t,r,n,i,a,s,o,l){super(t,r,n,i,a,s,o),this.spec=l}update(t,r,n,i){if(this.dirty==Ju)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let a=this.spec.update(t,r,n);return a&&this.updateInner(t,r,n,i),a}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,r,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,r,n,i){this.spec.setSelection?this.spec.setSelection(t,r,n.root):super.setSelection(t,r,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}};function ihe(e,t,r){let n=e.firstChild,i=!1;for(let a=0;a>1,o=Math.min(s,t.length);for(;a-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let h=N1.create(this.top,t[s],r,n);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,s++}}findNodeMatch(t,r,n,i){let a=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(t,r,n))a=this.top.children.indexOf(s,this.index);else for(let o=this.index,l=Math.min(this.top.children.length,o+5);o0;){let o;for(;;)if(n){let u=r.children[n-1];if(u instanceof N1)r=u,n=u.children.length;else{o=u,n--;break}}else{if(r==t)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=o.node;if(l){if(l!=e.child(i-1))break;--i,a.set(o,i),s.push(o)}}return{index:i,matched:a,matches:s.reverse()}}function Jlt(e,t){return e.type.side-t.type.side}function ect(e,t,r,n){let i=t.locals(e),a=0;if(i.length==0){for(let u=0;ua;)o.push(i[s++]);let m=a+d.nodeSize;if(d.isText){let y=m;s!y.inline):o.slice();n(d,g,t.forChild(a,d),p),a=m}}function tct(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function rct(e,t,r,n){for(let i=0,a=0;i=r){if(a>=n&&l.slice(n-t.length-o,n-o)==t)return n-t.length;let u=o=0&&u+t.length+o>=r)return o+u;if(r==n&&l.length>=n+t.length-o&&l.slice(n-o,n-o+t.length)==t)return n}}return-1}function YB(e,t,r,n,i){let a=[];for(let s=0,o=0;s=r||h<=t?a.push(l):(ur&&a.push(l.slice(r-u,l.size,n)))}return a}function aF(e,t=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),a=i&&i.size==0,s=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(s<0)return null;let o=n.resolve(s),l,u;if(s7(r)){for(l=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&cn.isSelectable(f)&&i.parent&&!(f.isInline&&Mlt(r.focusNode,r.focusOffset,i.dom))){let d=i.posBefore;u=new cn(s==d?o:n.resolve(d))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let f=s,d=s;for(let p=0;p{(r.anchorNode!=n||r.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!ohe(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function ict(e){let t=e.domSelection();if(!t)return;let r=e.cursorWrapper.dom,n=r.nodeName=="IMG";n?t.collapse(r.parentNode,Qs(r)+1):t.collapse(r,0),!n&&!e.state.selection.visible&&$l&&Fp<=11&&(r.disabled=!0,r.disabled=!1)}function lhe(e,t){if(t instanceof cn){let r=e.docView.descAt(t.from);r!=e.lastSelectedViewDesc&&(Iue(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else Iue(e)}function Iue(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function sF(e,t,r,n){return e.someProp("createSelectionBetween",i=>i(e,t,r))||Pr.between(t,r,n)}function Mue(e){return e.editable&&!e.hasFocus()?!1:che(e)}function che(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function act(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),r=e.domSelectionRange();return B1(t.node,t.offset,r.anchorNode,r.anchorOffset)}function XB(e,t){let{$anchor:r,$head:n}=e.selection,i=t>0?r.max(n):r.min(n),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&Vr.findFrom(a,t)}function Bp(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Nue(e,t,r){let n=e.state.selection;if(n instanceof Pr)if(r.indexOf("s")>-1){let{$head:i}=n,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let s=e.state.doc.resolve(i.pos+a.nodeSize*(t<0?-1:1));return Bp(e,new Pr(n.$anchor,s))}else if(n.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=XB(e.state,t);return i&&i instanceof cn?Bp(e,i):!1}else if(!(ou&&r.indexOf("m")>-1)){let i=n.$head,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,s;if(!a||a.isText)return!1;let o=t<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(s=e.docView.descAt(o))&&!s.contentDOM?cn.isSelectable(a)?Bp(e,new cn(t<0?e.state.doc.resolve(i.pos-a.nodeSize):i)):oT?Bp(e,new Pr(e.state.doc.resolve(t<0?o:o+a.nodeSize))):!1:!1}}else return!1;else{if(n instanceof cn&&n.node.isInline)return Bp(e,new Pr(t>0?n.$to:n.$from));{let i=XB(e.state,t);return i?Bp(e,i):!1}}}function JE(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function tT(e,t){let r=e.pmViewDesc;return r&&r.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function px(e,t){return t<0?sct(e):oct(e)}function sct(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i,a,s=!1;for(cu&&r.nodeType==1&&n0){if(r.nodeType!=1)break;{let o=r.childNodes[n-1];if(tT(o,-1))i=r,a=--n;else if(o.nodeType==3)r=o,n=r.nodeValue.length;else break}}else{if(uhe(r))break;{let o=r.previousSibling;for(;o&&tT(o,-1);)i=r.parentNode,a=Qs(o),o=o.previousSibling;if(o)r=o,n=JE(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}}s?jB(e,r,n):i&&jB(e,i,a)}function oct(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i=JE(r),a,s;for(;;)if(n{e.state==i&&Bd(e)},50)}function Due(e,t){let r=e.state.doc.resolve(t);if(!(Ms||Zue)&&r.parent.inlineContent){let i=e.coordsAtPos(t);if(t>r.start()){let a=e.coordsAtPos(t-1),s=(a.top+a.bottom)/2;if(s>i.top&&s1)return a.lefti.top&&s1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function Oue(e,t,r){let n=e.state.selection;if(n instanceof Pr&&!n.empty||r.indexOf("s")>-1||ou&&r.indexOf("m")>-1)return!1;let{$from:i,$to:a}=n;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=XB(e.state,t);if(s&&s instanceof cn)return Bp(e,s)}if(!i.parent.inlineContent){let s=t<0?i:a,o=n instanceof Tc?Vr.near(s,t):Vr.findFrom(s,t);return o?Bp(e,o):!1}return!1}function Pue(e,t){if(!(e.state.selection instanceof Pr))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){let s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function Bue(e,t,r){e.domObserver.stop(),t.contentEditable=r,e.domObserver.start()}function uct(e){if(!Do||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(t&&t.nodeType==1&&r==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let n=t.firstChild;Bue(e,n,"true"),setTimeout(()=>Bue(e,n,"false"),20)}return!1}function hct(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function fct(e,t){let r=t.keyCode,n=hct(t);if(r==8||ou&&r==72&&n=="c")return Pue(e,-1)||px(e,-1);if(r==46&&!t.shiftKey||ou&&r==68&&n=="c")return Pue(e,1)||px(e,1);if(r==13||r==27)return!0;if(r==37||ou&&r==66&&n=="c"){let i=r==37?Due(e,e.state.selection.from)=="ltr"?-1:1:-1;return Nue(e,i,n)||px(e,i)}else if(r==39||ou&&r==70&&n=="c"){let i=r==39?Due(e,e.state.selection.from)=="ltr"?1:-1:1;return Nue(e,i,n)||px(e,i)}else{if(r==38||ou&&r==80&&n=="c")return Oue(e,-1,n)||px(e,-1);if(r==40||ou&&r==78&&n=="c")return uct(e)||Oue(e,1,n)||px(e,1);if(n==(ou?"m":"c")&&(r==66||r==73||r==89||r==90))return!0}return!1}function oF(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let r=[],{content:n,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,a--;let p=n.firstChild;r.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),n=p.content}let s=e.someProp("clipboardSerializer")||Yh.fromSchema(e.state.schema),o=ghe(),l=o.createElement("div");l.appendChild(s.serializeFragment(n,{document:o}));let u=l.firstChild,h,f=0;for(;u&&u.nodeType==1&&(h=mhe[u.nodeName.toLowerCase()]);){for(let p=h.length-1;p>=0;p--){let m=o.createElement(h[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${a}${f?` -${f}`:""} ${JSON.stringify(r)}`);let d=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,` - -`);return{dom:l,text:d,slice:t}}function hhe(e,t,r,n,i){let a=i.parent.type.spec.code,s,o;if(!r&&!t)return null;let l=!!t&&(n||a||!r);if(l){if(e.someProp("transformPastedText",d=>{t=d(t,a||n,e)}),a)return o=new Xt(Lt.from(e.state.schema.text(t.replace(/\r\n?/g,` -`))),0,0),e.someProp("transformPasted",d=>{o=d(o,e,!0)}),o;let f=e.someProp("clipboardTextParser",d=>d(t,i,n,e));if(f)o=f;else{let d=i.marks(),{schema:p}=e.state,m=Yh.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,d)))})}}else e.someProp("transformPastedHTML",f=>{r=f(r,e)}),s=gct(r),oT&&yct(s);let u=s&&s.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let f=+h[3];f>0;f--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(o||(o=(e.someProp("clipboardParser")||e.someProp("domParser")||Uh.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||h),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!dct.test(d.parentNode.nodeName)?{ignore:!0}:null}})),h)o=vct(Fue(o,+h[1],+h[2]),h[4]);else if(o=Xt.maxOpen(pct(o.content,i),!0),o.openStart||o.openEnd){let f=0,d=0;for(let p=o.content.firstChild;f{o=f(o,e,l)}),o}var dct=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function pct(e,t){if(e.childCount<2)return e;for(let r=t.depth;r>=0;r--){let i=t.node(r).contentMatchAt(t.index(r)),a,s=[];if(e.forEach(o=>{if(!s)return;let l=i.findWrapping(o.type),u;if(!l)return s=null;if(u=s.length&&a.length&&dhe(l,a,o,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=phe(s[s.length-1],a.length));let h=fhe(o,l);s.push(h),i=i.matchType(h.type),a=l}}),s)return Lt.from(s)}return e}function fhe(e,t,r=0){for(let n=t.length-1;n>=r;n--)e=t[n].create(null,Lt.from(e));return e}function dhe(e,t,r,n,i){if(i1&&(a=0),i=r&&(o=t<0?s.contentMatchAt(0).fillBefore(o,a<=i).append(o):o.append(s.contentMatchAt(s.childCount).fillBefore(Lt.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(o))}function Fue(e,t,r){return tr})),PB.createHTML(e)):e}function gct(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let r=ghe(),n=r.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&mhe[i[1].toLowerCase()])&&(e=a.map(s=>"<"+s+">").join("")+e+a.map(s=>"").reverse().join("")),n.innerHTML=mct(e),a)for(let s=0;s=0;o-=2){let l=r.nodes[n[o]];if(!l||l.hasRequiredAttrs())break;i=Lt.from(l.create(n[o+1],i)),a++,s++}return new Xt(i,a,s)}var el={},tl={},xct={touchstart:!0,touchmove:!0},ZB=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function bct(e){for(let t in el){let r=el[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=n=>{kct(e,n)&&!lF(e,n)&&(e.editable||!(n.type in tl))&&r(e,n)},xct[t]?{passive:!0}:void 0)}Do&&e.dom.addEventListener("input",()=>null),QB(e)}function Pd(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function wct(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function QB(e){e.someProp("handleDOMEvents",t=>{for(let r in t)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=n=>lF(e,n))})}function lF(e,t){return e.someProp("handleDOMEvents",r=>{let n=r[t.type];return n?n(e,t)||t.defaultPrevented:!1})}function kct(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let r=t.target;r!=e.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(t))return!1;return!0}function Tct(e,t){!lF(e,t)&&el[t.type]&&(e.editable||!(t.type in tl))&&el[t.type](e,t)}tl.keydown=(e,t)=>{let r=t;if(e.input.shiftKey=r.keyCode==16||r.shiftKey,!xhe(e)&&(e.input.lastKeyCode=r.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Od&&Ms&&r.keyCode==13)))if(r.keyCode!=229&&e.domObserver.forceFlush(),yx&&r.keyCode==13&&!r.ctrlKey&&!r.altKey&&!r.metaKey){let n=Date.now();e.input.lastIOSEnter=n,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==n&&(e.someProp("handleKeyDown",i=>i(e,L1(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",n=>n(e,r))||fct(e,r)?r.preventDefault():Pd(e,"key")};tl.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};tl.keypress=(e,t)=>{let r=t;if(xhe(e)||!r.charCode||r.ctrlKey&&!r.altKey||ou&&r.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,r))){r.preventDefault();return}let n=e.state.selection;if(!(n instanceof Pr)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(r.charCode),a=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",s=>s(e,n.$from.pos,n.$to.pos,i,a))&&e.dispatch(a()),r.preventDefault()}};function lT(e){return{left:e.clientX,top:e.clientY}}function Cct(e,t){let r=t.x-e.clientX,n=t.y-e.clientY;return r*r+n*n<100}function cF(e,t,r,n,i){if(n==-1)return!1;let a=e.state.doc.resolve(n);for(let s=a.depth+1;s>0;s--)if(e.someProp(t,o=>s>a.depth?o(e,r,a.nodeAfter,a.before(s),i,!0):o(e,r,a.node(s),a.before(s),i,!1)))return!0;return!1}function cT(e,t,r){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);r=="pointer"&&n.setMeta("pointer",!0),e.dispatch(n)}function Sct(e,t){if(t==-1)return!1;let r=e.state.doc.resolve(t),n=r.nodeAfter;return n&&n.isAtom&&cn.isSelectable(n)?(cT(e,new cn(r),"pointer"),!0):!1}function Ect(e,t){if(t==-1)return!1;let r=e.state.selection,n,i;r instanceof cn&&(n=r.node);let a=e.state.doc.resolve(t);for(let s=a.depth+1;s>0;s--){let o=s>a.depth?a.nodeAfter:a.node(s);if(cn.isSelectable(o)){n&&r.$from.depth>0&&s>=r.$from.depth&&a.before(r.$from.depth+1)==r.$from.pos?i=a.before(r.$from.depth):i=a.before(s);break}}return i!=null?(cT(e,cn.create(e.state.doc,i),"pointer"),!0):!1}function Act(e,t,r,n,i){return cF(e,"handleClickOn",t,r,n)||e.someProp("handleClick",a=>a(e,t,n))||(i?Ect(e,r):Sct(e,r))}function _ct(e,t,r,n){return cF(e,"handleDoubleClickOn",t,r,n)||e.someProp("handleDoubleClick",i=>i(e,t,n))}function Rct(e,t,r,n){return cF(e,"handleTripleClickOn",t,r,n)||e.someProp("handleTripleClick",i=>i(e,t,n))||Lct(e,r,n)}function Lct(e,t,r){if(r.button!=0)return!1;let n=yhe(e,t,!0),i=e.state.doc;return n?(cT(e,n,"pointer"),n instanceof Pr&&i.eq(e.state.doc)&&(e.input.mouseDown=new eF(e,n)),!0):!1}function yhe(e,t,r){let n=e.state.doc;if(t==-1)return n.inlineContent?Pr.create(n,0,n.content.size):null;let i=n.resolve(t);for(let a=i.depth+1;a>0;a--){let s=a>i.depth?i.nodeAfter:i.node(a),o=i.before(a);if(s.inlineContent)return Pr.create(n,o+1,o+1+s.content.size);if(r&&cn.isSelectable(s))return cn.create(n,o)}return null}function uF(e){return t7(e)}var vhe=ou?"metaKey":"ctrlKey";el.mousedown=(e,t)=>{let r=t;e.input.shiftKey=r.shiftKey;let n=uF(e),i=Date.now(),a="singleClick";i-e.input.lastClick.time<500&&Cct(r,e.input.lastClick)&&!r[vhe]&&e.input.lastClick.button==r.button&&(e.input.lastClick.type=="singleClick"?a="doubleClick":e.input.lastClick.type=="doubleClick"&&(a="tripleClick")),e.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:a,button:r.button},e.input.mouseDown&&e.input.mouseDown.done();let s=e.posAtCoords(lT(r));s&&(a=="singleClick"?e.input.mouseDown=new JB(e,s,r,!!n):(a=="doubleClick"?_ct:Rct)(e,s.pos,s.inside,r)?r.preventDefault():Pd(e,"pointer"))};var e7=class{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},JB=class extends e7{constructor(t,r,n,i){super(t),this.pos=r,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!n[vhe],this.allowDefault=n.shiftKey;let a,s;if(r.inside>-1)a=t.state.doc.nodeAt(r.inside),s=r.inside;else{let h=t.state.doc.resolve(r.pos);a=h.parent,s=h.depth?h.before():0}let o=i?null:n.target,l=o?t.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=t.state;n.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof cn&&u.from<=s&&u.to>s)&&(this.mightDrag={node:a,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&cu&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),Pd(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Bd(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let r=this.pos;this.view.state.doc!=this.startDoc&&(r=this.view.posAtCoords(lT(t))),this.updateAllowDefault(t),this.allowDefault||!r?Pd(this.view,"pointer"):Act(this.view,r.pos,r.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Do&&this.mightDrag&&!this.mightDrag.node.isAtom||Ms&&!this.view.state.selection.visible&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(cT(this.view,Vr.near(this.view.state.doc.resolve(r.pos)),"pointer"),t.preventDefault()):Pd(this.view,"pointer")}move(t){this.updateAllowDefault(t),Pd(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},eF=class extends e7{constructor(t,r){super(t),this.startSelection=r,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),Pd(this.view,"pointer");let r=this.view.posAtCoords(lT(t)),n=r&&yhe(this.view,r.inside,!1);if(!n)return;let{doc:i}=this.view.state,a=this.startSelection,[s,o]=n.from{e.input.lastTouch=Date.now(),uF(e),Pd(e,"pointer")};el.touchmove=e=>{e.input.lastTouch=Date.now(),Pd(e,"pointer")};el.contextmenu=e=>uF(e);function xhe(e,t){return e.composing?!0:Do&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Ict=Od?5e3:-1;tl.compositionstart=tl.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,r=t.selection.$to;if(t.selection instanceof Pr&&(t.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Ms&&Zue&&Mct(e)))e.markCursor=e.state.storedMarks||r.marks(),t7(e,!0),e.markCursor=null;else if(t7(e,!t.selection.empty),cu&&t.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let n=e.domSelectionRange();for(let i=n.focusNode,a=n.focusOffset;i&&i.nodeType==1&&a!=0;){let s=a<0?i.lastChild:i.childNodes[a-1];if(!s)break;if(s.nodeType==3){let o=e.domSelection();o&&o.collapse(s,s.nodeValue.length);break}else i=s,a=-1}}e.input.composing=!0}bhe(e,Ict)};function Mct(e){let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(!t||t.nodeType!=1||r>=t.childNodes.length)return!1;let n=t.childNodes[r];return n.nodeType==1&&n.contentEditable=="false"}tl.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,bhe(e,20))};function bhe(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>t7(e),t))}function whe(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Nct(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let r=Llt(t.focusNode,t.focusOffset),n=Ilt(t.focusNode,t.focusOffset);if(r&&n&&r!=n){let i=n.pmViewDesc,a=e.domObserver.lastChangedTextNode;if(r==a||n==a)return a;if(!i||!i.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let s=r.pmViewDesc;if(!(!s||!s.isText(r.nodeValue)))return n}}return r||n}function t7(e,t=!1){if(!(Od&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),whe(e),t||e.docView&&e.docView.dirty){let r=aF(e),n=e.state.selection;return r&&!r.eq(n)?e.dispatch(e.state.tr.setSelection(r)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Dct(e,t){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(t),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()},50)}var rT=$l&&Fp<15||yx&&Olt<604;el.copy=tl.cut=(e,t)=>{let r=t,n=e.state.selection,i=r.type=="cut";if(n.empty)return;let a=rT?null:r.clipboardData,s=n.content(),{dom:o,text:l}=oF(e,s);a?(r.preventDefault(),a.clearData(),a.setData("text/html",o.innerHTML),a.setData("text/plain",l)):Dct(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Oct(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Pct(e,t){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?nT(e,n.value,null,i,t):nT(e,n.textContent,n.innerHTML,i,t)},50)}function nT(e,t,r,n,i){let a=hhe(e,t,r,n,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,i,a||Xt.empty)))return!0;if(!a)return!1;let s=Oct(a),o=s?e.state.tr.replaceSelectionWith(s,n):e.state.tr.replaceSelection(a);return e.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function khe(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}tl.paste=(e,t)=>{let r=t;if(e.composing&&!Od)return;let n=rT?null:r.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;n&&nT(e,khe(n),n.getData("text/html"),i,r)?r.preventDefault():Pct(e,r)};var r7=class{constructor(t,r,n){this.slice=t,this.move=r,this.node=n}},Bct=ou?"altKey":"ctrlKey";function The(e,t){let r;return e.someProp("dragCopies",n=>{r=r||n(t)}),r!=null?!r:!t[Bct]}el.dragstart=(e,t)=>{let r=t,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(lT(r)),s;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof cn?i.to-1:i.to))){if(n&&n.mightDrag)s=cn.create(e.state.doc,n.mightDrag.pos);else if(r.target&&r.target.nodeType==1){let f=e.docView.nearestDesc(r.target,!0);f&&f.node.type.spec.draggable&&f!=e.docView&&(s=cn.create(e.state.doc,f.posBefore))}}let o=(s||e.state.selection).content(),{dom:l,text:u,slice:h}=oF(e,o);(!r.dataTransfer.files.length||!Ms||Kue>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(rT?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",rT||r.dataTransfer.setData("text/plain",u),e.dragging=new r7(h,The(e,r),s)};el.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};tl.dragover=tl.dragenter=(e,t)=>t.preventDefault();tl.drop=(e,t)=>{try{Fct(e,t,e.dragging)}finally{e.dragging=null}};function Fct(e,t,r){if(!t.dataTransfer)return;let n=e.posAtCoords(lT(t));if(!n)return;let i=e.state.doc.resolve(n.pos),a=r&&r.slice;a?e.someProp("transformPasted",p=>{a=p(a,e,!1)}):a=hhe(e,khe(t.dataTransfer),rT?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(r&&The(e,t));if(e.someProp("handleDrop",p=>p(e,t,a||Xt.empty,s))){t.preventDefault();return}if(!a)return;t.preventDefault();let o=a?Mce(e.state.doc,i.pos,a):i.pos;o==null&&(o=i.pos);let l=e.state.tr;if(s){let{node:p}=r;p?p.replace(l):l.deleteSelection()}let u=l.mapping.map(o),h=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,f=l.doc;if(h?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(f))return;let d=l.doc.resolve(u);if(h&&cn.isSelectable(a.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new cn(d));else{let p=l.mapping.map(o);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,y,v)=>p=v),l.setSelection(sF(e,d,l.doc.resolve(p)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}el.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Bd(e)},20))};el.blur=(e,t)=>{let r=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),r.relatedTarget&&e.dom.contains(r.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};el.beforeinput=(e,t)=>{if(Ms&&Od&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:n}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=n||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",a=>a(e,L1(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in tl)el[e]=tl[e];function iT(e,t){if(e==t)return!0;for(let r in e)if(e[r]!==t[r])return!1;for(let r in t)if(!(r in e))return!1;return!0}var n7=class e{constructor(t,r){this.toDOM=t,this.spec=r||O1,this.side=this.spec.side||0}map(t,r,n,i){let{pos:a,deleted:s}=t.mapResult(r.from+i,this.side<0?-1:1);return s?null:new mi(a-n,a-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&iT(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}},D1=class e{constructor(t,r){this.attrs=t,this.spec=r||O1}map(t,r,n,i){let a=t.map(r.from+i,this.spec.inclusiveStart?-1:1)-n,s=t.map(r.to+i,this.spec.inclusiveEnd?1:-1)-n;return a>=s?null:new mi(a,s,this)}valid(t,r){return r.from=t&&(!a||a(o.spec))&&n.push(o.copy(o.from+i,o.to+i))}for(let s=0;st){let o=this.children[s]+1;this.children[s+2].findInner(t-o,r-o,n,i+o,a)}}map(t,r,n){return this==No||t.maps.length==0?this:this.mapInner(t,r,0,0,n||O1)}mapInner(t,r,n,i,a){let s;for(let o=0;o{let u=l+n,h;if(h=She(r,o,u)){for(i||(i=this.children.slice());ao&&f.to=t){this.children[o]==t&&(n=this.children[o+2]);break}let a=t+1,s=a+r.content.size;for(let o=0;oa&&l.type instanceof D1){let u=Math.max(a,l.from)-a,h=Math.min(s,l.to)-a;ui.map(t,r,O1));return e.from(n)}forChild(t,r){if(r.isLeaf)return Ui.empty;let n=[];for(let i=0;ir instanceof Ui)?t:t.reduce((r,n)=>r.concat(n instanceof Ui?n:n.members),[]))}}forEachSet(t){for(let r=0;r{let y=g-m-(p-d);for(let v=0;vx+h-f)continue;let w=o[v]+h-f;p>=w?o[v+1]=d<=w?-2:-1:d>=h&&y&&(o[v]+=y,o[v+1]+=y)}f+=y}),h=r.maps[u].map(h,-1)}let l=!1;for(let u=0;u=n.content.size){l=!0;continue}let d=r.map(e[u+1]+a,-1),p=d-i,{index:m,offset:g}=n.content.findIndex(f),y=n.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let v=o[u+2].mapInner(r,y,h+1,e[u]+a+1,s);v!=No?(o[u]=f,o[u+1]=p,o[u+2]=v):(o[u+1]=-2,l=!0)}else l=!0}if(l){let u=zct(o,e,t,r,i,a,s),h=a7(u,n,0,s);t=h.local;for(let f=0;fr&&s.to{let u=She(e,o,l+r);if(u){a=!0;let h=a7(u,o,r+l+1,n);h!=No&&i.push(l,l+o.nodeSize,h)}});let s=Che(a?Ehe(e):e,-r).sort(P1);for(let o=0;o0;)t++;e.splice(t,0,r)}function BB(e){let t=[];return e.someProp("decorations",r=>{let n=r(e.state);n&&n!=No&&t.push(n)}),e.cursorWrapper&&t.push(Ui.create(e.state.doc,[e.cursorWrapper.deco])),i7.from(t)}var Gct={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},qct=$l&&Fp<=11,rF=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}},nF=class{constructor(t,r){this.view=t,this.handleDOMChange=r,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rF,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Do&&t.composing&&n.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),qct&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Gct)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let r=0;rthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Mue(this.view)){if(this.suppressingSelectionUpdates)return Bd(this.view);if($l&&Fp<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&B1(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let r=new Set,n;for(let a=t.focusNode;a;a=gx(a))r.add(a);for(let a=t.anchorNode;a;a=gx(a))if(r.has(a)){n=a;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Mue(t)&&!this.ignoreSelectionChange(n),a=-1,s=-1,o=!1,l=[];if(t.editable)for(let h=0;hh.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Ms&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&r.some(h=>h.type=="childList"&&h.removedNodes.length))){for(let h of l)if(h.nodeName=="BR"&&h.parentNode){let f=h.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){h.parentNode.removeChild(h);break}f=f.firstChild}}}else if(cu&&l.length){let h=l.filter(f=>f.nodeName=="BR");if(h.length==2){let[f,d]=h;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of h){let p=d.parentNode;p&&p.nodeName=="LI"&&(!f||Hct(t,f)!=p)&&d.remove()}}}let u=null;a<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(a>-1&&(t.docView.markDirty(a,s),Vct(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,Uct(t,l)),this.handleDOMChange(a,s,o,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||Bd(t),this.currentSelection.set(n))}registerMutation(t,r){if(r.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(n==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!n||n.ignoreMutation(t))return null;if(t.type=="childList"){for(let h=0;hi;y--){let v=n.childNodes[y-1],x=v.pmViewDesc;if(v.nodeName=="BR"&&!x){a=y;break}if(!x||x.size)break}let f=e.state.doc,d=e.someProp("domParser")||Uh.fromSchema(e.state.schema),p=f.resolve(s),m=null,g=d.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Xct,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=y),m={anchor:y+s,head:v+s}}return{doc:g,sel:m,from:s,to:o}}function Xct(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Do&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Do&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var jct=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Kct(e,t,r,n,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let S=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,E=aF(e,S);if(E&&!e.state.selection.eq(E)){if(Ms&&Od&&e.input.lastKeyCode===13&&Date.now()-100L(e,L1(13,"Enter"))))return;let I=e.state.tr.setSelection(E);S=="pointer"?I.setMeta("pointer",!0):S=="key"&&I.scrollIntoView(),a&&I.setMeta("composition",a),e.dispatch(I)}return}let s=e.state.doc.resolve(t),o=s.sharedDepth(r);t=s.before(o+1),r=e.state.doc.resolve(r).after(o+1);let l=e.state.selection,u=Yct(e,t,r),h=e.state.doc,f=h.slice(u.from,u.to),d,p;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Od)&&i.some(S=>S.nodeType==1&&!jct.test(S.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",S=>S(e,L1(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof Pr&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let S=Vue(e,e.state.doc,u.sel);if(S&&!S.eq(e.state.selection)){let E=e.state.tr.setSelection(S);a&&E.setMeta("composition",a),e.dispatch(E)}}return}e.state.selection.frome.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?m.start=e.state.selection.from:m.endA=e.state.selection.to-2&&e.state.selection.to<=u.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),$l&&Fp<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" \xA0"&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),v=h.resolve(m.start),x=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=m.endA;if((yx&&e.input.lastIOSEnter>Date.now()-225&&(!x||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!x&&g.posS(e,L1(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Qct(h,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",S=>S(e,L1(8,"Backspace")))){Od&&Ms&&e.domObserver.suppressSelectionUpdates();return}Ms&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Od&&!x&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(S){return S(e,L1(13,"Enter"))})},20));let w=m.start,C=m.endA,T=S=>{let E=S||e.state.tr.replace(w,C,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let I=Vue(e,E.doc,u.sel);I&&!(Ms&&e.composing&&I.empty&&(m.start!=m.endB||e.input.lastChromeDeleteBd(e),20));let S=T(e.state.tr.delete(w,C)),E=h.resolve(m.start).marksAcross(h.resolve(m.endA));E&&S.ensureMarks(E),e.dispatch(S)}else if(m.endA==m.endB&&(k=Zct(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let S=T(e.state.tr);k.type=="add"?S.addMark(w,C,k.mark):S.removeMark(w,C,k.mark),e.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,y.parentOffset),E=()=>T(e.state.tr.insertText(S,w,C));e.someProp("handleTextInput",I=>I(e,w,C,S,E))||e.dispatch(E())}else e.dispatch(T());else e.dispatch(T())}function Vue(e,t,r){return Math.max(r.anchor,r.head)>t.content.size?null:sF(e,t.resolve(r.anchor),t.resolve(r.head))}function Zct(e,t){let r=e.firstChild.marks,n=t.firstChild.marks,i=r,a=n,s,o,l;for(let h=0;hh.mark(o.addToSet(h.marks));else if(i.length==0&&a.length==1)o=a[0],s="remove",l=h=>h.mark(o.removeFromSet(h.marks));else return null;let u=[];for(let h=0;hr||FB(s,!0,!1)0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,i++,t=!1;if(r){let a=e.node(n).maybeChild(e.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Jct(e,t,r,n,i){let a=e.findDiffStart(t,r),s=r+e.size,o=r+t.size;if(a==null)return null;let{a:l,b:u}=e.findDiffEnd(t,s,o);if(i=="end"){let h=Math.max(0,a-Math.min(l,u));n-=l+h-a}if(l=l?a-n:0;a-=h,u=a+(u-l),l=a}else if(u=u?a-n:0;a-=h,l=a+(l-u),u=a}return{start:a,endA:l,endB:u}}var aT=class{constructor(t,r){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ZB,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=r,this.state=r.state,this.directPlugins=r.plugins||[],this.directPlugins.forEach(Xue),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Uue(this),Hue(this),this.nodeViews=Yue(this),this.docView=Eue(this.state.doc,Wue(this),BB(this),this.dom,this),this.domObserver=new nF(this,(n,i,a,s)=>Kct(this,n,i,a,s)),this.domObserver.start(),bct(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let r in t)this._props[r]=t[r];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&QB(this);let r=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Xue),this.directPlugins=t.plugins),this.updateStateInner(t.state,r)}setProps(t){let r={};for(let n in this._props)r[n]=this._props[n];r.state=this.state;for(let n in t)r[n]=t[n];this.update(r)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,r){var n;let i=this.state,a=!1,s=!1;t.storedMarks&&this.composing&&(whe(this),s=!0),this.state=t;let o=i.plugins!=t.plugins||this._props.plugins!=r.plugins;if(o||this._props.plugins!=r.plugins||this._props.nodeViews!=r.nodeViews){let p=Yue(this);tut(p,this.nodeViews)&&(this.nodeViews=p,a=!0)}(o||r.handleDOMEvents!=this._props.handleDOMEvents)&&QB(this),this.editable=Uue(this),Hue(this);let l=BB(this),u=Wue(this),h=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=a||!this.docView.matchesNode(t.doc,u,l);(f||!t.selection.eq(i.selection))&&(s=!0);let d=h=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Flt(this);if(s){this.domObserver.stop();let p=f&&($l||Ms)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&eut(i.selection,t.selection);if(f){let g=Ms?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Nct(this)),(a||!this.docView.update(t.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Eue(t.doc,u,l,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let m=this.input.mouseDown;p||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&act(this)&&m.delaySelUpdate())?Bd(this,p):(lhe(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():d&&$lt(d)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",r=>r(this)))if(this.state.selection instanceof cn){let r=this.docView.domAfterPos(this.state.selection.from);r.nodeType==1&&bue(this,r.getBoundingClientRect(),t)}else bue(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let r=0;r0&&ar.ownerDocument.getSelection()),this._root=r}return t||document}updateRoot(){this._root=null}posAtCoords(t){return Hlt(this,t)}coordsAtPos(t,r=1){return rhe(this,t,r)}domAtPos(t,r=0){return this.docView.domFromPos(t,r)}nodeDOM(t){let r=this.docView.descAt(t);return r?r.nodeDOM:null}posAtDOM(t,r,n=-1){let i=this.docView.posFromDOM(t,r,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,r){return Klt(this,r||this.state,t)}pasteHTML(t,r){return nT(this,"",t,!1,r||new ClipboardEvent("paste"))}pasteText(t,r){return nT(this,t,null,!0,r||new ClipboardEvent("paste"))}serializeForClipboard(t){return oF(this,t)}destroy(){this.docView&&(wct(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],BB(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_lt())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return Tct(this,t)}domSelectionRange(){let t=this.domSelection();return t?Do&&this.root.nodeType===11&&Nlt(this.dom.ownerDocument)==this.dom&&Wct(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};aT.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Wue(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",r=>{if(typeof r=="function"&&(r=r(e.state)),r)for(let n in r)n=="class"?t.class+=" "+r[n]:n=="style"?t.style=(t.style?t.style+";":"")+r[n]:!t[n]&&n!="contenteditable"&&n!="nodeName"&&(t[n]=String(r[n]))}),t.translate||(t.translate="no"),[mi.node(0,e.state.doc.content.size,t)]}function Hue(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:mi.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Uue(e){return!e.someProp("editable",t=>t(e.state)===!1)}function eut(e,t){let r=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(r)!=t.$anchor.start(r)}function Yue(e){let t=Object.create(null);function r(n){for(let i in n)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=n[i])}return e.someProp("nodeViews",r),e.someProp("markViews",r),t}function tut(e,t){let r=0,n=0;for(let i in e){if(e[i]!=t[i])return!0;r++}for(let i in t)n++;return r!=n}function Xue(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Gd(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}var Rhe={text:(e,t,r,n)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:r.safe(i,{...n,encode:[]})},strong:(e,t,r,n)=>{let i=e.marker||r.options.strong||"*",a=r.enter("strong"),s=r.createTracker(n),o=s.move(i+i);return o+=s.move(r.containerPhrasing(e,{before:o,after:i,...s.current()})),o+=s.move(i+i),a(),o},emphasis:(e,t,r,n)=>{let i=e.marker||r.options.emphasis||"*",a=r.enter("emphasis"),s=r.createTracker(n),o=s.move(i);return o+=s.move(r.containerPhrasing(e,{before:o,after:i,...s.current()})),o+=s.move(i),a(),o}},Li=bn({},"editorView"),uT=bn({},"editorState"),fF=bn([],"initTimer"),Ahe=bn({},"editor"),$d=bn([],"inputRules"),fu=bn([],"prosePlugins"),zd=bn([],"remarkPlugins"),xT=bn([],"nodeView"),bT=bn([],"markView"),$1=bn(zk().use(Z2).use(tx),"remark"),vx=bn({handlers:Rhe,encode:[]},"remarkStringifyOptions"),o7=wc("ConfigReady");function rut(e){let t=r=>(r.record(o7),async()=>(await e(r),r.done(o7),()=>{r.clearTimer(o7)}));return Gd(t,{displayName:"Config"}),t}var eh=wc("InitReady");function nut(e){let t=r=>(r.inject(Ahe,e).inject(fu,[]).inject(zd,[]).inject($d,[]).inject(xT,[]).inject(bT,[]).inject(vx,{handlers:Rhe,encode:[]}).inject($1,zk().use(Z2).use(tx)).inject(fF,[o7]).record(eh),async()=>{await r.waitTimers(fF);let n=r.get(vx);return r.set($1,zk().use(Z2).use(tx,n)),r.done(eh),()=>{r.remove(Ahe).remove(fu).remove(zd).remove($d).remove(xT).remove(bT).remove(vx).remove($1).remove(fF).clearTimer(eh)}});return Gd(t,{displayName:"Init"}),t}var Js=wc("SchemaReady"),hT=bn([],"schemaTimer"),eo=bn({},"schema"),jh=bn([],"nodes"),z1=bn([],"marks");function _he(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var Lhe=e=>(e.inject(eo,{}).inject(jh,[]).inject(z1,[]).inject(hT,[eh]).record(Js),async()=>{await e.waitTimers(hT);let t=e.get($1),r=e.get(zd).reduce((i,a)=>i.use(a.plugin,a.options),t);e.set($1,r);let n=new BE({nodes:Object.fromEntries(e.get(jh).map(([i,a])=>[i,_he(a)])),marks:Object.fromEntries(e.get(z1).map(([i,a])=>[i,_he(a)]))});return e.set(eo,n),e.done(Js),()=>{e.remove(eo).remove(jh).remove(z1).remove(hT).clearTimer(Js)}});Gd(Lhe,{displayName:"Schema"});var Ihe=class{constructor(){this.#t=new pP,this.#e=null,this.setCtx=e=>{this.#e=e},this.chain=()=>{if(this.#e==null)throw oE();let e=this.#e,t=[],r=this.get.bind(this),n={run:()=>{let a=_1(...t),s=e.get(Li);return a(s.state,s.dispatch,s)},inline:a=>(t.push(a),n),pipe:i.bind(this)};function i(a,s){let o=r(a);return t.push(o(s)),n}return n}}#t;#e;get ctx(){return this.#e}create(e,t){let r=e.create(this.#t.sliceMap);return r.set(t),r}get(e){return this.#t.get(e).get()}remove(e){return this.#t.remove(e)}call(e,t){if(this.#e==null)throw oE();let r=this.get(e)(t),n=this.#e.get(Li);return r(n.state,n.dispatch,n)}inline(e){if(this.#e==null)throw oE();let t=this.#e.get(Li);return e(t.state,t.dispatch,t)}};function vF(e="cmdKey"){return bn((()=>()=>!1),e)}var Gn=bn(new Ihe,"commands"),fT=bn([Js],"commandsTimer"),G1=wc("CommandsReady"),Mhe=e=>{let t=new Ihe;return t.setCtx(e),e.inject(Gn,t).inject(fT,[Js]).record(G1),async()=>(await e.waitTimers(fT),e.done(G1),()=>{e.remove(Gn).remove(fT).clearTimer(G1)})};Gd(Mhe,{displayName:"Commands"});function iut(e){return e.Backspace=_1(Jce,WE,Yce,kB),e}var Nhe=class{constructor(){this.#t=null,this.#e=[],this.setCtx=e=>{this.#t=e},this.add=e=>(this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([r,n])=>{if(typeof n=="function"){let i={key:r,onRun:()=>n};this.#e.push(i),t.push(()=>{this.#e=this.#e.filter(a=>a!==i)})}else this.#e.push(n),t.push(()=>{this.#e=this.#e.filter(i=>i!==n)})}),()=>{t.forEach(r=>r())}},this.addBaseKeymap=()=>{let e=iut(Qce);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#e.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([t,r])=>{let n=r.sort((a,s)=>(s.priority??50)-(a.priority??50));return[t,(a,s,o)=>{let l=this.#t;if(l==null)throw j2();return _1(...n.map(u=>u.onRun(l)))(a,s,o)}]}))}}#t;#e;get ctx(){return this.#t}},wT=bn(new Nhe,"keymap"),dF=bn([Js],"keymapTimer"),xx=wc("KeymapReady"),aut=e=>{let t=new Nhe;return t.setCtx(e),e.inject(wT,t).inject(dF,[Js]).record(xx),async()=>(await e.waitTimers(dF),e.done(xx),()=>{e.remove(wT).remove(dF).clearTimer(xx)})},l7=wc("ParserReady"),Dhe=(()=>{throw j2()}),Fd=bn(Dhe,"parser"),pF=bn([],"parserTimer"),Ohe=e=>(e.inject(Fd,Dhe).inject(pF,[Js]).record(l7),async()=>{await e.waitTimers(pF);let t=e.get($1),r=e.get(eo);return e.set(Fd,mue.create(r,t)),e.done(l7),()=>{e.remove(Fd).remove(pF).clearTimer(l7)}});Gd(Ohe,{displayName:"Parser"});var bx=wc("SerializerReady"),mF=bn([],"serializerTimer"),Phe=(()=>{throw j2()}),Gp=bn(Phe,"serializer"),Bhe=e=>(e.inject(Gp,Phe).inject(mF,[Js]).record(bx),async()=>{await e.waitTimers(mF);let t=e.get($1),r=e.get(eo);return e.set(Gp,yue.create(r,t)),e.done(bx),()=>{e.remove(Gp).remove(mF).clearTimer(bx)}});Gd(Bhe,{displayName:"Serializer"});var dT=bn("","defaultValue"),wx=bn(e=>e,"stateOptions"),pT=bn([],"editorStateTimer"),c7=wc("EditorStateReady");function sut(e,t,r){if(typeof e=="string")return t(e);if(e.type==="html")return Uh.fromSchema(r).parse(e.dom);if(e.type==="json")return Fl.fromJSON(r,e.value);throw boe(e)}var out=new Hi("MILKDOWN_STATE_TRACKER"),Fhe=e=>(e.inject(dT,"").inject(uT,{}).inject(wx,t=>t).inject(pT,[l7,bx,G1,xx]).record(c7),async()=>{await e.waitTimers(pT);let t=e.get(eo),r=e.get(Fd),n=e.get($d),i=e.get(wx),a=e.get(fu),s=sut(e.get(dT),r,t),o=e.get(wT),l=o.addBaseKeymap(),u=[...a,new Ci({key:out,state:{init:()=>{},apply:(d,p,m,g)=>{e.set(uT,g)}}}),rue({rules:n}),uue(o.build())];e.set(fu,u);let h=i({schema:t,doc:s,plugins:u}),f=cx.create(h);return e.set(uT,f),e.done(c7),()=>{l(),e.remove(dT).remove(uT).remove(wx).remove(pT).clearTimer(c7)}});Gd(Fhe,{displayName:"EditorState"});var kx=bn([],"pasteRule"),u7=bn([Js],"pasteRuleTimer"),h7=wc("PasteRuleReady"),$he=e=>(e.inject(kx,[]).inject(u7,[Js]).record(h7),async()=>(await e.waitTimers(u7),e.done(h7),()=>{e.remove(kx).remove(u7).clearTimer(h7)}));Gd($he,{displayName:"PasteRule"});var mT=wc("EditorViewReady"),gT=bn([],"editorViewTimer"),yT=bn({},"editorViewOptions"),vT=bn(null,"root"),gF=bn(null,"rootDOM"),yF=bn({},"rootAttrs");function lut(e,t){let r=document.createElement("div");r.className="milkdown",e.appendChild(r),t.set(gF,r);let n=t.get(yF);return Object.entries(n).forEach(([i,a])=>r.setAttribute(i,a)),r}function cut(e){e.classList.add("editor"),e.setAttribute("role","textbox")}var uut=new Hi("MILKDOWN_VIEW_CLEAR"),zhe=e=>(e.inject(vT,document.body).inject(Li,{}).inject(yT,{}).inject(gF,null).inject(yF,{}).inject(gT,[c7,h7]).record(mT),async()=>{await e.wait(eh);let t=e.get(vT)||document.body,r=typeof t=="string"?document.querySelector(t):t;e.update(fu,s=>[new Ci({key:uut,view:o=>{let l=r?lut(r,e):void 0;return(()=>{if(l&&r){let h=o.dom;r.replaceChild(l,h),l.appendChild(h)}})(),{destroy:()=>{l?.parentNode&&l?.parentNode.replaceChild(o.dom,l),l?.remove()}}}}),...s]),await e.waitTimers(gT);let n=e.get(uT),i=e.get(yT),a=new aT(r,{state:n,nodeViews:Object.fromEntries(e.get(xT)),markViews:Object.fromEntries(e.get(bT)),transformPasted:(s,o,l)=>(e.get(kx).sort((u,h)=>(h.priority??50)-(u.priority??50)).map(u=>u.run).forEach(u=>{s=u(s,o,l)}),s),...i});return cut(a.dom),e.set(Li,a),e.done(mT),()=>{a?.destroy(),e.remove(vT).remove(Li).remove(yT).remove(gF).remove(yF).remove(gT).clearTimer(mT)}});Gd(zhe,{displayName:"EditorView"});var hu=(function(e){return e.Idle="Idle",e.OnCreate="OnCreate",e.Created="Created",e.OnDestroy="OnDestroy",e.Destroyed="Destroyed",e})({}),Ghe=class qhe{constructor(){this.#t=!1,this.#e=hu.Idle,this.#n=[],this.#r=()=>{},this.#s=new pP,this.#a=new Roe,this.#i=new Map,this.#o=new Map,this.#l=new Aoe(this.#s,this.#a),this.#u=()=>{let t=rut(async n=>{await Promise.all(this.#n.map(i=>Promise.resolve(i(n))))}),r=[Lhe,Ohe,Bhe,Mhe,aut,$he,Fhe,zhe,nut(this),t];this.#c(r,this.#o)},this.#c=(t,r)=>{t.forEach(n=>{let i=this.#l.produce(this.#t?n.meta:void 0),a=n(i);r.set(n,{ctx:i,handler:a,cleanup:void 0})})},this.#h=(t,r=!1)=>Promise.all([t].flat().map(async n=>{let i=this.#i.get(n)?.cleanup;return r?this.#i.delete(n):this.#i.set(n,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i})),this.#f=async()=>{await Promise.all([...this.#o.entries()].map(async([t,{cleanup:r}])=>typeof r=="function"?r():r)),this.#o.clear()},this.#d=t=>{this.#e=t,this.#r(t)},this.#p=t=>[...t.entries()].map(async([r,n])=>{let{ctx:i,handler:a}=n;if(!a)return;let s=await a();t.set(r,{ctx:i,handler:a,cleanup:s})}),this.enableInspector=(t=!0)=>(this.#t=t,this),this.onStatusChange=t=>(this.#r=t,this),this.config=t=>(this.#n.push(t),this),this.removeConfig=t=>(this.#n=this.#n.filter(r=>r!==t),this),this.use=t=>{let r=[t].flat();return r.flat().forEach(n=>{this.#i.set(n,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#e===hu.Created&&this.#c(r,this.#i),this},this.remove=async t=>this.#e===hu.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(r=>{setTimeout(()=>{r(this.remove(t))},50)})):(await this.#h([t].flat(),!0),this),this.create=async()=>this.#e===hu.OnCreate?this:(this.#e===hu.Created&&await this.destroy(),this.#d(hu.OnCreate),this.#u(),this.#c([...this.#i.keys()],this.#i),await Promise.all([this.#p(this.#o),this.#p(this.#i)].flat()),this.#d(hu.Created),this),this.destroy=async(t=!1)=>this.#e===hu.Destroyed||this.#e===hu.OnDestroy?this:this.#e===hu.OnCreate?new Promise(r=>{setTimeout(()=>{r(this.destroy(t))},50)}):(t&&(this.#n=[]),this.#d(hu.OnDestroy),await this.#h([...this.#i.keys()],t),await this.#f(),this.#d(hu.Destroyed),this),this.action=t=>t(this.#l),this.inspect=()=>this.#t?[...this.#o.values(),...this.#i.values()].map(({ctx:t})=>t?.inspector?.read()).filter(t=>!!t):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new qhe}#t;#e;#n;#r;#s;#a;#i;#o;#l;#u;#c;#h;#f;#d;#p;get ctx(){return this.#l}get status(){return this.#e}};var hut=e=>crypto.getRandomValues(new Uint8Array(e)),fut=(e,t,r)=>{let n=256-256%e.length;if(n===256){let a=e.length-1;return(s=t)=>{if(!s)return"";let o="";for(;;){let l=r(s),u=s;for(;u--;)if(o+=e[l[u]&a],o.length>=s)return o}}}let i=Math.ceil(1.6*256*t/n);return(a=t)=>{if(!a)return"";let s="";for(;;){let o=r(i),l=i;for(;l--;)if(o[l]=a))return s}}},f7=(e,t=21)=>fut(e,t|0,hut);var nyr=f7("abcedfghicklmn",10);function hn(e,t){let r=vF(e),n=i=>async()=>{n.key=r,await i.wait(G1);let a=t(i);return i.get(Gn).create(r,a),n.run=s=>i.get(Gn).call(e,s),()=>{i.get(Gn).remove(r)}};return n}function Oo(e){let t=r=>async()=>{await r.wait(Js);let n=e(r);return r.update($d,i=>[...i,n]),t.inputRule=n,()=>{r.update($d,i=>i.filter(a=>a!==n))}};return t}function Vhe(e){let t=r=>async()=>{await r.wait(Js);let n=e(r);return r.update(kx,i=>[...i,n]),t.pasteRule=n,()=>{r.update(kx,i=>i.filter(a=>a!==n))}};return t}function dut(e,t){let r=n=>async()=>{let i=t(n);return n.update(z1,a=>[...a.filter(s=>s[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{n.update(z1,a=>a.filter(([s])=>s!==e))}};return r.type=n=>{let i=n.get(eo).marks[e];if(!i)throw Eoe(e);return i},r}function d7(e,t){let r=n=>async()=>{let i=t(n);return n.update(jh,a=>[...a.filter(s=>s[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{n.update(jh,a=>a.filter(([s])=>s!==e))}};return r.type=n=>{let i=n.get(eo).nodes[e];if(!i)throw lE(e);return i},r}function rl(e){let t,r=n=>async()=>(await n.wait(Js),t=e(n),n.update(fu,i=>[...i,t]),()=>{n.update(fu,i=>i.filter(a=>a!==t))});return r.plugin=()=>t,r.key=()=>t.spec.key,r}function put(e){let t=r=>async()=>{await r.wait(xx);let n=r.get(wT),i=e(r),a=n.addObjectKeymap(i);return t.keymap=i,()=>{a()}};return t}function th(e,t){let r=bn(e,t),n=i=>(i.inject(r),()=>()=>{i.remove(r)});return n.key=r,n}function Ba(e,t){let r=th(t,e),n=d7(e,a=>a.get(r.key)(a)),i=[r,n];return i.id=n.id,i.node=n,i.type=a=>n.type(a),i.ctx=r,i.key=r.key,i.extendSchema=a=>Ba(e,a(t)),i}function qp(e,t){let r=th(t,e),n=dut(e,a=>a.get(r.key)(a)),i=[r,n];return i.id=n.id,i.mark=n,i.type=a=>n.type(a),i.ctx=r,i.key=r.key,i.extendSchema=a=>qp(e,a(t)),i}function nl(e,t){let r=th(Object.fromEntries(Object.entries(t).map(([a,{shortcuts:s,priority:o}])=>[a,{shortcuts:s,priority:o}])),`${e}Keymap`),n=put(a=>{let s=a.get(r.key),o=Object.entries(t).flatMap(([l,{command:u}])=>{let h=s[l],f=[h.shortcuts].flat(),d=h.priority;return f.map(p=>[p,{key:p,onRun:u,priority:d}])});return Object.fromEntries(o)}),i=[r,n];return i.ctx=r,i.shortcuts=n,i.key=r.key,i.keymap=n.keymap,i}var du=(e,t=()=>({}))=>th(t,`${e}Attr`),q1=(e,t=()=>({}))=>th(t,`${e}Attr`);function qd(e,t,r){let n=th(r??{},e),i=s=>async()=>{await s.wait(eh);let o={plugin:t(s),options:s.get(n.key)};return s.update(zd,l=>[...l,o]),()=>{s.update(zd,l=>l.filter(u=>u!==o))}},a=[n,i];return a.id=e,a.plugin=i,a.options=n,a}function Whe(e){return t=>{let r=t.get(Li),n=t.get(eo),i=t.get(Gp);if(!e)return i(r.state.doc);let a=r.state.doc.slice(e.from,e.to,!0),s=n.topNodeType.createAndFill(null,a.content);return s?i(s):(console.error("No document found"),"")}}function xF(e,t=!1){return r=>{let n=r.get(Li),i=r.get(Fd)(e);if(!i)return;if(!t){let u=n.state.selection.content();return n.dispatch(n.state.tr.replaceSelection(new Xt(i.content,u.openStart,u.openEnd)).scrollIntoView())}let a=r.get(eo),s=Yh.fromSchema(a).serializeFragment(i.content),o=Uh.fromSchema(a).parseSlice(s),l=iue(o);if(l){n.dispatch(n.state.tr.replaceSelectionWith(l,!0));return}n.dispatch(n.state.tr.replaceSelection(o))}}function Hhe(e,t=!1){return r=>{let n=r.get(Li),i=r.get(Fd)(e);if(!i)return;if(!t){let{state:l}=n;return n.dispatch(l.tr.replace(0,l.doc.content.size,new Xt(i.content,0,0)))}let a=r.get(eo),s=r.get(wx)({schema:a,doc:i,plugins:r.get(fu)}),o=cx.create(s);n.updateState(o)}}function mut(e){return t=>{let r=t.get(Fd)(e),n=t.get(eo),i=Yh.fromSchema(n).serializeFragment(r.content);return Uh.fromSchema(n).parseSlice(i)}}function bF(e,t){return r=>{let n=r.get(Li),i=mut(e)(r);n.dispatch(n.state.tr.replace(t.from,t.to,i))}}function Uhe(e,t){return function(r,n){let{$from:i,$to:a,node:s}=r.selection;if(s&&s.isBlock||i.depth<2||!i.sameParent(a))return!1;let o=i.node(-1);if(o.type!=e)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=e||i.index(-2)!=i.node(-2).childCount-1)return!1;if(n){let f=Lt.empty,d=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-d;v>=i.depth-3;v--)f=Lt.from(i.node(v).copy(f));let p=i.indexAfter(-1){if(y>-1)return!1;v.isTextblock&&v.content.size==0&&(y=x+1)}),y>-1&&g.setSelection(Vr.near(g.doc.resolve(y))),n(g.scrollIntoView())}return!0}let l=a.pos==i.end()?o.contentMatchAt(0).defaultType:null,u=r.tr.delete(i.pos,a.pos),h=l?[t?{type:e,attrs:t}:null,{type:l}]:void 0;return S1(u.doc,i.pos,2,h)?(n&&n(u.split(i.pos,2,h).scrollIntoView()),!0):!1}}function p7(e){return function(t,r){let{$from:n,$to:i}=t.selection,a=n.blockRange(i,s=>s.childCount>0&&s.firstChild.type==e);return a?r?n.node(a.depth-1).type==e?gut(t,r,e,a):yut(t,r,a):!0:!1}}function gut(e,t,r,n){let i=e.tr,a=n.end,s=n.$to.end(n.depth);ag;m--)p-=i.child(m).nodeSize,n.delete(p-1,p+1);let a=n.doc.resolve(r.start),s=a.nodeAfter;if(n.mapping.map(r.end)!=r.start+a.nodeAfter.nodeSize)return!1;let o=r.startIndex==0,l=r.endIndex==i.childCount,u=a.node(-1),h=a.index(-1);if(!u.canReplace(h+(o?0:1),h+1,s.content.append(l?Lt.empty:Lt.from(i))))return!1;let f=a.pos,d=f+s.nodeSize;return n.step(new Zs(f-(o?1:0),d+(l?1:0),f+1,d-1,new Xt((o?Lt.empty:Lt.from(i.copy(Lt.empty))).append(l?Lt.empty:Lt.from(i.copy(Lt.empty))),o?0:1,l?0:1),o?0:1)),t(n.scrollIntoView()),!0}function Yhe(e){return function(t,r){let{$from:n,$to:i}=t.selection,a=n.blockRange(i,u=>u.childCount>0&&u.firstChild.type==e);if(!a)return!1;let s=a.startIndex;if(s==0)return!1;let o=a.parent,l=o.child(s-1);if(l.type!=e)return!1;if(r){let u=l.lastChild&&l.lastChild.type==o.type,h=Lt.from(u?e.create():null),f=new Xt(Lt.from(e.create(null,Lt.from(o.type.create(null,h)))),u?3:1,0),d=a.start,p=a.end;r(t.tr.step(new Zs(d-(u?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}function wF(e){let t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Zu(e,"definition",function(n){let i=Xhe(n.identifier);i&&!t.get(i)&&t.set(i,n)}),r;function r(n){let i=Xhe(n);return t.get(i)}}function Xhe(e){return String(e||"").toUpperCase()}function m7(){return function(e){let t=wF(e);Zu(e,function(r,n,i){if(r.type==="definition"&&i!==void 0&&typeof n=="number")return i.children.splice(n,1),[m1,n];if(r.type==="imageReference"||r.type==="linkReference"){let a=t(r.identifier);if(a&&i&&typeof n=="number")return i.children[n]=r.type==="imageReference"?{type:"image",url:a.url,title:a.title,alt:r.alt}:{type:"link",url:a.url,title:a.title,children:r.children},[m1,n]}})}}function jhe(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak")){e.next(t.content);return}let r=[];t.content.forEach((n,i,a)=>{a!==t.childCount-1&&r.push(n)}),e.next(Lt.fromArray(r))}function vt(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var kF=q1("emphasis");vt(kF,{displayName:"Attr",group:"Emphasis"});var Cx=qp("emphasis",e=>({attrs:{marker:{default:e.get(vx).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:t=>t==="italic"}],toDOM:t=>["em",e.get(kF.key)(t)],parseMarkdown:{match:t=>t.type==="emphasis",runner:(t,r,n)=>{t.openMark(n,{marker:r.marker}),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="emphasis",runner:(t,r)=>{t.withMark(r,"emphasis",void 0,{marker:r.attrs.marker})}}}));vt(Cx.mark,{displayName:"MarkSchema",group:"Emphasis"});vt(Cx.ctx,{displayName:"MarkSchemaCtx",group:"Emphasis"});var TF=hn("ToggleEmphasis",e=>()=>fx(Cx.type(e)));vt(TF,{displayName:"Command",group:"Emphasis"});var Khe=Oo(e=>R1(/(?:^|[^*])\*([^*]+)\*$/,Cx.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:t,start:r})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:r+1}}));vt(Khe,{displayName:"InputRule|Star",group:"Emphasis"});var Zhe=Oo(e=>R1(/\b_(?![_\s])(.*?[^_\s])_\b/,Cx.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:t,start:r})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:r+1}}));vt(Zhe,{displayName:"InputRule|Underscore",group:"Emphasis"});var CF=nl("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{let t=e.get(Gn);return()=>t.call(TF.key)}}});vt(CF.ctx,{displayName:"KeymapCtx",group:"Emphasis"});vt(CF.shortcuts,{displayName:"Keymap",group:"Emphasis"});var SF=q1("strong");vt(SF,{displayName:"Attr",group:"Strong"});var kT=qp("strong",e=>({attrs:{marker:{default:e.get(vx).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:t=>t==="bold"},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:t=>["strong",e.get(SF.key)(t)],parseMarkdown:{match:t=>t.type==="strong",runner:(t,r,n)=>{t.openMark(n,{marker:r.marker}),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="strong",runner:(t,r)=>{t.withMark(r,"strong",void 0,{marker:r.attrs.marker})}}}));vt(kT.mark,{displayName:"MarkSchema",group:"Strong"});vt(kT.ctx,{displayName:"MarkSchemaCtx",group:"Strong"});var EF=hn("ToggleStrong",e=>()=>fx(kT.type(e)));vt(EF,{displayName:"Command",group:"Strong"});var Qhe=Oo(e=>R1(/(?({marker:t[0].startsWith("*")?"*":"_"})}));vt(Qhe,{displayName:"InputRule",group:"Strong"});var AF=nl("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{let t=e.get(Gn);return()=>t.call(EF.key)}}});vt(AF.ctx,{displayName:"KeymapCtx",group:"Strong"});vt(AF.shortcuts,{displayName:"Keymap",group:"Strong"});var _F=q1("inlineCode");vt(_F,{displayName:"Attr",group:"InlineCode"});var Wp=qp("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(_F.key)(t)],parseMarkdown:{match:t=>t.type==="inlineCode",runner:(t,r,n)=>{t.openMark(n),t.addText(r.value),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="inlineCode",runner:(t,r,n)=>(t.withMark(r,"inlineCode",n.text||""),!0)}}));vt(Wp.mark,{displayName:"MarkSchema",group:"InlineCode"});vt(Wp.ctx,{displayName:"MarkSchemaCtx",group:"InlineCode"});var RF=hn("ToggleInlineCode",e=>()=>(t,r)=>{let{selection:n,tr:i}=t;if(n.empty)return!1;let{from:a,to:s}=n;return t.doc.rangeHasMark(a,s,Wp.type(e))?(r?.(i.removeMark(a,s,Wp.type(e))),!0):(Object.keys(t.schema.marks).filter(o=>o!==Wp.type.name).map(o=>t.schema.marks[o]).forEach(o=>{i.removeMark(a,s,o)}),r?.(i.addMark(a,s,Wp.type(e).create())),!0)});vt(RF,{displayName:"Command",group:"InlineCode"});var Jhe=Oo(e=>R1(/(?:`)([^`]+)(?:`)$/,Wp.type(e)));vt(Jhe,{displayName:"InputRule",group:"InlineCode"});var LF=nl("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{let t=e.get(Gn);return()=>t.call(RF.key)}}});vt(LF.ctx,{displayName:"KeymapCtx",group:"InlineCode"});vt(LF.shortcuts,{displayName:"Keymap",group:"InlineCode"});var IF=q1("link");vt(IF,{displayName:"Attr",group:"Link"});var Tx=qp("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(IF.key)(t),...t.attrs}],parseMarkdown:{match:t=>t.type==="link",runner:(t,r,n)=>{let i=r.url,a=r.title;t.openMark(n,{href:i,title:a}),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="link",runner:(t,r)=>{t.withMark(r,"link",void 0,{title:r.attrs.title,url:r.attrs.href})}}}));vt(Tx.mark,{displayName:"MarkSchema",group:"Link"});var efe=hn("ToggleLink",e=>(t={})=>fx(Tx.type(e),t));vt(efe,{displayName:"Command",group:"Link"});var tfe=hn("UpdateLink",e=>(t={})=>(r,n)=>{if(!n)return!1;let i,a=-1,{selection:s}=r,{from:o,to:l}=s;if(r.doc.nodesBetween(o,o===l?l+1:l,(m,g)=>{if(Tx.type(e).isInSet(m.marks))return i=m,a=g,!1}),!i)return!1;let u=i.marks.find(({type:m})=>m===Tx.type(e));if(!u)return!1;let h=a,f=a+i.nodeSize,{tr:d}=r,p=Tx.type(e).create({...u.attrs,...t});return p?(n(d.removeMark(h,f,u).addMark(h,f,p).setSelection(new Pr(d.selection.$anchor)).scrollIntoView()),!0):!1});vt(tfe,{displayName:"Command",group:"Link"});var rfe=d7("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>e==="root",runner:(e,t,r)=>{e.injectRoot(t,r)}},toMarkdown:{match:e=>e.type.name==="doc",runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));vt(rfe,{displayName:"NodeSchema",group:"Doc"});function vut(e){return g1(e,t=>t.type==="html"&&["
","
","
","
"].includes(t.value?.trim()),(t,r)=>{if(!r.length)return;let n=r[r.length-1];if(!n)return;let i=n.children.indexOf(t);i!==-1&&n.children.splice(i,1)},!0)}var y7=qd("remark-preserve-empty-line",()=>()=>vut);vt(y7.plugin,{displayName:"Remark",group:"Remark"});vt(y7.options,{displayName:"RemarkConfig",group:"Remark"});var MF=du("paragraph");vt(MF,{displayName:"Attr",group:"Paragraph"});var rh=Ba("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(MF.key)(t),0],parseMarkdown:{match:t=>t.type==="paragraph",runner:(t,r,n)=>{t.openNode(n),r.children?t.next(r.children):t.addText(r.value||""),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="paragraph",runner:(t,r)=>{let n=e.get(Li).state?.doc.lastChild;t.openNode("paragraph"),(!r.content||r.content.size===0)&&r!==n&&xut(e)?t.addNode("html",void 0,"
"):jhe(t,r),t.closeNode()}}}));function xut(e){let t=!1;try{e.get(y7.id),t=!0}catch{t=!1}return t}vt(rh.node,{displayName:"NodeSchema",group:"Paragraph"});vt(rh.ctx,{displayName:"NodeSchemaCtx",group:"Paragraph"});var NF=hn("TurnIntoText",e=>()=>hx(rh.type(e)));vt(NF,{displayName:"Command",group:"Paragraph"});var DF=nl("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{let t=e.get(Gn);return()=>t.call(NF.key)}}});vt(DF.ctx,{displayName:"KeymapCtx",group:"Paragraph"});vt(DF.shortcuts,{displayName:"Keymap",group:"Paragraph"});var but=Array(6).fill(0).map((e,t)=>t+1);function wut(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var v7=th(wut,"headingIdGenerator");vt(v7,{displayName:"Ctx",group:"Heading"});var OF=du("heading");vt(OF,{displayName:"Attr",group:"Heading"});var W1=Ba("heading",e=>{let t=e.get(v7.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:but.map(r=>({tag:`h${r}`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw su(n);return{level:r,id:n.id}}})),toDOM:r=>[`h${r.attrs.level}`,{...e.get(OF.key)(r),id:r.attrs.id||t(r)},0],parseMarkdown:{match:({type:r})=>r==="heading",runner:(r,n,i)=>{let a=n.depth;r.openNode(i,{level:a}),r.next(n.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="heading",runner:(r,n)=>{r.openNode("heading",void 0,{depth:n.attrs.level}),jhe(r,n),r.closeNode()}}}});vt(W1.node,{displayName:"NodeSchema",group:"Heading"});vt(W1.ctx,{displayName:"NodeSchemaCtx",group:"Heading"});var nfe=Oo(e=>SB(/^(?#+)\s$/,W1.type(e),t=>{let r=t.groups?.hashes?.length||0,{$from:n}=e.get(Li).state.selection,i=n.node();if(i.type.name==="heading"){let a=Number(i.attrs.level)+Number(r);return a>6&&(a=6),{level:a}}return{level:r}}));vt(nfe,{displayName:"InputRule",group:"Heading"});var Vp=hn("WrapInHeading",e=>t=>(t??=1,t<1?hx(rh.type(e)):hx(W1.type(e),{level:t})));vt(Vp,{displayName:"Command",group:"Heading"});var PF=hn("DowngradeHeading",e=>()=>(t,r,n)=>{let{$from:i}=t.selection,a=i.node();if(a.type!==W1.type(e)||!t.selection.empty||i.parentOffset!==0)return!1;let s=a.attrs.level-1;return s?(r?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...a.attrs,level:s})),!0):hx(rh.type(e))(t,r,n)});vt(PF,{displayName:"Command",group:"Heading"});var BF=nl("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{let t=e.get(Gn);return()=>t.call(PF.key)}}});vt(BF.ctx,{displayName:"KeymapCtx",group:"Heading"});vt(BF.shortcuts,{displayName:"Keymap",group:"Heading"});var FF=du("blockquote");vt(FF,{displayName:"Attr

",group:"Blockquote"});var TT=Ba("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(FF.key)(t),0],parseMarkdown:{match:({type:t})=>t==="blockquote",runner:(t,r,n)=>{t.openNode(n).next(r.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="blockquote",runner:(t,r)=>{t.openNode("blockquote").next(r.content).closeNode()}}}));vt(TT.node,{displayName:"NodeSchema
",group:"Blockquote"});vt(TT.ctx,{displayName:"NodeSchemaCtx
",group:"Blockquote"});var ife=Oo(e=>UE(/^\s*>\s$/,TT.type(e)));vt(ife,{displayName:"InputRule",group:"Blockquote"});var $F=hn("WrapInBlockquote",e=>()=>HE(TT.type(e)));vt($F,{displayName:"Command",group:"Blockquote"});var zF=nl("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{let t=e.get(Gn);return()=>t.call($F.key)}}});vt(zF.ctx,{displayName:"KeymapCtx
",group:"Blockquote"});vt(zF.shortcuts,{displayName:"Keymap
",group:"Blockquote"});var GF=du("codeBlock",()=>({pre:{},code:{}}));vt(GF,{displayName:"Attr",group:"CodeBlock"});var CT=Ba("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{language:t.dataset.language}}}],toDOM:t=>{let r=e.get(GF.key)(t),n=t.attrs.language,i=n&&n.length>0?{"data-language":n}:void 0;return["pre",{...r.pre,...i},["code",r.code,0]]},parseMarkdown:{match:({type:t})=>t==="code",runner:(t,r,n)=>{let i=r.lang??"",a=r.value;t.openNode(n,{language:i}),a&&t.addText(a),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="code_block",runner:(t,r)=>{t.addNode("code",void 0,r.content.firstChild?.text||"",{lang:r.attrs.language})}}}));vt(CT.node,{displayName:"NodeSchema",group:"CodeBlock"});vt(CT.ctx,{displayName:"NodeSchemaCtx",group:"CodeBlock"});var afe=Oo(e=>SB(/^```(?[a-z]*)?[\s\n]$/,CT.type(e),t=>({language:t.groups?.language??""})));vt(afe,{displayName:"InputRule",group:"CodeBlock"});var qF=hn("CreateCodeBlock",e=>(t="")=>hx(CT.type(e),{language:t}));vt(qF,{displayName:"Command",group:"CodeBlock"});var kut=hn("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(r,n)=>e>=0?(n?.(r.tr.setNodeAttribute(e,"language",t)),!0):!1);vt(kut,{displayName:"Command",group:"CodeBlock"});var VF=nl("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{let t=e.get(Gn);return()=>t.call(qF.key)}}});vt(VF.ctx,{displayName:"KeymapCtx",group:"CodeBlock"});vt(VF.shortcuts,{displayName:"Keymap",group:"CodeBlock"});var WF=du("image");vt(WF,{displayName:"Attr",group:"Image"});var Sx=Ba("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",title:t.getAttribute("title")||t.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(WF.key)(t),...t.attrs}],parseMarkdown:{match:({type:t})=>t==="image",runner:(t,r,n)=>{let i=r.url,a=r.alt,s=r.title;t.addNode(n,{src:i,alt:a,title:s})}},toMarkdown:{match:t=>t.type.name==="image",runner:(t,r)=>{t.addNode("image",void 0,void 0,{title:r.attrs.title,url:r.attrs.src,alt:r.attrs.alt})}}}));vt(Sx.node,{displayName:"NodeSchema",group:"Image"});vt(Sx.ctx,{displayName:"NodeSchemaCtx",group:"Image"});var sfe=hn("InsertImage",e=>(t={})=>(r,n)=>{if(!n)return!0;let{src:i="",alt:a="",title:s=""}=t,o=Sx.type(e).create({src:i,alt:a,title:s});return o&&n(r.tr.replaceSelectionWith(o).scrollIntoView()),!0});vt(sfe,{displayName:"Command",group:"Image"});var ofe=hn("UpdateImage",e=>(t={})=>(r,n)=>{let i=oue(r.selection,Sx.type(e));if(!i)return!1;let{node:a,pos:s}=i,o={...a.attrs},{src:l,alt:u,title:h}=t;return l!==void 0&&(o.src=l),u!==void 0&&(o.alt=u),h!==void 0&&(o.title=h),n?.(r.tr.setNodeMarkup(s,void 0,o).scrollIntoView()),!0});vt(ofe,{displayName:"Command",group:"Image"});var Tut=Oo(e=>new Pa(/!\[(?.*?)]\((?.*?)\s*(?="|\))"?(?[^"]+)?"?\)/,(t,r,n,i)=>{let[a,s,o="",l]=r;return a?t.tr.replaceWith(n,i,Sx.type(e).create({src:o,alt:s,title:l})):null}));vt(Tut,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var g7=du("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));vt(g7,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var V1=Ba("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(g7.key)(t)," "]:["br",e.get(g7.key)(t)],parseMarkdown:{match:({type:t})=>t==="break",runner:(t,r,n)=>{t.addNode(n,{isInline:!!r.data?.isInline})}},leafText:()=>` +`),i;function a(s){return n.stack.push(s),o;function o(){n.stack.pop()}}}function qst(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function Vst(e){let t=e;throw new Error("Cannot handle unknown node `"+t.type+"`")}function Wst(e,t){if(e.type==="definition"&&e.type===t.type)return 0}function Hst(e,t){return Lle(e,this,t)}function Ust(e,t){return Ile(e,this,t)}function Yst(e,t){return Dle(this,e,t)}function tx(e){let t=this;t.compiler=r;function r(n){return UP(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function YP(e){if(e)throw e}var LE=Ro(Wle(),1);function Bk(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function XP(){let e=[],t={run:r,use:n};return t;function r(...i){let a=-1,s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...i);function o(l,...u){let h=e[++a],f=-1;if(l){s(l);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,h?Hle(h,o)(...u):s(null,...u)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Hle(e,t){let r;return n;function n(...s){let o=e.length>s.length,l;o&&s.push(i);try{l=e.apply(this,s)}catch(u){let h=u;if(o&&r)throw h;return i(h)}o||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(s,...o){r||(r=!0,t(s,...o))}function a(s){i(null,s)}}var Ls=class extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},s=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(s=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?a.ruleId=n:(a.source=n.slice(0,l),a.ruleId=n.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=Rp(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Ls.prototype.file="";Ls.prototype.name="";Ls.prototype.reason="";Ls.prototype.message="";Ls.prototype.stack="";Ls.prototype.column=void 0;Ls.prototype.line=void 0;Ls.prototype.ancestors=void 0;Ls.prototype.cause=void 0;Ls.prototype.fatal=void 0;Ls.prototype.place=void 0;Ls.prototype.ruleId=void 0;Ls.prototype.source=void 0;var Qu={basename:Xst,dirname:jst,extname:Kst,join:Zst,sep:"/"};function Xst(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fk(e);let r=0,n=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let s=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else s<0&&(a=!0,s=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(n=i):(o=-1,n=s));return r===n?n=s:n<0&&(n=e.length),e.slice(r,n)}function jst(e){if(Fk(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Kst(e){Fk(e);let t=e.length,r=-1,n=0,i=-1,a=0,s;for(;t--;){let o=e.codePointAt(t);if(o===47){if(s){n=t+1;break}continue}r<0&&(s=!0,r=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function Zst(...e){let t=-1,r;for(;++t<e.length;)Fk(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":Qst(r)}function Qst(e){Fk(e);let t=e.codePointAt(0)===47,r=Jst(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Jst(e,t){let r="",n=0,i=-1,a=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=s,a=0;continue}}else if(r.length>0){r="",n=0,i=s,a=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,s):r=e.slice(i+1,s),n=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return r}function Fk(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var Ule={cwd:eot};function eot(){return"/"}function rx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Yle(e){if(typeof e=="string")e=new URL(e);else if(!rx(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return tot(e)}function tot(e){if(e.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let t=e.pathname,r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){let n=t.codePointAt(r+2);if(n===70||n===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}var jP=["history","path","basename","stem","extname","dirname"],$k=class{constructor(t){let r;t?rx(t)?r={path:t}:typeof t=="string"||rot(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":Ule.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<jP.length;){let a=jP[n];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let i;for(i in r)jP.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Qu.basename(this.path):void 0}set basename(t){ZP(t,"basename"),KP(t,"basename"),this.path=Qu.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Qu.dirname(this.path):void 0}set dirname(t){Xle(this.basename,"dirname"),this.path=Qu.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Qu.extname(this.path):void 0}set extname(t){if(KP(t,"extname"),Xle(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Qu.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){rx(t)&&(t=Yle(t)),ZP(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Qu.basename(this.path,this.extname):void 0}set stem(t){ZP(t,"stem"),KP(t,"stem"),this.path=Qu.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){let i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){let i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){let i=new Ls(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}};function KP(e,t){if(e&&e.includes(Qu.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Qu.sep+"`")}function ZP(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Xle(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function rot(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var jle=(function(e){let n=this.constructor.prototype,i=n[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,n),a});var not={}.hasOwnProperty,tB=class e extends jle{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=XP()}copy(){let t=new e,r=-1;for(;++r<this.attachers.length;){let n=this.attachers[r];t.use(...n)}return t.data((0,LE.default)(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(eB("data",this.frozen),this.namespace[t]=r,this):not.call(this.namespace,t)&&this.namespace[t]||void 0:t?(eB("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;let t=this;for(;++this.freezeIndex<this.attachers.length;){let[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let i=r.call(t,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();let r=RE(t),n=this.parser||this.Parser;return QP("parse",n),n(String(r),r)}process(t,r){let n=this;return this.freeze(),QP("process",this.parser||this.Parser),JP("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(a,s){let o=RE(t),l=n.parse(o);n.run(l,o,function(h,f,d){if(h||!f||!d)return u(h);let p=f,m=n.stringify(p,d);aot(m)?d.value=m:d.result=m,u(h,d)});function u(h,f){h||!f?s(h):a?a(f):r(void 0,f)}}}processSync(t){let r=!1,n;return this.freeze(),QP("processSync",this.parser||this.Parser),JP("processSync",this.compiler||this.Compiler),this.process(t,i),Zle("processSync","process",r),n;function i(a,s){r=!0,YP(a),n=s}}run(t,r,n){Kle(t),this.freeze();let i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?a(void 0,n):new Promise(a);function a(s,o){let l=RE(r);i.run(t,l,u);function u(h,f,d){let p=f||t;h?o(h):s?s(p):n(void 0,p,d)}}}runSync(t,r){let n=!1,i;return this.run(t,r,a),Zle("runSync","run",n),i;function a(s,o){YP(s),i=o,n=!0}}stringify(t,r){this.freeze();let n=RE(r),i=this.compiler||this.Compiler;return JP("stringify",i),Kle(t),i(t,n)}use(t,...r){let n=this.attachers,i=this.namespace;if(eB("use",this.frozen),t!=null)if(typeof t=="function")l(t,r);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){let[h,...f]=u;l(h,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(i.settings=(0,LE.default)(!0,i.settings,u.settings))}function o(u){let h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){let f=u[h];a(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,h){let f=-1,d=-1;for(;++f<n.length;)if(n[f][0]===u){d=f;break}if(d===-1)n.push([u,...h]);else if(h.length>0){let[p,...m]=h,g=n[d][1];Bk(g)&&Bk(p)&&(p=(0,LE.default)(!0,g,p)),n[d]=[u,p,...m]}}}},zk=new tB().freeze();function QP(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function JP(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function eB(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Kle(e){if(!Bk(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Zle(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function RE(e){return iot(e)?e:new $k(e)}function iot(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function aot(e){return typeof e=="string"||sot(e)}function sot(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}function Mo(e){this.content=e}Mo.prototype={constructor:Mo,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,r){var n=r&&r!=e?this.remove(r):this,i=n.find(e),a=n.content.slice();return i==-1?a.push(r||e,t):(a[i+1]=t,r&&(a[i]=r)),new Mo(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var r=this.content.slice();return r.splice(t,2),new Mo(r)},addToStart:function(e,t){return new Mo([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new Mo(r)},addBefore:function(e,t,r){var n=this.remove(t),i=n.content.slice(),a=n.find(e);return i.splice(a==-1?i.length:a,0,t,r),new Mo(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Mo.from(e),e.size?new Mo(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Mo.from(e),e.size?new Mo(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Mo.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},toObject:function(){var e={};return this.forEach(function(t,r){e[t]=r}),e},get size(){return this.content.length>>1}};Mo.from=function(e){if(e instanceof Mo)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new Mo(t)};var rB=Mo;function oce(e,t,r){for(let n=0;;n++){if(n==e.childCount||n==t.childCount)return e.childCount==t.childCount?null:r;let i=e.child(n),a=t.child(n);if(i==a){r+=i.nodeSize;continue}if(!i.sameMarkup(a))return r;if(i.isText&&i.text!=a.text){let s=i.text,o=a.text,l=0;for(;s[l]==o[l];l++)r++;return l&&l<s.length&&l<o.length&&uce(s.charCodeAt(l-1))&&cce(s.charCodeAt(l))&&r--,r}if(i.content.size||a.content.size){let s=oce(i.content,a.content,r+1);if(s!=null)return s}r+=i.nodeSize}}function lce(e,t,r,n){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:r,b:n};let s=e.child(--i),o=t.child(--a),l=s.nodeSize;if(s==o){r-=l,n-=l;continue}if(!s.sameMarkup(o))return{a:r,b:n};if(s.isText&&s.text!=o.text){let u=s.text,h=o.text,f=u.length,d=h.length;for(;f>0&&d>0&&u[f-1]==h[d-1];)f--,d--,r--,n--;return f&&d&&f<u.length&&uce(u.charCodeAt(f-1))&&cce(u.charCodeAt(f))&&(r++,n++),{a:r,b:n}}if(s.content.size||o.content.size){let u=lce(s.content,o.content,r-1,n-1);if(u)return u}r-=l,n-=l}}function cce(e){return e>=56320&&e<57344}function uce(e){return e>=55296&&e<56320}var Lt=class e{constructor(t,r){if(this.content=t,this.size=r||0,r==null)for(let n=0;n<t.length;n++)this.size+=t[n].nodeSize}nodesBetween(t,r,n,i=0,a){for(let s=0,o=0;o<r;s++){let l=this.content[s],u=o+l.nodeSize;if(u>t&&n(l,i+o,a||null,s)!==!1&&l.content.size){let h=o+1;l.nodesBetween(Math.max(0,t-h),Math.min(l.content.size,r-h),n,i+h)}o=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,r,n,i){let a="",s=!0;return this.nodesBetween(t,r,(o,l)=>{let u=o.isText?o.text.slice(Math.max(t,l)-l,r-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&n&&(s?s=!1:a+=n),a+=u},0),a}append(t){if(!t.size)return this;if(!this.size)return t;let r=this.lastChild,n=t.firstChild,i=this.content.slice(),a=0;for(r.isText&&r.sameMarkup(n)&&(i[i.length-1]=r.withText(r.text+n.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,r=this.size){if(t==0&&r==this.size)return this;let n=[],i=0;if(r>t)for(let a=0,s=0;s<r;a++){let o=this.content[a],l=s+o.nodeSize;l>t&&((s<t||l>r)&&(o.isText?o=o.cut(Math.max(0,t-s),Math.min(o.text.length,r-s)):o=o.cut(Math.max(0,t-s-1),Math.min(o.content.size,r-s-1))),n.push(o),i+=o.nodeSize),s=l}return new e(n,i)}cutByIndex(t,r){return t==r?e.empty:t==0&&r==this.content.length?this:new e(this.content.slice(t,r))}replaceChild(t,r){let n=this.content[t];if(n==r)return this;let i=this.content.slice(),a=this.size+r.nodeSize-n.nodeSize;return i[t]=r,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let r=0;r<this.content.length;r++)if(!this.content[r].eq(t.content[r]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let r=this.content[t];if(!r)throw new RangeError("Index "+t+" out of range for "+this);return r}maybeChild(t){return this.content[t]||null}forEach(t){for(let r=0,n=0;r<this.content.length;r++){let i=this.content[r];t(i,n,r),n+=i.nodeSize}}findDiffStart(t,r=0){return oce(this,t,r)}findDiffEnd(t,r=this.size,n=t.size){return lce(this,t,r,n)}findIndex(t){if(t==0)return IE(0,t);if(t==this.size)return IE(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=this.child(r),a=n+i.nodeSize;if(a>=t)return a==t?IE(r+1,a):IE(r,n);n=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,r){if(!r)return e.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(r.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let r,n=0;for(let i=0;i<t.length;i++){let a=t[i];n+=a.nodeSize,i&&a.isText&&t[i-1].sameMarkup(a)?(r||(r=t.slice(0,i)),r[r.length-1]=a.withText(r[r.length-1].text+a.text)):r&&r.push(a)}return new e(r||t,n)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Lt.empty=new Lt([],0);var nB={index:0,offset:0};function IE(e,t){return nB.index=e,nB.offset=t,nB}function DE(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!DE(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!DE(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var In=class e{constructor(t,r){this.type=t,this.attrs=r}addToSet(t){let r,n=!1;for(let i=0;i<t.length;i++){let a=t[i];if(this.eq(a))return t;if(this.type.excludes(a.type))r||(r=t.slice(0,i));else{if(a.type.excludes(this.type))return t;!n&&a.type.rank>this.type.rank&&(r||(r=t.slice(0,i)),r.push(this),n=!0),r&&r.push(a)}}return r||(r=t.slice()),n||r.push(this),r}removeFromSet(t){for(let r=0;r<t.length;r++)if(this.eq(t[r]))return t.slice(0,r).concat(t.slice(r+1));return t}isInSet(t){for(let r=0;r<t.length;r++)if(this.eq(t[r]))return!0;return!1}eq(t){return this==t||this.type==t.type&&DE(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[r.type];if(!n)throw new RangeError(`There is no mark type ${r.type} in this schema`);let i=n.create(r.attrs);return n.checkAttrs(i.attrs),i}static sameSet(t,r){if(t==r)return!0;if(t.length!=r.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(r[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let r=t.slice();return r.sort((n,i)=>n.type.rank-i.type.rank),r}};In.none=[];var Mp=class extends Error{},Xt=class e{constructor(t,r,n){this.content=t,this.openStart=r,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,r){let n=fce(this.content,t+this.openStart,r,this.openStart+1,this.openEnd+1);return n&&new e(n,this.openStart,this.openEnd)}removeBetween(t,r){return new e(hce(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,r){if(!r)return e.empty;let n=r.openStart||0,i=r.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new e(Lt.fromJSON(t,r.content),n,i)}static maxOpen(t,r=!0){let n=0,i=0;for(let a=t.firstChild;a&&!a.isLeaf&&(r||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=t.lastChild;a&&!a.isLeaf&&(r||!a.type.spec.isolating);a=a.lastChild)i++;return new e(t,n,i)}};Xt.empty=new Xt(Lt.empty,0,0);function hce(e,t,r){let{index:n,offset:i}=e.findIndex(t),a=e.maybeChild(n),{index:s,offset:o}=e.findIndex(r);if(i==t||a.isText){if(o!=r&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(r))}if(n!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(n,a.copy(hce(a.content,t-i-1,r-i-1)))}function fce(e,t,r,n,i,a){let{index:s,offset:o}=e.findIndex(t),l=e.maybeChild(s);if(o==t||l.isText)return a&&n<=0&&i<=0&&!a.canReplace(s,s,r)?null:e.cut(0,t).append(r).append(e.cut(t));let u=fce(l.content,t-o-1,r,s==0?n-1:0,s==e.childCount-1?i-1:0,l);return u&&e.replaceChild(s,l.copy(u))}function oot(e,t,r){if(r.openStart>e.depth)throw new Mp("Inserted content deeper than insertion position");if(e.depth-r.openStart!=t.depth-r.openEnd)throw new Mp("Inconsistent open depths");return dce(e,t,r,0)}function dce(e,t,r,n){let i=e.index(n),a=e.node(n);if(i==t.index(n)&&n<e.depth-r.openStart){let s=dce(e,t,r,n+1);return a.copy(a.content.replaceChild(i,s))}else if(r.content.size)if(!r.openStart&&!r.openEnd&&e.depth==n&&t.depth==n){let s=e.parent,o=s.content;return b1(s,o.cut(0,e.parentOffset).append(r.content).append(o.cut(t.parentOffset)))}else{let{start:s,end:o}=lot(r,e);return b1(a,mce(e,s,o,t,n))}else return b1(a,OE(e,t,n))}function pce(e,t){if(!t.type.compatibleContent(e.type))throw new Mp("Cannot join "+t.type.name+" onto "+e.type.name)}function iB(e,t,r){let n=e.node(r);return pce(n,t.node(r)),n}function x1(e,t){let r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function Gk(e,t,r,n){let i=(t||e).node(r),a=0,s=t?t.index(r):i.childCount;e&&(a=e.index(r),e.depth>r?a++:e.textOffset&&(x1(e.nodeAfter,n),a++));for(let o=a;o<s;o++)x1(i.child(o),n);t&&t.depth==r&&t.textOffset&&x1(t.nodeBefore,n)}function b1(e,t){if(!e.type.validContent(t))throw new Mp("Invalid content for node "+e.type.name);return e.copy(t)}function mce(e,t,r,n,i){let a=e.depth>i&&iB(e,t,i+1),s=n.depth>i&&iB(r,n,i+1),o=[];return Gk(null,e,i,o),a&&s&&t.index(i)==r.index(i)?(pce(a,s),x1(b1(a,mce(e,t,r,n,i+1)),o)):(a&&x1(b1(a,OE(e,t,i+1)),o),Gk(t,r,i,o),s&&x1(b1(s,OE(r,n,i+1)),o)),Gk(n,null,i,o),new Lt(o)}function OE(e,t,r){let n=[];if(Gk(null,e,r,n),e.depth>r){let i=iB(e,t,r+1);x1(b1(i,OE(e,t,r+1)),n)}return Gk(t,null,r,n),new Lt(n)}function lot(e,t){let r=t.depth-e.openStart,i=t.node(r).copy(e.content);for(let a=r-1;a>=0;a--)i=t.node(a).copy(Lt.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}var PE=class e{constructor(t,r,n){this.pos=t,this.path=r,this.parentOffset=n,this.depth=r.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,r=this.index(this.depth);if(r==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=t.child(r);return n?t.child(r).cut(n):i}get nodeBefore(){let t=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(t).cut(0,r):t==0?null:this.parent.child(t-1)}posAtIndex(t,r){r=this.resolveDepth(r);let n=this.path[r*3],i=r==0?0:this.path[r*3-1]+1;for(let a=0;a<t;a++)i+=n.child(a).nodeSize;return i}marks(){let t=this.parent,r=this.index();if(t.content.size==0)return In.none;if(this.textOffset)return t.child(r).marks;let n=t.maybeChild(r-1),i=t.maybeChild(r);if(!n){let o=n;n=i,i=o}let a=n.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(t){let r=this.parent.maybeChild(this.index());if(!r||!r.isInline)return null;let n=r.marks,i=t.parent.maybeChild(t.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(t){for(let r=this.depth;r>0;r--)if(this.start(r)<=t&&this.end(r)>=t)return r;return 0}blockRange(t=this,r){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!r||r(this.node(n))))return new Vk(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let r=1;r<=this.depth;r++)t+=(t?"/":"")+this.node(r).type.name+"_"+this.index(r-1);return t+":"+this.parentOffset}static resolve(t,r){if(!(r>=0&&r<=t.content.size))throw new RangeError("Position "+r+" out of range");let n=[],i=0,a=r;for(let s=t;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(n.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new e(r,n,a)}static resolveCached(t,r){let n=Qle.get(t);if(n)for(let a=0;a<n.elts.length;a++){let s=n.elts[a];if(s.pos==r)return s}else Qle.set(t,n=new aB);let i=n.elts[n.i]=e.resolve(t,r);return n.i=(n.i+1)%cot,i}},aB=class{constructor(){this.elts=[],this.i=0}},cot=12,Qle=new WeakMap,Vk=class{constructor(t,r,n){this.$from=t,this.$to=r,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},uot=Object.create(null),$l=class e{constructor(t,r,n,i=In.none){this.type=t,this.attrs=r,this.marks=i,this.content=n||Lt.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,r,n,i=0){this.content.nodesBetween(t,r,n,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,r,n,i){return this.content.textBetween(t,r,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,r,n){return this.type==t&&DE(this.attrs,r||t.defaultAttrs||uot)&&In.sameSet(this.marks,n||In.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(t,r=this.content.size){return t==0&&r==this.content.size?this:this.copy(this.content.cut(t,r))}slice(t,r=this.content.size,n=!1){if(t==r)return Xt.empty;let i=this.resolve(t),a=this.resolve(r),s=n?0:i.sharedDepth(r),o=i.start(s),u=i.node(s).content.cut(i.pos-o,a.pos-o);return new Xt(u,i.depth-s,a.depth-s)}replace(t,r,n){return oot(this.resolve(t),this.resolve(r),n)}nodeAt(t){for(let r=this;;){let{index:n,offset:i}=r.content.findIndex(t);if(r=r.maybeChild(n),!r)return null;if(i==t||r.isText)return r;t-=i+1}}childAfter(t){let{index:r,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(r),index:r,offset:n}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:r,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(r),index:r,offset:n};let i=this.content.child(r-1);return{node:i,index:r-1,offset:n-i.nodeSize}}resolve(t){return PE.resolveCached(this,t)}resolveNoCache(t){return PE.resolve(this,t)}rangeHasMark(t,r,n){let i=!1;return r>t&&this.nodesBetween(t,r,a=>(n.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),gce(this.marks,t)}contentMatchAt(t){let r=this.type.contentMatch.matchFragment(this.content,0,t);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(t,r,n=Lt.empty,i=0,a=n.childCount){let s=this.contentMatchAt(t).matchFragment(n,i,a),o=s&&s.matchFragment(this.content,r);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(t,r,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(t).matchType(n),s=a&&a.matchFragment(this.content,r);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=In.none;for(let r=0;r<this.marks.length;r++){let n=this.marks[r];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!In.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(r=>r.type.name)}`);this.content.forEach(r=>r.check())}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(r=>r.toJSON())),t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let n;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=r.marks.map(t.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(r.text,n)}let i=Lt.fromJSON(t,r.content),a=t.nodeType(r.type).create(r.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};$l.prototype.text=void 0;var sB=class e extends $l{constructor(t,r,n,i){if(super(t,r,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):gce(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,r){return this.text.slice(t,r)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(t=0,r=this.text.length){return t==0&&r==this.text.length?this:this.withText(this.text.slice(t,r))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}};function gce(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}var w1=class e{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,r){let n=new oB(t,r);if(n.next==null)return e.empty;let i=yce(n);n.next&&n.err("Unexpected trailing text");let a=yot(got(i));return vot(a,n),a}matchType(t){for(let r=0;r<this.next.length;r++)if(this.next[r].type==t)return this.next[r].next;return null}matchFragment(t,r=0,n=t.childCount){let i=this;for(let a=r;i&&a<n;a++)i=i.matchType(t.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:r}=this.next[t];if(!(r.isText||r.hasRequiredAttrs()))return r}return null}compatible(t){for(let r=0;r<this.next.length;r++)for(let n=0;n<t.next.length;n++)if(this.next[r].type==t.next[n].type)return!0;return!1}fillBefore(t,r=!1,n=0){let i=[this];function a(s,o){let l=s.matchFragment(t,n);if(l&&(!r||l.validEnd))return Lt.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:h,next:f}=s.next[u];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=a(f,o.concat(h));if(d)return d}}return null}return a(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let r=this.computeWrapping(t);return this.wrapCache.push(t,r),r}computeWrapping(t){let r=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(t)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in r)&&(!i.type||l.validEnd)&&(n.push({match:o.contentMatch,type:o,via:i}),r[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function r(n){t.push(n);for(let i=0;i<n.next.length;i++)t.indexOf(n.next[i].next)==-1&&r(n.next[i].next)}return r(this),t.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let s=0;s<n.next.length;s++)a+=(s?", ":"")+n.next[s].type.name+"->"+t.indexOf(n.next[s].next);return a}).join(` +`)}};w1.empty=new w1(!0);var oB=class{constructor(t,r){this.string=t,this.nodeTypes=r,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function yce(e){let t=[];do t.push(hot(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function hot(e){let t=[];do t.push(fot(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function fot(e){let t=mot(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=dot(e,t);else break;return t}function Jle(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function dot(e,t){let r=Jle(e),n=r;return e.eat(",")&&(e.next!="}"?n=Jle(e):n=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}function pot(e,t){let r=e.nodeTypes,n=r[t];if(n)return[n];let i=[];for(let a in r){let s=r[a];s.isInGroup(t)&&i.push(s)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function mot(e){if(e.eat("(")){let t=yce(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=pot(e,e.next).map(r=>(e.inline==null?e.inline=r.isInline:e.inline!=r.isInline&&e.err("Mixing inline and block content"),{type:"name",value:r}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function got(e){let t=[[]];return i(a(e,0),r()),t;function r(){return t.push([])-1}function n(s,o,l){let u={term:l,to:o};return t[s].push(u),u}function i(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(a(u,o)),[]);if(s.type=="seq")for(let l=0;;l++){let u=a(s.exprs[l],o);if(l==s.exprs.length-1)return u;i(u,o=r())}else if(s.type=="star"){let l=r();return n(o,l),i(a(s.expr,l),l),[n(l)]}else if(s.type=="plus"){let l=r();return i(a(s.expr,o),l),i(a(s.expr,l),l),[n(l)]}else{if(s.type=="opt")return[n(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let u=0;u<s.min;u++){let h=r();i(a(s.expr,l),h),l=h}if(s.max==-1)i(a(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let h=r();n(l,h),i(a(s.expr,l),h),l=h}return[n(l)]}else{if(s.type=="name")return[n(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function vce(e,t){return t-e}function ece(e,t){let r=[];return n(t),r.sort(vce);function n(i){let a=e[i];if(a.length==1&&!a[0].term)return n(a[0].to);r.push(i);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&r.indexOf(l)==-1&&n(l)}}}function yot(e){let t=Object.create(null);return r(ece(e,0));function r(n){let i=[];n.forEach(s=>{e[s].forEach(({term:o,to:l})=>{if(!o)return;let u;for(let h=0;h<i.length;h++)i[h][0]==o&&(u=i[h][1]);ece(e,l).forEach(h=>{u||i.push([o,u=[]]),u.indexOf(h)==-1&&u.push(h)})})});let a=t[n.join(",")]=new w1(n.indexOf(e.length-1)>-1);for(let s=0;s<i.length;s++){let o=i[s][1].sort(vce);a.next.push({type:i[s][0],next:t[o.join(",")]||r(o)})}return a}}function vot(e,t){for(let r=0,n=[e];r<n.length;r++){let i=n[r],a=!i.validEnd,s=[];for(let o=0;o<i.next.length;o++){let{type:l,next:u}=i.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),n.indexOf(u)==-1&&n.push(u)}a&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function xce(e){let t=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;t[r]=n.default}return t}function bce(e,t){let r=Object.create(null);for(let n in e){let i=t&&t[n];if(i===void 0){let a=e[n];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+n)}r[n]=i}return r}function wce(e,t,r,n){for(let i in t)if(!(i in e))throw new RangeError(`Unsupported attribute ${i} for ${r} of type ${n}`);for(let i in e)e[i].validate&&e[i].validate(t[i])}function kce(e,t){let r=Object.create(null);if(t)for(let n in t)r[n]=new lB(e,n,t[n]);return r}var Wk=class e{constructor(t,r,n){this.name=t,this.schema=r,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=kce(t,n.attrs),this.defaultAttrs=xce(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==w1.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:bce(this.attrs,t)}create(t=null,r,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new $l(this,this.computeAttrs(t),Lt.from(r),In.setFrom(n))}createChecked(t=null,r,n){return r=Lt.from(r),this.checkContent(r),new $l(this,this.computeAttrs(t),r,In.setFrom(n))}createAndFill(t=null,r,n){if(t=this.computeAttrs(t),r=Lt.from(r),r.size){let s=this.contentMatch.fillBefore(r);if(!s)return null;r=s.append(r)}let i=this.contentMatch.matchFragment(r),a=i&&i.fillBefore(Lt.empty,!0);return a?new $l(this,t,r.append(a),In.setFrom(n)):null}validContent(t){let r=this.contentMatch.matchFragment(t);if(!r||!r.validEnd)return!1;for(let n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){wce(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let r=0;r<t.length;r++)if(!this.allowsMarkType(t[r].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let r;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?r&&r.push(t[n]):r||(r=t.slice(0,n));return r?r.length?r:In.none:t}static compile(t,r){let n=Object.create(null);t.forEach((a,s)=>n[a]=new e(a,r,s));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let a in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function xot(e,t,r){let n=r.split("|");return i=>{let a=i===null?"null":typeof i;if(n.indexOf(a)<0)throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${a}`)}}var lB=class{constructor(t,r,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?xot(t,r,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Hk=class e{constructor(t,r,n,i){this.name=t,this.rank=r,this.schema=n,this.spec=i,this.attrs=kce(t,i.attrs),this.excluded=null;let a=xce(this.attrs);this.instance=a?new In(this,a):null}create(t=null){return!t&&this.instance?this.instance:new In(this,bce(this.attrs,t))}static compile(t,r){let n=Object.create(null),i=0;return t.forEach((a,s)=>n[a]=new e(a,i++,r,s)),n}removeFromSet(t){for(var r=0;r<t.length;r++)t[r].type==this&&(t=t.slice(0,r).concat(t.slice(r+1)),r--);return t}isInSet(t){for(let r=0;r<t.length;r++)if(t[r].type==this)return t[r]}checkAttrs(t){wce(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}},BE=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let i in t)r[i]=t[i];r.nodes=rB.from(t.nodes),r.marks=rB.from(t.marks||{}),this.nodes=Wk.compile(this.spec.nodes,this),this.marks=Hk.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=n[s]||(n[s]=w1.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?tce(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:tce(this,s.split(" "))}this.nodeFromJSON=i=>$l.fromJSON(this,i),this.markFromJSON=i=>In.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,r=null,n,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Wk){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(r,n,i)}text(t,r){let n=this.nodes.text;return new sB(n,n.defaultAttrs,t,In.setFrom(r))}mark(t,r){return typeof t=="string"&&(t=this.marks[t]),t.create(r)}nodeType(t){let r=this.nodes[t];if(!r)throw new RangeError("Unknown node type: "+t);return r}};function tce(e,t){let r=[];for(let n=0;n<t.length;n++){let i=t[n],a=e.marks[i],s=a;if(a)r.push(a);else for(let o in e.marks){let l=e.marks[o];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&r.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[n]+"'")}return r}function bot(e){return e.tag!=null}function wot(e){return e.style!=null}var Uh=class e{constructor(t,r){this.schema=t,this.rules=r,this.tags=[],this.styles=[];let n=this.matchedStyles=[];r.forEach(i=>{if(bot(i))this.tags.push(i);else if(wot(i)){let a=/[^=]*/.exec(i.style)[0];n.indexOf(a)<0&&n.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=t.nodes[i.node];return a.contentMatch.matchType(a)})}parse(t,r={}){let n=new FE(this,r,!1);return n.addAll(t,In.none,r.from,r.to),n.finish()}parseSlice(t,r={}){let n=new FE(this,r,!0);return n.addAll(t,In.none,r.from,r.to),Xt.maxOpen(n.finish())}matchTag(t,r,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(Cot(t,a.tag)&&(a.namespace===void 0||t.namespaceURI==a.namespace)&&(!a.context||r.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(t);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(t,r,n,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(t)!=0||s.context&&!n.matchesContext(s.context)||o.length>t.length&&(o.charCodeAt(t.length)!=61||o.slice(t.length+1)!=r))){if(s.getAttrs){let l=s.getAttrs(r);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let r=[];function n(i){let a=i.priority==null?50:i.priority,s=0;for(;s<r.length;s++){let o=r[s];if((o.priority==null?50:o.priority)<a)break}r.splice(s,0,i)}for(let i in t.marks){let a=t.marks[i].spec.parseDOM;a&&a.forEach(s=>{n(s=nce(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in t.nodes){let a=t.nodes[i].spec.parseDOM;a&&a.forEach(s=>{n(s=nce(s)),s.node||s.ignore||s.mark||(s.node=i)})}return r}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Tce={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},kot={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Cce={ol:!0,ul:!0},Uk=1,cB=2,qk=4;function rce(e,t,r){return t!=null?(t?Uk:0)|(t==="full"?cB:0):e&&e.whitespace=="pre"?Uk|cB:r&~qk}var nx=class{constructor(t,r,n,i,a,s){this.type=t,this.attrs=r,this.marks=n,this.solid=i,this.options=s,this.content=[],this.activeMarks=In.none,this.match=a||(s&qk?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let r=this.type.contentMatch.fillBefore(Lt.from(t));if(r)this.match=this.type.contentMatch.matchFragment(r);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(t.type))?(this.match=n,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Uk)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let a=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let r=Lt.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(Lt.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!Tce.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}},FE=class{constructor(t,r,n){this.parser=t,this.options=r,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=r.topNode,a,s=rce(null,r.preserveWhitespace,0)|(n?qk:0);i?a=new nx(i.type,i.attrs,In.none,!0,r.topMatch||i.type.contentMatch,s):n?a=new nx(null,null,In.none,!0,null,s):a=new nx(t.schema.topNodeType,null,In.none,!0,null,s),this.nodes=[a],this.find=r.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,r){t.nodeType==3?this.addTextNode(t,r):t.nodeType==1&&this.addElement(t,r)}addTextNode(t,r){let n=t.nodeValue,i=this.top,a=i.options&cB?"full":this.localPreserveWS||(i.options&Uk)>0,{schema:s}=this.parser;if(a==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(a)if(a==="full")n=n.replace(/\r\n?/g,` +`);else if(s.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=n.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),r,!0),o[l]&&this.insertNode(s.text(o[l]),r,!/\S/.test(o[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],l=t.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(s.text(n),r,!/\S/.test(n)),this.findInText(t)}else this.findInside(t)}addElement(t,r,n){let i=this.localPreserveWS,a=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s=t.nodeName.toLowerCase(),o;Cce.hasOwnProperty(s)&&this.parser.normalizeLists&&Tot(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,n));e:if(l?l.ignore:kot.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t,r);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let u,h=this.needsBlock;if(Tce.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),u=!0,a.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,r);break e}let f=l&&l.skip?r:this.readStyles(t,r);f&&this.addAll(t,f),u&&this.sync(a),this.needsBlock=h}else{let u=this.readStyles(t,r);u&&this.addElementByRule(t,l,u,l.consuming===!1?o:void 0)}this.localPreserveWS=i}leafFallback(t,r){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(` +`),r)}ignoreFallback(t,r){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),r,!0)}readStyles(t,r){let n=t.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],s=n.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?r=r.filter(u=>!l.clearMark(u)):r=r.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return r}addElementByRule(t,r,n,i){let a,s;if(r.node)if(s=this.parser.schema.nodes[r.node],s.isLeaf)this.insertNode(s.create(r.attrs),n,t.nodeName=="BR")||this.leafFallback(t,n);else{let l=this.enter(s,r.attrs||null,n,r.preserveWhitespace);l&&(a=!0,n=l)}else{let l=this.parser.schema.marks[r.mark];n=n.concat(l.create(r.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(t);else if(i)this.addElement(t,n,i);else if(r.getContent)this.findInside(t),r.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=t;typeof r.contentElement=="string"?l=t.querySelector(r.contentElement):typeof r.contentElement=="function"?l=r.contentElement(t):r.contentElement&&(l=r.contentElement),this.findAround(t,l,!0),this.addAll(l,n),this.findAround(t,l,!1)}a&&this.sync(o)&&this.open--}addAll(t,r,n,i){let a=n||0;for(let s=n?t.childNodes[n]:t.firstChild,o=i==null?null:t.childNodes[i];s!=o;s=s.nextSibling,++a)this.findAtPoint(t,a),this.addDOM(s,r);this.findAtPoint(t,a)}findPlace(t,r,n){let i,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(t);if(u&&(!i||i.length>u.length+o)&&(i=u,a=l,!u.length))break;if(l.solid){if(n)break;o+=2}}if(!i)return null;this.sync(a);for(let s=0;s<i.length;s++)r=this.enterInner(i[s],null,r,!1);return r}insertNode(t,r,n){if(t.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(r=this.enterInner(a,null,r))}let i=this.findPlace(t,r,n);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(t.type));let s=In.none;for(let o of i.concat(t.marks))(a.type?a.type.allowsMarkType(o.type):ice(o.type,t.type))&&(s=o.addToSet(s));return a.content.push(t.mark(s)),!0}return!1}enter(t,r,n,i){let a=this.findPlace(t.create(r),n,!1);return a&&(a=this.enterInner(t,r,n,!0,i)),a}enterInner(t,r,n,i=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let o=rce(t,a,s.options);s.options&qk&&s.content.length==0&&(o|=qk);let l=In.none;return n=n.filter(u=>(s.type?s.type.allowsMarkType(u.type):ice(u.type,t))?(l=u.addToSet(l),!1):!0),this.nodes.push(new nx(t,r,l,i,null,o)),this.open++,n}closeExtra(t=!1){let r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let r=this.open;r>=0;r--){if(this.nodes[r]==t)return this.open=r,!0;this.localPreserveWS&&(this.nodes[r].options|=Uk)}return!1}get currentPos(){this.closeExtra();let t=0;for(let r=this.open;r>=0;r--){let n=this.nodes[r].content;for(let i=n.length-1;i>=0;i--)t+=n[i].nodeSize;r&&t++}return t}findAtPoint(t,r){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==r&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&t.nodeType==1&&t.contains(this.find[r].node)&&(this.find[r].pos=this.currentPos)}findAround(t,r,n){if(t!=r&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&r.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&(this.find[r].pos=this.currentPos-(t.nodeValue.length-this.find[r].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let r=t.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),a=-(n?n.depth+1:0)+(i?0:1),s=(o,l)=>{for(;o>=0;o--){let u=r[o];if(u==""){if(o==r.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let h=l>0||l==0&&i?this.nodes[l].type:n&&l>=a?n.node(l-a).type:null;if(!h||h.name!=u&&!h.isInGroup(u))return!1;l--}}return!0};return s(r.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let r=t.depth;r>=0;r--){let n=t.node(r).contentMatchAt(t.indexAfter(r)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let r in this.parser.schema.nodes){let n=this.parser.schema.nodes[r];if(n.isTextblock&&n.defaultAttrs)return n}}};function Tot(e){for(let t=e.firstChild,r=null;t;t=t.nextSibling){let n=t.nodeType==1?t.nodeName.toLowerCase():null;n&&Cce.hasOwnProperty(n)&&r?(r.appendChild(t),t=r):n=="li"?r=t:n&&(r=null)}}function Cot(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function nce(e){let t={};for(let r in e)t[r]=e[r];return t}function ice(e,t){let r=t.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:u,next:h}=o.edge(l);if(u==t||a.indexOf(h)<0&&s(h))return!0}};if(s(i.contentMatch))return!0}}var Yh=class e{constructor(t,r){this.nodes=t,this.marks=r}serializeFragment(t,r={},n){n||(n=ME(r).createDocumentFragment());let i=n,a=[];return t.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(a[o][0])||u.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)i=a.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],h=this.serializeMark(u,s.isInline,r);h&&(a.push([u,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(s,r))}),n}serializeNodeInner(t,r){if(t.isText)return ME(r).createTextNode(t.text);let{dom:n,contentDOM:i}=NE(ME(r),this.nodes[t.type.name](t),null,t.attrs);if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,r,i)}return n}serializeNode(t,r={}){let n=this.serializeNodeInner(t,r);for(let i=t.marks.length-1;i>=0;i--){let a=this.serializeMark(t.marks[i],t.isInline,r);a&&((a.contentDOM||a.dom).appendChild(n),n=a.dom)}return n}serializeMark(t,r,n={}){let i=this.marks[t.type.name];return i&&NE(ME(n),i(t,r),null,t.attrs)}static renderSpec(t,r,n=null,i){return typeof r=="string"?{dom:t.createTextNode(r)}:NE(t,r,n,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let r=ace(t.nodes);return r.text||(r.text=n=>n.text),r}static marksFromSchema(t){return ace(t.marks)}};function ace(e){let t={};for(let r in e){let n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function ME(e){return e.document||window.document}var sce=new WeakMap;function Sot(e){let t=sce.get(e);return t===void 0&&sce.set(e,t=Eot(e)),t}function Eot(e){let t=null;function r(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")t||(t=[]),t.push(n);else for(let i=0;i<n.length;i++)r(n[i]);else for(let i in n)r(n[i])}return r(e),t}function NE(e,t,r,n){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(a=Sot(n))&&a.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),u=t[1],h=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){h=2;for(let f in u)if(u[f]!=null){let d=f.indexOf(" ");d>0?l.setAttributeNS(f.slice(0,d),f.slice(d+1),u[f]):f=="style"&&l.style?l.style.cssText=u[f]:l.setAttribute(f,u[f])}}for(let f=h;f<t.length;f++){let d=t[f];if(d===0){if(f<t.length-1||f>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof d=="string")l.appendChild(e.createTextNode(d));else{let{dom:p,contentDOM:m}=NE(e,d,r,n);if(l.appendChild(p),m){if(o)throw new RangeError("Multiple content holes");o=m}}}return{dom:l,contentDOM:o}}var Ace=65535,_ce=Math.pow(2,16);function Aot(e,t){return e+t*_ce}function Sce(e){return e&Ace}function _ot(e){return(e-(e&Ace))/_ce}var Rce=1,Lce=2,$E=4,Ice=8,jk=class{constructor(t,r,n){this.pos=t,this.delInfo=r,this.recover=n}get deleted(){return(this.delInfo&Ice)>0}get deletedBefore(){return(this.delInfo&(Rce|$E))>0}get deletedAfter(){return(this.delInfo&(Lce|$E))>0}get deletedAcross(){return(this.delInfo&$E)>0}},Ld=class e{constructor(t,r=!1){if(this.ranges=t,this.inverted=r,!t.length&&e.empty)return e.empty}recover(t){let r=0,n=Sce(t);if(!this.inverted)for(let i=0;i<n;i++)r+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+r+_ot(t)}mapResult(t,r=1){return this._map(t,r,!1)}map(t,r=1){return this._map(t,r,!0)}_map(t,r,n){let i=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>t)break;let u=this.ranges[o+a],h=this.ranges[o+s],f=l+u;if(t<=f){let d=u?t==l?-1:t==f?1:r:r,p=l+i+(d<0?0:h);if(n)return p;let m=t==(r<0?l:f)?null:Aot(o/3,t-l),g=t==l?Lce:t==f?Rce:$E;return(r<0?t!=l:t!=f)&&(g|=Ice),new jk(p,g,m)}i+=h-u}return n?t+i:new jk(t+i,0,null)}touches(t,r){let n=0,i=Sce(r),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?n:0);if(l>t)break;let u=this.ranges[o+a],h=l+u;if(t<=h&&o==i*3)return!0;n+=this.ranges[o+s]-u}return!1}forEach(t){let r=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let s=this.ranges[i],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),u=this.ranges[i+r],h=this.ranges[i+n];t(o,o+u,l,l+h),a+=h-u}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Ld.empty=new Ld([]);var dB=class e{constructor(t,r,n=0,i=t?t.length:0){this.mirror=r,this.from=n,this.to=i,this._maps=t||[],this.ownData=!(t||r)}get maps(){return this._maps}slice(t=0,r=this.maps.length){return new e(this._maps,this.mirror,t,r)}appendMap(t,r){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),r!=null&&this.setMirror(this._maps.length-1,r)}appendMapping(t){for(let r=0,n=this._maps.length;r<t._maps.length;r++){let i=t.getMirror(r);this.appendMap(t._maps[r],i!=null&&i<r?n+i:void 0)}}getMirror(t){if(this.mirror){for(let r=0;r<this.mirror.length;r++)if(this.mirror[r]==t)return this.mirror[r+(r%2?-1:1)]}}setMirror(t,r){this.mirror||(this.mirror=[]),this.mirror.push(t,r)}appendMappingInverted(t){for(let r=t.maps.length-1,n=this._maps.length+t._maps.length;r>=0;r--){let i=t.getMirror(r);this.appendMap(t._maps[r].invert(),i!=null&&i>r?n-i-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(t,r=1){if(this.mirror)return this._map(t,r,!0);for(let n=this.from;n<this.to;n++)t=this._maps[n].map(t,r);return t}mapResult(t,r=1){return this._map(t,r,!1)}_map(t,r,n){let i=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(t,r);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,t=this._maps[l].recover(o.recover);continue}}i|=o.delInfo,t=o.pos}return n?t:new jk(t,i,null)}},uB=Object.create(null),Is=class{getMap(){return Ld.empty}merge(t){return null}static fromJSON(t,r){if(!r||!r.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=uB[r.stepType];if(!n)throw new RangeError(`No step type ${r.stepType} defined`);return n.fromJSON(t,r)}static jsonID(t,r){if(t in uB)throw new RangeError("Duplicate use of step JSON ID "+t);return uB[t]=r,r.prototype.jsonID=t,r}},js=class e{constructor(t,r){this.doc=t,this.failed=r}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,r,n,i){try{return e.ok(t.replace(r,n,i))}catch(a){if(a instanceof Mp)return e.fail(a.message);throw a}}};function gB(e,t,r){let n=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(gB(a.content,t,a))),a.isInline&&(a=t(a,r,i)),n.push(a)}return Lt.fromArray(n)}var k1=class e extends Is{constructor(t,r,n){super(),this.from=t,this.to=r,this.mark=n}apply(t){let r=t.slice(this.from,this.to),n=t.resolve(this.from),i=n.node(n.sharedDepth(this.to)),a=new Xt(gB(r.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),r.openStart,r.openEnd);return js.fromReplace(t,this.from,this.to,a)}invert(){return new T1(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};Is.jsonID("addMark",k1);var T1=class e extends Is{constructor(t,r,n){super(),this.from=t,this.to=r,this.mark=n}apply(t){let r=t.slice(this.from,this.to),n=new Xt(gB(r.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),r.openStart,r.openEnd);return js.fromReplace(t,this.from,this.to,n)}invert(){return new k1(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};Is.jsonID("removeMark",T1);var Kk=class e extends Is{constructor(t,r){super(),this.pos=t,this.mark=r}apply(t){let r=t.nodeAt(this.pos);if(!r)return js.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.addToSet(r.marks));return js.fromReplace(t,this.pos,this.pos+1,new Xt(Lt.from(n),0,r.isLeaf?0:1))}invert(t){let r=t.nodeAt(this.pos);if(r){let n=this.mark.addToSet(r.marks);if(n.length==r.marks.length){for(let i=0;i<r.marks.length;i++)if(!r.marks[i].isInSet(n))return new e(this.pos,r.marks[i]);return new e(this.pos,this.mark)}}return new ix(this.pos,this.mark)}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new e(r.pos,t.markFromJSON(r.mark))}};Is.jsonID("addNodeMark",Kk);var ix=class e extends Is{constructor(t,r){super(),this.pos=t,this.mark=r}apply(t){let r=t.nodeAt(this.pos);if(!r)return js.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.removeFromSet(r.marks));return js.fromReplace(t,this.pos,this.pos+1,new Xt(Lt.from(n),0,r.isLeaf?0:1))}invert(t){let r=t.nodeAt(this.pos);return!r||!this.mark.isInSet(r.marks)?this:new Kk(this.pos,this.mark)}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new e(r.pos,t.markFromJSON(r.mark))}};Is.jsonID("removeNodeMark",ix);var Ks=class e extends Is{constructor(t,r,n,i=!1){super(),this.from=t,this.to=r,this.slice=n,this.structure=i}apply(t){return this.structure&&pB(t,this.from,this.to)?js.fail("Structure replace would overwrite content"):js.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Ld([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let r=t.mapResult(this.to,-1),n=this.from==this.to&&e.MAP_BIAS<0?r:t.mapResult(this.from,1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let r=this.slice.size+t.slice.size==0?Xt.empty:new Xt(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let r=this.slice.size+t.slice.size==0?Xt.empty:new Xt(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,r,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(r.from,r.to,Xt.fromJSON(t,r.slice),!!r.structure)}};Ks.MAP_BIAS=1;Is.jsonID("replace",Ks);var Zs=class e extends Is{constructor(t,r,n,i,a,s,o=!1){super(),this.from=t,this.to=r,this.gapFrom=n,this.gapTo=i,this.slice=a,this.insert=s,this.structure=o}apply(t){if(this.structure&&(pB(t,this.from,this.gapFrom)||pB(t,this.gapTo,this.to)))return js.fail("Structure gap-replace would overwrite content");let r=t.slice(this.gapFrom,this.gapTo);if(r.openStart||r.openEnd)return js.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,r.content);return n?js.fromReplace(t,this.from,this.to,n):js.fail("Content does not fit in gap")}getMap(){return new Ld([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let r=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+r,this.from+this.insert,this.from+this.insert+r,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),i=this.from==this.gapFrom?r.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?n.pos:t.map(this.gapTo,1);return r.deletedAcross&&n.deletedAcross||i<r.pos||a>n.pos?null:new e(r.pos,n.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number"||typeof r.gapFrom!="number"||typeof r.gapTo!="number"||typeof r.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(r.from,r.to,r.gapFrom,r.gapTo,Xt.fromJSON(t,r.slice),r.insert,!!r.structure)}};Is.jsonID("replaceAround",Zs);function pB(e,t,r){let n=e.resolve(t),i=r-t,a=n.depth;for(;i>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,i--;if(i>0){let s=n.node(a).maybeChild(n.indexAfter(a));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Rot(e,t,r,n){let i=[],a=[],s,o;e.doc.nodesBetween(t,r,(l,u,h)=>{if(!l.isInline)return;let f=l.marks;if(!n.isInSet(f)&&h.type.allowsMarkType(n.type)){let d=Math.max(u,t),p=Math.min(u+l.nodeSize,r),m=n.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==d&&s.mark.eq(f[g])?s.to=p:i.push(s=new T1(d,p,f[g])));o&&o.to==d?o.to=p:a.push(o=new k1(d,p,n))}}),i.forEach(l=>e.step(l)),a.forEach(l=>e.step(l))}function Lot(e,t,r,n){let i=[],a=0;e.doc.nodesBetween(t,r,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(n instanceof Hk){let u=s.marks,h;for(;h=n.isInSet(u);)(l||(l=[])).push(h),u=h.removeFromSet(u)}else n?n.isInSet(s.marks)&&(l=[n]):l=s.marks;if(l&&l.length){let u=Math.min(o+s.nodeSize,r);for(let h=0;h<l.length;h++){let f=l[h],d;for(let p=0;p<i.length;p++){let m=i[p];m.step==a-1&&f.eq(i[p].style)&&(d=m)}d?(d.to=u,d.step=a):i.push({style:f,from:Math.max(o,t),to:u,step:a})}}}),i.forEach(s=>e.step(new T1(s.from,s.to,s.style)))}function yB(e,t,r,n=r.contentMatch,i=!0){let a=e.doc.nodeAt(t),s=[],o=t+1;for(let l=0;l<a.childCount;l++){let u=a.child(l),h=o+u.nodeSize,f=n.matchType(u.type);if(!f)s.push(new Ks(o,h,Xt.empty));else{n=f;for(let d=0;d<u.marks.length;d++)r.allowsMarkType(u.marks[d].type)||e.step(new T1(o,h,u.marks[d]));if(i&&u.isText&&r.whitespace!="pre"){let d,p=/\r?\n|\r/g,m;for(;d=p.exec(u.text);)m||(m=new Xt(Lt.from(r.schema.text(" ",r.allowedMarks(u.marks))),0,0)),s.push(new Ks(o+d.index,o+d.index+d[0].length,m))}}o=h}if(!n.validEnd){let l=n.fillBefore(Lt.empty,!0);e.replace(o,o,new Xt(l,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function Iot(e,t,r){return(t==0||e.canReplace(t,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function ox(e){let r=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,i=0,a=0;;--n){let s=e.$from.node(n),o=e.$from.index(n)+i,l=e.$to.indexAfter(n)-a;if(n<e.depth&&s.canReplace(o,l,r))return n;if(n==0||s.type.spec.isolating||!Iot(s,o,l))break;o&&(i=1),l<s.childCount&&(a=1)}return null}function Mot(e,t,r){let{$from:n,$to:i,depth:a}=t,s=n.before(a+1),o=i.after(a+1),l=s,u=o,h=Lt.empty,f=0;for(let m=a,g=!1;m>r;m--)g||n.index(m)>0?(g=!0,h=Lt.from(n.node(m).copy(h)),f++):l--;let d=Lt.empty,p=0;for(let m=a,g=!1;m>r;m--)g||i.after(m+1)<i.end(m)?(g=!0,d=Lt.from(i.node(m).copy(d)),p++):u++;e.step(new Zs(l,u,s,o,new Xt(h.append(d),f,p),h.size-f,!0))}function C1(e,t,r=null,n=e){let i=Not(e,t),a=i&&Dot(n,t);return a?i.map(Ece).concat({type:t,attrs:r}).concat(a.map(Ece)):null}function Ece(e){return{type:e,attrs:null}}function Not(e,t){let{parent:r,startIndex:n,endIndex:i}=e,a=r.contentMatchAt(n).findWrapping(t);if(!a)return null;let s=a.length?a[0]:t;return r.canReplaceWith(n,i,s)?a:null}function Dot(e,t){let{parent:r,startIndex:n,endIndex:i}=e,a=r.child(n),s=t.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let u=n;l&&u<i;u++)l=l.matchType(r.child(u).type);return!l||!l.validEnd?null:s}function Oot(e,t,r){let n=Lt.empty;for(let s=r.length-1;s>=0;s--){if(n.size){let o=r[s].type.contentMatch.matchFragment(n);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Lt.from(r[s].type.create(r[s].attrs,n))}let i=t.start,a=t.end;e.step(new Zs(i,a,i,a,new Xt(n,0,0),r.length,!0))}function Pot(e,t,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=e.steps.length;e.doc.nodesBetween(t,r,(s,o)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(n,l)&&Bot(e.doc,e.mapping.slice(a).map(o),n)){let u=null;if(n.schema.linebreakReplacement){let p=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);p&&!m?u=!1:!p&&m&&(u=!0)}u===!1&&Nce(e,s,o,a),yB(e,e.mapping.slice(a).map(o,1),n,void 0,u===null);let h=e.mapping.slice(a),f=h.map(o,1),d=h.map(o+s.nodeSize,1);return e.step(new Zs(f,d,f+1,d-1,new Xt(Lt.from(n.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Mce(e,s,o,a),!1}})}function Mce(e,t,r,n){t.forEach((i,a)=>{if(i.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(i.text);){let l=e.mapping.slice(n).map(r+1+a+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function Nce(e,t,r,n){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let s=e.mapping.slice(n).map(r+1+a);e.replaceWith(s,s+1,t.type.schema.text(` +`))}})}function Bot(e,t,r){let n=e.resolve(t),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}function Fot(e,t,r,n,i){let a=e.doc.nodeAt(t);if(!a)throw new RangeError("No node at given position");r||(r=a.type);let s=r.create(n,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,s);if(!r.validContent(a.content))throw new RangeError("Invalid content for node type "+r.name);e.step(new Zs(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new Xt(Lt.from(s),0,0),1,!0))}function S1(e,t,r=1,n){let i=e.resolve(t),a=i.depth-r,s=n&&n[n.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,h=r-2;u>a;u--,h--){let f=i.node(u),d=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),m=n&&n[h+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=n&&n[h]||f;if(!f.canReplace(d+1,f.childCount)||!g.type.validContent(p))return!1}let o=i.indexAfter(a),l=n&&n[0];return i.node(a).canReplaceWith(o,o,l?l.type:i.node(a+1).type)}function $ot(e,t,r=1,n){let i=e.doc.resolve(t),a=Lt.empty,s=Lt.empty;for(let o=i.depth,l=i.depth-r,u=r-1;o>l;o--,u--){a=Lt.from(i.node(o).copy(a));let h=n&&n[u];s=Lt.from(h?h.type.create(h.attrs,s):i.node(o).copy(s))}e.step(new Ks(t,t,new Xt(a.append(s),r,r),!0))}function E1(e,t){let r=e.resolve(t),n=r.index();return Got(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function zot(e,t){t.content.size||e.type.compatibleContent(t.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),s=a.type==n?e.type.schema.nodes.text:a.type;if(r=r.matchType(s),!r||!e.type.allowsMarks(a.marks))return!1}return r.validEnd}function Got(e,t){return!!(e&&t&&!e.isLeaf&&zot(e,t))}function qot(e,t,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-r),s=a.node().type;if(i&&s.inlineContent){let h=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);h&&!f?n=!1:!h&&f&&(n=!0)}let o=e.steps.length;if(n===!1){let h=e.doc.resolve(t+r);Nce(e,h.node(),h.before(),o)}s.inlineContent&&yB(e,t+r-1,s,a.node().contentMatchAt(a.index()),n==null);let l=e.mapping.slice(o),u=l.map(t-r);if(e.step(new Ks(u,l.map(t+r,-1),Xt.empty,!0)),n===!0){let h=e.doc.resolve(u);Mce(e,h.node(),h.before(),e.steps.length)}return e}function Vot(e,t,r){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),r))return t;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let a=n.index(i);if(n.node(i).canReplaceWith(a,a,r))return n.before(i+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let a=n.indexAfter(i);if(n.node(i).canReplaceWith(a,a,r))return n.after(i+1);if(a<n.node(i).childCount)return null}return null}function Dce(e,t,r){let n=e.resolve(t);if(!r.content.size)return t;let i=r.content;for(let a=0;a<r.openStart;a++)i=i.firstChild.content;for(let a=1;a<=(r.openStart==0&&r.size?2:1);a++)for(let s=n.depth;s>=0;s--){let o=s==n.depth?0:n.pos<=(n.start(s+1)+n.end(s+1))/2?-1:1,l=n.index(s)+(o>0?1:0),u=n.node(s),h=!1;if(a==1)h=u.canReplace(l,l,i);else{let f=u.contentMatchAt(l).findWrapping(i.firstChild.type);h=f&&u.canReplaceWith(l,l,f[0])}if(h)return o==0?n.pos:o<0?n.before(s+1):n.after(s+1)}return null}function Zk(e,t,r=t,n=Xt.empty){if(t==r&&!n.size)return null;let i=e.resolve(t),a=e.resolve(r);return Oce(i,a,n)?new Ks(t,r,n):new mB(i,a,n).fit()}function Oce(e,t,r){return!r.openStart&&!r.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),r.content)}var mB=class{constructor(t,r,n){this.$from=t,this.$to=r,this.unplaced=n,this.frontier=[],this.placed=Lt.empty;for(let i=0;i<=t.depth;i++){let a=t.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=Lt.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(t<0?this.$to:n.doc.resolve(t));if(!i)return null;let a=this.placed,s=n.depth,o=i.depth;for(;s&&o&&a.childCount==1;)a=a.firstChild.content,s--,o--;let l=new Xt(a,s,o);return t>-1?new Zs(n.pos,t,this.$to.pos,this.$to.end(),l,r):l.size||n.pos!=this.$to.pos?new Ks(n.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let r=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<t;n++){let a=r.firstChild;if(r.childCount>1&&(i=0),a.type.spec.isolating&&i<=n){t=n;break}r=a.content}for(let r=1;r<=2;r++)for(let n=r==1?t:this.unplaced.openStart;n>=0;n--){let i,a=null;n?(a=hB(this.unplaced.content,n-1).firstChild,i=a.content):i=this.unplaced.content;let s=i.firstChild;for(let o=this.depth;o>=0;o--){let{type:l,match:u}=this.frontier[o],h,f=null;if(r==1&&(s?u.matchType(s.type)||(f=u.fillBefore(Lt.from(s),!1)):a&&l.compatibleContent(a.type)))return{sliceDepth:n,frontierDepth:o,parent:a,inject:f};if(r==2&&s&&(h=u.findWrapping(s.type)))return{sliceDepth:n,frontierDepth:o,parent:a,wrap:h};if(a&&u.matchType(a.type))break}}}openMore(){let{content:t,openStart:r,openEnd:n}=this.unplaced,i=hB(t,r);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Xt(t,r+1,Math.max(n,i.size+r>=t.size-n?r+1:0)),!0)}dropNode(){let{content:t,openStart:r,openEnd:n}=this.unplaced,i=hB(t,r);if(i.childCount<=1&&r>0){let a=t.size-r<=r+i.size;this.unplaced=new Xt(Yk(t,r-1,1),r-1,a?r-1:n)}else this.unplaced=new Xt(Yk(t,r,1),r,n)}placeNodes({sliceDepth:t,frontierDepth:r,parent:n,inject:i,wrap:a}){for(;this.depth>r;)this.closeFrontierNode();if(a)for(let g=0;g<a.length;g++)this.openFrontierNode(a[g]);let s=this.unplaced,o=n?n.content:s.content,l=s.openStart-t,u=0,h=[],{match:f,type:d}=this.frontier[r];if(i){for(let g=0;g<i.childCount;g++)h.push(i.child(g));f=f.matchFragment(i)}let p=o.size+t-(s.content.size-s.openEnd);for(;u<o.childCount;){let g=o.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||l==0||g.content.size)&&(f=y,h.push(Pce(g.mark(d.allowedMarks(g.marks)),u==1?l:0,u==o.childCount?p:-1)))}let m=u==o.childCount;m||(p=-1),this.placed=Xk(this.placed,r,Lt.from(h)),this.frontier[r].match=f,m&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=o;g<p;g++){let v=y.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),y=v.content}this.unplaced=m?t==0?Xt.empty:new Xt(Yk(s.content,t-1,1),t-1,p<0?s.openEnd:t-1):new Xt(Yk(s.content,t,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],r;if(!t.type.isTextblock||!fB(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(r=this.findCloseLevel(this.$to))&&r.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(t){e:for(let r=Math.min(this.depth,t.depth);r>=0;r--){let{match:n,type:i}=this.frontier[r],a=r<t.depth&&t.end(r+1)==t.pos+(t.depth-(r+1)),s=fB(t,r,i,n,a);if(s){for(let o=r-1;o>=0;o--){let{match:l,type:u}=this.frontier[o],h=fB(t,o,u,l,!0);if(!h||h.childCount)continue e}return{depth:r,fit:s,move:a?t.doc.resolve(t.after(r+1)):t}}}}close(t){let r=this.findCloseLevel(t);if(!r)return null;for(;this.depth>r.depth;)this.closeFrontierNode();r.fit.childCount&&(this.placed=Xk(this.placed,r.depth,r.fit)),t=r.move;for(let n=r.depth+1;n<=t.depth;n++){let i=t.node(n),a=i.type.contentMatch.fillBefore(i.content,!0,t.index(n));this.openFrontierNode(i.type,i.attrs,a)}return t}openFrontierNode(t,r=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Xk(this.placed,this.depth,Lt.from(t.create(r,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let r=this.frontier.pop().match.fillBefore(Lt.empty,!0);r.childCount&&(this.placed=Xk(this.placed,this.frontier.length,r))}};function Yk(e,t,r){return t==0?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(Yk(e.firstChild.content,t-1,r)))}function Xk(e,t,r){return t==0?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(Xk(e.lastChild.content,t-1,r)))}function hB(e,t){for(let r=0;r<t;r++)e=e.firstChild.content;return e}function Pce(e,t,r){if(t<=0)return e;let n=e.content;return t>1&&(n=n.replaceChild(0,Pce(n.firstChild,t-1,n.childCount==1?r-1:0))),t>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(Lt.empty,!0)))),e.copy(n)}function fB(e,t,r,n,i){let a=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==a.childCount&&!r.compatibleContent(a.type))return null;let o=n.fillBefore(a.content,!0,s);return o&&!Wot(r,a.content,s)?o:null}function Wot(e,t,r){for(let n=r;n<t.childCount;n++)if(!e.allowsMarks(t.child(n).marks))return!0;return!1}function Hot(e){return e.spec.defining||e.spec.definingForContent}function Uot(e,t,r,n){if(!n.size)return e.deleteRange(t,r);let i=e.doc.resolve(t),a=e.doc.resolve(r);if(Oce(i,a,n))return e.step(new Ks(t,r,n));let s=Fce(i,a);s[s.length-1]==0&&s.pop();let o=-(i.depth+1);s.unshift(o);for(let d=i.depth,p=i.pos-1;d>0;d--,p--){let m=i.node(d).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(d)>-1?o=d:i.before(d)==p&&s.splice(1,0,-d)}let l=s.indexOf(o),u=[],h=n.openStart;for(let d=n.content,p=0;;p++){let m=d.firstChild;if(u.push(m),p==n.openStart)break;d=m.content}for(let d=h-1;d>=0;d--){let p=u[d],m=Hot(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(o)-1)))h=d;else if(m||!p.type.isTextblock)break}for(let d=n.openStart;d>=0;d--){let p=(d+h+1)%(n.openStart+1),m=u[p];if(m)for(let g=0;g<s.length;g++){let y=s[(g+l)%s.length],v=!0;y<0&&(v=!1,y=-y);let x=i.node(y-1),w=i.index(y-1);if(x.canReplaceWith(w,w,m.type,m.marks))return e.replace(i.before(y),v?a.after(y):r,new Xt(Bce(n.content,0,n.openStart,p),p,n.openEnd))}}let f=e.steps.length;for(let d=s.length-1;d>=0&&(e.replace(t,r,n),!(e.steps.length>f));d--){let p=s[d];p<0||(t=i.before(p),r=a.after(p))}}function Bce(e,t,r,n,i){if(t<r){let a=e.firstChild;e=e.replaceChild(0,a.copy(Bce(a.content,t+1,r,n,a)))}if(t>n){let a=i.contentMatchAt(0),s=a.fillBefore(e).append(e);e=s.append(a.matchFragment(s).fillBefore(Lt.empty,!0))}return e}function Yot(e,t,r,n){if(!n.isInline&&t==r&&e.doc.resolve(t).parent.content.size){let i=Vot(e.doc,t,n.type);i!=null&&(t=r=i)}e.replaceRange(t,r,new Xt(Lt.from(n),0,0))}function Xot(e,t,r){let n=e.doc.resolve(t),i=e.doc.resolve(r);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&n.parentOffset==0&&i.parentOffset==0){let s=n.sharedDepth(r),o=!1;for(let l=n.depth;l>s;l--)n.node(l).type.spec.isolating&&(o=!0);for(let l=i.depth;l>s;l--)i.node(l).type.spec.isolating&&(o=!0);if(!o){for(let l=n.depth;l>0&&t==n.start(l);l--)t=n.before(l);for(let l=i.depth;l>0&&r==i.start(l);l--)r=i.before(l);n=e.doc.resolve(t),i=e.doc.resolve(r)}}let a=Fce(n,i);for(let s=0;s<a.length;s++){let o=a[s],l=s==a.length-1;if(l&&o==0||n.node(o).type.contentMatch.validEnd)return e.delete(n.start(o),i.end(o));if(o>0&&(l||n.node(o-1).canReplace(n.index(o-1),i.indexAfter(o-1))))return e.delete(n.before(o),i.after(o))}for(let s=1;s<=n.depth&&s<=i.depth;s++)if(t-n.start(s)==n.depth-s&&r>n.end(s)&&i.end(s)-r!=i.depth-s&&n.start(s-1)==i.start(s-1)&&n.node(s-1).canReplace(n.index(s-1),i.index(s-1)))return e.delete(n.before(s),r);e.delete(t,r)}function Fce(e,t){let r=[],n=Math.min(e.depth,t.depth);for(let i=n;i>=0;i--){let a=e.start(i);if(a<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(a==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==a-1)&&r.push(i)}return r}var zE=class e extends Is{constructor(t,r,n){super(),this.pos=t,this.attr=r,this.value=n}apply(t){let r=t.nodeAt(this.pos);if(!r)return js.fail("No node at attribute step's position");let n=Object.create(null);for(let a in r.attrs)n[a]=r.attrs[a];n[this.attr]=this.value;let i=r.type.create(n,null,r.marks);return js.fromReplace(t,this.pos,this.pos+1,new Xt(Lt.from(i),0,r.isLeaf?0:1))}getMap(){return Ld.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,r){if(typeof r.pos!="number"||typeof r.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(r.pos,r.attr,r.value)}};Is.jsonID("attr",zE);var GE=class e extends Is{constructor(t,r){super(),this.attr=t,this.value=r}apply(t){let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let n=t.type.create(r,t.content,t.marks);return js.ok(n)}getMap(){return Ld.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,r){if(typeof r.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(r.attr,r.value)}};Is.jsonID("docAttr",GE);var ax=class extends Error{};ax=function e(t){let r=Error.call(this,t);return r.__proto__=e.prototype,r};ax.prototype=Object.create(Error.prototype);ax.prototype.constructor=ax;ax.prototype.name="TransformError";var sx=class{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new dB}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let r=this.maybeStep(t);if(r.failed)throw new ax(r.failed);return this}maybeStep(t){let r=t.apply(this.doc);return r.failed||this.addStep(t,r.doc),r}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,r=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let i=this.mapping.maps[n];n&&(t=i.map(t,1),r=i.map(r,-1)),i.forEach((a,s,o,l)=>{t=Math.min(t,o),r=Math.max(r,l)})}return t==1e9?null:{from:t,to:r}}addStep(t,r){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=r}replace(t,r=t,n=Xt.empty){let i=Zk(this.doc,t,r,n);return i&&this.step(i),this}replaceWith(t,r,n){return this.replace(t,r,new Xt(Lt.from(n),0,0))}delete(t,r){return this.replace(t,r,Xt.empty)}insert(t,r){return this.replaceWith(t,t,r)}replaceRange(t,r,n){return Uot(this,t,r,n),this}replaceRangeWith(t,r,n){return Yot(this,t,r,n),this}deleteRange(t,r){return Xot(this,t,r),this}lift(t,r){return Mot(this,t,r),this}join(t,r=1){return qot(this,t,r),this}wrap(t,r){return Oot(this,t,r),this}setBlockType(t,r=t,n,i=null){return Pot(this,t,r,n,i),this}setNodeMarkup(t,r,n=null,i){return Fot(this,t,r,n,i),this}setNodeAttribute(t,r,n){return this.step(new zE(t,r,n)),this}setDocAttribute(t,r){return this.step(new GE(t,r)),this}addNodeMark(t,r){return this.step(new Kk(t,r)),this}removeNodeMark(t,r){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(r instanceof In)r.isInSet(n.marks)&&this.step(new ix(t,r));else{let i=n.marks,a,s=[];for(;a=r.isInSet(i);)s.push(new ix(t,a)),i=a.removeFromSet(i);for(let o=s.length-1;o>=0;o--)this.step(s[o])}return this}split(t,r=1,n){return $ot(this,t,r,n),this}addMark(t,r,n){return Rot(this,t,r,n),this}removeMark(t,r,n){return Lot(this,t,r,n),this}clearIncompatible(t,r,n){return yB(this,t,r,n),this}};var vB=Object.create(null),Vr=class{constructor(t,r,n){this.$anchor=t,this.$head=r,this.ranges=n||[new Np(t.min(r),t.max(r))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let r=0;r<t.length;r++)if(t[r].$from.pos!=t[r].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,r=Xt.empty){let n=r.content.lastChild,i=null;for(let o=0;o<r.openEnd;o++)i=n,n=n.lastChild;let a=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:u}=s[o],h=t.mapping.slice(a);t.replaceRange(h.map(l.pos),h.map(u.pos),o?Xt.empty:r),o==0&&Gce(t,a,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,r){let n=t.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:s,$to:o}=i[a],l=t.mapping.slice(n),u=l.map(s.pos),h=l.map(o.pos);a?t.deleteRange(u,h):(t.replaceRangeWith(u,h,r),Gce(t,n,r.isInline?-1:1))}}static findFrom(t,r,n=!1){let i=t.parent.inlineContent?new Pr(t):lx(t.node(0),t.parent,t.pos,t.index(),r,n);if(i)return i;for(let a=t.depth-1;a>=0;a--){let s=r<0?lx(t.node(0),t.node(a),t.before(a+1),t.index(a),r,n):lx(t.node(0),t.node(a),t.after(a+1),t.index(a)+1,r,n);if(s)return s}return null}static near(t,r=1){return this.findFrom(t,r)||this.findFrom(t,-r)||new Tc(t.node(0))}static atStart(t){return lx(t,t,0,0,1)||new Tc(t)}static atEnd(t){return lx(t,t,t.content.size,t.childCount,-1)||new Tc(t)}static fromJSON(t,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=vB[r.type];if(!n)throw new RangeError(`No selection type ${r.type} defined`);return n.fromJSON(t,r)}static jsonID(t,r){if(t in vB)throw new RangeError("Duplicate use of selection JSON ID "+t);return vB[t]=r,r.prototype.jsonID=t,r}getBookmark(){return Pr.between(this.$anchor,this.$head).getBookmark()}};Vr.prototype.visible=!0;var Np=class{constructor(t,r){this.$from=t,this.$to=r}},$ce=!1;function zce(e){!$ce&&!e.parent.inlineContent&&($ce=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var Pr=class e extends Vr{constructor(t,r=t){zce(t),zce(r),super(t,r)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,r){let n=t.resolve(r.map(this.head));if(!n.parent.inlineContent)return Vr.near(n);let i=t.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:n,n)}replace(t,r=Xt.empty){if(super.replace(t,r),r==Xt.empty){let n=this.$from.marksAcross(this.$to);n&&t.ensureMarks(n)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new VE(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,r){if(typeof r.anchor!="number"||typeof r.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(r.anchor),t.resolve(r.head))}static create(t,r,n=r){let i=t.resolve(r);return new this(i,n==r?i:t.resolve(n))}static between(t,r,n){let i=t.pos-r.pos;if((!n||i)&&(n=i>=0?1:-1),!r.parent.inlineContent){let a=Vr.findFrom(r,n,!0)||Vr.findFrom(r,-n,!0);if(a)r=a.$head;else return Vr.near(r,n)}return t.parent.inlineContent||(i==0?t=r:(t=(Vr.findFrom(t,-n,!0)||Vr.findFrom(t,n,!0)).$anchor,t.pos<r.pos!=i<0&&(t=r))),new e(t,r)}};Vr.jsonID("text",Pr);var VE=class e{constructor(t,r){this.anchor=t,this.head=r}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(t){return Pr.between(t.resolve(this.anchor),t.resolve(this.head))}},cn=class e extends Vr{constructor(t){let r=t.nodeAfter,n=t.node(0).resolve(t.pos+r.nodeSize);super(t,n),this.node=r}map(t,r){let{deleted:n,pos:i}=r.mapResult(this.anchor),a=t.resolve(i);return n?Vr.near(a):new e(a)}content(){return new Xt(Lt.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new bB(this.anchor)}static fromJSON(t,r){if(typeof r.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(r.anchor))}static create(t,r){return new e(t.resolve(r))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}};cn.prototype.visible=!1;Vr.jsonID("node",cn);var bB=class e{constructor(t){this.anchor=t}map(t){let{deleted:r,pos:n}=t.mapResult(this.anchor);return r?new VE(n,n):new e(n)}resolve(t){let r=t.resolve(this.anchor),n=r.nodeAfter;return n&&cn.isSelectable(n)?new cn(r):Vr.near(r)}},Tc=class e extends Vr{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,r=Xt.empty){if(r==Xt.empty){t.delete(0,t.doc.content.size);let n=Vr.atStart(t.doc);n.eq(t.selection)||t.setSelection(n)}else super.replace(t,r)}toJSON(){return{type:"all"}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return jot}};Vr.jsonID("all",Tc);var jot={map(){return this},resolve(e){return new Tc(e)}};function lx(e,t,r,n,i,a=!1){if(t.inlineContent)return Pr.create(e,r);for(let s=n-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let o=t.child(s);if(o.isAtom){if(!a&&cn.isSelectable(o))return cn.create(e,r-(i<0?o.nodeSize:0))}else{let l=lx(e,o,r+i,i<0?o.childCount:0,i,a);if(l)return l}r+=o.nodeSize*i}return null}function Gce(e,t,r){let n=e.steps.length-1;if(n<t)return;let i=e.steps[n];if(!(i instanceof Ks||i instanceof Zs))return;let a=e.mapping.maps[n],s;a.forEach((o,l,u,h)=>{s==null&&(s=h)}),e.setSelection(Vr.near(e.doc.resolve(s),r))}var qce=1,qE=2,Vce=4,wB=class extends sx{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|qce)&~qE,this.storedMarks=null,this}get selectionSet(){return(this.updated&qce)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=qE,this}ensureMarks(t){return In.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&qE)>0}addStep(t,r){super.addStep(t,r),this.updated=this.updated&~qE,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,r=!0){let n=this.selection;return r&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||In.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,r,n){let i=this.doc.type.schema;if(r==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(n==null&&(n=r),!t)return this.deleteRange(r,n);let a=this.storedMarks;if(!a){let s=this.doc.resolve(r);a=n==r?s.marks():s.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(r,n,i.text(t,a)),!this.selection.empty&&this.selection.to==r+t.length&&this.setSelection(Vr.near(this.selection.$to)),this}}setMeta(t,r){return this.meta[typeof t=="string"?t:t.key]=r,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Vce,this}get scrolledIntoView(){return(this.updated&Vce)>0}};function Wce(e,t){return!t||!e?e:e.bind(t)}var A1=class{constructor(t,r,n){this.name=t,this.init=Wce(r.init,n),this.apply=Wce(r.apply,n)}},Kot=[new A1("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new A1("selection",{init(e,t){return e.selection||Vr.atStart(t.doc)},apply(e){return e.selection}}),new A1("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,r,n){return n.selection.$cursor?e.storedMarks:null}}),new A1("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Qk=class{constructor(t,r){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Kot.slice(),r&&r.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new A1(n.key,n.spec.state,n))})}},cx=class e{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,r=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=r){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let r=[t],n=this.applyInner(t),i=null;for(;;){let a=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=i?i[s].n:0,u=i?i[s].state:this,h=l<r.length&&o.spec.appendTransaction.call(o,l?r.slice(l):r,u,n);if(h&&n.filterTransaction(h,s)){if(h.setMeta("appendedTransaction",t),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:n,n:r.length}:{state:this,n:0})}r.push(h),n=n.applyInner(h),a=!0}i&&(i[s]={state:n,n:r.length})}}if(!a)return{state:n,transactions:r}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let r=new e(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let a=n[i];r[a.name]=a.apply(t,this[a.name],this,r)}return r}get tr(){return new wB(this)}static create(t){let r=new Qk(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new e(r);for(let i=0;i<r.fields.length;i++)n[r.fields[i].name]=r.fields[i].init(t,n);return n}reconfigure(t){let r=new Qk(this.schema,t.plugins),n=r.fields,i=new e(r);for(let a=0;a<n.length;a++){let s=n[a].name;i[s]=this.hasOwnProperty(s)?this[s]:n[a].init(t,i)}return i}toJSON(t){let r={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(r.storedMarks=this.storedMarks.map(n=>n.toJSON())),t&&typeof t=="object")for(let n in t){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[n],a=i.spec.state;a&&a.toJSON&&(r[n]=a.toJSON.call(i,this[i.key]))}return r}static fromJSON(t,r,n){if(!r)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new Qk(t.schema,t.plugins),a=new e(i);return i.fields.forEach(s=>{if(s.name=="doc")a.doc=$l.fromJSON(t.schema,r.doc);else if(s.name=="selection")a.selection=Vr.fromJSON(a.doc,r.selection);else if(s.name=="storedMarks")r.storedMarks&&(a.storedMarks=r.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let o in n){let l=n[o],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(r,o)){a[s.name]=u.fromJSON.call(l,t,r[o],a);return}}a[s.name]=s.init(t,a)}}),a}};function Hce(e,t,r){for(let n in e){let i=e[n];i instanceof Function?i=i.bind(t):n=="handleDOMEvents"&&(i=Hce(i,t,{})),r[n]=i}return r}var Ci=class{constructor(t){this.spec=t,this.props={},t.props&&Hce(t.props,this,this.props),this.key=t.key?t.key.key:Uce("plugin")}getState(t){return t[this.key]}},xB=Object.create(null);function Uce(e){return e in xB?e+"$"+ ++xB[e]:(xB[e]=0,e+"$")}var Hi=class{constructor(t="key"){this.key=Uce(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}};var WE=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Xce(e,t){let{$cursor:r}=e.selection;return!r||(t?!t.endOfTextblock("backward",e):r.parentOffset>0)?null:r}var TB=(e,t,r)=>{let n=Xce(e,r);if(!n)return!1;let i=SB(n);if(!i){let s=n.blockRange(),o=s&&ox(s);return o==null?!1:(t&&t(e.tr.lift(s,o).scrollIntoView()),!0)}let a=i.nodeBefore;if(Zce(e,i,t,-1))return!0;if(n.parent.content.size==0&&(ux(a,"end")||cn.isSelectable(a)))for(let s=n.depth;;s--){let o=Zk(e.doc,n.before(s),n.after(s),Xt.empty);if(o&&o.slice.size<o.to-o.from){if(t){let l=e.tr.step(o);l.setSelection(ux(a,"end")?Vr.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):cn.create(l.doc,i.pos-a.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||n.node(s-1).childCount>1)break}return a.isAtom&&i.depth==n.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},jce=(e,t,r)=>{let n=Xce(e,r);if(!n)return!1;let i=SB(n);return i?Zot(e,i,t):!1};function Zot(e,t,r){let n=t.nodeBefore,i=n,a=t.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let h=i.lastChild;if(!h)return!1;i=h}let s=t.nodeAfter,o=s,l=t.pos+1;for(;!o.isTextblock;l++){if(o.type.spec.isolating)return!1;let h=o.firstChild;if(!h)return!1;o=h}let u=Zk(e.doc,a,l,Xt.empty);if(!u||u.from!=a||u instanceof Ks&&u.slice.size>=l-a)return!1;if(r){let h=e.tr.step(u);h.setSelection(Pr.create(h.doc,a)),r(h.scrollIntoView())}return!0}function ux(e,t,r=!1){for(let n=e;n;n=t=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&n.childCount!=1)return!1}return!1}var CB=(e,t,r)=>{let{$head:n,empty:i}=e.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;a=SB(n)}let s=a&&a.nodeBefore;return!s||!cn.isSelectable(s)?!1:(t&&t(e.tr.setSelection(cn.create(e.doc,a.pos-s.nodeSize)).scrollIntoView()),!0)};function SB(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Qot(e,t){let{$cursor:r}=e.selection;return!r||(t?!t.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)?null:r}var Jot=(e,t,r)=>{let n=Qot(e,r);if(!n)return!1;let i=Kce(n);if(!i)return!1;let a=i.nodeAfter;if(Zce(e,i,t,1))return!0;if(n.parent.content.size==0&&(ux(a,"start")||cn.isSelectable(a))){let s=Zk(e.doc,n.before(),n.after(),Xt.empty);if(s&&s.slice.size<s.to-s.from){if(t){let o=e.tr.step(s);o.setSelection(ux(a,"start")?Vr.findFrom(o.doc.resolve(o.mapping.map(i.pos)),1):cn.create(o.doc,o.mapping.map(i.pos))),t(o.scrollIntoView())}return!0}}return a.isAtom&&i.depth==n.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},elt=(e,t,r)=>{let{$head:n,empty:i}=e.selection,a=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;a=Kce(n)}let s=a&&a.nodeAfter;return!s||!cn.isSelectable(s)?!1:(t&&t(e.tr.setSelection(cn.create(e.doc,a.pos)).scrollIntoView()),!0)};function Kce(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let r=e.node(t);if(e.index(t)+1<r.childCount)return e.doc.resolve(e.after(t+1));if(r.type.spec.isolating)break}return null}var tlt=(e,t)=>{let{$head:r,$anchor:n}=e.selection;return!r.parent.type.spec.code||!r.sameParent(n)?!1:(t&&t(e.tr.insertText(` +`).scrollIntoView()),!0)};function EB(e){for(let t=0;t<e.edgeCount;t++){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}var rlt=(e,t)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),a=r.indexAfter(-1),s=EB(i.contentMatchAt(a));if(!s||!i.canReplaceWith(a,a,s))return!1;if(t){let o=r.after(),l=e.tr.replaceWith(o,o,s.createAndFill());l.setSelection(Vr.near(l.doc.resolve(o),1)),t(l.scrollIntoView())}return!0},nlt=(e,t)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof Tc||n.parent.inlineContent||i.parent.inlineContent)return!1;let a=EB(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let s=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,o=e.tr.insert(s,a.createAndFill());o.setSelection(Pr.create(o.doc,s+1)),t(o.scrollIntoView())}return!0},ilt=(e,t)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let a=r.before();if(S1(e.doc,a))return t&&t(e.tr.split(a).scrollIntoView()),!0}let n=r.blockRange(),i=n&&ox(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)};function alt(e){return(t,r)=>{let{$from:n,$to:i}=t.selection;if(t.selection instanceof cn&&t.selection.node.isBlock)return!n.parentOffset||!S1(t.doc,n.pos)?!1:(r&&r(t.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let a=[],s,o,l=!1,u=!1;for(let p=n.depth;;p--)if(n.node(p).isBlock){l=n.end(p)==n.pos+(n.depth-p),u=n.start(p)==n.pos-(n.depth-p),o=EB(n.node(p-1).contentMatchAt(n.indexAfter(p-1)));let g=e&&e(i.parent,l,n);a.unshift(g||(l&&o?{type:o}:null)),s=p;break}else{if(p==1)return!1;a.unshift(null)}let h=t.tr;(t.selection instanceof Pr||t.selection instanceof Tc)&&h.deleteSelection();let f=h.mapping.map(n.pos),d=S1(h.doc,f,a.length,a);if(d||(a[0]=o?{type:o}:null,d=S1(h.doc,f,a.length,a)),!d)return!1;if(h.split(f,a.length,a),!l&&u&&n.node(s).type!=o){let p=h.mapping.map(n.before(s)),m=h.doc.resolve(p);o&&n.node(s-1).canReplaceWith(m.index(),m.index()+1,o)&&h.setNodeMarkup(h.mapping.map(n.before(s)),o)}return r&&r(h.scrollIntoView()),!0}}var slt=alt();var olt=(e,t)=>(t&&t(e.tr.setSelection(new Tc(e.doc))),!0);function llt(e,t,r){let n=t.nodeBefore,i=t.nodeAfter,a=t.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&t.parent.canReplace(a-1,a)?(r&&r(e.tr.delete(t.pos-n.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||E1(e.doc,t.pos))?!1:(r&&r(e.tr.join(t.pos).scrollIntoView()),!0)}function Zce(e,t,r,n){let i=t.nodeBefore,a=t.nodeAfter,s,o,l=i.type.spec.isolating||a.type.spec.isolating;if(!l&&llt(e,t,r))return!0;let u=!l&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(s=(o=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&o.matchType(s[0]||a.type).validEnd){if(r){let p=t.pos+a.nodeSize,m=Lt.empty;for(let v=s.length-1;v>=0;v--)m=Lt.from(s[v].create(null,m));m=Lt.from(i.copy(m));let g=e.tr.step(new Zs(t.pos-1,p,t.pos,p,new Xt(m,1,0),s.length,!0)),y=g.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&E1(g.doc,y.pos)&&g.join(y.pos),r(g.scrollIntoView())}return!0}let h=a.type.spec.isolating||n>0&&l?null:Vr.findFrom(t,1),f=h&&h.$from.blockRange(h.$to),d=f&&ox(f);if(d!=null&&d>=t.depth)return r&&r(e.tr.lift(f,d).scrollIntoView()),!0;if(u&&ux(a,"start",!0)&&ux(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=a,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(r){let v=Lt.empty;for(let w=m.length-1;w>=0;w--)v=Lt.from(m[w].copy(v));let x=e.tr.step(new Zs(t.pos-m.length,t.pos+a.nodeSize,t.pos+y,t.pos+a.nodeSize-y,new Xt(v,m.length,0),0,!0));r(x.scrollIntoView())}return!0}}return!1}function Qce(e){return function(t,r){let n=t.selection,i=e<0?n.$from:n.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(r&&r(t.tr.setSelection(Pr.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var clt=Qce(-1),ult=Qce(1);function HE(e,t=null){return function(r,n){let{$from:i,$to:a}=r.selection,s=i.blockRange(a),o=s&&C1(s,e,t);return o?(n&&n(r.tr.wrap(s,o).scrollIntoView()),!0):!1}}function hx(e,t=null){return function(r,n){let i=!1;for(let a=0;a<r.selection.ranges.length&&!i;a++){let{$from:{pos:s},$to:{pos:o}}=r.selection.ranges[a];r.doc.nodesBetween(s,o,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(e,t)))if(l.type==e)i=!0;else{let h=r.doc.resolve(u),f=h.index();i=h.parent.canReplaceWith(f,f+1,e)}})}if(!i)return!1;if(n){let a=r.tr;for(let s=0;s<r.selection.ranges.length;s++){let{$from:{pos:o},$to:{pos:l}}=r.selection.ranges[s];a.setBlockType(o,l,e,t)}n(a.scrollIntoView())}return!0}}function hlt(e,t,r,n){for(let i=0;i<t.length;i++){let{$from:a,$to:s}=t[i],o=a.depth==0?e.inlineContent&&e.type.allowsMarkType(r):!1;if(e.nodesBetween(a.pos,s.pos,(l,u)=>{if(o||!n&&l.isAtom&&l.isInline&&u>=a.pos&&u+l.nodeSize<=s.pos)return!1;o=l.inlineContent&&l.type.allowsMarkType(r)}),o)return!0}return!1}function flt(e){let t=[];for(let r=0;r<e.length;r++){let{$from:n,$to:i}=e[r];n.doc.nodesBetween(n.pos,i.pos,(a,s)=>{if(a.isAtom&&a.content.size&&a.isInline&&s>=n.pos&&s+a.nodeSize<=i.pos)return s+1>n.pos&&t.push(new Np(n,n.doc.resolve(s+1))),n=n.doc.resolve(s+1+a.content.size),!1}),n.pos<i.pos&&t.push(new Np(n,i))}return t}function fx(e,t=null,r){let n=(r&&r.removeWhenPresent)!==!1,i=(r&&r.enterInlineAtoms)!==!1,a=!(r&&r.includeWhitespace);return function(s,o){let{empty:l,$cursor:u,ranges:h}=s.selection;if(l&&!u||!hlt(s.doc,h,e,i))return!1;if(o)if(u)e.isInSet(s.storedMarks||u.marks())?o(s.tr.removeStoredMark(e)):o(s.tr.addStoredMark(e.create(t)));else{let f,d=s.tr;i||(h=flt(h)),n?f=!h.some(p=>s.doc.rangeHasMark(p.$from.pos,p.$to.pos,e)):f=!h.every(p=>{let m=!1;return d.doc.nodesBetween(p.$from.pos,p.$to.pos,(g,y,v)=>{if(m)return!1;m=!e.isInSet(g.marks)&&!!v&&v.type.allowsMarkType(e)&&!(g.isText&&/^\s*$/.test(g.textBetween(Math.max(0,p.$from.pos-y),Math.min(g.nodeSize,p.$to.pos-y))))}),!m});for(let p=0;p<h.length;p++){let{$from:m,$to:g}=h[p];if(!f)d.removeMark(m.pos,g.pos,e);else{let y=m.pos,v=g.pos,x=m.nodeAfter,w=g.nodeBefore,C=a&&x&&x.isText?/^\s*/.exec(x.text)[0].length:0,T=a&&w&&w.isText?/\s*$/.exec(w.text)[0].length:0;y+C<v&&(y+=C,v-=T),d.addMark(y,v,e.create(t))}}o(d.scrollIntoView())}return!0}}function _1(...e){return function(t,r,n){for(let i=0;i<e.length;i++)if(e[i](t,r,n))return!0;return!1}}var kB=_1(WE,TB,CB),Yce=_1(WE,Jot,elt),Id={Enter:_1(tlt,nlt,ilt,slt),"Mod-Enter":rlt,Backspace:kB,"Mod-Backspace":kB,"Shift-Backspace":kB,Delete:Yce,"Mod-Delete":Yce,"Mod-a":olt},Jce={"Ctrl-h":Id.Backspace,"Alt-Backspace":Id["Mod-Backspace"],"Ctrl-d":Id.Delete,"Ctrl-Alt-Backspace":Id["Mod-Delete"],"Alt-Delete":Id["Mod-Delete"],"Alt-d":Id["Mod-Delete"],"Ctrl-a":clt,"Ctrl-e":ult};for(let e in Id)Jce[e]=Id[e];var dlt=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,eue=dlt?Jce:Id;var Pa=class{constructor(t,r,n={}){this.match=t,this.match=t,this.handler=typeof r=="string"?plt(r):r,this.undoable=n.undoable!==!1,this.inCode=n.inCode||!1,this.inCodeMark=n.inCodeMark!==!1}};function plt(e){return function(t,r,n,i){let a=e;if(r[1]){let s=r[0].lastIndexOf(r[1]);a+=r[0].slice(s+r[1].length),n+=s;let o=n-i;o>0&&(a=r[0].slice(s-o,s)+a,n=i)}return t.tr.insertText(a,n,i)}}var tue=(e,t)=>{let r=e.plugins;for(let n=0;n<r.length;n++){let i=r[n],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let s=e.tr,o=a.transform;for(let l=o.steps.length-1;l>=0;l--)s.step(o.steps[l].invert(o.docs[l]));if(a.text){let l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,e.schema.text(a.text,l))}else s.delete(a.from,a.to);t(s)}return!0}}return!1},l1r=new Pa(/--$/,"\u2014",{inCodeMark:!1}),c1r=new Pa(/\.\.\.$/,"\u2026",{inCodeMark:!1}),u1r=new Pa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C",{inCodeMark:!1}),h1r=new Pa(/"$/,"\u201D",{inCodeMark:!1}),f1r=new Pa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018",{inCodeMark:!1}),d1r=new Pa(/'$/,"\u2019",{inCodeMark:!1});function UE(e,t,r=null,n){return new Pa(e,(i,a,s,o)=>{let l=r instanceof Function?r(a):r,u=i.tr.delete(s,o),h=u.doc.resolve(s),f=h.blockRange(),d=f&&C1(f,t,l);if(!d)return null;u.wrap(f,d);let p=u.doc.resolve(s-1).nodeBefore;return p&&p.type==t&&E1(u.doc,s-1)&&(!n||n(a,p))&&u.join(s-1),u})}function AB(e,t,r=null){return new Pa(e,(n,i,a,s)=>{let o=n.doc.resolve(a),l=r instanceof Function?r(i):r;return o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t)?n.tr.delete(a,s).setBlockType(a,a,t,l):null})}var Dp=typeof navigator<"u"?navigator:null,rue=typeof document<"u"?document:null,Op=Dp&&Dp.userAgent||"",RB=/Edge\/(\d+)/.exec(Op),nue=/MSIE \d/.exec(Op),LB=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Op),MB=!!(nue||LB||RB),y1r=nue?document.documentMode:LB?+LB[1]:RB?+RB[1]:0,mlt=!MB&&/gecko\/(\d+)/i.test(Op),v1r=mlt&&+(/Firefox\/(\d+)/.exec(Op)||[0,0])[1],IB=!MB&&/Chrome\/(\d+)/.exec(Op),glt=!!IB,x1r=IB?+IB[1]:0,ylt=!MB&&!!Dp&&/Apple Computer/.test(Dp.vendor),vlt=ylt&&(/Mobile\/\w+/.test(Op)||!!Dp&&Dp.maxTouchPoints>2),b1r=vlt||(Dp?/Mac/.test(Dp.platform):!1),xlt=/Android \d/.test(Op),blt=!!rue&&"webkitFontSmoothing"in rue.documentElement.style,w1r=blt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function _B(e,t,r,n,i,a){if(e.composing)return!1;let s=e.state,o=s.doc.resolve(t);if(o.parent.type.spec.code)return!1;let l=o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,void 0,"\uFFFC")+n;for(let u of i){let h=u,f=h.match.exec(l),d=f&&f[0]&&h.handler(s,f,t-(f[0].length-n.length),r);if(d)return h.undoable!==!1&&d.setMeta(a,{transform:d,from:t,to:r,text:n}),e.dispatch(d),!0}return!1}var wlt=new Hi("MILKDOWN_CUSTOM_INPUTRULES");function iue({rules:e}){let t=new Ci({key:wlt,isInputRules:!0,state:{init(){return null},apply(r,n){let i=r.getMeta(this);return i||(r.selectionSet||r.docChanged?null:n)}},props:{handleTextInput(r,n,i,a){return _B(r,n,i,a,e,t)},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{let{$cursor:n}=r.state.selection;n&&_B(r,n.pos,n.pos,"",e,t)}),!1),keydown:(r,n)=>!(xlt&&glt&&n.key==="Enter")||r.composing?!1:r.someProp("handleKeyDown",i=>i(r,n))?(n.preventDefault(),!0):!1},handleKeyDown(r,n){if(n.key!=="Enter")return!1;let{$cursor:i}=r.state.selection;return i?_B(r,i.pos,i.pos,` +`,e,t):!1}}});return t}function R1(e,t,r={}){return new Pa(e,(n,i,a,s)=>{var o,l,u,h;let{tr:f}=n,d=i.length,p=i[d-1],m=i[0],g=[],y,v={group:p,fullMatch:m,start:a,end:s},x=(o=r.updateCaptured)==null?void 0:o.call(r,v);if(Object.assign(v,x),{group:p,fullMatch:m,start:a,end:s}=v,m===null||p?.trim()==="")return null;if(p){let w=m.search(/\S/),C=a+m.indexOf(p),T=C+p.length;g=(l=f.storedMarks)!=null?l:[],T<s&&f.delete(T,s),C>a&&f.delete(a+w,C),y=a+w+p.length;let k=(u=r.getAttr)==null?void 0:u.call(r,i);f.addMark(a,y,t.create(k)),f.setStoredMarks(g),(h=r.beforeDispatch)==null||h.call(r,{match:i,start:a,end:s,tr:f})}return f})}function aue(e,t,r={}){return new Pa(e,(n,i,a,s)=>{var o,l,u;let{tr:h}=n,f=i[1],d=i[0],p={group:f,fullMatch:d,start:a,end:s},m=(o=r.updateCaptured)==null?void 0:o.call(r,p);if(Object.assign(p,m),{group:f,fullMatch:d,start:a,end:s}=p,d===null||!f||f.trim()==="")return null;let g=(l=r.getAttr)==null?void 0:l.call(r,i),y=t.createAndFill(g);return y&&(h.replaceRangeWith(t.isBlock?h.doc.resolve(a).before():a,s,y),(u=r.beforeDispatch)==null||u.call(r,{match:[d,f],start:a,end:s,tr:h})),h})}function NB(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function klt(e,t){return Array.isArray(e)&&e.includes(t.type)||t.type===e}function sue(e){if(e.content.childCount===1){let t=e.content.firstChild;if(t?.type.name==="text"&&t.marks.length===0)return t;if(t?.type.name==="paragraph"&&t.childCount===1){let r=t.firstChild;if(r?.type.name==="text"&&r.marks.length===0)return r}}return!1}function Tlt(e){return t=>{for(let r=t.depth;r>0;r-=1){let n=t.node(r);if(e(n)){let i=t.before(r),a=t.after(r);return{from:i,to:a,node:n}}}}}function oue(e,t){return Tlt(r=>r.type===t)(e)}function lue(e){return t=>{for(let r=t.depth;r>0;r--){let n=t.node(r);if(e(n))return{pos:t.before(r),start:t.start(r),depth:r,node:n}}}}function cue(e,t){if(!(e instanceof cn))return;let{node:r,$from:n}=e;if(klt(t,r))return{node:r,pos:n.pos,start:n.start(n.depth),depth:n.depth}}var uue=(e,t)=>{let{selection:r,doc:n}=e;if(r instanceof cn)return{hasNode:r.node.type===t,pos:r.from,target:r.node};let{from:i,to:a}=r,s=!1,o=-1,l=null;return n.nodesBetween(i,a,(u,h)=>l?!1:u.type===t?(s=!0,o=h,l=u,!1):!0),{hasNode:s,pos:o,target:l}};var Md={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},XE={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Clt=typeof navigator<"u"&&/Mac/.test(navigator.platform),Slt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ua=0;Ua<10;Ua++)Md[48+Ua]=Md[96+Ua]=String(Ua);var Ua;for(Ua=1;Ua<=24;Ua++)Md[Ua+111]="F"+Ua;var Ua;for(Ua=65;Ua<=90;Ua++)Md[Ua]=String.fromCharCode(Ua+32),XE[Ua]=String.fromCharCode(Ua);var Ua;for(YE in Md)XE.hasOwnProperty(YE)||(XE[YE]=Md[YE]);var YE;function hue(e){var t=Clt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Slt&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",r=!t&&e.key||(e.shiftKey?XE:Md)[e.keyCode]||e.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}var Elt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Alt=typeof navigator<"u"&&/Win/.test(navigator.platform);function _lt(e){let t=e.split(/-(?!$)/),r=t[t.length-1];r=="Space"&&(r=" ");let n,i,a,s;for(let o=0;o<t.length-1;o++){let l=t[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))Elt?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(r="Alt-"+r),i&&(r="Ctrl-"+r),s&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function Rlt(e){let t=Object.create(null);for(let r in e)t[_lt(r)]=e[r];return t}function DB(e,t,r=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),r&&t.shiftKey&&(e="Shift-"+e),e}function fue(e){return new Ci({props:{handleKeyDown:OB(e)}})}function OB(e){let t=Rlt(e);return function(r,n){let i=hue(n),a,s=t[DB(i,n)];if(s&&s(r.state,r.dispatch,r))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let o=t[DB(i,n,!1)];if(o&&o(r.state,r.dispatch,r))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Alt&&n.ctrlKey&&n.altKey)&&(a=Md[n.keyCode])&&a!=i){let o=t[DB(a,n)];if(o&&o(r.state,r.dispatch,r))return!0}}return!1}}var pue=class{},mue=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw mP();return e}}},Llt=class gue extends pue{constructor(t,r,n){super(),this.type=t,this.content=r,this.attrs=n}push(t,...r){this.content.push(t,...r)}pop(){return this.content.pop()}static create(t,r,n){return new gue(t,r,n)}},yue=class extends mue{#t;static{this.create=(e,t)=>{let r=new this(e);return n=>(r.run(t,n),r.toDoc())}}constructor(e){super(),this.#t=In.none,this.#e=t=>t.isText,this.#n=(t,r)=>{if(this.#e(t)&&this.#e(r)&&In.sameSet(t.marks,r.marks))return this.schema.text(t.text+r.text,t.marks)},this.#r=t=>{let r=Object.values({...this.schema.nodes,...this.schema.marks}).find(n=>n.spec.parseMarkdown.match(t));if(!r)throw Eoe(t);return r},this.#s=t=>{let r=this.#r(t);r.spec.parseMarkdown.runner(this,t,r)},this.injectRoot=(t,r,n)=>(this.openNode(r,n),this.next(t.children),this),this.openNode=(t,r)=>(this.open(Llt.create(t,[],r)),this),this.#a=()=>{this.#t=In.none;let t=this.close();return this.#i(t.type,t.attrs,t.content)},this.closeNode=()=>{try{this.#a()}catch(t){console.error(t)}return this},this.#i=(t,r,n)=>{let i=t.createAndFill(r,n,this.#t);if(!i)throw Soe(t,r,n);return this.push(i),i},this.addNode=(t,r,n)=>{try{this.#i(t,r,n)}catch(i){console.error(i)}return this},this.openMark=(t,r)=>{let n=t.create(r);return this.#t=n.addToSet(this.#t),this},this.closeMark=t=>(this.#t=t.removeFromSet(this.#t),this),this.addText=t=>{try{let r=this.top();if(!r)throw mP();let n=r.pop(),i=this.schema.text(t,this.#t);if(!n)return r.push(i),this;let a=this.#n(n,i);return a?(r.push(a),this):(r.push(n,i),this)}catch(r){return console.error(r),this}},this.build=()=>{let t;do t=this.#a();while(this.size());return t},this.next=(t=[])=>([t].flat().forEach(r=>this.#s(r)),this),this.toDoc=()=>this.build(),this.run=(t,r)=>{let n=t.runSync(t.parse(r),r);return this.next(n),this},this.schema=e}#e;#n;#r;#s;#a;#i},due=class vue extends pue{constructor(t,r,n,i={}){super(),this.type=t,this.children=r,this.value=n,this.props=i,this.push=(a,...s)=>{this.children||(this.children=[]),this.children.push(a,...s)},this.pop=()=>this.children?.pop()}static{this.create=(t,r,n,i={})=>new vue(t,r,n,i)}},Ilt=e=>Object.prototype.hasOwnProperty.call(e,"size"),xue=class extends mue{#t;static{this.create=(e,t)=>{let r=new this(e);return n=>(r.run(n),r.toString(t))}}constructor(e){super(),this.#t=In.none,this.#e=t=>{let r=Object.values({...this.schema.nodes,...this.schema.marks}).find(n=>n.spec.toMarkdown.match(t));if(!r)throw Aoe(t.type);return r},this.#n=t=>this.#e(t).spec.toMarkdown.runner(this,t),this.#r=(t,r)=>this.#e(t).spec.toMarkdown.runner(this,t,r),this.#s=t=>{let{marks:r}=t,n=i=>i.type.spec.priority??50;[...r].sort((i,a)=>n(i)-n(a)).every(i=>!this.#r(i,t))&&this.#n(t),r.forEach(i=>this.#f(i))},this.#a=(t,r)=>{if(t.type===r||t.children?.length!==1)return t;let n=o=>{if(o.type===r)return o.value!=null?null:o;if(o.children?.length!==1)return null;let[l]=o.children;return l?n(l):null},i=n(t);if(!i)return t;let a=i.children?[...i.children]:void 0,s={...t,children:a};return s.children=a,i.children=[s],i},this.#i=t=>{let{children:r}=t;return r&&(t.children=r.reduce((n,i,a)=>{if(a===0)return[i];let s=n.at(-1);if(s&&s.isMark&&i.isMark){i=this.#a(i,s.type);let{children:o,...l}=i,{children:u,...h}=s;if(i.type===s.type&&o&&u&&JSON.stringify(l)===JSON.stringify(h)){let f={...h,children:[...u,...o]};return n.slice(0,-1).concat(this.#i(f))}}return n.concat(i)},[])),t},this.#o=t=>{let r={...t.props,type:t.type};return t.children&&(r.children=t.children),t.value&&(r.value=t.value),r},this.openNode=(t,r,n)=>(this.open(due.create(t,void 0,r,n)),this),this.#l=(t,r)=>{let n="",i="",a=t.children,s=-1,o=-1,l=h=>{h&&h.forEach((f,d)=>{f.type==="text"&&f.value&&(s<0&&(s=d),o=d)})};if(a){l(a);let h=a?.[o],f=a?.[s];if(h&&h.value.endsWith(" ")){let d=h.value,p=d.trimEnd();i=d.slice(p.length),h.value=p}if(f&&f.value.startsWith(" ")){let d=f.value,p=d.trimStart();n=d.slice(0,d.length-p.length),f.value=p}}n.length&&this.#c("text",void 0,n);let u=r();return i.length&&this.#c("text",void 0,i),u},this.#u=(t=!1)=>{let r=this.close(),n=()=>this.#c(r.type,r.children,r.value,r.props);return t?this.#l(r,n):n()},this.closeNode=()=>(this.#u(),this),this.#c=(t,r,n,i)=>{let a=due.create(t,r,n,i),s=this.#i(this.#o(a));return this.push(s),s},this.addNode=(t,r,n,i)=>(this.#c(t,r,n,i),this),this.#h=(t,r,n,i)=>t.isInSet(this.#t)?this:(this.#t=t.addToSet(this.#t),this.openNode(r,n,{...i,isMark:!0})),this.#f=t=>{t.isInSet(this.#t)&&(this.#t=t.type.removeFromSet(this.#t),this.#u(!0))},this.withMark=(t,r,n,i)=>(this.#h(t,r,n,i),this),this.closeMark=t=>(this.#f(t),this),this.build=()=>{let t=null;do t=this.#u();while(this.size());return t},this.next=t=>Ilt(t)?(t.forEach(r=>{this.#s(r)}),this):(this.#s(t),this),this.toString=t=>t.stringify(this.build()),this.run=t=>(this.next(t),this),this.schema=e}#e;#n;#r;#s;#a;#i;#o;#l;#u;#c;#h;#f};var Qs=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},gx=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},GB=null,Dd=function(e,t,r){let n=GB||(GB=document.createRange());return n.setEnd(e,r??e.nodeValue.length),n.setStart(e,t||0),n},Mlt=function(){GB=null},B1=function(e,t,r,n){return r&&(bue(e,t,r,n,-1)||bue(e,t,r,n,1))},Nlt=/^(img|br|input|textarea|hr)$/i;function bue(e,t,r,n,i){for(var a;;){if(e==r&&t==n)return!0;if(t==(i<0?0:lu(e))){let s=e.parentNode;if(!s||s.nodeType!=1||sT(e)||Nlt.test(e.nodeName)||e.contentEditable=="false")return!1;t=Qs(e)+(i<0?0:1),e=s}else if(e.nodeType==1){let s=e.childNodes[t+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((a=s.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)t+=i;else return!1;else e=s,t=i<0?lu(e):0}else return!1}}function lu(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Dlt(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=lu(e)}else if(e.parentNode&&!sT(e))t=Qs(e),e=e.parentNode;else return null}}function Olt(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!sT(e))t=Qs(e)+1,e=e.parentNode;else return null}}function Plt(e,t,r){for(let n=t==0,i=t==lu(e);n||i;){if(e==r)return!0;let a=Qs(e);if(e=e.parentNode,!e)return!1;n=n&&a==0,i=i&&a==lu(e)}}function sT(e){let t;for(let r=e;r&&!(t=r.pmViewDesc);r=r.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var s7=function(e){return e.focusNode&&B1(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function L1(e,t){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=t,r}function Blt(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Flt(e,t,r){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(t,r);if(n)return{node:n.offsetNode,offset:Math.min(lu(n.offsetNode),n.offset)}}catch{}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(t,r);if(n)return{node:n.startContainer,offset:Math.min(lu(n.startContainer),n.startOffset)}}}var Xh=typeof navigator<"u"?navigator:null,wue=typeof document<"u"?document:null,zp=Xh&&Xh.userAgent||"",qB=/Edge\/(\d+)/.exec(zp),Zue=/MSIE \d/.exec(zp),VB=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zp),zl=!!(Zue||VB||qB),Fp=Zue?document.documentMode:VB?+VB[1]:qB?+qB[1]:0,cu=!zl&&/gecko\/(\d+)/i.test(zp);cu&&+(/Firefox\/(\d+)/.exec(zp)||[0,0])[1];var WB=!zl&&/Chrome\/(\d+)/.exec(zp),Ms=!!WB,Que=WB?+WB[1]:0,Do=!zl&&!!Xh&&/Apple Computer/.test(Xh.vendor),yx=Do&&(/Mobile\/\w+/.test(zp)||!!Xh&&Xh.maxTouchPoints>2),ou=yx||(Xh?/Mac/.test(Xh.platform):!1),Jue=Xh?/Win/.test(Xh.platform):!1,Od=/Android \d/.test(zp),oT=!!wue&&"webkitFontSmoothing"in wue.documentElement.style,$lt=oT?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function zlt(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Nd(e,t){return typeof e=="number"?e:e[t]}function Glt(e){let t=e.getBoundingClientRect(),r=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*r,top:t.top,bottom:t.top+e.clientHeight*n}}function kue(e,t,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,a=e.dom.ownerDocument;for(let s=r||e.dom;s;){if(s.nodeType!=1){s=gx(s);continue}let o=s,l=o==a.body,u=l?zlt(a):Glt(o),h=0,f=0;if(t.top<u.top+Nd(n,"top")?f=-(u.top-t.top+Nd(i,"top")):t.bottom>u.bottom-Nd(n,"bottom")&&(f=t.bottom-t.top>u.bottom-u.top?t.top+Nd(i,"top")-u.top:t.bottom-u.bottom+Nd(i,"bottom")),t.left<u.left+Nd(n,"left")?h=-(u.left-t.left+Nd(i,"left")):t.right>u.right-Nd(n,"right")&&(h=t.right-u.right+Nd(i,"right")),h||f)if(l)a.defaultView.scrollBy(h,f);else{let p=o.scrollLeft,m=o.scrollTop;f&&(o.scrollTop+=f),h&&(o.scrollLeft+=h);let g=o.scrollLeft-p,y=o.scrollTop-m;t={left:t.left-g,top:t.top-y,right:t.right-g,bottom:t.bottom-y}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:gx(s)}}function qlt(e){let t=e.dom.getBoundingClientRect(),r=Math.max(0,t.top),n,i;for(let a=(t.left+t.right)/2,s=r+1;s<Math.min(innerHeight,t.bottom);s+=5){let o=e.root.elementFromPoint(a,s);if(!o||o==e.dom||!e.dom.contains(o))continue;let l=o.getBoundingClientRect();if(l.top>=r-20){n=o,i=l.top;break}}return{refDOM:n,refTop:i,stack:ehe(e.dom)}}function ehe(e){let t=[],r=e.ownerDocument;for(let n=e;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=gx(n));return t}function Vlt({refDOM:e,refTop:t,stack:r}){let n=e?e.getBoundingClientRect().top:0;the(r,n==0?0:n-t)}function the(e,t){for(let r=0;r<e.length;r++){let{dom:n,top:i,left:a}=e[r];n.scrollTop!=i+t&&(n.scrollTop=i+t),n.scrollLeft!=a&&(n.scrollLeft=a)}}var dx=null;function Wlt(e){if(e.setActive)return e.setActive();if(dx)return e.focus(dx);let t=ehe(e);e.focus(dx==null?{get preventScroll(){return dx={preventScroll:!0},!0}}:void 0),dx||(dx=!1,the(t,0))}function rhe(e,t){let r,n=2e8,i,a=0,s=t.top,o=t.top,l,u;for(let h=e.firstChild,f=0;h;h=h.nextSibling,f++){let d;if(h.nodeType==1)d=h.getClientRects();else if(h.nodeType==3)d=Dd(h).getClientRects();else continue;for(let p=0;p<d.length;p++){let m=d[p];if(m.top<=s&&m.bottom>=o){s=Math.max(m.bottom,s),o=Math.min(m.top,o);let g=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(g<n){r=h,n=g,i=g&&r.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,h.nodeType==1&&g&&(a=f+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=h,u={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!r&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(a=f+1)}}return!r&&l&&(r=l,i=u,n=0),r&&r.nodeType==3?Hlt(r,i):!r||n&&r.nodeType==1?{node:e,offset:a}:rhe(r,i)}function Hlt(e,t){let r=e.nodeValue.length,n=document.createRange(),i;for(let a=0;a<r;a++){n.setEnd(e,a+1),n.setStart(e,a);let s=Pp(n,1);if(s.top!=s.bottom&&sF(t,s)){i={node:e,offset:a+(t.left>=(s.left+s.right)/2?1:0)};break}}return n.detach(),i||{node:e,offset:0}}function sF(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Ult(e,t){let r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&t.left<e.getBoundingClientRect().left?r:e}function Ylt(e,t,r){let{node:n,offset:i}=rhe(t,r),a=-1;if(n.nodeType==1&&!n.firstChild){let s=n.getBoundingClientRect();a=s.left!=s.right&&r.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(n,i,a)}function Xlt(e,t,r,n){let i=-1;for(let a=t,s=!1;a!=e.dom;){let o=e.docView.nearestDesc(a,!0),l;if(!o)return null;if(o.dom.nodeType==1&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((l=o.dom.getBoundingClientRect()).width||l.height)&&(o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(!s&&l.left>n.left||l.top>n.top?i=o.posBefore:(!s&&l.right<n.left||l.bottom<n.top)&&(i=o.posAfter),s=!0),!o.contentDOM&&i<0&&!o.node.isText))return(o.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?o.posBefore:o.posAfter;a=o.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,r,-1)}function nhe(e,t,r){let n=e.childNodes.length;if(n&&r.top<r.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(t.top-r.top)/(r.bottom-r.top))-2)),a=i;;){let s=e.childNodes[a];if(s.nodeType==1){let o=s.getClientRects();for(let l=0;l<o.length;l++){let u=o[l];if(sF(t,u))return nhe(s,t,u)}}if((a=(a+1)%n)==i)break}return e}function jlt(e,t){let r=e.dom.ownerDocument,n,i=0,a=Flt(r,t.left,t.top);a&&({node:n,offset:i}=a);let s=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top),o;if(!s||!e.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=e.dom.getBoundingClientRect();if(!sF(t,u)||(s=nhe(e.dom,t,u),!s))return null}if(Do)for(let u=s;n&&u;u=gx(u))u.draggable&&(n=void 0);if(s=Ult(s,t),n){if(cu&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let h=n.childNodes[i],f;h.nodeName=="IMG"&&(f=h.getBoundingClientRect()).right<=t.left&&f.bottom>t.top&&i++}let u;oT&&i&&n.nodeType==1&&(u=n.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&t.top>n.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(o=Xlt(e,n,i,t))}o==null&&(o=Ylt(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function Tue(e){return e.top<e.bottom||e.left<e.right}function Pp(e,t){let r=e.getClientRects();if(r.length){let n=r[t<0?0:r.length-1];if(Tue(n))return n}return Array.prototype.find.call(r,Tue)||e.getBoundingClientRect()}var Klt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ihe(e,t,r){let{node:n,offset:i,atom:a}=e.docView.domFromPos(t,r<0?-1:1),s=oT||cu;if(n.nodeType==3)if(s&&(Klt.test(n.nodeValue)||(r<0?!i:i==n.nodeValue.length))){let l=Pp(Dd(n,i,i),r);if(cu&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let u=Pp(Dd(n,i-1,i-1),-1);if(u.top==l.top){let h=Pp(Dd(n,i,i+1),-1);if(h.top!=l.top)return Jk(h,h.left<u.left)}}return l}else{let l=i,u=i,h=r<0?1:-1;return r<0&&!i?(u++,h=-1):r>=0&&i==n.nodeValue.length?(l--,h=1):r<0?l--:u++,Jk(Pp(Dd(n,l,u),h),h<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(r<0||i==lu(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return PB(l.getBoundingClientRect(),!1)}if(a==null&&i<lu(n)){let l=n.childNodes[i];if(l.nodeType==1)return PB(l.getBoundingClientRect(),!0)}return PB(n.getBoundingClientRect(),r>=0)}if(a==null&&i&&(r<0||i==lu(n))){let l=n.childNodes[i-1],u=l.nodeType==3?Dd(l,lu(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return Jk(Pp(u,1),!1)}if(a==null&&i<lu(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?Dd(l,0,s?0:1):l.nodeType==1?l:null:null;if(u)return Jk(Pp(u,-1),!0)}return Jk(Pp(n.nodeType==3?Dd(n):n,-r),r>=0)}function Jk(e,t){if(e.width==0)return e;let r=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function PB(e,t){if(e.height==0)return e;let r=t?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function ahe(e,t,r){let n=e.state,i=e.root.activeElement;n!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return r()}finally{n!=t&&e.updateState(n),i!=e.dom&&i&&i.focus()}}function Zlt(e,t,r){let n=t.selection,i=r=="up"?n.$from:n.$to;return ahe(e,t,()=>{let{node:a}=e.docView.domFromPos(i.pos,r=="up"?-1:1);for(;;){let o=e.docView.nearestDesc(a,!0);if(!o)break;if(o.node.isBlock){a=o.contentDOM||o.dom;break}a=o.dom.parentNode}let s=ihe(e,i.pos,1);for(let o=a.firstChild;o;o=o.nextSibling){let l;if(o.nodeType==1)l=o.getClientRects();else if(o.nodeType==3)l=Dd(o,0,o.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let h=l[u];if(h.bottom>h.top+1&&(r=="up"?s.top-h.top>(h.bottom-s.top)*2:h.bottom-s.bottom>(s.bottom-h.top)*2))return!1}}return!0})}var Qlt=/[\u0590-\u08ac]/;function Jlt(e,t,r){let{$head:n}=t.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,a=!i,s=i==n.parent.content.size,o=e.domSelection();return o?!Qlt.test(n.parent.textContent)||!o.modify?r=="left"||r=="backward"?a:s:ahe(e,t,()=>{let{focusNode:l,focusOffset:u,anchorNode:h,anchorOffset:f}=e.domSelectionRange(),d=o.caretBidiLevel;o.modify("move",r,"character");let p=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:m,focusOffset:g}=e.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==g;try{o.collapse(h,f),l&&(l!=h||u!=f)&&o.extend&&o.extend(l,u)}catch{}return d!=null&&(o.caretBidiLevel=d),y}):n.pos==n.start()||n.pos==n.end()}var Cue=null,Sue=null,Eue=!1;function ect(e,t,r){return Cue==t&&Sue==r?Eue:(Cue=t,Sue=r,Eue=r=="up"||r=="down"?Zlt(e,t,r):Jlt(e,t,r))}var uu=0,Aue=1,I1=2,Ju=3,F1=class{constructor(t,r,n,i){this.parent=t,this.children=r,this.dom=n,this.contentDOM=i,this.dirty=uu,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,r,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let r=0;r<this.children.length;r++)t+=this.children[r].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let r=0,n=this.posAtStart;;r++){let i=this.children[r];if(i==t)return n;n+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,r,n){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(n<0){let a,s;if(t==this.contentDOM)a=t.childNodes[r-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;a=t.previousSibling}for(;a&&!((s=a.pmViewDesc)&&s.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(s)+s.size:this.posAtStart}else{let a,s;if(t==this.contentDOM)a=t.childNodes[r];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;a=t.nextSibling}for(;a&&!((s=a.pmViewDesc)&&s.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(s):this.posAtEnd}let i;if(t==this.dom&&this.contentDOM)i=r>Qs(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(r==0)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&r==t.childNodes.length)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(t,r=!1){for(let n=!0,i=t;i;i=i.parentNode){let a=this.getDesc(i),s;if(a&&(!r||a.node))if(n&&(s=a.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))n=!1;else return a}}getDesc(t){let r=t.pmViewDesc;for(let n=r;n;n=n.parent)if(n==this)return r}posFromDOM(t,r,n){for(let i=t;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(t,r,n)}return-1}descAt(t){for(let r=0,n=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==t&&a!=n){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let o=i.children[s];if(o.size){i=o;break}}return i}if(t<a)return i.descAt(t-n-i.border);n=a}}domFromPos(t,r){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let n=0,i=0;for(let a=0;n<this.children.length;n++){let s=this.children[n],o=a+s.size;if(o>t||s instanceof ZE){i=t-a;break}a=o}if(i)return this.children[n].domFromPos(i-this.children[n].border,r);for(let a;n&&!(a=this.children[n-1]).size&&a instanceof jE&&a.side>=0;n--);if(r<=0){let a,s=!0;for(;a=n?this.children[n-1]:null,!(!a||a.dom.parentNode==this.contentDOM);n--,s=!1);return a&&r&&s&&!a.border&&!a.domAtom?a.domFromPos(a.size,r):{node:this.contentDOM,offset:a?Qs(a.dom)+1:0}}else{let a,s=!0;for(;a=n<this.children.length?this.children[n]:null,!(!a||a.dom.parentNode==this.contentDOM);n++,s=!1);return a&&s&&!a.border&&!a.domAtom?a.domFromPos(0,r):{node:this.contentDOM,offset:a?Qs(a.dom):this.contentDOM.childNodes.length}}}parseRange(t,r,n=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:r,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,a=-1;for(let s=n,o=0;;o++){let l=this.children[o],u=s+l.size;if(i==-1&&t<=u){let h=s+l.border;if(t>=h&&r<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,r,h);t=s;for(let f=o;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=Qs(d.dom)+1;break}t-=d.size}i==-1&&(i=0)}if(i>-1&&(u>r||o==this.children.length-1)){r=u;for(let h=o+1;h<this.children.length;h++){let f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){a=Qs(f.dom);break}r+=f.size}a==-1&&(a=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:t,to:r,fromOffset:i,toOffset:a}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let r=this.children[t<0?0:this.children.length-1];return r.size==0||r.emptyChildAt(t)}domAfterPos(t){let{node:r,offset:n}=this.domFromPos(t,0);if(r.nodeType!=1||n==r.childNodes.length)throw new RangeError("No node after pos "+t);return r.childNodes[n]}setSelection(t,r,n,i=!1){let a=Math.min(t,r),s=Math.max(t,r);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(a>m&&s<y)return g.setSelection(t-m-g.border,r-m-g.border,n,i);m=y}let o=this.domFromPos(t,t?-1:1),l=r==t?o:this.domFromPos(r,r?-1:1),u=n.root.getSelection(),h=n.domSelectionRange(),f=!1;if((cu||Do)&&t==r){let{node:p,offset:m}=o;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==` +`),f&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(o=l={node:y.parentNode,offset:Qs(y)+1});break}let v=g.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(cu&&h.focusNode&&h.focusNode!=l.node&&h.focusNode.nodeType==1){let p=h.focusNode.childNodes[h.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&Do)&&B1(o.node,o.offset,h.anchorNode,h.anchorOffset)&&B1(l.node,l.offset,h.focusNode,h.focusOffset))return;let d=!1;if((u.extend||t==r)&&!(f&&cu)){u.collapse(o.node,o.offset);try{t!=r&&u.extend(l.node,l.offset),d=!0}catch{}}if(!d){if(t>r){let m=o;o=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(o.node,o.offset),u.removeAllRanges(),u.addRange(p)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,r){for(let n=0,i=0;i<this.children.length;i++){let a=this.children[i],s=n+a.size;if(n==s?t<=s&&r>=n:t<s&&r>n){let o=n+a.border,l=s-a.border;if(t>=o&&r<=l){this.dirty=t==n||r==s?I1:Aue,t==o&&r==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Ju:a.markDirty(t-o,r-o);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?I1:Ju}n=s}this.dirty=I1}markParentsDirty(){let t=1;for(let r=this.parent;r;r=r.parent,t++){let n=t==1?I1:Aue;r.dirty<n&&(r.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}},jE=class extends F1{constructor(t,r,n,i){let a,s=r.type.toDOM;if(typeof s=="function"&&(s=s(n,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!r.type.spec.raw){if(s.nodeType!=1){let o=document.createElement("span");o.appendChild(s),s=o}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=r,this.widget=r,a=this}matchesWidget(t){return this.dirty==uu&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let r=this.widget.spec.stopEvent;return r?r(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},HB=class extends F1{constructor(t,r,n,i){super(t,[],r,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(t,r){return t!=this.textDOM?this.posAtStart+(r?this.size:0):this.posAtStart+r}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}},N1=class e extends F1{constructor(t,r,n,i,a){super(t,[],n,i),this.mark=r,this.spec=a}static create(t,r,n,i){let a=i.nodeViews[r.type.name],s=a&&a(r,i,n);return(!s||!s.dom)&&(s=Yh.renderSpec(document,r.type.spec.toDOM(r,n),null,r.attrs)),new e(t,r,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Ju||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Ju&&this.mark.eq(t)}markDirty(t,r){if(super.markDirty(t,r),this.dirty!=uu){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=uu}}slice(t,r,n){let i=e.create(this.parent,this.mark,!0,n),a=this.children,s=this.size;r<s&&(a=jB(a,r,s,n)),t>0&&(a=jB(a,0,t,n));for(let o=0;o<a.length;o++)a[o].parent=i;return i.children=a,i}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},$p=class e extends F1{constructor(t,r,n,i,a,s,o){super(t,[],a,s),this.node=r,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=o}static create(t,r,n,i,a,s){let o=a.nodeViews[r.type.name],l,u=o&&o(r,a,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},n,i),h=u&&u.dom,f=u&&u.contentDOM;if(r.isText){if(!h)h=document.createTextNode(r.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:f}=Yh.renderSpec(document,r.type.spec.toDOM(r),null,r.attrs));!f&&!r.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),r.type.spec.draggable&&(h.draggable=!0));let d=h;return h=lhe(h,n,r),u?l=new UB(t,r,n,i,h,f||null,d,u):r.isText?new KE(t,r,n,i,h,d):new e(t,r,n,i,h,f||null,d)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let n=this.children[r];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>Lt.empty)}return t}matchesNode(t,r,n){return this.dirty==uu&&t.eq(this.node)&&QE(r,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,r){let n=this.node.inlineContent,i=r,a=t.composing?this.localCompositionInfo(t,r):null,s=a&&a.pos>-1?a:null,o=a&&a.pos<0,l=new XB(this,s&&s.node,t);ict(this.node,this.innerDeco,(u,h,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,n,t,h):u.type.side>=0&&!f&&l.syncToMarks(h==this.node.childCount?In.none:this.node.child(h).marks,n,t,h),l.placeWidget(u,t,i)},(u,h,f,d)=>{l.syncToMarks(u.marks,n,t,d);let p;l.findNodeMatch(u,h,f,d)||o&&t.state.selection.from>i&&t.state.selection.to<i+u.nodeSize&&(p=l.findIndexWithChild(a.node))>-1&&l.updateNodeAt(u,h,f,p,t)||l.updateNextNode(u,h,f,t,d,i)||l.addNode(u,h,f,t,i),i+=u.nodeSize}),l.syncToMarks([],n,t,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==I1)&&(s&&this.protectLocalComposition(t,s),she(this.contentDOM,this.children,t),yx&&act(this.dom))}localCompositionInfo(t,r){let{from:n,to:i}=t.state.selection;if(!(t.state.selection instanceof Pr)||n<r||i>r+this.node.content.size)return null;let a=t.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let s=a.nodeValue,o=sct(this.node.content,s,n-r,i-r);return o<0?null:{node:a,pos:o,text:s}}else return{node:a,pos:-1,text:""}}protectLocalComposition(t,{node:r,pos:n,text:i}){if(this.getDesc(r))return;let a=r;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let s=new HB(this,a,r,i);t.input.compositionNodes.push(s),this.children=jB(this.children,n,n+i.length,t,s)}update(t,r,n,i){return this.dirty==Ju||!t.sameMarkup(this.node)?!1:(this.updateInner(t,r,n,i),!0)}updateInner(t,r,n,i){this.updateOuterDeco(r),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=uu}updateOuterDeco(t){if(QE(t,this.outerDeco))return;let r=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=ohe(this.dom,this.nodeDOM,YB(this.outerDeco,this.node,r),YB(t,this.node,r)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function _ue(e,t,r,n,i){lhe(n,t,e);let a=new $p(void 0,e,t,r,n,n,n);return a.contentDOM&&a.updateChildren(i,0),a}var KE=class e extends $p{constructor(t,r,n,i,a,s){super(t,r,n,i,a,null,s)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,r,n,i){return this.dirty==Ju||this.dirty!=uu&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(r),(this.dirty!=uu||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=uu,!0)}inParent(){let t=this.parent.contentDOM;for(let r=this.nodeDOM;r;r=r.parentNode)if(r==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,r,n){return t==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):super.localPosFromDOM(t,r,n)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,r,n){let i=this.node.cut(t,r),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(t,r){super.markDirty(t,r),this.dom!=this.nodeDOM&&(t==0||r==this.nodeDOM.nodeValue.length)&&(this.dirty=Ju)}get domAtom(){return!1}isText(t){return this.node.text==t}},ZE=class extends F1{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==uu&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},UB=class extends $p{constructor(t,r,n,i,a,s,o,l){super(t,r,n,i,a,s,o),this.spec=l}update(t,r,n,i){if(this.dirty==Ju)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let a=this.spec.update(t,r,n);return a&&this.updateInner(t,r,n,i),a}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,r,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,r,n,i){this.spec.setSelection?this.spec.setSelection(t,r,n.root):super.setSelection(t,r,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}};function she(e,t,r){let n=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let s=t[a],o=s.dom;if(o.parentNode==e){for(;o!=n;)n=Rue(n),i=!0;n=n.nextSibling}else i=!0,e.insertBefore(o,n);if(s instanceof N1){let l=n?n.previousSibling:e.lastChild;she(s.contentDOM,s.children,r),n=l?l.nextSibling:e.firstChild}}for(;n;)n=Rue(n),i=!0;i&&r.trackWrites==e&&(r.trackWrites=null)}var eT=function(e){e&&(this.nodeName=e)};eT.prototype=Object.create(null);var M1=[new eT];function YB(e,t,r){if(e.length==0)return M1;let n=r?M1[0]:new eT,i=[n];for(let a=0;a<e.length;a++){let s=e[a].type.attrs;if(s){s.nodeName&&i.push(n=new eT(s.nodeName));for(let o in s){let l=s[o];l!=null&&(r&&i.length==1&&i.push(n=new eT(t.isInline?"span":"div")),o=="class"?n.class=(n.class?n.class+" ":"")+l:o=="style"?n.style=(n.style?n.style+";":"")+l:o!="nodeName"&&(n[o]=l))}}}return i}function ohe(e,t,r,n){if(r==M1&&n==M1)return t;let i=t;for(let a=0;a<n.length;a++){let s=n[a],o=r[a];if(a){let l;o&&o.nodeName==s.nodeName&&i!=e&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),o=M1[0]),i=l}tct(i,o||M1[0],s)}return i}function tct(e,t,r){for(let n in t)n!="class"&&n!="style"&&n!="nodeName"&&!(n in r)&&e.removeAttribute(n);for(let n in r)n!="class"&&n!="style"&&n!="nodeName"&&r[n]!=t[n]&&e.setAttribute(n,r[n]);if(t.class!=r.class){let n=t.class?t.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let a=0;a<n.length;a++)i.indexOf(n[a])==-1&&e.classList.remove(n[a]);for(let a=0;a<i.length;a++)n.indexOf(i[a])==-1&&e.classList.add(i[a]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=r.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(t.style);)e.style.removeProperty(i[1])}r.style&&(e.style.cssText+=r.style)}}function lhe(e,t,r){return ohe(e,e,M1,YB(t,r,e.nodeType!=1))}function QE(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].type.eq(t[r].type))return!1;return!0}function Rue(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var XB=class{constructor(t,r,n){this.lock=r,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=rct(t.node.content,t)}destroyBetween(t,r){if(t!=r){for(let n=t;n<r;n++)this.top.children[n].destroy();this.top.children.splice(t,r-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,r,n,i){let a=0,s=this.stack.length>>1,o=Math.min(s,t.length);for(;a<o&&(a==s-1?this.top:this.stack[a+1<<1]).matchesMark(t[a])&&t[a].type.spec.spanning!==!1;)a++;for(;a<s;)this.destroyRest(),this.top.dirty=uu,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<t.length;){this.stack.push(this.top,this.index+1);let l=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let h=this.index;h<u;h++){let f=this.top.children[h];if(f.matchesMark(t[s])&&!this.isLocked(f.dom)){l=h;break}}if(l<0&&this.index<this.top.children.length){let h=this.top.children[this.index];h instanceof N1&&h.dirty!=Ju&&h.mark.type==t[s].type&&h.spec.update&&!this.isLocked(h.dom)&&h.spec.update(t[s])&&(h.mark=t[s],l=this.index,this.changed=!0)}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let h=N1.create(this.top,t[s],r,n);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,s++}}findNodeMatch(t,r,n,i){let a=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(t,r,n))a=this.top.children.indexOf(s,this.index);else for(let o=this.index,l=Math.min(this.top.children.length,o+5);o<l;o++){let u=this.top.children[o];if(u.matchesNode(t,r,n)&&!this.preMatch.matched.has(u)){a=o;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(t,r,n,i,a){let s=this.top.children[i];return s.dirty==Ju&&s.dom==s.contentDOM&&(s.dirty=I1),s.update(t,r,n,a)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let r=t.parentNode;if(!r)return-1;if(r==this.top.contentDOM){let n=t.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}t=r}}updateNextNode(t,r,n,i,a,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof $p){let u=this.preMatch.matched.get(l);if(u!=null&&u!=a)return!1;let h=l.dom,f,d=this.isLocked(h)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=Ju&&QE(r,l.outerDeco));if(!d&&l.update(t,r,n,i))return this.destroyBetween(this.index,o),l.dom!=h&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(l,t,r,n,i,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=I1,f.updateChildren(i,s+1),f.dirty=uu),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,r,n,i,a,s){if(t.dirty||r.isAtom||!t.children.length||!t.node.content.eq(r.content)||!QE(n,t.outerDeco)||!i.eq(t.innerDeco))return null;let o=$p.create(this.top,r,n,i,a,s);if(o.contentDOM){o.children=t.children,t.children=[];for(let l of o.children)l.parent=o}return t.destroy(),o}addNode(t,r,n,i,a){let s=$p.create(this.top,t,r,n,i,a);s.contentDOM&&s.updateChildren(i,a+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,r,n){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(t)&&(t==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let a=new jE(this.top,t,r,n);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],r=this.top;for(;t instanceof N1;)r=t,t=r.children[r.children.length-1];(!t||!(t instanceof KE)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Do||Ms)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",r),this.addHackNode("BR",this.top))}addHackNode(t,r){if(r==this.top&&this.index<r.children.length&&r.children[this.index].matchesHack(t))this.index++;else{let n=document.createElement(t);t=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),t=="BR"&&(n.className="ProseMirror-trailingBreak");let i=new ZE(this.top,[],n,null);r!=this.top?r.children.push(i):r.children.splice(this.index++,0,i),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}};function rct(e,t){let r=t,n=r.children.length,i=e.childCount,a=new Map,s=[];e:for(;i>0;){let o;for(;;)if(n){let u=r.children[n-1];if(u instanceof N1)r=u,n=u.children.length;else{o=u,n--;break}}else{if(r==t)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=o.node;if(l){if(l!=e.child(i-1))break;--i,a.set(o,i),s.push(o)}}return{index:i,matched:a,matches:s.reverse()}}function nct(e,t){return e.type.side-t.type.side}function ict(e,t,r,n){let i=t.locals(e),a=0;if(i.length==0){for(let u=0;u<e.childCount;u++){let h=e.child(u);n(h,i,t.forChild(a,h),u),a+=h.nodeSize}return}let s=0,o=[],l=null;for(let u=0;;){let h,f;for(;s<i.length&&i[s].to==a;){let y=i[s++];y.widget&&(h?(f||(f=[h])).push(y):h=y)}if(h)if(f){f.sort(nct);for(let y=0;y<f.length;y++)r(f[y],u,!!l)}else r(h,u,!!l);let d,p;if(l)p=-1,d=l,l=null;else if(u<e.childCount)p=u,d=e.child(u++);else break;for(let y=0;y<o.length;y++)o[y].to<=a&&o.splice(y--,1);for(;s<i.length&&i[s].from<=a&&i[s].to>a;)o.push(i[s++]);let m=a+d.nodeSize;if(d.isText){let y=m;s<i.length&&i[s].from<y&&(y=i[s].from);for(let v=0;v<o.length;v++)o[v].to<y&&(y=o[v].to);y<m&&(l=d.cut(y-a),d=d.cut(0,y-a),m=y,p=-1)}else for(;s<i.length&&i[s].to<m;)s++;let g=d.isInline&&!d.isLeaf?o.filter(y=>!y.inline):o.slice();n(d,g,t.forChild(a,d),p),a=m}}function act(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function sct(e,t,r,n){for(let i=0,a=0;i<e.childCount&&a<=n;){let s=e.child(i++),o=a;if(a+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let u=e.child(i++);if(a+=u.nodeSize,!u.isText)break;l+=u.text}if(a>=r){if(a>=n&&l.slice(n-t.length-o,n-o)==t)return n-t.length;let u=o<n?l.lastIndexOf(t,n-o-1):-1;if(u>=0&&u+t.length+o>=r)return o+u;if(r==n&&l.length>=n+t.length-o&&l.slice(n-o,n-o+t.length)==t)return n}}return-1}function jB(e,t,r,n,i){let a=[];for(let s=0,o=0;s<e.length;s++){let l=e[s],u=o,h=o+=l.size;u>=r||h<=t?a.push(l):(u<t&&a.push(l.slice(0,t-u,n)),i&&(a.push(i),i=void 0),h>r&&a.push(l.slice(r-u,l.size,n)))}return a}function oF(e,t=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),a=i&&i.size==0,s=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(s<0)return null;let o=n.resolve(s),l,u;if(s7(r)){for(l=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&cn.isSelectable(f)&&i.parent&&!(f.isInline&&Plt(r.focusNode,r.focusOffset,i.dom))){let d=i.posBefore;u=new cn(s==d?o:n.resolve(d))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let f=s,d=s;for(let p=0;p<r.rangeCount;p++){let m=r.getRangeAt(p);f=Math.min(f,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),d=Math.max(d,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[l,s]=d==e.state.selection.anchor?[d,f]:[f,d],o=n.resolve(s)}else l=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}let h=n.resolve(l);if(!u){let f=t=="pointer"||e.state.selection.head<o.pos&&!a?1:-1;u=lF(e,h,o,f)}return u}function che(e){return e.editable?e.hasFocus():hhe(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Bd(e,t=!1){let r=e.state.selection;if(uhe(e,r),!che(e))return;let n=e.input.mouseDown;if(!t&&Ms&&n){let i=e.domSelectionRange(),a=e.domObserver.currentSelection;if(i.anchorNode&&a.anchorNode&&B1(i.anchorNode,i.anchorOffset,a.anchorNode,a.anchorOffset)&&n.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)lct(e);else{let{anchor:i,head:a}=r,s,o;Lue&&!(r instanceof Pr)&&(r.$from.parent.inlineContent||(s=Iue(e,r.from)),!r.empty&&!r.$from.parent.inlineContent&&(o=Iue(e,r.to))),e.docView.setSelection(i,a,e,t),Lue&&(s&&Mue(s),o&&Mue(o)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&oct(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var Lue=Do||Ms&&Que<63;function Iue(e,t){let{node:r,offset:n}=e.docView.domFromPos(t,0),i=n<r.childNodes.length?r.childNodes[n]:null,a=n?r.childNodes[n-1]:null;if(Do&&i&&i.contentEditable=="false")return BB(i);if((!i||i.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(i)return BB(i);if(a)return BB(a)}}function BB(e){return e.contentEditable="true",Do&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Mue(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function oct(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let r=e.domSelectionRange(),n=r.anchorNode,i=r.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(r.anchorNode!=n||r.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!che(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function lct(e){let t=e.domSelection();if(!t)return;let r=e.cursorWrapper.dom,n=r.nodeName=="IMG";n?t.collapse(r.parentNode,Qs(r)+1):t.collapse(r,0),!n&&!e.state.selection.visible&&zl&&Fp<=11&&(r.disabled=!0,r.disabled=!1)}function uhe(e,t){if(t instanceof cn){let r=e.docView.descAt(t.from);r!=e.lastSelectedViewDesc&&(Nue(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else Nue(e)}function Nue(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function lF(e,t,r,n){return e.someProp("createSelectionBetween",i=>i(e,t,r))||Pr.between(t,r,n)}function Due(e){return e.editable&&!e.hasFocus()?!1:hhe(e)}function hhe(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function cct(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),r=e.domSelectionRange();return B1(t.node,t.offset,r.anchorNode,r.anchorOffset)}function KB(e,t){let{$anchor:r,$head:n}=e.selection,i=t>0?r.max(n):r.min(n),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&Vr.findFrom(a,t)}function Bp(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Oue(e,t,r){let n=e.state.selection;if(n instanceof Pr)if(r.indexOf("s")>-1){let{$head:i}=n,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let s=e.state.doc.resolve(i.pos+a.nodeSize*(t<0?-1:1));return Bp(e,new Pr(n.$anchor,s))}else if(n.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=KB(e.state,t);return i&&i instanceof cn?Bp(e,i):!1}else if(!(ou&&r.indexOf("m")>-1)){let i=n.$head,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,s;if(!a||a.isText)return!1;let o=t<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(s=e.docView.descAt(o))&&!s.contentDOM?cn.isSelectable(a)?Bp(e,new cn(t<0?e.state.doc.resolve(i.pos-a.nodeSize):i)):oT?Bp(e,new Pr(e.state.doc.resolve(t<0?o:o+a.nodeSize))):!1:!1}}else return!1;else{if(n instanceof cn&&n.node.isInline)return Bp(e,new Pr(t>0?n.$to:n.$from));{let i=KB(e.state,t);return i?Bp(e,i):!1}}}function JE(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function tT(e,t){let r=e.pmViewDesc;return r&&r.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function px(e,t){return t<0?uct(e):hct(e)}function uct(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i,a,s=!1;for(cu&&r.nodeType==1&&n<JE(r)&&tT(r.childNodes[n],-1)&&(s=!0);;)if(n>0){if(r.nodeType!=1)break;{let o=r.childNodes[n-1];if(tT(o,-1))i=r,a=--n;else if(o.nodeType==3)r=o,n=r.nodeValue.length;else break}}else{if(fhe(r))break;{let o=r.previousSibling;for(;o&&tT(o,-1);)i=r.parentNode,a=Qs(o),o=o.previousSibling;if(o)r=o,n=JE(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}}s?ZB(e,r,n):i&&ZB(e,i,a)}function hct(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i=JE(r),a,s;for(;;)if(n<i){if(r.nodeType!=1)break;let o=r.childNodes[n];if(tT(o,1))a=r,s=++n;else break}else{if(fhe(r))break;{let o=r.nextSibling;for(;o&&tT(o,1);)a=o.parentNode,s=Qs(o)+1,o=o.nextSibling;if(o)r=o,n=0,i=JE(r);else{if(r=r.parentNode,r==e.dom)break;n=i=0}}}a&&ZB(e,a,s)}function fhe(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function fct(e,t){for(;e&&t==e.childNodes.length&&!sT(e);)t=Qs(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let r=e.childNodes[t];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;e=r,t=0}}function dct(e,t){for(;e&&!t&&!sT(e);)t=Qs(e),e=e.parentNode;for(;e&&t;){let r=e.childNodes[t-1];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;e=r,t=e.childNodes.length}}function ZB(e,t,r){if(t.nodeType!=3){let a,s;(s=fct(t,r))?(t=s,r=0):(a=dct(t,r))&&(t=a,r=a.nodeValue.length)}let n=e.domSelection();if(!n)return;if(s7(n)){let a=document.createRange();a.setEnd(t,r),a.setStart(t,r),n.removeAllRanges(),n.addRange(a)}else n.extend&&n.extend(t,r);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&Bd(e)},50)}function Pue(e,t){let r=e.state.doc.resolve(t);if(!(Ms||Jue)&&r.parent.inlineContent){let i=e.coordsAtPos(t);if(t>r.start()){let a=e.coordsAtPos(t-1),s=(a.top+a.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(a.left-i.left)>1)return a.left<i.left?"ltr":"rtl"}if(t<r.end()){let a=e.coordsAtPos(t+1),s=(a.top+a.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(a.left-i.left)>1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function Bue(e,t,r){let n=e.state.selection;if(n instanceof Pr&&!n.empty||r.indexOf("s")>-1||ou&&r.indexOf("m")>-1)return!1;let{$from:i,$to:a}=n;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=KB(e.state,t);if(s&&s instanceof cn)return Bp(e,s)}if(!i.parent.inlineContent){let s=t<0?i:a,o=n instanceof Tc?Vr.near(s,t):Vr.findFrom(s,t);return o?Bp(e,o):!1}return!1}function Fue(e,t){if(!(e.state.selection instanceof Pr))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){let s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function $ue(e,t,r){e.domObserver.stop(),t.contentEditable=r,e.domObserver.start()}function pct(e){if(!Do||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(t&&t.nodeType==1&&r==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let n=t.firstChild;$ue(e,n,"true"),setTimeout(()=>$ue(e,n,"false"),20)}return!1}function mct(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function gct(e,t){let r=t.keyCode,n=mct(t);if(r==8||ou&&r==72&&n=="c")return Fue(e,-1)||px(e,-1);if(r==46&&!t.shiftKey||ou&&r==68&&n=="c")return Fue(e,1)||px(e,1);if(r==13||r==27)return!0;if(r==37||ou&&r==66&&n=="c"){let i=r==37?Pue(e,e.state.selection.from)=="ltr"?-1:1:-1;return Oue(e,i,n)||px(e,i)}else if(r==39||ou&&r==70&&n=="c"){let i=r==39?Pue(e,e.state.selection.from)=="ltr"?1:-1:1;return Oue(e,i,n)||px(e,i)}else{if(r==38||ou&&r==80&&n=="c")return Bue(e,-1,n)||px(e,-1);if(r==40||ou&&r==78&&n=="c")return pct(e)||Bue(e,1,n)||px(e,1);if(n==(ou?"m":"c")&&(r==66||r==73||r==89||r==90))return!0}return!1}function cF(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let r=[],{content:n,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,a--;let p=n.firstChild;r.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),n=p.content}let s=e.someProp("clipboardSerializer")||Yh.fromSchema(e.state.schema),o=vhe(),l=o.createElement("div");l.appendChild(s.serializeFragment(n,{document:o}));let u=l.firstChild,h,f=0;for(;u&&u.nodeType==1&&(h=yhe[u.nodeName.toLowerCase()]);){for(let p=h.length-1;p>=0;p--){let m=o.createElement(h[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${a}${f?` -${f}`:""} ${JSON.stringify(r)}`);let d=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,` + +`);return{dom:l,text:d,slice:t}}function dhe(e,t,r,n,i){let a=i.parent.type.spec.code,s,o;if(!r&&!t)return null;let l=!!t&&(n||a||!r);if(l){if(e.someProp("transformPastedText",d=>{t=d(t,a||n,e)}),a)return o=new Xt(Lt.from(e.state.schema.text(t.replace(/\r\n?/g,` +`))),0,0),e.someProp("transformPasted",d=>{o=d(o,e,!0)}),o;let f=e.someProp("clipboardTextParser",d=>d(t,i,n,e));if(f)o=f;else{let d=i.marks(),{schema:p}=e.state,m=Yh.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,d)))})}}else e.someProp("transformPastedHTML",f=>{r=f(r,e)}),s=bct(r),oT&&wct(s);let u=s&&s.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let f=+h[3];f>0;f--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(o||(o=(e.someProp("clipboardParser")||e.someProp("domParser")||Uh.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||h),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!yct.test(d.parentNode.nodeName)?{ignore:!0}:null}})),h)o=kct(zue(o,+h[1],+h[2]),h[4]);else if(o=Xt.maxOpen(vct(o.content,i),!0),o.openStart||o.openEnd){let f=0,d=0;for(let p=o.content.firstChild;f<o.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=o.content.lastChild;d<o.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);o=zue(o,f,d)}return e.someProp("transformPasted",f=>{o=f(o,e,l)}),o}var yct=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function vct(e,t){if(e.childCount<2)return e;for(let r=t.depth;r>=0;r--){let i=t.node(r).contentMatchAt(t.index(r)),a,s=[];if(e.forEach(o=>{if(!s)return;let l=i.findWrapping(o.type),u;if(!l)return s=null;if(u=s.length&&a.length&&mhe(l,a,o,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=ghe(s[s.length-1],a.length));let h=phe(o,l);s.push(h),i=i.matchType(h.type),a=l}}),s)return Lt.from(s)}return e}function phe(e,t,r=0){for(let n=t.length-1;n>=r;n--)e=t[n].create(null,Lt.from(e));return e}function mhe(e,t,r,n,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=mhe(e,t,r,n.lastChild,i+1);if(a)return n.copy(n.content.replaceChild(n.childCount-1,a));if(n.contentMatchAt(n.childCount).matchType(i==e.length-1?r.type:e[i+1]))return n.copy(n.content.append(Lt.from(phe(r,e,i+1))))}}function ghe(e,t){if(t==0)return e;let r=e.content.replaceChild(e.childCount-1,ghe(e.lastChild,t-1)),n=e.contentMatchAt(e.childCount).fillBefore(Lt.empty,!0);return e.copy(r.append(n))}function QB(e,t,r,n,i,a){let s=t<0?e.firstChild:e.lastChild,o=s.content;return e.childCount>1&&(a=0),i<n-1&&(o=QB(o,t,r,n,i+1,a)),i>=r&&(o=t<0?s.contentMatchAt(0).fillBefore(o,a<=i).append(o):o.append(s.contentMatchAt(s.childCount).fillBefore(Lt.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(o))}function zue(e,t,r){return t<e.openStart&&(e=new Xt(QB(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),r<e.openEnd&&(e=new Xt(QB(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}var yhe={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function vhe(){return document.implementation.createHTMLDocument("title")}var FB=null;function xct(e){let t=window.trustedTypes;return t?(FB||(FB=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:r=>r})),FB.createHTML(e)):e}function bct(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let r=vhe(),n=r.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&yhe[i[1].toLowerCase()])&&(e=a.map(s=>"<"+s+">").join("")+e+a.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=xct(e),a)for(let s=0;s<a.length;s++)n=n.querySelector(a[s])||n;for(let s=0;s<r.styleSheets.length;s++){let o=r.styleSheets[s];for(let l=0;l<o.rules.length;l++){let u=o.rules[l];if(u instanceof CSSStyleRule){let h=n.querySelectorAll(u.selectorText);for(let f=0;f<h.length;f++)h[f].style.cssText+=u.style.cssText}}}return n}function wct(e){let t=e.querySelectorAll(Ms?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<t.length;r++){let n=t[r];n.childNodes.length==1&&n.textContent=="\xA0"&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}function kct(e,t){if(!e.size)return e;let r=e.content.firstChild.type.schema,n;try{n=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:s}=e;for(let o=n.length-2;o>=0;o-=2){let l=r.nodes[n[o]];if(!l||l.hasRequiredAttrs())break;i=Lt.from(l.create(n[o+1],i)),a++,s++}return new Xt(i,a,s)}var tl={},rl={},Tct={touchstart:!0,touchmove:!0},JB=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Cct(e){for(let t in tl){let r=tl[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=n=>{Ect(e,n)&&!uF(e,n)&&(e.editable||!(n.type in rl))&&r(e,n)},Tct[t]?{passive:!0}:void 0)}Do&&e.dom.addEventListener("input",()=>null),eF(e)}function Pd(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Sct(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function eF(e){e.someProp("handleDOMEvents",t=>{for(let r in t)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=n=>uF(e,n))})}function uF(e,t){return e.someProp("handleDOMEvents",r=>{let n=r[t.type];return n?n(e,t)||t.defaultPrevented:!1})}function Ect(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let r=t.target;r!=e.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(t))return!1;return!0}function Act(e,t){!uF(e,t)&&tl[t.type]&&(e.editable||!(t.type in rl))&&tl[t.type](e,t)}rl.keydown=(e,t)=>{let r=t;if(e.input.shiftKey=r.keyCode==16||r.shiftKey,!whe(e)&&(e.input.lastKeyCode=r.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Od&&Ms&&r.keyCode==13)))if(r.keyCode!=229&&e.domObserver.forceFlush(),yx&&r.keyCode==13&&!r.ctrlKey&&!r.altKey&&!r.metaKey){let n=Date.now();e.input.lastIOSEnter=n,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==n&&(e.someProp("handleKeyDown",i=>i(e,L1(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",n=>n(e,r))||gct(e,r)?r.preventDefault():Pd(e,"key")};rl.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};rl.keypress=(e,t)=>{let r=t;if(whe(e)||!r.charCode||r.ctrlKey&&!r.altKey||ou&&r.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,r))){r.preventDefault();return}let n=e.state.selection;if(!(n instanceof Pr)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(r.charCode),a=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",s=>s(e,n.$from.pos,n.$to.pos,i,a))&&e.dispatch(a()),r.preventDefault()}};function lT(e){return{left:e.clientX,top:e.clientY}}function _ct(e,t){let r=t.x-e.clientX,n=t.y-e.clientY;return r*r+n*n<100}function hF(e,t,r,n,i){if(n==-1)return!1;let a=e.state.doc.resolve(n);for(let s=a.depth+1;s>0;s--)if(e.someProp(t,o=>s>a.depth?o(e,r,a.nodeAfter,a.before(s),i,!0):o(e,r,a.node(s),a.before(s),i,!1)))return!0;return!1}function cT(e,t,r){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);r=="pointer"&&n.setMeta("pointer",!0),e.dispatch(n)}function Rct(e,t){if(t==-1)return!1;let r=e.state.doc.resolve(t),n=r.nodeAfter;return n&&n.isAtom&&cn.isSelectable(n)?(cT(e,new cn(r),"pointer"),!0):!1}function Lct(e,t){if(t==-1)return!1;let r=e.state.selection,n,i;r instanceof cn&&(n=r.node);let a=e.state.doc.resolve(t);for(let s=a.depth+1;s>0;s--){let o=s>a.depth?a.nodeAfter:a.node(s);if(cn.isSelectable(o)){n&&r.$from.depth>0&&s>=r.$from.depth&&a.before(r.$from.depth+1)==r.$from.pos?i=a.before(r.$from.depth):i=a.before(s);break}}return i!=null?(cT(e,cn.create(e.state.doc,i),"pointer"),!0):!1}function Ict(e,t,r,n,i){return hF(e,"handleClickOn",t,r,n)||e.someProp("handleClick",a=>a(e,t,n))||(i?Lct(e,r):Rct(e,r))}function Mct(e,t,r,n){return hF(e,"handleDoubleClickOn",t,r,n)||e.someProp("handleDoubleClick",i=>i(e,t,n))}function Nct(e,t,r,n){return hF(e,"handleTripleClickOn",t,r,n)||e.someProp("handleTripleClick",i=>i(e,t,n))||Dct(e,r,n)}function Dct(e,t,r){if(r.button!=0)return!1;let n=xhe(e,t,!0),i=e.state.doc;return n?(cT(e,n,"pointer"),n instanceof Pr&&i.eq(e.state.doc)&&(e.input.mouseDown=new rF(e,n)),!0):!1}function xhe(e,t,r){let n=e.state.doc;if(t==-1)return n.inlineContent?Pr.create(n,0,n.content.size):null;let i=n.resolve(t);for(let a=i.depth+1;a>0;a--){let s=a>i.depth?i.nodeAfter:i.node(a),o=i.before(a);if(s.inlineContent)return Pr.create(n,o+1,o+1+s.content.size);if(r&&cn.isSelectable(s))return cn.create(n,o)}return null}function fF(e){return t7(e)}var bhe=ou?"metaKey":"ctrlKey";tl.mousedown=(e,t)=>{let r=t;e.input.shiftKey=r.shiftKey;let n=fF(e),i=Date.now(),a="singleClick";i-e.input.lastClick.time<500&&_ct(r,e.input.lastClick)&&!r[bhe]&&e.input.lastClick.button==r.button&&(e.input.lastClick.type=="singleClick"?a="doubleClick":e.input.lastClick.type=="doubleClick"&&(a="tripleClick")),e.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:a,button:r.button},e.input.mouseDown&&e.input.mouseDown.done();let s=e.posAtCoords(lT(r));s&&(a=="singleClick"?e.input.mouseDown=new tF(e,s,r,!!n):(a=="doubleClick"?Mct:Nct)(e,s.pos,s.inside,r)?r.preventDefault():Pd(e,"pointer"))};var e7=class{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},tF=class extends e7{constructor(t,r,n,i){super(t),this.pos=r,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!n[bhe],this.allowDefault=n.shiftKey;let a,s;if(r.inside>-1)a=t.state.doc.nodeAt(r.inside),s=r.inside;else{let h=t.state.doc.resolve(r.pos);a=h.parent,s=h.depth?h.before():0}let o=i?null:n.target,l=o?t.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=t.state;n.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof cn&&u.from<=s&&u.to>s)&&(this.mightDrag={node:a,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&cu&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),Pd(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Bd(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let r=this.pos;this.view.state.doc!=this.startDoc&&(r=this.view.posAtCoords(lT(t))),this.updateAllowDefault(t),this.allowDefault||!r?Pd(this.view,"pointer"):Ict(this.view,r.pos,r.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Do&&this.mightDrag&&!this.mightDrag.node.isAtom||Ms&&!this.view.state.selection.visible&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(cT(this.view,Vr.near(this.view.state.doc.resolve(r.pos)),"pointer"),t.preventDefault()):Pd(this.view,"pointer")}move(t){this.updateAllowDefault(t),Pd(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},rF=class extends e7{constructor(t,r){super(t),this.startSelection=r,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),Pd(this.view,"pointer");let r=this.view.posAtCoords(lT(t)),n=r&&xhe(this.view,r.inside,!1);if(!n)return;let{doc:i}=this.view.state,a=this.startSelection,[s,o]=n.from<a.from?[a.to,n.from]:[a.from,n.to];cT(this.view,Pr.create(i,s,o),"pointer")}};tl.touchstart=e=>{e.input.lastTouch=Date.now(),fF(e),Pd(e,"pointer")};tl.touchmove=e=>{e.input.lastTouch=Date.now(),Pd(e,"pointer")};tl.contextmenu=e=>fF(e);function whe(e,t){return e.composing?!0:Do&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Oct=Od?5e3:-1;rl.compositionstart=rl.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,r=t.selection.$to;if(t.selection instanceof Pr&&(t.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Ms&&Jue&&Pct(e)))e.markCursor=e.state.storedMarks||r.marks(),t7(e,!0),e.markCursor=null;else if(t7(e,!t.selection.empty),cu&&t.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let n=e.domSelectionRange();for(let i=n.focusNode,a=n.focusOffset;i&&i.nodeType==1&&a!=0;){let s=a<0?i.lastChild:i.childNodes[a-1];if(!s)break;if(s.nodeType==3){let o=e.domSelection();o&&o.collapse(s,s.nodeValue.length);break}else i=s,a=-1}}e.input.composing=!0}khe(e,Oct)};function Pct(e){let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(!t||t.nodeType!=1||r>=t.childNodes.length)return!1;let n=t.childNodes[r];return n.nodeType==1&&n.contentEditable=="false"}rl.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,khe(e,20))};function khe(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>t7(e),t))}function The(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Bct(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let r=Dlt(t.focusNode,t.focusOffset),n=Olt(t.focusNode,t.focusOffset);if(r&&n&&r!=n){let i=n.pmViewDesc,a=e.domObserver.lastChangedTextNode;if(r==a||n==a)return a;if(!i||!i.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let s=r.pmViewDesc;if(!(!s||!s.isText(r.nodeValue)))return n}}return r||n}function t7(e,t=!1){if(!(Od&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),The(e),t||e.docView&&e.docView.dirty){let r=oF(e),n=e.state.selection;return r&&!r.eq(n)?e.dispatch(e.state.tr.setSelection(r)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Fct(e,t){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(t),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()},50)}var rT=zl&&Fp<15||yx&&$lt<604;tl.copy=rl.cut=(e,t)=>{let r=t,n=e.state.selection,i=r.type=="cut";if(n.empty)return;let a=rT?null:r.clipboardData,s=n.content(),{dom:o,text:l}=cF(e,s);a?(r.preventDefault(),a.clearData(),a.setData("text/html",o.innerHTML),a.setData("text/plain",l)):Fct(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function $ct(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function zct(e,t){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?nT(e,n.value,null,i,t):nT(e,n.textContent,n.innerHTML,i,t)},50)}function nT(e,t,r,n,i){let a=dhe(e,t,r,n,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,i,a||Xt.empty)))return!0;if(!a)return!1;let s=$ct(a),o=s?e.state.tr.replaceSelectionWith(s,n):e.state.tr.replaceSelection(a);return e.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Che(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}rl.paste=(e,t)=>{let r=t;if(e.composing&&!Od)return;let n=rT?null:r.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;n&&nT(e,Che(n),n.getData("text/html"),i,r)?r.preventDefault():zct(e,r)};var r7=class{constructor(t,r,n){this.slice=t,this.move=r,this.node=n}},Gct=ou?"altKey":"ctrlKey";function She(e,t){let r;return e.someProp("dragCopies",n=>{r=r||n(t)}),r!=null?!r:!t[Gct]}tl.dragstart=(e,t)=>{let r=t,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(lT(r)),s;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof cn?i.to-1:i.to))){if(n&&n.mightDrag)s=cn.create(e.state.doc,n.mightDrag.pos);else if(r.target&&r.target.nodeType==1){let f=e.docView.nearestDesc(r.target,!0);f&&f.node.type.spec.draggable&&f!=e.docView&&(s=cn.create(e.state.doc,f.posBefore))}}let o=(s||e.state.selection).content(),{dom:l,text:u,slice:h}=cF(e,o);(!r.dataTransfer.files.length||!Ms||Que>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(rT?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",rT||r.dataTransfer.setData("text/plain",u),e.dragging=new r7(h,She(e,r),s)};tl.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};rl.dragover=rl.dragenter=(e,t)=>t.preventDefault();rl.drop=(e,t)=>{try{qct(e,t,e.dragging)}finally{e.dragging=null}};function qct(e,t,r){if(!t.dataTransfer)return;let n=e.posAtCoords(lT(t));if(!n)return;let i=e.state.doc.resolve(n.pos),a=r&&r.slice;a?e.someProp("transformPasted",p=>{a=p(a,e,!1)}):a=dhe(e,Che(t.dataTransfer),rT?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(r&&She(e,t));if(e.someProp("handleDrop",p=>p(e,t,a||Xt.empty,s))){t.preventDefault();return}if(!a)return;t.preventDefault();let o=a?Dce(e.state.doc,i.pos,a):i.pos;o==null&&(o=i.pos);let l=e.state.tr;if(s){let{node:p}=r;p?p.replace(l):l.deleteSelection()}let u=l.mapping.map(o),h=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,f=l.doc;if(h?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(f))return;let d=l.doc.resolve(u);if(h&&cn.isSelectable(a.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new cn(d));else{let p=l.mapping.map(o);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,y,v)=>p=v),l.setSelection(lF(e,d,l.doc.resolve(p)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}tl.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Bd(e)},20))};tl.blur=(e,t)=>{let r=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),r.relatedTarget&&e.dom.contains(r.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};tl.beforeinput=(e,t)=>{if(Ms&&Od&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:n}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=n||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",a=>a(e,L1(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in rl)tl[e]=rl[e];function iT(e,t){if(e==t)return!0;for(let r in e)if(e[r]!==t[r])return!1;for(let r in t)if(!(r in e))return!1;return!0}var n7=class e{constructor(t,r){this.toDOM=t,this.spec=r||O1,this.side=this.spec.side||0}map(t,r,n,i){let{pos:a,deleted:s}=t.mapResult(r.from+i,this.side<0?-1:1);return s?null:new mi(a-n,a-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&iT(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}},D1=class e{constructor(t,r){this.attrs=t,this.spec=r||O1}map(t,r,n,i){let a=t.map(r.from+i,this.spec.inclusiveStart?-1:1)-n,s=t.map(r.to+i,this.spec.inclusiveEnd?1:-1)-n;return a>=s?null:new mi(a,s,this)}valid(t,r){return r.from<r.to}eq(t){return this==t||t instanceof e&&iT(this.attrs,t.attrs)&&iT(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},nF=class e{constructor(t,r){this.attrs=t,this.spec=r||O1}map(t,r,n,i){let a=t.mapResult(r.from+i,1);if(a.deleted)return null;let s=t.mapResult(r.to+i,-1);return s.deleted||s.pos<=a.pos?null:new mi(a.pos-n,s.pos-n,this)}valid(t,r){let{index:n,offset:i}=t.content.findIndex(r.from),a;return i==r.from&&!(a=t.child(n)).isText&&i+a.nodeSize==r.to}eq(t){return this==t||t instanceof e&&iT(this.attrs,t.attrs)&&iT(this.spec,t.spec)}destroy(){}},mi=class e{constructor(t,r,n){this.from=t,this.to=r,this.type=n}copy(t,r){return new e(t,r,this.type)}eq(t,r=0){return this.type.eq(t.type)&&this.from+r==t.from&&this.to+r==t.to}map(t,r,n){return this.type.map(t,this,r,n)}static widget(t,r,n){return new e(t,t,new n7(r,n))}static inline(t,r,n,i){return new e(t,r,new D1(n,i))}static node(t,r,n,i){return new e(t,r,new nF(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof D1}get widget(){return this.type instanceof n7}},mx=[],O1={},Ui=class e{constructor(t,r){this.local=t.length?t:mx,this.children=r.length?r:mx}static create(t,r){return r.length?a7(r,t,0,O1):No}find(t,r,n){let i=[];return this.findInner(t??0,r??1e9,i,0,n),i}findInner(t,r,n,i,a){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=r&&o.to>=t&&(!a||a(o.spec))&&n.push(o.copy(o.from+i,o.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<r&&this.children[s+1]>t){let o=this.children[s]+1;this.children[s+2].findInner(t-o,r-o,n,i+o,a)}}map(t,r,n){return this==No||t.maps.length==0?this:this.mapInner(t,r,0,0,n||O1)}mapInner(t,r,n,i,a){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(t,n,i);l&&l.type.valid(r,l)?(s||(s=[])).push(l):a.onRemove&&a.onRemove(this.local[o].spec)}return this.children.length?Vct(this.children,s||[],t,r,n,i,a):s?new e(s.sort(P1),mx):No}add(t,r){return r.length?this==No?e.create(t,r):this.addInner(t,r,0):this}addInner(t,r,n){let i,a=0;t.forEach((o,l)=>{let u=l+n,h;if(h=Ahe(r,o,u)){for(i||(i=this.children.slice());a<i.length&&i[a]<l;)a+=3;i[a]==l?i[a+2]=i[a+2].addInner(o,h,u+1):i.splice(a,0,l,l+o.nodeSize,a7(h,o,u+1,O1)),a+=3}});let s=Ehe(a?_he(r):r,-n);for(let o=0;o<s.length;o++)s[o].type.valid(t,s[o])||s.splice(o--,1);return new e(s.length?this.local.concat(s).sort(P1):this.local,i||this.children)}remove(t){return t.length==0||this==No?this:this.removeInner(t,0)}removeInner(t,r){let n=this.children,i=this.local;for(let a=0;a<n.length;a+=3){let s,o=n[a]+r,l=n[a+1]+r;for(let h=0,f;h<t.length;h++)(f=t[h])&&f.from>o&&f.to<l&&(t[h]=null,(s||(s=[])).push(f));if(!s)continue;n==this.children&&(n=this.children.slice());let u=n[a+2].removeInner(s,o+1);u!=No?n[a+2]=u:(n.splice(a,3),a-=3)}if(i.length){for(let a=0,s;a<t.length;a++)if(s=t[a])for(let o=0;o<i.length;o++)i[o].eq(s,r)&&(i==this.local&&(i=this.local.slice()),i.splice(o--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new e(i,n):No}forChild(t,r){if(this==No)return this;if(r.isLeaf)return e.empty;let n,i;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}let a=t+1,s=a+r.content.size;for(let o=0;o<this.local.length;o++){let l=this.local[o];if(l.from<s&&l.to>a&&l.type instanceof D1){let u=Math.max(a,l.from)-a,h=Math.min(s,l.to)-a;u<h&&(i||(i=[])).push(l.copy(u,h))}}if(i){let o=new e(i.sort(P1),mx);return n?new i7([o,n]):o}return n||No}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let r=0;r<this.local.length;r++)if(!this.local[r].eq(t.local[r]))return!1;for(let r=0;r<this.children.length;r+=3)if(this.children[r]!=t.children[r]||this.children[r+1]!=t.children[r+1]||!this.children[r+2].eq(t.children[r+2]))return!1;return!0}locals(t){return dF(this.localsInner(t))}localsInner(t){if(this==No)return mx;if(t.inlineContent||!this.local.some(D1.is))return this.local;let r=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof D1||r.push(this.local[n]);return r}forEachSet(t){t(this)}};Ui.empty=new Ui([],[]);Ui.removeOverlap=dF;var No=Ui.empty,i7=class e{constructor(t){this.members=t}map(t,r){let n=this.members.map(i=>i.map(t,r,O1));return e.from(n)}forChild(t,r){if(r.isLeaf)return Ui.empty;let n=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,r);a!=No&&(a instanceof e?n=n.concat(a.members):n.push(a))}return e.from(n)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let r=0;r<this.members.length;r++)if(!this.members[r].eq(t.members[r]))return!1;return!0}locals(t){let r,n=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(t);if(a.length)if(!r)r=a;else{n&&(r=r.slice(),n=!1);for(let s=0;s<a.length;s++)r.push(a[s])}}return r?dF(n?r:r.sort(P1)):mx}static from(t){switch(t.length){case 0:return No;case 1:return t[0];default:return new e(t.every(r=>r instanceof Ui)?t:t.reduce((r,n)=>r.concat(n instanceof Ui?n:n.members),[]))}}forEachSet(t){for(let r=0;r<this.members.length;r++)this.members[r].forEachSet(t)}};function Vct(e,t,r,n,i,a,s){let o=e.slice();for(let u=0,h=a;u<r.maps.length;u++){let f=0;r.maps[u].forEach((d,p,m,g)=>{let y=g-m-(p-d);for(let v=0;v<o.length;v+=3){let x=o[v+1];if(x<0||d>x+h-f)continue;let w=o[v]+h-f;p>=w?o[v+1]=d<=w?-2:-1:d>=h&&y&&(o[v]+=y,o[v+1]+=y)}f+=y}),h=r.maps[u].map(h,-1)}let l=!1;for(let u=0;u<o.length;u+=3)if(o[u+1]<0){if(o[u+1]==-2){l=!0,o[u+1]=-1;continue}let h=r.map(e[u]+a),f=h-i;if(f<0||f>=n.content.size){l=!0;continue}let d=r.map(e[u+1]+a,-1),p=d-i,{index:m,offset:g}=n.content.findIndex(f),y=n.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let v=o[u+2].mapInner(r,y,h+1,e[u]+a+1,s);v!=No?(o[u]=f,o[u+1]=p,o[u+2]=v):(o[u+1]=-2,l=!0)}else l=!0}if(l){let u=Wct(o,e,t,r,i,a,s),h=a7(u,n,0,s);t=h.local;for(let f=0;f<o.length;f+=3)o[f+1]<0&&(o.splice(f,3),f-=3);for(let f=0,d=0;f<h.children.length;f+=3){let p=h.children[f];for(;d<o.length&&o[d]<p;)d+=3;o.splice(d,0,h.children[f],h.children[f+1],h.children[f+2])}}return new Ui(t.sort(P1),o)}function Ehe(e,t){if(!t||!e.length)return e;let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(new mi(i.from+t,i.to+t,i.type))}return r}function Wct(e,t,r,n,i,a,s){function o(l,u){for(let h=0;h<l.local.length;h++){let f=l.local[h].map(n,i,u);f?r.push(f):s.onRemove&&s.onRemove(l.local[h].spec)}for(let h=0;h<l.children.length;h+=3)o(l.children[h+2],l.children[h]+u+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&o(e[l+2],t[l]+a+1);return r}function Ahe(e,t,r){if(t.isLeaf)return null;let n=r+t.nodeSize,i=null;for(let a=0,s;a<e.length;a++)(s=e[a])&&s.from>r&&s.to<n&&((i||(i=[])).push(s),e[a]=null);return i}function _he(e){let t=[];for(let r=0;r<e.length;r++)e[r]!=null&&t.push(e[r]);return t}function a7(e,t,r,n){let i=[],a=!1;t.forEach((o,l)=>{let u=Ahe(e,o,l+r);if(u){a=!0;let h=a7(u,o,r+l+1,n);h!=No&&i.push(l,l+o.nodeSize,h)}});let s=Ehe(a?_he(e):e,-r).sort(P1);for(let o=0;o<s.length;o++)s[o].type.valid(t,s[o])||(n.onRemove&&n.onRemove(s[o].spec),s.splice(o--,1));return s.length||i.length?new Ui(s,i):No}function P1(e,t){return e.from-t.from||e.to-t.to}function dF(e){let t=e;for(let r=0;r<t.length-1;r++){let n=t[r];if(n.from!=n.to)for(let i=r+1;i<t.length;i++){let a=t[i];if(a.from==n.from){a.to!=n.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,n.to),Gue(t,i+1,a.copy(n.to,a.to)));continue}else{a.from<n.to&&(t==e&&(t=e.slice()),t[r]=n.copy(n.from,a.from),Gue(t,i,n.copy(a.from,n.to)));break}}}return t}function Gue(e,t,r){for(;t<e.length&&P1(r,e[t])>0;)t++;e.splice(t,0,r)}function $B(e){let t=[];return e.someProp("decorations",r=>{let n=r(e.state);n&&n!=No&&t.push(n)}),e.cursorWrapper&&t.push(Ui.create(e.state.doc,[e.cursorWrapper.deco])),i7.from(t)}var Hct={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Uct=zl&&Fp<=11,iF=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}},aF=class{constructor(t,r){this.view=t,this.handleDOMChange=r,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new iF,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);zl&&Fp<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Do&&t.composing&&n.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Uct&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Hct)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let r=0;r<t.length;r++)this.queue.push(t[r]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Due(this.view)){if(this.suppressingSelectionUpdates)return Bd(this.view);if(zl&&Fp<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&B1(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let r=new Set,n;for(let a=t.focusNode;a;a=gx(a))r.add(a);for(let a=t.anchorNode;a;a=gx(a))if(r.has(a)){n=a;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Due(t)&&!this.ignoreSelectionChange(n),a=-1,s=-1,o=!1,l=[];if(t.editable)for(let h=0;h<r.length;h++){let f=this.registerMutation(r[h],l);f&&(a=a<0?f.from:Math.min(f.from,a),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(o=!0))}if(l.some(h=>h.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Ms&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&r.some(h=>h.type=="childList"&&h.removedNodes.length))){for(let h of l)if(h.nodeName=="BR"&&h.parentNode){let f=h.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){h.parentNode.removeChild(h);break}f=f.firstChild}}}else if(cu&&l.length){let h=l.filter(f=>f.nodeName=="BR");if(h.length==2){let[f,d]=h;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of h){let p=d.parentNode;p&&p.nodeName=="LI"&&(!f||jct(t,f)!=p)&&d.remove()}}}let u=null;a<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&s7(n)&&(u=oF(t))&&u.eq(Vr.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Bd(t),this.currentSelection.set(n),t.scrollToSelection()):(a>-1||i)&&(a>-1&&(t.docView.markDirty(a,s),Yct(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,Kct(t,l)),this.handleDOMChange(a,s,o,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||Bd(t),this.currentSelection.set(n))}registerMutation(t,r){if(r.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(n==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!n||n.ignoreMutation(t))return null;if(t.type=="childList"){for(let h=0;h<t.addedNodes.length;h++){let f=t.addedNodes[h];r.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};let i=t.previousSibling,a=t.nextSibling;if(zl&&Fp<=11&&t.addedNodes.length)for(let h=0;h<t.addedNodes.length;h++){let{previousSibling:f,nextSibling:d}=t.addedNodes[h];(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(a=d)}let s=i&&i.parentNode==t.target?Qs(i)+1:0,o=n.localPosFromDOM(t.target,s,-1),l=a&&a.parentNode==t.target?Qs(a):t.target.childNodes.length,u=n.localPosFromDOM(t.target,l,1);return{from:o,to:u}}else return t.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=t.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}},que=new WeakMap,Vue=!1;function Yct(e){if(!que.has(e)&&(que.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=cu,Vue)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Vue=!0}}function Wue(e,t){let r=t.startContainer,n=t.startOffset,i=t.endContainer,a=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return B1(s.node,s.offset,i,a)&&([r,n,i,a]=[i,a,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:a}}function Xct(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return Wue(e,i)}let r;function n(i){i.preventDefault(),i.stopImmediatePropagation(),r=i.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0),r?Wue(e,r):null}function jct(e,t){for(let r=t.parentNode;r&&r!=e.dom;r=r.parentNode){let n=e.docView.nearestDesc(r,!0);if(n&&n.node.isBlock)return r}return null}function Kct(e,t){var r;let{focusNode:n,focusOffset:i}=e.domSelectionRange();for(let a of t)if(((r=a.parentNode)===null||r===void 0?void 0:r.nodeName)=="TR"){let s=a.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let o=s;for(;;){let l=o.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;o=l}o.insertBefore(a,o.firstChild),n==a&&e.domSelection().collapse(a,i)}else a.parentNode.removeChild(a)}}function Zct(e,t,r){let{node:n,fromOffset:i,toOffset:a,from:s,to:o}=e.docView.parseRange(t,r),l=e.domSelectionRange(),u,h=l.anchorNode;if(h&&e.dom.contains(h.nodeType==1?h:h.parentNode)&&(u=[{node:h,offset:l.anchorOffset}],s7(l)||u.push({node:l.focusNode,offset:l.focusOffset})),Ms&&e.input.lastKeyCode===8)for(let y=a;y>i;y--){let v=n.childNodes[y-1],x=v.pmViewDesc;if(v.nodeName=="BR"&&!x){a=y;break}if(!x||x.size)break}let f=e.state.doc,d=e.someProp("domParser")||Uh.fromSchema(e.state.schema),p=f.resolve(s),m=null,g=d.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Qct,context:p});if(u&&u[0].pos!=null){let y=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=y),m={anchor:y+s,head:v+s}}return{doc:g,sel:m,from:s,to:o}}function Qct(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Do&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Do&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var Jct=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function eut(e,t,r,n,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let S=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,E=oF(e,S);if(E&&!e.state.selection.eq(E)){if(Ms&&Od&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",L=>L(e,L1(13,"Enter"))))return;let I=e.state.tr.setSelection(E);S=="pointer"?I.setMeta("pointer",!0):S=="key"&&I.scrollIntoView(),a&&I.setMeta("composition",a),e.dispatch(I)}return}let s=e.state.doc.resolve(t),o=s.sharedDepth(r);t=s.before(o+1),r=e.state.doc.resolve(r).after(o+1);let l=e.state.selection,u=Zct(e,t,r),h=e.state.doc,f=h.slice(u.from,u.to),d,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(d=e.state.selection.to,p="end"):(d=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let m=nut(f.content,u.doc.content,u.from,d,p);if(m&&e.input.domChangeCount++,(yx&&e.input.lastIOSEnter>Date.now()-225||Od)&&i.some(S=>S.nodeType==1&&!Jct.test(S.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",S=>S(e,L1(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof Pr&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let S=Hue(e,e.state.doc,u.sel);if(S&&!S.eq(e.state.selection)){let E=e.state.tr.setSelection(S);a&&E.setMeta("composition",a),e.dispatch(E)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Pr&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),zl&&Fp<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" \xA0"&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),v=h.resolve(m.start),x=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=m.endA;if((yx&&e.input.lastIOSEnter>Date.now()-225&&(!x||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!x&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",S=>S(e,L1(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&rut(h,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",S=>S(e,L1(8,"Backspace")))){Od&&Ms&&e.domObserver.suppressSelectionUpdates();return}Ms&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Od&&!x&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(S){return S(e,L1(13,"Enter"))})},20));let w=m.start,C=m.endA,T=S=>{let E=S||e.state.tr.replace(w,C,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let I=Hue(e,E.doc,u.sel);I&&!(Ms&&e.composing&&I.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(I.head==w||I.head==E.mapping.map(C)-1)||zl&&I.empty&&I.head==w)&&E.setSelection(I)}return a&&E.setMeta("composition",a),E.scrollIntoView()},k;if(x)if(g.pos==y.pos){zl&&Fp<=11&&g.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Bd(e),20));let S=T(e.state.tr.delete(w,C)),E=h.resolve(m.start).marksAcross(h.resolve(m.endA));E&&S.ensureMarks(E),e.dispatch(S)}else if(m.endA==m.endB&&(k=tut(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let S=T(e.state.tr);k.type=="add"?S.addMark(w,C,k.mark):S.removeMark(w,C,k.mark),e.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,y.parentOffset),E=()=>T(e.state.tr.insertText(S,w,C));e.someProp("handleTextInput",I=>I(e,w,C,S,E))||e.dispatch(E())}else e.dispatch(T());else e.dispatch(T())}function Hue(e,t,r){return Math.max(r.anchor,r.head)>t.content.size?null:lF(e,t.resolve(r.anchor),t.resolve(r.head))}function tut(e,t){let r=e.firstChild.marks,n=t.firstChild.marks,i=r,a=n,s,o,l;for(let h=0;h<n.length;h++)i=n[h].removeFromSet(i);for(let h=0;h<r.length;h++)a=r[h].removeFromSet(a);if(i.length==1&&a.length==0)o=i[0],s="add",l=h=>h.mark(o.addToSet(h.marks));else if(i.length==0&&a.length==1)o=a[0],s="remove",l=h=>h.mark(o.removeFromSet(h.marks));else return null;let u=[];for(let h=0;h<t.childCount;h++)u.push(l(t.child(h)));if(Lt.from(u).eq(e))return{mark:o,type:s}}function rut(e,t,r,n,i){if(r-t<=i.pos-n.pos||zB(n,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!n.parent.isTextblock){let o=a.nodeAfter;return o!=null&&r==t+o.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let s=e.resolve(zB(a,!0,!0));return!s.parent.isTextblock||s.pos>r||zB(s,!0,!1)<r?!1:n.parent.content.cut(n.parentOffset).eq(s.parent.content)}function zB(e,t,r){let n=e.depth,i=t?e.end():e.pos;for(;n>0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,i++,t=!1;if(r){let a=e.node(n).maybeChild(e.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function nut(e,t,r,n,i){let a=e.findDiffStart(t,r),s=r+e.size,o=r+t.size;if(a==null)return null;let{a:l,b:u}=e.findDiffEnd(t,s,o);if(i=="end"){let h=Math.max(0,a-Math.min(l,u));n-=l+h-a}if(l<a&&s<o){let h=n<=a&&n>=l?a-n:0;a-=h,u=a+(u-l),l=a}else if(u<a){let h=n<=a&&n>=u?a-n:0;a-=h,l=a+(l-u),u=a}return{start:a,endA:l,endB:u}}var aT=class{constructor(t,r){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new JB,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=r,this.state=r.state,this.directPlugins=r.plugins||[],this.directPlugins.forEach(Kue),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Xue(this),Yue(this),this.nodeViews=jue(this),this.docView=_ue(this.state.doc,Uue(this),$B(this),this.dom,this),this.domObserver=new aF(this,(n,i,a,s)=>eut(this,n,i,a,s)),this.domObserver.start(),Cct(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let r in t)this._props[r]=t[r];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&eF(this);let r=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Kue),this.directPlugins=t.plugins),this.updateStateInner(t.state,r)}setProps(t){let r={};for(let n in this._props)r[n]=this._props[n];r.state=this.state;for(let n in t)r[n]=t[n];this.update(r)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,r){var n;let i=this.state,a=!1,s=!1;t.storedMarks&&this.composing&&(The(this),s=!0),this.state=t;let o=i.plugins!=t.plugins||this._props.plugins!=r.plugins;if(o||this._props.plugins!=r.plugins||this._props.nodeViews!=r.nodeViews){let p=jue(this);aut(p,this.nodeViews)&&(this.nodeViews=p,a=!0)}(o||r.handleDOMEvents!=this._props.handleDOMEvents)&&eF(this),this.editable=Xue(this),Yue(this);let l=$B(this),u=Uue(this),h=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=a||!this.docView.matchesNode(t.doc,u,l);(f||!t.selection.eq(i.selection))&&(s=!0);let d=h=="preserve"&&s&&this.dom.style.overflowAnchor==null&&qlt(this);if(s){this.domObserver.stop();let p=f&&(zl||Ms)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&iut(i.selection,t.selection);if(f){let g=Ms?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Bct(this)),(a||!this.docView.update(t.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=_ue(t.doc,u,l,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let m=this.input.mouseDown;p||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&cct(this)&&m.delaySelUpdate())?Bd(this,p):(uhe(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():d&&Vlt(d)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",r=>r(this)))if(this.state.selection instanceof cn){let r=this.docView.domAfterPos(this.state.selection.from);r.nodeType==1&&kue(this,r.getBoundingClientRect(),t)}else kue(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let r=0;r<this.directPlugins.length;r++){let n=this.directPlugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let r=0;r<this.state.plugins.length;r++){let n=this.state.plugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let r=0;r<this.pluginViews.length;r++){let n=this.pluginViews[r];n.update&&n.update(this,t)}}updateDraggedNode(t,r){let n=t.node,i=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let a=n.from+(this.state.doc.content.size-r.doc.content.size);(a>0&&a<this.state.doc.content.size&&this.state.doc.nodeAt(a))==n.node&&(i=a)}this.dragging=new r7(t.slice,t.move,i<0?void 0:cn.create(this.state.doc,i))}someProp(t,r){let n=this._props&&this._props[t],i;if(n!=null&&(i=r?r(n):n))return i;for(let s=0;s<this.directPlugins.length;s++){let o=this.directPlugins[s].props[t];if(o!=null&&(i=r?r(o):o))return i}let a=this.state.plugins;if(a)for(let s=0;s<a.length;s++){let o=a[s].props[t];if(o!=null&&(i=r?r(o):o))return i}}hasFocus(){if(zl){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Wlt(this.dom),Bd(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return t||document}updateRoot(){this._root=null}posAtCoords(t){return jlt(this,t)}coordsAtPos(t,r=1){return ihe(this,t,r)}domAtPos(t,r=0){return this.docView.domFromPos(t,r)}nodeDOM(t){let r=this.docView.descAt(t);return r?r.nodeDOM:null}posAtDOM(t,r,n=-1){let i=this.docView.posFromDOM(t,r,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,r){return ect(this,r||this.state,t)}pasteHTML(t,r){return nT(this,"",t,!1,r||new ClipboardEvent("paste"))}pasteText(t,r){return nT(this,t,null,!0,r||new ClipboardEvent("paste"))}serializeForClipboard(t){return cF(this,t)}destroy(){this.docView&&(Sct(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$B(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Mlt())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return Act(this,t)}domSelectionRange(){let t=this.domSelection();return t?Do&&this.root.nodeType===11&&Blt(this.dom.ownerDocument)==this.dom&&Xct(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};aT.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Uue(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",r=>{if(typeof r=="function"&&(r=r(e.state)),r)for(let n in r)n=="class"?t.class+=" "+r[n]:n=="style"?t.style=(t.style?t.style+";":"")+r[n]:!t[n]&&n!="contenteditable"&&n!="nodeName"&&(t[n]=String(r[n]))}),t.translate||(t.translate="no"),[mi.node(0,e.state.doc.content.size,t)]}function Yue(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:mi.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Xue(e){return!e.someProp("editable",t=>t(e.state)===!1)}function iut(e,t){let r=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(r)!=t.$anchor.start(r)}function jue(e){let t=Object.create(null);function r(n){for(let i in n)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=n[i])}return e.someProp("nodeViews",r),e.someProp("markViews",r),t}function aut(e,t){let r=0,n=0;for(let i in e){if(e[i]!=t[i])return!0;r++}for(let i in t)n++;return r!=n}function Kue(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Gd(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}var Ihe={text:(e,t,r,n)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:r.safe(i,{...n,encode:[]})},strong:(e,t,r,n)=>{let i=e.marker||r.options.strong||"*",a=r.enter("strong"),s=r.createTracker(n),o=s.move(i+i);return o+=s.move(r.containerPhrasing(e,{before:o,after:i,...s.current()})),o+=s.move(i+i),a(),o},emphasis:(e,t,r,n)=>{let i=e.marker||r.options.emphasis||"*",a=r.enter("emphasis"),s=r.createTracker(n),o=s.move(i);return o+=s.move(r.containerPhrasing(e,{before:o,after:i,...s.current()})),o+=s.move(i),a(),o}},Li=bn({},"editorView"),uT=bn({},"editorState"),pF=bn([],"initTimer"),Rhe=bn({},"editor"),$d=bn([],"inputRules"),fu=bn([],"prosePlugins"),zd=bn([],"remarkPlugins"),xT=bn([],"nodeView"),bT=bn([],"markView"),$1=bn(zk().use(Z2).use(tx),"remark"),vx=bn({handlers:Ihe,encode:[]},"remarkStringifyOptions"),o7=wc("ConfigReady");function sut(e){let t=r=>(r.record(o7),async()=>(await e(r),r.done(o7),()=>{r.clearTimer(o7)}));return Gd(t,{displayName:"Config"}),t}var eh=wc("InitReady");function out(e){let t=r=>(r.inject(Rhe,e).inject(fu,[]).inject(zd,[]).inject($d,[]).inject(xT,[]).inject(bT,[]).inject(vx,{handlers:Ihe,encode:[]}).inject($1,zk().use(Z2).use(tx)).inject(pF,[o7]).record(eh),async()=>{await r.waitTimers(pF);let n=r.get(vx);return r.set($1,zk().use(Z2).use(tx,n)),r.done(eh),()=>{r.remove(Rhe).remove(fu).remove(zd).remove($d).remove(xT).remove(bT).remove(vx).remove($1).remove(pF).clearTimer(eh)}});return Gd(t,{displayName:"Init"}),t}var Js=wc("SchemaReady"),hT=bn([],"schemaTimer"),eo=bn({},"schema"),jh=bn([],"nodes"),z1=bn([],"marks");function Lhe(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var Mhe=e=>(e.inject(eo,{}).inject(jh,[]).inject(z1,[]).inject(hT,[eh]).record(Js),async()=>{await e.waitTimers(hT);let t=e.get($1),r=e.get(zd).reduce((i,a)=>i.use(a.plugin,a.options),t);e.set($1,r);let n=new BE({nodes:Object.fromEntries(e.get(jh).map(([i,a])=>[i,Lhe(a)])),marks:Object.fromEntries(e.get(z1).map(([i,a])=>[i,Lhe(a)]))});return e.set(eo,n),e.done(Js),()=>{e.remove(eo).remove(jh).remove(z1).remove(hT).clearTimer(Js)}});Gd(Mhe,{displayName:"Schema"});var Nhe=class{constructor(){this.#t=new gP,this.#e=null,this.setCtx=e=>{this.#e=e},this.chain=()=>{if(this.#e==null)throw oE();let e=this.#e,t=[],r=this.get.bind(this),n={run:()=>{let a=_1(...t),s=e.get(Li);return a(s.state,s.dispatch,s)},inline:a=>(t.push(a),n),pipe:i.bind(this)};function i(a,s){let o=r(a);return t.push(o(s)),n}return n}}#t;#e;get ctx(){return this.#e}create(e,t){let r=e.create(this.#t.sliceMap);return r.set(t),r}get(e){return this.#t.get(e).get()}remove(e){return this.#t.remove(e)}call(e,t){if(this.#e==null)throw oE();let r=this.get(e)(t),n=this.#e.get(Li);return r(n.state,n.dispatch,n)}inline(e){if(this.#e==null)throw oE();let t=this.#e.get(Li);return e(t.state,t.dispatch,t)}};function bF(e="cmdKey"){return bn((()=>()=>!1),e)}var Gn=bn(new Nhe,"commands"),fT=bn([Js],"commandsTimer"),G1=wc("CommandsReady"),Dhe=e=>{let t=new Nhe;return t.setCtx(e),e.inject(Gn,t).inject(fT,[Js]).record(G1),async()=>(await e.waitTimers(fT),e.done(G1),()=>{e.remove(Gn).remove(fT).clearTimer(G1)})};Gd(Dhe,{displayName:"Commands"});function lut(e){return e.Backspace=_1(tue,WE,jce,CB),e}var Ohe=class{constructor(){this.#t=null,this.#e=[],this.setCtx=e=>{this.#t=e},this.add=e=>(this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([r,n])=>{if(typeof n=="function"){let i={key:r,onRun:()=>n};this.#e.push(i),t.push(()=>{this.#e=this.#e.filter(a=>a!==i)})}else this.#e.push(n),t.push(()=>{this.#e=this.#e.filter(i=>i!==n)})}),()=>{t.forEach(r=>r())}},this.addBaseKeymap=()=>{let e=lut(eue);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#e.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([t,r])=>{let n=r.sort((a,s)=>(s.priority??50)-(a.priority??50));return[t,(a,s,o)=>{let l=this.#t;if(l==null)throw j2();return _1(...n.map(u=>u.onRun(l)))(a,s,o)}]}))}}#t;#e;get ctx(){return this.#t}},wT=bn(new Ohe,"keymap"),mF=bn([Js],"keymapTimer"),xx=wc("KeymapReady"),cut=e=>{let t=new Ohe;return t.setCtx(e),e.inject(wT,t).inject(mF,[Js]).record(xx),async()=>(await e.waitTimers(mF),e.done(xx),()=>{e.remove(wT).remove(mF).clearTimer(xx)})},l7=wc("ParserReady"),Phe=(()=>{throw j2()}),Fd=bn(Phe,"parser"),gF=bn([],"parserTimer"),Bhe=e=>(e.inject(Fd,Phe).inject(gF,[Js]).record(l7),async()=>{await e.waitTimers(gF);let t=e.get($1),r=e.get(eo);return e.set(Fd,yue.create(r,t)),e.done(l7),()=>{e.remove(Fd).remove(gF).clearTimer(l7)}});Gd(Bhe,{displayName:"Parser"});var bx=wc("SerializerReady"),yF=bn([],"serializerTimer"),Fhe=(()=>{throw j2()}),Gp=bn(Fhe,"serializer"),$he=e=>(e.inject(Gp,Fhe).inject(yF,[Js]).record(bx),async()=>{await e.waitTimers(yF);let t=e.get($1),r=e.get(eo);return e.set(Gp,xue.create(r,t)),e.done(bx),()=>{e.remove(Gp).remove(yF).clearTimer(bx)}});Gd($he,{displayName:"Serializer"});var dT=bn("","defaultValue"),wx=bn(e=>e,"stateOptions"),pT=bn([],"editorStateTimer"),c7=wc("EditorStateReady");function uut(e,t,r){if(typeof e=="string")return t(e);if(e.type==="html")return Uh.fromSchema(r).parse(e.dom);if(e.type==="json")return $l.fromJSON(r,e.value);throw koe(e)}var hut=new Hi("MILKDOWN_STATE_TRACKER"),zhe=e=>(e.inject(dT,"").inject(uT,{}).inject(wx,t=>t).inject(pT,[l7,bx,G1,xx]).record(c7),async()=>{await e.waitTimers(pT);let t=e.get(eo),r=e.get(Fd),n=e.get($d),i=e.get(wx),a=e.get(fu),s=uut(e.get(dT),r,t),o=e.get(wT),l=o.addBaseKeymap(),u=[...a,new Ci({key:hut,state:{init:()=>{},apply:(d,p,m,g)=>{e.set(uT,g)}}}),iue({rules:n}),fue(o.build())];e.set(fu,u);let h=i({schema:t,doc:s,plugins:u}),f=cx.create(h);return e.set(uT,f),e.done(c7),()=>{l(),e.remove(dT).remove(uT).remove(wx).remove(pT).clearTimer(c7)}});Gd(zhe,{displayName:"EditorState"});var kx=bn([],"pasteRule"),u7=bn([Js],"pasteRuleTimer"),h7=wc("PasteRuleReady"),Ghe=e=>(e.inject(kx,[]).inject(u7,[Js]).record(h7),async()=>(await e.waitTimers(u7),e.done(h7),()=>{e.remove(kx).remove(u7).clearTimer(h7)}));Gd(Ghe,{displayName:"PasteRule"});var mT=wc("EditorViewReady"),gT=bn([],"editorViewTimer"),yT=bn({},"editorViewOptions"),vT=bn(null,"root"),vF=bn(null,"rootDOM"),xF=bn({},"rootAttrs");function fut(e,t){let r=document.createElement("div");r.className="milkdown",e.appendChild(r),t.set(vF,r);let n=t.get(xF);return Object.entries(n).forEach(([i,a])=>r.setAttribute(i,a)),r}function dut(e){e.classList.add("editor"),e.setAttribute("role","textbox")}var put=new Hi("MILKDOWN_VIEW_CLEAR"),qhe=e=>(e.inject(vT,document.body).inject(Li,{}).inject(yT,{}).inject(vF,null).inject(xF,{}).inject(gT,[c7,h7]).record(mT),async()=>{await e.wait(eh);let t=e.get(vT)||document.body,r=typeof t=="string"?document.querySelector(t):t;e.update(fu,s=>[new Ci({key:put,view:o=>{let l=r?fut(r,e):void 0;return(()=>{if(l&&r){let h=o.dom;r.replaceChild(l,h),l.appendChild(h)}})(),{destroy:()=>{l?.parentNode&&l?.parentNode.replaceChild(o.dom,l),l?.remove()}}}}),...s]),await e.waitTimers(gT);let n=e.get(uT),i=e.get(yT),a=new aT(r,{state:n,nodeViews:Object.fromEntries(e.get(xT)),markViews:Object.fromEntries(e.get(bT)),transformPasted:(s,o,l)=>(e.get(kx).sort((u,h)=>(h.priority??50)-(u.priority??50)).map(u=>u.run).forEach(u=>{s=u(s,o,l)}),s),...i});return dut(a.dom),e.set(Li,a),e.done(mT),()=>{a?.destroy(),e.remove(vT).remove(Li).remove(yT).remove(vF).remove(xF).remove(gT).clearTimer(mT)}});Gd(qhe,{displayName:"EditorView"});var hu=(function(e){return e.Idle="Idle",e.OnCreate="OnCreate",e.Created="Created",e.OnDestroy="OnDestroy",e.Destroyed="Destroyed",e})({}),Vhe=class Whe{constructor(){this.#t=!1,this.#e=hu.Idle,this.#n=[],this.#r=()=>{},this.#s=new gP,this.#a=new Ioe,this.#i=new Map,this.#o=new Map,this.#l=new Roe(this.#s,this.#a),this.#u=()=>{let t=sut(async n=>{await Promise.all(this.#n.map(i=>Promise.resolve(i(n))))}),r=[Mhe,Bhe,$he,Dhe,cut,Ghe,zhe,qhe,out(this),t];this.#c(r,this.#o)},this.#c=(t,r)=>{t.forEach(n=>{let i=this.#l.produce(this.#t?n.meta:void 0),a=n(i);r.set(n,{ctx:i,handler:a,cleanup:void 0})})},this.#h=(t,r=!1)=>Promise.all([t].flat().map(async n=>{let i=this.#i.get(n)?.cleanup;return r?this.#i.delete(n):this.#i.set(n,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i})),this.#f=async()=>{await Promise.all([...this.#o.entries()].map(async([t,{cleanup:r}])=>typeof r=="function"?r():r)),this.#o.clear()},this.#d=t=>{this.#e=t,this.#r(t)},this.#p=t=>[...t.entries()].map(async([r,n])=>{let{ctx:i,handler:a}=n;if(!a)return;let s=await a();t.set(r,{ctx:i,handler:a,cleanup:s})}),this.enableInspector=(t=!0)=>(this.#t=t,this),this.onStatusChange=t=>(this.#r=t,this),this.config=t=>(this.#n.push(t),this),this.removeConfig=t=>(this.#n=this.#n.filter(r=>r!==t),this),this.use=t=>{let r=[t].flat();return r.flat().forEach(n=>{this.#i.set(n,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#e===hu.Created&&this.#c(r,this.#i),this},this.remove=async t=>this.#e===hu.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(r=>{setTimeout(()=>{r(this.remove(t))},50)})):(await this.#h([t].flat(),!0),this),this.create=async()=>this.#e===hu.OnCreate?this:(this.#e===hu.Created&&await this.destroy(),this.#d(hu.OnCreate),this.#u(),this.#c([...this.#i.keys()],this.#i),await Promise.all([this.#p(this.#o),this.#p(this.#i)].flat()),this.#d(hu.Created),this),this.destroy=async(t=!1)=>this.#e===hu.Destroyed||this.#e===hu.OnDestroy?this:this.#e===hu.OnCreate?new Promise(r=>{setTimeout(()=>{r(this.destroy(t))},50)}):(t&&(this.#n=[]),this.#d(hu.OnDestroy),await this.#h([...this.#i.keys()],t),await this.#f(),this.#d(hu.Destroyed),this),this.action=t=>t(this.#l),this.inspect=()=>this.#t?[...this.#o.values(),...this.#i.values()].map(({ctx:t})=>t?.inspector?.read()).filter(t=>!!t):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new Whe}#t;#e;#n;#r;#s;#a;#i;#o;#l;#u;#c;#h;#f;#d;#p;get ctx(){return this.#l}get status(){return this.#e}};var mut=e=>crypto.getRandomValues(new Uint8Array(e)),gut=(e,t,r)=>{let n=256-256%e.length;if(n===256){let a=e.length-1;return(s=t)=>{if(!s)return"";let o="";for(;;){let l=r(s),u=s;for(;u--;)if(o+=e[l[u]&a],o.length>=s)return o}}}let i=Math.ceil(1.6*256*t/n);return(a=t)=>{if(!a)return"";let s="";for(;;){let o=r(i),l=i;for(;l--;)if(o[l]<n&&(s+=e[o[l]%e.length],s.length>=a))return s}}},f7=(e,t=21)=>gut(e,t|0,mut);var lyr=f7("abcedfghicklmn",10);function hn(e,t){let r=bF(e),n=i=>async()=>{n.key=r,await i.wait(G1);let a=t(i);return i.get(Gn).create(r,a),n.run=s=>i.get(Gn).call(e,s),()=>{i.get(Gn).remove(r)}};return n}function Oo(e){let t=r=>async()=>{await r.wait(Js);let n=e(r);return r.update($d,i=>[...i,n]),t.inputRule=n,()=>{r.update($d,i=>i.filter(a=>a!==n))}};return t}function Hhe(e){let t=r=>async()=>{await r.wait(Js);let n=e(r);return r.update(kx,i=>[...i,n]),t.pasteRule=n,()=>{r.update(kx,i=>i.filter(a=>a!==n))}};return t}function yut(e,t){let r=n=>async()=>{let i=t(n);return n.update(z1,a=>[...a.filter(s=>s[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{n.update(z1,a=>a.filter(([s])=>s!==e))}};return r.type=n=>{let i=n.get(eo).marks[e];if(!i)throw _oe(e);return i},r}function d7(e,t){let r=n=>async()=>{let i=t(n);return n.update(jh,a=>[...a.filter(s=>s[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{n.update(jh,a=>a.filter(([s])=>s!==e))}};return r.type=n=>{let i=n.get(eo).nodes[e];if(!i)throw lE(e);return i},r}function nl(e){let t,r=n=>async()=>(await n.wait(Js),t=e(n),n.update(fu,i=>[...i,t]),()=>{n.update(fu,i=>i.filter(a=>a!==t))});return r.plugin=()=>t,r.key=()=>t.spec.key,r}function vut(e){let t=r=>async()=>{await r.wait(xx);let n=r.get(wT),i=e(r),a=n.addObjectKeymap(i);return t.keymap=i,()=>{a()}};return t}function th(e,t){let r=bn(e,t),n=i=>(i.inject(r),()=>()=>{i.remove(r)});return n.key=r,n}function Ba(e,t){let r=th(t,e),n=d7(e,a=>a.get(r.key)(a)),i=[r,n];return i.id=n.id,i.node=n,i.type=a=>n.type(a),i.ctx=r,i.key=r.key,i.extendSchema=a=>Ba(e,a(t)),i}function qp(e,t){let r=th(t,e),n=yut(e,a=>a.get(r.key)(a)),i=[r,n];return i.id=n.id,i.mark=n,i.type=a=>n.type(a),i.ctx=r,i.key=r.key,i.extendSchema=a=>qp(e,a(t)),i}function il(e,t){let r=th(Object.fromEntries(Object.entries(t).map(([a,{shortcuts:s,priority:o}])=>[a,{shortcuts:s,priority:o}])),`${e}Keymap`),n=vut(a=>{let s=a.get(r.key),o=Object.entries(t).flatMap(([l,{command:u}])=>{let h=s[l],f=[h.shortcuts].flat(),d=h.priority;return f.map(p=>[p,{key:p,onRun:u,priority:d}])});return Object.fromEntries(o)}),i=[r,n];return i.ctx=r,i.shortcuts=n,i.key=r.key,i.keymap=n.keymap,i}var du=(e,t=()=>({}))=>th(t,`${e}Attr`),q1=(e,t=()=>({}))=>th(t,`${e}Attr`);function qd(e,t,r){let n=th(r??{},e),i=s=>async()=>{await s.wait(eh);let o={plugin:t(s),options:s.get(n.key)};return s.update(zd,l=>[...l,o]),()=>{s.update(zd,l=>l.filter(u=>u!==o))}},a=[n,i];return a.id=e,a.plugin=i,a.options=n,a}function Uhe(e){return t=>{let r=t.get(Li),n=t.get(eo),i=t.get(Gp);if(!e)return i(r.state.doc);let a=r.state.doc.slice(e.from,e.to,!0),s=n.topNodeType.createAndFill(null,a.content);return s?i(s):(console.error("No document found"),"")}}function wF(e,t=!1){return r=>{let n=r.get(Li),i=r.get(Fd)(e);if(!i)return;if(!t){let u=n.state.selection.content();return n.dispatch(n.state.tr.replaceSelection(new Xt(i.content,u.openStart,u.openEnd)).scrollIntoView())}let a=r.get(eo),s=Yh.fromSchema(a).serializeFragment(i.content),o=Uh.fromSchema(a).parseSlice(s),l=sue(o);if(l){n.dispatch(n.state.tr.replaceSelectionWith(l,!0));return}n.dispatch(n.state.tr.replaceSelection(o))}}function Yhe(e,t=!1){return r=>{let n=r.get(Li),i=r.get(Fd)(e);if(!i)return;if(!t){let{state:l}=n;return n.dispatch(l.tr.replace(0,l.doc.content.size,new Xt(i.content,0,0)))}let a=r.get(eo),s=r.get(wx)({schema:a,doc:i,plugins:r.get(fu)}),o=cx.create(s);n.updateState(o)}}function xut(e){return t=>{let r=t.get(Fd)(e),n=t.get(eo),i=Yh.fromSchema(n).serializeFragment(r.content);return Uh.fromSchema(n).parseSlice(i)}}function kF(e,t){return r=>{let n=r.get(Li),i=xut(e)(r);n.dispatch(n.state.tr.replace(t.from,t.to,i))}}function Xhe(e,t){return function(r,n){let{$from:i,$to:a,node:s}=r.selection;if(s&&s.isBlock||i.depth<2||!i.sameParent(a))return!1;let o=i.node(-1);if(o.type!=e)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=e||i.index(-2)!=i.node(-2).childCount-1)return!1;if(n){let f=Lt.empty,d=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-d;v>=i.depth-3;v--)f=Lt.from(i.node(v).copy(f));let p=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;f=f.append(Lt.from(e.createAndFill()));let m=i.before(i.depth-(d-1)),g=r.tr.replace(m,i.after(-p),new Xt(f,4-d,0)),y=-1;g.doc.nodesBetween(m,g.doc.content.size,(v,x)=>{if(y>-1)return!1;v.isTextblock&&v.content.size==0&&(y=x+1)}),y>-1&&g.setSelection(Vr.near(g.doc.resolve(y))),n(g.scrollIntoView())}return!0}let l=a.pos==i.end()?o.contentMatchAt(0).defaultType:null,u=r.tr.delete(i.pos,a.pos),h=l?[t?{type:e,attrs:t}:null,{type:l}]:void 0;return S1(u.doc,i.pos,2,h)?(n&&n(u.split(i.pos,2,h).scrollIntoView()),!0):!1}}function p7(e){return function(t,r){let{$from:n,$to:i}=t.selection,a=n.blockRange(i,s=>s.childCount>0&&s.firstChild.type==e);return a?r?n.node(a.depth-1).type==e?but(t,r,e,a):wut(t,r,a):!0:!1}}function but(e,t,r,n){let i=e.tr,a=n.end,s=n.$to.end(n.depth);a<s&&(i.step(new Zs(a-1,s,a,s,new Xt(Lt.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new Vk(i.doc.resolve(n.$from.pos),i.doc.resolve(s),n.depth));let o=ox(n);if(o==null)return!1;i.lift(n,o);let l=i.doc.resolve(i.mapping.map(a,-1)-1);return E1(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}function wut(e,t,r){let n=e.tr,i=r.parent;for(let p=r.end,m=r.endIndex-1,g=r.startIndex;m>g;m--)p-=i.child(m).nodeSize,n.delete(p-1,p+1);let a=n.doc.resolve(r.start),s=a.nodeAfter;if(n.mapping.map(r.end)!=r.start+a.nodeAfter.nodeSize)return!1;let o=r.startIndex==0,l=r.endIndex==i.childCount,u=a.node(-1),h=a.index(-1);if(!u.canReplace(h+(o?0:1),h+1,s.content.append(l?Lt.empty:Lt.from(i))))return!1;let f=a.pos,d=f+s.nodeSize;return n.step(new Zs(f-(o?1:0),d+(l?1:0),f+1,d-1,new Xt((o?Lt.empty:Lt.from(i.copy(Lt.empty))).append(l?Lt.empty:Lt.from(i.copy(Lt.empty))),o?0:1,l?0:1),o?0:1)),t(n.scrollIntoView()),!0}function jhe(e){return function(t,r){let{$from:n,$to:i}=t.selection,a=n.blockRange(i,u=>u.childCount>0&&u.firstChild.type==e);if(!a)return!1;let s=a.startIndex;if(s==0)return!1;let o=a.parent,l=o.child(s-1);if(l.type!=e)return!1;if(r){let u=l.lastChild&&l.lastChild.type==o.type,h=Lt.from(u?e.create():null),f=new Xt(Lt.from(e.create(null,Lt.from(o.type.create(null,h)))),u?3:1,0),d=a.start,p=a.end;r(t.tr.step(new Zs(d-(u?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}function TF(e){let t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Zu(e,"definition",function(n){let i=Khe(n.identifier);i&&!t.get(i)&&t.set(i,n)}),r;function r(n){let i=Khe(n);return t.get(i)}}function Khe(e){return String(e||"").toUpperCase()}function m7(){return function(e){let t=TF(e);Zu(e,function(r,n,i){if(r.type==="definition"&&i!==void 0&&typeof n=="number")return i.children.splice(n,1),[m1,n];if(r.type==="imageReference"||r.type==="linkReference"){let a=t(r.identifier);if(a&&i&&typeof n=="number")return i.children[n]=r.type==="imageReference"?{type:"image",url:a.url,title:a.title,alt:r.alt}:{type:"link",url:a.url,title:a.title,children:r.children},[m1,n]}})}}function Zhe(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak")){e.next(t.content);return}let r=[];t.content.forEach((n,i,a)=>{a!==t.childCount-1&&r.push(n)}),e.next(Lt.fromArray(r))}function vt(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var CF=q1("emphasis");vt(CF,{displayName:"Attr<emphasis>",group:"Emphasis"});var Cx=qp("emphasis",e=>({attrs:{marker:{default:e.get(vx).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:t=>t==="italic"}],toDOM:t=>["em",e.get(CF.key)(t)],parseMarkdown:{match:t=>t.type==="emphasis",runner:(t,r,n)=>{t.openMark(n,{marker:r.marker}),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="emphasis",runner:(t,r)=>{t.withMark(r,"emphasis",void 0,{marker:r.attrs.marker})}}}));vt(Cx.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});vt(Cx.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var SF=hn("ToggleEmphasis",e=>()=>fx(Cx.type(e)));vt(SF,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var Qhe=Oo(e=>R1(/(?:^|[^*])\*([^*]+)\*$/,Cx.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:t,start:r})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:r+1}}));vt(Qhe,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var Jhe=Oo(e=>R1(/\b_(?![_\s])(.*?[^_\s])_\b/,Cx.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:t,start:r})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:r+1}}));vt(Jhe,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var EF=il("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{let t=e.get(Gn);return()=>t.call(SF.key)}}});vt(EF.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});vt(EF.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var AF=q1("strong");vt(AF,{displayName:"Attr<strong>",group:"Strong"});var kT=qp("strong",e=>({attrs:{marker:{default:e.get(vx).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:t=>t==="bold"},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:t=>["strong",e.get(AF.key)(t)],parseMarkdown:{match:t=>t.type==="strong",runner:(t,r,n)=>{t.openMark(n,{marker:r.marker}),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="strong",runner:(t,r)=>{t.withMark(r,"strong",void 0,{marker:r.attrs.marker})}}}));vt(kT.mark,{displayName:"MarkSchema<strong>",group:"Strong"});vt(kT.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var _F=hn("ToggleStrong",e=>()=>fx(kT.type(e)));vt(_F,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var efe=Oo(e=>R1(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/,kT.type(e),{getAttr:t=>({marker:t[0].startsWith("*")?"*":"_"})}));vt(efe,{displayName:"InputRule<strong>",group:"Strong"});var RF=il("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{let t=e.get(Gn);return()=>t.call(_F.key)}}});vt(RF.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});vt(RF.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var LF=q1("inlineCode");vt(LF,{displayName:"Attr<inlineCode>",group:"InlineCode"});var Wp=qp("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(LF.key)(t)],parseMarkdown:{match:t=>t.type==="inlineCode",runner:(t,r,n)=>{t.openMark(n),t.addText(r.value),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="inlineCode",runner:(t,r,n)=>(t.withMark(r,"inlineCode",n.text||""),!0)}}));vt(Wp.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});vt(Wp.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var IF=hn("ToggleInlineCode",e=>()=>(t,r)=>{let{selection:n,tr:i}=t;if(n.empty)return!1;let{from:a,to:s}=n;return t.doc.rangeHasMark(a,s,Wp.type(e))?(r?.(i.removeMark(a,s,Wp.type(e))),!0):(Object.keys(t.schema.marks).filter(o=>o!==Wp.type.name).map(o=>t.schema.marks[o]).forEach(o=>{i.removeMark(a,s,o)}),r?.(i.addMark(a,s,Wp.type(e).create())),!0)});vt(IF,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var tfe=Oo(e=>R1(/(?:`)([^`]+)(?:`)$/,Wp.type(e)));vt(tfe,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var MF=il("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{let t=e.get(Gn);return()=>t.call(IF.key)}}});vt(MF.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});vt(MF.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var NF=q1("link");vt(NF,{displayName:"Attr<link>",group:"Link"});var Tx=qp("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(NF.key)(t),...t.attrs}],parseMarkdown:{match:t=>t.type==="link",runner:(t,r,n)=>{let i=r.url,a=r.title;t.openMark(n,{href:i,title:a}),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="link",runner:(t,r)=>{t.withMark(r,"link",void 0,{title:r.attrs.title,url:r.attrs.href})}}}));vt(Tx.mark,{displayName:"MarkSchema<link>",group:"Link"});var rfe=hn("ToggleLink",e=>(t={})=>fx(Tx.type(e),t));vt(rfe,{displayName:"Command<toggleLinkCommand>",group:"Link"});var nfe=hn("UpdateLink",e=>(t={})=>(r,n)=>{if(!n)return!1;let i,a=-1,{selection:s}=r,{from:o,to:l}=s;if(r.doc.nodesBetween(o,o===l?l+1:l,(m,g)=>{if(Tx.type(e).isInSet(m.marks))return i=m,a=g,!1}),!i)return!1;let u=i.marks.find(({type:m})=>m===Tx.type(e));if(!u)return!1;let h=a,f=a+i.nodeSize,{tr:d}=r,p=Tx.type(e).create({...u.attrs,...t});return p?(n(d.removeMark(h,f,u).addMark(h,f,p).setSelection(new Pr(d.selection.$anchor)).scrollIntoView()),!0):!1});vt(nfe,{displayName:"Command<updateLinkCommand>",group:"Link"});var ife=d7("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>e==="root",runner:(e,t,r)=>{e.injectRoot(t,r)}},toMarkdown:{match:e=>e.type.name==="doc",runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));vt(ife,{displayName:"NodeSchema<doc>",group:"Doc"});function kut(e){return g1(e,t=>t.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(t.value?.trim()),(t,r)=>{if(!r.length)return;let n=r[r.length-1];if(!n)return;let i=n.children.indexOf(t);i!==-1&&n.children.splice(i,1)},!0)}var y7=qd("remark-preserve-empty-line",()=>()=>kut);vt(y7.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});vt(y7.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var DF=du("paragraph");vt(DF,{displayName:"Attr<paragraph>",group:"Paragraph"});var rh=Ba("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(DF.key)(t),0],parseMarkdown:{match:t=>t.type==="paragraph",runner:(t,r,n)=>{t.openNode(n),r.children?t.next(r.children):t.addText(r.value||""),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="paragraph",runner:(t,r)=>{let n=e.get(Li).state?.doc.lastChild;t.openNode("paragraph"),(!r.content||r.content.size===0)&&r!==n&&Tut(e)?t.addNode("html",void 0,"<br />"):Zhe(t,r),t.closeNode()}}}));function Tut(e){let t=!1;try{e.get(y7.id),t=!0}catch{t=!1}return t}vt(rh.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});vt(rh.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var OF=hn("TurnIntoText",e=>()=>hx(rh.type(e)));vt(OF,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var PF=il("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{let t=e.get(Gn);return()=>t.call(OF.key)}}});vt(PF.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});vt(PF.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var Cut=Array(6).fill(0).map((e,t)=>t+1);function Sut(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var v7=th(Sut,"headingIdGenerator");vt(v7,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var BF=du("heading");vt(BF,{displayName:"Attr<heading>",group:"Heading"});var W1=Ba("heading",e=>{let t=e.get(v7.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:Cut.map(r=>({tag:`h${r}`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw su(n);return{level:r,id:n.id}}})),toDOM:r=>[`h${r.attrs.level}`,{...e.get(BF.key)(r),id:r.attrs.id||t(r)},0],parseMarkdown:{match:({type:r})=>r==="heading",runner:(r,n,i)=>{let a=n.depth;r.openNode(i,{level:a}),r.next(n.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="heading",runner:(r,n)=>{r.openNode("heading",void 0,{depth:n.attrs.level}),Zhe(r,n),r.closeNode()}}}});vt(W1.node,{displayName:"NodeSchema<heading>",group:"Heading"});vt(W1.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var afe=Oo(e=>AB(/^(?<hashes>#+)\s$/,W1.type(e),t=>{let r=t.groups?.hashes?.length||0,{$from:n}=e.get(Li).state.selection,i=n.node();if(i.type.name==="heading"){let a=Number(i.attrs.level)+Number(r);return a>6&&(a=6),{level:a}}return{level:r}}));vt(afe,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var Vp=hn("WrapInHeading",e=>t=>(t??=1,t<1?hx(rh.type(e)):hx(W1.type(e),{level:t})));vt(Vp,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var FF=hn("DowngradeHeading",e=>()=>(t,r,n)=>{let{$from:i}=t.selection,a=i.node();if(a.type!==W1.type(e)||!t.selection.empty||i.parentOffset!==0)return!1;let s=a.attrs.level-1;return s?(r?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...a.attrs,level:s})),!0):hx(rh.type(e))(t,r,n)});vt(FF,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var $F=il("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{let t=e.get(Gn);return()=>t.call(Vp.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{let t=e.get(Gn);return()=>t.call(FF.key)}}});vt($F.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});vt($F.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var zF=du("blockquote");vt(zF,{displayName:"Attr<blockquote>",group:"Blockquote"});var TT=Ba("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(zF.key)(t),0],parseMarkdown:{match:({type:t})=>t==="blockquote",runner:(t,r,n)=>{t.openNode(n).next(r.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="blockquote",runner:(t,r)=>{t.openNode("blockquote").next(r.content).closeNode()}}}));vt(TT.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});vt(TT.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var sfe=Oo(e=>UE(/^\s*>\s$/,TT.type(e)));vt(sfe,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var GF=hn("WrapInBlockquote",e=>()=>HE(TT.type(e)));vt(GF,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var qF=il("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{let t=e.get(Gn);return()=>t.call(GF.key)}}});vt(qF.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});vt(qF.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var VF=du("codeBlock",()=>({pre:{},code:{}}));vt(VF,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var CT=Ba("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{language:t.dataset.language}}}],toDOM:t=>{let r=e.get(VF.key)(t),n=t.attrs.language,i=n&&n.length>0?{"data-language":n}:void 0;return["pre",{...r.pre,...i},["code",r.code,0]]},parseMarkdown:{match:({type:t})=>t==="code",runner:(t,r,n)=>{let i=r.lang??"",a=r.value;t.openNode(n,{language:i}),a&&t.addText(a),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="code_block",runner:(t,r)=>{t.addNode("code",void 0,r.content.firstChild?.text||"",{lang:r.attrs.language})}}}));vt(CT.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});vt(CT.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var ofe=Oo(e=>AB(/^```(?<language>[a-z]*)?[\s\n]$/,CT.type(e),t=>({language:t.groups?.language??""})));vt(ofe,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var WF=hn("CreateCodeBlock",e=>(t="")=>hx(CT.type(e),{language:t}));vt(WF,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var Eut=hn("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(r,n)=>e>=0?(n?.(r.tr.setNodeAttribute(e,"language",t)),!0):!1);vt(Eut,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var HF=il("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{let t=e.get(Gn);return()=>t.call(WF.key)}}});vt(HF.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});vt(HF.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var UF=du("image");vt(UF,{displayName:"Attr<image>",group:"Image"});var Sx=Ba("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",title:t.getAttribute("title")||t.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(UF.key)(t),...t.attrs}],parseMarkdown:{match:({type:t})=>t==="image",runner:(t,r,n)=>{let i=r.url,a=r.alt,s=r.title;t.addNode(n,{src:i,alt:a,title:s})}},toMarkdown:{match:t=>t.type.name==="image",runner:(t,r)=>{t.addNode("image",void 0,void 0,{title:r.attrs.title,url:r.attrs.src,alt:r.attrs.alt})}}}));vt(Sx.node,{displayName:"NodeSchema<image>",group:"Image"});vt(Sx.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var lfe=hn("InsertImage",e=>(t={})=>(r,n)=>{if(!n)return!0;let{src:i="",alt:a="",title:s=""}=t,o=Sx.type(e).create({src:i,alt:a,title:s});return o&&n(r.tr.replaceSelectionWith(o).scrollIntoView()),!0});vt(lfe,{displayName:"Command<insertImageCommand>",group:"Image"});var cfe=hn("UpdateImage",e=>(t={})=>(r,n)=>{let i=cue(r.selection,Sx.type(e));if(!i)return!1;let{node:a,pos:s}=i,o={...a.attrs},{src:l,alt:u,title:h}=t;return l!==void 0&&(o.src=l),u!==void 0&&(o.alt=u),h!==void 0&&(o.title=h),n?.(r.tr.setNodeMarkup(s,void 0,o).scrollIntoView()),!0});vt(cfe,{displayName:"Command<updateImageCommand>",group:"Image"});var Aut=Oo(e=>new Pa(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,r,n,i)=>{let[a,s,o="",l]=r;return a?t.tr.replaceWith(n,i,Sx.type(e).create({src:o,alt:s,title:l})):null}));vt(Aut,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var g7=du("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));vt(g7,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var V1=Ba("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(g7.key)(t)," "]:["br",e.get(g7.key)(t)],parseMarkdown:{match:({type:t})=>t==="break",runner:(t,r,n)=>{t.addNode(n,{isInline:!!r.data?.isInline})}},leafText:()=>` `,toMarkdown:{match:t=>t.type.name==="hardbreak",runner:(t,r)=>{r.attrs.isInline?t.addNode("text",void 0,` -`):t.addNode("break")}}}));vt(V1.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});vt(V1.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var HF=hn("InsertHardbreak",e=>()=>(t,r)=>{let{selection:n,tr:i}=t;if(!(n instanceof Pr))return!1;if(n.empty){let a=n.$from.node();if(a.childCount>0&&a.lastChild?.type.name==="hardbreak")return r?.(i.replaceRangeWith(n.to-1,n.to,t.schema.node("paragraph")).setSelection(Vr.near(i.doc.resolve(n.to))).scrollIntoView()),!0}return r?.(i.setMeta("hardbreak",!0).replaceSelectionWith(V1.type(e).create()).scrollIntoView()),!0});vt(HF,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var UF=nl("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{let t=e.get(Gn);return()=>t.call(HF.key)}}});vt(UF.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});vt(UF.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var YF=du("hr");vt(YF,{displayName:"Attr<hr>",group:"Hr"});var ST=Ba("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(YF.key)(t)],parseMarkdown:{match:({type:t})=>t==="thematicBreak",runner:(t,r,n)=>{t.addNode(n)}},toMarkdown:{match:t=>t.type.name==="hr",runner:t=>{t.addNode("thematicBreak")}}}));vt(ST.node,{displayName:"NodeSchema<hr>",group:"Hr"});vt(ST.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var lfe=Oo(e=>new Pa(/^(?:---|___\s|\*\*\*\s)$/,(t,r,n,i)=>{let{tr:a}=t;return r[0]&&a.replaceWith(n-1,i,ST.type(e).create()),a}));vt(lfe,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var cfe=hn("InsertHr",e=>()=>(t,r)=>{if(!r)return!0;let n=rh.node.type(e).create(),{tr:i,selection:a}=t,{from:s}=a,o=ST.type(e).create();if(!o)return!0;let l=i.replaceSelectionWith(o).insert(s,n),u=Vr.findFrom(l.doc.resolve(s),1,!0);return u&&r(l.setSelection(u).scrollIntoView()),!0});vt(cfe,{displayName:"Command<insertHrCommand>",group:"Hr"});var XF=du("bulletList");vt(XF,{displayName:"Attr<bulletList>",group:"BulletList"});var Ex=Ba("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{spread:t.dataset.spread==="true"}}}],toDOM:t=>["ul",{...e.get(XF.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:r})=>t==="list"&&!r,runner:(t,r,n)=>{let i=r.spread!=null?`${r.spread}`:"false";t.openNode(n,{spread:i}).next(r.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="bullet_list",runner:(t,r)=>{t.openNode("list",void 0,{ordered:!1,spread:r.attrs.spread}).next(r.content).closeNode()}}}));vt(Ex.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});vt(Ex.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var ufe=Oo(e=>UE(/^\s*([-+*])\s$/,Ex.type(e)));vt(ufe,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var jF=hn("WrapInBulletList",e=>()=>HE(Ex.type(e)));vt(jF,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var KF=nl("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{let t=e.get(Gn);return()=>t.call(jF.key)}}});vt(KF.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});vt(KF.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var ZF=du("orderedList");vt(ZF,{displayName:"Attr<orderedList>",group:"OrderedList"});var Ax=Ba("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{spread:t.dataset.spread,order:t.hasAttribute("start")?Number(t.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(ZF.key)(t),...t.attrs.order===1?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:r})=>t==="list"&&!!r,runner:(t,r,n)=>{let i=r.spread!=null?`${r.spread}`:"true";t.openNode(n,{spread:i,order:r.start??1}).next(r.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="ordered_list",runner:(t,r)=>{t.openNode("list",void 0,{ordered:!0,start:r.attrs.order??1,spread:r.attrs.spread==="true"}),t.next(r.content),t.closeNode()}}}));vt(Ax.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});vt(Ax.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var hfe=Oo(e=>UE(/^\s*(\d+)\.\s$/,Ax.type(e),t=>({order:Number(t[1])}),(t,r)=>r.childCount+r.attrs.order===Number(t[1])));vt(hfe,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var QF=hn("WrapInOrderedList",e=>()=>HE(Ax.type(e)));vt(QF,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var JF=nl("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{let t=e.get(Gn);return()=>t.call(QF.key)}}});vt(JF.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});vt(JF.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var e$=du("listItem");vt(e$,{displayName:"Attr<listItem>",group:"ListItem"});var Kh=Ba("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"\u2022",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{label:t.dataset.label,listType:t.dataset.listType,spread:t.dataset.spread==="true"}}}],toDOM:t=>["li",{...e.get(e$.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t})=>t==="listItem",runner:(t,r,n)=>{let i=r.label!=null?`${r.label}.`:"\u2022",a=r.label!=null?"ordered":"bullet",s=r.spread!=null?`${r.spread}`:"true";t.openNode(n,{label:i,listType:a,spread:s}),t.next(r.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="list_item",runner:(t,r)=>{t.openNode("listItem",void 0,{spread:r.attrs.spread}),t.next(r.content),t.closeNode()}}}));vt(Kh.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});vt(Kh.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var t$=hn("SinkListItem",e=>()=>Yhe(Kh.type(e)));vt(t$,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var r$=hn("LiftListItem",e=>()=>p7(Kh.type(e)));vt(r$,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var n$=hn("SplitListItem",e=>()=>Uhe(Kh.type(e)));vt(n$,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function Cut(e){return(t,r,n)=>{let{selection:i}=t;if(!(i instanceof Pr))return!1;let{empty:a,$from:s}=i;return!a||s.parentOffset!==0||s.node(-1).type!==Kh.type(e)?!1:wB(t,r,n)}}var i$=hn("LiftFirstListItem",e=>()=>Cut(e));vt(i$,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var a$=nl("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{let t=e.get(Gn);return()=>t.call(n$.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{let t=e.get(Gn);return()=>t.call(t$.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{let t=e.get(Gn);return()=>t.call(r$.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{let t=e.get(Gn);return()=>t.call(i$.key)}}});vt(a$.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});vt(a$.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var ffe=d7("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>e==="text",runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>e.type.name==="text",runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));vt(ffe,{displayName:"NodeSchema<text>",group:"Text"});var s$=du("html");vt(s$,{displayName:"Attr<html>",group:"Html"});var o$=Ba("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{let r=document.createElement("span"),n={...e.get(s$.key)(t),"data-value":t.attrs.value,"data-type":"html"};return r.textContent=t.attrs.value,["span",n,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:t=>({value:t.dataset.value??""})}],parseMarkdown:{match:({type:t})=>t==="html",runner:(t,r,n)=>{t.addNode(n,{value:r.value})}},toMarkdown:{match:t=>t.type.name==="html",runner:(t,r)=>{t.addNode("html",void 0,r.attrs.value)}}}));vt(o$.node,{displayName:"NodeSchema<html>",group:"Html"});vt(o$.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var Sut=[rfe,MF,rh,v7,OF,W1,g7,V1,FF,TT,GF,CT,YF,ST,WF,Sx,XF,Ex,ZF,Ax,e$,Kh,kF,Cx,SF,kT,_F,Wp,IF,Tx,s$,o$,ffe].flat(),Eut=[ife,ufe,hfe,afe,lfe,nfe].flat(),Aut=[Khe,Zhe,Jhe,Qhe],_ut=hn("IsMarkSelected",()=>e=>t=>{if(!e)return!1;let{doc:r,selection:n}=t;return r.rangeHasMark(n.from,n.to,e)}),Rut=hn("IsNoteSelected",()=>e=>t=>e?lue(t,e).hasNode:!1),Lut=hn("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let r=e.tr,{$from:n,$to:i}=r.selection,{pos:a}=n,{pos:s}=i,o=a-n.node().content.size;return o<0?!1:(r=r.deleteRange(o,s),t?.(r),!0)}),Iut=hn("SetBlockType",()=>e=>(t,r)=>{let{nodeType:n,attrs:i=null}=e??{};if(!n)return!1;let a=t.tr,{from:s,to:o}=a.selection;try{a.setBlockType(s,o,n,i)}catch{return!1}return r?.(a),!0}),Mut=hn("WrapInBlockType",()=>e=>(t,r)=>{let{nodeType:n,attrs:i=null}=e??{};if(!n)return!1;let a=t.tr;try{let{$from:s,$to:o}=a.selection,l=s.blockRange(o),u=l&&C1(l,n,i);if(!u)return!1;a=a.wrap(l,u)}catch{return!1}return r?.(a),!0}),Nut=hn("AddBlockType",()=>e=>(t,r)=>{let{nodeType:n,attrs:i=null}=e??{};if(!n)return!1;let a=t.tr;try{let s=n instanceof Fl?n:n.createAndFill(i);if(!s)return!1;a.replaceSelectionWith(s)}catch{return!1}return r?.(a),!0}),Dut=hn("SelectTextNearPos",()=>e=>(t,r)=>{let{pos:n}=e??{};if(n==null)return!1;let i=(s,o,l)=>Math.min(Math.max(s,o),l),a=t.tr;try{let s=t.doc.resolve(i(n,0,t.doc.content.size));a.setSelection(Pr.near(s))}catch{return!1}return r?.(a.scrollIntoView()),!0}),Out=[NF,$F,Vp,PF,qF,HF,cfe,sfe,ofe,QF,jF,t$,n$,r$,i$,TF,RF,EF,efe,tfe,_ut,Rut,Lut,Iut,Mut,Nut,Dut],Put=[zF,VF,UF,BF,a$,JF,KF,DF,CF,LF,AF].flat(),l$=qd("remarkAddOrderInList",()=>()=>e=>{Zu(e,"list",t=>{if(t.ordered){let r=t.start??1;t.children.forEach((n,i)=>{n.label=i+r})}})});vt(l$.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});vt(l$.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var c$=qd("remarkLineBreak",()=>()=>e=>{let t=/[\t ]*(?:\r?\n|\r)/g;Zu(e,"text",(r,n,i)=>{if(!r.value||typeof r.value!="string")return;let a=[],s=0;t.lastIndex=0;let o=t.exec(r.value);for(;o;){let l=o.index;s!==l&&a.push({type:"text",value:r.value.slice(s,l)}),a.push({type:"break",data:{isInline:!0}}),s=l+o[0].length,o=t.exec(r.value)}if(a.length>0&&i&&typeof n=="number")return s<r.value.length&&a.push({type:"text",value:r.value.slice(s)}),i.children.splice(n,1,...a),n+a.length})});vt(c$.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});vt(c$.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var u$=qd("remarkInlineLink",()=>m7);vt(u$.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});vt(u$.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var But=e=>!!e.children,Fut=e=>e.type==="html";function $ut(e,t){return r(e,0,null)[0];function r(n,i,a){if(But(n)){let s=[];for(let o=0,l=n.children.length;o<l;o++){let u=n.children[o];if(u){let h=r(u,o,n);if(h)for(let f=0,d=h.length;f<d;f++){let p=h[f];p&&s.push(p)}}}n.children=s}return t(n,i,a)}}var zut=["root","blockquote","listItem"],h$=qd("remarkHTMLTransformer",()=>()=>e=>{$ut(e,(t,r,n)=>Fut(t)?(n&&zut.includes(n.type)&&(t.children=[{...t}],delete t.value,t.type="paragraph"),[t]):[t])});vt(h$.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});vt(h$.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var f$=qd("remarkMarker",()=>()=>(e,t)=>{let r=n=>t.value.charAt(n.position.start.offset);Zu(e,n=>["strong","emphasis"].includes(n.type),n=>{n.marker=r(n)})});vt(f$.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});vt(f$.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var dfe=rl(()=>{let e=!1,t=new Ci({key:new Hi("MILKDOWN_INLINE_NODES_CURSOR"),state:{init(){return!1},apply(r){if(!r.selection.empty)return!1;let n=r.selection.$from,i=n.nodeBefore,a=n.nodeAfter;return!!(i&&a&&i.isInline&&!i.isText&&a.isInline&&!a.isText)}},props:{handleDOMEvents:{compositionend:(r,n)=>e?(e=!1,requestAnimationFrame(()=>{if(t.getState(r.state)){let i=r.state.selection.from;n.preventDefault(),r.dispatch(r.state.tr.insertText(n.data||"",i))}}),!0):!1,compositionstart:r=>(t.getState(r.state)&&(e=!0),!1),beforeinput:(r,n)=>{if(t.getState(r.state)&&n instanceof InputEvent&&n.data&&!e){let i=r.state.selection.from;return n.preventDefault(),r.dispatch(r.state.tr.insertText(n.data||"",i)),!0}return!1}},decorations(r){if(t.getState(r)){let n=r.selection.$from.pos,i=document.createElement("span"),a=mi.widget(n,i,{side:-1}),s=document.createElement("span"),o=mi.widget(n,s);return setTimeout(()=>{i.contentEditable="true",s.contentEditable="true"}),Ui.create(r.doc,[a,o])}return Ui.empty}}});return t});vt(dfe,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var pfe=rl(e=>new Ci({key:new Hi("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,r,n)=>{if(!t.length)return;let[i]=t;if(!i)return;let[a]=i.steps;if(i.getMeta("hardbreak")){if(!(a instanceof Ks))return;let{from:s}=a;return n.tr.setNodeMarkup(s,V1.type(e),void 0,[])}if(a instanceof k1){let s=n.tr,{from:o,to:l}=a;return n.doc.nodesBetween(o,l,(u,h)=>{u.type===V1.type(e)&&(s=s.setNodeMarkup(h,V1.type(e),void 0,[]))}),s}}}));vt(pfe,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var d$=th(["table","code_block"],"hardbreakFilterNodes");vt(d$,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var mfe=rl(e=>{let t=e.get(d$.key);return new Ci({key:new Hi("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(r,n)=>{let i=r.getMeta("hardbreak"),[a]=r.steps;if(i&&a){let{from:s}=a,o=n.doc.resolve(s),l=o.depth,u=!0;for(;l>0;)t.includes(o.node(l).type.name)&&(u=!1),l--;return u}return!0}})});vt(mfe,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var gfe=rl(e=>{let t=new Hi("MILKDOWN_HEADING_ID"),r=n=>{if(n.composing)return;let i=e.get(v7.key),a=n.state.tr.setMeta("addToHistory",!1),s=!1,o={};n.state.doc.descendants((l,u)=>{if(l.type===W1.type(e)){if(l.textContent.trim().length===0)return;let h=l.attrs,f=i(l);o[f]?(o[f]+=1,f+=`-#${o[f]}`):o[f]=1,h.id!==f&&(s=!0,a.setMeta(t,!0).setNodeMarkup(u,void 0,{...h,id:f}))}}),s&&n.dispatch(a)};return new Ci({key:t,view:n=>(r(n),{update:(i,a)=>{i.state.doc.eq(a.doc)||r(i)}})})});vt(gfe,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var yfe=rl(e=>{let t=(r,n,i)=>{if(!i.selection||r.some(f=>f.getMeta("addToHistory")===!1||!f.isGeneric))return null;let a=Ax.type(e),s=Ex.type(e),o=Kh.type(e),l=(f,d,p=1)=>{let m=!1,g=`${d+p}.`;return f.label!==g&&(f.label=g,m=!0),m},u=i.tr,h=!1;return i.doc.descendants((f,d,p,m)=>{if(f.type===s){let g=f.maybeChild(0);g?.type===o&&g.attrs.listType==="ordered"&&(h=!0,u.setNodeMarkup(d,a,{spread:"true"}),f.descendants((y,v,x,w)=>{if(y.type===o){let C={...y.attrs};l(C,w)&&(u=u.setNodeMarkup(v,void 0,C))}return!1}))}else if(f.type===o&&p?.type===a){let g={...f.attrs},y=!1;g.listType!=="ordered"&&(g.listType="ordered",y=!0),p?.maybeChild(0)&&(y=l(g,m,p?.attrs.order??1)),y&&(u=u.setNodeMarkup(d,void 0,g),h=!0)}}),h?u.setMeta("addToHistory",!1):null};return new Ci({key:new Hi("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:t})});vt(yfe,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var Gut=[pfe,d$,mfe,dfe,l$,u$,c$,h$,f$,y7,gfe,yfe].flat(),vfe=[Sut,Eut,Aut,Out,Put,Gut].flat();var m$,g$;if(typeof WeakMap<"u"){let e=new WeakMap;m$=t=>e.get(t),g$=(t,r)=>(e.set(t,r),r)}else{let e=[],r=0;m$=n=>{for(let i=0;i<e.length;i+=2)if(e[i]==n)return e[i+1]},g$=(n,i)=>(r==10&&(r=0),e[r++]=n,e[r++]=i)}var ai=class{constructor(e,t,r,n){this.width=e,this.height=t,this.map=r,this.problems=n}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let n=t%this.width,i=t/this.width|0,a=n+1,s=i+1;for(let o=1;a<this.width&&this.map[t+o]==r;o++)a++;for(let o=1;s<this.height&&this.map[t+this.width*o]==r;o++)s++;return{left:n,top:i,right:a,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,r){let{left:n,right:i,top:a,bottom:s}=this.findCell(e);return t=="horiz"?(r<0?n==0:i==this.width)?null:this.map[a*this.width+(r<0?n-1:i)]:(r<0?a==0:s==this.height)?null:this.map[n+this.width*(r<0?a-1:s)]}rectBetween(e,t){let{left:r,right:n,top:i,bottom:a}=this.findCell(e),{left:s,right:o,top:l,bottom:u}=this.findCell(t);return{left:Math.min(r,s),top:Math.min(i,l),right:Math.max(n,o),bottom:Math.max(a,u)}}cellsInRect(e){let t=[],r={};for(let n=e.top;n<e.bottom;n++)for(let i=e.left;i<e.right;i++){let a=n*this.width+i,s=this.map[a];r[s]||(r[s]=!0,!(i==e.left&&i&&this.map[a-1]==s||n==e.top&&n&&this.map[a-this.width]==s)&&t.push(s))}return t}positionAt(e,t,r){for(let n=0,i=0;;n++){let a=i+r.child(n).nodeSize;if(n==e){let s=t+e*this.width,o=(e+1)*this.width;for(;s<o&&this.map[s]<i;)s++;return s==o?a-1:this.map[s]}i=a}}static get(e){return m$(e)||g$(e,qut(e))}};function qut(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);let t=Vut(e),r=e.childCount,n=[],i=0,a=null,s=[];for(let u=0,h=t*r;u<h;u++)n[u]=0;for(let u=0,h=0;u<r;u++){let f=e.child(u);h++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==f.childCount)break;let g=f.child(m),{colspan:y,rowspan:v,colwidth:x}=g.attrs;for(let w=0;w<v;w++){if(w+u>=r){(a||(a=[])).push({type:"overlong_rowspan",pos:h,n:v-w});break}let C=i+w*t;for(let T=0;T<y;T++){n[C+T]==0?n[C+T]=h:(a||(a=[])).push({type:"collision",row:u,pos:h,n:y-T});let k=x&&x[T];if(k){let S=(C+T)%t*2,E=s[S];E==null||E!=k&&s[S+1]==1?(s[S]=k,s[S+1]=1):E==k&&s[S+1]++}}}i+=y,h+=g.nodeSize}let d=(u+1)*t,p=0;for(;i<d;)n[i++]==0&&p++;p&&(a||(a=[])).push({type:"missing",row:u,n:p}),h++}(t===0||r===0)&&(a||(a=[])).push({type:"zero_sized"});let o=new ai(t,r,n,a),l=!1;for(let u=0;!l&&u<s.length;u+=2)s[u]!=null&&s[u+1]<r&&(l=!0);return l&&Wut(o,s,e),o}function Vut(e){let t=-1,r=!1;for(let n=0;n<e.childCount;n++){let i=e.child(n),a=0;if(r)for(let s=0;s<n;s++){let o=e.child(s);for(let l=0;l<o.childCount;l++){let u=o.child(l);s+u.attrs.rowspan>n&&(a+=u.attrs.colspan)}}for(let s=0;s<i.childCount;s++){let o=i.child(s);a+=o.attrs.colspan,o.attrs.rowspan>1&&(r=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Wut(e,t,r){e.problems||(e.problems=[]);let n={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(n[a])continue;n[a]=!0;let s=r.nodeAt(a);if(!s)throw new RangeError(`No cell with offset ${a} found`);let o=null,l=s.attrs;for(let u=0;u<l.colspan;u++){let h=t[(i+u)%e.width*2];h!=null&&(!l.colwidth||l.colwidth[u]!=h)&&((o||(o=Hut(l)))[u]=h)}o&&e.problems.unshift({type:"colwidth mismatch",pos:a,colwidth:o})}}function Hut(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let r=0;r<e.colspan;r++)t.push(0);return t}function xfe(e,t){if(typeof e=="string")return{};let r=e.getAttribute("data-colwidth"),n=r&&/^\d+(,\d+)*$/.test(r)?r.split(",").map(s=>Number(s)):null,i=Number(e.getAttribute("colspan")||1),a={colspan:i,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:n&&n.length==i?n:null};for(let s in t){let o=t[s].getFromDOM,l=o&&o(e);l!=null&&(a[s]=l)}return a}function bfe(e,t){let r={};e.attrs.colspan!=1&&(r.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(r.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(r["data-colwidth"]=e.attrs.colwidth.join(","));for(let n in t){let i=t[n].setDOMAttr;i&&i(e.attrs[n],r)}return r}function Uut(e){if(e!==null){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(let t of e)if(typeof t!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function Mfe(e){let t=e.cellAttributes||{},r={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:Uut}};for(let n in t)r[n]={default:t[n].default,validate:t[n].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:r,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:n=>xfe(n,t)}],toDOM(n){return["td",bfe(n,t),0]}},table_header:{content:e.cellContent,attrs:r,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:n=>xfe(n,t)}],toDOM(n){return["th",bfe(n,t),0]}}}}function pu(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let r in e.nodes){let n=e.nodes[r],i=n.spec.tableRole;i&&(t[i]=n)}}return t}var Hp=new Hi("selectingCells");function Lx(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function Sc(e){let t=e.selection.$head;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="row")return!0;return!1}function C7(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;let r=Lx(t.$head)||Yut(t.$head);if(r)return r;throw new RangeError(`No cell found around position ${t.head}`)}function Yut(e){for(let t=e.nodeAfter,r=e.pos;t;t=t.firstChild,r++){let n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(r)}for(let t=e.nodeBefore,r=e.pos;t;t=t.lastChild,r--){let n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(r-t.nodeSize)}}function y$(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function Xut(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function b$(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Nfe(e,t,r){let n=e.node(-1),i=ai.get(n),a=e.start(-1),s=i.nextCell(e.pos-a,t,r);return s==null?null:e.node(0).resolve(a+s)}function H1(e,t,r=1){let n={...e,colspan:e.colspan-r};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(t,r),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}function jut(e,t,r=1){let n={...e,colspan:e.colspan+r};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let i=0;i<r;i++)n.colwidth.splice(t,0,0)}return n}function Kut(e,t,r){let n=pu(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[r+i*e.width]).type!=n)return!1;return!0}var Oi=class Vd extends Vr{constructor(t,r=t){let n=t.node(-1),i=ai.get(n),a=t.start(-1),s=i.rectBetween(t.pos-a,r.pos-a),o=t.node(0),l=i.cellsInRect(s).filter(h=>h!=r.pos-a);l.unshift(r.pos-a);let u=l.map(h=>{let f=n.nodeAt(h);if(!f)throw new RangeError(`No cell with offset ${h} found`);let d=a+h+1;return new Np(o.resolve(d),o.resolve(d+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=r}map(t,r){let n=t.resolve(r.map(this.$anchorCell.pos)),i=t.resolve(r.map(this.$headCell.pos));if(y$(n)&&y$(i)&&b$(n,i)){let a=this.$anchorCell.node(-1)!=n.node(-1);return a&&this.isRowSelection()?Vd.rowSelection(n,i):a&&this.isColSelection()?Vd.colSelection(n,i):new Vd(n,i)}return Pr.between(n,i)}content(){let t=this.$anchorCell.node(-1),r=ai.get(t),n=this.$anchorCell.start(-1),i=r.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),a={},s=[];for(let l=i.top;l<i.bottom;l++){let u=[];for(let h=l*r.width+i.left,f=i.left;f<i.right;f++,h++){let d=r.map[h];if(a[d])continue;a[d]=!0;let p=r.findCell(d),m=t.nodeAt(d);if(!m)throw new RangeError(`No cell with offset ${d} found`);let g=i.left-p.left,y=p.right-i.right;if(g>0||y>0){let v=m.attrs;if(g>0&&(v=H1(v,0,g)),y>0&&(v=H1(v,v.colspan-y,y)),p.left<i.left){if(m=m.type.createAndFill(v),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(v)}`)}else m=m.type.create(v,m.content)}if(p.top<i.top||p.bottom>i.bottom){let v={...m.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?m=m.type.createAndFill(v):m=m.type.create(v,m.content)}u.push(m)}s.push(t.child(l).copy(Lt.from(u)))}let o=this.isColSelection()&&this.isRowSelection()?t:s;return new Xt(Lt.from(o),1,1)}replace(t,r=Xt.empty){let n=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],u=t.mapping.slice(n);t.replace(u.map(o.pos),u.map(l.pos),s?Xt.empty:r)}let a=Vr.findFrom(t.doc.resolve(t.mapping.slice(n).map(this.to)),-1);a&&t.setSelection(a)}replaceWith(t,r){this.replace(t,new Xt(Lt.from(r),0,0))}forEachCell(t){let r=this.$anchorCell.node(-1),n=ai.get(r),i=this.$anchorCell.start(-1),a=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<a.length;s++)t(r.nodeAt(a[s]),i+a[s])}isColSelection(){let t=this.$anchorCell.index(-1),r=this.$headCell.index(-1);if(Math.min(t,r)>0)return!1;let n=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=r+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(t,r=t){let n=t.node(-1),i=ai.get(n),a=t.start(-1),s=i.findCell(t.pos-a),o=i.findCell(r.pos-a),l=t.node(0);return s.top<=o.top?(s.top>0&&(t=l.resolve(a+i.map[s.left])),o.bottom<i.height&&(r=l.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))):(o.top>0&&(r=l.resolve(a+i.map[o.left])),s.bottom<i.height&&(t=l.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))),new Vd(t,r)}isRowSelection(){let t=this.$anchorCell.node(-1),r=ai.get(t),n=this.$anchorCell.start(-1),i=r.colCount(this.$anchorCell.pos-n),a=r.colCount(this.$headCell.pos-n);if(Math.min(i,a)>0)return!1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,o=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,o)==r.width}eq(t){return t instanceof Vd&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,r=t){let n=t.node(-1),i=ai.get(n),a=t.start(-1),s=i.findCell(t.pos-a),o=i.findCell(r.pos-a),l=t.node(0);return s.left<=o.left?(s.left>0&&(t=l.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(r=l.resolve(a+i.map[i.width*(o.top+1)-1]))):(o.left>0&&(r=l.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(t=l.resolve(a+i.map[i.width*(s.top+1)-1]))),new Vd(t,r)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,r){return new Vd(t.resolve(r.anchor),t.resolve(r.head))}static create(t,r,n=r){return new Vd(t.resolve(r),t.resolve(n))}getBookmark(){return new Zut(this.$anchorCell.pos,this.$headCell.pos)}};Oi.prototype.visible=!1;Vr.jsonID("cell",Oi);var Zut=class Dfe{constructor(t,r){this.anchor=t,this.head=r}map(t){return new Dfe(t.map(this.anchor),t.map(this.head))}resolve(t){let r=t.resolve(this.anchor),n=t.resolve(this.head);return r.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&r.index()<r.parent.childCount&&n.index()<n.parent.childCount&&b$(r,n)?new Oi(r,n):Vr.near(n,1)}};function Qut(e){if(!(e.selection instanceof Oi))return null;let t=[];return e.selection.forEachCell((r,n)=>{t.push(mi.node(n,n+r.nodeSize,{class:"selectedCell"}))}),Ui.create(e.doc,t)}function Jut({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let r=e.pos,n=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,r++);for(let a=t.depth;a>=0&&!(t.before(a+1)>t.start(a));a--,n--);return r==n&&/row|table/.test(e.node(i).type.spec.tableRole)}function eht({$from:e,$to:t}){let r,n;for(let i=e.depth;i>0;i--){let a=e.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}for(let i=t.depth;i>0;i--){let a=t.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}return r!==n&&t.parentOffset===0}function tht(e,t,r){let n=(t||e).selection,i=(t||e).doc,a,s;if(n instanceof cn&&(s=n.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")a=Oi.create(i,n.from);else if(s=="row"){let o=i.resolve(n.from+1);a=Oi.rowSelection(o,o)}else if(!r){let o=ai.get(n.node),l=n.from+1,u=l+o.map[o.width*o.height-1];a=Oi.create(i,l+1,u)}}else n instanceof Pr&&Jut(n)?a=Pr.create(i,n.from):n instanceof Pr&&eht(n)&&(a=Pr.create(i,n.$from.start(),n.$from.end()));return a&&(t||(t=e.tr)).setSelection(a),t}var rht=new Hi("fix-tables");function Ofe(e,t,r,n){let i=e.childCount,a=t.childCount;e:for(let s=0,o=0;s<a;s++){let l=t.child(s);for(let u=o,h=Math.min(i,s+3);u<h;u++)if(e.child(u)==l){o=u+1,r+=l.nodeSize;continue e}n(l,r),o<i&&e.child(o).sameMarkup(l)?Ofe(e.child(o),l,r+1,n):l.nodesBetween(0,l.content.size,n,r+1),r+=l.nodeSize}}function nht(e,t){let r,n=(i,a)=>{i.type.spec.tableRole=="table"&&(r=iht(e,i,a,r))};return t?t.doc!=e.doc&&Ofe(t.doc,e.doc,0,n):e.doc.descendants(n),r}function iht(e,t,r,n){let i=ai.get(t);if(!i.problems)return n;n||(n=e.tr);let a=[];for(let l=0;l<i.height;l++)a.push(0);for(let l=0;l<i.problems.length;l++){let u=i.problems[l];if(u.type=="collision"){let h=t.nodeAt(u.pos);if(!h)continue;let f=h.attrs;for(let d=0;d<f.rowspan;d++)a[u.row+d]+=u.n;n.setNodeMarkup(n.mapping.map(r+1+u.pos),null,H1(f,f.colspan-u.n,u.n))}else if(u.type=="missing")a[u.row]+=u.n;else if(u.type=="overlong_rowspan"){let h=t.nodeAt(u.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(r+1+u.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){let h=t.nodeAt(u.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(r+1+u.pos),null,{...h.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){let h=n.mapping.map(r);n.delete(h,h+t.nodeSize)}}let s,o;for(let l=0;l<a.length;l++)a[l]&&(s==null&&(s=l),o=l);for(let l=0,u=r+1;l<i.height;l++){let h=t.child(l),f=u+h.nodeSize,d=a[l];if(d>0){let p="cell";h.firstChild&&(p=h.firstChild.type.spec.tableRole);let m=[];for(let y=0;y<d;y++){let v=pu(e.schema)[p].createAndFill();v&&m.push(v)}let g=(l==0||s==l-1)&&o==l?u+1:f-1;n.insert(n.mapping.map(g),m)}u=f}return n.setMeta(rht,{fixTables:!0})}function Pfe(e){let t=ai.get(e),r=[],n=t.height,i=t.width;for(let a=0;a<n;a++){let s=[];for(let o=0;o<i;o++){let l=a*i+o,u=t.map[l];if(a>0){let h=l-i;if(u===t.map[h]){s.push(null);continue}}if(o>0){let h=l-1;if(u===t.map[h]){s.push(null);continue}}s.push(e.nodeAt(u))}r.push(s)}return r}function Bfe(e,t){let r=[],n=ai.get(e),i=n.height,a=n.width;for(let s=0;s<i;s++){let o=e.child(s),l=[];for(let h=0;h<a;h++){let f=t[s][h];if(!f)continue;let d=n.map[s*n.width+h],p=e.nodeAt(d);if(!p)continue;let m=p.type.createChecked(f.attrs,f.content,f.marks);l.push(m)}let u=o.type.createChecked(o.attrs,l,o.marks);r.push(u)}return e.type.createChecked(e.attrs,r,e.marks)}function Ffe(e,t,r,n){let i=t[0]>r[0]?-1:1,a=e.splice(t[0],t.length),s=a.length%2===0?1:0,o;return n===-1&&i===1?o=r[0]-1:n===1&&i===-1?o=r[r.length-1]-s+1:o=i===-1?r[0]:r[r.length-1]-s,e.splice(o,0,...a),e}function Ix(e){return aht(t=>t.type.spec.tableRole==="table",e)}function aht(e,t){for(let r=t.depth;r>=0;r-=1){let n=t.node(r);if(e(n))return{node:n,pos:r===0?0:t.before(r),start:t.start(r),depth:r}}return null}function _x(e,t){let r=Ix(t.$from);if(!r)return;let n=ai.get(r.node);if(!(e<0||e>n.width-1))return n.cellsInRect({left:e,right:e+1,top:0,bottom:n.height}).map(i=>{let a=r.node.nodeAt(i),s=i+r.start;return{pos:s,start:s+1,node:a,depth:r.depth+2}})}function Rx(e,t){let r=Ix(t.$from);if(!r)return;let n=ai.get(r.node);if(!(e<0||e>n.height-1))return n.cellsInRect({left:0,right:n.width,top:e,bottom:e+1}).map(i=>{let a=r.node.nodeAt(i),s=i+r.start;return{pos:s,start:s+1,node:a,depth:r.depth+2}})}function wfe(e,t,r=t){let n=t,i=r;for(let h=t;h>=0;h--){let f=_x(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.colspan+h-1;p>=n&&(n=h),p>i&&(i=p)})}for(let h=t;h<=i;h++){let f=_x(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.colspan+h-1;d.node.attrs.colspan>1&&p>i&&(i=p)})}let a=[];for(let h=n;h<=i;h++){let f=_x(h,e.selection);f&&f.length>0&&a.push(h)}n=a[0],i=a[a.length-1];let s=_x(n,e.selection),o=Rx(0,e.selection);if(!s||!o)return;let l=e.doc.resolve(s[s.length-1].pos),u;for(let h=i;h>=n;h--){let f=_x(h,e.selection);if(f&&f.length>0){for(let d=o.length-1;d>=0;d--)if(o[d].pos===f[0].pos){u=f[0];break}if(u)break}}if(u)return{$anchor:l,$head:e.doc.resolve(u.pos),indexes:a}}function kfe(e,t,r=t){let n=t,i=r;for(let h=t;h>=0;h--){let f=Rx(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.rowspan+h-1;p>=n&&(n=h),p>i&&(i=p)})}for(let h=t;h<=i;h++){let f=Rx(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.rowspan+h-1;d.node.attrs.rowspan>1&&p>i&&(i=p)})}let a=[];for(let h=n;h<=i;h++){let f=Rx(h,e.selection);f&&f.length>0&&a.push(h)}n=a[0],i=a[a.length-1];let s=Rx(n,e.selection),o=_x(0,e.selection);if(!s||!o)return;let l=e.doc.resolve(s[s.length-1].pos),u;for(let h=i;h>=n;h--){let f=Rx(h,e.selection);if(f&&f.length>0){for(let d=o.length-1;d>=0;d--)if(o[d].pos===f[0].pos){u=f[0];break}if(u)break}}if(u)return{$anchor:l,$head:e.doc.resolve(u.pos),indexes:a}}function Tfe(e){return e[0].map((t,r)=>e.map(n=>n[r]))}function sht(e){var t,r;let{tr:n,originIndex:i,targetIndex:a,select:s,pos:o}=e,l=Ix(n.doc.resolve(o));if(!l)return!1;let u=(t=wfe(n,i))===null||t===void 0?void 0:t.indexes,h=(r=wfe(n,a))===null||r===void 0?void 0:r.indexes;if(!u||!h||u.includes(a))return!1;let f=oht(l.node,u,h,0);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,f),!s)return!0;let d=ai.get(f),p=l.start,m=a,g=d.positionAt(d.height-1,m,f),y=n.doc.resolve(p+g),v=d.positionAt(0,m,f),x=n.doc.resolve(p+v);return n.setSelection(Oi.colSelection(y,x)),!0}function oht(e,t,r,n){let i=Tfe(Pfe(e));return i=Ffe(i,t,r,n),i=Tfe(i),Bfe(e,i)}function lht(e){var t,r;let{tr:n,originIndex:i,targetIndex:a,select:s,pos:o}=e,l=Ix(n.doc.resolve(o));if(!l)return!1;let u=(t=kfe(n,i))===null||t===void 0?void 0:t.indexes,h=(r=kfe(n,a))===null||r===void 0?void 0:r.indexes;if(!u||!h||u.includes(a))return!1;let f=cht(l.node,u,h,0);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,f),!s)return!0;let d=ai.get(f),p=l.start,m=a,g=d.positionAt(m,d.width-1,f),y=n.doc.resolve(p+g),v=d.positionAt(m,0,f),x=n.doc.resolve(p+v);return n.setSelection(Oi.rowSelection(y,x)),!0}function cht(e,t,r,n){let i=Pfe(e);return i=Ffe(i,t,r,n),Bfe(e,i)}function Wd(e){let t=e.selection,r=C7(e),n=r.node(-1),i=r.start(-1),a=ai.get(n);return{...t instanceof Oi?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(r.pos-i),tableStart:i,map:a,table:n}}function $fe(e,{map:t,tableStart:r,table:n},i){let a=i>0?-1:0;Kut(t,n,i+a)&&(a=i==0||i==t.width?null:0);for(let s=0;s<t.height;s++){let o=s*t.width+i;if(i>0&&i<t.width&&t.map[o-1]==t.map[o]){let l=t.map[o],u=n.nodeAt(l);e.setNodeMarkup(e.mapping.map(r+l),null,jut(u.attrs,i-t.colCount(l))),s+=u.attrs.rowspan-1}else{let l=a==null?pu(n.type.schema).cell:n.nodeAt(t.map[o+a]).type,u=t.positionAt(s,i,n);e.insert(e.mapping.map(r+u),l.createAndFill())}}return e}function zfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e);t($fe(e.tr,r,r.left))}return!0}function Gfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e);t($fe(e.tr,r,r.right))}return!0}function uht(e,{map:t,table:r,tableStart:n},i){let a=e.mapping.maps.length;for(let s=0;s<t.height;){let o=s*t.width+i,l=t.map[o],u=r.nodeAt(l),h=u.attrs;if(i>0&&t.map[o-1]==l||i<t.width-1&&t.map[o+1]==l)e.setNodeMarkup(e.mapping.slice(a).map(n+l),null,H1(h,i-t.colCount(l)));else{let f=e.mapping.slice(a).map(n+l);e.delete(f,f+u.nodeSize)}s+=h.rowspan}}function qfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e),n=e.tr;if(r.left==0&&r.right==r.map.width)return!1;for(let i=r.right-1;uht(n,r,i),i!=r.left;i--){let a=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");r.table=a,r.map=ai.get(a)}t(n)}return!0}function hht(e,{map:t,table:r,tableStart:n},i){let a=0;for(let u=0;u<i;u++)a+=r.child(u).nodeSize;let s=a+r.child(i).nodeSize,o=e.mapping.maps.length;e.delete(a+n,s+n);let l=new Set;for(let u=0,h=i*t.width;u<t.width;u++,h++){let f=t.map[h];if(!l.has(f)){if(l.add(f),i>0&&f==t.map[h-t.width]){let d=r.nodeAt(f).attrs;e.setNodeMarkup(e.mapping.slice(o).map(f+n),null,{...d,rowspan:d.rowspan-1}),u+=d.colspan-1}else if(i<t.height&&f==t.map[h+t.width]){let d=r.nodeAt(f),p=d.attrs,m=d.type.create({...p,rowspan:d.attrs.rowspan-1},d.content),g=t.positionAt(i+1,u,r);e.insert(e.mapping.slice(o).map(n+g),m),u+=p.colspan-1}}}}function Vfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e),n=e.tr;if(r.top==0&&r.bottom==r.map.height)return!1;for(let i=r.bottom-1;hht(n,r,i),i!=r.top;i--){let a=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");r.table=a,r.map=ai.get(r.table)}t(n)}return!0}function Wfe(e,t){return function(r,n){if(!Sc(r))return!1;let i=C7(r);if(i.nodeAfter.attrs[e]===t)return!1;if(n){let a=r.tr;r.selection instanceof Oi?r.selection.forEachCell((s,o)=>{s.attrs[e]!==t&&a.setNodeMarkup(o,null,{...s.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),n(a)}return!0}}function fht(e){return function(t,r){if(!Sc(t))return!1;if(r){let n=pu(t.schema),i=Wd(t),a=t.tr,s=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),o=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)o[l].type==n.header_cell&&a.setNodeMarkup(i.tableStart+s[l],n.cell,o[l].attrs);if(a.steps.length===0)for(let l=0;l<s.length;l++)a.setNodeMarkup(i.tableStart+s[l],n.header_cell,o[l].attrs);r(a)}return!0}}function Cfe(e,t,r){let n=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<n.length;i++){let a=t.table.nodeAt(n[i]);if(a&&a.type!==r.header_cell)return!1}return!0}function w$(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?fht(e):function(r,n){if(!Sc(r))return!1;if(n){let i=pu(r.schema),a=Wd(r),s=r.tr,o=Cfe("row",a,i),l=Cfe("column",a,i),u=(e==="column"?o:e==="row"&&l)?1:0,h=e=="column"?{left:0,top:u,right:1,bottom:a.map.height}:e=="row"?{left:u,top:0,right:a.map.width,bottom:1}:a,f=e=="column"?l?i.cell:i.header_cell:e=="row"?o?i.cell:i.header_cell:i.cell;a.map.cellsInRect(h).forEach(d=>{let p=d+a.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),n(s)}return!0}}var Fyr=w$("row",{useDeprecatedLogic:!0}),$yr=w$("column",{useDeprecatedLogic:!0}),zyr=w$("cell",{useDeprecatedLogic:!0});function dht(e,t){if(t<0){let r=e.nodeBefore;if(r)return e.pos-r.nodeSize;for(let n=e.index(-1)-1,i=e.before();n>=0;n--){let a=e.node(-1).child(n),s=a.lastChild;if(s)return i-1-s.nodeSize;i-=a.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let r=e.node(-1);for(let n=e.indexAfter(-1),i=e.after();n<r.childCount;n++){let a=r.child(n);if(a.childCount)return i+1;i+=a.nodeSize}}return null}function k$(e){return function(t,r){if(!Sc(t))return!1;let n=dht(C7(t),e);if(n==null)return!1;if(r){let i=t.doc.resolve(n);r(t.tr.setSelection(Pr.between(i,Xut(i))).scrollIntoView())}return!0}}function Hfe(e,t){let r=e.selection.$anchor;for(let n=r.depth;n>0;n--)if(r.node(n).type.spec.tableRole=="table")return t&&t(e.tr.delete(r.before(n),r.after(n)).scrollIntoView()),!0;return!1}function x7(e,t){let r=e.selection;if(!(r instanceof Oi))return!1;if(t){let n=e.tr,i=pu(e.schema).cell.createAndFill().content;r.forEachCell((a,s)=>{a.content.eq(i)||n.replace(n.mapping.map(s+1),n.mapping.map(s+a.nodeSize-1),new Xt(i,0,0))}),n.docChanged&&t(n)}return!0}function Ufe(e){return(t,r)=>{let{from:n,to:i,select:a=!0,pos:s=t.selection.from}=e,o=t.tr;return lht({tr:o,originIndex:n,targetIndex:i,select:a,pos:s})?(r?.(o),!0):!1}}function Yfe(e){return(t,r)=>{let{from:n,to:i,select:a=!0,pos:s=t.selection.from}=e,o=t.tr;return sht({tr:o,originIndex:n,targetIndex:i,select:a,pos:s})?(r?.(o),!0):!1}}function pht(e){if(e.size===0)return null;let{content:t,openStart:r,openEnd:n}=e;for(;t.childCount==1&&(r>0&&n>0||t.child(0).type.spec.tableRole=="table");)r--,n--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,s=i.type.schema,o=[];if(a=="row")for(let l=0;l<t.childCount;l++){let u=t.child(l).content,h=l?0:Math.max(0,r-1),f=l<t.childCount-1?0:Math.max(0,n-1);(h||f)&&(u=v$(pu(s).row,new Xt(u,h,f)).content),o.push(u)}else if(a=="cell"||a=="header_cell")o.push(r||n?v$(pu(s).row,new Xt(t,r,n)).content:t);else return null;return mht(s,o)}function mht(e,t){let r=[];for(let i=0;i<t.length;i++){let a=t[i];for(let s=a.childCount-1;s>=0;s--){let{rowspan:o,colspan:l}=a.child(s).attrs;for(let u=i;u<i+o;u++)r[u]=(r[u]||0)+l}}let n=0;for(let i=0;i<r.length;i++)n=Math.max(n,r[i]);for(let i=0;i<r.length;i++)if(i>=t.length&&t.push(Lt.empty),r[i]<n){let a=pu(e).cell.createAndFill(),s=[];for(let o=r[i];o<n;o++)s.push(a);t[i]=t[i].append(Lt.from(s))}return{height:t.length,width:n,rows:t}}function v$(e,t){let r=e.createAndFill();return new sx(r).replace(0,r.content.size,t).doc}function ght({width:e,height:t,rows:r},n,i){if(e!=n){let a=[],s=[];for(let o=0;o<r.length;o++){let l=r[o],u=[];for(let h=a[o]||0,f=0;h<n;f++){let d=l.child(f%l.childCount);h+d.attrs.colspan>n&&(d=d.type.createChecked(H1(d.attrs,d.attrs.colspan,h+d.attrs.colspan-n),d.content)),u.push(d),h+=d.attrs.colspan;for(let p=1;p<d.attrs.rowspan;p++)a[o+p]=(a[o+p]||0)+d.attrs.colspan}s.push(Lt.from(u))}r=s,e=n}if(t!=i){let a=[];for(let s=0,o=0;s<i;s++,o++){let l=[],u=r[o%t];for(let h=0;h<u.childCount;h++){let f=u.child(h);s+f.attrs.rowspan>i&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,i-f.attrs.rowspan)},f.content)),l.push(f)}a.push(Lt.from(l))}r=a,t=i}return{width:e,height:t,rows:r}}function yht(e,t,r,n,i,a,s){let o=e.doc.type.schema,l=pu(o),u,h;if(i>t.width)for(let f=0,d=0;f<t.height;f++){let p=r.child(f);d+=p.nodeSize;let m=[],g;p.lastChild==null||p.lastChild.type==l.cell?g=u||(u=l.cell.createAndFill()):g=h||(h=l.header_cell.createAndFill());for(let y=t.width;y<i;y++)m.push(g);e.insert(e.mapping.slice(s).map(d-1+n),m)}if(a>t.height){let f=[];for(let m=0,g=(t.height-1)*t.width;m<Math.max(t.width,i);m++){let y=m>=t.width?!1:r.nodeAt(t.map[g+m]).type==l.header_cell;f.push(y?h||(h=l.header_cell.createAndFill()):u||(u=l.cell.createAndFill()))}let d=l.row.create(null,Lt.from(f)),p=[];for(let m=t.height;m<a;m++)p.push(d);e.insert(e.mapping.slice(s).map(n+r.nodeSize-2),p)}return!!(u||h)}function Sfe(e,t,r,n,i,a,s,o){if(s==0||s==t.height)return!1;let l=!1;for(let u=i;u<a;u++){let h=s*t.width+u,f=t.map[h];if(t.map[h-t.width]==f){l=!0;let d=r.nodeAt(f),{top:p,left:m}=t.findCell(f);e.setNodeMarkup(e.mapping.slice(o).map(f+n),null,{...d.attrs,rowspan:s-p}),e.insert(e.mapping.slice(o).map(t.positionAt(s,m,r)),d.type.createAndFill({...d.attrs,rowspan:p+d.attrs.rowspan-s})),u+=d.attrs.colspan-1}}return l}function Efe(e,t,r,n,i,a,s,o){if(s==0||s==t.width)return!1;let l=!1;for(let u=i;u<a;u++){let h=u*t.width+s,f=t.map[h];if(t.map[h-1]==f){l=!0;let d=r.nodeAt(f),p=t.colCount(f),m=e.mapping.slice(o).map(f+n);e.setNodeMarkup(m,null,H1(d.attrs,s-p,d.attrs.colspan-(s-p))),e.insert(m+d.nodeSize,d.type.createAndFill(H1(d.attrs,0,s-p))),u+=d.attrs.rowspan-1}}return l}function Afe(e,t,r,n,i){let a=r?e.doc.nodeAt(r-1):e.doc;if(!a)throw new Error("No table found");let s=ai.get(a),{top:o,left:l}=n,u=l+i.width,h=o+i.height,f=e.tr,d=0;function p(){if(a=r?f.doc.nodeAt(r-1):f.doc,!a)throw new Error("No table found");s=ai.get(a),d=f.mapping.maps.length}yht(f,s,a,r,u,h,d)&&p(),Sfe(f,s,a,r,l,u,o,d)&&p(),Sfe(f,s,a,r,l,u,h,d)&&p(),Efe(f,s,a,r,o,h,l,d)&&p(),Efe(f,s,a,r,o,h,u,d)&&p();for(let m=o;m<h;m++){let g=s.positionAt(m,l,a),y=s.positionAt(m,u,a);f.replace(f.mapping.slice(d).map(g+r),f.mapping.slice(d).map(y+r),new Xt(i.rows[m-o],0,0))}p(),f.setSelection(new Oi(f.doc.resolve(r+s.positionAt(o,l,a)),f.doc.resolve(r+s.positionAt(h-1,u-1,a)))),t(f)}var vht=NB({ArrowLeft:b7("horiz",-1),ArrowRight:b7("horiz",1),ArrowUp:b7("vert",-1),ArrowDown:b7("vert",1),"Shift-ArrowLeft":w7("horiz",-1),"Shift-ArrowRight":w7("horiz",1),"Shift-ArrowUp":w7("vert",-1),"Shift-ArrowDown":w7("vert",1),Backspace:x7,"Mod-Backspace":x7,Delete:x7,"Mod-Delete":x7});function k7(e,t,r){return r.eq(e.selection)?!1:(t&&t(e.tr.setSelection(r).scrollIntoView()),!0)}function b7(e,t){return(r,n,i)=>{if(!i)return!1;let a=r.selection;if(a instanceof Oi)return k7(r,n,Vr.near(a.$headCell,t));if(e!="horiz"&&!a.empty)return!1;let s=Xfe(i,e,t);if(s==null)return!1;if(e=="horiz")return k7(r,n,Vr.near(r.doc.resolve(a.head+t),t));{let o=r.doc.resolve(s),l=Nfe(o,e,t),u;return l?u=Vr.near(l,1):t<0?u=Vr.near(r.doc.resolve(o.before(-1)),-1):u=Vr.near(r.doc.resolve(o.after(-1)),1),k7(r,n,u)}}}function w7(e,t){return(r,n,i)=>{if(!i)return!1;let a=r.selection,s;if(a instanceof Oi)s=a;else{let l=Xfe(i,e,t);if(l==null)return!1;s=new Oi(r.doc.resolve(l))}let o=Nfe(s.$headCell,e,t);return o?k7(r,n,new Oi(s.$anchorCell,o)):!1}}function xht(e,t){let r=e.state.doc,n=Lx(r.resolve(t));return n?(e.dispatch(e.state.tr.setSelection(new Oi(n))),!0):!1}function bht(e,t,r){if(!Sc(e.state))return!1;let n=pht(r),i=e.state.selection;if(i instanceof Oi){n||(n={width:1,height:1,rows:[Lt.from(v$(pu(e.state.schema).cell,r))]});let a=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),o=ai.get(a).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return n=ght(n,o.right-o.left,o.bottom-o.top),Afe(e.state,e.dispatch,s,o,n),!0}else if(n){let a=C7(e.state),s=a.start(-1);return Afe(e.state,e.dispatch,s,ai.get(a.node(-1)).findCell(a.pos-s),n),!0}else return!1}function wht(e,t){var r;if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=_fe(e,t.target),i;if(t.shiftKey&&e.state.selection instanceof Oi)a(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(i=Lx(e.state.selection.$anchor))!=null&&((r=p$(e,t))===null||r===void 0?void 0:r.pos)!=i.pos)a(i,t),t.preventDefault();else if(!n)return;function a(l,u){let h=p$(e,u),f=Hp.getState(e.state)==null;if(!h||!b$(l,h))if(f)h=l;else return;let d=new Oi(l,h);if(f||!e.state.selection.eq(d)){let p=e.state.tr.setSelection(d);f&&p.setMeta(Hp,l.pos),e.dispatch(p)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",o),Hp.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(Hp,-1))}function o(l){let u=l,h=Hp.getState(e.state),f;if(h!=null)f=e.state.doc.resolve(h);else if(_fe(e,u.target)!=n&&(f=p$(e,t),!f))return s();f&&a(f,u)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",o)}function Xfe(e,t,r){if(!(e.state.selection instanceof Pr))return null;let{$head:n}=e.state.selection;for(let i=n.depth-1;i>=0;i--){let a=n.node(i);if((r<0?n.index(i):n.indexAfter(i))!=(r<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){let s=n.before(i),o=t=="vert"?r>0?"down":"up":r>0?"right":"left";return e.endOfTextblock(o)?s:null}}return null}function _fe(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function p$(e,t){let r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return null;let{inside:n,pos:i}=r;return n>=0&&Lx(e.state.doc.resolve(n))||Lx(e.state.doc.resolve(i))}var kht=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),x$(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,x$(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function x$(e,t,r,n,i,a){let s=0,o=!0,l=t.firstChild,u=e.firstChild;if(u){for(let f=0,d=0;f<u.childCount;f++){let{colspan:p,colwidth:m}=u.child(f).attrs;for(let g=0;g<p;g++,d++){let y=i==d?a:m&&m[g],v=y?y+"px":"";if(s+=y||n,y||(o=!1),l)l.style.width!=v&&(l.style.width=v),l=l.nextSibling;else{let x=document.createElement("col");x.style.width=v,t.appendChild(x)}}}for(;l;){var h;let f=l.nextSibling;(h=l.parentNode)===null||h===void 0||h.removeChild(l),l=f}o?(r.style.width=s+"px",r.style.minWidth=""):(r.style.width="",r.style.minWidth=s+"px")}}var Cc=new Hi("tableColumnResizing");function jfe({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:r=100,View:n=kht,lastColumnResizable:i=!0}={}){let a=new Ci({key:Cc,state:{init(s,o){var l;let u=(l=a.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,h=pu(o.schema).table.name;return n&&u&&(u[h]=(f,d)=>new n(f,r,d)),new Tht(-1,!1)},apply(s,o){return o.apply(s)}},props:{attributes:s=>{let o=Cc.getState(s);return o&&o.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,o)=>{Cht(s,o,e,i)},mouseleave:s=>{Sht(s)},mousedown:(s,o)=>{Eht(s,o,t,r)}},decorations:s=>{let o=Cc.getState(s);if(o&&o.activeHandle>-1)return Iht(s,o.activeHandle)},nodeViews:{}}});return a}var Tht=class T7{constructor(t,r){this.activeHandle=t,this.dragging=r}apply(t){let r=this,n=t.getMeta(Cc);if(n&&n.setHandle!=null)return new T7(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new T7(r.activeHandle,n.setDragging);if(r.activeHandle>-1&&t.docChanged){let i=t.mapping.map(r.activeHandle,-1);return y$(t.doc.resolve(i))||(i=-1),new T7(i,r.dragging)}return r}};function Cht(e,t,r,n){if(!e.editable)return;let i=Cc.getState(e.state);if(i&&!i.dragging){let a=_ht(t.target),s=-1;if(a){let{left:o,right:l}=a.getBoundingClientRect();t.clientX-o<=r?s=Rfe(e,t,"left",r):l-t.clientX<=r&&(s=Rfe(e,t,"right",r))}if(s!=i.activeHandle){if(!n&&s!==-1){let o=e.state.doc.resolve(s),l=o.node(-1),u=ai.get(l),h=o.start(-1);if(u.colCount(o.pos-h)+o.nodeAfter.attrs.colspan-1==u.width-1)return}Kfe(e,s)}}}function Sht(e){if(!e.editable)return;let t=Cc.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Kfe(e,-1)}function Eht(e,t,r,n){var i;if(!e.editable)return!1;let a=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=Cc.getState(e.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let o=e.state.doc.nodeAt(s.activeHandle),l=Aht(e,s.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(Cc,{setDragging:{startX:t.clientX,startWidth:l}}));function u(f){a.removeEventListener("mouseup",u),a.removeEventListener("mousemove",h);let d=Cc.getState(e.state);d?.dragging&&(Rht(e,d.activeHandle,Lfe(d.dragging,f,r)),e.dispatch(e.state.tr.setMeta(Cc,{setDragging:null})))}function h(f){if(!f.which)return u(f);let d=Cc.getState(e.state);if(d&&d.dragging){let p=Lfe(d.dragging,f,r);Ife(e,d.activeHandle,p,n)}}return Ife(e,s.activeHandle,l,n),a.addEventListener("mouseup",u),a.addEventListener("mousemove",h),t.preventDefault(),!0}function Aht(e,t,{colspan:r,colwidth:n}){let i=n&&n[n.length-1];if(i)return i;let a=e.domAtPos(t),s=a.node.childNodes[a.offset].offsetWidth,o=r;if(n)for(let l=0;l<r;l++)n[l]&&(s-=n[l],o--);return s/o}function _ht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function Rfe(e,t,r,n){let i=r=="right"?-n:n,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:s}=a,o=Lx(e.state.doc.resolve(s));if(!o)return-1;if(r=="right")return o.pos;let l=ai.get(o.node(-1)),u=o.start(-1),h=l.map.indexOf(o.pos-u);return h%l.width==0?-1:u+l.map[h-1]}function Lfe(e,t,r){let n=t.clientX-e.startX;return Math.max(r,e.startWidth+n)}function Kfe(e,t){e.dispatch(e.state.tr.setMeta(Cc,{setHandle:t}))}function Rht(e,t,r){let n=e.state.doc.resolve(t),i=n.node(-1),a=ai.get(i),s=n.start(-1),o=a.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let u=0;u<a.height;u++){let h=u*a.width+o;if(u&&a.map[h]==a.map[h-a.width])continue;let f=a.map[h],d=i.nodeAt(f).attrs,p=d.colspan==1?0:o-a.colCount(f);if(d.colwidth&&d.colwidth[p]==r)continue;let m=d.colwidth?d.colwidth.slice():Lht(d.colspan);m[p]=r,l.setNodeMarkup(s+f,null,{...d,colwidth:m})}l.docChanged&&e.dispatch(l)}function Ife(e,t,r,n){let i=e.state.doc.resolve(t),a=i.node(-1),s=i.start(-1),o=ai.get(a).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=e.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&x$(a,l.firstChild,l,n,o,r)}function Lht(e){return Array(e).fill(0)}function Iht(e,t){let r=[],n=e.doc.resolve(t),i=n.node(-1);if(!i)return Ui.empty;let a=ai.get(i),s=n.start(-1),o=a.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1;for(let u=0;u<a.height;u++){let h=o+u*a.width;if((o==a.width-1||a.map[h]!=a.map[h+1])&&(u==0||a.map[h]!=a.map[h-a.width])){var l;let f=a.map[h],d=s+f+i.nodeAt(f).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((l=Cc.getState(e))===null||l===void 0)&&l.dragging&&r.push(mi.node(s+f,s+f+i.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),r.push(mi.widget(d,p))}}return Ui.create(e.doc,r)}function Zfe({allowTableNodeSelection:e=!1}={}){return new Ci({key:Hp,state:{init(){return null},apply(t,r){let n=t.getMeta(Hp);if(n!=null)return n==-1?null:n;if(r==null||!t.docChanged)return r;let{deleted:i,pos:a}=t.mapping.mapResult(r);return i?null:a}},props:{decorations:Qut,handleDOMEvents:{mousedown:wht},createSelectionBetween(t){return Hp.getState(t.state)!=null?t.state.selection:null},handleTripleClick:xht,handleKeyDown:vht,handlePaste:bht},appendTransaction(t,r,n){return tht(n,nht(n,r),e)}})}var S7=typeof navigator<"u"?navigator:null,C$=S7&&S7.userAgent||"",Mht=/Edge\/(\d+)/.exec(C$),Nht=/MSIE \d/.exec(C$),Dht=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(C$),Oht=!!(Nht||Dht||Mht),Pht=!Oht&&!!S7&&/Apple Computer/.test(S7.vendor),Qfe=new Hi("safari-ime-span"),T$=!1,Bht={key:Qfe,props:{decorations:Fht,handleDOMEvents:{compositionstart:()=>{T$=!0},compositionend:()=>{T$=!1}}}};function Fht(e){let{$from:t,$to:r,to:n}=e.selection;if(T$&&t.sameParent(r)){let i=mi.widget(n,$ht,{ignoreSelection:!0,key:"safari-ime-span"});return Ui.create(e.doc,[i])}}function $ht(e){let t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var Jfe=new Ci(Pht?Bht:{key:Qfe});function S$(e,t){let r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function E$(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function A$(e,t,r){let i=Ip((r||{}).ignore||[]),a=zht(t),s=-1;for(;++s<a.length;)g1(e,"text",o);function o(u,h){let f=-1,d;for(;++f<h.length;){let p=h[f],m=d?d.children:void 0;if(i(p,m?m.indexOf(p):void 0,d))return;d=p}if(d)return l(u,h)}function l(u,h){let f=h[h.length-1],d=a[s][0],p=a[s][1],m=0,y=f.children.indexOf(u),v=!1,x=[];d.lastIndex=0;let w=d.exec(u.value);for(;w;){let C=w.index,T={index:w.index,input:w.input,stack:[...h,u]},k=p(...w,T);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?d.lastIndex=C+1:(m!==C&&x.push({type:"text",value:u.value.slice(m,C)}),Array.isArray(k)?x.push(...k):k&&x.push(k),m=C+w[0].length,v=!0),!d.global)break;w=d.exec(u.value)}return v?(m<u.value.length&&x.push({type:"text",value:u.value.slice(m)}),f.children.splice(y,1,...x)):x=[u],y+x.length}}function zht(e){let t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){let i=r[n];t.push([Ght(i[0]),qht(i[1])])}return t}function Ght(e){return typeof e=="string"?new RegExp(E$(e),"g"):e}function qht(e){return typeof e=="function"?e:function(){return e}}var _$="phrasing",R$=["autolink","link","image","label"];function I$(){return{transforms:[Xht],enter:{literalAutolink:Vht,literalAutolinkEmail:L$,literalAutolinkHttp:L$,literalAutolinkWww:L$},exit:{literalAutolink:Yht,literalAutolinkEmail:Uht,literalAutolinkHttp:Wht,literalAutolinkWww:Hht}}}function M$(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_$,notInConstruct:R$},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_$,notInConstruct:R$},{character:":",before:"[ps]",after:"\\/",inConstruct:_$,notInConstruct:R$}]}}function Vht(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function L$(e){this.config.enter.autolinkProtocol.call(this,e)}function Wht(e){this.config.exit.autolinkProtocol.call(this,e)}function Hht(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Uht(e){this.config.exit.autolinkEmail.call(this,e)}function Yht(e){this.exit(e)}function Xht(e){A$(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jht],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Kht]],{ignore:["link","linkReference"]})}function jht(e,t,r,n,i){let a="";if(!ede(i)||(/^w/i.test(t)&&(r=t+r,t="",a="http://"),!Zht(r)))return!1;let s=Qht(r+n);if(!s[0])return!1;let o={type:"link",title:null,url:a+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[o,{type:"text",value:s[1]}]:o}function Kht(e,t,r,n){return!ede(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function Zht(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Qht(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),i=S$(e,"("),a=S$(e,")");for(;n!==-1&&i>a;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),a++;return[e,r]}function ede(e,t){let r=e.input.charCodeAt(e.index-1);return(e.index===0||Wh(r)||u1(r))&&(!t||r!==47)}tde.peek=oft;function Jht(){this.buffer()}function eft(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function tft(){this.buffer()}function rft(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function nft(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Lo(this.sliceSerialize(e)).toLowerCase(),r.label=t}function ift(e){this.exit(e)}function aft(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Lo(this.sliceSerialize(e)).toLowerCase(),r.label=t}function sft(e){this.exit(e)}function oft(){return"["}function tde(e,t,r,n){let i=r.createTracker(n),a=i.move("[^"),s=r.enter("footnoteReference"),o=r.enter("reference");return a+=i.move(r.safe(r.associationId(e),{after:"]",before:a})),o(),s(),a+=i.move("]"),a}function N$(){return{enter:{gfmFootnoteCallString:Jht,gfmFootnoteCall:eft,gfmFootnoteDefinitionLabelString:tft,gfmFootnoteDefinition:rft},exit:{gfmFootnoteCallString:nft,gfmFootnoteCall:ift,gfmFootnoteDefinitionLabelString:aft,gfmFootnoteDefinition:sft}}}function D$(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:tde},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,a,s){let o=a.createTracker(s),l=o.move("[^"),u=a.enter("footnoteDefinition"),h=a.enter("label");return l+=o.move(a.safe(a.associationId(n),{before:l,after:"]"})),h(),l+=o.move("]:"),n.children&&n.children.length>0&&(o.shift(4),l+=o.move((t?` -`:" ")+a.indentLines(a.containerFlow(n,o.current()),t?rde:lft))),u(),l}}function lft(e,t,r){return t===0?e:rde(e,t,r)}function rde(e,t,r){return(r?"":" ")+e}var cft=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];nde.peek=fft;function O$(){return{canContainEols:["delete"],enter:{strikethrough:uft},exit:{strikethrough:hft}}}function P$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cft}],handlers:{delete:nde}}}function uft(e){this.enter({type:"delete",children:[]},e)}function hft(e){this.exit(e)}function nde(e,t,r,n){let i=r.createTracker(n),a=r.enter("strikethrough"),s=i.move("~~");return s+=r.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),a(),s}function fft(){return"~"}function dft(e){return e.length}function ade(e,t){let r=t||{},n=(r.align||[]).concat(),i=r.stringLength||dft,a=[],s=[],o=[],l=[],u=0,h=-1;for(;++h<e.length;){let g=[],y=[],v=-1;for(e[h].length>u&&(u=e[h].length);++v<e[h].length;){let x=pft(e[h][v]);if(r.alignDelimiters!==!1){let w=i(x);y[v]=w,(l[v]===void 0||w>l[v])&&(l[v]=w)}g.push(x)}s[h]=g,o[h]=y}let f=-1;if(typeof n=="object"&&"length"in n)for(;++f<u;)a[f]=ide(n[f]);else{let g=ide(n);for(;++f<u;)a[f]=g}f=-1;let d=[],p=[];for(;++f<u;){let g=a[f],y="",v="";g===99?(y=":",v=":"):g===108?y=":":g===114&&(v=":");let x=r.alignDelimiters===!1?1:Math.max(1,l[f]-y.length-v.length),w=y+"-".repeat(x)+v;r.alignDelimiters!==!1&&(x=y.length+x+v.length,x>l[f]&&(l[f]=x),p[f]=x),d[f]=w}s.splice(1,0,d),o.splice(1,0,p),h=-1;let m=[];for(;++h<s.length;){let g=s[h],y=o[h];f=-1;let v=[];for(;++f<u;){let x=g[f]||"",w="",C="";if(r.alignDelimiters!==!1){let T=l[f]-(y[f]||0),k=a[f];k===114?w=" ".repeat(T):k===99?T%2?(w=" ".repeat(T/2+.5),C=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),C=w):C=" ".repeat(T)}r.delimiterStart!==!1&&!f&&v.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&x==="")&&(r.delimiterStart!==!1||f)&&v.push(" "),r.alignDelimiters!==!1&&v.push(w),v.push(x),r.alignDelimiters!==!1&&v.push(C),r.padding!==!1&&v.push(" "),(r.delimiterEnd!==!1||f!==u-1)&&v.push("|")}m.push(r.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return m.join(` -`)}function pft(e){return e==null?"":String(e)}function ide(e){let t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function F$(){return{enter:{table:mft,tableData:sde,tableHeader:sde,tableRow:yft},exit:{codeText:vft,table:gft,tableData:B$,tableHeader:B$,tableRow:B$}}}function mft(e){let t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function gft(e){this.exit(e),this.data.inTable=void 0}function yft(e){this.enter({type:"tableRow",children:[]},e)}function B$(e){this.exit(e)}function sde(e){this.enter({type:"tableCell",children:[]},e)}function vft(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,xft));let r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function xft(e,t){return t==="|"?t:e}function $$(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,a=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`):t.addNode("break")}}}));vt(V1.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});vt(V1.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var YF=hn("InsertHardbreak",e=>()=>(t,r)=>{let{selection:n,tr:i}=t;if(!(n instanceof Pr))return!1;if(n.empty){let a=n.$from.node();if(a.childCount>0&&a.lastChild?.type.name==="hardbreak")return r?.(i.replaceRangeWith(n.to-1,n.to,t.schema.node("paragraph")).setSelection(Vr.near(i.doc.resolve(n.to))).scrollIntoView()),!0}return r?.(i.setMeta("hardbreak",!0).replaceSelectionWith(V1.type(e).create()).scrollIntoView()),!0});vt(YF,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var XF=il("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{let t=e.get(Gn);return()=>t.call(YF.key)}}});vt(XF.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});vt(XF.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var jF=du("hr");vt(jF,{displayName:"Attr<hr>",group:"Hr"});var ST=Ba("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(jF.key)(t)],parseMarkdown:{match:({type:t})=>t==="thematicBreak",runner:(t,r,n)=>{t.addNode(n)}},toMarkdown:{match:t=>t.type.name==="hr",runner:t=>{t.addNode("thematicBreak")}}}));vt(ST.node,{displayName:"NodeSchema<hr>",group:"Hr"});vt(ST.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var ufe=Oo(e=>new Pa(/^(?:---|___\s|\*\*\*\s)$/,(t,r,n,i)=>{let{tr:a}=t;return r[0]&&a.replaceWith(n-1,i,ST.type(e).create()),a}));vt(ufe,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var hfe=hn("InsertHr",e=>()=>(t,r)=>{if(!r)return!0;let n=rh.node.type(e).create(),{tr:i,selection:a}=t,{from:s}=a,o=ST.type(e).create();if(!o)return!0;let l=i.replaceSelectionWith(o).insert(s,n),u=Vr.findFrom(l.doc.resolve(s),1,!0);return u&&r(l.setSelection(u).scrollIntoView()),!0});vt(hfe,{displayName:"Command<insertHrCommand>",group:"Hr"});var KF=du("bulletList");vt(KF,{displayName:"Attr<bulletList>",group:"BulletList"});var Ex=Ba("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{spread:t.dataset.spread==="true"}}}],toDOM:t=>["ul",{...e.get(KF.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:r})=>t==="list"&&!r,runner:(t,r,n)=>{let i=r.spread!=null?`${r.spread}`:"false";t.openNode(n,{spread:i}).next(r.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="bullet_list",runner:(t,r)=>{t.openNode("list",void 0,{ordered:!1,spread:r.attrs.spread}).next(r.content).closeNode()}}}));vt(Ex.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});vt(Ex.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var ffe=Oo(e=>UE(/^\s*([-+*])\s$/,Ex.type(e)));vt(ffe,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var ZF=hn("WrapInBulletList",e=>()=>HE(Ex.type(e)));vt(ZF,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var QF=il("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{let t=e.get(Gn);return()=>t.call(ZF.key)}}});vt(QF.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});vt(QF.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var JF=du("orderedList");vt(JF,{displayName:"Attr<orderedList>",group:"OrderedList"});var Ax=Ba("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{spread:t.dataset.spread,order:t.hasAttribute("start")?Number(t.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(JF.key)(t),...t.attrs.order===1?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t,ordered:r})=>t==="list"&&!!r,runner:(t,r,n)=>{let i=r.spread!=null?`${r.spread}`:"true";t.openNode(n,{spread:i,order:r.start??1}).next(r.children).closeNode()}},toMarkdown:{match:t=>t.type.name==="ordered_list",runner:(t,r)=>{t.openNode("list",void 0,{ordered:!0,start:r.attrs.order??1,spread:r.attrs.spread==="true"}),t.next(r.content),t.closeNode()}}}));vt(Ax.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});vt(Ax.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var dfe=Oo(e=>UE(/^\s*(\d+)\.\s$/,Ax.type(e),t=>({order:Number(t[1])}),(t,r)=>r.childCount+r.attrs.order===Number(t[1])));vt(dfe,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var e$=hn("WrapInOrderedList",e=>()=>HE(Ax.type(e)));vt(e$,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var t$=il("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{let t=e.get(Gn);return()=>t.call(e$.key)}}});vt(t$.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});vt(t$.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var r$=du("listItem");vt(r$,{displayName:"Attr<listItem>",group:"ListItem"});var Kh=Ba("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"\u2022",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{label:t.dataset.label,listType:t.dataset.listType,spread:t.dataset.spread==="true"}}}],toDOM:t=>["li",{...e.get(r$.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:t})=>t==="listItem",runner:(t,r,n)=>{let i=r.label!=null?`${r.label}.`:"\u2022",a=r.label!=null?"ordered":"bullet",s=r.spread!=null?`${r.spread}`:"true";t.openNode(n,{label:i,listType:a,spread:s}),t.next(r.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="list_item",runner:(t,r)=>{t.openNode("listItem",void 0,{spread:r.attrs.spread}),t.next(r.content),t.closeNode()}}}));vt(Kh.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});vt(Kh.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var n$=hn("SinkListItem",e=>()=>jhe(Kh.type(e)));vt(n$,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var i$=hn("LiftListItem",e=>()=>p7(Kh.type(e)));vt(i$,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var a$=hn("SplitListItem",e=>()=>Xhe(Kh.type(e)));vt(a$,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function _ut(e){return(t,r,n)=>{let{selection:i}=t;if(!(i instanceof Pr))return!1;let{empty:a,$from:s}=i;return!a||s.parentOffset!==0||s.node(-1).type!==Kh.type(e)?!1:TB(t,r,n)}}var s$=hn("LiftFirstListItem",e=>()=>_ut(e));vt(s$,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var o$=il("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{let t=e.get(Gn);return()=>t.call(a$.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{let t=e.get(Gn);return()=>t.call(n$.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{let t=e.get(Gn);return()=>t.call(i$.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{let t=e.get(Gn);return()=>t.call(s$.key)}}});vt(o$.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});vt(o$.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var pfe=d7("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>e==="text",runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>e.type.name==="text",runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));vt(pfe,{displayName:"NodeSchema<text>",group:"Text"});var l$=du("html");vt(l$,{displayName:"Attr<html>",group:"Html"});var c$=Ba("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{let r=document.createElement("span"),n={...e.get(l$.key)(t),"data-value":t.attrs.value,"data-type":"html"};return r.textContent=t.attrs.value,["span",n,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:t=>({value:t.dataset.value??""})}],parseMarkdown:{match:({type:t})=>t==="html",runner:(t,r,n)=>{t.addNode(n,{value:r.value})}},toMarkdown:{match:t=>t.type.name==="html",runner:(t,r)=>{t.addNode("html",void 0,r.attrs.value)}}}));vt(c$.node,{displayName:"NodeSchema<html>",group:"Html"});vt(c$.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var Rut=[ife,DF,rh,v7,BF,W1,g7,V1,zF,TT,VF,CT,jF,ST,UF,Sx,KF,Ex,JF,Ax,r$,Kh,CF,Cx,AF,kT,LF,Wp,NF,Tx,l$,c$,pfe].flat(),Lut=[sfe,ffe,dfe,ofe,ufe,afe].flat(),Iut=[Qhe,Jhe,tfe,efe],Mut=hn("IsMarkSelected",()=>e=>t=>{if(!e)return!1;let{doc:r,selection:n}=t;return r.rangeHasMark(n.from,n.to,e)}),Nut=hn("IsNoteSelected",()=>e=>t=>e?uue(t,e).hasNode:!1),Dut=hn("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let r=e.tr,{$from:n,$to:i}=r.selection,{pos:a}=n,{pos:s}=i,o=a-n.node().content.size;return o<0?!1:(r=r.deleteRange(o,s),t?.(r),!0)}),Out=hn("SetBlockType",()=>e=>(t,r)=>{let{nodeType:n,attrs:i=null}=e??{};if(!n)return!1;let a=t.tr,{from:s,to:o}=a.selection;try{a.setBlockType(s,o,n,i)}catch{return!1}return r?.(a),!0}),Put=hn("WrapInBlockType",()=>e=>(t,r)=>{let{nodeType:n,attrs:i=null}=e??{};if(!n)return!1;let a=t.tr;try{let{$from:s,$to:o}=a.selection,l=s.blockRange(o),u=l&&C1(l,n,i);if(!u)return!1;a=a.wrap(l,u)}catch{return!1}return r?.(a),!0}),But=hn("AddBlockType",()=>e=>(t,r)=>{let{nodeType:n,attrs:i=null}=e??{};if(!n)return!1;let a=t.tr;try{let s=n instanceof $l?n:n.createAndFill(i);if(!s)return!1;a.replaceSelectionWith(s)}catch{return!1}return r?.(a),!0}),Fut=hn("SelectTextNearPos",()=>e=>(t,r)=>{let{pos:n}=e??{};if(n==null)return!1;let i=(s,o,l)=>Math.min(Math.max(s,o),l),a=t.tr;try{let s=t.doc.resolve(i(n,0,t.doc.content.size));a.setSelection(Pr.near(s))}catch{return!1}return r?.(a.scrollIntoView()),!0}),$ut=[OF,GF,Vp,FF,WF,YF,hfe,lfe,cfe,e$,ZF,n$,a$,i$,s$,SF,IF,_F,rfe,nfe,Mut,Nut,Dut,Out,Put,But,Fut],zut=[qF,HF,XF,$F,o$,t$,QF,PF,EF,MF,RF].flat(),u$=qd("remarkAddOrderInList",()=>()=>e=>{Zu(e,"list",t=>{if(t.ordered){let r=t.start??1;t.children.forEach((n,i)=>{n.label=i+r})}})});vt(u$.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});vt(u$.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var h$=qd("remarkLineBreak",()=>()=>e=>{let t=/[\t ]*(?:\r?\n|\r)/g;Zu(e,"text",(r,n,i)=>{if(!r.value||typeof r.value!="string")return;let a=[],s=0;t.lastIndex=0;let o=t.exec(r.value);for(;o;){let l=o.index;s!==l&&a.push({type:"text",value:r.value.slice(s,l)}),a.push({type:"break",data:{isInline:!0}}),s=l+o[0].length,o=t.exec(r.value)}if(a.length>0&&i&&typeof n=="number")return s<r.value.length&&a.push({type:"text",value:r.value.slice(s)}),i.children.splice(n,1,...a),n+a.length})});vt(h$.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});vt(h$.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var f$=qd("remarkInlineLink",()=>m7);vt(f$.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});vt(f$.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var Gut=e=>!!e.children,qut=e=>e.type==="html";function Vut(e,t){return r(e,0,null)[0];function r(n,i,a){if(Gut(n)){let s=[];for(let o=0,l=n.children.length;o<l;o++){let u=n.children[o];if(u){let h=r(u,o,n);if(h)for(let f=0,d=h.length;f<d;f++){let p=h[f];p&&s.push(p)}}}n.children=s}return t(n,i,a)}}var Wut=["root","blockquote","listItem"],d$=qd("remarkHTMLTransformer",()=>()=>e=>{Vut(e,(t,r,n)=>qut(t)?(n&&Wut.includes(n.type)&&(t.children=[{...t}],delete t.value,t.type="paragraph"),[t]):[t])});vt(d$.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});vt(d$.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var p$=qd("remarkMarker",()=>()=>(e,t)=>{let r=n=>t.value.charAt(n.position.start.offset);Zu(e,n=>["strong","emphasis"].includes(n.type),n=>{n.marker=r(n)})});vt(p$.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});vt(p$.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var mfe=nl(()=>{let e=!1,t=new Ci({key:new Hi("MILKDOWN_INLINE_NODES_CURSOR"),state:{init(){return!1},apply(r){if(!r.selection.empty)return!1;let n=r.selection.$from,i=n.nodeBefore,a=n.nodeAfter;return!!(i&&a&&i.isInline&&!i.isText&&a.isInline&&!a.isText)}},props:{handleDOMEvents:{compositionend:(r,n)=>e?(e=!1,requestAnimationFrame(()=>{if(t.getState(r.state)){let i=r.state.selection.from;n.preventDefault(),r.dispatch(r.state.tr.insertText(n.data||"",i))}}),!0):!1,compositionstart:r=>(t.getState(r.state)&&(e=!0),!1),beforeinput:(r,n)=>{if(t.getState(r.state)&&n instanceof InputEvent&&n.data&&!e){let i=r.state.selection.from;return n.preventDefault(),r.dispatch(r.state.tr.insertText(n.data||"",i)),!0}return!1}},decorations(r){if(t.getState(r)){let n=r.selection.$from.pos,i=document.createElement("span"),a=mi.widget(n,i,{side:-1}),s=document.createElement("span"),o=mi.widget(n,s);return setTimeout(()=>{i.contentEditable="true",s.contentEditable="true"}),Ui.create(r.doc,[a,o])}return Ui.empty}}});return t});vt(mfe,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var gfe=nl(e=>new Ci({key:new Hi("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,r,n)=>{if(!t.length)return;let[i]=t;if(!i)return;let[a]=i.steps;if(i.getMeta("hardbreak")){if(!(a instanceof Ks))return;let{from:s}=a;return n.tr.setNodeMarkup(s,V1.type(e),void 0,[])}if(a instanceof k1){let s=n.tr,{from:o,to:l}=a;return n.doc.nodesBetween(o,l,(u,h)=>{u.type===V1.type(e)&&(s=s.setNodeMarkup(h,V1.type(e),void 0,[]))}),s}}}));vt(gfe,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var m$=th(["table","code_block"],"hardbreakFilterNodes");vt(m$,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var yfe=nl(e=>{let t=e.get(m$.key);return new Ci({key:new Hi("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(r,n)=>{let i=r.getMeta("hardbreak"),[a]=r.steps;if(i&&a){let{from:s}=a,o=n.doc.resolve(s),l=o.depth,u=!0;for(;l>0;)t.includes(o.node(l).type.name)&&(u=!1),l--;return u}return!0}})});vt(yfe,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var vfe=nl(e=>{let t=new Hi("MILKDOWN_HEADING_ID"),r=n=>{if(n.composing)return;let i=e.get(v7.key),a=n.state.tr.setMeta("addToHistory",!1),s=!1,o={};n.state.doc.descendants((l,u)=>{if(l.type===W1.type(e)){if(l.textContent.trim().length===0)return;let h=l.attrs,f=i(l);o[f]?(o[f]+=1,f+=`-#${o[f]}`):o[f]=1,h.id!==f&&(s=!0,a.setMeta(t,!0).setNodeMarkup(u,void 0,{...h,id:f}))}}),s&&n.dispatch(a)};return new Ci({key:t,view:n=>(r(n),{update:(i,a)=>{i.state.doc.eq(a.doc)||r(i)}})})});vt(vfe,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var xfe=nl(e=>{let t=(r,n,i)=>{if(!i.selection||r.some(f=>f.getMeta("addToHistory")===!1||!f.isGeneric))return null;let a=Ax.type(e),s=Ex.type(e),o=Kh.type(e),l=(f,d,p=1)=>{let m=!1,g=`${d+p}.`;return f.label!==g&&(f.label=g,m=!0),m},u=i.tr,h=!1;return i.doc.descendants((f,d,p,m)=>{if(f.type===s){let g=f.maybeChild(0);g?.type===o&&g.attrs.listType==="ordered"&&(h=!0,u.setNodeMarkup(d,a,{spread:"true"}),f.descendants((y,v,x,w)=>{if(y.type===o){let C={...y.attrs};l(C,w)&&(u=u.setNodeMarkup(v,void 0,C))}return!1}))}else if(f.type===o&&p?.type===a){let g={...f.attrs},y=!1;g.listType!=="ordered"&&(g.listType="ordered",y=!0),p?.maybeChild(0)&&(y=l(g,m,p?.attrs.order??1)),y&&(u=u.setNodeMarkup(d,void 0,g),h=!0)}}),h?u.setMeta("addToHistory",!1):null};return new Ci({key:new Hi("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:t})});vt(xfe,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var Hut=[gfe,m$,yfe,mfe,u$,f$,h$,d$,p$,y7,vfe,xfe].flat(),bfe=[Rut,Lut,Iut,$ut,zut,Hut].flat();var y$,v$;if(typeof WeakMap<"u"){let e=new WeakMap;y$=t=>e.get(t),v$=(t,r)=>(e.set(t,r),r)}else{let e=[],r=0;y$=n=>{for(let i=0;i<e.length;i+=2)if(e[i]==n)return e[i+1]},v$=(n,i)=>(r==10&&(r=0),e[r++]=n,e[r++]=i)}var ai=class{constructor(e,t,r,n){this.width=e,this.height=t,this.map=r,this.problems=n}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let n=t%this.width,i=t/this.width|0,a=n+1,s=i+1;for(let o=1;a<this.width&&this.map[t+o]==r;o++)a++;for(let o=1;s<this.height&&this.map[t+this.width*o]==r;o++)s++;return{left:n,top:i,right:a,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,r){let{left:n,right:i,top:a,bottom:s}=this.findCell(e);return t=="horiz"?(r<0?n==0:i==this.width)?null:this.map[a*this.width+(r<0?n-1:i)]:(r<0?a==0:s==this.height)?null:this.map[n+this.width*(r<0?a-1:s)]}rectBetween(e,t){let{left:r,right:n,top:i,bottom:a}=this.findCell(e),{left:s,right:o,top:l,bottom:u}=this.findCell(t);return{left:Math.min(r,s),top:Math.min(i,l),right:Math.max(n,o),bottom:Math.max(a,u)}}cellsInRect(e){let t=[],r={};for(let n=e.top;n<e.bottom;n++)for(let i=e.left;i<e.right;i++){let a=n*this.width+i,s=this.map[a];r[s]||(r[s]=!0,!(i==e.left&&i&&this.map[a-1]==s||n==e.top&&n&&this.map[a-this.width]==s)&&t.push(s))}return t}positionAt(e,t,r){for(let n=0,i=0;;n++){let a=i+r.child(n).nodeSize;if(n==e){let s=t+e*this.width,o=(e+1)*this.width;for(;s<o&&this.map[s]<i;)s++;return s==o?a-1:this.map[s]}i=a}}static get(e){return y$(e)||v$(e,Uut(e))}};function Uut(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);let t=Yut(e),r=e.childCount,n=[],i=0,a=null,s=[];for(let u=0,h=t*r;u<h;u++)n[u]=0;for(let u=0,h=0;u<r;u++){let f=e.child(u);h++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==f.childCount)break;let g=f.child(m),{colspan:y,rowspan:v,colwidth:x}=g.attrs;for(let w=0;w<v;w++){if(w+u>=r){(a||(a=[])).push({type:"overlong_rowspan",pos:h,n:v-w});break}let C=i+w*t;for(let T=0;T<y;T++){n[C+T]==0?n[C+T]=h:(a||(a=[])).push({type:"collision",row:u,pos:h,n:y-T});let k=x&&x[T];if(k){let S=(C+T)%t*2,E=s[S];E==null||E!=k&&s[S+1]==1?(s[S]=k,s[S+1]=1):E==k&&s[S+1]++}}}i+=y,h+=g.nodeSize}let d=(u+1)*t,p=0;for(;i<d;)n[i++]==0&&p++;p&&(a||(a=[])).push({type:"missing",row:u,n:p}),h++}(t===0||r===0)&&(a||(a=[])).push({type:"zero_sized"});let o=new ai(t,r,n,a),l=!1;for(let u=0;!l&&u<s.length;u+=2)s[u]!=null&&s[u+1]<r&&(l=!0);return l&&Xut(o,s,e),o}function Yut(e){let t=-1,r=!1;for(let n=0;n<e.childCount;n++){let i=e.child(n),a=0;if(r)for(let s=0;s<n;s++){let o=e.child(s);for(let l=0;l<o.childCount;l++){let u=o.child(l);s+u.attrs.rowspan>n&&(a+=u.attrs.colspan)}}for(let s=0;s<i.childCount;s++){let o=i.child(s);a+=o.attrs.colspan,o.attrs.rowspan>1&&(r=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Xut(e,t,r){e.problems||(e.problems=[]);let n={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(n[a])continue;n[a]=!0;let s=r.nodeAt(a);if(!s)throw new RangeError(`No cell with offset ${a} found`);let o=null,l=s.attrs;for(let u=0;u<l.colspan;u++){let h=t[(i+u)%e.width*2];h!=null&&(!l.colwidth||l.colwidth[u]!=h)&&((o||(o=jut(l)))[u]=h)}o&&e.problems.unshift({type:"colwidth mismatch",pos:a,colwidth:o})}}function jut(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let r=0;r<e.colspan;r++)t.push(0);return t}function wfe(e,t){if(typeof e=="string")return{};let r=e.getAttribute("data-colwidth"),n=r&&/^\d+(,\d+)*$/.test(r)?r.split(",").map(s=>Number(s)):null,i=Number(e.getAttribute("colspan")||1),a={colspan:i,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:n&&n.length==i?n:null};for(let s in t){let o=t[s].getFromDOM,l=o&&o(e);l!=null&&(a[s]=l)}return a}function kfe(e,t){let r={};e.attrs.colspan!=1&&(r.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(r.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(r["data-colwidth"]=e.attrs.colwidth.join(","));for(let n in t){let i=t[n].setDOMAttr;i&&i(e.attrs[n],r)}return r}function Kut(e){if(e!==null){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(let t of e)if(typeof t!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function Dfe(e){let t=e.cellAttributes||{},r={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:Kut}};for(let n in t)r[n]={default:t[n].default,validate:t[n].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:r,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:n=>wfe(n,t)}],toDOM(n){return["td",kfe(n,t),0]}},table_header:{content:e.cellContent,attrs:r,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:n=>wfe(n,t)}],toDOM(n){return["th",kfe(n,t),0]}}}}function pu(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let r in e.nodes){let n=e.nodes[r],i=n.spec.tableRole;i&&(t[i]=n)}}return t}var Hp=new Hi("selectingCells");function Lx(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function Sc(e){let t=e.selection.$head;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="row")return!0;return!1}function C7(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;let r=Lx(t.$head)||Zut(t.$head);if(r)return r;throw new RangeError(`No cell found around position ${t.head}`)}function Zut(e){for(let t=e.nodeAfter,r=e.pos;t;t=t.firstChild,r++){let n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(r)}for(let t=e.nodeBefore,r=e.pos;t;t=t.lastChild,r--){let n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(r-t.nodeSize)}}function x$(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function Qut(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function k$(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Ofe(e,t,r){let n=e.node(-1),i=ai.get(n),a=e.start(-1),s=i.nextCell(e.pos-a,t,r);return s==null?null:e.node(0).resolve(a+s)}function H1(e,t,r=1){let n={...e,colspan:e.colspan-r};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(t,r),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}function Jut(e,t,r=1){let n={...e,colspan:e.colspan+r};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let i=0;i<r;i++)n.colwidth.splice(t,0,0)}return n}function eht(e,t,r){let n=pu(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[r+i*e.width]).type!=n)return!1;return!0}var Oi=class Vd extends Vr{constructor(t,r=t){let n=t.node(-1),i=ai.get(n),a=t.start(-1),s=i.rectBetween(t.pos-a,r.pos-a),o=t.node(0),l=i.cellsInRect(s).filter(h=>h!=r.pos-a);l.unshift(r.pos-a);let u=l.map(h=>{let f=n.nodeAt(h);if(!f)throw new RangeError(`No cell with offset ${h} found`);let d=a+h+1;return new Np(o.resolve(d),o.resolve(d+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=r}map(t,r){let n=t.resolve(r.map(this.$anchorCell.pos)),i=t.resolve(r.map(this.$headCell.pos));if(x$(n)&&x$(i)&&k$(n,i)){let a=this.$anchorCell.node(-1)!=n.node(-1);return a&&this.isRowSelection()?Vd.rowSelection(n,i):a&&this.isColSelection()?Vd.colSelection(n,i):new Vd(n,i)}return Pr.between(n,i)}content(){let t=this.$anchorCell.node(-1),r=ai.get(t),n=this.$anchorCell.start(-1),i=r.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),a={},s=[];for(let l=i.top;l<i.bottom;l++){let u=[];for(let h=l*r.width+i.left,f=i.left;f<i.right;f++,h++){let d=r.map[h];if(a[d])continue;a[d]=!0;let p=r.findCell(d),m=t.nodeAt(d);if(!m)throw new RangeError(`No cell with offset ${d} found`);let g=i.left-p.left,y=p.right-i.right;if(g>0||y>0){let v=m.attrs;if(g>0&&(v=H1(v,0,g)),y>0&&(v=H1(v,v.colspan-y,y)),p.left<i.left){if(m=m.type.createAndFill(v),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(v)}`)}else m=m.type.create(v,m.content)}if(p.top<i.top||p.bottom>i.bottom){let v={...m.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?m=m.type.createAndFill(v):m=m.type.create(v,m.content)}u.push(m)}s.push(t.child(l).copy(Lt.from(u)))}let o=this.isColSelection()&&this.isRowSelection()?t:s;return new Xt(Lt.from(o),1,1)}replace(t,r=Xt.empty){let n=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],u=t.mapping.slice(n);t.replace(u.map(o.pos),u.map(l.pos),s?Xt.empty:r)}let a=Vr.findFrom(t.doc.resolve(t.mapping.slice(n).map(this.to)),-1);a&&t.setSelection(a)}replaceWith(t,r){this.replace(t,new Xt(Lt.from(r),0,0))}forEachCell(t){let r=this.$anchorCell.node(-1),n=ai.get(r),i=this.$anchorCell.start(-1),a=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<a.length;s++)t(r.nodeAt(a[s]),i+a[s])}isColSelection(){let t=this.$anchorCell.index(-1),r=this.$headCell.index(-1);if(Math.min(t,r)>0)return!1;let n=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=r+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(t,r=t){let n=t.node(-1),i=ai.get(n),a=t.start(-1),s=i.findCell(t.pos-a),o=i.findCell(r.pos-a),l=t.node(0);return s.top<=o.top?(s.top>0&&(t=l.resolve(a+i.map[s.left])),o.bottom<i.height&&(r=l.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))):(o.top>0&&(r=l.resolve(a+i.map[o.left])),s.bottom<i.height&&(t=l.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))),new Vd(t,r)}isRowSelection(){let t=this.$anchorCell.node(-1),r=ai.get(t),n=this.$anchorCell.start(-1),i=r.colCount(this.$anchorCell.pos-n),a=r.colCount(this.$headCell.pos-n);if(Math.min(i,a)>0)return!1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,o=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,o)==r.width}eq(t){return t instanceof Vd&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,r=t){let n=t.node(-1),i=ai.get(n),a=t.start(-1),s=i.findCell(t.pos-a),o=i.findCell(r.pos-a),l=t.node(0);return s.left<=o.left?(s.left>0&&(t=l.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(r=l.resolve(a+i.map[i.width*(o.top+1)-1]))):(o.left>0&&(r=l.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(t=l.resolve(a+i.map[i.width*(s.top+1)-1]))),new Vd(t,r)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,r){return new Vd(t.resolve(r.anchor),t.resolve(r.head))}static create(t,r,n=r){return new Vd(t.resolve(r),t.resolve(n))}getBookmark(){return new tht(this.$anchorCell.pos,this.$headCell.pos)}};Oi.prototype.visible=!1;Vr.jsonID("cell",Oi);var tht=class Pfe{constructor(t,r){this.anchor=t,this.head=r}map(t){return new Pfe(t.map(this.anchor),t.map(this.head))}resolve(t){let r=t.resolve(this.anchor),n=t.resolve(this.head);return r.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&r.index()<r.parent.childCount&&n.index()<n.parent.childCount&&k$(r,n)?new Oi(r,n):Vr.near(n,1)}};function rht(e){if(!(e.selection instanceof Oi))return null;let t=[];return e.selection.forEachCell((r,n)=>{t.push(mi.node(n,n+r.nodeSize,{class:"selectedCell"}))}),Ui.create(e.doc,t)}function nht({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let r=e.pos,n=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,r++);for(let a=t.depth;a>=0&&!(t.before(a+1)>t.start(a));a--,n--);return r==n&&/row|table/.test(e.node(i).type.spec.tableRole)}function iht({$from:e,$to:t}){let r,n;for(let i=e.depth;i>0;i--){let a=e.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}for(let i=t.depth;i>0;i--){let a=t.node(i);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}return r!==n&&t.parentOffset===0}function aht(e,t,r){let n=(t||e).selection,i=(t||e).doc,a,s;if(n instanceof cn&&(s=n.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")a=Oi.create(i,n.from);else if(s=="row"){let o=i.resolve(n.from+1);a=Oi.rowSelection(o,o)}else if(!r){let o=ai.get(n.node),l=n.from+1,u=l+o.map[o.width*o.height-1];a=Oi.create(i,l+1,u)}}else n instanceof Pr&&nht(n)?a=Pr.create(i,n.from):n instanceof Pr&&iht(n)&&(a=Pr.create(i,n.$from.start(),n.$from.end()));return a&&(t||(t=e.tr)).setSelection(a),t}var sht=new Hi("fix-tables");function Bfe(e,t,r,n){let i=e.childCount,a=t.childCount;e:for(let s=0,o=0;s<a;s++){let l=t.child(s);for(let u=o,h=Math.min(i,s+3);u<h;u++)if(e.child(u)==l){o=u+1,r+=l.nodeSize;continue e}n(l,r),o<i&&e.child(o).sameMarkup(l)?Bfe(e.child(o),l,r+1,n):l.nodesBetween(0,l.content.size,n,r+1),r+=l.nodeSize}}function oht(e,t){let r,n=(i,a)=>{i.type.spec.tableRole=="table"&&(r=lht(e,i,a,r))};return t?t.doc!=e.doc&&Bfe(t.doc,e.doc,0,n):e.doc.descendants(n),r}function lht(e,t,r,n){let i=ai.get(t);if(!i.problems)return n;n||(n=e.tr);let a=[];for(let l=0;l<i.height;l++)a.push(0);for(let l=0;l<i.problems.length;l++){let u=i.problems[l];if(u.type=="collision"){let h=t.nodeAt(u.pos);if(!h)continue;let f=h.attrs;for(let d=0;d<f.rowspan;d++)a[u.row+d]+=u.n;n.setNodeMarkup(n.mapping.map(r+1+u.pos),null,H1(f,f.colspan-u.n,u.n))}else if(u.type=="missing")a[u.row]+=u.n;else if(u.type=="overlong_rowspan"){let h=t.nodeAt(u.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(r+1+u.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){let h=t.nodeAt(u.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(r+1+u.pos),null,{...h.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){let h=n.mapping.map(r);n.delete(h,h+t.nodeSize)}}let s,o;for(let l=0;l<a.length;l++)a[l]&&(s==null&&(s=l),o=l);for(let l=0,u=r+1;l<i.height;l++){let h=t.child(l),f=u+h.nodeSize,d=a[l];if(d>0){let p="cell";h.firstChild&&(p=h.firstChild.type.spec.tableRole);let m=[];for(let y=0;y<d;y++){let v=pu(e.schema)[p].createAndFill();v&&m.push(v)}let g=(l==0||s==l-1)&&o==l?u+1:f-1;n.insert(n.mapping.map(g),m)}u=f}return n.setMeta(sht,{fixTables:!0})}function Ffe(e){let t=ai.get(e),r=[],n=t.height,i=t.width;for(let a=0;a<n;a++){let s=[];for(let o=0;o<i;o++){let l=a*i+o,u=t.map[l];if(a>0){let h=l-i;if(u===t.map[h]){s.push(null);continue}}if(o>0){let h=l-1;if(u===t.map[h]){s.push(null);continue}}s.push(e.nodeAt(u))}r.push(s)}return r}function $fe(e,t){let r=[],n=ai.get(e),i=n.height,a=n.width;for(let s=0;s<i;s++){let o=e.child(s),l=[];for(let h=0;h<a;h++){let f=t[s][h];if(!f)continue;let d=n.map[s*n.width+h],p=e.nodeAt(d);if(!p)continue;let m=p.type.createChecked(f.attrs,f.content,f.marks);l.push(m)}let u=o.type.createChecked(o.attrs,l,o.marks);r.push(u)}return e.type.createChecked(e.attrs,r,e.marks)}function zfe(e,t,r,n){let i=t[0]>r[0]?-1:1,a=e.splice(t[0],t.length),s=a.length%2===0?1:0,o;return n===-1&&i===1?o=r[0]-1:n===1&&i===-1?o=r[r.length-1]-s+1:o=i===-1?r[0]:r[r.length-1]-s,e.splice(o,0,...a),e}function Ix(e){return cht(t=>t.type.spec.tableRole==="table",e)}function cht(e,t){for(let r=t.depth;r>=0;r-=1){let n=t.node(r);if(e(n))return{node:n,pos:r===0?0:t.before(r),start:t.start(r),depth:r}}return null}function _x(e,t){let r=Ix(t.$from);if(!r)return;let n=ai.get(r.node);if(!(e<0||e>n.width-1))return n.cellsInRect({left:e,right:e+1,top:0,bottom:n.height}).map(i=>{let a=r.node.nodeAt(i),s=i+r.start;return{pos:s,start:s+1,node:a,depth:r.depth+2}})}function Rx(e,t){let r=Ix(t.$from);if(!r)return;let n=ai.get(r.node);if(!(e<0||e>n.height-1))return n.cellsInRect({left:0,right:n.width,top:e,bottom:e+1}).map(i=>{let a=r.node.nodeAt(i),s=i+r.start;return{pos:s,start:s+1,node:a,depth:r.depth+2}})}function Tfe(e,t,r=t){let n=t,i=r;for(let h=t;h>=0;h--){let f=_x(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.colspan+h-1;p>=n&&(n=h),p>i&&(i=p)})}for(let h=t;h<=i;h++){let f=_x(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.colspan+h-1;d.node.attrs.colspan>1&&p>i&&(i=p)})}let a=[];for(let h=n;h<=i;h++){let f=_x(h,e.selection);f&&f.length>0&&a.push(h)}n=a[0],i=a[a.length-1];let s=_x(n,e.selection),o=Rx(0,e.selection);if(!s||!o)return;let l=e.doc.resolve(s[s.length-1].pos),u;for(let h=i;h>=n;h--){let f=_x(h,e.selection);if(f&&f.length>0){for(let d=o.length-1;d>=0;d--)if(o[d].pos===f[0].pos){u=f[0];break}if(u)break}}if(u)return{$anchor:l,$head:e.doc.resolve(u.pos),indexes:a}}function Cfe(e,t,r=t){let n=t,i=r;for(let h=t;h>=0;h--){let f=Rx(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.rowspan+h-1;p>=n&&(n=h),p>i&&(i=p)})}for(let h=t;h<=i;h++){let f=Rx(h,e.selection);f&&f.forEach(d=>{let p=d.node.attrs.rowspan+h-1;d.node.attrs.rowspan>1&&p>i&&(i=p)})}let a=[];for(let h=n;h<=i;h++){let f=Rx(h,e.selection);f&&f.length>0&&a.push(h)}n=a[0],i=a[a.length-1];let s=Rx(n,e.selection),o=_x(0,e.selection);if(!s||!o)return;let l=e.doc.resolve(s[s.length-1].pos),u;for(let h=i;h>=n;h--){let f=Rx(h,e.selection);if(f&&f.length>0){for(let d=o.length-1;d>=0;d--)if(o[d].pos===f[0].pos){u=f[0];break}if(u)break}}if(u)return{$anchor:l,$head:e.doc.resolve(u.pos),indexes:a}}function Sfe(e){return e[0].map((t,r)=>e.map(n=>n[r]))}function uht(e){var t,r;let{tr:n,originIndex:i,targetIndex:a,select:s,pos:o}=e,l=Ix(n.doc.resolve(o));if(!l)return!1;let u=(t=Tfe(n,i))===null||t===void 0?void 0:t.indexes,h=(r=Tfe(n,a))===null||r===void 0?void 0:r.indexes;if(!u||!h||u.includes(a))return!1;let f=hht(l.node,u,h,0);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,f),!s)return!0;let d=ai.get(f),p=l.start,m=a,g=d.positionAt(d.height-1,m,f),y=n.doc.resolve(p+g),v=d.positionAt(0,m,f),x=n.doc.resolve(p+v);return n.setSelection(Oi.colSelection(y,x)),!0}function hht(e,t,r,n){let i=Sfe(Ffe(e));return i=zfe(i,t,r,n),i=Sfe(i),$fe(e,i)}function fht(e){var t,r;let{tr:n,originIndex:i,targetIndex:a,select:s,pos:o}=e,l=Ix(n.doc.resolve(o));if(!l)return!1;let u=(t=Cfe(n,i))===null||t===void 0?void 0:t.indexes,h=(r=Cfe(n,a))===null||r===void 0?void 0:r.indexes;if(!u||!h||u.includes(a))return!1;let f=dht(l.node,u,h,0);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,f),!s)return!0;let d=ai.get(f),p=l.start,m=a,g=d.positionAt(m,d.width-1,f),y=n.doc.resolve(p+g),v=d.positionAt(m,0,f),x=n.doc.resolve(p+v);return n.setSelection(Oi.rowSelection(y,x)),!0}function dht(e,t,r,n){let i=Ffe(e);return i=zfe(i,t,r,n),$fe(e,i)}function Wd(e){let t=e.selection,r=C7(e),n=r.node(-1),i=r.start(-1),a=ai.get(n);return{...t instanceof Oi?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(r.pos-i),tableStart:i,map:a,table:n}}function Gfe(e,{map:t,tableStart:r,table:n},i){let a=i>0?-1:0;eht(t,n,i+a)&&(a=i==0||i==t.width?null:0);for(let s=0;s<t.height;s++){let o=s*t.width+i;if(i>0&&i<t.width&&t.map[o-1]==t.map[o]){let l=t.map[o],u=n.nodeAt(l);e.setNodeMarkup(e.mapping.map(r+l),null,Jut(u.attrs,i-t.colCount(l))),s+=u.attrs.rowspan-1}else{let l=a==null?pu(n.type.schema).cell:n.nodeAt(t.map[o+a]).type,u=t.positionAt(s,i,n);e.insert(e.mapping.map(r+u),l.createAndFill())}}return e}function qfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e);t(Gfe(e.tr,r,r.left))}return!0}function Vfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e);t(Gfe(e.tr,r,r.right))}return!0}function pht(e,{map:t,table:r,tableStart:n},i){let a=e.mapping.maps.length;for(let s=0;s<t.height;){let o=s*t.width+i,l=t.map[o],u=r.nodeAt(l),h=u.attrs;if(i>0&&t.map[o-1]==l||i<t.width-1&&t.map[o+1]==l)e.setNodeMarkup(e.mapping.slice(a).map(n+l),null,H1(h,i-t.colCount(l)));else{let f=e.mapping.slice(a).map(n+l);e.delete(f,f+u.nodeSize)}s+=h.rowspan}}function Wfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e),n=e.tr;if(r.left==0&&r.right==r.map.width)return!1;for(let i=r.right-1;pht(n,r,i),i!=r.left;i--){let a=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");r.table=a,r.map=ai.get(a)}t(n)}return!0}function mht(e,{map:t,table:r,tableStart:n},i){let a=0;for(let u=0;u<i;u++)a+=r.child(u).nodeSize;let s=a+r.child(i).nodeSize,o=e.mapping.maps.length;e.delete(a+n,s+n);let l=new Set;for(let u=0,h=i*t.width;u<t.width;u++,h++){let f=t.map[h];if(!l.has(f)){if(l.add(f),i>0&&f==t.map[h-t.width]){let d=r.nodeAt(f).attrs;e.setNodeMarkup(e.mapping.slice(o).map(f+n),null,{...d,rowspan:d.rowspan-1}),u+=d.colspan-1}else if(i<t.height&&f==t.map[h+t.width]){let d=r.nodeAt(f),p=d.attrs,m=d.type.create({...p,rowspan:d.attrs.rowspan-1},d.content),g=t.positionAt(i+1,u,r);e.insert(e.mapping.slice(o).map(n+g),m),u+=p.colspan-1}}}}function Hfe(e,t){if(!Sc(e))return!1;if(t){let r=Wd(e),n=e.tr;if(r.top==0&&r.bottom==r.map.height)return!1;for(let i=r.bottom-1;mht(n,r,i),i!=r.top;i--){let a=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");r.table=a,r.map=ai.get(r.table)}t(n)}return!0}function Ufe(e,t){return function(r,n){if(!Sc(r))return!1;let i=C7(r);if(i.nodeAfter.attrs[e]===t)return!1;if(n){let a=r.tr;r.selection instanceof Oi?r.selection.forEachCell((s,o)=>{s.attrs[e]!==t&&a.setNodeMarkup(o,null,{...s.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),n(a)}return!0}}function ght(e){return function(t,r){if(!Sc(t))return!1;if(r){let n=pu(t.schema),i=Wd(t),a=t.tr,s=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),o=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)o[l].type==n.header_cell&&a.setNodeMarkup(i.tableStart+s[l],n.cell,o[l].attrs);if(a.steps.length===0)for(let l=0;l<s.length;l++)a.setNodeMarkup(i.tableStart+s[l],n.header_cell,o[l].attrs);r(a)}return!0}}function Efe(e,t,r){let n=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<n.length;i++){let a=t.table.nodeAt(n[i]);if(a&&a.type!==r.header_cell)return!1}return!0}function T$(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?ght(e):function(r,n){if(!Sc(r))return!1;if(n){let i=pu(r.schema),a=Wd(r),s=r.tr,o=Efe("row",a,i),l=Efe("column",a,i),u=(e==="column"?o:e==="row"&&l)?1:0,h=e=="column"?{left:0,top:u,right:1,bottom:a.map.height}:e=="row"?{left:u,top:0,right:a.map.width,bottom:1}:a,f=e=="column"?l?i.cell:i.header_cell:e=="row"?o?i.cell:i.header_cell:i.cell;a.map.cellsInRect(h).forEach(d=>{let p=d+a.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),n(s)}return!0}}var Vyr=T$("row",{useDeprecatedLogic:!0}),Wyr=T$("column",{useDeprecatedLogic:!0}),Hyr=T$("cell",{useDeprecatedLogic:!0});function yht(e,t){if(t<0){let r=e.nodeBefore;if(r)return e.pos-r.nodeSize;for(let n=e.index(-1)-1,i=e.before();n>=0;n--){let a=e.node(-1).child(n),s=a.lastChild;if(s)return i-1-s.nodeSize;i-=a.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let r=e.node(-1);for(let n=e.indexAfter(-1),i=e.after();n<r.childCount;n++){let a=r.child(n);if(a.childCount)return i+1;i+=a.nodeSize}}return null}function C$(e){return function(t,r){if(!Sc(t))return!1;let n=yht(C7(t),e);if(n==null)return!1;if(r){let i=t.doc.resolve(n);r(t.tr.setSelection(Pr.between(i,Qut(i))).scrollIntoView())}return!0}}function Yfe(e,t){let r=e.selection.$anchor;for(let n=r.depth;n>0;n--)if(r.node(n).type.spec.tableRole=="table")return t&&t(e.tr.delete(r.before(n),r.after(n)).scrollIntoView()),!0;return!1}function x7(e,t){let r=e.selection;if(!(r instanceof Oi))return!1;if(t){let n=e.tr,i=pu(e.schema).cell.createAndFill().content;r.forEachCell((a,s)=>{a.content.eq(i)||n.replace(n.mapping.map(s+1),n.mapping.map(s+a.nodeSize-1),new Xt(i,0,0))}),n.docChanged&&t(n)}return!0}function Xfe(e){return(t,r)=>{let{from:n,to:i,select:a=!0,pos:s=t.selection.from}=e,o=t.tr;return fht({tr:o,originIndex:n,targetIndex:i,select:a,pos:s})?(r?.(o),!0):!1}}function jfe(e){return(t,r)=>{let{from:n,to:i,select:a=!0,pos:s=t.selection.from}=e,o=t.tr;return uht({tr:o,originIndex:n,targetIndex:i,select:a,pos:s})?(r?.(o),!0):!1}}function vht(e){if(e.size===0)return null;let{content:t,openStart:r,openEnd:n}=e;for(;t.childCount==1&&(r>0&&n>0||t.child(0).type.spec.tableRole=="table");)r--,n--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,s=i.type.schema,o=[];if(a=="row")for(let l=0;l<t.childCount;l++){let u=t.child(l).content,h=l?0:Math.max(0,r-1),f=l<t.childCount-1?0:Math.max(0,n-1);(h||f)&&(u=b$(pu(s).row,new Xt(u,h,f)).content),o.push(u)}else if(a=="cell"||a=="header_cell")o.push(r||n?b$(pu(s).row,new Xt(t,r,n)).content:t);else return null;return xht(s,o)}function xht(e,t){let r=[];for(let i=0;i<t.length;i++){let a=t[i];for(let s=a.childCount-1;s>=0;s--){let{rowspan:o,colspan:l}=a.child(s).attrs;for(let u=i;u<i+o;u++)r[u]=(r[u]||0)+l}}let n=0;for(let i=0;i<r.length;i++)n=Math.max(n,r[i]);for(let i=0;i<r.length;i++)if(i>=t.length&&t.push(Lt.empty),r[i]<n){let a=pu(e).cell.createAndFill(),s=[];for(let o=r[i];o<n;o++)s.push(a);t[i]=t[i].append(Lt.from(s))}return{height:t.length,width:n,rows:t}}function b$(e,t){let r=e.createAndFill();return new sx(r).replace(0,r.content.size,t).doc}function bht({width:e,height:t,rows:r},n,i){if(e!=n){let a=[],s=[];for(let o=0;o<r.length;o++){let l=r[o],u=[];for(let h=a[o]||0,f=0;h<n;f++){let d=l.child(f%l.childCount);h+d.attrs.colspan>n&&(d=d.type.createChecked(H1(d.attrs,d.attrs.colspan,h+d.attrs.colspan-n),d.content)),u.push(d),h+=d.attrs.colspan;for(let p=1;p<d.attrs.rowspan;p++)a[o+p]=(a[o+p]||0)+d.attrs.colspan}s.push(Lt.from(u))}r=s,e=n}if(t!=i){let a=[];for(let s=0,o=0;s<i;s++,o++){let l=[],u=r[o%t];for(let h=0;h<u.childCount;h++){let f=u.child(h);s+f.attrs.rowspan>i&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,i-f.attrs.rowspan)},f.content)),l.push(f)}a.push(Lt.from(l))}r=a,t=i}return{width:e,height:t,rows:r}}function wht(e,t,r,n,i,a,s){let o=e.doc.type.schema,l=pu(o),u,h;if(i>t.width)for(let f=0,d=0;f<t.height;f++){let p=r.child(f);d+=p.nodeSize;let m=[],g;p.lastChild==null||p.lastChild.type==l.cell?g=u||(u=l.cell.createAndFill()):g=h||(h=l.header_cell.createAndFill());for(let y=t.width;y<i;y++)m.push(g);e.insert(e.mapping.slice(s).map(d-1+n),m)}if(a>t.height){let f=[];for(let m=0,g=(t.height-1)*t.width;m<Math.max(t.width,i);m++){let y=m>=t.width?!1:r.nodeAt(t.map[g+m]).type==l.header_cell;f.push(y?h||(h=l.header_cell.createAndFill()):u||(u=l.cell.createAndFill()))}let d=l.row.create(null,Lt.from(f)),p=[];for(let m=t.height;m<a;m++)p.push(d);e.insert(e.mapping.slice(s).map(n+r.nodeSize-2),p)}return!!(u||h)}function Afe(e,t,r,n,i,a,s,o){if(s==0||s==t.height)return!1;let l=!1;for(let u=i;u<a;u++){let h=s*t.width+u,f=t.map[h];if(t.map[h-t.width]==f){l=!0;let d=r.nodeAt(f),{top:p,left:m}=t.findCell(f);e.setNodeMarkup(e.mapping.slice(o).map(f+n),null,{...d.attrs,rowspan:s-p}),e.insert(e.mapping.slice(o).map(t.positionAt(s,m,r)),d.type.createAndFill({...d.attrs,rowspan:p+d.attrs.rowspan-s})),u+=d.attrs.colspan-1}}return l}function _fe(e,t,r,n,i,a,s,o){if(s==0||s==t.width)return!1;let l=!1;for(let u=i;u<a;u++){let h=u*t.width+s,f=t.map[h];if(t.map[h-1]==f){l=!0;let d=r.nodeAt(f),p=t.colCount(f),m=e.mapping.slice(o).map(f+n);e.setNodeMarkup(m,null,H1(d.attrs,s-p,d.attrs.colspan-(s-p))),e.insert(m+d.nodeSize,d.type.createAndFill(H1(d.attrs,0,s-p))),u+=d.attrs.rowspan-1}}return l}function Rfe(e,t,r,n,i){let a=r?e.doc.nodeAt(r-1):e.doc;if(!a)throw new Error("No table found");let s=ai.get(a),{top:o,left:l}=n,u=l+i.width,h=o+i.height,f=e.tr,d=0;function p(){if(a=r?f.doc.nodeAt(r-1):f.doc,!a)throw new Error("No table found");s=ai.get(a),d=f.mapping.maps.length}wht(f,s,a,r,u,h,d)&&p(),Afe(f,s,a,r,l,u,o,d)&&p(),Afe(f,s,a,r,l,u,h,d)&&p(),_fe(f,s,a,r,o,h,l,d)&&p(),_fe(f,s,a,r,o,h,u,d)&&p();for(let m=o;m<h;m++){let g=s.positionAt(m,l,a),y=s.positionAt(m,u,a);f.replace(f.mapping.slice(d).map(g+r),f.mapping.slice(d).map(y+r),new Xt(i.rows[m-o],0,0))}p(),f.setSelection(new Oi(f.doc.resolve(r+s.positionAt(o,l,a)),f.doc.resolve(r+s.positionAt(h-1,u-1,a)))),t(f)}var kht=OB({ArrowLeft:b7("horiz",-1),ArrowRight:b7("horiz",1),ArrowUp:b7("vert",-1),ArrowDown:b7("vert",1),"Shift-ArrowLeft":w7("horiz",-1),"Shift-ArrowRight":w7("horiz",1),"Shift-ArrowUp":w7("vert",-1),"Shift-ArrowDown":w7("vert",1),Backspace:x7,"Mod-Backspace":x7,Delete:x7,"Mod-Delete":x7});function k7(e,t,r){return r.eq(e.selection)?!1:(t&&t(e.tr.setSelection(r).scrollIntoView()),!0)}function b7(e,t){return(r,n,i)=>{if(!i)return!1;let a=r.selection;if(a instanceof Oi)return k7(r,n,Vr.near(a.$headCell,t));if(e!="horiz"&&!a.empty)return!1;let s=Kfe(i,e,t);if(s==null)return!1;if(e=="horiz")return k7(r,n,Vr.near(r.doc.resolve(a.head+t),t));{let o=r.doc.resolve(s),l=Ofe(o,e,t),u;return l?u=Vr.near(l,1):t<0?u=Vr.near(r.doc.resolve(o.before(-1)),-1):u=Vr.near(r.doc.resolve(o.after(-1)),1),k7(r,n,u)}}}function w7(e,t){return(r,n,i)=>{if(!i)return!1;let a=r.selection,s;if(a instanceof Oi)s=a;else{let l=Kfe(i,e,t);if(l==null)return!1;s=new Oi(r.doc.resolve(l))}let o=Ofe(s.$headCell,e,t);return o?k7(r,n,new Oi(s.$anchorCell,o)):!1}}function Tht(e,t){let r=e.state.doc,n=Lx(r.resolve(t));return n?(e.dispatch(e.state.tr.setSelection(new Oi(n))),!0):!1}function Cht(e,t,r){if(!Sc(e.state))return!1;let n=vht(r),i=e.state.selection;if(i instanceof Oi){n||(n={width:1,height:1,rows:[Lt.from(b$(pu(e.state.schema).cell,r))]});let a=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),o=ai.get(a).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return n=bht(n,o.right-o.left,o.bottom-o.top),Rfe(e.state,e.dispatch,s,o,n),!0}else if(n){let a=C7(e.state),s=a.start(-1);return Rfe(e.state,e.dispatch,s,ai.get(a.node(-1)).findCell(a.pos-s),n),!0}else return!1}function Sht(e,t){var r;if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=Lfe(e,t.target),i;if(t.shiftKey&&e.state.selection instanceof Oi)a(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(i=Lx(e.state.selection.$anchor))!=null&&((r=g$(e,t))===null||r===void 0?void 0:r.pos)!=i.pos)a(i,t),t.preventDefault();else if(!n)return;function a(l,u){let h=g$(e,u),f=Hp.getState(e.state)==null;if(!h||!k$(l,h))if(f)h=l;else return;let d=new Oi(l,h);if(f||!e.state.selection.eq(d)){let p=e.state.tr.setSelection(d);f&&p.setMeta(Hp,l.pos),e.dispatch(p)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",o),Hp.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(Hp,-1))}function o(l){let u=l,h=Hp.getState(e.state),f;if(h!=null)f=e.state.doc.resolve(h);else if(Lfe(e,u.target)!=n&&(f=g$(e,t),!f))return s();f&&a(f,u)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",o)}function Kfe(e,t,r){if(!(e.state.selection instanceof Pr))return null;let{$head:n}=e.state.selection;for(let i=n.depth-1;i>=0;i--){let a=n.node(i);if((r<0?n.index(i):n.indexAfter(i))!=(r<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){let s=n.before(i),o=t=="vert"?r>0?"down":"up":r>0?"right":"left";return e.endOfTextblock(o)?s:null}}return null}function Lfe(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function g$(e,t){let r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return null;let{inside:n,pos:i}=r;return n>=0&&Lx(e.state.doc.resolve(n))||Lx(e.state.doc.resolve(i))}var Eht=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),w$(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,w$(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function w$(e,t,r,n,i,a){let s=0,o=!0,l=t.firstChild,u=e.firstChild;if(u){for(let f=0,d=0;f<u.childCount;f++){let{colspan:p,colwidth:m}=u.child(f).attrs;for(let g=0;g<p;g++,d++){let y=i==d?a:m&&m[g],v=y?y+"px":"";if(s+=y||n,y||(o=!1),l)l.style.width!=v&&(l.style.width=v),l=l.nextSibling;else{let x=document.createElement("col");x.style.width=v,t.appendChild(x)}}}for(;l;){var h;let f=l.nextSibling;(h=l.parentNode)===null||h===void 0||h.removeChild(l),l=f}o?(r.style.width=s+"px",r.style.minWidth=""):(r.style.width="",r.style.minWidth=s+"px")}}var Cc=new Hi("tableColumnResizing");function Zfe({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:r=100,View:n=Eht,lastColumnResizable:i=!0}={}){let a=new Ci({key:Cc,state:{init(s,o){var l;let u=(l=a.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,h=pu(o.schema).table.name;return n&&u&&(u[h]=(f,d)=>new n(f,r,d)),new Aht(-1,!1)},apply(s,o){return o.apply(s)}},props:{attributes:s=>{let o=Cc.getState(s);return o&&o.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,o)=>{_ht(s,o,e,i)},mouseleave:s=>{Rht(s)},mousedown:(s,o)=>{Lht(s,o,t,r)}},decorations:s=>{let o=Cc.getState(s);if(o&&o.activeHandle>-1)return Oht(s,o.activeHandle)},nodeViews:{}}});return a}var Aht=class T7{constructor(t,r){this.activeHandle=t,this.dragging=r}apply(t){let r=this,n=t.getMeta(Cc);if(n&&n.setHandle!=null)return new T7(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new T7(r.activeHandle,n.setDragging);if(r.activeHandle>-1&&t.docChanged){let i=t.mapping.map(r.activeHandle,-1);return x$(t.doc.resolve(i))||(i=-1),new T7(i,r.dragging)}return r}};function _ht(e,t,r,n){if(!e.editable)return;let i=Cc.getState(e.state);if(i&&!i.dragging){let a=Mht(t.target),s=-1;if(a){let{left:o,right:l}=a.getBoundingClientRect();t.clientX-o<=r?s=Ife(e,t,"left",r):l-t.clientX<=r&&(s=Ife(e,t,"right",r))}if(s!=i.activeHandle){if(!n&&s!==-1){let o=e.state.doc.resolve(s),l=o.node(-1),u=ai.get(l),h=o.start(-1);if(u.colCount(o.pos-h)+o.nodeAfter.attrs.colspan-1==u.width-1)return}Qfe(e,s)}}}function Rht(e){if(!e.editable)return;let t=Cc.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Qfe(e,-1)}function Lht(e,t,r,n){var i;if(!e.editable)return!1;let a=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=Cc.getState(e.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let o=e.state.doc.nodeAt(s.activeHandle),l=Iht(e,s.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(Cc,{setDragging:{startX:t.clientX,startWidth:l}}));function u(f){a.removeEventListener("mouseup",u),a.removeEventListener("mousemove",h);let d=Cc.getState(e.state);d?.dragging&&(Nht(e,d.activeHandle,Mfe(d.dragging,f,r)),e.dispatch(e.state.tr.setMeta(Cc,{setDragging:null})))}function h(f){if(!f.which)return u(f);let d=Cc.getState(e.state);if(d&&d.dragging){let p=Mfe(d.dragging,f,r);Nfe(e,d.activeHandle,p,n)}}return Nfe(e,s.activeHandle,l,n),a.addEventListener("mouseup",u),a.addEventListener("mousemove",h),t.preventDefault(),!0}function Iht(e,t,{colspan:r,colwidth:n}){let i=n&&n[n.length-1];if(i)return i;let a=e.domAtPos(t),s=a.node.childNodes[a.offset].offsetWidth,o=r;if(n)for(let l=0;l<r;l++)n[l]&&(s-=n[l],o--);return s/o}function Mht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function Ife(e,t,r,n){let i=r=="right"?-n:n,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:s}=a,o=Lx(e.state.doc.resolve(s));if(!o)return-1;if(r=="right")return o.pos;let l=ai.get(o.node(-1)),u=o.start(-1),h=l.map.indexOf(o.pos-u);return h%l.width==0?-1:u+l.map[h-1]}function Mfe(e,t,r){let n=t.clientX-e.startX;return Math.max(r,e.startWidth+n)}function Qfe(e,t){e.dispatch(e.state.tr.setMeta(Cc,{setHandle:t}))}function Nht(e,t,r){let n=e.state.doc.resolve(t),i=n.node(-1),a=ai.get(i),s=n.start(-1),o=a.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let u=0;u<a.height;u++){let h=u*a.width+o;if(u&&a.map[h]==a.map[h-a.width])continue;let f=a.map[h],d=i.nodeAt(f).attrs,p=d.colspan==1?0:o-a.colCount(f);if(d.colwidth&&d.colwidth[p]==r)continue;let m=d.colwidth?d.colwidth.slice():Dht(d.colspan);m[p]=r,l.setNodeMarkup(s+f,null,{...d,colwidth:m})}l.docChanged&&e.dispatch(l)}function Nfe(e,t,r,n){let i=e.state.doc.resolve(t),a=i.node(-1),s=i.start(-1),o=ai.get(a).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=e.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&w$(a,l.firstChild,l,n,o,r)}function Dht(e){return Array(e).fill(0)}function Oht(e,t){let r=[],n=e.doc.resolve(t),i=n.node(-1);if(!i)return Ui.empty;let a=ai.get(i),s=n.start(-1),o=a.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1;for(let u=0;u<a.height;u++){let h=o+u*a.width;if((o==a.width-1||a.map[h]!=a.map[h+1])&&(u==0||a.map[h]!=a.map[h-a.width])){var l;let f=a.map[h],d=s+f+i.nodeAt(f).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((l=Cc.getState(e))===null||l===void 0)&&l.dragging&&r.push(mi.node(s+f,s+f+i.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),r.push(mi.widget(d,p))}}return Ui.create(e.doc,r)}function Jfe({allowTableNodeSelection:e=!1}={}){return new Ci({key:Hp,state:{init(){return null},apply(t,r){let n=t.getMeta(Hp);if(n!=null)return n==-1?null:n;if(r==null||!t.docChanged)return r;let{deleted:i,pos:a}=t.mapping.mapResult(r);return i?null:a}},props:{decorations:rht,handleDOMEvents:{mousedown:Sht},createSelectionBetween(t){return Hp.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Tht,handleKeyDown:kht,handlePaste:Cht},appendTransaction(t,r,n){return aht(n,oht(n,r),e)}})}var S7=typeof navigator<"u"?navigator:null,E$=S7&&S7.userAgent||"",Pht=/Edge\/(\d+)/.exec(E$),Bht=/MSIE \d/.exec(E$),Fht=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(E$),$ht=!!(Bht||Fht||Pht),zht=!$ht&&!!S7&&/Apple Computer/.test(S7.vendor),ede=new Hi("safari-ime-span"),S$=!1,Ght={key:ede,props:{decorations:qht,handleDOMEvents:{compositionstart:()=>{S$=!0},compositionend:()=>{S$=!1}}}};function qht(e){let{$from:t,$to:r,to:n}=e.selection;if(S$&&t.sameParent(r)){let i=mi.widget(n,Vht,{ignoreSelection:!0,key:"safari-ime-span"});return Ui.create(e.doc,[i])}}function Vht(e){let t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var tde=new Ci(zht?Ght:{key:ede});function A$(e,t){let r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function _$(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function R$(e,t,r){let i=Ip((r||{}).ignore||[]),a=Wht(t),s=-1;for(;++s<a.length;)g1(e,"text",o);function o(u,h){let f=-1,d;for(;++f<h.length;){let p=h[f],m=d?d.children:void 0;if(i(p,m?m.indexOf(p):void 0,d))return;d=p}if(d)return l(u,h)}function l(u,h){let f=h[h.length-1],d=a[s][0],p=a[s][1],m=0,y=f.children.indexOf(u),v=!1,x=[];d.lastIndex=0;let w=d.exec(u.value);for(;w;){let C=w.index,T={index:w.index,input:w.input,stack:[...h,u]},k=p(...w,T);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?d.lastIndex=C+1:(m!==C&&x.push({type:"text",value:u.value.slice(m,C)}),Array.isArray(k)?x.push(...k):k&&x.push(k),m=C+w[0].length,v=!0),!d.global)break;w=d.exec(u.value)}return v?(m<u.value.length&&x.push({type:"text",value:u.value.slice(m)}),f.children.splice(y,1,...x)):x=[u],y+x.length}}function Wht(e){let t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){let i=r[n];t.push([Hht(i[0]),Uht(i[1])])}return t}function Hht(e){return typeof e=="string"?new RegExp(_$(e),"g"):e}function Uht(e){return typeof e=="function"?e:function(){return e}}var L$="phrasing",I$=["autolink","link","image","label"];function N$(){return{transforms:[Qht],enter:{literalAutolink:Yht,literalAutolinkEmail:M$,literalAutolinkHttp:M$,literalAutolinkWww:M$},exit:{literalAutolink:Zht,literalAutolinkEmail:Kht,literalAutolinkHttp:Xht,literalAutolinkWww:jht}}}function D$(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:L$,notInConstruct:I$},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:L$,notInConstruct:I$},{character:":",before:"[ps]",after:"\\/",inConstruct:L$,notInConstruct:I$}]}}function Yht(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function M$(e){this.config.enter.autolinkProtocol.call(this,e)}function Xht(e){this.config.exit.autolinkProtocol.call(this,e)}function jht(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Kht(e){this.config.exit.autolinkEmail.call(this,e)}function Zht(e){this.exit(e)}function Qht(e){R$(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Jht],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,eft]],{ignore:["link","linkReference"]})}function Jht(e,t,r,n,i){let a="";if(!rde(i)||(/^w/i.test(t)&&(r=t+r,t="",a="http://"),!tft(r)))return!1;let s=rft(r+n);if(!s[0])return!1;let o={type:"link",title:null,url:a+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[o,{type:"text",value:s[1]}]:o}function eft(e,t,r,n){return!rde(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function tft(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function rft(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),i=A$(e,"("),a=A$(e,")");for(;n!==-1&&i>a;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),a++;return[e,r]}function rde(e,t){let r=e.input.charCodeAt(e.index-1);return(e.index===0||Wh(r)||u1(r))&&(!t||r!==47)}nde.peek=hft;function nft(){this.buffer()}function ift(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function aft(){this.buffer()}function sft(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function oft(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Lo(this.sliceSerialize(e)).toLowerCase(),r.label=t}function lft(e){this.exit(e)}function cft(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Lo(this.sliceSerialize(e)).toLowerCase(),r.label=t}function uft(e){this.exit(e)}function hft(){return"["}function nde(e,t,r,n){let i=r.createTracker(n),a=i.move("[^"),s=r.enter("footnoteReference"),o=r.enter("reference");return a+=i.move(r.safe(r.associationId(e),{after:"]",before:a})),o(),s(),a+=i.move("]"),a}function O$(){return{enter:{gfmFootnoteCallString:nft,gfmFootnoteCall:ift,gfmFootnoteDefinitionLabelString:aft,gfmFootnoteDefinition:sft},exit:{gfmFootnoteCallString:oft,gfmFootnoteCall:lft,gfmFootnoteDefinitionLabelString:cft,gfmFootnoteDefinition:uft}}}function P$(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:nde},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,a,s){let o=a.createTracker(s),l=o.move("[^"),u=a.enter("footnoteDefinition"),h=a.enter("label");return l+=o.move(a.safe(a.associationId(n),{before:l,after:"]"})),h(),l+=o.move("]:"),n.children&&n.children.length>0&&(o.shift(4),l+=o.move((t?` +`:" ")+a.indentLines(a.containerFlow(n,o.current()),t?ide:fft))),u(),l}}function fft(e,t,r){return t===0?e:ide(e,t,r)}function ide(e,t,r){return(r?"":" ")+e}var dft=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ade.peek=gft;function B$(){return{canContainEols:["delete"],enter:{strikethrough:pft},exit:{strikethrough:mft}}}function F$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:dft}],handlers:{delete:ade}}}function pft(e){this.enter({type:"delete",children:[]},e)}function mft(e){this.exit(e)}function ade(e,t,r,n){let i=r.createTracker(n),a=r.enter("strikethrough"),s=i.move("~~");return s+=r.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),a(),s}function gft(){return"~"}function yft(e){return e.length}function ode(e,t){let r=t||{},n=(r.align||[]).concat(),i=r.stringLength||yft,a=[],s=[],o=[],l=[],u=0,h=-1;for(;++h<e.length;){let g=[],y=[],v=-1;for(e[h].length>u&&(u=e[h].length);++v<e[h].length;){let x=vft(e[h][v]);if(r.alignDelimiters!==!1){let w=i(x);y[v]=w,(l[v]===void 0||w>l[v])&&(l[v]=w)}g.push(x)}s[h]=g,o[h]=y}let f=-1;if(typeof n=="object"&&"length"in n)for(;++f<u;)a[f]=sde(n[f]);else{let g=sde(n);for(;++f<u;)a[f]=g}f=-1;let d=[],p=[];for(;++f<u;){let g=a[f],y="",v="";g===99?(y=":",v=":"):g===108?y=":":g===114&&(v=":");let x=r.alignDelimiters===!1?1:Math.max(1,l[f]-y.length-v.length),w=y+"-".repeat(x)+v;r.alignDelimiters!==!1&&(x=y.length+x+v.length,x>l[f]&&(l[f]=x),p[f]=x),d[f]=w}s.splice(1,0,d),o.splice(1,0,p),h=-1;let m=[];for(;++h<s.length;){let g=s[h],y=o[h];f=-1;let v=[];for(;++f<u;){let x=g[f]||"",w="",C="";if(r.alignDelimiters!==!1){let T=l[f]-(y[f]||0),k=a[f];k===114?w=" ".repeat(T):k===99?T%2?(w=" ".repeat(T/2+.5),C=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),C=w):C=" ".repeat(T)}r.delimiterStart!==!1&&!f&&v.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&x==="")&&(r.delimiterStart!==!1||f)&&v.push(" "),r.alignDelimiters!==!1&&v.push(w),v.push(x),r.alignDelimiters!==!1&&v.push(C),r.padding!==!1&&v.push(" "),(r.delimiterEnd!==!1||f!==u-1)&&v.push("|")}m.push(r.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return m.join(` +`)}function vft(e){return e==null?"":String(e)}function sde(e){let t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function z$(){return{enter:{table:xft,tableData:lde,tableHeader:lde,tableRow:wft},exit:{codeText:kft,table:bft,tableData:$$,tableHeader:$$,tableRow:$$}}}function xft(e){let t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function bft(e){this.exit(e),this.data.inTable=void 0}function wft(e){this.enter({type:"tableRow",children:[]},e)}function $$(e){this.exit(e)}function lde(e){this.enter({type:"tableCell",children:[]},e)}function kft(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Tft));let r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function Tft(e,t){return t==="|"?t:e}function G$(e){let t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,a=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:s,tableCell:l,tableRow:o}};function s(p,m,g,y){return u(h(p,g,y),p.align)}function o(p,m,g,y){let v=f(p,g,y),x=u([v]);return x.slice(0,x.indexOf(` -`))}function l(p,m,g,y){let v=g.enter("tableCell"),x=g.enter("phrasing"),w=g.containerPhrasing(p,{...y,before:a,after:a});return x(),v(),w}function u(p,m){return ade(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function h(p,m,g){let y=p.children,v=-1,x=[],w=m.enter("table");for(;++v<y.length;)x[v]=f(y[v],m,g);return w(),x}function f(p,m,g){let y=p.children,v=-1,x=[],w=m.enter("tableRow");for(;++v<y.length;)x[v]=l(y[v],p,m,g);return w(),x}function d(p,m,g){let y=y1.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function z$(){return{exit:{taskListCheckValueChecked:ode,taskListCheckValueUnchecked:ode,paragraph:bft}}}function G$(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:wft}}}function ode(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function bft(e){let t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){let r=this.stack[this.stack.length-1];r.type;let n=r.children[0];if(n&&n.type==="text"){let i=t.children,a=-1,s;for(;++a<i.length;){let o=i[a];if(o.type==="paragraph"){s=o;break}}s===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function wft(e,t,r,n){let i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",o=r.createTracker(n);a&&o.move(s);let l=y1.listItem(e,t,r,{...n,...o.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+s}}function q$(){return[I$(),N$(),O$(),F$(),z$()]}function V$(e){return{extensions:[M$(),D$(e),P$(),$$(e),G$()]}}var kft={tokenize:Aft,partial:!0},lde={tokenize:_ft,partial:!0},cde={tokenize:Rft,partial:!0},ude={tokenize:Lft,partial:!0},Tft={tokenize:Ift,partial:!0},hde={name:"wwwAutolink",tokenize:Sft,previous:dde},fde={name:"protocolAutolink",tokenize:Eft,previous:pde},Hd={name:"emailAutolink",tokenize:Cft,previous:mde},Zh={};function H$(){return{text:Zh}}var U1=48;for(;U1<123;)Zh[U1]=Hd,U1++,U1===58?U1=65:U1===91&&(U1=97);Zh[43]=Hd;Zh[45]=Hd;Zh[46]=Hd;Zh[95]=Hd;Zh[72]=[Hd,fde];Zh[104]=[Hd,fde];Zh[87]=[Hd,hde];Zh[119]=[Hd,hde];function Cft(e,t,r){let n=this,i,a;return s;function s(f){return!W$(f)||!mde.call(n,n.previous)||U$(n.events)?r(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(f))}function o(f){return W$(f)?(e.consume(f),o):f===64?(e.consume(f),l):r(f)}function l(f){return f===46?e.check(Tft,h,u)(f):f===45||f===95||hs(f)?(a=!0,e.consume(f),l):h(f)}function u(f){return e.consume(f),i=!0,l}function h(f){return a&&i&&us(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):r(f)}}function Sft(e,t,r){let n=this;return i;function i(s){return s!==87&&s!==119||!dde.call(n,n.previous)||U$(n.events)?r(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(kft,e.attempt(lde,e.attempt(cde,a),r),r)(s))}function a(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function Eft(e,t,r){let n=this,i="",a=!1;return s;function s(f){return(f===72||f===104)&&pde.call(n,n.previous)&&!U$(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),o):r(f)}function o(f){if(us(f)&&i.length<5)return i+=String.fromCodePoint(f),e.consume(f),o;if(f===58){let d=i.toLowerCase();if(d==="http"||d==="https")return e.consume(f),l}return r(f)}function l(f){return f===47?(e.consume(f),a?u:(a=!0,l)):r(f)}function u(f){return f===null||c1(f)||_n(f)||Wh(f)||u1(f)?r(f):e.attempt(lde,e.attempt(cde,h),r)(f)}function h(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function Aft(e,t,r){let n=0;return i;function i(s){return(s===87||s===119)&&n<3?(n++,e.consume(s),i):s===46&&n===3?(e.consume(s),a):r(s)}function a(s){return s===null?r(s):t(s)}}function _ft(e,t,r){let n,i,a;return s;function s(u){return u===46||u===95?e.check(ude,l,o)(u):u===null||_n(u)||Wh(u)||u!==45&&u1(u)?l(u):(a=!0,e.consume(u),s)}function o(u){return u===95?n=!0:(i=n,n=void 0),e.consume(u),s}function l(u){return i||n||!a?r(u):t(u)}}function Rft(e,t){let r=0,n=0;return i;function i(s){return s===40?(r++,e.consume(s),i):s===41&&n<r?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(ude,t,a)(s):s===null||_n(s)||Wh(s)?t(s):(e.consume(s),i)}function a(s){return s===41&&n++,e.consume(s),i}}function Lft(e,t,r){return n;function n(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),n):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||_n(o)||Wh(o)?t(o):r(o)}function i(o){return o===null||o===40||o===91||_n(o)||Wh(o)?t(o):n(o)}function a(o){return us(o)?s(o):r(o)}function s(o){return o===59?(e.consume(o),n):us(o)?(e.consume(o),s):r(o)}}function Ift(e,t,r){return n;function n(a){return e.consume(a),i}function i(a){return hs(a)?r(a):t(a)}}function dde(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||_n(e)}function pde(e){return!us(e)}function mde(e){return!(e===47||W$(e))}function W$(e){return e===43||e===45||e===46||e===95||hs(e)}function U$(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}var Mft={tokenize:$ft,partial:!0};function Y$(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Pft,continuation:{tokenize:Bft},exit:Fft}},text:{91:{name:"gfmFootnoteCall",tokenize:Oft},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Nft,resolveTo:Dft}}}}function Nft(e,t,r){let n=this,i=n.events.length,a=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),s;for(;i--;){let l=n.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!s||!s._balanced)return r(l);let u=Lo(n.sliceSerialize({start:s.end,end:n.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?r(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Dft(e,t){let r=e.length,n;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){n=e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",i,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(r,e.length-r+1,...l),e}function Oft(e,t,r){let n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),a=0,s;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?r(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(a>999||f===93&&!s||f===null||f===91||_n(f))return r(f);if(f===93){e.exit("chunkString");let d=e.exit("gfmFootnoteCallString");return i.includes(Lo(n.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(f)}return _n(f)||(s=!0),a++,e.consume(f),f===92?h:u}function h(f){return f===91||f===92||f===93?(e.consume(f),a++,u):u(f)}}function Pft(e,t,r){let n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),a,s=0,o;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):r(m)}function h(m){if(s>999||m===93&&!o||m===null||m===91||_n(m))return r(m);if(m===93){e.exit("chunkString");let g=e.exit("gfmFootnoteDefinitionLabelString");return a=Lo(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return _n(m)||(o=!0),s++,e.consume(m),m===92?f:h}function f(m){return m===91||m===92||m===93?(e.consume(m),s++,h):h(m)}function d(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(a)||i.push(a),kr(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function Bft(e,t,r){return e.check(Hh,t,e.attempt(Mft,t,r))}function Fft(e){e.exit("gfmFootnoteDefinition")}function $ft(e,t,r){let n=this;return kr(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){let s=n.events[n.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(a):r(a)}}function X$(e){let r=(e||{}).singleTilde,n={name:"strikethrough",tokenize:a,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(s,o){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let u=l;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[l][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";let h={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[l][1].end)},f={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[l][1].start)},d=[["enter",h,o],["enter",s[u][1],o],["exit",s[u][1],o],["enter",f,o]],p=o.parser.constructs.insideSpan.null;p&&Oa(d,d.length,0,_p(p,s.slice(u+1,l),o)),Oa(d,d.length,0,[["exit",f,o],["enter",s[l][1],o],["exit",s[l][1],o],["exit",h,o]]),Oa(s,u-1,l-u+3,d),l=u+d.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function a(s,o,l){let u=this.previous,h=this.events,f=0;return d;function d(m){return u===126&&h[h.length-1][1].type!=="characterEscape"?l(m):(s.enter("strikethroughSequenceTemporary"),p(m))}function p(m){let g=Rd(u);if(m===126)return f>1?l(m):(s.consume(m),f++,p);if(f<2&&!r)return l(m);let y=s.exit("strikethroughSequenceTemporary"),v=Rd(m);return y._open=!v||v===2&&!!g,y._close=!g||g===2&&!!v,o(m)}}}var E7=class{constructor(){this.map=[]}add(t,r,n){zft(this,t,r,n)}consume(t){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let r=this.map.length,n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(let a of i)t.push(a);i=n.pop()}this.map.length=0}};function zft(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}function gde(e,t){let r=!1,n=[];for(;t<e.length;){let i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){let a=n.length-1;n[a]=n[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function j$(){return{flow:{null:{name:"table",tokenize:Gft,resolveAll:qft}}}}function Gft(e,t,r){let n=this,i=0,a=0,s;return o;function o(L){let O=n.events.length-1;for(;O>-1;){let N=n.events[O][1].type;if(N==="lineEnding"||N==="linePrefix")O--;else break}let R=O>-1?n.events[O][1].type:null,A=R==="tableHead"||R==="tableRow"?k:l;return A===k&&n.parser.lazy[n.now().line]?r(L):A(L)}function l(L){return e.enter("tableHead"),e.enter("tableRow"),u(L)}function u(L){return L===124||(s=!0,a+=1),h(L)}function h(L){return L===null?r(L):Kt(L)?a>1?(a=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),p):r(L):Or(L)?kr(e,h,"whitespace")(L):(a+=1,s&&(s=!1,i+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),s=!0,h):(e.enter("data"),f(L)))}function f(L){return L===null||L===124||_n(L)?(e.exit("data"),h(L)):(e.consume(L),L===92?d:f)}function d(L){return L===92||L===124?(e.consume(L),f):f(L)}function p(L){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(L):(e.enter("tableDelimiterRow"),s=!1,Or(L)?kr(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):m(L))}function m(L){return L===45||L===58?y(L):L===124?(s=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),g):T(L)}function g(L){return Or(L)?kr(e,y,"whitespace")(L):y(L)}function y(L){return L===58?(a+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),v):L===45?(a+=1,v(L)):L===null||Kt(L)?C(L):T(L)}function v(L){return L===45?(e.enter("tableDelimiterFiller"),x(L)):T(L)}function x(L){return L===45?(e.consume(L),x):L===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(L))}function w(L){return Or(L)?kr(e,C,"whitespace")(L):C(L)}function C(L){return L===124?m(L):L===null||Kt(L)?!s||i!==a?T(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):T(L)}function T(L){return r(L)}function k(L){return e.enter("tableRow"),S(L)}function S(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),S):L===null||Kt(L)?(e.exit("tableRow"),t(L)):Or(L)?kr(e,S,"whitespace")(L):(e.enter("data"),E(L))}function E(L){return L===null||L===124||_n(L)?(e.exit("data"),S(L)):(e.consume(L),L===92?I:E)}function I(L){return L===92||L===124?(e.consume(L),E):E(L)}}function qft(e,t){let r=-1,n=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],o=!1,l=0,u,h,f,d=new E7;for(;++r<e.length;){let p=e[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(o=!1,l!==0&&(yde(d,t,l,u,h),h=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,f=void 0,a=[0,0,0,0],s=[0,r+1,0,0],o&&(o=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],f=A7(d,t,a,i,void 0,f),a=[0,0,0,0]),s[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(a[1]!==0&&(s[0]=s[1],f=A7(d,t,a,i,void 0,f)),a=s,s=[a[1],r,0,0])):m.type==="tableHead"?(o=!0,l=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=r,a[1]!==0?(s[0]=s[1],f=A7(d,t,a,i,r,f)):s[1]!==0&&(f=A7(d,t,s,i,r,f)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=r)}for(l!==0&&yde(d,t,l,u,h),d.consume(t.events),r=-1;++r<t.events.length;){let p=t.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=gde(t.events,r))}return e}function A7(e,t,r,n,i,a){let s=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",o="tableContent";r[0]!==0&&(a.end=Object.assign({},Mx(t.events,r[0])),e.add(r[0],0,[["exit",a,t]]));let l=Mx(t.events,r[1]);if(a={type:s,start:Object.assign({},l),end:Object.assign({},l)},e.add(r[1],0,[["enter",a,t]]),r[2]!==0){let u=Mx(t.events,r[2]),h=Mx(t.events,r[3]),f={type:o,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(r[2],0,[["enter",f,t]]),n!==2){let d=t.events[r[2]],p=t.events[r[3]];if(d[1].end=Object.assign({},p[1].end),d[1].type="chunkText",d[1].contentType="text",r[3]>r[2]+1){let m=r[2]+1,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",f,t]])}return i!==void 0&&(a.end=Object.assign({},Mx(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function yde(e,t,r,n,i){let a=[],s=Mx(t.events,r);i&&(i.end=Object.assign({},s),a.push(["exit",i,t])),n.end=Object.assign({},s),a.push(["exit",n,t]),e.add(r+1,0,a)}function Mx(e,t){let r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}var Vft={name:"tasklistCheck",tokenize:Wft};function K$(){return{text:{91:Vft}}}function Wft(e,t,r){let n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),a)}function a(l){return _n(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),s):r(l)}function s(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(l)}function o(l){return Kt(l)?t(l):Or(l)?e.check({tokenize:Hft},t,r)(l):r(l)}}function Hft(e,t,r){return kr(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function vde(e){return cE([H$(),Y$(),X$(e),j$(),K$()])}var Uft={};function _7(e){let t=this,r=e||Uft,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(vde(r)),a.push(q$()),s.push(V$(r))}function Kr(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var J$=q1("strike_through");Kr(J$,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var ET=qp("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:t=>t==="line-through"}],toDOM:t=>["del",e.get(J$.key)(t)],parseMarkdown:{match:t=>t.type==="delete",runner:(t,r,n)=>{t.openMark(n),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="strike_through",runner:(t,r)=>{t.withMark(r,"delete")}}}));Kr(ET.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Kr(ET.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var ez=hn("ToggleStrikeThrough",e=>()=>fx(ET.type(e)));Kr(ez,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var bde=Oo(e=>R1(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)/,ET.type(e)));Kr(bde,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var tz=nl("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{let t=e.get(Gn);return()=>t.call(ez.key)}}});Kr(tz.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Kr(tz.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var AT=Mfe({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),Ud=Ba("table",()=>({...AT.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="table",runner:(e,t,r)=>{let n=t.align,i=t.children.map((a,s)=>({...a,align:n,isHeader:s===0}));e.openNode(r),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table",runner:(e,t)=>{let r=t.content.firstChild?.content;if(!r)return;let n=[];r.forEach(i=>{n.push(i.attrs.alignment)}),e.openNode("table",void 0,{align:n}),e.next(t.content),e.closeNode()}}}));Kr(Ud.node,{displayName:"NodeSchema<table>",group:"Table"});Kr(Ud.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var _T=Ba("table_header_row",()=>({...AT.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&e.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:e=>!!(e.type==="tableRow"&&e.isHeader),runner:(e,t,r)=>{let n=t.align,i=t.children.map((a,s)=>({...a,align:n[s],isHeader:t.isHeader}));e.openNode(r),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));Kr(_T.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Kr(_T.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Dx=Ba("table_row",()=>({...AT.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>e.type==="tableRow",runner:(e,t,r)=>{let n=t.align,i=t.children.map((a,s)=>({...a,align:n[s]}));e.openNode(r),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));Kr(Dx.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Kr(Dx.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var RT=Ba("table_cell",()=>({...AT.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!e.isHeader,runner:(e,t,r)=>{let n=t.align;e.openNode(r,{alignment:n}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>e.type.name==="table_cell",runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));Kr(RT.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Kr(RT.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Nx=Ba("table_header",()=>({...AT.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!!e.isHeader,runner:(e,t,r)=>{let n=t.align;e.openNode(r,{alignment:n}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header",runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));Kr(Nx.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Kr(Nx.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function wde(e,t=3,r=3){let n=Array(r).fill(0).map(()=>RT.type(e).createAndFill()),i=Array(r).fill(0).map(()=>Nx.type(e).createAndFill()),a=Array(t).fill(0).map((s,o)=>o===0?_T.type(e).create(null,i):Dx.type(e).create(null,n));return Ud.type(e).create(null,a)}function kde(e){return(t,r)=>n=>{r=r??n.selection.from;let i=n.doc.resolve(r),a=sue(l=>l.type.name==="table")(i),s=a?{node:a.node,from:a.start}:void 0,o=e==="row";if(s){let l=ai.get(s.node);if(t>=0&&t<(o?l.height:l.width)){let u=l.positionAt(o?t:l.height-1,o?l.width-1:t,s.node),h=n.doc.resolve(s.from+u),f=o?Oi.rowSelection:Oi.colSelection,d=l.positionAt(o?t:0,o?0:t,s.node),p=n.doc.resolve(s.from+d);return IB(n.setSelection(f(h,p)))}}return n}}var Yft=kde("row"),Xft=kde("col");function Tde(e,t,{map:r,tableStart:n,table:i},a){let s=Array(a).fill(0).reduce((l,u,h)=>l+i.child(h).nodeSize,n),o=Array(r.width).fill(0).map((l,u)=>{let h=i.nodeAt(r.map[u]);return RT.type(e).createAndFill({alignment:h?.attrs.alignment})});return t.insert(s,Dx.type(e).create(null,o)),t}function jft(e){let t=Ix(e.$from);if(!t)return;let r=ai.get(t.node);return r.cellsInRect({left:0,right:r.width,top:0,bottom:r.height}).map(n=>{let i=t.node.nodeAt(n),a=n+t.start;return{pos:a,start:a+1,node:i}})}function Kft(e){let t=jft(e.selection);if(t&&t[0]){let r=e.doc.resolve(t[0].pos),n=t[t.length-1];if(n){let i=e.doc.resolve(n.pos);return IB(e.setSelection(new Oi(i,r)))}}return e}var rz=hn("GoToPrevTableCell",()=>()=>k$(-1));Kr(rz,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var nz=hn("GoToNextTableCell",()=>()=>k$(1));Kr(nz,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var iz=hn("ExitTable",e=>()=>(t,r)=>{if(!Sc(t))return!1;let{$head:n}=t.selection,i=aue(n,Ud.type(e));if(!i)return!1;let{to:a}=i,s=t.tr.replaceWith(a,a,rh.type(e).createAndFill());return s.setSelection(Vr.near(s.doc.resolve(a),1)).scrollIntoView(),r?.(s),!0});Kr(iz,{displayName:"Command<breakTableCommand>",group:"Table"});var Cde=hn("InsertTable",e=>({row:t,col:r}={})=>(n,i)=>{let{selection:a,tr:s}=n,{from:o}=a,l=wde(e,t,r),u=s.replaceSelectionWith(l),h=Vr.findFrom(u.doc.resolve(o),1,!0);return h&&u.setSelection(h),i?.(u),!0});Kr(Cde,{displayName:"Command<insertTableCommand>",group:"Table"});var Sde=hn("MoveRow",()=>({from:e,to:t,pos:r}={})=>Ufe({from:e??0,to:t??0,pos:r}));Kr(Sde,{displayName:"Command<moveRowCommand>",group:"Table"});var Ede=hn("MoveCol",()=>({from:e,to:t,pos:r}={})=>Yfe({from:e??0,to:t??0,pos:r}));Kr(Ede,{displayName:"Command<moveColCommand>",group:"Table"});var Ade=hn("SelectRow",()=>(e={index:0})=>(t,r)=>{let{tr:n}=t;return!!r?.(Yft(e.index,e.pos)(n))});Kr(Ade,{displayName:"Command<selectRowCommand>",group:"Table"});var _de=hn("SelectCol",()=>(e={index:0})=>(t,r)=>{let{tr:n}=t;return!!r?.(Xft(e.index,e.pos)(n))});Kr(_de,{displayName:"Command<selectColCommand>",group:"Table"});var Rde=hn("SelectTable",()=>()=>(e,t)=>{let{tr:r}=e;return!!t?.(Kft(r))});Kr(Rde,{displayName:"Command<selectTableCommand>",group:"Table"});var Lde=hn("DeleteSelectedCells",()=>()=>(e,t)=>{let{selection:r}=e;if(!(r instanceof Oi))return!1;let n=r.isRowSelection(),i=r.isColSelection();return n&&i?Hfe(e,t):i?qfe(e,t):Vfe(e,t)});Kr(Lde,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var Ide=hn("AddColBefore",()=>()=>zfe);Kr(Ide,{displayName:"Command<addColBeforeCommand>",group:"Table"});var Mde=hn("AddColAfter",()=>()=>Gfe);Kr(Mde,{displayName:"Command<addColAfterCommand>",group:"Table"});var Nde=hn("AddRowBefore",e=>()=>(t,r)=>{if(!Sc(t))return!1;if(r){let n=Wd(t);r(Tde(e,t.tr,n,n.top))}return!0});Kr(Nde,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var Dde=hn("AddRowAfter",e=>()=>(t,r)=>{if(!Sc(t))return!1;if(r){let n=Wd(t);r(Tde(e,t.tr,n,n.bottom))}return!0});Kr(Dde,{displayName:"Command<addRowAfterCommand>",group:"Table"});var Ode=hn("SetAlign",()=>(e="left")=>Wfe("alignment",e));Kr(Ode,{displayName:"Command<setAlignCommand>",group:"Table"});var Pde=Oo(e=>new Pa(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,r,n,i)=>{let a=t.doc.resolve(n);if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),Ud.type(e)))return null;let s=wde(e,Math.max(Number(r.groups?.row??0),2),Number(r.groups?.col)),o=t.tr.replaceRangeWith(n,i,s);return o.setSelection(Pr.create(o.doc,n+3)).scrollIntoView()}));Kr(Pde,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var Bde=Vhe(e=>({run:(t,r,n)=>{if(n)return t;function i(u){let h=u.childCount,f=u.lastChild?.childCount??0;if(h===0||f===0)return rh.type(e).create();let d=u.firstChild;if(!(f>0&&d&&d.childCount===0))return u;if(h>=3){let y=u.child(1),v=[];for(let C=0;C<y.childCount;C++){let T=y.child(C);v.push(Nx.type(e).create(T.attrs,T.content,T.marks))}let x=d.type.create(d.attrs,v),w=[];for(let C=2;C<h;C++)w.push(u.child(C));return u.type.create(u.attrs,[x,...w])}let p=Array(f).fill(0).map(()=>Nx.type(e).createAndFill()),m=new Xt(Lt.from(p),0,0),g=d.replace(0,0,m);return u.replace(0,d.nodeSize,new Xt(Lt.from(g),0,0))}function a(u){let h=Dx.type(e),f=[],d=[],p=!1;function m(){if(d.length===0)return;let g=_T.type(e).createAndFill(),y=Ud.type(e).create(null,[g,...d]);f.push(i(y)),d=[]}return u.forEach(g=>{g.type===h?(p=!0,d.push(g)):(m(),f.push(g))}),m(),p?Lt.from(f):u}function s(u){let h=a(u),f=h!==u,d=[];return h.forEach(p=>{if(p.type===Ud.type(e)){let m=i(p);m!==p&&(f=!0),d.push(m)}else if(p.childCount>0){let m=s(p.content);m!==p.content?(f=!0,d.push(p.copy(m))):d.push(p)}else d.push(p)}),f?Lt.from(d):u}function o(u){let h=[],f=[];u.forEach(d=>f.push(d));for(let d=0;d<f.length;d++){let p=f[d],m=f[d+1];p.type===rh.type(e)&&p.content.size===0&&m&&m.type===Ud.type(e)||h.push(p)}return h.length<f.length?Lt.from(h):u}let l=s(t.content);return l=o(l),new Xt(Lt.from(l),t.openStart,t.openEnd)}}));Kr(Bde,{displayName:"PasteRule<table>",group:"Table"});var az=nl("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{let t=e.get(Gn);return()=>t.call(nz.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{let t=e.get(Gn);return()=>t.call(rz.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{let t=e.get(Gn);return()=>t.call(iz.key)}}});Kr(az.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Kr(az.shortcuts,{displayName:"Keymap<table>",group:"Table"});var Z$="footnote_definition",xde="footnoteDefinition",sz=Ba("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${Z$}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{let t=e.attrs.label;return["dl",{"data-label":t,"data-type":Z$},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===xde,runner:(e,t,r)=>{e.openNode(r,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===Z$,runner:(e,t)=>{e.openNode(xde,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));Kr(sz.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Kr(sz.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var Q$="footnote_reference",oz=Ba("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${Q$}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{label:e.dataset.label}}}],toDOM:e=>{let t=e.attrs.label;return["sup",{"data-label":t,"data-type":Q$},t]},parseMarkdown:{match:({type:e})=>e==="footnoteReference",runner:(e,t,r)=>{e.addNode(r,{label:t.label})}},toMarkdown:{match:e=>e.type.name===Q$,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));Kr(oz.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Kr(oz.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var lz=Kh.extendSchema(e=>t=>{let r=e(t);return{...r,attrs:{...r.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:n=>{if(!(n instanceof HTMLElement))throw su(n);return{label:n.dataset.label,listType:n.dataset.listType,spread:n.dataset.spread,checked:n.dataset.checked?n.dataset.checked==="true":null}}},...r?.parseDOM||[]],toDOM:n=>r.toDOM&&n.attrs.checked==null?r.toDOM(n):["li",{"data-item-type":"task","data-label":n.attrs.label,"data-list-type":n.attrs.listType,"data-spread":n.attrs.spread,"data-checked":n.attrs.checked},0],parseMarkdown:{match:({type:n})=>n==="listItem",runner:(n,i,a)=>{if(i.checked==null){r.parseMarkdown.runner(n,i,a);return}let s=i.label!=null?`${i.label}.`:"\u2022",o=i.checked!=null?!!i.checked:null,l=i.label!=null?"ordered":"bullet",u=i.spread!=null?`${i.spread}`:"true";n.openNode(a,{label:s,listType:l,spread:u,checked:o}),n.next(i.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="list_item",runner:(n,i)=>{if(i.attrs.checked==null){r.toMarkdown.runner(n,i);return}let a=i.attrs.label,s=i.attrs.listType,o=i.attrs.spread==="true",l=i.attrs.checked;n.openNode("listItem",void 0,{label:a,listType:s,spread:o,checked:l}),n.next(i.content),n.closeNode()}}}});Kr(lz.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Kr(lz.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var Fde=Oo(()=>new Pa(/^\[(?<checked>\s|x)\]\s$/,(e,t,r,n)=>{let i=e.doc.resolve(r),a=0,s=i.node(a);for(;s&&s.type.name!=="list_item";)a--,s=i.node(a);if(!s||s.attrs.checked!=null)return null;let o=t.groups?.checked==="x",l=i.before(a),u=e.tr;return u.deleteRange(r,n).setNodeMarkup(l,void 0,{...s.attrs,checked:o}),u}));Kr(Fde,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var Zft=[tz,az].flat(),Qft=[Pde,Fde],Jft=[bde],edt=[Bde],$de=rl(()=>Jfe);Kr($de,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var tdt=rl(()=>jfe({}));Kr(tdt,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var zde=rl(()=>Zfe({allowTableNodeSelection:!0}));Kr(zde,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var cz=qd("remarkGFM",()=>_7);Kr(cz.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Kr(cz.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var rdt=new Hi("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function ndt(e,t){let r=0;return t.forEach((n,i,a)=>{n===e&&(r=a)}),r}var Gde=rl(()=>new Ci({key:rdt,appendTransaction:(e,t,r)=>{let n,i=(a,s)=>{if(n||(n=r.tr),a.type.name!=="table_cell")return;let o=r.doc.resolve(s),l=o.node(o.depth),u=o.node(o.depth-1).firstChild;if(!u)return;let h=ndt(a,l),f=u.maybeChild(h);if(!f)return;let d=f.attrs.alignment;d!==a.attrs.alignment&&n.setNodeMarkup(s,void 0,{...a.attrs,alignment:d})};return t.doc!==r.doc&&r.doc.descendants(i),n}}));Kr(Gde,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var idt=[Gde,$de,cz,zde].flat(),adt=[lz,Ud,_T,Dx,Nx,RT,sz,oz,J$,ET].flat(),sdt=[nz,rz,iz,Cde,Sde,Ede,Ade,_de,Rde,Lde,Nde,Dde,Ide,Mde,Ode,ez],qde=[adt,Qft,edt,Jft,Zft,sdt,idt].flat();si();var Aye=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},t5=bn(new Aye,"listener"),C2t=new Hi("MILKDOWN_LISTENER"),dG=e=>(e.inject(t5,new Aye),async()=>{await e.wait(eh);let{listeners:t}=e.get(t5);t.beforeMount.forEach(u=>u(e)),await e.wait(bx);let r=e.get(Gp),n=null,i=null,a=null,s=null,o=Jz(()=>{if(!s)return;let{doc:u}=s;if(t.updated.length>0&&n&&!n.eq(u)&&t.updated.forEach(h=>{h(e,u,n)}),t.markdownUpdated.length>0&&n&&!n.eq(u)){let h=r(u);t.markdownUpdated.forEach(f=>{f(e,h,i)}),i=h}n=u,s=null},200),l=new Ci({key:C2t,view:()=>({destroy:()=>{o.cancel(),t.destroy.forEach(u=>u(e))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(u=>u(e)),!1),blur:()=>(t.blur.forEach(u=>u(e)),!1)}},state:{init:(u,h)=>{n=h.doc,i=r(h.doc)},apply:u=>{let h=u.selection;(!a&&h||a&&!h.eq(a))&&(t.selectionUpdated.forEach(f=>{f(e,h,a)}),a=h),!(!(u.docChanged||u.storedMarksSet)||u.getMeta("addToHistory")===!1)&&(s=u,o())}}});e.update(fu,u=>u.concat(l)),await e.wait(mT),t.mounted.forEach(u=>u(e))});dG.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};function pG(e){return new Promise(t=>{let r=new FileReader;r.addEventListener("load",()=>{t({alt:e.name,src:r.result})},!1),r.readAsDataURL(e)})}var S2t=async(e,t)=>{let r=[];for(let i=0;i<e.length;i++){let a=e.item(i);a&&a.type.includes("image")&&r.push(a)}let{image:n}=t.nodes;if(!n)throw lE("image");return(await Promise.all(r.map(i=>pG(i)))).map(({alt:i,src:a})=>n.createAndFill({src:a,alt:i}))},ny=th({uploader:S2t,enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{let r=document.createElement("span");return r.textContent="Upload in progress...",mi.widget(e,r,t)}},"uploadConfig");ny.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var _ye=rl(e=>{let t=new Hi("MILKDOWN_UPLOAD"),r=(i,a)=>{let s=t.getState(i);if(!s)return-1;let o=s.find(void 0,void 0,l=>l.id===a);return o.length?o[0]?.from??-1:-1},n=(i,a,s)=>{if(!s||s.length<=0)return!1;let o=Symbol("upload symbol"),l=e.get(eo),{uploader:u,getInsertPos:h}=e.get(ny.key),{tr:f}=i.state,d=a instanceof DragEvent?i.posAtCoords({left:a.clientX,top:a.clientY})?.pos??f.selection.from:f.selection.from,p=typeof h=="function"?h(a,e,d):d;return i.dispatch(f.setMeta(t,{add:{id:o,pos:p}})),u(s,l,e,p).then(m=>{let g=r(i.state,o);g<0||i.dispatch(i.state.tr.replaceWith(g,g,m).setMeta(t,{remove:{id:o}}))}).catch(m=>{console.error(m)}),!0};return new Ci({key:t,state:{init(){return Ui.empty},apply(i,a){let s=a.map(i.mapping,i.doc),o=i.getMeta(this);if(!o)return s;if(o.add){let{uploadWidgetFactory:l}=e.get(ny.key),u=l(o.add.pos,{id:o.add.id});return s.add(i.doc,[u])}if(o.remove){let l=s.find(void 0,void 0,u=>u.id===o.remove.id);return s.remove(l)}return s}},props:{decorations(i){return this.getState(i)},handlePaste:(i,a)=>{let{enableHtmlFileUploader:s}=e.get(ny.key);return!(a instanceof ClipboardEvent)||!s&&a.clipboardData?.getData("text/html")?!1:n(i,a,a.clipboardData?.files)},handleDrop:(i,a)=>a instanceof DragEvent?n(i,a,a.dataTransfer?.files):!1}})});_ye.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var Rye=[ny,_ye];var mG=(e=>(e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e))(mG||{}),R8=class extends Error{constructor(t,r){super(r),this.name="MilkdownError",this.code=t}},E2t=(e,t)=>typeof t=="function"?"[Function]":t,A2t=e=>JSON.stringify(e,E2t);function Lye(e){return new R8(mG.expectDomTypeError,`Expect to be a dom, but get: ${A2t(e)}.`)}function Iye(e){return new R8(mG.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}var q8r=f7("abcedfghicklmn",10);function gG(e){let t=r=>async()=>{await r.wait(Js);let n=e(r);return r.update($d,i=>[...i,n]),t.inputRule=n,()=>{r.update($d,i=>i.filter(a=>a!==n))}};return t}function _2t(e,t){let r=n=>async()=>{let i=t(n);return n.update(jh,a=>[...a.filter(s=>s[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{n.update(jh,a=>a.filter(([s])=>s!==e))}};return r.type=n=>{let i=n.get(eo).nodes[e];if(!i)throw Iye(e);return i},r}function L8(e,t){let r=bn(e,t),n=i=>(i.inject(r),()=>()=>{i.remove(r)});return n.key=r,n}function yG(e,t){let r=L8(t,e),n=_2t(e,a=>a.get(r.key)(a)),i=[r,n];return i.id=n.id,i.node=n,i.type=a=>n.type(a),i.schema=n.schema,i.ctx=r,i.key=r.key,i.extendSchema=a=>s=>()=>{let o=s.get(r.key),l=a(o)(s);s.update(jh,u=>[...u.filter(h=>h[0]!==e),[e,l]]),i.schema=l},i}function Mye(e,t,r){let n=L8(r??{},e),i=s=>async()=>{await s.wait(eh);let o={plugin:t(s),options:s.get(n.key)};return s.update(zd,l=>[...l,o]),()=>{s.update(zd,l=>l.filter(u=>u!==o))}},a=[n,i];return a.id=e,a.plugin=i,a.options=n,a}var $t=class e extends Error{constructor(t,r){var n="KaTeX parse error: "+t,i,a,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;i=s.start,a=s.end,i===o.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=o.slice(i,a).replace(/[^]/g,"$&\u0332"),u;i>15?u="\u2026"+o.slice(i-15,i):u=o.slice(0,i);var h;a+15<o.length?h=o.slice(a,a+15)+"\u2026":h=o.slice(a),n+=u+l+h}super(n),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},R2t=/([A-Z])/g,L2t=e=>e.replace(R2t,"-$1").toLowerCase(),I2t={"&":"&",">":">","<":"<",'"':""","'":"'"},M2t=/[&><"']/g,Fo=e=>String(e).replace(M2t,t=>I2t[t]),G8=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?G8(e.body[0]):e:e.type==="font"?G8(e.body):e,N2t=new Set(["mathord","textord","atom"]),n0=e=>N2t.has(G8(e).type),D2t=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},MG={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function O2t(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function P2t(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return O2t(t)}function B2t(e,t,r,n){var i=r[t];e[t]=i!==void 0?n.processor?n.processor(i):i:P2t(n)}var s5=class{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r of Object.keys(MG)){var n=MG[r];n&&B2t(this,r,t,n)}}reportNonstrict(t,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(t,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new $t("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,n){var i=this.strict;if(typeof i=="function")try{i=i(t,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var r=D2t(t.url);if(r==null)return!1;t.protocol=r}var n=typeof this.trust=="function"?this.trust(t):this.trust;return!!n}},of=class{constructor(t,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=n}sup(){return lf[F2t[this.id]]}sub(){return lf[$2t[this.id]]}fracNum(){return lf[z2t[this.id]]}fracDen(){return lf[G2t[this.id]]}cramp(){return lf[q2t[this.id]]}text(){return lf[V2t[this.id]]}isTight(){return this.size>=2}},JG=0,V8=1,lb=2,r0=3,o5=4,xu=5,cb=6,ol=7,lf=[new of(JG,0,!1),new of(V8,0,!0),new of(lb,1,!1),new of(r0,1,!0),new of(o5,2,!1),new of(xu,2,!0),new of(cb,3,!1),new of(ol,3,!0)],F2t=[o5,xu,o5,xu,cb,ol,cb,ol],$2t=[xu,xu,xu,xu,ol,ol,ol,ol],z2t=[lb,r0,o5,xu,cb,ol,cb,ol],G2t=[r0,r0,xu,xu,ol,ol,ol,ol],q2t=[V8,V8,r0,r0,xu,xu,ol,ol],V2t=[JG,V8,lb,r0,lb,r0,lb,r0],dn={DISPLAY:lf[JG],TEXT:lf[lb],SCRIPT:lf[o5],SCRIPTSCRIPT:lf[cb]},NG=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function W2t(e){for(var t=0;t<NG.length;t++)for(var r=NG[t],n=0;n<r.blocks.length;n++){var i=r.blocks[n];if(e>=i[0]&&e<=i[1])return r.name}return null}var q8=[];NG.forEach(e=>e.blocks.forEach(t=>q8.push(...t)));function pve(e){for(var t=0;t<q8.length;t+=2)if(e>=q8[t]&&e<=q8[t+1])return!0;return!1}var fs=e=>e+" "+e,ob=80,H2t=function(t,r){return"M95,"+(622+t+r)+` +`))}function l(p,m,g,y){let v=g.enter("tableCell"),x=g.enter("phrasing"),w=g.containerPhrasing(p,{...y,before:a,after:a});return x(),v(),w}function u(p,m){return ode(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function h(p,m,g){let y=p.children,v=-1,x=[],w=m.enter("table");for(;++v<y.length;)x[v]=f(y[v],m,g);return w(),x}function f(p,m,g){let y=p.children,v=-1,x=[],w=m.enter("tableRow");for(;++v<y.length;)x[v]=l(y[v],p,m,g);return w(),x}function d(p,m,g){let y=y1.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function q$(){return{exit:{taskListCheckValueChecked:cde,taskListCheckValueUnchecked:cde,paragraph:Cft}}}function V$(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Sft}}}function cde(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Cft(e){let t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){let r=this.stack[this.stack.length-1];r.type;let n=r.children[0];if(n&&n.type==="text"){let i=t.children,a=-1,s;for(;++a<i.length;){let o=i[a];if(o.type==="paragraph"){s=o;break}}s===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Sft(e,t,r,n){let i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",o=r.createTracker(n);a&&o.move(s);let l=y1.listItem(e,t,r,{...n,...o.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+s}}function W$(){return[N$(),O$(),B$(),z$(),q$()]}function H$(e){return{extensions:[D$(),P$(e),F$(),G$(e),V$()]}}var Eft={tokenize:Ift,partial:!0},ude={tokenize:Mft,partial:!0},hde={tokenize:Nft,partial:!0},fde={tokenize:Dft,partial:!0},Aft={tokenize:Oft,partial:!0},dde={name:"wwwAutolink",tokenize:Rft,previous:mde},pde={name:"protocolAutolink",tokenize:Lft,previous:gde},Hd={name:"emailAutolink",tokenize:_ft,previous:yde},Zh={};function Y$(){return{text:Zh}}var U1=48;for(;U1<123;)Zh[U1]=Hd,U1++,U1===58?U1=65:U1===91&&(U1=97);Zh[43]=Hd;Zh[45]=Hd;Zh[46]=Hd;Zh[95]=Hd;Zh[72]=[Hd,pde];Zh[104]=[Hd,pde];Zh[87]=[Hd,dde];Zh[119]=[Hd,dde];function _ft(e,t,r){let n=this,i,a;return s;function s(f){return!U$(f)||!yde.call(n,n.previous)||X$(n.events)?r(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(f))}function o(f){return U$(f)?(e.consume(f),o):f===64?(e.consume(f),l):r(f)}function l(f){return f===46?e.check(Aft,h,u)(f):f===45||f===95||hs(f)?(a=!0,e.consume(f),l):h(f)}function u(f){return e.consume(f),i=!0,l}function h(f){return a&&i&&us(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):r(f)}}function Rft(e,t,r){let n=this;return i;function i(s){return s!==87&&s!==119||!mde.call(n,n.previous)||X$(n.events)?r(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Eft,e.attempt(ude,e.attempt(hde,a),r),r)(s))}function a(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function Lft(e,t,r){let n=this,i="",a=!1;return s;function s(f){return(f===72||f===104)&&gde.call(n,n.previous)&&!X$(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),o):r(f)}function o(f){if(us(f)&&i.length<5)return i+=String.fromCodePoint(f),e.consume(f),o;if(f===58){let d=i.toLowerCase();if(d==="http"||d==="https")return e.consume(f),l}return r(f)}function l(f){return f===47?(e.consume(f),a?u:(a=!0,l)):r(f)}function u(f){return f===null||c1(f)||_n(f)||Wh(f)||u1(f)?r(f):e.attempt(ude,e.attempt(hde,h),r)(f)}function h(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function Ift(e,t,r){let n=0;return i;function i(s){return(s===87||s===119)&&n<3?(n++,e.consume(s),i):s===46&&n===3?(e.consume(s),a):r(s)}function a(s){return s===null?r(s):t(s)}}function Mft(e,t,r){let n,i,a;return s;function s(u){return u===46||u===95?e.check(fde,l,o)(u):u===null||_n(u)||Wh(u)||u!==45&&u1(u)?l(u):(a=!0,e.consume(u),s)}function o(u){return u===95?n=!0:(i=n,n=void 0),e.consume(u),s}function l(u){return i||n||!a?r(u):t(u)}}function Nft(e,t){let r=0,n=0;return i;function i(s){return s===40?(r++,e.consume(s),i):s===41&&n<r?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(fde,t,a)(s):s===null||_n(s)||Wh(s)?t(s):(e.consume(s),i)}function a(s){return s===41&&n++,e.consume(s),i}}function Dft(e,t,r){return n;function n(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),n):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||_n(o)||Wh(o)?t(o):r(o)}function i(o){return o===null||o===40||o===91||_n(o)||Wh(o)?t(o):n(o)}function a(o){return us(o)?s(o):r(o)}function s(o){return o===59?(e.consume(o),n):us(o)?(e.consume(o),s):r(o)}}function Oft(e,t,r){return n;function n(a){return e.consume(a),i}function i(a){return hs(a)?r(a):t(a)}}function mde(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||_n(e)}function gde(e){return!us(e)}function yde(e){return!(e===47||U$(e))}function U$(e){return e===43||e===45||e===46||e===95||hs(e)}function X$(e){let t=e.length,r=!1;for(;t--;){let n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}var Pft={tokenize:Vft,partial:!0};function j$(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:zft,continuation:{tokenize:Gft},exit:qft}},text:{91:{name:"gfmFootnoteCall",tokenize:$ft},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Bft,resolveTo:Fft}}}}function Bft(e,t,r){let n=this,i=n.events.length,a=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),s;for(;i--;){let l=n.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!s||!s._balanced)return r(l);let u=Lo(n.sliceSerialize({start:s.end,end:n.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?r(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Fft(e,t){let r=e.length,n;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){n=e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";let i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",i,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(r,e.length-r+1,...l),e}function $ft(e,t,r){let n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),a=0,s;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?r(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(a>999||f===93&&!s||f===null||f===91||_n(f))return r(f);if(f===93){e.exit("chunkString");let d=e.exit("gfmFootnoteCallString");return i.includes(Lo(n.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(f)}return _n(f)||(s=!0),a++,e.consume(f),f===92?h:u}function h(f){return f===91||f===92||f===93?(e.consume(f),a++,u):u(f)}}function zft(e,t,r){let n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),a,s=0,o;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):r(m)}function h(m){if(s>999||m===93&&!o||m===null||m===91||_n(m))return r(m);if(m===93){e.exit("chunkString");let g=e.exit("gfmFootnoteDefinitionLabelString");return a=Lo(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return _n(m)||(o=!0),s++,e.consume(m),m===92?f:h}function f(m){return m===91||m===92||m===93?(e.consume(m),s++,h):h(m)}function d(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(a)||i.push(a),kr(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function Gft(e,t,r){return e.check(Hh,t,e.attempt(Pft,t,r))}function qft(e){e.exit("gfmFootnoteDefinition")}function Vft(e,t,r){let n=this;return kr(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){let s=n.events[n.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(a):r(a)}}function K$(e){let r=(e||{}).singleTilde,n={name:"strikethrough",tokenize:a,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(s,o){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let u=l;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[l][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";let h={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[l][1].end)},f={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[l][1].start)},d=[["enter",h,o],["enter",s[u][1],o],["exit",s[u][1],o],["enter",f,o]],p=o.parser.constructs.insideSpan.null;p&&Oa(d,d.length,0,_p(p,s.slice(u+1,l),o)),Oa(d,d.length,0,[["exit",f,o],["enter",s[l][1],o],["exit",s[l][1],o],["exit",h,o]]),Oa(s,u-1,l-u+3,d),l=u+d.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function a(s,o,l){let u=this.previous,h=this.events,f=0;return d;function d(m){return u===126&&h[h.length-1][1].type!=="characterEscape"?l(m):(s.enter("strikethroughSequenceTemporary"),p(m))}function p(m){let g=Rd(u);if(m===126)return f>1?l(m):(s.consume(m),f++,p);if(f<2&&!r)return l(m);let y=s.exit("strikethroughSequenceTemporary"),v=Rd(m);return y._open=!v||v===2&&!!g,y._close=!g||g===2&&!!v,o(m)}}}var E7=class{constructor(){this.map=[]}add(t,r,n){Wft(this,t,r,n)}consume(t){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let r=this.map.length,n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(let a of i)t.push(a);i=n.pop()}this.map.length=0}};function Wft(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}function vde(e,t){let r=!1,n=[];for(;t<e.length;){let i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){let a=n.length-1;n[a]=n[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function Z$(){return{flow:{null:{name:"table",tokenize:Hft,resolveAll:Uft}}}}function Hft(e,t,r){let n=this,i=0,a=0,s;return o;function o(L){let O=n.events.length-1;for(;O>-1;){let N=n.events[O][1].type;if(N==="lineEnding"||N==="linePrefix")O--;else break}let R=O>-1?n.events[O][1].type:null,A=R==="tableHead"||R==="tableRow"?k:l;return A===k&&n.parser.lazy[n.now().line]?r(L):A(L)}function l(L){return e.enter("tableHead"),e.enter("tableRow"),u(L)}function u(L){return L===124||(s=!0,a+=1),h(L)}function h(L){return L===null?r(L):Kt(L)?a>1?(a=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),p):r(L):Or(L)?kr(e,h,"whitespace")(L):(a+=1,s&&(s=!1,i+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),s=!0,h):(e.enter("data"),f(L)))}function f(L){return L===null||L===124||_n(L)?(e.exit("data"),h(L)):(e.consume(L),L===92?d:f)}function d(L){return L===92||L===124?(e.consume(L),f):f(L)}function p(L){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(L):(e.enter("tableDelimiterRow"),s=!1,Or(L)?kr(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):m(L))}function m(L){return L===45||L===58?y(L):L===124?(s=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),g):T(L)}function g(L){return Or(L)?kr(e,y,"whitespace")(L):y(L)}function y(L){return L===58?(a+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),v):L===45?(a+=1,v(L)):L===null||Kt(L)?C(L):T(L)}function v(L){return L===45?(e.enter("tableDelimiterFiller"),x(L)):T(L)}function x(L){return L===45?(e.consume(L),x):L===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(L))}function w(L){return Or(L)?kr(e,C,"whitespace")(L):C(L)}function C(L){return L===124?m(L):L===null||Kt(L)?!s||i!==a?T(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):T(L)}function T(L){return r(L)}function k(L){return e.enter("tableRow"),S(L)}function S(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),S):L===null||Kt(L)?(e.exit("tableRow"),t(L)):Or(L)?kr(e,S,"whitespace")(L):(e.enter("data"),E(L))}function E(L){return L===null||L===124||_n(L)?(e.exit("data"),S(L)):(e.consume(L),L===92?I:E)}function I(L){return L===92||L===124?(e.consume(L),E):E(L)}}function Uft(e,t){let r=-1,n=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],o=!1,l=0,u,h,f,d=new E7;for(;++r<e.length;){let p=e[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(o=!1,l!==0&&(xde(d,t,l,u,h),h=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,f=void 0,a=[0,0,0,0],s=[0,r+1,0,0],o&&(o=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],f=A7(d,t,a,i,void 0,f),a=[0,0,0,0]),s[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(a[1]!==0&&(s[0]=s[1],f=A7(d,t,a,i,void 0,f)),a=s,s=[a[1],r,0,0])):m.type==="tableHead"?(o=!0,l=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=r,a[1]!==0?(s[0]=s[1],f=A7(d,t,a,i,r,f)):s[1]!==0&&(f=A7(d,t,s,i,r,f)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=r)}for(l!==0&&xde(d,t,l,u,h),d.consume(t.events),r=-1;++r<t.events.length;){let p=t.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=vde(t.events,r))}return e}function A7(e,t,r,n,i,a){let s=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",o="tableContent";r[0]!==0&&(a.end=Object.assign({},Mx(t.events,r[0])),e.add(r[0],0,[["exit",a,t]]));let l=Mx(t.events,r[1]);if(a={type:s,start:Object.assign({},l),end:Object.assign({},l)},e.add(r[1],0,[["enter",a,t]]),r[2]!==0){let u=Mx(t.events,r[2]),h=Mx(t.events,r[3]),f={type:o,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(r[2],0,[["enter",f,t]]),n!==2){let d=t.events[r[2]],p=t.events[r[3]];if(d[1].end=Object.assign({},p[1].end),d[1].type="chunkText",d[1].contentType="text",r[3]>r[2]+1){let m=r[2]+1,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",f,t]])}return i!==void 0&&(a.end=Object.assign({},Mx(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function xde(e,t,r,n,i){let a=[],s=Mx(t.events,r);i&&(i.end=Object.assign({},s),a.push(["exit",i,t])),n.end=Object.assign({},s),a.push(["exit",n,t]),e.add(r+1,0,a)}function Mx(e,t){let r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}var Yft={name:"tasklistCheck",tokenize:Xft};function Q$(){return{text:{91:Yft}}}function Xft(e,t,r){let n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),a)}function a(l){return _n(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),s):r(l)}function s(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(l)}function o(l){return Kt(l)?t(l):Or(l)?e.check({tokenize:jft},t,r)(l):r(l)}}function jft(e,t,r){return kr(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function bde(e){return cE([Y$(),j$(),K$(e),Z$(),Q$()])}var Kft={};function _7(e){let t=this,r=e||Kft,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(bde(r)),a.push(W$()),s.push(H$(r))}function Kr(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var tz=q1("strike_through");Kr(tz,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var ET=qp("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:t=>t==="line-through"}],toDOM:t=>["del",e.get(tz.key)(t)],parseMarkdown:{match:t=>t.type==="delete",runner:(t,r,n)=>{t.openMark(n),t.next(r.children),t.closeMark(n)}},toMarkdown:{match:t=>t.type.name==="strike_through",runner:(t,r)=>{t.withMark(r,"delete")}}}));Kr(ET.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Kr(ET.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var rz=hn("ToggleStrikeThrough",e=>()=>fx(ET.type(e)));Kr(rz,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var kde=Oo(e=>R1(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)/,ET.type(e)));Kr(kde,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var nz=il("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{let t=e.get(Gn);return()=>t.call(rz.key)}}});Kr(nz.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Kr(nz.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var AT=Dfe({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),Ud=Ba("table",()=>({...AT.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="table",runner:(e,t,r)=>{let n=t.align,i=t.children.map((a,s)=>({...a,align:n,isHeader:s===0}));e.openNode(r),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table",runner:(e,t)=>{let r=t.content.firstChild?.content;if(!r)return;let n=[];r.forEach(i=>{n.push(i.attrs.alignment)}),e.openNode("table",void 0,{align:n}),e.next(t.content),e.closeNode()}}}));Kr(Ud.node,{displayName:"NodeSchema<table>",group:"Table"});Kr(Ud.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var _T=Ba("table_header_row",()=>({...AT.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&e.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:e=>!!(e.type==="tableRow"&&e.isHeader),runner:(e,t,r)=>{let n=t.align,i=t.children.map((a,s)=>({...a,align:n[s],isHeader:t.isHeader}));e.openNode(r),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));Kr(_T.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Kr(_T.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Dx=Ba("table_row",()=>({...AT.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>e.type==="tableRow",runner:(e,t,r)=>{let n=t.align,i=t.children.map((a,s)=>({...a,align:n[s]}));e.openNode(r),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_row",runner:(e,t)=>{t.content.size!==0&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));Kr(Dx.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Kr(Dx.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var RT=Ba("table_cell",()=>({...AT.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!e.isHeader,runner:(e,t,r)=>{let n=t.align;e.openNode(r,{alignment:n}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>e.type.name==="table_cell",runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));Kr(RT.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Kr(RT.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Nx=Ba("table_header",()=>({...AT.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>e.type==="tableCell"&&!!e.isHeader,runner:(e,t,r)=>{let n=t.align;e.openNode(r,{alignment:n}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="table_header",runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));Kr(Nx.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Kr(Nx.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function Tde(e,t=3,r=3){let n=Array(r).fill(0).map(()=>RT.type(e).createAndFill()),i=Array(r).fill(0).map(()=>Nx.type(e).createAndFill()),a=Array(t).fill(0).map((s,o)=>o===0?_T.type(e).create(null,i):Dx.type(e).create(null,n));return Ud.type(e).create(null,a)}function Cde(e){return(t,r)=>n=>{r=r??n.selection.from;let i=n.doc.resolve(r),a=lue(l=>l.type.name==="table")(i),s=a?{node:a.node,from:a.start}:void 0,o=e==="row";if(s){let l=ai.get(s.node);if(t>=0&&t<(o?l.height:l.width)){let u=l.positionAt(o?t:l.height-1,o?l.width-1:t,s.node),h=n.doc.resolve(s.from+u),f=o?Oi.rowSelection:Oi.colSelection,d=l.positionAt(o?t:0,o?0:t,s.node),p=n.doc.resolve(s.from+d);return NB(n.setSelection(f(h,p)))}}return n}}var Zft=Cde("row"),Qft=Cde("col");function Sde(e,t,{map:r,tableStart:n,table:i},a){let s=Array(a).fill(0).reduce((l,u,h)=>l+i.child(h).nodeSize,n),o=Array(r.width).fill(0).map((l,u)=>{let h=i.nodeAt(r.map[u]);return RT.type(e).createAndFill({alignment:h?.attrs.alignment})});return t.insert(s,Dx.type(e).create(null,o)),t}function Jft(e){let t=Ix(e.$from);if(!t)return;let r=ai.get(t.node);return r.cellsInRect({left:0,right:r.width,top:0,bottom:r.height}).map(n=>{let i=t.node.nodeAt(n),a=n+t.start;return{pos:a,start:a+1,node:i}})}function edt(e){let t=Jft(e.selection);if(t&&t[0]){let r=e.doc.resolve(t[0].pos),n=t[t.length-1];if(n){let i=e.doc.resolve(n.pos);return NB(e.setSelection(new Oi(i,r)))}}return e}var iz=hn("GoToPrevTableCell",()=>()=>C$(-1));Kr(iz,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var az=hn("GoToNextTableCell",()=>()=>C$(1));Kr(az,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var sz=hn("ExitTable",e=>()=>(t,r)=>{if(!Sc(t))return!1;let{$head:n}=t.selection,i=oue(n,Ud.type(e));if(!i)return!1;let{to:a}=i,s=t.tr.replaceWith(a,a,rh.type(e).createAndFill());return s.setSelection(Vr.near(s.doc.resolve(a),1)).scrollIntoView(),r?.(s),!0});Kr(sz,{displayName:"Command<breakTableCommand>",group:"Table"});var Ede=hn("InsertTable",e=>({row:t,col:r}={})=>(n,i)=>{let{selection:a,tr:s}=n,{from:o}=a,l=Tde(e,t,r),u=s.replaceSelectionWith(l),h=Vr.findFrom(u.doc.resolve(o),1,!0);return h&&u.setSelection(h),i?.(u),!0});Kr(Ede,{displayName:"Command<insertTableCommand>",group:"Table"});var Ade=hn("MoveRow",()=>({from:e,to:t,pos:r}={})=>Xfe({from:e??0,to:t??0,pos:r}));Kr(Ade,{displayName:"Command<moveRowCommand>",group:"Table"});var _de=hn("MoveCol",()=>({from:e,to:t,pos:r}={})=>jfe({from:e??0,to:t??0,pos:r}));Kr(_de,{displayName:"Command<moveColCommand>",group:"Table"});var Rde=hn("SelectRow",()=>(e={index:0})=>(t,r)=>{let{tr:n}=t;return!!r?.(Zft(e.index,e.pos)(n))});Kr(Rde,{displayName:"Command<selectRowCommand>",group:"Table"});var Lde=hn("SelectCol",()=>(e={index:0})=>(t,r)=>{let{tr:n}=t;return!!r?.(Qft(e.index,e.pos)(n))});Kr(Lde,{displayName:"Command<selectColCommand>",group:"Table"});var Ide=hn("SelectTable",()=>()=>(e,t)=>{let{tr:r}=e;return!!t?.(edt(r))});Kr(Ide,{displayName:"Command<selectTableCommand>",group:"Table"});var Mde=hn("DeleteSelectedCells",()=>()=>(e,t)=>{let{selection:r}=e;if(!(r instanceof Oi))return!1;let n=r.isRowSelection(),i=r.isColSelection();return n&&i?Yfe(e,t):i?Wfe(e,t):Hfe(e,t)});Kr(Mde,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var Nde=hn("AddColBefore",()=>()=>qfe);Kr(Nde,{displayName:"Command<addColBeforeCommand>",group:"Table"});var Dde=hn("AddColAfter",()=>()=>Vfe);Kr(Dde,{displayName:"Command<addColAfterCommand>",group:"Table"});var Ode=hn("AddRowBefore",e=>()=>(t,r)=>{if(!Sc(t))return!1;if(r){let n=Wd(t);r(Sde(e,t.tr,n,n.top))}return!0});Kr(Ode,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var Pde=hn("AddRowAfter",e=>()=>(t,r)=>{if(!Sc(t))return!1;if(r){let n=Wd(t);r(Sde(e,t.tr,n,n.bottom))}return!0});Kr(Pde,{displayName:"Command<addRowAfterCommand>",group:"Table"});var Bde=hn("SetAlign",()=>(e="left")=>Ufe("alignment",e));Kr(Bde,{displayName:"Command<setAlignCommand>",group:"Table"});var Fde=Oo(e=>new Pa(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,r,n,i)=>{let a=t.doc.resolve(n);if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),Ud.type(e)))return null;let s=Tde(e,Math.max(Number(r.groups?.row??0),2),Number(r.groups?.col)),o=t.tr.replaceRangeWith(n,i,s);return o.setSelection(Pr.create(o.doc,n+3)).scrollIntoView()}));Kr(Fde,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var $de=Hhe(e=>({run:(t,r,n)=>{if(n)return t;function i(u){let h=u.childCount,f=u.lastChild?.childCount??0;if(h===0||f===0)return rh.type(e).create();let d=u.firstChild;if(!(f>0&&d&&d.childCount===0))return u;if(h>=3){let y=u.child(1),v=[];for(let C=0;C<y.childCount;C++){let T=y.child(C);v.push(Nx.type(e).create(T.attrs,T.content,T.marks))}let x=d.type.create(d.attrs,v),w=[];for(let C=2;C<h;C++)w.push(u.child(C));return u.type.create(u.attrs,[x,...w])}let p=Array(f).fill(0).map(()=>Nx.type(e).createAndFill()),m=new Xt(Lt.from(p),0,0),g=d.replace(0,0,m);return u.replace(0,d.nodeSize,new Xt(Lt.from(g),0,0))}function a(u){let h=Dx.type(e),f=[],d=[],p=!1;function m(){if(d.length===0)return;let g=_T.type(e).createAndFill(),y=Ud.type(e).create(null,[g,...d]);f.push(i(y)),d=[]}return u.forEach(g=>{g.type===h?(p=!0,d.push(g)):(m(),f.push(g))}),m(),p?Lt.from(f):u}function s(u){let h=a(u),f=h!==u,d=[];return h.forEach(p=>{if(p.type===Ud.type(e)){let m=i(p);m!==p&&(f=!0),d.push(m)}else if(p.childCount>0){let m=s(p.content);m!==p.content?(f=!0,d.push(p.copy(m))):d.push(p)}else d.push(p)}),f?Lt.from(d):u}function o(u){let h=[],f=[];u.forEach(d=>f.push(d));for(let d=0;d<f.length;d++){let p=f[d],m=f[d+1];p.type===rh.type(e)&&p.content.size===0&&m&&m.type===Ud.type(e)||h.push(p)}return h.length<f.length?Lt.from(h):u}let l=s(t.content);return l=o(l),new Xt(Lt.from(l),t.openStart,t.openEnd)}}));Kr($de,{displayName:"PasteRule<table>",group:"Table"});var oz=il("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{let t=e.get(Gn);return()=>t.call(az.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{let t=e.get(Gn);return()=>t.call(iz.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{let t=e.get(Gn);return()=>t.call(sz.key)}}});Kr(oz.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Kr(oz.shortcuts,{displayName:"Keymap<table>",group:"Table"});var J$="footnote_definition",wde="footnoteDefinition",lz=Ba("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${J$}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{let t=e.attrs.label;return["dl",{"data-label":t,"data-type":J$},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===wde,runner:(e,t,r)=>{e.openNode(r,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===J$,runner:(e,t)=>{e.openNode(wde,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));Kr(lz.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Kr(lz.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var ez="footnote_reference",cz=Ba("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${ez}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{label:e.dataset.label}}}],toDOM:e=>{let t=e.attrs.label;return["sup",{"data-label":t,"data-type":ez},t]},parseMarkdown:{match:({type:e})=>e==="footnoteReference",runner:(e,t,r)=>{e.addNode(r,{label:t.label})}},toMarkdown:{match:e=>e.type.name===ez,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));Kr(cz.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Kr(cz.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var uz=Kh.extendSchema(e=>t=>{let r=e(t);return{...r,attrs:{...r.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:n=>{if(!(n instanceof HTMLElement))throw su(n);return{label:n.dataset.label,listType:n.dataset.listType,spread:n.dataset.spread,checked:n.dataset.checked?n.dataset.checked==="true":null}}},...r?.parseDOM||[]],toDOM:n=>r.toDOM&&n.attrs.checked==null?r.toDOM(n):["li",{"data-item-type":"task","data-label":n.attrs.label,"data-list-type":n.attrs.listType,"data-spread":n.attrs.spread,"data-checked":n.attrs.checked},0],parseMarkdown:{match:({type:n})=>n==="listItem",runner:(n,i,a)=>{if(i.checked==null){r.parseMarkdown.runner(n,i,a);return}let s=i.label!=null?`${i.label}.`:"\u2022",o=i.checked!=null?!!i.checked:null,l=i.label!=null?"ordered":"bullet",u=i.spread!=null?`${i.spread}`:"true";n.openNode(a,{label:s,listType:l,spread:u,checked:o}),n.next(i.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="list_item",runner:(n,i)=>{if(i.attrs.checked==null){r.toMarkdown.runner(n,i);return}let a=i.attrs.label,s=i.attrs.listType,o=i.attrs.spread==="true",l=i.attrs.checked;n.openNode("listItem",void 0,{label:a,listType:s,spread:o,checked:l}),n.next(i.content),n.closeNode()}}}});Kr(uz.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Kr(uz.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var zde=Oo(()=>new Pa(/^\[(?<checked>\s|x)\]\s$/,(e,t,r,n)=>{let i=e.doc.resolve(r),a=0,s=i.node(a);for(;s&&s.type.name!=="list_item";)a--,s=i.node(a);if(!s||s.attrs.checked!=null)return null;let o=t.groups?.checked==="x",l=i.before(a),u=e.tr;return u.deleteRange(r,n).setNodeMarkup(l,void 0,{...s.attrs,checked:o}),u}));Kr(zde,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var tdt=[nz,oz].flat(),rdt=[Fde,zde],ndt=[kde],idt=[$de],Gde=nl(()=>tde);Kr(Gde,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var adt=nl(()=>Zfe({}));Kr(adt,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var qde=nl(()=>Jfe({allowTableNodeSelection:!0}));Kr(qde,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var hz=qd("remarkGFM",()=>_7);Kr(hz.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Kr(hz.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var sdt=new Hi("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function odt(e,t){let r=0;return t.forEach((n,i,a)=>{n===e&&(r=a)}),r}var Vde=nl(()=>new Ci({key:sdt,appendTransaction:(e,t,r)=>{let n,i=(a,s)=>{if(n||(n=r.tr),a.type.name!=="table_cell")return;let o=r.doc.resolve(s),l=o.node(o.depth),u=o.node(o.depth-1).firstChild;if(!u)return;let h=odt(a,l),f=u.maybeChild(h);if(!f)return;let d=f.attrs.alignment;d!==a.attrs.alignment&&n.setNodeMarkup(s,void 0,{...a.attrs,alignment:d})};return t.doc!==r.doc&&r.doc.descendants(i),n}}));Kr(Vde,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var ldt=[Vde,Gde,hz,qde].flat(),cdt=[uz,Ud,_T,Dx,Nx,RT,lz,cz,tz,ET].flat(),udt=[az,iz,sz,Ede,Ade,_de,Rde,Lde,Ide,Mde,Ode,Pde,Nde,Dde,Bde,rz],Wde=[cdt,rdt,idt,ndt,tdt,udt,ldt].flat();si();var Rye=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},t5=bn(new Rye,"listener"),_2t=new Hi("MILKDOWN_LISTENER"),mG=e=>(e.inject(t5,new Rye),async()=>{await e.wait(eh);let{listeners:t}=e.get(t5);t.beforeMount.forEach(u=>u(e)),await e.wait(bx);let r=e.get(Gp),n=null,i=null,a=null,s=null,o=tG(()=>{if(!s)return;let{doc:u}=s;if(t.updated.length>0&&n&&!n.eq(u)&&t.updated.forEach(h=>{h(e,u,n)}),t.markdownUpdated.length>0&&n&&!n.eq(u)){let h=r(u);t.markdownUpdated.forEach(f=>{f(e,h,i)}),i=h}n=u,s=null},200),l=new Ci({key:_2t,view:()=>({destroy:()=>{o.cancel(),t.destroy.forEach(u=>u(e))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(u=>u(e)),!1),blur:()=>(t.blur.forEach(u=>u(e)),!1)}},state:{init:(u,h)=>{n=h.doc,i=r(h.doc)},apply:u=>{let h=u.selection;(!a&&h||a&&!h.eq(a))&&(t.selectionUpdated.forEach(f=>{f(e,h,a)}),a=h),!(!(u.docChanged||u.storedMarksSet)||u.getMeta("addToHistory")===!1)&&(s=u,o())}}});e.update(fu,u=>u.concat(l)),await e.wait(mT),t.mounted.forEach(u=>u(e))});mG.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};function gG(e){return new Promise(t=>{let r=new FileReader;r.addEventListener("load",()=>{t({alt:e.name,src:r.result})},!1),r.readAsDataURL(e)})}var R2t=async(e,t)=>{let r=[];for(let i=0;i<e.length;i++){let a=e.item(i);a&&a.type.includes("image")&&r.push(a)}let{image:n}=t.nodes;if(!n)throw lE("image");return(await Promise.all(r.map(i=>gG(i)))).map(({alt:i,src:a})=>n.createAndFill({src:a,alt:i}))},ny=th({uploader:R2t,enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{let r=document.createElement("span");return r.textContent="Upload in progress...",mi.widget(e,r,t)}},"uploadConfig");ny.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var Lye=nl(e=>{let t=new Hi("MILKDOWN_UPLOAD"),r=(i,a)=>{let s=t.getState(i);if(!s)return-1;let o=s.find(void 0,void 0,l=>l.id===a);return o.length?o[0]?.from??-1:-1},n=(i,a,s)=>{if(!s||s.length<=0)return!1;let o=Symbol("upload symbol"),l=e.get(eo),{uploader:u,getInsertPos:h}=e.get(ny.key),{tr:f}=i.state,d=a instanceof DragEvent?i.posAtCoords({left:a.clientX,top:a.clientY})?.pos??f.selection.from:f.selection.from,p=typeof h=="function"?h(a,e,d):d;return i.dispatch(f.setMeta(t,{add:{id:o,pos:p}})),u(s,l,e,p).then(m=>{let g=r(i.state,o);g<0||i.dispatch(i.state.tr.replaceWith(g,g,m).setMeta(t,{remove:{id:o}}))}).catch(m=>{console.error(m)}),!0};return new Ci({key:t,state:{init(){return Ui.empty},apply(i,a){let s=a.map(i.mapping,i.doc),o=i.getMeta(this);if(!o)return s;if(o.add){let{uploadWidgetFactory:l}=e.get(ny.key),u=l(o.add.pos,{id:o.add.id});return s.add(i.doc,[u])}if(o.remove){let l=s.find(void 0,void 0,u=>u.id===o.remove.id);return s.remove(l)}return s}},props:{decorations(i){return this.getState(i)},handlePaste:(i,a)=>{let{enableHtmlFileUploader:s}=e.get(ny.key);return!(a instanceof ClipboardEvent)||!s&&a.clipboardData?.getData("text/html")?!1:n(i,a,a.clipboardData?.files)},handleDrop:(i,a)=>a instanceof DragEvent?n(i,a,a.dataTransfer?.files):!1}})});Lye.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var Iye=[ny,Lye];var yG=(e=>(e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e))(yG||{}),R8=class extends Error{constructor(t,r){super(r),this.name="MilkdownError",this.code=t}},L2t=(e,t)=>typeof t=="function"?"[Function]":t,I2t=e=>JSON.stringify(e,L2t);function Mye(e){return new R8(yG.expectDomTypeError,`Expect to be a dom, but get: ${I2t(e)}.`)}function Nye(e){return new R8(yG.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}var Y8r=f7("abcedfghicklmn",10);function vG(e){let t=r=>async()=>{await r.wait(Js);let n=e(r);return r.update($d,i=>[...i,n]),t.inputRule=n,()=>{r.update($d,i=>i.filter(a=>a!==n))}};return t}function M2t(e,t){let r=n=>async()=>{let i=t(n);return n.update(jh,a=>[...a.filter(s=>s[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{n.update(jh,a=>a.filter(([s])=>s!==e))}};return r.type=n=>{let i=n.get(eo).nodes[e];if(!i)throw Nye(e);return i},r}function L8(e,t){let r=bn(e,t),n=i=>(i.inject(r),()=>()=>{i.remove(r)});return n.key=r,n}function xG(e,t){let r=L8(t,e),n=M2t(e,a=>a.get(r.key)(a)),i=[r,n];return i.id=n.id,i.node=n,i.type=a=>n.type(a),i.schema=n.schema,i.ctx=r,i.key=r.key,i.extendSchema=a=>s=>()=>{let o=s.get(r.key),l=a(o)(s);s.update(jh,u=>[...u.filter(h=>h[0]!==e),[e,l]]),i.schema=l},i}function Dye(e,t,r){let n=L8(r??{},e),i=s=>async()=>{await s.wait(eh);let o={plugin:t(s),options:s.get(n.key)};return s.update(zd,l=>[...l,o]),()=>{s.update(zd,l=>l.filter(u=>u!==o))}},a=[n,i];return a.id=e,a.plugin=i,a.options=n,a}var $t=class e extends Error{constructor(t,r){var n="KaTeX parse error: "+t,i,a,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;i=s.start,a=s.end,i===o.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=o.slice(i,a).replace(/[^]/g,"$&\u0332"),u;i>15?u="\u2026"+o.slice(i-15,i):u=o.slice(0,i);var h;a+15<o.length?h=o.slice(a,a+15)+"\u2026":h=o.slice(a),n+=u+l+h}super(n),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},N2t=/([A-Z])/g,D2t=e=>e.replace(N2t,"-$1").toLowerCase(),O2t={"&":"&",">":">","<":"<",'"':""","'":"'"},P2t=/[&><"']/g,Fo=e=>String(e).replace(P2t,t=>O2t[t]),G8=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?G8(e.body[0]):e:e.type==="font"?G8(e.body):e,B2t=new Set(["mathord","textord","atom"]),n0=e=>B2t.has(G8(e).type),F2t=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},DG={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function $2t(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function z2t(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return $2t(t)}function G2t(e,t,r,n){var i=r[t];e[t]=i!==void 0?n.processor?n.processor(i):i:z2t(n)}var s5=class{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r of Object.keys(DG)){var n=DG[r];n&&G2t(this,r,t,n)}}reportNonstrict(t,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(t,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new $t("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,n){var i=this.strict;if(typeof i=="function")try{i=i(t,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var r=F2t(t.url);if(r==null)return!1;t.protocol=r}var n=typeof this.trust=="function"?this.trust(t):this.trust;return!!n}},of=class{constructor(t,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=n}sup(){return lf[q2t[this.id]]}sub(){return lf[V2t[this.id]]}fracNum(){return lf[W2t[this.id]]}fracDen(){return lf[H2t[this.id]]}cramp(){return lf[U2t[this.id]]}text(){return lf[Y2t[this.id]]}isTight(){return this.size>=2}},tq=0,V8=1,lb=2,r0=3,o5=4,xu=5,cb=6,ll=7,lf=[new of(tq,0,!1),new of(V8,0,!0),new of(lb,1,!1),new of(r0,1,!0),new of(o5,2,!1),new of(xu,2,!0),new of(cb,3,!1),new of(ll,3,!0)],q2t=[o5,xu,o5,xu,cb,ll,cb,ll],V2t=[xu,xu,xu,xu,ll,ll,ll,ll],W2t=[lb,r0,o5,xu,cb,ll,cb,ll],H2t=[r0,r0,xu,xu,ll,ll,ll,ll],U2t=[V8,V8,r0,r0,xu,xu,ll,ll],Y2t=[tq,V8,lb,r0,lb,r0,lb,r0],dn={DISPLAY:lf[tq],TEXT:lf[lb],SCRIPT:lf[o5],SCRIPTSCRIPT:lf[cb]},OG=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function X2t(e){for(var t=0;t<OG.length;t++)for(var r=OG[t],n=0;n<r.blocks.length;n++){var i=r.blocks[n];if(e>=i[0]&&e<=i[1])return r.name}return null}var q8=[];OG.forEach(e=>e.blocks.forEach(t=>q8.push(...t)));function gve(e){for(var t=0;t<q8.length;t+=2)if(e>=q8[t]&&e<=q8[t+1])return!0;return!1}var fs=e=>e+" "+e,ob=80,j2t=function(t,r){return"M95,"+(622+t+r)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 @@ -3584,7 +3584,7 @@ c5.3,-9.3,12,-14,20,-14 H400000v`+(40+t)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},U2t=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 +M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},K2t=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+t/2.084+" -"+t+` @@ -3594,7 +3594,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5, c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Y2t=function(t,r){return"M983 "+(10+t+r)+` +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Z2t=function(t,r){return"M983 "+(10+t+r)+` l`+t/3.13+" -"+t+` c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 @@ -3603,7 +3603,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},X2t=function(t,r){return"M424,"+(2398+t+r)+` +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Q2t=function(t,r){return"M424,"+(2398+t+r)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 @@ -3613,18 +3613,18 @@ v`+(40+t)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+r+` -h400000v`+(40+t)+"h-400000z"},j2t=function(t,r){return"M473,"+(2713+t+r)+` +h400000v`+(40+t)+"h-400000z"},J2t=function(t,r){return"M473,"+(2713+t+r)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},K2t=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},Z2t=function(t,r,n){var i=n-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` +606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},ext=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},txt=function(t,r,n){var i=n-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},Q2t=function(t,r,n){r=1e3*r;var i="";switch(t){case"sqrtMain":i=H2t(r,ob);break;case"sqrtSize1":i=U2t(r,ob);break;case"sqrtSize2":i=Y2t(r,ob);break;case"sqrtSize3":i=X2t(r,ob);break;case"sqrtSize4":i=j2t(r,ob);break;case"sqrtTall":i=Z2t(r,ob,n)}return i},J2t=function(t,r){switch(t){case"\u239C":return fs("M291 0 H417 V"+r+" H291z");case"\u2223":return fs("M145 0 H188 V"+r+" H145z");case"\u2225":return fs("M145 0 H188 V"+r+" H145z")+fs("M367 0 H410 V"+r+" H367z");case"\u239F":return fs("M457 0 H583 V"+r+" H457z");case"\u23A2":return fs("M319 0 H403 V"+r+" H319z");case"\u23A5":return fs("M263 0 H347 V"+r+" H263z");case"\u23AA":return fs("M384 0 H504 V"+r+" H384z");case"\u23D0":return fs("M312 0 H355 V"+r+" H312z");case"\u2016":return fs("M257 0 H300 V"+r+" H257z")+fs("M478 0 H521 V"+r+" H478z");default:return""}},Nye={doubleleftarrow:`M262 157 +219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},rxt=function(t,r,n){r=1e3*r;var i="";switch(t){case"sqrtMain":i=j2t(r,ob);break;case"sqrtSize1":i=K2t(r,ob);break;case"sqrtSize2":i=Z2t(r,ob);break;case"sqrtSize3":i=Q2t(r,ob);break;case"sqrtSize4":i=J2t(r,ob);break;case"sqrtTall":i=txt(r,ob,n)}return i},nxt=function(t,r){switch(t){case"\u239C":return fs("M291 0 H417 V"+r+" H291z");case"\u2223":return fs("M145 0 H188 V"+r+" H145z");case"\u2225":return fs("M145 0 H188 V"+r+" H145z")+fs("M367 0 H410 V"+r+" H367z");case"\u239F":return fs("M457 0 H583 V"+r+" H457z");case"\u23A2":return fs("M319 0 H403 V"+r+" H319z");case"\u23A5":return fs("M263 0 H347 V"+r+" H263z");case"\u23AA":return fs("M384 0 H504 V"+r+" H384z");case"\u23D0":return fs("M312 0 H355 V"+r+" H312z");case"\u2016":return fs("M257 0 H300 V"+r+" H257z")+fs("M478 0 H521 V"+r+" H478z");default:return""}},Oye={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 @@ -3795,7 +3795,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z` 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`},ext=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 v84 h347 v-84 +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},ixt=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 v84 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+r+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 @@ -3823,56 +3823,56 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function txt(e){return"toText"in e}var mm=class{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t}toMarkup(){for(var t="",r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t}toText(){return this.children.map(t=>{if(txt(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}},DG={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},rxt={ex:!0,em:!0,mu:!0},mve=function(t){return typeof t!="string"&&(t=t.unit),t in DG||t in rxt||t==="ex"},da=function(t,r){var n;if(t.unit in DG)n=DG[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,t.unit==="ex")n=i.fontMetrics().xHeight;else if(t.unit==="em")n=i.fontMetrics().quad;else throw new $t("Invalid unit: '"+t.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*n,r.maxSize)},Ut=function(t){return+t.toFixed(4)+"em"},gm=function(t){return t.filter(r=>r).join(" ")},eq=function(t){var r="";for(var n of Object.keys(t)){var i=t[n];i!==void 0&&(r+=L2t(n)+":"+i+";")}return r},gve=function(t,r,n){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},yve=function(t){var r=document.createElement(t);r.className=gm(this.classes),Object.assign(r.style,this.style);for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)r.appendChild(this.children[i].toNode());return r},nxt=/[\s"'>/=\x00-\x1f]/,vve=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+Fo(gm(this.classes))+'"');var n=eq(this.style);n&&(r+=' style="'+Fo(n)+'"');for(var i of Object.keys(this.attributes)){if(nxt.test(i))throw new $t("Invalid attribute name '"+i+"'");r+=" "+i+'="'+Fo(this.attributes[i])+'"'}r+=">";for(var a=0;a<this.children.length;a++)r+=this.children[a].toMarkup();return r+="</"+t+">",r},ym=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,gve.call(this,t,n,i),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return yve.call(this,"span")}toMarkup(){return vve.call(this,"span")}},ub=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,gve.call(this,r,i),this.children=n||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return yve.call(this,"a")}toMarkup(){return vve.call(this,"a")}},OG=class{constructor(t,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+Fo(this.src)+'"'+(' alt="'+Fo(this.alt)+'"'),r=eq(this.style);return r&&(t+=' style="'+Fo(r)+'"'),t+="'/>",t}},ixt={\u00EE:"\u0131\u0302",\u00EF:"\u0131\u0308",\u00ED:"\u0131\u0301",\u00EC:"\u0131\u0300"},ll=class{constructor(t,r,n,i,a,s,o,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=r||0,this.depth=n||0,this.italic=i||0,this.skew=a||0,this.width=s||0,this.classes=o||[],this.style=l||{},this.maxFontSize=0;var u=W2t(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=ixt[this.text])}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createTextNode(this.text),r=null;return this.italic>0&&(r=document.createElement("span"),r.style.marginRight=Ut(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=gm(this.classes)),Object.keys(this.style).length>0&&(r=r||document.createElement("span"),Object.assign(r.style,this.style)),r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="<span";this.classes.length&&(t=!0,r+=' class="',r+=Fo(gm(this.classes)),r+='"');var n="";this.italic>0&&(n+="margin-right:"+Ut(this.italic)+";"),n+=eq(this.style),n&&(t=!0,r+=' style="'+Fo(n)+'"');var i=Fo(this.text);return t?(r+=">",r+=i,r+="</span>",r):i}},sh=class{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)r.appendChild(this.children[i].toNode());return r}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var r of Object.keys(this.attributes))t+=" "+r+'="'+Fo(this.attributes[r])+'"';t+=">";for(var n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</svg>",t}},uf=class{constructor(t,r){this.pathName=void 0,this.alternate=void 0,this.pathName=t,this.alternate=r}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"path");return this.alternate?r.setAttribute("d",this.alternate):r.setAttribute("d",Nye[this.pathName]),r}toMarkup(){return this.alternate?'<path d="'+Fo(this.alternate)+'"/>':'<path d="'+Fo(Nye[this.pathName])+'"/>'}},l5=class{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var t="<line";for(var r of Object.keys(this.attributes))t+=" "+r+'="'+Fo(this.attributes[r])+'"';return t+="/>",t}};function axt(e){if(e instanceof ll)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function sxt(e){if(e instanceof ym)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var oxt=e=>e instanceof ym||e instanceof ub||e instanceof mm,cf={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],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:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],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:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],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:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],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:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],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:[0,.44444,0,0,.63889],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:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],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:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],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:[0,.68611,.17208,0,.8961],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:[0,.69444,.06709,0,.59111],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:[.19444,.44444,.105,0,.53222],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:[.19444,.44444,.105,0,.53222],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:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],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:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],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:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],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:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],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:[0,.68333,.16389,0,.74333],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:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],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:[0,.68333,.16389,0,.74333],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:[0,.69444,.06646,0,.51111],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:[.19444,.43056,.08847,0,.46],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:[.19444,.43056,.08847,0,.46],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:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],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:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],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:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],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:[0,.43056,0,0,.55556],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:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],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:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],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:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],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:[0,.69444,0,0,.66759],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:[0,.44444,0,0,.58472],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:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],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:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],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:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],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:[0,.68333,.08125,.05556,.83125],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:[0,.68333,.02778,.08334,.76278],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:[0,.43056,0,.05556,.48472],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:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],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:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],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:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],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:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],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:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],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:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],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:[0,.69444,.07816,0,.27778],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:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],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:[0,.69444,0,0,.66667],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:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],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:[0,.69444,.0799,0,.5],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:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],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:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],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:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],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:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],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:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},I8={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],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:[.25,.25,.25],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],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Dye={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\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 lxt(e,t){cf[e]=t}function tq(e,t,r){if(!cf[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),i=cf[t][n];if(!i&&e[0]in Dye&&(n=Dye[e[0]].charCodeAt(0),i=cf[t][n]),!i&&r==="text"&&pve(n)&&(i=cf[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var vG={};function cxt(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!vG[t]){var r=vG[t]={cssEmPerMu:I8.quad[t]/18};for(var n in I8)I8.hasOwnProperty(n)&&(r[n]=I8[n][t])}return vG[t]}var ra={math:{},text:{}};function X(e,t,r,n,i,a){ra[e][i]={font:t,group:r,replace:n},a&&n&&(ra[e][n]=ra[e][i])}var te="math",It="text",be="main",He="ams",na="accent-token",or="bin",cl="close",db="inner",Br="mathord",ja="op-token",Ic="open",u5="punct",Ye="rel",i0="spacing",Ze="textord";X(te,be,Ye,"\u2261","\\equiv",!0);X(te,be,Ye,"\u227A","\\prec",!0);X(te,be,Ye,"\u227B","\\succ",!0);X(te,be,Ye,"\u223C","\\sim",!0);X(te,be,Ye,"\u22A5","\\perp");X(te,be,Ye,"\u2AAF","\\preceq",!0);X(te,be,Ye,"\u2AB0","\\succeq",!0);X(te,be,Ye,"\u2243","\\simeq",!0);X(te,be,Ye,"\u2223","\\mid",!0);X(te,be,Ye,"\u226A","\\ll",!0);X(te,be,Ye,"\u226B","\\gg",!0);X(te,be,Ye,"\u224D","\\asymp",!0);X(te,be,Ye,"\u2225","\\parallel");X(te,be,Ye,"\u22C8","\\bowtie",!0);X(te,be,Ye,"\u2323","\\smile",!0);X(te,be,Ye,"\u2291","\\sqsubseteq",!0);X(te,be,Ye,"\u2292","\\sqsupseteq",!0);X(te,be,Ye,"\u2250","\\doteq",!0);X(te,be,Ye,"\u2322","\\frown",!0);X(te,be,Ye,"\u220B","\\ni",!0);X(te,be,Ye,"\u221D","\\propto",!0);X(te,be,Ye,"\u22A2","\\vdash",!0);X(te,be,Ye,"\u22A3","\\dashv",!0);X(te,be,Ye,"\u220B","\\owns");X(te,be,u5,".","\\ldotp");X(te,be,u5,"\u22C5","\\cdotp");X(te,be,u5,"\u22C5","\xB7");X(It,be,Ze,"\u22C5","\xB7");X(te,be,Ze,"#","\\#");X(It,be,Ze,"#","\\#");X(te,be,Ze,"&","\\&");X(It,be,Ze,"&","\\&");X(te,be,Ze,"\u2135","\\aleph",!0);X(te,be,Ze,"\u2200","\\forall",!0);X(te,be,Ze,"\u210F","\\hbar",!0);X(te,be,Ze,"\u2203","\\exists",!0);X(te,be,Ze,"\u2207","\\nabla",!0);X(te,be,Ze,"\u266D","\\flat",!0);X(te,be,Ze,"\u2113","\\ell",!0);X(te,be,Ze,"\u266E","\\natural",!0);X(te,be,Ze,"\u2663","\\clubsuit",!0);X(te,be,Ze,"\u2118","\\wp",!0);X(te,be,Ze,"\u266F","\\sharp",!0);X(te,be,Ze,"\u2662","\\diamondsuit",!0);X(te,be,Ze,"\u211C","\\Re",!0);X(te,be,Ze,"\u2661","\\heartsuit",!0);X(te,be,Ze,"\u2111","\\Im",!0);X(te,be,Ze,"\u2660","\\spadesuit",!0);X(te,be,Ze,"\xA7","\\S",!0);X(It,be,Ze,"\xA7","\\S");X(te,be,Ze,"\xB6","\\P",!0);X(It,be,Ze,"\xB6","\\P");X(te,be,Ze,"\u2020","\\dag");X(It,be,Ze,"\u2020","\\dag");X(It,be,Ze,"\u2020","\\textdagger");X(te,be,Ze,"\u2021","\\ddag");X(It,be,Ze,"\u2021","\\ddag");X(It,be,Ze,"\u2021","\\textdaggerdbl");X(te,be,cl,"\u23B1","\\rmoustache",!0);X(te,be,Ic,"\u23B0","\\lmoustache",!0);X(te,be,cl,"\u27EF","\\rgroup",!0);X(te,be,Ic,"\u27EE","\\lgroup",!0);X(te,be,or,"\u2213","\\mp",!0);X(te,be,or,"\u2296","\\ominus",!0);X(te,be,or,"\u228E","\\uplus",!0);X(te,be,or,"\u2293","\\sqcap",!0);X(te,be,or,"\u2217","\\ast");X(te,be,or,"\u2294","\\sqcup",!0);X(te,be,or,"\u25EF","\\bigcirc",!0);X(te,be,or,"\u2219","\\bullet",!0);X(te,be,or,"\u2021","\\ddagger");X(te,be,or,"\u2240","\\wr",!0);X(te,be,or,"\u2A3F","\\amalg");X(te,be,or,"&","\\And");X(te,be,Ye,"\u27F5","\\longleftarrow",!0);X(te,be,Ye,"\u21D0","\\Leftarrow",!0);X(te,be,Ye,"\u27F8","\\Longleftarrow",!0);X(te,be,Ye,"\u27F6","\\longrightarrow",!0);X(te,be,Ye,"\u21D2","\\Rightarrow",!0);X(te,be,Ye,"\u27F9","\\Longrightarrow",!0);X(te,be,Ye,"\u2194","\\leftrightarrow",!0);X(te,be,Ye,"\u27F7","\\longleftrightarrow",!0);X(te,be,Ye,"\u21D4","\\Leftrightarrow",!0);X(te,be,Ye,"\u27FA","\\Longleftrightarrow",!0);X(te,be,Ye,"\u21A6","\\mapsto",!0);X(te,be,Ye,"\u27FC","\\longmapsto",!0);X(te,be,Ye,"\u2197","\\nearrow",!0);X(te,be,Ye,"\u21A9","\\hookleftarrow",!0);X(te,be,Ye,"\u21AA","\\hookrightarrow",!0);X(te,be,Ye,"\u2198","\\searrow",!0);X(te,be,Ye,"\u21BC","\\leftharpoonup",!0);X(te,be,Ye,"\u21C0","\\rightharpoonup",!0);X(te,be,Ye,"\u2199","\\swarrow",!0);X(te,be,Ye,"\u21BD","\\leftharpoondown",!0);X(te,be,Ye,"\u21C1","\\rightharpoondown",!0);X(te,be,Ye,"\u2196","\\nwarrow",!0);X(te,be,Ye,"\u21CC","\\rightleftharpoons",!0);X(te,He,Ye,"\u226E","\\nless",!0);X(te,He,Ye,"\uE010","\\@nleqslant");X(te,He,Ye,"\uE011","\\@nleqq");X(te,He,Ye,"\u2A87","\\lneq",!0);X(te,He,Ye,"\u2268","\\lneqq",!0);X(te,He,Ye,"\uE00C","\\@lvertneqq");X(te,He,Ye,"\u22E6","\\lnsim",!0);X(te,He,Ye,"\u2A89","\\lnapprox",!0);X(te,He,Ye,"\u2280","\\nprec",!0);X(te,He,Ye,"\u22E0","\\npreceq",!0);X(te,He,Ye,"\u22E8","\\precnsim",!0);X(te,He,Ye,"\u2AB9","\\precnapprox",!0);X(te,He,Ye,"\u2241","\\nsim",!0);X(te,He,Ye,"\uE006","\\@nshortmid");X(te,He,Ye,"\u2224","\\nmid",!0);X(te,He,Ye,"\u22AC","\\nvdash",!0);X(te,He,Ye,"\u22AD","\\nvDash",!0);X(te,He,Ye,"\u22EA","\\ntriangleleft");X(te,He,Ye,"\u22EC","\\ntrianglelefteq",!0);X(te,He,Ye,"\u228A","\\subsetneq",!0);X(te,He,Ye,"\uE01A","\\@varsubsetneq");X(te,He,Ye,"\u2ACB","\\subsetneqq",!0);X(te,He,Ye,"\uE017","\\@varsubsetneqq");X(te,He,Ye,"\u226F","\\ngtr",!0);X(te,He,Ye,"\uE00F","\\@ngeqslant");X(te,He,Ye,"\uE00E","\\@ngeqq");X(te,He,Ye,"\u2A88","\\gneq",!0);X(te,He,Ye,"\u2269","\\gneqq",!0);X(te,He,Ye,"\uE00D","\\@gvertneqq");X(te,He,Ye,"\u22E7","\\gnsim",!0);X(te,He,Ye,"\u2A8A","\\gnapprox",!0);X(te,He,Ye,"\u2281","\\nsucc",!0);X(te,He,Ye,"\u22E1","\\nsucceq",!0);X(te,He,Ye,"\u22E9","\\succnsim",!0);X(te,He,Ye,"\u2ABA","\\succnapprox",!0);X(te,He,Ye,"\u2246","\\ncong",!0);X(te,He,Ye,"\uE007","\\@nshortparallel");X(te,He,Ye,"\u2226","\\nparallel",!0);X(te,He,Ye,"\u22AF","\\nVDash",!0);X(te,He,Ye,"\u22EB","\\ntriangleright");X(te,He,Ye,"\u22ED","\\ntrianglerighteq",!0);X(te,He,Ye,"\uE018","\\@nsupseteqq");X(te,He,Ye,"\u228B","\\supsetneq",!0);X(te,He,Ye,"\uE01B","\\@varsupsetneq");X(te,He,Ye,"\u2ACC","\\supsetneqq",!0);X(te,He,Ye,"\uE019","\\@varsupsetneqq");X(te,He,Ye,"\u22AE","\\nVdash",!0);X(te,He,Ye,"\u2AB5","\\precneqq",!0);X(te,He,Ye,"\u2AB6","\\succneqq",!0);X(te,He,Ye,"\uE016","\\@nsubseteqq");X(te,He,or,"\u22B4","\\unlhd");X(te,He,or,"\u22B5","\\unrhd");X(te,He,Ye,"\u219A","\\nleftarrow",!0);X(te,He,Ye,"\u219B","\\nrightarrow",!0);X(te,He,Ye,"\u21CD","\\nLeftarrow",!0);X(te,He,Ye,"\u21CF","\\nRightarrow",!0);X(te,He,Ye,"\u21AE","\\nleftrightarrow",!0);X(te,He,Ye,"\u21CE","\\nLeftrightarrow",!0);X(te,He,Ye,"\u25B3","\\vartriangle");X(te,He,Ze,"\u210F","\\hslash");X(te,He,Ze,"\u25BD","\\triangledown");X(te,He,Ze,"\u25CA","\\lozenge");X(te,He,Ze,"\u24C8","\\circledS");X(te,He,Ze,"\xAE","\\circledR");X(It,He,Ze,"\xAE","\\circledR");X(te,He,Ze,"\u2221","\\measuredangle",!0);X(te,He,Ze,"\u2204","\\nexists");X(te,He,Ze,"\u2127","\\mho");X(te,He,Ze,"\u2132","\\Finv",!0);X(te,He,Ze,"\u2141","\\Game",!0);X(te,He,Ze,"\u2035","\\backprime");X(te,He,Ze,"\u25B2","\\blacktriangle");X(te,He,Ze,"\u25BC","\\blacktriangledown");X(te,He,Ze,"\u25A0","\\blacksquare");X(te,He,Ze,"\u29EB","\\blacklozenge");X(te,He,Ze,"\u2605","\\bigstar");X(te,He,Ze,"\u2222","\\sphericalangle",!0);X(te,He,Ze,"\u2201","\\complement",!0);X(te,He,Ze,"\xF0","\\eth",!0);X(It,be,Ze,"\xF0","\xF0");X(te,He,Ze,"\u2571","\\diagup");X(te,He,Ze,"\u2572","\\diagdown");X(te,He,Ze,"\u25A1","\\square");X(te,He,Ze,"\u25A1","\\Box");X(te,He,Ze,"\u25CA","\\Diamond");X(te,He,Ze,"\xA5","\\yen",!0);X(It,He,Ze,"\xA5","\\yen",!0);X(te,He,Ze,"\u2713","\\checkmark",!0);X(It,He,Ze,"\u2713","\\checkmark");X(te,He,Ze,"\u2136","\\beth",!0);X(te,He,Ze,"\u2138","\\daleth",!0);X(te,He,Ze,"\u2137","\\gimel",!0);X(te,He,Ze,"\u03DD","\\digamma",!0);X(te,He,Ze,"\u03F0","\\varkappa");X(te,He,Ic,"\u250C","\\@ulcorner",!0);X(te,He,cl,"\u2510","\\@urcorner",!0);X(te,He,Ic,"\u2514","\\@llcorner",!0);X(te,He,cl,"\u2518","\\@lrcorner",!0);X(te,He,Ye,"\u2266","\\leqq",!0);X(te,He,Ye,"\u2A7D","\\leqslant",!0);X(te,He,Ye,"\u2A95","\\eqslantless",!0);X(te,He,Ye,"\u2272","\\lesssim",!0);X(te,He,Ye,"\u2A85","\\lessapprox",!0);X(te,He,Ye,"\u224A","\\approxeq",!0);X(te,He,or,"\u22D6","\\lessdot");X(te,He,Ye,"\u22D8","\\lll",!0);X(te,He,Ye,"\u2276","\\lessgtr",!0);X(te,He,Ye,"\u22DA","\\lesseqgtr",!0);X(te,He,Ye,"\u2A8B","\\lesseqqgtr",!0);X(te,He,Ye,"\u2251","\\doteqdot");X(te,He,Ye,"\u2253","\\risingdotseq",!0);X(te,He,Ye,"\u2252","\\fallingdotseq",!0);X(te,He,Ye,"\u223D","\\backsim",!0);X(te,He,Ye,"\u22CD","\\backsimeq",!0);X(te,He,Ye,"\u2AC5","\\subseteqq",!0);X(te,He,Ye,"\u22D0","\\Subset",!0);X(te,He,Ye,"\u228F","\\sqsubset",!0);X(te,He,Ye,"\u227C","\\preccurlyeq",!0);X(te,He,Ye,"\u22DE","\\curlyeqprec",!0);X(te,He,Ye,"\u227E","\\precsim",!0);X(te,He,Ye,"\u2AB7","\\precapprox",!0);X(te,He,Ye,"\u22B2","\\vartriangleleft");X(te,He,Ye,"\u22B4","\\trianglelefteq");X(te,He,Ye,"\u22A8","\\vDash",!0);X(te,He,Ye,"\u22AA","\\Vvdash",!0);X(te,He,Ye,"\u2323","\\smallsmile");X(te,He,Ye,"\u2322","\\smallfrown");X(te,He,Ye,"\u224F","\\bumpeq",!0);X(te,He,Ye,"\u224E","\\Bumpeq",!0);X(te,He,Ye,"\u2267","\\geqq",!0);X(te,He,Ye,"\u2A7E","\\geqslant",!0);X(te,He,Ye,"\u2A96","\\eqslantgtr",!0);X(te,He,Ye,"\u2273","\\gtrsim",!0);X(te,He,Ye,"\u2A86","\\gtrapprox",!0);X(te,He,or,"\u22D7","\\gtrdot");X(te,He,Ye,"\u22D9","\\ggg",!0);X(te,He,Ye,"\u2277","\\gtrless",!0);X(te,He,Ye,"\u22DB","\\gtreqless",!0);X(te,He,Ye,"\u2A8C","\\gtreqqless",!0);X(te,He,Ye,"\u2256","\\eqcirc",!0);X(te,He,Ye,"\u2257","\\circeq",!0);X(te,He,Ye,"\u225C","\\triangleq",!0);X(te,He,Ye,"\u223C","\\thicksim");X(te,He,Ye,"\u2248","\\thickapprox");X(te,He,Ye,"\u2AC6","\\supseteqq",!0);X(te,He,Ye,"\u22D1","\\Supset",!0);X(te,He,Ye,"\u2290","\\sqsupset",!0);X(te,He,Ye,"\u227D","\\succcurlyeq",!0);X(te,He,Ye,"\u22DF","\\curlyeqsucc",!0);X(te,He,Ye,"\u227F","\\succsim",!0);X(te,He,Ye,"\u2AB8","\\succapprox",!0);X(te,He,Ye,"\u22B3","\\vartriangleright");X(te,He,Ye,"\u22B5","\\trianglerighteq");X(te,He,Ye,"\u22A9","\\Vdash",!0);X(te,He,Ye,"\u2223","\\shortmid");X(te,He,Ye,"\u2225","\\shortparallel");X(te,He,Ye,"\u226C","\\between",!0);X(te,He,Ye,"\u22D4","\\pitchfork",!0);X(te,He,Ye,"\u221D","\\varpropto");X(te,He,Ye,"\u25C0","\\blacktriangleleft");X(te,He,Ye,"\u2234","\\therefore",!0);X(te,He,Ye,"\u220D","\\backepsilon");X(te,He,Ye,"\u25B6","\\blacktriangleright");X(te,He,Ye,"\u2235","\\because",!0);X(te,He,Ye,"\u22D8","\\llless");X(te,He,Ye,"\u22D9","\\gggtr");X(te,He,or,"\u22B2","\\lhd");X(te,He,or,"\u22B3","\\rhd");X(te,He,Ye,"\u2242","\\eqsim",!0);X(te,be,Ye,"\u22C8","\\Join");X(te,He,Ye,"\u2251","\\Doteq",!0);X(te,He,or,"\u2214","\\dotplus",!0);X(te,He,or,"\u2216","\\smallsetminus");X(te,He,or,"\u22D2","\\Cap",!0);X(te,He,or,"\u22D3","\\Cup",!0);X(te,He,or,"\u2A5E","\\doublebarwedge",!0);X(te,He,or,"\u229F","\\boxminus",!0);X(te,He,or,"\u229E","\\boxplus",!0);X(te,He,or,"\u22C7","\\divideontimes",!0);X(te,He,or,"\u22C9","\\ltimes",!0);X(te,He,or,"\u22CA","\\rtimes",!0);X(te,He,or,"\u22CB","\\leftthreetimes",!0);X(te,He,or,"\u22CC","\\rightthreetimes",!0);X(te,He,or,"\u22CF","\\curlywedge",!0);X(te,He,or,"\u22CE","\\curlyvee",!0);X(te,He,or,"\u229D","\\circleddash",!0);X(te,He,or,"\u229B","\\circledast",!0);X(te,He,or,"\u22C5","\\centerdot");X(te,He,or,"\u22BA","\\intercal",!0);X(te,He,or,"\u22D2","\\doublecap");X(te,He,or,"\u22D3","\\doublecup");X(te,He,or,"\u22A0","\\boxtimes",!0);X(te,He,Ye,"\u21E2","\\dashrightarrow",!0);X(te,He,Ye,"\u21E0","\\dashleftarrow",!0);X(te,He,Ye,"\u21C7","\\leftleftarrows",!0);X(te,He,Ye,"\u21C6","\\leftrightarrows",!0);X(te,He,Ye,"\u21DA","\\Lleftarrow",!0);X(te,He,Ye,"\u219E","\\twoheadleftarrow",!0);X(te,He,Ye,"\u21A2","\\leftarrowtail",!0);X(te,He,Ye,"\u21AB","\\looparrowleft",!0);X(te,He,Ye,"\u21CB","\\leftrightharpoons",!0);X(te,He,Ye,"\u21B6","\\curvearrowleft",!0);X(te,He,Ye,"\u21BA","\\circlearrowleft",!0);X(te,He,Ye,"\u21B0","\\Lsh",!0);X(te,He,Ye,"\u21C8","\\upuparrows",!0);X(te,He,Ye,"\u21BF","\\upharpoonleft",!0);X(te,He,Ye,"\u21C3","\\downharpoonleft",!0);X(te,be,Ye,"\u22B6","\\origof",!0);X(te,be,Ye,"\u22B7","\\imageof",!0);X(te,He,Ye,"\u22B8","\\multimap",!0);X(te,He,Ye,"\u21AD","\\leftrightsquigarrow",!0);X(te,He,Ye,"\u21C9","\\rightrightarrows",!0);X(te,He,Ye,"\u21C4","\\rightleftarrows",!0);X(te,He,Ye,"\u21A0","\\twoheadrightarrow",!0);X(te,He,Ye,"\u21A3","\\rightarrowtail",!0);X(te,He,Ye,"\u21AC","\\looparrowright",!0);X(te,He,Ye,"\u21B7","\\curvearrowright",!0);X(te,He,Ye,"\u21BB","\\circlearrowright",!0);X(te,He,Ye,"\u21B1","\\Rsh",!0);X(te,He,Ye,"\u21CA","\\downdownarrows",!0);X(te,He,Ye,"\u21BE","\\upharpoonright",!0);X(te,He,Ye,"\u21C2","\\downharpoonright",!0);X(te,He,Ye,"\u21DD","\\rightsquigarrow",!0);X(te,He,Ye,"\u21DD","\\leadsto");X(te,He,Ye,"\u21DB","\\Rrightarrow",!0);X(te,He,Ye,"\u21BE","\\restriction");X(te,be,Ze,"\u2018","`");X(te,be,Ze,"$","\\$");X(It,be,Ze,"$","\\$");X(It,be,Ze,"$","\\textdollar");X(te,be,Ze,"%","\\%");X(It,be,Ze,"%","\\%");X(te,be,Ze,"_","\\_");X(It,be,Ze,"_","\\_");X(It,be,Ze,"_","\\textunderscore");X(te,be,Ze,"\u2220","\\angle",!0);X(te,be,Ze,"\u221E","\\infty",!0);X(te,be,Ze,"\u2032","\\prime");X(te,be,Ze,"\u25B3","\\triangle");X(te,be,Ze,"\u0393","\\Gamma",!0);X(te,be,Ze,"\u0394","\\Delta",!0);X(te,be,Ze,"\u0398","\\Theta",!0);X(te,be,Ze,"\u039B","\\Lambda",!0);X(te,be,Ze,"\u039E","\\Xi",!0);X(te,be,Ze,"\u03A0","\\Pi",!0);X(te,be,Ze,"\u03A3","\\Sigma",!0);X(te,be,Ze,"\u03A5","\\Upsilon",!0);X(te,be,Ze,"\u03A6","\\Phi",!0);X(te,be,Ze,"\u03A8","\\Psi",!0);X(te,be,Ze,"\u03A9","\\Omega",!0);X(te,be,Ze,"A","\u0391");X(te,be,Ze,"B","\u0392");X(te,be,Ze,"E","\u0395");X(te,be,Ze,"Z","\u0396");X(te,be,Ze,"H","\u0397");X(te,be,Ze,"I","\u0399");X(te,be,Ze,"K","\u039A");X(te,be,Ze,"M","\u039C");X(te,be,Ze,"N","\u039D");X(te,be,Ze,"O","\u039F");X(te,be,Ze,"P","\u03A1");X(te,be,Ze,"T","\u03A4");X(te,be,Ze,"X","\u03A7");X(te,be,Ze,"\xAC","\\neg",!0);X(te,be,Ze,"\xAC","\\lnot");X(te,be,Ze,"\u22A4","\\top");X(te,be,Ze,"\u22A5","\\bot");X(te,be,Ze,"\u2205","\\emptyset");X(te,He,Ze,"\u2205","\\varnothing");X(te,be,Br,"\u03B1","\\alpha",!0);X(te,be,Br,"\u03B2","\\beta",!0);X(te,be,Br,"\u03B3","\\gamma",!0);X(te,be,Br,"\u03B4","\\delta",!0);X(te,be,Br,"\u03F5","\\epsilon",!0);X(te,be,Br,"\u03B6","\\zeta",!0);X(te,be,Br,"\u03B7","\\eta",!0);X(te,be,Br,"\u03B8","\\theta",!0);X(te,be,Br,"\u03B9","\\iota",!0);X(te,be,Br,"\u03BA","\\kappa",!0);X(te,be,Br,"\u03BB","\\lambda",!0);X(te,be,Br,"\u03BC","\\mu",!0);X(te,be,Br,"\u03BD","\\nu",!0);X(te,be,Br,"\u03BE","\\xi",!0);X(te,be,Br,"\u03BF","\\omicron",!0);X(te,be,Br,"\u03C0","\\pi",!0);X(te,be,Br,"\u03C1","\\rho",!0);X(te,be,Br,"\u03C3","\\sigma",!0);X(te,be,Br,"\u03C4","\\tau",!0);X(te,be,Br,"\u03C5","\\upsilon",!0);X(te,be,Br,"\u03D5","\\phi",!0);X(te,be,Br,"\u03C7","\\chi",!0);X(te,be,Br,"\u03C8","\\psi",!0);X(te,be,Br,"\u03C9","\\omega",!0);X(te,be,Br,"\u03B5","\\varepsilon",!0);X(te,be,Br,"\u03D1","\\vartheta",!0);X(te,be,Br,"\u03D6","\\varpi",!0);X(te,be,Br,"\u03F1","\\varrho",!0);X(te,be,Br,"\u03C2","\\varsigma",!0);X(te,be,Br,"\u03C6","\\varphi",!0);X(te,be,or,"\u2217","*",!0);X(te,be,or,"+","+");X(te,be,or,"\u2212","-",!0);X(te,be,or,"\u22C5","\\cdot",!0);X(te,be,or,"\u2218","\\circ",!0);X(te,be,or,"\xF7","\\div",!0);X(te,be,or,"\xB1","\\pm",!0);X(te,be,or,"\xD7","\\times",!0);X(te,be,or,"\u2229","\\cap",!0);X(te,be,or,"\u222A","\\cup",!0);X(te,be,or,"\u2216","\\setminus",!0);X(te,be,or,"\u2227","\\land");X(te,be,or,"\u2228","\\lor");X(te,be,or,"\u2227","\\wedge",!0);X(te,be,or,"\u2228","\\vee",!0);X(te,be,Ze,"\u221A","\\surd");X(te,be,Ic,"\u27E8","\\langle",!0);X(te,be,Ic,"\u2223","\\lvert");X(te,be,Ic,"\u2225","\\lVert");X(te,be,cl,"?","?");X(te,be,cl,"!","!");X(te,be,cl,"\u27E9","\\rangle",!0);X(te,be,cl,"\u2223","\\rvert");X(te,be,cl,"\u2225","\\rVert");X(te,be,Ye,"=","=");X(te,be,Ye,":",":");X(te,be,Ye,"\u2248","\\approx",!0);X(te,be,Ye,"\u2245","\\cong",!0);X(te,be,Ye,"\u2265","\\ge");X(te,be,Ye,"\u2265","\\geq",!0);X(te,be,Ye,"\u2190","\\gets");X(te,be,Ye,">","\\gt",!0);X(te,be,Ye,"\u2208","\\in",!0);X(te,be,Ye,"\uE020","\\@not");X(te,be,Ye,"\u2282","\\subset",!0);X(te,be,Ye,"\u2283","\\supset",!0);X(te,be,Ye,"\u2286","\\subseteq",!0);X(te,be,Ye,"\u2287","\\supseteq",!0);X(te,He,Ye,"\u2288","\\nsubseteq",!0);X(te,He,Ye,"\u2289","\\nsupseteq",!0);X(te,be,Ye,"\u22A8","\\models");X(te,be,Ye,"\u2190","\\leftarrow",!0);X(te,be,Ye,"\u2264","\\le");X(te,be,Ye,"\u2264","\\leq",!0);X(te,be,Ye,"<","\\lt",!0);X(te,be,Ye,"\u2192","\\rightarrow",!0);X(te,be,Ye,"\u2192","\\to");X(te,He,Ye,"\u2271","\\ngeq",!0);X(te,He,Ye,"\u2270","\\nleq",!0);X(te,be,i0,"\xA0","\\ ");X(te,be,i0,"\xA0","\\space");X(te,be,i0,"\xA0","\\nobreakspace");X(It,be,i0,"\xA0","\\ ");X(It,be,i0,"\xA0"," ");X(It,be,i0,"\xA0","\\space");X(It,be,i0,"\xA0","\\nobreakspace");X(te,be,i0,"","\\nobreak");X(te,be,i0,"","\\allowbreak");X(te,be,u5,",",",");X(te,be,u5,";",";");X(te,He,or,"\u22BC","\\barwedge",!0);X(te,He,or,"\u22BB","\\veebar",!0);X(te,be,or,"\u2299","\\odot",!0);X(te,be,or,"\u2295","\\oplus",!0);X(te,be,or,"\u2297","\\otimes",!0);X(te,be,Ze,"\u2202","\\partial",!0);X(te,be,or,"\u2298","\\oslash",!0);X(te,He,or,"\u229A","\\circledcirc",!0);X(te,He,or,"\u22A1","\\boxdot",!0);X(te,be,or,"\u25B3","\\bigtriangleup");X(te,be,or,"\u25BD","\\bigtriangledown");X(te,be,or,"\u2020","\\dagger");X(te,be,or,"\u22C4","\\diamond");X(te,be,or,"\u22C6","\\star");X(te,be,or,"\u25C3","\\triangleleft");X(te,be,or,"\u25B9","\\triangleright");X(te,be,Ic,"{","\\{");X(It,be,Ze,"{","\\{");X(It,be,Ze,"{","\\textbraceleft");X(te,be,cl,"}","\\}");X(It,be,Ze,"}","\\}");X(It,be,Ze,"}","\\textbraceright");X(te,be,Ic,"{","\\lbrace");X(te,be,cl,"}","\\rbrace");X(te,be,Ic,"[","\\lbrack",!0);X(It,be,Ze,"[","\\lbrack",!0);X(te,be,cl,"]","\\rbrack",!0);X(It,be,Ze,"]","\\rbrack",!0);X(te,be,Ic,"(","\\lparen",!0);X(te,be,cl,")","\\rparen",!0);X(It,be,Ze,"<","\\textless",!0);X(It,be,Ze,">","\\textgreater",!0);X(te,be,Ic,"\u230A","\\lfloor",!0);X(te,be,cl,"\u230B","\\rfloor",!0);X(te,be,Ic,"\u2308","\\lceil",!0);X(te,be,cl,"\u2309","\\rceil",!0);X(te,be,Ze,"\\","\\backslash");X(te,be,Ze,"\u2223","|");X(te,be,Ze,"\u2223","\\vert");X(It,be,Ze,"|","\\textbar",!0);X(te,be,Ze,"\u2225","\\|");X(te,be,Ze,"\u2225","\\Vert");X(It,be,Ze,"\u2225","\\textbardbl");X(It,be,Ze,"~","\\textasciitilde");X(It,be,Ze,"\\","\\textbackslash");X(It,be,Ze,"^","\\textasciicircum");X(te,be,Ye,"\u2191","\\uparrow",!0);X(te,be,Ye,"\u21D1","\\Uparrow",!0);X(te,be,Ye,"\u2193","\\downarrow",!0);X(te,be,Ye,"\u21D3","\\Downarrow",!0);X(te,be,Ye,"\u2195","\\updownarrow",!0);X(te,be,Ye,"\u21D5","\\Updownarrow",!0);X(te,be,ja,"\u2210","\\coprod");X(te,be,ja,"\u22C1","\\bigvee");X(te,be,ja,"\u22C0","\\bigwedge");X(te,be,ja,"\u2A04","\\biguplus");X(te,be,ja,"\u22C2","\\bigcap");X(te,be,ja,"\u22C3","\\bigcup");X(te,be,ja,"\u222B","\\int");X(te,be,ja,"\u222B","\\intop");X(te,be,ja,"\u222C","\\iint");X(te,be,ja,"\u222D","\\iiint");X(te,be,ja,"\u220F","\\prod");X(te,be,ja,"\u2211","\\sum");X(te,be,ja,"\u2A02","\\bigotimes");X(te,be,ja,"\u2A01","\\bigoplus");X(te,be,ja,"\u2A00","\\bigodot");X(te,be,ja,"\u222E","\\oint");X(te,be,ja,"\u222F","\\oiint");X(te,be,ja,"\u2230","\\oiiint");X(te,be,ja,"\u2A06","\\bigsqcup");X(te,be,ja,"\u222B","\\smallint");X(It,be,db,"\u2026","\\textellipsis");X(te,be,db,"\u2026","\\mathellipsis");X(It,be,db,"\u2026","\\ldots",!0);X(te,be,db,"\u2026","\\ldots",!0);X(te,be,db,"\u22EF","\\@cdots",!0);X(te,be,db,"\u22F1","\\ddots",!0);X(te,be,Ze,"\u22EE","\\varvdots");X(It,be,Ze,"\u22EE","\\varvdots");X(te,be,na,"\u02CA","\\acute");X(te,be,na,"\u02CB","\\grave");X(te,be,na,"\xA8","\\ddot");X(te,be,na,"~","\\tilde");X(te,be,na,"\u02C9","\\bar");X(te,be,na,"\u02D8","\\breve");X(te,be,na,"\u02C7","\\check");X(te,be,na,"^","\\hat");X(te,be,na,"\u20D7","\\vec");X(te,be,na,"\u02D9","\\dot");X(te,be,na,"\u02DA","\\mathring");X(te,be,Br,"\uE131","\\@imath");X(te,be,Br,"\uE237","\\@jmath");X(te,be,Ze,"\u0131","\u0131");X(te,be,Ze,"\u0237","\u0237");X(It,be,Ze,"\u0131","\\i",!0);X(It,be,Ze,"\u0237","\\j",!0);X(It,be,Ze,"\xDF","\\ss",!0);X(It,be,Ze,"\xE6","\\ae",!0);X(It,be,Ze,"\u0153","\\oe",!0);X(It,be,Ze,"\xF8","\\o",!0);X(It,be,Ze,"\xC6","\\AE",!0);X(It,be,Ze,"\u0152","\\OE",!0);X(It,be,Ze,"\xD8","\\O",!0);X(It,be,na,"\u02CA","\\'");X(It,be,na,"\u02CB","\\`");X(It,be,na,"\u02C6","\\^");X(It,be,na,"\u02DC","\\~");X(It,be,na,"\u02C9","\\=");X(It,be,na,"\u02D8","\\u");X(It,be,na,"\u02D9","\\.");X(It,be,na,"\xB8","\\c");X(It,be,na,"\u02DA","\\r");X(It,be,na,"\u02C7","\\v");X(It,be,na,"\xA8",'\\"');X(It,be,na,"\u02DD","\\H");X(It,be,na,"\u25EF","\\textcircled");var xve={"--":!0,"---":!0,"``":!0,"''":!0};X(It,be,Ze,"\u2013","--",!0);X(It,be,Ze,"\u2013","\\textendash");X(It,be,Ze,"\u2014","---",!0);X(It,be,Ze,"\u2014","\\textemdash");X(It,be,Ze,"\u2018","`",!0);X(It,be,Ze,"\u2018","\\textquoteleft");X(It,be,Ze,"\u2019","'",!0);X(It,be,Ze,"\u2019","\\textquoteright");X(It,be,Ze,"\u201C","``",!0);X(It,be,Ze,"\u201C","\\textquotedblleft");X(It,be,Ze,"\u201D","''",!0);X(It,be,Ze,"\u201D","\\textquotedblright");X(te,be,Ze,"\xB0","\\degree",!0);X(It,be,Ze,"\xB0","\\degree");X(It,be,Ze,"\xB0","\\textdegree",!0);X(te,be,Ze,"\xA3","\\pounds");X(te,be,Ze,"\xA3","\\mathsterling",!0);X(It,be,Ze,"\xA3","\\pounds");X(It,be,Ze,"\xA3","\\textsterling",!0);X(te,He,Ze,"\u2720","\\maltese");X(It,He,Ze,"\u2720","\\maltese");var Oye='0123456789/@."';for(M8=0;M8<Oye.length;M8++)xG=Oye.charAt(M8),X(te,be,Ze,xG,xG);var xG,M8,Pye='0123456789!@*()-=+";:?/.,';for(N8=0;N8<Pye.length;N8++)bG=Pye.charAt(N8),X(It,be,Ze,bG,bG);var bG,N8,W8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(D8=0;D8<W8.length;D8++)r5=W8.charAt(D8),X(te,be,Br,r5,r5),X(It,be,Ze,r5,r5);var r5,D8;X(te,He,Ze,"C","\u2102");X(It,He,Ze,"C","\u2102");X(te,He,Ze,"H","\u210D");X(It,He,Ze,"H","\u210D");X(te,He,Ze,"N","\u2115");X(It,He,Ze,"N","\u2115");X(te,He,Ze,"P","\u2119");X(It,He,Ze,"P","\u2119");X(te,He,Ze,"Q","\u211A");X(It,He,Ze,"Q","\u211A");X(te,He,Ze,"R","\u211D");X(It,He,Ze,"R","\u211D");X(te,He,Ze,"Z","\u2124");X(It,He,Ze,"Z","\u2124");X(te,be,Br,"h","\u210E");X(It,be,Br,"h","\u210E");var sn;for(Bo=0;Bo<W8.length;Bo++)ha=W8.charAt(Bo),sn=String.fromCharCode(55349,56320+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56372+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56424+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56580+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56684+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56736+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56788+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56840+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56944+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),Bo<26&&(sn=String.fromCharCode(55349,56632+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56476+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn));var ha,Bo;sn="\u{1D55C}";X(te,be,Br,"k",sn);X(It,be,Ze,"k",sn);for(dm=0;dm<10;dm++)e0=dm.toString(),sn=String.fromCharCode(55349,57294+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn),sn=String.fromCharCode(55349,57314+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn),sn=String.fromCharCode(55349,57324+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn),sn=String.fromCharCode(55349,57334+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn);var e0,dm,PG="\xD0\xDE\xFE";for(O8=0;O8<PG.length;O8++)n5=PG.charAt(O8),X(te,be,Br,n5,n5),X(It,be,Ze,n5,n5);var n5,O8,BG={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},Bye={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},Fye={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},uxt={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},ay={mathClass:"",textClass:"",font:""},$ye={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},zye={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},Gye={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},FG={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},$G={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},qye={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},zG={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},Vye=[BG,BG,Bye,Bye,Fye,Fye,uxt,ay,ay,ay,$ye,$ye,zye,zye,Gye,Gye,FG,FG,$G,$G,qye,qye,ay,ay,zG,zG],hxt=[BG,ay,FG,$G,zG],fxt=e=>{var t=e.charCodeAt(0),r=e.charCodeAt(1),n=(t-55296)*1024+(r-56320)+65536;if(119808<=n&&n<120484){var i=Math.floor((n-119808)/26);return Vye[i]}else if(120782<=n&&n<=120831){var a=Math.floor((n-120782)/10);return hxt[a]}else{if(n===120485||n===120486)return Vye[0];if(120486<n&&n<120782)return ay;throw new $t("Unsupported character: "+e)}},Q8=function(t,r,n){if(ra[n][t]){var i=ra[n][t].replace;i&&(t=i)}return{value:t,metrics:tq(t,r,n)}},sl=function(t,r,n,i,a){var s=Q8(t,r,n),o=s.metrics;t=s.value;var l;if(o){var u=o.italic;(n==="text"||i&&i.font==="mathit")&&(u=0),l=new ll(t,o.height,o.depth,u,o.skew,o.width,a)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+r+"' and mode '"+n+"'")),l=new ll(t,0,0,0,0,0,a);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var h=i.getColor();h&&(l.style.color=h)}return l},rq=function(t,r,n,i){return i===void 0&&(i=[]),n.font==="boldsymbol"&&Q8(t,"Main-Bold",r).metrics?sl(t,"Main-Bold",r,n,i.concat(["mathbf"])):t==="\\"||ra[r][t].font==="main"?sl(t,"Main-Regular",r,n,i):sl(t,"AMS-Regular",r,n,i.concat(["amsrm"]))},dxt=function(t,r,n){return n!=="textord"&&Q8(t,"Math-BoldItalic",r).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},J8=function(t,r,n){var i=t.mode,a=t.text,s=["mord"],{font:o,fontFamily:l,fontWeight:u,fontShape:h}=r,f=i==="math"||i==="text"&&!!o,d=f?o:l,p="",m="";if(a.charCodeAt(0)===55349){var g=fxt(a);p=g.font,m=g[i+"Class"]}if(p)return sl(a,p,i,r,s.concat(m));if(d){var y,v;if(d==="boldsymbol"){var x=dxt(a,i,n);y=x.fontName,v=[x.fontClass]}else f?(y=GG[o].fontName,v=[o]):(y=P8(l,u,h),v=[l,u,h]);if(Q8(a,y,i).metrics)return sl(a,y,i,r,s.concat(v));if(xve.hasOwnProperty(a)&&y.slice(0,10)==="Typewriter"){for(var w=[],C=0;C<a.length;C++)w.push(sl(a[C],y,i,r,s.concat(v)));return a0(w)}}if(n==="mathord")return sl(a,"Math-Italic",i,r,s.concat(["mathnormal"]));if(n==="textord"){var T=ra[i][a]&&ra[i][a].font;if(T==="ams"){var k=P8("amsrm",u,h);return sl(a,k,i,r,s.concat("amsrm",u,h))}else if(T==="main"||!T){var S=P8("textrm",u,h);return sl(a,S,i,r,s.concat(u,h))}else{var E=P8(T,u,h);return sl(a,E,i,r,s.concat(E,u,h))}}else throw new Error("unexpected type: "+n+" in makeOrd")},pxt=(e,t)=>{if(gm(e.classes)!==gm(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n of Object.keys(e.style))if(e.style[n]!==t.style[n])return!1;for(var i of Object.keys(t.style))if(e.style[i]!==t.style[i])return!1;return!0},bve=e=>{for(var t=0;t<e.length-1;t++){var r=e[t],n=e[t+1];r instanceof ll&&n instanceof ll&&pxt(r,n)&&(r.text+=n.text,r.height=Math.max(r.height,n.height),r.depth=Math.max(r.depth,n.depth),r.italic=n.italic,e.splice(t+1,1),t--)}return e},nq=function(t){for(var r=0,n=0,i=0,a=0;a<t.children.length;a++){var s=t.children[a];s.height>r&&(r=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}t.height=r,t.depth=n,t.maxFontSize=i},Nt=function(t,r,n,i){var a=new ym(t,r,n,i);return nq(a),a},vm=(e,t,r,n)=>new ym(e,t,r,n),hb=function(t,r,n){var i=Nt([t],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=Ut(i.height),i.maxFontSize=1,i},mxt=function(t,r,n,i){var a=new ub(t,r,n,i);return nq(a),a},a0=function(t){var r=new mm(t);return nq(r),r},fb=function(t,r){return t instanceof mm?Nt([],[t],r):t},gxt=function(t){if(t.positionType==="individualShift"){for(var r=t.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,s=1;s<r.length;s++){var o=-r[s].shift-a-r[s].elem.depth,l=o-(r[s-1].elem.height+r[s-1].elem.depth);a=a+o,n.push({type:"kern",size:l}),n.push(r[s])}return{children:n,depth:i}}var u;if(t.positionType==="top"){for(var h=t.positionData,f=0;f<t.children.length;f++){var d=t.children[f];h-=d.type==="kern"?d.size:d.elem.height+d.elem.depth}u=h}else if(t.positionType==="bottom")u=-t.positionData;else{var p=t.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")u=-p.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")u=-p.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:u}},oi=function(t,r){for(var{children:n,depth:i}=gxt(t),a=0,s=0;s<n.length;s++){var o=n[s];if(o.type==="elem"){var l=o.elem;a=Math.max(a,l.maxFontSize,l.height)}}a+=2;var u=Nt(["pstrut"],[]);u.style.height=Ut(a);for(var h=[],f=i,d=i,p=i,m=0;m<n.length;m++){var g=n[m];if(g.type==="kern")p+=g.size;else{var y=g.elem,v=g.wrapperClasses||[],x=g.wrapperStyle||{},w=Nt(v,[u,y],void 0,x);w.style.top=Ut(-a-p-y.depth),g.marginLeft&&(w.style.marginLeft=g.marginLeft),g.marginRight&&(w.style.marginRight=g.marginRight),h.push(w),p+=y.height+y.depth}f=Math.min(f,p),d=Math.max(d,p)}var C=Nt(["vlist"],h);C.style.height=Ut(d);var T;if(f<0){var k=Nt([],[]),S=Nt(["vlist"],[k]);S.style.height=Ut(-f);var E=Nt(["vlist-s"],[new ll("\u200B")]);T=[Nt(["vlist-r"],[C,E]),Nt(["vlist-r"],[S])]}else T=[Nt(["vlist-r"],[C])];var I=Nt(["vlist-t"],T);return T.length===2&&I.classes.push("vlist-t2"),I.height=d,I.depth=-f,I},wve=(e,t)=>{var r=Nt(["mspace"],[],t),n=da(e,t);return r.style.marginRight=Ut(n),r},P8=(e,t,r)=>{var n,i;switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return t==="textbf"&&r==="textit"?i="BoldItalic":t==="textbf"?i="Bold":r==="textit"?i="Italic":i="Regular",n+"-"+i},GG={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},kve={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Tve=function(t,r){var[n,i,a]=kve[t],s=new uf(n),o=new sh([s],{width:Ut(i),height:Ut(a),style:"width:"+Ut(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),l=vm(["overlay"],[o],r);return l.height=a,l.style.height=Ut(a),l.style.width=Ut(i),l},fa={number:3,unit:"mu"},iy={number:4,unit:"mu"},t0={number:5,unit:"mu"},yxt={mord:{mop:fa,mbin:iy,mrel:t0,minner:fa},mop:{mord:fa,mop:fa,mrel:t0,minner:fa},mbin:{mord:iy,mop:iy,mopen:iy,minner:iy},mrel:{mord:t0,mop:t0,mopen:t0,minner:t0},mopen:{},mclose:{mop:fa,mbin:iy,mrel:t0,minner:fa},mpunct:{mord:fa,mop:fa,mrel:t0,mopen:fa,mclose:fa,mpunct:fa,minner:fa},minner:{mord:fa,mop:fa,mbin:iy,mrel:t0,mopen:fa,mpunct:fa,minner:fa}},vxt={mord:{mop:fa},mop:{mord:fa,mop:fa},mbin:{},mrel:{},mopen:{},mclose:{mop:fa},mpunct:{},minner:{mop:fa}},Cve={},H8={},U8={};function ir(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l<r.length;++l)Cve[r[l]]=o;t&&(a&&(H8[t]=a),s&&(U8[t]=s))}function sy(e){var{type:t,htmlBuilder:r,mathmlBuilder:n}=e;ir({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:r,mathmlBuilder:n})}var Y8=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Xa=function(t){return t.type==="ordgroup"?t.body:[t]},xxt=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),bxt=new Set(["rightmost","mrel","mclose","mpunct"]),wxt={display:dn.DISPLAY,text:dn.TEXT,script:dn.SCRIPT,scriptscript:dn.SCRIPTSCRIPT},kxt={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ds=function(t,r,n,i){i===void 0&&(i=[null,null]);for(var a=[],s=0;s<t.length;s++){var o=li(t[s],r);if(o instanceof mm){var l=o.children;a.push(...l)}else a.push(o)}if(bve(a),!n)return a;var u=r;if(t.length===1){var h=t[0];h.type==="sizing"?u=r.havingSize(h.size):h.type==="styling"&&(u=r.havingStyle(wxt[h.style]))}var f=Nt([i[0]||"leftmost"],[],r),d=Nt([i[1]||"rightmost"],[],r),p=n==="root";return qG(a,(m,g)=>{var y=g.classes[0],v=m.classes[0];y==="mbin"&&bxt.has(v)?g.classes[0]="mord":v==="mbin"&&xxt.has(y)&&(m.classes[0]="mord")},{node:f},d,p),qG(a,(m,g)=>{var y,v,x=WG(g),w=WG(m),C=x&&w?m.hasClass("mtight")?(y=vxt[x])==null?void 0:y[w]:(v=yxt[x])==null?void 0:v[w]:null;if(C)return wve(C,u)},{node:f},d,p),a},qG=function(t,r,n,i,a){i&&t.push(i);for(var s=0;s<t.length;s++){var o=t[s],l=Sve(o);if(l){qG(l.children,r,n,null,a);continue}var u=!o.hasClass("mspace");if(u){var h=r(o,n.node);h&&(n.insertAfter?n.insertAfter(h):(t.unshift(h),s++))}u?n.node=o:a&&o.hasClass("newline")&&(n.node=Nt(["leftmost"])),n.insertAfter=(f=>d=>{t.splice(f+1,0,d),s++})(s)}i&&t.pop()},Sve=function(t){return t instanceof mm||t instanceof ub||t instanceof ym&&t.hasClass("enclosing")?t:null},VG=function(t,r){var n=Sve(t);if(n){var i=n.children;if(i.length){if(r==="right")return VG(i[i.length-1],"right");if(r==="left")return VG(i[0],"left")}}return t},WG=function(t,r){if(!t)return null;r&&(t=VG(t,r));var n=t.classes[0];return kxt[n]||null},c5=function(t,r){var n=["nulldelimiter"].concat(t.baseSizingClasses());return Nt(r.concat(n))},li=function(t,r,n){if(!t)return Nt();if(H8[t.type]){var i=H8[t.type](t,r);if(n&&r.size!==n.size){i=Nt(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new $t("Got group of unknown type: '"+t.type+"'")};function B8(e,t){var r=Nt(["base"],e,t),n=Nt(["strut"]);return n.style.height=Ut(r.height+r.depth),r.depth&&(n.style.verticalAlign=Ut(-r.depth)),r.children.unshift(n),r}function HG(e,t){var r=null;e.length===1&&e[0].type==="tag"&&(r=e[0].tag,e=e[0].body);var n=ds(e,t,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var a=[],s=[],o=0;o<n.length;o++)if(s.push(n[o]),n[o].hasClass("mbin")||n[o].hasClass("mrel")||n[o].hasClass("allowbreak")){for(var l=!1;o<n.length-1&&n[o+1].hasClass("mspace")&&!n[o+1].hasClass("newline");)o++,s.push(n[o]),n[o].hasClass("nobreak")&&(l=!0);l||(a.push(B8(s,t)),s=[])}else n[o].hasClass("newline")&&(s.pop(),s.length>0&&(a.push(B8(s,t)),s=[]),a.push(n[o]));s.length>0&&a.push(B8(s,t));var u;r?(u=B8(ds(r,t,!0),t),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=Nt(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=Ut(h.height+h.depth),h.depth&&(f.style.verticalAlign=Ut(-h.depth))}return h}function Eve(e){return new mm(e)}var Ot=class{constructor(t,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=gm(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Ta&&this.children[n+1]instanceof Ta){for(var i=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Ta;)i+=this.children[++n].toText();t.appendChild(new Ta(i).toNode())}else t.appendChild(this.children[n].toNode());return t}toMarkup(){var t="<"+this.type;for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(t+=" "+r+'="',t+=Fo(this.attributes[r]),t+='"');this.classes.length>0&&(t+=' class ="'+Fo(gm(this.classes))+'"'),t+=">";for(var n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}},Ta=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Fo(this.toText())}toText(){return this.text}},X8=class{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character="\u200A":t>=.1666&&t<=.1667?this.character="\u2009":t>=.2222&&t<=.2223?this.character="\u2005":t>=.2777&&t<=.2778?this.character="\u2005\u200A":t>=-.05556&&t<=-.05555?this.character="\u200A\u2063":t>=-.1667&&t<=-.1666?this.character="\u2009\u2063":t>=-.2223&&t<=-.2222?this.character="\u205F\u2063":t>=-.2778&&t<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Ut(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ut(this.width)+'"/>'}toText(){return this.character?this.character:" "}},Txt=new Set(["\\imath","\\jmath"]),Cxt=new Set(["mrow","mtable"]),bu=function(t,r,n){return ra[r][t]&&ra[r][t].replace&&t.charCodeAt(0)!==55349&&!(xve.hasOwnProperty(t)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(t=ra[r][t].replace),new Ta(t)},iq=function(t){return t.length===1?t[0]:new Ot("mrow",t)},Sxt={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},aq=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var r=t.font;if(!r||r==="mathnormal")return null;var n=e.mode,i=Sxt[r];if(i)return typeof i=="function"?i(e):i;var a=e.text;if(Txt.has(a))return null;if(ra[n][a]){var s=ra[n][a].replace;s&&(a=s)}var o=GG[r].fontName;return tq(a,o,n)?GG[r].variant:null};function wG(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Ta&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof Ta&&r.text===","}else return!1}var Mc=function(t,r,n){if(t.length===1){var i=Ii(t[0],r);return n&&i instanceof Ot&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],s,o=0;o<t.length;o++){var l=Ii(t[o],r);if(l instanceof Ot&&s instanceof Ot){if(l.type==="mtext"&&s.type==="mtext"&&l.getAttribute("mathvariant")===s.getAttribute("mathvariant")){s.children.push(...l.children);continue}else if(l.type==="mn"&&s.type==="mn"){s.children.push(...l.children);continue}else if(wG(l)&&s.type==="mn"){s.children.push(...l.children);continue}else if(l.type==="mn"&&wG(s))l.children=[...s.children,...l.children],a.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(s.type==="mn"||wG(s))){var u=l.children[0];u instanceof Ot&&u.type==="mn"&&(u.children=[...s.children,...u.children],a.pop())}else if(s.type==="mi"&&s.children.length===1){var h=s.children[0];if(h instanceof Ta&&h.text==="\u0338"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var f=l.children[0];f instanceof Ta&&f.text.length>0&&(f.text=f.text.slice(0,1)+"\u0338"+f.text.slice(1),a.pop())}}}a.push(l),s=l}return a},xm=function(t,r,n){return iq(Mc(t,r,n))},Ii=function(t,r){if(!t)return new Ot("mrow");if(U8[t.type])return U8[t.type](t,r);throw new $t("Got group of unknown type: '"+t.type+"'")};function Wye(e,t,r,n,i){var a=Mc(e,r),s;a.length===1&&a[0]instanceof Ot&&Cxt.has(a[0].type)?s=a[0]:s=new Ot("mrow",a);var o=new Ot("annotation",[new Ta(t)]);o.setAttribute("encoding","application/x-tex");var l=new Ot("semantics",[s,o]),u=new Ot("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return Nt([h],[u])}var Ext=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Hye=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Uye=function(t,r){return r.size<2?t:Ext[t-1][r.size-1]},j8=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=Hye[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(r,t),new e(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:Uye(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:Hye[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=Uye(e.BASESIZE,t);return this.size===r&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==e.BASESIZE?["sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=cxt(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};j8.BASESIZE=6;var Ave=function(t){return new j8({style:t.displayMode?dn.DISPLAY:dn.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},_ve=function(t,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),t=Nt(n,[t])}return t},Axt=function(t,r,n){var i=Ave(n),a;if(n.output==="mathml")return Wye(t,r,i,n.displayMode,!0);if(n.output==="html"){var s=HG(t,i);a=Nt(["katex"],[s])}else{var o=Wye(t,r,i,n.displayMode,!1),l=HG(t,i);a=Nt(["katex"],[o,l])}return _ve(a,n)},_xt=function(t,r,n){var i=Ave(n),a=HG(t,i),s=Nt(["katex"],[a]);return _ve(s,n)},Rxt={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",underbracket:"\u23B5",overbracket:"\u23B4",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",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},eA=function(t){var r=new Ot("mo",[new Ta(Rxt[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},Lxt={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"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,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"],"\\cdlongequal":[["longequal"],3,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],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["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],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ixt=new Set(["widehat","widecheck","widetilde","utilde"]),tA=function(t,r){function n(){var o=4e5,l=t.label.slice(1);if(Ixt.has(l)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,h,f,d;if(u>5)l==="widehat"||l==="widecheck"?(h=420,o=2364,d=.42,f=l+"4"):(h=312,o=2340,d=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][p],h=[0,239,300,360,420][p],d=[0,.24,.3,.3,.36,.42][p],f=l+p):(o=[0,600,1033,2339,2340][p],h=[0,260,286,306,312][p],d=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var m=new uf(f),g=new sh([m],{width:"100%",height:Ut(d),viewBox:"0 0 "+o+" "+h,preserveAspectRatio:"none"});return{span:vm([],[g],r),minWidth:0,height:d}}else{var y=[],v=Lxt[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[x,w,C]=v,T=C/1e3,k=x.length,S,E;if(k===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');S=["hide-tail"],E=[v[3]]}else if(k===2)S=["halfarrow-left","halfarrow-right"],E=["xMinYMin","xMaxYMin"];else if(k===3)S=["brace-left","brace-center","brace-right"],E=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+k+" children.");for(var I=0;I<k;I++){var L=new uf(x[I]),O=new sh([L],{width:"400em",height:Ut(T),viewBox:"0 0 "+o+" "+C,preserveAspectRatio:E[I]+" slice"}),R=vm([S[I]],[O],r);if(k===1)return{span:R,minWidth:w,height:T};R.style.height=Ut(T),y.push(R)}return{span:Nt(["stretchy"],y,r),minWidth:w,height:T}}}var{span:i,minWidth:a,height:s}=n();return i.height=s,i.style.height=Ut(s),a>0&&(i.style.minWidth=Ut(a)),i},Mxt=function(t,r,n,i,a){var s,o=t.height+t.depth+n+i;if(/fbox|color|angl/.test(r)){if(s=Nt(["stretchy",r],[],a),r==="fbox"){var l=a.color&&a.getColor();l&&(s.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new l5({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new l5({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new sh(u,{width:"100%",height:Ut(o)});s=vm([],[h],a)}return s.height=o,s.style.height=Ut(o),s},Nxt={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Dxt={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function Oxt(e){return e in Nxt}function kn(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function rA(e){var t=nA(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function nA(e){return e&&(e.type==="atom"||Dxt.hasOwnProperty(e.type))?e:null}var Rve=e=>{if(e instanceof ll)return e;if(oxt(e)&&e.children.length===1)return Rve(e.children[0])},sq=(e,t)=>{var r,n,i;e&&e.type==="supsub"?(n=kn(e.base,"accent"),r=n.base,e.base=r,i=sxt(li(e,t)),e.base=n):(n=kn(e,"accent"),r=n.base);var a=li(r,t.havingCrampedStyle()),s=n.isShifty&&n0(r),o=0;if(s){var l,u;o=(l=(u=Rve(a))==null?void 0:u.skew)!=null?l:0}var h=n.label==="\\c",f=h?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),d;if(n.isStretchy)d=tA(n,t),d=oi({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+Ut(2*o)+")",marginLeft:Ut(2*o)}:void 0}]});else{var p,m;n.label==="\\vec"?(p=Tve("vec",t),m=kve.vec[1]):(p=J8({type:"textord",mode:n.mode,text:n.label},t,"textord"),p=axt(p),p.italic=0,m=p.width,h&&(f+=p.depth)),d=Nt(["accent-body"],[p]);var g=n.label==="\\textcircled";g&&(d.classes.push("accent-full"),f=a.height);var y=o;g||(y-=m/2),d.style.left=Ut(y),n.label==="\\textcircled"&&(d.style.top=".2em"),d=oi({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-f},{type:"elem",elem:d}]})}var v=Nt(["mord","accent"],[d],t);return i?(i.children[0]=v,i.height=Math.max(v.height,i.height),i.classes[0]="mord",i):v},Lve=(e,t)=>{var r=e.isStretchy?eA(e.label):new Ot("mo",[bu(e.label,e.mode)]),n=new Ot("mover",[Ii(e.base,t),r]);return n.setAttribute("accent","true"),n},Pxt=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));ir({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=Y8(t[0]),n=!Pxt.test(e.funcName),i=!n||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:sq,mathmlBuilder:Lve});ir({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],n=e.parser.mode;return n==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:sq,mathmlBuilder:Lve});ir({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(e,t)=>{var r=li(e.base,t),n=tA(e,t),i=e.label==="\\utilde"?.12:0,a=oi({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]});return Nt(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var r=eA(e.label),n=new Ot("munder",[Ii(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var F8=e=>{var t=new Ot("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};ir({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n,funcName:i}=e;return{type:"xArrow",mode:n.mode,label:i,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,n=t.havingStyle(r.sup()),i=fb(li(e.body,n,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var s;e.below&&(n=t.havingStyle(r.sub()),s=fb(li(e.below,n,t),t),s.classes.push(a+"-arrow-pad"));var o=tA(e,t),l=-t.fontMetrics().axisHeight+.5*o.height,u=-t.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(s){var f=-t.fontMetrics().axisHeight+s.height+.5*o.height+.111;h=oi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:s,shift:f}]})}else h=oi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return Nt(["mrel","x-arrow"],[h],t)},mathmlBuilder(e,t){var r=eA(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(e.body){var i=F8(Ii(e.body,t));if(e.below){var a=F8(Ii(e.below,t));n=new Ot("munderover",[r,a,i])}else n=new Ot("mover",[r,i])}else if(e.below){var s=F8(Ii(e.below,t));n=new Ot("munder",[r,s])}else n=F8(),n=new Ot("mover",[r,n]);return n}});function Ive(e,t){var r=ds(e.body,t,!0);return Nt([e.mclass],r,t)}function Mve(e,t){var r,n=Mc(e.body,t);return e.mclass==="minner"?r=new Ot("mpadded",n):e.mclass==="mord"?e.isCharacterBox?(r=n[0],r.type="mi"):r=new Ot("mi",n):(e.isCharacterBox?(r=n[0],r.type="mo"):r=new Ot("mo",n),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}ir({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:Xa(i),isCharacterBox:n0(i)}},htmlBuilder:Ive,mathmlBuilder:Mve});var iA=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};ir({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:iA(t[0]),body:Xa(t[1]),isCharacterBox:n0(t[1])}}});ir({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:n}=e,i=t[1],a=t[0],s;n!=="\\stackrel"?s=iA(i):s="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:Xa(i)},l={type:"supsub",mode:a.mode,base:o,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:s,body:[l],isCharacterBox:n0(l)}},htmlBuilder:Ive,mathmlBuilder:Mve});ir({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:iA(t[0]),body:Xa(t[0])}},htmlBuilder(e,t){var r=ds(e.body,t,!0),n=Nt([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=Mc(e.body,t),n=new Ot("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var Bxt={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Yye=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),Xye=e=>e.type==="textord"&&e.text==="@",Fxt=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function $xt(e,t,r){var n=Bxt[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},s=r.callFunction("\\Big",[a],[]),o=r.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[i,s,o]};return r.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function zxt(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new $t("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var n=[],i=[n],a=0;a<t.length;a++){for(var s=t[a],o=Yye(),l=0;l<s.length;l++)if(!Xye(s[l]))o.body.push(s[l]);else{n.push(o),l+=1;var u=rA(s[l]).text,h=new Array(2);if(h[0]={type:"ordgroup",mode:"math",body:[]},h[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(u))if("<>AV".includes(u))for(var f=0;f<2;f++){for(var d=!0,p=l+1;p<s.length;p++){if(Fxt(s[p],u)){d=!1,l=p;break}if(Xye(s[p]))throw new $t("Missing a "+u+" character to complete a CD arrow.",s[p]);h[f].body.push(s[p])}if(d)throw new $t("Missing a "+u+" character to complete a CD arrow.",s[l])}else throw new $t('Expected one of "<>AV=|." after @',s[l]);var m=$xt(u,h,e),g={type:"styling",body:[m],mode:"math",style:"display",resetFont:!0};n.push(g),o=Yye()}a%2===0?n.push(o):n.shift(),n=[],i.push(n)}e.gullet.endGroup(),e.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}ir({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=fb(li(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=Ut(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new Ot("mrow",[Ii(e.label,t)]);return r=new Ot("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new Ot("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});ir({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=fb(li(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new Ot("mrow",[Ii(e.fragment,t)])}});ir({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,n=kn(t[0],"ordgroup"),i=n.body,a="",s=0;s<i.length;s++){var o=kn(i[s],"textord");a+=o.text}var l=parseInt(a),u;if(isNaN(l))throw new $t("\\@char has non-numeric argument "+a);if(l<0||l>=1114111)throw new $t("\\@char with invalid code point "+a);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});var Nve=(e,t)=>{var r=ds(e.body,t.withColor(e.color),!1);return a0(r)},Dve=(e,t)=>{var r=Mc(e.body,t.withColor(e.color)),n=new Ot("mstyle",r);return n.setAttribute("mathcolor",e.color),n};ir({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,n=kn(t[0],"color-token").color,i=t[1];return{type:"color",mode:r.mode,color:n,body:Xa(i)}},htmlBuilder:Nve,mathmlBuilder:Dve});ir({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:n}=e,i=kn(t[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:Nve,mathmlBuilder:Dve});ir({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:n}=e,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&kn(i,"size").value}},htmlBuilder(e,t){var r=Nt(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=Ut(da(e.size,t)))),r},mathmlBuilder(e,t){var r=new Ot("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",Ut(da(e.size,t)))),r}});var UG={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Ove=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new $t("Expected a control sequence",e);return t},Gxt=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},Pve=(e,t,r,n)=>{var i=e.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,i,n)};ir({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var n=t.fetch();if(UG[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=UG[n.text]),kn(t.parseFunction(),"internal");throw new $t("Invalid token after macro prefix",n)}});ir({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=t.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new $t("Expected a control sequence",n);for(var a=0,s,o=[[]];t.gullet.future().text!=="{";)if(n=t.gullet.popToken(),n.text==="#"){if(t.gullet.future().text==="{"){s=t.gullet.future(),o[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new $t('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new $t('Argument number "'+n.text+'" out of order');a++,o.push([])}else{if(n.text==="EOF")throw new $t("Expected a macro definition");o[a].push(n.text)}var{tokens:l}=t.gullet.consumeArg();return s&&l.unshift(s),(r==="\\edef"||r==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(i,{tokens:l,numArgs:a,delimiters:o},r===UG[r]),{type:"internal",mode:t.mode}}});ir({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=Ove(t.gullet.popToken());t.gullet.consumeSpaces();var i=Gxt(t);return Pve(t,n,i,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});ir({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=Ove(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return Pve(t,n,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var i5=function(t,r,n){var i=ra.math[t]&&ra.math[t].replace,a=tq(i||t,r,n);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},oq=function(t,r,n,i){var a=n.havingBaseStyle(r),s=Nt(i.concat(a.sizingClasses(n)),[t],n),o=a.sizeMultiplier/n.sizeMultiplier;return s.height*=o,s.depth*=o,s.maxFontSize=a.sizeMultiplier,s},Bve=function(t,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Ut(a),t.height-=a,t.depth+=a},qxt=function(t,r,n,i,a,s){var o=sl(t,"Main-Regular",a,i),l=oq(o,r,i,s);return n&&Bve(l,i,r),l},Vxt=function(t,r,n,i){return sl(t,"Size"+r+"-Regular",n,i)},Fve=function(t,r,n,i,a,s){var o=Vxt(t,r,a,i),l=oq(Nt(["delimsizing","size"+r],[o],i),dn.TEXT,i,s);return n&&Bve(l,i,dn.TEXT),l},kG=function(t,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=Nt(["delimsizinginner",i],[Nt([],[sl(t,r,n)])]);return{type:"elem",elem:a}},TG=function(t,r,n){var i=cf["Size4-Regular"][t.charCodeAt(0)]?cf["Size4-Regular"][t.charCodeAt(0)][4]:cf["Size1-Regular"][t.charCodeAt(0)][4],a=new uf("inner",J2t(t,Math.round(1e3*r))),s=new sh([a],{width:Ut(i),height:Ut(r),style:"width:"+Ut(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),o=vm([],[s],n);return o.height=r,o.style.height=Ut(r),o.style.width=Ut(i),{type:"elem",elem:o}},YG=.008,$8={type:"kern",size:-1*YG},Wxt=new Set(["|","\\lvert","\\rvert","\\vert"]),Hxt=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),$ve=function(t,r,n,i,a,s){var o,l,u,h,f="",d=0;o=u=h=t,l=null;var p="Size1-Regular";t==="\\uparrow"?u=h="\u23D0":t==="\\Uparrow"?u=h="\u2016":t==="\\downarrow"?o=u="\u23D0":t==="\\Downarrow"?o=u="\u2016":t==="\\updownarrow"?(o="\\uparrow",u="\u23D0",h="\\downarrow"):t==="\\Updownarrow"?(o="\\Uparrow",u="\u2016",h="\\Downarrow"):Wxt.has(t)?(u="\u2223",f="vert",d=333):Hxt.has(t)?(u="\u2225",f="doublevert",d=556):t==="["||t==="\\lbrack"?(o="\u23A1",u="\u23A2",h="\u23A3",p="Size4-Regular",f="lbrack",d=667):t==="]"||t==="\\rbrack"?(o="\u23A4",u="\u23A5",h="\u23A6",p="Size4-Regular",f="rbrack",d=667):t==="\\lfloor"||t==="\u230A"?(u=o="\u23A2",h="\u23A3",p="Size4-Regular",f="lfloor",d=667):t==="\\lceil"||t==="\u2308"?(o="\u23A1",u=h="\u23A2",p="Size4-Regular",f="lceil",d=667):t==="\\rfloor"||t==="\u230B"?(u=o="\u23A5",h="\u23A6",p="Size4-Regular",f="rfloor",d=667):t==="\\rceil"||t==="\u2309"?(o="\u23A4",u=h="\u23A5",p="Size4-Regular",f="rceil",d=667):t==="("||t==="\\lparen"?(o="\u239B",u="\u239C",h="\u239D",p="Size4-Regular",f="lparen",d=875):t===")"||t==="\\rparen"?(o="\u239E",u="\u239F",h="\u23A0",p="Size4-Regular",f="rparen",d=875):t==="\\{"||t==="\\lbrace"?(o="\u23A7",l="\u23A8",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(o="\u23AB",l="\u23AC",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lgroup"||t==="\u27EE"?(o="\u23A7",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\rgroup"||t==="\u27EF"?(o="\u23AB",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lmoustache"||t==="\u23B0"?(o="\u23A7",h="\u23AD",u="\u23AA",p="Size4-Regular"):(t==="\\rmoustache"||t==="\u23B1")&&(o="\u23AB",h="\u23A9",u="\u23AA",p="Size4-Regular");var m=i5(o,p,a),g=m.height+m.depth,y=i5(u,p,a),v=y.height+y.depth,x=i5(h,p,a),w=x.height+x.depth,C=0,T=1;if(l!==null){var k=i5(l,p,a);C=k.height+k.depth,T=2}var S=g+w+C,E=Math.max(0,Math.ceil((r-S)/(T*v))),I=S+E*T*v,L=i.fontMetrics().axisHeight;n&&(L*=i.sizeMultiplier);var O=I/2-L,R=[];if(f.length>0){var A=I-g-w,N=Math.round(I*1e3),M=ext(f,Math.round(A*1e3)),D=new uf(f,M),B=Ut(d/1e3),P=Ut(N/1e3),$=new sh([D],{width:B,height:P,viewBox:"0 0 "+d+" "+N}),F=vm([],[$],i);F.height=N/1e3,F.style.width=B,F.style.height=P,R.push({type:"elem",elem:F})}else{if(R.push(kG(h,p,a)),R.push($8),l===null){var q=I-g-w+2*YG;R.push(TG(u,q,i))}else{var G=(I-g-w-C)/2+2*YG;R.push(TG(u,G,i)),R.push($8),R.push(kG(l,p,a)),R.push($8),R.push(TG(u,G,i))}R.push($8),R.push(kG(o,p,a))}var z=i.havingBaseStyle(dn.TEXT),H=oi({positionType:"bottom",positionData:O,children:R});return oq(Nt(["delimsizing","mult"],[H],z),dn.TEXT,i,s)},CG=80,SG=.08,EG=function(t,r,n,i,a){var s=Q2t(t,i,n),o=new uf(t,s),l=new sh([o],{width:"400em",height:Ut(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return vm(["hide-tail"],[l],a)},Uxt=function(t,r){var n=r.havingBaseSizing(),i=Wve("\\surd",t*n.sizeMultiplier,Vve,n),a=n.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),o,l,u,h,f;return i.type==="small"?(h=1e3+1e3*s+CG,t<1?a=1:t<1.4&&(a=.7),l=(1+s+SG)/a,u=(1+s)/a,o=EG("sqrtMain",l,h,s,r),o.style.minWidth="0.853em",f=.833/a):i.type==="large"?(h=(1e3+CG)*a5[i.size],u=(a5[i.size]+s)/a,l=(a5[i.size]+s+SG)/a,o=EG("sqrtSize"+i.size,l,h,s,r),o.style.minWidth="1.02em",f=1/a):(l=t+s+SG,u=t+s,h=Math.floor(1e3*t+s)+CG,o=EG("sqrtTall",l,h,s,r),o.style.minWidth="0.742em",f=1.056),o.height=u,o.style.height=Ut(l),{span:o,advanceWidth:f,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*a}},zve=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"]),Yxt=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"]),Gve=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),a5=[0,1.2,1.8,2.4,3],qve=function(t,r,n,i,a){if(t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle"),zve.has(t)||Gve.has(t))return Fve(t,r,!1,n,i,a);if(Yxt.has(t))return $ve(t,a5[r],!1,n,i,a);throw new $t("Illegal delimiter: '"+t+"'")},Xxt=[{type:"small",style:dn.SCRIPTSCRIPT},{type:"small",style:dn.SCRIPT},{type:"small",style:dn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],jxt=[{type:"small",style:dn.SCRIPTSCRIPT},{type:"small",style:dn.SCRIPT},{type:"small",style:dn.TEXT},{type:"stack"}],Vve=[{type:"small",style:dn.SCRIPTSCRIPT},{type:"small",style:dn.SCRIPT},{type:"small",style:dn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Kxt=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var r=t.type;throw new Error("Add support for delim type '"+r+"' here.")},Wve=function(t,r,n,i){for(var a=Math.min(2,3-i.style.size),s=a;s<n.length;s++){var o=n[s];if(o.type==="stack")break;var l=i5(t,Kxt(o),"math"),u=l.height+l.depth;if(o.type==="small"){var h=i.havingBaseStyle(o.style);u*=h.sizeMultiplier}if(u>r)return o}return n[n.length-1]},XG=function(t,r,n,i,a,s){t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle");var o;Gve.has(t)?o=Xxt:zve.has(t)?o=Vve:o=jxt;var l=Wve(t,r,o,i);return l.type==="small"?qxt(t,l.style,n,i,a,s):l.type==="large"?Fve(t,l.size,n,i,a,s):$ve(t,r,n,i,a,s)},AG=function(t,r,n,i,a,s){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-o,n+o),f=Math.max(h/500*l,2*h-u);return XG(t,f,!0,i,a,s)},jye={"\\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}},Zxt=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function Kye(e){return"isMiddle"in e}function aA(e,t){var r=nA(e);if(r&&Zxt.has(r.text))return r;throw r?new $t("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new $t("Invalid delimiter type '"+e.type+"'",e)}ir({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=aA(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:jye[e.funcName].size,mclass:jye[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?Nt([e.mclass]):qve(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(bu(e.delim,e.mode));var r=new Ot("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=Ut(a5[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function Zye(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ir({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new $t("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:aA(t[0],e).text,color:r}}});ir({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=aA(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=kn(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{Zye(e);for(var r=ds(e.body,t,!0,["mopen","mclose"]),n=0,i=0,a=!1,s=0;s<r.length;s++){var o=r[s];Kye(o)?a=!0:(n=Math.max(r[s].height,n),i=Math.max(r[s].depth,i))}n*=t.sizeMultiplier,i*=t.sizeMultiplier;var l;if(e.left==="."?l=c5(t,["mopen"]):l=AG(e.left,n,i,t,e.mode,["mopen"]),r.unshift(l),a)for(var u=1;u<r.length;u++){var h=r[u];if(Kye(h)){var f=h.isMiddle;r[u]=AG(f.delim,n,i,f.options,e.mode,[])}}var d;if(e.right===".")d=c5(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;d=AG(e.right,n,i,p,e.mode,["mclose"])}return r.push(d),Nt(["minner"],r,t)},mathmlBuilder:(e,t)=>{Zye(e);var r=Mc(e.body,t);if(e.left!=="."){var n=new Ot("mo",[bu(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(e.right!=="."){var i=new Ot("mo",[bu(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),r.push(i)}return iq(r)}});ir({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=aA(t[0],e);if(!e.parser.leftrightDepth)throw new $t("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;return e.delim==="."?r=c5(t,[]):(r=qve(e.delim,1,t,e.mode,[]),r.isMiddle={delim:e.delim,options:t}),r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?bu("|","text"):bu(e.delim,e.mode),n=new Ot("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var sA=(e,t)=>{var r=fb(li(e.body,t),t),n=e.label.slice(1),i=t.sizeMultiplier,a,s,o=n0(e.body);if(n==="sout")a=Nt(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,s=-.5*t.fontMetrics().xHeight;else if(n==="phase"){var l=da({number:.6,unit:"pt"},t),u=da({number:.35,unit:"ex"},t),h=t.havingBaseSizing();i=i/h.sizeMultiplier;var f=r.height+r.depth+l+u;r.style.paddingLeft=Ut(f/2+l);var d=Math.floor(1e3*f*i),p=K2t(d),m=new sh([new uf("phase",p)],{width:"400em",height:Ut(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=vm(["hide-tail"],[m],t),a.style.height=Ut(f),s=r.depth+l+u}else{/cancel/.test(n)?o||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var g,y,v=0;/box/.test(n)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),g=t.fontMetrics().fboxsep+(n==="colorbox"?0:v),y=g):n==="angl"?(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),g=4*v,y=Math.max(0,.25-r.depth)):(g=o?.2:0,y=g),a=Mxt(r,n,g,y,t),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=Ut(v)):n==="angl"&&v!==.049&&(a.style.borderTopWidth=Ut(v),a.style.borderRightWidth=Ut(v)),s=r.depth+y,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var x;if(e.backgroundColor)x=oi({positionType:"individualShift",children:[{type:"elem",elem:a,shift:s},{type:"elem",elem:r,shift:0}]});else{var w=/cancel|phase/.test(n)?["svg-align"]:[];x=oi({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:s,wrapperClasses:w}]})}return/cancel/.test(n)&&(x.height=r.height,x.depth=r.depth),/cancel/.test(n)&&!o?Nt(["mord","cancel-lap"],[x],t):Nt(["mord"],[x],t)},oA=(e,t)=>{var r,n=new Ot(e.label.includes("colorbox")?"mpadded":"menclose",[Ii(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+Ut(i)+" solid "+e.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};ir({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=kn(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:s}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=kn(t[0],"color-token").color,s=kn(t[1],"color-token").color,o=t[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,borderColor:a,body:o}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});ir({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e;r.mode==="math"&&r.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});var Hve={};function hf(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<r.length;++l)Hve[r[l]]=o;a&&(H8[t]=a),s&&(U8[t]=s)}var Uve={};function Ae(e,t){Uve[e]=t}var Hl=class e{constructor(t,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=r,this.end=n}static range(t,r){return r?!t||!t.loc||!r.loc||t.loc.lexer!==r.loc.lexer?null:new e(t.loc.lexer,t.loc.start,r.loc.end):t&&t.loc}},Lc=class e{constructor(t,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=r}range(t,r){return new e(r,Hl.range(this,t))}};function Qye(e){var t=[];e.consumeSpaces();var r=e.fetch().text;for(r==="\\relax"&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);r==="\\hline"||r==="\\hdashline";)e.consume(),t.push(r==="\\hdashline"),e.consumeSpaces(),r=e.fetch().text;return t}var lA=e=>{var t=e.parser.settings;if(!t.displayMode)throw new $t("{"+e.envName+"} can be used only in display mode.")},Qxt=new Set(["gather","gather*"]);function lq(e){if(!e.includes("ed"))return!e.includes("*")}function bm(e,t,r){var{hskipBeforeAndAfter:n,addJot:i,cols:a,arraystretch:s,colSeparationType:o,autoTag:l,singleRow:u,emptySingleRow:h,maxNumCols:f,leqno:d}=t;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!s){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)s=1;else if(s=parseFloat(p),!s||s<0)throw new $t("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var m=[],g=[m],y=[],v=[],x=l!=null?[]:void 0;function w(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function C(){x&&(e.gullet.macros.get("\\df@tag")?(x.push(e.subparse([new Lc("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):x.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),v.push(Qye(e));;){var T=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var k={type:"ordgroup",mode:e.mode,body:T};r&&(k={type:"styling",mode:e.mode,style:r,resetFont:!0,body:[k]}),m.push(k);var S=e.fetch().text;if(S==="&"){if(f&&m.length===f){if(u||o)throw new $t("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(S==="\\end"){C(),m.length===1&&k.type==="styling"&&k.body.length===1&&k.body[0].type==="ordgroup"&&k.body[0].body.length===0&&(g.length>1||!h)&&g.pop(),v.length<g.length+1&&v.push([]);break}else if(S==="\\\\"){e.consume();var E=void 0;e.gullet.future().text!==" "&&(E=e.parseSizeGroup(!0)),y.push(E?E.value:null),C(),v.push(Qye(e)),m=[],g.push(m),w()}else throw new $t("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:i,arraystretch:s,body:g,cols:a,rowGaps:y,hskipBeforeAndAfter:n,hLinesBeforeRow:v,colSeparationType:o,tags:x,leqno:d}}function cq(e){return e.slice(0,1)==="d"?"display":"text"}var ff=function(t,r){var n,i,a=t.body.length,s=t.hLinesBeforeRow,o=0,l=new Array(a),u=[],h=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),f=1/r.fontMetrics().ptPerEm,d=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var p=r.havingStyle(dn.SCRIPT).sizeMultiplier;d=.2778*(p/r.sizeMultiplier)}var m=t.colSeparationType==="CD"?da({number:3,unit:"ex"},r):12*f,g=3*f,y=t.arraystretch*m,v=.7*y,x=.3*y,w=0;function C(Ie){for(var ye=0;ye<Ie.length;++ye)ye>0&&(w+=.25),u.push({pos:w,isDashed:Ie[ye]})}for(C(s[0]),n=0;n<t.body.length;++n){var T=t.body[n],k=v,S=x;o<T.length&&(o=T.length);var E={cells:new Array(T.length),height:0,depth:0,pos:0};for(i=0;i<T.length;++i){var I=li(T[i],r);S<I.depth&&(S=I.depth),k<I.height&&(k=I.height),E.cells[i]=I}var L=t.rowGaps[n],O=0;L&&(O=da(L,r),O>0&&(O+=x,S<O&&(S=O),O=0)),t.addJot&&n<t.body.length-1&&(S+=g),E.height=k,E.depth=S,w+=k,E.pos=w,w+=S+O,l[n]=E,C(s[n+1])}var R=w/2+r.fontMetrics().axisHeight,A=t.cols||[],N=[],M,D,B=[];if(t.tags&&t.tags.some(Ie=>Ie))for(n=0;n<a;++n){var P=l[n],$=P.pos-R,F=t.tags[n],q=void 0;F===!0?q=Nt(["eqn-num"],[],r):F===!1?q=Nt([],[],r):q=Nt([],ds(F,r,!0),r),q.depth=P.depth,q.height=P.height,B.push({type:"elem",elem:q,shift:$})}for(i=0,D=0;i<o||D<A.length;++i,++D){for(var G,z=A[D],H=!0;((j=z)==null?void 0:j.type)==="separator";){var j;if(H||(M=Nt(["arraycolsep"],[]),M.style.width=Ut(r.fontMetrics().doubleRuleSep),N.push(M)),z.separator==="|"||z.separator===":"){var J=z.separator==="|"?"solid":"dashed",U=Nt(["vertical-separator"],[],r);U.style.height=Ut(w),U.style.borderRightWidth=Ut(h),U.style.borderRightStyle=J,U.style.margin="0 "+Ut(-h/2);var le=w-R;le&&(U.style.verticalAlign=Ut(-le)),N.push(U)}else throw new $t("Invalid separator type: "+z.separator);D++,z=A[D],H=!1}if(!(i>=o)){var ee=void 0;if(i>0||t.hskipBeforeAndAfter){var ue,ae;ee=(ue=(ae=z)==null?void 0:ae.pregap)!=null?ue:d,ee!==0&&(M=Nt(["arraycolsep"],[]),M.style.width=Ut(ee),N.push(M))}var oe=[];for(n=0;n<a;++n){var Re=l[n],Te=Re.cells[i];if(Te){var Oe=Re.pos-R;Te.depth=Re.depth,Te.height=Re.height,oe.push({type:"elem",elem:Te,shift:Oe})}}var qe=oi({positionType:"individualShift",children:oe}),Ge=Nt(["col-align-"+(((G=z)==null?void 0:G.align)||"c")],[qe]);if(N.push(Ge),i<o-1||t.hskipBeforeAndAfter){var fe,Ce;ee=(fe=(Ce=z)==null?void 0:Ce.postgap)!=null?fe:d,ee!==0&&(M=Nt(["arraycolsep"],[]),M.style.width=Ut(ee),N.push(M))}}}var _e=Nt(["mtable"],N);if(u.length>0){for(var de=hb("hline",r,h),ie=hb("hdashline",r,h),Q=[{type:"elem",elem:_e,shift:0}];u.length>0;){var he=u.pop(),xe=he.pos-R;he.isDashed?Q.push({type:"elem",elem:ie,shift:xe}):Q.push({type:"elem",elem:de,shift:xe})}_e=oi({positionType:"individualShift",children:Q})}if(B.length===0)return Nt(["mord"],[_e],r);var ce=oi({positionType:"individualShift",children:B}),ge=Nt(["tag"],[ce],r);return a0([_e,ge])},Jxt={c:"center ",l:"left ",r:"right "},df=function(t,r){for(var n=[],i=new Ot("mtd",[],["mtr-glue"]),a=new Ot("mtd",[],["mml-eqn-num"]),s=0;s<t.body.length;s++){for(var o=t.body[s],l=[],u=0;u<o.length;u++)l.push(new Ot("mtd",[Ii(o[u],r)]));t.tags&&t.tags[s]&&(l.unshift(i),l.push(i),t.leqno?l.unshift(a):l.push(a)),n.push(new Ot("mtr",l))}var h=new Ot("mtable",n),f=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);h.setAttribute("rowspacing",Ut(f));var d="",p="";if(t.cols&&t.cols.length>0){var m=t.cols,g="",y=!1,v=0,x=m.length;m[0].type==="separator"&&(d+="top ",v=1),m[m.length-1].type==="separator"&&(d+="bottom ",x-=1);for(var w=v;w<x;w++){var C=m[w];C.type==="align"?(p+=Jxt[C.align],y&&(g+="none "),y=!0):C.type==="separator"&&y&&(g+=C.separator==="|"?"solid ":"dashed ",y=!1)}h.setAttribute("columnalign",p.trim()),/[sd]/.test(g)&&h.setAttribute("columnlines",g.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],k="",S=1;S<T.length;S++)k+=S%2?"0em ":"1em ";h.setAttribute("columnspacing",k.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?h.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?h.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?h.setAttribute("columnspacing","0.5em"):h.setAttribute("columnspacing","1em");var E="",I=t.hLinesBeforeRow;d+=I[0].length>0?"left ":"",d+=I[I.length-1].length>0?"right ":"";for(var L=1;L<I.length-1;L++)E+=I[L].length===0?"none ":I[L][0]?"dashed ":"solid ";return/[sd]/.test(E)&&h.setAttribute("rowlines",E.trim()),d!==""&&(h=new Ot("menclose",[h]),h.setAttribute("notation",d.trim())),t.arraystretch&&t.arraystretch<1&&(h=new Ot("mstyle",[h]),h.setAttribute("scriptlevel","1")),h},Yve=function(t,r){t.envName.includes("ed")||lA(t);var n=[],i=t.envName.includes("at")?"alignat":"align",a=t.envName==="split",s=bm(t.parser,{cols:n,addJot:!0,autoTag:a?void 0:lq(t.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:a?2:void 0,leqno:t.parser.settings.leqno},"display"),o=0,l=0,u={type:"ordgroup",mode:t.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var h="",f=0;f<r[0].body.length;f++){var d=kn(r[0].body[f],"textord");h+=d.text}o=Number(h),l=o*2}var p=!l;s.body.forEach(function(v){for(var x=1;x<v.length;x+=2){var w=kn(v[x],"styling"),C=kn(w.body[0],"ordgroup");C.body.unshift(u)}if(p)l<v.length&&(l=v.length);else{var T=v.length/2;if(o<T)throw new $t("Too many math in a row: "+("expected "+o+", but got "+T),v[0])}});for(var m=0;m<l;++m){var g="r",y=0;m%2===1?g="l":m>0&&p&&(y=1),n[m]={type:"align",align:g,pregap:y,postgap:0}}return s.colSeparationType=p?"align":"alignat",s};hf({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=nA(t[0]),n=r?[t[0]]:kn(t[0],"ordgroup").body,i=n.map(function(s){var o=rA(s),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new $t("Unknown column alignment: "+l,s)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return bm(e.parser,a,cq(e.envName))},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,!"lcr".includes(r))throw new $t("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=bm(e.parser,n,cq(e.envName)),s=Math.max(0,...a.body.map(o=>o.length));return a.cols=new Array(s).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=bm(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=nA(t[0]),n=r?[t[0]]:kn(t[0],"ordgroup").body,i=n.map(function(o){var l=rA(o),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new $t("Unknown column alignment: "+u,o)});if(i.length>1)throw new $t("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5},s=bm(e.parser,a,"script");if(s.body.length>0&&s.body[0].length>1)throw new $t("{subarray} can contain only one column");return s},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=bm(e.parser,t,cq(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Yve,htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){Qxt.has(e.envName)&&lA(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:lq(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return bm(e.parser,t,"display")},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Yve,htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){lA(e);var t={autoTag:lq(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return bm(e.parser,t,"display")},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["CD"],props:{numArgs:0},handler(e){return lA(e),zxt(e.parser)},htmlBuilder:ff,mathmlBuilder:df});Ae("\\nonumber","\\gdef\\@eqnsw{0}");Ae("\\notag","\\nonumber");ir({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new $t(e.funcName+" valid only within array environment")}});var Jye=Hve;ir({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];if(i.type!=="ordgroup")throw new $t("Invalid environment name",i);for(var a="",s=0;s<i.body.length;++s)a+=kn(i.body[s],"textord").text;if(n==="\\begin"){if(!Jye.hasOwnProperty(a))throw new $t("No such environment: "+a,i);var o=Jye[a],{args:l,optArgs:u}=r.parseArguments("\\begin{"+a+"}",o),h={mode:r.mode,envName:a,parser:r},f=o.handler(h,l,u);r.expect("\\end",!1);var d=r.nextToken,p=kn(r.parseFunction(),"environment");if(p.name!==a)throw new $t("Mismatch: \\begin{"+a+"} matched by \\end{"+p.name+"}",d);return f}return{type:"environment",mode:r.mode,name:a,nameGroup:i}}});var Xve=(e,t)=>{var r=e.font,n=t.withFont(r);return li(e.body,n)},jve=(e,t)=>{var r=e.font,n=t.withFont(r);return Ii(e.body,n)},eve={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};ir({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=Y8(t[0]),a=n;return a in eve&&(a=eve[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:Xve,mathmlBuilder:jve});ir({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"mclass",mode:r.mode,mclass:iA(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:n0(n)}}});ir({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,breakOnTokenText:i}=e,{mode:a}=r,s=r.parseExpression(!0,i);return{type:"font",mode:a,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:s}}},htmlBuilder:Xve,mathmlBuilder:jve});var ebt=(e,t)=>{var r=t.style,n=r.fracNum(),i=r.fracDen(),a;a=t.havingStyle(n);var s=li(e.numer,a,t);if(e.continued){var o=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height<o?o:s.height,s.depth=s.depth<l?l:s.depth}a=t.havingStyle(i);var u=li(e.denom,a,t),h,f,d;e.hasBarLine?(e.barSize?(f=da(e.barSize,t),h=hb("frac-line",t,f)):h=hb("frac-line",t),f=h.height,d=h.height):(h=null,f=0,d=t.fontMetrics().defaultRuleThickness);var p,m,g;r.size===dn.DISPLAY.size?(p=t.fontMetrics().num1,f>0?m=3*d:m=7*d,g=t.fontMetrics().denom1):(f>0?(p=t.fontMetrics().num2,m=d):(p=t.fontMetrics().num3,m=3*d),g=t.fontMetrics().denom2);var y;if(h){var x=t.fontMetrics().axisHeight;p-s.depth-(x+.5*f)<m&&(p+=m-(p-s.depth-(x+.5*f))),x-.5*f-(u.height-g)<m&&(g+=m-(x-.5*f-(u.height-g)));var w=-(x-.5*f);y=oi({positionType:"individualShift",children:[{type:"elem",elem:u,shift:g},{type:"elem",elem:h,shift:w},{type:"elem",elem:s,shift:-p}]})}else{var v=p-s.depth-(u.height-g);v<m&&(p+=.5*(m-v),g+=.5*(m-v)),y=oi({positionType:"individualShift",children:[{type:"elem",elem:u,shift:g},{type:"elem",elem:s,shift:-p}]})}a=t.havingStyle(r),y.height*=a.sizeMultiplier/t.sizeMultiplier,y.depth*=a.sizeMultiplier/t.sizeMultiplier;var C;r.size===dn.DISPLAY.size?C=t.fontMetrics().delim1:r.size===dn.SCRIPTSCRIPT.size?C=t.havingStyle(dn.SCRIPT).fontMetrics().delim2:C=t.fontMetrics().delim2;var T,k;return e.leftDelim==null?T=c5(t,["mopen"]):T=XG(e.leftDelim,C,!0,t.havingStyle(r),e.mode,["mopen"]),e.continued?k=Nt([]):e.rightDelim==null?k=c5(t,["mclose"]):k=XG(e.rightDelim,C,!0,t.havingStyle(r),e.mode,["mclose"]),Nt(["mord"].concat(a.sizingClasses(t)),[T,Nt(["mfrac"],[y]),k],t)},tbt=(e,t)=>{var r=new Ot("mfrac",[Ii(e.numer,t),Ii(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var n=da(e.barSize,t);r.setAttribute("linethickness",Ut(n))}if(e.leftDelim!=null||e.rightDelim!=null){var i=[];if(e.leftDelim!=null){var a=new Ot("mo",[new Ta(e.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}if(i.push(r),e.rightDelim!=null){var s=new Ot("mo",[new Ta(e.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}return iq(i)}return r},Kve=(e,t)=>{if(!t)return e;var r={type:"styling",mode:e.mode,style:t,body:[e]};return r};ir({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1],s,o=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,o="(",l=")";break;case"\\\\bracefrac":s=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var u=n==="\\cfrac",h=null;return u||n.startsWith("\\d")?h="display":n.startsWith("\\t")&&(h="text"),Kve({type:"genfrac",mode:r.mode,numer:i,denom:a,continued:u,hasBarLine:s,leftDelim:o,rightDelim:l,barSize:null},h)},htmlBuilder:ebt,mathmlBuilder:tbt});ir({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:n}=e,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:n}}});var tve=["display","text","script","scriptscript"],rve=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};ir({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,n=t[4],i=t[5],a=Y8(t[0]),s=a.type==="atom"&&a.family==="open"?rve(a.text):null,o=Y8(t[1]),l=o.type==="atom"&&o.family==="close"?rve(o.text):null,u=kn(t[2],"size"),h,f=null;u.isBlank?h=!0:(f=u.value,h=f.number>0);var d=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var m=kn(p.body[0],"textord");d=tve[Number(m.text)]}}else p=kn(p,"textord"),d=tve[Number(p.text)];return Kve({type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:f,leftDelim:s,rightDelim:l},d)}});ir({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:n,token:i}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:kn(t[0],"size").value,token:i}}});ir({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=kn(t[1],"infix").size;if(!a)throw new Error("\\\\abovefrac expected size, but got "+String(a));var s=t[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:s,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null}}});var Zve=(e,t)=>{var r=t.style,n,i;e.type==="supsub"?(n=e.sup?li(e.sup,t.havingStyle(r.sup()),t):li(e.sub,t.havingStyle(r.sub()),t),i=kn(e.base,"horizBrace")):i=kn(e,"horizBrace");var a=li(i.base,t.havingBaseStyle(dn.DISPLAY)),s=tA(i,t),o;if(i.isOver?o=oi({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):o=oi({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:a}]}),n){var l=Nt(["minner",i.isOver?"mover":"munder"],[o],t);i.isOver?o=oi({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):o=oi({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Nt(["minner",i.isOver?"mover":"munder"],[o],t)},rbt=(e,t)=>{var r=eA(e.label);return new Ot(e.isOver?"mover":"munder",[Ii(e.base,t),r])};ir({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:t[0]}},htmlBuilder:Zve,mathmlBuilder:rbt});ir({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[1],i=kn(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:Xa(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=ds(e.body,t,!1);return mxt(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=xm(e.body,t);return r instanceof Ot||(r=new Ot("mrow",[r])),r.setAttribute("href",e.href),r}});ir({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=kn(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a<n.length;a++){var s=n[a];s==="~"&&(s="\\textasciitilde"),i.push({type:"textord",mode:"text",text:s})}var o={type:"text",mode:r.mode,font:"\\texttt",body:i};return{type:"href",mode:r.mode,href:n,body:Xa(o)}}});ir({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:r}=e;return{type:"hbox",mode:r.mode,body:Xa(t[0])}},htmlBuilder(e,t){var r=ds(e.body,t.withFont(""),!1);return a0(r)},mathmlBuilder(e,t){return new Ot("mrow",Mc(e.body,t.withFont("")))}});ir({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,token:i}=e,a=kn(t[0],"raw").string,s=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(n){case"\\htmlClass":l.class=a,o={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,o={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,o={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h<u.length;h++){var f=u[h],d=f.indexOf("=");if(d<0)throw new $t("\\htmlData key/value '"+f+"' missing equals sign");var p=f.slice(0,d),m=f.slice(d+1);l["data-"+p.trim()]=m}o={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(o)?{type:"html",mode:r.mode,attributes:l,body:Xa(s)}:r.formatUnsupportedCmd(n)},htmlBuilder:(e,t)=>{var r=ds(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var i=Nt(n,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>xm(e.body,t)});ir({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:Xa(t[0]),mathml:Xa(t[1])}},htmlBuilder:(e,t)=>{var r=ds(e.html,t,!1);return a0(r)},mathmlBuilder:(e,t)=>xm(e.mathml,t)});var _G=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new $t("Invalid size: '"+t+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!mve(n))throw new $t("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};ir({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:n}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},s={number:0,unit:"em"},o="";if(r[0])for(var l=kn(r[0],"raw").string,u=l.split(","),h=0;h<u.length;h++){var f=u[h].split("=");if(f.length===2){var d=f[1].trim();switch(f[0].trim()){case"alt":o=d;break;case"width":i=_G(d);break;case"height":a=_G(d);break;case"totalheight":s=_G(d);break;default:throw new $t("Invalid key: '"+f[0]+"' in \\includegraphics.")}}}var p=kn(t[0],"url").url;return o===""&&(o=p,o=o.replace(/^.*[\\/]/,""),o=o.substring(0,o.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:n.mode,alt:o,width:i,height:a,totalheight:s,src:p}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var r=da(e.height,t),n=0;e.totalheight.number>0&&(n=da(e.totalheight,t)-r);var i=0;e.width.number>0&&(i=da(e.width,t));var a={height:Ut(r+n)};i>0&&(a.width=Ut(i)),n>0&&(a.verticalAlign=Ut(-n));var s=new OG(e.src,e.alt,a);return s.height=r,s.depth=n,s},mathmlBuilder:(e,t)=>{var r=new Ot("mglyph",[]);r.setAttribute("alt",e.alt);var n=da(e.height,t),i=0;if(e.totalheight.number>0&&(i=da(e.totalheight,t)-n,r.setAttribute("valign",Ut(-i))),r.setAttribute("height",Ut(n+i)),e.width.number>0){var a=da(e.width,t);r.setAttribute("width",Ut(a))}return r.setAttribute("src",e.src),r}});ir({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=kn(t[0],"size");if(r.settings.strict){var a=n[1]==="m",s=i.value.unit==="mu";a?(s||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):s&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(e,t){return wve(e.dimension,t)},mathmlBuilder(e,t){var r=da(e.dimension,t);return new X8(r)}});ir({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=Nt([],[li(e.body,t)]),r=Nt(["inner"],[r],t)):r=Nt(["inner"],[li(e.body,t)]);var n=Nt(["fix"],[]),i=Nt([e.alignment],[r,n],t),a=Nt(["strut"]);return a.style.height=Ut(i.height+i.depth),i.depth&&(a.style.verticalAlign=Ut(-i.depth)),i.children.unshift(a),i=Nt(["thinbox"],[i],t),Nt(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var r=new Ot("mpadded",[Ii(e.body,t)]);if(e.alignment!=="rlap"){var n=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});ir({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:n}=e,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",s=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",resetFont:!0,body:s}}});ir({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new $t("Mismatched "+e.funcName)}});var nve=(e,t)=>{switch(t.style.size){case dn.DISPLAY.size:return e.display;case dn.TEXT.size:return e.text;case dn.SCRIPT.size:return e.script;case dn.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};ir({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:Xa(t[0]),text:Xa(t[1]),script:Xa(t[2]),scriptscript:Xa(t[3])}},htmlBuilder:(e,t)=>{var r=nve(e,t),n=ds(r,t,!1);return a0(n)},mathmlBuilder:(e,t)=>{var r=nve(e,t);return xm(r,t)}});var Qve=(e,t,r,n,i,a,s)=>{e=Nt([],[e]);var o=r&&n0(r),l,u;if(t){var h=li(t,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var f=li(r,n.havingStyle(i.sub()),n);l={elem:f,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-f.height)}}var d;if(u&&l){var p=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+s;d=oi({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ut(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Ut(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var m=e.height-s;d=oi({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ut(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(u){var g=e.depth+s;d=oi({positionType:"bottom",positionData:g,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Ut(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return e;var y=[d];if(l&&a!==0&&!o){var v=Nt(["mspace"],[],n);v.style.marginRight=Ut(a),y.unshift(v)}return Nt(["mop","op-limits"],y,n)},Jve=new Set(["\\smallint"]),pb=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=kn(e.base,"op"),i=!0):a=kn(e,"op");var s=t.style,o=!1;s.size===dn.DISPLAY.size&&a.symbol&&!Jve.has(a.name)&&(o=!0);var l,u;if(a.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(f=a.name.slice(1),a.name=f==="oiint"?"\\iint":"\\iiint"),l=sl(a.name,h,"math",t,["mop","op-symbol",o?"large-op":"small-op"]),u=l.italic,f.length>0){var d=Tve(f+"Size"+(o?"2":"1"),t);l=oi({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:d,shift:o?.08:0}]}),a.name="\\"+f,l.classes.unshift("mop"),l.italic=u}}else if(a.body){var p=ds(a.body,t,!0);p.length===1&&p[0]instanceof ll?(l=p[0],l.classes[0]="mop"):l=Nt(["mop"],p,t)}else{for(var m=[],g=1;g<a.name.length;g++)m.push(rq(a.name[g],a.mode,t));l=Nt(["mop"],m,t)}var y=0,v=0;if((l instanceof ll||a.name==="\\oiint"||a.name==="\\oiiint")&&!a.suppressBaseShift){var x;y=(l.height-l.depth)/2-t.fontMetrics().axisHeight,v=(x=l.italic)!=null?x:0}return i?Qve(l,r,n,t,s,v,y):(y&&(l.style.position="relative",l.style.top=Ut(y)),l)},h5=(e,t)=>{var r;if(e.symbol)r=new Ot("mo",[bu(e.name,e.mode)]),Jve.has(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new Ot("mo",Mc(e.body,t));else{r=new Ot("mi",[new Ta(e.name.slice(1))]);var n=new Ot("mo",[bu("\u2061","text")]);e.parentIsSupSub?r=new Ot("mrow",[r,n]):r=Eve([r,n])}return r},nbt={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};ir({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=n;return i.length===1&&(i=nbt[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:pb,mathmlBuilder:h5});ir({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Xa(n)}},htmlBuilder:pb,mathmlBuilder:h5});var ibt={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};ir({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:pb,mathmlBuilder:h5});ir({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:pb,mathmlBuilder:h5});ir({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:r}=e,n=r;return n.length===1&&(n=ibt[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:pb,mathmlBuilder:h5});var e2e=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=kn(e.base,"operatorname"),i=!0):a=kn(e,"operatorname");var s;if(a.body.length>0){for(var o=a.body.map(f=>{var d="text"in f?f.text:void 0;return typeof d=="string"?{type:"textord",mode:f.mode,text:d}:f}),l=ds(o,t.withFont("mathrm"),!0),u=0;u<l.length;u++){var h=l[u];h instanceof ll&&(h.text=h.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}s=Nt(["mop"],l,t)}else s=Nt(["mop"],[],t);return i?Qve(s,r,n,t,t.style,0,0):s},abt=(e,t)=>{for(var r=Mc(e.body,t.withFont("mathrm")),n=!0,i=0;i<r.length;i++){var a=r[i];if(!(a instanceof X8))if(a instanceof Ot)switch(a.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var s=a.children[0];a.children.length===1&&s instanceof Ta?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var o=r.map(h=>h.toText()).join("");r=[new Ta(o)]}var l=new Ot("mi",r);l.setAttribute("mathvariant","normal");var u=new Ot("mo",[bu("\u2061","text")]);return e.parentIsSupSub?new Ot("mrow",[l,u]):Eve([l,u])};ir({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"operatorname",mode:r.mode,body:Xa(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:e2e,mathmlBuilder:abt});Ae("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");sy({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?a0(ds(e.body,t,!1)):Nt(["mord"],ds(e.body,t,!0),t)},mathmlBuilder(e,t){return xm(e.body,t,!0)}});ir({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=li(e.body,t.havingCrampedStyle()),n=hb("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=oi({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]});return Nt(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new Ot("mo",[new Ta("\u203E")]);r.setAttribute("stretchy","true");var n=new Ot("mover",[Ii(e.body,t),r]);return n.setAttribute("accent","true"),n}});ir({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"phantom",mode:r.mode,body:Xa(n)}},htmlBuilder:(e,t)=>{var r=ds(e.body,t.withPhantom(),!1);return a0(r)},mathmlBuilder:(e,t)=>{var r=Mc(e.body,t);return new Ot("mphantom",r)}});Ae("\\hphantom","\\smash{\\phantom{#1}}");ir({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=Nt(["inner"],[li(e.body,t.withPhantom())]),n=Nt(["fix"],[]);return Nt(["mord","rlap"],[r,n],t)},mathmlBuilder:(e,t)=>{var r=Mc(Xa(e.body),t),n=new Ot("mphantom",r),i=new Ot("mpadded",[n]);return i.setAttribute("width","0px"),i}});ir({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,n=kn(t[0],"size").value,i=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(e,t){var r=li(e.body,t),n=da(e.dy,t);return oi({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Ot("mpadded",[Ii(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});ir({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});ir({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:n}=e,i=r[0],a=kn(t[0],"size"),s=kn(t[1],"size");return{type:"rule",mode:n.mode,shift:i&&kn(i,"size").value,width:a.value,height:s.value}},htmlBuilder(e,t){var r=Nt(["mord","rule"],[],t),n=da(e.width,t),i=da(e.height,t),a=e.shift?da(e.shift,t):0;return r.style.borderRightWidth=Ut(n),r.style.borderTopWidth=Ut(i),r.style.bottom=Ut(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=da(e.width,t),n=da(e.height,t),i=e.shift?da(e.shift,t):0,a=t.color&&t.getColor()||"black",s=new Ot("mspace");s.setAttribute("mathbackground",a),s.setAttribute("width",Ut(r)),s.setAttribute("height",Ut(n));var o=new Ot("mpadded",[s]);return i>=0?o.setAttribute("height",Ut(i)):(o.setAttribute("height",Ut(i)),o.setAttribute("depth",Ut(-i))),o.setAttribute("voffset",Ut(i)),o}});function t2e(e,t,r){for(var n=ds(e,t,!1),i=t.sizeMultiplier/r.sizeMultiplier,a=0;a<n.length;a++){var s=n[a].classes.indexOf("sizing");s<0?Array.prototype.push.apply(n[a].classes,t.sizingClasses(r)):n[a].classes[s+1]==="reset-size"+t.size&&(n[a].classes[s+1]="reset-size"+r.size),n[a].height*=i,n[a].depth*=i}return a0(n)}var ive=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],sbt=(e,t)=>{var r=t.havingSize(e.size);return t2e(e.body,r,t)};ir({type:"sizing",names:ive,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:ive.indexOf(n)+1,body:a}},htmlBuilder:sbt,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=Mc(e.body,r),i=new Ot("mstyle",n);return i.setAttribute("mathsize",Ut(r.sizeMultiplier)),i}});ir({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:n}=e,i=!1,a=!1,s=r[0]&&kn(r[0],"ordgroup");if(s)for(var o,l=0;l<s.body.length;++l){var u=s.body[l];if(o=rA(u).text,o==="t")i=!0;else if(o==="b")a=!0;else{i=!1,a=!1;break}}else i=!0,a=!0;var h=t[0];return{type:"smash",mode:n.mode,body:h,smashHeight:i,smashDepth:a}},htmlBuilder:(e,t)=>{var r=Nt([],[li(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0),e.smashDepth&&(r.depth=0),e.smashHeight&&e.smashDepth)return Nt(["mord","smash"],[r],t);if(r.children)for(var n=0;n<r.children.length;n++)e.smashHeight&&(r.children[n].height=0),e.smashDepth&&(r.children[n].depth=0);var i=oi({positionType:"firstBaseline",children:[{type:"elem",elem:r}]});return Nt(["mord"],[i],t)},mathmlBuilder:(e,t)=>{var r=new Ot("mpadded",[Ii(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});ir({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n}=e,i=r[0],a=t[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(e,t){var r=li(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=fb(r,t);var n=t.fontMetrics(),i=n.defaultRuleThickness,a=i;t.style.id<dn.TEXT.id&&(a=t.fontMetrics().xHeight);var s=i+a/4,o=r.height+r.depth+s+i,{span:l,ruleWidth:u,advanceWidth:h}=Uxt(o,t),f=l.height-u;f>r.height+r.depth+s&&(s=(s+f-r.height-r.depth)/2);var d=l.height-r.height-s-u;r.style.paddingLeft=Ut(h);var p=oi({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:l},{type:"kern",size:u}]});if(e.index){var m=t.havingStyle(dn.SCRIPTSCRIPT),g=li(e.index,m,t),y=.6*(p.height-p.depth),v=oi({positionType:"shift",positionData:-y,children:[{type:"elem",elem:g}]}),x=Nt(["root"],[v]);return Nt(["mord","sqrt"],[x,p],t)}else return Nt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:n}=e;return n?new Ot("mroot",[Ii(r,t),Ii(n,t)]):new Ot("msqrt",[Ii(r,t)])}});var jG={display:dn.DISPLAY,text:dn.TEXT,script:dn.SCRIPT,scriptscript:dn.SCRIPTSCRIPT};function obt(e){return e in jG}ir({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!0,r),s=n.slice(1,n.length-5);if(!obt(s))throw new Error("Unknown style: "+s);return{type:"styling",mode:i.mode,style:s,body:a}},htmlBuilder(e,t){var r=jG[e.style],n=t.havingStyle(r);return e.resetFont&&(n=n.withFont("")),t2e(e.body,n,t)},mathmlBuilder(e,t){var r=jG[e.style],n=t.havingStyle(r);e.resetFont&&(n=n.withFont(""));var i=Mc(e.body,n),a=new Ot("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=s[e.style];return a.setAttribute("scriptlevel",o[0]),a.setAttribute("displaystyle",o[1]),a}});var lbt=function(t,r){var n=t.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===dn.DISPLAY.size||n.alwaysHandleSupSub);return i?pb:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===dn.DISPLAY.size||n.limits);return a?e2e:null}else{if(n.type==="accent")return n0(n.base)?sq:null;if(n.type==="horizBrace"){var s=!t.sub;return s===n.isOver?Zve:null}else return null}else return null};sy({type:"supsub",htmlBuilder(e,t){var r=lbt(e,t);if(r)return r(e,t);var{base:n,sup:i,sub:a}=e,s=li(n,t),o,l,u=t.fontMetrics(),h=0,f=0,d=n&&n0(n);if(i){var p=t.havingStyle(t.style.sup());o=li(i,p,t),d||(h=s.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var m=t.havingStyle(t.style.sub());l=li(a,m,t),d||(f=s.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}var g;t.style===dn.DISPLAY?g=u.sup1:t.style.cramped?g=u.sup3:g=u.sup2;var y=t.sizeMultiplier,v=Ut(.5/u.ptPerEm/y),x=null;if(l){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(s instanceof ll||w){var C;x=Ut(-((C=s.italic)!=null?C:0))}}var T;if(o&&l){h=Math.max(h,g,o.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var k=u.defaultRuleThickness,S=4*k;if(h-o.depth-(l.height-f)<S){f=S-(h-o.depth)+l.height;var E=.8*u.xHeight-(h-o.depth);E>0&&(h+=E,f-=E)}var I=[{type:"elem",elem:l,shift:f,marginRight:v,marginLeft:x},{type:"elem",elem:o,shift:-h,marginRight:v}];T=oi({positionType:"individualShift",children:I})}else if(l){f=Math.max(f,u.sub1,l.height-.8*u.xHeight);var L=[{type:"elem",elem:l,marginLeft:x,marginRight:v}];T=oi({positionType:"shift",positionData:f,children:L})}else if(o)h=Math.max(h,g,o.depth+.25*u.xHeight),T=oi({positionType:"shift",positionData:-h,children:[{type:"elem",elem:o,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var O=WG(s,"right")||"mord";return Nt([O],[s,Nt(["msupsub"],[T])],t)},mathmlBuilder(e,t){var r=!1,n,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(r=!0,n=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[Ii(e.base,t)];e.sub&&a.push(Ii(e.sub,t)),e.sup&&a.push(Ii(e.sup,t));var s;if(r)s=n?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===dn.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===dn.DISPLAY||u.limits)?s="munderover":s="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===dn.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===dn.DISPLAY)?s="munder":s="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===dn.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===dn.DISPLAY)?s="mover":s="msup"}return new Ot(s,a)}});sy({type:"atom",htmlBuilder(e,t){return rq(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new Ot("mo",[bu(e.text,e.mode)]);if(e.family==="bin"){var n=aq(e,t);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});var r2e={mi:"italic",mn:"normal",mtext:"normal"};sy({type:"mathord",htmlBuilder(e,t){return J8(e,t,"mathord")},mathmlBuilder(e,t){var r=new Ot("mi",[bu(e.text,e.mode,t)]),n=aq(e,t)||"italic";return n!==r2e[r.type]&&r.setAttribute("mathvariant",n),r}});sy({type:"textord",htmlBuilder(e,t){return J8(e,t,"textord")},mathmlBuilder(e,t){var r=bu(e.text,e.mode,t),n=aq(e,t)||"normal",i;return e.mode==="text"?i=new Ot("mtext",[r]):/[0-9]/.test(e.text)?i=new Ot("mn",[r]):e.text==="\\prime"?i=new Ot("mo",[r]):i=new Ot("mi",[r]),n!==r2e[i.type]&&i.setAttribute("mathvariant",n),i}});var RG={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},LG={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};sy({type:"spacing",htmlBuilder(e,t){if(LG.hasOwnProperty(e.text)){var r=LG[e.text].className||"";if(e.mode==="text"){var n=J8(e,t,"textord");return n.classes.push(r),n}else return Nt(["mspace",r],[rq(e.text,e.mode,t)],t)}else{if(RG.hasOwnProperty(e.text))return Nt(["mspace",RG[e.text]],[],t);throw new $t('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(LG.hasOwnProperty(e.text))r=new Ot("mtext",[new Ta("\xA0")]);else{if(RG.hasOwnProperty(e.text))return new Ot("mspace");throw new $t('Unknown type of space "'+e.text+'"')}return r}});var ave=()=>{var e=new Ot("mtd",[]);return e.setAttribute("width","50%"),e};sy({type:"tag",mathmlBuilder(e,t){var r=new Ot("mtable",[new Ot("mtr",[ave(),new Ot("mtd",[xm(e.body,t)]),ave(),new Ot("mtd",[xm(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var sve={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},ove={"\\textbf":"textbf","\\textmd":"textmd"},cbt={"\\textit":"textit","\\textup":"textup"},lve=(e,t)=>{var r=e.font;if(r){if(sve[r])return t.withTextFontFamily(sve[r]);if(ove[r])return t.withTextFontWeight(ove[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(cbt[r])};ir({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"text",mode:r.mode,body:Xa(i),font:n}},htmlBuilder(e,t){var r=lve(e,t),n=ds(e.body,r,!0);return Nt(["mord","text"],n,r)},mathmlBuilder(e,t){var r=lve(e,t);return xm(e.body,r)}});ir({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=li(e.body,t),n=hb("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=oi({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]});return Nt(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new Ot("mo",[new Ta("\u203E")]);r.setAttribute("stretchy","true");var n=new Ot("munder",[Ii(e.body,t),r]);return n.setAttribute("accentunder","true"),n}});ir({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=li(e.body,t),n=t.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return oi({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Ot("mpadded",[Ii(e.body,t)],["vcenter"]);return new Ot("mrow",[r])}});ir({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new $t("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=cve(e),n=[],i=t.havingStyle(t.style.text()),a=0;a<r.length;a++){var s=r[a];s==="~"&&(s="\\textasciitilde"),n.push(sl(s,"Typewriter-Regular",e.mode,i,["mord","texttt"]))}return Nt(["mord","text"].concat(i.sizingClasses(t)),bve(n),i)},mathmlBuilder(e,t){var r=new Ta(cve(e)),n=new Ot("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});var cve=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),pm=Cve,n2e=`[ \r - ]`,ubt="\\\\[a-zA-Z@]+",hbt="\\\\[^\uD800-\uDFFF]",fbt="("+ubt+")"+n2e+"*",dbt=`\\\\( +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function axt(e){return"toText"in e}var mm=class{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t}toMarkup(){for(var t="",r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t}toText(){return this.children.map(t=>{if(axt(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}},PG={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},sxt={ex:!0,em:!0,mu:!0},yve=function(t){return typeof t!="string"&&(t=t.unit),t in PG||t in sxt||t==="ex"},da=function(t,r){var n;if(t.unit in PG)n=PG[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,t.unit==="ex")n=i.fontMetrics().xHeight;else if(t.unit==="em")n=i.fontMetrics().quad;else throw new $t("Invalid unit: '"+t.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*n,r.maxSize)},Ut=function(t){return+t.toFixed(4)+"em"},gm=function(t){return t.filter(r=>r).join(" ")},rq=function(t){var r="";for(var n of Object.keys(t)){var i=t[n];i!==void 0&&(r+=D2t(n)+":"+i+";")}return r},vve=function(t,r,n){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},xve=function(t){var r=document.createElement(t);r.className=gm(this.classes),Object.assign(r.style,this.style);for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)r.appendChild(this.children[i].toNode());return r},oxt=/[\s"'>/=\x00-\x1f]/,bve=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+Fo(gm(this.classes))+'"');var n=rq(this.style);n&&(r+=' style="'+Fo(n)+'"');for(var i of Object.keys(this.attributes)){if(oxt.test(i))throw new $t("Invalid attribute name '"+i+"'");r+=" "+i+'="'+Fo(this.attributes[i])+'"'}r+=">";for(var a=0;a<this.children.length;a++)r+=this.children[a].toMarkup();return r+="</"+t+">",r},ym=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,vve.call(this,t,n,i),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return xve.call(this,"span")}toMarkup(){return bve.call(this,"span")}},ub=class{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,vve.call(this,r,i),this.children=n||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return xve.call(this,"a")}toMarkup(){return bve.call(this,"a")}},BG=class{constructor(t,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+Fo(this.src)+'"'+(' alt="'+Fo(this.alt)+'"'),r=rq(this.style);return r&&(t+=' style="'+Fo(r)+'"'),t+="'/>",t}},lxt={\u00EE:"\u0131\u0302",\u00EF:"\u0131\u0308",\u00ED:"\u0131\u0301",\u00EC:"\u0131\u0300"},cl=class{constructor(t,r,n,i,a,s,o,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=r||0,this.depth=n||0,this.italic=i||0,this.skew=a||0,this.width=s||0,this.classes=o||[],this.style=l||{},this.maxFontSize=0;var u=X2t(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=lxt[this.text])}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createTextNode(this.text),r=null;return this.italic>0&&(r=document.createElement("span"),r.style.marginRight=Ut(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=gm(this.classes)),Object.keys(this.style).length>0&&(r=r||document.createElement("span"),Object.assign(r.style,this.style)),r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="<span";this.classes.length&&(t=!0,r+=' class="',r+=Fo(gm(this.classes)),r+='"');var n="";this.italic>0&&(n+="margin-right:"+Ut(this.italic)+";"),n+=rq(this.style),n&&(t=!0,r+=' style="'+Fo(n)+'"');var i=Fo(this.text);return t?(r+=">",r+=i,r+="</span>",r):i}},sh=class{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)r.appendChild(this.children[i].toNode());return r}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var r of Object.keys(this.attributes))t+=" "+r+'="'+Fo(this.attributes[r])+'"';t+=">";for(var n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</svg>",t}},uf=class{constructor(t,r){this.pathName=void 0,this.alternate=void 0,this.pathName=t,this.alternate=r}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"path");return this.alternate?r.setAttribute("d",this.alternate):r.setAttribute("d",Oye[this.pathName]),r}toMarkup(){return this.alternate?'<path d="'+Fo(this.alternate)+'"/>':'<path d="'+Fo(Oye[this.pathName])+'"/>'}},l5=class{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var t="<line";for(var r of Object.keys(this.attributes))t+=" "+r+'="'+Fo(this.attributes[r])+'"';return t+="/>",t}};function cxt(e){if(e instanceof cl)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function uxt(e){if(e instanceof ym)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var hxt=e=>e instanceof ym||e instanceof ub||e instanceof mm,cf={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],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:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],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:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],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:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],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:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],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:[0,.44444,0,0,.63889],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:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],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:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],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:[0,.68611,.17208,0,.8961],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:[0,.69444,.06709,0,.59111],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:[.19444,.44444,.105,0,.53222],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:[.19444,.44444,.105,0,.53222],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:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],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:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],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:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],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:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],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:[0,.68333,.16389,0,.74333],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:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],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:[0,.68333,.16389,0,.74333],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:[0,.69444,.06646,0,.51111],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:[.19444,.43056,.08847,0,.46],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:[.19444,.43056,.08847,0,.46],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:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],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:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],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:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],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:[0,.43056,0,0,.55556],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:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],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:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],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:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],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:[0,.69444,0,0,.66759],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:[0,.44444,0,0,.58472],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:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],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:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],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:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],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:[0,.68333,.08125,.05556,.83125],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:[0,.68333,.02778,.08334,.76278],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:[0,.43056,0,.05556,.48472],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:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],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:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],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:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],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:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],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:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],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:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],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:[0,.69444,.07816,0,.27778],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:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],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:[0,.69444,0,0,.66667],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:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],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:[0,.69444,.0799,0,.5],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:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],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:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],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:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],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:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],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:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},I8={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],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:[.25,.25,.25],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],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Pye={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\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 fxt(e,t){cf[e]=t}function nq(e,t,r){if(!cf[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),i=cf[t][n];if(!i&&e[0]in Pye&&(n=Pye[e[0]].charCodeAt(0),i=cf[t][n]),!i&&r==="text"&&gve(n)&&(i=cf[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var bG={};function dxt(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!bG[t]){var r=bG[t]={cssEmPerMu:I8.quad[t]/18};for(var n in I8)I8.hasOwnProperty(n)&&(r[n]=I8[n][t])}return bG[t]}var ra={math:{},text:{}};function X(e,t,r,n,i,a){ra[e][i]={font:t,group:r,replace:n},a&&n&&(ra[e][n]=ra[e][i])}var te="math",It="text",be="main",He="ams",na="accent-token",or="bin",ul="close",db="inner",Br="mathord",ja="op-token",Ic="open",u5="punct",Ye="rel",i0="spacing",Ze="textord";X(te,be,Ye,"\u2261","\\equiv",!0);X(te,be,Ye,"\u227A","\\prec",!0);X(te,be,Ye,"\u227B","\\succ",!0);X(te,be,Ye,"\u223C","\\sim",!0);X(te,be,Ye,"\u22A5","\\perp");X(te,be,Ye,"\u2AAF","\\preceq",!0);X(te,be,Ye,"\u2AB0","\\succeq",!0);X(te,be,Ye,"\u2243","\\simeq",!0);X(te,be,Ye,"\u2223","\\mid",!0);X(te,be,Ye,"\u226A","\\ll",!0);X(te,be,Ye,"\u226B","\\gg",!0);X(te,be,Ye,"\u224D","\\asymp",!0);X(te,be,Ye,"\u2225","\\parallel");X(te,be,Ye,"\u22C8","\\bowtie",!0);X(te,be,Ye,"\u2323","\\smile",!0);X(te,be,Ye,"\u2291","\\sqsubseteq",!0);X(te,be,Ye,"\u2292","\\sqsupseteq",!0);X(te,be,Ye,"\u2250","\\doteq",!0);X(te,be,Ye,"\u2322","\\frown",!0);X(te,be,Ye,"\u220B","\\ni",!0);X(te,be,Ye,"\u221D","\\propto",!0);X(te,be,Ye,"\u22A2","\\vdash",!0);X(te,be,Ye,"\u22A3","\\dashv",!0);X(te,be,Ye,"\u220B","\\owns");X(te,be,u5,".","\\ldotp");X(te,be,u5,"\u22C5","\\cdotp");X(te,be,u5,"\u22C5","\xB7");X(It,be,Ze,"\u22C5","\xB7");X(te,be,Ze,"#","\\#");X(It,be,Ze,"#","\\#");X(te,be,Ze,"&","\\&");X(It,be,Ze,"&","\\&");X(te,be,Ze,"\u2135","\\aleph",!0);X(te,be,Ze,"\u2200","\\forall",!0);X(te,be,Ze,"\u210F","\\hbar",!0);X(te,be,Ze,"\u2203","\\exists",!0);X(te,be,Ze,"\u2207","\\nabla",!0);X(te,be,Ze,"\u266D","\\flat",!0);X(te,be,Ze,"\u2113","\\ell",!0);X(te,be,Ze,"\u266E","\\natural",!0);X(te,be,Ze,"\u2663","\\clubsuit",!0);X(te,be,Ze,"\u2118","\\wp",!0);X(te,be,Ze,"\u266F","\\sharp",!0);X(te,be,Ze,"\u2662","\\diamondsuit",!0);X(te,be,Ze,"\u211C","\\Re",!0);X(te,be,Ze,"\u2661","\\heartsuit",!0);X(te,be,Ze,"\u2111","\\Im",!0);X(te,be,Ze,"\u2660","\\spadesuit",!0);X(te,be,Ze,"\xA7","\\S",!0);X(It,be,Ze,"\xA7","\\S");X(te,be,Ze,"\xB6","\\P",!0);X(It,be,Ze,"\xB6","\\P");X(te,be,Ze,"\u2020","\\dag");X(It,be,Ze,"\u2020","\\dag");X(It,be,Ze,"\u2020","\\textdagger");X(te,be,Ze,"\u2021","\\ddag");X(It,be,Ze,"\u2021","\\ddag");X(It,be,Ze,"\u2021","\\textdaggerdbl");X(te,be,ul,"\u23B1","\\rmoustache",!0);X(te,be,Ic,"\u23B0","\\lmoustache",!0);X(te,be,ul,"\u27EF","\\rgroup",!0);X(te,be,Ic,"\u27EE","\\lgroup",!0);X(te,be,or,"\u2213","\\mp",!0);X(te,be,or,"\u2296","\\ominus",!0);X(te,be,or,"\u228E","\\uplus",!0);X(te,be,or,"\u2293","\\sqcap",!0);X(te,be,or,"\u2217","\\ast");X(te,be,or,"\u2294","\\sqcup",!0);X(te,be,or,"\u25EF","\\bigcirc",!0);X(te,be,or,"\u2219","\\bullet",!0);X(te,be,or,"\u2021","\\ddagger");X(te,be,or,"\u2240","\\wr",!0);X(te,be,or,"\u2A3F","\\amalg");X(te,be,or,"&","\\And");X(te,be,Ye,"\u27F5","\\longleftarrow",!0);X(te,be,Ye,"\u21D0","\\Leftarrow",!0);X(te,be,Ye,"\u27F8","\\Longleftarrow",!0);X(te,be,Ye,"\u27F6","\\longrightarrow",!0);X(te,be,Ye,"\u21D2","\\Rightarrow",!0);X(te,be,Ye,"\u27F9","\\Longrightarrow",!0);X(te,be,Ye,"\u2194","\\leftrightarrow",!0);X(te,be,Ye,"\u27F7","\\longleftrightarrow",!0);X(te,be,Ye,"\u21D4","\\Leftrightarrow",!0);X(te,be,Ye,"\u27FA","\\Longleftrightarrow",!0);X(te,be,Ye,"\u21A6","\\mapsto",!0);X(te,be,Ye,"\u27FC","\\longmapsto",!0);X(te,be,Ye,"\u2197","\\nearrow",!0);X(te,be,Ye,"\u21A9","\\hookleftarrow",!0);X(te,be,Ye,"\u21AA","\\hookrightarrow",!0);X(te,be,Ye,"\u2198","\\searrow",!0);X(te,be,Ye,"\u21BC","\\leftharpoonup",!0);X(te,be,Ye,"\u21C0","\\rightharpoonup",!0);X(te,be,Ye,"\u2199","\\swarrow",!0);X(te,be,Ye,"\u21BD","\\leftharpoondown",!0);X(te,be,Ye,"\u21C1","\\rightharpoondown",!0);X(te,be,Ye,"\u2196","\\nwarrow",!0);X(te,be,Ye,"\u21CC","\\rightleftharpoons",!0);X(te,He,Ye,"\u226E","\\nless",!0);X(te,He,Ye,"\uE010","\\@nleqslant");X(te,He,Ye,"\uE011","\\@nleqq");X(te,He,Ye,"\u2A87","\\lneq",!0);X(te,He,Ye,"\u2268","\\lneqq",!0);X(te,He,Ye,"\uE00C","\\@lvertneqq");X(te,He,Ye,"\u22E6","\\lnsim",!0);X(te,He,Ye,"\u2A89","\\lnapprox",!0);X(te,He,Ye,"\u2280","\\nprec",!0);X(te,He,Ye,"\u22E0","\\npreceq",!0);X(te,He,Ye,"\u22E8","\\precnsim",!0);X(te,He,Ye,"\u2AB9","\\precnapprox",!0);X(te,He,Ye,"\u2241","\\nsim",!0);X(te,He,Ye,"\uE006","\\@nshortmid");X(te,He,Ye,"\u2224","\\nmid",!0);X(te,He,Ye,"\u22AC","\\nvdash",!0);X(te,He,Ye,"\u22AD","\\nvDash",!0);X(te,He,Ye,"\u22EA","\\ntriangleleft");X(te,He,Ye,"\u22EC","\\ntrianglelefteq",!0);X(te,He,Ye,"\u228A","\\subsetneq",!0);X(te,He,Ye,"\uE01A","\\@varsubsetneq");X(te,He,Ye,"\u2ACB","\\subsetneqq",!0);X(te,He,Ye,"\uE017","\\@varsubsetneqq");X(te,He,Ye,"\u226F","\\ngtr",!0);X(te,He,Ye,"\uE00F","\\@ngeqslant");X(te,He,Ye,"\uE00E","\\@ngeqq");X(te,He,Ye,"\u2A88","\\gneq",!0);X(te,He,Ye,"\u2269","\\gneqq",!0);X(te,He,Ye,"\uE00D","\\@gvertneqq");X(te,He,Ye,"\u22E7","\\gnsim",!0);X(te,He,Ye,"\u2A8A","\\gnapprox",!0);X(te,He,Ye,"\u2281","\\nsucc",!0);X(te,He,Ye,"\u22E1","\\nsucceq",!0);X(te,He,Ye,"\u22E9","\\succnsim",!0);X(te,He,Ye,"\u2ABA","\\succnapprox",!0);X(te,He,Ye,"\u2246","\\ncong",!0);X(te,He,Ye,"\uE007","\\@nshortparallel");X(te,He,Ye,"\u2226","\\nparallel",!0);X(te,He,Ye,"\u22AF","\\nVDash",!0);X(te,He,Ye,"\u22EB","\\ntriangleright");X(te,He,Ye,"\u22ED","\\ntrianglerighteq",!0);X(te,He,Ye,"\uE018","\\@nsupseteqq");X(te,He,Ye,"\u228B","\\supsetneq",!0);X(te,He,Ye,"\uE01B","\\@varsupsetneq");X(te,He,Ye,"\u2ACC","\\supsetneqq",!0);X(te,He,Ye,"\uE019","\\@varsupsetneqq");X(te,He,Ye,"\u22AE","\\nVdash",!0);X(te,He,Ye,"\u2AB5","\\precneqq",!0);X(te,He,Ye,"\u2AB6","\\succneqq",!0);X(te,He,Ye,"\uE016","\\@nsubseteqq");X(te,He,or,"\u22B4","\\unlhd");X(te,He,or,"\u22B5","\\unrhd");X(te,He,Ye,"\u219A","\\nleftarrow",!0);X(te,He,Ye,"\u219B","\\nrightarrow",!0);X(te,He,Ye,"\u21CD","\\nLeftarrow",!0);X(te,He,Ye,"\u21CF","\\nRightarrow",!0);X(te,He,Ye,"\u21AE","\\nleftrightarrow",!0);X(te,He,Ye,"\u21CE","\\nLeftrightarrow",!0);X(te,He,Ye,"\u25B3","\\vartriangle");X(te,He,Ze,"\u210F","\\hslash");X(te,He,Ze,"\u25BD","\\triangledown");X(te,He,Ze,"\u25CA","\\lozenge");X(te,He,Ze,"\u24C8","\\circledS");X(te,He,Ze,"\xAE","\\circledR");X(It,He,Ze,"\xAE","\\circledR");X(te,He,Ze,"\u2221","\\measuredangle",!0);X(te,He,Ze,"\u2204","\\nexists");X(te,He,Ze,"\u2127","\\mho");X(te,He,Ze,"\u2132","\\Finv",!0);X(te,He,Ze,"\u2141","\\Game",!0);X(te,He,Ze,"\u2035","\\backprime");X(te,He,Ze,"\u25B2","\\blacktriangle");X(te,He,Ze,"\u25BC","\\blacktriangledown");X(te,He,Ze,"\u25A0","\\blacksquare");X(te,He,Ze,"\u29EB","\\blacklozenge");X(te,He,Ze,"\u2605","\\bigstar");X(te,He,Ze,"\u2222","\\sphericalangle",!0);X(te,He,Ze,"\u2201","\\complement",!0);X(te,He,Ze,"\xF0","\\eth",!0);X(It,be,Ze,"\xF0","\xF0");X(te,He,Ze,"\u2571","\\diagup");X(te,He,Ze,"\u2572","\\diagdown");X(te,He,Ze,"\u25A1","\\square");X(te,He,Ze,"\u25A1","\\Box");X(te,He,Ze,"\u25CA","\\Diamond");X(te,He,Ze,"\xA5","\\yen",!0);X(It,He,Ze,"\xA5","\\yen",!0);X(te,He,Ze,"\u2713","\\checkmark",!0);X(It,He,Ze,"\u2713","\\checkmark");X(te,He,Ze,"\u2136","\\beth",!0);X(te,He,Ze,"\u2138","\\daleth",!0);X(te,He,Ze,"\u2137","\\gimel",!0);X(te,He,Ze,"\u03DD","\\digamma",!0);X(te,He,Ze,"\u03F0","\\varkappa");X(te,He,Ic,"\u250C","\\@ulcorner",!0);X(te,He,ul,"\u2510","\\@urcorner",!0);X(te,He,Ic,"\u2514","\\@llcorner",!0);X(te,He,ul,"\u2518","\\@lrcorner",!0);X(te,He,Ye,"\u2266","\\leqq",!0);X(te,He,Ye,"\u2A7D","\\leqslant",!0);X(te,He,Ye,"\u2A95","\\eqslantless",!0);X(te,He,Ye,"\u2272","\\lesssim",!0);X(te,He,Ye,"\u2A85","\\lessapprox",!0);X(te,He,Ye,"\u224A","\\approxeq",!0);X(te,He,or,"\u22D6","\\lessdot");X(te,He,Ye,"\u22D8","\\lll",!0);X(te,He,Ye,"\u2276","\\lessgtr",!0);X(te,He,Ye,"\u22DA","\\lesseqgtr",!0);X(te,He,Ye,"\u2A8B","\\lesseqqgtr",!0);X(te,He,Ye,"\u2251","\\doteqdot");X(te,He,Ye,"\u2253","\\risingdotseq",!0);X(te,He,Ye,"\u2252","\\fallingdotseq",!0);X(te,He,Ye,"\u223D","\\backsim",!0);X(te,He,Ye,"\u22CD","\\backsimeq",!0);X(te,He,Ye,"\u2AC5","\\subseteqq",!0);X(te,He,Ye,"\u22D0","\\Subset",!0);X(te,He,Ye,"\u228F","\\sqsubset",!0);X(te,He,Ye,"\u227C","\\preccurlyeq",!0);X(te,He,Ye,"\u22DE","\\curlyeqprec",!0);X(te,He,Ye,"\u227E","\\precsim",!0);X(te,He,Ye,"\u2AB7","\\precapprox",!0);X(te,He,Ye,"\u22B2","\\vartriangleleft");X(te,He,Ye,"\u22B4","\\trianglelefteq");X(te,He,Ye,"\u22A8","\\vDash",!0);X(te,He,Ye,"\u22AA","\\Vvdash",!0);X(te,He,Ye,"\u2323","\\smallsmile");X(te,He,Ye,"\u2322","\\smallfrown");X(te,He,Ye,"\u224F","\\bumpeq",!0);X(te,He,Ye,"\u224E","\\Bumpeq",!0);X(te,He,Ye,"\u2267","\\geqq",!0);X(te,He,Ye,"\u2A7E","\\geqslant",!0);X(te,He,Ye,"\u2A96","\\eqslantgtr",!0);X(te,He,Ye,"\u2273","\\gtrsim",!0);X(te,He,Ye,"\u2A86","\\gtrapprox",!0);X(te,He,or,"\u22D7","\\gtrdot");X(te,He,Ye,"\u22D9","\\ggg",!0);X(te,He,Ye,"\u2277","\\gtrless",!0);X(te,He,Ye,"\u22DB","\\gtreqless",!0);X(te,He,Ye,"\u2A8C","\\gtreqqless",!0);X(te,He,Ye,"\u2256","\\eqcirc",!0);X(te,He,Ye,"\u2257","\\circeq",!0);X(te,He,Ye,"\u225C","\\triangleq",!0);X(te,He,Ye,"\u223C","\\thicksim");X(te,He,Ye,"\u2248","\\thickapprox");X(te,He,Ye,"\u2AC6","\\supseteqq",!0);X(te,He,Ye,"\u22D1","\\Supset",!0);X(te,He,Ye,"\u2290","\\sqsupset",!0);X(te,He,Ye,"\u227D","\\succcurlyeq",!0);X(te,He,Ye,"\u22DF","\\curlyeqsucc",!0);X(te,He,Ye,"\u227F","\\succsim",!0);X(te,He,Ye,"\u2AB8","\\succapprox",!0);X(te,He,Ye,"\u22B3","\\vartriangleright");X(te,He,Ye,"\u22B5","\\trianglerighteq");X(te,He,Ye,"\u22A9","\\Vdash",!0);X(te,He,Ye,"\u2223","\\shortmid");X(te,He,Ye,"\u2225","\\shortparallel");X(te,He,Ye,"\u226C","\\between",!0);X(te,He,Ye,"\u22D4","\\pitchfork",!0);X(te,He,Ye,"\u221D","\\varpropto");X(te,He,Ye,"\u25C0","\\blacktriangleleft");X(te,He,Ye,"\u2234","\\therefore",!0);X(te,He,Ye,"\u220D","\\backepsilon");X(te,He,Ye,"\u25B6","\\blacktriangleright");X(te,He,Ye,"\u2235","\\because",!0);X(te,He,Ye,"\u22D8","\\llless");X(te,He,Ye,"\u22D9","\\gggtr");X(te,He,or,"\u22B2","\\lhd");X(te,He,or,"\u22B3","\\rhd");X(te,He,Ye,"\u2242","\\eqsim",!0);X(te,be,Ye,"\u22C8","\\Join");X(te,He,Ye,"\u2251","\\Doteq",!0);X(te,He,or,"\u2214","\\dotplus",!0);X(te,He,or,"\u2216","\\smallsetminus");X(te,He,or,"\u22D2","\\Cap",!0);X(te,He,or,"\u22D3","\\Cup",!0);X(te,He,or,"\u2A5E","\\doublebarwedge",!0);X(te,He,or,"\u229F","\\boxminus",!0);X(te,He,or,"\u229E","\\boxplus",!0);X(te,He,or,"\u22C7","\\divideontimes",!0);X(te,He,or,"\u22C9","\\ltimes",!0);X(te,He,or,"\u22CA","\\rtimes",!0);X(te,He,or,"\u22CB","\\leftthreetimes",!0);X(te,He,or,"\u22CC","\\rightthreetimes",!0);X(te,He,or,"\u22CF","\\curlywedge",!0);X(te,He,or,"\u22CE","\\curlyvee",!0);X(te,He,or,"\u229D","\\circleddash",!0);X(te,He,or,"\u229B","\\circledast",!0);X(te,He,or,"\u22C5","\\centerdot");X(te,He,or,"\u22BA","\\intercal",!0);X(te,He,or,"\u22D2","\\doublecap");X(te,He,or,"\u22D3","\\doublecup");X(te,He,or,"\u22A0","\\boxtimes",!0);X(te,He,Ye,"\u21E2","\\dashrightarrow",!0);X(te,He,Ye,"\u21E0","\\dashleftarrow",!0);X(te,He,Ye,"\u21C7","\\leftleftarrows",!0);X(te,He,Ye,"\u21C6","\\leftrightarrows",!0);X(te,He,Ye,"\u21DA","\\Lleftarrow",!0);X(te,He,Ye,"\u219E","\\twoheadleftarrow",!0);X(te,He,Ye,"\u21A2","\\leftarrowtail",!0);X(te,He,Ye,"\u21AB","\\looparrowleft",!0);X(te,He,Ye,"\u21CB","\\leftrightharpoons",!0);X(te,He,Ye,"\u21B6","\\curvearrowleft",!0);X(te,He,Ye,"\u21BA","\\circlearrowleft",!0);X(te,He,Ye,"\u21B0","\\Lsh",!0);X(te,He,Ye,"\u21C8","\\upuparrows",!0);X(te,He,Ye,"\u21BF","\\upharpoonleft",!0);X(te,He,Ye,"\u21C3","\\downharpoonleft",!0);X(te,be,Ye,"\u22B6","\\origof",!0);X(te,be,Ye,"\u22B7","\\imageof",!0);X(te,He,Ye,"\u22B8","\\multimap",!0);X(te,He,Ye,"\u21AD","\\leftrightsquigarrow",!0);X(te,He,Ye,"\u21C9","\\rightrightarrows",!0);X(te,He,Ye,"\u21C4","\\rightleftarrows",!0);X(te,He,Ye,"\u21A0","\\twoheadrightarrow",!0);X(te,He,Ye,"\u21A3","\\rightarrowtail",!0);X(te,He,Ye,"\u21AC","\\looparrowright",!0);X(te,He,Ye,"\u21B7","\\curvearrowright",!0);X(te,He,Ye,"\u21BB","\\circlearrowright",!0);X(te,He,Ye,"\u21B1","\\Rsh",!0);X(te,He,Ye,"\u21CA","\\downdownarrows",!0);X(te,He,Ye,"\u21BE","\\upharpoonright",!0);X(te,He,Ye,"\u21C2","\\downharpoonright",!0);X(te,He,Ye,"\u21DD","\\rightsquigarrow",!0);X(te,He,Ye,"\u21DD","\\leadsto");X(te,He,Ye,"\u21DB","\\Rrightarrow",!0);X(te,He,Ye,"\u21BE","\\restriction");X(te,be,Ze,"\u2018","`");X(te,be,Ze,"$","\\$");X(It,be,Ze,"$","\\$");X(It,be,Ze,"$","\\textdollar");X(te,be,Ze,"%","\\%");X(It,be,Ze,"%","\\%");X(te,be,Ze,"_","\\_");X(It,be,Ze,"_","\\_");X(It,be,Ze,"_","\\textunderscore");X(te,be,Ze,"\u2220","\\angle",!0);X(te,be,Ze,"\u221E","\\infty",!0);X(te,be,Ze,"\u2032","\\prime");X(te,be,Ze,"\u25B3","\\triangle");X(te,be,Ze,"\u0393","\\Gamma",!0);X(te,be,Ze,"\u0394","\\Delta",!0);X(te,be,Ze,"\u0398","\\Theta",!0);X(te,be,Ze,"\u039B","\\Lambda",!0);X(te,be,Ze,"\u039E","\\Xi",!0);X(te,be,Ze,"\u03A0","\\Pi",!0);X(te,be,Ze,"\u03A3","\\Sigma",!0);X(te,be,Ze,"\u03A5","\\Upsilon",!0);X(te,be,Ze,"\u03A6","\\Phi",!0);X(te,be,Ze,"\u03A8","\\Psi",!0);X(te,be,Ze,"\u03A9","\\Omega",!0);X(te,be,Ze,"A","\u0391");X(te,be,Ze,"B","\u0392");X(te,be,Ze,"E","\u0395");X(te,be,Ze,"Z","\u0396");X(te,be,Ze,"H","\u0397");X(te,be,Ze,"I","\u0399");X(te,be,Ze,"K","\u039A");X(te,be,Ze,"M","\u039C");X(te,be,Ze,"N","\u039D");X(te,be,Ze,"O","\u039F");X(te,be,Ze,"P","\u03A1");X(te,be,Ze,"T","\u03A4");X(te,be,Ze,"X","\u03A7");X(te,be,Ze,"\xAC","\\neg",!0);X(te,be,Ze,"\xAC","\\lnot");X(te,be,Ze,"\u22A4","\\top");X(te,be,Ze,"\u22A5","\\bot");X(te,be,Ze,"\u2205","\\emptyset");X(te,He,Ze,"\u2205","\\varnothing");X(te,be,Br,"\u03B1","\\alpha",!0);X(te,be,Br,"\u03B2","\\beta",!0);X(te,be,Br,"\u03B3","\\gamma",!0);X(te,be,Br,"\u03B4","\\delta",!0);X(te,be,Br,"\u03F5","\\epsilon",!0);X(te,be,Br,"\u03B6","\\zeta",!0);X(te,be,Br,"\u03B7","\\eta",!0);X(te,be,Br,"\u03B8","\\theta",!0);X(te,be,Br,"\u03B9","\\iota",!0);X(te,be,Br,"\u03BA","\\kappa",!0);X(te,be,Br,"\u03BB","\\lambda",!0);X(te,be,Br,"\u03BC","\\mu",!0);X(te,be,Br,"\u03BD","\\nu",!0);X(te,be,Br,"\u03BE","\\xi",!0);X(te,be,Br,"\u03BF","\\omicron",!0);X(te,be,Br,"\u03C0","\\pi",!0);X(te,be,Br,"\u03C1","\\rho",!0);X(te,be,Br,"\u03C3","\\sigma",!0);X(te,be,Br,"\u03C4","\\tau",!0);X(te,be,Br,"\u03C5","\\upsilon",!0);X(te,be,Br,"\u03D5","\\phi",!0);X(te,be,Br,"\u03C7","\\chi",!0);X(te,be,Br,"\u03C8","\\psi",!0);X(te,be,Br,"\u03C9","\\omega",!0);X(te,be,Br,"\u03B5","\\varepsilon",!0);X(te,be,Br,"\u03D1","\\vartheta",!0);X(te,be,Br,"\u03D6","\\varpi",!0);X(te,be,Br,"\u03F1","\\varrho",!0);X(te,be,Br,"\u03C2","\\varsigma",!0);X(te,be,Br,"\u03C6","\\varphi",!0);X(te,be,or,"\u2217","*",!0);X(te,be,or,"+","+");X(te,be,or,"\u2212","-",!0);X(te,be,or,"\u22C5","\\cdot",!0);X(te,be,or,"\u2218","\\circ",!0);X(te,be,or,"\xF7","\\div",!0);X(te,be,or,"\xB1","\\pm",!0);X(te,be,or,"\xD7","\\times",!0);X(te,be,or,"\u2229","\\cap",!0);X(te,be,or,"\u222A","\\cup",!0);X(te,be,or,"\u2216","\\setminus",!0);X(te,be,or,"\u2227","\\land");X(te,be,or,"\u2228","\\lor");X(te,be,or,"\u2227","\\wedge",!0);X(te,be,or,"\u2228","\\vee",!0);X(te,be,Ze,"\u221A","\\surd");X(te,be,Ic,"\u27E8","\\langle",!0);X(te,be,Ic,"\u2223","\\lvert");X(te,be,Ic,"\u2225","\\lVert");X(te,be,ul,"?","?");X(te,be,ul,"!","!");X(te,be,ul,"\u27E9","\\rangle",!0);X(te,be,ul,"\u2223","\\rvert");X(te,be,ul,"\u2225","\\rVert");X(te,be,Ye,"=","=");X(te,be,Ye,":",":");X(te,be,Ye,"\u2248","\\approx",!0);X(te,be,Ye,"\u2245","\\cong",!0);X(te,be,Ye,"\u2265","\\ge");X(te,be,Ye,"\u2265","\\geq",!0);X(te,be,Ye,"\u2190","\\gets");X(te,be,Ye,">","\\gt",!0);X(te,be,Ye,"\u2208","\\in",!0);X(te,be,Ye,"\uE020","\\@not");X(te,be,Ye,"\u2282","\\subset",!0);X(te,be,Ye,"\u2283","\\supset",!0);X(te,be,Ye,"\u2286","\\subseteq",!0);X(te,be,Ye,"\u2287","\\supseteq",!0);X(te,He,Ye,"\u2288","\\nsubseteq",!0);X(te,He,Ye,"\u2289","\\nsupseteq",!0);X(te,be,Ye,"\u22A8","\\models");X(te,be,Ye,"\u2190","\\leftarrow",!0);X(te,be,Ye,"\u2264","\\le");X(te,be,Ye,"\u2264","\\leq",!0);X(te,be,Ye,"<","\\lt",!0);X(te,be,Ye,"\u2192","\\rightarrow",!0);X(te,be,Ye,"\u2192","\\to");X(te,He,Ye,"\u2271","\\ngeq",!0);X(te,He,Ye,"\u2270","\\nleq",!0);X(te,be,i0,"\xA0","\\ ");X(te,be,i0,"\xA0","\\space");X(te,be,i0,"\xA0","\\nobreakspace");X(It,be,i0,"\xA0","\\ ");X(It,be,i0,"\xA0"," ");X(It,be,i0,"\xA0","\\space");X(It,be,i0,"\xA0","\\nobreakspace");X(te,be,i0,"","\\nobreak");X(te,be,i0,"","\\allowbreak");X(te,be,u5,",",",");X(te,be,u5,";",";");X(te,He,or,"\u22BC","\\barwedge",!0);X(te,He,or,"\u22BB","\\veebar",!0);X(te,be,or,"\u2299","\\odot",!0);X(te,be,or,"\u2295","\\oplus",!0);X(te,be,or,"\u2297","\\otimes",!0);X(te,be,Ze,"\u2202","\\partial",!0);X(te,be,or,"\u2298","\\oslash",!0);X(te,He,or,"\u229A","\\circledcirc",!0);X(te,He,or,"\u22A1","\\boxdot",!0);X(te,be,or,"\u25B3","\\bigtriangleup");X(te,be,or,"\u25BD","\\bigtriangledown");X(te,be,or,"\u2020","\\dagger");X(te,be,or,"\u22C4","\\diamond");X(te,be,or,"\u22C6","\\star");X(te,be,or,"\u25C3","\\triangleleft");X(te,be,or,"\u25B9","\\triangleright");X(te,be,Ic,"{","\\{");X(It,be,Ze,"{","\\{");X(It,be,Ze,"{","\\textbraceleft");X(te,be,ul,"}","\\}");X(It,be,Ze,"}","\\}");X(It,be,Ze,"}","\\textbraceright");X(te,be,Ic,"{","\\lbrace");X(te,be,ul,"}","\\rbrace");X(te,be,Ic,"[","\\lbrack",!0);X(It,be,Ze,"[","\\lbrack",!0);X(te,be,ul,"]","\\rbrack",!0);X(It,be,Ze,"]","\\rbrack",!0);X(te,be,Ic,"(","\\lparen",!0);X(te,be,ul,")","\\rparen",!0);X(It,be,Ze,"<","\\textless",!0);X(It,be,Ze,">","\\textgreater",!0);X(te,be,Ic,"\u230A","\\lfloor",!0);X(te,be,ul,"\u230B","\\rfloor",!0);X(te,be,Ic,"\u2308","\\lceil",!0);X(te,be,ul,"\u2309","\\rceil",!0);X(te,be,Ze,"\\","\\backslash");X(te,be,Ze,"\u2223","|");X(te,be,Ze,"\u2223","\\vert");X(It,be,Ze,"|","\\textbar",!0);X(te,be,Ze,"\u2225","\\|");X(te,be,Ze,"\u2225","\\Vert");X(It,be,Ze,"\u2225","\\textbardbl");X(It,be,Ze,"~","\\textasciitilde");X(It,be,Ze,"\\","\\textbackslash");X(It,be,Ze,"^","\\textasciicircum");X(te,be,Ye,"\u2191","\\uparrow",!0);X(te,be,Ye,"\u21D1","\\Uparrow",!0);X(te,be,Ye,"\u2193","\\downarrow",!0);X(te,be,Ye,"\u21D3","\\Downarrow",!0);X(te,be,Ye,"\u2195","\\updownarrow",!0);X(te,be,Ye,"\u21D5","\\Updownarrow",!0);X(te,be,ja,"\u2210","\\coprod");X(te,be,ja,"\u22C1","\\bigvee");X(te,be,ja,"\u22C0","\\bigwedge");X(te,be,ja,"\u2A04","\\biguplus");X(te,be,ja,"\u22C2","\\bigcap");X(te,be,ja,"\u22C3","\\bigcup");X(te,be,ja,"\u222B","\\int");X(te,be,ja,"\u222B","\\intop");X(te,be,ja,"\u222C","\\iint");X(te,be,ja,"\u222D","\\iiint");X(te,be,ja,"\u220F","\\prod");X(te,be,ja,"\u2211","\\sum");X(te,be,ja,"\u2A02","\\bigotimes");X(te,be,ja,"\u2A01","\\bigoplus");X(te,be,ja,"\u2A00","\\bigodot");X(te,be,ja,"\u222E","\\oint");X(te,be,ja,"\u222F","\\oiint");X(te,be,ja,"\u2230","\\oiiint");X(te,be,ja,"\u2A06","\\bigsqcup");X(te,be,ja,"\u222B","\\smallint");X(It,be,db,"\u2026","\\textellipsis");X(te,be,db,"\u2026","\\mathellipsis");X(It,be,db,"\u2026","\\ldots",!0);X(te,be,db,"\u2026","\\ldots",!0);X(te,be,db,"\u22EF","\\@cdots",!0);X(te,be,db,"\u22F1","\\ddots",!0);X(te,be,Ze,"\u22EE","\\varvdots");X(It,be,Ze,"\u22EE","\\varvdots");X(te,be,na,"\u02CA","\\acute");X(te,be,na,"\u02CB","\\grave");X(te,be,na,"\xA8","\\ddot");X(te,be,na,"~","\\tilde");X(te,be,na,"\u02C9","\\bar");X(te,be,na,"\u02D8","\\breve");X(te,be,na,"\u02C7","\\check");X(te,be,na,"^","\\hat");X(te,be,na,"\u20D7","\\vec");X(te,be,na,"\u02D9","\\dot");X(te,be,na,"\u02DA","\\mathring");X(te,be,Br,"\uE131","\\@imath");X(te,be,Br,"\uE237","\\@jmath");X(te,be,Ze,"\u0131","\u0131");X(te,be,Ze,"\u0237","\u0237");X(It,be,Ze,"\u0131","\\i",!0);X(It,be,Ze,"\u0237","\\j",!0);X(It,be,Ze,"\xDF","\\ss",!0);X(It,be,Ze,"\xE6","\\ae",!0);X(It,be,Ze,"\u0153","\\oe",!0);X(It,be,Ze,"\xF8","\\o",!0);X(It,be,Ze,"\xC6","\\AE",!0);X(It,be,Ze,"\u0152","\\OE",!0);X(It,be,Ze,"\xD8","\\O",!0);X(It,be,na,"\u02CA","\\'");X(It,be,na,"\u02CB","\\`");X(It,be,na,"\u02C6","\\^");X(It,be,na,"\u02DC","\\~");X(It,be,na,"\u02C9","\\=");X(It,be,na,"\u02D8","\\u");X(It,be,na,"\u02D9","\\.");X(It,be,na,"\xB8","\\c");X(It,be,na,"\u02DA","\\r");X(It,be,na,"\u02C7","\\v");X(It,be,na,"\xA8",'\\"');X(It,be,na,"\u02DD","\\H");X(It,be,na,"\u25EF","\\textcircled");var wve={"--":!0,"---":!0,"``":!0,"''":!0};X(It,be,Ze,"\u2013","--",!0);X(It,be,Ze,"\u2013","\\textendash");X(It,be,Ze,"\u2014","---",!0);X(It,be,Ze,"\u2014","\\textemdash");X(It,be,Ze,"\u2018","`",!0);X(It,be,Ze,"\u2018","\\textquoteleft");X(It,be,Ze,"\u2019","'",!0);X(It,be,Ze,"\u2019","\\textquoteright");X(It,be,Ze,"\u201C","``",!0);X(It,be,Ze,"\u201C","\\textquotedblleft");X(It,be,Ze,"\u201D","''",!0);X(It,be,Ze,"\u201D","\\textquotedblright");X(te,be,Ze,"\xB0","\\degree",!0);X(It,be,Ze,"\xB0","\\degree");X(It,be,Ze,"\xB0","\\textdegree",!0);X(te,be,Ze,"\xA3","\\pounds");X(te,be,Ze,"\xA3","\\mathsterling",!0);X(It,be,Ze,"\xA3","\\pounds");X(It,be,Ze,"\xA3","\\textsterling",!0);X(te,He,Ze,"\u2720","\\maltese");X(It,He,Ze,"\u2720","\\maltese");var Bye='0123456789/@."';for(M8=0;M8<Bye.length;M8++)wG=Bye.charAt(M8),X(te,be,Ze,wG,wG);var wG,M8,Fye='0123456789!@*()-=+";:?/.,';for(N8=0;N8<Fye.length;N8++)kG=Fye.charAt(N8),X(It,be,Ze,kG,kG);var kG,N8,W8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(D8=0;D8<W8.length;D8++)r5=W8.charAt(D8),X(te,be,Br,r5,r5),X(It,be,Ze,r5,r5);var r5,D8;X(te,He,Ze,"C","\u2102");X(It,He,Ze,"C","\u2102");X(te,He,Ze,"H","\u210D");X(It,He,Ze,"H","\u210D");X(te,He,Ze,"N","\u2115");X(It,He,Ze,"N","\u2115");X(te,He,Ze,"P","\u2119");X(It,He,Ze,"P","\u2119");X(te,He,Ze,"Q","\u211A");X(It,He,Ze,"Q","\u211A");X(te,He,Ze,"R","\u211D");X(It,He,Ze,"R","\u211D");X(te,He,Ze,"Z","\u2124");X(It,He,Ze,"Z","\u2124");X(te,be,Br,"h","\u210E");X(It,be,Br,"h","\u210E");var sn;for(Bo=0;Bo<W8.length;Bo++)ha=W8.charAt(Bo),sn=String.fromCharCode(55349,56320+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56372+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56424+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56580+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56684+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56736+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56788+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56840+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56944+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),Bo<26&&(sn=String.fromCharCode(55349,56632+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn),sn=String.fromCharCode(55349,56476+Bo),X(te,be,Br,ha,sn),X(It,be,Ze,ha,sn));var ha,Bo;sn="\u{1D55C}";X(te,be,Br,"k",sn);X(It,be,Ze,"k",sn);for(dm=0;dm<10;dm++)e0=dm.toString(),sn=String.fromCharCode(55349,57294+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn),sn=String.fromCharCode(55349,57314+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn),sn=String.fromCharCode(55349,57324+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn),sn=String.fromCharCode(55349,57334+dm),X(te,be,Br,e0,sn),X(It,be,Ze,e0,sn);var e0,dm,FG="\xD0\xDE\xFE";for(O8=0;O8<FG.length;O8++)n5=FG.charAt(O8),X(te,be,Br,n5,n5),X(It,be,Ze,n5,n5);var n5,O8,$G={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},$ye={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},zye={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},pxt={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},ay={mathClass:"",textClass:"",font:""},Gye={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},qye={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},Vye={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},zG={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},GG={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},Wye={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},qG={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},Hye=[$G,$G,$ye,$ye,zye,zye,pxt,ay,ay,ay,Gye,Gye,qye,qye,Vye,Vye,zG,zG,GG,GG,Wye,Wye,ay,ay,qG,qG],mxt=[$G,ay,zG,GG,qG],gxt=e=>{var t=e.charCodeAt(0),r=e.charCodeAt(1),n=(t-55296)*1024+(r-56320)+65536;if(119808<=n&&n<120484){var i=Math.floor((n-119808)/26);return Hye[i]}else if(120782<=n&&n<=120831){var a=Math.floor((n-120782)/10);return mxt[a]}else{if(n===120485||n===120486)return Hye[0];if(120486<n&&n<120782)return ay;throw new $t("Unsupported character: "+e)}},Q8=function(t,r,n){if(ra[n][t]){var i=ra[n][t].replace;i&&(t=i)}return{value:t,metrics:nq(t,r,n)}},ol=function(t,r,n,i,a){var s=Q8(t,r,n),o=s.metrics;t=s.value;var l;if(o){var u=o.italic;(n==="text"||i&&i.font==="mathit")&&(u=0),l=new cl(t,o.height,o.depth,u,o.skew,o.width,a)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+r+"' and mode '"+n+"'")),l=new cl(t,0,0,0,0,0,a);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var h=i.getColor();h&&(l.style.color=h)}return l},iq=function(t,r,n,i){return i===void 0&&(i=[]),n.font==="boldsymbol"&&Q8(t,"Main-Bold",r).metrics?ol(t,"Main-Bold",r,n,i.concat(["mathbf"])):t==="\\"||ra[r][t].font==="main"?ol(t,"Main-Regular",r,n,i):ol(t,"AMS-Regular",r,n,i.concat(["amsrm"]))},yxt=function(t,r,n){return n!=="textord"&&Q8(t,"Math-BoldItalic",r).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},J8=function(t,r,n){var i=t.mode,a=t.text,s=["mord"],{font:o,fontFamily:l,fontWeight:u,fontShape:h}=r,f=i==="math"||i==="text"&&!!o,d=f?o:l,p="",m="";if(a.charCodeAt(0)===55349){var g=gxt(a);p=g.font,m=g[i+"Class"]}if(p)return ol(a,p,i,r,s.concat(m));if(d){var y,v;if(d==="boldsymbol"){var x=yxt(a,i,n);y=x.fontName,v=[x.fontClass]}else f?(y=VG[o].fontName,v=[o]):(y=P8(l,u,h),v=[l,u,h]);if(Q8(a,y,i).metrics)return ol(a,y,i,r,s.concat(v));if(wve.hasOwnProperty(a)&&y.slice(0,10)==="Typewriter"){for(var w=[],C=0;C<a.length;C++)w.push(ol(a[C],y,i,r,s.concat(v)));return a0(w)}}if(n==="mathord")return ol(a,"Math-Italic",i,r,s.concat(["mathnormal"]));if(n==="textord"){var T=ra[i][a]&&ra[i][a].font;if(T==="ams"){var k=P8("amsrm",u,h);return ol(a,k,i,r,s.concat("amsrm",u,h))}else if(T==="main"||!T){var S=P8("textrm",u,h);return ol(a,S,i,r,s.concat(u,h))}else{var E=P8(T,u,h);return ol(a,E,i,r,s.concat(E,u,h))}}else throw new Error("unexpected type: "+n+" in makeOrd")},vxt=(e,t)=>{if(gm(e.classes)!==gm(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n of Object.keys(e.style))if(e.style[n]!==t.style[n])return!1;for(var i of Object.keys(t.style))if(e.style[i]!==t.style[i])return!1;return!0},kve=e=>{for(var t=0;t<e.length-1;t++){var r=e[t],n=e[t+1];r instanceof cl&&n instanceof cl&&vxt(r,n)&&(r.text+=n.text,r.height=Math.max(r.height,n.height),r.depth=Math.max(r.depth,n.depth),r.italic=n.italic,e.splice(t+1,1),t--)}return e},aq=function(t){for(var r=0,n=0,i=0,a=0;a<t.children.length;a++){var s=t.children[a];s.height>r&&(r=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}t.height=r,t.depth=n,t.maxFontSize=i},Nt=function(t,r,n,i){var a=new ym(t,r,n,i);return aq(a),a},vm=(e,t,r,n)=>new ym(e,t,r,n),hb=function(t,r,n){var i=Nt([t],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=Ut(i.height),i.maxFontSize=1,i},xxt=function(t,r,n,i){var a=new ub(t,r,n,i);return aq(a),a},a0=function(t){var r=new mm(t);return aq(r),r},fb=function(t,r){return t instanceof mm?Nt([],[t],r):t},bxt=function(t){if(t.positionType==="individualShift"){for(var r=t.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,s=1;s<r.length;s++){var o=-r[s].shift-a-r[s].elem.depth,l=o-(r[s-1].elem.height+r[s-1].elem.depth);a=a+o,n.push({type:"kern",size:l}),n.push(r[s])}return{children:n,depth:i}}var u;if(t.positionType==="top"){for(var h=t.positionData,f=0;f<t.children.length;f++){var d=t.children[f];h-=d.type==="kern"?d.size:d.elem.height+d.elem.depth}u=h}else if(t.positionType==="bottom")u=-t.positionData;else{var p=t.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")u=-p.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")u=-p.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:u}},oi=function(t,r){for(var{children:n,depth:i}=bxt(t),a=0,s=0;s<n.length;s++){var o=n[s];if(o.type==="elem"){var l=o.elem;a=Math.max(a,l.maxFontSize,l.height)}}a+=2;var u=Nt(["pstrut"],[]);u.style.height=Ut(a);for(var h=[],f=i,d=i,p=i,m=0;m<n.length;m++){var g=n[m];if(g.type==="kern")p+=g.size;else{var y=g.elem,v=g.wrapperClasses||[],x=g.wrapperStyle||{},w=Nt(v,[u,y],void 0,x);w.style.top=Ut(-a-p-y.depth),g.marginLeft&&(w.style.marginLeft=g.marginLeft),g.marginRight&&(w.style.marginRight=g.marginRight),h.push(w),p+=y.height+y.depth}f=Math.min(f,p),d=Math.max(d,p)}var C=Nt(["vlist"],h);C.style.height=Ut(d);var T;if(f<0){var k=Nt([],[]),S=Nt(["vlist"],[k]);S.style.height=Ut(-f);var E=Nt(["vlist-s"],[new cl("\u200B")]);T=[Nt(["vlist-r"],[C,E]),Nt(["vlist-r"],[S])]}else T=[Nt(["vlist-r"],[C])];var I=Nt(["vlist-t"],T);return T.length===2&&I.classes.push("vlist-t2"),I.height=d,I.depth=-f,I},Tve=(e,t)=>{var r=Nt(["mspace"],[],t),n=da(e,t);return r.style.marginRight=Ut(n),r},P8=(e,t,r)=>{var n,i;switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return t==="textbf"&&r==="textit"?i="BoldItalic":t==="textbf"?i="Bold":r==="textit"?i="Italic":i="Regular",n+"-"+i},VG={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Cve={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Sve=function(t,r){var[n,i,a]=Cve[t],s=new uf(n),o=new sh([s],{width:Ut(i),height:Ut(a),style:"width:"+Ut(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),l=vm(["overlay"],[o],r);return l.height=a,l.style.height=Ut(a),l.style.width=Ut(i),l},fa={number:3,unit:"mu"},iy={number:4,unit:"mu"},t0={number:5,unit:"mu"},wxt={mord:{mop:fa,mbin:iy,mrel:t0,minner:fa},mop:{mord:fa,mop:fa,mrel:t0,minner:fa},mbin:{mord:iy,mop:iy,mopen:iy,minner:iy},mrel:{mord:t0,mop:t0,mopen:t0,minner:t0},mopen:{},mclose:{mop:fa,mbin:iy,mrel:t0,minner:fa},mpunct:{mord:fa,mop:fa,mrel:t0,mopen:fa,mclose:fa,mpunct:fa,minner:fa},minner:{mord:fa,mop:fa,mbin:iy,mrel:t0,mopen:fa,mpunct:fa,minner:fa}},kxt={mord:{mop:fa},mop:{mord:fa,mop:fa},mbin:{},mrel:{},mopen:{},mclose:{mop:fa},mpunct:{},minner:{mop:fa}},Eve={},H8={},U8={};function ir(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l<r.length;++l)Eve[r[l]]=o;t&&(a&&(H8[t]=a),s&&(U8[t]=s))}function sy(e){var{type:t,htmlBuilder:r,mathmlBuilder:n}=e;ir({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:r,mathmlBuilder:n})}var Y8=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Xa=function(t){return t.type==="ordgroup"?t.body:[t]},Txt=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Cxt=new Set(["rightmost","mrel","mclose","mpunct"]),Sxt={display:dn.DISPLAY,text:dn.TEXT,script:dn.SCRIPT,scriptscript:dn.SCRIPTSCRIPT},Ext={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ds=function(t,r,n,i){i===void 0&&(i=[null,null]);for(var a=[],s=0;s<t.length;s++){var o=li(t[s],r);if(o instanceof mm){var l=o.children;a.push(...l)}else a.push(o)}if(kve(a),!n)return a;var u=r;if(t.length===1){var h=t[0];h.type==="sizing"?u=r.havingSize(h.size):h.type==="styling"&&(u=r.havingStyle(Sxt[h.style]))}var f=Nt([i[0]||"leftmost"],[],r),d=Nt([i[1]||"rightmost"],[],r),p=n==="root";return WG(a,(m,g)=>{var y=g.classes[0],v=m.classes[0];y==="mbin"&&Cxt.has(v)?g.classes[0]="mord":v==="mbin"&&Txt.has(y)&&(m.classes[0]="mord")},{node:f},d,p),WG(a,(m,g)=>{var y,v,x=UG(g),w=UG(m),C=x&&w?m.hasClass("mtight")?(y=kxt[x])==null?void 0:y[w]:(v=wxt[x])==null?void 0:v[w]:null;if(C)return Tve(C,u)},{node:f},d,p),a},WG=function(t,r,n,i,a){i&&t.push(i);for(var s=0;s<t.length;s++){var o=t[s],l=Ave(o);if(l){WG(l.children,r,n,null,a);continue}var u=!o.hasClass("mspace");if(u){var h=r(o,n.node);h&&(n.insertAfter?n.insertAfter(h):(t.unshift(h),s++))}u?n.node=o:a&&o.hasClass("newline")&&(n.node=Nt(["leftmost"])),n.insertAfter=(f=>d=>{t.splice(f+1,0,d),s++})(s)}i&&t.pop()},Ave=function(t){return t instanceof mm||t instanceof ub||t instanceof ym&&t.hasClass("enclosing")?t:null},HG=function(t,r){var n=Ave(t);if(n){var i=n.children;if(i.length){if(r==="right")return HG(i[i.length-1],"right");if(r==="left")return HG(i[0],"left")}}return t},UG=function(t,r){if(!t)return null;r&&(t=HG(t,r));var n=t.classes[0];return Ext[n]||null},c5=function(t,r){var n=["nulldelimiter"].concat(t.baseSizingClasses());return Nt(r.concat(n))},li=function(t,r,n){if(!t)return Nt();if(H8[t.type]){var i=H8[t.type](t,r);if(n&&r.size!==n.size){i=Nt(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new $t("Got group of unknown type: '"+t.type+"'")};function B8(e,t){var r=Nt(["base"],e,t),n=Nt(["strut"]);return n.style.height=Ut(r.height+r.depth),r.depth&&(n.style.verticalAlign=Ut(-r.depth)),r.children.unshift(n),r}function YG(e,t){var r=null;e.length===1&&e[0].type==="tag"&&(r=e[0].tag,e=e[0].body);var n=ds(e,t,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var a=[],s=[],o=0;o<n.length;o++)if(s.push(n[o]),n[o].hasClass("mbin")||n[o].hasClass("mrel")||n[o].hasClass("allowbreak")){for(var l=!1;o<n.length-1&&n[o+1].hasClass("mspace")&&!n[o+1].hasClass("newline");)o++,s.push(n[o]),n[o].hasClass("nobreak")&&(l=!0);l||(a.push(B8(s,t)),s=[])}else n[o].hasClass("newline")&&(s.pop(),s.length>0&&(a.push(B8(s,t)),s=[]),a.push(n[o]));s.length>0&&a.push(B8(s,t));var u;r?(u=B8(ds(r,t,!0),t),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=Nt(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=Ut(h.height+h.depth),h.depth&&(f.style.verticalAlign=Ut(-h.depth))}return h}function _ve(e){return new mm(e)}var Ot=class{constructor(t,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=gm(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Ta&&this.children[n+1]instanceof Ta){for(var i=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Ta;)i+=this.children[++n].toText();t.appendChild(new Ta(i).toNode())}else t.appendChild(this.children[n].toNode());return t}toMarkup(){var t="<"+this.type;for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(t+=" "+r+'="',t+=Fo(this.attributes[r]),t+='"');this.classes.length>0&&(t+=' class ="'+Fo(gm(this.classes))+'"'),t+=">";for(var n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}},Ta=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Fo(this.toText())}toText(){return this.text}},X8=class{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character="\u200A":t>=.1666&&t<=.1667?this.character="\u2009":t>=.2222&&t<=.2223?this.character="\u2005":t>=.2777&&t<=.2778?this.character="\u2005\u200A":t>=-.05556&&t<=-.05555?this.character="\u200A\u2063":t>=-.1667&&t<=-.1666?this.character="\u2009\u2063":t>=-.2223&&t<=-.2222?this.character="\u205F\u2063":t>=-.2778&&t<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Ut(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ut(this.width)+'"/>'}toText(){return this.character?this.character:" "}},Axt=new Set(["\\imath","\\jmath"]),_xt=new Set(["mrow","mtable"]),bu=function(t,r,n){return ra[r][t]&&ra[r][t].replace&&t.charCodeAt(0)!==55349&&!(wve.hasOwnProperty(t)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(t=ra[r][t].replace),new Ta(t)},sq=function(t){return t.length===1?t[0]:new Ot("mrow",t)},Rxt={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},oq=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var r=t.font;if(!r||r==="mathnormal")return null;var n=e.mode,i=Rxt[r];if(i)return typeof i=="function"?i(e):i;var a=e.text;if(Axt.has(a))return null;if(ra[n][a]){var s=ra[n][a].replace;s&&(a=s)}var o=VG[r].fontName;return nq(a,o,n)?VG[r].variant:null};function TG(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Ta&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof Ta&&r.text===","}else return!1}var Mc=function(t,r,n){if(t.length===1){var i=Ii(t[0],r);return n&&i instanceof Ot&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],s,o=0;o<t.length;o++){var l=Ii(t[o],r);if(l instanceof Ot&&s instanceof Ot){if(l.type==="mtext"&&s.type==="mtext"&&l.getAttribute("mathvariant")===s.getAttribute("mathvariant")){s.children.push(...l.children);continue}else if(l.type==="mn"&&s.type==="mn"){s.children.push(...l.children);continue}else if(TG(l)&&s.type==="mn"){s.children.push(...l.children);continue}else if(l.type==="mn"&&TG(s))l.children=[...s.children,...l.children],a.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(s.type==="mn"||TG(s))){var u=l.children[0];u instanceof Ot&&u.type==="mn"&&(u.children=[...s.children,...u.children],a.pop())}else if(s.type==="mi"&&s.children.length===1){var h=s.children[0];if(h instanceof Ta&&h.text==="\u0338"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var f=l.children[0];f instanceof Ta&&f.text.length>0&&(f.text=f.text.slice(0,1)+"\u0338"+f.text.slice(1),a.pop())}}}a.push(l),s=l}return a},xm=function(t,r,n){return sq(Mc(t,r,n))},Ii=function(t,r){if(!t)return new Ot("mrow");if(U8[t.type])return U8[t.type](t,r);throw new $t("Got group of unknown type: '"+t.type+"'")};function Uye(e,t,r,n,i){var a=Mc(e,r),s;a.length===1&&a[0]instanceof Ot&&_xt.has(a[0].type)?s=a[0]:s=new Ot("mrow",a);var o=new Ot("annotation",[new Ta(t)]);o.setAttribute("encoding","application/x-tex");var l=new Ot("semantics",[s,o]),u=new Ot("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return Nt([h],[u])}var Lxt=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Yye=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Xye=function(t,r){return r.size<2?t:Lxt[t-1][r.size-1]},j8=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=Yye[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(r,t),new e(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:Xye(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:Yye[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=Xye(e.BASESIZE,t);return this.size===r&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==e.BASESIZE?["sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=dxt(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};j8.BASESIZE=6;var Rve=function(t){return new j8({style:t.displayMode?dn.DISPLAY:dn.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},Lve=function(t,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),t=Nt(n,[t])}return t},Ixt=function(t,r,n){var i=Rve(n),a;if(n.output==="mathml")return Uye(t,r,i,n.displayMode,!0);if(n.output==="html"){var s=YG(t,i);a=Nt(["katex"],[s])}else{var o=Uye(t,r,i,n.displayMode,!1),l=YG(t,i);a=Nt(["katex"],[o,l])}return Lve(a,n)},Mxt=function(t,r,n){var i=Rve(n),a=YG(t,i),s=Nt(["katex"],[a]);return Lve(s,n)},Nxt={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",underbracket:"\u23B5",overbracket:"\u23B4",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",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},eA=function(t){var r=new Ot("mo",[new Ta(Nxt[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},Dxt={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"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,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"],"\\cdlongequal":[["longequal"],3,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],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["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],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Oxt=new Set(["widehat","widecheck","widetilde","utilde"]),tA=function(t,r){function n(){var o=4e5,l=t.label.slice(1);if(Oxt.has(l)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,h,f,d;if(u>5)l==="widehat"||l==="widecheck"?(h=420,o=2364,d=.42,f=l+"4"):(h=312,o=2340,d=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][p],h=[0,239,300,360,420][p],d=[0,.24,.3,.3,.36,.42][p],f=l+p):(o=[0,600,1033,2339,2340][p],h=[0,260,286,306,312][p],d=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var m=new uf(f),g=new sh([m],{width:"100%",height:Ut(d),viewBox:"0 0 "+o+" "+h,preserveAspectRatio:"none"});return{span:vm([],[g],r),minWidth:0,height:d}}else{var y=[],v=Dxt[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[x,w,C]=v,T=C/1e3,k=x.length,S,E;if(k===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');S=["hide-tail"],E=[v[3]]}else if(k===2)S=["halfarrow-left","halfarrow-right"],E=["xMinYMin","xMaxYMin"];else if(k===3)S=["brace-left","brace-center","brace-right"],E=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+k+" children.");for(var I=0;I<k;I++){var L=new uf(x[I]),O=new sh([L],{width:"400em",height:Ut(T),viewBox:"0 0 "+o+" "+C,preserveAspectRatio:E[I]+" slice"}),R=vm([S[I]],[O],r);if(k===1)return{span:R,minWidth:w,height:T};R.style.height=Ut(T),y.push(R)}return{span:Nt(["stretchy"],y,r),minWidth:w,height:T}}}var{span:i,minWidth:a,height:s}=n();return i.height=s,i.style.height=Ut(s),a>0&&(i.style.minWidth=Ut(a)),i},Pxt=function(t,r,n,i,a){var s,o=t.height+t.depth+n+i;if(/fbox|color|angl/.test(r)){if(s=Nt(["stretchy",r],[],a),r==="fbox"){var l=a.color&&a.getColor();l&&(s.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new l5({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new l5({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new sh(u,{width:"100%",height:Ut(o)});s=vm([],[h],a)}return s.height=o,s.style.height=Ut(o),s},Bxt={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Fxt={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function $xt(e){return e in Bxt}function kn(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function rA(e){var t=nA(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function nA(e){return e&&(e.type==="atom"||Fxt.hasOwnProperty(e.type))?e:null}var Ive=e=>{if(e instanceof cl)return e;if(hxt(e)&&e.children.length===1)return Ive(e.children[0])},lq=(e,t)=>{var r,n,i;e&&e.type==="supsub"?(n=kn(e.base,"accent"),r=n.base,e.base=r,i=uxt(li(e,t)),e.base=n):(n=kn(e,"accent"),r=n.base);var a=li(r,t.havingCrampedStyle()),s=n.isShifty&&n0(r),o=0;if(s){var l,u;o=(l=(u=Ive(a))==null?void 0:u.skew)!=null?l:0}var h=n.label==="\\c",f=h?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),d;if(n.isStretchy)d=tA(n,t),d=oi({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+Ut(2*o)+")",marginLeft:Ut(2*o)}:void 0}]});else{var p,m;n.label==="\\vec"?(p=Sve("vec",t),m=Cve.vec[1]):(p=J8({type:"textord",mode:n.mode,text:n.label},t,"textord"),p=cxt(p),p.italic=0,m=p.width,h&&(f+=p.depth)),d=Nt(["accent-body"],[p]);var g=n.label==="\\textcircled";g&&(d.classes.push("accent-full"),f=a.height);var y=o;g||(y-=m/2),d.style.left=Ut(y),n.label==="\\textcircled"&&(d.style.top=".2em"),d=oi({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-f},{type:"elem",elem:d}]})}var v=Nt(["mord","accent"],[d],t);return i?(i.children[0]=v,i.height=Math.max(v.height,i.height),i.classes[0]="mord",i):v},Mve=(e,t)=>{var r=e.isStretchy?eA(e.label):new Ot("mo",[bu(e.label,e.mode)]),n=new Ot("mover",[Ii(e.base,t),r]);return n.setAttribute("accent","true"),n},zxt=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));ir({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=Y8(t[0]),n=!zxt.test(e.funcName),i=!n||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:lq,mathmlBuilder:Mve});ir({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],n=e.parser.mode;return n==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:lq,mathmlBuilder:Mve});ir({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(e,t)=>{var r=li(e.base,t),n=tA(e,t),i=e.label==="\\utilde"?.12:0,a=oi({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]});return Nt(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var r=eA(e.label),n=new Ot("munder",[Ii(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var F8=e=>{var t=new Ot("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};ir({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n,funcName:i}=e;return{type:"xArrow",mode:n.mode,label:i,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,n=t.havingStyle(r.sup()),i=fb(li(e.body,n,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var s;e.below&&(n=t.havingStyle(r.sub()),s=fb(li(e.below,n,t),t),s.classes.push(a+"-arrow-pad"));var o=tA(e,t),l=-t.fontMetrics().axisHeight+.5*o.height,u=-t.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(s){var f=-t.fontMetrics().axisHeight+s.height+.5*o.height+.111;h=oi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:s,shift:f}]})}else h=oi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return Nt(["mrel","x-arrow"],[h],t)},mathmlBuilder(e,t){var r=eA(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(e.body){var i=F8(Ii(e.body,t));if(e.below){var a=F8(Ii(e.below,t));n=new Ot("munderover",[r,a,i])}else n=new Ot("mover",[r,i])}else if(e.below){var s=F8(Ii(e.below,t));n=new Ot("munder",[r,s])}else n=F8(),n=new Ot("mover",[r,n]);return n}});function Nve(e,t){var r=ds(e.body,t,!0);return Nt([e.mclass],r,t)}function Dve(e,t){var r,n=Mc(e.body,t);return e.mclass==="minner"?r=new Ot("mpadded",n):e.mclass==="mord"?e.isCharacterBox?(r=n[0],r.type="mi"):r=new Ot("mi",n):(e.isCharacterBox?(r=n[0],r.type="mo"):r=new Ot("mo",n),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}ir({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:Xa(i),isCharacterBox:n0(i)}},htmlBuilder:Nve,mathmlBuilder:Dve});var iA=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};ir({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:iA(t[0]),body:Xa(t[1]),isCharacterBox:n0(t[1])}}});ir({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:n}=e,i=t[1],a=t[0],s;n!=="\\stackrel"?s=iA(i):s="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:Xa(i)},l={type:"supsub",mode:a.mode,base:o,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:s,body:[l],isCharacterBox:n0(l)}},htmlBuilder:Nve,mathmlBuilder:Dve});ir({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:iA(t[0]),body:Xa(t[0])}},htmlBuilder(e,t){var r=ds(e.body,t,!0),n=Nt([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=Mc(e.body,t),n=new Ot("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var Gxt={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},jye=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),Kye=e=>e.type==="textord"&&e.text==="@",qxt=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Vxt(e,t,r){var n=Gxt[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},s=r.callFunction("\\Big",[a],[]),o=r.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[i,s,o]};return r.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Wxt(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new $t("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var n=[],i=[n],a=0;a<t.length;a++){for(var s=t[a],o=jye(),l=0;l<s.length;l++)if(!Kye(s[l]))o.body.push(s[l]);else{n.push(o),l+=1;var u=rA(s[l]).text,h=new Array(2);if(h[0]={type:"ordgroup",mode:"math",body:[]},h[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(u))if("<>AV".includes(u))for(var f=0;f<2;f++){for(var d=!0,p=l+1;p<s.length;p++){if(qxt(s[p],u)){d=!1,l=p;break}if(Kye(s[p]))throw new $t("Missing a "+u+" character to complete a CD arrow.",s[p]);h[f].body.push(s[p])}if(d)throw new $t("Missing a "+u+" character to complete a CD arrow.",s[l])}else throw new $t('Expected one of "<>AV=|." after @',s[l]);var m=Vxt(u,h,e),g={type:"styling",body:[m],mode:"math",style:"display",resetFont:!0};n.push(g),o=jye()}a%2===0?n.push(o):n.shift(),n=[],i.push(n)}e.gullet.endGroup(),e.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}ir({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=fb(li(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=Ut(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new Ot("mrow",[Ii(e.label,t)]);return r=new Ot("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new Ot("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});ir({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=fb(li(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new Ot("mrow",[Ii(e.fragment,t)])}});ir({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,n=kn(t[0],"ordgroup"),i=n.body,a="",s=0;s<i.length;s++){var o=kn(i[s],"textord");a+=o.text}var l=parseInt(a),u;if(isNaN(l))throw new $t("\\@char has non-numeric argument "+a);if(l<0||l>=1114111)throw new $t("\\@char with invalid code point "+a);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});var Ove=(e,t)=>{var r=ds(e.body,t.withColor(e.color),!1);return a0(r)},Pve=(e,t)=>{var r=Mc(e.body,t.withColor(e.color)),n=new Ot("mstyle",r);return n.setAttribute("mathcolor",e.color),n};ir({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,n=kn(t[0],"color-token").color,i=t[1];return{type:"color",mode:r.mode,color:n,body:Xa(i)}},htmlBuilder:Ove,mathmlBuilder:Pve});ir({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:n}=e,i=kn(t[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:Ove,mathmlBuilder:Pve});ir({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:n}=e,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&kn(i,"size").value}},htmlBuilder(e,t){var r=Nt(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=Ut(da(e.size,t)))),r},mathmlBuilder(e,t){var r=new Ot("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",Ut(da(e.size,t)))),r}});var XG={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Bve=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new $t("Expected a control sequence",e);return t},Hxt=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},Fve=(e,t,r,n)=>{var i=e.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,i,n)};ir({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var n=t.fetch();if(XG[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=XG[n.text]),kn(t.parseFunction(),"internal");throw new $t("Invalid token after macro prefix",n)}});ir({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=t.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new $t("Expected a control sequence",n);for(var a=0,s,o=[[]];t.gullet.future().text!=="{";)if(n=t.gullet.popToken(),n.text==="#"){if(t.gullet.future().text==="{"){s=t.gullet.future(),o[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new $t('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new $t('Argument number "'+n.text+'" out of order');a++,o.push([])}else{if(n.text==="EOF")throw new $t("Expected a macro definition");o[a].push(n.text)}var{tokens:l}=t.gullet.consumeArg();return s&&l.unshift(s),(r==="\\edef"||r==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(i,{tokens:l,numArgs:a,delimiters:o},r===XG[r]),{type:"internal",mode:t.mode}}});ir({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=Bve(t.gullet.popToken());t.gullet.consumeSpaces();var i=Hxt(t);return Fve(t,n,i,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});ir({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=Bve(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return Fve(t,n,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var i5=function(t,r,n){var i=ra.math[t]&&ra.math[t].replace,a=nq(i||t,r,n);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},cq=function(t,r,n,i){var a=n.havingBaseStyle(r),s=Nt(i.concat(a.sizingClasses(n)),[t],n),o=a.sizeMultiplier/n.sizeMultiplier;return s.height*=o,s.depth*=o,s.maxFontSize=a.sizeMultiplier,s},$ve=function(t,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Ut(a),t.height-=a,t.depth+=a},Uxt=function(t,r,n,i,a,s){var o=ol(t,"Main-Regular",a,i),l=cq(o,r,i,s);return n&&$ve(l,i,r),l},Yxt=function(t,r,n,i){return ol(t,"Size"+r+"-Regular",n,i)},zve=function(t,r,n,i,a,s){var o=Yxt(t,r,a,i),l=cq(Nt(["delimsizing","size"+r],[o],i),dn.TEXT,i,s);return n&&$ve(l,i,dn.TEXT),l},CG=function(t,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=Nt(["delimsizinginner",i],[Nt([],[ol(t,r,n)])]);return{type:"elem",elem:a}},SG=function(t,r,n){var i=cf["Size4-Regular"][t.charCodeAt(0)]?cf["Size4-Regular"][t.charCodeAt(0)][4]:cf["Size1-Regular"][t.charCodeAt(0)][4],a=new uf("inner",nxt(t,Math.round(1e3*r))),s=new sh([a],{width:Ut(i),height:Ut(r),style:"width:"+Ut(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),o=vm([],[s],n);return o.height=r,o.style.height=Ut(r),o.style.width=Ut(i),{type:"elem",elem:o}},jG=.008,$8={type:"kern",size:-1*jG},Xxt=new Set(["|","\\lvert","\\rvert","\\vert"]),jxt=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Gve=function(t,r,n,i,a,s){var o,l,u,h,f="",d=0;o=u=h=t,l=null;var p="Size1-Regular";t==="\\uparrow"?u=h="\u23D0":t==="\\Uparrow"?u=h="\u2016":t==="\\downarrow"?o=u="\u23D0":t==="\\Downarrow"?o=u="\u2016":t==="\\updownarrow"?(o="\\uparrow",u="\u23D0",h="\\downarrow"):t==="\\Updownarrow"?(o="\\Uparrow",u="\u2016",h="\\Downarrow"):Xxt.has(t)?(u="\u2223",f="vert",d=333):jxt.has(t)?(u="\u2225",f="doublevert",d=556):t==="["||t==="\\lbrack"?(o="\u23A1",u="\u23A2",h="\u23A3",p="Size4-Regular",f="lbrack",d=667):t==="]"||t==="\\rbrack"?(o="\u23A4",u="\u23A5",h="\u23A6",p="Size4-Regular",f="rbrack",d=667):t==="\\lfloor"||t==="\u230A"?(u=o="\u23A2",h="\u23A3",p="Size4-Regular",f="lfloor",d=667):t==="\\lceil"||t==="\u2308"?(o="\u23A1",u=h="\u23A2",p="Size4-Regular",f="lceil",d=667):t==="\\rfloor"||t==="\u230B"?(u=o="\u23A5",h="\u23A6",p="Size4-Regular",f="rfloor",d=667):t==="\\rceil"||t==="\u2309"?(o="\u23A4",u=h="\u23A5",p="Size4-Regular",f="rceil",d=667):t==="("||t==="\\lparen"?(o="\u239B",u="\u239C",h="\u239D",p="Size4-Regular",f="lparen",d=875):t===")"||t==="\\rparen"?(o="\u239E",u="\u239F",h="\u23A0",p="Size4-Regular",f="rparen",d=875):t==="\\{"||t==="\\lbrace"?(o="\u23A7",l="\u23A8",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(o="\u23AB",l="\u23AC",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lgroup"||t==="\u27EE"?(o="\u23A7",h="\u23A9",u="\u23AA",p="Size4-Regular"):t==="\\rgroup"||t==="\u27EF"?(o="\u23AB",h="\u23AD",u="\u23AA",p="Size4-Regular"):t==="\\lmoustache"||t==="\u23B0"?(o="\u23A7",h="\u23AD",u="\u23AA",p="Size4-Regular"):(t==="\\rmoustache"||t==="\u23B1")&&(o="\u23AB",h="\u23A9",u="\u23AA",p="Size4-Regular");var m=i5(o,p,a),g=m.height+m.depth,y=i5(u,p,a),v=y.height+y.depth,x=i5(h,p,a),w=x.height+x.depth,C=0,T=1;if(l!==null){var k=i5(l,p,a);C=k.height+k.depth,T=2}var S=g+w+C,E=Math.max(0,Math.ceil((r-S)/(T*v))),I=S+E*T*v,L=i.fontMetrics().axisHeight;n&&(L*=i.sizeMultiplier);var O=I/2-L,R=[];if(f.length>0){var A=I-g-w,N=Math.round(I*1e3),M=ixt(f,Math.round(A*1e3)),D=new uf(f,M),B=Ut(d/1e3),P=Ut(N/1e3),$=new sh([D],{width:B,height:P,viewBox:"0 0 "+d+" "+N}),F=vm([],[$],i);F.height=N/1e3,F.style.width=B,F.style.height=P,R.push({type:"elem",elem:F})}else{if(R.push(CG(h,p,a)),R.push($8),l===null){var q=I-g-w+2*jG;R.push(SG(u,q,i))}else{var G=(I-g-w-C)/2+2*jG;R.push(SG(u,G,i)),R.push($8),R.push(CG(l,p,a)),R.push($8),R.push(SG(u,G,i))}R.push($8),R.push(CG(o,p,a))}var z=i.havingBaseStyle(dn.TEXT),H=oi({positionType:"bottom",positionData:O,children:R});return cq(Nt(["delimsizing","mult"],[H],z),dn.TEXT,i,s)},EG=80,AG=.08,_G=function(t,r,n,i,a){var s=rxt(t,i,n),o=new uf(t,s),l=new sh([o],{width:"400em",height:Ut(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return vm(["hide-tail"],[l],a)},Kxt=function(t,r){var n=r.havingBaseSizing(),i=Uve("\\surd",t*n.sizeMultiplier,Hve,n),a=n.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),o,l,u,h,f;return i.type==="small"?(h=1e3+1e3*s+EG,t<1?a=1:t<1.4&&(a=.7),l=(1+s+AG)/a,u=(1+s)/a,o=_G("sqrtMain",l,h,s,r),o.style.minWidth="0.853em",f=.833/a):i.type==="large"?(h=(1e3+EG)*a5[i.size],u=(a5[i.size]+s)/a,l=(a5[i.size]+s+AG)/a,o=_G("sqrtSize"+i.size,l,h,s,r),o.style.minWidth="1.02em",f=1/a):(l=t+s+AG,u=t+s,h=Math.floor(1e3*t+s)+EG,o=_G("sqrtTall",l,h,s,r),o.style.minWidth="0.742em",f=1.056),o.height=u,o.style.height=Ut(l),{span:o,advanceWidth:f,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*a}},qve=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"]),Zxt=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"]),Vve=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),a5=[0,1.2,1.8,2.4,3],Wve=function(t,r,n,i,a){if(t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle"),qve.has(t)||Vve.has(t))return zve(t,r,!1,n,i,a);if(Zxt.has(t))return Gve(t,a5[r],!1,n,i,a);throw new $t("Illegal delimiter: '"+t+"'")},Qxt=[{type:"small",style:dn.SCRIPTSCRIPT},{type:"small",style:dn.SCRIPT},{type:"small",style:dn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Jxt=[{type:"small",style:dn.SCRIPTSCRIPT},{type:"small",style:dn.SCRIPT},{type:"small",style:dn.TEXT},{type:"stack"}],Hve=[{type:"small",style:dn.SCRIPTSCRIPT},{type:"small",style:dn.SCRIPT},{type:"small",style:dn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],ebt=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var r=t.type;throw new Error("Add support for delim type '"+r+"' here.")},Uve=function(t,r,n,i){for(var a=Math.min(2,3-i.style.size),s=a;s<n.length;s++){var o=n[s];if(o.type==="stack")break;var l=i5(t,ebt(o),"math"),u=l.height+l.depth;if(o.type==="small"){var h=i.havingBaseStyle(o.style);u*=h.sizeMultiplier}if(u>r)return o}return n[n.length-1]},KG=function(t,r,n,i,a,s){t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle");var o;Vve.has(t)?o=Qxt:qve.has(t)?o=Hve:o=Jxt;var l=Uve(t,r,o,i);return l.type==="small"?Uxt(t,l.style,n,i,a,s):l.type==="large"?zve(t,l.size,n,i,a,s):Gve(t,r,n,i,a,s)},RG=function(t,r,n,i,a,s){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-o,n+o),f=Math.max(h/500*l,2*h-u);return KG(t,f,!0,i,a,s)},Zye={"\\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}},tbt=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function Qye(e){return"isMiddle"in e}function aA(e,t){var r=nA(e);if(r&&tbt.has(r.text))return r;throw r?new $t("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new $t("Invalid delimiter type '"+e.type+"'",e)}ir({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=aA(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Zye[e.funcName].size,mclass:Zye[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?Nt([e.mclass]):Wve(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(bu(e.delim,e.mode));var r=new Ot("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=Ut(a5[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function Jye(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ir({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new $t("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:aA(t[0],e).text,color:r}}});ir({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=aA(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=kn(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{Jye(e);for(var r=ds(e.body,t,!0,["mopen","mclose"]),n=0,i=0,a=!1,s=0;s<r.length;s++){var o=r[s];Qye(o)?a=!0:(n=Math.max(r[s].height,n),i=Math.max(r[s].depth,i))}n*=t.sizeMultiplier,i*=t.sizeMultiplier;var l;if(e.left==="."?l=c5(t,["mopen"]):l=RG(e.left,n,i,t,e.mode,["mopen"]),r.unshift(l),a)for(var u=1;u<r.length;u++){var h=r[u];if(Qye(h)){var f=h.isMiddle;r[u]=RG(f.delim,n,i,f.options,e.mode,[])}}var d;if(e.right===".")d=c5(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;d=RG(e.right,n,i,p,e.mode,["mclose"])}return r.push(d),Nt(["minner"],r,t)},mathmlBuilder:(e,t)=>{Jye(e);var r=Mc(e.body,t);if(e.left!=="."){var n=new Ot("mo",[bu(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(e.right!=="."){var i=new Ot("mo",[bu(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),r.push(i)}return sq(r)}});ir({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=aA(t[0],e);if(!e.parser.leftrightDepth)throw new $t("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;return e.delim==="."?r=c5(t,[]):(r=Wve(e.delim,1,t,e.mode,[]),r.isMiddle={delim:e.delim,options:t}),r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?bu("|","text"):bu(e.delim,e.mode),n=new Ot("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var sA=(e,t)=>{var r=fb(li(e.body,t),t),n=e.label.slice(1),i=t.sizeMultiplier,a,s,o=n0(e.body);if(n==="sout")a=Nt(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,s=-.5*t.fontMetrics().xHeight;else if(n==="phase"){var l=da({number:.6,unit:"pt"},t),u=da({number:.35,unit:"ex"},t),h=t.havingBaseSizing();i=i/h.sizeMultiplier;var f=r.height+r.depth+l+u;r.style.paddingLeft=Ut(f/2+l);var d=Math.floor(1e3*f*i),p=ext(d),m=new sh([new uf("phase",p)],{width:"400em",height:Ut(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=vm(["hide-tail"],[m],t),a.style.height=Ut(f),s=r.depth+l+u}else{/cancel/.test(n)?o||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var g,y,v=0;/box/.test(n)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),g=t.fontMetrics().fboxsep+(n==="colorbox"?0:v),y=g):n==="angl"?(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),g=4*v,y=Math.max(0,.25-r.depth)):(g=o?.2:0,y=g),a=Pxt(r,n,g,y,t),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=Ut(v)):n==="angl"&&v!==.049&&(a.style.borderTopWidth=Ut(v),a.style.borderRightWidth=Ut(v)),s=r.depth+y,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var x;if(e.backgroundColor)x=oi({positionType:"individualShift",children:[{type:"elem",elem:a,shift:s},{type:"elem",elem:r,shift:0}]});else{var w=/cancel|phase/.test(n)?["svg-align"]:[];x=oi({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:s,wrapperClasses:w}]})}return/cancel/.test(n)&&(x.height=r.height,x.depth=r.depth),/cancel/.test(n)&&!o?Nt(["mord","cancel-lap"],[x],t):Nt(["mord"],[x],t)},oA=(e,t)=>{var r,n=new Ot(e.label.includes("colorbox")?"mpadded":"menclose",[Ii(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+Ut(i)+" solid "+e.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};ir({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=kn(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:s}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=kn(t[0],"color-token").color,s=kn(t[1],"color-token").color,o=t[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,borderColor:a,body:o}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});ir({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e;r.mode==="math"&&r.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:sA,mathmlBuilder:oA});ir({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});var Yve={};function hf(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<r.length;++l)Yve[r[l]]=o;a&&(H8[t]=a),s&&(U8[t]=s)}var Xve={};function Ae(e,t){Xve[e]=t}var Ul=class e{constructor(t,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=r,this.end=n}static range(t,r){return r?!t||!t.loc||!r.loc||t.loc.lexer!==r.loc.lexer?null:new e(t.loc.lexer,t.loc.start,r.loc.end):t&&t.loc}},Lc=class e{constructor(t,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=r}range(t,r){return new e(r,Ul.range(this,t))}};function eve(e){var t=[];e.consumeSpaces();var r=e.fetch().text;for(r==="\\relax"&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);r==="\\hline"||r==="\\hdashline";)e.consume(),t.push(r==="\\hdashline"),e.consumeSpaces(),r=e.fetch().text;return t}var lA=e=>{var t=e.parser.settings;if(!t.displayMode)throw new $t("{"+e.envName+"} can be used only in display mode.")},rbt=new Set(["gather","gather*"]);function uq(e){if(!e.includes("ed"))return!e.includes("*")}function bm(e,t,r){var{hskipBeforeAndAfter:n,addJot:i,cols:a,arraystretch:s,colSeparationType:o,autoTag:l,singleRow:u,emptySingleRow:h,maxNumCols:f,leqno:d}=t;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!s){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)s=1;else if(s=parseFloat(p),!s||s<0)throw new $t("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var m=[],g=[m],y=[],v=[],x=l!=null?[]:void 0;function w(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function C(){x&&(e.gullet.macros.get("\\df@tag")?(x.push(e.subparse([new Lc("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):x.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),v.push(eve(e));;){var T=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var k={type:"ordgroup",mode:e.mode,body:T};r&&(k={type:"styling",mode:e.mode,style:r,resetFont:!0,body:[k]}),m.push(k);var S=e.fetch().text;if(S==="&"){if(f&&m.length===f){if(u||o)throw new $t("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(S==="\\end"){C(),m.length===1&&k.type==="styling"&&k.body.length===1&&k.body[0].type==="ordgroup"&&k.body[0].body.length===0&&(g.length>1||!h)&&g.pop(),v.length<g.length+1&&v.push([]);break}else if(S==="\\\\"){e.consume();var E=void 0;e.gullet.future().text!==" "&&(E=e.parseSizeGroup(!0)),y.push(E?E.value:null),C(),v.push(eve(e)),m=[],g.push(m),w()}else throw new $t("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:i,arraystretch:s,body:g,cols:a,rowGaps:y,hskipBeforeAndAfter:n,hLinesBeforeRow:v,colSeparationType:o,tags:x,leqno:d}}function hq(e){return e.slice(0,1)==="d"?"display":"text"}var ff=function(t,r){var n,i,a=t.body.length,s=t.hLinesBeforeRow,o=0,l=new Array(a),u=[],h=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),f=1/r.fontMetrics().ptPerEm,d=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var p=r.havingStyle(dn.SCRIPT).sizeMultiplier;d=.2778*(p/r.sizeMultiplier)}var m=t.colSeparationType==="CD"?da({number:3,unit:"ex"},r):12*f,g=3*f,y=t.arraystretch*m,v=.7*y,x=.3*y,w=0;function C(Ie){for(var ye=0;ye<Ie.length;++ye)ye>0&&(w+=.25),u.push({pos:w,isDashed:Ie[ye]})}for(C(s[0]),n=0;n<t.body.length;++n){var T=t.body[n],k=v,S=x;o<T.length&&(o=T.length);var E={cells:new Array(T.length),height:0,depth:0,pos:0};for(i=0;i<T.length;++i){var I=li(T[i],r);S<I.depth&&(S=I.depth),k<I.height&&(k=I.height),E.cells[i]=I}var L=t.rowGaps[n],O=0;L&&(O=da(L,r),O>0&&(O+=x,S<O&&(S=O),O=0)),t.addJot&&n<t.body.length-1&&(S+=g),E.height=k,E.depth=S,w+=k,E.pos=w,w+=S+O,l[n]=E,C(s[n+1])}var R=w/2+r.fontMetrics().axisHeight,A=t.cols||[],N=[],M,D,B=[];if(t.tags&&t.tags.some(Ie=>Ie))for(n=0;n<a;++n){var P=l[n],$=P.pos-R,F=t.tags[n],q=void 0;F===!0?q=Nt(["eqn-num"],[],r):F===!1?q=Nt([],[],r):q=Nt([],ds(F,r,!0),r),q.depth=P.depth,q.height=P.height,B.push({type:"elem",elem:q,shift:$})}for(i=0,D=0;i<o||D<A.length;++i,++D){for(var G,z=A[D],H=!0;((j=z)==null?void 0:j.type)==="separator";){var j;if(H||(M=Nt(["arraycolsep"],[]),M.style.width=Ut(r.fontMetrics().doubleRuleSep),N.push(M)),z.separator==="|"||z.separator===":"){var J=z.separator==="|"?"solid":"dashed",U=Nt(["vertical-separator"],[],r);U.style.height=Ut(w),U.style.borderRightWidth=Ut(h),U.style.borderRightStyle=J,U.style.margin="0 "+Ut(-h/2);var le=w-R;le&&(U.style.verticalAlign=Ut(-le)),N.push(U)}else throw new $t("Invalid separator type: "+z.separator);D++,z=A[D],H=!1}if(!(i>=o)){var ee=void 0;if(i>0||t.hskipBeforeAndAfter){var ue,ae;ee=(ue=(ae=z)==null?void 0:ae.pregap)!=null?ue:d,ee!==0&&(M=Nt(["arraycolsep"],[]),M.style.width=Ut(ee),N.push(M))}var oe=[];for(n=0;n<a;++n){var Re=l[n],Te=Re.cells[i];if(Te){var Oe=Re.pos-R;Te.depth=Re.depth,Te.height=Re.height,oe.push({type:"elem",elem:Te,shift:Oe})}}var qe=oi({positionType:"individualShift",children:oe}),Ge=Nt(["col-align-"+(((G=z)==null?void 0:G.align)||"c")],[qe]);if(N.push(Ge),i<o-1||t.hskipBeforeAndAfter){var fe,Ce;ee=(fe=(Ce=z)==null?void 0:Ce.postgap)!=null?fe:d,ee!==0&&(M=Nt(["arraycolsep"],[]),M.style.width=Ut(ee),N.push(M))}}}var _e=Nt(["mtable"],N);if(u.length>0){for(var de=hb("hline",r,h),ie=hb("hdashline",r,h),Q=[{type:"elem",elem:_e,shift:0}];u.length>0;){var he=u.pop(),xe=he.pos-R;he.isDashed?Q.push({type:"elem",elem:ie,shift:xe}):Q.push({type:"elem",elem:de,shift:xe})}_e=oi({positionType:"individualShift",children:Q})}if(B.length===0)return Nt(["mord"],[_e],r);var ce=oi({positionType:"individualShift",children:B}),ge=Nt(["tag"],[ce],r);return a0([_e,ge])},nbt={c:"center ",l:"left ",r:"right "},df=function(t,r){for(var n=[],i=new Ot("mtd",[],["mtr-glue"]),a=new Ot("mtd",[],["mml-eqn-num"]),s=0;s<t.body.length;s++){for(var o=t.body[s],l=[],u=0;u<o.length;u++)l.push(new Ot("mtd",[Ii(o[u],r)]));t.tags&&t.tags[s]&&(l.unshift(i),l.push(i),t.leqno?l.unshift(a):l.push(a)),n.push(new Ot("mtr",l))}var h=new Ot("mtable",n),f=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);h.setAttribute("rowspacing",Ut(f));var d="",p="";if(t.cols&&t.cols.length>0){var m=t.cols,g="",y=!1,v=0,x=m.length;m[0].type==="separator"&&(d+="top ",v=1),m[m.length-1].type==="separator"&&(d+="bottom ",x-=1);for(var w=v;w<x;w++){var C=m[w];C.type==="align"?(p+=nbt[C.align],y&&(g+="none "),y=!0):C.type==="separator"&&y&&(g+=C.separator==="|"?"solid ":"dashed ",y=!1)}h.setAttribute("columnalign",p.trim()),/[sd]/.test(g)&&h.setAttribute("columnlines",g.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],k="",S=1;S<T.length;S++)k+=S%2?"0em ":"1em ";h.setAttribute("columnspacing",k.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?h.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?h.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?h.setAttribute("columnspacing","0.5em"):h.setAttribute("columnspacing","1em");var E="",I=t.hLinesBeforeRow;d+=I[0].length>0?"left ":"",d+=I[I.length-1].length>0?"right ":"";for(var L=1;L<I.length-1;L++)E+=I[L].length===0?"none ":I[L][0]?"dashed ":"solid ";return/[sd]/.test(E)&&h.setAttribute("rowlines",E.trim()),d!==""&&(h=new Ot("menclose",[h]),h.setAttribute("notation",d.trim())),t.arraystretch&&t.arraystretch<1&&(h=new Ot("mstyle",[h]),h.setAttribute("scriptlevel","1")),h},jve=function(t,r){t.envName.includes("ed")||lA(t);var n=[],i=t.envName.includes("at")?"alignat":"align",a=t.envName==="split",s=bm(t.parser,{cols:n,addJot:!0,autoTag:a?void 0:uq(t.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:a?2:void 0,leqno:t.parser.settings.leqno},"display"),o=0,l=0,u={type:"ordgroup",mode:t.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var h="",f=0;f<r[0].body.length;f++){var d=kn(r[0].body[f],"textord");h+=d.text}o=Number(h),l=o*2}var p=!l;s.body.forEach(function(v){for(var x=1;x<v.length;x+=2){var w=kn(v[x],"styling"),C=kn(w.body[0],"ordgroup");C.body.unshift(u)}if(p)l<v.length&&(l=v.length);else{var T=v.length/2;if(o<T)throw new $t("Too many math in a row: "+("expected "+o+", but got "+T),v[0])}});for(var m=0;m<l;++m){var g="r",y=0;m%2===1?g="l":m>0&&p&&(y=1),n[m]={type:"align",align:g,pregap:y,postgap:0}}return s.colSeparationType=p?"align":"alignat",s};hf({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=nA(t[0]),n=r?[t[0]]:kn(t[0],"ordgroup").body,i=n.map(function(s){var o=rA(s),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new $t("Unknown column alignment: "+l,s)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return bm(e.parser,a,hq(e.envName))},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,!"lcr".includes(r))throw new $t("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=bm(e.parser,n,hq(e.envName)),s=Math.max(0,...a.body.map(o=>o.length));return a.cols=new Array(s).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=bm(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=nA(t[0]),n=r?[t[0]]:kn(t[0],"ordgroup").body,i=n.map(function(o){var l=rA(o),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new $t("Unknown column alignment: "+u,o)});if(i.length>1)throw new $t("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5},s=bm(e.parser,a,"script");if(s.body.length>0&&s.body[0].length>1)throw new $t("{subarray} can contain only one column");return s},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=bm(e.parser,t,hq(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:jve,htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){rbt.has(e.envName)&&lA(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:uq(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return bm(e.parser,t,"display")},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:jve,htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){lA(e);var t={autoTag:uq(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return bm(e.parser,t,"display")},htmlBuilder:ff,mathmlBuilder:df});hf({type:"array",names:["CD"],props:{numArgs:0},handler(e){return lA(e),Wxt(e.parser)},htmlBuilder:ff,mathmlBuilder:df});Ae("\\nonumber","\\gdef\\@eqnsw{0}");Ae("\\notag","\\nonumber");ir({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new $t(e.funcName+" valid only within array environment")}});var tve=Yve;ir({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];if(i.type!=="ordgroup")throw new $t("Invalid environment name",i);for(var a="",s=0;s<i.body.length;++s)a+=kn(i.body[s],"textord").text;if(n==="\\begin"){if(!tve.hasOwnProperty(a))throw new $t("No such environment: "+a,i);var o=tve[a],{args:l,optArgs:u}=r.parseArguments("\\begin{"+a+"}",o),h={mode:r.mode,envName:a,parser:r},f=o.handler(h,l,u);r.expect("\\end",!1);var d=r.nextToken,p=kn(r.parseFunction(),"environment");if(p.name!==a)throw new $t("Mismatch: \\begin{"+a+"} matched by \\end{"+p.name+"}",d);return f}return{type:"environment",mode:r.mode,name:a,nameGroup:i}}});var Kve=(e,t)=>{var r=e.font,n=t.withFont(r);return li(e.body,n)},Zve=(e,t)=>{var r=e.font,n=t.withFont(r);return Ii(e.body,n)},rve={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};ir({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=Y8(t[0]),a=n;return a in rve&&(a=rve[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:Kve,mathmlBuilder:Zve});ir({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"mclass",mode:r.mode,mclass:iA(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:n0(n)}}});ir({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,breakOnTokenText:i}=e,{mode:a}=r,s=r.parseExpression(!0,i);return{type:"font",mode:a,font:"math"+n.slice(1),body:{type:"ordgroup",mode:r.mode,body:s}}},htmlBuilder:Kve,mathmlBuilder:Zve});var ibt=(e,t)=>{var r=t.style,n=r.fracNum(),i=r.fracDen(),a;a=t.havingStyle(n);var s=li(e.numer,a,t);if(e.continued){var o=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height<o?o:s.height,s.depth=s.depth<l?l:s.depth}a=t.havingStyle(i);var u=li(e.denom,a,t),h,f,d;e.hasBarLine?(e.barSize?(f=da(e.barSize,t),h=hb("frac-line",t,f)):h=hb("frac-line",t),f=h.height,d=h.height):(h=null,f=0,d=t.fontMetrics().defaultRuleThickness);var p,m,g;r.size===dn.DISPLAY.size?(p=t.fontMetrics().num1,f>0?m=3*d:m=7*d,g=t.fontMetrics().denom1):(f>0?(p=t.fontMetrics().num2,m=d):(p=t.fontMetrics().num3,m=3*d),g=t.fontMetrics().denom2);var y;if(h){var x=t.fontMetrics().axisHeight;p-s.depth-(x+.5*f)<m&&(p+=m-(p-s.depth-(x+.5*f))),x-.5*f-(u.height-g)<m&&(g+=m-(x-.5*f-(u.height-g)));var w=-(x-.5*f);y=oi({positionType:"individualShift",children:[{type:"elem",elem:u,shift:g},{type:"elem",elem:h,shift:w},{type:"elem",elem:s,shift:-p}]})}else{var v=p-s.depth-(u.height-g);v<m&&(p+=.5*(m-v),g+=.5*(m-v)),y=oi({positionType:"individualShift",children:[{type:"elem",elem:u,shift:g},{type:"elem",elem:s,shift:-p}]})}a=t.havingStyle(r),y.height*=a.sizeMultiplier/t.sizeMultiplier,y.depth*=a.sizeMultiplier/t.sizeMultiplier;var C;r.size===dn.DISPLAY.size?C=t.fontMetrics().delim1:r.size===dn.SCRIPTSCRIPT.size?C=t.havingStyle(dn.SCRIPT).fontMetrics().delim2:C=t.fontMetrics().delim2;var T,k;return e.leftDelim==null?T=c5(t,["mopen"]):T=KG(e.leftDelim,C,!0,t.havingStyle(r),e.mode,["mopen"]),e.continued?k=Nt([]):e.rightDelim==null?k=c5(t,["mclose"]):k=KG(e.rightDelim,C,!0,t.havingStyle(r),e.mode,["mclose"]),Nt(["mord"].concat(a.sizingClasses(t)),[T,Nt(["mfrac"],[y]),k],t)},abt=(e,t)=>{var r=new Ot("mfrac",[Ii(e.numer,t),Ii(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var n=da(e.barSize,t);r.setAttribute("linethickness",Ut(n))}if(e.leftDelim!=null||e.rightDelim!=null){var i=[];if(e.leftDelim!=null){var a=new Ot("mo",[new Ta(e.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}if(i.push(r),e.rightDelim!=null){var s=new Ot("mo",[new Ta(e.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}return sq(i)}return r},Qve=(e,t)=>{if(!t)return e;var r={type:"styling",mode:e.mode,style:t,body:[e]};return r};ir({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1],s,o=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,o="(",l=")";break;case"\\\\bracefrac":s=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var u=n==="\\cfrac",h=null;return u||n.startsWith("\\d")?h="display":n.startsWith("\\t")&&(h="text"),Qve({type:"genfrac",mode:r.mode,numer:i,denom:a,continued:u,hasBarLine:s,leftDelim:o,rightDelim:l,barSize:null},h)},htmlBuilder:ibt,mathmlBuilder:abt});ir({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:n}=e,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:n}}});var nve=["display","text","script","scriptscript"],ive=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};ir({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,n=t[4],i=t[5],a=Y8(t[0]),s=a.type==="atom"&&a.family==="open"?ive(a.text):null,o=Y8(t[1]),l=o.type==="atom"&&o.family==="close"?ive(o.text):null,u=kn(t[2],"size"),h,f=null;u.isBlank?h=!0:(f=u.value,h=f.number>0);var d=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var m=kn(p.body[0],"textord");d=nve[Number(m.text)]}}else p=kn(p,"textord"),d=nve[Number(p.text)];return Qve({type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:f,leftDelim:s,rightDelim:l},d)}});ir({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:n,token:i}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:kn(t[0],"size").value,token:i}}});ir({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=kn(t[1],"infix").size;if(!a)throw new Error("\\\\abovefrac expected size, but got "+String(a));var s=t[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:s,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null}}});var Jve=(e,t)=>{var r=t.style,n,i;e.type==="supsub"?(n=e.sup?li(e.sup,t.havingStyle(r.sup()),t):li(e.sub,t.havingStyle(r.sub()),t),i=kn(e.base,"horizBrace")):i=kn(e,"horizBrace");var a=li(i.base,t.havingBaseStyle(dn.DISPLAY)),s=tA(i,t),o;if(i.isOver?o=oi({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):o=oi({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:a}]}),n){var l=Nt(["minner",i.isOver?"mover":"munder"],[o],t);i.isOver?o=oi({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):o=oi({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Nt(["minner",i.isOver?"mover":"munder"],[o],t)},sbt=(e,t)=>{var r=eA(e.label);return new Ot(e.isOver?"mover":"munder",[Ii(e.base,t),r])};ir({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:t[0]}},htmlBuilder:Jve,mathmlBuilder:sbt});ir({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[1],i=kn(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:Xa(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=ds(e.body,t,!1);return xxt(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=xm(e.body,t);return r instanceof Ot||(r=new Ot("mrow",[r])),r.setAttribute("href",e.href),r}});ir({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=kn(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a<n.length;a++){var s=n[a];s==="~"&&(s="\\textasciitilde"),i.push({type:"textord",mode:"text",text:s})}var o={type:"text",mode:r.mode,font:"\\texttt",body:i};return{type:"href",mode:r.mode,href:n,body:Xa(o)}}});ir({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:r}=e;return{type:"hbox",mode:r.mode,body:Xa(t[0])}},htmlBuilder(e,t){var r=ds(e.body,t.withFont(""),!1);return a0(r)},mathmlBuilder(e,t){return new Ot("mrow",Mc(e.body,t.withFont("")))}});ir({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,token:i}=e,a=kn(t[0],"raw").string,s=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(n){case"\\htmlClass":l.class=a,o={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,o={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,o={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h<u.length;h++){var f=u[h],d=f.indexOf("=");if(d<0)throw new $t("\\htmlData key/value '"+f+"' missing equals sign");var p=f.slice(0,d),m=f.slice(d+1);l["data-"+p.trim()]=m}o={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(o)?{type:"html",mode:r.mode,attributes:l,body:Xa(s)}:r.formatUnsupportedCmd(n)},htmlBuilder:(e,t)=>{var r=ds(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var i=Nt(n,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>xm(e.body,t)});ir({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:Xa(t[0]),mathml:Xa(t[1])}},htmlBuilder:(e,t)=>{var r=ds(e.html,t,!1);return a0(r)},mathmlBuilder:(e,t)=>xm(e.mathml,t)});var LG=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new $t("Invalid size: '"+t+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!yve(n))throw new $t("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};ir({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:n}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},s={number:0,unit:"em"},o="";if(r[0])for(var l=kn(r[0],"raw").string,u=l.split(","),h=0;h<u.length;h++){var f=u[h].split("=");if(f.length===2){var d=f[1].trim();switch(f[0].trim()){case"alt":o=d;break;case"width":i=LG(d);break;case"height":a=LG(d);break;case"totalheight":s=LG(d);break;default:throw new $t("Invalid key: '"+f[0]+"' in \\includegraphics.")}}}var p=kn(t[0],"url").url;return o===""&&(o=p,o=o.replace(/^.*[\\/]/,""),o=o.substring(0,o.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:n.mode,alt:o,width:i,height:a,totalheight:s,src:p}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var r=da(e.height,t),n=0;e.totalheight.number>0&&(n=da(e.totalheight,t)-r);var i=0;e.width.number>0&&(i=da(e.width,t));var a={height:Ut(r+n)};i>0&&(a.width=Ut(i)),n>0&&(a.verticalAlign=Ut(-n));var s=new BG(e.src,e.alt,a);return s.height=r,s.depth=n,s},mathmlBuilder:(e,t)=>{var r=new Ot("mglyph",[]);r.setAttribute("alt",e.alt);var n=da(e.height,t),i=0;if(e.totalheight.number>0&&(i=da(e.totalheight,t)-n,r.setAttribute("valign",Ut(-i))),r.setAttribute("height",Ut(n+i)),e.width.number>0){var a=da(e.width,t);r.setAttribute("width",Ut(a))}return r.setAttribute("src",e.src),r}});ir({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=kn(t[0],"size");if(r.settings.strict){var a=n[1]==="m",s=i.value.unit==="mu";a?(s||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):s&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(e,t){return Tve(e.dimension,t)},mathmlBuilder(e,t){var r=da(e.dimension,t);return new X8(r)}});ir({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=Nt([],[li(e.body,t)]),r=Nt(["inner"],[r],t)):r=Nt(["inner"],[li(e.body,t)]);var n=Nt(["fix"],[]),i=Nt([e.alignment],[r,n],t),a=Nt(["strut"]);return a.style.height=Ut(i.height+i.depth),i.depth&&(a.style.verticalAlign=Ut(-i.depth)),i.children.unshift(a),i=Nt(["thinbox"],[i],t),Nt(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var r=new Ot("mpadded",[Ii(e.body,t)]);if(e.alignment!=="rlap"){var n=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});ir({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:n}=e,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",s=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",resetFont:!0,body:s}}});ir({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new $t("Mismatched "+e.funcName)}});var ave=(e,t)=>{switch(t.style.size){case dn.DISPLAY.size:return e.display;case dn.TEXT.size:return e.text;case dn.SCRIPT.size:return e.script;case dn.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};ir({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:Xa(t[0]),text:Xa(t[1]),script:Xa(t[2]),scriptscript:Xa(t[3])}},htmlBuilder:(e,t)=>{var r=ave(e,t),n=ds(r,t,!1);return a0(n)},mathmlBuilder:(e,t)=>{var r=ave(e,t);return xm(r,t)}});var e2e=(e,t,r,n,i,a,s)=>{e=Nt([],[e]);var o=r&&n0(r),l,u;if(t){var h=li(t,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var f=li(r,n.havingStyle(i.sub()),n);l={elem:f,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-f.height)}}var d;if(u&&l){var p=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+s;d=oi({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ut(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Ut(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var m=e.height-s;d=oi({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ut(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(u){var g=e.depth+s;d=oi({positionType:"bottom",positionData:g,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Ut(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return e;var y=[d];if(l&&a!==0&&!o){var v=Nt(["mspace"],[],n);v.style.marginRight=Ut(a),y.unshift(v)}return Nt(["mop","op-limits"],y,n)},t2e=new Set(["\\smallint"]),pb=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=kn(e.base,"op"),i=!0):a=kn(e,"op");var s=t.style,o=!1;s.size===dn.DISPLAY.size&&a.symbol&&!t2e.has(a.name)&&(o=!0);var l,u;if(a.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(f=a.name.slice(1),a.name=f==="oiint"?"\\iint":"\\iiint"),l=ol(a.name,h,"math",t,["mop","op-symbol",o?"large-op":"small-op"]),u=l.italic,f.length>0){var d=Sve(f+"Size"+(o?"2":"1"),t);l=oi({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:d,shift:o?.08:0}]}),a.name="\\"+f,l.classes.unshift("mop"),l.italic=u}}else if(a.body){var p=ds(a.body,t,!0);p.length===1&&p[0]instanceof cl?(l=p[0],l.classes[0]="mop"):l=Nt(["mop"],p,t)}else{for(var m=[],g=1;g<a.name.length;g++)m.push(iq(a.name[g],a.mode,t));l=Nt(["mop"],m,t)}var y=0,v=0;if((l instanceof cl||a.name==="\\oiint"||a.name==="\\oiiint")&&!a.suppressBaseShift){var x;y=(l.height-l.depth)/2-t.fontMetrics().axisHeight,v=(x=l.italic)!=null?x:0}return i?e2e(l,r,n,t,s,v,y):(y&&(l.style.position="relative",l.style.top=Ut(y)),l)},h5=(e,t)=>{var r;if(e.symbol)r=new Ot("mo",[bu(e.name,e.mode)]),t2e.has(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new Ot("mo",Mc(e.body,t));else{r=new Ot("mi",[new Ta(e.name.slice(1))]);var n=new Ot("mo",[bu("\u2061","text")]);e.parentIsSupSub?r=new Ot("mrow",[r,n]):r=_ve([r,n])}return r},obt={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};ir({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=n;return i.length===1&&(i=obt[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:pb,mathmlBuilder:h5});ir({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Xa(n)}},htmlBuilder:pb,mathmlBuilder:h5});var lbt={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};ir({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:pb,mathmlBuilder:h5});ir({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:pb,mathmlBuilder:h5});ir({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:r}=e,n=r;return n.length===1&&(n=lbt[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:pb,mathmlBuilder:h5});var r2e=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=kn(e.base,"operatorname"),i=!0):a=kn(e,"operatorname");var s;if(a.body.length>0){for(var o=a.body.map(f=>{var d="text"in f?f.text:void 0;return typeof d=="string"?{type:"textord",mode:f.mode,text:d}:f}),l=ds(o,t.withFont("mathrm"),!0),u=0;u<l.length;u++){var h=l[u];h instanceof cl&&(h.text=h.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}s=Nt(["mop"],l,t)}else s=Nt(["mop"],[],t);return i?e2e(s,r,n,t,t.style,0,0):s},cbt=(e,t)=>{for(var r=Mc(e.body,t.withFont("mathrm")),n=!0,i=0;i<r.length;i++){var a=r[i];if(!(a instanceof X8))if(a instanceof Ot)switch(a.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var s=a.children[0];a.children.length===1&&s instanceof Ta?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var o=r.map(h=>h.toText()).join("");r=[new Ta(o)]}var l=new Ot("mi",r);l.setAttribute("mathvariant","normal");var u=new Ot("mo",[bu("\u2061","text")]);return e.parentIsSupSub?new Ot("mrow",[l,u]):_ve([l,u])};ir({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"operatorname",mode:r.mode,body:Xa(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:r2e,mathmlBuilder:cbt});Ae("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");sy({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?a0(ds(e.body,t,!1)):Nt(["mord"],ds(e.body,t,!0),t)},mathmlBuilder(e,t){return xm(e.body,t,!0)}});ir({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=li(e.body,t.havingCrampedStyle()),n=hb("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=oi({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]});return Nt(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new Ot("mo",[new Ta("\u203E")]);r.setAttribute("stretchy","true");var n=new Ot("mover",[Ii(e.body,t),r]);return n.setAttribute("accent","true"),n}});ir({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"phantom",mode:r.mode,body:Xa(n)}},htmlBuilder:(e,t)=>{var r=ds(e.body,t.withPhantom(),!1);return a0(r)},mathmlBuilder:(e,t)=>{var r=Mc(e.body,t);return new Ot("mphantom",r)}});Ae("\\hphantom","\\smash{\\phantom{#1}}");ir({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=Nt(["inner"],[li(e.body,t.withPhantom())]),n=Nt(["fix"],[]);return Nt(["mord","rlap"],[r,n],t)},mathmlBuilder:(e,t)=>{var r=Mc(Xa(e.body),t),n=new Ot("mphantom",r),i=new Ot("mpadded",[n]);return i.setAttribute("width","0px"),i}});ir({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,n=kn(t[0],"size").value,i=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(e,t){var r=li(e.body,t),n=da(e.dy,t);return oi({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Ot("mpadded",[Ii(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});ir({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});ir({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:n}=e,i=r[0],a=kn(t[0],"size"),s=kn(t[1],"size");return{type:"rule",mode:n.mode,shift:i&&kn(i,"size").value,width:a.value,height:s.value}},htmlBuilder(e,t){var r=Nt(["mord","rule"],[],t),n=da(e.width,t),i=da(e.height,t),a=e.shift?da(e.shift,t):0;return r.style.borderRightWidth=Ut(n),r.style.borderTopWidth=Ut(i),r.style.bottom=Ut(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=da(e.width,t),n=da(e.height,t),i=e.shift?da(e.shift,t):0,a=t.color&&t.getColor()||"black",s=new Ot("mspace");s.setAttribute("mathbackground",a),s.setAttribute("width",Ut(r)),s.setAttribute("height",Ut(n));var o=new Ot("mpadded",[s]);return i>=0?o.setAttribute("height",Ut(i)):(o.setAttribute("height",Ut(i)),o.setAttribute("depth",Ut(-i))),o.setAttribute("voffset",Ut(i)),o}});function n2e(e,t,r){for(var n=ds(e,t,!1),i=t.sizeMultiplier/r.sizeMultiplier,a=0;a<n.length;a++){var s=n[a].classes.indexOf("sizing");s<0?Array.prototype.push.apply(n[a].classes,t.sizingClasses(r)):n[a].classes[s+1]==="reset-size"+t.size&&(n[a].classes[s+1]="reset-size"+r.size),n[a].height*=i,n[a].depth*=i}return a0(n)}var sve=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],ubt=(e,t)=>{var r=t.havingSize(e.size);return n2e(e.body,r,t)};ir({type:"sizing",names:sve,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:sve.indexOf(n)+1,body:a}},htmlBuilder:ubt,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=Mc(e.body,r),i=new Ot("mstyle",n);return i.setAttribute("mathsize",Ut(r.sizeMultiplier)),i}});ir({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:n}=e,i=!1,a=!1,s=r[0]&&kn(r[0],"ordgroup");if(s)for(var o,l=0;l<s.body.length;++l){var u=s.body[l];if(o=rA(u).text,o==="t")i=!0;else if(o==="b")a=!0;else{i=!1,a=!1;break}}else i=!0,a=!0;var h=t[0];return{type:"smash",mode:n.mode,body:h,smashHeight:i,smashDepth:a}},htmlBuilder:(e,t)=>{var r=Nt([],[li(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0),e.smashDepth&&(r.depth=0),e.smashHeight&&e.smashDepth)return Nt(["mord","smash"],[r],t);if(r.children)for(var n=0;n<r.children.length;n++)e.smashHeight&&(r.children[n].height=0),e.smashDepth&&(r.children[n].depth=0);var i=oi({positionType:"firstBaseline",children:[{type:"elem",elem:r}]});return Nt(["mord"],[i],t)},mathmlBuilder:(e,t)=>{var r=new Ot("mpadded",[Ii(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});ir({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n}=e,i=r[0],a=t[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(e,t){var r=li(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=fb(r,t);var n=t.fontMetrics(),i=n.defaultRuleThickness,a=i;t.style.id<dn.TEXT.id&&(a=t.fontMetrics().xHeight);var s=i+a/4,o=r.height+r.depth+s+i,{span:l,ruleWidth:u,advanceWidth:h}=Kxt(o,t),f=l.height-u;f>r.height+r.depth+s&&(s=(s+f-r.height-r.depth)/2);var d=l.height-r.height-s-u;r.style.paddingLeft=Ut(h);var p=oi({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:l},{type:"kern",size:u}]});if(e.index){var m=t.havingStyle(dn.SCRIPTSCRIPT),g=li(e.index,m,t),y=.6*(p.height-p.depth),v=oi({positionType:"shift",positionData:-y,children:[{type:"elem",elem:g}]}),x=Nt(["root"],[v]);return Nt(["mord","sqrt"],[x,p],t)}else return Nt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:n}=e;return n?new Ot("mroot",[Ii(r,t),Ii(n,t)]):new Ot("msqrt",[Ii(r,t)])}});var ZG={display:dn.DISPLAY,text:dn.TEXT,script:dn.SCRIPT,scriptscript:dn.SCRIPTSCRIPT};function hbt(e){return e in ZG}ir({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!0,r),s=n.slice(1,n.length-5);if(!hbt(s))throw new Error("Unknown style: "+s);return{type:"styling",mode:i.mode,style:s,body:a}},htmlBuilder(e,t){var r=ZG[e.style],n=t.havingStyle(r);return e.resetFont&&(n=n.withFont("")),n2e(e.body,n,t)},mathmlBuilder(e,t){var r=ZG[e.style],n=t.havingStyle(r);e.resetFont&&(n=n.withFont(""));var i=Mc(e.body,n),a=new Ot("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=s[e.style];return a.setAttribute("scriptlevel",o[0]),a.setAttribute("displaystyle",o[1]),a}});var fbt=function(t,r){var n=t.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===dn.DISPLAY.size||n.alwaysHandleSupSub);return i?pb:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===dn.DISPLAY.size||n.limits);return a?r2e:null}else{if(n.type==="accent")return n0(n.base)?lq:null;if(n.type==="horizBrace"){var s=!t.sub;return s===n.isOver?Jve:null}else return null}else return null};sy({type:"supsub",htmlBuilder(e,t){var r=fbt(e,t);if(r)return r(e,t);var{base:n,sup:i,sub:a}=e,s=li(n,t),o,l,u=t.fontMetrics(),h=0,f=0,d=n&&n0(n);if(i){var p=t.havingStyle(t.style.sup());o=li(i,p,t),d||(h=s.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var m=t.havingStyle(t.style.sub());l=li(a,m,t),d||(f=s.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}var g;t.style===dn.DISPLAY?g=u.sup1:t.style.cramped?g=u.sup3:g=u.sup2;var y=t.sizeMultiplier,v=Ut(.5/u.ptPerEm/y),x=null;if(l){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(s instanceof cl||w){var C;x=Ut(-((C=s.italic)!=null?C:0))}}var T;if(o&&l){h=Math.max(h,g,o.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var k=u.defaultRuleThickness,S=4*k;if(h-o.depth-(l.height-f)<S){f=S-(h-o.depth)+l.height;var E=.8*u.xHeight-(h-o.depth);E>0&&(h+=E,f-=E)}var I=[{type:"elem",elem:l,shift:f,marginRight:v,marginLeft:x},{type:"elem",elem:o,shift:-h,marginRight:v}];T=oi({positionType:"individualShift",children:I})}else if(l){f=Math.max(f,u.sub1,l.height-.8*u.xHeight);var L=[{type:"elem",elem:l,marginLeft:x,marginRight:v}];T=oi({positionType:"shift",positionData:f,children:L})}else if(o)h=Math.max(h,g,o.depth+.25*u.xHeight),T=oi({positionType:"shift",positionData:-h,children:[{type:"elem",elem:o,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var O=UG(s,"right")||"mord";return Nt([O],[s,Nt(["msupsub"],[T])],t)},mathmlBuilder(e,t){var r=!1,n,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(r=!0,n=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[Ii(e.base,t)];e.sub&&a.push(Ii(e.sub,t)),e.sup&&a.push(Ii(e.sup,t));var s;if(r)s=n?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===dn.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===dn.DISPLAY||u.limits)?s="munderover":s="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===dn.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===dn.DISPLAY)?s="munder":s="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===dn.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===dn.DISPLAY)?s="mover":s="msup"}return new Ot(s,a)}});sy({type:"atom",htmlBuilder(e,t){return iq(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new Ot("mo",[bu(e.text,e.mode)]);if(e.family==="bin"){var n=oq(e,t);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});var i2e={mi:"italic",mn:"normal",mtext:"normal"};sy({type:"mathord",htmlBuilder(e,t){return J8(e,t,"mathord")},mathmlBuilder(e,t){var r=new Ot("mi",[bu(e.text,e.mode,t)]),n=oq(e,t)||"italic";return n!==i2e[r.type]&&r.setAttribute("mathvariant",n),r}});sy({type:"textord",htmlBuilder(e,t){return J8(e,t,"textord")},mathmlBuilder(e,t){var r=bu(e.text,e.mode,t),n=oq(e,t)||"normal",i;return e.mode==="text"?i=new Ot("mtext",[r]):/[0-9]/.test(e.text)?i=new Ot("mn",[r]):e.text==="\\prime"?i=new Ot("mo",[r]):i=new Ot("mi",[r]),n!==i2e[i.type]&&i.setAttribute("mathvariant",n),i}});var IG={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},MG={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};sy({type:"spacing",htmlBuilder(e,t){if(MG.hasOwnProperty(e.text)){var r=MG[e.text].className||"";if(e.mode==="text"){var n=J8(e,t,"textord");return n.classes.push(r),n}else return Nt(["mspace",r],[iq(e.text,e.mode,t)],t)}else{if(IG.hasOwnProperty(e.text))return Nt(["mspace",IG[e.text]],[],t);throw new $t('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(MG.hasOwnProperty(e.text))r=new Ot("mtext",[new Ta("\xA0")]);else{if(IG.hasOwnProperty(e.text))return new Ot("mspace");throw new $t('Unknown type of space "'+e.text+'"')}return r}});var ove=()=>{var e=new Ot("mtd",[]);return e.setAttribute("width","50%"),e};sy({type:"tag",mathmlBuilder(e,t){var r=new Ot("mtable",[new Ot("mtr",[ove(),new Ot("mtd",[xm(e.body,t)]),ove(),new Ot("mtd",[xm(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var lve={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},cve={"\\textbf":"textbf","\\textmd":"textmd"},dbt={"\\textit":"textit","\\textup":"textup"},uve=(e,t)=>{var r=e.font;if(r){if(lve[r])return t.withTextFontFamily(lve[r]);if(cve[r])return t.withTextFontWeight(cve[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(dbt[r])};ir({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"text",mode:r.mode,body:Xa(i),font:n}},htmlBuilder(e,t){var r=uve(e,t),n=ds(e.body,r,!0);return Nt(["mord","text"],n,r)},mathmlBuilder(e,t){var r=uve(e,t);return xm(e.body,r)}});ir({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=li(e.body,t),n=hb("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=oi({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]});return Nt(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new Ot("mo",[new Ta("\u203E")]);r.setAttribute("stretchy","true");var n=new Ot("munder",[Ii(e.body,t),r]);return n.setAttribute("accentunder","true"),n}});ir({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=li(e.body,t),n=t.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return oi({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]})},mathmlBuilder(e,t){var r=new Ot("mpadded",[Ii(e.body,t)],["vcenter"]);return new Ot("mrow",[r])}});ir({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new $t("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=hve(e),n=[],i=t.havingStyle(t.style.text()),a=0;a<r.length;a++){var s=r[a];s==="~"&&(s="\\textasciitilde"),n.push(ol(s,"Typewriter-Regular",e.mode,i,["mord","texttt"]))}return Nt(["mord","text"].concat(i.sizingClasses(t)),kve(n),i)},mathmlBuilder(e,t){var r=new Ta(hve(e)),n=new Ot("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});var hve=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),pm=Eve,a2e=`[ \r + ]`,pbt="\\\\[a-zA-Z@]+",mbt="\\\\[^\uD800-\uDFFF]",gbt="("+pbt+")"+a2e+"*",ybt=`\\\\( |[ \r ]+ -?)[ \r ]*`,KG="[\u0300-\u036F]",pbt=new RegExp(KG+"+$"),mbt="("+n2e+"+)|"+(dbt+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(KG+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(KG+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+fbt)+("|"+hbt+")"),K8=class{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(mbt,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Lc("EOF",new Hl(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new $t("Unexpected character: '"+t[r]+"'",new Lc(t[r],new Hl(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(` -`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Lc(i,new Hl(this,r,this.tokenRegex.lastIndex))}},ZG=class{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new $t("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}},gbt=Uve;Ae("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Ae("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Ae("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Ae("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Ae("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});Ae("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Ae("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var uve={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ae("\\char",function(e){var t=e.popToken(),r,n=0;if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new $t("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=uve[t.text],n==null||n>=r)throw new $t("Invalid base-"+r+" digit "+t.text);for(var i;(i=uve[e.future().text])!=null&&i<r;)n*=r,n+=i,e.popToken()}return"\\@char{"+n+"}"});var uq=(e,t,r,n)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new $t("\\newcommand's first argument must be a macro name");var a=i[0].text,s=e.isDefined(a);if(s&&!t)throw new $t("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!s&&!r)throw new $t("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var o=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new $t("Invalid number of arguments: "+l);o=parseInt(l),i=e.consumeArg().tokens}return s&&n||e.macros.set(a,{tokens:i,numArgs:o}),""};Ae("\\newcommand",e=>uq(e,!1,!0,!1));Ae("\\renewcommand",e=>uq(e,!0,!1,!1));Ae("\\providecommand",e=>uq(e,!0,!0,!0));Ae("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});Ae("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});Ae("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),pm[r],ra.math[r],ra.text[r]),""});Ae("\\bgroup","{");Ae("\\egroup","}");Ae("~","\\nobreakspace");Ae("\\lq","`");Ae("\\rq","'");Ae("\\aa","\\r a");Ae("\\AA","\\r A");Ae("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");Ae("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Ae("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");Ae("\u212C","\\mathscr{B}");Ae("\u2130","\\mathscr{E}");Ae("\u2131","\\mathscr{F}");Ae("\u210B","\\mathscr{H}");Ae("\u2110","\\mathscr{I}");Ae("\u2112","\\mathscr{L}");Ae("\u2133","\\mathscr{M}");Ae("\u211B","\\mathscr{R}");Ae("\u212D","\\mathfrak{C}");Ae("\u210C","\\mathfrak{H}");Ae("\u2128","\\mathfrak{Z}");Ae("\\Bbbk","\\Bbb{k}");Ae("\\llap","\\mathllap{\\textrm{#1}}");Ae("\\rlap","\\mathrlap{\\textrm{#1}}");Ae("\\clap","\\mathclap{\\textrm{#1}}");Ae("\\mathstrut","\\vphantom{(}");Ae("\\underbar","\\underline{\\text{#1}}");Ae("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Ae("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");Ae("\\ne","\\neq");Ae("\u2260","\\neq");Ae("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");Ae("\u2209","\\notin");Ae("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");Ae("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");Ae("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");Ae("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");Ae("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");Ae("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");Ae("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");Ae("\u27C2","\\perp");Ae("\u203C","\\mathclose{!\\mkern-0.8mu!}");Ae("\u220C","\\notni");Ae("\u231C","\\ulcorner");Ae("\u231D","\\urcorner");Ae("\u231E","\\llcorner");Ae("\u231F","\\lrcorner");Ae("\xA9","\\copyright");Ae("\xAE","\\textregistered");Ae("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Ae("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Ae("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Ae("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Ae("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Ae("\u22EE","\\vdots");Ae("\\varGamma","\\mathit{\\Gamma}");Ae("\\varDelta","\\mathit{\\Delta}");Ae("\\varTheta","\\mathit{\\Theta}");Ae("\\varLambda","\\mathit{\\Lambda}");Ae("\\varXi","\\mathit{\\Xi}");Ae("\\varPi","\\mathit{\\Pi}");Ae("\\varSigma","\\mathit{\\Sigma}");Ae("\\varUpsilon","\\mathit{\\Upsilon}");Ae("\\varPhi","\\mathit{\\Phi}");Ae("\\varPsi","\\mathit{\\Psi}");Ae("\\varOmega","\\mathit{\\Omega}");Ae("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Ae("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Ae("\\boxed","\\fbox{$\\displaystyle{#1}$}");Ae("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Ae("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Ae("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Ae("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Ae("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var hve={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},ybt=new Set(["bin","rel"]);Ae("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in hve?t=hve[r]:(r.slice(0,4)==="\\not"||r in ra.math&&ybt.has(ra.math[r].group))&&(t="\\dotsb"),t});var hq={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ae("\\dotso",function(e){var t=e.future().text;return t in hq?"\\ldots\\,":"\\ldots"});Ae("\\dotsc",function(e){var t=e.future().text;return t in hq&&t!==","?"\\ldots\\,":"\\ldots"});Ae("\\cdots",function(e){var t=e.future().text;return t in hq?"\\@cdots\\,":"\\@cdots"});Ae("\\dotsb","\\cdots");Ae("\\dotsm","\\cdots");Ae("\\dotsi","\\!\\cdots");Ae("\\dotsx","\\ldots\\,");Ae("\\DOTSI","\\relax");Ae("\\DOTSB","\\relax");Ae("\\DOTSX","\\relax");Ae("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Ae("\\,","\\tmspace+{3mu}{.1667em}");Ae("\\thinspace","\\,");Ae("\\>","\\mskip{4mu}");Ae("\\:","\\tmspace+{4mu}{.2222em}");Ae("\\medspace","\\:");Ae("\\;","\\tmspace+{5mu}{.2777em}");Ae("\\thickspace","\\;");Ae("\\!","\\tmspace-{3mu}{.1667em}");Ae("\\negthinspace","\\!");Ae("\\negmedspace","\\tmspace-{4mu}{.2222em}");Ae("\\negthickspace","\\tmspace-{5mu}{.277em}");Ae("\\enspace","\\kern.5em ");Ae("\\enskip","\\hskip.5em\\relax");Ae("\\quad","\\hskip1em\\relax");Ae("\\qquad","\\hskip2em\\relax");Ae("\\tag","\\@ifstar\\tag@literal\\tag@paren");Ae("\\tag@paren","\\tag@literal{({#1})}");Ae("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new $t("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Ae("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Ae("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Ae("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Ae("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Ae("\\newline","\\\\\\relax");Ae("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var i2e=Ut(cf["Main-Regular"][84][1]-.7*cf["Main-Regular"][65][1]);Ae("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+i2e+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ae("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+i2e+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Ae("\\hspace","\\@ifstar\\@hspacer\\@hspace");Ae("\\@hspace","\\hskip #1\\relax");Ae("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Ae("\\ordinarycolon",":");Ae("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Ae("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Ae("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Ae("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Ae("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Ae("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Ae("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Ae("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Ae("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Ae("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Ae("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Ae("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Ae("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Ae("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Ae("\u2237","\\dblcolon");Ae("\u2239","\\eqcolon");Ae("\u2254","\\coloneqq");Ae("\u2255","\\eqqcolon");Ae("\u2A74","\\Coloneqq");Ae("\\ratio","\\vcentcolon");Ae("\\coloncolon","\\dblcolon");Ae("\\colonequals","\\coloneqq");Ae("\\coloncolonequals","\\Coloneqq");Ae("\\equalscolon","\\eqqcolon");Ae("\\equalscoloncolon","\\Eqqcolon");Ae("\\colonminus","\\coloneq");Ae("\\coloncolonminus","\\Coloneq");Ae("\\minuscolon","\\eqcolon");Ae("\\minuscoloncolon","\\Eqcolon");Ae("\\coloncolonapprox","\\Colonapprox");Ae("\\coloncolonsim","\\Colonsim");Ae("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ae("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ae("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ae("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ae("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");Ae("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Ae("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Ae("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Ae("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Ae("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Ae("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Ae("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Ae("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Ae("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");Ae("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");Ae("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");Ae("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");Ae("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");Ae("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");Ae("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");Ae("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");Ae("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");Ae("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");Ae("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");Ae("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");Ae("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");Ae("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");Ae("\\imath","\\html@mathml{\\@imath}{\u0131}");Ae("\\jmath","\\html@mathml{\\@jmath}{\u0237}");Ae("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");Ae("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");Ae("\u27E6","\\llbracket");Ae("\u27E7","\\rrbracket");Ae("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");Ae("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");Ae("\u2983","\\lBrace");Ae("\u2984","\\rBrace");Ae("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");Ae("\u29B5","\\minuso");Ae("\\darr","\\downarrow");Ae("\\dArr","\\Downarrow");Ae("\\Darr","\\Downarrow");Ae("\\lang","\\langle");Ae("\\rang","\\rangle");Ae("\\uarr","\\uparrow");Ae("\\uArr","\\Uparrow");Ae("\\Uarr","\\Uparrow");Ae("\\N","\\mathbb{N}");Ae("\\R","\\mathbb{R}");Ae("\\Z","\\mathbb{Z}");Ae("\\alef","\\aleph");Ae("\\alefsym","\\aleph");Ae("\\Alpha","\\mathrm{A}");Ae("\\Beta","\\mathrm{B}");Ae("\\bull","\\bullet");Ae("\\Chi","\\mathrm{X}");Ae("\\clubs","\\clubsuit");Ae("\\cnums","\\mathbb{C}");Ae("\\Complex","\\mathbb{C}");Ae("\\Dagger","\\ddagger");Ae("\\diamonds","\\diamondsuit");Ae("\\empty","\\emptyset");Ae("\\Epsilon","\\mathrm{E}");Ae("\\Eta","\\mathrm{H}");Ae("\\exist","\\exists");Ae("\\harr","\\leftrightarrow");Ae("\\hArr","\\Leftrightarrow");Ae("\\Harr","\\Leftrightarrow");Ae("\\hearts","\\heartsuit");Ae("\\image","\\Im");Ae("\\infin","\\infty");Ae("\\Iota","\\mathrm{I}");Ae("\\isin","\\in");Ae("\\Kappa","\\mathrm{K}");Ae("\\larr","\\leftarrow");Ae("\\lArr","\\Leftarrow");Ae("\\Larr","\\Leftarrow");Ae("\\lrarr","\\leftrightarrow");Ae("\\lrArr","\\Leftrightarrow");Ae("\\Lrarr","\\Leftrightarrow");Ae("\\Mu","\\mathrm{M}");Ae("\\natnums","\\mathbb{N}");Ae("\\Nu","\\mathrm{N}");Ae("\\Omicron","\\mathrm{O}");Ae("\\plusmn","\\pm");Ae("\\rarr","\\rightarrow");Ae("\\rArr","\\Rightarrow");Ae("\\Rarr","\\Rightarrow");Ae("\\real","\\Re");Ae("\\reals","\\mathbb{R}");Ae("\\Reals","\\mathbb{R}");Ae("\\Rho","\\mathrm{P}");Ae("\\sdot","\\cdot");Ae("\\sect","\\S");Ae("\\spades","\\spadesuit");Ae("\\sub","\\subset");Ae("\\sube","\\subseteq");Ae("\\supe","\\supseteq");Ae("\\Tau","\\mathrm{T}");Ae("\\thetasym","\\vartheta");Ae("\\weierp","\\wp");Ae("\\Zeta","\\mathrm{Z}");Ae("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Ae("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Ae("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Ae("\\bra","\\mathinner{\\langle{#1}|}");Ae("\\ket","\\mathinner{|{#1}\\rangle}");Ae("\\braket","\\mathinner{\\langle{#1}\\rangle}");Ae("\\Bra","\\left\\langle#1\\right|");Ae("\\Ket","\\left|#1\\right\\rangle");var a2e=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.macros.get("|"),o=t.macros.get("\\|");t.macros.beginGroup();var l=f=>d=>{e&&(d.macros.set("|",s),i.length&&d.macros.set("\\|",o));var p=f;if(!f&&i.length){var m=d.future();m.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};t.macros.set("|",l(!1)),i.length&&t.macros.set("\\|",l(!0));var u=t.consumeArg().tokens,h=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};Ae("\\bra@ket",a2e(!1));Ae("\\bra@set",a2e(!0));Ae("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Ae("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Ae("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Ae("\\angln","{\\angl n}");Ae("\\blue","\\textcolor{##6495ed}{#1}");Ae("\\orange","\\textcolor{##ffa500}{#1}");Ae("\\pink","\\textcolor{##ff00af}{#1}");Ae("\\red","\\textcolor{##df0030}{#1}");Ae("\\green","\\textcolor{##28ae7b}{#1}");Ae("\\gray","\\textcolor{gray}{#1}");Ae("\\purple","\\textcolor{##9d38bd}{#1}");Ae("\\blueA","\\textcolor{##ccfaff}{#1}");Ae("\\blueB","\\textcolor{##80f6ff}{#1}");Ae("\\blueC","\\textcolor{##63d9ea}{#1}");Ae("\\blueD","\\textcolor{##11accd}{#1}");Ae("\\blueE","\\textcolor{##0c7f99}{#1}");Ae("\\tealA","\\textcolor{##94fff5}{#1}");Ae("\\tealB","\\textcolor{##26edd5}{#1}");Ae("\\tealC","\\textcolor{##01d1c1}{#1}");Ae("\\tealD","\\textcolor{##01a995}{#1}");Ae("\\tealE","\\textcolor{##208170}{#1}");Ae("\\greenA","\\textcolor{##b6ffb0}{#1}");Ae("\\greenB","\\textcolor{##8af281}{#1}");Ae("\\greenC","\\textcolor{##74cf70}{#1}");Ae("\\greenD","\\textcolor{##1fab54}{#1}");Ae("\\greenE","\\textcolor{##0d923f}{#1}");Ae("\\goldA","\\textcolor{##ffd0a9}{#1}");Ae("\\goldB","\\textcolor{##ffbb71}{#1}");Ae("\\goldC","\\textcolor{##ff9c39}{#1}");Ae("\\goldD","\\textcolor{##e07d10}{#1}");Ae("\\goldE","\\textcolor{##a75a05}{#1}");Ae("\\redA","\\textcolor{##fca9a9}{#1}");Ae("\\redB","\\textcolor{##ff8482}{#1}");Ae("\\redC","\\textcolor{##f9685d}{#1}");Ae("\\redD","\\textcolor{##e84d39}{#1}");Ae("\\redE","\\textcolor{##bc2612}{#1}");Ae("\\maroonA","\\textcolor{##ffbde0}{#1}");Ae("\\maroonB","\\textcolor{##ff92c6}{#1}");Ae("\\maroonC","\\textcolor{##ed5fa6}{#1}");Ae("\\maroonD","\\textcolor{##ca337c}{#1}");Ae("\\maroonE","\\textcolor{##9e034e}{#1}");Ae("\\purpleA","\\textcolor{##ddd7ff}{#1}");Ae("\\purpleB","\\textcolor{##c6b9fc}{#1}");Ae("\\purpleC","\\textcolor{##aa87ff}{#1}");Ae("\\purpleD","\\textcolor{##7854ab}{#1}");Ae("\\purpleE","\\textcolor{##543b78}{#1}");Ae("\\mintA","\\textcolor{##f5f9e8}{#1}");Ae("\\mintB","\\textcolor{##edf2df}{#1}");Ae("\\mintC","\\textcolor{##e0e5cc}{#1}");Ae("\\grayA","\\textcolor{##f6f7f7}{#1}");Ae("\\grayB","\\textcolor{##f0f1f2}{#1}");Ae("\\grayC","\\textcolor{##e3e5e6}{#1}");Ae("\\grayD","\\textcolor{##d6d8da}{#1}");Ae("\\grayE","\\textcolor{##babec2}{#1}");Ae("\\grayF","\\textcolor{##888d93}{#1}");Ae("\\grayG","\\textcolor{##626569}{#1}");Ae("\\grayH","\\textcolor{##3b3e40}{#1}");Ae("\\grayI","\\textcolor{##21242c}{#1}");Ae("\\kaBlue","\\textcolor{##314453}{#1}");Ae("\\kaGreen","\\textcolor{##71B307}{#1}");var s2e={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},QG=class{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new ZG(gbt,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new K8(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new Lc("EOF",n.loc)),this.pushTokens(i),new Lc("",Hl.range(r,n))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,s=0,o=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++s;else if(a.text==="}"){if(--s,s===-1)throw new $t("Extra }",a)}else if(a.text==="EOF")throw new $t("Unexpected end of input in a macro argument, expected '"+(t&&n?t[o]:"}")+"'",a);if(t&&n)if((s===0||s===1&&t[o]==="{")&&a.text===t[o]){if(++o,o===t.length){r.splice(-o,o);break}}else o=0}while(s!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new $t("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;i<n.length;i++){var a=this.popToken();if(n[i]!==a.text)throw new $t("Use of the macro doesn't match its definition",a)}}for(var s=[],o=0;o<t;o++)s.push(this.consumeArg(r&&r[o+1]).tokens);return s}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new $t("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new $t("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,s=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var o=a.length-1;o>=0;--o){var l=a[o];if(l.text==="#"){if(o===0)throw new $t("Incomplete placeholder at end of macro body",l);if(l=a[--o],l.text==="#")a.splice(o+1,1);else if(/^[1-9]$/.test(l.text))a.splice(o,2,...s[+l.text-1]);else throw new $t("Not a valid argument number",l)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Lc(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.includes("#"))for(var s=i.replace(/##/g,"");s.includes("#"+(a+1));)++a;for(var o=new K8(i,this.settings),l=[],u=o.lex();u.text!=="EOF";)l.push(u),u=o.lex();l.reverse();var h={tokens:l,numArgs:a};return h}return i}isDefined(t){return this.macros.has(t)||pm.hasOwnProperty(t)||ra.math.hasOwnProperty(t)||ra.text.hasOwnProperty(t)||s2e.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:pm.hasOwnProperty(t)&&!pm[t].primitive}},fve=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,z8=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),IG={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},dve={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},Z8=class e{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new QG(t,r,this.mode),this.settings=r,this.leftrightDepth=0,this.nextToken=null}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new $t("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new Lc("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.has(i.text)||r&&i.text===r||t&&pm[i.text]&&pm[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i<t.length;i++){var a=t[i];if(a.type==="infix"){if(r!==-1)throw new $t("only one infix operator per group",a.token);r=i,n=a.replaceWith}}if(r!==-1&&n){var s,o,l=t.slice(0,r),u=t.slice(r+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},u.length===1&&u[0].type==="ordgroup"?o=u[0]:o={type:"ordgroup",mode:this.mode,body:u};var h;return n==="\\\\abovefrac"?h=this.callFunction(n,[s,t[r],o],[]):h=this.callFunction(n,[s,o],[]),[h]}else return t}handleSupSubscript(t){var r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();var i;do{var a;i=this.parseGroup(t)}while(((a=i)==null?void 0:a.type)==="internal");if(!i)throw new $t("Expected group after '"+n+"'",r);return i}formatUnsupportedCmd(t){for(var r=[],n=0;n<t.length;n++)r.push({type:"textord",mode:"text",text:t[n]});var i={type:"text",mode:this.mode,body:r},a={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return a}parseAtom(t){var r=this.parseGroup("atom",t);if(r?.type==="internal"||this.mode==="text")return r;for(var n,i;;){this.consumeSpaces();var a=this.fetch();if(a.text==="\\limits"||a.text==="\\nolimits"){if(r&&r.type==="op"){var s=a.text==="\\limits";r.limits=s,r.alwaysHandleSupSub=!0}else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=a.text==="\\limits");else throw new $t("Limit controls must follow a math operator",a);this.consume()}else if(a.text==="^"){if(n)throw new $t("Double superscript",a);n=this.handleSupSubscript("superscript")}else if(a.text==="_"){if(i)throw new $t("Double subscript",a);i=this.handleSupSubscript("subscript")}else if(a.text==="'"){if(n)throw new $t("Double superscript",a);var o={type:"textord",mode:this.mode,text:"\\prime"},l=[o];for(this.consume();this.fetch().text==="'";)l.push(o),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(z8[a.text]){var u=fve.test(a.text),h=[];for(h.push(new Lc(z8[a.text])),this.consume();;){var f=this.fetch().text;if(!z8[f]||fve.test(f)!==u)break;h.unshift(new Lc(z8[f])),this.consume()}var d=this.subparse(h);u?i={type:"ordgroup",mode:"math",body:d}:n={type:"ordgroup",mode:"math",body:d}}else break}return n||i?{type:"supsub",mode:this.mode,base:r,sup:n,sub:i}:r}parseFunction(t,r){var n=this.fetch(),i=n.text,a=pm[i];if(!a)return null;if(this.consume(),r&&r!=="atom"&&!a.allowedInArgument)throw new $t("Got function '"+i+"' with no arguments"+(r?" as "+r:""),n);if(this.mode==="text"&&!a.allowedInText)throw new $t("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&a.allowedInMath===!1)throw new $t("Can't use function '"+i+"' in math mode",n);var{args:s,optArgs:o}=this.parseArguments(i,a);return this.callFunction(i,s,o,n,t)}callFunction(t,r,n,i,a){var s={funcName:t,parser:this,token:i,breakOnTokenText:a},o=pm[t];if(o&&o.handler)return o.handler(s,r,n);throw new $t("No function handler for "+t)}parseArguments(t,r){var n=r.numArgs+r.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],a=[],s=0;s<n;s++){var o=r.argTypes&&r.argTypes[s],l=s<r.numOptionalArgs;("primitive"in r&&r.primitive&&o==null||r.type==="sqrt"&&s===1&&a[0]==null)&&(o="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",o,l);if(l)a.push(u);else if(u!=null)i.push(u);else throw new $t("Null argument, please report this as a bug")}return{args:i,optArgs:a}}parseGroupOfType(t,r,n){switch(r){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text",resetFont:!0}:null}case"raw":{var a=this.parseStringGroup("raw",n);return a!=null?{type:"raw",mode:"text",string:a.text}:null}case"primitive":{if(n)throw new $t("A primitive argument cannot be optional");var s=this.parseGroup(t);if(s==null)throw new $t("Expected group as "+t,this.fetch());return s}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new $t("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,r){var n=this.gullet.scanArgument(r);if(n==null)return null;for(var i="",a;(a=this.fetch()).text!=="EOF";)i+=a.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(t,r){for(var n=this.fetch(),i=n,a="",s;(s=this.fetch()).text!=="EOF"&&t.test(a+s.text);)i=s,a+=i.text,this.consume();if(a==="")throw new $t("Invalid "+r+": '"+n.text+"'",n);return n.range(i,a)}parseColorGroup(t){var r=this.parseStringGroup("color",t);if(r==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);if(!n)throw new $t("Invalid color: '"+r.text+"'",r);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(t){var r,n=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup("size",t),!r)return null;!t&&r.text.length===0&&(r.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!i)throw new $t("Invalid size: '"+r.text+"'",r);var a={number:+(i[1]+i[2]),unit:i[3]};if(!mve(a))throw new $t("Invalid unit: '"+a.unit+"'",r);return{type:"size",mode:this.mode,value:a,isBlank:n}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var r=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;var n=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(t,r){var n=this.gullet.scanArgument(t);if(n==null)return null;var i=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var s={type:"ordgroup",mode:this.mode,loc:n.loc,body:a};return r&&this.switchMode(i),s}parseGroup(t,r){var n=this.fetch(),i=n.text,a;if(i==="{"||i==="\\begingroup"){this.consume();var s=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,s),l=this.fetch();this.expect(s),this.gullet.endGroup(),a={type:"ordgroup",mode:this.mode,loc:Hl.range(n,l),body:o,semisimple:i==="\\begingroup"||void 0}}else if(a=this.parseFunction(r,t)||this.parseSymbol(),a==null&&i[0]==="\\"&&!s2e.hasOwnProperty(i)){if(this.settings.throwOnError)throw new $t("Undefined control sequence: "+i,n);a=this.formatUnsupportedCmd(i),this.consume()}return a}formLigatures(t){for(var r=t.length-1,n=0;n<r;++n){var i=t[n];if(i.type==="textord"){var a=i.text,s=t[n+1];if(!(!s||s.type!=="textord")){if(a==="-"&&s.text==="-"){var o=t[n+2];n+1<r&&o&&o.type==="textord"&&o.text==="-"?(t.splice(n,3,{type:"textord",mode:"text",loc:Hl.range(i,o),text:"---"}),r-=2):(t.splice(n,2,{type:"textord",mode:"text",loc:Hl.range(i,s),text:"--"}),r-=1)}(a==="'"||a==="`")&&s.text===a&&(t.splice(n,2,{type:"textord",mode:"text",loc:Hl.range(i,s),text:a+a}),r-=1)}}}}parseSymbol(){var t=this.fetch(),r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var n=r.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new $t(`\\verb assertion failed -- - please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}dve.hasOwnProperty(r[0])&&!ra[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+r[0]+'" used in math mode',t),r=dve[r[0]]+r.slice(1));var a=pbt.exec(r);a&&(r=r.substring(0,a.index),r==="i"?r="\u0131":r==="j"&&(r="\u0237"));var s;if(ra[this.mode][r]){this.settings.strict&&this.mode==="math"&&PG.includes(r)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var o=ra[this.mode][r].group,l=Hl.range(t),u;Oxt(o)?u={type:"atom",mode:this.mode,family:o,loc:l,text:r}:u={type:o,mode:this.mode,loc:l,text:r},s=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(pve(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),s={type:"textord",mode:"text",loc:Hl.range(t),text:r};else return null;if(this.consume(),a)for(var h=0;h<a[0].length;h++){var f=a[0][h];if(!IG[f])throw new $t("Unknown accent ' "+f+"'",t);var d=IG[f][this.mode]||IG[f].text;if(!d)throw new $t("Accent "+f+" unsupported in "+this.mode+" mode",t);s={type:"accent",mode:this.mode,loc:Hl.range(t),label:d,isStretchy:!1,isShifty:!0,base:s}}return s}};Z8.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var fq=function(t,r){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Z8(t,r);delete n.gullet.macros.current["\\df@tag"];var i=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new $t("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new Lc("\\df@tag")])}]}return i},o2e=function(t,r,n){r.textContent="";var i=dq(t,n).toNode();r.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),o2e=function(){throw new $t("KaTeX doesn't work in quirks mode.")});var vbt=function(t,r){var n=dq(t,r).toMarkup();return n},xbt=function(t,r){var n=new s5(r);return fq(t,n)},l2e=function(t,r,n){if(n.throwOnError||!(t instanceof $t))throw t;var i=Nt(["katex-error"],[new ll(r)]);return i.setAttribute("title",t.toString()),i.setAttribute("style","color:"+n.errorColor),i},dq=function(t,r){var n=new s5(r);try{var i=fq(t,n);return Axt(i,t,n)}catch(a){return l2e(a,t,n)}},bbt=function(t,r){var n=new s5(r);try{var i=fq(t,n);return _xt(i,t,n)}catch(a){return l2e(a,t,n)}},wbt="0.16.47",kbt={Span:ym,Anchor:ub,SymbolNode:ll,SvgNode:sh,PathNode:uf,LineNode:l5},pq={version:wbt,render:o2e,renderToString:vbt,ParseError:$t,SETTINGS_SCHEMA:MG,__parse:xbt,__renderToDomTree:dq,__renderToHTMLTree:bbt,__setFontMetrics:lxt,__defineSymbol:X,__defineFunction:ir,__defineMacro:Ae,__domTree:kbt};function mq(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:o,mathText:s,mathTextData:o}};function e(l){let u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function t(){this.buffer()}function r(){let l=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=l}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){let u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),h=this.stack[this.stack.length-1];h.type,this.exit(l),h.value=u;let f=h.data.hChildren[0];f.type,f.tagName,f.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function a(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function s(l){let u=this.resume(),h=this.stack[this.stack.length-1];h.type,this.exit(l),h.value=u,h.data.hChildren.push({type:"text",value:u})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function gq(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),n.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +?)[ \r ]*`,QG="[\u0300-\u036F]",vbt=new RegExp(QG+"+$"),xbt="("+a2e+"+)|"+(ybt+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(QG+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(QG+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+gbt)+("|"+mbt+")"),K8=class{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(xbt,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Lc("EOF",new Ul(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new $t("Unexpected character: '"+t[r]+"'",new Lc(t[r],new Ul(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(` +`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Lc(i,new Ul(this,r,this.tokenRegex.lastIndex))}},JG=class{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new $t("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}},bbt=Xve;Ae("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Ae("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Ae("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Ae("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Ae("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});Ae("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Ae("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var fve={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ae("\\char",function(e){var t=e.popToken(),r,n=0;if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new $t("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=fve[t.text],n==null||n>=r)throw new $t("Invalid base-"+r+" digit "+t.text);for(var i;(i=fve[e.future().text])!=null&&i<r;)n*=r,n+=i,e.popToken()}return"\\@char{"+n+"}"});var fq=(e,t,r,n)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new $t("\\newcommand's first argument must be a macro name");var a=i[0].text,s=e.isDefined(a);if(s&&!t)throw new $t("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!s&&!r)throw new $t("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var o=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new $t("Invalid number of arguments: "+l);o=parseInt(l),i=e.consumeArg().tokens}return s&&n||e.macros.set(a,{tokens:i,numArgs:o}),""};Ae("\\newcommand",e=>fq(e,!1,!0,!1));Ae("\\renewcommand",e=>fq(e,!0,!1,!1));Ae("\\providecommand",e=>fq(e,!0,!0,!0));Ae("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});Ae("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});Ae("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),pm[r],ra.math[r],ra.text[r]),""});Ae("\\bgroup","{");Ae("\\egroup","}");Ae("~","\\nobreakspace");Ae("\\lq","`");Ae("\\rq","'");Ae("\\aa","\\r a");Ae("\\AA","\\r A");Ae("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");Ae("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Ae("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");Ae("\u212C","\\mathscr{B}");Ae("\u2130","\\mathscr{E}");Ae("\u2131","\\mathscr{F}");Ae("\u210B","\\mathscr{H}");Ae("\u2110","\\mathscr{I}");Ae("\u2112","\\mathscr{L}");Ae("\u2133","\\mathscr{M}");Ae("\u211B","\\mathscr{R}");Ae("\u212D","\\mathfrak{C}");Ae("\u210C","\\mathfrak{H}");Ae("\u2128","\\mathfrak{Z}");Ae("\\Bbbk","\\Bbb{k}");Ae("\\llap","\\mathllap{\\textrm{#1}}");Ae("\\rlap","\\mathrlap{\\textrm{#1}}");Ae("\\clap","\\mathclap{\\textrm{#1}}");Ae("\\mathstrut","\\vphantom{(}");Ae("\\underbar","\\underline{\\text{#1}}");Ae("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Ae("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");Ae("\\ne","\\neq");Ae("\u2260","\\neq");Ae("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");Ae("\u2209","\\notin");Ae("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");Ae("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");Ae("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");Ae("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");Ae("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");Ae("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");Ae("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");Ae("\u27C2","\\perp");Ae("\u203C","\\mathclose{!\\mkern-0.8mu!}");Ae("\u220C","\\notni");Ae("\u231C","\\ulcorner");Ae("\u231D","\\urcorner");Ae("\u231E","\\llcorner");Ae("\u231F","\\lrcorner");Ae("\xA9","\\copyright");Ae("\xAE","\\textregistered");Ae("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Ae("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Ae("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Ae("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Ae("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Ae("\u22EE","\\vdots");Ae("\\varGamma","\\mathit{\\Gamma}");Ae("\\varDelta","\\mathit{\\Delta}");Ae("\\varTheta","\\mathit{\\Theta}");Ae("\\varLambda","\\mathit{\\Lambda}");Ae("\\varXi","\\mathit{\\Xi}");Ae("\\varPi","\\mathit{\\Pi}");Ae("\\varSigma","\\mathit{\\Sigma}");Ae("\\varUpsilon","\\mathit{\\Upsilon}");Ae("\\varPhi","\\mathit{\\Phi}");Ae("\\varPsi","\\mathit{\\Psi}");Ae("\\varOmega","\\mathit{\\Omega}");Ae("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Ae("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Ae("\\boxed","\\fbox{$\\displaystyle{#1}$}");Ae("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Ae("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Ae("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Ae("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Ae("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var dve={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},wbt=new Set(["bin","rel"]);Ae("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in dve?t=dve[r]:(r.slice(0,4)==="\\not"||r in ra.math&&wbt.has(ra.math[r].group))&&(t="\\dotsb"),t});var dq={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ae("\\dotso",function(e){var t=e.future().text;return t in dq?"\\ldots\\,":"\\ldots"});Ae("\\dotsc",function(e){var t=e.future().text;return t in dq&&t!==","?"\\ldots\\,":"\\ldots"});Ae("\\cdots",function(e){var t=e.future().text;return t in dq?"\\@cdots\\,":"\\@cdots"});Ae("\\dotsb","\\cdots");Ae("\\dotsm","\\cdots");Ae("\\dotsi","\\!\\cdots");Ae("\\dotsx","\\ldots\\,");Ae("\\DOTSI","\\relax");Ae("\\DOTSB","\\relax");Ae("\\DOTSX","\\relax");Ae("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Ae("\\,","\\tmspace+{3mu}{.1667em}");Ae("\\thinspace","\\,");Ae("\\>","\\mskip{4mu}");Ae("\\:","\\tmspace+{4mu}{.2222em}");Ae("\\medspace","\\:");Ae("\\;","\\tmspace+{5mu}{.2777em}");Ae("\\thickspace","\\;");Ae("\\!","\\tmspace-{3mu}{.1667em}");Ae("\\negthinspace","\\!");Ae("\\negmedspace","\\tmspace-{4mu}{.2222em}");Ae("\\negthickspace","\\tmspace-{5mu}{.277em}");Ae("\\enspace","\\kern.5em ");Ae("\\enskip","\\hskip.5em\\relax");Ae("\\quad","\\hskip1em\\relax");Ae("\\qquad","\\hskip2em\\relax");Ae("\\tag","\\@ifstar\\tag@literal\\tag@paren");Ae("\\tag@paren","\\tag@literal{({#1})}");Ae("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new $t("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Ae("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Ae("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Ae("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Ae("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Ae("\\newline","\\\\\\relax");Ae("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var s2e=Ut(cf["Main-Regular"][84][1]-.7*cf["Main-Regular"][65][1]);Ae("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+s2e+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ae("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+s2e+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Ae("\\hspace","\\@ifstar\\@hspacer\\@hspace");Ae("\\@hspace","\\hskip #1\\relax");Ae("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Ae("\\ordinarycolon",":");Ae("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Ae("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Ae("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Ae("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Ae("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Ae("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Ae("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Ae("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Ae("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Ae("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Ae("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Ae("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Ae("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Ae("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Ae("\u2237","\\dblcolon");Ae("\u2239","\\eqcolon");Ae("\u2254","\\coloneqq");Ae("\u2255","\\eqqcolon");Ae("\u2A74","\\Coloneqq");Ae("\\ratio","\\vcentcolon");Ae("\\coloncolon","\\dblcolon");Ae("\\colonequals","\\coloneqq");Ae("\\coloncolonequals","\\Coloneqq");Ae("\\equalscolon","\\eqqcolon");Ae("\\equalscoloncolon","\\Eqqcolon");Ae("\\colonminus","\\coloneq");Ae("\\coloncolonminus","\\Coloneq");Ae("\\minuscolon","\\eqcolon");Ae("\\minuscoloncolon","\\Eqcolon");Ae("\\coloncolonapprox","\\Colonapprox");Ae("\\coloncolonsim","\\Colonsim");Ae("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ae("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ae("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ae("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ae("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");Ae("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Ae("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Ae("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Ae("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Ae("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Ae("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Ae("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Ae("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Ae("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");Ae("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");Ae("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");Ae("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");Ae("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");Ae("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");Ae("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");Ae("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");Ae("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");Ae("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");Ae("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");Ae("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");Ae("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");Ae("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");Ae("\\imath","\\html@mathml{\\@imath}{\u0131}");Ae("\\jmath","\\html@mathml{\\@jmath}{\u0237}");Ae("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");Ae("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");Ae("\u27E6","\\llbracket");Ae("\u27E7","\\rrbracket");Ae("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");Ae("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");Ae("\u2983","\\lBrace");Ae("\u2984","\\rBrace");Ae("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");Ae("\u29B5","\\minuso");Ae("\\darr","\\downarrow");Ae("\\dArr","\\Downarrow");Ae("\\Darr","\\Downarrow");Ae("\\lang","\\langle");Ae("\\rang","\\rangle");Ae("\\uarr","\\uparrow");Ae("\\uArr","\\Uparrow");Ae("\\Uarr","\\Uparrow");Ae("\\N","\\mathbb{N}");Ae("\\R","\\mathbb{R}");Ae("\\Z","\\mathbb{Z}");Ae("\\alef","\\aleph");Ae("\\alefsym","\\aleph");Ae("\\Alpha","\\mathrm{A}");Ae("\\Beta","\\mathrm{B}");Ae("\\bull","\\bullet");Ae("\\Chi","\\mathrm{X}");Ae("\\clubs","\\clubsuit");Ae("\\cnums","\\mathbb{C}");Ae("\\Complex","\\mathbb{C}");Ae("\\Dagger","\\ddagger");Ae("\\diamonds","\\diamondsuit");Ae("\\empty","\\emptyset");Ae("\\Epsilon","\\mathrm{E}");Ae("\\Eta","\\mathrm{H}");Ae("\\exist","\\exists");Ae("\\harr","\\leftrightarrow");Ae("\\hArr","\\Leftrightarrow");Ae("\\Harr","\\Leftrightarrow");Ae("\\hearts","\\heartsuit");Ae("\\image","\\Im");Ae("\\infin","\\infty");Ae("\\Iota","\\mathrm{I}");Ae("\\isin","\\in");Ae("\\Kappa","\\mathrm{K}");Ae("\\larr","\\leftarrow");Ae("\\lArr","\\Leftarrow");Ae("\\Larr","\\Leftarrow");Ae("\\lrarr","\\leftrightarrow");Ae("\\lrArr","\\Leftrightarrow");Ae("\\Lrarr","\\Leftrightarrow");Ae("\\Mu","\\mathrm{M}");Ae("\\natnums","\\mathbb{N}");Ae("\\Nu","\\mathrm{N}");Ae("\\Omicron","\\mathrm{O}");Ae("\\plusmn","\\pm");Ae("\\rarr","\\rightarrow");Ae("\\rArr","\\Rightarrow");Ae("\\Rarr","\\Rightarrow");Ae("\\real","\\Re");Ae("\\reals","\\mathbb{R}");Ae("\\Reals","\\mathbb{R}");Ae("\\Rho","\\mathrm{P}");Ae("\\sdot","\\cdot");Ae("\\sect","\\S");Ae("\\spades","\\spadesuit");Ae("\\sub","\\subset");Ae("\\sube","\\subseteq");Ae("\\supe","\\supseteq");Ae("\\Tau","\\mathrm{T}");Ae("\\thetasym","\\vartheta");Ae("\\weierp","\\wp");Ae("\\Zeta","\\mathrm{Z}");Ae("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Ae("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Ae("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Ae("\\bra","\\mathinner{\\langle{#1}|}");Ae("\\ket","\\mathinner{|{#1}\\rangle}");Ae("\\braket","\\mathinner{\\langle{#1}\\rangle}");Ae("\\Bra","\\left\\langle#1\\right|");Ae("\\Ket","\\left|#1\\right\\rangle");var o2e=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.macros.get("|"),o=t.macros.get("\\|");t.macros.beginGroup();var l=f=>d=>{e&&(d.macros.set("|",s),i.length&&d.macros.set("\\|",o));var p=f;if(!f&&i.length){var m=d.future();m.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};t.macros.set("|",l(!1)),i.length&&t.macros.set("\\|",l(!0));var u=t.consumeArg().tokens,h=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};Ae("\\bra@ket",o2e(!1));Ae("\\bra@set",o2e(!0));Ae("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Ae("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Ae("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Ae("\\angln","{\\angl n}");Ae("\\blue","\\textcolor{##6495ed}{#1}");Ae("\\orange","\\textcolor{##ffa500}{#1}");Ae("\\pink","\\textcolor{##ff00af}{#1}");Ae("\\red","\\textcolor{##df0030}{#1}");Ae("\\green","\\textcolor{##28ae7b}{#1}");Ae("\\gray","\\textcolor{gray}{#1}");Ae("\\purple","\\textcolor{##9d38bd}{#1}");Ae("\\blueA","\\textcolor{##ccfaff}{#1}");Ae("\\blueB","\\textcolor{##80f6ff}{#1}");Ae("\\blueC","\\textcolor{##63d9ea}{#1}");Ae("\\blueD","\\textcolor{##11accd}{#1}");Ae("\\blueE","\\textcolor{##0c7f99}{#1}");Ae("\\tealA","\\textcolor{##94fff5}{#1}");Ae("\\tealB","\\textcolor{##26edd5}{#1}");Ae("\\tealC","\\textcolor{##01d1c1}{#1}");Ae("\\tealD","\\textcolor{##01a995}{#1}");Ae("\\tealE","\\textcolor{##208170}{#1}");Ae("\\greenA","\\textcolor{##b6ffb0}{#1}");Ae("\\greenB","\\textcolor{##8af281}{#1}");Ae("\\greenC","\\textcolor{##74cf70}{#1}");Ae("\\greenD","\\textcolor{##1fab54}{#1}");Ae("\\greenE","\\textcolor{##0d923f}{#1}");Ae("\\goldA","\\textcolor{##ffd0a9}{#1}");Ae("\\goldB","\\textcolor{##ffbb71}{#1}");Ae("\\goldC","\\textcolor{##ff9c39}{#1}");Ae("\\goldD","\\textcolor{##e07d10}{#1}");Ae("\\goldE","\\textcolor{##a75a05}{#1}");Ae("\\redA","\\textcolor{##fca9a9}{#1}");Ae("\\redB","\\textcolor{##ff8482}{#1}");Ae("\\redC","\\textcolor{##f9685d}{#1}");Ae("\\redD","\\textcolor{##e84d39}{#1}");Ae("\\redE","\\textcolor{##bc2612}{#1}");Ae("\\maroonA","\\textcolor{##ffbde0}{#1}");Ae("\\maroonB","\\textcolor{##ff92c6}{#1}");Ae("\\maroonC","\\textcolor{##ed5fa6}{#1}");Ae("\\maroonD","\\textcolor{##ca337c}{#1}");Ae("\\maroonE","\\textcolor{##9e034e}{#1}");Ae("\\purpleA","\\textcolor{##ddd7ff}{#1}");Ae("\\purpleB","\\textcolor{##c6b9fc}{#1}");Ae("\\purpleC","\\textcolor{##aa87ff}{#1}");Ae("\\purpleD","\\textcolor{##7854ab}{#1}");Ae("\\purpleE","\\textcolor{##543b78}{#1}");Ae("\\mintA","\\textcolor{##f5f9e8}{#1}");Ae("\\mintB","\\textcolor{##edf2df}{#1}");Ae("\\mintC","\\textcolor{##e0e5cc}{#1}");Ae("\\grayA","\\textcolor{##f6f7f7}{#1}");Ae("\\grayB","\\textcolor{##f0f1f2}{#1}");Ae("\\grayC","\\textcolor{##e3e5e6}{#1}");Ae("\\grayD","\\textcolor{##d6d8da}{#1}");Ae("\\grayE","\\textcolor{##babec2}{#1}");Ae("\\grayF","\\textcolor{##888d93}{#1}");Ae("\\grayG","\\textcolor{##626569}{#1}");Ae("\\grayH","\\textcolor{##3b3e40}{#1}");Ae("\\grayI","\\textcolor{##21242c}{#1}");Ae("\\kaBlue","\\textcolor{##314453}{#1}");Ae("\\kaGreen","\\textcolor{##71B307}{#1}");var l2e={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},eq=class{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new JG(bbt,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new K8(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new Lc("EOF",n.loc)),this.pushTokens(i),new Lc("",Ul.range(r,n))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,s=0,o=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++s;else if(a.text==="}"){if(--s,s===-1)throw new $t("Extra }",a)}else if(a.text==="EOF")throw new $t("Unexpected end of input in a macro argument, expected '"+(t&&n?t[o]:"}")+"'",a);if(t&&n)if((s===0||s===1&&t[o]==="{")&&a.text===t[o]){if(++o,o===t.length){r.splice(-o,o);break}}else o=0}while(s!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new $t("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;i<n.length;i++){var a=this.popToken();if(n[i]!==a.text)throw new $t("Use of the macro doesn't match its definition",a)}}for(var s=[],o=0;o<t;o++)s.push(this.consumeArg(r&&r[o+1]).tokens);return s}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new $t("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new $t("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,s=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var o=a.length-1;o>=0;--o){var l=a[o];if(l.text==="#"){if(o===0)throw new $t("Incomplete placeholder at end of macro body",l);if(l=a[--o],l.text==="#")a.splice(o+1,1);else if(/^[1-9]$/.test(l.text))a.splice(o,2,...s[+l.text-1]);else throw new $t("Not a valid argument number",l)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Lc(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.includes("#"))for(var s=i.replace(/##/g,"");s.includes("#"+(a+1));)++a;for(var o=new K8(i,this.settings),l=[],u=o.lex();u.text!=="EOF";)l.push(u),u=o.lex();l.reverse();var h={tokens:l,numArgs:a};return h}return i}isDefined(t){return this.macros.has(t)||pm.hasOwnProperty(t)||ra.math.hasOwnProperty(t)||ra.text.hasOwnProperty(t)||l2e.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:pm.hasOwnProperty(t)&&!pm[t].primitive}},pve=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,z8=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),NG={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},mve={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},Z8=class e{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new eq(t,r,this.mode),this.settings=r,this.leftrightDepth=0,this.nextToken=null}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new $t("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new Lc("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.has(i.text)||r&&i.text===r||t&&pm[i.text]&&pm[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i<t.length;i++){var a=t[i];if(a.type==="infix"){if(r!==-1)throw new $t("only one infix operator per group",a.token);r=i,n=a.replaceWith}}if(r!==-1&&n){var s,o,l=t.slice(0,r),u=t.slice(r+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},u.length===1&&u[0].type==="ordgroup"?o=u[0]:o={type:"ordgroup",mode:this.mode,body:u};var h;return n==="\\\\abovefrac"?h=this.callFunction(n,[s,t[r],o],[]):h=this.callFunction(n,[s,o],[]),[h]}else return t}handleSupSubscript(t){var r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();var i;do{var a;i=this.parseGroup(t)}while(((a=i)==null?void 0:a.type)==="internal");if(!i)throw new $t("Expected group after '"+n+"'",r);return i}formatUnsupportedCmd(t){for(var r=[],n=0;n<t.length;n++)r.push({type:"textord",mode:"text",text:t[n]});var i={type:"text",mode:this.mode,body:r},a={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return a}parseAtom(t){var r=this.parseGroup("atom",t);if(r?.type==="internal"||this.mode==="text")return r;for(var n,i;;){this.consumeSpaces();var a=this.fetch();if(a.text==="\\limits"||a.text==="\\nolimits"){if(r&&r.type==="op"){var s=a.text==="\\limits";r.limits=s,r.alwaysHandleSupSub=!0}else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=a.text==="\\limits");else throw new $t("Limit controls must follow a math operator",a);this.consume()}else if(a.text==="^"){if(n)throw new $t("Double superscript",a);n=this.handleSupSubscript("superscript")}else if(a.text==="_"){if(i)throw new $t("Double subscript",a);i=this.handleSupSubscript("subscript")}else if(a.text==="'"){if(n)throw new $t("Double superscript",a);var o={type:"textord",mode:this.mode,text:"\\prime"},l=[o];for(this.consume();this.fetch().text==="'";)l.push(o),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(z8[a.text]){var u=pve.test(a.text),h=[];for(h.push(new Lc(z8[a.text])),this.consume();;){var f=this.fetch().text;if(!z8[f]||pve.test(f)!==u)break;h.unshift(new Lc(z8[f])),this.consume()}var d=this.subparse(h);u?i={type:"ordgroup",mode:"math",body:d}:n={type:"ordgroup",mode:"math",body:d}}else break}return n||i?{type:"supsub",mode:this.mode,base:r,sup:n,sub:i}:r}parseFunction(t,r){var n=this.fetch(),i=n.text,a=pm[i];if(!a)return null;if(this.consume(),r&&r!=="atom"&&!a.allowedInArgument)throw new $t("Got function '"+i+"' with no arguments"+(r?" as "+r:""),n);if(this.mode==="text"&&!a.allowedInText)throw new $t("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&a.allowedInMath===!1)throw new $t("Can't use function '"+i+"' in math mode",n);var{args:s,optArgs:o}=this.parseArguments(i,a);return this.callFunction(i,s,o,n,t)}callFunction(t,r,n,i,a){var s={funcName:t,parser:this,token:i,breakOnTokenText:a},o=pm[t];if(o&&o.handler)return o.handler(s,r,n);throw new $t("No function handler for "+t)}parseArguments(t,r){var n=r.numArgs+r.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],a=[],s=0;s<n;s++){var o=r.argTypes&&r.argTypes[s],l=s<r.numOptionalArgs;("primitive"in r&&r.primitive&&o==null||r.type==="sqrt"&&s===1&&a[0]==null)&&(o="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",o,l);if(l)a.push(u);else if(u!=null)i.push(u);else throw new $t("Null argument, please report this as a bug")}return{args:i,optArgs:a}}parseGroupOfType(t,r,n){switch(r){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text",resetFont:!0}:null}case"raw":{var a=this.parseStringGroup("raw",n);return a!=null?{type:"raw",mode:"text",string:a.text}:null}case"primitive":{if(n)throw new $t("A primitive argument cannot be optional");var s=this.parseGroup(t);if(s==null)throw new $t("Expected group as "+t,this.fetch());return s}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new $t("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,r){var n=this.gullet.scanArgument(r);if(n==null)return null;for(var i="",a;(a=this.fetch()).text!=="EOF";)i+=a.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(t,r){for(var n=this.fetch(),i=n,a="",s;(s=this.fetch()).text!=="EOF"&&t.test(a+s.text);)i=s,a+=i.text,this.consume();if(a==="")throw new $t("Invalid "+r+": '"+n.text+"'",n);return n.range(i,a)}parseColorGroup(t){var r=this.parseStringGroup("color",t);if(r==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);if(!n)throw new $t("Invalid color: '"+r.text+"'",r);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(t){var r,n=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup("size",t),!r)return null;!t&&r.text.length===0&&(r.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!i)throw new $t("Invalid size: '"+r.text+"'",r);var a={number:+(i[1]+i[2]),unit:i[3]};if(!yve(a))throw new $t("Invalid unit: '"+a.unit+"'",r);return{type:"size",mode:this.mode,value:a,isBlank:n}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var r=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;var n=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(t,r){var n=this.gullet.scanArgument(t);if(n==null)return null;var i=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var s={type:"ordgroup",mode:this.mode,loc:n.loc,body:a};return r&&this.switchMode(i),s}parseGroup(t,r){var n=this.fetch(),i=n.text,a;if(i==="{"||i==="\\begingroup"){this.consume();var s=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,s),l=this.fetch();this.expect(s),this.gullet.endGroup(),a={type:"ordgroup",mode:this.mode,loc:Ul.range(n,l),body:o,semisimple:i==="\\begingroup"||void 0}}else if(a=this.parseFunction(r,t)||this.parseSymbol(),a==null&&i[0]==="\\"&&!l2e.hasOwnProperty(i)){if(this.settings.throwOnError)throw new $t("Undefined control sequence: "+i,n);a=this.formatUnsupportedCmd(i),this.consume()}return a}formLigatures(t){for(var r=t.length-1,n=0;n<r;++n){var i=t[n];if(i.type==="textord"){var a=i.text,s=t[n+1];if(!(!s||s.type!=="textord")){if(a==="-"&&s.text==="-"){var o=t[n+2];n+1<r&&o&&o.type==="textord"&&o.text==="-"?(t.splice(n,3,{type:"textord",mode:"text",loc:Ul.range(i,o),text:"---"}),r-=2):(t.splice(n,2,{type:"textord",mode:"text",loc:Ul.range(i,s),text:"--"}),r-=1)}(a==="'"||a==="`")&&s.text===a&&(t.splice(n,2,{type:"textord",mode:"text",loc:Ul.range(i,s),text:a+a}),r-=1)}}}}parseSymbol(){var t=this.fetch(),r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var n=r.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new $t(`\\verb assertion failed -- + please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}mve.hasOwnProperty(r[0])&&!ra[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+r[0]+'" used in math mode',t),r=mve[r[0]]+r.slice(1));var a=vbt.exec(r);a&&(r=r.substring(0,a.index),r==="i"?r="\u0131":r==="j"&&(r="\u0237"));var s;if(ra[this.mode][r]){this.settings.strict&&this.mode==="math"&&FG.includes(r)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var o=ra[this.mode][r].group,l=Ul.range(t),u;$xt(o)?u={type:"atom",mode:this.mode,family:o,loc:l,text:r}:u={type:o,mode:this.mode,loc:l,text:r},s=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(gve(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),s={type:"textord",mode:"text",loc:Ul.range(t),text:r};else return null;if(this.consume(),a)for(var h=0;h<a[0].length;h++){var f=a[0][h];if(!NG[f])throw new $t("Unknown accent ' "+f+"'",t);var d=NG[f][this.mode]||NG[f].text;if(!d)throw new $t("Accent "+f+" unsupported in "+this.mode+" mode",t);s={type:"accent",mode:this.mode,loc:Ul.range(t),label:d,isStretchy:!1,isShifty:!0,base:s}}return s}};Z8.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var pq=function(t,r){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Z8(t,r);delete n.gullet.macros.current["\\df@tag"];var i=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new $t("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new Lc("\\df@tag")])}]}return i},c2e=function(t,r,n){r.textContent="";var i=mq(t,n).toNode();r.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),c2e=function(){throw new $t("KaTeX doesn't work in quirks mode.")});var kbt=function(t,r){var n=mq(t,r).toMarkup();return n},Tbt=function(t,r){var n=new s5(r);return pq(t,n)},u2e=function(t,r,n){if(n.throwOnError||!(t instanceof $t))throw t;var i=Nt(["katex-error"],[new cl(r)]);return i.setAttribute("title",t.toString()),i.setAttribute("style","color:"+n.errorColor),i},mq=function(t,r){var n=new s5(r);try{var i=pq(t,n);return Ixt(i,t,n)}catch(a){return u2e(a,t,n)}},Cbt=function(t,r){var n=new s5(r);try{var i=pq(t,n);return Mxt(i,t,n)}catch(a){return u2e(a,t,n)}},Sbt="0.16.47",Ebt={Span:ym,Anchor:ub,SymbolNode:cl,SvgNode:sh,PathNode:uf,LineNode:l5},gq={version:Sbt,render:c2e,renderToString:kbt,ParseError:$t,SETTINGS_SCHEMA:DG,__parse:Tbt,__renderToDomTree:mq,__renderToHTMLTree:Cbt,__setFontMetrics:fxt,__defineSymbol:X,__defineFunction:ir,__defineMacro:Ae,__domTree:Ebt};function yq(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:o,mathText:s,mathTextData:o}};function e(l){let u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function t(){this.buffer()}function r(){let l=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=l}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){let u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),h=this.stack[this.stack.length-1];h.type,this.exit(l),h.value=u;let f=h.data.hChildren[0];f.type,f.tagName,f.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function a(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function s(l){let u=this.resume(),h=this.stack[this.stack.length-1];h.type,this.exit(l),h.value=u,h.data.hChildren.push({type:"text",value:u})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function vq(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),n.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:n}};function r(a,s,o,l){let u=a.value||"",h=o.createTracker(l),f="$".repeat(Math.max(TE(u,"$")+1,2)),d=o.enter("mathFlow"),p=h.move(f);if(a.meta){let m=o.enter("mathFlowMeta");p+=h.move(o.safe(a.meta,{after:` `,before:p,encode:["$"],...h.current()})),m()}return p+=h.move(` `),u&&(p+=h.move(u+` -`)),p+=h.move(f),d(),p}function n(a,s,o){let l=a.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(l);)u++;let h="$".repeat(u);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let f=-1;for(;++f<o.unsafe.length;){let d=o.unsafe[f];if(!d.atBreak)continue;let p=o.compilePattern(d),m;for(;m=p.exec(l);){let g=m.index;l.codePointAt(g)===10&&l.codePointAt(g-1)===13&&g--,l=l.slice(0,g)+" "+l.slice(m.index+1)}}return h+l+h}function i(){return"$"}}var u2e={tokenize:Tbt,concrete:!0,name:"mathFlow"},c2e={tokenize:Cbt,partial:!0};function Tbt(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(x){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(x)}function l(x){return x===36?(e.consume(x),s++,l):s<2?r(x):(e.exit("mathFlowFenceSequence"),kr(e,u,"whitespace")(x))}function u(x){return x===null||Kt(x)?f(x):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===null||Kt(x)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),f(x)):x===36?r(x):(e.consume(x),h)}function f(x){return e.exit("mathFlowFence"),n.interrupt?t(x):e.attempt(c2e,d,y)(x)}function d(x){return e.attempt({tokenize:v,partial:!0},y,p)(x)}function p(x){return(a?kr(e,m,"linePrefix",a+1):m)(x)}function m(x){return x===null?y(x):Kt(x)?e.attempt(c2e,d,y)(x):(e.enter("mathFlowValue"),g(x))}function g(x){return x===null||Kt(x)?(e.exit("mathFlowValue"),m(x)):(e.consume(x),g)}function y(x){return e.exit("mathFlow"),t(x)}function v(x,w,C){let T=0;return kr(x,k,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function k(I){return x.enter("mathFlowFence"),x.enter("mathFlowFenceSequence"),S(I)}function S(I){return I===36?(T++,x.consume(I),S):T<s?C(I):(x.exit("mathFlowFenceSequence"),kr(x,E,"whitespace")(I))}function E(I){return I===null||Kt(I)?(x.exit("mathFlowFence"),w(I)):C(I)}}}function Cbt(e,t,r){let n=this;return i;function i(s){return s===null?t(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return n.parser.lazy[n.now().line]?r(s):t(s)}}function h2e(e){let r=(e||{}).singleDollarTextMath;return r==null&&(r=!0),{tokenize:n,resolve:Sbt,previous:Ebt,name:"mathText"};function n(i,a,s){let o=this,l=0,u,h;return f;function f(y){return i.enter("mathText"),i.enter("mathTextSequence"),d(y)}function d(y){return y===36?(i.consume(y),l++,d):l<2&&!r?s(y):(i.exit("mathTextSequence"),p(y))}function p(y){return y===null?s(y):y===36?(h=i.enter("mathTextSequence"),u=0,g(y)):y===32?(i.enter("space"),i.consume(y),i.exit("space"),p):Kt(y)?(i.enter("lineEnding"),i.consume(y),i.exit("lineEnding"),p):(i.enter("mathTextData"),m(y))}function m(y){return y===null||y===32||y===36||Kt(y)?(i.exit("mathTextData"),p(y)):(i.consume(y),m)}function g(y){return y===36?(i.consume(y),u++,g):u===l?(i.exit("mathTextSequence"),i.exit("mathText"),a(y)):(h.type="mathTextData",m(y))}}}function Sbt(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[r][1].type="mathTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="mathTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function Ebt(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function yq(e){return{flow:{36:u2e},text:{36:h2e(e)}}}var Abt={};function cA(e){let t=this,r=e||Abt,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(yq(r)),a.push(mq()),s.push(gq(r))}function s0(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-math",...t}}),e}var bq=Mye("remarkMath",()=>cA);s0(bq.plugin,{displayName:"Remark<remarkMath>"});s0(bq.options,{displayName:"RemarkConfig<remarkMath>"});var vq="math_inline",mb=L8({},"katexOptions");s0(mb,{displayName:"Ctx<katexOptions>"});var uA=yG("math_inline",e=>({group:"inline",content:"text*",inline:!0,atom:!0,parseDOM:[{tag:`span[data-type="${vq}"]`,getContent:(t,r)=>{if(!(t instanceof HTMLElement))throw Lye(t);return Lt.from(r.text(t.dataset.value??""))}}],toDOM:t=>{let r=t.textContent,n=document.createElement("span");return n.dataset.type=vq,n.dataset.value=r,pq.render(r,n,e.get(mb.key)),n},parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,r,n)=>{t.openNode(n).addText(r.value).closeNode()}},toMarkdown:{match:t=>t.type.name===vq,runner:(t,r)=>{t.addNode("inlineMath",void 0,r.textContent)}}}));s0(uA.ctx,{displayName:"NodeSchemaCtx<mathInline>"});s0(uA.node,{displayName:"NodeSchema<mathInline>"});var f2e=gG(e=>nue(/(?:\$)([^$]+)(?:\$)$/,uA.type(e),{beforeDispatch:({tr:t,match:r,start:n})=>{t.insertText(r[1]??"",n+1)}}));s0(f2e,{displayName:"InputRule<mathInline>"});var xq="math_block",f5=yG("math_block",e=>({content:"text*",group:"block",marks:"",defining:!0,atom:!0,isolating:!0,attrs:{value:{default:""}},parseDOM:[{tag:`div[data-type="${xq}"]`,preserveWhitespace:"full",getAttrs:t=>({value:t.dataset.value??""})}],toDOM:t=>{let r=t.attrs.value,n=document.createElement("div");return n.dataset.type=xq,n.dataset.value=r,pq.render(r,n,e.get(mb.key)),n},parseMarkdown:{match:({type:t})=>t==="math",runner:(t,r,n)=>{let i=r.value;t.addNode(n,{value:i})}},toMarkdown:{match:t=>t.type.name===xq,runner:(t,r)=>{t.addNode("math",void 0,r.attrs.value)}}}));s0(f5.ctx,{displayName:"NodeSchemaCtx<mathBlock>"});s0(f5.node,{displayName:"NodeSchema<mathBlock>"});var d2e=gG(e=>new Pa(/^\$\$\s$/,(t,r,n,i)=>{let a=t.doc.resolve(n);return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),f5.type(e))?t.tr.delete(n,i).setBlockType(n,n,f5.type(e)):null}));s0(d2e,{displayName:"InputRule<mathBlock>"});var p2e=[bq,mb,uA,f5,d2e,f2e].flat();za();Gy();ic();Jl();po();co();vl();ho();bs();ts();Sn();_r();Rr();hr();ZU();fn();var J4="comm",pI="rule",mI="decl";var ODe="@media",PDe="@import";var BDe="@supports";var FDe="@namespace",KC="@keyframes";var gI="@layer",$De="@scope";var zDe=Math.abs,bv=String.fromCharCode;function yI(e){return e.trim()}function ZC(e,t,r){return e.replace(t,r)}function G0(e,t){return e.charCodeAt(t)|0}function q0(e,t,r){return e.slice(t,r)}function ac(e){return e.length}function vI(e){return e.length}function ew(e,t){return t.push(e),e}var xI=1,tw=1,GDe=0,Pu=0,ss=0,nw="";function bI(e,t,r,n,i,a,s,o){return{value:e,root:t,parent:r,type:n,props:i,children:a,line:xI,column:tw,length:s,return:"",siblings:o}}function qDe(){return ss}function VDe(){return ss=Pu>0?G0(nw,--Pu):0,tw--,ss===10&&(tw=1,xI--),ss}function Bu(){return ss=Pu<GDe?G0(nw,Pu++):0,tw++,ss===10&&(tw=1,xI++),ss}function V0(){return G0(nw,Pu)}function QC(){return Pu}function wI(e,t){return q0(nw,e,t)}function rw(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function WDe(e){return xI=tw=1,GDe=ac(nw=e),Pu=0,[]}function HDe(e){return nw="",e}function kI(e){return yI(wI(Pu-1,BZ(e===91?e+2:e===40?e+1:e)))}function UDe(e){for(;(ss=V0())&&ss<33;)Bu();return rw(e)>2||rw(ss)>3?"":" "}function YDe(e,t){for(;--t&&Bu()&&!(ss<48||ss>102||ss>57&&ss<65||ss>70&&ss<97););return wI(e,QC()+(t<6&&V0()==32&&Bu()==32))}function BZ(e){for(;Bu();)switch(ss){case e:return Pu;case 34:case 39:e!==34&&e!==39&&BZ(ss);break;case 40:e===41&&BZ(e);break;case 92:Bu();break}return Pu}function XDe(e,t){for(;Bu()&&e+ss!==57;)if(e+ss===84&&V0()===47)break;return"/*"+wI(t,Pu-1)+"*"+bv(e===47?e:Bu())}function jDe(e){for(;!rw(V0());)Bu();return wI(e,Pu)}function QDe(e){return HDe(TI("",null,null,null,[""],e=WDe(e),0,[0],e))}function TI(e,t,r,n,i,a,s,o,l){for(var u=0,h=0,f=s,d=0,p=0,m=0,g=1,y=1,v=1,x=0,w=0,C="",T=i,k=a,S=n,E=C;y;)switch(m=w,w=Bu()){case 40:m!=108&&G0(E,f-1)==58?(x++,E+="("):E+=kI(w);break;case 41:x--,E+=")";break;case 34:case 39:case 91:E+=kI(w);break;case 9:case 10:case 13:case 32:if(x>0){E+=bv(w);break}E+=UDe(m);break;case 92:E+=YDe(QC()-1,7);continue;case 47:switch(V0()){case 42:case 47:ew(TNt(XDe(Bu(),QC()),t,r,l),l),(rw(m||1)==5||rw(V0()||1)==5)&&ac(E)&&q0(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*g:o[u++]=ac(E)*v;case 125*g:case 59:case 0:if(x>0&&w){E+=bv(w);break}switch(w){case 0:case 125:y=0;case 59+h:v==-1&&(E=ZC(E,/\f/g,"")),p>0&&(ac(E)-f||g===0)&&ew(p>32?ZDe(E+";",n,r,f-1,l):ZDe(ZC(E," ","")+";",n,r,f-2,l),l);break;case 59:E+=";";default:if(ew(S=KDe(E,t,r,u,h,i,o,C,T=[],k=[],f,a),a),w===123)if(h===0)TI(E,t,S,S,T,a,f,o,k);else{switch(d){case 99:if(G0(E,3)===110)break;case 108:if(G0(E,2)===97)break;default:h=0;case 100:case 109:case 115:}h?TI(e,S,S,n&&ew(KDe(e,S,S,0,0,i,o,C,i,T=[],f,k),k),i,k,f,o,n?T:k):TI(E,S,S,S,[""],k,0,o,k)}}u=h=p=0,g=v=1,C=E="",f=s;break;case 58:f=1+ac(E),p=m;default:if(g<1){if(w==123)--g;else if(w==125&&g++==0&&VDe()==125)continue}switch(E+=bv(w),w*g){case 38:v=h>0?1:(E+="\f",-1);break;case 44:if(x>0)break;o[u++]=(ac(E)-1)*v,v=1;break;case 64:V0()===45&&(E+=kI(Bu())),d=V0(),h=f=ac(C=E+=jDe(QC())),w++;break;case 45:m===45&&ac(E)==2&&(g=0)}}return a}function KDe(e,t,r,n,i,a,s,o,l,u,h,f){for(var d=i-1,p=i===0?a:[""],m=vI(p),g=0,y=0,v=0;g<n;++g)for(var x=0,w=q0(e,d+1,d=zDe(y=s[g])),C=e;x<m;++x)(C=yI(y>0?p[x]+" "+w:ZC(w,/&\f/g,p[x])))&&(l[v++]=C);return bI(e,t,r,i===0?pI:o,l,u,h,f)}function TNt(e,t,r,n){return bI(e,t,r,J4,bv(qDe()),q0(e,2,-2),0,n)}function ZDe(e,t,r,n,i){return bI(e,t,r,mI,q0(e,0,n),q0(e,n+1,-1),n,i)}function CI(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function JDe(e,t,r,n){switch(e.type){case gI:if(e.children.length)break;case PDe:case FDe:case mI:return e.return=e.return||e.value;case J4:return"";case KC:return e.return=e.value+"{"+CI(e.children,n)+"}";case pI:if(!ac(e.value=e.props.join(",")))return""}return ac(r=CI(e.children,n))?e.return=e.value+"{"+r+"}":""}function eOe(e){var t=vI(e);return function(r,n,i,a){for(var s="",o=0;o<t;o++)s+=e[o](r,n,i,a)||"";return s}}xb();aR();var Hrt="c4",Esr=b(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Asr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(pOe(),dOe));return{id:Hrt,diagram:e}},"loader"),_sr={id:Hrt,detector:Esr,loader:Asr},Rsr=_sr,Urt="flowchart",Lsr=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),Isr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(PI(),OI));return{id:Urt,diagram:e}},"loader"),Msr={id:Urt,detector:Lsr,loader:Isr},Nsr=Msr,Yrt="flowchart-v2",Dsr=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),Osr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(PI(),OI));return{id:Yrt,diagram:e}},"loader"),Psr={id:Yrt,detector:Dsr,loader:Osr},Bsr=Psr,Xrt="swimlane",Fsr=b(e=>/^\s*swimlane-beta\b/.test(e),"detector"),$sr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(xOe(),vOe));return{id:Xrt,diagram:e}},"loader"),zsr={id:Xrt,detector:Fsr,loader:$sr},Gsr=zsr,jrt="er",qsr=b(e=>/^\s*erDiagram/.test(e),"detector"),Vsr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(TOe(),kOe));return{id:jrt,diagram:e}},"loader"),Wsr={id:jrt,detector:qsr,loader:Vsr},Hsr=Wsr,Krt="gitGraph",Usr=b(e=>/^\s*gitGraph/.test(e),"detector"),Ysr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Nje(),Mje));return{id:Krt,diagram:e}},"loader"),Xsr={id:Krt,detector:Usr,loader:Ysr},jsr=Xsr,Zrt="gantt",Ksr=b(e=>/^\s*gantt/.test(e),"detector"),Zsr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(rKe(),tKe));return{id:Zrt,diagram:e}},"loader"),Qsr={id:Zrt,detector:Ksr,loader:Zsr},Jsr=Qsr,Qrt="info",eor=b(e=>/^\s*info/.test(e),"detector"),tor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(iKe(),nKe));return{id:Qrt,diagram:e}},"loader"),ror={id:Qrt,detector:eor,loader:tor},Jrt="pie",nor=b(e=>/^\s*pie/.test(e),"detector"),ior=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(lKe(),oKe));return{id:Jrt,diagram:e}},"loader"),aor={id:Jrt,detector:nor,loader:ior},ent="quadrantChart",sor=b(e=>/^\s*quadrantChart/.test(e),"detector"),oor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(SKe(),CKe));return{id:ent,diagram:e}},"loader"),lor={id:ent,detector:sor,loader:oor},cor=lor,tnt="xychart",uor=b(e=>/^\s*xychart(-beta)?/.test(e),"detector"),hor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(YKe(),UKe));return{id:tnt,diagram:e}},"loader"),dor={id:tnt,detector:uor,loader:hor},por=dor,rnt="requirement",mor=b(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),gor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(KKe(),jKe));return{id:rnt,diagram:e}},"loader"),yor={id:rnt,detector:mor,loader:gor},vor=yor,nnt="sequence",xor=b(e=>/^\s*sequenceDiagram/.test(e),"detector"),bor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(hZe(),uZe));return{id:nnt,diagram:e}},"loader"),wor={id:nnt,detector:xor,loader:bor},kor=wor,int="class",Tor=b((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),Cor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(gZe(),mZe));return{id:int,diagram:e}},"loader"),Sor={id:int,detector:Tor,loader:Cor},Eor=Sor,ant="classDiagram",Aor=b((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),_or=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(vZe(),yZe));return{id:ant,diagram:e}},"loader"),Ror={id:ant,detector:Aor,loader:_or},Lor=Ror,snt="state",Ior=b((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),Mor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(WZe(),VZe));return{id:snt,diagram:e}},"loader"),Nor={id:snt,detector:Ior,loader:Mor},Dor=Nor,ont="stateDiagram",Oor=b((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),Por=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(UZe(),HZe));return{id:ont,diagram:e}},"loader"),Bor={id:ont,detector:Oor,loader:Por},For=Bor,lnt="journey",$or=b(e=>/^\s*journey/.test(e),"detector"),zor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(rQe(),tQe));return{id:lnt,diagram:e}},"loader"),Gor={id:lnt,detector:$or,loader:zor},qor=Gor,Vor=b((e,t,r)=>{se.debug(`rendering svg for syntax error -`);let n=Qn(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),vn(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),cnt={draw:Vor},Wor=cnt,Hor={db:{},renderer:cnt,parser:{parse:b(()=>{},"parse")}},Uor=Hor,unt="flowchart-elk",Yor=b((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),Xor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(PI(),OI));return{id:unt,diagram:e}},"loader"),jor={id:unt,detector:Yor,loader:Xor},Kor=jor,hnt="timeline",Zor=b(e=>/^\s*timeline/.test(e),"detector"),Qor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(AQe(),EQe));return{id:hnt,diagram:e}},"loader"),Jor={id:hnt,detector:Zor,loader:Qor},elr=Jor,fnt="mindmap",tlr=b(e=>/^\s*mindmap/.test(e),"detector"),rlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(DQe(),NQe));return{id:fnt,diagram:e}},"loader"),nlr={id:fnt,detector:tlr,loader:rlr},ilr=nlr,dnt="kanban",alr=b(e=>/^\s*kanban/.test(e),"detector"),slr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(BQe(),PQe));return{id:dnt,diagram:e}},"loader"),olr={id:dnt,detector:alr,loader:slr},llr=olr,pnt="sankey",clr=b(e=>/^\s*sankey(-beta)?/.test(e),"detector"),ulr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(lJe(),oJe));return{id:pnt,diagram:e}},"loader"),hlr={id:pnt,detector:clr,loader:ulr},flr=hlr,mnt="packet",dlr=b(e=>/^\s*packet(-beta)?/.test(e),"detector"),plr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(fJe(),hJe));return{id:mnt,diagram:e}},"loader"),mlr={id:mnt,detector:dlr,loader:plr},gnt="radar",glr=b(e=>/^\s*radar-beta/.test(e),"detector"),ylr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(bJe(),xJe));return{id:gnt,diagram:e}},"loader"),vlr={id:gnt,detector:glr,loader:ylr},ynt="block",xlr=b(e=>/^\s*block(-beta)?/.test(e),"detector"),blr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(QJe(),ZJe));return{id:ynt,diagram:e}},"loader"),wlr={id:ynt,detector:xlr,loader:blr},klr=wlr,vnt="treeView",Tlr=b(e=>/^\s*treeView-beta/.test(e),"detector"),Clr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(det(),fet));return{id:vnt,diagram:e}},"loader"),Slr={id:vnt,detector:Tlr,loader:Clr},Elr=Slr,xnt="architecture",Alr=b(e=>/^\s*architecture/.test(e),"detector"),_lr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Met(),Iet));return{id:xnt,diagram:e}},"loader"),Rlr={id:xnt,detector:Alr,loader:_lr},Llr=Rlr,bnt="eventmodeling",Ilr=b(e=>/^\s*eventmodeling/.test(e),"detector"),Mlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(ott(),stt));return{id:bnt,diagram:e}},"loader"),Nlr={id:bnt,detector:Ilr,loader:Mlr},Dlr=Nlr,wnt="ishikawa",Olr=b(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),Plr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(gtt(),mtt));return{id:wnt,diagram:e}},"loader"),Blr={id:wnt,detector:Olr,loader:Plr},knt="venn",Flr=b(e=>/^\s*venn-beta/.test(e),"detector"),$lr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Gtt(),ztt));return{id:knt,diagram:e}},"loader"),zlr={id:knt,detector:Flr,loader:$lr},Glr=zlr,Tnt="treemap",qlr=b(e=>/^\s*treemap/.test(e),"detector"),Vlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Utt(),Htt));return{id:Tnt,diagram:e}},"loader"),Wlr={id:Tnt,detector:qlr,loader:Vlr},Cnt="wardley",Hlr=b(e=>/^\s*wardley-beta/i.test(e),"detector"),Ulr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(drt(),frt));return{id:Cnt,diagram:e}},"loader"),Ylr={id:Cnt,detector:Hlr,loader:Ulr},Xlr=Ylr,Snt="cynefin",jlr=b(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),Klr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Trt(),krt));return{id:Snt,diagram:e}},"loader"),Zlr={id:Snt,detector:jlr,loader:Klr},Ent="railroad",Qlr=b(e=>/^\s*railroad-beta/i.test(e),"detector"),Jlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Irt(),Lrt));return{id:Ent,diagram:e}},"loader"),ecr={id:Ent,detector:Qlr,loader:Jlr},Ant="railroadEbnf",tcr=b(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),rcr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Drt(),Nrt));return{id:Ant,diagram:e}},"loader"),ncr={id:Ant,detector:tcr,loader:rcr},_nt="railroadAbnf",icr=b(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),acr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Prt(),Ort));return{id:_nt,diagram:e}},"loader"),scr={id:_nt,detector:icr,loader:acr},Rnt="railroadPeg",ocr=b(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),lcr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(zrt(),$rt));return{id:Rnt,diagram:e}},"loader"),ccr={id:Rnt,detector:ocr,loader:lcr},Grt=!1,iP=b(()=>{Grt||(Grt=!0,F5("error",Uor,e=>e.toLowerCase().trim()==="error"),F5("---",{db:{clear:b(()=>{},"clear")},styles:{},renderer:{draw:b(()=>{},"draw")},parser:{parse:b(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:b(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),a9(Kor,ilr,Llr),a9(Rsr,llr,Lor,Eor,Hsr,Jsr,ror,aor,vor,kor,Gsr,Bsr,Nsr,elr,jsr,For,Dor,qor,cor,flr,mlr,por,klr,Dlr,Elr,vlr,Blr,Wlr,ecr,ncr,scr,ccr,Glr,Xlr,Zlr))},"addDiagrams"),ucr=b(async()=>{se.debug("Loading registered diagrams");let t=(await Promise.allSettled(Object.entries(Nm).map(async([r,{detector:n,loader:i}])=>{if(i)try{u9(r)}catch{try{let{diagram:a,id:s}=await i();F5(s,a,n)}catch(a){throw se.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Nm[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){se.error(`Failed to load ${t.length} external diagrams`);for(let r of t)se.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),hcr="graphics-document document";function Lnt(e,t){e.attr("role",hcr),t!==""&&e.attr("aria-roledescription",t)}b(Lnt,"setA11yDiagramInfo");function Int(e,t,r,n){if(e.insert!==void 0){if(r){let i=`chart-desc-${n}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(r)}if(t){let i=`chart-title-${n}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}b(Int,"addSVGa11yTitleDescription");var Qse=class Mnt{constructor(t,r,n,i,a){this.type=t,this.text=r,this.db=n,this.parser=i,this.renderer=a}static{b(this,"Diagram")}static async fromText(t,r={}){let n=qt(),i=O5(t,n);t=SEe(t)+` -`;try{u9(i)}catch{let u=s4e(i);if(!u)throw new FV(`Diagram ${i} not found.`);let{id:h,diagram:f}=await u();F5(h,f)}let{db:a,parser:s,renderer:o,init:l}=u9(i);return s.parser&&(s.parser.yy=a),a.clear?.(),l?.(n),r.title&&a.setDiagramTitle?.(r.title),await s.parse(t),new Mnt(i,t,a,s,o)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},qrt=[],fcr=b(()=>{qrt.forEach(e=>{e()}),qrt=[]},"attachFunctions"),dcr=b(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Nnt(e){let t=e.match(BV);if(!t)return{text:e,metadata:{}};let r=t[1],n=r?t[2].split(` +`)),p+=h.move(f),d(),p}function n(a,s,o){let l=a.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(l);)u++;let h="$".repeat(u);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let f=-1;for(;++f<o.unsafe.length;){let d=o.unsafe[f];if(!d.atBreak)continue;let p=o.compilePattern(d),m;for(;m=p.exec(l);){let g=m.index;l.codePointAt(g)===10&&l.codePointAt(g-1)===13&&g--,l=l.slice(0,g)+" "+l.slice(m.index+1)}}return h+l+h}function i(){return"$"}}var f2e={tokenize:Abt,concrete:!0,name:"mathFlow"},h2e={tokenize:_bt,partial:!0};function Abt(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(x){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(x)}function l(x){return x===36?(e.consume(x),s++,l):s<2?r(x):(e.exit("mathFlowFenceSequence"),kr(e,u,"whitespace")(x))}function u(x){return x===null||Kt(x)?f(x):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===null||Kt(x)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),f(x)):x===36?r(x):(e.consume(x),h)}function f(x){return e.exit("mathFlowFence"),n.interrupt?t(x):e.attempt(h2e,d,y)(x)}function d(x){return e.attempt({tokenize:v,partial:!0},y,p)(x)}function p(x){return(a?kr(e,m,"linePrefix",a+1):m)(x)}function m(x){return x===null?y(x):Kt(x)?e.attempt(h2e,d,y)(x):(e.enter("mathFlowValue"),g(x))}function g(x){return x===null||Kt(x)?(e.exit("mathFlowValue"),m(x)):(e.consume(x),g)}function y(x){return e.exit("mathFlow"),t(x)}function v(x,w,C){let T=0;return kr(x,k,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function k(I){return x.enter("mathFlowFence"),x.enter("mathFlowFenceSequence"),S(I)}function S(I){return I===36?(T++,x.consume(I),S):T<s?C(I):(x.exit("mathFlowFenceSequence"),kr(x,E,"whitespace")(I))}function E(I){return I===null||Kt(I)?(x.exit("mathFlowFence"),w(I)):C(I)}}}function _bt(e,t,r){let n=this;return i;function i(s){return s===null?t(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return n.parser.lazy[n.now().line]?r(s):t(s)}}function d2e(e){let r=(e||{}).singleDollarTextMath;return r==null&&(r=!0),{tokenize:n,resolve:Rbt,previous:Lbt,name:"mathText"};function n(i,a,s){let o=this,l=0,u,h;return f;function f(y){return i.enter("mathText"),i.enter("mathTextSequence"),d(y)}function d(y){return y===36?(i.consume(y),l++,d):l<2&&!r?s(y):(i.exit("mathTextSequence"),p(y))}function p(y){return y===null?s(y):y===36?(h=i.enter("mathTextSequence"),u=0,g(y)):y===32?(i.enter("space"),i.consume(y),i.exit("space"),p):Kt(y)?(i.enter("lineEnding"),i.consume(y),i.exit("lineEnding"),p):(i.enter("mathTextData"),m(y))}function m(y){return y===null||y===32||y===36||Kt(y)?(i.exit("mathTextData"),p(y)):(i.consume(y),m)}function g(y){return y===36?(i.consume(y),u++,g):u===l?(i.exit("mathTextSequence"),i.exit("mathText"),a(y)):(h.type="mathTextData",m(y))}}}function Rbt(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[r][1].type="mathTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="mathTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function Lbt(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function xq(e){return{flow:{36:f2e},text:{36:d2e(e)}}}var Ibt={};function cA(e){let t=this,r=e||Ibt,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(xq(r)),a.push(yq()),s.push(vq(r))}function s0(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-math",...t}}),e}var kq=Dye("remarkMath",()=>cA);s0(kq.plugin,{displayName:"Remark<remarkMath>"});s0(kq.options,{displayName:"RemarkConfig<remarkMath>"});var bq="math_inline",mb=L8({},"katexOptions");s0(mb,{displayName:"Ctx<katexOptions>"});var uA=xG("math_inline",e=>({group:"inline",content:"text*",inline:!0,atom:!0,parseDOM:[{tag:`span[data-type="${bq}"]`,getContent:(t,r)=>{if(!(t instanceof HTMLElement))throw Mye(t);return Lt.from(r.text(t.dataset.value??""))}}],toDOM:t=>{let r=t.textContent,n=document.createElement("span");return n.dataset.type=bq,n.dataset.value=r,gq.render(r,n,e.get(mb.key)),n},parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,r,n)=>{t.openNode(n).addText(r.value).closeNode()}},toMarkdown:{match:t=>t.type.name===bq,runner:(t,r)=>{t.addNode("inlineMath",void 0,r.textContent)}}}));s0(uA.ctx,{displayName:"NodeSchemaCtx<mathInline>"});s0(uA.node,{displayName:"NodeSchema<mathInline>"});var p2e=vG(e=>aue(/(?:\$)([^$]+)(?:\$)$/,uA.type(e),{beforeDispatch:({tr:t,match:r,start:n})=>{t.insertText(r[1]??"",n+1)}}));s0(p2e,{displayName:"InputRule<mathInline>"});var wq="math_block",f5=xG("math_block",e=>({content:"text*",group:"block",marks:"",defining:!0,atom:!0,isolating:!0,attrs:{value:{default:""}},parseDOM:[{tag:`div[data-type="${wq}"]`,preserveWhitespace:"full",getAttrs:t=>({value:t.dataset.value??""})}],toDOM:t=>{let r=t.attrs.value,n=document.createElement("div");return n.dataset.type=wq,n.dataset.value=r,gq.render(r,n,e.get(mb.key)),n},parseMarkdown:{match:({type:t})=>t==="math",runner:(t,r,n)=>{let i=r.value;t.addNode(n,{value:i})}},toMarkdown:{match:t=>t.type.name===wq,runner:(t,r)=>{t.addNode("math",void 0,r.attrs.value)}}}));s0(f5.ctx,{displayName:"NodeSchemaCtx<mathBlock>"});s0(f5.node,{displayName:"NodeSchema<mathBlock>"});var m2e=vG(e=>new Pa(/^\$\$\s$/,(t,r,n,i)=>{let a=t.doc.resolve(n);return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),f5.type(e))?t.tr.delete(n,i).setBlockType(n,n,f5.type(e)):null}));s0(m2e,{displayName:"InputRule<mathBlock>"});var g2e=[kq,mb,uA,f5,m2e,p2e].flat();za();Gy();ac();ec();po();co();xl();ho();bs();ts();Sn();_r();Rr();hr();JU();fn();var J4="comm",pI="rule",mI="decl";var BDe="@media",FDe="@import";var $De="@supports";var zDe="@namespace",KC="@keyframes";var gI="@layer",GDe="@scope";var qDe=Math.abs,bv=String.fromCharCode;function yI(e){return e.trim()}function ZC(e,t,r){return e.replace(t,r)}function G0(e,t){return e.charCodeAt(t)|0}function q0(e,t,r){return e.slice(t,r)}function sc(e){return e.length}function vI(e){return e.length}function ew(e,t){return t.push(e),e}var xI=1,tw=1,VDe=0,Pu=0,ss=0,nw="";function bI(e,t,r,n,i,a,s,o){return{value:e,root:t,parent:r,type:n,props:i,children:a,line:xI,column:tw,length:s,return:"",siblings:o}}function WDe(){return ss}function HDe(){return ss=Pu>0?G0(nw,--Pu):0,tw--,ss===10&&(tw=1,xI--),ss}function Bu(){return ss=Pu<VDe?G0(nw,Pu++):0,tw++,ss===10&&(tw=1,xI++),ss}function V0(){return G0(nw,Pu)}function QC(){return Pu}function wI(e,t){return q0(nw,e,t)}function rw(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function UDe(e){return xI=tw=1,VDe=sc(nw=e),Pu=0,[]}function YDe(e){return nw="",e}function kI(e){return yI(wI(Pu-1,$Z(e===91?e+2:e===40?e+1:e)))}function XDe(e){for(;(ss=V0())&&ss<33;)Bu();return rw(e)>2||rw(ss)>3?"":" "}function jDe(e,t){for(;--t&&Bu()&&!(ss<48||ss>102||ss>57&&ss<65||ss>70&&ss<97););return wI(e,QC()+(t<6&&V0()==32&&Bu()==32))}function $Z(e){for(;Bu();)switch(ss){case e:return Pu;case 34:case 39:e!==34&&e!==39&&$Z(ss);break;case 40:e===41&&$Z(e);break;case 92:Bu();break}return Pu}function KDe(e,t){for(;Bu()&&e+ss!==57;)if(e+ss===84&&V0()===47)break;return"/*"+wI(t,Pu-1)+"*"+bv(e===47?e:Bu())}function ZDe(e){for(;!rw(V0());)Bu();return wI(e,Pu)}function eOe(e){return YDe(TI("",null,null,null,[""],e=UDe(e),0,[0],e))}function TI(e,t,r,n,i,a,s,o,l){for(var u=0,h=0,f=s,d=0,p=0,m=0,g=1,y=1,v=1,x=0,w=0,C="",T=i,k=a,S=n,E=C;y;)switch(m=w,w=Bu()){case 40:m!=108&&G0(E,f-1)==58?(x++,E+="("):E+=kI(w);break;case 41:x--,E+=")";break;case 34:case 39:case 91:E+=kI(w);break;case 9:case 10:case 13:case 32:if(x>0){E+=bv(w);break}E+=XDe(m);break;case 92:E+=jDe(QC()-1,7);continue;case 47:switch(V0()){case 42:case 47:ew(ANt(KDe(Bu(),QC()),t,r,l),l),(rw(m||1)==5||rw(V0()||1)==5)&&sc(E)&&q0(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*g:o[u++]=sc(E)*v;case 125*g:case 59:case 0:if(x>0&&w){E+=bv(w);break}switch(w){case 0:case 125:y=0;case 59+h:v==-1&&(E=ZC(E,/\f/g,"")),p>0&&(sc(E)-f||g===0)&&ew(p>32?JDe(E+";",n,r,f-1,l):JDe(ZC(E," ","")+";",n,r,f-2,l),l);break;case 59:E+=";";default:if(ew(S=QDe(E,t,r,u,h,i,o,C,T=[],k=[],f,a),a),w===123)if(h===0)TI(E,t,S,S,T,a,f,o,k);else{switch(d){case 99:if(G0(E,3)===110)break;case 108:if(G0(E,2)===97)break;default:h=0;case 100:case 109:case 115:}h?TI(e,S,S,n&&ew(QDe(e,S,S,0,0,i,o,C,i,T=[],f,k),k),i,k,f,o,n?T:k):TI(E,S,S,S,[""],k,0,o,k)}}u=h=p=0,g=v=1,C=E="",f=s;break;case 58:f=1+sc(E),p=m;default:if(g<1){if(w==123)--g;else if(w==125&&g++==0&&HDe()==125)continue}switch(E+=bv(w),w*g){case 38:v=h>0?1:(E+="\f",-1);break;case 44:if(x>0)break;o[u++]=(sc(E)-1)*v,v=1;break;case 64:V0()===45&&(E+=kI(Bu())),d=V0(),h=f=sc(C=E+=ZDe(QC())),w++;break;case 45:m===45&&sc(E)==2&&(g=0)}}return a}function QDe(e,t,r,n,i,a,s,o,l,u,h,f){for(var d=i-1,p=i===0?a:[""],m=vI(p),g=0,y=0,v=0;g<n;++g)for(var x=0,w=q0(e,d+1,d=qDe(y=s[g])),C=e;x<m;++x)(C=yI(y>0?p[x]+" "+w:ZC(w,/&\f/g,p[x])))&&(l[v++]=C);return bI(e,t,r,i===0?pI:o,l,u,h,f)}function ANt(e,t,r,n){return bI(e,t,r,J4,bv(WDe()),q0(e,2,-2),0,n)}function JDe(e,t,r,n,i){return bI(e,t,r,mI,q0(e,0,n),q0(e,n+1,-1),n,i)}function CI(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function tOe(e,t,r,n){switch(e.type){case gI:if(e.children.length)break;case FDe:case zDe:case mI:return e.return=e.return||e.value;case J4:return"";case KC:return e.return=e.value+"{"+CI(e.children,n)+"}";case pI:if(!sc(e.value=e.props.join(",")))return""}return sc(r=CI(e.children,n))?e.return=e.value+"{"+r+"}":""}function rOe(e){var t=vI(e);return function(r,n,i,a){for(var s="",o=0;o<t;o++)s+=e[o](r,n,i,a)||"";return s}}xb();aR();var Yrt="c4",Lsr=b(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Isr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(gOe(),mOe));return{id:Yrt,diagram:e}},"loader"),Msr={id:Yrt,detector:Lsr,loader:Isr},Nsr=Msr,Xrt="flowchart",Dsr=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),Osr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(PI(),OI));return{id:Xrt,diagram:e}},"loader"),Psr={id:Xrt,detector:Dsr,loader:Osr},Bsr=Psr,jrt="flowchart-v2",Fsr=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),$sr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(PI(),OI));return{id:jrt,diagram:e}},"loader"),zsr={id:jrt,detector:Fsr,loader:$sr},Gsr=zsr,Krt="swimlane",qsr=b(e=>/^\s*swimlane-beta\b/.test(e),"detector"),Vsr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(wOe(),bOe));return{id:Krt,diagram:e}},"loader"),Wsr={id:Krt,detector:qsr,loader:Vsr},Hsr=Wsr,Zrt="er",Usr=b(e=>/^\s*erDiagram/.test(e),"detector"),Ysr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(SOe(),COe));return{id:Zrt,diagram:e}},"loader"),Xsr={id:Zrt,detector:Usr,loader:Ysr},jsr=Xsr,Qrt="gitGraph",Ksr=b(e=>/^\s*gitGraph/.test(e),"detector"),Zsr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Oje(),Dje));return{id:Qrt,diagram:e}},"loader"),Qsr={id:Qrt,detector:Ksr,loader:Zsr},Jsr=Qsr,Jrt="gantt",eor=b(e=>/^\s*gantt/.test(e),"detector"),tor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(iKe(),nKe));return{id:Jrt,diagram:e}},"loader"),ror={id:Jrt,detector:eor,loader:tor},nor=ror,ent="info",ior=b(e=>/^\s*info/.test(e),"detector"),aor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(sKe(),aKe));return{id:ent,diagram:e}},"loader"),sor={id:ent,detector:ior,loader:aor},tnt="pie",oor=b(e=>/^\s*pie/.test(e),"detector"),lor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(uKe(),cKe));return{id:tnt,diagram:e}},"loader"),cor={id:tnt,detector:oor,loader:lor},rnt="quadrantChart",uor=b(e=>/^\s*quadrantChart/.test(e),"detector"),hor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(AKe(),EKe));return{id:rnt,diagram:e}},"loader"),dor={id:rnt,detector:uor,loader:hor},por=dor,nnt="xychart",mor=b(e=>/^\s*xychart(-beta)?/.test(e),"detector"),gor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(jKe(),XKe));return{id:nnt,diagram:e}},"loader"),yor={id:nnt,detector:mor,loader:gor},vor=yor,int="requirement",xor=b(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),bor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(QKe(),ZKe));return{id:int,diagram:e}},"loader"),wor={id:int,detector:xor,loader:bor},kor=wor,ant="sequence",Tor=b(e=>/^\s*sequenceDiagram/.test(e),"detector"),Cor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(dZe(),fZe));return{id:ant,diagram:e}},"loader"),Sor={id:ant,detector:Tor,loader:Cor},Eor=Sor,snt="class",Aor=b((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),_or=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(vZe(),yZe));return{id:snt,diagram:e}},"loader"),Ror={id:snt,detector:Aor,loader:_or},Lor=Ror,ont="classDiagram",Ior=b((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),Mor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(bZe(),xZe));return{id:ont,diagram:e}},"loader"),Nor={id:ont,detector:Ior,loader:Mor},Dor=Nor,lnt="state",Oor=b((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),Por=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(UZe(),HZe));return{id:lnt,diagram:e}},"loader"),Bor={id:lnt,detector:Oor,loader:Por},For=Bor,cnt="stateDiagram",$or=b((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),zor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(XZe(),YZe));return{id:cnt,diagram:e}},"loader"),Gor={id:cnt,detector:$or,loader:zor},qor=Gor,unt="journey",Vor=b(e=>/^\s*journey/.test(e),"detector"),Wor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(iQe(),nQe));return{id:unt,diagram:e}},"loader"),Hor={id:unt,detector:Vor,loader:Wor},Uor=Hor,Yor=b((e,t,r)=>{se.debug(`rendering svg for syntax error +`);let n=Qn(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),vn(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),hnt={draw:Yor},Xor=hnt,jor={db:{},renderer:hnt,parser:{parse:b(()=>{},"parse")}},Kor=jor,fnt="flowchart-elk",Zor=b((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),Qor=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(PI(),OI));return{id:fnt,diagram:e}},"loader"),Jor={id:fnt,detector:Zor,loader:Qor},elr=Jor,dnt="timeline",tlr=b(e=>/^\s*timeline/.test(e),"detector"),rlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(RQe(),_Qe));return{id:dnt,diagram:e}},"loader"),nlr={id:dnt,detector:tlr,loader:rlr},ilr=nlr,pnt="mindmap",alr=b(e=>/^\s*mindmap/.test(e),"detector"),slr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(PQe(),OQe));return{id:pnt,diagram:e}},"loader"),olr={id:pnt,detector:alr,loader:slr},llr=olr,mnt="kanban",clr=b(e=>/^\s*kanban/.test(e),"detector"),ulr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>($Qe(),FQe));return{id:mnt,diagram:e}},"loader"),hlr={id:mnt,detector:clr,loader:ulr},flr=hlr,gnt="sankey",dlr=b(e=>/^\s*sankey(-beta)?/.test(e),"detector"),plr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(uJe(),cJe));return{id:gnt,diagram:e}},"loader"),mlr={id:gnt,detector:dlr,loader:plr},glr=mlr,ynt="packet",ylr=b(e=>/^\s*packet(-beta)?/.test(e),"detector"),vlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(pJe(),dJe));return{id:ynt,diagram:e}},"loader"),xlr={id:ynt,detector:ylr,loader:vlr},vnt="radar",blr=b(e=>/^\s*radar-beta/.test(e),"detector"),wlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(kJe(),wJe));return{id:vnt,diagram:e}},"loader"),klr={id:vnt,detector:blr,loader:wlr},xnt="block",Tlr=b(e=>/^\s*block(-beta)?/.test(e),"detector"),Clr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(eet(),JJe));return{id:xnt,diagram:e}},"loader"),Slr={id:xnt,detector:Tlr,loader:Clr},Elr=Slr,bnt="treeView",Alr=b(e=>/^\s*treeView-beta/.test(e),"detector"),_lr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(met(),pet));return{id:bnt,diagram:e}},"loader"),Rlr={id:bnt,detector:Alr,loader:_lr},Llr=Rlr,wnt="architecture",Ilr=b(e=>/^\s*architecture/.test(e),"detector"),Mlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Det(),Net));return{id:wnt,diagram:e}},"loader"),Nlr={id:wnt,detector:Ilr,loader:Mlr},Dlr=Nlr,knt="eventmodeling",Olr=b(e=>/^\s*eventmodeling/.test(e),"detector"),Plr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(ctt(),ltt));return{id:knt,diagram:e}},"loader"),Blr={id:knt,detector:Olr,loader:Plr},Flr=Blr,Tnt="ishikawa",$lr=b(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),zlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(vtt(),ytt));return{id:Tnt,diagram:e}},"loader"),Glr={id:Tnt,detector:$lr,loader:zlr},Cnt="venn",qlr=b(e=>/^\s*venn-beta/.test(e),"detector"),Vlr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Vtt(),qtt));return{id:Cnt,diagram:e}},"loader"),Wlr={id:Cnt,detector:qlr,loader:Vlr},Hlr=Wlr,Snt="treemap",Ulr=b(e=>/^\s*treemap/.test(e),"detector"),Ylr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Xtt(),Ytt));return{id:Snt,diagram:e}},"loader"),Xlr={id:Snt,detector:Ulr,loader:Ylr},Ent="wardley",jlr=b(e=>/^\s*wardley-beta/i.test(e),"detector"),Klr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(mrt(),prt));return{id:Ent,diagram:e}},"loader"),Zlr={id:Ent,detector:jlr,loader:Klr},Qlr=Zlr,Ant="cynefin",Jlr=b(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),ecr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Srt(),Crt));return{id:Ant,diagram:e}},"loader"),tcr={id:Ant,detector:Jlr,loader:ecr},_nt="railroad",rcr=b(e=>/^\s*railroad-beta/i.test(e),"detector"),ncr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Nrt(),Mrt));return{id:_nt,diagram:e}},"loader"),icr={id:_nt,detector:rcr,loader:ncr},Rnt="railroadEbnf",acr=b(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),scr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Prt(),Ort));return{id:Rnt,diagram:e}},"loader"),ocr={id:Rnt,detector:acr,loader:scr},Lnt="railroadAbnf",lcr=b(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),ccr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(Frt(),Brt));return{id:Lnt,diagram:e}},"loader"),ucr={id:Lnt,detector:lcr,loader:ccr},Int="railroadPeg",hcr=b(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),fcr=b(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(qrt(),Grt));return{id:Int,diagram:e}},"loader"),dcr={id:Int,detector:hcr,loader:fcr},Vrt=!1,iP=b(()=>{Vrt||(Vrt=!0,F5("error",Kor,e=>e.toLowerCase().trim()==="error"),F5("---",{db:{clear:b(()=>{},"clear")},styles:{},renderer:{draw:b(()=>{},"draw")},parser:{parse:b(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:b(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),a9(elr,llr,Dlr),a9(Nsr,flr,Dor,Lor,jsr,nor,sor,cor,kor,Eor,Hsr,Gsr,Bsr,ilr,Jsr,qor,For,Uor,por,glr,xlr,vor,Elr,Flr,Llr,klr,Glr,Xlr,icr,ocr,ucr,dcr,Hlr,Qlr,tcr))},"addDiagrams"),pcr=b(async()=>{se.debug("Loading registered diagrams");let t=(await Promise.allSettled(Object.entries(Nm).map(async([r,{detector:n,loader:i}])=>{if(i)try{u9(r)}catch{try{let{diagram:a,id:s}=await i();F5(s,a,n)}catch(a){throw se.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Nm[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){se.error(`Failed to load ${t.length} external diagrams`);for(let r of t)se.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),mcr="graphics-document document";function Mnt(e,t){e.attr("role",mcr),t!==""&&e.attr("aria-roledescription",t)}b(Mnt,"setA11yDiagramInfo");function Nnt(e,t,r,n){if(e.insert!==void 0){if(r){let i=`chart-desc-${n}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(r)}if(t){let i=`chart-title-${n}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}b(Nnt,"addSVGa11yTitleDescription");var eoe=class Dnt{constructor(t,r,n,i,a){this.type=t,this.text=r,this.db=n,this.parser=i,this.renderer=a}static{b(this,"Diagram")}static async fromText(t,r={}){let n=qt(),i=O5(t,n);t=AEe(t)+` +`;try{u9(i)}catch{let u=l4e(i);if(!u)throw new zV(`Diagram ${i} not found.`);let{id:h,diagram:f}=await u();F5(h,f)}let{db:a,parser:s,renderer:o,init:l}=u9(i);return s.parser&&(s.parser.yy=a),a.clear?.(),l?.(n),r.title&&a.setDiagramTitle?.(r.title),await s.parse(t),new Dnt(i,t,a,s,o)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},Wrt=[],gcr=b(()=>{Wrt.forEach(e=>{e()}),Wrt=[]},"attachFunctions"),ycr=b(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Ont(e){let t=e.match($V);if(!t)return{text:e,metadata:{}};let r=t[1],n=r?t[2].split(` `).map(s=>s.startsWith(r)?s.slice(r.length):s).join(` -`):t[2],i=Ym(n,{schema:Um})??{};i=typeof i=="object"&&!Array.isArray(i)?i:{};let a={};return i.displayMode&&(a.displayMode=i.displayMode.toString()),i.title&&(a.title=i.title.toString()),i.config&&(a.config=i.config),{text:e.slice(t[0].length),metadata:a}}b(Nnt,"extractFrontMatter");var pcr=b(e=>e.replace(/\r\n?/g,` -`).replace(/<(\w+)([^>]*)>/g,(t,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),mcr=b(e=>{let{text:t,metadata:r}=Nnt(e),{displayMode:n,title:i,config:a={}}=r;return n&&(a.gantt||(a.gantt={}),a.gantt.displayMode=n),{title:i,config:a,text:t}},"processFrontmatter"),gcr=b(e=>{let t=pr.detectInit(e)??{},r=pr.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:n})=>n==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:xEe(e),directive:t}},"processDirectives");function eoe(e){let t=pcr(e),r=mcr(t),n=gcr(r.text),i=Rn(r.config,n.directive);return e=dcr(n.text),{code:e,title:r.title,config:i}}b(eoe,"preprocessDiagram");function Dnt(e){let t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(r)}b(Dnt,"toBase64");var ycr=5e4,vcr="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",xcr="sandbox",bcr="loose",wcr="http://www.w3.org/2000/svg",kcr="http://www.w3.org/1999/xlink",Tcr="http://www.w3.org/1999/xhtml",Ccr="100%",Scr="100%",Ecr="border:0;margin:0;",Acr="margin:0",_cr="allow-top-navigation-by-user-activation allow-popups",Rcr='The "iframe" tag is not supported by your browser.',Lcr=["foreignobject"],Icr=["dominant-baseline"];function toe(e){let t=eoe(e);return D5(),r4e(t.config??{}),t}b(toe,"processAndSetConfigs");async function Ont(e,t){iP();try{let{code:r,config:n}=toe(e);return{diagramType:(await Bnt(r)).type,config:n}}catch(r){if(t?.suppressErrors)return!1;throw r}}b(Ont,"parse");var Vrt=b((e,t,r=[])=>{let n=DV(`{ ${r.join(" !important; ")} !important; }`);return`.${e} ${t} ${n}`},"cssImportantStyles"),Mcr=b((e,t=new Map)=>{let r=new CSSStyleSheet;if(e.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${e.fontFamily}}`,r.cssRules.length),e.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${e.altFontFamily}}`,r.cssRules.length),t instanceof Map){let o=zn(e)?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(l=>{iR(l.styles)||o.forEach(u=>{r.insertRule(Vrt(l.id,u,l.styles),r.cssRules.length)}),iR(l.textStyles)||r.insertRule(Vrt(l.id,"tspan",(l?.textStyles||[]).map(u=>u.replace("color","fill"))),r.cssRules.length)})}let n="";if(e.themeCSS!==void 0)if(typeof r.replaceSync=="function"){let i=new CSSStyleSheet;i.replaceSync(e.themeCSS),n=s9(i)+` +`):t[2],i=Ym(n,{schema:Um})??{};i=typeof i=="object"&&!Array.isArray(i)?i:{};let a={};return i.displayMode&&(a.displayMode=i.displayMode.toString()),i.title&&(a.title=i.title.toString()),i.config&&(a.config=i.config),{text:e.slice(t[0].length),metadata:a}}b(Ont,"extractFrontMatter");var vcr=b(e=>e.replace(/\r\n?/g,` +`).replace(/<(\w+)([^>]*)>/g,(t,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),xcr=b(e=>{let{text:t,metadata:r}=Ont(e),{displayMode:n,title:i,config:a={}}=r;return n&&(a.gantt||(a.gantt={}),a.gantt.displayMode=n),{title:i,config:a,text:t}},"processFrontmatter"),bcr=b(e=>{let t=pr.detectInit(e)??{},r=pr.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:n})=>n==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:wEe(e),directive:t}},"processDirectives");function roe(e){let t=vcr(e),r=xcr(t),n=bcr(r.text),i=Rn(r.config,n.directive);return e=ycr(n.text),{code:e,title:r.title,config:i}}b(roe,"preprocessDiagram");function Pnt(e){let t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(r)}b(Pnt,"toBase64");var wcr=5e4,kcr="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",Tcr="sandbox",Ccr="loose",Scr="http://www.w3.org/2000/svg",Ecr="http://www.w3.org/1999/xlink",Acr="http://www.w3.org/1999/xhtml",_cr="100%",Rcr="100%",Lcr="border:0;margin:0;",Icr="margin:0",Mcr="allow-top-navigation-by-user-activation allow-popups",Ncr='The "iframe" tag is not supported by your browser.',Dcr=["foreignobject"],Ocr=["dominant-baseline"];function noe(e){let t=roe(e);return D5(),i4e(t.config??{}),t}b(noe,"processAndSetConfigs");async function Bnt(e,t){iP();try{let{code:r,config:n}=noe(e);return{diagramType:(await $nt(r)).type,config:n}}catch(r){if(t?.suppressErrors)return!1;throw r}}b(Bnt,"parse");var Hrt=b((e,t,r=[])=>{let n=PV(`{ ${r.join(" !important; ")} !important; }`);return`.${e} ${t} ${n}`},"cssImportantStyles"),Pcr=b((e,t=new Map)=>{let r=new CSSStyleSheet;if(e.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${e.fontFamily}}`,r.cssRules.length),e.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${e.altFontFamily}}`,r.cssRules.length),t instanceof Map){let o=zn(e)?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(l=>{iR(l.styles)||o.forEach(u=>{r.insertRule(Hrt(l.id,u,l.styles),r.cssRules.length)}),iR(l.textStyles)||r.insertRule(Hrt(l.id,"tspan",(l?.textStyles||[]).map(u=>u.replace("color","fill"))),r.cssRules.length)})}let n="";if(e.themeCSS!==void 0)if(typeof r.replaceSync=="function"){let i=new CSSStyleSheet;i.replaceSync(e.themeCSS),n=s9(i)+` `}else n+=`${e.themeCSS} -`;return n+s9(r)},"createCssStyles"),Ncr=b((e,t)=>CI(QDe(`${e}{${t}}`),eOe([b(function(n,i,a,s){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===KC)return;n.props=n.props.map(o=>o.startsWith(e)?o:`${e} ${o}`)}else n.type.startsWith("@")&&([...[ODe,BDe,gI,$De,"@container","@starting-style"],KC].includes(n.type)||(se.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=J4))},"addNamespace"),JDe])),"compileCSS"),Dcr=b((e,t,r,n)=>{let i=Mcr(e,r),a=u4e(t,i,{...e.themeVariables,theme:e.theme,look:e.look},n);return Ncr(n,a)},"createUserStyles"),Ocr=b((e="",t,r)=>{let n=e;return!r&&!t&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=$c(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),Pcr=b((e="",t)=>{let r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":Scr,n=Dnt(`<body style="${Acr}">${e}</body>`);return`<iframe style="width:${Ccr};height:${r};${Ecr}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${_cr}"> - ${Rcr} -</iframe>`},"putIntoIFrame"),Wrt=b((e,t,r,n,i)=>{let a=e.append("div");a.attr("id",r),n&&a.attr("style",n);let s=a.append("svg").attr("id",t).attr("width","100%").attr("xmlns",wcr);return i&&s.attr("xmlns:xlink",i),s.append("g"),e},"appendDivSvgG");function Jse(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}b(Jse,"sandboxedIframe");var Bcr=b((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),Fcr=b(async function(e,t,r){iP();let n=toe(t);t=n.code;let i=qt();se.debug(i),t.length>(i?.maxTextSize??ycr)&&(t=vcr);let a=`#${e}`,s="i"+e,o="#"+s,l="d"+e,u="#"+l,h=b(()=>{let A=ct(d?o:u).node();A&&"remove"in A&&A.remove()},"removeTempElements"),f=ct(document.body),d=i.securityLevel===xcr,p=i.securityLevel===bcr,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),d){let R=Jse(ct(r),s);f=ct(R.nodes()[0].contentDocument.body),f.node().style.margin="0"}else f=ct(r);Wrt(f,e,l,`font-family: ${m}`,kcr)}else{if(Bcr(document,e,l,s),d){let R=Jse(ct(document.body),s);f=ct(R.nodes()[0].contentDocument.body),f.node().style.margin="0"}else f=ct("body");Wrt(f,e,l)}let g,y;try{g=await Qse.fromText(t,{title:n.title})}catch(R){if(i.suppressErrorRendering)throw h(),R;g=await Qse.fromText("error"),y=R}let v=f.select(u).node(),x=g.type,w=v.firstChild,C=w.firstChild,T=g.renderer.getClasses?.(t,g),k=Dcr(i,x,T,a),S=document.createElement("style");S.innerHTML=k,w.insertBefore(S,C);try{await g.renderer.draw(t,e,"11.16.0",g)}catch(R){throw i.suppressErrorRendering?h():Wor.draw(t,e,"11.16.0"),R}let E=f.select(`${u} svg`),I=g.db.getAccTitle?.(),L=g.db.getAccDescription?.();Fnt(x,E,I,L),f.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",Tcr);let O=f.select(u).node().innerHTML;if(se.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),O=Ocr(O,d,Cu(i.arrowMarkerAbsolute)),d){let R=f.select(u+" svg").node();O=Pcr(O,R)}else p||(O=Ul.sanitize(O,{ADD_TAGS:Lcr,ADD_ATTR:Icr,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(fcr(),y)throw y;return h(),{diagramType:x,svg:O,bindFunctions:g.db.bindFunctions}},"render");function Pnt(e={}){let t=Xi({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),Jbe(t),t?.theme&&t.theme in Cf?t.themeVariables=Cf[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Cf.default.getThemeVariables(t.themeVariables));let r=typeof t=="object"?Qbe(t):OV();d5(r.logLevel),iP()}b(Pnt,"initialize");var Bnt=b((e,t={})=>{let{code:r}=eoe(e);return Qse.fromText(r,t)},"getDiagramFromText");function Fnt(e,t,r,n){Lnt(t,e),Int(t,r,n,t.attr("id"))}b(Fnt,"addA11yInfo");var W2=Object.freeze({render:Fcr,parse:Ont,getDiagramFromText:Bnt,initialize:Pnt,getConfig:qt,setConfig:PV,getSiteConfig:OV,updateSiteConfig:e4e,reset:b(()=>{D5()},"reset"),globalReset:b(()=>{D5(py)},"globalReset"),defaultConfig:py});d5(qt().logLevel);D5(qt());var $cr=b((e,t,r)=>{se.warn(e),cR(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),$nt=b(async function(e={querySelector:".mermaid"}){try{await zcr(e)}catch(t){if(cR(t)&&se.error(t.str),kp.parseError&&kp.parseError(t),!e.suppressErrors)throw se.error("Use the suppressErrors option to suppress these errors"),t}},"run"),zcr=b(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let n=W2.getConfig();se.debug(`${e?"":"No "}Callback function found`);let i;if(r)i=r;else if(t)i=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");se.debug(`Found ${i.length} diagrams`),n?.startOnLoad!==void 0&&(se.debug("Start On Load: "+n?.startOnLoad),W2.updateSiteConfig({startOnLoad:n?.startOnLoad}));let a=new pr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed),s,o=[];for(let l of Array.from(i)){if(se.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");let u=`mermaid-${a.next()}`;s=l.innerHTML,s=vR(pr.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,"<br/>");let h=pr.detectInit(s);h&&se.debug("Detected early reinit: ",h);try{let{svg:f,bindFunctions:d}=await Vnt(u,s,l);l.innerHTML=f,e&&await e(u),d&&d(l)}catch(f){$cr(f,o,kp.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),znt=b(function(e){W2.initialize(e)},"initialize"),Gcr=b(async function(e,t,r){se.warn("mermaid.init is deprecated. Please use run instead."),e&&znt(e);let n={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await $nt(n)},"init"),qcr=b(async(e,{lazyLoad:t=!0}={})=>{iP(),a9(...e),t===!1&&await ucr()},"registerExternalDiagrams"),Gnt=b(function(){if(kp.startOnLoad){let{startOnLoad:e}=W2.getConfig();e&&kp.run().catch(t=>se.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",Gnt,!1);var Vcr=b(function(e){kp.parseError=e},"setParseErrorHandler"),nP=[],Zse=!1,qnt=b(async()=>{if(!Zse){for(Zse=!0;nP.length>0;){let e=nP.shift();if(e)try{await e()}catch(t){se.error("Error executing queue",t)}}Zse=!1}},"executeQueue"),Wcr=b(async(e,t)=>new Promise((r,n)=>{let i=b(()=>new Promise((a,s)=>{W2.parse(e,t).then(o=>{a(o),r(o)},o=>{se.error("Error parsing",o),kp.parseError?.(o),s(o),n(o)})}),"performCall");nP.push(i),qnt().catch(n)}),"parse"),Vnt=b((e,t,r)=>new Promise((n,i)=>{let a=b(()=>new Promise((s,o)=>{W2.render(e,t,r).then(l=>{s(l),n(l)},l=>{se.error("Error parsing",l),kp.parseError?.(l),o(l),i(l)})}),"performCall");nP.push(a),qnt().catch(i)}),"render"),Hcr=b(()=>Object.keys(Nm).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),kp={startOnLoad:!0,mermaidAPI:W2,parse:Wcr,render:Vnt,init:Gcr,run:$nt,registerExternalDiagrams:qcr,registerLayoutLoaders:PZ,initialize:znt,parseError:void 0,contentLoaded:Gnt,setParseErrorHandler:Vcr,detectType:O5,registerIconPacks:f4,getRegisteredDiagramsMetadata:Hcr},roe=kp;var sP=Ro(Wnt());(function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:r,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=e.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=n.variable[1].inside,s=0;s<i.length;s++)a[i[s]]=e.languages.bash[i[s]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(Prism);(function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,n={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[n,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:n.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:n.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":n,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:n.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:n.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(e){var t=e.util.clone(e.languages.javascript),r=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,n=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,i=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function a(l,u){return l=l.replace(/<S>/g,function(){return r}).replace(/<BRACES>/g,function(){return n}).replace(/<SPREAD>/g,function(){return i}),RegExp(l,u)}i=a(i).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var s=function(l){return l?typeof l=="string"?l:typeof l.content=="string"?l.content:l.content.map(s).join(""):""},o=function(l){for(var u=[],h=0;h<l.length;h++){var f=l[h],d=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?u.length>0&&u[u.length-1].tagName===s(f.content[0].content[1])&&u.pop():f.content[f.content.length-1].content==="/>"||u.push({tagName:s(f.content[0].content[1]),openedBraces:0}):u.length>0&&f.type==="punctuation"&&f.content==="{"?u[u.length-1].openedBraces++:u.length>0&&u[u.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?u[u.length-1].openedBraces--:d=!0),(d||typeof f=="string")&&u.length>0&&u[u.length-1].openedBraces===0){var p=s(f);h<l.length-1&&(typeof l[h+1]=="string"||l[h+1].type==="plain-text")&&(p+=s(l[h+1]),l.splice(h+1,1)),h>0&&(typeof l[h-1]=="string"||l[h-1].type==="plain-text")&&(p=s(l[h-1])+p,l.splice(h-1,1),h--),l[h]=new e.Token("plain-text",p,null,p)}f.content&&typeof f.content!="string"&&o(f.content)}};e.hooks.add("after-tokenize",function(l){l.language!=="jsx"&&l.language!=="tsx"||o(l.tokens)})})(Prism);(function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(h){return h=h.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+a+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+a+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(f){h!==f&&(e.languages.markdown[h].inside.content.inside[f]=e.languages.markdown[f])})}),e.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function f(d){if(!(!d||typeof d=="string"))for(var p=0,m=d.length;p<m;p++){var g=d[p];if(g.type!=="code"){f(g.content);continue}var y=g.content[1],v=g.content[3];if(y&&v&&y.type==="code-language"&&v.type==="code-block"&&typeof y.content=="string"){var x=y.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");x=(/[a-z][\w-]*/i.exec(x)||[""])[0].toLowerCase();var w="language-"+x;v.alias?typeof v.alias=="string"?v.alias=[v.alias,w]:v.alias.push(w):v.alias=[w]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",d=0,p=h.classes.length;d<p;d++){var m=h.classes[d],g=/language-(.+)/.exec(m);if(g){f=g[1];break}}var y=e.languages[f];if(y)h.content=e.highlight(u(h.content),y,f);else if(f&&f!=="none"&&e.plugins.autoloader){var v="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=v,e.plugins.autoloader.loadLanguages(f,function(){var x=document.getElementById(v);x&&(x.innerHTML=e.highlight(x.textContent,e.languages[f],f))})}}});var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),o={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function u(h){var f=h.replace(s,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(d,p){if(p=p.toLowerCase(),p[0]==="#"){var m;return p[1]==="x"?m=parseInt(p.slice(2),16):m=Number(p.slice(1)),l(m)}else{var g=o[p];return g||d}}),f}e.languages.md=e.languages.markdown})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;Prism.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/};(function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",n=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+n),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+n+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby})(Prism);(function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,r=0;r<2;r++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(e){e.inside.interpolation.inside=Prism.languages.swift});(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var r=e.languages.tsx.tag;r.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+r.pattern.source+")",r.pattern.flags),r.lookbehind=!0})(Prism);(function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism);(function(e){var t=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,n="(?:"+r.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+r.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(o,l){l=(l||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return n}).replace(/<<value>>/g,function(){return o});return RegExp(u,l)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return n})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return n}).replace(/<<key>>/g,function(){return"(?:"+i+"|"+a+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(a),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);var sit=window.webkit?.messageHandlers,ea,o1="",Cp=null,rE={text:null,rectKey:null},Rk="",Ed=window.weiBeiMarkdownEditable!==!1,foe=window.weiBeiMarkdownCompactPreview===!0,oit=window.weiBeiDocumentID||"",lit=window.weiBeiMarkdownBaseURL||"",Ycr=window.weiBeiLocalImageScheme||"weibeiimage",Xcr=0,Hnt=0,jcr=0,H2=new Map,Unt="{{WEIBEI_CURSOR}}",noe="{{WEIBEI_SELECT_START}}",Ynt="{{WEIBEI_SELECT_END}}",Kcr=new Set(["note","tip","important","warning","caution","summary","abstract","quote","question","example","info","success","failure","danger","bug","todo"]),iE="[A-Za-z][A-Za-z0-9_-]*",doe="(?:\\s*>\\s*)*\\s*",cit=e=>e==="en"?"en":"zh-Hans",nE=cit(window.weiBeiInterfaceLanguage),Xnt={"zh-Hans":{note:"\u672D\u8BB0",tip:"\u63D0\u793A",important:"\u91CD\u70B9",warning:"\u7559\u5FC3",caution:"\u8C28\u614E",summary:"\u63D0\u8981",abstract:"\u6458\u8981",quote:"\u5F15\u6587",question:"\u95EE\u9898",example:"\u4F8B\u5B50",info:"\u4FE1\u606F",success:"\u53EF\u884C",failure:"\u5931\u8D25",danger:"\u98CE\u9669",bug:"\u95EE\u9898",todo:"\u5F85\u529E"},en:{note:"Note",tip:"Tip",important:"Important",warning:"Warning",caution:"Caution",summary:"Summary",abstract:"Abstract",quote:"Quote",question:"Question",example:"Example",info:"Info",success:"Success",failure:"Failure",danger:"Danger",bug:"Bug",todo:"Todo"}},Zcr=e=>Xnt[nE]?.[e]||Xnt["zh-Hans"][e]||e,jnt={"zh-Hans":{properties:"\u5C5E\u6027",bootFailed:"Milkdown \u521D\u59CB\u5316\u5931\u8D25",imageMissing:"\u56FE\u7247\u672A\u627E\u5230",inlineFootnote:"\u884C\u5185\u811A\u6CE8\uFF1A{value}",openOrCreateNote:"\u6253\u5F00\u6216\u521B\u5EFA\u7B14\u8BB0\uFF1A{value}",openSource:"\u6253\u5F00\u6765\u6E90\uFF1A{value}",embed:"\u5D4C\u5165\uFF1A{value}",mermaidRendering:"\u6B63\u5728\u6E32\u67D3 Mermaid \u56FE\u8868...",mermaidFailed:`Mermaid \u56FE\u8868\u672A\u89E3\u6790 +`;return n+s9(r)},"createCssStyles"),Bcr=b((e,t)=>CI(eOe(`${e}{${t}}`),rOe([b(function(n,i,a,s){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===KC)return;n.props=n.props.map(o=>o.startsWith(e)?o:`${e} ${o}`)}else n.type.startsWith("@")&&([...[BDe,$De,gI,GDe,"@container","@starting-style"],KC].includes(n.type)||(se.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=J4))},"addNamespace"),tOe])),"compileCSS"),Fcr=b((e,t,r,n)=>{let i=Pcr(e,r),a=f4e(t,i,{...e.themeVariables,theme:e.theme,look:e.look},n);return Bcr(n,a)},"createUserStyles"),$cr=b((e="",t,r)=>{let n=e;return!r&&!t&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=$c(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),zcr=b((e="",t)=>{let r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":Rcr,n=Pnt(`<body style="${Icr}">${e}</body>`);return`<iframe style="width:${_cr};height:${r};${Lcr}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${Mcr}"> + ${Ncr} +</iframe>`},"putIntoIFrame"),Urt=b((e,t,r,n,i)=>{let a=e.append("div");a.attr("id",r),n&&a.attr("style",n);let s=a.append("svg").attr("id",t).attr("width","100%").attr("xmlns",Scr);return i&&s.attr("xmlns:xlink",i),s.append("g"),e},"appendDivSvgG");function toe(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}b(toe,"sandboxedIframe");var Gcr=b((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),qcr=b(async function(e,t,r){iP();let n=noe(t);t=n.code;let i=qt();se.debug(i),t.length>(i?.maxTextSize??wcr)&&(t=kcr);let a=`#${e}`,s="i"+e,o="#"+s,l="d"+e,u="#"+l,h=b(()=>{let A=ct(d?o:u).node();A&&"remove"in A&&A.remove()},"removeTempElements"),f=ct(document.body),d=i.securityLevel===Tcr,p=i.securityLevel===Ccr,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),d){let R=toe(ct(r),s);f=ct(R.nodes()[0].contentDocument.body),f.node().style.margin="0"}else f=ct(r);Urt(f,e,l,`font-family: ${m}`,Ecr)}else{if(Gcr(document,e,l,s),d){let R=toe(ct(document.body),s);f=ct(R.nodes()[0].contentDocument.body),f.node().style.margin="0"}else f=ct("body");Urt(f,e,l)}let g,y;try{g=await eoe.fromText(t,{title:n.title})}catch(R){if(i.suppressErrorRendering)throw h(),R;g=await eoe.fromText("error"),y=R}let v=f.select(u).node(),x=g.type,w=v.firstChild,C=w.firstChild,T=g.renderer.getClasses?.(t,g),k=Fcr(i,x,T,a),S=document.createElement("style");S.innerHTML=k,w.insertBefore(S,C);try{await g.renderer.draw(t,e,"11.16.0",g)}catch(R){throw i.suppressErrorRendering?h():Xor.draw(t,e,"11.16.0"),R}let E=f.select(`${u} svg`),I=g.db.getAccTitle?.(),L=g.db.getAccDescription?.();znt(x,E,I,L),f.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",Acr);let O=f.select(u).node().innerHTML;if(se.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),O=$cr(O,d,Cu(i.arrowMarkerAbsolute)),d){let R=f.select(u+" svg").node();O=zcr(O,R)}else p||(O=Yl.sanitize(O,{ADD_TAGS:Dcr,ADD_ATTR:Ocr,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(gcr(),y)throw y;return h(),{diagramType:x,svg:O,bindFunctions:g.db.bindFunctions}},"render");function Fnt(e={}){let t=Xi({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),t4e(t),t?.theme&&t.theme in Cf?t.themeVariables=Cf[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Cf.default.getThemeVariables(t.themeVariables));let r=typeof t=="object"?e4e(t):BV();d5(r.logLevel),iP()}b(Fnt,"initialize");var $nt=b((e,t={})=>{let{code:r}=roe(e);return eoe.fromText(r,t)},"getDiagramFromText");function znt(e,t,r,n){Mnt(t,e),Nnt(t,r,n,t.attr("id"))}b(znt,"addA11yInfo");var W2=Object.freeze({render:qcr,parse:Bnt,getDiagramFromText:$nt,initialize:Fnt,getConfig:qt,setConfig:FV,getSiteConfig:BV,updateSiteConfig:r4e,reset:b(()=>{D5()},"reset"),globalReset:b(()=>{D5(py)},"globalReset"),defaultConfig:py});d5(qt().logLevel);D5(qt());var Vcr=b((e,t,r)=>{se.warn(e),cR(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),Gnt=b(async function(e={querySelector:".mermaid"}){try{await Wcr(e)}catch(t){if(cR(t)&&se.error(t.str),kp.parseError&&kp.parseError(t),!e.suppressErrors)throw se.error("Use the suppressErrors option to suppress these errors"),t}},"run"),Wcr=b(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let n=W2.getConfig();se.debug(`${e?"":"No "}Callback function found`);let i;if(r)i=r;else if(t)i=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");se.debug(`Found ${i.length} diagrams`),n?.startOnLoad!==void 0&&(se.debug("Start On Load: "+n?.startOnLoad),W2.updateSiteConfig({startOnLoad:n?.startOnLoad}));let a=new pr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed),s,o=[];for(let l of Array.from(i)){if(se.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");let u=`mermaid-${a.next()}`;s=l.innerHTML,s=vR(pr.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,"<br/>");let h=pr.detectInit(s);h&&se.debug("Detected early reinit: ",h);try{let{svg:f,bindFunctions:d}=await Hnt(u,s,l);l.innerHTML=f,e&&await e(u),d&&d(l)}catch(f){Vcr(f,o,kp.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),qnt=b(function(e){W2.initialize(e)},"initialize"),Hcr=b(async function(e,t,r){se.warn("mermaid.init is deprecated. Please use run instead."),e&&qnt(e);let n={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await Gnt(n)},"init"),Ucr=b(async(e,{lazyLoad:t=!0}={})=>{iP(),a9(...e),t===!1&&await pcr()},"registerExternalDiagrams"),Vnt=b(function(){if(kp.startOnLoad){let{startOnLoad:e}=W2.getConfig();e&&kp.run().catch(t=>se.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",Vnt,!1);var Ycr=b(function(e){kp.parseError=e},"setParseErrorHandler"),nP=[],Jse=!1,Wnt=b(async()=>{if(!Jse){for(Jse=!0;nP.length>0;){let e=nP.shift();if(e)try{await e()}catch(t){se.error("Error executing queue",t)}}Jse=!1}},"executeQueue"),Xcr=b(async(e,t)=>new Promise((r,n)=>{let i=b(()=>new Promise((a,s)=>{W2.parse(e,t).then(o=>{a(o),r(o)},o=>{se.error("Error parsing",o),kp.parseError?.(o),s(o),n(o)})}),"performCall");nP.push(i),Wnt().catch(n)}),"parse"),Hnt=b((e,t,r)=>new Promise((n,i)=>{let a=b(()=>new Promise((s,o)=>{W2.render(e,t,r).then(l=>{s(l),n(l)},l=>{se.error("Error parsing",l),kp.parseError?.(l),o(l),i(l)})}),"performCall");nP.push(a),Wnt().catch(i)}),"render"),jcr=b(()=>Object.keys(Nm).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),kp={startOnLoad:!0,mermaidAPI:W2,parse:Xcr,render:Hnt,init:Hcr,run:Gnt,registerExternalDiagrams:Ucr,registerLayoutLoaders:FZ,initialize:qnt,parseError:void 0,contentLoaded:Vnt,setParseErrorHandler:Ycr,detectType:O5,registerIconPacks:f4,getRegisteredDiagramsMetadata:jcr},ioe=kp;var oP=Ro(Unt());(function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:r,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=e.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=n.variable[1].inside,s=0;s<i.length;s++)a[i[s]]=e.languages.bash[i[s]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(Prism);(function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,n={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[n,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:n.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:n.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":n,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:n.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:n.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(e){var t=e.util.clone(e.languages.javascript),r=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,n=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,i=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function a(l,u){return l=l.replace(/<S>/g,function(){return r}).replace(/<BRACES>/g,function(){return n}).replace(/<SPREAD>/g,function(){return i}),RegExp(l,u)}i=a(i).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var s=function(l){return l?typeof l=="string"?l:typeof l.content=="string"?l.content:l.content.map(s).join(""):""},o=function(l){for(var u=[],h=0;h<l.length;h++){var f=l[h],d=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?u.length>0&&u[u.length-1].tagName===s(f.content[0].content[1])&&u.pop():f.content[f.content.length-1].content==="/>"||u.push({tagName:s(f.content[0].content[1]),openedBraces:0}):u.length>0&&f.type==="punctuation"&&f.content==="{"?u[u.length-1].openedBraces++:u.length>0&&u[u.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?u[u.length-1].openedBraces--:d=!0),(d||typeof f=="string")&&u.length>0&&u[u.length-1].openedBraces===0){var p=s(f);h<l.length-1&&(typeof l[h+1]=="string"||l[h+1].type==="plain-text")&&(p+=s(l[h+1]),l.splice(h+1,1)),h>0&&(typeof l[h-1]=="string"||l[h-1].type==="plain-text")&&(p=s(l[h-1])+p,l.splice(h-1,1),h--),l[h]=new e.Token("plain-text",p,null,p)}f.content&&typeof f.content!="string"&&o(f.content)}};e.hooks.add("after-tokenize",function(l){l.language!=="jsx"&&l.language!=="tsx"||o(l.tokens)})})(Prism);(function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(h){return h=h.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+a+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+a+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(f){h!==f&&(e.languages.markdown[h].inside.content.inside[f]=e.languages.markdown[f])})}),e.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function f(d){if(!(!d||typeof d=="string"))for(var p=0,m=d.length;p<m;p++){var g=d[p];if(g.type!=="code"){f(g.content);continue}var y=g.content[1],v=g.content[3];if(y&&v&&y.type==="code-language"&&v.type==="code-block"&&typeof y.content=="string"){var x=y.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");x=(/[a-z][\w-]*/i.exec(x)||[""])[0].toLowerCase();var w="language-"+x;v.alias?typeof v.alias=="string"?v.alias=[v.alias,w]:v.alias.push(w):v.alias=[w]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",d=0,p=h.classes.length;d<p;d++){var m=h.classes[d],g=/language-(.+)/.exec(m);if(g){f=g[1];break}}var y=e.languages[f];if(y)h.content=e.highlight(u(h.content),y,f);else if(f&&f!=="none"&&e.plugins.autoloader){var v="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=v,e.plugins.autoloader.loadLanguages(f,function(){var x=document.getElementById(v);x&&(x.innerHTML=e.highlight(x.textContent,e.languages[f],f))})}}});var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),o={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function u(h){var f=h.replace(s,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(d,p){if(p=p.toLowerCase(),p[0]==="#"){var m;return p[1]==="x"?m=parseInt(p.slice(2),16):m=Number(p.slice(1)),l(m)}else{var g=o[p];return g||d}}),f}e.languages.md=e.languages.markdown})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;Prism.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/};(function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",n=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+n),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+n+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby})(Prism);(function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,r=0;r<2;r++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(e){e.inside.interpolation.inside=Prism.languages.swift});(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var r=e.languages.tsx.tag;r.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+r.pattern.source+")",r.pattern.flags),r.lookbehind=!0})(Prism);(function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism);(function(e){var t=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,n="(?:"+r.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+r.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(o,l){l=(l||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return n}).replace(/<<value>>/g,function(){return o});return RegExp(u,l)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return n})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return n}).replace(/<<key>>/g,function(){return"(?:"+i+"|"+a+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(a),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);var cit=window.webkit?.messageHandlers,ea,o1="",Cp=null,rE={text:null,rectKey:null},Rk="",Ed=window.weiBeiMarkdownEditable!==!1,poe=window.weiBeiMarkdownCompactPreview===!0,uit=window.weiBeiDocumentID||"",hit=window.weiBeiMarkdownBaseURL||"",Zcr=window.weiBeiLocalImageScheme||"weibeiimage",Qcr=0,Ynt=0,Jcr=0,H2=new Map,Xnt="{{WEIBEI_CURSOR}}",aoe="{{WEIBEI_SELECT_START}}",jnt="{{WEIBEI_SELECT_END}}",eur=new Set(["note","tip","important","warning","caution","summary","abstract","quote","question","example","info","success","failure","danger","bug","todo"]),iE="[A-Za-z][A-Za-z0-9_-]*",moe="(?:\\s*>\\s*)*\\s*",fit=e=>e==="en"?"en":"zh-Hans",nE=fit(window.weiBeiInterfaceLanguage),Knt={"zh-Hans":{note:"\u672D\u8BB0",tip:"\u63D0\u793A",important:"\u91CD\u70B9",warning:"\u7559\u5FC3",caution:"\u8C28\u614E",summary:"\u63D0\u8981",abstract:"\u6458\u8981",quote:"\u5F15\u6587",question:"\u95EE\u9898",example:"\u4F8B\u5B50",info:"\u4FE1\u606F",success:"\u53EF\u884C",failure:"\u5931\u8D25",danger:"\u98CE\u9669",bug:"\u95EE\u9898",todo:"\u5F85\u529E"},en:{note:"Note",tip:"Tip",important:"Important",warning:"Warning",caution:"Caution",summary:"Summary",abstract:"Abstract",quote:"Quote",question:"Question",example:"Example",info:"Info",success:"Success",failure:"Failure",danger:"Danger",bug:"Bug",todo:"Todo"}},tur=e=>Knt[nE]?.[e]||Knt["zh-Hans"][e]||e,Znt={"zh-Hans":{properties:"\u5C5E\u6027",bootFailed:"Milkdown \u521D\u59CB\u5316\u5931\u8D25",imageMissing:"\u56FE\u7247\u672A\u627E\u5230",inlineFootnote:"\u884C\u5185\u811A\u6CE8\uFF1A{value}",openOrCreateNote:"\u6253\u5F00\u6216\u521B\u5EFA\u7B14\u8BB0\uFF1A{value}",openSource:"\u6253\u5F00\u6765\u6E90\uFF1A{value}",embed:"\u5D4C\u5165\uFF1A{value}",mermaidRendering:"\u6B63\u5728\u6E32\u67D3 Mermaid \u56FE\u8868...",mermaidFailed:`Mermaid \u56FE\u8868\u672A\u89E3\u6790 {value}`,mathError:"\u516C\u5F0F\u6CA1\u6709\u901A\u8FC7 KaTeX \u89E3\u6790\u3002\u5E38\u7528\u5199\u6CD5\uFF1Ax_i\u3001x^{2}\u3001\\frac{a}{b}\u3001\\begin{bmatrix}...\\end{bmatrix}",uploadingImage:"\u6B63\u5728\u6536\u7EB3\u56FE\u7247..."},en:{properties:"Properties",bootFailed:"Milkdown failed to initialize",imageMissing:"Image not found",inlineFootnote:"Inline footnote: {value}",openOrCreateNote:"Open or create note: {value}",openSource:"Open source: {value}",embed:"Embed: {value}",mermaidRendering:"Rendering Mermaid diagram...",mermaidFailed:`Mermaid diagram did not parse -{value}`,mathError:"KaTeX could not parse this formula. Common forms: x_i, x^{2}, \\frac{a}{b}, \\begin{bmatrix}...\\end{bmatrix}",uploadingImage:"Saving image..."}},xc=(e,t={})=>{let r=jnt[nE]?.[e]||jnt["zh-Hans"][e]||e;for(let[n,i]of Object.entries(t))r=r.split(`{${n}}`).join(String(i));return r},Qcr=()=>xc("properties"),soe=new RegExp(`^${doe}\\\\?\\[!(${iE})\\]([+-]?)(?:[ \\t]+([^\\n]+))?`,"i"),Jcr=new RegExp(`^${doe}\\\\?\\[!(?:${iE})\\][+-]?\\s*`,"i"),eur=new RegExp(`^${doe}\\\\?\\[!(?:${iE})\\][+-]?(?:[ \\t]+[^\\n]+)?$`,"i"),uit=new RegExp(`(^|\\n)\\s*(?:>\\s*)*\\\\?\\[!(?:${iE})\\][+-]?[ \\t]*`,"gi"),tur=/<br\s*\/?>/gi,hit=e=>String(e||"").replace(tur,` -`).replace(/%%[\s\S]*?%%\n?/g,"").replace(/!\[\[([^\]\n]+)\]\]/g,(t,r)=>{let n=wit(r);return n.label||n.target}).replace(/\[\[([^\]\n]+)\]\]/g,(t,r)=>{let n=goe(r);return n.display||n.target}).replace(/!\[([^\]\n]*)\]\([^\)\n]+\)/g,(t,r)=>xit(r).alt||"").replace(/\[([^\]\n]+)\]\([^\)\n]+\)/g,"$1").replace(/==([^=\n]+)==/g,"$1").replace(/~~([^~\n]+)~~/g,"$1").replace(/`([^`\n]+)`/g,"$1").replace(/\^\[([^\]\n]+)\]/g,"$1").replace(uit,"$1").replace(/(^|\n)\s*>\s?/g,"$1").replace(/(^|\n)\s*[-*+]\s+\[[ xX]\]\s*/g,"$1").replace(/[ \t]+\n/g,` +{value}`,mathError:"KaTeX could not parse this formula. Common forms: x_i, x^{2}, \\frac{a}{b}, \\begin{bmatrix}...\\end{bmatrix}",uploadingImage:"Saving image..."}},xc=(e,t={})=>{let r=Znt[nE]?.[e]||Znt["zh-Hans"][e]||e;for(let[n,i]of Object.entries(t))r=r.split(`{${n}}`).join(String(i));return r},rur=()=>xc("properties"),loe=new RegExp(`^${moe}\\\\?\\[!(${iE})\\]([+-]?)(?:[ \\t]+([^\\n]+))?`,"i"),nur=new RegExp(`^${moe}\\\\?\\[!(?:${iE})\\][+-]?\\s*`,"i"),iur=new RegExp(`^${moe}\\\\?\\[!(?:${iE})\\][+-]?(?:[ \\t]+[^\\n]+)?$`,"i"),dit=new RegExp(`(^|\\n)\\s*(?:>\\s*)*\\\\?\\[!(?:${iE})\\][+-]?[ \\t]*`,"gi"),aur=/<br\s*\/?>/gi,pit=e=>String(e||"").replace(aur,` +`).replace(/%%[\s\S]*?%%\n?/g,"").replace(/!\[\[([^\]\n]+)\]\]/g,(t,r)=>{let n=Cit(r);return n.label||n.target}).replace(/\[\[([^\]\n]+)\]\]/g,(t,r)=>{let n=voe(r);return n.display||n.target}).replace(/!\[([^\]\n]*)\]\([^\)\n]+\)/g,(t,r)=>kit(r).alt||"").replace(/\[([^\]\n]+)\]\([^\)\n]+\)/g,"$1").replace(/==([^=\n]+)==/g,"$1").replace(/~~([^~\n]+)~~/g,"$1").replace(/`([^`\n]+)`/g,"$1").replace(/\^\[([^\]\n]+)\]/g,"$1").replace(dit,"$1").replace(/(^|\n)\s*>\s?/g,"$1").replace(/(^|\n)\s*[-*+]\s+\[[ xX]\]\s*/g,"$1").replace(/[ \t]+\n/g,` `).replace(/\n{2,}/g,` -`).trim(),rur=e=>((e.textBetween?e.textBetween(0,e.content.size,` +`).trim(),sur=e=>((e.textBetween?e.textBetween(0,e.content.size,` `):e.textContent||"").split(` -`)[0]||"").trimStart(),nur=e=>{let t="";return e.descendants(r=>{if(t)return!1;if(r.type?.name!=="paragraph")return!0;let n=(r.textContent||"").trimStart();return n?(t=n,!1):!0}),t},iur=e=>rur(e).match(soe)||nur(e).match(soe),Knt=e=>e==="blockquote"||e==="block_quote",aur=(e,t,r)=>{let n=t.textBetween?t.textBetween(0,t.content.size,""):t.textContent||"",i=n.match(Jcr);if(!i)return;let a=r+1,s=a+i[0].length;Ji(e,a,s,"weibei-callout-marker");let o=n.match(eur);if(!o)return;let l=a+o[0].length;l>s&&Ji(e,s,l,"weibei-callout-heading-source")},sur=(e,t,r)=>{for(let n of t.matchAll(uit)){let i=n[1]?.length||0,a=r+(n.index||0)+i,s=r+(n.index||0)+n[0].length;Ji(e,a,s,"weibei-callout-marker")}},fit=e=>e==="inkstone"?"inkstone":"paper",U2=fit(window.weiBeiTheme),our=()=>U2==="inkstone"?{background:"#151515",primaryColor:"#1c1c1c",primaryTextColor:"#d7cbb0",primaryBorderColor:"#3a3328",lineColor:"#8b5e3c",secondaryColor:"#222222",tertiaryColor:"#171717",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'}:{background:"#fbf5e8",primaryColor:"#f6eddc",primaryTextColor:"#2e261f",primaryBorderColor:"#cbb79b",lineColor:"#7a6250",secondaryColor:"#efe4d2",tertiaryColor:"#f8f0e1",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'},lur=()=>{roe.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:our()})},dit=e=>{U2=fit(e),document.documentElement.dataset.weibeiTheme=U2,document.body&&(document.body.dataset.weibeiTheme=U2),lur()};dit(U2);var Tp=e=>{if(window.WeiBeiEditorBootFailed){window.WeiBeiEditorBootFailed(e);return}let t=document.querySelector("#editor");t&&(t.innerHTML=`<pre style="white-space:pre-wrap;color:#9f3427;padding:24px;font:13px/1.5 SFMono-Regular,Menlo,monospace;">${xc("bootFailed")} -${String(e?.stack||e)}</pre>`)};window.addEventListener("error",e=>Tp(e.error||e.message));window.addEventListener("unhandledrejection",e=>Tp(e.reason));var vc=(e,t={})=>{sit?.[e]?.postMessage({...t,documentID:oit})};document.documentElement.dataset.weibeiCompactPreview=foe?"true":"false";var Znt=0,Qnt=0,oP=()=>{foe&&(window.cancelAnimationFrame(Znt),Znt=window.requestAnimationFrame(()=>{let e=document.querySelector("#editor"),t=document.querySelector(".milkdown"),r=document.querySelector(".ProseMirror"),n=Math.ceil(Math.max(1,e?.scrollHeight||0,t?.scrollHeight||0,r?.scrollHeight||0));Math.abs(n-Qnt)<1||(Qnt=n,vc("contentHeightChanged",{height:n}))}))},cur=()=>{if(!foe||!window.ResizeObserver)return;let e=new ResizeObserver(oP),t=document.querySelector("#editor"),r=document.querySelector(".ProseMirror");t&&e.observe(t),r&&e.observe(r),oP()},pit=()=>{let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0).getBoundingClientRect();return!t||t.width+t.height===0?null:{x:t.left+t.width/2,y:t.bottom,width:t.width,height:t.height}},uur=(e,t)=>{let r=0;for(let n=t-1;n>=0&&e[n]==="\\";n-=1)r+=1;return r%2===1},Jnt=(e,t,r)=>{let n=e.indexOf(t,r);for(;n>=0&&uur(e,n);)n=e.indexOf(t,n+t.length);return n},hur=(e,t)=>{let r=String(e||""),n="",i=0;for(;i<r.length;){let a=Jnt(r,"`",i);if(a<0){n+=t(r.slice(i));break}n+=t(r.slice(i,a));let s=r.slice(a).match(/^`+/)?.[0]||"`",o=Jnt(r,s,a+s.length);if(o<0){n+=r.slice(a);break}n+=r.slice(a,o+s.length),i=o+s.length}return n},fur=e=>String(e||"").replace(/\\\[\\\[/g,"[[").replace(/\\\]\\\]/g,"]]").replace(/\\=\\=([^=\n]+?)\\=\\=/g,"==$1==").replace(/\^\\\[/g,"^[").replace(/(^|\s)\\#(?=[\p{L}\p{N}_/-])/gu,"$1#").replace(/\\\$(?=\d)/g,"$").replace(new RegExp(`^(\\s*(?:>\\s*)*)\\\\(\\[!(?:${iE})\\])`,"gim"),"$1$2"),mit=(e,t)=>{let r=String(e||"").split(/(\r?\n)/),n=!1,i="",a=0,s="";for(let o=0;o<r.length;o+=2){let l=r[o]||"",u=r[o+1]||"",h=l.match(/^\s*(?:>\s*)*(`{3,}|~{3,})/);if(h){n?h[1][0]===i&&h[1].length>=a&&(n=!1,a=0):(n=!0,i=h[1][0],a=h[1].length),s+=l+u;continue}if(n){s+=l+u;continue}let f=hur(l,t);s+=f,f.endsWith(` -`)&&u||(s+=u)}return s},dur=e=>mit(e,fur),pur=e=>String(e||"").replace(/<br\s*\/?>[ \t]*/gi,` -`),cP=e=>mit(e,pur),git=e=>{let t=e||"",r=t.match(/^(---\n[\s\S]*?\n---)(?:\n+|$)/);return r?{frontmatter:r[1],body:t.slice(r[0].length)}:{frontmatter:"",body:t}},poe=e=>{let t=dur(e),r=Rk?t.replace(/^\n+/,""):t;return Rk?`${Rk} +`)[0]||"").trimStart(),our=e=>{let t="";return e.descendants(r=>{if(t)return!1;if(r.type?.name!=="paragraph")return!0;let n=(r.textContent||"").trimStart();return n?(t=n,!1):!0}),t},lur=e=>sur(e).match(loe)||our(e).match(loe),Qnt=e=>e==="blockquote"||e==="block_quote",cur=(e,t,r)=>{let n=t.textBetween?t.textBetween(0,t.content.size,""):t.textContent||"",i=n.match(nur);if(!i)return;let a=r+1,s=a+i[0].length;Ji(e,a,s,"weibei-callout-marker");let o=n.match(iur);if(!o)return;let l=a+o[0].length;l>s&&Ji(e,s,l,"weibei-callout-heading-source")},uur=(e,t,r)=>{for(let n of t.matchAll(dit)){let i=n[1]?.length||0,a=r+(n.index||0)+i,s=r+(n.index||0)+n[0].length;Ji(e,a,s,"weibei-callout-marker")}},mit=e=>e==="inkstone"?"inkstone":"paper",U2=mit(window.weiBeiTheme),hur=()=>U2==="inkstone"?{background:"#151515",primaryColor:"#1c1c1c",primaryTextColor:"#d7cbb0",primaryBorderColor:"#3a3328",lineColor:"#8b5e3c",secondaryColor:"#222222",tertiaryColor:"#171717",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'}:{background:"#fbf5e8",primaryColor:"#f6eddc",primaryTextColor:"#2e261f",primaryBorderColor:"#cbb79b",lineColor:"#7a6250",secondaryColor:"#efe4d2",tertiaryColor:"#f8f0e1",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'},fur=()=>{ioe.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:hur()})},git=e=>{U2=mit(e),document.documentElement.dataset.weibeiTheme=U2,document.body&&(document.body.dataset.weibeiTheme=U2),fur()};git(U2);var Tp=e=>{if(window.WeiBeiEditorBootFailed){window.WeiBeiEditorBootFailed(e);return}let t=document.querySelector("#editor");t&&(t.innerHTML=`<pre style="white-space:pre-wrap;color:#9f3427;padding:24px;font:13px/1.5 SFMono-Regular,Menlo,monospace;">${xc("bootFailed")} +${String(e?.stack||e)}</pre>`)};window.addEventListener("error",e=>Tp(e.error||e.message));window.addEventListener("unhandledrejection",e=>Tp(e.reason));var Zo=(e,t={})=>{cit?.[e]?.postMessage({...t,documentID:uit})};document.documentElement.dataset.weibeiCompactPreview=poe?"true":"false";var Jnt=0,eit=0,cP=()=>{poe&&(window.cancelAnimationFrame(Jnt),Jnt=window.requestAnimationFrame(()=>{let e=document.querySelector("#editor"),t=document.querySelector(".milkdown"),r=document.querySelector(".ProseMirror"),n=Math.ceil(Math.max(1,e?.scrollHeight||0,t?.scrollHeight||0,r?.scrollHeight||0));Math.abs(n-eit)<1||(eit=n,Zo("contentHeightChanged",{height:n}))}))},dur=()=>{if(!poe||!window.ResizeObserver)return;let e=new ResizeObserver(cP),t=document.querySelector("#editor"),r=document.querySelector(".ProseMirror");t&&e.observe(t),r&&e.observe(r),cP()},yit=()=>{let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0).getBoundingClientRect();return!t||t.width+t.height===0?null:{x:t.left+t.width/2,y:t.bottom,width:t.width,height:t.height}},pur=(e,t)=>{let r=0;for(let n=t-1;n>=0&&e[n]==="\\";n-=1)r+=1;return r%2===1},tit=(e,t,r)=>{let n=e.indexOf(t,r);for(;n>=0&&pur(e,n);)n=e.indexOf(t,n+t.length);return n},mur=(e,t)=>{let r=String(e||""),n="",i=0;for(;i<r.length;){let a=tit(r,"`",i);if(a<0){n+=t(r.slice(i));break}n+=t(r.slice(i,a));let s=r.slice(a).match(/^`+/)?.[0]||"`",o=tit(r,s,a+s.length);if(o<0){n+=r.slice(a);break}n+=r.slice(a,o+s.length),i=o+s.length}return n},gur=e=>String(e||"").replace(/\\\[\\\[/g,"[[").replace(/\\\]\\\]/g,"]]").replace(/\\=\\=([^=\n]+?)\\=\\=/g,"==$1==").replace(/\^\\\[/g,"^[").replace(/(^|\s)\\#(?=[\p{L}\p{N}_/-])/gu,"$1#").replace(/\\\$(?=\d)/g,"$").replace(new RegExp(`^(\\s*(?:>\\s*)*)\\\\(\\[!(?:${iE})\\])`,"gim"),"$1$2"),vit=(e,t)=>{let r=String(e||"").split(/(\r?\n)/),n=!1,i="",a=0,s="";for(let o=0;o<r.length;o+=2){let l=r[o]||"",u=r[o+1]||"",h=l.match(/^\s*(?:>\s*)*(`{3,}|~{3,})/);if(h){n?h[1][0]===i&&h[1].length>=a&&(n=!1,a=0):(n=!0,i=h[1][0],a=h[1].length),s+=l+u;continue}if(n){s+=l+u;continue}let f=mur(l,t);s+=f,f.endsWith(` +`)&&u||(s+=u)}return s},yur=e=>vit(e,gur),vur=e=>String(e||"").replace(/<br\s*\/?>[ \t]*/gi,` +`),hP=e=>vit(e,vur),xit=e=>{let t=e||"",r=t.match(/^(---\n[\s\S]*?\n---)(?:\n+|$)/);return r?{frontmatter:r[1],body:t.slice(r[0].length)}:{frontmatter:"",body:t}},goe=e=>{let t=yur(e),r=Rk?t.replace(/^\n+/,""):t;return Rk?`${Rk} -${r}`:r},mur=e=>String(e||"").split(/\r?\n/).slice(1,-1).map(t=>{let r=t.match(/^\s*([^:#][^:]*):\s*(.*)$/);return r?{key:r[1].trim(),value:r[2].trim()||" "}:null}).filter(Boolean),moe=()=>{let e=document.querySelector("#frontmatter-panel");if(!e)return;let t=mur(Rk);e.dataset.visible=t.length>0?"true":"false",e.innerHTML=t.length>0?`<div class="frontmatter-title">${Qcr()}</div>${t.map(r=>`<div class="frontmatter-row"><span class="frontmatter-key">${ooe(r.key)}</span><span>${ooe(r.value)}</span></div>`).join("")}`:""},ooe=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),gur=e=>`${Ycr}://image?src=${encodeURIComponent(e)}`,yur=/\.(?:png|jpe?g|gif|webp|svg|avif|bmp|tiff?)(?:$|[?#])/i,yit=e=>{let r=(e||"").trim().match(/^(\d{1,4})(?:x(\d{1,4}))?$/i);return r?{width:Math.max(1,Number(r[1])),height:r[2]?Math.max(1,Number(r[2])):null}:null},vit=(e,t)=>{t&&(e.style.width=`${t.width}px`,e.style.maxWidth="100%",t.height&&(e.style.height=`${t.height}px`))},xit=e=>{let t=String(e||"").split("|"),r=t.length>1?yit(t.at(-1)):null;return{alt:r?t.slice(0,-1).join("|").trim():String(e||""),size:r}},vur=(e,t,r)=>{let n=t,i=r;for(;n<i&&/\s/.test(e[n]);)n+=1;for(;i>n&&/\s/.test(e[i-1]);)i-=1;return{start:n,end:i}},bit=e=>{let t=String(e||""),r=[],n=0,i="";for(let a=0;a<t.length;a+=1){let s=t[a],o=t[a+1];if(s==="\\"&&o==="|"){r.push({raw:t.slice(n,a),value:i,start:n,end:a}),n=a+2,i="",a+=1;continue}if(s==="|"){r.push({raw:t.slice(n,a),value:i,start:n,end:a}),n=a+1,i="";continue}i+=s}return r.push({raw:t.slice(n),value:i,start:n,end:t.length}),r},goe=e=>{let t=String(e||"").trim(),r=bit(t),i=(r.shift()||{value:"",start:0,end:0}).value.trim(),a=r,s=a.map(h=>h.value).join("|").trim(),o=a.length>0?vur(t,a[0].start,a.at(-1).end):null,l=i.indexOf("#"),u=l>=0?i.slice(0,l).trim():i;return{source:t,target:i,noteTitle:u,display:s||i,alias:s,aliasRange:o}},wit=e=>{let t=bit(String(e||"").trim()),r=(t.shift()?.value||"").trim(),n=t.at(-1),i=n?yit(n.value):null,a=i?t.slice(0,-1):t;return{target:r,size:i,label:a.map(s=>s.value).join("|").trim()}},yoe=()=>{let e=U2==="inkstone"?{background:"#151515",accent:"#a6362b",text:"#d7cbb0"}:{background:"#efe6d8",accent:"#9f3b2f",text:"#6b5148"},t=`<svg xmlns="http://www.w3.org/2000/svg" width="156" height="34" viewBox="0 0 156 34"> +${r}`:r},xur=e=>String(e||"").split(/\r?\n/).slice(1,-1).map(t=>{let r=t.match(/^\s*([^:#][^:]*):\s*(.*)$/);return r?{key:r[1].trim(),value:r[2].trim()||" "}:null}).filter(Boolean),yoe=()=>{let e=document.querySelector("#frontmatter-panel");if(!e)return;let t=xur(Rk);e.dataset.visible=t.length>0?"true":"false",e.innerHTML=t.length>0?`<div class="frontmatter-title">${rur()}</div>${t.map(r=>`<div class="frontmatter-row"><span class="frontmatter-key">${coe(r.key)}</span><span>${coe(r.value)}</span></div>`).join("")}`:""},coe=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),bur=e=>`${Zcr}://image?src=${encodeURIComponent(e)}`,wur=/\.(?:png|jpe?g|gif|webp|svg|avif|bmp|tiff?)(?:$|[?#])/i,bit=e=>{let r=(e||"").trim().match(/^(\d{1,4})(?:x(\d{1,4}))?$/i);return r?{width:Math.max(1,Number(r[1])),height:r[2]?Math.max(1,Number(r[2])):null}:null},wit=(e,t)=>{t&&(e.style.width=`${t.width}px`,e.style.maxWidth="100%",t.height&&(e.style.height=`${t.height}px`))},kit=e=>{let t=String(e||"").split("|"),r=t.length>1?bit(t.at(-1)):null;return{alt:r?t.slice(0,-1).join("|").trim():String(e||""),size:r}},kur=(e,t,r)=>{let n=t,i=r;for(;n<i&&/\s/.test(e[n]);)n+=1;for(;i>n&&/\s/.test(e[i-1]);)i-=1;return{start:n,end:i}},Tit=e=>{let t=String(e||""),r=[],n=0,i="";for(let a=0;a<t.length;a+=1){let s=t[a],o=t[a+1];if(s==="\\"&&o==="|"){r.push({raw:t.slice(n,a),value:i,start:n,end:a}),n=a+2,i="",a+=1;continue}if(s==="|"){r.push({raw:t.slice(n,a),value:i,start:n,end:a}),n=a+1,i="";continue}i+=s}return r.push({raw:t.slice(n),value:i,start:n,end:t.length}),r},voe=e=>{let t=String(e||"").trim(),r=Tit(t),i=(r.shift()||{value:"",start:0,end:0}).value.trim(),a=r,s=a.map(h=>h.value).join("|").trim(),o=a.length>0?kur(t,a[0].start,a.at(-1).end):null,l=i.indexOf("#"),u=l>=0?i.slice(0,l).trim():i;return{source:t,target:i,noteTitle:u,display:s||i,alias:s,aliasRange:o}},Cit=e=>{let t=Tit(String(e||"").trim()),r=(t.shift()?.value||"").trim(),n=t.at(-1),i=n?bit(n.value):null,a=i?t.slice(0,-1):t;return{target:r,size:i,label:a.map(s=>s.value).join("|").trim()}},xoe=()=>{let e=U2==="inkstone"?{background:"#151515",accent:"#a6362b",text:"#d7cbb0"}:{background:"#efe6d8",accent:"#9f3b2f",text:"#6b5148"},t=`<svg xmlns="http://www.w3.org/2000/svg" width="156" height="34" viewBox="0 0 156 34"> <rect width="156" height="34" rx="3" fill="${e.background}"/> <path d="M18 22l5-6 4 4 3-3 6 5" fill="none" stroke="${e.accent}" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/> <rect x="17" y="11" width="20" height="14" rx="2" fill="none" stroke="${e.accent}" stroke-width="1.2"/> - <text x="48" y="22" fill="${e.text}" font-family="-apple-system, BlinkMacSystemFont, 'Songti SC', serif" font-size="13">${ooe(xc("imageMissing"))}</text> -</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`},voe=e=>{if(!e||/^(?:https?:|data:|blob:|weibeiimage:)/i.test(e))return e;try{let t=new URL(e,lit||window.location.href).href;return/^file:/i.test(t)?gur(t):t}catch{return e}},xur=e=>{let t=[];return e.doc.descendants(r=>(r.type.name==="image"&&r.attrs.src&&t.push(r.attrs.src),!0)),t},kit=()=>{document.body.dataset.editable=Ed?"true":"false"},bur=e=>{let t=xur(e.state);Array.from(e.dom.querySelectorAll("img")).forEach((n,i)=>{let a=t[i];if(!a)return;let s=voe(a),{alt:o,size:l}=xit(n.getAttribute("alt")||"");o&&n.setAttribute("alt",o),vit(n,l),n.dataset.weibeiMarkdownSrc=a,n.dataset.weibeiImageEventsBound||(n.dataset.weibeiImageEventsBound="true",n.addEventListener("error",()=>{n.dataset.weibeiImageMissingFor=n.dataset.weibeiResolvedSrc||n.getAttribute("src")||"",n.dataset.weibeiImagePlaceholder="true",n.classList.add("weibei-image-missing"),n.setAttribute("src",yoe())}),n.addEventListener("load",()=>{n.dataset.weibeiImagePlaceholder!=="true"&&n.classList.remove("weibei-image-missing")})),!(n.dataset.weibeiImageMissingFor===s&&n.dataset.weibeiImagePlaceholder==="true")&&s&&n.getAttribute("src")!==s&&(n.dataset.weibeiResolvedSrc=s,delete n.dataset.weibeiImagePlaceholder,n.classList.remove("weibei-image-missing"),n.setAttribute("src",s))})},loe=e=>{window.cancelAnimationFrame(Hnt),Hnt=window.requestAnimationFrame(()=>bur(e))},wur=()=>{ea&&ea.action(e=>loe(e.get(Li)))},uP=()=>{if(!ea)return null;let e=ea.action(t=>t.get(Li).state.selection);return!e||e.empty?null:{from:e.from,to:e.to}},Tit=()=>ea?ea.action(e=>{let{selection:t}=e.get(Li).state;if(!t||t.empty)return"";let r=t.content().content;return hit(r.textBetween(0,r.size,` -`))}):"",Cit=()=>hit(window.getSelection()?.toString()||Tit()),Ji=(e,t,r,n,i={})=>{r<=t||e.push(mi.inline(t,r,{...i,class:n}))},eit=(e,t,r)=>{let n=e.doc.resolve(t);for(let i=n.depth;i>=0;i-=1)if(n.node(i).type.name===r)return!0;return!1},kur=(e,t,r,n,i,a)=>{for(let s of t.matchAll(n)){let o=r+(s.index||0),l=o+s[0].length;Ji(e,o,o+i,"weibei-md-marker"),Ji(e,o+i,l-i,a),Ji(e,l-i,l,"weibei-md-marker")}},Tur=(e,t,r)=>{for(let n of t.matchAll(/(^|[^\\])\^\[([^\]\n]+)\]/g)){let i=n[1]?.length||0,a=n[2]||"",s=r+(n.index||0)+i,o=s+n[0].length-i;Ji(e,s,s+2,"weibei-md-marker"),Ji(e,s+2,o-1,"weibei-inline-footnote",{title:xc("inlineFootnote",{value:a}),"aria-label":xc("inlineFootnote",{value:a})}),Ji(e,o-1,o,"weibei-md-marker")}},Cur=(e,t,r)=>{for(let n of t.matchAll(/\[\[([^\]\n]+)\]\]/g)){let i=n.index||0;if(t[i-1]==="!")continue;let a=r+i,s=a+n[0].length,o=goe(n[1]),l=o.noteTitle||o.target,u=o.target||l;Ji(e,a,a+2,"weibei-md-marker"),o.aliasRange&&o.aliasRange.end>o.aliasRange.start?(Ji(e,a+2,a+2+o.aliasRange.start,"weibei-md-marker"),Ji(e,a+2+o.aliasRange.start,a+2+o.aliasRange.end,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,a+2+o.aliasRange.end,s-2,"weibei-md-marker")):Ji(e,a+2,s-2,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,s-2,s,"weibei-md-marker")}},Sur=(e,t,r)=>{for(let n of t.matchAll(/(?:^|\s)((?:来源:|Source:)[^\n]+)/g)){let i=n[0].startsWith(n[1])?0:1,a=n[1].startsWith("\u6765\u6E90\uFF1A")?"\u6765\u6E90\uFF1A":"Source:",s=r+(n.index||0)+i,o=s+n[1].length;Ji(e,s,o,"weibei-source-reference",{role:"link",tabindex:"0",title:xc("openSource",{value:n[1].slice(a.length).trim()}),"data-source-reference":n[1]})}},Eur=(e,t,r)=>{for(let n of t.matchAll(/!\[\[([^\]\n]+)\]\]/g)){let i=r+(n.index||0),a=i+n[0].length,s=wit(n[1]);Ji(e,i,a,"weibei-embed-source"),e.push(mi.widget(a,()=>{if(yur.test(s.target)){let l=document.createElement("img");return l.className="weibei-embed-preview weibei-embed-image",l.alt=s.target,l.src=voe(s.target),vit(l,s.size),l.addEventListener("error",()=>{l.src=yoe(),l.classList.add("weibei-image-missing")}),l}let o=document.createElement("span");return o.className="weibei-embed-preview weibei-embed-note",o.textContent=xc("embed",{value:s.label||s.target}),o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("title",xc("openOrCreateNote",{value:s.target})),o.dataset.wikilinkTarget=s.target,o.dataset.wikilinkTitle=s.target,o},{side:1}))}},Aur=(e,t,r,n)=>{let i=0;for(;i<t.length;){if(n.open){let o=t.indexOf("%%",i);if(o<0){Ji(e,r+i,r+t.length,"weibei-comment");return}Ji(e,r+i,r+o+2,"weibei-comment"),n.open=!1,i=o+2;continue}let a=t.indexOf("%%",i);if(a<0)return;let s=t.indexOf("%%",a+2);if(s<0){Ji(e,r+a,r+t.length,"weibei-comment"),n.open=!0;return}Ji(e,r+a,r+s+2,"weibei-comment"),i=s+2}},_ur=(e,t,r)=>{for(let n of t.matchAll(/(^|\s)(#[\p{L}\p{N}_/-]+)\b/gu)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-tag")}for(let n of t.matchAll(/(^|\s)(\^[A-Za-z0-9-]+)\s*$/g)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-block-id")}},Rur=(e,t,r)=>{for(let n of t.matchAll(/<br\s*\/?>/gi)){let i=r+(n.index||0),a=i+n[0].length;Ji(e,i,a,"weibei-html-break-source"),e.push(mi.widget(a,()=>{let s=document.createElement("br");return s.className="weibei-html-break-preview",s},{side:1}))}},Lur=e=>{let t=document.createElement("div");return t.className="weibei-mermaid-render",t.textContent=xc("mermaidRendering"),window.setTimeout(async()=>{try{let r=`weibei-mermaid-${jcr+=1}`,{svg:n,bindFunctions:i}=await roe.render(r,e,t);t.innerHTML=n,i?.(t),t.dataset.rendered="true"}catch(r){t.classList.add("weibei-mermaid-error"),t.textContent=xc("mermaidFailed",{value:String(r?.message||r)})}},0),t},Iur=(e,t,r)=>Eit(t.attrs.language||"")!=="mermaid"?!1:(e.push(mi.node(r,r+t.nodeSize,{class:"weibei-code-block weibei-mermaid-block","data-language":"mermaid"})),e.push(mi.widget(r+t.nodeSize-1,()=>Lur(t.textContent),{side:1})),!0),Mur=e=>{let t=goe(e);return t.target||t.noteTitle},Nur=e=>{let t=e instanceof Element?e.closest(".weibei-wikilink, .weibei-embed-note[data-wikilink-title]"):null;return t?.getAttribute("data-wikilink-title")||t?.textContent?.trim()||""},coe=e=>{let t=Nur(e);return t?(vc("wikiLinkActivated",{title:t}),!0):!1},Dur=e=>(e instanceof Element?e.closest(".weibei-source-reference[data-source-reference]"):null)?.getAttribute("data-source-reference")||"",uoe=e=>{let t=Dur(e);return t?(vc("sourceReferenceActivated",{reference:t}),!0):!1},Sit=e=>{if(Ed||!(e instanceof Element))return!1;let t=e.closest('blockquote.weibei-callout[data-callout-fold="-"]');return t?(t.classList.toggle("weibei-callout-open"),!0):!1},Eit=e=>{let t=(e||"").trim().toLowerCase();return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",md:"markdown",yml:"yaml"}[t]||t},Ait=e=>typeof e=="string"?e.length:Array.isArray(e.content)?e.content.reduce((t,r)=>t+Ait(r),0):String(e.content||"").length,Our=e=>{let t=Array.isArray(e.alias)?e.alias:e.alias?[e.alias]:[];return["weibei-prism-token","token",e.type,...t].filter(Boolean).join(" ")},_it=(e,t,r)=>{let n=r;for(let i of t){let a=Ait(i);typeof i!="string"&&a>0&&(Ji(e,n,n+a,Our(i)),Array.isArray(i.content)&&_it(e,i.content,n)),n+=a}},Pur=(e,t,r)=>{let n=Eit(t.attrs.language||"");if(!(!n||!sP.default.languages[n]))try{_it(e,sP.default.tokenize(t.textContent,sP.default.languages[n]),r+1)}catch{}},Bur=()=>ea?ea.action(e=>{let t=e.get(Li),r=t.state.selection.from,n="";return t.state.doc.descendants((i,a)=>{if(!i.isText||n)return!0;let s=i.text||"",o=a,l=a+s.length;if(r<o||r>l)return!0;for(let u of s.matchAll(/\[\[([^\]\n]+)\]\]/g)){let h=o+(u.index||0),f=h+u[0].length;if(r>=h&&r<=f)return n=Mur(u[1]),!1}return!0}),n}):"",Rit=async e=>{let{alt:t,src:r}=await pG(e);if(!sit?.imageAttachmentRequested)return{alt:t,src:r};let n=`attachment-${Date.now()}-${Xcr+=1}`;return new Promise((i,a)=>{H2.set(n,{resolve:i,reject:a}),vc("imageAttachmentRequested",{id:n,name:e.name||t||"image",mime:e.type||"image/png",dataURL:r}),window.setTimeout(()=>{H2.has(n)&&(H2.delete(n),a(new Error("Attachment save timed out")))},15e3)})},Fur=e=>{let t=String(e||""),r=t.trim();return r?t.includes(` -`)?!0:/^(?:#{1,6}\s|[-*+]\s|\d+\.\s|>\s|```|~~~|\$\$|\|.*\||---$)/.test(r):!1},$ur=e=>{let t=String(e||"");return Fur(t)?` + <text x="48" y="22" fill="${e.text}" font-family="-apple-system, BlinkMacSystemFont, 'Songti SC', serif" font-size="13">${coe(xc("imageMissing"))}</text> +</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`},boe=e=>{if(!e||/^(?:https?:|data:|blob:|weibeiimage:)/i.test(e))return e;try{let t=new URL(e,hit||window.location.href).href;return/^file:/i.test(t)?bur(t):t}catch{return e}},Tur=e=>{let t=[];return e.doc.descendants(r=>(r.type.name==="image"&&r.attrs.src&&t.push(r.attrs.src),!0)),t},Sit=()=>{document.body.dataset.editable=Ed?"true":"false"},Cur=e=>{let t=Tur(e.state);Array.from(e.dom.querySelectorAll("img")).forEach((n,i)=>{let a=t[i];if(!a)return;let s=boe(a),{alt:o,size:l}=kit(n.getAttribute("alt")||"");o&&n.setAttribute("alt",o),wit(n,l),n.dataset.weibeiMarkdownSrc=a,n.dataset.weibeiImageEventsBound||(n.dataset.weibeiImageEventsBound="true",n.addEventListener("error",()=>{n.dataset.weibeiImageMissingFor=n.dataset.weibeiResolvedSrc||n.getAttribute("src")||"",n.dataset.weibeiImagePlaceholder="true",n.classList.add("weibei-image-missing"),n.setAttribute("src",xoe())}),n.addEventListener("load",()=>{n.dataset.weibeiImagePlaceholder!=="true"&&n.classList.remove("weibei-image-missing")})),!(n.dataset.weibeiImageMissingFor===s&&n.dataset.weibeiImagePlaceholder==="true")&&s&&n.getAttribute("src")!==s&&(n.dataset.weibeiResolvedSrc=s,delete n.dataset.weibeiImagePlaceholder,n.classList.remove("weibei-image-missing"),n.setAttribute("src",s))})},uoe=e=>{window.cancelAnimationFrame(Ynt),Ynt=window.requestAnimationFrame(()=>Cur(e))},Sur=()=>{ea&&ea.action(e=>uoe(e.get(Li)))},fP=()=>{if(!ea)return null;let e=ea.action(t=>t.get(Li).state.selection);return!e||e.empty?null:{from:e.from,to:e.to}},Eit=()=>ea?ea.action(e=>{let{selection:t}=e.get(Li).state;if(!t||t.empty)return"";let r=t.content().content;return pit(r.textBetween(0,r.size,` +`))}):"",Ait=()=>pit(window.getSelection()?.toString()||Eit()),Ji=(e,t,r,n,i={})=>{r<=t||e.push(mi.inline(t,r,{...i,class:n}))},rit=(e,t,r)=>{let n=e.doc.resolve(t);for(let i=n.depth;i>=0;i-=1)if(n.node(i).type.name===r)return!0;return!1},Eur=(e,t,r,n,i,a)=>{for(let s of t.matchAll(n)){let o=r+(s.index||0),l=o+s[0].length;Ji(e,o,o+i,"weibei-md-marker"),Ji(e,o+i,l-i,a),Ji(e,l-i,l,"weibei-md-marker")}},Aur=(e,t,r)=>{for(let n of t.matchAll(/(^|[^\\])\^\[([^\]\n]+)\]/g)){let i=n[1]?.length||0,a=n[2]||"",s=r+(n.index||0)+i,o=s+n[0].length-i;Ji(e,s,s+2,"weibei-md-marker"),Ji(e,s+2,o-1,"weibei-inline-footnote",{title:xc("inlineFootnote",{value:a}),"aria-label":xc("inlineFootnote",{value:a})}),Ji(e,o-1,o,"weibei-md-marker")}},_ur=(e,t,r)=>{for(let n of t.matchAll(/\[\[([^\]\n]+)\]\]/g)){let i=n.index||0;if(t[i-1]==="!")continue;let a=r+i,s=a+n[0].length,o=voe(n[1]),l=o.noteTitle||o.target,u=o.target||l;Ji(e,a,a+2,"weibei-md-marker"),o.aliasRange&&o.aliasRange.end>o.aliasRange.start?(Ji(e,a+2,a+2+o.aliasRange.start,"weibei-md-marker"),Ji(e,a+2+o.aliasRange.start,a+2+o.aliasRange.end,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,a+2+o.aliasRange.end,s-2,"weibei-md-marker")):Ji(e,a+2,s-2,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,s-2,s,"weibei-md-marker")}},Rur=(e,t,r)=>{for(let n of t.matchAll(/(?:^|\s)((?:来源:|Source:)[^\n]+)/g)){let i=n[0].startsWith(n[1])?0:1,a=n[1].startsWith("\u6765\u6E90\uFF1A")?"\u6765\u6E90\uFF1A":"Source:",s=r+(n.index||0)+i,o=s+n[1].length;Ji(e,s,o,"weibei-source-reference",{role:"link",tabindex:"0",title:xc("openSource",{value:n[1].slice(a.length).trim()}),"data-source-reference":n[1]})}},Lur=(e,t,r)=>{for(let n of t.matchAll(/!\[\[([^\]\n]+)\]\]/g)){let i=r+(n.index||0),a=i+n[0].length,s=Cit(n[1]);Ji(e,i,a,"weibei-embed-source"),e.push(mi.widget(a,()=>{if(wur.test(s.target)){let l=document.createElement("img");return l.className="weibei-embed-preview weibei-embed-image",l.alt=s.target,l.src=boe(s.target),wit(l,s.size),l.addEventListener("error",()=>{l.src=xoe(),l.classList.add("weibei-image-missing")}),l}let o=document.createElement("span");return o.className="weibei-embed-preview weibei-embed-note",o.textContent=xc("embed",{value:s.label||s.target}),o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("title",xc("openOrCreateNote",{value:s.target})),o.dataset.wikilinkTarget=s.target,o.dataset.wikilinkTitle=s.target,o},{side:1}))}},Iur=(e,t,r,n)=>{let i=0;for(;i<t.length;){if(n.open){let o=t.indexOf("%%",i);if(o<0){Ji(e,r+i,r+t.length,"weibei-comment");return}Ji(e,r+i,r+o+2,"weibei-comment"),n.open=!1,i=o+2;continue}let a=t.indexOf("%%",i);if(a<0)return;let s=t.indexOf("%%",a+2);if(s<0){Ji(e,r+a,r+t.length,"weibei-comment"),n.open=!0;return}Ji(e,r+a,r+s+2,"weibei-comment"),i=s+2}},Mur=(e,t,r)=>{for(let n of t.matchAll(/(^|\s)(#[\p{L}\p{N}_/-]+)\b/gu)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-tag")}for(let n of t.matchAll(/(^|\s)(\^[A-Za-z0-9-]+)\s*$/g)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-block-id")}},Nur=(e,t,r)=>{for(let n of t.matchAll(/<br\s*\/?>/gi)){let i=r+(n.index||0),a=i+n[0].length;Ji(e,i,a,"weibei-html-break-source"),e.push(mi.widget(a,()=>{let s=document.createElement("br");return s.className="weibei-html-break-preview",s},{side:1}))}},Dur=e=>{let t=document.createElement("div");return t.className="weibei-mermaid-render",t.textContent=xc("mermaidRendering"),window.setTimeout(async()=>{try{let r=`weibei-mermaid-${Jcr+=1}`,{svg:n,bindFunctions:i}=await ioe.render(r,e,t);t.innerHTML=n,i?.(t),t.dataset.rendered="true"}catch(r){t.classList.add("weibei-mermaid-error"),t.textContent=xc("mermaidFailed",{value:String(r?.message||r)})}},0),t},Our=(e,t,r)=>Rit(t.attrs.language||"")!=="mermaid"?!1:(e.push(mi.node(r,r+t.nodeSize,{class:"weibei-code-block weibei-mermaid-block","data-language":"mermaid"})),e.push(mi.widget(r+t.nodeSize-1,()=>Dur(t.textContent),{side:1})),!0),Pur=e=>{let t=voe(e);return t.target||t.noteTitle},Bur=e=>{let t=e instanceof Element?e.closest(".weibei-wikilink, .weibei-embed-note[data-wikilink-title]"):null;return t?.getAttribute("data-wikilink-title")||t?.textContent?.trim()||""},hoe=e=>{let t=Bur(e);return t?(Zo("wikiLinkActivated",{title:t}),!0):!1},Fur=e=>(e instanceof Element?e.closest(".weibei-source-reference[data-source-reference]"):null)?.getAttribute("data-source-reference")||"",foe=e=>{let t=Fur(e);return t?(Zo("sourceReferenceActivated",{reference:t}),!0):!1},_it=e=>{if(Ed||!(e instanceof Element))return!1;let t=e.closest('blockquote.weibei-callout[data-callout-fold="-"]');return t?(t.classList.toggle("weibei-callout-open"),!0):!1},Rit=e=>{let t=(e||"").trim().toLowerCase();return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",md:"markdown",yml:"yaml"}[t]||t},Lit=e=>typeof e=="string"?e.length:Array.isArray(e.content)?e.content.reduce((t,r)=>t+Lit(r),0):String(e.content||"").length,$ur=e=>{let t=Array.isArray(e.alias)?e.alias:e.alias?[e.alias]:[];return["weibei-prism-token","token",e.type,...t].filter(Boolean).join(" ")},Iit=(e,t,r)=>{let n=r;for(let i of t){let a=Lit(i);typeof i!="string"&&a>0&&(Ji(e,n,n+a,$ur(i)),Array.isArray(i.content)&&Iit(e,i.content,n)),n+=a}},zur=(e,t,r)=>{let n=Rit(t.attrs.language||"");if(!(!n||!oP.default.languages[n]))try{Iit(e,oP.default.tokenize(t.textContent,oP.default.languages[n]),r+1)}catch{}},Gur=()=>ea?ea.action(e=>{let t=e.get(Li),r=t.state.selection.from,n="";return t.state.doc.descendants((i,a)=>{if(!i.isText||n)return!0;let s=i.text||"",o=a,l=a+s.length;if(r<o||r>l)return!0;for(let u of s.matchAll(/\[\[([^\]\n]+)\]\]/g)){let h=o+(u.index||0),f=h+u[0].length;if(r>=h&&r<=f)return n=Pur(u[1]),!1}return!0}),n}):"",Mit=async e=>{let{alt:t,src:r}=await gG(e);if(!cit?.imageAttachmentRequested)return{alt:t,src:r};let n=`attachment-${Date.now()}-${Qcr+=1}`;return new Promise((i,a)=>{H2.set(n,{resolve:i,reject:a}),Zo("imageAttachmentRequested",{id:n,name:e.name||t||"image",mime:e.type||"image/png",dataURL:r}),window.setTimeout(()=>{H2.has(n)&&(H2.delete(n),a(new Error("Attachment save timed out")))},15e3)})},qur=e=>{let t=String(e||""),r=t.trim();return r?t.includes(` +`)?!0:/^(?:#{1,6}\s|[-*+]\s|\d+\.\s|>\s|```|~~~|\$\$|\|.*\||---$)/.test(r):!1},Vur=e=>{let t=String(e||"");return qur(t)?` ${t.trim()} -`:t},zur=()=>ea.action(e=>{let t=e.get(Li),r=null,n=null;if(t.state.doc.descendants((s,o)=>{if(!s.isText||r||n)return!0;let l=s.text||"",u=l.indexOf(noe),h=l.indexOf(Ynt);if(u>=0&&h>u)return r={startFrom:o+u,startTo:o+u+noe.length,endFrom:o+h,endTo:o+h+Ynt.length},!1;let f=l.indexOf(Unt);return f<0?!0:(n={from:o+f,to:o+f+Unt.length},!1)}),r){let s=t.state.tr.delete(r.endFrom,r.endTo).delete(r.startFrom,r.startTo),o=Math.min(r.startFrom,s.doc.content.size),l=Math.min(Math.max(o,r.endFrom-noe.length),s.doc.content.size);return s.setSelection(Pr.create(s.doc,o,l)),t.dispatch(s),!0}if(!n)return!1;let i=t.state.tr.delete(n.from,n.to),a=Math.min(n.from,i.doc.content.size);return i.setSelection(Pr.create(i.doc,a)),t.dispatch(i),!0}),Gur=()=>ea.action(e=>{let t=e.get(Li),r=Math.min(t.state.selection.to,t.state.doc.content.size);t.dispatch(t.state.tr.setSelection(Pr.create(t.state.doc,r)))}),qur=async(e,t)=>{if(!Ed)return[];let r=[];for(let a=0;a<e.length;a+=1){let s=e.item(a);s&&s.type.includes("image")&&r.push(s)}let n=t.nodes.image;return!n||r.length===0?[]:(await Promise.all(r.map(Rit))).map(({alt:a,src:s})=>n.createAndFill({alt:a,src:s})).filter(Boolean)},tit=e=>Array.from(e||[]).map(t=>t.getAsFile?.()).filter(t=>t&&t.type.includes("image")),Vur=({alt:e,src:t})=>{let r=(e||"image").replace(/[\[\]\n\r]/g," ").trim()||"image",n=String(t||"").replace(/\s/g,"%20").replace(/\)/g,"%29");return`![${r}](${n})`},rit=async e=>{if(!Ed)return;let t=await Promise.all(e.map(Rit));hoe(t.map(Vur).join(` +`:t},Wur=()=>ea.action(e=>{let t=e.get(Li),r=null,n=null;if(t.state.doc.descendants((s,o)=>{if(!s.isText||r||n)return!0;let l=s.text||"",u=l.indexOf(aoe),h=l.indexOf(jnt);if(u>=0&&h>u)return r={startFrom:o+u,startTo:o+u+aoe.length,endFrom:o+h,endTo:o+h+jnt.length},!1;let f=l.indexOf(Xnt);return f<0?!0:(n={from:o+f,to:o+f+Xnt.length},!1)}),r){let s=t.state.tr.delete(r.endFrom,r.endTo).delete(r.startFrom,r.startTo),o=Math.min(r.startFrom,s.doc.content.size),l=Math.min(Math.max(o,r.endFrom-aoe.length),s.doc.content.size);return s.setSelection(Pr.create(s.doc,o,l)),t.dispatch(s),!0}if(!n)return!1;let i=t.state.tr.delete(n.from,n.to),a=Math.min(n.from,i.doc.content.size);return i.setSelection(Pr.create(i.doc,a)),t.dispatch(i),!0}),Hur=()=>ea.action(e=>{let t=e.get(Li),r=Math.min(t.state.selection.to,t.state.doc.content.size);t.dispatch(t.state.tr.setSelection(Pr.create(t.state.doc,r)))}),Uur=async(e,t)=>{if(!Ed)return[];let r=[];for(let a=0;a<e.length;a+=1){let s=e.item(a);s&&s.type.includes("image")&&r.push(s)}let n=t.nodes.image;return!n||r.length===0?[]:(await Promise.all(r.map(Mit))).map(({alt:a,src:s})=>n.createAndFill({alt:a,src:s})).filter(Boolean)},nit=e=>Array.from(e||[]).map(t=>t.getAsFile?.()).filter(t=>t&&t.type.includes("image")),Yur=({alt:e,src:t})=>{let r=(e||"image").replace(/[\[\]\n\r]/g," ").trim()||"image",n=String(t||"").replace(/\s/g,"%20").replace(/\)/g,"%29");return`![${r}](${n})`},iit=async e=>{if(!Ed)return;let t=await Promise.all(e.map(Mit));doe(t.map(Yur).join(` -`))},nit=()=>{window.requestAnimationFrame(()=>{document.querySelectorAll(".ProseMirror .katex-error").forEach(e=>{e.getAttribute("title")||e.setAttribute("title",xc("mathError"))})})},Wur='#editor, .ProseMirror pre, .ProseMirror div[data-type="math_block"], .ProseMirror div[data-type="math-block"]',ioe=new WeakMap,Hur=e=>{if(!(e instanceof Element))return;e.classList.add("weibei-scroll-active");let t=ioe.get(e);t&&window.clearTimeout(t),ioe.set(e,window.setTimeout(()=>{e.classList.remove("weibei-scroll-active"),ioe.delete(e)},850))},Uur=()=>{document.addEventListener("scroll",e=>{let t=e.target instanceof Element?e.target.closest(Wur):null;t&&Hur(t)},!0)},Yur=new Set(["list_item","task_list_item"]),Lit=e=>(e.textContent||"").replace(/[\u200B\uFEFF]/g,"").trim(),iit=e=>{let{selection:t}=e;if(!t.empty)return null;let{$from:r}=t;for(let n=r.depth;n>0;n-=1){let i=r.node(n);if(Yur.has(i.type.name))return Lit(i).length>0?null:i.type}return null},Xur=e=>{let{state:t}=e,{$from:r}=t.selection,n=r.parent;if(n?.isTextblock!==!0||!n.textContent||Lit(n).length>0)return;let i=r.start(),a=r.end(),s=t.tr.delete(i,a);s.setSelection(Pr.create(s.doc,Math.min(i,s.doc.content.size))),e.dispatch(s)},jur=e=>{let t=iit(e.state);return t?(Xur(e),t=iit(e.state)||t,p7(t)(e.state,e.dispatch,e)):!1},Kur=rl(()=>new Ci({view(e){return loe(e),nit(),{update(t){loe(t),nit()}}},props:{handlePaste(e,t){if(!Ed)return!1;let r=tit(t.clipboardData?.items);return r.length===0?!1:(t.preventDefault(),rit(r).catch(Tp),!0)},handleDrop(e,t){if(!Ed)return!1;let r=tit(t.dataTransfer?.items);return r.length===0?!1:(t.preventDefault(),rit(r).catch(Tp),!0)},handleTextInput(e,t,r,n){if(!Ed)return!1;let i=String(n||"");if(!i)return!1;let a=Math.min(12,t),o=`${e.state.doc.textBetween(t-a,t,` +`))},ait=()=>{window.requestAnimationFrame(()=>{document.querySelectorAll(".ProseMirror .katex-error").forEach(e=>{e.getAttribute("title")||e.setAttribute("title",xc("mathError"))})})},Xur='#editor, .ProseMirror pre, .ProseMirror div[data-type="math_block"], .ProseMirror div[data-type="math-block"]',soe=new WeakMap,jur=e=>{if(!(e instanceof Element))return;e.classList.add("weibei-scroll-active");let t=soe.get(e);t&&window.clearTimeout(t),soe.set(e,window.setTimeout(()=>{e.classList.remove("weibei-scroll-active"),soe.delete(e)},850))},Kur=()=>{document.addEventListener("scroll",e=>{let t=e.target instanceof Element?e.target.closest(Xur):null;t&&jur(t)},!0)},Zur=new Set(["list_item","task_list_item"]),Nit=e=>(e.textContent||"").replace(/[\u200B\uFEFF]/g,"").trim(),sit=e=>{let{selection:t}=e;if(!t.empty)return null;let{$from:r}=t;for(let n=r.depth;n>0;n-=1){let i=r.node(n);if(Zur.has(i.type.name))return Nit(i).length>0?null:i.type}return null},Qur=e=>{let{state:t}=e,{$from:r}=t.selection,n=r.parent;if(n?.isTextblock!==!0||!n.textContent||Nit(n).length>0)return;let i=r.start(),a=r.end(),s=t.tr.delete(i,a);s.setSelection(Pr.create(s.doc,Math.min(i,s.doc.content.size))),e.dispatch(s)},Jur=e=>{let t=sit(e.state);return t?(Qur(e),t=sit(e.state)||t,p7(t)(e.state,e.dispatch,e)):!1},ehr=nl(()=>new Ci({view(e){return uoe(e),ait(),{update(t){uoe(t),ait()}}},props:{handlePaste(e,t){if(!Ed)return!1;let r=nit(t.clipboardData?.items);return r.length===0?!1:(t.preventDefault(),iit(r).catch(Tp),!0)},handleDrop(e,t){if(!Ed)return!1;let r=nit(t.dataTransfer?.items);return r.length===0?!1:(t.preventDefault(),iit(r).catch(Tp),!0)},handleTextInput(e,t,r,n){if(!Ed)return!1;let i=String(n||"");if(!i)return!1;let a=Math.min(12,t),o=`${e.state.doc.textBetween(t-a,t,` `,` -`)}${i}`.match(/<br\s*\/?>$/i);if(!o)return!1;let l=e.state.schema.nodes.hardbreak||e.state.schema.nodes.hard_break;if(!l)return!1;let u=t-(o[0].length-i.length),h=e.state.tr.replaceWith(u,r,l.create()).scrollIntoView();return h.setSelection(Pr.create(h.doc,Math.min(u+1,h.doc.content.size))),e.dispatch(h),!0},handleClick(e,t,r){return coe(r.target)||uoe(r.target)||Sit(r.target)},handleKeyDown(e,t){if(t.key==="Enter"&&Ed&&!t.shiftKey&&!t.altKey&&!t.metaKey&&!t.ctrlKey&&jur(e))return t.preventDefault(),!0;if(t.key!=="Enter"&&t.key!==" ")return!1;if(uoe(t.target))return t.preventDefault(),!0;if(!t.metaKey&&!t.ctrlKey)return!1;let r=Bur();return r?(vc("wikiLinkActivated",{title:r}),t.preventDefault(),!0):!1},decorations(e){let t=[],r={open:!1};return e.doc.descendants((n,i,a)=>{let s=n.type.name,o=a?.type?.name||"";if(Knt(s)){let l=iur(n);if(l){let u=l[1].toLowerCase(),h=Kcr.has(u)?`weibei-callout-${u}`:`weibei-callout-${u} weibei-callout-custom`;t.push(mi.node(i,i+n.nodeSize,{class:`weibei-callout weibei-callout-has-heading ${h}`,"data-callout":u,"data-callout-fold":l[2]||"","data-callout-title":(l[3]||Zcr(u)).trim()}))}}if(s==="paragraph"&&Knt(o)&&n.textContent.trimStart().match(soe)&&(t.push(mi.node(i,i+n.nodeSize,{class:"weibei-callout-heading"})),aur(t,n,i)),s==="image"&&n.attrs.src&&t.push(mi.node(i,i+n.nodeSize,{class:"weibei-image",src:voe(n.attrs.src)})),s==="code_block")return Iur(t,n,i)||(t.push(mi.node(i,i+n.nodeSize,{class:"weibei-code-block","data-language":n.attrs.language||""})),Pur(t,n,i)),!1;if(n.isText){let l=i,u=n.text||"";if((n.marks||[]).some(d=>d.type.name.toLowerCase().includes("code")))return!0;(eit(e,l,"blockquote")||eit(e,l,"block_quote"))&&sur(t,u,l),kur(t,u,l,/==([^=\n]+)==/g,2,"weibei-highlight"),Tur(t,u,l),Rur(t,u,l),Aur(t,u,l,r),Eur(t,u,l),Cur(t,u,l),Sur(t,u,l),_ur(t,u,l)}return!0}),Ui.create(e.doc,t)}}})),aoe=()=>{if(window.weiBeiSuppressSelectionReport)return;let e=Cit(),t=e?pit():null,r=t?`${Math.round(t.x)}:${Math.round(t.y)}:${Math.round(t.width)}:${Math.round(t.height)}`:"";if(!(e===rE.text&&r===rE.rectKey)){if(rE={text:e,rectKey:r},!e){Cp=null,vc("selectionChanged",{text:"",rect:null});return}Cp=uP(),vc("selectionChanged",{text:e,rect:t})}},Y2=()=>{if(!ea)throw new Error("WeiBei editor is not ready")},ait=e=>{Y2();let t=git(e||""),r=cP(t.body);Rk=t.frontmatter,moe(),ea.action(Hhe(r)),o1=poe(r),oP()},Lk=()=>(Y2(),poe(ea.action(Whe()))),hoe=e=>{Y2();let t=cP(e||""),r=Cp||uP();r?ea.action(bF(t,r)):ea.action(xF(t));let n=Lk();o1=n,Cp=null,vc("markdownChanged",{markdown:n})},Zur=e=>{Y2();let t=uP(),r=$ur(cP(e));t?ea.action(bF(r,t)):ea.action(xF(r)),zur()||Gur();let n=Lk();o1=n,Cp=null,vc("markdownChanged",{markdown:n})},Qur=e=>(Y2(),!window.weiBeiEditorCheckMode||!e?!1:ea.action(t=>{let r=t.get(Li),n=null;return r.state.doc.descendants((i,a)=>{if(!i.isText||n)return!0;let s=(i.text||"").indexOf(e);return s<0?!0:(n={from:a+s,to:a+s+e.length},!1)}),n?(r.dispatch(r.state.tr.setSelection(Pr.create(r.state.doc,n.from,n.to))),Cp=n,!0):!1})),Jur=e=>(Y2(),window.weiBeiEditorCheckMode?ea.action(t=>{let r=t.get(Li);r.focus();for(let n of String(e||"")){let{from:i,to:a}=r.state.selection,s=!1;r.someProp("handleTextInput",o=>s?!0:(s=o(r,i,a,n)===!0,s)),s||r.dispatch(r.state.tr.insertText(n,i,a))}return!0}):!1),ehr=(e,t={})=>(Y2(),window.weiBeiEditorCheckMode?ea.action(r=>{let n=r.get(Li);n.focus();let i=new KeyboardEvent("keydown",{key:e,bubbles:!0,cancelable:!0,shiftKey:t.shiftKey===!0,altKey:t.altKey===!0,metaKey:t.metaKey===!0,ctrlKey:t.ctrlKey===!0});return n.dom.dispatchEvent(i),!0}):!1);window.WeiBeiEditor={getMarkdown:Lk,setMarkdown:ait,replaceSelection:e=>{try{hoe(e)}catch(t){Tp(t)}},applyAgentPatch:e=>{try{let t=Lk();ait(`${t.trimEnd()} +`)}${i}`.match(/<br\s*\/?>$/i);if(!o)return!1;let l=e.state.schema.nodes.hardbreak||e.state.schema.nodes.hard_break;if(!l)return!1;let u=t-(o[0].length-i.length),h=e.state.tr.replaceWith(u,r,l.create()).scrollIntoView();return h.setSelection(Pr.create(h.doc,Math.min(u+1,h.doc.content.size))),e.dispatch(h),!0},handleClick(e,t,r){return hoe(r.target)||foe(r.target)||_it(r.target)},handleKeyDown(e,t){if(t.key==="Enter"&&Ed&&!t.shiftKey&&!t.altKey&&!t.metaKey&&!t.ctrlKey&&Jur(e))return t.preventDefault(),!0;if(t.key!=="Enter"&&t.key!==" ")return!1;if(foe(t.target))return t.preventDefault(),!0;if(!t.metaKey&&!t.ctrlKey)return!1;let r=Gur();return r?(Zo("wikiLinkActivated",{title:r}),t.preventDefault(),!0):!1},decorations(e){let t=[],r={open:!1};return e.doc.descendants((n,i,a)=>{let s=n.type.name,o=a?.type?.name||"";if(Qnt(s)){let l=lur(n);if(l){let u=l[1].toLowerCase(),h=eur.has(u)?`weibei-callout-${u}`:`weibei-callout-${u} weibei-callout-custom`;t.push(mi.node(i,i+n.nodeSize,{class:`weibei-callout weibei-callout-has-heading ${h}`,"data-callout":u,"data-callout-fold":l[2]||"","data-callout-title":(l[3]||tur(u)).trim()}))}}if(s==="paragraph"&&Qnt(o)&&n.textContent.trimStart().match(loe)&&(t.push(mi.node(i,i+n.nodeSize,{class:"weibei-callout-heading"})),cur(t,n,i)),s==="image"&&n.attrs.src&&t.push(mi.node(i,i+n.nodeSize,{class:"weibei-image",src:boe(n.attrs.src)})),s==="code_block")return Our(t,n,i)||(t.push(mi.node(i,i+n.nodeSize,{class:"weibei-code-block","data-language":n.attrs.language||""})),zur(t,n,i)),!1;if(n.isText){let l=i,u=n.text||"";if((n.marks||[]).some(d=>d.type.name.toLowerCase().includes("code")))return!0;(rit(e,l,"blockquote")||rit(e,l,"block_quote"))&&uur(t,u,l),Eur(t,u,l,/==([^=\n]+)==/g,2,"weibei-highlight"),Aur(t,u,l),Nur(t,u,l),Iur(t,u,l,r),Lur(t,u,l),_ur(t,u,l),Rur(t,u,l),Mur(t,u,l)}return!0}),Ui.create(e.doc,t)}}})),ooe=()=>{if(window.weiBeiSuppressSelectionReport)return;let e=Ait(),t=e?yit():null,r=t?`${Math.round(t.x)}:${Math.round(t.y)}:${Math.round(t.width)}:${Math.round(t.height)}`:"";if(!(e===rE.text&&r===rE.rectKey)){if(rE={text:e,rectKey:r},!e){Cp=null,Zo("selectionChanged",{text:"",rect:null});return}Cp=fP(),Zo("selectionChanged",{text:e,rect:t})}},Y2=()=>{if(!ea)throw new Error("WeiBei editor is not ready")},oit=e=>{Y2();let t=xit(e||""),r=hP(t.body);Rk=t.frontmatter,yoe(),ea.action(Yhe(r)),o1=goe(r),cP()},Lk=()=>(Y2(),goe(ea.action(Uhe()))),doe=e=>{Y2();let t=hP(e||""),r=Cp||fP();r?ea.action(kF(t,r)):ea.action(wF(t));let n=Lk();o1=n,Cp=null,Zo("markdownChanged",{markdown:n})},thr=e=>{Y2();let t=fP(),r=Vur(hP(e));t?ea.action(kF(r,t)):ea.action(wF(r)),Wur()||Hur();let n=Lk();o1=n,Cp=null,Zo("markdownChanged",{markdown:n})},rhr=e=>(Y2(),!window.weiBeiEditorCheckMode||!e?!1:ea.action(t=>{let r=t.get(Li),n=null;return r.state.doc.descendants((i,a)=>{if(!i.isText||n)return!0;let s=(i.text||"").indexOf(e);return s<0?!0:(n={from:a+s,to:a+s+e.length},!1)}),n?(r.dispatch(r.state.tr.setSelection(Pr.create(r.state.doc,n.from,n.to))),Cp=n,!0):!1})),nhr=e=>(Y2(),window.weiBeiEditorCheckMode?ea.action(t=>{let r=t.get(Li);r.focus();for(let n of String(e||"")){let{from:i,to:a}=r.state.selection,s=!1;r.someProp("handleTextInput",o=>s?!0:(s=o(r,i,a,n)===!0,s)),s||r.dispatch(r.state.tr.insertText(n,i,a))}return!0}):!1),ihr=(e,t={})=>(Y2(),window.weiBeiEditorCheckMode?ea.action(r=>{let n=r.get(Li);n.focus();let i=new KeyboardEvent("keydown",{key:e,bubbles:!0,cancelable:!0,shiftKey:t.shiftKey===!0,altKey:t.altKey===!0,metaKey:t.metaKey===!0,ctrlKey:t.ctrlKey===!0});return n.dom.dispatchEvent(i),!0}):!1),Dit=()=>Array.from(document.querySelectorAll(".ProseMirror h1, .ProseMirror h2, .ProseMirror h3, .ProseMirror h4")),lit=0,sP=-2,lP=()=>{window.cancelAnimationFrame(lit),lit=window.requestAnimationFrame(()=>{let e=Dit();if(e.length===0){sP!==-1&&(sP=-1,Zo("activeHeadingChanged",{index:null}));return}let t=Math.max(0,window.innerHeight*.32),r=0;e.forEach((n,i)=>{n.getBoundingClientRect().top<=t&&(r=i)}),r!==sP&&(sP=r,Zo("activeHeadingChanged",{index:r}))})},ahr=e=>{let t=Number(e),r=Dit(),n=Number.isFinite(t)?r[Math.max(0,Math.floor(t))]:null;return n?(n.scrollIntoView({block:"start",behavior:"smooth"}),window.setTimeout(lP,180),!0):!1};window.WeiBeiEditor={getMarkdown:Lk,setMarkdown:oit,replaceSelection:e=>{try{doe(e)}catch(t){Tp(t)}},applyAgentPatch:e=>{try{let t=Lk();oit(`${t.trimEnd()} ${e||""} -`);let r=Lk();o1=r,vc("markdownChanged",{markdown:r})}catch(t){Tp(t)}},askAgentWithSelection:()=>{Cp=uP()||Cp;let e=Cit();vc("askAgentWithSelection",{text:e,rect:pit()})},insertMarkdownImage:e=>{try{hoe(e)}catch(t){Tp(t)}},insertMarkdown:e=>{try{Zur(e)}catch(t){Tp(t)}},resolveAttachment:(e,t,r)=>{let n=H2.get(e);n&&(H2.delete(e),n.resolve({src:t,alt:r}))},rejectAttachment:(e,t)=>{let r=H2.get(e);r&&(H2.delete(e),r.reject(new Error(t||"Attachment save failed")))},setEditable:e=>{Ed=e!==!1,kit()},setDocumentID:e=>{oit=e||""},setMarkdownBaseURL:e=>{lit=e||"",wur()},setTheme:e=>{dit(e),document.querySelectorAll('img[data-weibei-image-placeholder="true"]').forEach(t=>{t.setAttribute("src",yoe())}),ea&&ea.action(t=>{let r=t.get(Li);r.dispatch(r.state.tr.setMeta("weibeiThemeChanged",U2))})},setInterfaceLanguage:e=>{nE=cit(e),document.documentElement.dataset.weibeiLanguage=nE,moe(),ea&&ea.action(t=>{let r=t.get(Li);r.dispatch(r.state.tr.setMeta("weibeiLanguageChanged",nE))})}};window.weiBeiEditorCheckMode&&(window.WeiBeiEditor.selectFirstTextForCheck=Qur,window.WeiBeiEditor.selectedTextForCheck=Tit,window.WeiBeiEditor.typeTextForCheck=Jur,window.WeiBeiEditor.pressKeyForCheck=ehr);var lP=git(window.initialMarkdown||"");lP.body=cP(lP.body);Rk=lP.frontmatter;moe();Ghe.make().config(e=>{e.set(vT,document.querySelector("#editor")),e.set(dT,lP.body),e.set(yT,{editable:()=>Ed}),e.set(ny.key,{uploader:qur,enableHtmlFileUploader:!0,uploadWidgetFactory:(t,r)=>{let n=document.createElement("span");return n.className="weibei-uploading",n.textContent=xc("uploadingImage"),mi.widget(t,n,r)}}),e.set(mb.key,{throwOnError:!1,strict:!1,trust:!1})}).use(Kur).use(vfe).use(qde).use(p2e).use(Rye).use(dG).config(e=>{e.get(t5).markdownUpdated((t,r)=>{let n=poe(r);n!==o1&&(o1=n,vc("markdownChanged",{markdown:n}))}),e.get(t5).selectionUpdated(()=>{requestAnimationFrame(aoe)})}).create().then(e=>{ea=e,kit(),Uur(),document.querySelector("#editor-status")?.remove(),o1=Lk(),document.addEventListener("mouseup",aoe),document.addEventListener("pointerdown",()=>{window.weiBeiSuppressSelectionReport||(Cp=null,rE.text="",rE.rectKey="",vc("selectionChanged",{text:"",rect:null}))},!0),document.addEventListener("click",t=>{!coe(t.target)&&!uoe(t.target)&&!Sit(t.target)||(t.preventDefault(),t.stopPropagation())},!0),document.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||coe(t.target)&&(t.preventDefault(),t.stopPropagation())},!0),document.addEventListener("keyup",t=>{aoe()}),cur(),vc("editorReady",{markdown:o1}),oP()}).catch(Tp);})(); +`);let r=Lk();o1=r,Zo("markdownChanged",{markdown:r})}catch(t){Tp(t)}},askAgentWithSelection:()=>{Cp=fP()||Cp;let e=Ait();Zo("askAgentWithSelection",{text:e,rect:yit()})},insertMarkdownImage:e=>{try{doe(e)}catch(t){Tp(t)}},insertMarkdown:e=>{try{thr(e)}catch(t){Tp(t)}},resolveAttachment:(e,t,r)=>{let n=H2.get(e);n&&(H2.delete(e),n.resolve({src:t,alt:r}))},rejectAttachment:(e,t)=>{let r=H2.get(e);r&&(H2.delete(e),r.reject(new Error(t||"Attachment save failed")))},setEditable:e=>{Ed=e!==!1,Sit()},setDocumentID:e=>{uit=e||""},setMarkdownBaseURL:e=>{hit=e||"",Sur()},setTheme:e=>{git(e),document.querySelectorAll('img[data-weibei-image-placeholder="true"]').forEach(t=>{t.setAttribute("src",xoe())}),ea&&ea.action(t=>{let r=t.get(Li);r.dispatch(r.state.tr.setMeta("weibeiThemeChanged",U2))})},setInterfaceLanguage:e=>{nE=fit(e),document.documentElement.dataset.weibeiLanguage=nE,yoe(),ea&&ea.action(t=>{let r=t.get(Li);r.dispatch(r.state.tr.setMeta("weibeiLanguageChanged",nE))})},scrollToHeading:ahr};window.weiBeiEditorCheckMode&&(window.WeiBeiEditor.selectFirstTextForCheck=rhr,window.WeiBeiEditor.selectedTextForCheck=Eit,window.WeiBeiEditor.typeTextForCheck=nhr,window.WeiBeiEditor.pressKeyForCheck=ihr);var uP=xit(window.initialMarkdown||"");uP.body=hP(uP.body);Rk=uP.frontmatter;yoe();Vhe.make().config(e=>{e.set(vT,document.querySelector("#editor")),e.set(dT,uP.body),e.set(yT,{editable:()=>Ed}),e.set(ny.key,{uploader:Uur,enableHtmlFileUploader:!0,uploadWidgetFactory:(t,r)=>{let n=document.createElement("span");return n.className="weibei-uploading",n.textContent=xc("uploadingImage"),mi.widget(t,n,r)}}),e.set(mb.key,{throwOnError:!1,strict:!1,trust:!1})}).use(ehr).use(bfe).use(Wde).use(g2e).use(Iye).use(mG).config(e=>{e.get(t5).markdownUpdated((t,r)=>{let n=goe(r);n!==o1&&(o1=n,Zo("markdownChanged",{markdown:n}),lP())}),e.get(t5).selectionUpdated(()=>{requestAnimationFrame(ooe)})}).create().then(e=>{ea=e,Sit(),Kur(),document.querySelector("#editor-status")?.remove(),o1=Lk(),document.addEventListener("mouseup",ooe),document.addEventListener("pointerdown",()=>{window.weiBeiSuppressSelectionReport||(Cp=null,rE.text="",rE.rectKey="",Zo("selectionChanged",{text:"",rect:null}))},!0),document.addEventListener("click",t=>{!hoe(t.target)&&!foe(t.target)&&!_it(t.target)||(t.preventDefault(),t.stopPropagation())},!0),document.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||hoe(t.target)&&(t.preventDefault(),t.stopPropagation())},!0),document.addEventListener("keyup",t=>{ooe()}),dur(),document.addEventListener("scroll",lP,!0),Zo("editorReady",{markdown:o1}),cP(),lP()}).catch(Tp);})(); /*! Bundled license information: lodash-es/lodash.js: diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 7409e0b83..b8071f7d8 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -29,6 +29,11 @@ struct ThreePaneReorderDrag: Equatable { var targetIndex: Int? } +struct PaneExpansionRequest: Equatable { + let id = UUID() + let role: WorkspacePaneRole +} + @MainActor final class WorkspaceStore: ObservableObject { @Published var importedItems: [StudyItem] = [] @@ -54,6 +59,7 @@ final class WorkspaceStore: ObservableObject { @Published var layout: WorkspaceLayout = .documentAgentNotes @Published var threePaneOrder: [WorkspacePaneRole] = WorkspacePaneRole.defaultThreePaneOrder @Published var threePaneReorderDrag: ThreePaneReorderDrag? + @Published private(set) var paneExpansionRequest: PaneExpansionRequest? @Published var agentSurface: AgentSurface = .bottomDrawer @Published var noteRenderMode: NoteRenderMode = .rich @Published var showQuietInsight = true @@ -942,6 +948,15 @@ final class WorkspaceStore: ObservableObject { threePaneReorderFrames = nextFrames } + func requestPaneExpansion(_ role: WorkspacePaneRole) { + paneExpansionRequest = PaneExpansionRequest(role: role) + } + + func completePaneExpansionRequest(_ id: UUID) { + guard paneExpansionRequest?.id == id else { return } + paneExpansionRequest = nil + } + func threePaneReorderFrameList(order: [WorkspacePaneRole], fallback: [CGRect]) -> [CGRect] { let frames = order.compactMap { threePaneReorderFrames[$0] } return frames.count == order.count ? frames : fallback diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift new file mode 100644 index 000000000..212c091cc --- /dev/null +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -0,0 +1,427 @@ +import AppKit +import Foundation +import SwiftUI + +struct ContentRailItem: Identifiable { + let id: String + let position: CGFloat + let level: Int + let title: String + let excerpt: String + let metadata: String + let previewImage: NSImage? + + init( + id: String, + position: CGFloat, + level: Int = 0, + title: String, + excerpt: String = "", + metadata: String = "", + previewImage: NSImage? = nil + ) { + self.id = id + self.position = min(max(position, 0), 1) + self.level = max(level, 0) + self.title = title + self.excerpt = excerpt + self.metadata = metadata + self.previewImage = previewImage + } +} + +enum ContentRailMetrics { + static let normalWidth: CGFloat = 28 + static let railOnlyWidth: CGFloat = 88 + static let railOnlyThreshold: CGFloat = 150 + static let snapThreshold: CGFloat = 160 + static let readableWidth: CGFloat = 240 + static let defaultReadableWidth: CGFloat = 420 +} + +struct ContentRailView: View { + let label: String + let items: [ContentRailItem] + let activeID: String? + let appearanceMode: WeiBeiAppearanceMode + let isRailOnly: Bool + let topInset: CGFloat + let bottomInset: CGFloat + let onActivate: (ContentRailItem) -> Void + let onHover: (ContentRailItem?) -> Void + + @State private var hoveredID: String? + @State private var previewID: String? + @State private var previewOpenWork: DispatchWorkItem? + @State private var previewCloseWork: DispatchWorkItem? + + init( + label: String, + items: [ContentRailItem], + activeID: String? = nil, + appearanceMode: WeiBeiAppearanceMode, + isRailOnly: Bool = false, + topInset: CGFloat = 0, + bottomInset: CGFloat = 0, + onActivate: @escaping (ContentRailItem) -> Void, + onHover: @escaping (ContentRailItem?) -> Void = { _ in } + ) { + self.label = label + self.items = items + self.activeID = activeID + self.appearanceMode = appearanceMode + self.isRailOnly = isRailOnly + self.topInset = topInset + self.bottomInset = bottomInset + self.onActivate = onActivate + self.onHover = onHover + } + + var body: some View { + GeometryReader { geometry in + railColumn(height: geometry.size.height) + } + .frame(width: railWidth) + .accessibilityElement(children: .contain) + .accessibilityLabel(Text(label)) + .animation(WeiBeiMotion.panel, value: isRailOnly) + .animation(WeiBeiMotion.hover, value: previewID) + .onChange(of: items.map(\.id)) { _, ids in + guard let previewID, !ids.contains(previewID) else { return } + closePreview(immediately: true) + } + .onDisappear { + previewOpenWork?.cancel() + previewCloseWork?.cancel() + if previewID != nil { + onHover(nil) + } + } + } + + private var railWidth: CGFloat { + isRailOnly ? ContentRailMetrics.railOnlyWidth : ContentRailMetrics.normalWidth + } + + private var previewWidth: CGFloat { + 336 + } + + private func railColumn(height: CGFloat) -> some View { + ZStack(alignment: .topLeading) { + railBackground + + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(isRailOnly ? 0.54 : 0.30)) + .frame(width: 1) + .frame(maxWidth: .infinity, alignment: .trailing) + .allowsHitTesting(false) + + if items.isEmpty { + emptyOriginMark + .position( + x: railWidth / 2, + y: railY(position: 0, height: height) + ) + } else { + let hitHeight = railHitHeight(for: height) + ForEach(items) { item in + railButton(for: item, hitHeight: hitHeight, acceptsPointer: hitHeight >= 4) + .position( + x: railWidth / 2, + y: railY(position: item.position, height: height) + ) + } + + if hitHeight < 4 { + denseRailPointerSurface(height: height) + } + } + } + .frame(width: railWidth, height: height) + } + + private var railBackground: some View { + Rectangle() + .fill( + isRailOnly + ? WeiBeiTheme.paperRaised.opacity(appearanceMode == .inkstone ? 0.18 : 0.24) + : Color.clear + ) + } + + private var emptyOriginMark: some View { + HStack(spacing: 0) { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.44)) + .frame(width: isRailOnly ? 18 : 8, height: 1.5) + Spacer(minLength: 0) + } + .padding(.horizontal, tickHorizontalInset) + .frame(width: railWidth, height: 24) + .accessibilityLabel(Text("\(label):暂无可导航内容")) + } + + private func railButton(for item: ContentRailItem, hitHeight: CGFloat, acceptsPointer: Bool) -> some View { + let active = item.id == activeID + + return Button { + activate(item) + } label: { + HStack(spacing: 0) { + Rectangle() + .fill(tickColor(itemID: item.id, active: active)) + .frame( + width: tickLength(level: item.level, active: active), + height: active ? 2.5 : 1.5 + ) + Spacer(minLength: 0) + } + .padding(.horizontal, tickHorizontalInset) + .frame(width: railWidth, height: hitHeight) + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + .accessibilityLabel(Text("\(label):\(item.title)")) + .accessibilityValue(Text(active ? "当前位置" : item.metadata)) + .help(item.title) + .allowsHitTesting(acceptsPointer) + .popover( + isPresented: previewBinding(for: item), + attachmentAnchor: .rect(.bounds), + arrowEdge: .leading + ) { + previewCard(for: item) + .frame(width: previewWidth) + .padding(4) + } + .onHover { hovering in + if hovering { + beginHover(item) + } else { + endHover(item) + } + } + .animation(WeiBeiMotion.micro, value: activeID) + .animation(WeiBeiMotion.hover, value: hoveredID) + } + + private func denseRailPointerSurface(height: CGFloat) -> some View { + Color.clear + .contentShape(Rectangle()) + .onContinuousHover { phase in + switch phase { + case .active(let location): + if let item = nearestItem(to: location.y, height: height) { + beginHover(item) + } + case .ended: + if let hoveredID, + let item = items.first(where: { $0.id == hoveredID }) { + endHover(item) + } else { + schedulePreviewClose() + } + } + } + .gesture( + SpatialTapGesture() + .onEnded { value in + guard let item = nearestItem(to: value.location.y, height: height) else { return } + activate(item) + } + ) + .frame(width: railWidth, height: height) + .accessibilityHidden(true) + } + + private var tickHorizontalInset: CGFloat { + isRailOnly ? 16 : 4 + } + + private func tickLength(level: Int, active: Bool) -> CGFloat { + if active { + return isRailOnly ? 56 : 20 + } + let base: CGFloat = isRailOnly ? 34 : 14 + let minimum: CGFloat = isRailOnly ? 10 : 6 + return max(minimum, base - CGFloat(min(level, 4)) * (isRailOnly ? 6 : 2)) + } + + private func tickColor(itemID: String, active: Bool) -> Color { + if active { + return appearanceMode == .inkstone ? WeiBeiTheme.onCinnabar : WeiBeiTheme.cinnabar + } + if hoveredID == itemID { + return WeiBeiTheme.secondaryInk.opacity(0.72) + } + return WeiBeiTheme.hairline.opacity(0.86) + } + + private func railY(position: CGFloat, height: CGFloat) -> CGFloat { + let top = max(topInset, 0) + 12 + let bottom = max(bottomInset, 0) + 12 + let available = max(height - top - bottom, 0) + return min(max(top + min(max(position, 0), 1) * available, 12), max(height - 12, 12)) + } + + private func railHitHeight(for height: CGFloat) -> CGFloat { + guard !items.isEmpty else { return 24 } + let available = max(height - max(topInset, 0) - max(bottomInset, 0) - 24, 1) + return min(24, available / CGFloat(items.count)) + } + + private func nearestItem(to y: CGFloat, height: CGFloat) -> ContentRailItem? { + guard !items.isEmpty else { return nil } + let top = max(topInset, 0) + 12 + let bottom = max(bottomInset, 0) + 12 + let available = max(height - top - bottom, 1) + let position = min(max((y - top) / available, 0), 1) + return items.min { abs($0.position - position) < abs($1.position - position) } + } + + private func previewCard(for item: ContentRailItem) -> some View { + Button { + activate(item) + } label: { + HStack(alignment: .top, spacing: item.previewImage == nil ? 0 : 12) { + if let image = item.previewImage { + Image(nsImage: image) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 88, height: 112) + .clipped() + .accessibilityHidden(true) + } + + VStack(alignment: .leading, spacing: 7) { + Text(label) + .font(.system(size: 9.5, weight: .semibold, design: .serif)) + .tracking(0.7) + .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.78)) + .lineLimit(1) + + Text(item.title) + .font(.system(size: 13.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(2) + .frame(maxWidth: .infinity, alignment: .leading) + + if !item.excerpt.isEmpty { + Text(item.excerpt) + .font(.system(size: 12.5)) + .lineSpacing(3) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .lineLimit(item.previewImage == nil ? 4 : 3) + .frame(maxWidth: .infinity, alignment: .leading) + } + + if !item.metadata.isEmpty { + Text(item.metadata) + .font(.system(size: 10.5, weight: .medium, design: .monospaced)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .lineLimit(1) + .frame(maxWidth: .infinity, alignment: .leading) + } + } + .frame(maxWidth: .infinity, alignment: .leading) + } + .padding(12) + .frame(width: previewWidth, alignment: .leading) + .background(WeiBeiTheme.paperRaised) + .overlay { + RoundedRectangle(cornerRadius: 6, style: .continuous) + .stroke(WeiBeiTheme.hairline.opacity(0.82), lineWidth: 1) + } + .clipShape(RoundedRectangle(cornerRadius: 6, style: .continuous)) + .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode == .inkstone ? 0.22 : 0.08), radius: 8, y: 4) + } + .buttonStyle(.plain) + .accessibilityLabel(Text("\(item.title),点击打开")) + .onHover { hovering in + if hovering { + holdPreview(item) + } else { + endHover(item) + } + } + } + + private func previewBinding(for item: ContentRailItem) -> Binding<Bool> { + Binding( + get: { previewID == item.id }, + set: { presented in + guard !presented, previewID == item.id else { return } + closePreview(immediately: true) + } + ) + } + + private func beginHover(_ item: ContentRailItem) { + previewCloseWork?.cancel() + previewOpenWork?.cancel() + hoveredID = item.id + + guard previewID != item.id else { + onHover(item) + return + } + + let work = DispatchWorkItem { + guard hoveredID == item.id else { return } + withAnimation(WeiBeiMotion.hover) { + previewID = item.id + } + onHover(item) + } + previewOpenWork = work + DispatchQueue.main.asyncAfter(deadline: .now() + 0.10, execute: work) + } + + private func holdPreview(_ item: ContentRailItem) { + previewCloseWork?.cancel() + hoveredID = item.id + if previewID != item.id { + withAnimation(WeiBeiMotion.hover) { + previewID = item.id + } + } + onHover(item) + } + + private func endHover(_ item: ContentRailItem) { + if hoveredID == item.id { + hoveredID = nil + } + schedulePreviewClose() + } + + private func schedulePreviewClose() { + previewCloseWork?.cancel() + let work = DispatchWorkItem { + guard hoveredID == nil else { return } + closePreview(immediately: false) + } + previewCloseWork = work + DispatchQueue.main.asyncAfter(deadline: .now() + 0.15, execute: work) + } + + private func closePreview(immediately: Bool) { + previewOpenWork?.cancel() + previewCloseWork?.cancel() + hoveredID = nil + if immediately { + previewID = nil + } else { + withAnimation(WeiBeiMotion.hover) { + previewID = nil + } + } + onHover(nil) + } + + private func activate(_ item: ContentRailItem) { + closePreview(immediately: true) + onActivate(item) + } +} diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index e9b4a764c..98ed31581 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -815,10 +815,6 @@ private struct LayoutContentView: View { numericBinding($writingLeftSplitStorage) } - private var normalSidePaneMinimum: CGFloat { - store.showLibrary ? 220 : 260 - } - @ViewBuilder private func documentPaneLayoutView() -> some View { let order = store.visibleDocumentPaneOrder @@ -836,13 +832,8 @@ private struct LayoutContentView: View { } } - private func minimumWidth(for role: WorkspacePaneRole) -> CGFloat { - switch role { - case .reader: - return 320 - case .agent, .notes: - return normalSidePaneMinimum - } + private func minimumWidth(for _: WorkspacePaneRole) -> CGFloat { + ContentRailMetrics.railOnlyWidth } @ViewBuilder @@ -853,7 +844,9 @@ private struct LayoutContentView: View { ResizableTwoPane( split: halfSplit, minFirst: minimumWidth(for: order[0]), - minSecond: minimumWidth(for: order[1]) + minSecond: minimumWidth(for: order[1]), + roles: order, + allowRailSnapping: true ) { reorderablePaneView(for: order[0]) } second: { @@ -878,7 +871,9 @@ private struct LayoutContentView: View { secondSplit: secondSplit, minFirst: minimumWidth(for: order[0]), minSecond: minimumWidth(for: order[1]), - minThird: minimumWidth(for: order[2]) + minThird: minimumWidth(for: order[2]), + roles: order, + allowRailSnapping: true ) { reorderablePaneView(for: order[0]) } second: { @@ -1423,6 +1418,8 @@ private struct ResizableTwoPane<First: View, Second: View>: NSViewRepresentable @Binding var split: CGFloat var minFirst: CGFloat = 320 var minSecond: CGFloat = 320 + var roles: [WorkspacePaneRole] = [] + var allowRailSnapping = false private let first: First private let second: Second @@ -1430,18 +1427,27 @@ private struct ResizableTwoPane<First: View, Second: View>: NSViewRepresentable split: Binding<CGFloat>, minFirst: CGFloat = 320, minSecond: CGFloat = 320, + roles: [WorkspacePaneRole] = [], + allowRailSnapping: Bool = false, @ViewBuilder first: () -> First, @ViewBuilder second: () -> Second ) { _split = split self.minFirst = minFirst self.minSecond = minSecond + self.roles = roles + self.allowRailSnapping = allowRailSnapping self.first = first() self.second = second() } func makeCoordinator() -> NativeSplitCoordinator { - NativeSplitCoordinator(kind: .two(split: $split), minimums: [minFirst, minSecond]) + NativeSplitCoordinator( + kind: .two(split: $split), + minimums: [minFirst, minSecond], + roles: roles, + allowRailSnapping: allowRailSnapping + ) } func makeNSView(context: Context) -> WeiBeiSplitView { @@ -1454,11 +1460,18 @@ private struct ResizableTwoPane<First: View, Second: View>: NSViewRepresentable } func updateNSView(_ splitView: WeiBeiSplitView, context: Context) { + context.coordinator.captureReadableWidths(in: splitView) context.coordinator.kind = .two(split: $split) context.coordinator.minimums = [minFirst, minSecond] + context.coordinator.roles = roles + context.coordinator.allowRailSnapping = allowRailSnapping + context.coordinator.onExpansionRequestHandled = { requestID in + store.completePaneExpansionRequest(requestID) + } updateHost(at: 0, in: splitView, with: first) updateHost(at: 1, in: splitView, with: second) context.coordinator.applyStoredPositionsWhenNeeded(in: splitView) + context.coordinator.handleExpansionRequest(store.paneExpansionRequest, in: splitView) } private func nativeHost<V: View>(_ view: V) -> NSHostingView<AnyView> { @@ -1483,6 +1496,8 @@ private struct ResizableThreePane<First: View, Second: View, Third: View>: NSVie var minFirst: CGFloat = 320 var minSecond: CGFloat = 260 var minThird: CGFloat = 260 + var roles: [WorkspacePaneRole] = [] + var allowRailSnapping = false var onFramesChange: (([CGRect]) -> Void)? = nil private let first: First private let second: Second @@ -1494,6 +1509,8 @@ private struct ResizableThreePane<First: View, Second: View, Third: View>: NSVie minFirst: CGFloat = 320, minSecond: CGFloat = 260, minThird: CGFloat = 260, + roles: [WorkspacePaneRole] = [], + allowRailSnapping: Bool = false, @ViewBuilder first: () -> First, @ViewBuilder second: () -> Second, @ViewBuilder third: () -> Third, @@ -1504,6 +1521,8 @@ private struct ResizableThreePane<First: View, Second: View, Third: View>: NSVie self.minFirst = minFirst self.minSecond = minSecond self.minThird = minThird + self.roles = roles + self.allowRailSnapping = allowRailSnapping self.onFramesChange = onFramesChange self.first = first() self.second = second() @@ -1511,7 +1530,13 @@ private struct ResizableThreePane<First: View, Second: View, Third: View>: NSVie } func makeCoordinator() -> NativeSplitCoordinator { - NativeSplitCoordinator(kind: .three(first: $firstSplit, second: $secondSplit), minimums: [minFirst, minSecond, minThird], onFramesChange: onFramesChange) + NativeSplitCoordinator( + kind: .three(first: $firstSplit, second: $secondSplit), + minimums: [minFirst, minSecond, minThird], + roles: roles, + allowRailSnapping: allowRailSnapping, + onFramesChange: onFramesChange + ) } func makeNSView(context: Context) -> WeiBeiSplitView { @@ -1525,13 +1550,20 @@ private struct ResizableThreePane<First: View, Second: View, Third: View>: NSVie } func updateNSView(_ splitView: WeiBeiSplitView, context: Context) { + context.coordinator.captureReadableWidths(in: splitView) context.coordinator.kind = .three(first: $firstSplit, second: $secondSplit) context.coordinator.minimums = [minFirst, minSecond, minThird] + context.coordinator.roles = roles + context.coordinator.allowRailSnapping = allowRailSnapping context.coordinator.onFramesChange = onFramesChange + context.coordinator.onExpansionRequestHandled = { requestID in + store.completePaneExpansionRequest(requestID) + } updateHost(at: 0, in: splitView, with: first) updateHost(at: 1, in: splitView, with: second) updateHost(at: 2, in: splitView, with: third) context.coordinator.applyStoredPositionsWhenNeeded(in: splitView) + context.coordinator.handleExpansionRequest(store.paneExpansionRequest, in: splitView) } private func nativeHost<V: View>(_ view: V) -> NSHostingView<AnyView> { @@ -1603,15 +1635,33 @@ private final class NativeSplitCoordinator: NSObject, NSSplitViewDelegate { var kind: Kind var minimums: [CGFloat] + var roles: [WorkspacePaneRole] + var allowRailSnapping: Bool var onFramesChange: (([CGRect]) -> Void)? + var onExpansionRequestHandled: ((UUID) -> Void)? private var isDragging = false private var isApplyingStoredPositions = false private var lastAppliedWidth: CGFloat = 0 private var saveWork: DispatchWorkItem? + private var recentReadableWidths: [WorkspacePaneRole: CGFloat] = [:] + private var handledExpansionRequestID: UUID? + + private let railWidth = ContentRailMetrics.railOnlyWidth + private let railSnapThreshold = ContentRailMetrics.snapThreshold + private let readableWidthThreshold = ContentRailMetrics.readableWidth + private let defaultReadableWidth = ContentRailMetrics.defaultReadableWidth - init(kind: Kind, minimums: [CGFloat], onFramesChange: (([CGRect]) -> Void)? = nil) { + init( + kind: Kind, + minimums: [CGFloat], + roles: [WorkspacePaneRole] = [], + allowRailSnapping: Bool = false, + onFramesChange: (([CGRect]) -> Void)? = nil + ) { self.kind = kind self.minimums = minimums + self.roles = roles + self.allowRailSnapping = allowRailSnapping self.onFramesChange = onFramesChange } @@ -1619,13 +1669,20 @@ private final class NativeSplitCoordinator: NSObject, NSSplitViewDelegate { splitView.isVertical = true splitView.dividerStyle = .thin splitView.delegate = self - splitView.onDragStart = { [weak self] in - self?.isDragging = true - self?.saveWork?.cancel() + splitView.onDragStart = { [weak self, weak splitView] in + guard let self else { return } + if let splitView { + self.captureReadableWidths(in: splitView) + } + self.isDragging = true + self.saveWork?.cancel() } splitView.onDragEnd = { [weak self, weak splitView] in guard let self, let splitView else { return } self.isDragging = false + if self.allowRailSnapping { + self.snapRailWidthsIfNeeded(in: splitView) + } self.saveRatios(from: splitView) self.reportFrames(from: splitView) } @@ -1669,8 +1726,37 @@ private final class NativeSplitCoordinator: NSObject, NSSplitViewDelegate { splitView.setPosition(actualFirstWidth + splitView.dividerThickness + secondWidth, ofDividerAt: 1) } - lastAppliedWidth = splitView.bounds.width - reportFrames(from: splitView) + if allowRailSnapping { + snapRailWidthsIfNeeded(in: splitView) + } + + saveRatios(from: splitView) + } + + func captureReadableWidths(in splitView: NSSplitView) { + guard allowRailSnapping, roles.count == splitView.arrangedSubviews.count else { return } + for (role, view) in zip(roles, splitView.arrangedSubviews) where view.frame.width >= readableWidthThreshold { + recentReadableWidths[role] = view.frame.width + } + } + + func handleExpansionRequest(_ request: PaneExpansionRequest?, in splitView: NSSplitView) { + guard allowRailSnapping, + let request, + request.id != handledExpansionRequestID, + roles.count == splitView.arrangedSubviews.count, + let requestedIndex = roles.firstIndex(of: request.role) else { return } + + handledExpansionRequestID = request.id + expandPane(at: requestedIndex, role: request.role, in: splitView) + snapRailWidthsIfNeeded(in: splitView) + saveRatios(from: splitView) + splitView.needsLayout = true + splitView.layoutSubtreeIfNeeded() + + DispatchQueue.main.async { [weak self] in + self?.onExpansionRequestHandled?(request.id) + } } func splitViewDidResizeSubviews(_ notification: Notification) { @@ -1710,10 +1796,101 @@ private final class NativeSplitCoordinator: NSObject, NSSplitViewDelegate { first.wrappedValue = clamped(widths[0] / usable, min: 0, max: 1) second.wrappedValue = clamped((widths[0] + widths[1]) / usable, min: 0, max: 1) } + captureReadableWidths(in: splitView) lastAppliedWidth = splitView.bounds.width reportFrames(from: splitView) } + private func snapRailWidthsIfNeeded(in splitView: NSSplitView) { + let widths = splitView.arrangedSubviews.map(\.frame.width) + guard widths.count >= 2 else { return } + + let snapIndices = widths.indices.filter { widths[$0] < railSnapThreshold } + guard snapIndices.contains(where: { abs(widths[$0] - railWidth) > 0.5 }) else { return } + + var targetWidths = widths + for index in snapIndices { + targetWidths[index] = railWidth + } + + let readableIndices = widths.indices.filter { !snapIndices.contains($0) } + let fallbackRecipient = widths.indices.max { widths[$0] < widths[$1] } + for index in snapIndices { + let releasedWidth = widths[index] - railWidth + guard releasedWidth > 0.5 else { continue } + let recipient = readableIndices.min { lhs, rhs in + let lhsDistance = abs(lhs - index) + let rhsDistance = abs(rhs - index) + if lhsDistance == rhsDistance { + return widths[lhs] > widths[rhs] + } + return lhsDistance < rhsDistance + } ?? fallbackRecipient + if let recipient { + targetWidths[recipient] += releasedWidth + } + } + + applyPaneWidths(targetWidths, in: splitView) + } + + private func expandPane(at requestedIndex: Int, role: WorkspacePaneRole, in splitView: NSSplitView) { + let widths = splitView.arrangedSubviews.map(\.frame.width) + guard widths.indices.contains(requestedIndex) else { return } + let usable = max( + splitView.bounds.width - CGFloat(widths.count - 1) * splitView.dividerThickness, + 1 + ) + let otherIndices = widths.indices.filter { $0 != requestedIndex } + let otherMinimumTotal = otherIndices.reduce(CGFloat(0)) { partial, index in + partial + (minimums[safe: index] ?? railWidth) + } + let requestedMinimum = minimums[safe: requestedIndex] ?? railWidth + let desiredWidth = max(recentReadableWidths[role] ?? defaultReadableWidth, readableWidthThreshold) + let requestedWidth = clamped( + desiredWidth, + min: requestedMinimum, + max: max(requestedMinimum, usable - otherMinimumTotal) + ) + + var targetWidths = Array(repeating: CGFloat(0), count: widths.count) + targetWidths[requestedIndex] = requestedWidth + let remainingWidth = max(0, usable - requestedWidth) + let extraAvailable = max(0, remainingWidth - otherMinimumTotal) + let currentExtras = otherIndices.map { index in + max(0, widths[index] - (minimums[safe: index] ?? railWidth)) + } + let currentExtraTotal = currentExtras.reduce(0, +) + + for (offset, index) in otherIndices.enumerated() { + let minimum = minimums[safe: index] ?? railWidth + let share: CGFloat + if currentExtraTotal > 0.5 { + share = extraAvailable * currentExtras[offset] / currentExtraTotal + } else { + share = extraAvailable / CGFloat(max(otherIndices.count, 1)) + } + targetWidths[index] = minimum + share + } + + if let correctionIndex = otherIndices.last { + targetWidths[correctionIndex] += usable - targetWidths.reduce(0, +) + } + applyPaneWidths(targetWidths, in: splitView) + } + + private func applyPaneWidths(_ widths: [CGFloat], in splitView: NSSplitView) { + guard widths.count == splitView.arrangedSubviews.count, widths.count >= 2 else { return } + var leadingWidth: CGFloat = 0 + for dividerIndex in 0..<(widths.count - 1) { + leadingWidth += widths[dividerIndex] + splitView.setPosition( + leadingWidth + CGFloat(dividerIndex) * splitView.dividerThickness, + ofDividerAt: dividerIndex + ) + } + } + private func reportFrames(from splitView: NSSplitView) { guard onFramesChange != nil, splitView.arrangedSubviews.count > 0 else { return } let frames = splitView.arrangedSubviews.map(\.frame) diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 64ba2f658..687da20e3 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -277,27 +277,48 @@ struct NotePaneView: View { @State private var draftNoteItemID: String? @State private var isApplyingExternalNote = false @State private var noteDraftFlushTask: Task<Void, Never>? + @State private var activeNoteRailID: String? var showsPaneHeader = true var reorderRole: WorkspacePaneRole? = nil private let noteDraftFlushDelayNanoseconds: UInt64 = 220_000_000 var body: some View { - VStack(spacing: 0) { - if showsPaneHeader { - noteHeader - } + GeometryReader { geometry in + let railOnly = store.layout.allowsRailOnlyPanes && geometry.size.width < ContentRailMetrics.railOnlyThreshold + let railItems = noteRailItems + ZStack(alignment: .topLeading) { + VStack(spacing: 0) { + if showsPaneHeader { + noteHeader + } - if let noteFileError = store.noteFileError { - Text(noteFileError) - .font(.caption) - .foregroundStyle(noteFileStatusColor(for: noteFileError)) - .lineLimit(1) - .padding(.horizontal, 14) - .padding(.bottom, 8) - } + if let noteFileError = store.noteFileError { + Text(noteFileError) + .font(.caption) + .foregroundStyle(noteFileStatusColor(for: noteFileError)) + .lineLimit(1) + .padding(.horizontal, 14) + .padding(.bottom, 8) + } + + noteBody + .padding(.leading, ContentRailMetrics.normalWidth) + } + .opacity(railOnly ? 0 : 1) + .allowsHitTesting(!railOnly) - noteBody + ContentRailView( + label: store.ui("文稿目录", "Draft outline"), + items: railItems, + activeID: activeNoteRailID ?? railItems.first?.id, + appearanceMode: store.appearanceMode, + isRailOnly: railOnly, + topInset: railOnly ? 0 : (showsPaneHeader ? 44 : 34), + onActivate: { activateNoteRailItem($0, railOnly: railOnly) } + ) + .zIndex(4) + } } .frame(minHeight: 280) .foregroundStyle(WeiBeiTheme.ink) @@ -589,6 +610,56 @@ struct NotePaneView: View { ) } + private var noteRailItems: [ContentRailItem] { + let lines = draftNoteText.components(separatedBy: .newlines) + let headings = lines.enumerated().compactMap { offset, line -> (line: Int, level: Int, title: String)? in + let trimmed = line.trimmingCharacters(in: .whitespaces) + let level = trimmed.prefix { $0 == "#" }.count + guard (1...4).contains(level) else { return nil } + let markerEnd = trimmed.index(trimmed.startIndex, offsetBy: level) + guard markerEnd < trimmed.endIndex, trimmed[markerEnd].isWhitespace else { return nil } + let title = trimmed[markerEnd...].trimmingCharacters(in: .whitespaces) + guard !title.isEmpty else { return nil } + return (offset, level, title) + } + + return headings.enumerated().map { index, heading in + let nextLine = index + 1 < headings.count ? headings[index + 1].line : lines.count + let excerpt = lines[(heading.line + 1)..<max(heading.line + 1, nextLine)] + .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) } + .filter { !$0.isEmpty } + .joined(separator: " ") + let position = lines.count > 1 ? CGFloat(heading.line) / CGFloat(lines.count - 1) : 0 + return ContentRailItem( + id: "note-heading-\(index)", + position: position, + level: heading.level - 1, + title: heading.title, + excerpt: railPreviewText(excerpt), + metadata: store.ui("第 \(index + 1) / \(headings.count) 节 · H\(heading.level)", "Section \(index + 1) / \(headings.count) · H\(heading.level)") + ) + } + } + + private func activateNoteRailItem(_ item: ContentRailItem, railOnly: Bool) { + guard let index = Int(item.id.replacingOccurrences(of: "note-heading-", with: "")) else { return } + activeNoteRailID = item.id + let navigate = { + store.noteEditorCommand = NoteEditorCommand(kind: .scrollToHeading, markdown: String(index)) + } + if railOnly { + store.requestPaneExpansion(.notes) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.24, execute: navigate) + } else { + navigate() + } + } + + private func railPreviewText(_ value: String) -> String { + let collapsed = value.split(whereSeparator: { $0.isWhitespace }).joined(separator: " ") + return String(collapsed.prefix(180)) + } + private var richEditor: some View { let itemID = store.activeNoteItemID return RichMarkdownEditorView(documentID: itemID ?? "", markdown: noteMarkdownBinding, command: Binding(get: { @@ -609,6 +680,8 @@ struct NotePaneView: View { flushNoteDraft(immediate: true) store.updateSelection(text, source: .note, anchor: anchor) store.askSelection() + }, onActiveHeadingChange: { index in + activeNoteRailID = index.map { "note-heading-\($0)" } }, onWikiLink: { title in flushNoteDraft(immediate: true) store.openOrCreateWikiNote(title: title) @@ -1079,9 +1152,21 @@ struct MarkdownSourceEditor: NSViewRepresentable { applyPatch(command.markdown, in: textView) case .insertMarkdown: insertMarkdown(command.markdown, in: textView) + case .scrollToHeading: + scrollToHeading(command.markdown, in: textView) } } + private func scrollToHeading(_ rawIndex: String, in textView: NSTextView) { + guard let targetIndex = Int(rawIndex), targetIndex >= 0 else { return } + let pattern = #"(?m)^#{1,4}[\t ]+.+$"# + guard let regex = try? NSRegularExpression(pattern: pattern) else { return } + let fullRange = NSRange(location: 0, length: (textView.string as NSString).length) + let matches = regex.matches(in: textView.string, range: fullRange) + guard matches.indices.contains(targetIndex) else { return } + textView.scrollRangeToVisible(matches[targetIndex].range) + } + private func replaceSelection(with markdown: String, in textView: NSTextView) { let range = textView.selectedRange() guard range.length > 0 else { @@ -1250,64 +1335,102 @@ struct MarkdownPreviewView: View { } } +private struct AgentRailTurn { + var id: UUID + var startMessageID: UUID + var startIndex: Int + var question: String + var answer: String +} + struct AgentPaneView: View { @EnvironmentObject private var store: WorkspaceStore var showsPaneHeader = true var reorderRole: WorkspacePaneRole? = nil @FocusState private var draftFocused: Bool + @State private var visibleAgentMessageID: UUID? + @State private var activeAgentRailID: String? + @State private var agentFollowsLatest = true private let agentBottomAnchorID = "agentConversationBottom" var body: some View { - VStack(spacing: 0) { - if showsPaneHeader { - WeiBeiPaneHeader( - title: store.ui("对话", "Chat"), - latinMark: store.interfaceLanguage == .chinese ? "CHAT" : nil, - subtitle: store.agentConversationSubtitle, - appearanceMode: store.appearanceMode, - reorderRole: reorderRole - ) { - EmptyView() - } - } - + GeometryReader { paneGeometry in + let railOnly = store.layout.allowsRailOnlyPanes && paneGeometry.size.width < ContentRailMetrics.railOnlyThreshold + let railItems = agentRailItems ScrollViewReader { proxy in - GeometryReader { geometry in - let contentWidth = min(max(geometry.size.width - 36, 320), agentContentMaxWidth ?? 760) - - ScrollView(showsIndicators: true) { - LazyVStack(alignment: .leading, spacing: 12) { - ForEach(store.messages) { message in - agentMessageRow(message: message, geometryWidth: geometry.size.width, contentWidth: contentWidth, proxy: proxy) - } - if store.isAskingAgent { - AgentThinkingIndicator() - .id("agent-thinking") - .transition(WeiBeiTransition.message) + ZStack(alignment: .topLeading) { + VStack(spacing: 0) { + if showsPaneHeader { + WeiBeiPaneHeader( + title: store.ui("对话", "Chat"), + latinMark: store.interfaceLanguage == .chinese ? "CHAT" : nil, + subtitle: store.agentConversationSubtitle, + appearanceMode: store.appearanceMode, + reorderRole: reorderRole + ) { + EmptyView() } - if store.messages.isEmpty { - emptyAgentState - .frame(maxWidth: .infinity, alignment: .leading) - .transition(WeiBeiTransition.message) + } + + GeometryReader { geometry in + let availableWidth = max(geometry.size.width - ContentRailMetrics.normalWidth, 1) + let contentWidth = min(max(availableWidth - 36, 320), agentContentMaxWidth ?? 760) + + ScrollView(showsIndicators: true) { + LazyVStack(alignment: .leading, spacing: 12) { + ForEach(store.messages) { message in + agentMessageRow(message: message, geometryWidth: availableWidth, contentWidth: contentWidth, proxy: proxy) + } + if store.isAskingAgent { + AgentThinkingIndicator() + .id("agent-thinking") + .transition(WeiBeiTransition.message) + } + if store.messages.isEmpty { + emptyAgentState + .frame(maxWidth: .infinity, alignment: .leading) + .transition(WeiBeiTransition.message) + } + Color.clear + .frame(height: 1) + .id(agentBottomAnchorID) + } + .scrollTargetLayout() + .padding(14) + .padding(.top, store.messages.isEmpty ? 22 : 0) + .frame(width: availableWidth, alignment: .topLeading) + .frame(minHeight: geometry.size.height, alignment: .topLeading) + .animation(WeiBeiMotion.panel, value: store.messages.count) } - Color.clear - .frame(height: 1) - .id(agentBottomAnchorID) + .scrollPosition(id: $visibleAgentMessageID, anchor: .center) + .padding(.leading, ContentRailMetrics.normalWidth) } - .padding(14) - .padding(.top, store.messages.isEmpty ? 22 : 0) - .frame(width: geometry.size.width, alignment: .topLeading) - .frame(minHeight: geometry.size.height, alignment: .topLeading) - .animation(WeiBeiMotion.panel, value: store.messages.count) + + agentInputTray } + .opacity(railOnly ? 0 : 1) + .allowsHitTesting(!railOnly) + + ContentRailView( + label: store.ui("对话轨道", "Conversation rail"), + items: railItems, + activeID: activeAgentRailID ?? railItems.first?.id, + appearanceMode: store.appearanceMode, + isRailOnly: railOnly, + topInset: railOnly ? 0 : (showsPaneHeader ? 44 : 34), + bottomInset: railOnly ? 0 : 108, + onActivate: { activateAgentRailItem($0, railOnly: railOnly, proxy: proxy) } + ) + .zIndex(4) } .onChange(of: store.messages.count) { _, _ in scrollAgentToBottom(proxy) } + .onChange(of: visibleAgentMessageID) { _, messageID in + updateAgentRailPosition(for: messageID) + } } - - agentInputTray } .frame(minHeight: 260) .foregroundStyle(WeiBeiTheme.ink) @@ -1359,6 +1482,84 @@ struct AgentPaneView: View { .transition(WeiBeiTransition.message) } + private var agentRailTurns: [AgentRailTurn] { + var turns: [AgentRailTurn] = [] + for (index, message) in store.messages.enumerated() { + switch message.role { + case .user: + turns.append(AgentRailTurn( + id: message.id, + startMessageID: message.id, + startIndex: index, + question: message.text, + answer: "" + )) + case .assistant: + if turns.isEmpty { + turns.append(AgentRailTurn( + id: message.id, + startMessageID: message.id, + startIndex: index, + question: store.ui("对话回复", "Response"), + answer: message.text + )) + } else if turns[turns.count - 1].answer.isEmpty { + turns[turns.count - 1].answer = message.text + } else { + turns[turns.count - 1].answer += "\n\n" + message.text + } + } + } + return turns + } + + private var agentRailItems: [ContentRailItem] { + let turns = agentRailTurns + return turns.enumerated().map { index, turn in + ContentRailItem( + id: "chat-turn-\(turn.id.uuidString)", + position: turns.count > 1 ? CGFloat(index) / CGFloat(turns.count - 1) : 0, + title: railText(turn.question, fallback: store.ui("第 \(index + 1) 轮对话", "Conversation \(index + 1)")), + excerpt: railText(turn.answer, fallback: store.ui("等待回复", "Waiting for response")), + metadata: store.ui("第 \(index + 1) / \(turns.count) 轮", "Turn \(index + 1) / \(turns.count)") + ) + } + } + + private func activateAgentRailItem(_ item: ContentRailItem, railOnly: Bool, proxy: ScrollViewProxy) { + guard let turn = agentRailTurns.first(where: { "chat-turn-\($0.id.uuidString)" == item.id }) else { return } + activeAgentRailID = item.id + agentFollowsLatest = false + let navigate = { + withAnimation(WeiBeiMotion.panel) { + proxy.scrollTo(turn.startMessageID, anchor: .center) + } + } + if railOnly { + store.requestPaneExpansion(.agent) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.24, execute: navigate) + } else { + navigate() + } + } + + private func updateAgentRailPosition(for messageID: UUID?) { + guard let messageID, + let visibleIndex = store.messages.firstIndex(where: { $0.id == messageID }) else { return } + agentFollowsLatest = messageID == store.messages.last?.id + if let turn = agentRailTurns.last(where: { $0.startIndex <= visibleIndex }) { + activeAgentRailID = "chat-turn-\(turn.id.uuidString)" + } + } + + private func railText(_ value: String, fallback: String) -> String { + let collapsed = value + .replacingOccurrences(of: #"[`*_>#\[\]()]"#, with: "", options: .regularExpression) + .split(whereSeparator: { $0.isWhitespace }) + .joined(separator: " ") + return collapsed.isEmpty ? fallback : String(collapsed.prefix(180)) + } + private var agentPrompt: String { store.agentInputPrompt } @@ -1469,6 +1670,7 @@ struct AgentPaneView: View { } private func scrollAgentToBottom(_ proxy: ScrollViewProxy) { + guard agentFollowsLatest else { return } DispatchQueue.main.async { withAnimation(WeiBeiMotion.panel) { proxy.scrollTo(agentBottomAnchorID, anchor: .bottom) diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift index 2c53d4d6b..5f2f39cda 100644 --- a/Sources/WeiBei/Views/ReaderView.swift +++ b/Sources/WeiBei/Views/ReaderView.swift @@ -141,37 +141,59 @@ struct ReaderView: View { @State private var pdfControlsCollapseToken = UUID() @State private var pendingPDFPageIndex: Int? @State private var pdfHasSelectableText: Bool? + @State private var pdfContentRailItems: [ContentRailItem] = [] + @State private var pdfRailTargetPageIndex: Int? + @State private var pendingPDFRailPreviewPages: Set<Int> = [] + @State private var htmlContentRailItems: [ContentRailItem] = [] + @State private var htmlContentRailActiveID: String? + @State private var htmlContentRailTarget: WebReaderContentRailTarget? var body: some View { - ZStack(alignment: .bottomTrailing) { - VStack(spacing: 0) { - readerBody - } + GeometryReader { geometry in + let railOnly = supportsContentRail && !isImmersive && geometry.size.width < ContentRailMetrics.railOnlyThreshold + ZStack(alignment: .bottomTrailing) { + VStack(spacing: 0) { + readerBody + } + .opacity(railOnly ? 0 : 1) + .allowsHitTesting(!railOnly) + + if !railOnly, store.selectedMaterialItem?.kind == .pdf { + pdfFloatingControls + .padding(.trailing, isImmersive ? 18 : 10) + .padding(.bottom, isImmersive ? 18 : 12) + .transition(WeiBeiTransition.floating) + } - if store.selectedMaterialItem?.kind == .pdf { - pdfFloatingControls - .padding(.trailing, isImmersive ? 18 : 10) - .padding(.bottom, isImmersive ? 18 : 12) - .transition(WeiBeiTransition.floating) + if !railOnly, pdfHasSelectableText == false { + pdfTextLayerNotice + .padding(.leading, isImmersive ? 18 : 14) + .padding(.bottom, isImmersive ? 18 : 14) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomLeading) + .transition(WeiBeiTransition.floating) + } } - - if pdfHasSelectableText == false { - pdfTextLayerNotice - .padding(.leading, isImmersive ? 18 : 14) - .padding(.bottom, isImmersive ? 18 : 14) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomLeading) - .transition(WeiBeiTransition.floating) + .overlay(alignment: .leading) { + if supportsContentRail { + contentRail(isRailOnly: railOnly) + .frame( + width: railOnly ? min(ContentRailMetrics.railOnlyWidth, geometry.size.width) : geometry.size.width, + height: geometry.size.height, + alignment: .leading + ) + .zIndex(6) } - } - .overlay(alignment: .top) { - if showsFloatingTitle { - ImmersiveHoverTitleView( - mark: "DOC", - title: floatingTitle, - appearanceMode: store.appearanceMode, - reorderRole: floatingTitleReorderRole - ) { - importedDocumentAdaptationControl + } + .overlay(alignment: .top) { + if !railOnly, showsFloatingTitle { + ImmersiveHoverTitleView( + mark: "DOC", + title: floatingTitle, + appearanceMode: store.appearanceMode, + reorderRole: floatingTitleReorderRole + ) { + importedDocumentAdaptationControl + } } } } @@ -184,14 +206,22 @@ struct ReaderView: View { syncReaderLocationTitle() pendingPDFPageIndex = store.readerTargetPageIndex applyPendingPDFPageIfReady() + rebuildPDFContentRail() } .onChange(of: store.selectedItemID) { _, _ in pdfPageIndex = 0 pdfPageCount = store.selectedMaterialItem?.kind == .pdf && store.selectedMaterialItem?.url == nil ? 1 : 0 pdfHasSelectableText = store.selectedMaterialItem?.kind == .pdf && store.selectedMaterialItem?.url == nil ? true : nil + pdfContentRailItems = [] + pdfRailTargetPageIndex = nil + pendingPDFRailPreviewPages = [] + htmlContentRailItems = [] + htmlContentRailActiveID = nil + htmlContentRailTarget = nil syncReaderLocationTitle() pendingPDFPageIndex = store.readerTargetPageIndex applyPendingPDFPageIfReady() + rebuildPDFContentRail() } .onChange(of: pdfPageIndex) { _, _ in store.updateReaderPageIndex(pdfPageIndex) @@ -200,6 +230,7 @@ struct ReaderView: View { .onChange(of: pdfPageCount) { _, _ in syncReaderLocationTitle() applyPendingPDFPageIfReady() + rebuildPDFContentRail() } .onChange(of: store.readerTargetPageIndex) { _, target in pendingPDFPageIndex = target @@ -223,6 +254,142 @@ struct ReaderView: View { store.currentReferenceTitle } + private var supportsContentRail: Bool { + guard let kind = store.selectedMaterialItem?.kind else { return false } + return kind == .pdf || kind == .html + } + + private var contentRailItems: [ContentRailItem] { + switch store.selectedMaterialItem?.kind { + case .pdf: + return pdfContentRailItems + case .html: + return htmlContentRailItems + default: + return [] + } + } + + private var contentRailActiveID: String? { + switch store.selectedMaterialItem?.kind { + case .pdf: + return Self.pdfContentRailID(pageIndex: pdfPageIndex) + case .html: + return htmlContentRailActiveID + default: + return nil + } + } + + private func contentRail(isRailOnly: Bool) -> some View { + ContentRailView( + label: store.ui("文稿导航", "Document Navigation"), + items: contentRailItems, + activeID: contentRailActiveID, + appearanceMode: store.appearanceMode, + isRailOnly: isRailOnly, + topInset: showsFloatingTitle && !isRailOnly ? 46 : 14, + bottomInset: store.selectedMaterialItem?.kind == .pdf ? 52 : 18, + onActivate: { activateContentRailItem($0, railOnly: isRailOnly) }, + onHover: hoverContentRailItem + ) + } + + private func activateContentRailItem(_ item: ContentRailItem, railOnly: Bool) { + if railOnly { + store.requestPaneExpansion(.reader) + } + switch store.selectedMaterialItem?.kind { + case .pdf: + pdfRailTargetPageIndex = Self.pdfPageIndex(fromContentRailID: item.id) + case .html: + htmlContentRailTarget = WebReaderContentRailTarget(id: item.id) + default: + break + } + } + + private func hoverContentRailItem(_ item: ContentRailItem?) { + guard store.selectedMaterialItem?.kind == .pdf, + let item, + let pageIndex = Self.pdfPageIndex(fromContentRailID: item.id), + let url = store.selectedMaterialItem?.url, + item.previewImage == nil, + !pendingPDFRailPreviewPages.contains(pageIndex) else { return } + pendingPDFRailPreviewPages.insert(pageIndex) + let selectedPath = url.standardizedFileURL.path + PDFContentRailPreviewLoader.shared.load(url: url, pageIndex: pageIndex) { preview in + guard store.selectedMaterialItem?.url?.standardizedFileURL.path == selectedPath else { return } + pendingPDFRailPreviewPages.remove(pageIndex) + guard let preview, + let itemIndex = pdfContentRailItems.firstIndex(where: { $0.id == item.id }) else { return } + let fallbackTitle = store.ui("第 \(pageIndex + 1) 页", "Page \(pageIndex + 1)") + let excerpt = preview.excerpt.isEmpty + ? store.ui("扫描页;预览来自真实 PDF 页面。", "Scanned page; previewed from the real PDF page.") + : preview.excerpt + pdfContentRailItems[itemIndex] = ContentRailItem( + id: item.id, + position: item.position, + level: item.level, + title: preview.title.isEmpty ? fallbackTitle : preview.title, + excerpt: excerpt, + metadata: "\(pageIndex + 1) / \(max(pdfPageCount, 1)) · PDF", + previewImage: preview.image + ) + } + } + + private func rebuildPDFContentRail() { + guard store.selectedMaterialItem?.kind == .pdf, pdfPageCount > 0 else { + pdfContentRailItems = [] + return + } + let denominator = max(pdfPageCount - 1, 1) + pdfContentRailItems = (0..<pdfPageCount).map { pageIndex in + let pageNumber = pageIndex + 1 + return ContentRailItem( + id: Self.pdfContentRailID(pageIndex: pageIndex), + position: CGFloat(pageIndex) / CGFloat(denominator), + level: Self.pdfContentRailLevel(pageIndex: pageIndex, pageCount: pdfPageCount), + title: store.ui("第 \(pageNumber) 页", "Page \(pageNumber)"), + excerpt: store.ui("悬停以预览真实页面内容。", "Hover to preview the real page content."), + metadata: "\(pageNumber) / \(pdfPageCount) · PDF" + ) + } + } + + private func applyHTMLContentRailSections(_ sections: [WebReaderContentRailSection]) { + htmlContentRailItems = sections.map { section in + ContentRailItem( + id: section.id, + position: section.position, + level: section.level, + title: section.title, + excerpt: section.excerpt, + metadata: section.metadata + ) + } + if let activeID = htmlContentRailActiveID, + !htmlContentRailItems.contains(where: { $0.id == activeID }) { + htmlContentRailActiveID = htmlContentRailItems.first?.id + } + } + + private static func pdfContentRailID(pageIndex: Int) -> String { + "pdf-page-\(max(pageIndex, 0))" + } + + private static func pdfPageIndex(fromContentRailID id: String) -> Int? { + guard id.hasPrefix("pdf-page-") else { return nil } + return Int(id.dropFirst("pdf-page-".count)) + } + + private static func pdfContentRailLevel(pageIndex: Int, pageCount: Int) -> Int { + if pageIndex == 0 || pageIndex == pageCount - 1 { return 1 } + if (pageIndex + 1).isMultiple(of: 10) { return 2 } + return 4 + } + @ViewBuilder private var importedDocumentAdaptationControl: some View { if supportsImportedDocumentColorAdaptation { @@ -451,6 +618,7 @@ struct ReaderView: View { adaptsDocumentColors: store.adaptImportedDocumentColors, pageIndex: $pdfPageIndex, pageCount: $pdfPageCount, + railTargetPageIndex: $pdfRailTargetPageIndex, onSelectableTextChange: { available in pdfHasSelectableText = available } ) { text, anchor, selectionPageIndex in let title = store.displayTitle(for: item) @@ -473,6 +641,9 @@ struct ReaderView: View { searchQuery: store.readerSearch, appearanceMode: store.appearanceMode, adaptsDocumentColors: store.adaptImportedDocumentColors, + contentRailTarget: htmlContentRailTarget, + onContentRailChange: applyHTMLContentRailSections, + onContentRailActiveChange: { htmlContentRailActiveID = $0 }, onAppShortcut: { key, modifiers in store.handleAppShortcut(key: key, modifiers: modifiers) } ) { text, anchor in store.updateSelection(text, source: .document, anchor: anchor) @@ -483,6 +654,9 @@ struct ReaderView: View { searchQuery: store.readerSearch, appearanceMode: store.appearanceMode, adaptsDocumentColors: true, + contentRailTarget: htmlContentRailTarget, + onContentRailChange: applyHTMLContentRailSections, + onContentRailActiveChange: { htmlContentRailActiveID = $0 }, onAppShortcut: { key, modifiers in store.handleAppShortcut(key: key, modifiers: modifiers) } ) { text, anchor in store.updateSelection(text, source: .document, anchor: anchor) @@ -533,6 +707,100 @@ struct ReaderView: View { } +struct WebReaderContentRailSection: Hashable { + var id: String + var position: CGFloat + var level: Int + var title: String + var excerpt: String + var metadata: String +} + +struct WebReaderContentRailTarget: Equatable { + var id: String + var requestID = UUID() +} + +private struct PDFContentRailPreview { + var image: NSImage + var title: String + var excerpt: String +} + +private final class PDFContentRailPreviewBox: NSObject { + let preview: PDFContentRailPreview + + init(_ preview: PDFContentRailPreview) { + self.preview = preview + } +} + +private final class PDFContentRailPreviewLoader { + static let shared = PDFContentRailPreviewLoader() + + private let queue = DispatchQueue(label: "WeiBei.PDFContentRailPreview", qos: .userInitiated) + private let documentCache = NSCache<NSString, PDFDocument>() + private let previewCache = NSCache<NSString, PDFContentRailPreviewBox>() + + private init() { + documentCache.countLimit = 3 + previewCache.countLimit = 80 + } + + func load(url: URL, pageIndex: Int, completion: @escaping (PDFContentRailPreview?) -> Void) { + let documentKey = cacheKey(for: url) + let previewKey = "\(documentKey)#page=\(pageIndex)" as NSString + if let cached = previewCache.object(forKey: previewKey) { + DispatchQueue.main.async { + completion(cached.preview) + } + return + } + + queue.async { [documentCache, previewCache] in + let key = documentKey as NSString + let document: PDFDocument + if let cached = documentCache.object(forKey: key) { + document = cached + } else if let loaded = PDFDocument(url: url) { + document = loaded + documentCache.setObject(loaded, forKey: key) + } else { + DispatchQueue.main.async { + completion(nil) + } + return + } + guard let page = document.page(at: pageIndex) else { + DispatchQueue.main.async { + completion(nil) + } + return + } + + let image = page.thumbnail(of: NSSize(width: 180, height: 240), for: .mediaBox) + let lines = (page.string ?? "") + .split(whereSeparator: { $0.isNewline }) + .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) } + .filter { !$0.isEmpty } + let title = lines.first.map { String($0.prefix(52)) } ?? "" + let bodyLines = lines.count > 1 ? lines.dropFirst() : lines[...] + let excerpt = String(bodyLines.joined(separator: " ").prefix(180)) + let preview = PDFContentRailPreview(image: image, title: title, excerpt: excerpt) + previewCache.setObject(PDFContentRailPreviewBox(preview), forKey: previewKey) + DispatchQueue.main.async { + completion(preview) + } + } + } + + private func cacheKey(for url: URL) -> String { + let modificationDate = (try? FileManager.default.attributesOfItem(atPath: url.path)[.modificationDate] as? Date)? + .timeIntervalSince1970 ?? 0 + return "\(url.standardizedFileURL.path)#\(modificationDate)" + } +} + private enum PDFBrowseMode: String, CaseIterable, Identifiable { case scroll case page @@ -580,6 +848,7 @@ private struct PDFReaderRepresentable: NSViewRepresentable { var adaptsDocumentColors: Bool @Binding var pageIndex: Int @Binding var pageCount: Int + @Binding var railTargetPageIndex: Int? var onSelectableTextChange: (Bool?) -> Void = { _ in } var onSelectionChange: (String, CGPoint?, Int) -> Void @@ -641,6 +910,16 @@ private struct PDFReaderRepresentable: NSViewRepresentable { view.go(to: page) } + if let targetPageIndex = railTargetPageIndex, + let page = view.document?.page(at: min(max(targetPageIndex, 0), max(pageCount - 1, 0))) { + view.go(to: page) + DispatchQueue.main.async { + if railTargetPageIndex == targetPageIndex { + railTargetPageIndex = nil + } + } + } + context.coordinator.applySearch(searchQuery, in: view) DispatchQueue.main.async { WeiBeiQuietScrollers.configureRecursively( @@ -1191,6 +1470,9 @@ struct WebReaderRepresentable: NSViewRepresentable { var searchQuery: String var appearanceMode: WeiBeiAppearanceMode var adaptsDocumentColors: Bool + var contentRailTarget: WebReaderContentRailTarget? + var onContentRailChange: ([WebReaderContentRailSection]) -> Void + var onContentRailActiveChange: (String?) -> Void var onAppShortcut: (String, NSEvent.ModifierFlags) -> Bool var onSelectionChange: (String, CGPoint?) -> Void @@ -1199,6 +1481,9 @@ struct WebReaderRepresentable: NSViewRepresentable { searchQuery: String = "", appearanceMode: WeiBeiAppearanceMode = .paper, adaptsDocumentColors: Bool = true, + contentRailTarget: WebReaderContentRailTarget? = nil, + onContentRailChange: @escaping ([WebReaderContentRailSection]) -> Void = { _ in }, + onContentRailActiveChange: @escaping (String?) -> Void = { _ in }, onAppShortcut: @escaping (String, NSEvent.ModifierFlags) -> Bool = { _, _ in false }, onSelectionChange: @escaping (String, CGPoint?) -> Void ) { @@ -1207,6 +1492,9 @@ struct WebReaderRepresentable: NSViewRepresentable { self.searchQuery = searchQuery self.appearanceMode = appearanceMode self.adaptsDocumentColors = adaptsDocumentColors + self.contentRailTarget = contentRailTarget + self.onContentRailChange = onContentRailChange + self.onContentRailActiveChange = onContentRailActiveChange self.onAppShortcut = onAppShortcut self.onSelectionChange = onSelectionChange } @@ -1216,6 +1504,9 @@ struct WebReaderRepresentable: NSViewRepresentable { searchQuery: String = "", appearanceMode: WeiBeiAppearanceMode = .paper, adaptsDocumentColors: Bool = true, + contentRailTarget: WebReaderContentRailTarget? = nil, + onContentRailChange: @escaping ([WebReaderContentRailSection]) -> Void = { _ in }, + onContentRailActiveChange: @escaping (String?) -> Void = { _ in }, onAppShortcut: @escaping (String, NSEvent.ModifierFlags) -> Bool = { _, _ in false }, onSelectionChange: @escaping (String, CGPoint?) -> Void ) { @@ -1224,6 +1515,9 @@ struct WebReaderRepresentable: NSViewRepresentable { self.searchQuery = searchQuery self.appearanceMode = appearanceMode self.adaptsDocumentColors = adaptsDocumentColors + self.contentRailTarget = contentRailTarget + self.onContentRailChange = onContentRailChange + self.onContentRailActiveChange = onContentRailActiveChange self.onAppShortcut = onAppShortcut self.onSelectionChange = onSelectionChange } @@ -1232,6 +1526,9 @@ struct WebReaderRepresentable: NSViewRepresentable { Coordinator( appearanceMode: appearanceMode, adaptsDocumentColors: adaptsDocumentColors, + contentRailTarget: contentRailTarget, + onContentRailChange: onContentRailChange, + onContentRailActiveChange: onContentRailActiveChange, onAppShortcut: onAppShortcut, onSelectionChange: onSelectionChange ) @@ -1242,6 +1539,8 @@ struct WebReaderRepresentable: NSViewRepresentable { let controller = WKUserContentController() controller.add(context.coordinator, name: "selection") controller.add(context.coordinator, name: "appShortcut") + controller.add(context.coordinator, name: "contentRailSections") + controller.add(context.coordinator, name: "contentRailActive") controller.addUserScript(WKUserScript( source: Self.appShortcutScript, injectionTime: .atDocumentStart, @@ -1257,6 +1556,11 @@ struct WebReaderRepresentable: NSViewRepresentable { injectionTime: .atDocumentEnd, forMainFrameOnly: true )) + controller.addUserScript(WKUserScript( + source: Self.contentRailScript, + injectionTime: .atDocumentEnd, + forMainFrameOnly: true + )) configuration.userContentController = controller let view = WKWebView(frame: .zero, configuration: configuration) @@ -1269,6 +1573,9 @@ struct WebReaderRepresentable: NSViewRepresentable { func updateNSView(_ view: WKWebView, context: Context) { context.coordinator.searchQuery = searchQuery context.coordinator.onAppShortcut = onAppShortcut + context.coordinator.onContentRailChange = onContentRailChange + context.coordinator.onContentRailActiveChange = onContentRailActiveChange + context.coordinator.contentRailTarget = contentRailTarget if context.coordinator.appearanceMode != appearanceMode || context.coordinator.adaptsDocumentColors != adaptsDocumentColors { context.coordinator.appearanceMode = appearanceMode @@ -1292,11 +1599,14 @@ struct WebReaderRepresentable: NSViewRepresentable { context.coordinator.applySearch(in: view) } } + context.coordinator.applyContentRailTarget(in: view) } static func dismantleNSView(_ view: WKWebView, coordinator: Coordinator) { view.configuration.userContentController.removeScriptMessageHandler(forName: "selection") view.configuration.userContentController.removeScriptMessageHandler(forName: "appShortcut") + view.configuration.userContentController.removeScriptMessageHandler(forName: "contentRailSections") + view.configuration.userContentController.removeScriptMessageHandler(forName: "contentRailActive") } static let appShortcutScript = """ @@ -1376,6 +1686,174 @@ struct WebReaderRepresentable: NSViewRepresentable { })(); """ + static let contentRailScript = """ + (() => { + if (window.WeiBeiContentRail?.installed) { + window.WeiBeiContentRail.scan(); + return; + } + + const state = { + items: [], + activeID: "", + activeFrame: 0, + scanTimer: 0 + }; + const clean = (value) => String(value || "").replace(/\\s+/g, " ").trim(); + const clipped = (value, limit) => clean(value).slice(0, limit); + const visible = (element) => { + if (!(element instanceof Element)) return false; + if (element.closest("nav, footer, [aria-hidden='true']")) return false; + const style = getComputedStyle(element); + const rect = element.getBoundingClientRect(); + return style.display !== "none" && style.visibility !== "hidden" && rect.width > 1 && rect.height > 1; + }; + const absoluteTop = (element) => window.scrollY + element.getBoundingClientRect().top; + const maximumScroll = () => Math.max( + 1, + (document.scrollingElement?.scrollHeight || document.documentElement.scrollHeight || document.body.scrollHeight || 1) + - window.innerHeight + ); + const normalizedPosition = (element) => Math.max(0, Math.min(1, absoluteTop(element) / maximumScroll())); + const metadata = (index, count, fallback) => fallback + ? `HTML · 内容段 ${index + 1} / ${count}` + : `HTML · ${index + 1} / ${count}`; + + const excerptAfterHeading = (heading) => { + let cursor = heading.nextElementSibling; + while (cursor) { + if (/^H[1-4]$/.test(cursor.tagName) || cursor.getAttribute("role") === "heading") break; + const candidate = cursor.matches("p, li, blockquote, figcaption, pre") + ? cursor + : cursor.querySelector("p, li, blockquote, figcaption, pre"); + const text = clipped(candidate?.textContent, 180); + if (text) return text; + cursor = cursor.nextElementSibling; + } + return ""; + }; + + const headingSections = () => Array.from(document.querySelectorAll("h1, h2, h3, h4, [role='heading']")) + .filter((element) => visible(element) && clean(element.textContent)) + .map((element, index) => { + const explicitLevel = Number(element.getAttribute("aria-level")); + const tagLevel = /^H[1-4]$/.test(element.tagName) ? Number(element.tagName.slice(1)) : 2; + const level = Math.max(1, Math.min(4, Number.isFinite(explicitLevel) && explicitLevel > 0 ? explicitLevel : tagLevel)); + const id = element.dataset.weibeiContentRailID || `html-heading-${index}`; + element.dataset.weibeiContentRailID = id; + return { + id, + element, + level, + title: clipped(element.textContent, 72), + excerpt: excerptAfterHeading(element), + top: absoluteTop(element), + position: normalizedPosition(element), + fallback: false + }; + }); + + const fallbackSections = () => { + const root = document.querySelector("main, article") || document.body; + const blocks = Array.from(root?.querySelectorAll("p, li, blockquote, figcaption, pre") || []) + .filter((element) => visible(element) && clean(element.textContent).length >= 24) + .sort((left, right) => absoluteTop(left) - absoluteTop(right)); + if (blocks.length === 0) return []; + const desiredCount = Math.max(1, Math.min(24, Math.ceil(maximumScroll() / Math.max(window.innerHeight * 1.35, 640)) + 1)); + const selected = []; + for (let index = 0; index < desiredCount; index += 1) { + const blockIndex = desiredCount === 1 + ? 0 + : Math.round((index / (desiredCount - 1)) * (blocks.length - 1)); + const element = blocks[blockIndex]; + if (!element || selected.some((entry) => entry.element === element)) continue; + const text = clean(element.textContent); + const id = element.dataset.weibeiContentRailID || `html-block-${blockIndex}`; + element.dataset.weibeiContentRailID = id; + selected.push({ + id, + element, + level: 4, + title: clipped(text, 48), + excerpt: clipped(text, 180), + top: absoluteTop(element), + position: normalizedPosition(element), + fallback: true + }); + } + return selected; + }; + + const postSections = () => { + const count = state.items.length; + window.webkit?.messageHandlers?.contentRailSections?.postMessage(state.items.map((item, index) => ({ + id: item.id, + position: item.position, + level: item.level, + title: item.title, + excerpt: item.excerpt, + metadata: metadata(index, count, item.fallback) + }))); + }; + + const updateActive = () => { + window.cancelAnimationFrame(state.activeFrame); + state.activeFrame = window.requestAnimationFrame(() => { + if (state.items.length === 0) { + if (state.activeID) { + state.activeID = ""; + window.webkit?.messageHandlers?.contentRailActive?.postMessage({ id: "" }); + } + return; + } + const readingLine = window.scrollY + window.innerHeight * 0.32; + let active = state.items[0]; + for (const item of state.items) { + if (item.top <= readingLine) active = item; + else break; + } + if (active.id === state.activeID) return; + state.activeID = active.id; + window.webkit?.messageHandlers?.contentRailActive?.postMessage({ id: active.id }); + }); + }; + + const scan = () => { + const headings = headingSections(); + state.items = (headings.length > 0 ? headings : fallbackSections()) + .sort((left, right) => left.top - right.top); + postSections(); + updateActive(); + }; + + const scheduleScan = () => { + window.clearTimeout(state.scanTimer); + state.scanTimer = window.setTimeout(scan, 160); + }; + + const scrollTo = (id) => { + const item = state.items.find((candidate) => candidate.id === id); + if (!item?.element) return false; + item.element.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" }); + window.setTimeout(() => window.scrollBy({ top: -44, behavior: "auto" }), 180); + return true; + }; + + window.WeiBeiContentRail = { installed: true, scan, scrollTo }; + window.addEventListener("scroll", updateActive, { passive: true }); + window.addEventListener("resize", scheduleScan, { passive: true }); + new MutationObserver(scheduleScan).observe(document.body || document.documentElement, { + childList: true, + characterData: true, + subtree: true + }); + if (window.ResizeObserver) { + new ResizeObserver(scheduleScan).observe(document.body || document.documentElement); + } + window.requestAnimationFrame(scan); + })(); + """ + static func readerStyleScript(for mode: WeiBeiAppearanceMode, adaptsDocumentColors: Bool = true) -> String { let selectionCSS: String switch mode { @@ -1472,21 +1950,31 @@ struct WebReaderRepresentable: NSViewRepresentable { final class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler { var onSelectionChange: (String, CGPoint?) -> Void var onAppShortcut: (String, NSEvent.ModifierFlags) -> Bool + var onContentRailChange: ([WebReaderContentRailSection]) -> Void + var onContentRailActiveChange: (String?) -> Void + var contentRailTarget: WebReaderContentRailTarget? var loadedSignature: String? var searchQuery = "" var appearanceMode: WeiBeiAppearanceMode = .paper var adaptsDocumentColors = true private var lastAppliedSearchQuery = "" + private var lastAppliedContentRailTargetRequestID: UUID? weak var webView: WKWebView? init( appearanceMode: WeiBeiAppearanceMode, adaptsDocumentColors: Bool, + contentRailTarget: WebReaderContentRailTarget?, + onContentRailChange: @escaping ([WebReaderContentRailSection]) -> Void, + onContentRailActiveChange: @escaping (String?) -> Void, onAppShortcut: @escaping (String, NSEvent.ModifierFlags) -> Bool, onSelectionChange: @escaping (String, CGPoint?) -> Void ) { self.appearanceMode = appearanceMode self.adaptsDocumentColors = adaptsDocumentColors + self.contentRailTarget = contentRailTarget + self.onContentRailChange = onContentRailChange + self.onContentRailActiveChange = onContentRailActiveChange self.onAppShortcut = onAppShortcut self.onSelectionChange = onSelectionChange } @@ -1499,6 +1987,23 @@ struct WebReaderRepresentable: NSViewRepresentable { return } + if message.name == "contentRailSections" { + guard let rows = message.body as? [[String: Any]] else { return } + let sections = rows.compactMap(Self.contentRailSection(from:)) + Task { @MainActor in + self.onContentRailChange(sections) + } + return + } + + if message.name == "contentRailActive" { + let id = (message.body as? [String: Any])?["id"] as? String + Task { @MainActor in + self.onContentRailActiveChange(id?.isEmpty == false ? id : nil) + } + return + } + let text: String let anchor: CGPoint? if let body = message.body as? [String: Any], @@ -1533,6 +2038,21 @@ struct WebReaderRepresentable: NSViewRepresentable { return modifiers } + private static func contentRailSection(from body: [String: Any]) -> WebReaderContentRailSection? { + guard let id = body["id"] as? String, + let title = body["title"] as? String, + let position = (body["position"] as? NSNumber)?.doubleValue, + let level = (body["level"] as? NSNumber)?.intValue else { return nil } + return WebReaderContentRailSection( + id: id, + position: CGFloat(position), + level: level, + title: title, + excerpt: body["excerpt"] as? String ?? "", + metadata: body["metadata"] as? String ?? "HTML" + ) + } + private static func anchor(from body: [String: Any], in view: WKWebView?) -> CGPoint? { guard let view, let x = body["x"] as? Double, @@ -1544,8 +2064,10 @@ struct WebReaderRepresentable: NSViewRepresentable { func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { lastAppliedSearchQuery = "" + lastAppliedContentRailTargetRequestID = nil webView.evaluateJavaScript(WebReaderRepresentable.readerStyleScript(for: appearanceMode, adaptsDocumentColors: adaptsDocumentColors)) applySearch(in: webView) + applyContentRailTarget(in: webView) } func applySearch(in view: WKWebView) { @@ -1572,6 +2094,13 @@ struct WebReaderRepresentable: NSViewRepresentable { view.evaluateJavaScript(script) } + func applyContentRailTarget(in view: WKWebView) { + guard let contentRailTarget, + contentRailTarget.requestID != lastAppliedContentRailTargetRequestID else { return } + lastAppliedContentRailTargetRequestID = contentRailTarget.requestID + view.evaluateJavaScript("window.WeiBeiContentRail?.scrollTo(\(Self.json(contentRailTarget.id)))") + } + private static func json(_ value: String) -> String { let data = (try? JSONEncoder().encode(value)) ?? Data("".utf8) return String(data: data, encoding: .utf8) ?? "\"\"" diff --git a/Sources/WeiBei/Views/RichMarkdownEditorView.swift b/Sources/WeiBei/Views/RichMarkdownEditorView.swift index e604f136a..07f6fe7da 100644 --- a/Sources/WeiBei/Views/RichMarkdownEditorView.swift +++ b/Sources/WeiBei/Views/RichMarkdownEditorView.swift @@ -246,6 +246,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { var onSelectionChange: (String, CGPoint?) -> Void var onAskAgentWithSelection: (String, CGPoint?) -> Void var onContentHeightChange: (CGFloat) -> Void = { _ in } + var onActiveHeadingChange: (Int?) -> Void = { _ in } var onWikiLink: (String) -> Void = { _ in } var onSourceReference: (String) -> Void = { _ in } var onAppShortcut: (String, NSEvent.ModifierFlags) -> Bool = { _, _ in false } @@ -265,6 +266,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { appearanceMode: appearanceMode, interfaceLanguage: interfaceLanguage, onContentHeightChange: onContentHeightChange, + onActiveHeadingChange: onActiveHeadingChange, onSelectionChange: onSelectionChange, onAskAgentWithSelection: onAskAgentWithSelection, onWikiLink: onWikiLink, @@ -423,6 +425,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { context.coordinator.onSelectionChange = onSelectionChange context.coordinator.onAskAgentWithSelection = onAskAgentWithSelection context.coordinator.onContentHeightChange = onContentHeightChange + context.coordinator.onActiveHeadingChange = onActiveHeadingChange if context.coordinator.isReady, context.coordinator.webMarkdown != markdown { context.coordinator.setMarkdown(markdown) @@ -451,6 +454,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { "sourceReferenceActivated", "imageAttachmentRequested", "contentHeightChanged", + "activeHeadingChanged", "compactPreviewWheel", "appShortcut" ] @@ -472,6 +476,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { var onSelectionChange: (String, CGPoint?) -> Void var onAskAgentWithSelection: (String, CGPoint?) -> Void var onContentHeightChange: (CGFloat) -> Void + var onActiveHeadingChange: (Int?) -> Void var onWikiLink: (String) -> Void var onSourceReference: (String) -> Void var onAppShortcut: (String, NSEvent.ModifierFlags) -> Bool @@ -505,6 +510,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { appearanceMode: WeiBeiAppearanceMode, interfaceLanguage: WeiBeiInterfaceLanguage, onContentHeightChange: @escaping (CGFloat) -> Void, + onActiveHeadingChange: @escaping (Int?) -> Void, onSelectionChange: @escaping (String, CGPoint?) -> Void, onAskAgentWithSelection: @escaping (String, CGPoint?) -> Void, onWikiLink: @escaping (String) -> Void, @@ -523,6 +529,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { self.appearanceMode = appearanceMode self.interfaceLanguage = interfaceLanguage self.onContentHeightChange = onContentHeightChange + self.onActiveHeadingChange = onActiveHeadingChange self.onSelectionChange = onSelectionChange self.onAskAgentWithSelection = onAskAgentWithSelection self.onWikiLink = onWikiLink @@ -604,6 +611,9 @@ struct RichMarkdownEditorView: NSViewRepresentable { guard let body = message.body as? [String: Any], let height = body["height"] as? Double else { return } onContentHeightChange(CGFloat(height)) + case "activeHeadingChanged": + guard let body = message.body as? [String: Any] else { return } + onActiveHeadingChange((body["index"] as? NSNumber)?.intValue) case "compactPreviewWheel": guard let body = message.body as? [String: Any], let deltaY = body["deltaY"] as? Double else { return } @@ -672,6 +682,8 @@ struct RichMarkdownEditorView: NSViewRepresentable { evaluate("window.WeiBeiEditor?.applyAgentPatch(\(Self.json(command.markdown)))") case .insertMarkdown: evaluate("window.WeiBeiEditor?.insertMarkdown(\(Self.json(command.markdown)))") + case .scrollToHeading: + evaluate("window.WeiBeiEditor?.scrollToHeading(\(Self.json(command.markdown)))") } } diff --git a/Sources/WeiBei/WebEditor/src/editor.js b/Sources/WeiBei/WebEditor/src/editor.js index d54570d34..136925dea 100644 --- a/Sources/WeiBei/WebEditor/src/editor.js +++ b/Sources/WeiBei/WebEditor/src/editor.js @@ -1468,6 +1468,42 @@ const pressKeyForCheck = (key, options = {}) => { }); }; +const headingElements = () => Array.from(document.querySelectorAll('.ProseMirror h1, .ProseMirror h2, .ProseMirror h3, .ProseMirror h4')); +let activeHeadingFrame = 0; +let lastActiveHeadingIndex = -2; + +const reportActiveHeading = () => { + window.cancelAnimationFrame(activeHeadingFrame); + activeHeadingFrame = window.requestAnimationFrame(() => { + const headings = headingElements(); + if (headings.length === 0) { + if (lastActiveHeadingIndex !== -1) { + lastActiveHeadingIndex = -1; + post('activeHeadingChanged', { index: null }); + } + return; + } + const readingLine = Math.max(0, window.innerHeight * 0.32); + let activeIndex = 0; + headings.forEach((heading, index) => { + if (heading.getBoundingClientRect().top <= readingLine) activeIndex = index; + }); + if (activeIndex === lastActiveHeadingIndex) return; + lastActiveHeadingIndex = activeIndex; + post('activeHeadingChanged', { index: activeIndex }); + }); +}; + +const scrollToHeadingInternal = (rawIndex) => { + const index = Number(rawIndex); + const headings = headingElements(); + const heading = Number.isFinite(index) ? headings[Math.max(0, Math.floor(index))] : null; + if (!heading) return false; + heading.scrollIntoView({ block: 'start', behavior: 'smooth' }); + window.setTimeout(reportActiveHeading, 180); + return true; +}; + window.WeiBeiEditor = { getMarkdown: getMarkdownInternal, setMarkdown: setMarkdownInternal, @@ -1552,6 +1588,7 @@ window.WeiBeiEditor = { view.dispatch(view.state.tr.setMeta('weibeiLanguageChanged', currentLanguage)); }); }, + scrollToHeading: scrollToHeadingInternal, }; if (window.weiBeiEditorCheckMode) { @@ -1602,6 +1639,7 @@ Editor if (normalizedMarkdown === lastMarkdown) return; lastMarkdown = normalizedMarkdown; post('markdownChanged', { markdown: normalizedMarkdown }); + reportActiveHeading(); }); ctx.get(listenerCtx).selectionUpdated(() => { requestAnimationFrame(reportSelection); @@ -1639,7 +1677,9 @@ Editor reportSelection(); }); installContentHeightObserver(); + document.addEventListener('scroll', reportActiveHeading, true); post('editorReady', { markdown: lastMarkdown }); reportContentHeight(); + reportActiveHeading(); }) .catch(showFailure); diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index ac019c28e..850513b6e 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -331,6 +331,15 @@ public enum WorkspaceLayout: String, Codable, CaseIterable, Identifiable { } } + public var allowsRailOnlyPanes: Bool { + switch self { + case .documentAgentNotes, .documentNotesAgent, .documentNotesSplit: + return true + case .immersiveReading, .immersiveConversation, .immersiveWriting: + return false + } + } + public var defaultThreePaneOrder: [WorkspacePaneRole]? { switch self { case .documentAgentNotes: @@ -435,6 +444,7 @@ public struct NoteEditorCommand: Identifiable, Hashable { case replaceSelection case applyAgentPatch case insertMarkdown + case scrollToHeading } public var id: UUID diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index e52cb379b..1cd59f378 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -652,6 +652,10 @@ expect(!WorkspaceLayout.immersiveReading.hasCollapsibleRightPane, "immersive rea expect(WorkspaceLayout.documentAgentNotes.isDocumentThreePane && WorkspaceLayout.documentNotesAgent.isDocumentThreePane && !WorkspaceLayout.documentNotesSplit.isDocumentThreePane, "only full document layouts participate in three-pane reordering") +expect(WorkspaceLayout.documentAgentNotes.allowsRailOnlyPanes + && WorkspaceLayout.documentNotesSplit.allowsRailOnlyPanes + && !WorkspaceLayout.immersiveConversation.allowsRailOnlyPanes + && !WorkspaceLayout.immersiveWriting.allowsRailOnlyPanes, "only normal multi-pane layouts can collapse content panes into rail-only mode") expect(WorkspaceLayout.documentAgentNotes.defaultThreePaneOrder == [.reader, .agent, .notes] && WorkspaceLayout.documentNotesAgent.defaultThreePaneOrder == [.reader, .notes, .agent], "legacy three-pane layout presets map to pane role order") expect(WorkspacePaneRole.normalized([.notes, .reader, .notes]) == [.notes, .reader, .agent], "pane role order normalization preserves user pane order and restores missing panes") @@ -678,6 +682,17 @@ let contentViewSourceURL = URL(fileURLWithPath: FileManager.default.currentDirec .appendingPathComponent("Sources/WeiBei/Views/ContentView.swift") let contentViewSource = (try? String(contentsOf: contentViewSourceURL, encoding: .utf8)) ?? "" expect(!contentViewSource.isEmpty, "content view source is readable") +let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/ContentRailView.swift") +let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" +expect(contentRailSource.contains("struct ContentRailView: View") + && contentRailSource.contains("static let railOnlyWidth: CGFloat = 88") + && contentRailSource.contains("static let normalWidth: CGFloat = 28") + && contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") + && contentRailSource.contains("previewImage: NSImage?") + && contentRailSource.contains(".popover(") + && contentRailSource.contains("SpatialTapGesture()") + && contentRailSource.contains("private func nearestItem"), "shared content rail supports normal, rail-only, delayed unclipped hover, dense-track mapping, and real image previews") expect(contentViewSource.contains("case .immersiveReading:\n ZStack(alignment: .topTrailing)") && contentViewSource.contains("QuietInsightView(compact: true)") && contentViewSource.contains(".padding(.top, 24)") @@ -744,7 +759,10 @@ expect(contentViewSource.contains("dividerFill.setFill()") expect(contentViewSource.contains("override func layout()"), "native split applies saved positions after first real layout") expect(contentViewSource.contains("libraryResizeHandle"), "library pane keeps SwiftUI resize handle") expect(contentViewSource.contains("minimumContentWidthWithLibrary"), "library leaves readable width for the workspace") -expect(contentViewSource.contains("normalSidePaneMinimum"), "normal three-pane layout relaxes side panes when library is open") +expect(contentViewSource.contains("private let railWidth = ContentRailMetrics.railOnlyWidth") + && contentRailSource.contains("static let snapThreshold: CGFloat = 160") + && contentRailSource.contains("static let readableWidth: CGFloat = 240") + && contentViewSource.contains("handleExpansionRequest(store.paneExpansionRequest"), "normal multi-pane layouts snap to a restorable 88pt content rail state") expect(!contentViewSource.contains("DragGesture()"), "content panes avoid SwiftUI drag resizing") expect(!contentViewSource.contains(".id(store.layout)"), "layout changes avoid whole-screen identity resets") expect(!contentViewSource.contains("PaneSeparator"), "content panes avoid hand-drawn split separators") @@ -876,6 +894,11 @@ expect(sidebarSource.contains("Text(store.ui(\"课程目录\", \"Course Index\") let notesAgentSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/NotesAgentView.swift") let notesAgentSource = (try? String(contentsOf: notesAgentSourceURL, encoding: .utf8)) ?? "" +expect(notesAgentSource.contains("private var noteRailItems: [ContentRailItem]") + && notesAgentSource.contains("NoteEditorCommand(kind: .scrollToHeading") + && notesAgentSource.contains("private var agentRailItems: [ContentRailItem]") + && notesAgentSource.contains("store.requestPaneExpansion(.agent)") + && notesAgentSource.components(separatedBy: "let railOnly = store.layout.allowsRailOnlyPanes").count >= 3, "notes and conversation share the content rail and navigate after restoring a narrow pane") let notePaneHeaderSource: String = { guard let start = notesAgentSource.range(of: "struct NotePaneView: View")?.lowerBound, let end = notesAgentSource.range(of: "private func noteFileStatusColor", range: start..<notesAgentSource.endIndex)?.lowerBound else { @@ -1020,6 +1043,11 @@ expect(commandPaletteSource.contains("if store.agentSurface != .hidden") && comm let readerViewSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/ReaderView.swift") let readerViewSource = (try? String(contentsOf: readerViewSourceURL, encoding: .utf8)) ?? "" +expect(readerViewSource.contains("private final class PDFContentRailPreviewLoader") + && readerViewSource.contains("page.thumbnail(of:") + && readerViewSource.contains("static let contentRailScript") + && readerViewSource.contains("window.WeiBeiContentRail") + && readerViewSource.contains("if railOnly {\n store.requestPaneExpansion(.reader)"), "PDF and HTML rails use real page or document content and restore narrow reader panes") let selectionAnchorContentPointSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Support/SelectionAnchorContentPoint.swift") let selectionAnchorContentPointSource = (try? String(contentsOf: selectionAnchorContentPointSourceURL, encoding: .utf8)) ?? "" @@ -1059,7 +1087,7 @@ expect(readerViewSource.contains("controller.add(context.coordinator, name: \"ap && readerViewSource.contains("removeScriptMessageHandler(forName: \"appShortcut\")"), "html reader forwards app keyboard shortcuts while the web document has focus") expect(!readerViewSource.contains("readerHeader") && !readerViewSource.contains("statusBar"), "reader avoids duplicate internal chrome under unified top bar") expect(readerViewSource.contains("ReaderStateMessage") && !readerViewSource.contains("ContentUnavailableView("), "reader empty states use WeiBei paper styling") -expect(readerViewSource.contains("if store.selectedMaterialItem?.kind == .pdf") && readerViewSource.contains("if let item = store.selectedMaterialItem"), "reader renders materials, not notebook notes") +expect(readerViewSource.contains("store.selectedMaterialItem?.kind == .pdf") && readerViewSource.contains("if let item = store.selectedMaterialItem"), "reader renders materials, not notebook notes") expect(readerViewSource.contains("NotebookSelectedReaderView") && readerViewSource.contains("阅读区只显示资料"), "reader explains notebook selection instead of rendering it as material") expect(readerViewSource.contains("ZStack(alignment: .bottomTrailing)") && readerViewSource.contains(".padding(.trailing, isImmersive ? 18 : 10)") @@ -1233,12 +1261,19 @@ expect(readerViewSource.contains("private var importedDocumentAdaptationControl: && readerViewSource.contains("Image(systemName: \"eyeglasses\")") && readerViewSource.contains("WeiBeiIconButtonStyle(active: store.adaptImportedDocumentColors, size: 22)") && readerViewSource.contains("store.toggleImportedDocumentColorAdaptation()"), "DOC hover title offers a quiet stateful adaptation control only for imported PDF and HTML materials") +let readerStyleScriptSource: String = { + guard let start = readerViewSource.range(of: "static func readerStyleScript")?.lowerBound, + let end = readerViewSource.range(of: "final class Coordinator", range: start..<readerViewSource.endIndex)?.lowerBound else { + return "" + } + return String(readerViewSource[start..<end]) +}() expect(readerViewSource.contains("static func readerStyleScript(for mode: WeiBeiAppearanceMode, adaptsDocumentColors: Bool = true)") && readerViewSource.contains("document.documentElement.dataset.weibeiTheme = adaptsDocumentColors ? appearance : \"original\"") && readerViewSource.contains("[data-weibei-paper-surface] { background-color: transparent !important; }") && readerViewSource.contains(".slice(0, 2500)") && readerViewSource.contains("element.removeAttribute(\"data-weibei-paper-surface\")") - && !readerViewSource.contains("MutationObserver"), "HTML adaptation is reversible and bounds its one-time near-white surface pass without a persistent DOM observer") + && !readerStyleScriptSource.contains("MutationObserver"), "HTML adaptation is reversible and bounds its one-time near-white surface pass without a persistent DOM observer") expect(readerViewSource.contains("pendingPDFPageIndex") && readerViewSource.contains("applyPendingPDFPageIfReady") && readerViewSource.contains("store.readerTargetPageIndex = nil"), "pdf reader consumes source-jump target pages") expect(readerViewSource.contains("onSourceReference: { reference in store.openSourceReference(reference) }"), "markdown reader source references can jump back to material") expect(readerViewSource.contains("private struct SamplePDFView") @@ -2195,7 +2230,8 @@ expect(!readerViewSource.contains("struct ReaderPaneView") && readerViewSource.contains(".frame(maxWidth: .infinity)") && readerViewSource.contains(".frame(maxWidth: actionsAlignedTrailing ? .infinity : nil, alignment: .leading)") && readerViewSource.contains(".padding(.horizontal, actionsAlignedTrailing ? 14 : 0)") - && readerViewSource.contains("mark: \"DOC\",\n title: floatingTitle") + && readerViewSource.contains("mark: \"DOC\"") + && readerViewSource.contains("title: floatingTitle") && readerViewSource.contains("reorderRole: floatingTitleReorderRole") && readerViewSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.8, execute: task)") && contentViewSource.contains("isImmersive: store.layout == .immersiveReading") @@ -2305,11 +2341,12 @@ expect(notesAgentSource.contains("if store.hasSelectedMaterial") && !notesAgentSource.contains("starterChip(\"梳理材料\"") && !notesAgentSource.contains("starterChip(\"出复习题\""), "agent starter chips hide material actions without a selected material and avoid clipped long labels") expect(notesAgentSource.contains("GeometryReader { geometry in") - && notesAgentSource.contains("let contentWidth = min(max(geometry.size.width - 36, 320), agentContentMaxWidth ?? 760)") - && notesAgentSource.contains("agentMessageRow(message: message, geometryWidth: geometry.size.width, contentWidth: contentWidth, proxy: proxy)") + && notesAgentSource.contains("let availableWidth = max(geometry.size.width - ContentRailMetrics.normalWidth, 1)") + && notesAgentSource.contains("let contentWidth = min(max(availableWidth - 36, 320), agentContentMaxWidth ?? 760)") + && notesAgentSource.contains("agentMessageRow(message: message, geometryWidth: availableWidth, contentWidth: contentWidth, proxy: proxy)") && notesAgentSource.contains("private func agentMessageRow(message: AgentMessage, geometryWidth: CGFloat, contentWidth: CGFloat, proxy: ScrollViewProxy) -> some View") && notesAgentSource.contains(".padding(.top, store.messages.isEmpty ? 22 : 0)") - && notesAgentSource.contains(".frame(width: geometry.size.width, alignment: .topLeading)") + && notesAgentSource.contains(".frame(width: availableWidth, alignment: .topLeading)") && notesAgentSource.contains(".frame(minHeight: geometry.size.height, alignment: .topLeading)") && !notesAgentSource.contains("alignment: store.messages.isEmpty ? .bottomLeading : .topLeading"), "agent empty state starts in the content area instead of being pinned to the composer") expect(notesAgentSource.contains("canPolishNoteSelection") && notesAgentSource.contains("store.selectionContext?.isNoteSelection == true"), "selection agent only shows polish for note selections") @@ -2530,7 +2567,7 @@ expect(notesAgentSource.contains("private var agentContentMaxWidth: CGFloat?") && notesAgentSource.contains("private var userBubbleFill: Color") && notesAgentSource.contains("private var userBubbleStroke: Color") && notesAgentSource.contains(".frame(maxWidth: 520, alignment: .trailing)") - && notesAgentSource.contains(".frame(width: geometry.size.width, alignment: .topLeading)") + && notesAgentSource.contains(".frame(width: availableWidth, alignment: .topLeading)") && notesAgentSource.contains(".frame(minHeight: geometry.size.height, alignment: .topLeading)"), "agent user and assistant turns share one centered reading column; user bubbles trail inside the column") expect(notesAgentSource.contains("private let agentBottomAnchorID = \"agentConversationBottom\"") && notesAgentSource.contains(".id(agentBottomAnchorID)") From 45f509e8284e091ca4d9ee12f46c6b6069eb268e Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Fri, 10 Jul 2026 05:17:20 +0800 Subject: [PATCH 02/36] =?UTF-8?q?fix:=20=E8=AE=A9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E8=BD=A8=E6=82=AC=E6=B5=AE=E4=BA=8E=E5=8E=9F=E8=BE=B9=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/WeiBei/Views/ContentRailView.swift | 85 ++++++++++++---------- Sources/WeiBei/Views/NotesAgentView.swift | 9 +-- Sources/WeiBeiSelfCheck/main.swift | 17 +++-- 3 files changed, 60 insertions(+), 51 deletions(-) diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index 212c091cc..4e9bbb3cd 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -31,7 +31,7 @@ struct ContentRailItem: Identifiable { } enum ContentRailMetrics { - static let normalWidth: CGFloat = 28 + static let normalWidth: CGFloat = 16 static let railOnlyWidth: CGFloat = 88 static let railOnlyThreshold: CGFloat = 150 static let snapThreshold: CGFloat = 160 @@ -111,12 +111,6 @@ struct ContentRailView: View { ZStack(alignment: .topLeading) { railBackground - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(isRailOnly ? 0.54 : 0.30)) - .frame(width: 1) - .frame(maxWidth: .infinity, alignment: .trailing) - .allowsHitTesting(false) - if items.isEmpty { emptyOriginMark .position( @@ -139,6 +133,17 @@ struct ContentRailView: View { } } .frame(width: railWidth, height: height) + .contentShape(Rectangle()) + .onContinuousHover { phase in + switch phase { + case .active(let location): + guard let item = nearestItem(to: location.y, height: height) else { return } + beginHover(item) + case .ended: + hoveredID = nil + schedulePreviewClose() + } + } } private var railBackground: some View { @@ -172,8 +177,8 @@ struct ContentRailView: View { Rectangle() .fill(tickColor(itemID: item.id, active: active)) .frame( - width: tickLength(level: item.level, active: active), - height: active ? 2.5 : 1.5 + width: tickLength(for: item, active: active), + height: tickThickness(for: item, active: active) ) Spacer(minLength: 0) } @@ -195,13 +200,6 @@ struct ContentRailView: View { .frame(width: previewWidth) .padding(4) } - .onHover { hovering in - if hovering { - beginHover(item) - } else { - endHover(item) - } - } .animation(WeiBeiMotion.micro, value: activeID) .animation(WeiBeiMotion.hover, value: hoveredID) } @@ -209,21 +207,6 @@ struct ContentRailView: View { private func denseRailPointerSurface(height: CGFloat) -> some View { Color.clear .contentShape(Rectangle()) - .onContinuousHover { phase in - switch phase { - case .active(let location): - if let item = nearestItem(to: location.y, height: height) { - beginHover(item) - } - case .ended: - if let hoveredID, - let item = items.first(where: { $0.id == hoveredID }) { - endHover(item) - } else { - schedulePreviewClose() - } - } - } .gesture( SpatialTapGesture() .onEnded { value in @@ -236,16 +219,39 @@ struct ContentRailView: View { } private var tickHorizontalInset: CGFloat { - isRailOnly ? 16 : 4 + isRailOnly ? 16 : 2 } - private func tickLength(level: Int, active: Bool) -> CGFloat { - if active { - return isRailOnly ? 56 : 20 + private func tickLength(for item: ContentRailItem, active: Bool) -> CGFloat { + let base: CGFloat = isRailOnly ? 34 : 8 + let minimum: CGFloat = isRailOnly ? 10 : 4 + let resting = active + ? (isRailOnly ? 48 : 10) + : max(minimum, base - CGFloat(min(item.level, 4)) * (isRailOnly ? 6 : 1)) + let influence = hoverInfluence(for: item.id) + let hoveredLength: CGFloat = isRailOnly ? 56 : 12 + return resting + (hoveredLength - resting) * influence + } + + private func tickThickness(for item: ContentRailItem, active: Bool) -> CGFloat { + let resting: CGFloat = active ? 2.5 : 1.5 + return resting + (2.8 - resting) * hoverInfluence(for: item.id) + } + + private func hoverInfluence(for itemID: String) -> CGFloat { + guard let hoveredID, + let hoveredIndex = items.firstIndex(where: { $0.id == hoveredID }), + let itemIndex = items.firstIndex(where: { $0.id == itemID }) else { return 0 } + switch abs(hoveredIndex - itemIndex) { + case 0: + return 1 + case 1: + return 0.52 + case 2: + return 0.22 + default: + return 0 } - let base: CGFloat = isRailOnly ? 34 : 14 - let minimum: CGFloat = isRailOnly ? 10 : 6 - return max(minimum, base - CGFloat(min(level, 4)) * (isRailOnly ? 6 : 2)) } private func tickColor(itemID: String, active: Bool) -> Color { @@ -255,6 +261,9 @@ struct ContentRailView: View { if hoveredID == itemID { return WeiBeiTheme.secondaryInk.opacity(0.72) } + if hoverInfluence(for: itemID) > 0 { + return WeiBeiTheme.hairline.opacity(0.98) + } return WeiBeiTheme.hairline.opacity(0.86) } diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 687da20e3..b74966b88 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -303,7 +303,6 @@ struct NotePaneView: View { } noteBody - .padding(.leading, ContentRailMetrics.normalWidth) } .opacity(railOnly ? 0 : 1) .allowsHitTesting(!railOnly) @@ -1374,13 +1373,12 @@ struct AgentPaneView: View { } GeometryReader { geometry in - let availableWidth = max(geometry.size.width - ContentRailMetrics.normalWidth, 1) - let contentWidth = min(max(availableWidth - 36, 320), agentContentMaxWidth ?? 760) + let contentWidth = min(max(geometry.size.width - 36, 320), agentContentMaxWidth ?? 760) ScrollView(showsIndicators: true) { LazyVStack(alignment: .leading, spacing: 12) { ForEach(store.messages) { message in - agentMessageRow(message: message, geometryWidth: availableWidth, contentWidth: contentWidth, proxy: proxy) + agentMessageRow(message: message, geometryWidth: geometry.size.width, contentWidth: contentWidth, proxy: proxy) } if store.isAskingAgent { AgentThinkingIndicator() @@ -1399,12 +1397,11 @@ struct AgentPaneView: View { .scrollTargetLayout() .padding(14) .padding(.top, store.messages.isEmpty ? 22 : 0) - .frame(width: availableWidth, alignment: .topLeading) + .frame(width: geometry.size.width, alignment: .topLeading) .frame(minHeight: geometry.size.height, alignment: .topLeading) .animation(WeiBeiMotion.panel, value: store.messages.count) } .scrollPosition(id: $visibleAgentMessageID, anchor: .center) - .padding(.leading, ContentRailMetrics.normalWidth) } agentInputTray diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 1cd59f378..99615060f 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -687,12 +687,16 @@ let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirec let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("static let railOnlyWidth: CGFloat = 88") - && contentRailSource.contains("static let normalWidth: CGFloat = 28") + && contentRailSource.contains("static let normalWidth: CGFloat = 16") && contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") && contentRailSource.contains("previewImage: NSImage?") && contentRailSource.contains(".popover(") && contentRailSource.contains("SpatialTapGesture()") - && contentRailSource.contains("private func nearestItem"), "shared content rail supports normal, rail-only, delayed unclipped hover, dense-track mapping, and real image previews") + && contentRailSource.contains("private func nearestItem") + && contentRailSource.contains("private func hoverInfluence") + && contentRailSource.contains("case 1:\n return 0.52") + && contentRailSource.contains("case 2:\n return 0.22") + && !contentRailSource.contains("WeiBeiTheme.hairline.opacity(isRailOnly"), "shared content rail floats on the existing pane edge without adding a second divider") expect(contentViewSource.contains("case .immersiveReading:\n ZStack(alignment: .topTrailing)") && contentViewSource.contains("QuietInsightView(compact: true)") && contentViewSource.contains(".padding(.top, 24)") @@ -2341,12 +2345,11 @@ expect(notesAgentSource.contains("if store.hasSelectedMaterial") && !notesAgentSource.contains("starterChip(\"梳理材料\"") && !notesAgentSource.contains("starterChip(\"出复习题\""), "agent starter chips hide material actions without a selected material and avoid clipped long labels") expect(notesAgentSource.contains("GeometryReader { geometry in") - && notesAgentSource.contains("let availableWidth = max(geometry.size.width - ContentRailMetrics.normalWidth, 1)") - && notesAgentSource.contains("let contentWidth = min(max(availableWidth - 36, 320), agentContentMaxWidth ?? 760)") - && notesAgentSource.contains("agentMessageRow(message: message, geometryWidth: availableWidth, contentWidth: contentWidth, proxy: proxy)") + && notesAgentSource.contains("let contentWidth = min(max(geometry.size.width - 36, 320), agentContentMaxWidth ?? 760)") + && notesAgentSource.contains("agentMessageRow(message: message, geometryWidth: geometry.size.width, contentWidth: contentWidth, proxy: proxy)") && notesAgentSource.contains("private func agentMessageRow(message: AgentMessage, geometryWidth: CGFloat, contentWidth: CGFloat, proxy: ScrollViewProxy) -> some View") && notesAgentSource.contains(".padding(.top, store.messages.isEmpty ? 22 : 0)") - && notesAgentSource.contains(".frame(width: availableWidth, alignment: .topLeading)") + && notesAgentSource.contains(".frame(width: geometry.size.width, alignment: .topLeading)") && notesAgentSource.contains(".frame(minHeight: geometry.size.height, alignment: .topLeading)") && !notesAgentSource.contains("alignment: store.messages.isEmpty ? .bottomLeading : .topLeading"), "agent empty state starts in the content area instead of being pinned to the composer") expect(notesAgentSource.contains("canPolishNoteSelection") && notesAgentSource.contains("store.selectionContext?.isNoteSelection == true"), "selection agent only shows polish for note selections") @@ -2567,7 +2570,7 @@ expect(notesAgentSource.contains("private var agentContentMaxWidth: CGFloat?") && notesAgentSource.contains("private var userBubbleFill: Color") && notesAgentSource.contains("private var userBubbleStroke: Color") && notesAgentSource.contains(".frame(maxWidth: 520, alignment: .trailing)") - && notesAgentSource.contains(".frame(width: availableWidth, alignment: .topLeading)") + && notesAgentSource.contains(".frame(width: geometry.size.width, alignment: .topLeading)") && notesAgentSource.contains(".frame(minHeight: geometry.size.height, alignment: .topLeading)"), "agent user and assistant turns share one centered reading column; user bubbles trail inside the column") expect(notesAgentSource.contains("private let agentBottomAnchorID = \"agentConversationBottom\"") && notesAgentSource.contains(".id(agentBottomAnchorID)") From 2710990ba3bbdf151588ebaef167806f578e4da5 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Fri, 10 Jul 2026 07:18:21 +0800 Subject: [PATCH 03/36] feat: add sourced empty workspace launcher --- Sources/WeiBei/App/WeiBeiApp.swift | 55 ++++ .../Calligraphy/lanting-clear-breeze.png | Bin 0 -> 33121 bytes .../Calligraphy/lanting-universe.png | Bin 0 -> 21912 bytes .../WeiBei/Resources/Inspiration/SOURCES.md | 34 ++ Sources/WeiBei/Stores/WorkspaceStore.swift | 57 +++- Sources/WeiBei/Views/ContentView.swift | 2 +- .../Views/EmptyWorkspaceLauncherView.swift | 294 ++++++++++++++++++ .../EmptyWorkspaceInspiration.swift | 178 +++++++++++ Sources/WeiBeiCore/OpenAIAPIKeyStore.swift | 28 +- Sources/WeiBeiCore/WorkspaceModels.swift | 4 +- Sources/WeiBeiSelfCheck/main.swift | 229 +++++++++++++- script/build_and_run.sh | 88 +++++- 12 files changed, 936 insertions(+), 33 deletions(-) create mode 100644 Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png create mode 100644 Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-universe.png create mode 100644 Sources/WeiBei/Resources/Inspiration/SOURCES.md create mode 100644 Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift create mode 100644 Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index 4e59a66f1..11f6ec06b 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -335,6 +335,45 @@ private struct WindowChromeConfigurator: NSViewRepresentable { window.isOpaque = true window.backgroundColor = appearanceMode.windowBackground window.isMovableByWindowBackground = true + applyVerificationWindowSize(to: window) + captureVerificationWindowIfRequested(window) + } + + private func applyVerificationWindowSize(to window: NSWindow) { + let environment = ProcessInfo.processInfo.environment + guard environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1", + let rawSize = environment["WEIBEI_VERIFY_WINDOW_SIZE"] else { return } + let parts = rawSize.lowercased().split(separator: "x", maxSplits: 1) + guard parts.count == 2, + let width = Double(parts[0]), + let height = Double(parts[1]), + width >= 600, + height >= 400 else { return } + + let target = NSSize(width: width, height: height) + let current = window.contentLayoutRect.size + guard abs(current.width - target.width) > 1 || abs(current.height - target.height) > 1 else { return } + window.setContentSize(target) + window.center() + } + + private func captureVerificationWindowIfRequested(_ window: NSWindow) { + let environment = ProcessInfo.processInfo.environment + guard environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1", + let capturePath = environment["WEIBEI_VERIFY_CAPTURE_PATH"], + !capturePath.isEmpty else { return } + + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + guard !FileManager.default.fileExists(atPath: capturePath), + let contentView = window.contentView else { return } + let bounds = contentView.bounds + guard bounds.width >= 600, + bounds.height >= 400, + let bitmap = contentView.bitmapImageRepForCachingDisplay(in: bounds) else { return } + contentView.cacheDisplay(in: bounds, to: bitmap) + guard let png = bitmap.representation(using: .png, properties: [:]) else { return } + try? png.write(to: URL(fileURLWithPath: capturePath), options: .atomic) + } } } @@ -682,6 +721,22 @@ struct SettingsView: View { } } + settingsRow( + title: store.ui("每日灵感", "Daily Inspiration"), + detail: store.ui("只控制空工作区里的出处内容;文稿、对话和笔记入口始终保留。", "Controls sourced material on the empty workspace only; document, chat, and notes entries always remain.") + ) { + Toggle( + "", + isOn: Binding( + get: { store.showDailyInspiration }, + set: { store.setDailyInspirationEnabled($0) } + ) + ) + .labelsHidden() + .toggleStyle(.switch) + .tint(WeiBeiTheme.cinnabar) + .accessibilityLabel(Text(store.ui("显示每日灵感", "Show Daily Inspiration"))) + } } } } diff --git a/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png b/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png new file mode 100644 index 0000000000000000000000000000000000000000..50305cc8bfb00ae496ecdb36bfe565605e8d6ad0 GIT binary patch literal 33121 zcmce+Wmg<bv@RGRxD%vtcL?qdP2=tacMH}KJh;0%1c%`6?(R--Xxv@zduG<0`wwP+ zs8wHT%d@R&?Fv^`ltM)!K>G6K3#yDXQ1#0f814V|K?rdFt<jMY#$Uep)5!qE)ZMer zec&6+Bv*glM<?PNL8BN0cE2PTkLZZzQ;7uxP{~l_=Z8^5e8v0?C8jP45=E2+g+nI< z?h_>m?sLkwmAzJaI$S<Fh@1vptoyXTZm!v8FY>tL3PaQvwG20M!I=Ml)4eE^6!3p( zfK03$Tvf1%$2PDtOh)k^nIKSluK&*_gOGWuH6LuR0@-jgHhS)6KFbmq;CoEzpv~ug zwHoDXrid!1%?4*rwN`l=YX2`sAkf2V_%v^-l?1Y(2T+xKyNK=H7V1B7&kn?o0$f0{ zyf*ooD+L`KRzUyv3}?KPs~@;(nQu8-8Yxz|<71q!nS66ybNH0F!fH@k-gQd<Fw2X0 zC?(O7q+arWwEKUF0Kl0P156qt&=T~-m~2Cn{T*ep$Q{ub1-1_XUr0bU(6hmm`$Feo zRybD#1wZ~T)~LYznnLgeH(Ox>3e%^jknlIuinTvq3fzPt8$1WkxrbRl=&uZj$E~a+ z|5wWeK3!GOyRj0eDLK|E*)W6TIPoX7XK&znegxrm`t;zb{!}YWHrSRA0@@Q2uH#Y_ z9v{(^r;Z8>3j=%&dw%*K>64?n%gBRSA?ng%EIkOe!2y?;lr)V{xu2F(t!~-iJxs9; zjL^?l{Ha#2Y;ZY+`IRnYBQoBJ_5U-NB460(?$`*j!35bjOFGh!L1Fv!Ea#H~y5<d? z<4xXPV$NX_8sEi_I6djL$EE(S?m*xIhFL-8e<126-N9#pr34@!b|?(vG*40B3ox&i zUC0l@2Bg(sg?V|oox9<+sn*IYu<gjR$(Ygq@VGy?bDnBFCwIV$h#CIR9wuP0-Bm!D zPY&9fz*OtcEby%WWT@}yrLF9}7H;X=R4esFD}{}zk%G7j+hj{!s1o@b(oh1I&i~_p zcPTN|10|QKPSgF%+$=Eih!-WriLNaMt?_%@{TU-MsbNre9oQb0?$Th}MbkYRvr#Nk zhO(fxp%#3>On09VGZePO?CwA`y_OG4_<WN<u#$>7m{0ydkZ(xRf9g&8KSBb-9d;cl z-RLuqlLQsB%v8FgpIB;!WvO%LKbX!D(%1Tz;2R=`x$=dtrhOy8_Bugr$HAlGVg^2_ zBNlWm%}Cn^Q>|==9GKCP=ohtB;EOGPPO*<StqvB3i^kxpcrSCx=?IHi1g|B&W@=&5 z=$*q*TF&d1|I*{Xpkk}gfcGHA#8eTOG0F&Gis=$1@L}1%RkQNl#dOUMTaa0_CeWR$ zUyJ$8E66`yF}||E*Nl$sDM^WEWxEhPWLm$N=hz$TkFf$}>Xe0v+ckS^2H7y7hwNru zjXm2>wJJ%Do+bxUAxZJ<+!8SS@o&VW(EeLd?tf4A!l`i*6h4AJmac)BTxXi#;<B^o zaF=OnN4f3*?t2t@{W0Y3MmfksL6QG5a~7jz_U~OSYgAILL~ziXn_~A<DMV5so-<yf z2QuGFWW%}SG?jgp)jq`MhGXF2uDb)t0z2flZ1S+a=gG@1`++nGqXL!Hrl)Awh)Qdi z{n%;=UD0Fg_vj603z7e7SqMjE`)(0=3-6of25K2%5G3CYNo2}kHjD}S{#NY(JE7Pj z>szk#LoCMlC)w-Ls+_TeNei?mp|;kecx$89+7q7b{tLa&StPy=ESJT6-l$HF8*L}i zxmwq(qp|lGBgyHNZ85}eHfY@YxqJ{BUdZpAEHA`}M@Jyn5_qZ-j=CIS&<ArySjlg9 zGKbIlD);(HFsYp<3(V8=#i%;Rvw&DO+Jr~%mFvoe7kHBvdzvd#kcSh{^Ekgsu)M+u z7h7e{;QVokN5Q#ifAJG`B0l@i4C?fgy@;=-+tk0PTtahi$`8CK`5%s1ZJ1?Ir9w{= z0&y80-%Ic5E$g!QedfY=tLle_*jG&7H(v!flfUCZ1RxI;y^WH<1(;xhF=hf`YluVO z@BKj3RFmkbz_(5`5eFK`&i!VPPePj$aNrZ3=Vv#Y?-rjMSK45e%T)Gp)+;lGGU@)^ z-$^-M&%)+$!CQP)v1I|@M#(6++%fkI@P&Fu7ZmIeVZc_PN}1I{7_JawcL>G^frtnQ zvh&-@FWS%lxi-pai4Op!^9>R<8#@HOyyiH8T1*oBV)Xnt6gJY6=cn**nRnBE?#ukX zJ)-F`=5Zh)p>0^a`pNM1Isevw&BK><X23GI$IVt|LK~oEW_4ff_8<NM6Q>50v6m9o z!BPuO6ah8g`j?M3j{ht72)C<YdJ}^oo59QWL>?!woUqm;Q;X5R1@DV@sg?p%tgCg@ zb~=`w@PMIde^ne{*bvoYeB%m6&q8VL2kK#RsI7giK^ZZhuT!m|*UzBe+!FZm<L?<V z9D8~!6dA|zljdIHCw9R5*VOaVEU#riXI`M`qsWst9RvO>;A(2ZGz;u@H{Y_GSN8B< z0fuh(jgo#g^xb|eFA5rAJl^<L#6oqi>Ptj+`3&<Rf?WN&cNtGEK%vzcqu7N;r#&6v z6d$_!H!F}!@RDZXZGphE8<}kPCd-}G3YfrFyiS+zK*{39HoEl_$m)8u>Q`%3fGd^f zaeRT*IL1EVxqmNA7lIj$`k=7J)7x`Xt+nk_fHl`&5U(LHBYlGpo0~S`nBade_a8<t z`D8x(f)BXU?u{{8r|!O(n8|<0K*@%rnY<81smWiPozzO}_@Q<MQt{DZLL+$<<_yxo z+(2dj7_$@c`8>QPe3(dE_j<oTVG0UNl=KAIY|QLT`HVjg#>dtE8VPMQ2K}NNv^$q> z9pH-+XMG)dK6%%|zP<Sq0xqu5J@--sIDubp@BDe^O~Yy!tn-pz?#HHc2KK*tG@YZ` zIihJe3J%F-%x!{XAX&fhCURd^g?3z4VO`TnoWNzoM~gyCMqj01%CBp`W_SsVek~pB zmG=(|1BINxF!j6lP8>)?tL3W_=aaoARy%o5^SPmotZI(*E<N)s7&k@`bph|Xm6S~l zG^9+aS^*o%!RyA(LKj)D(D?-On6i~AyLuS?W@!sp3k1}8ERR8iQhqK4Y4gey<7AXS zs0IOHwk&vhZ=n=eDo9a=P!YGkrQrpTHi_Bkr=XulBb6T>FzUX=`u>NbKl#)h8-W34 zG)&B}U7?dF%jTR#j-&lu!06PY7C+&qA%?AmR1NxXV$5+(fCc7aFeywZ-C%oM=U@`5 zP*w9#pHy7@Ab~(8jsG<VMSlD&G=8J7O*SrOV3FT4c*g5QJMMkvxcXHNJ}Zbr)r{nG z6CVD_mTV&f{Y4h4dg0%iF=wOy%5nRQ6rOl-f&|>R%l_)~7Ko%eY~`+N3pvK<U(O6k zht}K~FW96GT|ZDSyRzQR3|T1JT&4)s<{L;Z-6oZ8&<oLY5mhX?B=79{2?cehxrgZ} zI3+Nis6cZPieP$+!*r|wPxk#4@ph{^`+&e@6CHOZuN68Ak0`YeA;rzlW8lc?{d$oA zRB^V0s6s(OklhlBuW~t(V>+MHz7MHRyLHT6MOx+jY2H+B9I@5vs9BVU`W1I?e@zL; zV;!|CfIN8+b4`60H1B)FK@>RJ+O>MNswG1>eaKaFNG?97S-{4aR=S`inz){;5G_0D zq5Tw{k|LowU~Z&$d|T`!KNq2o*_z)RhB?UgwEi{{Z{f@6yTN?SBF`9YMdD(T6)VkJ zbEn*&rLwMNRs~#uTT|Vka|+XzXhA@)bSrcpXw(*wClKwA_^%cfjInS9&=jEf>xjtQ zwraUV`zRA`(Zi+0e*dQi0uhVwtQEqMkSnxH8MB;X>yO|klpr6}^O#niKErd}(Ucgm za-nnNzg#I;Yl$JLP!q!7d?@|dZ`L$2qGoHUd5ViD9A2aQrC#k#J=<)b_tP+6Y~Hey z)d`UK-Sn!?7Y}t{Mt4`6$^IxvM06qIOhZ_NkDrYIPY?dQ&ZAVN0eQ$((I~N?M3JYH z1aMZk9b4D<;FUqzP8v?hNF}ia5`gUzF)?D(L`cYYTI5wGu+Q8jeXLx|Tdas?&I0>R z?@Tbl=Ii8=31wfE9ZRKJuQ-xS#5Vl8u>K50f$E|K9!yQ-Y>hYSGpp2yiNrqrc}FFs zN8brGF$dY~d<J3ZB*AEOWwSQgg$$)F2OhrF5y7Dd?ftuAY7l!K2kZX@HiYl4knj#$ z0Y`FB>1dLPz)t_R`ko0VBd0yOs7Gj5%vS2iUixe;bCNeBNvC~xI!Oz7)>3YWmrlPe zYnghW%`eSij<|km8D+0=l@pq<l>QSk@vT@BrySeDfyBh1qE@}eYs`dA<@83W&|5b& z3VY*%fX=#UC-js(52wR&n8d)wes9N@IHErOkhJ@xV#?nk%aQ}qH$_Ove$GyaNj%;Z zo!UI|bSgV~1hAoP7FRQ^!lm~l-{Wv*uq(_2>$*s%+ipI@-dPz$ErSW!lUp7{)ot<P zr1sg&T%2YBzob><%BijVXBwc@YEcBSm&aTSi&zqfSs6Ry!KVVnVoseZ7_qaDwbzeu z+L$6=jwR>dIB*q;<&0kV2)LY)jiTn3X8t@La{9B|4-c0(e+=<GB2cvO`1MfyWHvxV z`caqrFJy~nFhgxv19;xEu=f*YsER;uIe#lsiYRf-l<RtAdGBgK0&_Jj>?}=Abk2ou ze<!stgmVc^3*I}#K<SAcCBegS>ZQxUcVKH_Hk;>%mDqDmqVl*#`1dU&pK~kIo=Ld% zZEw);CTW`KKxh3fnqS7ZIb!geX<7}2sWdgd?3wYt?!&!-dAWpRkv(`w-&uSe(C_-j zBA5J3nmrX^<f1dj$xs%z<v40W$X$m@T8V?a^^vCMd&CRIOqKeeFUG_s?Wb?agQO`X zYd8yi@)r!^rT3e|u3l>0{5iwXY94Dw8!m&3o}lMoQ$;@u4R`r+V{%iIZb1tqF3#Gt zqu#7FEFts9*+H&WuWQ$k*rFUuCc1xk$+vF#qZHA10JgI8Cr`dd1ykkgKO7_VBR|nv zt!xn}{@Q8_=}Sr++noJ~O?u|zR*Zf!bexJ6%f3g?0yh^5N{|Mp;XZi-&HsEfW4l~2 z#u2o{11Qm6N7Gq7SyB-k*~D0wb_DloNdK_}3HOgr6dDn1?*e?!eHKwe%xD+R7R+%I z7y7X7=-{B>sMG#7ed(w~?}w)T9Sz@WQA_RaB!zbU_Jcu!C%<(qXYQNSmRcF+S~#R# zF&z#!_Hjn(n9*6klKycgvip-hV)(XCRbtPR8`q{fs7PicZ|j{R%_4_wOwOt|7Zzz6 zBqy}!(Fw(!e#$yUeE7V|#fk-5nMFufn_(4iCeAl>ljQ*mO$C;W9<oa<gft8yJ!-JQ zO;Z6&nMP%--kl1_<<wLIjdQWQS+KD|(-eP^FVqZ--&*5EmZWp6A4J~0fv%2X$x(kH z<d!%G-oHcn|M?aaND}$~nm+u!1(O}8Ls#9agI%D#C?OYN4`7$Rke+RhaQFENw?6pv z&K7RN=A4VSK+7|fWpoV0Y#QJ_5~2by{K3B&ch)z!qzXX=(Ne-YVXX)qh5ymugF}y@ zHwO3UcVA#U*3G-~YojPRq&uJncNECl`4Flb8LiUIQ6j*$2L-P(nEo~ip77he^%B5s zy}aC0ZcklUsYgb>M!xwMjqs0Y!7E8Kb>5^cJ2u7A7dH#=!qnz8(a$D_QlHn>WrHer zQisl+)1Jpvng={EiHVxk;}buwQQ!7?Ni=~6GO~!FV}%;f&?5PRfcIk0bqWDdOk-P$ z!5n7f1^d9kTHlst*^os-=^t)Z=hu>N6Td}0&>qgirD^VTzV0i6flg>ba@1GXKBPkV z1*QB(ZT#6T%ob50<cr>Hvy7hLDyWmB)Lz8P;dY`K`mVAO#k$&;v*_$A;eX3biBV)- zmzE<0+D0{rJ}T++*v-K+1!3s1k>L^7%9>wVtx01@q%(dw^ExNuQ%u4LgGFYWq>$F2 zZ~)rgzRm924shY1xiq%MS>s-Jnv#<3pYDj+eTE?QQ)XaU&fwN%Y6ExvHx*JW3GJN; z*j7SZbxOt*0)07?A1KBxg7Y}WekV^W3v~&s6Dqu@{IQBSGh1QM!_I;fcTo)~K{6L& z^CcB})N!Zx`tIkrQbAA5Y+X6Mk53I}rqIiHDniO#XBkFDW%*BTamH^@$DNz~gv-VU zM#zC5B;Cm&n-Ra<$D5h<^e~UD@Pc_qW&Xl{cC!oPnQOboHBMjivB3LOCgm|E%r>oe zJX-S^8d&n&k5ooGNy1D&hPXI)Y4YN=L$^)8s*dxR!6n&I7Lr*+E2wxrqTEM^5<arI zf6v87?{hLSGe;zzRC^b|g?U9)UklO>-m1L%wZbOXUiItt_HZN@-QNKBd#OVh#W$Ov zW!l*)5Lb<Mq>5r&2~ye42-rf5L5)dbZ-5RLRVg;Ft83v0j~+!kRY=*ujE&UngJH0{ ziCoQaCEDeaSs_wYD8V?_)h9EnB~S0=X+P#ov*?Kqiw#OFh{0%$z=z=Z$Sjp;ET&x7 z@7CfG8-{UGTUgm_;m>`ICjPC~XpKpwE$$70ws55g1-=VKlU#UMrA`C98hj@VrO9>= z_TwxT!m%8nfGT~N+03*mDr9}5K(p^dvgBIusJtZnqXorgLWF%;8+a^(Sg4{q&U2(J z?d~^!^(Bp@;CWm^AF7bT$E;_*UuGYyek;hxkU&y0!cjd$GbnlYWvcpKNUdn4nZQ*< z9oPVo5Bs{ULRV`ahs{@K2&m1JftP2mcma-hqvXd|5HLNE;ZGpMcPan*R;V(~VfjNr zclJ;_GwSRCJ~ZuK3H@K>k<%mW+s~K@-}3^^0PrFGh9O`4T$o*44Fz*R@~;V~-e^m5 zs@*3l)5YHxTA`Vx_9SuYbf;JQT$roQH@7sd+{Z?dX;^hSoI=9+zh>Bz0^=kXQ@5ia zT`npCilaVO+3X`ex`i&gy0iCy(cPDSBdm#`D5Cr{hN4ZOIleP24X7}1Dd@zhrbeim z!Fdu%$Ey|rxA!+mptd#i$mo50O!07M?xF@dt?D2Xd}8tkzt9iSLTtrLOZ^4MjpbU< zYQr+0{>^W~No{3FpAdacYl@$7BgV<~rkrvi9|=J%gTKxd*f~esZ>)QEL=+C1l2xRH z{N#>8_0;=?DW0}(1k!5MQ))xMM}`kenf&os4Tr+SaA+tARr?`w{#3A`26T;bF_g>F z3{0kyTQ!aI{S>8Oi0<=Tv!YveKiDCRyPz$TJfOII1e%SH98hubGapP;MIWOs*qgJ~ z3(U#XFlSxo9<mxtg-pnrtYyIy4;(D8=@vGAn?HldB)O9xrEtTF96w=u#&a`~ELd>? zk!_4TkQ`_uhNci;ZaAzX$aEw($XMIf4)BGnY4~^`<?+t@6F%iCwY+oCTim%UC7TSV zLRkaDVa_v1=JhZU5S*t?k@VMb@p5bqT(j%Xb%494;pQpZpkONKOY+eUYm6M3m}9=4 znv<GcG=FBQYQAP(Z5tNcz}pRRMlq%?Wr-2$FBEaf*vC%XulN1##de3~gfBjH3Dh^B z`X{0HO33c5Wu@7Oz*7v6eLe~2<I<eZ4QOtK&KpM4>yBDEUQs|7W!=u>t_v1&GDx3Z zY!0j~ZNR0ReypYU1_JD~u8r`A7WG(ntIi3&ZIs`aa&~rz967}GCXk)O_^_Fsr2wa% zub-2>zlS?_!=vnYL=&20zDcK1w^q4HX~IEfBxYj8ZzJr+wgNX7&whyw!r_wsxo3~| zzxhDv2zt!>zJuZY8#>1N=~WGsXZK*)5T<PSkRj8+wOPU?%SqP+wN7$tIgcwRO|BN} z9(J?-y~!Zxnt2I$aZY1`Jv$;xK)FP#BWWtcxzGv3P1{7z9sj^Ox1n-?tu}|A18hkW zD~28XR8VdffeOxjTw#Xewmx61_u@Jnj3|C4g@oIGLH0Lzk##c5(ttWus`s1LCd4{v ztHJDDHTqPe1?7bh>PJq%8l0lF;4<tSFkEJ_P>+COt&Gh3`2|DLAx%&nb*W;A6)xVq zP4&Tz_N4^c<FNbpSP6$&kSA-@D#qzYo9VHzn(tswG~%GwjIFKMRB%$}iD9`W6({!m z5*>#Ufy|>Ly(exh|4>+)AwmD1V8?faLx*aCjtusy@f0?a1><h)mKZk`--+8zXo`lo zz{p3Z3*~aK0!NKEjAD5WlfU3hhxo%!V_2I*_%Y8k7<pl5m77sK1cY3lIG(By6@%%& zATeRl?s5m%Bxs?ReSr^n<j3(V?hSM?KG~B|S#80lX4qpfobv70=}?uMzZ1zOeXe%P zJ;w!S62FM6avP4#bOh0YvoF&PWHOeXoye%qoPg&;ML^eZ^E~V>>b-ZwrOD7Rmkt!@ zXpnbEvR~%E-WJHJHfcSKtpt9gEUR;D%I$*5Uc<CIHg|goma3RX_KO=o(b-ljw=d&e z2j(YViXLr6r<^SF2XubNU0RCQ-PrGCQ;Nj@qS7{8cMsPZO=;h!%I>fJPj70-qf}6@ zYlE%glF8UVshzMwwVIqi6Ahq6f|Y7tzvatuf?qJ&`K-|XVa{FUlOqkce<b#2@x0h# z=Kq^-+yr(PMpb_1GMa8J@Ttj5`{sr>;U(^*8KW~9z_<>8_YDaDZC6^O;^K62431YJ z+jbaZ<<0dTAtoa$M&b4P%}pq9x6WSBP0OH04hI2EQ0)}E*>k?ieT{Fj;*HOh^u)IP z8#A%`B^fhWabEsPYlu(;4~|T%C<GARR+%{S$*|um&v6%%>U|C(^fDjuz=fN%J?g!Y zA)8b}Ew5+A#ml!i;&kuCQ(&#&%>Ly8Y~EzWtQCxqs3+9s#A+UkztNR-{{UZYte3Yq zF+>_8n{DJd(rl!%El1Why`q%UnE%Pu66y7P<uQZJg)Lyu#>&P&b9IlxusIED;M~=$ zsLU2a{2(?yXOgKjb({KyCv)k6YT6|pAYoRz{oRZd<A<4`(vrG5;ZK}G8qgaL;ChRq zCm^dhRJqwW!&eS=tDQ+2YmI}5#$&2z1=IH4dwwNF3U7>jDkaCJksG5kiXTP9vZ%Kf z*h@Zt3T(KYfhh4UW-C9g1Z$c5{N^#2S7PDFPXiuIcfOKD!QAh?@3<64nfIU20!8c_ zbl)-p?h$Q_RN`A_YOYZvUbbfQ<qPpq-bC<9D`jkGW{y^nB6xE#FMV-UDZ0>QkI-T6 ziaoHUHTW-+)Nw+hw?<`LR1$`Y(U3+RSbxLL+>{S5dBNkT)o4#4U^pqqBi?t_Ax#+P z|93BQ676;TF+_BDiS9pXNfkA`cU6DyqUNC)@NIhk2_4|@(5e%F@xyP6`K~zniD-Nf z8}PB7N4lbTgj|A(RDbwr7`*aFWGL)@;#Xhmos43U;N53>U27Zw@?GyUGhwXvbULCA z?N@`}ml0#;N`$#Mg`I6a+~d_;I5U-2pqQWq8TF&=nX8t61+bbPSyzrP&5`4U3M-G| zp}a=qNgk2#+I8-!OSOh3g_mbI&9g*fz&F5aCN0ZVOLJ+Hxx)Wop^N`0w*4>;tOMD7 zP7$BHV+IZ9*Up;P)wm0?;4?HjW?a3b1VNqZ-0SuD4?O-F+gfIQ=UCkY-S-u;oeZ7& zTcyv_9FUR|?;(LZJub$la|`y@+=bA^OLV?cV;5|HQOkH}O_O@1t${`Nyb4+783Q9) zGob}GAqq-2#N2{R-d^qdJTmx*Ln3#;(v9P{D2E4k*gCl7&2dfKl0oY5Np+k%rLbkG zc~!JBe=4FUrKg*@yKD)Bt0O2gmk)l1R6rIW%cW&91>5F`|Hj+H-hR>=(1Qf*{)&@d z-2#CX7DWJ69jRvb9XO5z?$E+}XRZ;`F%9R@HQv4joE#|1Cyw-C9or{UfRd2%S~INB zTgo4?P33$e!7WDV&Q`qpzsrB5!n$+6VPO8rKcVVdJlh5+_+zo7I-j#Hkl8~A<h+u> zNZhM~Vd^wE=<A4-B@4Gbx!W<;II#T-<)eDd%-AHuXDp9U^#`4fiW<01oV5a^vVAyl zx;{+_a1#&D%Z-IGHmc{)E*rw13`_L{w=h`E&qdS=t4o!A3rww$0letqiaBJnJ1U51 zh2lmAdW2R8(;;o-_zJ^RmyZ&9k>$o_o?lhJ`84 $YTqG+>*4RV8TjEncj)K)!#m z7l+osPUk_U!p_`YB*^h}7ZPEi+r!12LmB%AA6#l7c(=Q=B7v`Ph9lty1D+y>B0l0U zk87=|3blOpR`vzQ-KaJ=*KLq#desLYJEsQ?^_)?QA&bP4o1AjwNM(n5UW|n7)$C9$ z`dwYt4;GY)kKvwGo7mua8X@E|k%Z}(s8b{EQjt&EZcGSvgFv)PeQ3&WpxsAfa}Xxd zZm$o0fhgDIEXRo80jH{tZT}=>vS&>;!!4@E({w1EEgxzT>q(IiXAMI>WE!@M(pFwp zI$NKhQ1mRcWCgjbPu4l!)j_Eb>>a#NgI26w<N(=_YLRh^)GL~x9~SEkgv(3?pLFcT zm&E1;SS!hVI%s-pJrpvc-WCOO=g{U&YZem+OAt@TQU%Mh!JXa+Jat<Jy3Day>P=lQ zl2}L(>#kk*e_>P05gP9Pz=zOD`QB2K%ZH*D^>%;VvjM!6Ma!&g755s=*g^A`H7t{v z59$?GmUZc3>41?BjVs4BmI6pzQ?0rBEWzI&Pzgf*(bt{iN(;Hn+5XiUbF>KG+ug_h zH&0k{;AdJ}deqTTe7sAiCbgY6vUwEm()TT%ByG{cyk=zTvn_9w-9OTQDDtf{3jvO2 z$V2+w8kbrCQGH~H3`ZI77gr1|bRz;0=~8cH?oB5)Srje}SHd_u_OqA6w(mjV?p+aG zcOZV{)vjO;hvz6~T?OiN2?@#rcFH+4y^-~BRu(vFC^I^r1o~iS(C-YXGMtJ6?*Yd+ zrZte~GE>^LFu+)b)l;FfkiYrP9eepW+b9r<D3mzQYVvOY(|MnFTJmgY6zJJ{Zm%NY zlr&s=a#_@|;e_mVs>(hm(=fFv0MdvNR=cvhmnuywOOV@aJX2|R7hDgX3Jm*nVdXp4 zST%nrTy;G9K$s;b#5wHR_eyO=BH9<&6TFmQsofI!w%h_Bs%7Y=?Uioc%cKfy$B=Q| z6>YlTO+x-?`&$&-R4Dj3NxpSR&f$-bq&si>2>YR^+OQ?6Rgm}ys+YpK-Yjdu1?5P* zrfx-!iHT(q`lj%yC3RYTi_$=5=LQ&?sb3fQ1+s=$dd~Qh?1z^oBB65Q>2CHJGv9nC zSLX+i{8@^P=gcRN6=M-x{GMm1R8Hq$z3^9^$Xi!ISC-_n>u=$}K{)P&_`8Z>I%b76 zY7T`qa};*Jz&OTvNR2NJ$<`=cl~RV9@TUiBU~t!?oVpuH4rVr|yvpLUq_I*H-My@$ z-<6i9cc@DPNA0S2lEe_(Bo$||I&KxG5JXW@VQYeDA0Si4Y~zQj37ddfpa4w*agM=P zUeg-pr@~ax8oPb44m+TWZu8AX^N?owNs1l*o*{_3xmhhN;2`~gXE@E5BS7ig7+SF< z?WjW1vUS1eg=W6OMAzryt!A)E>d4v&lP+^pUO^JXjMckCV20k$IML=!3LzjrzFa3? zOKEP%4+>lKFP(OF_NmTzy!JxpTwXJ5D17T8NDE6e^G)cLreFqzYQwm7Mya6x7ACy> zq5Qxp<bd~^B{eLh4N@FN@z?)N4lpRN>r>FHJkqJ|LG&vmzA>xerz$jgSB%XP9WD;K zK?m+87|WXoaD_4Gc!W??=}~>kpD)OD5GaSCJFl9wQxPa@!a_GaEbZjB=2k@&EkBRK z)cr+&475dVtwL(%e(0h11$_($r0fgF^3DepTs*x$z{4;q*;@0+O3(<O(zNxl5z58= zEg~@HoRpnAu9xWD7E|fbl5crh@AkFUIp^0kNmqcvgR0<OIqEGDPhervdfc$aaPVo5 zmoG5_mOWCIA)*|hc0pHb37dNK+j%XwHX8}ph~lAulpOWI(Y+uQ$o4c;dYVNy%<F`! zN<MQf6Jc}^KEisl`-iF{F>Xzoc7emniw$7*ufT%j5njFPhG-xqfjtXy6@Qc$utfB^ zuDXw$JKHI(lVicIulWs5AUei7h&`UEAsn+N)jPL(kvxXuG$H2Tzr-Gn=s@L56?eX; zn6*xV?jU=?La+K!T>9V^-Gt->vW<}V&EtJJjQ=S4??eOOuS+T~HG_KN-4+e=uqMil z;`>qB_o_Bz4f^^Se7cTPUBDK?M6bgCNUZGJNTo`x#QpO9($=XEk6YtM6!&N_sxfgK zevO)o?<w#j2C*AXkRlNEd`MtERh30_&B$|GBd?7FGBcXgu)+uBhEjua(sw55)aCnN z4c($ab7zidoktC9{^h62rlW1<{)UQN@(uZ1!ZhyIRjaidq{V;tQc*Hx@XCvs<sBk3 zbRrMPduTuMerlf}WdxL<o4`bZO@7$D$zOVsW^QkWDV|5~F?a}*$}PMz?gHofHdtiN z#rUk#f9dC<b5HL@L(egKysxLLi_V?Qxy!QuAz|x2eLY4jJiCHBGLlG;2O!4U@mb5r zmv4RvQMOXr8@e2o*BcAjw874*Muv*izkCqL3C5Z|JAKG!z-MJi&XaJ*|8u3%D`Kv! zbbEz#uM8g@g|lO{>+MTWr#zpwij)s)d+s*0Gq7was(mAQ1hpofPllGDxUk<rJG5wR z6!!zcIm5X*jBbqu%M856d)xMwrR<2lz3C$*s>I+gUqaA^fU35n-6(4R(<Gmhxz24u zmbFH``nE2_N(?E-w`-~Aq<6Yol;C^)mx#lAfzrUa+e4^>Wo}+P)C#SuW|f)S)Z`<} z*w)-cM^+>uLeB$rz%H8N6JZ?g##Org-;s;(tDPHVtd+ZaGkL{(0ED@#$=3@9LL3WU z6`$CP)rf$vEo1i0dbmUxJ6T3%9-3>gj0{OMa-So#qXbMfx6hu0g|tn*GrR0`o&Y<Z zWf1E0&Mw|Z*e7uo{oTZMl(G2gh~tbc+Q7Hu)<q4$AJhL?0P`5d`(f=-VR<-oMbth7 zep3cLE&!iawc+pf0UzOe>pgsyVK)y_QtA(K`GDSgjfp`G;~tK4GMOd2u*SUUlqvKW zQeukwqL%+!gn<)y{a;05KEUhl<2Q}9Y0*~?4^q{IU;V{58bBK>>_Xx|YS_sOt^T~A z;JHEx*yGAWBM~;j?B;2Qs=}5av!b6hUEh~zDe0|4T0KjAB2n{ql0&}M{E|ZN79JBT zo9JhJj`&%`X1}y^sulvRTX-2i#jFskS-f|gKmsc2=DKQq9^5Gyz)T8d*|w~%5O5Mz zX3<4b+{B8yr8d$N3Ty1l8EFwt%on1iMZ~~y%cZ~a17Bd#z4``KXuh#sty0|OH1tUD z8R?Q(uMUg){z1V<^O+VY2#h8&(S&}?8pgZ>gm=a;C(s1478949Q_oYLnosyF{dC&! z`V)#W{QmMFd*BB)^U4Bi{t=ReSH=HHAOx9QEWPytx|3{*W1mr;1z$=NyGoEbTt-uG zkFF4n`4~c<|6D6<LU9I*rh1a+GvuvhScGY+LvNn)gAkldvZ1S=WmrufMK4}Rc%?B< zpre6YI7MoLY}h97NNUDbYQBhjJM2j{+%kOLqC<v+FtO}??%Dw*sbiCL*E3f-SKg;% zkGKS^=9<aP#>&6EV4lY!jhWi_g(dhFE-CN*K^i$GD_#>E^SO=a|BPTD{WgxeXR!*> zgtH0eHF^^DM#4NKiUIXl8Rn<gG%o{<lvus3O0-haAt5oxbGc@ufb-L${XT~%z9ts! zjSskk4*_NE-@FK@_EY|~SU%`nkVCKe2i$XwQW689L!-$Tk3VP?X!T3nF!QMjiQ@!d z{r>exo=z1rLq1-b9g^E6=cL5V;r?nB4FfsH!u{upt@-~Poo5;pRhTW`9-k;#tsLQq zY@t>PUClpaN93aHt-oL2FFb8v4T+r4)3M3vvIn@L4`+OOP2De2#xFRKIRjM-mHv2D z!t)8_=5a!7G0UuU8qGY|pdi1Y6i<H%Mk)f5k<+A~GHAXPP`P&4mG`3*gah`Xi(<}q zd!CY1bCP{=gDRz_0uG3bBHpU^KSQOf%av_*OKA90&1|2@lqJZlRaxPEeiypFf6coW zC|Xg96&!$ja9}Z-8E>uX{fd-0ZG20Y(eeAT)$vM{N-|!2GUa|X7`s%aj;<18S6l!M znQuI9=eZ=~@RuZ02<*<eHYfSdn1<^+f?Hv?UXQk@{A*?pB}y-6+MaU#gb(I3@$S^? zqu>?J+)(32P>(1=v{X3&kA)hbeMz_@xF8moJDtqVBKL6QNeDOS<~uS1Uz_p?jlQ)L z<~QRZTET*%*aqi1u^EDQ{{>(gRYC3l7`NbNjY$8ow2;&Lm7g~xz0{rhzyD{h0a)UF zSe`qppNh2vQ9phf=N)HzL|(SXrAW#iS#U&Ei{2ewBw2I?GZeux=!EYQ$;eIIdRQEx z{KB3wbRc@Tu4Sdu3|6^@%Q`7H`3PobV``DA58({=4pj*+I><VegX=R_jV$`A4;%Ms zMRg3%iZDF-Id`Hg=NKg)qPXDy`dAi<yw}bhlGq@r+QgOpYT#|yco)y+9IZr1X_yVR zlk9`k3K3ak_Tsmbqcq^omNb;C%Sij9#%m`{^jbdIV#s+n_PHED@9(h<)jqLa7~7F? zv7TpC<dp+SAHSM8{hL9Ou;dGx?hfpjo5upkjR{2zm9{B3FNH?1;Xu=VLZ@|5o2sA1 zNDf5jh}3_okJ$DR9Z9mrD@nbNjy}CByE6+bkST75NbP-R3@+6dq@PZ|eMeoc{R5cG z=#o}8w!(wDDf$X?N{G>7H}ga3>Xo(+Ll=K@1*fS0-ELpG+Dz5#2(vlhoX^<aB}7vM z)!Uv2o;ziee2G&{t<$C`jE257x4*bUc{_tBsR{X8hVtWR)^nG21Oa>g6PONlYV@_D zcX1>p{3Br610UnZ9sJLPzb+DEZJv|Z7qJ0swbd2F3C30OCf*ZkB7D^uWhAypC{(FN zM#-uuzcqNrg|PRo-gFX^X^FSSZ}WmQ&nnLyk17HhOj#mb1e=m9>*D~FxN_kiE2*rx zq<%4?QAwp^#B<G2F^TaMr$;^e8EblGhXG-mTiHf}9l<vd7%3@7DCsgK87ZXtyV_+I z=oJCv_i6qlA<J^IB$)#&W~$#bwAQsBUW>N34G@lRnrZH^7^z2c45IeD!w&09^!Tje zZ(`Bq15b`?1PuId=_gkh4?8yTsLpG?Z&PKH@;n(Jo#G<nNHmgrz=dItq-J3ESgcXm z_~UxKs~TO`b@yFmA-CucY1#sBNH(q<Ld4>R)y5<{p*j@#dAu8LrPGh{Xe#sgSQUdx z6foZ?g2wjY!iKIq%AG3or@b(^=61CcaJ2g$ezVRuW*!+B^eVudX87HJOslG(E#t(q zVRTjuk8aN`#GYUH1%o_)6R5qf4kS19*Y%*`TAj?f6qw<?(C4Bf(?tmF4jLezy6U@! zHvaaX+)e&&cp$lX7E1!`58>MRkO_X92=emAM!K$3-u+%-^eHQcnZd;5h~^rj0|AU3 zVGJMV?r{E@0HD)SaAY+F+$g~9X(q8yH6qcAFTd5sTO;?S(UHqV!1d8pFy>?~{|Y%P z%RtlhQ>o>j62S$1RE<pV0pNTXtGqgh_MjCihY`sYW-In=9(tUeyUBm`@P$3_jrieQ zy)||pV>!lr0zLg}9rlX&bbXSrT>Ac95iu^d@=n=CeiTHPd=7gX7QsXMZ0^5P?x3<n z!hc$t{@3)ydj)w?IJN)HZBLB)@%)I8VE&U6ySSguCK(sWgMN#{vySF&(Ly%LZ}s{a zG!*G80vkymYZ<cFLL^AZ5F{&&nP#J!DxUb8PcU$r(ry|KEJ<0Y6aXLmJmMV#gDQMk z7N!}$6KyT=OKk_RV)+qbZ8dVQQpK)dI#FzPb&oO{8C!~)wmX)T^1NNji@~MD*(HKJ zfzGg9XmvS(-x~GgOBa^#@KbOe5Bjs(ESe=^*R6dT$6U~-xCb*~4Y>QwoNxa6BGCBZ z{L84!TrXd}Yji<<<G?8W<8c1{2T?Z)E1HAFrbN?vg@o->2*VmCYLl5x0X3{GKJc(P z(AX=5ZaNPoop$g`ao}HxEDCTC=2Wla8uaBNr!_mA^ZQd68ykCn-jVeIi<FUA^)(wW z{bi7Z9nxVe`^mNNM>IjDjU{YU@+;D4Ovz51Tk%iKaRksVUoG6-mm@Xu65E`Go@3UT zCS+dMp?!HC$gK{KvV$UfsdFID1DQ%_E*@&Q5ZNEQXdIr1!s1@?;5h<hFQcpR^G%_Z zS(;4u1pnk_zd9ItKWx<l#hLHnSglz?U)QKAKC~!<UZ@sl^1p@5Q6aF_6;l)Ixp(8@ zHhD7S5+zas0XiAxp4JOB8PWHPmT7-O;3+iap~kT`Vfo<0L7vgGg4(wB1hBdyN85BQ zBo!dNNb4zvkIP?CZk+}7lR>yDFVe7^@aS!)p%qr&XsOiRZ-AKz*r^5pqs#o9)x4^~ zVlm6?SG%%Tt71A$tVA+&cz9htuM{^Vfx?jI5g0aD#Uf<}`_2ADB}udD_~1d-r_NR1 zin<SO3b_Jm)Y;y$@yBPOO&Q8nMUG{>euL50zWcpp$x^sZ1=VLB<c2U6pTQ~r$9VmG zFW%_kSB#z0Qhz}K{wpGlVsDzV%>F+=LLZ`XVO@GVK=PyppJ8kWi<`AE9^O;B@Av!o z56#huLZv(`-}g3F=_33MMnH6FuhgX^l@vXFZ-TSTit>hjM}J3}*tKV9#0%1ljM!NC z5h<_rTIuSwC+Be0t82a;ViI*!EmC(>8{`xOGX)0pcnNi-UcIN7&wYO|9k5lK*2NOe zEExPzxojKBc?s;jdMy=O_ykML9_5%X*^KJAnSeK2K{5xV%Ley(@x@$ZJh@6~=+hLE z2j2LkQ?K}ao~5VyogHj-_gesqx#^?l`v@qN(c4`>1;v@KjI3D3WAfemd~|`SSYF;# z!PC{}a*v;*0$`Az?BE0Y6krnPe7rEKzLZO;w05a1YIPo!f-ssRo%b$<BnAb!aAnPC z0#z<T3a{-*+4)mKV`|V<H$zMXoBJ)bKzC=Bpy9VpR(IWZbJF>SY$%xa!_syuq|A2_ zFGNqvrt)~Kt%xu^EHC=U7&TVmVRHV$$IrkXpQ+@ix=Hig6XdLJsg^Hucd<Ksx|vp_ z{EJTIu2(O)JsUcJ+qw(56!CN!1d&yA@r#nB)TBcCLl>sBbVQyh`?*ZcvgOJYE1b(Q zMiBibPJkH~fW9J+?0^+-ZrWIVRsGx2u4A6yclCl_V%LwCV;<vWuew^!RguLiHw73K z&7!?o`k<3CoSD?HT4k1lfP2$|!jFh}it{a2<eW=i(J!0n6ad^5h!2G-&cm12=^MV` zZRN58b<ONps-H9rhX<7O#E~F$oEV36Q1?I8$XhfUv=xhOvem1jqK<V|i`hR&qvL|{ zlX+kGsh8r8ej*kkd6an~BR1ygX=Rf6Ff;cJG+GEfIvD%v!LoNOF2I&mOfkY30wWS_ z#VL)VlU|XH#poR6Og^PwnA94HYyjnX4bMJYyWMO^T#9IRu4}A6Y>R(Z*0RIdhtZvB z$!B*hQxb=<EQzTn{N%}D1u9gm=WXt(-G}e=NxP@Sj~*P6oG=wD?ipT+FVIB){coN? z&qu#5K~0>I^JXfDN80GrQpE^;JlgS4Qsb8W{n)dpr?=b7(j7rodx<<MG_NZ#NkfFo zR5LmdZeJqIpf*~vpFdZ-p_1?kI&EJBnCm|u2giYkY#;r#T)oWBFcJEq^yuA9t*e_L zAfQs&_Rdk<;FvdRaH9uQ{jCL=Gw0jPds`B#<|jydGntL=*4=~Nu99}Bc)^^w6N8R( z;dGHIdD`Ne`$pR&AgPDHiL}G}Hr>(~r!oCz!xzwUDHU`gRH%H-M?{(iPhChk_)<QG zq1yG6e_Knrf6P(@*&4qyAHz$NkG71nJHBz1k&6$R23XoO0D1%;D_K@M&;@`$#Z6~~ zlL|tTVi-a#?GHw=7fw48>n$~8h;)AVndF|+V;4YM?|7Jzr8ko#4%MKR1F4K$#@?UB zUpVO~3xv|nd-;uoa{Tk!$sSfa_C_`>Fn3Z|L!}+qQ{t(F<fbl<`zD&{_o=e4a&$9q z;&lWv#|ZdwML3X8XnASx$KAHQJE7Tc$moTR=)tJ8#Q*BL+X;%C@wOea{a$H#0-{@- ze4iPI%zqaS{>HVM`w;|wMP6zDuIPx6ye+>ADU-YSxnHm-v4%;#L1(<RfBI-+WaK12 zRav08QVnY!{4~(Bl{2|Q$7_^ZG-HY;*)US<)pT6iDL`}K^7amokobx4+^v)jSvRNo z&hw&SE|wMYIZLK|IW(mDn5gAckl(6dWK2qJhLdM%AnuS}$SKAps85XdEq7X7CXz|4 zwH+Y>Cl@*S;4&bG)5UPJ$2m+pd3)4!ZAb4qZC1@}mfp17It5!$7}m6uaW~nI@R^;} z5pSseuzmxh(-pvV#`b(6l!i_?O5h;*0txijyAzO?3n@^xykZQuSBvMx$BgS8fzw8N z>ZnR>R1ff$w;id3tE;Z1SPHx`JFuPWT4J0k)87v2(47Nb`h7dI2d-2FYyjY6y-C^} zz3kwrT~xn;*aXxr#zk_eqT(Lo*$rb214oxW{*{RF0dyEC^HrwmW1bwSpU0)U8-cQa zA^*_e-@u2yISYe%Q?C+xj(V~uamY|KN~#HN8J@zwA$l0=NpbcH`gD;m0+)F|Ie%3_ z*V|%+m{#53%lplyQF&bqfnUYQc8izKIP$aNzEF=gnrsU+pauuBHL_5Q!vcwPE-h>y zlK}^MS=AdT#f5>(Za7&B6L&WJK^^{4&Xtro{U+N(N{A>A%BO7cUxnu}l`|H4b_2AL zXY*E9k}Tn@x?NTDVQ@)2`LY26kTBM|Nb3)zIYm2Dqv$ARw9Ahi?I=k8!#=c(#=hkt zT!)e7vr%c*zk$<qL%F<K80_ubJp)Ac7v6A^&UCT`3o*Y=OzCnXw0mNjfc!tA?MrsN z8%8V5CUlIu2R)$Ds=&MfPPy)MpMP}d{PyT3w<5}dS^WoD?Iz5&o<odbVKJinx4S{8 z2Ft14#THQ}3w=Fpsz<qUtoAL>i~=QNO=T;YBmpXSmZs`XmChA&+)u-pVmW9fsu|GN zgvtrD^t|NeCGa<<q#N^L{Pm>|@YZ9hSl@Xj;&dXG3+fEChPUc$dc=p7#mI-ZIs%W) z=L5(_#cDW~wglK?BUzzo0?)+ngB#VV0#{J!EntByX%tq(b!`s}PDVj!IhHhajr`mD zBW;JWGc;|4>n?F*_U!D$>JQiox6ZFbQ;7?=4w_f;FOF4)qXry^UrEg}4X||N^Eky$ zTE@vTDW_Y!Ee>^#{>XQs)NL5sX%ns_8T~HsoOeJi^t4{7l3dC5G|RWyD$YYv?5b7X z=WHAgZ6VH?R}?q>f#N<6G5W?ogF&TSOGmcx7KI<0Ku3kFrA#>tzKl4XLs-jcsirhm zjul;-1iCjXqOxi_J6TI8eq=*7CA->l5IkhH1q#3!&^ISvd*>n%9O<Up@Jzk(v&R2> z!fR0hv?o$Y$4;48bQR13(GYXd_Ao|Gfayr$sqPBXxE4(LlM~DR*B`Cyq$HwWZ=KU$ z36eE+e-!`nCR3>>zFX6P(nE)Y>7Dgwv{D&QIRxFiNQwV-saA%!q$eE|)s4<6AzWsc z^JMXf;!6sZk^8)y4-F3w$!|@MbE$6XZA%<s+3F|AYOowiVI6RGJkb#U%?8Nxxw8A3 zRpA(cx$?t;w(wC6w+j_A<H?I|z3}|G>WC5d9{Vz0cJt3VjWlH4+x?O!YIBtuvqF$_ z|3SF!u+MVk+hM3McU?%?qcy*_DvTwgm-Lr@>~ZrVyp7<Q(c=o1;*DktG-k{=p4&W{ zJ2H-3{()8jgP~4>S;n!o@@pSU@k?SZZK4>xFiLaP$8@MxHG<-{FToJ`a5Gd5SpP>M zqD}Q^BVu}SM}Q!&eC)Q@g+Js@Iq_1dC@1%4qQUphLn8fzOu0QimeLIeW~34V?SeRA zu%Wn6-xS6`H!x!Tnib0z&i~&CTuN0S=Pw>mP6}3jTE$F9%)AISb2GI$%14%wk%G0V zWQE9)(pJH9P0j^-BS1iIjB(jI){Y=&Ct*8d{(~(kP%2_sg~vg|s4e<Y83&)?D+d*< zP3f4Duo}0fmTGS7089rbwqK&;=!~Th9@3WH9+f97h(nFP9-EDzUq-&&;SbHtAW=j% z?&nsNr`}YVO5H`~Pkq{dEM=$6()LasG2kFiEd@y+Upczg(Gj|)<UcJABjJ&5HY_OZ zFOBOH9m=Z(b=5)d>rzM>G0qCksNM*{X<q6qFUrjRR?-H8X_xDYSyKz<!l*S$Yqkn& z4)aUfgbDdAC}TWu8JIunN4U|Cet33EnrS~JX@}b7OJU?0qCwjDEWumCM<;n*CjCwq zK1DGd#Poq3hyS956YjFcW%e3Y<+p~s9UV6v7SBR(gI~8MzBcCxSgLY-m~7s12gNb} zA!1Mtv|y7+sVNW?VZi!Xv($~s67)}5I($l(VUScl19R9;F?ds%fu&z;-Ubg7=XFcE z)U!8h(q%ZaOV`t$<?i<3*aqA2V;yd+=qvefn4}V1Z?F_+&By%8c^o8JtGHqO@c9Sj zco)?4X=uo^LsdmCsWFV|10QUz58<3lA~%tF)R-!gg<RrE@uvI>l<+A>aCXx4jKD7h zVzn6Z%&JiAsK@y9-o|EAquhBmV@w}u8Fym(C|@!Ce=2-9gswrgiWPeB+LRQ>zZ)I! z)%KF1E*7G|tmaE5sLCz^)?c$9wM%p5qocfepm`lY<TpZ?irw#VACh(fzc3$5=r-P- zVSrm)ILp0x*H&YKxwKx-bPM%|*~^tPe42?#24k|h7pF!QTbXm{>h(~?5~)a)KR?c0 z%mBO-;n{;>00hXA)x_Q}PW%sE<sYDzC-^_4?B~wr7<=9fUyZxvSJY$?AAJKhs`H75 zNIY;-u;<$2u^LY%c|Yg-pfi(&rFFbm1F#rJeVX!d!8RP@GWLgR#?-cXCMvj_Xov6W z-XHcP`!M<2=#rF?$PM!dK|a(B?4$^cO%hae)ib0ak6we<svZ|7Y)4|)qsVAlLj(I< z@^To(YK~Pu^UhoXB`wklxf=J}NbFkLS%bQ!=otzP*|-!Zzkr-A_pxp6+I-kTF-UFT zaHHu!*3b3%)K_PTX2>D}ARD2i@WgxQxAv)POEY1MQI@I$Qn-#--K>eDPy&@<GTomt zMsIDlNmlkkJ)P#h?)`E%XTl({k2XGn>gnG454;CTQuF<_HFd!FP2KzC;L1j*v~VrW ziB<YonhTl&%%khXRN)rqsqXi}je4b9btdBvB^%GwE04?laq+SVQ#`uAX1|&6@TlpE zVNgLLYbx;fUx^S{dXJkC4_l+JtZnKp=pFJEllXH|qOpUd$p?rw80+R4_Z4kCZZ<*# z{iP*jt8GJob3|Ef96Ls{ZMVXO=LXQUW6RF$>uji1By>ITJm}U_1q!DD@G#7FO@YSu zK>!NmWaA0!Ym)P=5&->jQ*z;zeFn#S!q#Vn8E&Eew`f@ldm^fL*kzDmqeXJ`C!RcC zCbWaUK2R@CSpF0`LWz*3_jT9$tXDiu5cq$JJIC)jn6TY9cGB3~N#n-0ZQHhOd&jmL z+iC1%M~&Iowoae-yytH?_lNm7o>{Zj+}HI>g`()pFmaww-L=NftPTi+u}~8A`LX*# zpAf~4J8-6>h?k${B%O7A1UDx}B$B>26l^EwKsRn|A+n`a(Q!-EL|zf`IBDL0^BMrC z#D2hV_v+2gMka)Hu!s#3$K+#co4nx@neLMwFtw%H2CG_W0AtQg3*8>=)0yEnS08gJ z-udAtK&FIWmZLLAdKO)S)`_-;n?gRkCNX21EKbpKgIrrk#geN;j@+M@)GP!FQGRwP z`RIw>W25peAGp?&8*#R>g3WC;??T1(B0hTqU4O4q=7+z{t--L>iJ0Z8WIgd?=b6`p z{2(eMi2_3rJHG3U=R~rV)tR~J^542TsCcO2&?dJ_975-{7gSB9p5UARrgy|oC|oBL z<Zf=CRM>>+y4(6An_C#0Ou^>K1jXX3GFeRj&bwz<ve?e6WW0uu#Q2S~xGjsw_s2eF zhB{?Z=8YrowU0;A(JRv$$sDOcUkfw0l*K-#=hqo-d^!JEWj@SG%qZm2186t$6hl9} znu>2Ugr0pK@4HG}$G31oAB8QlR*}fv?n=ffSlVop87clv*Hm|N=1V~S5y`s<w0*&y z4t^=J4COmuUNAA)+|5(#Wr}~q#fRreRQ~nNmeGjbu9pF%`&>qqKO7h|Ooa4%aN9t3 zEY)L#%3yMedh4#Hh;!M5iMsNejh*n-3F}vO-mI_EXd!~v0l#*phSLmL2i0hwHT3Si z+f+v`>cIy)881gv()1o!2?qh)KDzeKX7KMOe$}IFHF&D`FQZ7hB<m}xuj6V>uo<vN zHtH;HS~ZM>^c?rH4|@Q0@9E2)E`GEn>hK;n%N3V<kLP8tdS4lb4s({0VxB)Ge7PF? zMR)*Uf7Km_!wh>N{2ISsMyA|2%XsiEpM5M#x*S(C8|S6?>&^%LW;zt~meoaWo1>D5 zOo*HqBF(5aqoiOdT1@Wunv`*r<QgH-z`#S*aT<95%9gz1>{@o(y7O|j!=UNT|B&sm zMrka66rqKTU>#x==RR908UTsd7`*h#6jU9$HLK%y{}T+PnJPTY@WAYegy1i#Xx84C z94Fb<EvA!%GzS#N-$frfOsR6S3EC%>Cd>?3xFa%>uX(x92E!r1XHI|tF9x%iAZE(e zI7_nmaE?tx8LmRwcT0%qc_~%;SOY$2PFz@VZl~`AQ{9%lQoaXk0EWlk9_0*oCVecC zZ{=WX($+-;k*bvoc5jM)#QK)JUrj@b<7InS#N^gFNZSnwJ`E^~bC#*D-6&BMLOuDZ z;F{d|yu{N{c@40Mb2jYoCj<?5yD#rdzh?YMe0=Y$XVP|95h2sL_qWOjf34G^*u^t4 zBS8IrY^!gB^oKt2Z@En!XbjZ0+oEw*&+cm=kpifNx`J~TS?N>eat%)u;kIY3O=90^ zV9e3-&5xMK*xu`@U@gdGF1<@#_V5;z50Cd^UKW<0Fb`+fXpLZyr?mZ*^`y+>G@pvz zKTo9X?Hj!~U+tt%<d&gcITeGpWY0H87H_wH85AypccYAbShxJ48@$*3?cmA27~^gy zs}thNq*9Q=u-O)MutEajIH7%naQGS4jDm45y3$eVEbq(WG4P0}B7LL9yWvzV0G$~b zFCaHbel!hzL6IXh<<DZw{ahGCfBZw(Zq{*N@%T)3b;w8q2*Xj*Kn>T@>_XlV?fNOk zG2W$*$<dZYydfpfnAFJXL`pMq>OoeA*Y{gBg0ZzcocPF`G9$lcw}%&*<^;KW3oI*- z(Hdi7cLBF>hJQ2GPti9!gku5B1RE|xfwDhys*2b$a7wLF&NZ^hJfd57;q}-pDMp6V z-$4_CG{iN3Q{O4cVm-);{*sJQO<_s+KZ^t{hL#i~uvw#DPu+529}gV^*GBYNh_s-w zpdK-%C^SS~S3iTF9LeS##_mVo<f8eV_WZQ0jXi54<P>NKQ9ga4yz3qBqydd2X;ApP z38jyh3xaxsZ;~&6%;TlO2bWV5qsx|GxiQ}QF%BwR^?rgeM}4<h(FaNp2t>U2V_3J@ z?k~_7N=a*=kWpd_!3khmX&R*R%i1R1m?CEx(>S(C)65#;X_O^f%r&ony(||0lRhbw zO={DnTz{gY_0qEb*ki0sEeJJ!_cm!~d@B`G6d8T|%X=)T6|#VaVJc^3?i~=2d(@50 z&CtUC02RAh=Tgn(!;3`d&W3}YMsfroJ*co43ibKgYOe)>BWvq#M*{`&NoeFvMwa%T zgkkuwm0rx0tc#eB4Ufx2!4jKG_}a<ig=l5Ce&&^oN$I3id$+T8ygQKQT3a?pIxj&7 zeF;v4USN{0<}E-l>1P<){z9}$xTDDqAq_6Y|4@UY_9?VzNcD8CE*b;2@te%^UgbJ% zk<S7-#bZr!ub(owE3r_cWl`u!MQi-fZKDe)6sZRcS66+@mMk&Fq_W9X>g_1^nmJ+_ zy4V{b-%M`xT<H`elTi~!Xn3|%0{!K^bF57F$)ZTgg7O|222Xac3FD68lvf++iuk2s zHAsy<Q6aB=NBWG5ZOm@F&}WEhSn9KX)n<#;WBsNWVkj(zMcD-vzB2&PFkNm1va>d6 z-N>dzUzP0?iTngerSJJ;&oplCY!n}>jfS^O*f+UO6wQo(94_HYs(9nVZz*f4Nb4uD zQXV53s#fo&hBDXNiVsC5>M+lz`FK)_!LEJRMJdZn=H|UH91*1`n5yK^F3_bsamWdI ze-RoRM*+Tavysw9B_>6|QCmp+j)d3$VU#__(bZgPSo+Y7Php|Z@#L#_e>3Ebk6<cH zRE1d;K(^ZLlFIe&>9=Sna{bP|MHIMDgS5<zjN0Q-a%m?d8pfvAv5aH6{x|bG!PB15 zO)p~JxIS!jD6^pF2E{`;_tW#HMNqr3{LH7mHR23Y{+>_o@^L01)M6YXMfen>RhUyu zN`oh-AuVb3l&_a|xr<=_NfuLEBVt96Q?_g$v6SZ$JX<N%HVhHSL#%HqwO9f&NB%Ma z^`97JtXa&`HI=y;e_GYfpDlnGfwV8ou?r{3G<+e2O3zl->^c#QBM>1H{*kCXUQ3+Q z?;FI4*1~u0=>_A2j-a*X>IS2@QP>ig>#XP3GFG5GOTo+UM9EZT2WJ4D*7>S99VN!I zRRm4PTgDP9MKPU$x$@+>2e(!>6er}2pzB3j20~q5_A6NIrGZSz+*h?E3lP3B)4AtH zyC>)vT8l=jW2eUf3Z;zQX=zVwtebcELf@)GJ%>Wws^t9@_w}1{$6_(egGj7#c`4CM z>T5h)S<kp(VE$ls>4t#Puj}g(H~qcnl=ZiR^SI&T3})fOu%6%EMmYDCibw_A%twN_ z?uL?bG9AjB`<*GO-DsvpEl=pDVW1e)VK*<rM`pSH&&<lwSJlX9&AVUnyW;NWcdH4& z`#r5PkG&$tK0UgY>q)7CA+*I*AQU6PN7W-HVGPI^g|ofIo~vYUcBQb%50ev*uE*E1 zw&df2jgt}-NcZ()sh69z3!ln4CmOV8<dD+WQ-=~5)0hM`zz-<QQT#2b8=~;|DOk+Y zHp#*X2GU2MZUKQtt|h5y710nTp{^y*X=AD&2dmLe4e&h6qnI`*qrp}1MU*CYVX2=Y z1>04QZBJVCh~~(05m+x1n3t7on&Fa76biQJ5(*@F_`zaU%N37j#9t3^JeTbSy$=}b zSGNI>RKEJE7}4hFTHHs^t&&-zys%8a``N80NQ$NWL!1g&K*_HIBaP|1O$*oE0Ws6Z zydp2MBfm;)cFx2lu}dRdxTex;ZV04^yJ>6pm~ooDqFp*x>!{f<)SYlAps^NAM<dHs z7i3qurg-28HOn8v6a9V^ebpJ>eR3(UwhEa(PX#g$u$9^7uLq{(ULh%|Qcg>G=PSUA z-ol_udJuCj1%avjTTi4@Oj!*C!W4@tvT6Ra4gVf4sX7{%oPfB3SYq0zL0hccatA3J zAh@#iU5fYYO>!A4NKmvSD_o|Zb&EcV=$6ykXH3(tys|Ebw8g0=vfg~$>&>O7|LBXt z2@wkw=Oh&Q!E0lib1)ij!j(oCOTO=DCPfw{W{{k4eWH~=Id#EaIkYCvy7)~SyZovP z5XP+kc6;ifstm5e;&>aI9Kp=q=WB)y;xRO|u5>i96_Zrp5dZke4#Yo)UeaT({3M$b z$*yfFpWV0lqz`+cR>Y7GO8s4MV|?OrfU{4?gC~6lxStx=O}QdY7K$Mx8*NusR@QO6 zlJ!~eq0QuHg8(~&t*6Gy`qHa)QWL&!kn0w9X<+K6wn>;$c%O<Gi#W`%r5mE88>5F; zlHSVtNokeiKt^Abn8{~lNtm`{STLG4=QNRykE9eO7I2!Cl(Hv}0qf$&BAs~fr$rRo zdPe|wlPdyc_qU~|Z~xr|;y1P6rT|)Es$Jsgy3x!_42Hv%+M%z?E=dDoqF0s$meb~& zR6s#1h8dS=+5B<+t!@HlX)n)(C+R_eR!^g}qoy6A#jrW<)t^DQ5PdE~)ABsaRNKPu z#anlVPn%7M7DzH2mKzu@Q%>Bq)=UltNo*5-JDND!kJ|R>wu$Cx*}m~zlf8<fdX;tA zdzwE<?;PEw$Avi_M-K{FK803rI-V3n;s1)1nMJn1@rUM(tleXAZgCMw%_#CD@QaM} z3+z@CAj9A;oan?Ar{1QIY;)jAIqZg22lv|y4j^oDVy5#)X{veyR7w1QLeyld!nt8t z!?JqAaxlO<3;a%{nx@dip@~fkxs`#Ekz(QxpMUHLy*ds=>v!y=M{EVLL=88n@!r&B z4$mVDrwY@S6j;k)sbHB$Y2=@WB!i#mbUQfYAe96SAI(yGoqOS-AM)`7@9Oez^x6I% z7KIxsl}K3S*AU&DAL>!k7g5asx!fx~{qSp!^B$b44;BH`4DTYI3zDVVQ5}mx`Ls+w z=&4Zx9FoJ=<WCiU!us;V@g6k-N7t%i{M^HxA!7`=CvSt~a-^64c*dKkkTnfD)h3c~ zG#s5KvVxE~nUF<OGU==jh<;VPYhu8%l~pXB;+aBd5yj=m=evK|9C?Z($G0~>z2jC& z7JlgkS{xr7K(EkBm~4-~Uiz>QFiUxY=ReJic?bEtIHnMF$Mk$Di^~0z8w(NjNFQxC z!6_kDG5%&yDzd&JrC<4SwVMg+?_nTgTJGl*5V}-YmS#Ck>i$G3_^Qm|L3!PakDRIc zO!*OzC$Th1KJ^4->ZZTXcM-c%d3oTB<)_R)YN?HNnso;};%$Wy_=)G7oB<4hL$Er5 zQ~Ej+tkSb4c;*iK`vwF8`KDM=M9skqc%x|${Gq^6Ma&5YNcIeK=&)@@3`BoJ&3MjC zc1#-Cnv2Y!6sD^h((pZBRXnRrVmmU%`~gFgPOZG7aVKsaEU3{_fM>Hdb0}6SxHrM; zQ2jewN<Nl}Eryujvw5R^U<^)20mq16*<9xj!eK-RnT2~v`6O||Neu?Y+H}~o@a3zY zO`3T`g$%eN7i^xx@JNRbd+k%QK!sS=jTlSNdXh0W5Wh+;*%QYqOr=Er=Sjyco&?+i z+Vb_;vrm&4i!~TKx85A1EEYtbT@8gAMCtJT_!`6amcun~sFyG7bZQvaxJG+Xt1<@> z8d<!UOJlT?##w!bxB^b)PjbGP;`*mjJ_eBYAq}vjG;o(2FVAzy=x6TTUD`KN6!}CD zZOnmS$ekgiw_2DcY73WpTDKk=^`BS_3tY{XivGrS_%m1N!xa9jxiV~H01w%1aHEk} z$)1wKPqH^rz)04nQ@Ybgnk<Ql1TO>kp<1|XAgT*b&iPV<R|qHiI=btqoml>|*F4nb zX%#SF13RL;<nXNJ=1ns}&z2P;CfUBEa8aJdunUfKsKio&BH4_tTeTHO1#=>Q;7mA3 zG4864Qv196rU7C#0x+o_<CA~X_THsX@y&@W3BFjXAfS~=^?s#~SH#<q-t*JO@#jUv zV>phB*KCwFEX}B{;r8$sW!6o;MXZ9iCk(u*Co(eC%?DTKF6Yks?_a@pzmd#z1O_D; z`Rc-$P5U|<XF8Cz=(3-5A;6e5=R(S}htGt;x^T$)x}tA+flss6W5LoSrtP?~8ogVi z6t>W(p<KdC(s0a%x)9V0577B{k%Dp#*q`nQ^Ro9J(waqYbL@v+l!SM(6S0lymEc)r zvHssmBQMY*ovy{}z$iz}EeWqVIDOT_Z`+x9L0Att*nmP3IY}>f7<eP)`37`rPny(* zJYVrS<Pe)~DqpRLWuA%QHi(D)2Vv4uTyG)?Hl$=J#S%BW6QiSl{%n^kc++CF>lD{| z3DE?99;rj(QnQ%9?jm19nb|WQM_qXuXBr6#CH6JoDw}A9{jEQoz#huFgl2R@9~i-r zKg&_SIVRy2QAM)s5eM-DyGIO2A$FH%o3I#_-dSh9om%Wu6wnb>$d;=rI_b*~To(?D zaPJ9>hiTA8m*5k;(Nct=%1AQl%z18Q!*NS3q1Op(bGAi>ITw0bQjv@7tjH#j_0@)g z4_?Uap4J``bV_PMl!Z02pk30#@m|@X4I398%rh1}^m=XnM&I);0AzI6jn9V^FHcSD z7}~B)A99rG%O^YuE`Ep4wII}Plfd(GQ}o>HA!y$1xTJPTWYd!svV*MqK5FbYxVRLd z3WH@E5&9u$-<XAU7ZUpLp-@R`G~-Q5>Zh_0;@2rw94i3`1lfV9I9L~JdKAPr1C4R$ zfZzM)UBbO94!FF-)NG(rz{RZyYVCMW&40=pQX>)uM5x$9m6%$^1O<WffsmIOQRN#- zZ1gc=<D|ZxDkYJlO)CdPwEpIdA;BmI@*Z8AsQ#ow^6lxzI|aHh+r+y<o|ea$O?lY$ zs8qH5M$QS*j_&(n>-5)*AIw1Ji13@aq-Gbq0bfbSP3`>I-<K6_A?b{u4@%Q4K6mIO z%;E7JvDxt!W_|Ppp*bRIdHv#^-vxH9lP(0(CFC?kW1`BPv9ib3h}Crk4I}7i4cL$- z<o+yU7&lZypJFpWd4OjBog9;zd;%!h{7#6JHjn}(zr#*dXO+?`Mi+Z9!AQqRohr?# zYB;7UkUx3O*pMk<)6*${38kO{xsAA?p>Osn-ZXn8NeI+8fpbY&R<CO)OX`Ilv7_8? zyX*9~%wyrJxOxzgn(dUR4dHrTzjER$DOmdXK%AEOV+_gB0(GN19bas$l~qxiWn9oR zH)mAVX$N}pSgnU$!MhpvMNNG|Lk0firFuE(K`EH@1Qn^8(Fr(FnY6l2#P)HR0mcXi z^+K*%F%(FaOriqzkO5KZPr-QRWY@Zvr4d4AoXf-xUnZg4v%6f9J1Dqox)FjNT*{-8 zmns79F#omsTf&Db%|~&ZjO7;_Y@4i;|H(f;AnXZ84dFuxmSCR&?#Q&zC8&S^LCdC> zHmyhu_JQ8H;{v8RV`OO5>LBmXIiy7^e(ZjDZX8R_4~qUiZT_%lYlS_!cW{5=C{UO* zd;9XwV99iUY%?w5#teImj$JfmYXnDo21LR$-IL`%_G>JRV)eBj_2E%Y57AK=E5j<H z5W`K0^U5*7Vw6W4W42U<a<KwmIQVHS`a9;|D2*am2j3947H+O>>k_=<c)jKehrQb| zzQSWU;ycRI%;O(^2<O+DOi$PAVBG>%WGDR&S-&k0c`fh`bld;NK>=DUS!!<V3mE*^ zdvwZ_UMn}0<i_580iREsNgZ2cMD1+Lii@i=otg+q6NK2)M~#)>P^4E!z)-yqa1U{9 zbO?3*t}o&v-RAxI$<3RD52%UG*H9qkkmtrvgZH$JU~Z25kdEqIYcA#gju0m%Jwd4m zX<^0+b!gGzQG6-(M0()O=KG~|z4e7DwmuoXF@GKc!IbBkrAZ+g(B=maS(aRyx`S!| zaYn3sC0xQML;0{J^|kyu?3`dxm{J2-$6<Cu#c7Pi!8V~K!9{g{cNf>1x6(?|%-`;j z4-U=!XU-h1Nsk^NHJwGX37$z@B-SR5a&*aVDgCJwyyuG*`<=2e{Pi;x4tnVj*Cz@Z zQdr4Itjd?63C>o<(Esa#WU}c&-A2g#GC`fPrh<6m+nGCJUf9y~JeXqWr!qESVl}gB ziRA+Yu13?1z`8?`dcm!`CpcxVy{qmys1NXL#-&g^FGG9(n(^07T>PuBo7!_jc7`KS zz{fG@f*Rr2Msif8?hC^x&D7rkHFx_Z_aHbXPnc^wxnj!@4U<*6&0cQTTPbwhWxmS@ zu}De_|JlN`*5fY=I&&5u_qf8AdXecb)m~k3>+qQx;%ME1bl+A_z&hSe2go5KMBT2Q zt<J<XT+2ay=Ju$K;<WO-lGa4!lwCa7=6gt+QXlNydt+q;+0$lZHzlqrtGOiSLb7s# z8`9yH=gTKlXlatb+17gaKL;kkMdO4wpfz^%xra<E%rf7RN_q(~@{spKc!_aPijT3% z;w~3rmUE5@fey?O8XWyRBi)ggpS7nxa84QJ%GBzIqS6-KVEg=*#1XEab3Ci3{k>|B zcL6#sVjG!s=MUvm{s`r`(nPW@Qf8SM#y9c0*y)yvz0b07co%ADb>evJuyL&?MZSp7 z>C)!?UCu97L)}%cyL!`+YVgs~25|##8SivzalF5*=DVrabkMpIO0)qeM&MG?2qj7G z)S(pArZ!0aqn87}(#Y@c*N%eXfOFVolH><O%lO*u5)hM5lTKyzbp#A8@t`)blcizH z)JOp%C7#0RfK}h8x*^Gh<`mkuIiAQ$ok>Z4U*!eU&wpQWt(Pw?x7Fo4UJZtu<#XJg zV^3ohHO6+Efa}F`2(ePg;WJVk2i1Aug7QO3@yz`v=6o)cHS*FjaufN#u>$agQa#HH z^GReYW*8gd-|9?+P6*S<Ctt~HF8T#o{i$t9*7nBh#>E-k@iA?Jpca-WLi6}g%Itr{ zEkIot)yBEC<ehV1ssC^%8#ZI2!crLj6kFX0p?V0qey@XgVa7{5dq`Y$R1{QCax9jK zMa$<thaSu3!Jgia%2m$mpplijsw{c5rWJ)Joag&s+Xur}vmo>mVg~b>U9p6=ynm-( z5SK`O|A{jNRd}sFVhjpB|98`ViG$79rAen0An->ZX84e%&(CWbd=Eb$S59DssKS1@ zR&f>wU(hUqdu&sSAc4!X$1H!bZSH%qCdqAAkhb^?@{)v*{~hyDFX`N`y$<HWYdyUP zyKgjagSF;4)_D(Cfj{2O3aq5+-s*97e6hh(ftxt3go~EIgSr$Hp*;QVbU`V3U%ByD zVr$tK_QWMQml~Z-lxIpVQGW@*bi-!-QWseGnAcrCZ?Q(b6%(;@0gFpc@MW;uh1cKr zSC<<WAE;1Rs^N~H;+o0oVIgd^fMltJ)8i3i_<@rcr*{1XH61PndNw)adC6*nu9REK zW#&A^@ui%F^dS)fSVxQ2=OuS0h%?nc`?6zSX|L%TlK-`T>3$p_Gf{;*A>ArILB&kp zw+P@jjaEZG(fv!1kG*2@FE#1JM6u6<O%xeEe&Ls+ZRKDz{s*ffMZ{_RmKgW$5jqZ- z$O>YtP5}GXdJ<KeY-R0(_C=qEcQMoC7}dC2st9|c>pL1qH(Q_%9_2}NoP5mXLn|VI zWM4@ALaV71_VdTi`O>GDY`{nA81szKr9)hi2OEt$w9Iy?aEaN&?Xu#TJ6G)Lg5c$D z0XlVZJ~w^@#iHT#@Y#_6C585vH9&(`KX^)8K&<>Xv@b*gq_;00^ic{6TQk%ObraGF zDDaq)yAm5SOHL2cJ^2W9`cWA%KM;2!*wM=Rh<8@$i;)+!m)JHTwLb)3Th3gzJzeIA z4O0<%ms74cqRCO6Zp29V11b2(uwf=-w<VbR=Y|s2kR^^U%l-?q-8nK9!H3fISo8v^ z=r_`<n+@m~LrijMHrdbC<{R;_F>Ou_8O2yjk}zw0sbTA*4-?6B-AU0DP1EY;xgO>H z+?MecDblLEV$;yvI)tin=k4GzFr;c8a74)m=(sfqS-r9CX&kN9vs4!Re(h=Auhscj zCh_{DlZ$fU_?t{K>RFTm&-XLUNn|CORF3n?W`J_#S1|OA#lXTVf6*+q(Unt1HtFE0 zc<kOI+zGp__9oeMRgHza6cCpXni7-%{Lw5UJQ=4Qi0WWRob;G;;$$$`d_eVd{U!{X zdS5FI*q9vzRnqb1-g<%X))5Q9*J*5lDFU&AzR+ph7V{stnHR|^M^xnlmI`C?T(H!= zqk)2lJ{1cO@nQ)0g{{*mnWs-}p?KBP&X?Kb&&navEDba4jcLd)tHufhG&bq4b9b{A z+67lv@RTf|{yV!Y$8C;`Y96$GL|FB(z5qaZVPlx>&xdp3KB&vS$2(_vcgnXfe$Bx; zBa+O4Kar@_cXH7tc`nzydlZ;f>IEoc{>G*^&rv{CM)*d+;iv@cM?N*GLXF>@ev0*? zh*M(qw~@@*_Y#t4^w=!#r<U0(qA20hg#&M`uEal)PT}K#!wwxYUUnfn<S5H(uvZ)3 z0NPO1`A$vJh{V#5`Ypt2$|W#8+QsUJqN#16!xuX<<{xV=f4~VALd?4BhO_nv;Ku2R z4`##Lk-1*TjdnV^g;y#<8REXtxccA#WQwnQu4nRNA7mVSEd4DTo?De&GF`jDJ1<R! zPQ;FuSb)=$FwAnt&obHBzIB^`(*w^=q9=(E=c`zYrgElG8n${?J{K=h<uvx0MQ7lX zPm`m9fWWq;jV02t!6{>jun$qBa6C3Z?TP;su0frZ@B%GtV*Z1>fSA0ejZo<xj!c2O z6xFA0uFBU-SRdwG>(E<baBk+65l;l~yd7s-fS_fNb-?GJnTgrU=em(3k%RT853rvF zF$j`5f`KNKI48gN+*Hu9n!2b3KL3MH)IwXKLL-3UK5iF$1}%81sx2TtrlRj42+6+S zYFfPBpBBlu2`lp_^p)Bh@#+xnf#x3!noBU0*9%2y>U&9z^PLw&>cH2H?etH0J2pcg zqSsSQ<g@3Ma}Tev^*#3WhC<qzsjEWWR|6sht=-)T5H`GwfSI|JE%N-!RmIRwWu+#G zsZF)vt#>0?-zVMESdEl`>KbnuebrqIN;VsUv`xI=XUg79E!CS8DqR3WR^u5E&xji6 zw^sXKLJu}Q9CCi{P`~AJXe!{>J|j<HO9i2%Qz1AXx-`7mL9(P17hH4%^Uj<J4+<)+ zxUNLMluFb><gH}fZ}xHce~B_M_&sTkSID43T?jzRPu1GOy<7)m6ZNP;voPjZIt58! zDBVXW^0_#SnOzJgTyt$Wyw6zTiUrxNlKcV8fjmsSywoHpJM0#T^U1RpN+<)Jxn6zX zt#Rg}?!;Vl`bBRvGQ`Zj;A;oY(f1kji3p98J1lnGotqTZ1d#y`VwpKbBhZ<|Z=K&P z#masf*7x`r@zjjq8Q>;>tDE8ayV)`l{!s0)N1#18OJ&7ALlvqbM<w9kqJBZB%>3k^ zrj!K(|Ed=|!$+13nBFVapLs}JD;l^mNU~nZYxGp*x@7eOR&Z7<`x5#0O8!f{2E|VF zbyDwfgYGd-Dw2&3NDPrv!lv_-)+*lt)XV{$!Vof}W+EcmMbIE#svZ2I@DMiK;XtDj zK1$)e(FV>HUJt(GQe%eBpdX1=K_2m5YXMX&gwe}c;zaYrj>+qaMI%;;Pemo)?P-R) zp_GjCIq00W6z?LVCj*$-YXLTHUQy=f6g}Qsqb$A%&dwP)Tv9u{M$wc{8u8;zl46wV z!hCuT1(F}%F?=Fk^B*h-{{SxhvIFN-YK`_~X)dU_Kzq4#@Zuj5h75CA9hfXQ-chW= zDcw`SX*Y93x?R(O$Rd>rgnP`@xdG*-$f@;*_q?brP-ZJ-W4dp=rUOfVO=<A_;vZtX zV%ruBZ5^U8PC&8#{n|YdiEIbp^tjEv>-nH4p%d929MBtLBVt;}W)pvrMtbH}2(g+D zG_%?v`boJd$EC6%YIh9GWfx@^H0v+A``4dvigJgT(XYDC-f+Cp5LUXUPmB{c;kNTq z;88@SSc?<ghLGD5Wl^QU9q&^|%Qp4U>XCZRwHR1UGlh6NZne}(1;8M+p#d2m{y(f0 zbRm1bnhc;ZmU5#~{JY<wWbF{bC7Ojn2eN}x3PW!u98C#@q6BI6Cv*7Ci7)aGu`T#v zlu>5Q`0+t@&?{qqJ$y9|O*&BNW^xw<`FDPuUpOT5dJ{${o<;F%y{%`1+9I9D@Fdwr z?)Af&soE$9Tx7H!b4XPk72#3(H#S=kkMPd&Yg3MyMlV@PhMCqp>la~ujebGZi~b^Q zpwlFyoYZ80)wfM7b6E+w<$=={NNh=<#FbSU>X)oWX>FvdhvvFs(wMKi)AxX58=d}E zi&7UV5Y!P+a*m#j;A3W)5JMddfsjh5AgNG|KFzP1^x=|9;8Vc<Ezc~{O%=PGS63@1 z!xp<_dhU$`-~hxJ{zLlDAtb8qbrhW{2q$RIX6&(uCFIFnlkEtP<F8fOHzn*_nCpy< zu%Zr1#aNl)qE$$4;;p$P`{EGY%fg&@8AQXIUj94mNl8@Obk*MFDZXxcE3|`ntF)j} zRKe}z+N=q}D>nix6U&^=VL+>C>QPM|rRz*Xq`2;P#%I?pKFF(hkk;~%i*bP!6%ri< zwNzKHJ8YT_nlk4R9?ecRv+`UoQn4r!dKq?$k-t>{ArBFatOuST3O7d(K<sccX%>v% zrZylDBgDGaYwOE#@#((wUhy=wVSQ3Jd+Urf)8)N7VaOBF4I&0)iHNv1xR1*p_8^?8 zIYR&!carvZR@tNtrqPJ*QKJ^+ah`^(W_Em|rRQc##AMnW0I^aCPV-=0dd4;0tpwDX zj<VI0oCh`noAnov1vnzR^R2KdiY+)2xqMr@VD^(+U*?|vbL`DC2#&3zD16h=tHm~H z^_7Qz98Nqe=gwqzESDFQ7%^Qa5{1CulqBAenZS1sv)#~|kL4;a!!IBA<<w`o%^1=C z)90GxKo%^<J?djfXrK3YvxY-Uuyp4KE1GL3Yjb;{8LH7rNQh?$Y=ZVt-I>d8r0sw% z&CkNPwB<*(hK&=h*Y<o_Yu+cKBtR7?^0xu`V%r~Y@d@d{;~2hXm{~8icYm6tG+Sdn zPxn^n1IK)-LH6lKDbH3m=Alm;WKoP#f6@9Js<?>$I~E4R=7)hMR@6~U@x*eHbF`4p z<rP*tqvL4hr_|=W<J4D0>pknZVBPKVznH{oLh!@3O3%N{3~%1?WnN?1oMXfr9`WN4 zO1Q9O?a1O@(Pl1~7Ln-quTm3x+tS9MlIWke{A**~p|E(jsmq892vy$Nh;V7=PkD3) z`ICN)Jv{UCw!h}a#aB&k*xdc?Bsenexgj=M*$Op&^NPIIhl<!VU~Z%r_Nl2^opkX{ zX$%NM&WD?uG7KNZsJuF1vKipX<Shzfb1bOsd%do4w8S&0TO50F^+_kie~R$OOL996 z-PD=zvS;J|HIu+oAko_IXcGbUhb+|SJoOK~_zH$qw6A_adO@pA1w3nw9bw6gEJAmL zn6v4&B^KDFGfo68BqSdaeVO9{TjNY9r8CKy^rJ-oeTcH7Wf(uyV&c52T|AZ52YpTp zIrdVYF@*fQh(?!t82n{pkYXz)ynkUA-t_L=^<y`LLkm0D1#;+$15i6!An-lpzLeLU z9n?g%$KD$Y9bm^uZqL3vbjM^j?vrZg${N)YKk6qbw1J{udUbGqP^#2jyh~Ag&`B-H zO^sBIFmWyKVNBm3*tHhNXmx#V5j#8E<O7b(=>NOyi>4n$6BHLc-51gLcYx0jEeEb{ zk~68|ulSU~Z-!3z%1MMI{>M6I<{#~c4s0d3gN4^1hG?twu@sxwyXHhECtT>Tr-~!7 z%83Y#HCVS1y37G?b-ch3q`_=3DYh=;Ig?hWUH=7+zUf-PrwRuT#2e@e_^VRs$)2=o z;@6Xb?iTTcZPBOfo^{rDurR!$r=XPS{t7Yx>GGjn(1$&~?xZPBsL7C!7=(j9eWt1o zM0P?WDUvwQe_o1aDIa*LA${zckF|M9lib><%?ZBjW+lA9@!1_h_0KSnr_*|e<scY( z)A<^5jcS@8nJA;&us!L@fKx2d0%wh5xq9Texd3M9gb^7Tp0$?_dSKm8bEAa9{rdX@ zyi`<8u@XBdsbtwsXQXEq;&-mA*>Z(yT`a1Nc&qR!*-;x_9XS&ms#b~%M(K*%9NseX zZ8vR9kemF>ONG+fvg5QY<*zid$>~#{AoFQo^(LW^FZ9K2+nhe%MY5+~(lL0NB3e#X z>9E^_!cSFhDd;=CXCrsDLtG_^Ll$U=blK7}FI?z7mD;<I_zpQ1F?~`Z+{XT&Oj1_1 zrhu3s9xvqIZTtPsY^;_kA6He5IIoK(-^G`%x$iB_8ShNsO7_zb``3)Xk}4wCf^RR{ zg35j`^>NdPJr!*5um~OA_%@L%pQtzybG$ZxT%w)k>(no09<D=M+@FPeJxNdzEA{+U z^<^Nu@?*TVK6SJm#zr(Rrn%_N6&3OayV}_nLzQ7^Ro&Hf2}G)P5MF)bu=ZQznVj}? z8^5vudk`5YS=^2i1LFjvcA5g^Qcm1)DWX}Uf*rh!khK(Zm^tZN@vBgW7u!$6$E|91 z7mD{|;IY=OC1!b{)GB2TS?)JO9Tv!WOzHR(ioHnSqTJe+{3qZwn|sl_A{7l}(HP<V z=LHf1PxiYj?Y10>s2ZiTPJZdhsg{nuI=5Ucb0gfOiJ%CpRXhQ-a1^(lkbh)s-wn~x zgiKZxGr?9z?HqIDiHUF3^ygd^VQS*~_U~u`{12u$7G@`E(Vip8PD3tu10h(PyeZuN zqVh+yvBll%8Ja|>TyTN(j)L1mQm02YYwiGg#3&Kyu>vLMX!5<QYdixPI7FLi#EAkV z)BG-EyWkCyu{3LT#SsGfncb56gBUbv8CI43WJo>1roptKJYU_uioLDn7}mADT}^## zrT0JNzkD0JJ!+}>3Z|B)2u?3bN%N+aTr5Fo#!{ZJet0vzjGeXyWb8}}a!!B1un_ap z7txgs624Oy;(kv~8CvPUpTOB(H((?*D=FbPxgkB(*Nv;F$))O~HF2smG`v66Gcr8A zdX63F5C|*x!s_)vh6G#a%CMFeDT1uyT=nP;id09P_ykujA2~`jO{sS>;EHZs^5F7> zQ$RZue$%HMi0RqC&->-%==&2tFuc5G#K&JVd_WfE)KkksOscdt%_H^hMxuzZoR7s` z(GS<w<_sFKdf7;KF(j)CRdCPLqOc8RJXBul>J8`CKOi|e6UI(a)Ltf1cFiQ-X()6F za#dFY_zF!Us+;}Aii;V?zT|Z<xPq6{BrwYEXguqaSC&)5@@*NN?9B3q<EC9i%g6@< zO%DXhMHnVc8&#Aqm&AOT$VooWZV#!rah?ZCbt(1V9OMf(iet5^0t|Bv-y_bkJ4~Ui zMF6rQcLgr>!>B@G6O&B=40QUbE-Hjz1L1)3_u7ao)d3=<NMxLyvrT-Wb9*TbOVoqt zDJPdwLB|&VMGW#nwHYt??tygD3FmJZi_I462FG4Lv4#Z$x194-RfQOBQX-orBAAsO z;_c^QFD0ZGaiLlFrqrF?6poiaE0L(5{Ew#_OpGcIyzK2=^I4`7-?E7+V35KDP`<@| z8l#Q-(TKDwGa5vD4f|}hPn^*1?F_%wiUx{+qzGZMUb(T6Q@koh$(JM}4W~Io0h$*{ zTW^uPRkKZofGwy{uo#RdseHJ?!II5cFburypH9*jWD`PToPVDjqVz4KzqTl5n&pNS zZOBU>iV2*9<Qnb__rMs<?=4d*w57=4rlT{US8yz`A!OD?k9E&R&ODU0)nWxt%a?L& z4wv=jo9y`^S+?MP4bp+$AE?N4P$dK-QZ!^LRr$$lW9)k+#?aFF8>3iAr-69Qv%yZ; z!jg2+t~tr3efpvm*+)3A?{dPqZ)4%_P)y)Q(8v2#dN2pE&ie7o4R};z!moU>G)Q0| z(IZC<Gm5=+#^%e=Bo`!D+B|IQXBH;t*!O!9q;nz`{_LF`Sqg8Ayo@&pX?M7*Ns&K! zkp5}=NLDWDad~x83-&fs>dwcUdb%PIF;8t_u3-#OL1tI^Ah!S<Q$OSCWTE=f=;i%0 z?w_pL8T<gBm6yJ~HAILrz*vN}ZU9SAd>FD+LeDo433cNZbz&q6BZ@qgOT6+AhuG=- zvymjKxe9-1wp=ah3i|f=-D9m{_^650QMnJrVw@#e9R;3l5lRGC4CEA};aH%v(%G4{ z`>YWgkWUQoiO!m#p4`caA9RYkI<5^8-r=orG;FB-MV|OldcC?!mdqXo5!0A>d#%Em zjU_$~E_B=TF{E`zN@lT^pWOIrx;koQ$j35dlZZca+{k8a$Eb~kJuwl~jumk>$4xSS ze`#8=qSe*UuQdoQ7*$w5RotzCUxQY7EX18r*HY2yti(uNYGZ^P8!GI=`6_CgRlus^ z`9S99WR~MnBS_>t)^}@)VE+wDw2Jq)8LIse0WBVb8c|40VwQbnLX{ePWilHJ8npoh z?AkO0k!tPJ?mR<CD2bS7=|j&)M;<r<+FLYuUYj1|HV4f8EC{x%U@#}kqzJ!mOcR+x zEZn4<i~W;GRF+L(I~Zi?WmG{!n(Cq~yvPALbJnwSJP&JTAiQT}7Ba<sRpv;x`uBR( zvj=(=`~I9A9G?-+bso7a&0@EY88I=U1jV#;lnt}-O52PDPZKo`aw3O)v8hUExEQ}q zU~G3|6ROe0hZFTHa17h%;e-J?2bTw?R*7(ueBKk+RBS_KTx1sh=;1t2#N!AW7=jA6 zzxr<d@uAaSrHuyNURob?M(&M`k6GtMlJd*jvvBd+R}>bz`>*yziljer50%xka>38o zaLmzTTa)KcSbf~}CTXPV<y|PeW3LL~)UZl+kF2mVTd&!$Z7)r+Yb8!<You&4Nq~d@ zOMp<yGO=`F?Gi|p1$^<RY(Cxn5^EnC;($d%RCi>)gD}y1Q~L}i#Di!IN%SxL(ywm( z;5?qKtJPcGx+zbrl=M5OBGCXK-V$#-KAy<rV7<>gE0RCfnHAI6FW!d+*{;0Mjsll5 z3`JlqN4QWA;`tm&qBIMRue-Rus&VLZiY}$tN817GOe>>&taF1y93q`UB_XPk+z+8Y zO48z=7iuFN?T6T*sB9ygY#mpv!tp)u#g<CPV(6iv3QtpnyL2ZZ=gs0el>A>FPNqzy zpQwxTZ#@EdTBu*xP??6ykQhuv?{Bi1u_9(@H~azMuYU6Z%gmtcIXN2Bnn?fV0Ur^H zQ9PMDlA$q@G1pRLTn(Pq_m2>6;4e<V5VzpWF6P@N>K||Ja^Y)?iuktiIn-Xff)FE0 zT$nPz^KWW#;ld^1ZT{{jHd5+Jbv^^IlVSGY;pu4(H}@5~#u4pYDj9e#7|;t1d%O6r zQC!$-|GG4``*eblA93Zw6n^Q_BkpFR!_<HuM!gJCSzRa%yDT+Xx5X_}Z`$LcG&O@J zt(@jqsO7>v*MBfpcL>?NgkImOLy#mE>H*gJ$unB?%@i2-Pfvz`Kar82(8%_TKER12 zwEYV1A5F?7%R%-{ZUawf5(99Ycve9d;_6EL@nR^0X#13auas<A1K!PgZWcFhmK>Xv z@00tHV^LOU{qreghmXH4@Bqkcz=DFjZBSOJF^RQGl4>74;<z-}@L6HAFrkHV%kmyS z0$hL&*wdXDM&lNY*lmontzAWY@{EQZqD1+#hUm^MZqs-p_QvlNH?wi&j8;|p5ItOh zD`3MPn=aVw1*#L3v5~71-DOv{UimPxax2SJW<_=ucw=%axji-I$&?4J2<~4+Ofyg8 znf8_Xe;^bMxUix}ohqQJ$ytK$EO_^YvcPLcmZy~=lo+4@C)}&f<VbhfdHz}w>U#Bh zAdVujVe^Wpu1;wA&gm*!!?|57RHdKrWD+ALSM5qGK(5iw>$Z>*0`jvQWYibr6hYgt zyE{JLZ5*K1R7jJ%%<5BG_+GM&BeAKwZ?yKaQ)7M{8YR!FS_?xZ<z!^!SWa^tZdkPp znTD(hUbH1-f@s%CgmLC>MxJ|i$*59CQ9(OvKR}KGB*A-{d0D#k2yEOU9ioxSUk+Xj z%ECU&mJ8YXXc?k4KPxyi%C*xxh^#2P)5|wB^!l6TJZ9xN^AGTXhxG8EEkZ2^1nohh zb9o9=JvDXLtDZVw40geoxHd5AP;l|6CUSz~!V)}vE)BM1-KgUxn%nA;T8%syI`8=| z4=$@5^y``75an5MFtnx<C8~nwiq_Z!38;<tMMoYpa8vj_dYB8)NP&8IomoN$8@}pu zffK`Ul1M+a794d!mcHAjV-sSf;^)H2(URiRd(*w67+)NvEkc0fC{!fqT#P#Sy$M;_ z_VV5F37tSbO(h5RB6X=vFUiwHRU-z{VfpPVQKf7kP+FOlb%YQ}658ad{13rHR<>#& zvCOd|F>`Huzb=g_`=3t#JPSxf>K?3Ked9bUof(%}lJnGm(1f%}@hpxO==@RQsb~K1 zhZE;9_&k%OoMH)oe`)wet?bMp*$(ugR0LHkq8ox@)IU<vgl)IQD0G?KU%b>6e}-UP z^v>5)VbW0ocZEi=k0fhu%9&y9i-ItfXn~MN2_r(wP!KjmYpw0@uGOit0~W4^#5N%z zrPx-TRnjt<!^67`2+Y#<XroK29c2cPmWLKHWfOwjZh$OAC@;T3*p;@~lQn>R!D|Tk zzJ+<BhlpkFHwu6$qVxNfWTbJbBHa~Ud!9K-l-g~uQd4lfqw?;eKA|`8!m$*unqEIa zWSXQ-1gT30NF?My1gA7l)qUcoArklWaz$!wsArdV#UlCUVpj6Zg#+%Jr@KH=-<C&9 zq-Lh(W=z6xl*1zpO9`*m`Fq!rFv-mD<mM*^k)0+FaIX3yu~El<WVnSZ4mlrQ3y#}b zFjjSj#Ry4uE5xlD74-w^U^%SJ%S#IO=j)(oCnvuEDl%;<7yj7R(eM1*8yQKvZHOTi z7GRXH*VJe25#&Cx+5IwY_f{lnBshC%S0au3k62n|O>u~-&w^WCEH_pP&%pK_kLgIs z=7Px%Z{tOT&0}cw;$Z5y(IZ9O_KuB6*II2+ajRp3&`63mbvGGMA}V7avKWTkk!+Gv z?=L2*>L4~%>-uNjOSZYa1f%0)pZNll-yNdqM_GA}ZNY!kY;wY7LM_n{yOh+D7P@P( z7F};XlL%PYlhg*9Iz*KN@HU@`;FWUWiacw>9<I(FYD3NiV31A$WWV6JuQPrMpger? z3;?eZrf4MNR3m^&|4hFm_p1?nh?~6RgR6VsZL5-Ro*Ee8LEk&d<l<$<kP8WjXx{Wi z1^UJtiFoxlp7-{x=p1#s6*GV0e>p%5P{3(GVwCYOGJ1+aRQX<Kez1_FJRGO-yGZ4p zRRsx?ME{{|5!M)M@dao2`wk|i8HI*pm5I$*4<G)^n=xeXQIbUY1OQblTN(uNm0(15 zuC?U8qLf_bAtOm1Eu!km`uDh}`Uh%+zpv?n5>J~a;~=}m(XfRjLPbp^PSIE>*}Vo; zxn8<+A_y0BuTGrn2&7@bw8`XRBK4=vvP_ECKEG^};$1v-jp5-W;`1kb-7$0FZ=P|g z_Oo`NGFIn(lVkZx4+lqNT1rrioDzyw>hWnr3RjIxN5f#{Kf^VP)hI0x?&@I`zWgWn z0_ylji!NQl$Q(R}w)~b34tk(L^v{pq4etwIu+Ca{k7;=I4C8u<m6sdI@Ff9h!`XFy zw|Zuu*X@p2+U4O0Y#44}@F38%kohr$Ood9EmPj`CG>z`Suqu_k+IJft{f{C1iK{hQ zAn(GNBMkV3fdgB*t^7$3{%AA->R4&=oqiz&x||iKPQ+2gH7I#aH0JMSCHJzB{S_$4 zz7Cn`a4-&uk9Ic^vC29LqJ{yK*t|r1cMs8Hs%2X#9xS)+B__cjt*N^5VEtZ@c+aM^ z6eH<J!VbY!qg>|`oc#f0XA(jjZ9zw@=4e<&OdX>{3XAy1uCXX~!Q?Jyg}OewE^@xC z=pWdFz|pZ)*|CZgp&s^1An#TbhtDM{$;&5I9f|8Kw}p3bmpZ(+xo-c*A-qRfq-XuR zpe>dQkgA<sZSfQ){3}s`|G`=K5QnE>F|Lop()ADGtjr`Z-{q^aEw1jLrS!s&gBq@3 zXz2${>c<!D1QVQ^G#3f#XF00dBPtPWj(KuKC@Dy!8-Ap|aT7a(r!8cc{Rw61y!k!W zu)+Lv)gKMAS^C$6Z~^Y&#%_~^stmqle$ZjY7J3(S5%8c0B5}-Jw24F5ZY35Ti4Ln7 zl=Ne2n#APwOf4ZY(vmmUb*3iDGHr>xe4OF2idQekT*N3LrUDEvu8_XyacmudnoK}7 z>K%Um{t+6f`l@3W+A;U!$rj2)n$OYqgJ2%IqXEdy8+X`2m6(E*Eg4js7WB}L!}+Sq zo4up_L11Bqe1BfRkQHf(iaL5JXt!t~Ik^srRGvP3#>|+L#su^Ag|tXXplohXp&Wj+ z{B(#<;{y1{C2nZoCNOd(SzENY3=kW1#&O&Gw^bsczxlYVZizm8pKncU=m}@HqT_*p z@3QA+Z55tM{^z#K5=y}8oAwl$SPY6504*yF4#cmc7(#kbP(e!Vsh(Oy8*Hu7`doMD z{&3U#4-fqy3|6-{7tu)mMwqLfV!(f9a?oe-ulav0%=&-a(J)tSZ8FT4Fd=slC?49d zqEK%Zg(E)IA`IW~b&|#s&@Zar0i&WtG-9;Y<W_zD#MHS<1vVuipgpOmEOzGcf5`Bm zSz(@e=m4wzB`A`@Xyn5G1`+uy5UL-)piNu-Uf8By9JvrSZSZg%oT0pIa1Q^}rlePg z0wQKA-*#{|>UCVM1X&g!&kn9tH7Gu_xZ(rnrokhX-~L}U;vxv9GzrJB{~e;p3U2LE zi}9RTVZ(JxPb#l>oJt+A%3!_<KV^VPAx&dL66$Q84Ot}BPn1{%?0BNsy>9=KcP78^ zA<R28W$^@<sENO2K@W;d-TyQC|G|u-#Z?~&RU5i2)C3)5qD5o{9SnJ{C?F~+czrdx zT<YBR3dgOGVkcEB8An>$g+uROnU-9+0Z!R9G~r&lK6Cv{=v>H)-H*7B;)gxz0L#UZ zBWnLR&Z6IxIR7KQ|07TqqQuHPi4?X%tHQkv(k3-sVm=iHW05v#qR9CR1S-AO<508= zXyObKXI|aJv6YhrH$z&k=ZmaurO$Cxp>@aqy_V@?K7K3Z3)FCkJ=tgw*ZZ&jP$Aa( z|N0;Pv-KY?J}zHmI+RalgXlRwAzpMbK{O1NW;n?*Yds=mq-J(+V%dSK8TlAYD=I+| zwU=^<{AlC%cT^vI@y(i<j;ARP*9^So|EBkU1H<;Gl^I^<^@nJ<v3Ef*#(u7+T^&od zF>P((f-Vd`4$t?@eWxOC0BxweFU&gXf8F`tNC^VBZk&loJOB_Sa3B4!nEfrWh<#ov z7Cy?($X^>d_6Ih~-)#VPuiuhlwPnpnP&}>X|1}yJNmB&Hx=S=yZ#{Ekf^M2_OrjA3 v#`HgH^nVK|)sbQ+%>Op@|F781LjHnT9vgb2$CViU_AjKw<V9<R4TJv=6M(ZW literal 0 HcmV?d00001 diff --git a/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-universe.png b/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-universe.png new file mode 100644 index 0000000000000000000000000000000000000000..f8d67c11dce2b6efc8c4018709a4430b05fb7ca1 GIT binary patch literal 21912 zcmb@tWm_CPu=tJ3VvD;hy12W$ySr1QxH~NFPH}0Aw78Xp;ts`%7x#tYrLahW|9#GR zKEm@R$&1Kj<~O-Akt7{0WgGwn00993M^!~Z4*>zm>%Vd=2HJlqFoPrx0m0B(RYBGu zsN^CXbIsj;>$Pp?QDfFyL<Dy{^OO!io`S{~J1x(4%3!UCN#3V|QI!oKW}{a_uA<j; z(v4SBi<cYo#T_r)4!(N33)_O<_4n7jYv^5}+3vl6e!V<1Tm8NxS-(dfal2bGXv0H> zjTZC&XEq!p`(;`9zkVtDYQ#%@sb{+Y+w2FP=u%A+yz4`ug8w&O!ThzHdAV;Rdrj*~ z+Avn&|H$A>Sb#cfLl*ha?0e}BobJhMAVsp0=I}tC?Xnhw#h3URPhN%CG*G(i^-}&P zGzeKEil1zq)Gs0A?AJ!AFS`80`mktcNZwB0ZV6?;?ACtC_hHe%Hs4FduobMmbS{(s zZ=UkVs89kFXm6?SZOns^r=~et$_8CJBK~a9!;a-%iTI2t98I*p%Mb@Grm}(utEAHE zp@7}Ds{@xh`*Sl+y;t4d%T|f+;*F^&aH61x2PuWpJHz*q1Gf1BJnuPMCZPUbjXK-c zC#`+eFY&DrhXv%%X^=Z}+8so;`d;499T;$WKJ^9GaOJ&8@0Apn_;~!EWbTl>5?@MD zm=v<o)t0ZY2+W8l&>S?Mq<|8sF%-HX2J?t{_9M!Ns!j1?)RmNP5RO8GjV^8eud(K= zALC-bJ_?4s_imex<cim9IIS=7SpR5xD@Mo;5osN!$^RO<9i#>X{M+IDd>A`tWkI^b zt8T#?2kjJr(R|rg!-*3CgpCh<6(*4@!A$z!`T~gUt?qbeI~o13-Eh7TdER+YDY+Eb zV?iz5zRUMgvS1?}4RC6qZbkm^pQ<VTUD;o0;QvQeJP}!zz!Jc-&^sHka0zi>-fX_; z_(mH;jpMqQSgPzYWwxu~(Bf{W>BASVxl35d#*%0t##AB4xPQovBq06&po~hVsAt}u z=^%}bLj2c@n_BiFgfof&vjb%71pL@j!f7+6mDN-DqNMJIDOc$ESoOe$^3B!)W(Ez* zDI5KdL1u|*S38^VX1%cxYlq)fWI7roN}ga`umI<9i!2W8B&tGcPPDVs_cE}+EdWw` zzrkf{y&ZnmlH+@cfZ;2S2K$o_)hzLa%d(mrmOLl>US5fmFIVyZ$MA4$+`HH-ui0Kv zf@>=rb}`s1!H9k^dvXFR>S(kRYUtnvA8eCf^k8QRAdFD?JB`(Mra-(~N}ej30urgB zT2{fNg=ZZ(uj(%LpZN;rd7Q*~e}c&4rM&(r&vw<>npPHn&DOiyG1nHtl`?1EQ58?H zJ#USB`PZ0sZ*t{7d+{qu@L;Z^!}pTQ!k*FjlsMq10J2?gbzQVq^4v3D3aYR1z!y>v zlB8GW=7<cWmzwRC{~yn@9fDxrHrPyai^I53bC&1q`$aWf<9;H+iFxeinlZa)vF(uo zx+DL=JSr>X(jnL9qAXo+Pdok?%5e4>k7WI#<(m|7%i)cLY2&2-J;e92KkH$j-t2!6 z)Zp<`K>CuyQ-%uc);Ptz8}DVE(~3U7uK;t{=MbHv*r?*z?~D%gTj6<J*iIAXX#N%j z*ITpQp3&*d$b3l8_>X&7NvL9kFiK^^N+{W&b>u9AZ};<mUN|_fkSZ8+l}-0gPp$e$ z0Jf>oLz8jo1Tc<FaCA`kdgV!fqk&?*6MgkFc^~UBVnh_K3)|$K?eY|XdEoA!P1`Mm z`N?OlYsNOz=Qnbo&-qjS9(sg!FK79Axr{6b=^aS~$Bpw@bT*CNt`|LN7qsTm3OS+4 z<5b8rvrG}D66@Y;T>7)FfVk@$4ob|)xn$o0B|QAn?{bFxCLj9QcUUKPRz+a1p!_Vp z`T*$^9!pwMIJ=3{-;nsRX!~xYqSe)+&-3TQO*zJ(C`s_jMm?9MrpGm4NTF@Wv}vtn zPgz0?X}ty=Hh4V3Q#nYJvJ(SrF(M?F6fWwlwcIaxM%s57I?KDJ<~C@=W8b706dl8Q z*knPU_CvtF*OVJ5&<)bt)w&&zemF-<>d-s;VGm4n`6aM~n{JJsjftBe(}sYgC&}xP zCPnk#qJRm9(i7DfmiR_C+=N-^Ym38hamVcGKN2~-<jb^?C5UB>GqeArd7@DJbr`+C zNBM3zmSndNWvEB^^~zNb(JW)8#1{*c`4_d=Gua~49hxx4|8O3Pjzo3V^`hFhfogmI z{UMbkH;x_yo(L2sFwyiF44eiS(?X@@8uyc_vLA#c3x0`$-!hEw|0x{_596<%*g<u6 zP&(N%mTk$g38_iY&p74=r<cw3v)z-^=d(ZQR92Yt`I#bg8K<vVt$$MsO5A%(Pou4) z6^G>yB<^yq;ek*N31_=H#bLAlvoD*Xfx;_~xDOXaCa~}VmQU^tvaBN5_9)#leP|#5 z(fnl2(HV*_ER^dRPI6GE$=K56IuLBO=%H+Ssoq4D+pKP0cr0iPa3nC5f%s}c#NEj3 zW#2Ph<($4Ti&zVDd~H9>8x=f*t)?vo4YeSxcHkkdk)Hipz1=`RvJC5O-&r~RO*IyF zr{1)oQ*q1Lm9AWJu+m)5Bzrcv#k%@s)J%kNrT3;;c-dW<-3%%%rt@tao{F=Vqw1ty z0C^pYO@1Hh!gXQ-UCAGAZI~3c3J%7!WwhE2#U*jlOmFk{lv48ts~(^=IDBUMLO!Yx zok6d3Jeg~z9pU>vM#j~Sf(++bARoEXUYn<5xyttb;Ndyq-`$NF%oh0)>&M{SQJCr1 z*-pv_iO|V6v*89p#NRc09apBO*QI<bb91|PR_PqFbN{4c2}nHg)h*^ksQT+q2nJd3 zPH1lJ)x5B2hwz6}fce6xpH4?h?(DBP<hJ^kOMK1g$8P=Clz9>NgQ0_wyCtC{b9+1A zrGuE={j9Uh{N%kVBX#RZJAg)Pc<m}33~FnX5&ayRCWN0;ifv{kG@s~RtvJtYxg=0u zuc%;~+Vhv^F4KgkyFs5V(-6jExq_wRcZRIUAYS#qR&d=sNpSa(V4JVAU4+fr*!KK^ zmTS`C6}DR#45nbWNalO;$IMFElUyJ4eo`FRr-IA^FV&CzlIu?oI53$Jq8zX7PXznU zCjIYGM!d*hUva&IHdOY9g3t;tt{AvDyC=b5Z5*UIWnFO(ETVVel6~XBx5cMwqC0Si z+p+Al#CAIKZ5fqXj+C*UW}in%j)zcRfR2n%jN|)n(5}unI)8xc$O}?qWgMR|-k@Pb zzVD?0Y*So!K=`yUDBS-o>qayF+B?U@@z!k18Q&nKv_EiFDIYgolN3N%jxy@QIfAB@ zpza|)-$4yZ-Acx#2p&620LnRK96W3($&HVN+Bar*P{fnY`%J_0oTLCWKB64emIniJ z76M-Vp8u`=0zC*HFg>3nv2lu3@o#ZhY!>tvWjm)_=q0e_&F;C#NlpJzH&gWB-e5`z z?I9OT&s+z(F@k%jMv!=qS&sSk&&>DaE)a&@NRM^cAHv{O7+#%rG+bE6N#5=`l}CS> zfeKgo5u_-|JsO{j#3jShKiUmf1ilZ<qaU|`FEWXXyPvQ1R$#$!8_;l{ojfrd%;4I1 z-1X(r(DDNHcFJ3gN=~86r|mPH-NNTa=^FMx#<jMX<|j)8r40|cr0uJiAZG0v4+Y`e z9*8@MaT}bzK)p$9DWr!@4&Pv}>6_6ooGbVC+lClt$U?gH+#B{-sKC%p`M|cAEJt-& zfGMA4DP2raT9F+Q-~{cZNu|SIYg=5wWX%A>mT5S4tloR+I^28R-g`U1f6hU+Ky;a< zip36z%6{{e`HCO;PMy`LxtU!iC>(Ml4VVczlDtgyVR{?75#WgAXP7h0otcEeSL&Nm zMipi4KEiiU757mvR_heYGUUv&<NH}R<w6-|Z@<#{79`OAuoj0k0yXn&KH_mEERS{Q zzk0CWA)ymCQePUomsgcb#>?E^+Emgf^UZY(EcS&eG;4k>BqbzS*hl}7<=xw%I;4<w zZ}zD|z^#)_&WvD=Tu~&6+f{P=anb}L;YiVgBHx_-HFHK3<8&qs|H-Kqf2$xB3u!Rg z$;A`Rl5|It9_U*5$XJiAt}m2t#jx~sb|knbuNEH+32n-~xy=I&#A!rhA2E;M^W7&6 z-TPpy<7$*mgP2oC3Zzjp+j%z#Zv3RRK}C4O6odeNMH>#PoF??f!v+Rf7#H2Wr*g@! zOpGZPqg)p-s6{kAw2r4(Sr$c_tmFfQD@{t;Y;orV4I9a|qhW#d!aD{N-^dXY@Op0^ ziOZ_CV`{F}O)YbMRoZDSwC=eI&x1xdf+D%OzX;VVm?}5qPhP#R?C_wc{z-YIP;<-z z4*n<kY&|H|n{@2jZt1AH?QJ$;yU4UWb7A)(RQ72!je@|{ae+EI;1-kTS(-sdJXIG1 zZ;ncefx=tzL?tm8ynu9?`Zqf)2N*)lP4M+`D7B;eb=c5OLQL=XHGY{24f7;^?A-f* zxO@YC{P{64vDv;S!1-SNXglo*46YpL4}iemEgQ>4r%Q`DmI;X<SuPahz<2TkuLAWh zAO_oCH~__$X0s-Oq?$To@Snz-x2*F6R}wGD{5{d|xy2fw^kl0XTTm+c2O@iv9gNYO z+s%naatRjB<1*$;Hn>h5a9psJU_V7J<xi0Bmk7-08)Slbe!3g)7H`_IwKs>44)W=s zg0&7wzNp3A0WYnGkS~6iY=ClS%1kdRTKs0``yM20<~m~bB{pN3VAL|WDG#R^JnZ<8 zJMLi`mA`(}m86Z4*C>&U-3{?7TyVr|-gP*%B+iFW%OcmD-bjWrwQc3Ytfr`q0E-I8 zYEhze57rRMPeSq-oPl=d*)mkyXSJTd5)(!!v(i_dTBi9%r$L`*d7|`XUKe7K*SeUB zMZS;rq1g3C6fA)j%@M|#*zbjsBDrMGu#uaTb)N>lFKCU6oUYfROUwcIv`x374KS=m zZu#Q5B_iu!&E&hj9x2n~?-WmH+?#>ptMEbd7FRF44)9lY8O)uYnTAT$6B#mOHxg!Q zGi_bsANb%(5VgQk2G<w58y{S(J8+OD>N2qeM+*qOHmx4ZscBu!^xrSfT3NB`%vJ(5 z;vPK8Q`?c53xqK(bxO;2_Kzconr)_qsHlQ=xKkM=vE8oL2rVU`x$XCvpsU2VZYQsD z7LdAYya_)Q*;7kFMzdN(cJ(Co?%NoQqT<ybDtK4shdnzCPgf2jF%Le~#bS8oFPQp* zO0XM*$AoeB0c8qcjYnVYX_&g0^pNUZsSc{;!i&9drGW9pvU#P!1!PPXqpqw>-iEGG zi5~>}H2ZzAjwA0;mSa_YC8TID4oxAjTdHm=t!RX?KYXV63(dW|cV6Tc|1L0SalN8^ zFMnXPiQ<p5WStWN0xfoaK&GEf^s*|Y{_bDNXq^eR{puY$8QUvzXPb~n$0X_L>!ZkT z5!lcEoTsh$=?u%}=mu#>Hv1x^vcTH7)*eY5`NM7{5Z4~-m@<2+{}0*n_OoE)g{8nq znVxF-RU0;H(y}Q=#2XQZT_^f<kU^P?a@afXf!arE?%Z%8A5VuR+uPfD$)b^1yA^8x z)zY}ox>craXRp$k_|Z58<?;^Nv-0(-F;7NnF)NOO>6QoPDe~r66^0i6Z2mHWJ$Id4 zp374mj7Z?KBQ@B(n>M*1apAr5^xn@}?Jv`{Kjkc>U6EZiEGXm#>nW4>q?##kG5AZJ z8;9Uxu)gH$#C~*vKh{7ma^!c;>Fjq1m02zx?lgb3{vo$#!T1ai58hiPqypW4+yc<x zAyEDtHIM-VAOD_|1Gfyi+hX#`y%&|#22G;`L79X?LVsZ_O@*;Sy$sfM*wTnce4bk# zbJ2V8xY}#0ZS?&X1~PY4`<Vrz<jjfpX$BWQjPb5qWHJOfx@dnpD>$%`Lpn#g@*VxU z44-l1DtG8kdUY{b)8teOj%M}V>z%3Hh|VfE2!&soM1^WZ9R<R1_cwog7yc2Z9O@1e z&!$`YO#z_R-rXi0Hfy22-wMIR<RnbG8Lt5BEjNEND)QplUWQBKHbklJcAv_dRwNvT zrRaF_H=%#B99Ww#t4K2y@$ekq7C|(+e>sB3A6Fnp?tsa!K%B|ce<L13QavDMZ@w{D zk6|E2suOY9<{qqtDrXL+NvJt5lcf31RW#PJTUs*ph}egY6*AK4e4aXASqVJE8=?^w zYUb&*^}!7Kxu2;wFC9FOReIK6If^O+`NfFDB*0`%r948NC`coT7@x+I<})2YWW<Q~ zFM}e!!xkm7BKo#Rq_RI@Yj6@Z``;g3jN02ZFn`m2%`_Xcy1rYKGLED3#(j9iDwwmR zENPj%d)i}*y<r3kewR}X67Tk|m8*g~-WBYhpz4S4$Wu8tAeCgqVRL#B{jooC5mG$f zX`P^;QdpCNix8V-uhcTHjLfV2D89)1%WH*<^lKQgUws|<6a4^jnl=$GBbpoNKCO|) ztiBHbKXx)C!^NCVrMtIdw&3IUPQ#;Da>L1W3nJx+l>DgafnKT3$*@c^X@K#rKIt1# zqm1Vmj(0B565tD41_ovm_ly@4aM1hx;><bklfQnXuBC~fma3U2Hw$Ky9er(&xojJ^ z@%QFyDjCmHq)S<D(%Xv{%uCn&RY7${cqFEXe3hgsR5@90AIX)Qu9$@cCEEPkDXgw8 zz>*5hT0=UBq@VhJju(A{ecmF_%=<mhKt)M}>v@p9r6T&$0N_=#ACfcLO|*Yk;h8Z2 zp;dSNiedR6o?T;+vw5$G(lBnRcUbhILy5XI?t*lnpjgvWhILec>Cqx7^Xnj2#nM1t z&PSFMQYsoH4`yf;7r3kEw1)Ct#t6<0`oOJ5mg-Tl1}K_&8UUm;_EG{~J0HAj(Fnc~ z<1Z@i`{P^WhFB8;C3XFpReF-Ia(EY?mYuyUJg_X1Ek^tnaqOob-<vD8|1Pk>2LN3( zAgh*WAJolEv+f85o{~-Swpsfh%X7~b(k9lvf5h+3o?dRr@^)%|vo~2R&AygR=`fR2 z&dUAcm;|FEbP<qE#*F!1(YWB!Jk|Ooux1k-KB6G=3F)!p^K^W3vYU}l7b4Q8ca}nZ z!@yFbV)ZLB{+Z`VAKvP<^=P>BuMZuv@&G7_5U_6u&N9_E1;Hh+>p+gkWE=<%>;!#s zJaMlrlLnK-G1$b}ie_+-Aakwb?Nf;l=w&U{wGbi={BB;rXCELIGu^MsJ>_+qA1s1X zW6nwoh(u~^*kRMgn44yt`fB>{dX@BNXWopz(E_FnMNk;qLi{`I@=T>*9a3QXT!qg@ zY9ezv%~O2ob==@r3oYm+67(jSOlQX1g#4~b?pXOaL~2EwwC{Oi;$ahgFa0KN=IaAZ z{$wy^y}Pw)LFbG26=C6^z<!s#TPHpeRpBZsbgpA}MufH{t%>=clZgCJ1Ln4WIJWFg zoL@PI#YdE`4Z;Bbv`#xmGsc3a<XQb~Sl7bM9;(x9Q3N;x6Yr7-yQJlnw*8<Aw;T#% z&Jr1RJxzIMS$o%lZPm<4cPViK!lTC(nL5cMT<0lkb%11)E4m%cHow37U9=b|<*1r~ zW>~mJbO$$4`-z+-TfTC4d&#u6<fuZ&-$59IJ^A;YWu)qM1QP0eP$B*%%Xhw5${cvO zZnApqa>cF`clMq+{%AbsR<+7BEd0dwH|ArfZ5LzFvVi&OJw+ntKV_a{4lgyVJ^FL@ zZDa8YE9Tn%3+L;QLhR97eOZ@$GdP&jIdV{xTN}8B=E`v-uN{-|;kFs!=C2@W+qx_F zr9XpXK9{`8{O`d>W-&E6;U@etqDEa#J<q~ga<Y{Gm5eKN@1X8kwTXW-U+liYAu<$8 zQ$~QW<J6yeALN7u7Gd6L=8nS--nuQ8Yl`$1Uc4<zrk@5CgJd8)N;AW&9=-$_3bwZ! z{syrumDXs&HR-b0OyrTh#<auAwE-jV#6_aNV53`-C!h4~N%j&aYdlcB5L}JdONZYt z6Yw1tsrIO2$U{NUxn`7Pz;(ipbv8`|(%NnhDeS6td^n%#N*DqEl&?WsnQ>dIBk``1 zBW*DPJTk6>@vj`~29OgVokFH!glF@B)$o^?=+lmpYudL(D>orr+#stUFRE~-o&-!U zL}$!mu1n>ym~c%bNjIiH?L)i+@OvUVUd()cf6IJ_gXz3g-2A~a$JTyUIhsP({Ab^0 zGoI^mjSR|0Q~S%gw;CHn{o4q!kN!H%(AKGs+6@1Q9T2?b4Jbd&BaQq1BbqMv5TR*5 z^vI*L!A%M%V&bhL-hEofgNqf=4TKZzEb5`Qvt=l{(R3(WrDfAu$S>P5yxg##-mT*r zK?^?WPMtb>sd#<0iEzVAPv?Ci$N28-kbsu&QIx?&rajpDl@rHJQW&f5)fs~2<r0?0 zNmnzlAVk`d;PT8?B0ZzgXI6j5ocNFOJM;XSP87TAC`7|q$eS~!_96|jnAtP~*{1dN ztp~ifS+`I1>Ex80VW>T*6mu2SKYWH;iS)$CGk>SM;U0=IUk<RnG~`*5#VlYPOtEZB zz1qZb`=Rj|2C&dfL%VXs-(SB>EckULXJjgT*-vOcANP&%Q&3ZO)??~^C!B%vnd#ql ze|g*hZ+yyXh^pO#-2>&NxW)I)D6^S9=iP#p)+>>+;PR9+-m^f_z*m|Kg?e*iCHnER z_f+-pj}ZGdn)}0pHSypv4Oo1Bry;M?u;`p&()92tSVd|HfqD2Y5Uc(or5Scb*!eoe z_ZG|x7(8@YdRlr{<U9|%M2$R^7nzH1UYU(gDVg*lnoyx+$2^j+U0OKsCJVye(AO(0 zO*|POd!S!*0b@3FQ}=&CueA8NviorZ=qTq53P!xFJjJPX(}&oMRcvJCe$2HR4o1^Z z6#T^F^|t}2zy`*sL)>rQX0=rhLF-dypFi-)Ab#KO<XX+7+V?;*<}4apOnun(sA0bU z>-l=K{hLEePaf#HG4W=GGW7m&Ao&~Z<+F&%Uz&Kq8#QQzu{uUOO&(I!(|bjv)nO~l zb<kTsN>OkFm*ni*3cZ1Wct+zHt4b@zhCLJYbXmj1)1?dYOn$o!8VUvX^gps>Cyd4~ zCO&B69<&l~H6t&Dj+^%FyOJhwWPh_!Kaai?#+*{dvz@)(caVrO)48T!7uZ-(3O}2V zW;-Fxku{)v_`leIXf<WGjz-ss6zjmoikp7>ID*&4xS|@>B<#-}w2gcJ44Q*ZXja9N z-HRudLH=V(Ox}B9VL}avMZuU9srR4Mhy0-Kz192lGcf89KG!HA<VhCQ=?y9HqPKVm zY4(Hbw`I!FCz<F!Em3Q|xjLKeS-bqRGAq03`(lRd^C9#55(hrOvR2>?=rokViXV%) zvT^MS3C%DqQ?kT{1orY!Aa5*#*oY4I1Fo3XWAK%qO^KQJ{v3V6s$Web<cO^2kv1d< zpov-_u0ti`ORuD3hDD5gbM1=x7&8)NubSC~od3HVbboa+vGyfOF1|}Lwt}T4Lm=iu z)AwfFr^CQv`?8>|??~!C4bzsZYot|gw_~+kr&#ZIaNHD&qAG?&UC0Qj?cCPPJvK(e zx50naYATy#>C!Q~mz~`>8+~SD$`9(d1jpFb{yY`rX3{OJ!wp400PL$$dFw!SaV=O_ zW;iSPuCK(v4)^QeUX(J8i^QlxH`EYCmU<0eM}ntap@R4dx3Mph2sr+lNok<U7q-4z z0Lg!cDEgiNud^Sq{*_FID%izay9N1*o-I$vcH<U6%6qP^&NHT@1B;*7IRayVDf4>z zyS_j58I#SeStc&=rQbd*tmwMLx-*_EiZ$49No?bt_201o_W_$u>ownu5YxRg(f2L% zn`unn8{ACFM5_`~wLi<FBJCX6ST))ll%e(*_rv;u!Q1berMZ-%9^D{2_elujJI$}u zp`~N7g;GI`muh4%SKb5{<^K9FZJ!BeEKDXYGZBI>UC<`s>H)m4!lQDzqWKK}0JPk7 zd0F3VHM>-n+|NoI4O#gC!Ra-X9Pg3gzBKG7nIm{@BNIWi&m2arTS&H?LQd~cLG)i8 zy4ZN{LU$<=q9UxY@fI$9f{s$1u|SRT$zj<yQuM^#lwIEUSR4rG%slCZh(9l43_Xx@ z9c`*lsqy#E9r!YocCS1ZdS2mrLbepMUHmAyhCDPG%I!R^!!u<Gf?gNHpPfqkJKK=y zZwd!muS;W7m+*rx8^w_NAK@*rNR{#nGa$d8RhVAFw*QLV_ok8AIKB_<LnZctq50wD z#Ky|2NUz66sh?PQc<T`m_xZYn3jOq67>OmCATn(X^?QwJTWC2BFKwDuk+C3YblXb@ z)+4#6X4cqU-O0a3^?<4yuwNTgrHAl`cW;$mb`?qIY3=k;*dzw*#gcmZLeD~+b?rMu z0sUo%CH)1ZS6Vt(2N+(D`k;kLc}>k|LA{4gBsIL_8T}|uXuna;7oc`#|9s-Z$VG(^ zA%MBM!J>R32TuKmjr!Xy{Qd@#E>lUNvc~dht?7&fY_g~;YtN41Hf}rHSH!^Z&$`*~ z`4$RcUVTY8?kE3^jiY`Zhit#~3DLh!MD`ga=fM8bVx(ITJ-fM^cj%!G@cCrz>NKJ# ze!tb6!No4ggcJ^hUnfIx4+`W+T@_meizP|<Th=B<-pN-~&+`MY5Xy6m#?_Jb2cByv zbJis~fHP7vIaSZbqHk9=h^h=W#!Mzn(8?YgGe$Vh>TmHXZR_m(*%u!?j<Mi!`SBMH z@0bW=m%FR6^)1raljL2iY>r0xLAXc4ZVe`1@Kr~mP939te(eah64_nGu8UW;_neTF zI<FFY%qtb{;I;DL6X(HO2)~BBG0Z;klW)cNbJBt+y&FS2(iZmKIWrhRTBc+ke)D=1 z#FbWgAXal^S09HS-+YcybdFkI-(u6_NdpRi)WB4yPqSlRe%#>YmBV<fSmary(2^Gq z6CnX=I78;BXEmuJT7SL<v_=V2Q19cY6YTyC@0X^oUlNB%MPPIs7F1CaBA_4I1hR%} zH$6j^GC4U)8TBJlfXSpSh*Sk_88N>89zL%DJ5gj2)Hy&v!XmI({=!wU;Dr=5`e0Gt zwdYHGAQ}c7&!NqV^2^m&QV2c$K*RQ-32Hh%<wt1@+so>KA;YZdKB8?Qd6`a<<D*{g zXl5TRMxIqH3@(NnFls3q8}O+sVm1NmRdsrqy1BVKmJv<r2l*e42DH@;H>PSAQzd2% zc8fB>j|UO#D4qXZzNgr_^ilE_fIvU!W&Yta`7aqx`N+8M(M*U~>jT&3%El==1=wPr zn1M%)18T!N1~zvg)<`!QrXIPbOLoz>d(;{GeIYi%kzlBhHTU=(&7f>_MnMVhW!<vi z8&r7~%ZzdK9yc$D6Sq->G7s5m;Kp^R%rM#=Y*#6PO|oiOg~uaLX6N@b#|lwe=LHXS zda9Z_Big3UNB4^x;O~OpmnR(<S1j_H)rJa@^q2UhCa3-(I+2&$<JCmgob}!N!JT3n zm_1^FBmYU=RW|R=3>WrurcD*HVh90_Q@B*_db8F$vKxUEQUgtKj)+O79A2?f)4aKR z^-6ByFk;FU6g2au{fc)*4KoewW^svo%9}o$IH1ME->*a5SYz{CM@q^YV!aQ#NEBN^ zuqX_^+DKO<S!&#;3KH3<gP?7?)c*CccceI;)q(!+{l4XgqOVw!X^(zfSA`TeW|>!{ zg$$P2+`#IcNmHV>VQ!TM&hK+(cO+78qjji4KQ~rNN8l9sbuV24#)C1QU8Kf>8Ahs( zIcsMke!zyrgs9b+;OBh!O9{Xg?`SBcB@kT!D?(Y$$x`<?M-5h~G6o)AfPOPso^T7H zADZd%`Xm|ctxfn5JTXpy;}N_6Xa<J4gvONNLcAw}aosHg2wS-t{D1WiK30QRn`|s_ z#j+T?hHgtT!gg5l@#FMDmgPp{UNhUfe1Ms+NSu8%n$i7>LWZxN1OndCB;~fwb+pkH znSx!A)mNwl%Yos^z1}7X2ZC8g!Q<-m`C>mxicXx+_H7{JZnr#u&Zuo7Rv{H@iA4j- z7W-L$%H`xZ#41}UghAsYR!gq!Kg98SLtcH-=*%0@w@ikC!UNer70Kyr`v;uDTaz$z z4t@`V%XhwDnVh;2sLT6Led*yfmR=AOj$!{!6b(P}SF6;U$GX(5eH7BuOpM=)6&3S# ze$38`i6&Eb7^{--t$+&l=iz-Te6&cg^Oj`uW#a;U;JZ(QywCX(S95#aT4tW*sP18m zaa{?M1_lP`3cvmd?H6y;t?I`<M?Dw%?Zq_bj~(-0*qo@Nk~gJ>7N49T%rInZBiIvR zbz!<t6Sn;(UipgY{X_T0c7xtjebV9B*51qe(Z<@pt+sq;Ja);|b{EYiLyu-#f*eBm z?yE^CSYZnidi6tg!a43NMjT3i!}!id-WqKm=yb<Q=p2u*%9_vV^o@1Um|4zt$XqcG z_$n2HKx)3r=$Dc;@DWZ3vF~Lf%Nx5e2>s^H00CYtW5E;&h{R%eXXppA)`HFw>xO5n zvc00<!$bO>?A7Xw_pD9#WV7P{MUa)@WndlEEu4yPZUurR{%^BCkig=rU*3~fEKu1< zl}!in6H*3*bT*N5*YH7t==btxzsV962wt2|Rdj=2(lH_&{rd~HOxAaN@0#tn7b}ya z2)s{n;P$v*mud{?^v}lz*WG#aVGIocpH^xlNabt<&59LhFJ(`#zCX2pr?X;LGwJUg zEE1s*)NFI`5tg?}p>~aXLq)lgb8xG>OGEyHl1MInmAmVTCg(}Cq&5}WdxeTTLZSe| zH<RW2a*}TXMzS_8HKWB8Z_8eAeP>9wDOi`PlHt6gid}pqjR9xGe2^son*aEC92_2I zQAC+@+o@bZy@g8p&p%PVi_&nvcV1f~9p%X<M#``m7vT=WEA8v)$djTQJtE^bE(75F zH`Be%{FdWkig(HWu>}hky?_GNjh{1d`#OJ9y9jc#q?xD7%|=hs?~_Duv0s5B6%kaI zCGHhbJ*c6cpjM#xXtyZ@>(T}zltq4b18e*{lUsyIZne0#Req9buiD(vWc0ooQ^_4* z19g+uIO#0q_LgIx45oZ<n(d~MWAyiX4IMb*yGnspekQ(Cq1d_m<*kGovAnVe?htu$ zcVtnLo<pez%BSfohx#JclAm9d&Nv!^G@k7C^*IoKe~eYg=S3HO4O!!0up6uPSLbvu z&(xH?;O8EsJAjIj<u-$9x4flsg?{7!w~ex{j$}<pxxQiA%K-~_XK~8facvh=r<L#k zEmD{<YYI<OE7|zt?<`YOmjpE1#V3%CAFA@OL`_#rBd0n7!8&1x<!?w`u%EmnyF})6 zDNl>Qd|H{FgGxJH5uDYGuKW|oOD%@8I9>YhaA3Ffm{<{aB<axBLvl|)QI!x`r@n#P z=9@~(bryE0D;asYR%>4ut`u6}@m8X&xc+{XU8v%gdvgD-nJxAK6Xr?>4NuA?+h2_< zTM~{W#pJ-0O74nL7cL&ahAK@g569uz8l`7){ak%Z6on5Dxlv_(yUbOZ+S%3TZzkXK z&%dDC%Kj16LAy#0>iK;q0`{!5nPYIFuA=T&kb_01wU!7$obwf*wsbJ2l@BZJcdnww zf;j8#&u#NjBY3E$_);f)A58Le*u`jiP1vDhRf%rDOuOlG4@*o3G}YP79yZkSb{6Ot z!G6&XRERV0D*y+u+dc^ImjQxig5x?8oF2&Sg3n6c!dz}_21${ROsYV&Hxax|+Rpf1 zCHR}iFET|Nv9LyM29m!GL1i4p-?GkPZeQp)-hZ;WF9mAlPi%*pT}q;$rt$0iNF9w< zzWJ~+S6>k4Kcx0YaU?%cw@%2D>cF^4$A=uroqQXkdz6|3<s3Rs{1>-+ehh9>7NcRk zDs<|EdQ+LRi+Yj=cft2s^WBj3I**Q;l$vLn-+yk_BH5!lFSbzdN{zt5I-)9M=hONF zVXR7*tW<@2C@Sr*R)mQZqVwIl_Lfl}+W_rf9l>j5FwqhQEb84JP1)2Vrt95YzLAIw z(%1t5B+~;v#ySmBtDzU&ly`HJK}L`lVtu|3^cv?07(2g!M)%)uo>@lpL@-Q;7m*>p zYkY|5c%2{=UXS=Q-il{BWNsI_@?p4Avu-OuuV}P3r_S4vc!|Y+a2*%8N^868N%Ao_ z5cnh7Fl%PnR6K2(^PeUQii);PF`}!BOKc_mtvBVR8y6tOh$53bj8i}}Txm<A^dtF< z8t~hYNeLg>ER_M}Ti8%Imwd@5_Dq@iBu(|bcXS72fx_3Kx!_01fsT*x6P>4B!h&*> z_iTmx$*h-MWcoiJne;CZDk)_}D?la}T~cP43m~%&7gKfp<cIKt>1V{G502UMNccWA zbY+=ma;QjrpiAVm164f@G5q!|_7zb_xwFBkK2ZqlG(2(70~%BomEB`eV5fUeJos*@ z-g4VbkSX1$$OCh-izEqkyZ8|DNIprfv6FG<+m-u3*Hp{g)1olRc)rX}H^BL2aCiQ4 zUNBGqn};10VBdvXsfo{QEgAcpATl1`7Vt35hiQF%d!E_zcQN(s^O5fa`gs=g8$jR# zZtk2-0#g2p7Y4#npmr=#cy|~#mWb*HbSDje%Mu#Z;eIwdNCPV4q49nX$H{Ym#PIu( zzV{sDE&|2R1#L<(_MtvHNs^O{63KLHtiTFWqbmGSg%7f1@7%jS<0xXecLa%VF9v!w zA`|W#O|;)P_-wVH9Y_a$=(bbWA1f*ahRuv930J4*#o2s`BiHH4eH>5E$`xsr=*VJQ z;J^JoZ)Z7Z@kRgVPRDwI&On_FH$D}NyaJULA~Q0*Z0QS~G$adVgx2VqinC9N)<8(8 zi5#jHEGG)6$1bk9VOfH-DJ4e}cdc!I{buwc6fGN8>5ntF6fCGOIW7A=;~bmmw**_y z@v3${poBH3Jlk{dkemK(8h{X!<Z}!2%(`RR-D)e!?i4~_Q?X0K?WQ1X1aazs{rznX zv|U=gLw<(}Uc}3s#4b^KSo|pvB*XGo4ts$-3&-0b4_dE;;Z>FhO-!*jJWX1|cCKq8 z%Sq$a{&xSM5x=wK(}RS@hf^4q@KNVv@&q9>;pdw|*-igf9-WnFcD+i4#x4d3MF=k_ zoqUF)gP%mw_jLAER;{-+`Ml$~f^N$Mw*H89e=a?5{J|sBXzcD}+Ypt5v)a#KY>=HI zmKh_{g9=G~&gJ8@zmQ5)oyyHxxXs18YWr<@@&iIWyD#8meA&7mMAtc^dY24IEoVXD z9KcPJTruvpi_Bgz987TKpR%~^oA1KI6pc4Y2dvwiLVcD&+caQdEWP#Iyt6}X*Ou^x zB@a#W9b44`IZTJfF|uZLN12{GPSsE6Srs<8`(NhO@UUjhaV#ciF)+?-d2D|(8tQ;s zvewnJ5jx#c5~-5b{D>?J_Z!C(feEUK<0koSt$rOb#ryPM0{T*xI@F#oY=+PlpF+ls z@VUZvz41|@To~=jL+c~^v-P*5FiTv-)A@>X8UDeRCm+Tf?ZO{)7MM~{ODw5(lZ{nJ z#+*`5k9YHa=B0U6t5V8C1Yh%(_x6Sf<ix6a^{gR=j(H_qw7pIJRjJ=QuO$in3cutH zp1#f5Yd0;S{P61CCDTe!X89Z}CS6}C#IdDiK`nSQ^nOAUa@ft`JD{QT8X5if*HJIA zsmaN-ZBp{jGIB3LH}lbubRV>cv6p`WjgplENoz)EhqPc2u+8W6(2}wLkpS|#f;n4! z^u$D@?GSIm)a(J?b7?;nCE9fs>{8KaXxQ|6hjjx+=ZY~`D1OZYW-7UtAoAczH)*X5 zG4i~+>wY-B$FN^Yr3K*Aj&FKT+Z)kxLW6^%EpgONq{zL$WUjSU8}pkturk~BT2a-* zGAHM^+K~zPgWg;meHVW7a4N~oH6&7UX4~+Xt9?y9v>_|Q#4oB^!*c9^M8Ud5hec1) zF9;F2QoII4YYk<wz6XYxhbWV{WZYN@jjZ=beFXmYecW#30$*jtGFB>-M_Nu_xr;>B zM_8Qe3|^35XPSL4{V%j`Hh4CR;c6xsy9_5l`SuI^!^a;vc+MH;>`A+|EQNzn7&~l2 zbi#xJ$4r6ou6&U~glgo|JjdEN07^mPrc6va$g_V=aU{kB^*#kS%oO^@B6isEdM#=Y z$|{r3V+bgq8#}2~xG`NH?TT?|XCEi8iAQ6eK5F5W&42>99lo-C?yHHKj<eATW!a3I z28YU$9p->1e@ey=VK@0QUxH>{KFhr;(g8*YC8H!q4kW{Qk_#8|t^h;zP^<4%^;#Wk zOpT+)6%ui<b>K=T@{#a#ep$(%^Uvnfa!e*{;7Pryf|2}Y&o^cR)iZy6V@XNGn zU4^{}`B{o&lmE*$Y9&L)vSyrj6(>90<$Z!rnrlO`v->L2p|k=M!m3hloG48j(E2q$ z)<el{@FP^PFEF&Zrj=+zb6=7nYe$OXCUbf7q(4U|9uqWhBim6{oMG+Fik(pGz=WCG zNJn#MUyFX^<NB%B#?Pfer^jtk(2L*s-i>xYaLMkb5$R!U+5MJ=M}0PD?xXGI{ythK zj%~|OT_z5xFJ2ZXFY^!|V7Kn6C$8{UWo7ed5N%2GiLG7C*b9lQF>4DS21n+F1$NlX z)N?~3i{|Book@_sW5}KQPtb&F9zL0!d|%$}sRyC@)?tduFQ_uE;5bQ|Y+5nE{*{=V z{kH>k+|B{=i&Osnqv(x3c4D>OJGQxMisz(6B4_|gRrIY@4VJ)0hedflBHT%YYNQdA z{@LEhdT)R)mHCa^&Y!C(3wxQ~wBmNZG^k8{H#``buS}Y;;bf?VtWn>qZlZ;(XZ997 zVZQORq+CQ*l0nCa<TvVxpyNrIX=NN}`x>!(qt<OCDrZDr6i&XseAcfXR^*@E{ex!o zNoVh5QBJ-(?4FM5O??J?OIV4EX(vl-$@5OOk6NZB`Yv+H<}YK;D;Q4)S@$Lm>&vD_ z(xU&o6G2-w!C;4J(r5lIxxK@prz09H(#L5axhHlQsaaY>5L2@8%yl}wn6Fli$%V(s zWhzHK+vjoIewq0FdGwA7Bj6uLyq3vTdM=-0w{`2R;+pcE;U+gH@qaqe;WzzMYf1SP z^#!(vS&aGOSE2oGf{N#paGDcaF9qsWj~KN4W4a>+^n>w-r+2C(%4T71yi_{D^WG5{ zd!)j2vZ(^^mu;+>FH9q8X-T5{-RLoV!kbCFkissiU5k)OkDnd+l<4Neaf)U8KXfYU zz8{nT3@!*d%LUB{552$?q8Qq4Rf!d4r`<ObT<7zsSTCsN$c9ZI1bm=uw%ps^uISxS zU;WT^dM{OnF6r&LV(;{iCVuOv?R;VN@zY&8B2YA=HI5raMTl9`n|gLmEAvheJR)BP z{_Ggm6vy}E1T7be4fUkS9f7OYvo+<7`j`GKjT{{P%W4646NUdmxZIN?uloqGLWpOW zZ~c{b&}ms=+&MJW{(YKygUN9+;Am}!mdLNnAZnyk>7tl*A*L7-A&KcToro8_%#bKu zPP~aeenWPepBWHQ2CrMN*zOqYZp5^(Ihz;`<)lyf^&$J_hA#+@;rfPbX?OBWh(4wd z+q8O<$5BHJS)H<1ML5c44aDoEPG}ZPjQD%%pR-atk@+D}rdFB*Rzr-&PX@kf+a?-D zn%tI~8hVuw-I1!Vx8|y+acb-~-|<I`%&U4FR|YR;gPWMavE`98O!ji>@4tWE3Y;>r zDAK8B2+)bXCBdK%GYX(6<OGqv?2kSOsA+%ZZ8O`{jA^!l$7o%Er(LS(zHqQ}LWyrQ z#GDQ=D;HYmEq02sN{Cn}^aE()EA6>k?wj9_1|bg98Rdu^RS9Bv5v|A5%We1rH<u{Z z)4UH&E{k%;y|4OW0qB$|eCin+(4kS23hpR`zYcWMjAY6a0}*(X_U0}=rN-v4;F@G} z2v!X_uL4_?v&0I4i=)24$FX&>t312xqmt+!49;1C>?#VC@f`|6L+s#binBW-f<ZCH z063^hoLR(3JP7y7igW#el)Ti0QlF9cRGECNJTypjQ%2c_wr+RjWTdi%OZi6LR%-bk zYxPw!OYKsvW`)!YzpSl@vXO*+tWBq=QzlB3eYKym@#2e3a&WAyQ~ZaqLWF%JrcYRV zWVgHCc0ESfG6d{gui7S`1mivG)sQ=o4!eBus|o)QjLoK_{f$Hk1zWsDA~lJMgPD$a zs;RTco>}<fBe7HN44R%1Vii11=)1>%lw7dmg}9_MFa4X1_&92T3hDm_%r_J8`}XA* zp482EeDj4=rT)#`GsweFq)r91Kw`xxaMFFVy_{$?$Mh*05vn22o%js>^&|%2s#TGy z#+Uq5#)vmvQ@nTwKZVxO3|Y)rMnnb+esx_maDC;{EUL14Yvc|!zDZ8(FFpdSFb-$z z&4gklvWWL3=(fBEvXvm!fkj`7qytHyOsxt&3tjc!8jMFM?>G&+e8I2Ufx_($x<hd{ z8|j|R=KDo4gy{s9-4IsoN>x_HPPtXA#-v}nh#y#TzpMV%@a8_5DqJ9<BZ{#1haKCx zSO08ev@O1hgY2MUu!2lvD>z%eId4TQey5@^sZW08)(^2gRy>Ed_#KA~PKHw28G<J= zPcI0<nhfX9t}q9g^Sg4sLCY0+e`P~gk3o-g4u2|jL;#&Q$lZl1a!LXELst`@{{Xxk zlXz_<KL!xf7onz|f{f%jmV%p0oXF2)@y}r>vHlWij|NbC8d7)3Z<kOj?y;aJJ&=M) zfSqP6Aoe*vv|75Vz{RYKaf_Q$-gbkma8r2r>y!Pt_{tQO(pJkOIjodx(|*KKXgfB` z5ERtRVPF)}j?D!XM|Kphi?;8Pebg4V8|z2w+7n`((~oWr<(>*J#p?T7%lz+tD8|dv zfqMj(O;%c=@ayOxRa;Lwo4T<~<>EV6!HhR+2TKbk>`R37Ub-~g!-rl%Qg!lm&<_?4 zd^;m7HaqXLfv%#TJY_gFv`8R_dTL!1$O_K>W{jEUPCSB9zM}D9FW2bWTt55>U*|<Q zY$fR`oGJk=eQZ;aDRt3-s)w1=%}ox7t&0ok4VE_5!8H3#_Uc=ngLwOfSAkYcz$~=R zRh8Ob&VoL8Y&y;R+?me8q3HhOS+-8)&_4D%a;go9t63{9{m-<UtBiSUmQY_ziW$#j z@1rsk+-hOc%g<I}B>#n;N?jGyUNnGT$-2{RodQR)=qP!*oAT$T>zL<6i-_ErwBjsC z{?l8c$&b5cCdnd0SaC3~G@ixCkJ0w4Nw7CeqNKu1%43@gPUZJ|b>Kllb;#{ASG?9W zGy?jibF5>*fdX)ZwOiCn=-!Sy;yEcVcC=m!#_gxgj%dtTdy{HOC#9%M5_lS=V4UBk zODv<9O%#yyWYMf5&3SQ`7+-*l47enu(xR`2*J>KmWrlOlYrFzQuPPUA=t+>X5APj3 zO`NVG*eVC?MCSvvve_O~cT!Au%RY?c-PqxLWy;sU%mUbY#<^WY(qD>oBh{h)@Gad; zTp*G9;wX_8XrldI7#JcY-L^r7XBe&Hi=NJ%vXKoU^)v40YX0oKh5IAe#E22IWr4Yy zyN}54bLGMe(o6}g#~&KM$LxgD5s(pCjBFc>J|g)gk5|b$-yXXktj2K`EyhbjB%8!d z&>BDqnwz%!Wmx%Cob{6F$K!H>rStchPK7TR%qnHk;H@2V?}GSeXng!4Dej`sjdRGz z^Ya*yU}3nM#5;CgR_7|k=p}SOr&`nj{hu30ZuC?TbI%J3#k3@5uL5<q!zKZStLjkB zYb2l^$SrUFC?7xdY8@9Zzxlyu=5we?RFUR^ZiUwn-B7*Oi}d~GSp`)bbJ9FTE)y;v z)fpekIZLzDI<GAVOC@JJcKU~jOI|-+<9V?cIyDwnf#)p@$?3nysBiB~c7$Y6kC!}h z^1V}1YeALJmh+g8jOl&8^z4W)aRaja_6xtUYknU8$crVeW3IqTZ2LdDwB7a7>~1$| z@^M3Xnfu&7Vx}v9>H5akLd!COtn<Q&S2V+s_JGr4)w*?=e%E&k^vs@-N)3IHjTm0T zvZrYQ1iM34wJGLn(^iGBD*QpPQYtNKj)}Qib1hwmm>mJx(iaUWrR&%9f-%WhZ~u>R zQ(1KR8H@&pPVckk9Q=T6;bT922di)3kNo(r_SkhCg85_WPjCk!)!7&==%{gmc*$r6 z`G4;*Y{jAqYR5;BiWIO7*E|E=G$;gO{+fIF_N5jKl2+Z0TNsp=qsziH7k*^_wfT?> z)$NNw$S-XUpj!3oSoaHVoxa8JidksuroJZ`_e90Vel?e~wzG=8?&YQ@X{C-^zCkOE zsT-ZLm~GBK1)0$)kxWstc~KiVdY*PYykRv@xU}lna<+63xZ*CbAa!b@=1p!4VUy$U z_EDSc_KbcdMk*P9G{g`g-IlI;|6_x`ihu+J6?MSig&510=+rwJVQ>8CQf9!}3@&Rz zGt)<HG@etS9qEmg6n*SH*zl69a+Ifuf~L&0ycxI|Vo}9}KkxoA5-v&)oH#f2J=ON& zd{5x~xn)PU`3?W_6E#_g<Ovbz0!-u=?g_LW>#~tBq`fC6E|M~V*&*fjy)vMPIP&$p zE>VrfEylK>E6C8!T)*I>RE~3yHXy|9&r{4aM{}{F-_n3TsDFO7QX%{yoAXTBg1256 zpURTiM@1Zjuf$&;904=LaJIGH%e1D>)E&g+^x59M&ZBed;E}VCROpu9KPhN!G^N?@ zI9Pw*7E2;B27C+x2**1aaAn@{ahxC~W$k$eCKLTQk{#4yH|s|_D+O3h_Z*216L~h4 zYMHE9VVM26mKfiErj#-Hq%-!eC?hED00~inQ*G6bqxu+3Wo`hcg%2O^3z?@=gub)i zInStX2pl;2hmo5!h+_9?=%sf8utVEos*k+?&7XKM163^$Owr<sG*ska+J+^Z#m8=L z*Rz091^E5$^sZXI>ydYe`p-yxT<8-;kiL=PO8r9I+F-bJ;!f=Icj5`YOa7m~-E0{{ zKm64gKUTz8-x#uVPtqBc{XiBeK+;emZyT&-chNTg)FlX3oDwDlSW*cSHYY$Sln?hd zc+t{FQ>2mNRq0RKe7DF5MALuGeQn3xdp3sXE@p?=08?jB$;1=1fg%cKlbKmm*!!JU z@y`;>!1cd(-eikz|9w%3q>V<k;e%YuyFazl0fo4enWLOBle>TjCxC{5G&n)*)}tuJ zEccj1V~NgFjA^a8;g`wryW<AR#tOM>6T0aEqk1q?kdYGdvn#eUK1zo;zWuFCx*n~> z)6tdVguu2HAX9v4YUwH-om2ls#gE>Mb>L^B7yZ;)51QXQVKA?BT->oWIm*^M{LTkV zR!IkEPBnb9!{DVHL%AR}*5}`_-N0ZR1xipZW8DB5;bFe)uQH<}QLHqr$*52(6o6UK z_G&zd$o82keeO2P5${-bp*u5*6iNH^>JFi7GW?AT|D%#(=99$JbUwbPSGPl884x2x z9e?8D?G3FSxAHEfsh`L@5;qA!NEGTRsLwB+?=51L_{>S*Hk<9VYdT&A7r<)#6)>=_ z;_{}1>-0*u4-5}m*%&;}ep+(fT>ggX##YiPoi<G2Wx5}H+sKc;>Sh!Vq`WfW>|Wa= z%*BPwe~VDS5X1GZb1|(=B@9I~vI5*!k%UTm5TyL&2d*5WcZ~X_K8C3SX`i)Bo>$`y zvsS+GfF|aHM$CT4y#)^b4$~U@f32M5R}@;f#sP<zp}UbGhZ2wuL23v=X@+6w1}UXM za_E!}DNzLJl2JmsrKBW>MmUr-LtH%PuKO3<Py5SWd#(Mv@7nMF@I1dn*$uVmQOGnw zK*fwwZX%T}*FpYNYk<=SahI|@07}BTUMGanRgace#F48Q0;U}vRY_$WiYa<Z4PQo~ z@yJ?+FuLcXMT!-d7_T0y_AEIo?lN!Y=KQnpc%XYh%u9{7HZoV{B_D^-;|+R9du5o` z$V)W5UF!*{*G>O+EF>EFORJnU=%~xRY>6=L$4&q66-46;6Iq#E)mA*YepP~)#V;*3 zxPJRJ3uFgH9dr95?X-ZaJt0;Xw(EgE9a8O~auUmlHVhPOurgx9Jg)ri%;&3?(xcrc zXtPNT(|fKs`*b#=OzFyTPMSq#+kZ!8f^lBYP72Dd(WfVbSHb)hDsVm>bL>$)IgymL zd!!CKvx^h^dbpdA>&DJQEX?6r_}){n9|X#2wysT65n<VtcIP~in#>Xg8Bx^)Y8va> z4dd1w@<B=@xubpl2`OLg0|E+WK5F02SP*HvS6EKb?b-o?M{LJyh7@|O?OFe+e_^_m zFo>B4Y%PBy7T4z=MvK*CxZuVO*#SZ1KNrf4=_DVOgG+>BARZ(Is)fE4rS&U!qrdn$ zVmN^AS9e=vU0#I9?E*EO71<|Y55qY}d~8{{ic5JhFG_yw1;Tc}!6lmz)dAq!jK(=p zsCb+gQpI{J9C|~(7Jx;?rt&b6h36#qRF3!#m^g$WaNN=TN2%mc;<F7P>bivO_{ztZ zK`zUE5sGI0ZJ26L%C&b+Xu|{&zz7{SGTJH+rZiqQ05H^7U<$gsaK*!YJQ3z+;1JC# ziPapU`uV{4s5qh7N8N8rvCj2)bceSVxWlK*b4N_-6|t)TMm?l#IEWNOuL!Dlrw7al z$BsV={ly^>*-0yHqi&RJ!(Y{RF9*-F(~@aErB5eceTi58y~4Cr;DAP4TwZB|6pTvJ zsFd%dEm<5hu)b`p-hEe;DfWwg_)|M$_JC)0kzSP8joOY?vv>lzW=zogJ)~y%EEw$n zpy+uQUWy_G(H$N!4sB=ju?RA(h5RGDAuI5u>CdNRRWtI%#qnV{KJ0x3q8<{zlNh-= zZKzixd&pjyDz^4_hAJHQ#kD^z>Y!}&eqEGN*ytGH?UwIjElVH&%+gJVCDYR5@NREo zsVhs=NtpVio8t=o1(7xGsoA^QxDJz-jY9j`lC7*hiVOKpqkHA&Qk4o7N=+flSdMM1 zUMw6W&j!sXtLE(nfDi{$n}JmOJgwYa!BsbY+6|w19yP4jBQ!G!cJ(-x#GK97;0QT> zf!8W=A}_vXlsXvJHyruV3rcdt7trrE%yD{|qVP97u00;}2iw#MYj!eKJ`mJ%s2wtq zXk41rd?UDrsZ4or2282-{2_c4`<j|^?)p3^%AN7OJ<(OFZsadv)E#{AQeU~_N`*|u zT<z)?Cs81lV{4att_x-0C({O?ouV$CR26OxFZX<(=K{%0^r)uiEF`W&v_uuz#3Fh! z)#J(5uy`|0XaKaHvsz~}i;r*84ng1PSxx~d={r%M^=iRo*_UfqcvX~%9iombOM*vM z5ev%J(T`&0HB277Q#wmN$=bHgv>R{XvXwo(Ggl)@f@?RE9e*o*zWLTWIo}j_<wJTt zxtx!#fJP!CF^&>_K~iU@1uHs2bl@j4I3zNNu`i~kn~7`^8^KwcDosdVr>ER*k=JWh zX8g&LIKG->cfo5_LYA~LRF*a!Nm5IpTf25}F>eUh^V@4|=YE7NvJ?tWKjC5ux{j$5 z&S31v*cTiA=JVR`QYb2jmvC!rlmTgEh_KoO($4+B%*AiNwysQkx)N)nd}Iudk(<n0 zWt)XQHdmzGfh%IE(-lxO3DJ9s5$DJGSf)!prpP|V*?gG4RWQrS{NC^9=WT{=ZP5n? z<#oX#{oU_MS#?enkwEuT1<I(i%E$S(^fP<Pzb!*ryMlr=sq!m^*)l3Kd-YubdCs;l z>}pIbfhl~Bs|4`(&nO5EzXj8Q_K6&F6A1&l>*On@c@h#v*J@@l;-Q)Cx|gP&XkW%v z)#FJmEvq>{xQH;JJmDX2Z^!k(UO-h6nB@pMcD<_*C)m?Lq6(;-;FLHUlac~-Za5?o z9dShb9*wph;p|RGKiQFp3E#XRUpS-`c!z}RblQv~Ogco;-ky5VMmtBz9>W$hyR3Yn zOUJ)rkl&4PX_Ie*sziUX4AjW+(nZY|(ciFGuf<qIlgG!At}l@eP^U**T>5oyd$z;3 ze%>-KP+qk{LsTMFkC=7`QE6<};^XMP9&P#3Lf;iOLI-1rk^;x|)iuhdc}vHxZl7^~ zSpv+D%#SeKkGL%~cpDxv6&}zE3WMXOldu4+?_J@Wc)qu)M+nB%*5LQWk?@hoi2WYq zB1?>y*@KN*s-&={CviJ>qwTrEK+rf-n&>6=?T9i@KFJDS>qXnSz7*^aNuOV4$A-8; zuN`RQhL`HM8Nt;JSx_e1mje>SP$t50L#_~vjLZ{cQ%}e*bPA)aEUA1S!x?|)Q~SxS zJuux_+t<H#Q#_*Pie`8XHbj;^_Pi5L;gDY<W1~isKdR{^kVro+oOn5D03#G|CnWoz z{=-`tZqA8o8f*^#hb+EJqjPY=P^*40h^%{o2{Q9W8*uACL%v7_r}!BEV_V?iUYh<- zqU6v@;~p#J^53uDidkGpH0Te>Jf`6g=<=7N{5#yPWj8QNZ;Pi>@T*rFjnv|vj*{Tj zU-Ky{!;bePwu=yz@5VeG$yHzUl+-9QC;WL795b0x>}*iaCRS)>GA?}0E?$zP4isQ% z>Res#yI}LBs|pdidNNk>4E-6y8B{M?RNy(i#xvQ@$M9yCq++UQ2sI@}klKFH+XW7p z;FO0)aqdg|MuHegRX2^hfde>B&IKUxlWTDv6&+AkeTIS*j%(@zok0s)2VCBD_m1%% zw8;~x$#?#=1lGO+5j3$=6dcsTU?2R57r)wXpAf(DconoAI}w1woeQ#*&<+Ji?uq#N zrdPDYfV>!8%<mr#6cdrG=SCS;(Wz)^qU@2>%Gc{9AKaMmTs-HQj#6{Kk~Fnf*j@J5 zba!X(zrQrnkUwZbx6rbdUk&t2*14EZWYrx?rb6)846yGrC`v`U7Ia(m1ORWdRF9x* z#IxRorLfsre(mhSylvIY7CYx3ALtI8@Kb@U>9dW$BpZmoeXQMo^{Y@m-Ct3K#dm35 zx|1xDa`hsy7bAQZWZZz}`!H~L+;4U|{U9@W7)^WA6s8h@E6QNEEQR7_N!<-7*>tMF z(D0#~St$ba-?sUwOz4^@q;2YxOI|DyZ0d<QcHQBx6^ZwQ+kc;5MF?{PNt61IgjO3G z9@#YRCd8(1IRfGjbjc!fN@_l)|K#aNmn0Sb{z#3&f<T3?dQ*h>97%y;<v*@Hny47~ zAY7vTsUWpOkJW}ElFOP%B}JrR-;|{z#Eb@XZ9jNHw}UT$d~M-rfoSP9vX{zIcoT=} zcS+1q)+C9<dfMsZo43K(3qp|D_is+8JjzqZ6#$7T>B{pu>U=Krfq$rz>a))m%Fsc% zI1cO*^<FBHpJY6H>TKTKGGb4-6*A|`P2i6oW^;Op3Wc(UJYP@flA4taZ|^uSpx%X! zpSQz`P55(yD^{VL^&c&g*T0zoeC8A(I*eB4E`W`f+^AKnPE}ulTlt3@^k-o`pVeNg z_asF$XAfip_Lu1)-f}X&@_<q1jGI}|;1wr9?xjJuG%d)v5d{As=h>E&gBGnCAFEv; z8ORx=<ykLpXPIAKSCx^tCLz8fbaH+O)E#{>2>abOg>KDba0qt_mEjfoWsZ;M@ltua zXy~bl`M3s|p*yz->KU>VWVMVa1Rgg9gc~2_gio}x<C%qbTE}BEL(Un#N%9h0=ao)N za9d~eSbZ?erv~+&#Ni~WN(^$3<)w2QLi_G85Xy#TBr{Sps`JF8+$MDwLlm6Vzw+QY zB3{^Mm#X`*8Me=QUO)6Epz~tl%8)A5Rhh~~qGRi8_6kLLXLvfN-CNnT*CJSi{#ht% z2P}UaLK=y#UvJNJQ~(Ei713Btg8Y^oqC-Uq#~49-ewFqEUs_};5nt5cug`CY6qKd| z*d_D76ZiT9DvjDAf(rT2*YzC7nv0KG`vXryhYM6(J~gm?dZt3h^9LdR0G{L&#e}o) zD!v&^Qnf+Nj!C@x1oXTqeey+m+HRVHl9Pk~jp)bo-{v~h!Ln?I>*Ayh`EYahd^rxa zniu8Ol;`-cVskZjpK>7y8XQxp75^6l7jz7S2Dj$n$Pe{zqmQLf#^zBY`i?kev#WdZ z7O9yJTgf=uR^Q3sDUUaAJog#N`-#U1@pVgzjj+{Uo$wA}^^{$e7l-~P{l==83_+o@ zpRpQN<A-k}&F{=$$9M{Kq{>srusKoS0p6IW{i+Oj%^y1093NKG24V0_`fwm3E(i>a zOg&s+rmT1erQLMlwCUZ`i+JuXhgWOZ5-@OBFm`$qgyIb-bP*YA3%lTpdZMf7@sEPd zm0a>uBj5ex{cSPsuGVi-{KNbgdx!D?bg!%8G`_=$6N-wlmUwIh44-DH($bxOxd;@n zS&j-Q%b1{4XI<mA+R7tc`NLqdOp|TYD5BAU@(vXgZX1soFJg?vN;UI_nxX<?VH!3q zF!Xcc;c@#f>NG3|du4#3K^%gTW(}8*8tCdz;zmDkPwJ>1c-7>jhnu+%^9tBT_xW?` zJ_c9Qm<asHE%3u$q!uzM|7F2fxEOv^DsFZ|0Wn)YHK%&V2y=jPpk#?P{|w~RX6nm| z{ceu@XH2Sey5NE=E$2c+7Ar2S^<zZFv9HwUH*Vk*U7C=5jHU_SrHHrMTrn|FB->%Q zjJ#0)Nxaq&@rh9_v>|*_Hs=tLPyUcc9hcge?>gaIY=L6vz~dAqE_T>_kvDamjv3BS z7XiVde7Ix_$9>q>`ifwoP$D`Y6`<WX%RvZ{&}p0%&v*857&eZpPUPO5XX;jR()sBG zQO80#o=kaQ_xe!6mRZ7kG7YVJqnrXh!a-TOk~S3WH7#6pfo{hcq|#=Zh%xDmcTGB| z(d!ip;3ClW(-M)9u`YLn21$_xS=ihwgby}F9ZM+fnz%35taXz?k2^O7?;rRjg)MSc zc24dk8$>E#2F*j!GPlFl=2rkNdn!oU=vwx%7U$V)oSGAi7-!06{LEhMWwcTNJ^X0f z+d^cuWjeIc;>x~Or_lmg>HUYr$@bcXW7D>!n09oCXq|u0QWP%{*FYc!%q%U(r?4`9 zLjm_;_=*>oZzIN{P?VTm1%4j#9>d0ON4O&WV*d4gI*g{P@%A;$%ibPEnj74O#9s`; zFA@zAoG|v>RI&U$n>Gw_THA;g@|3tD^lx&Y@nmD%BGo-EjVH>Tawd2*U295u{s+fu zp4R}B@5FlGprJ6S0C*Sq#HLRMB`&U11_1RK<D#&;UFhq;8DLYJIZFqohP4phntJr* z;jeZKJDwA`1xrw=J%HZRP2z-7Uh<Wz-S}gs_e;to;g*OZC1kXLrJn=7kEn@`DJRV* zSUl`vDM^RDsyQ~jkV^fd-2+Ez8hO_5)iYr=QVZm&Y}@&7$ee52P3hAh*$}{stvy1i zToJtxM&<S|`9HOp_h4_9#$c0t7G=4M7D6`NX?P7@PAWLPwmkRA*gwy<yP8b33o7BX z059Qs18M;a_UOK>DXfy7^(ZpFqJa}<ooYwg7CFYM<>kV({&7^_%%DO;xX_Z?iTdVV zN*Yd`BM#y_K$VeQm~KZkB~0_1qvH1tp^k<YN5}v<B{~u<Cj-&#e*6r>>-4r<Z6Le@ zeE@#d1`T1R`3y8o6|pnd;#jGCaQshFBl)_fj|1l?tR~pzBtY_CHXj23#D&52aNQAa zEq?wph`T~+nYu`eFyod%o%Ch!l!La6L8jtxWAaIB%!ly|oX|5x0CZ;Jds20)%3Rm~ zodH)}dN?3tGY~eaR^8FEolND&#qS`ySShgYYT*IBqvf<Atd6^~j{A(7vc^wUybiq6 zMeK34)BmLrj<IS(WMoxBWU5K<7QpJb{<q{O#5RVXgwLmyoDJTXPAjmiXbCh4KEucU zUz#8VdN35LuZ|&!t>fP7U#_&%a6`Fu>UbCcZL@Y@o}~Cn?4(Y-)i0g!^~D{h82Vr2 zp^&IThzze)sGi-mYhZPL+L@Tni+Ewfy|gkJ9b}W%7;Wuz$s9tkOV=`g=0EP_7@8x} zr!Y=oR@L(Zw%FW6m9v9DR>KO}`IkbH6|Kd}7m6^6jvs#^m62Sbos&Nl{$Z@-d6xIu zt;c7_vY%48yxufcvijg%^A~85Kt{X!lM%OlkAH8F132rLClY|mvYX-U&KD#r>{y1) zT<}jebFNaV?lgQ82*aGRb+<Jt-I@Qpe~y7_galYe@}dJnQ$5{Afa@j*)9P^+Y`BxN zw&NLUCt5uvOJTm=l91Z^0)4j@kKASW5A%rA@BSuo+i{zH$I`Xt3^ySAtbG+)&KM^l z&w!G%RtHW=3;BYBUENJhME({6Cu>vIV;mdmO7{>mO9%rm0ax}C)DU!Gh121e=XWyK z892*IHFft04ObR^kKm^*^M#Xdi-jEiN+28wbjMS|5W32dxCp}Z3!u-+ZGA_ZpED!H zyfxg()<wPdIJXwWM!r6LpS0(>wQ%g7n#kJG(=oVpCvgw|QzEqFWFd+?qg|aHae7Rl zbCwi1O6cYzwZ-B&vWFeFK<%Koj7>P7{%T~SkTh=n+{|5M<*)W2tor*dS{r(^V_Fm? zwY9YR&IDJTNASH#r@_cqdFd?@_mRE(`714HgkSNBebtIPLCC1=KcuKq_&9xS>A5l- z;rL1^ljEMAGkR~>|BL#h>ky~wT@Knu;wJ1rr!ioO;M9^&;*|f74*Fkn{4M*vWdF|# dis1GkXeZ*6W{$JVJ#iIFUFErQm7+!1{{UO4him`< literal 0 HcmV?d00001 diff --git a/Sources/WeiBei/Resources/Inspiration/SOURCES.md b/Sources/WeiBei/Resources/Inspiration/SOURCES.md new file mode 100644 index 000000000..631c91c6c --- /dev/null +++ b/Sources/WeiBei/Resources/Inspiration/SOURCES.md @@ -0,0 +1,34 @@ +# Empty workspace inspiration sources + +WeiBei bundles the text and selected calligraphy alpha masks in this directory so the empty workspace works without a network connection. Source links are shown in the interface for traceability; they are never required for rendering. + +No NC, ND, modern calligraphy font, or license-unclear dataset is included. Mathematical and scientific expressions are typeset with system serif text and are not rendered as calligraphy. + +## Catalog + +| Catalog ID | Original text or expression | Author and work | Reliable source | Rights basis | +| --- | --- | --- | --- | --- | +| `lanting-clear-breeze` | `天朗氣清,惠風和暢` | 王羲之《蘭亭集序》; glyphs from the Tang copy traditionally attributed to 馮承素 | [Wikimedia Commons file page, Palace Museum source](https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG) | The ancient work and its faithful digital reproduction are marked public domain and [Public Domain Mark 1.0](https://creativecommons.org/publicdomain/mark/1.0/). The bundled PNG is a transparent crop derived from that scan. | +| `lanting-universe` | `仰觀宇宙之大` | 王羲之《蘭亭集序》; glyphs from the Tang copy traditionally attributed to 馮承素 | [Wikimedia Commons file page, Palace Museum source](https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG) | Same public-domain and Public Domain Mark 1.0 basis as above. | +| `basho-old-pond` | `古池や蛙飛こむ水のおと` | 松尾芭蕉《蛙合》, 1686 | [National Diet Library Collaborative Reference Database](https://crd.ndl.go.jp/reference/detail?page=ref_view&id=1000087707) | Public-domain original text; Matsuo Bashō died in 1694. Japan's [Copyright Act, Article 51](https://www.japaneselawtranslation.go.jp/en/laws/view/3379/tb) provides a general term of 70 years after the author's death. No translation is bundled. | +| `euler-formula` | `eⁱˣ = cos x + i sin x` | Leonhard Euler, *Introductio in analysin infinitorum*, 1748; modern notation | [ETH-Bibliothek e-rara, DOI 10.3931/e-rara-8740](https://www.e-rara.ch/zut/content/titleinfo/2447176) | The digitized 1748 book is marked [Public Domain Mark](https://creativecommons.org/publicdomain/mark/1.0/). WeiBei claims no copyright in the mathematical expression. | +| `einstein-rest-energy` | `E₀ = mc²` | Albert Einstein, *Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?*, 1905; modern notation | [Max Planck Institute for the History of Science, original paper](https://einstein-annalen.mpiwg-berlin.mpg.de/annalen/alphabetical/Einst_Istdi_de_1905) | Physical formula / fact. WeiBei claims no copyright in the expression; see [U.S. Copyright Office Circular 33](https://www.copyright.gov/circs/circ33.pdf). | +| `cobb-douglas-production` | `P = bLᵏC¹⁻ᵏ` | Charles W. Cobb and Paul H. Douglas, “A Theory of Production,” 1928 | [The American Economic Review 18(1), JSTOR stable record](https://www.jstor.org/stable/1811556) | Economic formula / fact. WeiBei claims no copyright in the expression; see Circular 33 above. | + +## Calligraphy transformation + +Only the two verified `Lantingji Xu` phrases are included. The source scan itself is not bundled. The generation record below preserves the glyph coordinates used to convert selected ink into transparent alpha masks. WeiBei applies semantic ink color at runtime, so the same PNG has no white box and stays legible in both paper and inkstone modes. + +- Commons description revision checked on 2026-07-10: [`oldid=1012610416`](https://commons.wikimedia.org/w/index.php?title=File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG&oldid=1012610416) +- Palace Museum accession number: `故00002597` +- Verified original JPEG: `28,549 × 1,300`, SHA-1 `a133647a8695cd06d0f5c6215d66e0b8b8d93d56` +- `lanting-clear-breeze.png`: `856 × 132`, SHA-256 `e5c6827f44b22f5441bb208b1770103da8a076564b52f41e64f77b0da7e1835c` +- `lanting-universe.png`: `624 × 132`, SHA-256 `a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22` +- Both PNGs have zero opaque-white pixels and zero ink in the outer two-pixel border. + +The manual source rectangles are recorded below as `(left, top, right, bottom)` in the verified Commons JPEG. No generative fill, vector tracing, or font substitution is used. + +- `天朗氣清惠風和暢`: `(22732,331,22832,414)`, `(22734,414,22818,499)`, `(22733,530,22831,628)`, `(22730,626,22818,741)`, `(22734,742,22813,849)`, `(22720,847,22829,957)`, `(22714,959,22831,1050)`, `(22728,1049,22836,1152)` +- `仰觀宇宙之大`: `(22725,1151,22832,1242)`, `(22610,9,22731,143)`, `(22622,154,22705,256)`, `(22617,276,22697,351)`, `(22615,384,22703,462)`, `(22604,475,22699,548)` + +The four experimental Zhao Mengfu crops from the research workspace were rejected because they contained neighboring strokes or incomplete glyphs. They are not part of this package or catalog. diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index b8071f7d8..4abc2cd27 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -47,6 +47,7 @@ final class WorkspaceStore: ObservableObject { @Published var showReader = true @Published var showAgent = true @Published var showNotes = true + @Published var showDailyInspiration = true @Published var commandPalettePresented = false @Published var librarySearch = "" @Published var readerSearch = "" @@ -1376,6 +1377,12 @@ final class WorkspaceStore: ObservableObject { save() } + func setDailyInspirationEnabled(_ enabled: Bool) { + guard showDailyInspiration != enabled else { return } + showDailyInspiration = enabled + save() + } + func toggleImportedDocumentColorAdaptation() { setImportedDocumentColorAdaptation(!adaptImportedDocumentColors) } @@ -2071,11 +2078,29 @@ final class WorkspaceStore: ObservableObject { func runVerificationScenarioIfNeeded() async { guard !didRunVerificationScenario else { return } + guard Self.environmentValue("WEIBEI_SUPPRESS_ACTIVATION") == "1" else { return } let scenario = Self.environmentValue("WEIBEI_VERIFY_SCENARIO") + let emptyWorkspaceScenarios: Set<String> = [ + "empty-workspace-light-wide", + "empty-workspace-light-narrow", + "empty-workspace-dark-wide", + "empty-workspace-dark-narrow", + "empty-workspace-calligraphy-light", + "empty-workspace-calligraphy-dark", + "empty-workspace-inspiration-off", + "empty-workspace-open-doc", + "empty-workspace-open-chat", + "empty-workspace-open-notes", + ] guard scenario == "offline-learning-flow" || scenario == "immersive-conversation-flow" - || scenario == "notebook-creation-flow" else { return } + || scenario == "notebook-creation-flow" + || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true + if emptyWorkspaceScenarios.contains(scenario) { + configureEmptyWorkspaceVerificationScenario(scenario) + return + } layout = scenario == "immersive-conversation-flow" ? .immersiveConversation : .documentAgentNotes if scenario == "notebook-creation-flow" { layout = .immersiveWriting @@ -2101,6 +2126,34 @@ final class WorkspaceStore: ObservableObject { applyLastAgentAnswerToNote() } + private func configureEmptyWorkspaceVerificationScenario(_ scenario: String) { + layout = .documentAgentNotes + showLibrary = false + agentSurface = .hidden + appearanceMode = scenario.contains("dark") ? .inkstone : .paper + showDailyInspiration = scenario != "empty-workspace-inspiration-off" + + if scenario.hasPrefix("empty-workspace-open-") { + select(itemID: "sample-html") + updateNote("# Empty workspace entry state marker\n\nPane toggles must preserve this note.\n") + } + + showReader = false + showAgent = false + showNotes = false + + switch scenario { + case "empty-workspace-open-doc": + toggleReader() + case "empty-workspace-open-chat": + toggleAgent() + case "empty-workspace-open-notes": + toggleNotes() + default: + save() + } + } + func replaceSelectionWithLastAgentAnswer() { guard selectionContext?.isReplaceableNoteSelection == true, let answer = lastUsableAgentAnswer else { return } @@ -2583,6 +2636,7 @@ final class WorkspaceStore: ObservableObject { showReader = snapshot.showReader ?? true showAgent = snapshot.showAgent ?? legacyRightPane ?? true showNotes = snapshot.showNotes ?? legacyRightPane ?? true + showDailyInspiration = snapshot.showDailyInspiration ?? true if let appearanceModeRaw = snapshot.appearanceModeRaw, let appearanceMode = WeiBeiAppearanceMode(rawValue: appearanceModeRaw) { self.appearanceMode = appearanceMode @@ -2636,6 +2690,7 @@ final class WorkspaceStore: ObservableObject { showAgent: showAgent, showNotes: showNotes, showRightPane: showRightPane, + showDailyInspiration: showDailyInspiration, appearanceModeRaw: appearanceMode.rawValue, adaptImportedDocumentColors: adaptImportedDocumentColors, interfaceLanguageRaw: interfaceLanguage.rawValue diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index 98ed31581..30c77dc4d 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -820,7 +820,7 @@ private struct LayoutContentView: View { let order = store.visibleDocumentPaneOrder switch order.count { case 0: - EmptyWorkspaceView() + EmptyWorkspaceLauncherView() .transition(WeiBeiTransition.layout) case 1: paneView(for: order[0]) diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift new file mode 100644 index 000000000..208db00a3 --- /dev/null +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -0,0 +1,294 @@ +import AppKit +import SwiftUI +import WeiBeiCore + +struct EmptyWorkspaceLauncherView: View { + @EnvironmentObject private var store: WorkspaceStore + + var body: some View { + TimelineView(.periodic(from: .now, by: 60)) { timeline in + GeometryReader { geometry in + let compact = geometry.size.width < 760 || geometry.size.height < 620 + let horizontalPadding: CGFloat = compact ? 28 : 52 + let entryWidth = min(116, max(76, (geometry.size.width - (horizontalPadding * 2) - 2) / 3)) + + ZStack { + WeiBeiTheme.paper + + VStack(spacing: compact ? 20 : 28) { + Spacer(minLength: compact ? 24 : 44) + + greeting(at: timeline.date) + + EmptyWorkspaceEntryRow(entryWidth: entryWidth) + + if store.showDailyInspiration { + EmptyWorkspaceInspirationView( + inspiration: inspiration(at: timeline.date), + compact: compact + ) + .transition(.opacity) + } + + Spacer(minLength: compact ? 24 : 44) + } + .frame(maxWidth: 760) + .padding(.horizontal, horizontalPadding) + } + } + } + .accessibilityElement(children: .contain) + .accessibilityIdentifier("empty-workspace-launcher") + } + + private func greeting(at date: Date) -> some View { + Text(EmptyWorkspaceDayPeriod.current(at: date).greeting(language: store.interfaceLanguage)) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 15, weight: .regular)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .multilineTextAlignment(.center) + .accessibilityIdentifier("empty-workspace-greeting") + } + + private func inspiration(at date: Date) -> EmptyWorkspaceInspiration { + let environment = ProcessInfo.processInfo.environment + if environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1" { + let forcedID: String? + switch environment["WEIBEI_VERIFY_SCENARIO"] { + case "empty-workspace-calligraphy-light": + forcedID = "lanting-clear-breeze" + case "empty-workspace-calligraphy-dark": + forcedID = "lanting-universe" + default: + forcedID = environment["WEIBEI_VERIFY_INSPIRATION_ID"] + } + if let forcedID, + let requested = EmptyWorkspaceInspirationCatalog.items.first(where: { $0.id == forcedID }) { + return requested + } + } + return EmptyWorkspaceInspirationCatalog.item(for: date) + } +} + +private struct EmptyWorkspaceEntryRow: View { + @EnvironmentObject private var store: WorkspaceStore + let entryWidth: CGFloat + + var body: some View { + HStack(spacing: 0) { + EmptyWorkspaceEntryButton( + title: "DOC", + accessibilityLabel: store.ui("打开文稿", "Open document"), + identifier: "empty-workspace-entry-doc", + width: entryWidth, + action: store.toggleReader + ) + + entryDivider + + EmptyWorkspaceEntryButton( + title: "CHAT", + accessibilityLabel: store.ui("打开对话", "Open chat"), + identifier: "empty-workspace-entry-chat", + width: entryWidth, + action: store.toggleAgent + ) + + entryDivider + + EmptyWorkspaceEntryButton( + title: "NOTES", + accessibilityLabel: store.ui("打开笔记", "Open notes"), + identifier: "empty-workspace-entry-notes", + width: entryWidth, + action: store.toggleNotes + ) + } + .fixedSize(horizontal: true, vertical: false) + .accessibilityElement(children: .contain) + } + + private var entryDivider: some View { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.78)) + .frame(width: 1, height: 18) + .accessibilityHidden(true) + } +} + +private struct EmptyWorkspaceEntryButton: View { + let title: String + let accessibilityLabel: String + let identifier: String + let width: CGFloat + let action: () -> Void + + @State private var hovering = false + @FocusState private var focused: Bool + + var body: some View { + Button(action: action) { + Text(title) + .font(WeiBeiTypography.englishBrandFont(size: 20, weight: .semibold)) + .tracking(2.2) + .foregroundStyle(focused || hovering ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk) + .frame(width: width, height: 48) + .contentShape(Rectangle()) + .overlay(alignment: .bottom) { + Rectangle() + .fill(WeiBeiTheme.ink.opacity(focused ? 0.62 : hovering ? 0.34 : 0)) + .frame(width: 26, height: 1) + .padding(.bottom, 4) + } + } + .buttonStyle(.plain) + .focused($focused) + .onHover { hovering = $0 } + .animation(.easeOut(duration: 0.12), value: hovering) + .animation(.easeOut(duration: 0.12), value: focused) + .accessibilityLabel(Text(accessibilityLabel)) + .accessibilityIdentifier(identifier) + .help(accessibilityLabel) + } +} + +private struct EmptyWorkspaceInspirationView: View { + let inspiration: EmptyWorkspaceInspiration + let compact: Bool + + var body: some View { + VStack(spacing: compact ? 8 : 10) { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.72)) + .frame(width: 34, height: 1) + .padding(.bottom, compact ? 2 : 5) + + inspirationContent + + Text(inspiration.credit) + .font(.system(size: compact ? 10.5 : 11.5, weight: .medium, design: .serif)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .multilineTextAlignment(.center) + .lineLimit(2) + + sourceAndRights + } + .frame(maxWidth: compact ? 560 : 660) + .accessibilityElement(children: .contain) + .accessibilityIdentifier("empty-workspace-inspiration-\(inspiration.id)") + } + + @ViewBuilder + private var inspirationContent: some View { + switch inspiration.presentation { + case let .calligraphy(assetName): + if let image = EmptyWorkspaceCalligraphyResource.image(named: assetName) { + Image(nsImage: image) + .renderingMode(.template) + .resizable() + .scaledToFit() + .foregroundStyle(WeiBeiTheme.ink.opacity(0.88)) + .frame(maxWidth: compact ? 390 : 500, maxHeight: compact ? 54 : 72) + .accessibilityLabel(Text(inspiration.text)) + } else { + inspirationText(size: compact ? 24 : 30) + } + case .quotation: + inspirationText(size: compact ? 21 : 26) + case .formula: + formulaContent(size: compact ? 24 : 30) + } + } + + private func formulaContent(size: CGFloat) -> some View { + formulaText(size: size) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) + .multilineTextAlignment(.center) + .lineLimit(1) + .minimumScaleFactor(0.78) + .accessibilityLabel(Text(inspiration.text)) + } + + private func formulaText(size: CGFloat) -> Text { + let baseFont = Font.system(size: size, weight: .regular, design: .serif) + let scriptFont = Font.system(size: size * 0.58, weight: .regular, design: .serif) + let superscript = size * 0.34 + + switch inspiration.id { + case "euler-formula": + return Text("e").font(baseFont) + + Text("ix").font(scriptFont).baselineOffset(superscript) + + Text(" = cos x + i sin x").font(baseFont) + case "einstein-rest-energy": + return Text("E").font(baseFont) + + Text("0").font(scriptFont).baselineOffset(-size * 0.16) + + Text(" = mc").font(baseFont) + + Text("2").font(scriptFont).baselineOffset(superscript) + case "cobb-douglas-production": + return Text("P = bL").font(baseFont) + + Text("k").font(scriptFont).baselineOffset(superscript) + + Text("C").font(baseFont) + + Text("1 − k").font(scriptFont).baselineOffset(superscript) + default: + return Text(inspiration.text).font(baseFont) + } + } + + private func inspirationText(size: CGFloat) -> some View { + Text(inspiration.text) + .font(.system(size: size, weight: .regular, design: .serif)) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) + .multilineTextAlignment(.center) + .lineLimit(2) + .minimumScaleFactor(0.78) + .accessibilityLabel(Text(inspiration.text)) + } + + private var sourceAndRights: some View { + ViewThatFits(in: .horizontal) { + HStack(spacing: 6) { + sourceLink + Text("·") + .accessibilityHidden(true) + rightsLink + } + + VStack(spacing: 3) { + sourceLink + rightsLink + } + } + .font(.system(size: compact ? 9 : 9.5, weight: .regular)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .multilineTextAlignment(.center) + .lineLimit(2) + } + + @ViewBuilder + private var sourceLink: some View { + if let url = inspiration.sourceURL { + Link(inspiration.sourceLabel, destination: url) + } else { + Text(inspiration.sourceLabel) + } + } + + @ViewBuilder + private var rightsLink: some View { + if let url = inspiration.rightsURL { + Link(inspiration.rightsLabel, destination: url) + } else { + Text(inspiration.rightsLabel) + } + } +} + +private enum EmptyWorkspaceCalligraphyResource { + static func image(named name: String) -> NSImage? { + let url = Bundle.module.url(forResource: name, withExtension: "png", subdirectory: "Inspiration/Calligraphy") + ?? Bundle.module.url(forResource: name, withExtension: "png", subdirectory: "Calligraphy") + ?? Bundle.module.url(forResource: name, withExtension: "png") + guard let url else { return nil } + return NSImage(contentsOf: url) + } +} diff --git a/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift new file mode 100644 index 000000000..1b3a1da86 --- /dev/null +++ b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift @@ -0,0 +1,178 @@ +import Foundation + +public enum EmptyWorkspaceDayPeriod: String, CaseIterable, Sendable { + case morning + case midday + case evening + case lateNight + + public init(hour: Int) { + switch hour { + case 5..<11: + self = .morning + case 11..<17: + self = .midday + case 17..<23: + self = .evening + default: + self = .lateNight + } + } + + public func greeting(language: WeiBeiInterfaceLanguage) -> String { + switch self { + case .morning: + return language.text("早安,宜开卷。", "Good morning. Open a page.") + case .midday: + return language.text("午安,慢慢读。", "Good afternoon. Read unhurriedly.") + case .evening: + return language.text("晚安,灯下可写。", "Good evening. Leave a line in the lamplight.") + case .lateNight: + return language.text("夜深了,留一页清醒。", "It is late. Keep one clear page.") + } + } + + public static func current(at date: Date, calendar: Calendar = .current) -> EmptyWorkspaceDayPeriod { + EmptyWorkspaceDayPeriod(hour: calendar.component(.hour, from: date)) + } +} + +public enum EmptyWorkspaceInspirationPresentation: Equatable, Sendable { + case calligraphy(assetName: String) + case quotation + case formula +} + +public struct EmptyWorkspaceInspiration: Identifiable, Equatable, Sendable { + public let id: String + public let text: String + public let credit: String + public let sourceLabel: String + public let sourceURLString: String + public let rightsLabel: String + public let rightsURLString: String + public let presentation: EmptyWorkspaceInspirationPresentation + + public init( + id: String, + text: String, + credit: String, + sourceLabel: String, + sourceURLString: String, + rightsLabel: String, + rightsURLString: String, + presentation: EmptyWorkspaceInspirationPresentation + ) { + self.id = id + self.text = text + self.credit = credit + self.sourceLabel = sourceLabel + self.sourceURLString = sourceURLString + self.rightsLabel = rightsLabel + self.rightsURLString = rightsURLString + self.presentation = presentation + } + + public var sourceURL: URL? { + URL(string: sourceURLString) + } + + public var rightsURL: URL? { + URL(string: rightsURLString) + } +} + +public enum EmptyWorkspaceInspirationCatalog { + public static let items: [EmptyWorkspaceInspiration] = [ + EmptyWorkspaceInspiration( + id: "lanting-clear-breeze", + text: "天朗氣清,惠風和暢", + credit: "王羲之《蘭亭集序》 · 唐摹本傳馮承素", + sourceLabel: "Wikimedia Commons / 故宫博物院", + sourceURLString: "https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG", + rightsLabel: "公版原作 · Public Domain Mark 1.0", + rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", + presentation: .calligraphy(assetName: "lanting-clear-breeze") + ), + EmptyWorkspaceInspiration( + id: "lanting-universe", + text: "仰觀宇宙之大", + credit: "王羲之《蘭亭集序》 · 唐摹本傳馮承素", + sourceLabel: "Wikimedia Commons / 故宫博物院", + sourceURLString: "https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG", + rightsLabel: "公版原作 · Public Domain Mark 1.0", + rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", + presentation: .calligraphy(assetName: "lanting-universe") + ), + EmptyWorkspaceInspiration( + id: "basho-old-pond", + text: "古池や蛙飛こむ水のおと", + credit: "松尾芭蕉《蛙合》 · 1686", + sourceLabel: "国立国会图书馆参考协同数据库", + sourceURLString: "https://crd.ndl.go.jp/reference/detail?page=ref_view&id=1000087707", + rightsLabel: "原文公版 · 日本著作权法第 51 条", + rightsURLString: "https://www.japaneselawtranslation.go.jp/en/laws/view/3379/tb", + presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "euler-formula", + text: "eⁱˣ = cos x + i sin x", + credit: "Leonhard Euler · Introductio in analysin infinitorum, 1748 · 现代记法", + sourceLabel: "ETH-Bibliothek e-rara · DOI 10.3931/e-rara-8740", + sourceURLString: "https://www.e-rara.ch/zut/content/titleinfo/2447176", + rightsLabel: "1748 原书公版 · Public Domain Mark", + rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", + presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "einstein-rest-energy", + text: "E₀ = mc²", + credit: "Albert Einstein · Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?, 1905 · 现代记法", + sourceLabel: "Max Planck Institute for the History of Science", + sourceURLString: "https://einstein-annalen.mpiwg-berlin.mpg.de/annalen/alphabetical/Einst_Istdi_de_1905", + rightsLabel: "物理公式 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "cobb-douglas-production", + text: "P = bLᵏC¹⁻ᵏ", + credit: "Charles W. Cobb & Paul H. Douglas · A Theory of Production, 1928", + sourceLabel: "The American Economic Review 18(1)", + sourceURLString: "https://www.jstor.org/stable/1811556", + rightsLabel: "经济学公式 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), + ] + + public static func item(for date: Date, calendar: Calendar = .current) -> EmptyWorkspaceInspiration { + precondition(!items.isEmpty) + let ordinal = calendar.ordinality(of: .day, in: .era, for: date) ?? 1 + return items[(ordinal - 1) % items.count] + } + + public static var validationErrors: [String] { + var errors: [String] = [] + let ids = items.map(\.id) + if Set(ids).count != ids.count { + errors.append("inspiration IDs must be unique") + } + + for item in items { + if item.id.isEmpty || item.text.isEmpty || item.credit.isEmpty || item.sourceLabel.isEmpty || item.rightsLabel.isEmpty { + errors.append("\(item.id): required metadata is missing") + } + if item.sourceURL?.scheme != "https" { + errors.append("\(item.id): source URL must use HTTPS") + } + if item.rightsURL?.scheme != "https" { + errors.append("\(item.id): rights URL must use HTTPS") + } + if case let .calligraphy(assetName) = item.presentation, assetName.isEmpty { + errors.append("\(item.id): calligraphy asset is missing") + } + } + return errors + } +} diff --git a/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift b/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift index 193e4da25..2ab06ea0f 100644 --- a/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift +++ b/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift @@ -4,10 +4,12 @@ import Security public struct KeychainPasswordStore { public let service: String public let account: String + private let keychain: SecKeychain? - public init(service: String, account: String) { + public init(service: String, account: String, keychain: SecKeychain? = nil) { self.service = service self.account = account + self.keychain = keychain } public static func cleaned(_ value: String) -> String { @@ -29,11 +31,11 @@ public struct KeychainPasswordStore { } let data = Data(key.utf8) - let status = SecItemUpdate(baseQuery as CFDictionary, [kSecValueData as String: data] as CFDictionary) + let status = SecItemUpdate(matchQuery as CFDictionary, [kSecValueData as String: data] as CFDictionary) if status == errSecSuccess { return } if status == errSecItemNotFound { - var attributes = baseQuery + var attributes = addAttributes attributes[kSecValueData as String] = data attributes[kSecAttrAccessible as String] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly let addStatus = SecItemAdd(attributes as CFDictionary, nil) @@ -45,7 +47,7 @@ public struct KeychainPasswordStore { } public func delete() throws { - let status = SecItemDelete(baseQuery as CFDictionary) + let status = SecItemDelete(matchQuery as CFDictionary) guard status == errSecSuccess || status == errSecItemNotFound else { throw Self.keychainError(status) } @@ -60,12 +62,28 @@ public struct KeychainPasswordStore { } private var readQuery: [String: Any] { - var query = baseQuery + var query = matchQuery query[kSecReturnData as String] = true query[kSecMatchLimit as String] = kSecMatchLimitOne return query } + private var matchQuery: [String: Any] { + var query = baseQuery + if let keychain { + query[kSecMatchSearchList as String] = [keychain] + } + return query + } + + private var addAttributes: [String: Any] { + var attributes = baseQuery + if let keychain { + attributes[kSecUseKeychain as String] = keychain + } + return attributes + } + private static func keychainError(_ status: OSStatus) -> NSError { let message = SecCopyErrorMessageString(status, nil) as String? ?? "Keychain error \(status)" return NSError( diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index 850513b6e..c030bc367 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -723,11 +723,12 @@ public struct PersistedWorkspace: Codable { public var showAgent: Bool? public var showNotes: Bool? public var showRightPane: Bool? + public var showDailyInspiration: Bool? public var appearanceModeRaw: String? public var adaptImportedDocumentColors: Bool? public var interfaceLanguageRaw: String? - public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { + public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { self.importedItems = importedItems self.notesByItemID = notesByItemID self.selectedItemID = selectedItemID @@ -742,6 +743,7 @@ public struct PersistedWorkspace: Codable { self.showAgent = showAgent self.showNotes = showNotes self.showRightPane = showRightPane + self.showDailyInspiration = showDailyInspiration self.appearanceModeRaw = appearanceModeRaw self.adaptImportedDocumentColors = adaptImportedDocumentColors self.interfaceLanguageRaw = interfaceLanguageRaw diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 1cd59f378..2ad00705f 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -2,6 +2,7 @@ import AppKit import CoreText import Foundation import PDFKit +import Security import WeiBeiCore func expect(_ condition: @autoclosure () -> Bool, _ message: String) { @@ -11,6 +12,40 @@ func expect(_ condition: @autoclosure () -> Bool, _ message: String) { } } +expect(EmptyWorkspaceDayPeriod(hour: 5) == .morning + && EmptyWorkspaceDayPeriod(hour: 10) == .morning + && EmptyWorkspaceDayPeriod(hour: 11) == .midday + && EmptyWorkspaceDayPeriod(hour: 16) == .midday + && EmptyWorkspaceDayPeriod(hour: 17) == .evening + && EmptyWorkspaceDayPeriod(hour: 22) == .evening + && EmptyWorkspaceDayPeriod(hour: 23) == .lateNight + && EmptyWorkspaceDayPeriod(hour: 4) == .lateNight, "empty workspace greeting follows morning, midday, evening, and late-night boundaries") +expect(EmptyWorkspaceDayPeriod.morning.greeting(language: .chinese).contains("早安") + && EmptyWorkspaceDayPeriod.midday.greeting(language: .chinese).contains("午安") + && EmptyWorkspaceDayPeriod.evening.greeting(language: .chinese).contains("晚安") + && EmptyWorkspaceDayPeriod.lateNight.greeting(language: .chinese).contains("夜深") + && !EmptyWorkspaceDayPeriod.morning.greeting(language: .english).isEmpty, "empty workspace greetings stay localized and non-empty") + +let inspirationItems = EmptyWorkspaceInspirationCatalog.items +expect(inspirationItems.count >= 6 + && EmptyWorkspaceInspirationCatalog.validationErrors.isEmpty + && inspirationItems.contains(where: { if case .calligraphy = $0.presentation { return true }; return false }) + && inspirationItems.contains(where: { $0.presentation == .quotation }) + && inspirationItems.contains(where: { $0.presentation == .formula }), "daily inspiration catalog contains validated calligraphy, original-language quotation, and formulas") +expect(inspirationItems.allSatisfy { item in + !item.text.isEmpty + && !item.credit.isEmpty + && item.sourceURL?.scheme == "https" + && !item.rightsLabel.isEmpty + && item.rightsURL?.scheme == "https" +}, "every daily inspiration keeps text, author/work credit, a reliable source, and rights metadata") +var inspirationCalendar = Calendar(identifier: .gregorian) +inspirationCalendar.timeZone = TimeZone(secondsFromGMT: 0)! +let inspirationDayOne = inspirationCalendar.date(from: DateComponents(year: 2026, month: 7, day: 10, hour: 12))! +let inspirationDayTwo = inspirationCalendar.date(byAdding: .day, value: 1, to: inspirationDayOne)! +expect(EmptyWorkspaceInspirationCatalog.item(for: inspirationDayOne, calendar: inspirationCalendar).id + != EmptyWorkspaceInspirationCatalog.item(for: inspirationDayTwo, calendar: inspirationCalendar).id, "daily inspiration rotates deterministically from one local day to the next") + let offlineChinesePreview = AgentOfflinePreview.render( AgentOfflinePreviewInput( language: .chinese, @@ -106,6 +141,61 @@ CTFontManagerRegisterFontsForURL(monoFontURL as CFURL, .process, nil) expect(NSFont(name: "WeiBeiStele-Regular", size: 18) != nil && NSFont(name: "WeiBeiSteleMono-Regular", size: 13) != nil, "bundled WeiBei English fonts register under their PostScript names") +func inspectCalligraphyAsset(_ url: URL) throws -> (width: Int, height: Int, visible: Int, transparent: Int, opaqueWhite: Int, outerInk: Int) { + let data = try Data(contentsOf: url) + guard let bitmap = NSBitmapImageRep(data: data) else { + throw NSError(domain: "WeiBeiSelfCheck", code: 1, userInfo: [NSLocalizedDescriptionKey: "Unreadable calligraphy PNG: \(url.path)"]) + } + var visible = 0 + var transparent = 0 + var opaqueWhite = 0 + var outerInk = 0 + for y in 0..<bitmap.pixelsHigh { + for x in 0..<bitmap.pixelsWide { + guard let color = bitmap.colorAt(x: x, y: y)?.usingColorSpace(.deviceRGB) else { continue } + if color.alphaComponent > 0.05 { + visible += 1 + if x < 2 || y < 2 || x >= bitmap.pixelsWide - 2 || y >= bitmap.pixelsHigh - 2 { + outerInk += 1 + } + } else { + transparent += 1 + } + if color.alphaComponent > 0.95 + && color.redComponent > 0.95 + && color.greenComponent > 0.95 + && color.blueComponent > 0.95 { + opaqueWhite += 1 + } + } + } + return (bitmap.pixelsWide, bitmap.pixelsHigh, visible, transparent, opaqueWhite, outerInk) +} + +let calligraphyDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Resources/Inspiration/Calligraphy", isDirectory: true) +let clearBreezeStats = try inspectCalligraphyAsset(calligraphyDirectoryURL.appendingPathComponent("lanting-clear-breeze.png")) +let universeStats = try inspectCalligraphyAsset(calligraphyDirectoryURL.appendingPathComponent("lanting-universe.png")) +expect(clearBreezeStats.width == 856 && clearBreezeStats.height == 132 + && universeStats.width == 624 && universeStats.height == 132 + && clearBreezeStats.visible > 1_000 && universeStats.visible > 1_000 + && clearBreezeStats.transparent > clearBreezeStats.visible + && universeStats.transparent > universeStats.visible + && clearBreezeStats.opaqueWhite == 0 && universeStats.opaqueWhite == 0 + && clearBreezeStats.outerInk == 0 && universeStats.outerInk == 0, "bundled Lanting calligraphy masks are transparent, uncropped, and free of hard white backgrounds") + +let inspirationSourcesURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Resources/Inspiration/SOURCES.md") +let inspirationSources = (try? String(contentsOf: inspirationSourcesURL, encoding: .utf8)) ?? "" +expect(inspirationSources.contains("a133647a8695cd06d0f5c6215d66e0b8b8d93d56") + && inspirationSources.contains("e5c6827f44b22f5441bb208b1770103da8a076564b52f41e64f77b0da7e1835c") + && inspirationSources.contains("a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22") + && inspirationSources.contains("Public Domain Mark 1.0") + && inspirationSources.contains("故00002597") + && inspirationSources.contains("were rejected") + && inspirationSources.contains("No NC, ND") + && inspirationSources.contains("No generative fill, vector tracing, or font substitution"), "inspiration resource documentation preserves source hashes, public-domain status, provenance, exclusions, and transformation limits") + let runScriptURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("script/build_and_run.sh") let runScript = (try? String(contentsOf: runScriptURL, encoding: .utf8)) ?? "" @@ -119,8 +209,12 @@ expect(runScript.contains("kCGWindowOwnerName") && runScript.contains("\"$APP_DI expect(runScript.contains("let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber") && runScript.contains("let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0"), "run script tolerates missing onscreen metadata when the window is otherwise capturable") expect(!runScript.contains("pid=\"$(pgrep -x \"$PRODUCT_NAME\""), "run script window verification does not depend on pgrep") expect(runScript.contains("visual_verify_window") && runScript.contains("--visual-verify") && runScript.contains("visual_non_black_ratio") && runScript.contains("visual verify failed: captured window is black or empty") && runScript.contains("nonBlackRatio < 0.02"), "run script exposes an explicit visual non-black window check") -expect(runScript.contains("weibei-visual-verify-latest.png") && runScript.contains("visual_capture_path=$latest_capture_path"), "visual verification leaves one latest screenshot path for review") -expect(runScript.contains("visual verify blocked: macOS refused window capture") && runScript.contains("Grant Screen Recording permission"), "visual verification reports capture-permission failures instead of looking like an app rendering failure") +expect(runScript.contains("weibei-visual-verify-latest.png") && runScript.contains("cp \"$capture_path\" \"$latest_capture_path\""), "visual verification leaves one latest screenshot path for review") +expect(runScript.contains("weibei-visual-verify-$VERIFY_SCENARIO.png") + && runScript.contains("visual_capture_path=$scenario_capture_path"), "visual verification preserves a separate screenshot for every empty-workspace theme and width scenario") +expect(runScript.contains("WEIBEI_VERIFY_CAPTURE_PATH") + && runScript.contains("app-owned capture and macOS window capture failed") + && runScript.contains("Grant Screen Recording permission"), "visual verification prefers an app-owned capture and reports when both capture paths fail") expect(runScript.contains("open_app() {\n /usr/bin/open \"$APP_BUNDLE\"\n}") && !runScript.contains("open_app() {\n /usr/bin/open -n \"$APP_BUNDLE\"\n}"), "regular run opens WeiBei without forcing a second app instance") expect(runScript.contains("RUN_VISUAL_VERIFY=false") @@ -131,8 +225,11 @@ expect(runScript.contains("RUN_VISUAL_VERIFY=false") expect(runScript.contains("open_app_for_verify()") && runScript.contains("VERIFY_DATA_DIR=\"$DIST_DIR/Data\"") && runScript.contains("VERIFY_SCENARIO=\"${WEIBEI_VERIFY_SCENARIO:-offline-learning-flow}\"") + && runScript.contains("VERIFY_WINDOW_SIZE=\"${WEIBEI_VERIFY_WINDOW_SIZE:-}\"") + && runScript.contains("VERIFY_INSPIRATION_ID=\"${WEIBEI_VERIFY_INSPIRATION_ID:-}\"") && runScript.contains("rm -rf \"$VERIFY_DATA_DIR\"") && runScript.contains("--env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env \"WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR\" --env \"WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO\"") + && runScript.contains("--env \"WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE\"") && runScript.contains("if [[ -n \"$VERIFY_SCENARIO\" ]]; then\n sleep 2.6\n fi") && runScript.contains("--verify|verify)\n run_verifiers\n open_app_for_verify") && runScript.contains("--visual-verify|visual-verify)\n run_verifiers\n open_app_for_verify"), "verify modes launch the app in the background with an isolated offline learning-flow workspace") @@ -142,6 +239,15 @@ expect(runScript.contains("verify_learning_flow_persistence()") && runScript.contains("把可确认依据写入笔记") && runScript.contains("! /usr/bin/grep -q \"## 离线草稿\"") && runScript.contains("! /usr/bin/grep -q \"## 可确认\""), "verify mode checks that the offline learning flow persists only the note-ready agent suggestion into the note workspace") +expect(runScript.contains("verify_empty_workspace_state()") + && runScript.contains("empty-workspace-open-doc") + && runScript.contains("empty-workspace-open-chat") + && runScript.contains("empty-workspace-open-notes") + && runScript.contains("\\\"showReader\\\":$expected_reader") + && runScript.contains("\\\"showAgent\\\":$expected_agent") + && runScript.contains("\\\"showNotes\\\":$expected_notes") + && runScript.contains("\\\"showDailyInspiration\\\":$expected_inspiration") + && runScript.contains("Empty workspace entry state marker"), "verify mode proves each empty-workspace entry opens the requested pane while preserving existing note state") expect(runScript.contains("VERIFY_MODE=true") && runScript.contains("DIST_DIR=\"${TMPDIR:-/tmp}/weibei-verify-$UID\"") && runScript.contains("elif [[ \"$VERIFY_MODE\" == true ]]; then\n :") @@ -490,15 +596,33 @@ expect( ) expect(OpenAIAPIKeyStore.cleaned(" sk-test\n") == "sk-test", "api key cleaning") -let temporaryKeychainStore = KeychainPasswordStore( - service: "com.changfenhuang.weibei.selfcheck.\(UUID().uuidString)", - account: "OPENAI_API_KEY" -) -try? temporaryKeychainStore.delete() -try temporaryKeychainStore.save(" sk-selfcheck\n") -expect(temporaryKeychainStore.load() == "sk-selfcheck", "keychain save and load") -try temporaryKeychainStore.delete() -expect(temporaryKeychainStore.load().isEmpty, "keychain delete") +do { + let temporaryKeychainURL = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-selfcheck-\(UUID().uuidString).keychain-db") + let temporaryKeychainPassword = Data("weibei-selfcheck-only".utf8) + var temporaryKeychain: SecKeychain? + let createStatus = temporaryKeychainURL.path.withCString { path in + temporaryKeychainPassword.withUnsafeBytes { password in + SecKeychainCreate(path, UInt32(password.count), password.baseAddress, false, nil, &temporaryKeychain) + } + } + expect(createStatus == errSecSuccess && temporaryKeychain != nil, "isolated self-check keychain is created without changing the user's default keychain") + guard let temporaryKeychain else { exit(1) } + defer { + SecKeychainDelete(temporaryKeychain) + } + + let temporaryKeychainStore = KeychainPasswordStore( + service: "com.changfenhuang.weibei.selfcheck.\(UUID().uuidString)", + account: "OPENAI_API_KEY", + keychain: temporaryKeychain + ) + try? temporaryKeychainStore.delete() + try temporaryKeychainStore.save(" sk-selfcheck\n") + expect(temporaryKeychainStore.load() == "sk-selfcheck", "keychain save and load") + try temporaryKeychainStore.delete() + expect(temporaryKeychainStore.load().isEmpty, "keychain delete") +} let missingSelectionInsight = QuietInsight.make( materialTitle: "利率资料", @@ -682,6 +806,12 @@ let contentViewSourceURL = URL(fileURLWithPath: FileManager.default.currentDirec .appendingPathComponent("Sources/WeiBei/Views/ContentView.swift") let contentViewSource = (try? String(contentsOf: contentViewSourceURL, encoding: .utf8)) ?? "" expect(!contentViewSource.isEmpty, "content view source is readable") +let emptyWorkspaceSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift") +let emptyWorkspaceSource = (try? String(contentsOf: emptyWorkspaceSourceURL, encoding: .utf8)) ?? "" +let inspirationCatalogSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift") +let inspirationCatalogSource = (try? String(contentsOf: inspirationCatalogSourceURL, encoding: .utf8)) ?? "" let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/ContentRailView.swift") let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" @@ -693,6 +823,40 @@ expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains(".popover(") && contentRailSource.contains("SpatialTapGesture()") && contentRailSource.contains("private func nearestItem"), "shared content rail supports normal, rail-only, delayed unclipped hover, dense-track mapping, and real image previews") +expect(contentViewSource.contains("case 0:\n EmptyWorkspaceLauncherView()") + && emptyWorkspaceSource.contains("Text(title)") + && emptyWorkspaceSource.contains("title: \"DOC\"") + && emptyWorkspaceSource.contains("title: \"CHAT\"") + && emptyWorkspaceSource.contains("title: \"NOTES\"") + && emptyWorkspaceSource.contains("action: store.toggleReader") + && emptyWorkspaceSource.contains("action: store.toggleAgent") + && emptyWorkspaceSource.contains("action: store.toggleNotes"), "empty workspace exposes direct document, chat, and notes entries through the existing pane toggles") +expect(emptyWorkspaceSource.contains("WeiBeiTypography.englishBrandFont") + && emptyWorkspaceSource.contains("entryDivider") + && emptyWorkspaceSource.contains("Rectangle()") + && !emptyWorkspaceSource.contains("RoundedRectangle") + && !emptyWorkspaceSource.contains("Capsule()") + && !emptyWorkspaceSource.contains("stroke(WeiBeiTheme.cinnabar"), "empty workspace entry uses WeiBei English lettering, hairlines, and whitespace without cards, pills, or red outlines") +expect(emptyWorkspaceSource.contains("TimelineView(.periodic(from: .now, by: 60))") + && emptyWorkspaceSource.contains("EmptyWorkspaceDayPeriod.current(at:") + && emptyWorkspaceSource.contains("geometry.size.width < 760 || geometry.size.height < 620") + && emptyWorkspaceSource.contains("min(116, max(76") + && emptyWorkspaceSource.contains("minimumScaleFactor(0.78)"), "empty workspace greeting updates with time and its entry and inspiration typography adapt to compact windows") +expect(emptyWorkspaceSource.contains("if store.showDailyInspiration") + && emptyWorkspaceSource.contains("EmptyWorkspaceInspirationCatalog.item") + && emptyWorkspaceSource.contains("case \"empty-workspace-calligraphy-light\":") + && emptyWorkspaceSource.contains("forcedID = \"lanting-clear-breeze\"") + && emptyWorkspaceSource.contains("case \"empty-workspace-calligraphy-dark\":") + && emptyWorkspaceSource.contains("forcedID = \"lanting-universe\"") + && emptyWorkspaceSource.contains("Link(inspiration.sourceLabel") + && emptyWorkspaceSource.contains("Link(inspiration.rightsLabel") + && emptyWorkspaceSource.contains("Bundle.module.url(forResource:") + && !emptyWorkspaceSource.contains("URLSession") + && !inspirationCatalogSource.contains("URLSession"), "daily inspiration is bundled for offline use while retaining visible source and rights links") +expect(emptyWorkspaceSource.contains("empty-workspace-entry-doc") + && emptyWorkspaceSource.contains("empty-workspace-entry-chat") + && emptyWorkspaceSource.contains("empty-workspace-entry-notes") + && emptyWorkspaceSource.contains("accessibilityLabel"), "empty workspace entries remain individually named and reachable to accessibility automation") expect(contentViewSource.contains("case .immersiveReading:\n ZStack(alignment: .topTrailing)") && contentViewSource.contains("QuietInsightView(compact: true)") && contentViewSource.contains(".padding(.top, 24)") @@ -1417,7 +1581,15 @@ expect(appSource.contains("private var shouldActivateOnLaunch: Bool") && appSource.contains("WEIBEI_SUPPRESS_ACTIVATION") && appSource.contains("Task { await store.runVerificationScenarioIfNeeded() }") && appSource.contains("if shouldActivateOnLaunch {\n NSApp.activate(ignoringOtherApps: true)\n }"), "app activation is skipped during non-invasive verification launches") +expect(appSource.contains("applyVerificationWindowSize(to: window)") + && appSource.contains("environment[\"WEIBEI_SUPPRESS_ACTIVATION\"] == \"1\"") + && appSource.contains("environment[\"WEIBEI_VERIFY_WINDOW_SIZE\"]") + && appSource.contains("window.setContentSize(target)") + && appSource.contains("window.center()"), "verification-only window sizing supports real wide and narrow screenshots without changing normal launch behavior") expect(appSource.contains("window.isOpaque = true"), "main window declares opaque paper backing for stable capture") +expect(appSource.contains("environment[\"WEIBEI_VERIFY_CAPTURE_PATH\"]") + && appSource.contains("bitmapImageRepForCachingDisplay") + && appSource.contains("cacheDisplay(in: bounds, to: bitmap)"), "isolated verification app can capture its own rendered content without Screen Recording permission") expect(appSource.contains("sharedWorkspaceStore"), "main window and settings share one workspace store") expect(!appSource.contains("launchProbe"), "app launch path has no temporary probe logging") expect(appSource.contains("WeiBeiAppearanceTransition") @@ -1498,6 +1670,11 @@ expect(!appSource.contains("Form {") && appSource.contains("store.setTopBarVariant(variant)"), "settings center uses categorized WeiBei chrome and real bound controls instead of the default form field") expect(appSource.contains("settingsPill(\n title: store.interfaceLanguage.settingsLabel,\n icon: \"character.book.closed\",\n active: false") && appSource.contains("settingsPill(\n title: store.appearanceMode.label(language: store.interfaceLanguage),\n icon: store.appearanceMode.systemImage,\n active: false"), "settings sidebar summary pills stay neutral instead of looking permanently selected") +expect(appSource.contains("title: store.ui(\"每日灵感\", \"Daily Inspiration\")") + && appSource.contains("get: { store.showDailyInspiration }") + && appSource.contains("set: { store.setDailyInspirationEnabled($0) }") + && appSource.contains("文稿、对话和笔记入口始终保留") + && appSource.contains(".accessibilityLabel(Text(store.ui(\"显示每日灵感\""), "settings explicitly toggles daily inspiration without implying that the three work entries disappear") expect(appSource.contains("segmented(NoteRenderMode.visibleCases, active: store.noteRenderMode.visibleMode)") && !appSource.contains("笔记预览") && !appSource.contains("Note Preview") @@ -1512,6 +1689,10 @@ expect(appSource.contains("init() {\n WeiBeiTypography.registerBundledFon let workspaceStoreSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Stores/WorkspaceStore.swift") let workspaceStoreSource = (try? String(contentsOf: workspaceStoreSourceURL, encoding: .utf8)) ?? "" +expect(workspaceStoreSource.contains("@Published var showDailyInspiration = true") + && workspaceStoreSource.contains("func setDailyInspirationEnabled(_ enabled: Bool)") + && workspaceStoreSource.contains("showDailyInspiration = snapshot.showDailyInspiration ?? true") + && workspaceStoreSource.contains("showDailyInspiration: showDailyInspiration"), "daily inspiration preference persists in the isolated workspace file and older workspaces default to enabled") expect(workspaceStoreSource.contains("var brandLatinName: String") && workspaceStoreSource.contains("\"WeiBei\"") && contentViewSource.contains("Text(store.brandLatinName)") @@ -1629,6 +1810,22 @@ expect(workspaceStoreSource.contains("let sampleItems: [StudyItem] = WorkspaceSt && workspaceStoreSource.contains("CGDataConsumer(data: data as CFMutableData)") && workspaceStoreSource.contains("利率是资金使用价格的表达。") && !workspaceStoreSource.contains("StudyItem(id: \"sample-pdf\", title: \"Mishkin 教材样例\", subtitle: \"PDF 阅读\", kind: .pdf, urlPath: nil, isSample: true)"), "sample PDF item points at a generated selectable PDF file instead of the fake PDF fallback") +expect(workspaceStoreSource.contains("empty-workspace-light-wide") + && workspaceStoreSource.contains("empty-workspace-light-narrow") + && workspaceStoreSource.contains("empty-workspace-calligraphy-light") + && workspaceStoreSource.contains("empty-workspace-calligraphy-dark") + && workspaceStoreSource.contains("empty-workspace-dark-wide") + && workspaceStoreSource.contains("empty-workspace-dark-narrow") + && workspaceStoreSource.contains("empty-workspace-inspiration-off") + && workspaceStoreSource.contains("configureEmptyWorkspaceVerificationScenario") + && workspaceStoreSource.contains("guard Self.environmentValue(\"WEIBEI_SUPPRESS_ACTIVATION\") == \"1\" else { return }") + && workspaceStoreSource.contains("showReader = false") + && workspaceStoreSource.contains("showAgent = false") + && workspaceStoreSource.contains("showNotes = false") + && workspaceStoreSource.contains("case \"empty-workspace-open-doc\":\n toggleReader()") + && workspaceStoreSource.contains("case \"empty-workspace-open-chat\":\n toggleAgent()") + && workspaceStoreSource.contains("case \"empty-workspace-open-notes\":\n toggleNotes()") + && workspaceStoreSource.contains("Empty workspace entry state marker"), "verification scenarios cover empty light and dark wide and narrow windows plus all three preserved-state entry paths") expect(workspaceStoreSource.contains("ownerTitle: String? = nil") && workspaceStoreSource.contains("let resolvedOwnerTitle"), "selection updates can carry a precise reader source title") expect(workspaceStoreSource.contains("@Published var selectionAttachments: [SelectionContext] = []") && workspaceStoreSource.contains("@Published var floatingSelectionPrompt = \"\"") @@ -2193,7 +2390,7 @@ expect(contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent && contentViewSource.contains("threePaneReorderOverlay(order: order") && contentViewSource.contains("private func documentPaneLayoutView() -> some View") && contentViewSource.contains("let order = store.visibleDocumentPaneOrder") - && contentViewSource.contains("EmptyWorkspaceView()") + && contentViewSource.contains("EmptyWorkspaceLauncherView()") && contentViewSource.contains("documentTwoPaneView(order: order)") && contentViewSource.contains("documentThreePaneView(order: Array(order.prefix(3)))") && contentViewSource.contains("let estimatedFrames = threePaneFrames(order: order, size: geometry.size)") @@ -2708,9 +2905,15 @@ expect(!notebookMarkdown.canBecomeNotebookNote, "notebook markdown does not offe expect(!sampleMarkdown.isImportedMarkdownFile, "sample markdown stays app-owned") expect(!sampleMarkdown.canBecomeNotebookNote, "sample markdown cannot become a backing-file note") -let persisted = PersistedWorkspace(threePaneOrder: [.agent, .reader, .notes], noteRenderMode: .preview, showLibrary: false, showReader: false, showAgent: true, showNotes: false, showRightPane: true, adaptImportedDocumentColors: false) +let persisted = PersistedWorkspace(threePaneOrder: [.agent, .reader, .notes], noteRenderMode: .preview, showLibrary: false, showReader: false, showAgent: true, showNotes: false, showRightPane: true, showDailyInspiration: false, adaptImportedDocumentColors: false) let restored = try JSONDecoder().decode(PersistedWorkspace.self, from: try JSONEncoder().encode(persisted)) expect(restored.showLibrary == false && restored.showReader == false && restored.showAgent == true && restored.showNotes == false && restored.showRightPane == true, "pane visibility state persists") +expect(restored.showDailyInspiration == false, "daily inspiration can be disabled and restored from workspace persistence") +let reenabledInspiration = try JSONDecoder().decode(PersistedWorkspace.self, from: try JSONEncoder().encode(PersistedWorkspace(showDailyInspiration: true))) +expect(reenabledInspiration.showDailyInspiration == true, "daily inspiration can be re-enabled and restored from workspace persistence") +let legacyWorkspace = try JSONDecoder().decode(PersistedWorkspace.self, from: Data(#"{"importedItems":[],"notesByItemID":{}}"#.utf8)) +expect(legacyWorkspace.showDailyInspiration == nil + && workspaceStoreSource.contains("showDailyInspiration = snapshot.showDailyInspiration ?? true"), "workspace snapshots created before daily inspiration remain decodable and default to enabled") expect(restored.adaptImportedDocumentColors == false && workspaceStoreSource.contains("adaptImportedDocumentColors = snapshot.adaptImportedDocumentColors ?? true") && workspaceStoreSource.contains("adaptImportedDocumentColors: adaptImportedDocumentColors"), "imported-document color adaptation persists while old workspaces default to adapted reading") diff --git a/script/build_and_run.sh b/script/build_and_run.sh index 48cd46642..d1aa9827d 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -47,6 +47,9 @@ INFO_PLIST="$APP_CONTENTS/Info.plist" VERIFY_PID="" VERIFY_DATA_DIR="$DIST_DIR/Data" VERIFY_SCENARIO="${WEIBEI_VERIFY_SCENARIO:-offline-learning-flow}" +VERIFY_WINDOW_SIZE="${WEIBEI_VERIFY_WINDOW_SIZE:-}" +VERIFY_INSPIRATION_ID="${WEIBEI_VERIFY_INSPIRATION_ID:-}" +VERIFY_CAPTURE_PATH="${TMPDIR:-/tmp}/weibei-self-capture-$UID-$VERIFY_SCENARIO.png" if [[ "$CHECK_ONLY" == true ]]; then : @@ -125,7 +128,8 @@ open_app_for_verify() { before_pids="$(pgrep -x "$PRODUCT_NAME" || true)" rm -rf "$VERIFY_DATA_DIR" mkdir -p "$VERIFY_DATA_DIR" - /usr/bin/open -n -g --env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" --env "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" "$APP_BUNDLE" + rm -f "$VERIFY_CAPTURE_PATH" + /usr/bin/open -n -g --env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" --env "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" --env "WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE" --env "WEIBEI_VERIFY_INSPIRATION_ID=$VERIFY_INSPIRATION_ID" --env "WEIBEI_VERIFY_CAPTURE_PATH=$VERIFY_CAPTURE_PATH" "$APP_BUNDLE" for _ in {1..50}; do local newest_pid newest_pid="$(pgrep -nx "$PRODUCT_NAME" || true)" @@ -148,21 +152,26 @@ visual_verify_window() { if [[ -n "$VERIFY_SCENARIO" ]]; then sleep 2.6 fi - local window_id - window_id="$(swift -target arm64-apple-macosx14.0 -e 'import CoreGraphics; import Foundation; let owner = CommandLine.arguments[1]; let targetPID = CommandLine.arguments.count > 2 ? Int(CommandLine.arguments[2]) : nil; func number(_ value: Any?) -> Double { (value as? NSNumber)?.doubleValue ?? 0 }; let windows = CGWindowListCopyWindowInfo([.optionAll], kCGNullWindowID) as? [[String: Any]] ?? []; guard let window = windows.first(where: { window in guard (window[kCGWindowOwnerName as String] as? String) == owner else { return false }; if let targetPID, (window[kCGWindowOwnerPID as String] as? NSNumber)?.intValue != targetPID { return false }; let bounds = window[kCGWindowBounds as String] as? [String: Any]; let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber; let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0; return visibleEnough && number(window[kCGWindowLayer as String]) == 0 && number(bounds?["Width"]) >= 600 && number(bounds?["Height"]) >= 400 }), let id = window[kCGWindowNumber as String] as? UInt32 else { exit(1) }; print(id)' "$APP_DISPLAY_NAME" "$VERIFY_PID")" - local capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.png" - local capture_error="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.err" - if ! /usr/sbin/screencapture -x -l "$window_id" "$capture_path" 2>"$capture_error"; then - cat "$capture_error" >&2 - echo "visual verify blocked: macOS refused window capture for $APP_DISPLAY_NAME. Grant Screen Recording permission to this terminal/Codex host, then rerun --visual-verify." >&2 - rm -f "$capture_path" "$capture_error" - exit 5 + local capture_path="$VERIFY_CAPTURE_PATH" + if [[ ! -s "$capture_path" ]]; then + local window_id + window_id="$(swift -target arm64-apple-macosx14.0 -e 'import CoreGraphics; import Foundation; let owner = CommandLine.arguments[1]; let targetPID = CommandLine.arguments.count > 2 ? Int(CommandLine.arguments[2]) : nil; func number(_ value: Any?) -> Double { (value as? NSNumber)?.doubleValue ?? 0 }; let windows = CGWindowListCopyWindowInfo([.optionAll], kCGNullWindowID) as? [[String: Any]] ?? []; guard let window = windows.first(where: { window in guard (window[kCGWindowOwnerName as String] as? String) == owner else { return false }; if let targetPID, (window[kCGWindowOwnerPID as String] as? NSNumber)?.intValue != targetPID { return false }; let bounds = window[kCGWindowBounds as String] as? [String: Any]; let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber; let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0; return visibleEnough && number(window[kCGWindowLayer as String]) == 0 && number(bounds?["Width"]) >= 600 && number(bounds?["Height"]) >= 400 }), let id = window[kCGWindowNumber as String] as? UInt32 else { exit(1) }; print(id)' "$APP_DISPLAY_NAME" "$VERIFY_PID")" + capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.png" + local capture_error="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.err" + if ! /usr/sbin/screencapture -x -l "$window_id" "$capture_path" 2>"$capture_error"; then + cat "$capture_error" >&2 + echo "visual verify blocked: both the app-owned capture and macOS window capture failed for $APP_DISPLAY_NAME. Grant Screen Recording permission to this terminal/Codex host, then rerun --visual-verify." >&2 + rm -f "$capture_path" "$capture_error" + exit 5 + fi + rm -f "$capture_error" fi - rm -f "$capture_error" swift -target arm64-apple-macosx14.0 -e 'import AppKit; import Foundation; let path = CommandLine.arguments[1]; guard let image = NSImage(contentsOf: URL(fileURLWithPath: path)), let data = image.tiffRepresentation, let bitmap = NSBitmapImageRep(data: data) else { exit(2) }; let xStep = max(1, bitmap.pixelsWide / 80); let yStep = max(1, bitmap.pixelsHigh / 60); var sampled = 0; var visible = 0; for y in stride(from: 0, to: bitmap.pixelsHigh, by: yStep) { for x in stride(from: 0, to: bitmap.pixelsWide, by: xStep) { guard let color = bitmap.colorAt(x: x, y: y) else { continue }; if color.redComponent > 0.08 || color.greenComponent > 0.08 || color.blueComponent > 0.08 { visible += 1 }; sampled += 1 } }; guard sampled > 0 else { exit(3) }; let nonBlackRatio = Double(visible) / Double(sampled); print("visual_non_black_ratio=\(nonBlackRatio)"); if nonBlackRatio < 0.02 { fputs("visual verify failed: captured window is black or empty\n", stderr); exit(4) }' "$capture_path" local latest_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-latest.png" + local scenario_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$VERIFY_SCENARIO.png" cp "$capture_path" "$latest_capture_path" - echo "visual_capture_path=$latest_capture_path" + cp "$capture_path" "$scenario_capture_path" + echo "visual_capture_path=$scenario_capture_path" rm -f "$capture_path" } @@ -196,11 +205,66 @@ verify_learning_flow_persistence() { return 1 } +verify_empty_workspace_state() { + case "$VERIFY_SCENARIO" in + empty-workspace-*) + ;; + *) + return 0 + ;; + esac + + local workspace_file="$VERIFY_DATA_DIR/workspace.json" + local expected_reader=false + local expected_agent=false + local expected_notes=false + local expected_inspiration=true + case "$VERIFY_SCENARIO" in + empty-workspace-open-doc) + expected_reader=true + ;; + empty-workspace-open-chat) + expected_agent=true + ;; + empty-workspace-open-notes) + expected_notes=true + ;; + empty-workspace-inspiration-off) + expected_inspiration=false + ;; + esac + + for _ in {1..30}; do + if [[ -f "$workspace_file" ]] \ + && /usr/bin/grep -q "\"showReader\":$expected_reader" "$workspace_file" \ + && /usr/bin/grep -q "\"showAgent\":$expected_agent" "$workspace_file" \ + && /usr/bin/grep -q "\"showNotes\":$expected_notes" "$workspace_file" \ + && /usr/bin/grep -q "\"showDailyInspiration\":$expected_inspiration" "$workspace_file"; then + if [[ "$VERIFY_SCENARIO" == empty-workspace-open-* ]] \ + && ! /usr/bin/grep -q "Empty workspace entry state marker" "$workspace_file"; then + sleep 0.2 + continue + fi + return 0 + fi + sleep 0.2 + done + + echo "verify failed: empty-workspace pane or inspiration state was not persisted for $VERIFY_SCENARIO." >&2 + if [[ -f "$workspace_file" ]]; then + /usr/bin/sed -n '1,80p' "$workspace_file" >&2 + else + echo "missing workspace file: $workspace_file" >&2 + fi + return 1 +} + finish_verify_window() { if [[ "$RUN_VISUAL_VERIFY" == true ]]; then visual_verify_window fi verify_learning_flow_persistence + verify_empty_workspace_state } run_verifiers() { From 8a172fe5956f5443e9ba0054e0f05f8bf5bde66b Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:03:54 +0800 Subject: [PATCH 04/36] =?UTF-8?q?fix:=20=E4=BF=9D=E6=8C=81=E5=88=86?= =?UTF-8?q?=E6=A0=8F=E5=88=87=E6=8D=A2=E8=BF=9E=E7=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 普通文档工作区统一为常驻 AppKit 三槽容器,避免 1/2/3 栏切换时重挂内容宿主;分栏增删改为宽度动画,并加入状态与宿主连续性验证。 --- Sources/WeiBei/Stores/WorkspaceStore.swift | 55 +- .../Support/PaneContinuityRecorder.swift | 72 ++ Sources/WeiBei/Views/ContentView.swift | 168 +--- .../Views/StableDocumentWorkspace.swift | 922 ++++++++++++++++++ Sources/WeiBeiSelfCheck/main.swift | 101 +- 5 files changed, 1173 insertions(+), 145 deletions(-) create mode 100644 Sources/WeiBei/Support/PaneContinuityRecorder.swift create mode 100644 Sources/WeiBei/Views/StableDocumentWorkspace.swift diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index b8071f7d8..838f550c9 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -2074,8 +2074,61 @@ final class WorkspaceStore: ObservableObject { let scenario = Self.environmentValue("WEIBEI_VERIFY_SCENARIO") guard scenario == "offline-learning-flow" || scenario == "immersive-conversation-flow" - || scenario == "notebook-creation-flow" else { return } + || scenario == "notebook-creation-flow" + || scenario == "pane-layout-stability-flow" else { return } didRunVerificationScenario = true + if scenario == "pane-layout-stability-flow" { + if Self.environmentValue("WEIBEI_VERIFY_APPEARANCE") == WeiBeiAppearanceMode.inkstone.rawValue { + appearanceMode = .inkstone + } + let rawOrder = Self.environmentValue("WEIBEI_VERIFY_PANE_ORDER") + if !rawOrder.isEmpty { + let requestedOrder = rawOrder + .split(separator: ",") + .compactMap { WorkspacePaneRole(rawValue: String($0)) } + if requestedOrder.count == WorkspacePaneRole.allCases.count, + Set(requestedOrder).count == WorkspacePaneRole.allCases.count { + threePaneOrder = requestedOrder + } + } + layout = layoutMatchingThreePaneOrder(threePaneOrder) + showLibrary = false + showReader = true + showAgent = false + showNotes = false + agentSurface = .hidden + select(itemID: "sample-html") + agentDraft = ui("保留这段尚未发送的提问", "Keep this unsent question") + updateNote(ui("# 分栏连续性验收\n\n笔记内容必须保留。\n", "# Pane continuity check\n\nThe note must survive pane changes.\n")) + save() + try? await Task.sleep(nanoseconds: 2_000_000_000) + showAgent = true + save() + try? await Task.sleep(nanoseconds: 900_000_000) + showNotes = true + save() + try? await Task.sleep(nanoseconds: 900_000_000) + showNotes = false + save() + try? await Task.sleep(nanoseconds: 900_000_000) + showAgent = false + save() + let completionURL = storageURL.deletingLastPathComponent().appendingPathComponent("pane-layout-stability.complete") + let receipt: [String: Any] = [ + "agentDraft": agentDraft, + "appearance": appearanceMode.rawValue, + "noteText": noteText, + "order": normalizedThreePaneOrder.map(\.rawValue), + "selectedItemID": selectedItemID ?? "", + "showAgent": showAgent, + "showNotes": showNotes, + "showReader": showReader + ] + if let data = try? JSONSerialization.data(withJSONObject: receipt, options: [.prettyPrinted, .sortedKeys]) { + try? data.write(to: completionURL, options: .atomic) + } + return + } layout = scenario == "immersive-conversation-flow" ? .immersiveConversation : .documentAgentNotes if scenario == "notebook-creation-flow" { layout = .immersiveWriting diff --git a/Sources/WeiBei/Support/PaneContinuityRecorder.swift b/Sources/WeiBei/Support/PaneContinuityRecorder.swift new file mode 100644 index 000000000..d351a6abd --- /dev/null +++ b/Sources/WeiBei/Support/PaneContinuityRecorder.swift @@ -0,0 +1,72 @@ +#if DEBUG +import AppKit +import Foundation + +struct PaneContinuityRoleSample: Codable { + let role: String + let hostID: String + let parentID: String + let hidden: Bool + let modelFrame: CGRect + let presentationFrame: CGRect +} + +struct PaneContinuitySample: Codable { + let recorderID: String + let transition: Int + let frame: Int + let timestamp: TimeInterval + let stableOwnership: Bool + let containerBounds: CGRect + let roles: [PaneContinuityRoleSample] +} + +@MainActor +final class PaneContinuityRecorder { + private let directory: URL + private let recorderID = UUID().uuidString + private var transitionIndex = 0 + + static func configuredFromEnvironment() -> PaneContinuityRecorder? { + let path = ProcessInfo.processInfo.environment["WEIBEI_VERIFY_PANE_TRACE_DIR"]? + .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + guard !path.isEmpty else { return nil } + return PaneContinuityRecorder(directory: URL(fileURLWithPath: path, isDirectory: true)) + } + + private init(directory: URL) { + self.directory = directory + try? FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + } + + func recordTransition(view: StableDocumentSplitView?, duration: TimeInterval) { + guard view != nil else { return } + transitionIndex += 1 + let transition = transitionIndex + let interval = 1.0 / 60.0 + let frameCount = max(2, Int(ceil(duration / interval)) + 3) + + for frame in 0..<frameCount { + DispatchQueue.main.asyncAfter(deadline: .now() + interval * Double(frame)) { [weak self, weak view] in + guard let self, let view else { return } + let sample = view.continuitySample( + recorderID: self.recorderID, + transition: transition, + frame: frame + ) + guard let data = try? JSONEncoder().encode(sample) else { return } + let name = String( + format: "container-%@-transition-%02d-frame-%02d.json", + self.recorderID, + transition, + frame + ) + let destination = self.directory.appendingPathComponent(name) + DispatchQueue.global(qos: .utility).async { + try? data.write(to: destination, options: .atomic) + } + } + } + } +} +#endif diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index 98ed31581..20422f89a 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -532,9 +532,7 @@ private struct UnifiedTopBarView: View { help: store.isPaneToggleActive(.reader) ? store.ui("隐藏文稿", "Hide document") : store.ui("显示文稿", "Show document"), active: store.isPaneToggleActive(.reader) ) { - withAnimation(WeiBeiMotion.layout) { - store.toggleReader() - } + store.toggleReader() } topIconButton( @@ -542,9 +540,7 @@ private struct UnifiedTopBarView: View { help: agentPaneToggleHelp, active: store.isPaneToggleActive(.agent) ) { - withAnimation(WeiBeiMotion.layout) { - store.toggleAgent() - } + store.toggleAgent() } topIconButton( @@ -552,9 +548,7 @@ private struct UnifiedTopBarView: View { help: store.isPaneToggleActive(.notes) ? store.ui("隐藏笔记", "Hide notes") : store.ui("显示笔记", "Show notes"), active: store.isPaneToggleActive(.notes) ) { - withAnimation(WeiBeiMotion.layout) { - store.toggleNotes() - } + store.toggleNotes() } } .padding(.horizontal, 4) @@ -711,9 +705,7 @@ private struct LayoutContentView: View { var body: some View { Group { switch store.layout { - case .documentAgentNotes, .documentNotesAgent: - documentPaneLayoutView() - case .documentNotesSplit: + case .documentAgentNotes, .documentNotesAgent, .documentNotesSplit: documentPaneLayoutView() case .immersiveReading: ZStack(alignment: .topTrailing) { @@ -771,10 +763,6 @@ private struct LayoutContentView: View { } .transition(WeiBeiTransition.layout) .animation(WeiBeiMotion.layout, value: store.layout) - .animation(WeiBeiMotion.panel, value: store.showRightPane) - .animation(WeiBeiMotion.panel, value: store.showReader) - .animation(WeiBeiMotion.panel, value: store.showAgent) - .animation(WeiBeiMotion.panel, value: store.showNotes) .animation(WeiBeiMotion.panel, value: store.agentSurface) .animation(WeiBeiMotion.panel, value: store.showQuietInsight) } @@ -818,102 +806,30 @@ private struct LayoutContentView: View { @ViewBuilder private func documentPaneLayoutView() -> some View { let order = store.visibleDocumentPaneOrder - switch order.count { - case 0: - EmptyWorkspaceView() - .transition(WeiBeiTransition.layout) - case 1: - paneView(for: order[0]) - .transition(WeiBeiTransition.layout) - case 2: - documentTwoPaneView(order: order) - default: - documentThreePaneView(order: Array(order.prefix(3))) - } - } - - private func minimumWidth(for _: WorkspacePaneRole) -> CGFloat { - ContentRailMetrics.railOnlyWidth - } - - @ViewBuilder - private func documentTwoPaneView(order: [WorkspacePaneRole]) -> some View { - GeometryReader { geometry in - let frames = twoPaneFrames(order: order, size: geometry.size) - ZStack { - ResizableTwoPane( - split: halfSplit, - minFirst: minimumWidth(for: order[0]), - minSecond: minimumWidth(for: order[1]), - roles: order, - allowRailSnapping: true - ) { - reorderablePaneView(for: order[0]) - } second: { - reorderablePaneView(for: order[1]) - } - - threePaneReorderOverlay(order: order, size: geometry.size, frames: frames) - } - .background(ThreePaneReorderFrameReporter(order: order, frames: frames)) - } - .transition(WeiBeiTransition.rightPanel) - } - - @ViewBuilder - private func documentThreePaneView(order: [WorkspacePaneRole]) -> some View { GeometryReader { geometry in - let estimatedFrames = threePaneFrames(order: order, size: geometry.size) - let frames = store.threePaneReorderFrameList(order: order, fallback: estimatedFrames) + let fallbackFrames = estimatedDocumentPaneFrames(order: order, size: geometry.size) + let frames = store.threePaneReorderFrameList(order: order, fallback: fallbackFrames) ZStack { - ResizableThreePane( + StableDocumentWorkspace( firstSplit: firstSplit, secondSplit: secondSplit, - minFirst: minimumWidth(for: order[0]), - minSecond: minimumWidth(for: order[1]), - minThird: minimumWidth(for: order[2]), - roles: order, - allowRailSnapping: true - ) { - reorderablePaneView(for: order[0]) - } second: { - reorderablePaneView(for: order[1]) - } third: { - reorderablePaneView(for: order[2]) - } onFramesChange: { frames in - store.updateThreePaneReorderFrames(order: order, frames: frames) - } + halfSplit: halfSplit, + registry: paneHostRegistry, + normalizedOrder: store.normalizedThreePaneOrder, + visibleOrder: order, + draggedRole: store.threePaneReorderDrag?.role, + expansionRequest: store.paneExpansionRequest, + onFramesChange: { reportedOrder, frames in + store.updateThreePaneReorderFrames(order: reportedOrder, frames: frames) + }, + onExpansionRequestHandled: { requestID in + store.completePaneExpansionRequest(requestID) + } + ) threePaneReorderOverlay(order: order, size: geometry.size, frames: frames) } - .background(ThreePaneReorderFrameReporter(order: order, frames: estimatedFrames)) } - .transition(WeiBeiTransition.rightPanel) - } - - @ViewBuilder - private func reorderablePaneView(for role: WorkspacePaneRole) -> some View { - let drag = store.threePaneReorderDrag - paneView(for: role) - .opacity(drag?.role == role ? 0.08 : 1) - .overlay { - if drag?.targetIndex == store.normalizedThreePaneOrder.firstIndex(of: role), drag?.role != role { - RoundedRectangle(cornerRadius: 8) - .stroke(WeiBeiTheme.cinnabar.opacity(0.22), lineWidth: 1) - .background { - RoundedRectangle(cornerRadius: 8) - .fill(WeiBeiTheme.cinnabarSoft.opacity(0.10)) - } - .padding(8) - .transition(WeiBeiTransition.floating) - } - } - .animation(WeiBeiMotion.micro, value: drag) - } - - @ViewBuilder - private func paneView(for role: WorkspacePaneRole) -> some View { - PersistentPaneHost(role: role, registry: paneHostRegistry) } @ViewBuilder @@ -949,6 +865,23 @@ private struct LayoutContentView: View { } } + private func estimatedDocumentPaneFrames(order: [WorkspacePaneRole], size: CGSize) -> [CGRect] { + switch order.count { + case 0: + return [] + case 1: + return [CGRect(origin: .zero, size: size)] + case 2: + return twoPaneFrames(order: order, size: size) + default: + return threePaneFrames(order: Array(order.prefix(3)), size: size) + } + } + + private func minimumWidth(for _: WorkspacePaneRole) -> CGFloat { + ContentRailMetrics.railOnlyWidth + } + private func threePaneFrames(order: [WorkspacePaneRole], size: CGSize) -> [CGRect] { let divider = WeiBeiSplitView.thickness let usable = max(size.width - 2 * divider, 1) @@ -984,23 +917,6 @@ private struct LayoutContentView: View { Swift.min(Swift.max(value, min), Swift.max(min, max)) } - private struct ThreePaneReorderFrameReporter: View { - @EnvironmentObject private var store: WorkspaceStore - let order: [WorkspacePaneRole] - let frames: [CGRect] - - var body: some View { - Color.clear - .onAppear(perform: report) - .onChange(of: order) { _, _ in report() } - .onChange(of: frames) { _, _ in report() } - } - - private func report() { - store.updateThreePaneReorderFrames(order: order, frames: frames) - } - } - private var conversationSourceRailItems: [ContextRailItem] { var items: [ContextRailItem] = [] if let item = store.selectedMaterialItem { @@ -1171,12 +1087,12 @@ private struct LayoutContentView: View { } } -private struct OwnerToken: Equatable { +struct OwnerToken: Equatable { let role: WorkspacePaneRole let generation: Int } -private final class PersistentPaneHostRegistry: ObservableObject { +final class PersistentPaneHostRegistry: ObservableObject { private var hosts: [WorkspacePaneRole: NSHostingView<AnyView>] = [:] private var latestOwnerGeneration: [WorkspacePaneRole: Int] = [:] private var activeOwners: [WorkspacePaneRole: OwnerToken] = [:] @@ -1227,7 +1143,7 @@ private final class PersistentPaneHostRegistry: ObservableObject { } } -private final class PersistentPaneContainerView: NSView { +final class PersistentPaneContainerView: NSView { var onWindowChange: ((PersistentPaneContainerView) -> Void)? override func viewDidMoveToWindow() { @@ -1236,7 +1152,7 @@ private final class PersistentPaneContainerView: NSView { } } -private struct PersistentPaneHost: NSViewRepresentable { +struct PersistentPaneHost: NSViewRepresentable { @EnvironmentObject private var store: WorkspaceStore let role: WorkspacePaneRole let registry: PersistentPaneHostRegistry @@ -1365,7 +1281,7 @@ private struct PaneReorderPreviewView: View { } } -private struct EmptyWorkspaceView: View { +struct EmptyWorkspaceView: View { @EnvironmentObject private var store: WorkspaceStore var body: some View { diff --git a/Sources/WeiBei/Views/StableDocumentWorkspace.swift b/Sources/WeiBei/Views/StableDocumentWorkspace.swift new file mode 100644 index 000000000..443d50f25 --- /dev/null +++ b/Sources/WeiBei/Views/StableDocumentWorkspace.swift @@ -0,0 +1,922 @@ +import AppKit +import QuartzCore +import SwiftUI +import WeiBeiCore + +struct StableDocumentWorkspace: NSViewRepresentable { + @EnvironmentObject private var store: WorkspaceStore + @Binding var firstSplit: CGFloat + @Binding var secondSplit: CGFloat + @Binding var halfSplit: CGFloat + let registry: PersistentPaneHostRegistry + let normalizedOrder: [WorkspacePaneRole] + let visibleOrder: [WorkspacePaneRole] + let draggedRole: WorkspacePaneRole? + let expansionRequest: PaneExpansionRequest? + let onFramesChange: ([WorkspacePaneRole], [CGRect]) -> Void + let onExpansionRequestHandled: (UUID) -> Void + + func makeCoordinator() -> StableDocumentSplitCoordinator { + StableDocumentSplitCoordinator( + firstSplit: $firstSplit, + secondSplit: $secondSplit, + halfSplit: $halfSplit + ) + } + + func makeNSView(context: Context) -> StableDocumentSplitView { + let splitView = StableDocumentSplitView() + let roleHosts = Dictionary(uniqueKeysWithValues: WorkspacePaneRole.allCases.map { role in + (role, nativeHost( + PersistentPaneHost(role: role, registry: registry) + .environmentObject(store), + identifier: "stable-document-slot-\(role.rawValue)" + )) + }) + let emptyHost = nativeHost( + EmptyWorkspaceView().environmentObject(store), + identifier: "stable-document-empty-workspace" + ) + splitView.install(roleHosts: roleHosts, emptyHost: emptyHost) + context.coordinator.install(in: splitView) + update(splitView, coordinator: context.coordinator) + return splitView + } + + func updateNSView(_ splitView: StableDocumentSplitView, context: Context) { + update(splitView, coordinator: context.coordinator) + } + + static func dismantleNSView(_ splitView: StableDocumentSplitView, coordinator: StableDocumentSplitCoordinator) { + coordinator.stop(in: splitView) + } + + private func update(_ splitView: StableDocumentSplitView, coordinator: StableDocumentSplitCoordinator) { + coordinator.firstSplit = $firstSplit + coordinator.secondSplit = $secondSplit + coordinator.halfSplit = $halfSplit + coordinator.onFramesChange = onFramesChange + coordinator.onExpansionRequestHandled = onExpansionRequestHandled + coordinator.update( + state: StableDocumentLayoutState( + normalizedOrder: WorkspacePaneRole.normalized(normalizedOrder), + visibleOrder: visibleOrder, + firstSplit: firstSplit, + secondSplit: secondSplit, + halfSplit: halfSplit + ), + draggedRole: draggedRole, + expansionRequest: expansionRequest, + in: splitView + ) + } + + private func nativeHost<Content: View>(_ content: Content, identifier: String) -> NSHostingView<AnyView> { + let host = NSHostingView(rootView: AnyView(content)) + host.identifier = NSUserInterfaceItemIdentifier(identifier) + host.translatesAutoresizingMaskIntoConstraints = true + host.autoresizingMask = [] + host.wantsLayer = true + host.layer?.masksToBounds = true + return host + } +} + +struct StableDocumentLayoutState: Equatable { + let normalizedOrder: [WorkspacePaneRole] + let visibleOrder: [WorkspacePaneRole] + let firstSplit: CGFloat + let secondSplit: CGFloat + let halfSplit: CGFloat + + func hasSameStructure(as other: StableDocumentLayoutState) -> Bool { + normalizedOrder == other.normalizedOrder && visibleOrder == other.visibleOrder + } + + func hasSameStoredRatios(as other: StableDocumentLayoutState) -> Bool { + abs(firstSplit - other.firstSplit) < 0.001 + && abs(secondSplit - other.secondSplit) < 0.001 + && abs(halfSplit - other.halfSplit) < 0.001 + } +} + +final class StableDocumentSplitView: NSView { + fileprivate var roleHosts: [WorkspacePaneRole: NSHostingView<AnyView>] = [:] + fileprivate var emptyHost: NSHostingView<AnyView>? + fileprivate let dividerViews = [StableDocumentDividerView(), StableDocumentDividerView()] + fileprivate weak var coordinator: StableDocumentSplitCoordinator? +#if DEBUG + private let continuityRecorder = PaneContinuityRecorder.configuredFromEnvironment() +#endif + + override var isFlipped: Bool { true } + + func install( + roleHosts: [WorkspacePaneRole: NSHostingView<AnyView>], + emptyHost: NSHostingView<AnyView> + ) { + precondition(roleHosts.count == WorkspacePaneRole.allCases.count) + autoresizesSubviews = false + wantsLayer = true + layer?.masksToBounds = true + self.roleHosts = roleHosts + self.emptyHost = emptyHost + addSubview(emptyHost) + for role in WorkspacePaneRole.defaultThreePaneOrder { + guard let host = roleHosts[role] else { continue } + host.isHidden = true + addSubview(host) + } + for divider in dividerViews { + divider.isHidden = true + addSubview(divider) + } + assertStableOwnership() + } + + func assertStableOwnership() { + assert(emptyHost?.superview === self) + assert(roleHosts.values.allSatisfy { $0.superview === self }) + assert(dividerViews.allSatisfy { $0.superview === self }) + } + +#if DEBUG + func recordContinuityTransition(duration: TimeInterval) { + continuityRecorder?.recordTransition(view: self, duration: duration) + } + + func continuitySample(recorderID: String, transition: Int, frame: Int) -> PaneContinuitySample { + let parentID = String(describing: ObjectIdentifier(self)) + let roles = WorkspacePaneRole.allCases.compactMap { role -> PaneContinuityRoleSample? in + guard let host = roleHosts[role] else { return nil } + let presentationFrame = host.layer?.presentation()?.frame ?? host.frame + return PaneContinuityRoleSample( + role: role.rawValue, + hostID: String(describing: ObjectIdentifier(host)), + parentID: host.superview.map { String(describing: ObjectIdentifier($0)) } ?? "none", + hidden: host.isHidden, + modelFrame: host.frame, + presentationFrame: presentationFrame + ) + } + return PaneContinuitySample( + recorderID: recorderID, + transition: transition, + frame: frame, + timestamp: ProcessInfo.processInfo.systemUptime, + stableOwnership: roles.count == WorkspacePaneRole.allCases.count + && roles.allSatisfy { $0.parentID == parentID }, + containerBounds: bounds, + roles: roles + ) + } +#endif + + override func layout() { + super.layout() + coordinator?.containerDidLayout(self) + } +} + +private final class StableDocumentDividerView: NSView { + var onDragStart: (() -> Void)? + var onDragChange: ((CGFloat) -> Void)? + var onDragEnd: (() -> Void)? + private var dragStartX: CGFloat? + + override var isFlipped: Bool { true } + override var acceptsFirstResponder: Bool { false } + + override init(frame frameRect: NSRect) { + super.init(frame: frameRect) + setAccessibilityRole(.splitter) + } + + required init?(coder: NSCoder) { + nil + } + + override func resetCursorRects() { + addCursorRect(bounds, cursor: .resizeLeftRight) + } + + override func viewDidChangeEffectiveAppearance() { + super.viewDidChangeEffectiveAppearance() + needsDisplay = true + } + + override func draw(_ dirtyRect: NSRect) { + dividerFill.setFill() + bounds.fill() + dividerLine.setFill() + NSRect(x: bounds.midX - 0.5, y: bounds.minY + 14, width: 1, height: max(0, bounds.height - 28)).fill() + } + + override func mouseDown(with event: NSEvent) { + dragStartX = event.locationInWindow.x + onDragStart?() + } + + override func mouseDragged(with event: NSEvent) { + guard let dragStartX else { return } + onDragChange?(event.locationInWindow.x - dragStartX) + } + + override func mouseUp(with event: NSEvent) { + dragStartX = nil + onDragEnd?() + } + + private var dividerFill: NSColor { + if isDarkAppearance { + return NSColor(calibratedRed: 0.059, green: 0.059, blue: 0.059, alpha: 0.96) + } + return NSColor(calibratedRed: 0.955, green: 0.918, blue: 0.835, alpha: 0.96) + } + + private var dividerLine: NSColor { + if isDarkAppearance { + return NSColor(calibratedRed: 0.230, green: 0.200, blue: 0.155, alpha: 0.24) + } + return NSColor(calibratedRed: 0.500, green: 0.380, blue: 0.260, alpha: 0.13) + } + + private var isDarkAppearance: Bool { + effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua + } +} + +final class StableDocumentSplitCoordinator { + var firstSplit: Binding<CGFloat> + var secondSplit: Binding<CGFloat> + var halfSplit: Binding<CGFloat> + var onFramesChange: (([WorkspacePaneRole], [CGRect]) -> Void)? + var onExpansionRequestHandled: ((UUID) -> Void)? + + private var desiredState: StableDocumentLayoutState? + private var appliedState: StableDocumentLayoutState? + private var displayedVisibleOrder: [WorkspacePaneRole] = [] + private var recentReadableWidths: [WorkspacePaneRole: CGFloat] = [:] + private var lastContainerSize = CGSize.zero + private var isAnimatingLayout = false + private var isDraggingDivider = false + private var isWritingStoredRatios = false + private var pendingState: StableDocumentLayoutState? + private var pendingExpansionRequest: PaneExpansionRequest? + private var handledExpansionRequestID: UUID? + private var dividerDrag: DividerDrag? + private var animationSequence = 0 + private var activeAnimationToken: Int? + + private let dividerWidth: CGFloat = 10 + private let railWidth = ContentRailMetrics.railOnlyWidth + private let railSnapThreshold = ContentRailMetrics.snapThreshold + private let readableWidthThreshold = ContentRailMetrics.readableWidth + private let defaultReadableWidth = ContentRailMetrics.defaultReadableWidth + private let layoutAnimationDuration = 0.24 + private let snapAnimationDuration = 0.18 + private let animationFallbackGrace: TimeInterval = 0.25 + + init( + firstSplit: Binding<CGFloat>, + secondSplit: Binding<CGFloat>, + halfSplit: Binding<CGFloat> + ) { + self.firstSplit = firstSplit + self.secondSplit = secondSplit + self.halfSplit = halfSplit + } + + func install(in splitView: StableDocumentSplitView) { + splitView.coordinator = self + for (index, divider) in splitView.dividerViews.enumerated() { + divider.onDragStart = { [weak self, weak splitView] in + guard let self, let splitView else { return } + self.beginDividerDrag(index: index, in: splitView) + } + divider.onDragChange = { [weak self, weak splitView] delta in + guard let self, let splitView else { return } + self.updateDividerDrag(delta: delta, in: splitView) + } + divider.onDragEnd = { [weak self, weak splitView] in + guard let self, let splitView else { return } + self.endDividerDrag(in: splitView) + } + } + } + + func stop(in splitView: StableDocumentSplitView) { + splitView.coordinator = nil + for divider in splitView.dividerViews { + divider.onDragStart = nil + divider.onDragChange = nil + divider.onDragEnd = nil + } + } + + func update( + state: StableDocumentLayoutState, + draggedRole: WorkspacePaneRole?, + expansionRequest: PaneExpansionRequest?, + in splitView: StableDocumentSplitView + ) { + splitView.assertStableOwnership() + desiredState = state + updateDragAppearance(draggedRole, in: splitView) + + if let expansionRequest, expansionRequest.id != handledExpansionRequestID { + pendingExpansionRequest = expansionRequest + } + + guard splitView.bounds.width > 0, splitView.bounds.height > 0 else { + splitView.needsLayout = true + return + } + + if isAnimatingLayout || isDraggingDivider { + pendingState = state + return + } + + guard let appliedState else { + apply(state: state, in: splitView, animated: false, preserveCurrentWidths: false) + handlePendingExpansionRequest(in: splitView) + return + } + + if !state.hasSameStructure(as: appliedState) { + apply(state: state, in: splitView, animated: true, preserveCurrentWidths: true) + return + } + + if isWritingStoredRatios { + self.appliedState = state + } else if !state.hasSameStoredRatios(as: appliedState) { + apply(state: state, in: splitView, animated: false, preserveCurrentWidths: false) + } + handlePendingExpansionRequest(in: splitView) + } + + func containerDidLayout(_ splitView: StableDocumentSplitView) { + guard splitView.bounds.width > 0, splitView.bounds.height > 0 else { return } + guard !isAnimatingLayout, !isDraggingDivider else { return } + let size = splitView.bounds.size + guard appliedState == nil || abs(size.width - lastContainerSize.width) > 0.5 || abs(size.height - lastContainerSize.height) > 0.5 else { return } + guard let state = desiredState else { return } + apply(state: state, in: splitView, animated: false, preserveCurrentWidths: appliedState != nil) + handlePendingExpansionRequest(in: splitView) + } + + private func apply( + state: StableDocumentLayoutState, + in splitView: StableDocumentSplitView, + animated: Bool, + preserveCurrentWidths: Bool + ) { + let visibleOrder = state.visibleOrder.filter { state.normalizedOrder.contains($0) } + let widths = paneWidths( + for: visibleOrder, + state: state, + in: splitView, + preserveCurrentWidths: preserveCurrentWidths + ) + let targetFrames = visibleFrames(order: visibleOrder, widths: widths, size: splitView.bounds.size) + let allTargetFrames = allRoleFrames( + normalizedOrder: state.normalizedOrder, + visibleOrder: visibleOrder, + visibleFrames: targetFrames, + size: splitView.bounds.size + ) + let targetDividerFrames = dividerFramesForOrder( + visibleOrder, + visibleFrames: targetFrames, + size: splitView.bounds.size + ) + let previousVisible = Set(displayedVisibleOrder) + let nextVisible = Set(visibleOrder) + let shouldAnimate = animated && !NSWorkspace.shared.accessibilityDisplayShouldReduceMotion + + prepareHosts( + previousVisible: previousVisible, + nextVisible: nextVisible, + targetFrames: allTargetFrames, + in: splitView + ) + prepareDividers(targetFrames: targetDividerFrames, in: splitView) + displayedVisibleOrder = visibleOrder + appliedState = state + lastContainerSize = splitView.bounds.size + + guard shouldAnimate else { + setFramesImmediately( + roleFrames: allTargetFrames, + dividerFrames: targetDividerFrames, + visibleOrder: visibleOrder, + in: splitView + ) + finishLayout(state: state, in: splitView, saveRatios: animated) + return + } + + let animationToken = beginAnimation() + let finishAnimation = { [weak self, weak splitView] in + guard let self, let splitView else { return } + self.completeAnimation(animationToken) { + self.setFramesImmediately( + roleFrames: allTargetFrames, + dividerFrames: targetDividerFrames, + visibleOrder: visibleOrder, + in: splitView + ) + self.finishLayout(state: state, in: splitView, saveRatios: true) + self.applyPendingWork(in: splitView) + } + } + NSAnimationContext.runAnimationGroup({ context in + context.duration = layoutAnimationDuration + context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + context.allowsImplicitAnimation = true + animateFrames( + roleFrames: allTargetFrames, + dividerFrames: targetDividerFrames, + visibleOrder: visibleOrder, + in: splitView + ) + }, completionHandler: finishAnimation) + DispatchQueue.main.asyncAfter( + deadline: .now() + layoutAnimationDuration + animationFallbackGrace, + execute: finishAnimation + ) +#if DEBUG + splitView.recordContinuityTransition(duration: layoutAnimationDuration) +#endif + } + + private func paneWidths( + for visibleOrder: [WorkspacePaneRole], + state: StableDocumentLayoutState, + in splitView: StableDocumentSplitView, + preserveCurrentWidths: Bool + ) -> [CGFloat] { + let count = visibleOrder.count + guard count > 0 else { return [] } + let usable = max(splitView.bounds.width - CGFloat(count - 1) * dividerWidth, 1) + if count == 1 { + return [usable] + } + + if preserveCurrentWidths, appliedState != nil { + let desired = visibleOrder.map { role -> CGFloat in + if displayedVisibleOrder.contains(role), let width = splitView.roleHosts[role]?.frame.width, width > 0.5 { + return width + } + return recentReadableWidths[role] ?? defaultReadableWidth + } + return normalizedWidths(desired, total: usable) + } + + if count == 2 { + let first = clamped(state.halfSplit * usable, min: minimumPaneWidth(total: usable, count: count), max: usable - minimumPaneWidth(total: usable, count: count)) + return [first, usable - first] + } + + let minimum = minimumPaneWidth(total: usable, count: count) + let first = clamped(state.firstSplit * usable, min: minimum, max: usable - 2 * minimum) + let second = clamped((state.secondSplit - state.firstSplit) * usable, min: minimum, max: usable - first - minimum) + return [first, second, max(minimum, usable - first - second)] + } + + private func normalizedWidths(_ desired: [CGFloat], total: CGFloat) -> [CGFloat] { + guard !desired.isEmpty else { return [] } + let minimum = minimumPaneWidth(total: total, count: desired.count) + let minimumTotal = minimum * CGFloat(desired.count) + let extraAvailable = max(0, total - minimumTotal) + let extras = desired.map { max(0, $0 - minimum) } + let extraTotal = extras.reduce(0, +) + var result = extras.map { extra -> CGFloat in + if extraTotal > 0.5 { + return minimum + extraAvailable * extra / extraTotal + } + return minimum + extraAvailable / CGFloat(desired.count) + } + if let lastIndex = result.indices.last { + result[lastIndex] += total - result.reduce(0, +) + } + return result + } + + private func minimumPaneWidth(total: CGFloat, count: Int) -> CGFloat { + min(railWidth, total / CGFloat(max(count, 1))) + } + + private func visibleFrames(order: [WorkspacePaneRole], widths: [CGFloat], size: CGSize) -> [WorkspacePaneRole: CGRect] { + var frames: [WorkspacePaneRole: CGRect] = [:] + var x: CGFloat = 0 + for (index, role) in order.enumerated() { + let width = widths[safe: index] ?? 0 + frames[role] = CGRect(x: x, y: 0, width: width, height: size.height) + x += width + if index < order.count - 1 { + x += dividerWidth + } + } + return frames + } + + private func allRoleFrames( + normalizedOrder: [WorkspacePaneRole], + visibleOrder: [WorkspacePaneRole], + visibleFrames: [WorkspacePaneRole: CGRect], + size: CGSize + ) -> [WorkspacePaneRole: CGRect] { + var frames = visibleFrames + for role in normalizedOrder where visibleFrames[role] == nil { + frames[role] = collapsedFrame( + for: role, + normalizedOrder: normalizedOrder, + visibleOrder: visibleOrder, + visibleFrames: visibleFrames, + size: size + ) + } + return frames + } + + private func collapsedFrame( + for role: WorkspacePaneRole, + normalizedOrder: [WorkspacePaneRole], + visibleOrder: [WorkspacePaneRole], + visibleFrames: [WorkspacePaneRole: CGRect], + size: CGSize + ) -> CGRect { + guard let roleIndex = normalizedOrder.firstIndex(of: role) else { + return CGRect(x: size.width, y: 0, width: 0, height: size.height) + } + if let nextRole = normalizedOrder.dropFirst(roleIndex + 1).first(where: { visibleOrder.contains($0) }), + let nextFrame = visibleFrames[nextRole] { + return CGRect(x: nextFrame.minX, y: 0, width: 0, height: size.height) + } + if let previousRole = normalizedOrder[..<roleIndex].reversed().first(where: { visibleOrder.contains($0) }), + let previousFrame = visibleFrames[previousRole] { + return CGRect(x: previousFrame.maxX, y: 0, width: 0, height: size.height) + } + return CGRect(x: 0, y: 0, width: 0, height: size.height) + } + + private func prepareHosts( + previousVisible: Set<WorkspacePaneRole>, + nextVisible: Set<WorkspacePaneRole>, + targetFrames: [WorkspacePaneRole: CGRect], + in splitView: StableDocumentSplitView + ) { + for role in nextVisible.subtracting(previousVisible) { + guard let host = splitView.roleHosts[role], let target = targetFrames[role] else { continue } + host.frame = CGRect(x: target.minX, y: 0, width: 0, height: target.height) + host.isHidden = false + } + for role in previousVisible.union(nextVisible) { + splitView.roleHosts[role]?.isHidden = false + } + if nextVisible.isEmpty { + splitView.emptyHost?.isHidden = false + if previousVisible.isEmpty { + splitView.emptyHost?.alphaValue = 1 + } else { + splitView.emptyHost?.alphaValue = 0 + } + } + } + + private func prepareDividers(targetFrames: [CGRect], in splitView: StableDocumentSplitView) { + for (index, divider) in splitView.dividerViews.enumerated() where targetFrames.indices.contains(index) { + if divider.isHidden { + let target = targetFrames[index] + divider.frame = CGRect(x: target.minX, y: 0, width: 0, height: target.height) + divider.alphaValue = 0 + divider.isHidden = false + } + } + } + + private func setFramesImmediately( + roleFrames: [WorkspacePaneRole: CGRect], + dividerFrames: [CGRect], + visibleOrder: [WorkspacePaneRole], + in splitView: StableDocumentSplitView + ) { + for (role, frame) in roleFrames { + splitView.roleHosts[role]?.frame = frame + } + updateDividerFrames(dividerFrames, animated: false, in: splitView) + splitView.emptyHost?.frame = splitView.bounds + splitView.emptyHost?.alphaValue = visibleOrder.isEmpty ? 1 : 0 + } + + private func animateFrames( + roleFrames: [WorkspacePaneRole: CGRect], + dividerFrames: [CGRect], + visibleOrder: [WorkspacePaneRole], + in splitView: StableDocumentSplitView + ) { + for (role, frame) in roleFrames { + splitView.roleHosts[role]?.animator().frame = frame + } + updateDividerFrames(dividerFrames, animated: true, in: splitView) + splitView.emptyHost?.animator().frame = splitView.bounds + splitView.emptyHost?.animator().alphaValue = visibleOrder.isEmpty ? 1 : 0 + } + + private func updateDividerFrames(_ frames: [CGRect], animated: Bool, in splitView: StableDocumentSplitView) { + for (index, divider) in splitView.dividerViews.enumerated() { + let target = frames[safe: index] ?? collapsedDividerFrame(index: index, frames: frames, size: splitView.bounds.size) + if animated { + divider.animator().frame = target + divider.animator().alphaValue = frames.indices.contains(index) ? 1 : 0 + } else { + divider.frame = target + divider.alphaValue = frames.indices.contains(index) ? 1 : 0 + } + } + } + + private func collapsedDividerFrame(index: Int, frames: [CGRect], size: CGSize) -> CGRect { + let x = frames.last?.maxX ?? (index == 0 ? 0 : size.width) + return CGRect(x: x, y: 0, width: 0, height: size.height) + } + + private func finishLayout(state: StableDocumentLayoutState, in splitView: StableDocumentSplitView, saveRatios: Bool) { + splitView.assertStableOwnership() + let visible = Set(displayedVisibleOrder) + for role in WorkspacePaneRole.allCases { + let host = splitView.roleHosts[role] + host?.isHidden = !visible.contains(role) + host?.alphaValue = 1 + } + for (index, divider) in splitView.dividerViews.enumerated() { + divider.isHidden = index >= max(0, displayedVisibleOrder.count - 1) + divider.alphaValue = divider.isHidden ? 0 : 1 + } + splitView.emptyHost?.isHidden = !displayedVisibleOrder.isEmpty + splitView.emptyHost?.alphaValue = displayedVisibleOrder.isEmpty ? 1 : 0 + captureReadableWidths(in: splitView) + if saveRatios { + persistRatios(in: splitView) + } + appliedState = StableDocumentLayoutState( + normalizedOrder: state.normalizedOrder, + visibleOrder: state.visibleOrder, + firstSplit: firstSplit.wrappedValue, + secondSplit: secondSplit.wrappedValue, + halfSplit: halfSplit.wrappedValue + ) + reportFrames(in: splitView) + } + + private func applyPendingWork(in splitView: StableDocumentSplitView) { + if let pendingState { + self.pendingState = nil + if let appliedState, !pendingState.hasSameStructure(as: appliedState) { + apply(state: pendingState, in: splitView, animated: true, preserveCurrentWidths: true) + return + } + if let appliedState, + !isWritingStoredRatios, + !pendingState.hasSameStoredRatios(as: appliedState) { + apply(state: pendingState, in: splitView, animated: false, preserveCurrentWidths: false) + return + } + } + handlePendingExpansionRequest(in: splitView) + splitView.needsLayout = true + } + + private func updateDragAppearance(_ draggedRole: WorkspacePaneRole?, in splitView: StableDocumentSplitView) { + for (role, host) in splitView.roleHosts { + host.alphaValue = role == draggedRole ? 0.08 : 1 + } + } + + private struct DividerDrag { + let index: Int + let baseWidths: [CGFloat] + } + + private func beginDividerDrag(index: Int, in splitView: StableDocumentSplitView) { + guard !isAnimatingLayout, displayedVisibleOrder.count > index + 1 else { return } + let widths = displayedVisibleOrder.compactMap { splitView.roleHosts[$0]?.frame.width } + guard widths.count == displayedVisibleOrder.count else { return } + captureReadableWidths(in: splitView) + dividerDrag = DividerDrag(index: index, baseWidths: widths) + isDraggingDivider = true + } + + private func updateDividerDrag(delta: CGFloat, in splitView: StableDocumentSplitView) { + guard let dividerDrag else { return } + var widths = dividerDrag.baseWidths + let leftIndex = dividerDrag.index + let rightIndex = dividerDrag.index + 1 + let combined = widths[leftIndex] + widths[rightIndex] + let minimum = minimumPaneWidth(total: combined, count: 2) + let left = clamped(widths[leftIndex] + delta, min: minimum, max: combined - minimum) + widths[leftIndex] = left + widths[rightIndex] = combined - left + applyVisibleWidthsImmediately(widths, in: splitView) + } + + private func endDividerDrag(in splitView: StableDocumentSplitView) { + guard dividerDrag != nil else { return } + dividerDrag = nil + isDraggingDivider = false + let widths = displayedVisibleOrder.compactMap { splitView.roleHosts[$0]?.frame.width } + let snapped = snappedWidths(widths) + if zip(widths, snapped).contains(where: { abs($0 - $1) > 0.5 }) { + animateVisibleWidths(snapped, duration: snapAnimationDuration, in: splitView) { [weak self, weak splitView] in + guard let self, let splitView else { return } + self.captureReadableWidths(in: splitView) + self.persistRatios(in: splitView) + self.reportFrames(in: splitView) + self.applyPendingWork(in: splitView) + } + } else { + captureReadableWidths(in: splitView) + persistRatios(in: splitView) + reportFrames(in: splitView) + applyPendingWork(in: splitView) + } + } + + private func snappedWidths(_ widths: [CGFloat]) -> [CGFloat] { + guard widths.count >= 2 else { return widths } + let snapIndices = widths.indices.filter { widths[$0] < railSnapThreshold } + guard !snapIndices.isEmpty else { return widths } + var target = widths + for index in snapIndices { + let released = max(0, widths[index] - railWidth) + target[index] = min(railWidth, widths[index]) + guard released > 0.5 else { continue } + let recipients = widths.indices.filter { $0 != index && !snapIndices.contains($0) } + let recipient = recipients.min { abs($0 - index) < abs($1 - index) } + ?? widths.indices.filter { $0 != index }.max { widths[$0] < widths[$1] } + if let recipient { + target[recipient] += released + } + } + return target + } + + private func applyVisibleWidthsImmediately(_ widths: [CGFloat], in splitView: StableDocumentSplitView) { + let frames = visibleFrames(order: displayedVisibleOrder, widths: widths, size: splitView.bounds.size) + for (role, frame) in frames { + splitView.roleHosts[role]?.frame = frame + } + let dividers = dividerFramesForOrder(displayedVisibleOrder, visibleFrames: frames, size: splitView.bounds.size) + updateDividerFrames(dividers, animated: false, in: splitView) + reportFrames(in: splitView) + } + + private func animateVisibleWidths( + _ widths: [CGFloat], + duration: TimeInterval, + in splitView: StableDocumentSplitView, + completion: @escaping () -> Void + ) { + let frames = visibleFrames(order: displayedVisibleOrder, widths: widths, size: splitView.bounds.size) + let dividers = dividerFramesForOrder(displayedVisibleOrder, visibleFrames: frames, size: splitView.bounds.size) + let animationToken = beginAnimation() + let finishAnimation = { [weak self, weak splitView] in + guard let self, let splitView else { return } + self.completeAnimation(animationToken) { + self.applyVisibleWidthsImmediately(widths, in: splitView) + completion() + } + } + NSAnimationContext.runAnimationGroup({ context in + context.duration = NSWorkspace.shared.accessibilityDisplayShouldReduceMotion ? 0 : duration + context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + context.allowsImplicitAnimation = true + for (role, frame) in frames { + splitView.roleHosts[role]?.animator().frame = frame + } + updateDividerFrames(dividers, animated: true, in: splitView) + }, completionHandler: finishAnimation) + DispatchQueue.main.asyncAfter( + deadline: .now() + duration + animationFallbackGrace, + execute: finishAnimation + ) + } + + private func beginAnimation() -> Int { + animationSequence += 1 + activeAnimationToken = animationSequence + isAnimatingLayout = true + return animationSequence + } + + private func completeAnimation(_ token: Int, completion: () -> Void) { + guard activeAnimationToken == token else { return } + activeAnimationToken = nil + isAnimatingLayout = false + completion() + } + + private func handlePendingExpansionRequest(in splitView: StableDocumentSplitView) { + guard !isAnimatingLayout, !isDraggingDivider, + let request = pendingExpansionRequest, + request.id != handledExpansionRequestID else { return } + pendingExpansionRequest = nil + handledExpansionRequestID = request.id + guard let requestedIndex = displayedVisibleOrder.firstIndex(of: request.role) else { + onExpansionRequestHandled?(request.id) + return + } + let widths = displayedVisibleOrder.compactMap { splitView.roleHosts[$0]?.frame.width } + guard widths.count == displayedVisibleOrder.count else { + onExpansionRequestHandled?(request.id) + return + } + let target = expandedWidths(widths, requestedIndex: requestedIndex, role: request.role) + animateVisibleWidths(target, duration: layoutAnimationDuration, in: splitView) { [weak self, weak splitView] in + guard let self, let splitView else { return } + self.captureReadableWidths(in: splitView) + self.persistRatios(in: splitView) + self.reportFrames(in: splitView) + self.onExpansionRequestHandled?(request.id) + self.applyPendingWork(in: splitView) + } + } + + private func expandedWidths(_ widths: [CGFloat], requestedIndex: Int, role: WorkspacePaneRole) -> [CGFloat] { + guard widths.indices.contains(requestedIndex) else { return widths } + let total = widths.reduce(0, +) + let minimum = minimumPaneWidth(total: total, count: widths.count) + let maxRequested = max(minimum, total - minimum * CGFloat(widths.count - 1)) + let requested = clamped( + max(recentReadableWidths[role] ?? defaultReadableWidth, readableWidthThreshold), + min: minimum, + max: maxRequested + ) + let remaining = max(0, total - requested) + let otherIndices = widths.indices.filter { $0 != requestedIndex } + let otherDesired = otherIndices.map { widths[$0] } + let allocated = normalizedWidths(otherDesired, total: remaining) + var result = widths + result[requestedIndex] = requested + for (offset, index) in otherIndices.enumerated() { + result[index] = allocated[safe: offset] ?? minimum + } + return result + } + + private func captureReadableWidths(in splitView: StableDocumentSplitView) { + for role in displayedVisibleOrder { + guard let width = splitView.roleHosts[role]?.frame.width, width >= readableWidthThreshold else { continue } + recentReadableWidths[role] = width + } + } + + private func persistRatios(in splitView: StableDocumentSplitView) { + let widths = displayedVisibleOrder.compactMap { splitView.roleHosts[$0]?.frame.width } + guard widths.count == displayedVisibleOrder.count, widths.count >= 2 else { return } + let usable = max(widths.reduce(0, +), 1) + isWritingStoredRatios = true + if widths.count == 2 { + halfSplit.wrappedValue = clamped(widths[0] / usable, min: 0, max: 1) + } else { + firstSplit.wrappedValue = clamped(widths[0] / usable, min: 0, max: 1) + secondSplit.wrappedValue = clamped((widths[0] + widths[1]) / usable, min: 0, max: 1) + } + DispatchQueue.main.async { [weak self] in + self?.isWritingStoredRatios = false + } + } + + private func reportFrames(in splitView: StableDocumentSplitView) { + let order = displayedVisibleOrder + let frames = order.compactMap { splitView.roleHosts[$0]?.frame } + guard frames.count == order.count else { return } + DispatchQueue.main.async { [weak self] in + self?.onFramesChange?(order, frames) + } + } + + private func dividerFramesForOrder( + _ order: [WorkspacePaneRole], + visibleFrames: [WorkspacePaneRole: CGRect], + size: CGSize + ) -> [CGRect] { + order.dropLast().compactMap { role in + guard let frame = visibleFrames[role] else { return nil } + return CGRect(x: frame.maxX, y: 0, width: dividerWidth, height: size.height) + } + } + + private func clamped(_ value: CGFloat, min: CGFloat, max: CGFloat) -> CGFloat { + Swift.min(Swift.max(value, min), Swift.max(min, max)) + } +} + +private extension Array { + subscript(safe index: Index) -> Element? { + indices.contains(index) ? self[index] : nil + } +} diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 1cd59f378..e88e87cfd 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -11,6 +11,65 @@ func expect(_ condition: @autoclosure () -> Bool, _ message: String) { } } +let paneTransitionSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/ContentView.swift") +let paneTransitionSource = (try? String(contentsOf: paneTransitionSourceURL, encoding: .utf8)) ?? "" +let stableDocumentSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/StableDocumentWorkspace.swift") +let stableDocumentSource = (try? String(contentsOf: stableDocumentSourceURL, encoding: .utf8)) ?? "" +let paneContinuityRecorderSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Support/PaneContinuityRecorder.swift") +let paneContinuityRecorderSource = (try? String(contentsOf: paneContinuityRecorderSourceURL, encoding: .utf8)) ?? "" +let documentPaneTransitionSource: String = { + guard let start = paneTransitionSource.range(of: "private func documentPaneLayoutView() -> some View")?.lowerBound, + let end = paneTransitionSource[start...].range(of: "private func threePaneReorderOverlay")?.lowerBound else { + return "" + } + return String(paneTransitionSource[start..<end]) +}() +expect(!documentPaneTransitionSource.isEmpty + && documentPaneTransitionSource.contains("StableDocumentWorkspace(") + && !documentPaneTransitionSource.contains("switch order.count") + && !documentPaneTransitionSource.contains("ResizableTwoPane(") + && !documentPaneTransitionSource.contains("ResizableThreePane(") + && !documentPaneTransitionSource.contains(".transition(WeiBeiTransition.layout)") + && !documentPaneTransitionSource.contains(".transition(WeiBeiTransition.rightPanel)"), "ordinary pane-count changes avoid whole-surface transitions that expose a blank frame") +expect(stableDocumentSource.contains("WorkspacePaneRole.allCases.map") + && stableDocumentSource.contains("splitView.install(roleHosts: roleHosts, emptyHost: emptyHost)") + && stableDocumentSource.contains("animator().frame = frame") + && stableDocumentSource.contains("private let layoutAnimationDuration = 0.24") + && stableDocumentSource.contains("private let snapAnimationDuration = 0.18") + && stableDocumentSource.contains("private let animationFallbackGrace: TimeInterval = 0.25") + && stableDocumentSource.contains("guard activeAnimationToken == token else { return }") + && stableDocumentSource.contains("host.frame = CGRect(x: target.minX, y: 0, width: 0") + && stableDocumentSource.contains("func assertStableOwnership()") + && stableDocumentSource.contains("roleHosts.values.allSatisfy { $0.superview === self }") + && stableDocumentSource.contains("host?.isHidden = !visible.contains(role)") + && stableDocumentSource.contains("applyVisibleWidthsImmediately(widths, in: splitView)") + && !stableDocumentSource.contains("removeFromSuperview()") + && !stableDocumentSource.contains("rootView ="), "document pane hosts stay in one AppKit container while slot frames animate and hidden panes pause drawing") +expect(stableDocumentSource.contains("recordContinuityTransition(duration: layoutAnimationDuration)") + && stableDocumentSource.contains("host.layer?.presentation()?.frame ?? host.frame") + && paneContinuityRecorderSource.contains("WEIBEI_VERIFY_PANE_TRACE_DIR") + && paneContinuityRecorderSource.contains("let recorderID = UUID().uuidString") + && paneContinuityRecorderSource.contains("1.0 / 60.0"), "debug verification records pane presentation frames and host ownership throughout each pane-count animation") +expect(!paneTransitionSource.contains(".animation(WeiBeiMotion.panel, value: store.showReader)") + && !paneTransitionSource.contains(".animation(WeiBeiMotion.panel, value: store.showAgent)") + && !paneTransitionSource.contains(".animation(WeiBeiMotion.panel, value: store.showNotes)") + && !paneTransitionSource.contains(".animation(WeiBeiMotion.panel, value: store.showRightPane)"), "ordinary pane toggles do not animate the entire layout tree") +let paneToggleClusterSource: String = { + guard let start = paneTransitionSource.range(of: "private var paneToggleCluster: some View")?.lowerBound, + let end = paneTransitionSource[start...].range(of: "private var agentPaneToggleHelp: String")?.lowerBound else { + return "" + } + return String(paneTransitionSource[start..<end]) +}() +expect(!paneToggleClusterSource.isEmpty + && !paneToggleClusterSource.contains("withAnimation") + && paneToggleClusterSource.contains("store.toggleReader()") + && paneToggleClusterSource.contains("store.toggleAgent()") + && paneToggleClusterSource.contains("store.toggleNotes()"), "top-bar pane switches update visibility without wrapping the container replacement in an animation transaction") + let offlineChinesePreview = AgentOfflinePreview.render( AgentOfflinePreviewInput( language: .chinese, @@ -766,8 +825,6 @@ expect(contentViewSource.contains("private let railWidth = ContentRailMetrics.ra expect(!contentViewSource.contains("DragGesture()"), "content panes avoid SwiftUI drag resizing") expect(!contentViewSource.contains(".id(store.layout)"), "layout changes avoid whole-screen identity resets") expect(!contentViewSource.contains("PaneSeparator"), "content panes avoid hand-drawn split separators") -expect(contentViewSource.components(separatedBy: ".transition(WeiBeiTransition.rightPanel)").count >= 5 - && contentViewSource.components(separatedBy: ".transition(WeiBeiTransition.layout)").count >= 3, "right-pane visibility changes use shared transitions instead of naked tree swaps") expect(!contentViewSource.contains("topBarContentFade"), "top bar avoids a duplicate content fade wash") expect(contentViewSource.contains("store.toggleLibrary()") && contentViewSource.contains("sidebar.left") @@ -1614,6 +1671,13 @@ expect(workspaceStoreSource.contains("let sampleItems: [StudyItem] = WorkspaceSt && workspaceStoreSource.contains("scenario == \"offline-learning-flow\"") && workspaceStoreSource.contains("scenario == \"immersive-conversation-flow\"") && workspaceStoreSource.contains("scenario == \"notebook-creation-flow\"") + && workspaceStoreSource.contains("scenario == \"pane-layout-stability-flow\"") + && workspaceStoreSource.contains("pane-layout-stability.complete") + && workspaceStoreSource.contains("WEIBEI_VERIFY_PANE_ORDER") + && workspaceStoreSource.contains("\"agentDraft\": agentDraft") + && workspaceStoreSource.contains("\"noteText\": noteText") + && workspaceStoreSource.contains("showAgent = true\n save()") + && workspaceStoreSource.contains("showNotes = false\n save()") && workspaceStoreSource.contains("layout = scenario == \"immersive-conversation-flow\" ? .immersiveConversation : .documentAgentNotes") && workspaceStoreSource.contains("if scenario == \"notebook-creation-flow\" {\n layout = .immersiveWriting") && workspaceStoreSource.contains("showLibrary = scenario != \"immersive-conversation-flow\"") @@ -2163,9 +2227,9 @@ expect(contentViewSource.contains("edge: .leading") && contentViewSource.contain expect(contentViewSource.contains("conversationSourceRailItems") && contentViewSource.contains("conversationTargetRailItems") && contentViewSource.contains("writingAssistRailItems"), "immersive rails wire role-specific actions") expect(contentViewSource.contains("systemImage: \"square.and.pencil\"") && contentViewSource.contains("systemImage: \"quote.opening\""), "immersive rail actions use stable semantic icons") expect(contentViewSource.contains("@StateObject private var paneHostRegistry = PersistentPaneHostRegistry()") - && contentViewSource.contains("private final class PersistentPaneHostRegistry: ObservableObject") - && contentViewSource.contains("private struct PersistentPaneHost: NSViewRepresentable") - && contentViewSource.contains("private final class PersistentPaneContainerView: NSView") + && contentViewSource.contains("final class PersistentPaneHostRegistry: ObservableObject") + && contentViewSource.contains("struct PersistentPaneHost: NSViewRepresentable") + && contentViewSource.contains("final class PersistentPaneContainerView: NSView") && contentViewSource.contains("override func viewDidMoveToWindow()") && contentViewSource.contains("guard container.window != nil else") && contentViewSource.contains("PersistentPaneHost(role: .reader, registry: paneHostRegistry)") @@ -2173,18 +2237,18 @@ expect(contentViewSource.contains("@StateObject private var paneHostRegistry = P && contentViewSource.contains("PersistentPaneHost(role: .notes, registry: paneHostRegistry)") && contentViewSource.contains("host.removeFromSuperview()") && contentViewSource.contains("host.autoresizingMask = [.width, .height]") - && contentViewSource.contains("private struct OwnerToken: Equatable") + && contentViewSource.contains("struct OwnerToken: Equatable") && contentViewSource.contains("func registerOwner(for role: WorkspacePaneRole) -> OwnerToken") && contentViewSource.contains("guard latestOwnerGeneration[role] == owner.generation else { return }") && contentViewSource.contains("guard activeOwners[role] == owner, host.superview === container else { return }") - && !contentViewSource.contains("paneView(for: drag.role, reorderable: false)"), "core pane hosts survive immersive, single-pane, and split-layout changes instead of recreating their reader or editor state") -expect(contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent:") + && !stableDocumentSource.contains("removeFromSuperview()") + && !stableDocumentSource.contains("rootView ="), "core pane hosts survive immersive changes while ordinary pane-count changes keep one stable parent container") +expect(contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent, .documentNotesSplit:") && contentViewSource.contains("documentPaneLayoutView()") - && contentViewSource.contains("reorderablePaneView(for: order[0])") && contentViewSource.contains("PaneReorderPreviewView(role: drag.role)") - && contentViewSource.contains(".opacity(drag?.role == role ? 0.08 : 1)") + && stableDocumentSource.contains("host.alphaValue = role == draggedRole ? 0.08 : 1") && contentViewSource.contains(".opacity(0.11)") - && contentViewSource.contains("PersistentPaneHost(role: role, registry: paneHostRegistry)") + && stableDocumentSource.contains("PersistentPaneHost(role: role, registry: registry)") && contentViewSource.contains("private struct PersistentPaneRoot: View") && contentViewSource.contains("AgentPaneView(showsPaneHeader: false, reorderRole: reorderRole)") && contentViewSource.contains("NotePaneView(showsPaneHeader: false, reorderRole: reorderRole)") @@ -2193,13 +2257,14 @@ expect(contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent && contentViewSource.contains("threePaneReorderOverlay(order: order") && contentViewSource.contains("private func documentPaneLayoutView() -> some View") && contentViewSource.contains("let order = store.visibleDocumentPaneOrder") - && contentViewSource.contains("EmptyWorkspaceView()") - && contentViewSource.contains("documentTwoPaneView(order: order)") - && contentViewSource.contains("documentThreePaneView(order: Array(order.prefix(3)))") - && contentViewSource.contains("let estimatedFrames = threePaneFrames(order: order, size: geometry.size)") - && contentViewSource.contains("store.threePaneReorderFrameList(order: order, fallback: estimatedFrames)") - && contentViewSource.contains("onFramesChange: { frames in") - && contentViewSource.contains("ThreePaneReorderFrameReporter(order: order, frames: estimatedFrames)") + && contentViewSource.contains("StableDocumentWorkspace(") + && contentViewSource.contains("let fallbackFrames = estimatedDocumentPaneFrames(order: order, size: geometry.size)") + && contentViewSource.contains("store.threePaneReorderFrameList(order: order, fallback: fallbackFrames)") + && contentViewSource.contains("onFramesChange: { reportedOrder, frames in") + && stableDocumentSource.contains("EmptyWorkspaceView().environmentObject(store)") + && stableDocumentSource.contains("addSubview(emptyHost)") + && stableDocumentSource.contains("for role in WorkspacePaneRole.defaultThreePaneOrder") + && stableDocumentSource.contains("addSubview(host)") && !contentViewSource.contains("case .documentAgentNotes:\n if store.showRightPane"), "document pane layouts render from the visible pane set and one draggable pane role order") expect(paneHeaderReorderSource.contains("struct PaneHeaderReorderModifier") && paneHeaderReorderSource.contains(".textSelection(.disabled)") From 513a7617eb2a3411ef7f9fd602519be24b339c8b Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Fri, 10 Jul 2026 18:06:55 +0800 Subject: [PATCH 05/36] feat: add empty workspace to stable pane host --- Sources/WeiBei/App/WeiBeiApp.swift | 55 ++++ .../Calligraphy/lanting-clear-breeze.png | Bin 0 -> 33121 bytes .../Calligraphy/lanting-universe.png | Bin 0 -> 21912 bytes .../WeiBei/Resources/Inspiration/SOURCES.md | 34 ++ Sources/WeiBei/Stores/WorkspaceStore.swift | 57 +++- .../Views/EmptyWorkspaceLauncherView.swift | 294 ++++++++++++++++++ .../Views/StableDocumentWorkspace.swift | 2 +- .../EmptyWorkspaceInspiration.swift | 178 +++++++++++ Sources/WeiBeiCore/OpenAIAPIKeyStore.swift | 28 +- Sources/WeiBeiCore/WorkspaceModels.swift | 4 +- Sources/WeiBeiSelfCheck/main.swift | 229 +++++++++++++- script/build_and_run.sh | 88 +++++- 12 files changed, 936 insertions(+), 33 deletions(-) create mode 100644 Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png create mode 100644 Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-universe.png create mode 100644 Sources/WeiBei/Resources/Inspiration/SOURCES.md create mode 100644 Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift create mode 100644 Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index 4e59a66f1..11f6ec06b 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -335,6 +335,45 @@ private struct WindowChromeConfigurator: NSViewRepresentable { window.isOpaque = true window.backgroundColor = appearanceMode.windowBackground window.isMovableByWindowBackground = true + applyVerificationWindowSize(to: window) + captureVerificationWindowIfRequested(window) + } + + private func applyVerificationWindowSize(to window: NSWindow) { + let environment = ProcessInfo.processInfo.environment + guard environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1", + let rawSize = environment["WEIBEI_VERIFY_WINDOW_SIZE"] else { return } + let parts = rawSize.lowercased().split(separator: "x", maxSplits: 1) + guard parts.count == 2, + let width = Double(parts[0]), + let height = Double(parts[1]), + width >= 600, + height >= 400 else { return } + + let target = NSSize(width: width, height: height) + let current = window.contentLayoutRect.size + guard abs(current.width - target.width) > 1 || abs(current.height - target.height) > 1 else { return } + window.setContentSize(target) + window.center() + } + + private func captureVerificationWindowIfRequested(_ window: NSWindow) { + let environment = ProcessInfo.processInfo.environment + guard environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1", + let capturePath = environment["WEIBEI_VERIFY_CAPTURE_PATH"], + !capturePath.isEmpty else { return } + + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + guard !FileManager.default.fileExists(atPath: capturePath), + let contentView = window.contentView else { return } + let bounds = contentView.bounds + guard bounds.width >= 600, + bounds.height >= 400, + let bitmap = contentView.bitmapImageRepForCachingDisplay(in: bounds) else { return } + contentView.cacheDisplay(in: bounds, to: bitmap) + guard let png = bitmap.representation(using: .png, properties: [:]) else { return } + try? png.write(to: URL(fileURLWithPath: capturePath), options: .atomic) + } } } @@ -682,6 +721,22 @@ struct SettingsView: View { } } + settingsRow( + title: store.ui("每日灵感", "Daily Inspiration"), + detail: store.ui("只控制空工作区里的出处内容;文稿、对话和笔记入口始终保留。", "Controls sourced material on the empty workspace only; document, chat, and notes entries always remain.") + ) { + Toggle( + "", + isOn: Binding( + get: { store.showDailyInspiration }, + set: { store.setDailyInspirationEnabled($0) } + ) + ) + .labelsHidden() + .toggleStyle(.switch) + .tint(WeiBeiTheme.cinnabar) + .accessibilityLabel(Text(store.ui("显示每日灵感", "Show Daily Inspiration"))) + } } } } diff --git a/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png b/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png new file mode 100644 index 0000000000000000000000000000000000000000..50305cc8bfb00ae496ecdb36bfe565605e8d6ad0 GIT binary patch literal 33121 zcmce+Wmg<bv@RGRxD%vtcL?qdP2=tacMH}KJh;0%1c%`6?(R--Xxv@zduG<0`wwP+ zs8wHT%d@R&?Fv^`ltM)!K>G6K3#yDXQ1#0f814V|K?rdFt<jMY#$Uep)5!qE)ZMer zec&6+Bv*glM<?PNL8BN0cE2PTkLZZzQ;7uxP{~l_=Z8^5e8v0?C8jP45=E2+g+nI< z?h_>m?sLkwmAzJaI$S<Fh@1vptoyXTZm!v8FY>tL3PaQvwG20M!I=Ml)4eE^6!3p( zfK03$Tvf1%$2PDtOh)k^nIKSluK&*_gOGWuH6LuR0@-jgHhS)6KFbmq;CoEzpv~ug zwHoDXrid!1%?4*rwN`l=YX2`sAkf2V_%v^-l?1Y(2T+xKyNK=H7V1B7&kn?o0$f0{ zyf*ooD+L`KRzUyv3}?KPs~@;(nQu8-8Yxz|<71q!nS66ybNH0F!fH@k-gQd<Fw2X0 zC?(O7q+arWwEKUF0Kl0P156qt&=T~-m~2Cn{T*ep$Q{ub1-1_XUr0bU(6hmm`$Feo zRybD#1wZ~T)~LYznnLgeH(Ox>3e%^jknlIuinTvq3fzPt8$1WkxrbRl=&uZj$E~a+ z|5wWeK3!GOyRj0eDLK|E*)W6TIPoX7XK&znegxrm`t;zb{!}YWHrSRA0@@Q2uH#Y_ z9v{(^r;Z8>3j=%&dw%*K>64?n%gBRSA?ng%EIkOe!2y?;lr)V{xu2F(t!~-iJxs9; zjL^?l{Ha#2Y;ZY+`IRnYBQoBJ_5U-NB460(?$`*j!35bjOFGh!L1Fv!Ea#H~y5<d? z<4xXPV$NX_8sEi_I6djL$EE(S?m*xIhFL-8e<126-N9#pr34@!b|?(vG*40B3ox&i zUC0l@2Bg(sg?V|oox9<+sn*IYu<gjR$(Ygq@VGy?bDnBFCwIV$h#CIR9wuP0-Bm!D zPY&9fz*OtcEby%WWT@}yrLF9}7H;X=R4esFD}{}zk%G7j+hj{!s1o@b(oh1I&i~_p zcPTN|10|QKPSgF%+$=Eih!-WriLNaMt?_%@{TU-MsbNre9oQb0?$Th}MbkYRvr#Nk zhO(fxp%#3>On09VGZePO?CwA`y_OG4_<WN<u#$>7m{0ydkZ(xRf9g&8KSBb-9d;cl z-RLuqlLQsB%v8FgpIB;!WvO%LKbX!D(%1Tz;2R=`x$=dtrhOy8_Bugr$HAlGVg^2_ zBNlWm%}Cn^Q>|==9GKCP=ohtB;EOGPPO*<StqvB3i^kxpcrSCx=?IHi1g|B&W@=&5 z=$*q*TF&d1|I*{Xpkk}gfcGHA#8eTOG0F&Gis=$1@L}1%RkQNl#dOUMTaa0_CeWR$ zUyJ$8E66`yF}||E*Nl$sDM^WEWxEhPWLm$N=hz$TkFf$}>Xe0v+ckS^2H7y7hwNru zjXm2>wJJ%Do+bxUAxZJ<+!8SS@o&VW(EeLd?tf4A!l`i*6h4AJmac)BTxXi#;<B^o zaF=OnN4f3*?t2t@{W0Y3MmfksL6QG5a~7jz_U~OSYgAILL~ziXn_~A<DMV5so-<yf z2QuGFWW%}SG?jgp)jq`MhGXF2uDb)t0z2flZ1S+a=gG@1`++nGqXL!Hrl)Awh)Qdi z{n%;=UD0Fg_vj603z7e7SqMjE`)(0=3-6of25K2%5G3CYNo2}kHjD}S{#NY(JE7Pj z>szk#LoCMlC)w-Ls+_TeNei?mp|;kecx$89+7q7b{tLa&StPy=ESJT6-l$HF8*L}i zxmwq(qp|lGBgyHNZ85}eHfY@YxqJ{BUdZpAEHA`}M@Jyn5_qZ-j=CIS&<ArySjlg9 zGKbIlD);(HFsYp<3(V8=#i%;Rvw&DO+Jr~%mFvoe7kHBvdzvd#kcSh{^Ekgsu)M+u z7h7e{;QVokN5Q#ifAJG`B0l@i4C?fgy@;=-+tk0PTtahi$`8CK`5%s1ZJ1?Ir9w{= z0&y80-%Ic5E$g!QedfY=tLle_*jG&7H(v!flfUCZ1RxI;y^WH<1(;xhF=hf`YluVO z@BKj3RFmkbz_(5`5eFK`&i!VPPePj$aNrZ3=Vv#Y?-rjMSK45e%T)Gp)+;lGGU@)^ z-$^-M&%)+$!CQP)v1I|@M#(6++%fkI@P&Fu7ZmIeVZc_PN}1I{7_JawcL>G^frtnQ zvh&-@FWS%lxi-pai4Op!^9>R<8#@HOyyiH8T1*oBV)Xnt6gJY6=cn**nRnBE?#ukX zJ)-F`=5Zh)p>0^a`pNM1Isevw&BK><X23GI$IVt|LK~oEW_4ff_8<NM6Q>50v6m9o z!BPuO6ah8g`j?M3j{ht72)C<YdJ}^oo59QWL>?!woUqm;Q;X5R1@DV@sg?p%tgCg@ zb~=`w@PMIde^ne{*bvoYeB%m6&q8VL2kK#RsI7giK^ZZhuT!m|*UzBe+!FZm<L?<V z9D8~!6dA|zljdIHCw9R5*VOaVEU#riXI`M`qsWst9RvO>;A(2ZGz;u@H{Y_GSN8B< z0fuh(jgo#g^xb|eFA5rAJl^<L#6oqi>Ptj+`3&<Rf?WN&cNtGEK%vzcqu7N;r#&6v z6d$_!H!F}!@RDZXZGphE8<}kPCd-}G3YfrFyiS+zK*{39HoEl_$m)8u>Q`%3fGd^f zaeRT*IL1EVxqmNA7lIj$`k=7J)7x`Xt+nk_fHl`&5U(LHBYlGpo0~S`nBade_a8<t z`D8x(f)BXU?u{{8r|!O(n8|<0K*@%rnY<81smWiPozzO}_@Q<MQt{DZLL+$<<_yxo z+(2dj7_$@c`8>QPe3(dE_j<oTVG0UNl=KAIY|QLT`HVjg#>dtE8VPMQ2K}NNv^$q> z9pH-+XMG)dK6%%|zP<Sq0xqu5J@--sIDubp@BDe^O~Yy!tn-pz?#HHc2KK*tG@YZ` zIihJe3J%F-%x!{XAX&fhCURd^g?3z4VO`TnoWNzoM~gyCMqj01%CBp`W_SsVek~pB zmG=(|1BINxF!j6lP8>)?tL3W_=aaoARy%o5^SPmotZI(*E<N)s7&k@`bph|Xm6S~l zG^9+aS^*o%!RyA(LKj)D(D?-On6i~AyLuS?W@!sp3k1}8ERR8iQhqK4Y4gey<7AXS zs0IOHwk&vhZ=n=eDo9a=P!YGkrQrpTHi_Bkr=XulBb6T>FzUX=`u>NbKl#)h8-W34 zG)&B}U7?dF%jTR#j-&lu!06PY7C+&qA%?AmR1NxXV$5+(fCc7aFeywZ-C%oM=U@`5 zP*w9#pHy7@Ab~(8jsG<VMSlD&G=8J7O*SrOV3FT4c*g5QJMMkvxcXHNJ}Zbr)r{nG z6CVD_mTV&f{Y4h4dg0%iF=wOy%5nRQ6rOl-f&|>R%l_)~7Ko%eY~`+N3pvK<U(O6k zht}K~FW96GT|ZDSyRzQR3|T1JT&4)s<{L;Z-6oZ8&<oLY5mhX?B=79{2?cehxrgZ} zI3+Nis6cZPieP$+!*r|wPxk#4@ph{^`+&e@6CHOZuN68Ak0`YeA;rzlW8lc?{d$oA zRB^V0s6s(OklhlBuW~t(V>+MHz7MHRyLHT6MOx+jY2H+B9I@5vs9BVU`W1I?e@zL; zV;!|CfIN8+b4`60H1B)FK@>RJ+O>MNswG1>eaKaFNG?97S-{4aR=S`inz){;5G_0D zq5Tw{k|LowU~Z&$d|T`!KNq2o*_z)RhB?UgwEi{{Z{f@6yTN?SBF`9YMdD(T6)VkJ zbEn*&rLwMNRs~#uTT|Vka|+XzXhA@)bSrcpXw(*wClKwA_^%cfjInS9&=jEf>xjtQ zwraUV`zRA`(Zi+0e*dQi0uhVwtQEqMkSnxH8MB;X>yO|klpr6}^O#niKErd}(Ucgm za-nnNzg#I;Yl$JLP!q!7d?@|dZ`L$2qGoHUd5ViD9A2aQrC#k#J=<)b_tP+6Y~Hey z)d`UK-Sn!?7Y}t{Mt4`6$^IxvM06qIOhZ_NkDrYIPY?dQ&ZAVN0eQ$((I~N?M3JYH z1aMZk9b4D<;FUqzP8v?hNF}ia5`gUzF)?D(L`cYYTI5wGu+Q8jeXLx|Tdas?&I0>R z?@Tbl=Ii8=31wfE9ZRKJuQ-xS#5Vl8u>K50f$E|K9!yQ-Y>hYSGpp2yiNrqrc}FFs zN8brGF$dY~d<J3ZB*AEOWwSQgg$$)F2OhrF5y7Dd?ftuAY7l!K2kZX@HiYl4knj#$ z0Y`FB>1dLPz)t_R`ko0VBd0yOs7Gj5%vS2iUixe;bCNeBNvC~xI!Oz7)>3YWmrlPe zYnghW%`eSij<|km8D+0=l@pq<l>QSk@vT@BrySeDfyBh1qE@}eYs`dA<@83W&|5b& z3VY*%fX=#UC-js(52wR&n8d)wes9N@IHErOkhJ@xV#?nk%aQ}qH$_Ove$GyaNj%;Z zo!UI|bSgV~1hAoP7FRQ^!lm~l-{Wv*uq(_2>$*s%+ipI@-dPz$ErSW!lUp7{)ot<P zr1sg&T%2YBzob><%BijVXBwc@YEcBSm&aTSi&zqfSs6Ry!KVVnVoseZ7_qaDwbzeu z+L$6=jwR>dIB*q;<&0kV2)LY)jiTn3X8t@La{9B|4-c0(e+=<GB2cvO`1MfyWHvxV z`caqrFJy~nFhgxv19;xEu=f*YsER;uIe#lsiYRf-l<RtAdGBgK0&_Jj>?}=Abk2ou ze<!stgmVc^3*I}#K<SAcCBegS>ZQxUcVKH_Hk;>%mDqDmqVl*#`1dU&pK~kIo=Ld% zZEw);CTW`KKxh3fnqS7ZIb!geX<7}2sWdgd?3wYt?!&!-dAWpRkv(`w-&uSe(C_-j zBA5J3nmrX^<f1dj$xs%z<v40W$X$m@T8V?a^^vCMd&CRIOqKeeFUG_s?Wb?agQO`X zYd8yi@)r!^rT3e|u3l>0{5iwXY94Dw8!m&3o}lMoQ$;@u4R`r+V{%iIZb1tqF3#Gt zqu#7FEFts9*+H&WuWQ$k*rFUuCc1xk$+vF#qZHA10JgI8Cr`dd1ykkgKO7_VBR|nv zt!xn}{@Q8_=}Sr++noJ~O?u|zR*Zf!bexJ6%f3g?0yh^5N{|Mp;XZi-&HsEfW4l~2 z#u2o{11Qm6N7Gq7SyB-k*~D0wb_DloNdK_}3HOgr6dDn1?*e?!eHKwe%xD+R7R+%I z7y7X7=-{B>sMG#7ed(w~?}w)T9Sz@WQA_RaB!zbU_Jcu!C%<(qXYQNSmRcF+S~#R# zF&z#!_Hjn(n9*6klKycgvip-hV)(XCRbtPR8`q{fs7PicZ|j{R%_4_wOwOt|7Zzz6 zBqy}!(Fw(!e#$yUeE7V|#fk-5nMFufn_(4iCeAl>ljQ*mO$C;W9<oa<gft8yJ!-JQ zO;Z6&nMP%--kl1_<<wLIjdQWQS+KD|(-eP^FVqZ--&*5EmZWp6A4J~0fv%2X$x(kH z<d!%G-oHcn|M?aaND}$~nm+u!1(O}8Ls#9agI%D#C?OYN4`7$Rke+RhaQFENw?6pv z&K7RN=A4VSK+7|fWpoV0Y#QJ_5~2by{K3B&ch)z!qzXX=(Ne-YVXX)qh5ymugF}y@ zHwO3UcVA#U*3G-~YojPRq&uJncNECl`4Flb8LiUIQ6j*$2L-P(nEo~ip77he^%B5s zy}aC0ZcklUsYgb>M!xwMjqs0Y!7E8Kb>5^cJ2u7A7dH#=!qnz8(a$D_QlHn>WrHer zQisl+)1Jpvng={EiHVxk;}buwQQ!7?Ni=~6GO~!FV}%;f&?5PRfcIk0bqWDdOk-P$ z!5n7f1^d9kTHlst*^os-=^t)Z=hu>N6Td}0&>qgirD^VTzV0i6flg>ba@1GXKBPkV z1*QB(ZT#6T%ob50<cr>Hvy7hLDyWmB)Lz8P;dY`K`mVAO#k$&;v*_$A;eX3biBV)- zmzE<0+D0{rJ}T++*v-K+1!3s1k>L^7%9>wVtx01@q%(dw^ExNuQ%u4LgGFYWq>$F2 zZ~)rgzRm924shY1xiq%MS>s-Jnv#<3pYDj+eTE?QQ)XaU&fwN%Y6ExvHx*JW3GJN; z*j7SZbxOt*0)07?A1KBxg7Y}WekV^W3v~&s6Dqu@{IQBSGh1QM!_I;fcTo)~K{6L& z^CcB})N!Zx`tIkrQbAA5Y+X6Mk53I}rqIiHDniO#XBkFDW%*BTamH^@$DNz~gv-VU zM#zC5B;Cm&n-Ra<$D5h<^e~UD@Pc_qW&Xl{cC!oPnQOboHBMjivB3LOCgm|E%r>oe zJX-S^8d&n&k5ooGNy1D&hPXI)Y4YN=L$^)8s*dxR!6n&I7Lr*+E2wxrqTEM^5<arI zf6v87?{hLSGe;zzRC^b|g?U9)UklO>-m1L%wZbOXUiItt_HZN@-QNKBd#OVh#W$Ov zW!l*)5Lb<Mq>5r&2~ye42-rf5L5)dbZ-5RLRVg;Ft83v0j~+!kRY=*ujE&UngJH0{ ziCoQaCEDeaSs_wYD8V?_)h9EnB~S0=X+P#ov*?Kqiw#OFh{0%$z=z=Z$Sjp;ET&x7 z@7CfG8-{UGTUgm_;m>`ICjPC~XpKpwE$$70ws55g1-=VKlU#UMrA`C98hj@VrO9>= z_TwxT!m%8nfGT~N+03*mDr9}5K(p^dvgBIusJtZnqXorgLWF%;8+a^(Sg4{q&U2(J z?d~^!^(Bp@;CWm^AF7bT$E;_*UuGYyek;hxkU&y0!cjd$GbnlYWvcpKNUdn4nZQ*< z9oPVo5Bs{ULRV`ahs{@K2&m1JftP2mcma-hqvXd|5HLNE;ZGpMcPan*R;V(~VfjNr zclJ;_GwSRCJ~ZuK3H@K>k<%mW+s~K@-}3^^0PrFGh9O`4T$o*44Fz*R@~;V~-e^m5 zs@*3l)5YHxTA`Vx_9SuYbf;JQT$roQH@7sd+{Z?dX;^hSoI=9+zh>Bz0^=kXQ@5ia zT`npCilaVO+3X`ex`i&gy0iCy(cPDSBdm#`D5Cr{hN4ZOIleP24X7}1Dd@zhrbeim z!Fdu%$Ey|rxA!+mptd#i$mo50O!07M?xF@dt?D2Xd}8tkzt9iSLTtrLOZ^4MjpbU< zYQr+0{>^W~No{3FpAdacYl@$7BgV<~rkrvi9|=J%gTKxd*f~esZ>)QEL=+C1l2xRH z{N#>8_0;=?DW0}(1k!5MQ))xMM}`kenf&os4Tr+SaA+tARr?`w{#3A`26T;bF_g>F z3{0kyTQ!aI{S>8Oi0<=Tv!YveKiDCRyPz$TJfOII1e%SH98hubGapP;MIWOs*qgJ~ z3(U#XFlSxo9<mxtg-pnrtYyIy4;(D8=@vGAn?HldB)O9xrEtTF96w=u#&a`~ELd>? zk!_4TkQ`_uhNci;ZaAzX$aEw($XMIf4)BGnY4~^`<?+t@6F%iCwY+oCTim%UC7TSV zLRkaDVa_v1=JhZU5S*t?k@VMb@p5bqT(j%Xb%494;pQpZpkONKOY+eUYm6M3m}9=4 znv<GcG=FBQYQAP(Z5tNcz}pRRMlq%?Wr-2$FBEaf*vC%XulN1##de3~gfBjH3Dh^B z`X{0HO33c5Wu@7Oz*7v6eLe~2<I<eZ4QOtK&KpM4>yBDEUQs|7W!=u>t_v1&GDx3Z zY!0j~ZNR0ReypYU1_JD~u8r`A7WG(ntIi3&ZIs`aa&~rz967}GCXk)O_^_Fsr2wa% zub-2>zlS?_!=vnYL=&20zDcK1w^q4HX~IEfBxYj8ZzJr+wgNX7&whyw!r_wsxo3~| zzxhDv2zt!>zJuZY8#>1N=~WGsXZK*)5T<PSkRj8+wOPU?%SqP+wN7$tIgcwRO|BN} z9(J?-y~!Zxnt2I$aZY1`Jv$;xK)FP#BWWtcxzGv3P1{7z9sj^Ox1n-?tu}|A18hkW zD~28XR8VdffeOxjTw#Xewmx61_u@Jnj3|C4g@oIGLH0Lzk##c5(ttWus`s1LCd4{v ztHJDDHTqPe1?7bh>PJq%8l0lF;4<tSFkEJ_P>+COt&Gh3`2|DLAx%&nb*W;A6)xVq zP4&Tz_N4^c<FNbpSP6$&kSA-@D#qzYo9VHzn(tswG~%GwjIFKMRB%$}iD9`W6({!m z5*>#Ufy|>Ly(exh|4>+)AwmD1V8?faLx*aCjtusy@f0?a1><h)mKZk`--+8zXo`lo zz{p3Z3*~aK0!NKEjAD5WlfU3hhxo%!V_2I*_%Y8k7<pl5m77sK1cY3lIG(By6@%%& zATeRl?s5m%Bxs?ReSr^n<j3(V?hSM?KG~B|S#80lX4qpfobv70=}?uMzZ1zOeXe%P zJ;w!S62FM6avP4#bOh0YvoF&PWHOeXoye%qoPg&;ML^eZ^E~V>>b-ZwrOD7Rmkt!@ zXpnbEvR~%E-WJHJHfcSKtpt9gEUR;D%I$*5Uc<CIHg|goma3RX_KO=o(b-ljw=d&e z2j(YViXLr6r<^SF2XubNU0RCQ-PrGCQ;Nj@qS7{8cMsPZO=;h!%I>fJPj70-qf}6@ zYlE%glF8UVshzMwwVIqi6Ahq6f|Y7tzvatuf?qJ&`K-|XVa{FUlOqkce<b#2@x0h# z=Kq^-+yr(PMpb_1GMa8J@Ttj5`{sr>;U(^*8KW~9z_<>8_YDaDZC6^O;^K62431YJ z+jbaZ<<0dTAtoa$M&b4P%}pq9x6WSBP0OH04hI2EQ0)}E*>k?ieT{Fj;*HOh^u)IP z8#A%`B^fhWabEsPYlu(;4~|T%C<GARR+%{S$*|um&v6%%>U|C(^fDjuz=fN%J?g!Y zA)8b}Ew5+A#ml!i;&kuCQ(&#&%>Ly8Y~EzWtQCxqs3+9s#A+UkztNR-{{UZYte3Yq zF+>_8n{DJd(rl!%El1Why`q%UnE%Pu66y7P<uQZJg)Lyu#>&P&b9IlxusIED;M~=$ zsLU2a{2(?yXOgKjb({KyCv)k6YT6|pAYoRz{oRZd<A<4`(vrG5;ZK}G8qgaL;ChRq zCm^dhRJqwW!&eS=tDQ+2YmI}5#$&2z1=IH4dwwNF3U7>jDkaCJksG5kiXTP9vZ%Kf z*h@Zt3T(KYfhh4UW-C9g1Z$c5{N^#2S7PDFPXiuIcfOKD!QAh?@3<64nfIU20!8c_ zbl)-p?h$Q_RN`A_YOYZvUbbfQ<qPpq-bC<9D`jkGW{y^nB6xE#FMV-UDZ0>QkI-T6 ziaoHUHTW-+)Nw+hw?<`LR1$`Y(U3+RSbxLL+>{S5dBNkT)o4#4U^pqqBi?t_Ax#+P z|93BQ676;TF+_BDiS9pXNfkA`cU6DyqUNC)@NIhk2_4|@(5e%F@xyP6`K~zniD-Nf z8}PB7N4lbTgj|A(RDbwr7`*aFWGL)@;#Xhmos43U;N53>U27Zw@?GyUGhwXvbULCA z?N@`}ml0#;N`$#Mg`I6a+~d_;I5U-2pqQWq8TF&=nX8t61+bbPSyzrP&5`4U3M-G| zp}a=qNgk2#+I8-!OSOh3g_mbI&9g*fz&F5aCN0ZVOLJ+Hxx)Wop^N`0w*4>;tOMD7 zP7$BHV+IZ9*Up;P)wm0?;4?HjW?a3b1VNqZ-0SuD4?O-F+gfIQ=UCkY-S-u;oeZ7& zTcyv_9FUR|?;(LZJub$la|`y@+=bA^OLV?cV;5|HQOkH}O_O@1t${`Nyb4+783Q9) zGob}GAqq-2#N2{R-d^qdJTmx*Ln3#;(v9P{D2E4k*gCl7&2dfKl0oY5Np+k%rLbkG zc~!JBe=4FUrKg*@yKD)Bt0O2gmk)l1R6rIW%cW&91>5F`|Hj+H-hR>=(1Qf*{)&@d z-2#CX7DWJ69jRvb9XO5z?$E+}XRZ;`F%9R@HQv4joE#|1Cyw-C9or{UfRd2%S~INB zTgo4?P33$e!7WDV&Q`qpzsrB5!n$+6VPO8rKcVVdJlh5+_+zo7I-j#Hkl8~A<h+u> zNZhM~Vd^wE=<A4-B@4Gbx!W<;II#T-<)eDd%-AHuXDp9U^#`4fiW<01oV5a^vVAyl zx;{+_a1#&D%Z-IGHmc{)E*rw13`_L{w=h`E&qdS=t4o!A3rww$0letqiaBJnJ1U51 zh2lmAdW2R8(;;o-_zJ^RmyZ&9k>$o_o?lhJ`84 $YTqG+>*4RV8TjEncj)K)!#m z7l+osPUk_U!p_`YB*^h}7ZPEi+r!12LmB%AA6#l7c(=Q=B7v`Ph9lty1D+y>B0l0U zk87=|3blOpR`vzQ-KaJ=*KLq#desLYJEsQ?^_)?QA&bP4o1AjwNM(n5UW|n7)$C9$ z`dwYt4;GY)kKvwGo7mua8X@E|k%Z}(s8b{EQjt&EZcGSvgFv)PeQ3&WpxsAfa}Xxd zZm$o0fhgDIEXRo80jH{tZT}=>vS&>;!!4@E({w1EEgxzT>q(IiXAMI>WE!@M(pFwp zI$NKhQ1mRcWCgjbPu4l!)j_Eb>>a#NgI26w<N(=_YLRh^)GL~x9~SEkgv(3?pLFcT zm&E1;SS!hVI%s-pJrpvc-WCOO=g{U&YZem+OAt@TQU%Mh!JXa+Jat<Jy3Day>P=lQ zl2}L(>#kk*e_>P05gP9Pz=zOD`QB2K%ZH*D^>%;VvjM!6Ma!&g755s=*g^A`H7t{v z59$?GmUZc3>41?BjVs4BmI6pzQ?0rBEWzI&Pzgf*(bt{iN(;Hn+5XiUbF>KG+ug_h zH&0k{;AdJ}deqTTe7sAiCbgY6vUwEm()TT%ByG{cyk=zTvn_9w-9OTQDDtf{3jvO2 z$V2+w8kbrCQGH~H3`ZI77gr1|bRz;0=~8cH?oB5)Srje}SHd_u_OqA6w(mjV?p+aG zcOZV{)vjO;hvz6~T?OiN2?@#rcFH+4y^-~BRu(vFC^I^r1o~iS(C-YXGMtJ6?*Yd+ zrZte~GE>^LFu+)b)l;FfkiYrP9eepW+b9r<D3mzQYVvOY(|MnFTJmgY6zJJ{Zm%NY zlr&s=a#_@|;e_mVs>(hm(=fFv0MdvNR=cvhmnuywOOV@aJX2|R7hDgX3Jm*nVdXp4 zST%nrTy;G9K$s;b#5wHR_eyO=BH9<&6TFmQsofI!w%h_Bs%7Y=?Uioc%cKfy$B=Q| z6>YlTO+x-?`&$&-R4Dj3NxpSR&f$-bq&si>2>YR^+OQ?6Rgm}ys+YpK-Yjdu1?5P* zrfx-!iHT(q`lj%yC3RYTi_$=5=LQ&?sb3fQ1+s=$dd~Qh?1z^oBB65Q>2CHJGv9nC zSLX+i{8@^P=gcRN6=M-x{GMm1R8Hq$z3^9^$Xi!ISC-_n>u=$}K{)P&_`8Z>I%b76 zY7T`qa};*Jz&OTvNR2NJ$<`=cl~RV9@TUiBU~t!?oVpuH4rVr|yvpLUq_I*H-My@$ z-<6i9cc@DPNA0S2lEe_(Bo$||I&KxG5JXW@VQYeDA0Si4Y~zQj37ddfpa4w*agM=P zUeg-pr@~ax8oPb44m+TWZu8AX^N?owNs1l*o*{_3xmhhN;2`~gXE@E5BS7ig7+SF< z?WjW1vUS1eg=W6OMAzryt!A)E>d4v&lP+^pUO^JXjMckCV20k$IML=!3LzjrzFa3? zOKEP%4+>lKFP(OF_NmTzy!JxpTwXJ5D17T8NDE6e^G)cLreFqzYQwm7Mya6x7ACy> zq5Qxp<bd~^B{eLh4N@FN@z?)N4lpRN>r>FHJkqJ|LG&vmzA>xerz$jgSB%XP9WD;K zK?m+87|WXoaD_4Gc!W??=}~>kpD)OD5GaSCJFl9wQxPa@!a_GaEbZjB=2k@&EkBRK z)cr+&475dVtwL(%e(0h11$_($r0fgF^3DepTs*x$z{4;q*;@0+O3(<O(zNxl5z58= zEg~@HoRpnAu9xWD7E|fbl5crh@AkFUIp^0kNmqcvgR0<OIqEGDPhervdfc$aaPVo5 zmoG5_mOWCIA)*|hc0pHb37dNK+j%XwHX8}ph~lAulpOWI(Y+uQ$o4c;dYVNy%<F`! zN<MQf6Jc}^KEisl`-iF{F>Xzoc7emniw$7*ufT%j5njFPhG-xqfjtXy6@Qc$utfB^ zuDXw$JKHI(lVicIulWs5AUei7h&`UEAsn+N)jPL(kvxXuG$H2Tzr-Gn=s@L56?eX; zn6*xV?jU=?La+K!T>9V^-Gt->vW<}V&EtJJjQ=S4??eOOuS+T~HG_KN-4+e=uqMil z;`>qB_o_Bz4f^^Se7cTPUBDK?M6bgCNUZGJNTo`x#QpO9($=XEk6YtM6!&N_sxfgK zevO)o?<w#j2C*AXkRlNEd`MtERh30_&B$|GBd?7FGBcXgu)+uBhEjua(sw55)aCnN z4c($ab7zidoktC9{^h62rlW1<{)UQN@(uZ1!ZhyIRjaidq{V;tQc*Hx@XCvs<sBk3 zbRrMPduTuMerlf}WdxL<o4`bZO@7$D$zOVsW^QkWDV|5~F?a}*$}PMz?gHofHdtiN z#rUk#f9dC<b5HL@L(egKysxLLi_V?Qxy!QuAz|x2eLY4jJiCHBGLlG;2O!4U@mb5r zmv4RvQMOXr8@e2o*BcAjw874*Muv*izkCqL3C5Z|JAKG!z-MJi&XaJ*|8u3%D`Kv! zbbEz#uM8g@g|lO{>+MTWr#zpwij)s)d+s*0Gq7was(mAQ1hpofPllGDxUk<rJG5wR z6!!zcIm5X*jBbqu%M856d)xMwrR<2lz3C$*s>I+gUqaA^fU35n-6(4R(<Gmhxz24u zmbFH``nE2_N(?E-w`-~Aq<6Yol;C^)mx#lAfzrUa+e4^>Wo}+P)C#SuW|f)S)Z`<} z*w)-cM^+>uLeB$rz%H8N6JZ?g##Org-;s;(tDPHVtd+ZaGkL{(0ED@#$=3@9LL3WU z6`$CP)rf$vEo1i0dbmUxJ6T3%9-3>gj0{OMa-So#qXbMfx6hu0g|tn*GrR0`o&Y<Z zWf1E0&Mw|Z*e7uo{oTZMl(G2gh~tbc+Q7Hu)<q4$AJhL?0P`5d`(f=-VR<-oMbth7 zep3cLE&!iawc+pf0UzOe>pgsyVK)y_QtA(K`GDSgjfp`G;~tK4GMOd2u*SUUlqvKW zQeukwqL%+!gn<)y{a;05KEUhl<2Q}9Y0*~?4^q{IU;V{58bBK>>_Xx|YS_sOt^T~A z;JHEx*yGAWBM~;j?B;2Qs=}5av!b6hUEh~zDe0|4T0KjAB2n{ql0&}M{E|ZN79JBT zo9JhJj`&%`X1}y^sulvRTX-2i#jFskS-f|gKmsc2=DKQq9^5Gyz)T8d*|w~%5O5Mz zX3<4b+{B8yr8d$N3Ty1l8EFwt%on1iMZ~~y%cZ~a17Bd#z4``KXuh#sty0|OH1tUD z8R?Q(uMUg){z1V<^O+VY2#h8&(S&}?8pgZ>gm=a;C(s1478949Q_oYLnosyF{dC&! z`V)#W{QmMFd*BB)^U4Bi{t=ReSH=HHAOx9QEWPytx|3{*W1mr;1z$=NyGoEbTt-uG zkFF4n`4~c<|6D6<LU9I*rh1a+GvuvhScGY+LvNn)gAkldvZ1S=WmrufMK4}Rc%?B< zpre6YI7MoLY}h97NNUDbYQBhjJM2j{+%kOLqC<v+FtO}??%Dw*sbiCL*E3f-SKg;% zkGKS^=9<aP#>&6EV4lY!jhWi_g(dhFE-CN*K^i$GD_#>E^SO=a|BPTD{WgxeXR!*> zgtH0eHF^^DM#4NKiUIXl8Rn<gG%o{<lvus3O0-haAt5oxbGc@ufb-L${XT~%z9ts! zjSskk4*_NE-@FK@_EY|~SU%`nkVCKe2i$XwQW689L!-$Tk3VP?X!T3nF!QMjiQ@!d z{r>exo=z1rLq1-b9g^E6=cL5V;r?nB4FfsH!u{upt@-~Poo5;pRhTW`9-k;#tsLQq zY@t>PUClpaN93aHt-oL2FFb8v4T+r4)3M3vvIn@L4`+OOP2De2#xFRKIRjM-mHv2D z!t)8_=5a!7G0UuU8qGY|pdi1Y6i<H%Mk)f5k<+A~GHAXPP`P&4mG`3*gah`Xi(<}q zd!CY1bCP{=gDRz_0uG3bBHpU^KSQOf%av_*OKA90&1|2@lqJZlRaxPEeiypFf6coW zC|Xg96&!$ja9}Z-8E>uX{fd-0ZG20Y(eeAT)$vM{N-|!2GUa|X7`s%aj;<18S6l!M znQuI9=eZ=~@RuZ02<*<eHYfSdn1<^+f?Hv?UXQk@{A*?pB}y-6+MaU#gb(I3@$S^? zqu>?J+)(32P>(1=v{X3&kA)hbeMz_@xF8moJDtqVBKL6QNeDOS<~uS1Uz_p?jlQ)L z<~QRZTET*%*aqi1u^EDQ{{>(gRYC3l7`NbNjY$8ow2;&Lm7g~xz0{rhzyD{h0a)UF zSe`qppNh2vQ9phf=N)HzL|(SXrAW#iS#U&Ei{2ewBw2I?GZeux=!EYQ$;eIIdRQEx z{KB3wbRc@Tu4Sdu3|6^@%Q`7H`3PobV``DA58({=4pj*+I><VegX=R_jV$`A4;%Ms zMRg3%iZDF-Id`Hg=NKg)qPXDy`dAi<yw}bhlGq@r+QgOpYT#|yco)y+9IZr1X_yVR zlk9`k3K3ak_Tsmbqcq^omNb;C%Sij9#%m`{^jbdIV#s+n_PHED@9(h<)jqLa7~7F? zv7TpC<dp+SAHSM8{hL9Ou;dGx?hfpjo5upkjR{2zm9{B3FNH?1;Xu=VLZ@|5o2sA1 zNDf5jh}3_okJ$DR9Z9mrD@nbNjy}CByE6+bkST75NbP-R3@+6dq@PZ|eMeoc{R5cG z=#o}8w!(wDDf$X?N{G>7H}ga3>Xo(+Ll=K@1*fS0-ELpG+Dz5#2(vlhoX^<aB}7vM z)!Uv2o;ziee2G&{t<$C`jE257x4*bUc{_tBsR{X8hVtWR)^nG21Oa>g6PONlYV@_D zcX1>p{3Br610UnZ9sJLPzb+DEZJv|Z7qJ0swbd2F3C30OCf*ZkB7D^uWhAypC{(FN zM#-uuzcqNrg|PRo-gFX^X^FSSZ}WmQ&nnLyk17HhOj#mb1e=m9>*D~FxN_kiE2*rx zq<%4?QAwp^#B<G2F^TaMr$;^e8EblGhXG-mTiHf}9l<vd7%3@7DCsgK87ZXtyV_+I z=oJCv_i6qlA<J^IB$)#&W~$#bwAQsBUW>N34G@lRnrZH^7^z2c45IeD!w&09^!Tje zZ(`Bq15b`?1PuId=_gkh4?8yTsLpG?Z&PKH@;n(Jo#G<nNHmgrz=dItq-J3ESgcXm z_~UxKs~TO`b@yFmA-CucY1#sBNH(q<Ld4>R)y5<{p*j@#dAu8LrPGh{Xe#sgSQUdx z6foZ?g2wjY!iKIq%AG3or@b(^=61CcaJ2g$ezVRuW*!+B^eVudX87HJOslG(E#t(q zVRTjuk8aN`#GYUH1%o_)6R5qf4kS19*Y%*`TAj?f6qw<?(C4Bf(?tmF4jLezy6U@! zHvaaX+)e&&cp$lX7E1!`58>MRkO_X92=emAM!K$3-u+%-^eHQcnZd;5h~^rj0|AU3 zVGJMV?r{E@0HD)SaAY+F+$g~9X(q8yH6qcAFTd5sTO;?S(UHqV!1d8pFy>?~{|Y%P z%RtlhQ>o>j62S$1RE<pV0pNTXtGqgh_MjCihY`sYW-In=9(tUeyUBm`@P$3_jrieQ zy)||pV>!lr0zLg}9rlX&bbXSrT>Ac95iu^d@=n=CeiTHPd=7gX7QsXMZ0^5P?x3<n z!hc$t{@3)ydj)w?IJN)HZBLB)@%)I8VE&U6ySSguCK(sWgMN#{vySF&(Ly%LZ}s{a zG!*G80vkymYZ<cFLL^AZ5F{&&nP#J!DxUb8PcU$r(ry|KEJ<0Y6aXLmJmMV#gDQMk z7N!}$6KyT=OKk_RV)+qbZ8dVQQpK)dI#FzPb&oO{8C!~)wmX)T^1NNji@~MD*(HKJ zfzGg9XmvS(-x~GgOBa^#@KbOe5Bjs(ESe=^*R6dT$6U~-xCb*~4Y>QwoNxa6BGCBZ z{L84!TrXd}Yji<<<G?8W<8c1{2T?Z)E1HAFrbN?vg@o->2*VmCYLl5x0X3{GKJc(P z(AX=5ZaNPoop$g`ao}HxEDCTC=2Wla8uaBNr!_mA^ZQd68ykCn-jVeIi<FUA^)(wW z{bi7Z9nxVe`^mNNM>IjDjU{YU@+;D4Ovz51Tk%iKaRksVUoG6-mm@Xu65E`Go@3UT zCS+dMp?!HC$gK{KvV$UfsdFID1DQ%_E*@&Q5ZNEQXdIr1!s1@?;5h<hFQcpR^G%_Z zS(;4u1pnk_zd9ItKWx<l#hLHnSglz?U)QKAKC~!<UZ@sl^1p@5Q6aF_6;l)Ixp(8@ zHhD7S5+zas0XiAxp4JOB8PWHPmT7-O;3+iap~kT`Vfo<0L7vgGg4(wB1hBdyN85BQ zBo!dNNb4zvkIP?CZk+}7lR>yDFVe7^@aS!)p%qr&XsOiRZ-AKz*r^5pqs#o9)x4^~ zVlm6?SG%%Tt71A$tVA+&cz9htuM{^Vfx?jI5g0aD#Uf<}`_2ADB}udD_~1d-r_NR1 zin<SO3b_Jm)Y;y$@yBPOO&Q8nMUG{>euL50zWcpp$x^sZ1=VLB<c2U6pTQ~r$9VmG zFW%_kSB#z0Qhz}K{wpGlVsDzV%>F+=LLZ`XVO@GVK=PyppJ8kWi<`AE9^O;B@Av!o z56#huLZv(`-}g3F=_33MMnH6FuhgX^l@vXFZ-TSTit>hjM}J3}*tKV9#0%1ljM!NC z5h<_rTIuSwC+Be0t82a;ViI*!EmC(>8{`xOGX)0pcnNi-UcIN7&wYO|9k5lK*2NOe zEExPzxojKBc?s;jdMy=O_ykML9_5%X*^KJAnSeK2K{5xV%Ley(@x@$ZJh@6~=+hLE z2j2LkQ?K}ao~5VyogHj-_gesqx#^?l`v@qN(c4`>1;v@KjI3D3WAfemd~|`SSYF;# z!PC{}a*v;*0$`Az?BE0Y6krnPe7rEKzLZO;w05a1YIPo!f-ssRo%b$<BnAb!aAnPC z0#z<T3a{-*+4)mKV`|V<H$zMXoBJ)bKzC=Bpy9VpR(IWZbJF>SY$%xa!_syuq|A2_ zFGNqvrt)~Kt%xu^EHC=U7&TVmVRHV$$IrkXpQ+@ix=Hig6XdLJsg^Hucd<Ksx|vp_ z{EJTIu2(O)JsUcJ+qw(56!CN!1d&yA@r#nB)TBcCLl>sBbVQyh`?*ZcvgOJYE1b(Q zMiBibPJkH~fW9J+?0^+-ZrWIVRsGx2u4A6yclCl_V%LwCV;<vWuew^!RguLiHw73K z&7!?o`k<3CoSD?HT4k1lfP2$|!jFh}it{a2<eW=i(J!0n6ad^5h!2G-&cm12=^MV` zZRN58b<ONps-H9rhX<7O#E~F$oEV36Q1?I8$XhfUv=xhOvem1jqK<V|i`hR&qvL|{ zlX+kGsh8r8ej*kkd6an~BR1ygX=Rf6Ff;cJG+GEfIvD%v!LoNOF2I&mOfkY30wWS_ z#VL)VlU|XH#poR6Og^PwnA94HYyjnX4bMJYyWMO^T#9IRu4}A6Y>R(Z*0RIdhtZvB z$!B*hQxb=<EQzTn{N%}D1u9gm=WXt(-G}e=NxP@Sj~*P6oG=wD?ipT+FVIB){coN? z&qu#5K~0>I^JXfDN80GrQpE^;JlgS4Qsb8W{n)dpr?=b7(j7rodx<<MG_NZ#NkfFo zR5LmdZeJqIpf*~vpFdZ-p_1?kI&EJBnCm|u2giYkY#;r#T)oWBFcJEq^yuA9t*e_L zAfQs&_Rdk<;FvdRaH9uQ{jCL=Gw0jPds`B#<|jydGntL=*4=~Nu99}Bc)^^w6N8R( z;dGHIdD`Ne`$pR&AgPDHiL}G}Hr>(~r!oCz!xzwUDHU`gRH%H-M?{(iPhChk_)<QG zq1yG6e_Knrf6P(@*&4qyAHz$NkG71nJHBz1k&6$R23XoO0D1%;D_K@M&;@`$#Z6~~ zlL|tTVi-a#?GHw=7fw48>n$~8h;)AVndF|+V;4YM?|7Jzr8ko#4%MKR1F4K$#@?UB zUpVO~3xv|nd-;uoa{Tk!$sSfa_C_`>Fn3Z|L!}+qQ{t(F<fbl<`zD&{_o=e4a&$9q z;&lWv#|ZdwML3X8XnASx$KAHQJE7Tc$moTR=)tJ8#Q*BL+X;%C@wOea{a$H#0-{@- ze4iPI%zqaS{>HVM`w;|wMP6zDuIPx6ye+>ADU-YSxnHm-v4%;#L1(<RfBI-+WaK12 zRav08QVnY!{4~(Bl{2|Q$7_^ZG-HY;*)US<)pT6iDL`}K^7amokobx4+^v)jSvRNo z&hw&SE|wMYIZLK|IW(mDn5gAckl(6dWK2qJhLdM%AnuS}$SKAps85XdEq7X7CXz|4 zwH+Y>Cl@*S;4&bG)5UPJ$2m+pd3)4!ZAb4qZC1@}mfp17It5!$7}m6uaW~nI@R^;} z5pSseuzmxh(-pvV#`b(6l!i_?O5h;*0txijyAzO?3n@^xykZQuSBvMx$BgS8fzw8N z>ZnR>R1ff$w;id3tE;Z1SPHx`JFuPWT4J0k)87v2(47Nb`h7dI2d-2FYyjY6y-C^} zz3kwrT~xn;*aXxr#zk_eqT(Lo*$rb214oxW{*{RF0dyEC^HrwmW1bwSpU0)U8-cQa zA^*_e-@u2yISYe%Q?C+xj(V~uamY|KN~#HN8J@zwA$l0=NpbcH`gD;m0+)F|Ie%3_ z*V|%+m{#53%lplyQF&bqfnUYQc8izKIP$aNzEF=gnrsU+pauuBHL_5Q!vcwPE-h>y zlK}^MS=AdT#f5>(Za7&B6L&WJK^^{4&Xtro{U+N(N{A>A%BO7cUxnu}l`|H4b_2AL zXY*E9k}Tn@x?NTDVQ@)2`LY26kTBM|Nb3)zIYm2Dqv$ARw9Ahi?I=k8!#=c(#=hkt zT!)e7vr%c*zk$<qL%F<K80_ubJp)Ac7v6A^&UCT`3o*Y=OzCnXw0mNjfc!tA?MrsN z8%8V5CUlIu2R)$Ds=&MfPPy)MpMP}d{PyT3w<5}dS^WoD?Iz5&o<odbVKJinx4S{8 z2Ft14#THQ}3w=Fpsz<qUtoAL>i~=QNO=T;YBmpXSmZs`XmChA&+)u-pVmW9fsu|GN zgvtrD^t|NeCGa<<q#N^L{Pm>|@YZ9hSl@Xj;&dXG3+fEChPUc$dc=p7#mI-ZIs%W) z=L5(_#cDW~wglK?BUzzo0?)+ngB#VV0#{J!EntByX%tq(b!`s}PDVj!IhHhajr`mD zBW;JWGc;|4>n?F*_U!D$>JQiox6ZFbQ;7?=4w_f;FOF4)qXry^UrEg}4X||N^Eky$ zTE@vTDW_Y!Ee>^#{>XQs)NL5sX%ns_8T~HsoOeJi^t4{7l3dC5G|RWyD$YYv?5b7X z=WHAgZ6VH?R}?q>f#N<6G5W?ogF&TSOGmcx7KI<0Ku3kFrA#>tzKl4XLs-jcsirhm zjul;-1iCjXqOxi_J6TI8eq=*7CA->l5IkhH1q#3!&^ISvd*>n%9O<Up@Jzk(v&R2> z!fR0hv?o$Y$4;48bQR13(GYXd_Ao|Gfayr$sqPBXxE4(LlM~DR*B`Cyq$HwWZ=KU$ z36eE+e-!`nCR3>>zFX6P(nE)Y>7Dgwv{D&QIRxFiNQwV-saA%!q$eE|)s4<6AzWsc z^JMXf;!6sZk^8)y4-F3w$!|@MbE$6XZA%<s+3F|AYOowiVI6RGJkb#U%?8Nxxw8A3 zRpA(cx$?t;w(wC6w+j_A<H?I|z3}|G>WC5d9{Vz0cJt3VjWlH4+x?O!YIBtuvqF$_ z|3SF!u+MVk+hM3McU?%?qcy*_DvTwgm-Lr@>~ZrVyp7<Q(c=o1;*DktG-k{=p4&W{ zJ2H-3{()8jgP~4>S;n!o@@pSU@k?SZZK4>xFiLaP$8@MxHG<-{FToJ`a5Gd5SpP>M zqD}Q^BVu}SM}Q!&eC)Q@g+Js@Iq_1dC@1%4qQUphLn8fzOu0QimeLIeW~34V?SeRA zu%Wn6-xS6`H!x!Tnib0z&i~&CTuN0S=Pw>mP6}3jTE$F9%)AISb2GI$%14%wk%G0V zWQE9)(pJH9P0j^-BS1iIjB(jI){Y=&Ct*8d{(~(kP%2_sg~vg|s4e<Y83&)?D+d*< zP3f4Duo}0fmTGS7089rbwqK&;=!~Th9@3WH9+f97h(nFP9-EDzUq-&&;SbHtAW=j% z?&nsNr`}YVO5H`~Pkq{dEM=$6()LasG2kFiEd@y+Upczg(Gj|)<UcJABjJ&5HY_OZ zFOBOH9m=Z(b=5)d>rzM>G0qCksNM*{X<q6qFUrjRR?-H8X_xDYSyKz<!l*S$Yqkn& z4)aUfgbDdAC}TWu8JIunN4U|Cet33EnrS~JX@}b7OJU?0qCwjDEWumCM<;n*CjCwq zK1DGd#Poq3hyS956YjFcW%e3Y<+p~s9UV6v7SBR(gI~8MzBcCxSgLY-m~7s12gNb} zA!1Mtv|y7+sVNW?VZi!Xv($~s67)}5I($l(VUScl19R9;F?ds%fu&z;-Ubg7=XFcE z)U!8h(q%ZaOV`t$<?i<3*aqA2V;yd+=qvefn4}V1Z?F_+&By%8c^o8JtGHqO@c9Sj zco)?4X=uo^LsdmCsWFV|10QUz58<3lA~%tF)R-!gg<RrE@uvI>l<+A>aCXx4jKD7h zVzn6Z%&JiAsK@y9-o|EAquhBmV@w}u8Fym(C|@!Ce=2-9gswrgiWPeB+LRQ>zZ)I! z)%KF1E*7G|tmaE5sLCz^)?c$9wM%p5qocfepm`lY<TpZ?irw#VACh(fzc3$5=r-P- zVSrm)ILp0x*H&YKxwKx-bPM%|*~^tPe42?#24k|h7pF!QTbXm{>h(~?5~)a)KR?c0 z%mBO-;n{;>00hXA)x_Q}PW%sE<sYDzC-^_4?B~wr7<=9fUyZxvSJY$?AAJKhs`H75 zNIY;-u;<$2u^LY%c|Yg-pfi(&rFFbm1F#rJeVX!d!8RP@GWLgR#?-cXCMvj_Xov6W z-XHcP`!M<2=#rF?$PM!dK|a(B?4$^cO%hae)ib0ak6we<svZ|7Y)4|)qsVAlLj(I< z@^To(YK~Pu^UhoXB`wklxf=J}NbFkLS%bQ!=otzP*|-!Zzkr-A_pxp6+I-kTF-UFT zaHHu!*3b3%)K_PTX2>D}ARD2i@WgxQxAv)POEY1MQI@I$Qn-#--K>eDPy&@<GTomt zMsIDlNmlkkJ)P#h?)`E%XTl({k2XGn>gnG454;CTQuF<_HFd!FP2KzC;L1j*v~VrW ziB<YonhTl&%%khXRN)rqsqXi}je4b9btdBvB^%GwE04?laq+SVQ#`uAX1|&6@TlpE zVNgLLYbx;fUx^S{dXJkC4_l+JtZnKp=pFJEllXH|qOpUd$p?rw80+R4_Z4kCZZ<*# z{iP*jt8GJob3|Ef96Ls{ZMVXO=LXQUW6RF$>uji1By>ITJm}U_1q!DD@G#7FO@YSu zK>!NmWaA0!Ym)P=5&->jQ*z;zeFn#S!q#Vn8E&Eew`f@ldm^fL*kzDmqeXJ`C!RcC zCbWaUK2R@CSpF0`LWz*3_jT9$tXDiu5cq$JJIC)jn6TY9cGB3~N#n-0ZQHhOd&jmL z+iC1%M~&Iowoae-yytH?_lNm7o>{Zj+}HI>g`()pFmaww-L=NftPTi+u}~8A`LX*# zpAf~4J8-6>h?k${B%O7A1UDx}B$B>26l^EwKsRn|A+n`a(Q!-EL|zf`IBDL0^BMrC z#D2hV_v+2gMka)Hu!s#3$K+#co4nx@neLMwFtw%H2CG_W0AtQg3*8>=)0yEnS08gJ z-udAtK&FIWmZLLAdKO)S)`_-;n?gRkCNX21EKbpKgIrrk#geN;j@+M@)GP!FQGRwP z`RIw>W25peAGp?&8*#R>g3WC;??T1(B0hTqU4O4q=7+z{t--L>iJ0Z8WIgd?=b6`p z{2(eMi2_3rJHG3U=R~rV)tR~J^542TsCcO2&?dJ_975-{7gSB9p5UARrgy|oC|oBL z<Zf=CRM>>+y4(6An_C#0Ou^>K1jXX3GFeRj&bwz<ve?e6WW0uu#Q2S~xGjsw_s2eF zhB{?Z=8YrowU0;A(JRv$$sDOcUkfw0l*K-#=hqo-d^!JEWj@SG%qZm2186t$6hl9} znu>2Ugr0pK@4HG}$G31oAB8QlR*}fv?n=ffSlVop87clv*Hm|N=1V~S5y`s<w0*&y z4t^=J4COmuUNAA)+|5(#Wr}~q#fRreRQ~nNmeGjbu9pF%`&>qqKO7h|Ooa4%aN9t3 zEY)L#%3yMedh4#Hh;!M5iMsNejh*n-3F}vO-mI_EXd!~v0l#*phSLmL2i0hwHT3Si z+f+v`>cIy)881gv()1o!2?qh)KDzeKX7KMOe$}IFHF&D`FQZ7hB<m}xuj6V>uo<vN zHtH;HS~ZM>^c?rH4|@Q0@9E2)E`GEn>hK;n%N3V<kLP8tdS4lb4s({0VxB)Ge7PF? zMR)*Uf7Km_!wh>N{2ISsMyA|2%XsiEpM5M#x*S(C8|S6?>&^%LW;zt~meoaWo1>D5 zOo*HqBF(5aqoiOdT1@Wunv`*r<QgH-z`#S*aT<95%9gz1>{@o(y7O|j!=UNT|B&sm zMrka66rqKTU>#x==RR908UTsd7`*h#6jU9$HLK%y{}T+PnJPTY@WAYegy1i#Xx84C z94Fb<EvA!%GzS#N-$frfOsR6S3EC%>Cd>?3xFa%>uX(x92E!r1XHI|tF9x%iAZE(e zI7_nmaE?tx8LmRwcT0%qc_~%;SOY$2PFz@VZl~`AQ{9%lQoaXk0EWlk9_0*oCVecC zZ{=WX($+-;k*bvoc5jM)#QK)JUrj@b<7InS#N^gFNZSnwJ`E^~bC#*D-6&BMLOuDZ z;F{d|yu{N{c@40Mb2jYoCj<?5yD#rdzh?YMe0=Y$XVP|95h2sL_qWOjf34G^*u^t4 zBS8IrY^!gB^oKt2Z@En!XbjZ0+oEw*&+cm=kpifNx`J~TS?N>eat%)u;kIY3O=90^ zV9e3-&5xMK*xu`@U@gdGF1<@#_V5;z50Cd^UKW<0Fb`+fXpLZyr?mZ*^`y+>G@pvz zKTo9X?Hj!~U+tt%<d&gcITeGpWY0H87H_wH85AypccYAbShxJ48@$*3?cmA27~^gy zs}thNq*9Q=u-O)MutEajIH7%naQGS4jDm45y3$eVEbq(WG4P0}B7LL9yWvzV0G$~b zFCaHbel!hzL6IXh<<DZw{ahGCfBZw(Zq{*N@%T)3b;w8q2*Xj*Kn>T@>_XlV?fNOk zG2W$*$<dZYydfpfnAFJXL`pMq>OoeA*Y{gBg0ZzcocPF`G9$lcw}%&*<^;KW3oI*- z(Hdi7cLBF>hJQ2GPti9!gku5B1RE|xfwDhys*2b$a7wLF&NZ^hJfd57;q}-pDMp6V z-$4_CG{iN3Q{O4cVm-);{*sJQO<_s+KZ^t{hL#i~uvw#DPu+529}gV^*GBYNh_s-w zpdK-%C^SS~S3iTF9LeS##_mVo<f8eV_WZQ0jXi54<P>NKQ9ga4yz3qBqydd2X;ApP z38jyh3xaxsZ;~&6%;TlO2bWV5qsx|GxiQ}QF%BwR^?rgeM}4<h(FaNp2t>U2V_3J@ z?k~_7N=a*=kWpd_!3khmX&R*R%i1R1m?CEx(>S(C)65#;X_O^f%r&ony(||0lRhbw zO={DnTz{gY_0qEb*ki0sEeJJ!_cm!~d@B`G6d8T|%X=)T6|#VaVJc^3?i~=2d(@50 z&CtUC02RAh=Tgn(!;3`d&W3}YMsfroJ*co43ibKgYOe)>BWvq#M*{`&NoeFvMwa%T zgkkuwm0rx0tc#eB4Ufx2!4jKG_}a<ig=l5Ce&&^oN$I3id$+T8ygQKQT3a?pIxj&7 zeF;v4USN{0<}E-l>1P<){z9}$xTDDqAq_6Y|4@UY_9?VzNcD8CE*b;2@te%^UgbJ% zk<S7-#bZr!ub(owE3r_cWl`u!MQi-fZKDe)6sZRcS66+@mMk&Fq_W9X>g_1^nmJ+_ zy4V{b-%M`xT<H`elTi~!Xn3|%0{!K^bF57F$)ZTgg7O|222Xac3FD68lvf++iuk2s zHAsy<Q6aB=NBWG5ZOm@F&}WEhSn9KX)n<#;WBsNWVkj(zMcD-vzB2&PFkNm1va>d6 z-N>dzUzP0?iTngerSJJ;&oplCY!n}>jfS^O*f+UO6wQo(94_HYs(9nVZz*f4Nb4uD zQXV53s#fo&hBDXNiVsC5>M+lz`FK)_!LEJRMJdZn=H|UH91*1`n5yK^F3_bsamWdI ze-RoRM*+Tavysw9B_>6|QCmp+j)d3$VU#__(bZgPSo+Y7Php|Z@#L#_e>3Ebk6<cH zRE1d;K(^ZLlFIe&>9=Sna{bP|MHIMDgS5<zjN0Q-a%m?d8pfvAv5aH6{x|bG!PB15 zO)p~JxIS!jD6^pF2E{`;_tW#HMNqr3{LH7mHR23Y{+>_o@^L01)M6YXMfen>RhUyu zN`oh-AuVb3l&_a|xr<=_NfuLEBVt96Q?_g$v6SZ$JX<N%HVhHSL#%HqwO9f&NB%Ma z^`97JtXa&`HI=y;e_GYfpDlnGfwV8ou?r{3G<+e2O3zl->^c#QBM>1H{*kCXUQ3+Q z?;FI4*1~u0=>_A2j-a*X>IS2@QP>ig>#XP3GFG5GOTo+UM9EZT2WJ4D*7>S99VN!I zRRm4PTgDP9MKPU$x$@+>2e(!>6er}2pzB3j20~q5_A6NIrGZSz+*h?E3lP3B)4AtH zyC>)vT8l=jW2eUf3Z;zQX=zVwtebcELf@)GJ%>Wws^t9@_w}1{$6_(egGj7#c`4CM z>T5h)S<kp(VE$ls>4t#Puj}g(H~qcnl=ZiR^SI&T3})fOu%6%EMmYDCibw_A%twN_ z?uL?bG9AjB`<*GO-DsvpEl=pDVW1e)VK*<rM`pSH&&<lwSJlX9&AVUnyW;NWcdH4& z`#r5PkG&$tK0UgY>q)7CA+*I*AQU6PN7W-HVGPI^g|ofIo~vYUcBQb%50ev*uE*E1 zw&df2jgt}-NcZ()sh69z3!ln4CmOV8<dD+WQ-=~5)0hM`zz-<QQT#2b8=~;|DOk+Y zHp#*X2GU2MZUKQtt|h5y710nTp{^y*X=AD&2dmLe4e&h6qnI`*qrp}1MU*CYVX2=Y z1>04QZBJVCh~~(05m+x1n3t7on&Fa76biQJ5(*@F_`zaU%N37j#9t3^JeTbSy$=}b zSGNI>RKEJE7}4hFTHHs^t&&-zys%8a``N80NQ$NWL!1g&K*_HIBaP|1O$*oE0Ws6Z zydp2MBfm;)cFx2lu}dRdxTex;ZV04^yJ>6pm~ooDqFp*x>!{f<)SYlAps^NAM<dHs z7i3qurg-28HOn8v6a9V^ebpJ>eR3(UwhEa(PX#g$u$9^7uLq{(ULh%|Qcg>G=PSUA z-ol_udJuCj1%avjTTi4@Oj!*C!W4@tvT6Ra4gVf4sX7{%oPfB3SYq0zL0hccatA3J zAh@#iU5fYYO>!A4NKmvSD_o|Zb&EcV=$6ykXH3(tys|Ebw8g0=vfg~$>&>O7|LBXt z2@wkw=Oh&Q!E0lib1)ij!j(oCOTO=DCPfw{W{{k4eWH~=Id#EaIkYCvy7)~SyZovP z5XP+kc6;ifstm5e;&>aI9Kp=q=WB)y;xRO|u5>i96_Zrp5dZke4#Yo)UeaT({3M$b z$*yfFpWV0lqz`+cR>Y7GO8s4MV|?OrfU{4?gC~6lxStx=O}QdY7K$Mx8*NusR@QO6 zlJ!~eq0QuHg8(~&t*6Gy`qHa)QWL&!kn0w9X<+K6wn>;$c%O<Gi#W`%r5mE88>5F; zlHSVtNokeiKt^Abn8{~lNtm`{STLG4=QNRykE9eO7I2!Cl(Hv}0qf$&BAs~fr$rRo zdPe|wlPdyc_qU~|Z~xr|;y1P6rT|)Es$Jsgy3x!_42Hv%+M%z?E=dDoqF0s$meb~& zR6s#1h8dS=+5B<+t!@HlX)n)(C+R_eR!^g}qoy6A#jrW<)t^DQ5PdE~)ABsaRNKPu z#anlVPn%7M7DzH2mKzu@Q%>Bq)=UltNo*5-JDND!kJ|R>wu$Cx*}m~zlf8<fdX;tA zdzwE<?;PEw$Avi_M-K{FK803rI-V3n;s1)1nMJn1@rUM(tleXAZgCMw%_#CD@QaM} z3+z@CAj9A;oan?Ar{1QIY;)jAIqZg22lv|y4j^oDVy5#)X{veyR7w1QLeyld!nt8t z!?JqAaxlO<3;a%{nx@dip@~fkxs`#Ekz(QxpMUHLy*ds=>v!y=M{EVLL=88n@!r&B z4$mVDrwY@S6j;k)sbHB$Y2=@WB!i#mbUQfYAe96SAI(yGoqOS-AM)`7@9Oez^x6I% z7KIxsl}K3S*AU&DAL>!k7g5asx!fx~{qSp!^B$b44;BH`4DTYI3zDVVQ5}mx`Ls+w z=&4Zx9FoJ=<WCiU!us;V@g6k-N7t%i{M^HxA!7`=CvSt~a-^64c*dKkkTnfD)h3c~ zG#s5KvVxE~nUF<OGU==jh<;VPYhu8%l~pXB;+aBd5yj=m=evK|9C?Z($G0~>z2jC& z7JlgkS{xr7K(EkBm~4-~Uiz>QFiUxY=ReJic?bEtIHnMF$Mk$Di^~0z8w(NjNFQxC z!6_kDG5%&yDzd&JrC<4SwVMg+?_nTgTJGl*5V}-YmS#Ck>i$G3_^Qm|L3!PakDRIc zO!*OzC$Th1KJ^4->ZZTXcM-c%d3oTB<)_R)YN?HNnso;};%$Wy_=)G7oB<4hL$Er5 zQ~Ej+tkSb4c;*iK`vwF8`KDM=M9skqc%x|${Gq^6Ma&5YNcIeK=&)@@3`BoJ&3MjC zc1#-Cnv2Y!6sD^h((pZBRXnRrVmmU%`~gFgPOZG7aVKsaEU3{_fM>Hdb0}6SxHrM; zQ2jewN<Nl}Eryujvw5R^U<^)20mq16*<9xj!eK-RnT2~v`6O||Neu?Y+H}~o@a3zY zO`3T`g$%eN7i^xx@JNRbd+k%QK!sS=jTlSNdXh0W5Wh+;*%QYqOr=Er=Sjyco&?+i z+Vb_;vrm&4i!~TKx85A1EEYtbT@8gAMCtJT_!`6amcun~sFyG7bZQvaxJG+Xt1<@> z8d<!UOJlT?##w!bxB^b)PjbGP;`*mjJ_eBYAq}vjG;o(2FVAzy=x6TTUD`KN6!}CD zZOnmS$ekgiw_2DcY73WpTDKk=^`BS_3tY{XivGrS_%m1N!xa9jxiV~H01w%1aHEk} z$)1wKPqH^rz)04nQ@Ybgnk<Ql1TO>kp<1|XAgT*b&iPV<R|qHiI=btqoml>|*F4nb zX%#SF13RL;<nXNJ=1ns}&z2P;CfUBEa8aJdunUfKsKio&BH4_tTeTHO1#=>Q;7mA3 zG4864Qv196rU7C#0x+o_<CA~X_THsX@y&@W3BFjXAfS~=^?s#~SH#<q-t*JO@#jUv zV>phB*KCwFEX}B{;r8$sW!6o;MXZ9iCk(u*Co(eC%?DTKF6Yks?_a@pzmd#z1O_D; z`Rc-$P5U|<XF8Cz=(3-5A;6e5=R(S}htGt;x^T$)x}tA+flss6W5LoSrtP?~8ogVi z6t>W(p<KdC(s0a%x)9V0577B{k%Dp#*q`nQ^Ro9J(waqYbL@v+l!SM(6S0lymEc)r zvHssmBQMY*ovy{}z$iz}EeWqVIDOT_Z`+x9L0Att*nmP3IY}>f7<eP)`37`rPny(* zJYVrS<Pe)~DqpRLWuA%QHi(D)2Vv4uTyG)?Hl$=J#S%BW6QiSl{%n^kc++CF>lD{| z3DE?99;rj(QnQ%9?jm19nb|WQM_qXuXBr6#CH6JoDw}A9{jEQoz#huFgl2R@9~i-r zKg&_SIVRy2QAM)s5eM-DyGIO2A$FH%o3I#_-dSh9om%Wu6wnb>$d;=rI_b*~To(?D zaPJ9>hiTA8m*5k;(Nct=%1AQl%z18Q!*NS3q1Op(bGAi>ITw0bQjv@7tjH#j_0@)g z4_?Uap4J``bV_PMl!Z02pk30#@m|@X4I398%rh1}^m=XnM&I);0AzI6jn9V^FHcSD z7}~B)A99rG%O^YuE`Ep4wII}Plfd(GQ}o>HA!y$1xTJPTWYd!svV*MqK5FbYxVRLd z3WH@E5&9u$-<XAU7ZUpLp-@R`G~-Q5>Zh_0;@2rw94i3`1lfV9I9L~JdKAPr1C4R$ zfZzM)UBbO94!FF-)NG(rz{RZyYVCMW&40=pQX>)uM5x$9m6%$^1O<WffsmIOQRN#- zZ1gc=<D|ZxDkYJlO)CdPwEpIdA;BmI@*Z8AsQ#ow^6lxzI|aHh+r+y<o|ea$O?lY$ zs8qH5M$QS*j_&(n>-5)*AIw1Ji13@aq-Gbq0bfbSP3`>I-<K6_A?b{u4@%Q4K6mIO z%;E7JvDxt!W_|Ppp*bRIdHv#^-vxH9lP(0(CFC?kW1`BPv9ib3h}Crk4I}7i4cL$- z<o+yU7&lZypJFpWd4OjBog9;zd;%!h{7#6JHjn}(zr#*dXO+?`Mi+Z9!AQqRohr?# zYB;7UkUx3O*pMk<)6*${38kO{xsAA?p>Osn-ZXn8NeI+8fpbY&R<CO)OX`Ilv7_8? zyX*9~%wyrJxOxzgn(dUR4dHrTzjER$DOmdXK%AEOV+_gB0(GN19bas$l~qxiWn9oR zH)mAVX$N}pSgnU$!MhpvMNNG|Lk0firFuE(K`EH@1Qn^8(Fr(FnY6l2#P)HR0mcXi z^+K*%F%(FaOriqzkO5KZPr-QRWY@Zvr4d4AoXf-xUnZg4v%6f9J1Dqox)FjNT*{-8 zmns79F#omsTf&Db%|~&ZjO7;_Y@4i;|H(f;AnXZ84dFuxmSCR&?#Q&zC8&S^LCdC> zHmyhu_JQ8H;{v8RV`OO5>LBmXIiy7^e(ZjDZX8R_4~qUiZT_%lYlS_!cW{5=C{UO* zd;9XwV99iUY%?w5#teImj$JfmYXnDo21LR$-IL`%_G>JRV)eBj_2E%Y57AK=E5j<H z5W`K0^U5*7Vw6W4W42U<a<KwmIQVHS`a9;|D2*am2j3947H+O>>k_=<c)jKehrQb| zzQSWU;ycRI%;O(^2<O+DOi$PAVBG>%WGDR&S-&k0c`fh`bld;NK>=DUS!!<V3mE*^ zdvwZ_UMn}0<i_580iREsNgZ2cMD1+Lii@i=otg+q6NK2)M~#)>P^4E!z)-yqa1U{9 zbO?3*t}o&v-RAxI$<3RD52%UG*H9qkkmtrvgZH$JU~Z25kdEqIYcA#gju0m%Jwd4m zX<^0+b!gGzQG6-(M0()O=KG~|z4e7DwmuoXF@GKc!IbBkrAZ+g(B=maS(aRyx`S!| zaYn3sC0xQML;0{J^|kyu?3`dxm{J2-$6<Cu#c7Pi!8V~K!9{g{cNf>1x6(?|%-`;j z4-U=!XU-h1Nsk^NHJwGX37$z@B-SR5a&*aVDgCJwyyuG*`<=2e{Pi;x4tnVj*Cz@Z zQdr4Itjd?63C>o<(Esa#WU}c&-A2g#GC`fPrh<6m+nGCJUf9y~JeXqWr!qESVl}gB ziRA+Yu13?1z`8?`dcm!`CpcxVy{qmys1NXL#-&g^FGG9(n(^07T>PuBo7!_jc7`KS zz{fG@f*Rr2Msif8?hC^x&D7rkHFx_Z_aHbXPnc^wxnj!@4U<*6&0cQTTPbwhWxmS@ zu}De_|JlN`*5fY=I&&5u_qf8AdXecb)m~k3>+qQx;%ME1bl+A_z&hSe2go5KMBT2Q zt<J<XT+2ay=Ju$K;<WO-lGa4!lwCa7=6gt+QXlNydt+q;+0$lZHzlqrtGOiSLb7s# z8`9yH=gTKlXlatb+17gaKL;kkMdO4wpfz^%xra<E%rf7RN_q(~@{spKc!_aPijT3% z;w~3rmUE5@fey?O8XWyRBi)ggpS7nxa84QJ%GBzIqS6-KVEg=*#1XEab3Ci3{k>|B zcL6#sVjG!s=MUvm{s`r`(nPW@Qf8SM#y9c0*y)yvz0b07co%ADb>evJuyL&?MZSp7 z>C)!?UCu97L)}%cyL!`+YVgs~25|##8SivzalF5*=DVrabkMpIO0)qeM&MG?2qj7G z)S(pArZ!0aqn87}(#Y@c*N%eXfOFVolH><O%lO*u5)hM5lTKyzbp#A8@t`)blcizH z)JOp%C7#0RfK}h8x*^Gh<`mkuIiAQ$ok>Z4U*!eU&wpQWt(Pw?x7Fo4UJZtu<#XJg zV^3ohHO6+Efa}F`2(ePg;WJVk2i1Aug7QO3@yz`v=6o)cHS*FjaufN#u>$agQa#HH z^GReYW*8gd-|9?+P6*S<Ctt~HF8T#o{i$t9*7nBh#>E-k@iA?Jpca-WLi6}g%Itr{ zEkIot)yBEC<ehV1ssC^%8#ZI2!crLj6kFX0p?V0qey@XgVa7{5dq`Y$R1{QCax9jK zMa$<thaSu3!Jgia%2m$mpplijsw{c5rWJ)Joag&s+Xur}vmo>mVg~b>U9p6=ynm-( z5SK`O|A{jNRd}sFVhjpB|98`ViG$79rAen0An->ZX84e%&(CWbd=Eb$S59DssKS1@ zR&f>wU(hUqdu&sSAc4!X$1H!bZSH%qCdqAAkhb^?@{)v*{~hyDFX`N`y$<HWYdyUP zyKgjagSF;4)_D(Cfj{2O3aq5+-s*97e6hh(ftxt3go~EIgSr$Hp*;QVbU`V3U%ByD zVr$tK_QWMQml~Z-lxIpVQGW@*bi-!-QWseGnAcrCZ?Q(b6%(;@0gFpc@MW;uh1cKr zSC<<WAE;1Rs^N~H;+o0oVIgd^fMltJ)8i3i_<@rcr*{1XH61PndNw)adC6*nu9REK zW#&A^@ui%F^dS)fSVxQ2=OuS0h%?nc`?6zSX|L%TlK-`T>3$p_Gf{;*A>ArILB&kp zw+P@jjaEZG(fv!1kG*2@FE#1JM6u6<O%xeEe&Ls+ZRKDz{s*ffMZ{_RmKgW$5jqZ- z$O>YtP5}GXdJ<KeY-R0(_C=qEcQMoC7}dC2st9|c>pL1qH(Q_%9_2}NoP5mXLn|VI zWM4@ALaV71_VdTi`O>GDY`{nA81szKr9)hi2OEt$w9Iy?aEaN&?Xu#TJ6G)Lg5c$D z0XlVZJ~w^@#iHT#@Y#_6C585vH9&(`KX^)8K&<>Xv@b*gq_;00^ic{6TQk%ObraGF zDDaq)yAm5SOHL2cJ^2W9`cWA%KM;2!*wM=Rh<8@$i;)+!m)JHTwLb)3Th3gzJzeIA z4O0<%ms74cqRCO6Zp29V11b2(uwf=-w<VbR=Y|s2kR^^U%l-?q-8nK9!H3fISo8v^ z=r_`<n+@m~LrijMHrdbC<{R;_F>Ou_8O2yjk}zw0sbTA*4-?6B-AU0DP1EY;xgO>H z+?MecDblLEV$;yvI)tin=k4GzFr;c8a74)m=(sfqS-r9CX&kN9vs4!Re(h=Auhscj zCh_{DlZ$fU_?t{K>RFTm&-XLUNn|CORF3n?W`J_#S1|OA#lXTVf6*+q(Unt1HtFE0 zc<kOI+zGp__9oeMRgHza6cCpXni7-%{Lw5UJQ=4Qi0WWRob;G;;$$$`d_eVd{U!{X zdS5FI*q9vzRnqb1-g<%X))5Q9*J*5lDFU&AzR+ph7V{stnHR|^M^xnlmI`C?T(H!= zqk)2lJ{1cO@nQ)0g{{*mnWs-}p?KBP&X?Kb&&navEDba4jcLd)tHufhG&bq4b9b{A z+67lv@RTf|{yV!Y$8C;`Y96$GL|FB(z5qaZVPlx>&xdp3KB&vS$2(_vcgnXfe$Bx; zBa+O4Kar@_cXH7tc`nzydlZ;f>IEoc{>G*^&rv{CM)*d+;iv@cM?N*GLXF>@ev0*? zh*M(qw~@@*_Y#t4^w=!#r<U0(qA20hg#&M`uEal)PT}K#!wwxYUUnfn<S5H(uvZ)3 z0NPO1`A$vJh{V#5`Ypt2$|W#8+QsUJqN#16!xuX<<{xV=f4~VALd?4BhO_nv;Ku2R z4`##Lk-1*TjdnV^g;y#<8REXtxccA#WQwnQu4nRNA7mVSEd4DTo?De&GF`jDJ1<R! zPQ;FuSb)=$FwAnt&obHBzIB^`(*w^=q9=(E=c`zYrgElG8n${?J{K=h<uvx0MQ7lX zPm`m9fWWq;jV02t!6{>jun$qBa6C3Z?TP;su0frZ@B%GtV*Z1>fSA0ejZo<xj!c2O z6xFA0uFBU-SRdwG>(E<baBk+65l;l~yd7s-fS_fNb-?GJnTgrU=em(3k%RT853rvF zF$j`5f`KNKI48gN+*Hu9n!2b3KL3MH)IwXKLL-3UK5iF$1}%81sx2TtrlRj42+6+S zYFfPBpBBlu2`lp_^p)Bh@#+xnf#x3!noBU0*9%2y>U&9z^PLw&>cH2H?etH0J2pcg zqSsSQ<g@3Ma}Tev^*#3WhC<qzsjEWWR|6sht=-)T5H`GwfSI|JE%N-!RmIRwWu+#G zsZF)vt#>0?-zVMESdEl`>KbnuebrqIN;VsUv`xI=XUg79E!CS8DqR3WR^u5E&xji6 zw^sXKLJu}Q9CCi{P`~AJXe!{>J|j<HO9i2%Qz1AXx-`7mL9(P17hH4%^Uj<J4+<)+ zxUNLMluFb><gH}fZ}xHce~B_M_&sTkSID43T?jzRPu1GOy<7)m6ZNP;voPjZIt58! zDBVXW^0_#SnOzJgTyt$Wyw6zTiUrxNlKcV8fjmsSywoHpJM0#T^U1RpN+<)Jxn6zX zt#Rg}?!;Vl`bBRvGQ`Zj;A;oY(f1kji3p98J1lnGotqTZ1d#y`VwpKbBhZ<|Z=K&P z#masf*7x`r@zjjq8Q>;>tDE8ayV)`l{!s0)N1#18OJ&7ALlvqbM<w9kqJBZB%>3k^ zrj!K(|Ed=|!$+13nBFVapLs}JD;l^mNU~nZYxGp*x@7eOR&Z7<`x5#0O8!f{2E|VF zbyDwfgYGd-Dw2&3NDPrv!lv_-)+*lt)XV{$!Vof}W+EcmMbIE#svZ2I@DMiK;XtDj zK1$)e(FV>HUJt(GQe%eBpdX1=K_2m5YXMX&gwe}c;zaYrj>+qaMI%;;Pemo)?P-R) zp_GjCIq00W6z?LVCj*$-YXLTHUQy=f6g}Qsqb$A%&dwP)Tv9u{M$wc{8u8;zl46wV z!hCuT1(F}%F?=Fk^B*h-{{SxhvIFN-YK`_~X)dU_Kzq4#@Zuj5h75CA9hfXQ-chW= zDcw`SX*Y93x?R(O$Rd>rgnP`@xdG*-$f@;*_q?brP-ZJ-W4dp=rUOfVO=<A_;vZtX zV%ruBZ5^U8PC&8#{n|YdiEIbp^tjEv>-nH4p%d929MBtLBVt;}W)pvrMtbH}2(g+D zG_%?v`boJd$EC6%YIh9GWfx@^H0v+A``4dvigJgT(XYDC-f+Cp5LUXUPmB{c;kNTq z;88@SSc?<ghLGD5Wl^QU9q&^|%Qp4U>XCZRwHR1UGlh6NZne}(1;8M+p#d2m{y(f0 zbRm1bnhc;ZmU5#~{JY<wWbF{bC7Ojn2eN}x3PW!u98C#@q6BI6Cv*7Ci7)aGu`T#v zlu>5Q`0+t@&?{qqJ$y9|O*&BNW^xw<`FDPuUpOT5dJ{${o<;F%y{%`1+9I9D@Fdwr z?)Af&soE$9Tx7H!b4XPk72#3(H#S=kkMPd&Yg3MyMlV@PhMCqp>la~ujebGZi~b^Q zpwlFyoYZ80)wfM7b6E+w<$=={NNh=<#FbSU>X)oWX>FvdhvvFs(wMKi)AxX58=d}E zi&7UV5Y!P+a*m#j;A3W)5JMddfsjh5AgNG|KFzP1^x=|9;8Vc<Ezc~{O%=PGS63@1 z!xp<_dhU$`-~hxJ{zLlDAtb8qbrhW{2q$RIX6&(uCFIFnlkEtP<F8fOHzn*_nCpy< zu%Zr1#aNl)qE$$4;;p$P`{EGY%fg&@8AQXIUj94mNl8@Obk*MFDZXxcE3|`ntF)j} zRKe}z+N=q}D>nix6U&^=VL+>C>QPM|rRz*Xq`2;P#%I?pKFF(hkk;~%i*bP!6%ri< zwNzKHJ8YT_nlk4R9?ecRv+`UoQn4r!dKq?$k-t>{ArBFatOuST3O7d(K<sccX%>v% zrZylDBgDGaYwOE#@#((wUhy=wVSQ3Jd+Urf)8)N7VaOBF4I&0)iHNv1xR1*p_8^?8 zIYR&!carvZR@tNtrqPJ*QKJ^+ah`^(W_Em|rRQc##AMnW0I^aCPV-=0dd4;0tpwDX zj<VI0oCh`noAnov1vnzR^R2KdiY+)2xqMr@VD^(+U*?|vbL`DC2#&3zD16h=tHm~H z^_7Qz98Nqe=gwqzESDFQ7%^Qa5{1CulqBAenZS1sv)#~|kL4;a!!IBA<<w`o%^1=C z)90GxKo%^<J?djfXrK3YvxY-Uuyp4KE1GL3Yjb;{8LH7rNQh?$Y=ZVt-I>d8r0sw% z&CkNPwB<*(hK&=h*Y<o_Yu+cKBtR7?^0xu`V%r~Y@d@d{;~2hXm{~8icYm6tG+Sdn zPxn^n1IK)-LH6lKDbH3m=Alm;WKoP#f6@9Js<?>$I~E4R=7)hMR@6~U@x*eHbF`4p z<rP*tqvL4hr_|=W<J4D0>pknZVBPKVznH{oLh!@3O3%N{3~%1?WnN?1oMXfr9`WN4 zO1Q9O?a1O@(Pl1~7Ln-quTm3x+tS9MlIWke{A**~p|E(jsmq892vy$Nh;V7=PkD3) z`ICN)Jv{UCw!h}a#aB&k*xdc?Bsenexgj=M*$Op&^NPIIhl<!VU~Z%r_Nl2^opkX{ zX$%NM&WD?uG7KNZsJuF1vKipX<Shzfb1bOsd%do4w8S&0TO50F^+_kie~R$OOL996 z-PD=zvS;J|HIu+oAko_IXcGbUhb+|SJoOK~_zH$qw6A_adO@pA1w3nw9bw6gEJAmL zn6v4&B^KDFGfo68BqSdaeVO9{TjNY9r8CKy^rJ-oeTcH7Wf(uyV&c52T|AZ52YpTp zIrdVYF@*fQh(?!t82n{pkYXz)ynkUA-t_L=^<y`LLkm0D1#;+$15i6!An-lpzLeLU z9n?g%$KD$Y9bm^uZqL3vbjM^j?vrZg${N)YKk6qbw1J{udUbGqP^#2jyh~Ag&`B-H zO^sBIFmWyKVNBm3*tHhNXmx#V5j#8E<O7b(=>NOyi>4n$6BHLc-51gLcYx0jEeEb{ zk~68|ulSU~Z-!3z%1MMI{>M6I<{#~c4s0d3gN4^1hG?twu@sxwyXHhECtT>Tr-~!7 z%83Y#HCVS1y37G?b-ch3q`_=3DYh=;Ig?hWUH=7+zUf-PrwRuT#2e@e_^VRs$)2=o z;@6Xb?iTTcZPBOfo^{rDurR!$r=XPS{t7Yx>GGjn(1$&~?xZPBsL7C!7=(j9eWt1o zM0P?WDUvwQe_o1aDIa*LA${zckF|M9lib><%?ZBjW+lA9@!1_h_0KSnr_*|e<scY( z)A<^5jcS@8nJA;&us!L@fKx2d0%wh5xq9Texd3M9gb^7Tp0$?_dSKm8bEAa9{rdX@ zyi`<8u@XBdsbtwsXQXEq;&-mA*>Z(yT`a1Nc&qR!*-;x_9XS&ms#b~%M(K*%9NseX zZ8vR9kemF>ONG+fvg5QY<*zid$>~#{AoFQo^(LW^FZ9K2+nhe%MY5+~(lL0NB3e#X z>9E^_!cSFhDd;=CXCrsDLtG_^Ll$U=blK7}FI?z7mD;<I_zpQ1F?~`Z+{XT&Oj1_1 zrhu3s9xvqIZTtPsY^;_kA6He5IIoK(-^G`%x$iB_8ShNsO7_zb``3)Xk}4wCf^RR{ zg35j`^>NdPJr!*5um~OA_%@L%pQtzybG$ZxT%w)k>(no09<D=M+@FPeJxNdzEA{+U z^<^Nu@?*TVK6SJm#zr(Rrn%_N6&3OayV}_nLzQ7^Ro&Hf2}G)P5MF)bu=ZQznVj}? z8^5vudk`5YS=^2i1LFjvcA5g^Qcm1)DWX}Uf*rh!khK(Zm^tZN@vBgW7u!$6$E|91 z7mD{|;IY=OC1!b{)GB2TS?)JO9Tv!WOzHR(ioHnSqTJe+{3qZwn|sl_A{7l}(HP<V z=LHf1PxiYj?Y10>s2ZiTPJZdhsg{nuI=5Ucb0gfOiJ%CpRXhQ-a1^(lkbh)s-wn~x zgiKZxGr?9z?HqIDiHUF3^ygd^VQS*~_U~u`{12u$7G@`E(Vip8PD3tu10h(PyeZuN zqVh+yvBll%8Ja|>TyTN(j)L1mQm02YYwiGg#3&Kyu>vLMX!5<QYdixPI7FLi#EAkV z)BG-EyWkCyu{3LT#SsGfncb56gBUbv8CI43WJo>1roptKJYU_uioLDn7}mADT}^## zrT0JNzkD0JJ!+}>3Z|B)2u?3bN%N+aTr5Fo#!{ZJet0vzjGeXyWb8}}a!!B1un_ap z7txgs624Oy;(kv~8CvPUpTOB(H((?*D=FbPxgkB(*Nv;F$))O~HF2smG`v66Gcr8A zdX63F5C|*x!s_)vh6G#a%CMFeDT1uyT=nP;id09P_ykujA2~`jO{sS>;EHZs^5F7> zQ$RZue$%HMi0RqC&->-%==&2tFuc5G#K&JVd_WfE)KkksOscdt%_H^hMxuzZoR7s` z(GS<w<_sFKdf7;KF(j)CRdCPLqOc8RJXBul>J8`CKOi|e6UI(a)Ltf1cFiQ-X()6F za#dFY_zF!Us+;}Aii;V?zT|Z<xPq6{BrwYEXguqaSC&)5@@*NN?9B3q<EC9i%g6@< zO%DXhMHnVc8&#Aqm&AOT$VooWZV#!rah?ZCbt(1V9OMf(iet5^0t|Bv-y_bkJ4~Ui zMF6rQcLgr>!>B@G6O&B=40QUbE-Hjz1L1)3_u7ao)d3=<NMxLyvrT-Wb9*TbOVoqt zDJPdwLB|&VMGW#nwHYt??tygD3FmJZi_I462FG4Lv4#Z$x194-RfQOBQX-orBAAsO z;_c^QFD0ZGaiLlFrqrF?6poiaE0L(5{Ew#_OpGcIyzK2=^I4`7-?E7+V35KDP`<@| z8l#Q-(TKDwGa5vD4f|}hPn^*1?F_%wiUx{+qzGZMUb(T6Q@koh$(JM}4W~Io0h$*{ zTW^uPRkKZofGwy{uo#RdseHJ?!II5cFburypH9*jWD`PToPVDjqVz4KzqTl5n&pNS zZOBU>iV2*9<Qnb__rMs<?=4d*w57=4rlT{US8yz`A!OD?k9E&R&ODU0)nWxt%a?L& z4wv=jo9y`^S+?MP4bp+$AE?N4P$dK-QZ!^LRr$$lW9)k+#?aFF8>3iAr-69Qv%yZ; z!jg2+t~tr3efpvm*+)3A?{dPqZ)4%_P)y)Q(8v2#dN2pE&ie7o4R};z!moU>G)Q0| z(IZC<Gm5=+#^%e=Bo`!D+B|IQXBH;t*!O!9q;nz`{_LF`Sqg8Ayo@&pX?M7*Ns&K! zkp5}=NLDWDad~x83-&fs>dwcUdb%PIF;8t_u3-#OL1tI^Ah!S<Q$OSCWTE=f=;i%0 z?w_pL8T<gBm6yJ~HAILrz*vN}ZU9SAd>FD+LeDo433cNZbz&q6BZ@qgOT6+AhuG=- zvymjKxe9-1wp=ah3i|f=-D9m{_^650QMnJrVw@#e9R;3l5lRGC4CEA};aH%v(%G4{ z`>YWgkWUQoiO!m#p4`caA9RYkI<5^8-r=orG;FB-MV|OldcC?!mdqXo5!0A>d#%Em zjU_$~E_B=TF{E`zN@lT^pWOIrx;koQ$j35dlZZca+{k8a$Eb~kJuwl~jumk>$4xSS ze`#8=qSe*UuQdoQ7*$w5RotzCUxQY7EX18r*HY2yti(uNYGZ^P8!GI=`6_CgRlus^ z`9S99WR~MnBS_>t)^}@)VE+wDw2Jq)8LIse0WBVb8c|40VwQbnLX{ePWilHJ8npoh z?AkO0k!tPJ?mR<CD2bS7=|j&)M;<r<+FLYuUYj1|HV4f8EC{x%U@#}kqzJ!mOcR+x zEZn4<i~W;GRF+L(I~Zi?WmG{!n(Cq~yvPALbJnwSJP&JTAiQT}7Ba<sRpv;x`uBR( zvj=(=`~I9A9G?-+bso7a&0@EY88I=U1jV#;lnt}-O52PDPZKo`aw3O)v8hUExEQ}q zU~G3|6ROe0hZFTHa17h%;e-J?2bTw?R*7(ueBKk+RBS_KTx1sh=;1t2#N!AW7=jA6 zzxr<d@uAaSrHuyNURob?M(&M`k6GtMlJd*jvvBd+R}>bz`>*yziljer50%xka>38o zaLmzTTa)KcSbf~}CTXPV<y|PeW3LL~)UZl+kF2mVTd&!$Z7)r+Yb8!<You&4Nq~d@ zOMp<yGO=`F?Gi|p1$^<RY(Cxn5^EnC;($d%RCi>)gD}y1Q~L}i#Di!IN%SxL(ywm( z;5?qKtJPcGx+zbrl=M5OBGCXK-V$#-KAy<rV7<>gE0RCfnHAI6FW!d+*{;0Mjsll5 z3`JlqN4QWA;`tm&qBIMRue-Rus&VLZiY}$tN817GOe>>&taF1y93q`UB_XPk+z+8Y zO48z=7iuFN?T6T*sB9ygY#mpv!tp)u#g<CPV(6iv3QtpnyL2ZZ=gs0el>A>FPNqzy zpQwxTZ#@EdTBu*xP??6ykQhuv?{Bi1u_9(@H~azMuYU6Z%gmtcIXN2Bnn?fV0Ur^H zQ9PMDlA$q@G1pRLTn(Pq_m2>6;4e<V5VzpWF6P@N>K||Ja^Y)?iuktiIn-Xff)FE0 zT$nPz^KWW#;ld^1ZT{{jHd5+Jbv^^IlVSGY;pu4(H}@5~#u4pYDj9e#7|;t1d%O6r zQC!$-|GG4``*eblA93Zw6n^Q_BkpFR!_<HuM!gJCSzRa%yDT+Xx5X_}Z`$LcG&O@J zt(@jqsO7>v*MBfpcL>?NgkImOLy#mE>H*gJ$unB?%@i2-Pfvz`Kar82(8%_TKER12 zwEYV1A5F?7%R%-{ZUawf5(99Ycve9d;_6EL@nR^0X#13auas<A1K!PgZWcFhmK>Xv z@00tHV^LOU{qreghmXH4@Bqkcz=DFjZBSOJF^RQGl4>74;<z-}@L6HAFrkHV%kmyS z0$hL&*wdXDM&lNY*lmontzAWY@{EQZqD1+#hUm^MZqs-p_QvlNH?wi&j8;|p5ItOh zD`3MPn=aVw1*#L3v5~71-DOv{UimPxax2SJW<_=ucw=%axji-I$&?4J2<~4+Ofyg8 znf8_Xe;^bMxUix}ohqQJ$ytK$EO_^YvcPLcmZy~=lo+4@C)}&f<VbhfdHz}w>U#Bh zAdVujVe^Wpu1;wA&gm*!!?|57RHdKrWD+ALSM5qGK(5iw>$Z>*0`jvQWYibr6hYgt zyE{JLZ5*K1R7jJ%%<5BG_+GM&BeAKwZ?yKaQ)7M{8YR!FS_?xZ<z!^!SWa^tZdkPp znTD(hUbH1-f@s%CgmLC>MxJ|i$*59CQ9(OvKR}KGB*A-{d0D#k2yEOU9ioxSUk+Xj z%ECU&mJ8YXXc?k4KPxyi%C*xxh^#2P)5|wB^!l6TJZ9xN^AGTXhxG8EEkZ2^1nohh zb9o9=JvDXLtDZVw40geoxHd5AP;l|6CUSz~!V)}vE)BM1-KgUxn%nA;T8%syI`8=| z4=$@5^y``75an5MFtnx<C8~nwiq_Z!38;<tMMoYpa8vj_dYB8)NP&8IomoN$8@}pu zffK`Ul1M+a794d!mcHAjV-sSf;^)H2(URiRd(*w67+)NvEkc0fC{!fqT#P#Sy$M;_ z_VV5F37tSbO(h5RB6X=vFUiwHRU-z{VfpPVQKf7kP+FOlb%YQ}658ad{13rHR<>#& zvCOd|F>`Huzb=g_`=3t#JPSxf>K?3Ked9bUof(%}lJnGm(1f%}@hpxO==@RQsb~K1 zhZE;9_&k%OoMH)oe`)wet?bMp*$(ugR0LHkq8ox@)IU<vgl)IQD0G?KU%b>6e}-UP z^v>5)VbW0ocZEi=k0fhu%9&y9i-ItfXn~MN2_r(wP!KjmYpw0@uGOit0~W4^#5N%z zrPx-TRnjt<!^67`2+Y#<XroK29c2cPmWLKHWfOwjZh$OAC@;T3*p;@~lQn>R!D|Tk zzJ+<BhlpkFHwu6$qVxNfWTbJbBHa~Ud!9K-l-g~uQd4lfqw?;eKA|`8!m$*unqEIa zWSXQ-1gT30NF?My1gA7l)qUcoArklWaz$!wsArdV#UlCUVpj6Zg#+%Jr@KH=-<C&9 zq-Lh(W=z6xl*1zpO9`*m`Fq!rFv-mD<mM*^k)0+FaIX3yu~El<WVnSZ4mlrQ3y#}b zFjjSj#Ry4uE5xlD74-w^U^%SJ%S#IO=j)(oCnvuEDl%;<7yj7R(eM1*8yQKvZHOTi z7GRXH*VJe25#&Cx+5IwY_f{lnBshC%S0au3k62n|O>u~-&w^WCEH_pP&%pK_kLgIs z=7Px%Z{tOT&0}cw;$Z5y(IZ9O_KuB6*II2+ajRp3&`63mbvGGMA}V7avKWTkk!+Gv z?=L2*>L4~%>-uNjOSZYa1f%0)pZNll-yNdqM_GA}ZNY!kY;wY7LM_n{yOh+D7P@P( z7F};XlL%PYlhg*9Iz*KN@HU@`;FWUWiacw>9<I(FYD3NiV31A$WWV6JuQPrMpger? z3;?eZrf4MNR3m^&|4hFm_p1?nh?~6RgR6VsZL5-Ro*Ee8LEk&d<l<$<kP8WjXx{Wi z1^UJtiFoxlp7-{x=p1#s6*GV0e>p%5P{3(GVwCYOGJ1+aRQX<Kez1_FJRGO-yGZ4p zRRsx?ME{{|5!M)M@dao2`wk|i8HI*pm5I$*4<G)^n=xeXQIbUY1OQblTN(uNm0(15 zuC?U8qLf_bAtOm1Eu!km`uDh}`Uh%+zpv?n5>J~a;~=}m(XfRjLPbp^PSIE>*}Vo; zxn8<+A_y0BuTGrn2&7@bw8`XRBK4=vvP_ECKEG^};$1v-jp5-W;`1kb-7$0FZ=P|g z_Oo`NGFIn(lVkZx4+lqNT1rrioDzyw>hWnr3RjIxN5f#{Kf^VP)hI0x?&@I`zWgWn z0_ylji!NQl$Q(R}w)~b34tk(L^v{pq4etwIu+Ca{k7;=I4C8u<m6sdI@Ff9h!`XFy zw|Zuu*X@p2+U4O0Y#44}@F38%kohr$Ood9EmPj`CG>z`Suqu_k+IJft{f{C1iK{hQ zAn(GNBMkV3fdgB*t^7$3{%AA->R4&=oqiz&x||iKPQ+2gH7I#aH0JMSCHJzB{S_$4 zz7Cn`a4-&uk9Ic^vC29LqJ{yK*t|r1cMs8Hs%2X#9xS)+B__cjt*N^5VEtZ@c+aM^ z6eH<J!VbY!qg>|`oc#f0XA(jjZ9zw@=4e<&OdX>{3XAy1uCXX~!Q?Jyg}OewE^@xC z=pWdFz|pZ)*|CZgp&s^1An#TbhtDM{$;&5I9f|8Kw}p3bmpZ(+xo-c*A-qRfq-XuR zpe>dQkgA<sZSfQ){3}s`|G`=K5QnE>F|Lop()ADGtjr`Z-{q^aEw1jLrS!s&gBq@3 zXz2${>c<!D1QVQ^G#3f#XF00dBPtPWj(KuKC@Dy!8-Ap|aT7a(r!8cc{Rw61y!k!W zu)+Lv)gKMAS^C$6Z~^Y&#%_~^stmqle$ZjY7J3(S5%8c0B5}-Jw24F5ZY35Ti4Ln7 zl=Ne2n#APwOf4ZY(vmmUb*3iDGHr>xe4OF2idQekT*N3LrUDEvu8_XyacmudnoK}7 z>K%Um{t+6f`l@3W+A;U!$rj2)n$OYqgJ2%IqXEdy8+X`2m6(E*Eg4js7WB}L!}+Sq zo4up_L11Bqe1BfRkQHf(iaL5JXt!t~Ik^srRGvP3#>|+L#su^Ag|tXXplohXp&Wj+ z{B(#<;{y1{C2nZoCNOd(SzENY3=kW1#&O&Gw^bsczxlYVZizm8pKncU=m}@HqT_*p z@3QA+Z55tM{^z#K5=y}8oAwl$SPY6504*yF4#cmc7(#kbP(e!Vsh(Oy8*Hu7`doMD z{&3U#4-fqy3|6-{7tu)mMwqLfV!(f9a?oe-ulav0%=&-a(J)tSZ8FT4Fd=slC?49d zqEK%Zg(E)IA`IW~b&|#s&@Zar0i&WtG-9;Y<W_zD#MHS<1vVuipgpOmEOzGcf5`Bm zSz(@e=m4wzB`A`@Xyn5G1`+uy5UL-)piNu-Uf8By9JvrSZSZg%oT0pIa1Q^}rlePg z0wQKA-*#{|>UCVM1X&g!&kn9tH7Gu_xZ(rnrokhX-~L}U;vxv9GzrJB{~e;p3U2LE zi}9RTVZ(JxPb#l>oJt+A%3!_<KV^VPAx&dL66$Q84Ot}BPn1{%?0BNsy>9=KcP78^ zA<R28W$^@<sENO2K@W;d-TyQC|G|u-#Z?~&RU5i2)C3)5qD5o{9SnJ{C?F~+czrdx zT<YBR3dgOGVkcEB8An>$g+uROnU-9+0Z!R9G~r&lK6Cv{=v>H)-H*7B;)gxz0L#UZ zBWnLR&Z6IxIR7KQ|07TqqQuHPi4?X%tHQkv(k3-sVm=iHW05v#qR9CR1S-AO<508= zXyObKXI|aJv6YhrH$z&k=ZmaurO$Cxp>@aqy_V@?K7K3Z3)FCkJ=tgw*ZZ&jP$Aa( z|N0;Pv-KY?J}zHmI+RalgXlRwAzpMbK{O1NW;n?*Yds=mq-J(+V%dSK8TlAYD=I+| zwU=^<{AlC%cT^vI@y(i<j;ARP*9^So|EBkU1H<;Gl^I^<^@nJ<v3Ef*#(u7+T^&od zF>P((f-Vd`4$t?@eWxOC0BxweFU&gXf8F`tNC^VBZk&loJOB_Sa3B4!nEfrWh<#ov z7Cy?($X^>d_6Ih~-)#VPuiuhlwPnpnP&}>X|1}yJNmB&Hx=S=yZ#{Ekf^M2_OrjA3 v#`HgH^nVK|)sbQ+%>Op@|F781LjHnT9vgb2$CViU_AjKw<V9<R4TJv=6M(ZW literal 0 HcmV?d00001 diff --git a/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-universe.png b/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-universe.png new file mode 100644 index 0000000000000000000000000000000000000000..f8d67c11dce2b6efc8c4018709a4430b05fb7ca1 GIT binary patch literal 21912 zcmb@tWm_CPu=tJ3VvD;hy12W$ySr1QxH~NFPH}0Aw78Xp;ts`%7x#tYrLahW|9#GR zKEm@R$&1Kj<~O-Akt7{0WgGwn00993M^!~Z4*>zm>%Vd=2HJlqFoPrx0m0B(RYBGu zsN^CXbIsj;>$Pp?QDfFyL<Dy{^OO!io`S{~J1x(4%3!UCN#3V|QI!oKW}{a_uA<j; z(v4SBi<cYo#T_r)4!(N33)_O<_4n7jYv^5}+3vl6e!V<1Tm8NxS-(dfal2bGXv0H> zjTZC&XEq!p`(;`9zkVtDYQ#%@sb{+Y+w2FP=u%A+yz4`ug8w&O!ThzHdAV;Rdrj*~ z+Avn&|H$A>Sb#cfLl*ha?0e}BobJhMAVsp0=I}tC?Xnhw#h3URPhN%CG*G(i^-}&P zGzeKEil1zq)Gs0A?AJ!AFS`80`mktcNZwB0ZV6?;?ACtC_hHe%Hs4FduobMmbS{(s zZ=UkVs89kFXm6?SZOns^r=~et$_8CJBK~a9!;a-%iTI2t98I*p%Mb@Grm}(utEAHE zp@7}Ds{@xh`*Sl+y;t4d%T|f+;*F^&aH61x2PuWpJHz*q1Gf1BJnuPMCZPUbjXK-c zC#`+eFY&DrhXv%%X^=Z}+8so;`d;499T;$WKJ^9GaOJ&8@0Apn_;~!EWbTl>5?@MD zm=v<o)t0ZY2+W8l&>S?Mq<|8sF%-HX2J?t{_9M!Ns!j1?)RmNP5RO8GjV^8eud(K= zALC-bJ_?4s_imex<cim9IIS=7SpR5xD@Mo;5osN!$^RO<9i#>X{M+IDd>A`tWkI^b zt8T#?2kjJr(R|rg!-*3CgpCh<6(*4@!A$z!`T~gUt?qbeI~o13-Eh7TdER+YDY+Eb zV?iz5zRUMgvS1?}4RC6qZbkm^pQ<VTUD;o0;QvQeJP}!zz!Jc-&^sHka0zi>-fX_; z_(mH;jpMqQSgPzYWwxu~(Bf{W>BASVxl35d#*%0t##AB4xPQovBq06&po~hVsAt}u z=^%}bLj2c@n_BiFgfof&vjb%71pL@j!f7+6mDN-DqNMJIDOc$ESoOe$^3B!)W(Ez* zDI5KdL1u|*S38^VX1%cxYlq)fWI7roN}ga`umI<9i!2W8B&tGcPPDVs_cE}+EdWw` zzrkf{y&ZnmlH+@cfZ;2S2K$o_)hzLa%d(mrmOLl>US5fmFIVyZ$MA4$+`HH-ui0Kv zf@>=rb}`s1!H9k^dvXFR>S(kRYUtnvA8eCf^k8QRAdFD?JB`(Mra-(~N}ej30urgB zT2{fNg=ZZ(uj(%LpZN;rd7Q*~e}c&4rM&(r&vw<>npPHn&DOiyG1nHtl`?1EQ58?H zJ#USB`PZ0sZ*t{7d+{qu@L;Z^!}pTQ!k*FjlsMq10J2?gbzQVq^4v3D3aYR1z!y>v zlB8GW=7<cWmzwRC{~yn@9fDxrHrPyai^I53bC&1q`$aWf<9;H+iFxeinlZa)vF(uo zx+DL=JSr>X(jnL9qAXo+Pdok?%5e4>k7WI#<(m|7%i)cLY2&2-J;e92KkH$j-t2!6 z)Zp<`K>CuyQ-%uc);Ptz8}DVE(~3U7uK;t{=MbHv*r?*z?~D%gTj6<J*iIAXX#N%j z*ITpQp3&*d$b3l8_>X&7NvL9kFiK^^N+{W&b>u9AZ};<mUN|_fkSZ8+l}-0gPp$e$ z0Jf>oLz8jo1Tc<FaCA`kdgV!fqk&?*6MgkFc^~UBVnh_K3)|$K?eY|XdEoA!P1`Mm z`N?OlYsNOz=Qnbo&-qjS9(sg!FK79Axr{6b=^aS~$Bpw@bT*CNt`|LN7qsTm3OS+4 z<5b8rvrG}D66@Y;T>7)FfVk@$4ob|)xn$o0B|QAn?{bFxCLj9QcUUKPRz+a1p!_Vp z`T*$^9!pwMIJ=3{-;nsRX!~xYqSe)+&-3TQO*zJ(C`s_jMm?9MrpGm4NTF@Wv}vtn zPgz0?X}ty=Hh4V3Q#nYJvJ(SrF(M?F6fWwlwcIaxM%s57I?KDJ<~C@=W8b706dl8Q z*knPU_CvtF*OVJ5&<)bt)w&&zemF-<>d-s;VGm4n`6aM~n{JJsjftBe(}sYgC&}xP zCPnk#qJRm9(i7DfmiR_C+=N-^Ym38hamVcGKN2~-<jb^?C5UB>GqeArd7@DJbr`+C zNBM3zmSndNWvEB^^~zNb(JW)8#1{*c`4_d=Gua~49hxx4|8O3Pjzo3V^`hFhfogmI z{UMbkH;x_yo(L2sFwyiF44eiS(?X@@8uyc_vLA#c3x0`$-!hEw|0x{_596<%*g<u6 zP&(N%mTk$g38_iY&p74=r<cw3v)z-^=d(ZQR92Yt`I#bg8K<vVt$$MsO5A%(Pou4) z6^G>yB<^yq;ek*N31_=H#bLAlvoD*Xfx;_~xDOXaCa~}VmQU^tvaBN5_9)#leP|#5 z(fnl2(HV*_ER^dRPI6GE$=K56IuLBO=%H+Ssoq4D+pKP0cr0iPa3nC5f%s}c#NEj3 zW#2Ph<($4Ti&zVDd~H9>8x=f*t)?vo4YeSxcHkkdk)Hipz1=`RvJC5O-&r~RO*IyF zr{1)oQ*q1Lm9AWJu+m)5Bzrcv#k%@s)J%kNrT3;;c-dW<-3%%%rt@tao{F=Vqw1ty z0C^pYO@1Hh!gXQ-UCAGAZI~3c3J%7!WwhE2#U*jlOmFk{lv48ts~(^=IDBUMLO!Yx zok6d3Jeg~z9pU>vM#j~Sf(++bARoEXUYn<5xyttb;Ndyq-`$NF%oh0)>&M{SQJCr1 z*-pv_iO|V6v*89p#NRc09apBO*QI<bb91|PR_PqFbN{4c2}nHg)h*^ksQT+q2nJd3 zPH1lJ)x5B2hwz6}fce6xpH4?h?(DBP<hJ^kOMK1g$8P=Clz9>NgQ0_wyCtC{b9+1A zrGuE={j9Uh{N%kVBX#RZJAg)Pc<m}33~FnX5&ayRCWN0;ifv{kG@s~RtvJtYxg=0u zuc%;~+Vhv^F4KgkyFs5V(-6jExq_wRcZRIUAYS#qR&d=sNpSa(V4JVAU4+fr*!KK^ zmTS`C6}DR#45nbWNalO;$IMFElUyJ4eo`FRr-IA^FV&CzlIu?oI53$Jq8zX7PXznU zCjIYGM!d*hUva&IHdOY9g3t;tt{AvDyC=b5Z5*UIWnFO(ETVVel6~XBx5cMwqC0Si z+p+Al#CAIKZ5fqXj+C*UW}in%j)zcRfR2n%jN|)n(5}unI)8xc$O}?qWgMR|-k@Pb zzVD?0Y*So!K=`yUDBS-o>qayF+B?U@@z!k18Q&nKv_EiFDIYgolN3N%jxy@QIfAB@ zpza|)-$4yZ-Acx#2p&620LnRK96W3($&HVN+Bar*P{fnY`%J_0oTLCWKB64emIniJ z76M-Vp8u`=0zC*HFg>3nv2lu3@o#ZhY!>tvWjm)_=q0e_&F;C#NlpJzH&gWB-e5`z z?I9OT&s+z(F@k%jMv!=qS&sSk&&>DaE)a&@NRM^cAHv{O7+#%rG+bE6N#5=`l}CS> zfeKgo5u_-|JsO{j#3jShKiUmf1ilZ<qaU|`FEWXXyPvQ1R$#$!8_;l{ojfrd%;4I1 z-1X(r(DDNHcFJ3gN=~86r|mPH-NNTa=^FMx#<jMX<|j)8r40|cr0uJiAZG0v4+Y`e z9*8@MaT}bzK)p$9DWr!@4&Pv}>6_6ooGbVC+lClt$U?gH+#B{-sKC%p`M|cAEJt-& zfGMA4DP2raT9F+Q-~{cZNu|SIYg=5wWX%A>mT5S4tloR+I^28R-g`U1f6hU+Ky;a< zip36z%6{{e`HCO;PMy`LxtU!iC>(Ml4VVczlDtgyVR{?75#WgAXP7h0otcEeSL&Nm zMipi4KEiiU757mvR_heYGUUv&<NH}R<w6-|Z@<#{79`OAuoj0k0yXn&KH_mEERS{Q zzk0CWA)ymCQePUomsgcb#>?E^+Emgf^UZY(EcS&eG;4k>BqbzS*hl}7<=xw%I;4<w zZ}zD|z^#)_&WvD=Tu~&6+f{P=anb}L;YiVgBHx_-HFHK3<8&qs|H-Kqf2$xB3u!Rg z$;A`Rl5|It9_U*5$XJiAt}m2t#jx~sb|knbuNEH+32n-~xy=I&#A!rhA2E;M^W7&6 z-TPpy<7$*mgP2oC3Zzjp+j%z#Zv3RRK}C4O6odeNMH>#PoF??f!v+Rf7#H2Wr*g@! zOpGZPqg)p-s6{kAw2r4(Sr$c_tmFfQD@{t;Y;orV4I9a|qhW#d!aD{N-^dXY@Op0^ ziOZ_CV`{F}O)YbMRoZDSwC=eI&x1xdf+D%OzX;VVm?}5qPhP#R?C_wc{z-YIP;<-z z4*n<kY&|H|n{@2jZt1AH?QJ$;yU4UWb7A)(RQ72!je@|{ae+EI;1-kTS(-sdJXIG1 zZ;ncefx=tzL?tm8ynu9?`Zqf)2N*)lP4M+`D7B;eb=c5OLQL=XHGY{24f7;^?A-f* zxO@YC{P{64vDv;S!1-SNXglo*46YpL4}iemEgQ>4r%Q`DmI;X<SuPahz<2TkuLAWh zAO_oCH~__$X0s-Oq?$To@Snz-x2*F6R}wGD{5{d|xy2fw^kl0XTTm+c2O@iv9gNYO z+s%naatRjB<1*$;Hn>h5a9psJU_V7J<xi0Bmk7-08)Slbe!3g)7H`_IwKs>44)W=s zg0&7wzNp3A0WYnGkS~6iY=ClS%1kdRTKs0``yM20<~m~bB{pN3VAL|WDG#R^JnZ<8 zJMLi`mA`(}m86Z4*C>&U-3{?7TyVr|-gP*%B+iFW%OcmD-bjWrwQc3Ytfr`q0E-I8 zYEhze57rRMPeSq-oPl=d*)mkyXSJTd5)(!!v(i_dTBi9%r$L`*d7|`XUKe7K*SeUB zMZS;rq1g3C6fA)j%@M|#*zbjsBDrMGu#uaTb)N>lFKCU6oUYfROUwcIv`x374KS=m zZu#Q5B_iu!&E&hj9x2n~?-WmH+?#>ptMEbd7FRF44)9lY8O)uYnTAT$6B#mOHxg!Q zGi_bsANb%(5VgQk2G<w58y{S(J8+OD>N2qeM+*qOHmx4ZscBu!^xrSfT3NB`%vJ(5 z;vPK8Q`?c53xqK(bxO;2_Kzconr)_qsHlQ=xKkM=vE8oL2rVU`x$XCvpsU2VZYQsD z7LdAYya_)Q*;7kFMzdN(cJ(Co?%NoQqT<ybDtK4shdnzCPgf2jF%Le~#bS8oFPQp* zO0XM*$AoeB0c8qcjYnVYX_&g0^pNUZsSc{;!i&9drGW9pvU#P!1!PPXqpqw>-iEGG zi5~>}H2ZzAjwA0;mSa_YC8TID4oxAjTdHm=t!RX?KYXV63(dW|cV6Tc|1L0SalN8^ zFMnXPiQ<p5WStWN0xfoaK&GEf^s*|Y{_bDNXq^eR{puY$8QUvzXPb~n$0X_L>!ZkT z5!lcEoTsh$=?u%}=mu#>Hv1x^vcTH7)*eY5`NM7{5Z4~-m@<2+{}0*n_OoE)g{8nq znVxF-RU0;H(y}Q=#2XQZT_^f<kU^P?a@afXf!arE?%Z%8A5VuR+uPfD$)b^1yA^8x z)zY}ox>craXRp$k_|Z58<?;^Nv-0(-F;7NnF)NOO>6QoPDe~r66^0i6Z2mHWJ$Id4 zp374mj7Z?KBQ@B(n>M*1apAr5^xn@}?Jv`{Kjkc>U6EZiEGXm#>nW4>q?##kG5AZJ z8;9Uxu)gH$#C~*vKh{7ma^!c;>Fjq1m02zx?lgb3{vo$#!T1ai58hiPqypW4+yc<x zAyEDtHIM-VAOD_|1Gfyi+hX#`y%&|#22G;`L79X?LVsZ_O@*;Sy$sfM*wTnce4bk# zbJ2V8xY}#0ZS?&X1~PY4`<Vrz<jjfpX$BWQjPb5qWHJOfx@dnpD>$%`Lpn#g@*VxU z44-l1DtG8kdUY{b)8teOj%M}V>z%3Hh|VfE2!&soM1^WZ9R<R1_cwog7yc2Z9O@1e z&!$`YO#z_R-rXi0Hfy22-wMIR<RnbG8Lt5BEjNEND)QplUWQBKHbklJcAv_dRwNvT zrRaF_H=%#B99Ww#t4K2y@$ekq7C|(+e>sB3A6Fnp?tsa!K%B|ce<L13QavDMZ@w{D zk6|E2suOY9<{qqtDrXL+NvJt5lcf31RW#PJTUs*ph}egY6*AK4e4aXASqVJE8=?^w zYUb&*^}!7Kxu2;wFC9FOReIK6If^O+`NfFDB*0`%r948NC`coT7@x+I<})2YWW<Q~ zFM}e!!xkm7BKo#Rq_RI@Yj6@Z``;g3jN02ZFn`m2%`_Xcy1rYKGLED3#(j9iDwwmR zENPj%d)i}*y<r3kewR}X67Tk|m8*g~-WBYhpz4S4$Wu8tAeCgqVRL#B{jooC5mG$f zX`P^;QdpCNix8V-uhcTHjLfV2D89)1%WH*<^lKQgUws|<6a4^jnl=$GBbpoNKCO|) ztiBHbKXx)C!^NCVrMtIdw&3IUPQ#;Da>L1W3nJx+l>DgafnKT3$*@c^X@K#rKIt1# zqm1Vmj(0B565tD41_ovm_ly@4aM1hx;><bklfQnXuBC~fma3U2Hw$Ky9er(&xojJ^ z@%QFyDjCmHq)S<D(%Xv{%uCn&RY7${cqFEXe3hgsR5@90AIX)Qu9$@cCEEPkDXgw8 zz>*5hT0=UBq@VhJju(A{ecmF_%=<mhKt)M}>v@p9r6T&$0N_=#ACfcLO|*Yk;h8Z2 zp;dSNiedR6o?T;+vw5$G(lBnRcUbhILy5XI?t*lnpjgvWhILec>Cqx7^Xnj2#nM1t z&PSFMQYsoH4`yf;7r3kEw1)Ct#t6<0`oOJ5mg-Tl1}K_&8UUm;_EG{~J0HAj(Fnc~ z<1Z@i`{P^WhFB8;C3XFpReF-Ia(EY?mYuyUJg_X1Ek^tnaqOob-<vD8|1Pk>2LN3( zAgh*WAJolEv+f85o{~-Swpsfh%X7~b(k9lvf5h+3o?dRr@^)%|vo~2R&AygR=`fR2 z&dUAcm;|FEbP<qE#*F!1(YWB!Jk|Ooux1k-KB6G=3F)!p^K^W3vYU}l7b4Q8ca}nZ z!@yFbV)ZLB{+Z`VAKvP<^=P>BuMZuv@&G7_5U_6u&N9_E1;Hh+>p+gkWE=<%>;!#s zJaMlrlLnK-G1$b}ie_+-Aakwb?Nf;l=w&U{wGbi={BB;rXCELIGu^MsJ>_+qA1s1X zW6nwoh(u~^*kRMgn44yt`fB>{dX@BNXWopz(E_FnMNk;qLi{`I@=T>*9a3QXT!qg@ zY9ezv%~O2ob==@r3oYm+67(jSOlQX1g#4~b?pXOaL~2EwwC{Oi;$ahgFa0KN=IaAZ z{$wy^y}Pw)LFbG26=C6^z<!s#TPHpeRpBZsbgpA}MufH{t%>=clZgCJ1Ln4WIJWFg zoL@PI#YdE`4Z;Bbv`#xmGsc3a<XQb~Sl7bM9;(x9Q3N;x6Yr7-yQJlnw*8<Aw;T#% z&Jr1RJxzIMS$o%lZPm<4cPViK!lTC(nL5cMT<0lkb%11)E4m%cHow37U9=b|<*1r~ zW>~mJbO$$4`-z+-TfTC4d&#u6<fuZ&-$59IJ^A;YWu)qM1QP0eP$B*%%Xhw5${cvO zZnApqa>cF`clMq+{%AbsR<+7BEd0dwH|ArfZ5LzFvVi&OJw+ntKV_a{4lgyVJ^FL@ zZDa8YE9Tn%3+L;QLhR97eOZ@$GdP&jIdV{xTN}8B=E`v-uN{-|;kFs!=C2@W+qx_F zr9XpXK9{`8{O`d>W-&E6;U@etqDEa#J<q~ga<Y{Gm5eKN@1X8kwTXW-U+liYAu<$8 zQ$~QW<J6yeALN7u7Gd6L=8nS--nuQ8Yl`$1Uc4<zrk@5CgJd8)N;AW&9=-$_3bwZ! z{syrumDXs&HR-b0OyrTh#<auAwE-jV#6_aNV53`-C!h4~N%j&aYdlcB5L}JdONZYt z6Yw1tsrIO2$U{NUxn`7Pz;(ipbv8`|(%NnhDeS6td^n%#N*DqEl&?WsnQ>dIBk``1 zBW*DPJTk6>@vj`~29OgVokFH!glF@B)$o^?=+lmpYudL(D>orr+#stUFRE~-o&-!U zL}$!mu1n>ym~c%bNjIiH?L)i+@OvUVUd()cf6IJ_gXz3g-2A~a$JTyUIhsP({Ab^0 zGoI^mjSR|0Q~S%gw;CHn{o4q!kN!H%(AKGs+6@1Q9T2?b4Jbd&BaQq1BbqMv5TR*5 z^vI*L!A%M%V&bhL-hEofgNqf=4TKZzEb5`Qvt=l{(R3(WrDfAu$S>P5yxg##-mT*r zK?^?WPMtb>sd#<0iEzVAPv?Ci$N28-kbsu&QIx?&rajpDl@rHJQW&f5)fs~2<r0?0 zNmnzlAVk`d;PT8?B0ZzgXI6j5ocNFOJM;XSP87TAC`7|q$eS~!_96|jnAtP~*{1dN ztp~ifS+`I1>Ex80VW>T*6mu2SKYWH;iS)$CGk>SM;U0=IUk<RnG~`*5#VlYPOtEZB zz1qZb`=Rj|2C&dfL%VXs-(SB>EckULXJjgT*-vOcANP&%Q&3ZO)??~^C!B%vnd#ql ze|g*hZ+yyXh^pO#-2>&NxW)I)D6^S9=iP#p)+>>+;PR9+-m^f_z*m|Kg?e*iCHnER z_f+-pj}ZGdn)}0pHSypv4Oo1Bry;M?u;`p&()92tSVd|HfqD2Y5Uc(or5Scb*!eoe z_ZG|x7(8@YdRlr{<U9|%M2$R^7nzH1UYU(gDVg*lnoyx+$2^j+U0OKsCJVye(AO(0 zO*|POd!S!*0b@3FQ}=&CueA8NviorZ=qTq53P!xFJjJPX(}&oMRcvJCe$2HR4o1^Z z6#T^F^|t}2zy`*sL)>rQX0=rhLF-dypFi-)Ab#KO<XX+7+V?;*<}4apOnun(sA0bU z>-l=K{hLEePaf#HG4W=GGW7m&Ao&~Z<+F&%Uz&Kq8#QQzu{uUOO&(I!(|bjv)nO~l zb<kTsN>OkFm*ni*3cZ1Wct+zHt4b@zhCLJYbXmj1)1?dYOn$o!8VUvX^gps>Cyd4~ zCO&B69<&l~H6t&Dj+^%FyOJhwWPh_!Kaai?#+*{dvz@)(caVrO)48T!7uZ-(3O}2V zW;-Fxku{)v_`leIXf<WGjz-ss6zjmoikp7>ID*&4xS|@>B<#-}w2gcJ44Q*ZXja9N z-HRudLH=V(Ox}B9VL}avMZuU9srR4Mhy0-Kz192lGcf89KG!HA<VhCQ=?y9HqPKVm zY4(Hbw`I!FCz<F!Em3Q|xjLKeS-bqRGAq03`(lRd^C9#55(hrOvR2>?=rokViXV%) zvT^MS3C%DqQ?kT{1orY!Aa5*#*oY4I1Fo3XWAK%qO^KQJ{v3V6s$Web<cO^2kv1d< zpov-_u0ti`ORuD3hDD5gbM1=x7&8)NubSC~od3HVbboa+vGyfOF1|}Lwt}T4Lm=iu z)AwfFr^CQv`?8>|??~!C4bzsZYot|gw_~+kr&#ZIaNHD&qAG?&UC0Qj?cCPPJvK(e zx50naYATy#>C!Q~mz~`>8+~SD$`9(d1jpFb{yY`rX3{OJ!wp400PL$$dFw!SaV=O_ zW;iSPuCK(v4)^QeUX(J8i^QlxH`EYCmU<0eM}ntap@R4dx3Mph2sr+lNok<U7q-4z z0Lg!cDEgiNud^Sq{*_FID%izay9N1*o-I$vcH<U6%6qP^&NHT@1B;*7IRayVDf4>z zyS_j58I#SeStc&=rQbd*tmwMLx-*_EiZ$49No?bt_201o_W_$u>ownu5YxRg(f2L% zn`unn8{ACFM5_`~wLi<FBJCX6ST))ll%e(*_rv;u!Q1berMZ-%9^D{2_elujJI$}u zp`~N7g;GI`muh4%SKb5{<^K9FZJ!BeEKDXYGZBI>UC<`s>H)m4!lQDzqWKK}0JPk7 zd0F3VHM>-n+|NoI4O#gC!Ra-X9Pg3gzBKG7nIm{@BNIWi&m2arTS&H?LQd~cLG)i8 zy4ZN{LU$<=q9UxY@fI$9f{s$1u|SRT$zj<yQuM^#lwIEUSR4rG%slCZh(9l43_Xx@ z9c`*lsqy#E9r!YocCS1ZdS2mrLbepMUHmAyhCDPG%I!R^!!u<Gf?gNHpPfqkJKK=y zZwd!muS;W7m+*rx8^w_NAK@*rNR{#nGa$d8RhVAFw*QLV_ok8AIKB_<LnZctq50wD z#Ky|2NUz66sh?PQc<T`m_xZYn3jOq67>OmCATn(X^?QwJTWC2BFKwDuk+C3YblXb@ z)+4#6X4cqU-O0a3^?<4yuwNTgrHAl`cW;$mb`?qIY3=k;*dzw*#gcmZLeD~+b?rMu z0sUo%CH)1ZS6Vt(2N+(D`k;kLc}>k|LA{4gBsIL_8T}|uXuna;7oc`#|9s-Z$VG(^ zA%MBM!J>R32TuKmjr!Xy{Qd@#E>lUNvc~dht?7&fY_g~;YtN41Hf}rHSH!^Z&$`*~ z`4$RcUVTY8?kE3^jiY`Zhit#~3DLh!MD`ga=fM8bVx(ITJ-fM^cj%!G@cCrz>NKJ# ze!tb6!No4ggcJ^hUnfIx4+`W+T@_meizP|<Th=B<-pN-~&+`MY5Xy6m#?_Jb2cByv zbJis~fHP7vIaSZbqHk9=h^h=W#!Mzn(8?YgGe$Vh>TmHXZR_m(*%u!?j<Mi!`SBMH z@0bW=m%FR6^)1raljL2iY>r0xLAXc4ZVe`1@Kr~mP939te(eah64_nGu8UW;_neTF zI<FFY%qtb{;I;DL6X(HO2)~BBG0Z;klW)cNbJBt+y&FS2(iZmKIWrhRTBc+ke)D=1 z#FbWgAXal^S09HS-+YcybdFkI-(u6_NdpRi)WB4yPqSlRe%#>YmBV<fSmary(2^Gq z6CnX=I78;BXEmuJT7SL<v_=V2Q19cY6YTyC@0X^oUlNB%MPPIs7F1CaBA_4I1hR%} zH$6j^GC4U)8TBJlfXSpSh*Sk_88N>89zL%DJ5gj2)Hy&v!XmI({=!wU;Dr=5`e0Gt zwdYHGAQ}c7&!NqV^2^m&QV2c$K*RQ-32Hh%<wt1@+so>KA;YZdKB8?Qd6`a<<D*{g zXl5TRMxIqH3@(NnFls3q8}O+sVm1NmRdsrqy1BVKmJv<r2l*e42DH@;H>PSAQzd2% zc8fB>j|UO#D4qXZzNgr_^ilE_fIvU!W&Yta`7aqx`N+8M(M*U~>jT&3%El==1=wPr zn1M%)18T!N1~zvg)<`!QrXIPbOLoz>d(;{GeIYi%kzlBhHTU=(&7f>_MnMVhW!<vi z8&r7~%ZzdK9yc$D6Sq->G7s5m;Kp^R%rM#=Y*#6PO|oiOg~uaLX6N@b#|lwe=LHXS zda9Z_Big3UNB4^x;O~OpmnR(<S1j_H)rJa@^q2UhCa3-(I+2&$<JCmgob}!N!JT3n zm_1^FBmYU=RW|R=3>WrurcD*HVh90_Q@B*_db8F$vKxUEQUgtKj)+O79A2?f)4aKR z^-6ByFk;FU6g2au{fc)*4KoewW^svo%9}o$IH1ME->*a5SYz{CM@q^YV!aQ#NEBN^ zuqX_^+DKO<S!&#;3KH3<gP?7?)c*CccceI;)q(!+{l4XgqOVw!X^(zfSA`TeW|>!{ zg$$P2+`#IcNmHV>VQ!TM&hK+(cO+78qjji4KQ~rNN8l9sbuV24#)C1QU8Kf>8Ahs( zIcsMke!zyrgs9b+;OBh!O9{Xg?`SBcB@kT!D?(Y$$x`<?M-5h~G6o)AfPOPso^T7H zADZd%`Xm|ctxfn5JTXpy;}N_6Xa<J4gvONNLcAw}aosHg2wS-t{D1WiK30QRn`|s_ z#j+T?hHgtT!gg5l@#FMDmgPp{UNhUfe1Ms+NSu8%n$i7>LWZxN1OndCB;~fwb+pkH znSx!A)mNwl%Yos^z1}7X2ZC8g!Q<-m`C>mxicXx+_H7{JZnr#u&Zuo7Rv{H@iA4j- z7W-L$%H`xZ#41}UghAsYR!gq!Kg98SLtcH-=*%0@w@ikC!UNer70Kyr`v;uDTaz$z z4t@`V%XhwDnVh;2sLT6Led*yfmR=AOj$!{!6b(P}SF6;U$GX(5eH7BuOpM=)6&3S# ze$38`i6&Eb7^{--t$+&l=iz-Te6&cg^Oj`uW#a;U;JZ(QywCX(S95#aT4tW*sP18m zaa{?M1_lP`3cvmd?H6y;t?I`<M?Dw%?Zq_bj~(-0*qo@Nk~gJ>7N49T%rInZBiIvR zbz!<t6Sn;(UipgY{X_T0c7xtjebV9B*51qe(Z<@pt+sq;Ja);|b{EYiLyu-#f*eBm z?yE^CSYZnidi6tg!a43NMjT3i!}!id-WqKm=yb<Q=p2u*%9_vV^o@1Um|4zt$XqcG z_$n2HKx)3r=$Dc;@DWZ3vF~Lf%Nx5e2>s^H00CYtW5E;&h{R%eXXppA)`HFw>xO5n zvc00<!$bO>?A7Xw_pD9#WV7P{MUa)@WndlEEu4yPZUurR{%^BCkig=rU*3~fEKu1< zl}!in6H*3*bT*N5*YH7t==btxzsV962wt2|Rdj=2(lH_&{rd~HOxAaN@0#tn7b}ya z2)s{n;P$v*mud{?^v}lz*WG#aVGIocpH^xlNabt<&59LhFJ(`#zCX2pr?X;LGwJUg zEE1s*)NFI`5tg?}p>~aXLq)lgb8xG>OGEyHl1MInmAmVTCg(}Cq&5}WdxeTTLZSe| zH<RW2a*}TXMzS_8HKWB8Z_8eAeP>9wDOi`PlHt6gid}pqjR9xGe2^son*aEC92_2I zQAC+@+o@bZy@g8p&p%PVi_&nvcV1f~9p%X<M#``m7vT=WEA8v)$djTQJtE^bE(75F zH`Be%{FdWkig(HWu>}hky?_GNjh{1d`#OJ9y9jc#q?xD7%|=hs?~_Duv0s5B6%kaI zCGHhbJ*c6cpjM#xXtyZ@>(T}zltq4b18e*{lUsyIZne0#Req9buiD(vWc0ooQ^_4* z19g+uIO#0q_LgIx45oZ<n(d~MWAyiX4IMb*yGnspekQ(Cq1d_m<*kGovAnVe?htu$ zcVtnLo<pez%BSfohx#JclAm9d&Nv!^G@k7C^*IoKe~eYg=S3HO4O!!0up6uPSLbvu z&(xH?;O8EsJAjIj<u-$9x4flsg?{7!w~ex{j$}<pxxQiA%K-~_XK~8facvh=r<L#k zEmD{<YYI<OE7|zt?<`YOmjpE1#V3%CAFA@OL`_#rBd0n7!8&1x<!?w`u%EmnyF})6 zDNl>Qd|H{FgGxJH5uDYGuKW|oOD%@8I9>YhaA3Ffm{<{aB<axBLvl|)QI!x`r@n#P z=9@~(bryE0D;asYR%>4ut`u6}@m8X&xc+{XU8v%gdvgD-nJxAK6Xr?>4NuA?+h2_< zTM~{W#pJ-0O74nL7cL&ahAK@g569uz8l`7){ak%Z6on5Dxlv_(yUbOZ+S%3TZzkXK z&%dDC%Kj16LAy#0>iK;q0`{!5nPYIFuA=T&kb_01wU!7$obwf*wsbJ2l@BZJcdnww zf;j8#&u#NjBY3E$_);f)A58Le*u`jiP1vDhRf%rDOuOlG4@*o3G}YP79yZkSb{6Ot z!G6&XRERV0D*y+u+dc^ImjQxig5x?8oF2&Sg3n6c!dz}_21${ROsYV&Hxax|+Rpf1 zCHR}iFET|Nv9LyM29m!GL1i4p-?GkPZeQp)-hZ;WF9mAlPi%*pT}q;$rt$0iNF9w< zzWJ~+S6>k4Kcx0YaU?%cw@%2D>cF^4$A=uroqQXkdz6|3<s3Rs{1>-+ehh9>7NcRk zDs<|EdQ+LRi+Yj=cft2s^WBj3I**Q;l$vLn-+yk_BH5!lFSbzdN{zt5I-)9M=hONF zVXR7*tW<@2C@Sr*R)mQZqVwIl_Lfl}+W_rf9l>j5FwqhQEb84JP1)2Vrt95YzLAIw z(%1t5B+~;v#ySmBtDzU&ly`HJK}L`lVtu|3^cv?07(2g!M)%)uo>@lpL@-Q;7m*>p zYkY|5c%2{=UXS=Q-il{BWNsI_@?p4Avu-OuuV}P3r_S4vc!|Y+a2*%8N^868N%Ao_ z5cnh7Fl%PnR6K2(^PeUQii);PF`}!BOKc_mtvBVR8y6tOh$53bj8i}}Txm<A^dtF< z8t~hYNeLg>ER_M}Ti8%Imwd@5_Dq@iBu(|bcXS72fx_3Kx!_01fsT*x6P>4B!h&*> z_iTmx$*h-MWcoiJne;CZDk)_}D?la}T~cP43m~%&7gKfp<cIKt>1V{G502UMNccWA zbY+=ma;QjrpiAVm164f@G5q!|_7zb_xwFBkK2ZqlG(2(70~%BomEB`eV5fUeJos*@ z-g4VbkSX1$$OCh-izEqkyZ8|DNIprfv6FG<+m-u3*Hp{g)1olRc)rX}H^BL2aCiQ4 zUNBGqn};10VBdvXsfo{QEgAcpATl1`7Vt35hiQF%d!E_zcQN(s^O5fa`gs=g8$jR# zZtk2-0#g2p7Y4#npmr=#cy|~#mWb*HbSDje%Mu#Z;eIwdNCPV4q49nX$H{Ym#PIu( zzV{sDE&|2R1#L<(_MtvHNs^O{63KLHtiTFWqbmGSg%7f1@7%jS<0xXecLa%VF9v!w zA`|W#O|;)P_-wVH9Y_a$=(bbWA1f*ahRuv930J4*#o2s`BiHH4eH>5E$`xsr=*VJQ z;J^JoZ)Z7Z@kRgVPRDwI&On_FH$D}NyaJULA~Q0*Z0QS~G$adVgx2VqinC9N)<8(8 zi5#jHEGG)6$1bk9VOfH-DJ4e}cdc!I{buwc6fGN8>5ntF6fCGOIW7A=;~bmmw**_y z@v3${poBH3Jlk{dkemK(8h{X!<Z}!2%(`RR-D)e!?i4~_Q?X0K?WQ1X1aazs{rznX zv|U=gLw<(}Uc}3s#4b^KSo|pvB*XGo4ts$-3&-0b4_dE;;Z>FhO-!*jJWX1|cCKq8 z%Sq$a{&xSM5x=wK(}RS@hf^4q@KNVv@&q9>;pdw|*-igf9-WnFcD+i4#x4d3MF=k_ zoqUF)gP%mw_jLAER;{-+`Ml$~f^N$Mw*H89e=a?5{J|sBXzcD}+Ypt5v)a#KY>=HI zmKh_{g9=G~&gJ8@zmQ5)oyyHxxXs18YWr<@@&iIWyD#8meA&7mMAtc^dY24IEoVXD z9KcPJTruvpi_Bgz987TKpR%~^oA1KI6pc4Y2dvwiLVcD&+caQdEWP#Iyt6}X*Ou^x zB@a#W9b44`IZTJfF|uZLN12{GPSsE6Srs<8`(NhO@UUjhaV#ciF)+?-d2D|(8tQ;s zvewnJ5jx#c5~-5b{D>?J_Z!C(feEUK<0koSt$rOb#ryPM0{T*xI@F#oY=+PlpF+ls z@VUZvz41|@To~=jL+c~^v-P*5FiTv-)A@>X8UDeRCm+Tf?ZO{)7MM~{ODw5(lZ{nJ z#+*`5k9YHa=B0U6t5V8C1Yh%(_x6Sf<ix6a^{gR=j(H_qw7pIJRjJ=QuO$in3cutH zp1#f5Yd0;S{P61CCDTe!X89Z}CS6}C#IdDiK`nSQ^nOAUa@ft`JD{QT8X5if*HJIA zsmaN-ZBp{jGIB3LH}lbubRV>cv6p`WjgplENoz)EhqPc2u+8W6(2}wLkpS|#f;n4! z^u$D@?GSIm)a(J?b7?;nCE9fs>{8KaXxQ|6hjjx+=ZY~`D1OZYW-7UtAoAczH)*X5 zG4i~+>wY-B$FN^Yr3K*Aj&FKT+Z)kxLW6^%EpgONq{zL$WUjSU8}pkturk~BT2a-* zGAHM^+K~zPgWg;meHVW7a4N~oH6&7UX4~+Xt9?y9v>_|Q#4oB^!*c9^M8Ud5hec1) zF9;F2QoII4YYk<wz6XYxhbWV{WZYN@jjZ=beFXmYecW#30$*jtGFB>-M_Nu_xr;>B zM_8Qe3|^35XPSL4{V%j`Hh4CR;c6xsy9_5l`SuI^!^a;vc+MH;>`A+|EQNzn7&~l2 zbi#xJ$4r6ou6&U~glgo|JjdEN07^mPrc6va$g_V=aU{kB^*#kS%oO^@B6isEdM#=Y z$|{r3V+bgq8#}2~xG`NH?TT?|XCEi8iAQ6eK5F5W&42>99lo-C?yHHKj<eATW!a3I z28YU$9p->1e@ey=VK@0QUxH>{KFhr;(g8*YC8H!q4kW{Qk_#8|t^h;zP^<4%^;#Wk zOpT+)6%ui<b>K=T@{#a#ep$(%^Uvnfa!e*{;7Pryf|2}Y&o^cR)iZy6V@XNGn zU4^{}`B{o&lmE*$Y9&L)vSyrj6(>90<$Z!rnrlO`v->L2p|k=M!m3hloG48j(E2q$ z)<el{@FP^PFEF&Zrj=+zb6=7nYe$OXCUbf7q(4U|9uqWhBim6{oMG+Fik(pGz=WCG zNJn#MUyFX^<NB%B#?Pfer^jtk(2L*s-i>xYaLMkb5$R!U+5MJ=M}0PD?xXGI{ythK zj%~|OT_z5xFJ2ZXFY^!|V7Kn6C$8{UWo7ed5N%2GiLG7C*b9lQF>4DS21n+F1$NlX z)N?~3i{|Book@_sW5}KQPtb&F9zL0!d|%$}sRyC@)?tduFQ_uE;5bQ|Y+5nE{*{=V z{kH>k+|B{=i&Osnqv(x3c4D>OJGQxMisz(6B4_|gRrIY@4VJ)0hedflBHT%YYNQdA z{@LEhdT)R)mHCa^&Y!C(3wxQ~wBmNZG^k8{H#``buS}Y;;bf?VtWn>qZlZ;(XZ997 zVZQORq+CQ*l0nCa<TvVxpyNrIX=NN}`x>!(qt<OCDrZDr6i&XseAcfXR^*@E{ex!o zNoVh5QBJ-(?4FM5O??J?OIV4EX(vl-$@5OOk6NZB`Yv+H<}YK;D;Q4)S@$Lm>&vD_ z(xU&o6G2-w!C;4J(r5lIxxK@prz09H(#L5axhHlQsaaY>5L2@8%yl}wn6Fli$%V(s zWhzHK+vjoIewq0FdGwA7Bj6uLyq3vTdM=-0w{`2R;+pcE;U+gH@qaqe;WzzMYf1SP z^#!(vS&aGOSE2oGf{N#paGDcaF9qsWj~KN4W4a>+^n>w-r+2C(%4T71yi_{D^WG5{ zd!)j2vZ(^^mu;+>FH9q8X-T5{-RLoV!kbCFkissiU5k)OkDnd+l<4Neaf)U8KXfYU zz8{nT3@!*d%LUB{552$?q8Qq4Rf!d4r`<ObT<7zsSTCsN$c9ZI1bm=uw%ps^uISxS zU;WT^dM{OnF6r&LV(;{iCVuOv?R;VN@zY&8B2YA=HI5raMTl9`n|gLmEAvheJR)BP z{_Ggm6vy}E1T7be4fUkS9f7OYvo+<7`j`GKjT{{P%W4646NUdmxZIN?uloqGLWpOW zZ~c{b&}ms=+&MJW{(YKygUN9+;Am}!mdLNnAZnyk>7tl*A*L7-A&KcToro8_%#bKu zPP~aeenWPepBWHQ2CrMN*zOqYZp5^(Ihz;`<)lyf^&$J_hA#+@;rfPbX?OBWh(4wd z+q8O<$5BHJS)H<1ML5c44aDoEPG}ZPjQD%%pR-atk@+D}rdFB*Rzr-&PX@kf+a?-D zn%tI~8hVuw-I1!Vx8|y+acb-~-|<I`%&U4FR|YR;gPWMavE`98O!ji>@4tWE3Y;>r zDAK8B2+)bXCBdK%GYX(6<OGqv?2kSOsA+%ZZ8O`{jA^!l$7o%Er(LS(zHqQ}LWyrQ z#GDQ=D;HYmEq02sN{Cn}^aE()EA6>k?wj9_1|bg98Rdu^RS9Bv5v|A5%We1rH<u{Z z)4UH&E{k%;y|4OW0qB$|eCin+(4kS23hpR`zYcWMjAY6a0}*(X_U0}=rN-v4;F@G} z2v!X_uL4_?v&0I4i=)24$FX&>t312xqmt+!49;1C>?#VC@f`|6L+s#binBW-f<ZCH z063^hoLR(3JP7y7igW#el)Ti0QlF9cRGECNJTypjQ%2c_wr+RjWTdi%OZi6LR%-bk zYxPw!OYKsvW`)!YzpSl@vXO*+tWBq=QzlB3eYKym@#2e3a&WAyQ~ZaqLWF%JrcYRV zWVgHCc0ESfG6d{gui7S`1mivG)sQ=o4!eBus|o)QjLoK_{f$Hk1zWsDA~lJMgPD$a zs;RTco>}<fBe7HN44R%1Vii11=)1>%lw7dmg}9_MFa4X1_&92T3hDm_%r_J8`}XA* zp482EeDj4=rT)#`GsweFq)r91Kw`xxaMFFVy_{$?$Mh*05vn22o%js>^&|%2s#TGy z#+Uq5#)vmvQ@nTwKZVxO3|Y)rMnnb+esx_maDC;{EUL14Yvc|!zDZ8(FFpdSFb-$z z&4gklvWWL3=(fBEvXvm!fkj`7qytHyOsxt&3tjc!8jMFM?>G&+e8I2Ufx_($x<hd{ z8|j|R=KDo4gy{s9-4IsoN>x_HPPtXA#-v}nh#y#TzpMV%@a8_5DqJ9<BZ{#1haKCx zSO08ev@O1hgY2MUu!2lvD>z%eId4TQey5@^sZW08)(^2gRy>Ed_#KA~PKHw28G<J= zPcI0<nhfX9t}q9g^Sg4sLCY0+e`P~gk3o-g4u2|jL;#&Q$lZl1a!LXELst`@{{Xxk zlXz_<KL!xf7onz|f{f%jmV%p0oXF2)@y}r>vHlWij|NbC8d7)3Z<kOj?y;aJJ&=M) zfSqP6Aoe*vv|75Vz{RYKaf_Q$-gbkma8r2r>y!Pt_{tQO(pJkOIjodx(|*KKXgfB` z5ERtRVPF)}j?D!XM|Kphi?;8Pebg4V8|z2w+7n`((~oWr<(>*J#p?T7%lz+tD8|dv zfqMj(O;%c=@ayOxRa;Lwo4T<~<>EV6!HhR+2TKbk>`R37Ub-~g!-rl%Qg!lm&<_?4 zd^;m7HaqXLfv%#TJY_gFv`8R_dTL!1$O_K>W{jEUPCSB9zM}D9FW2bWTt55>U*|<Q zY$fR`oGJk=eQZ;aDRt3-s)w1=%}ox7t&0ok4VE_5!8H3#_Uc=ngLwOfSAkYcz$~=R zRh8Ob&VoL8Y&y;R+?me8q3HhOS+-8)&_4D%a;go9t63{9{m-<UtBiSUmQY_ziW$#j z@1rsk+-hOc%g<I}B>#n;N?jGyUNnGT$-2{RodQR)=qP!*oAT$T>zL<6i-_ErwBjsC z{?l8c$&b5cCdnd0SaC3~G@ixCkJ0w4Nw7CeqNKu1%43@gPUZJ|b>Kllb;#{ASG?9W zGy?jibF5>*fdX)ZwOiCn=-!Sy;yEcVcC=m!#_gxgj%dtTdy{HOC#9%M5_lS=V4UBk zODv<9O%#yyWYMf5&3SQ`7+-*l47enu(xR`2*J>KmWrlOlYrFzQuPPUA=t+>X5APj3 zO`NVG*eVC?MCSvvve_O~cT!Au%RY?c-PqxLWy;sU%mUbY#<^WY(qD>oBh{h)@Gad; zTp*G9;wX_8XrldI7#JcY-L^r7XBe&Hi=NJ%vXKoU^)v40YX0oKh5IAe#E22IWr4Yy zyN}54bLGMe(o6}g#~&KM$LxgD5s(pCjBFc>J|g)gk5|b$-yXXktj2K`EyhbjB%8!d z&>BDqnwz%!Wmx%Cob{6F$K!H>rStchPK7TR%qnHk;H@2V?}GSeXng!4Dej`sjdRGz z^Ya*yU}3nM#5;CgR_7|k=p}SOr&`nj{hu30ZuC?TbI%J3#k3@5uL5<q!zKZStLjkB zYb2l^$SrUFC?7xdY8@9Zzxlyu=5we?RFUR^ZiUwn-B7*Oi}d~GSp`)bbJ9FTE)y;v z)fpekIZLzDI<GAVOC@JJcKU~jOI|-+<9V?cIyDwnf#)p@$?3nysBiB~c7$Y6kC!}h z^1V}1YeALJmh+g8jOl&8^z4W)aRaja_6xtUYknU8$crVeW3IqTZ2LdDwB7a7>~1$| z@^M3Xnfu&7Vx}v9>H5akLd!COtn<Q&S2V+s_JGr4)w*?=e%E&k^vs@-N)3IHjTm0T zvZrYQ1iM34wJGLn(^iGBD*QpPQYtNKj)}Qib1hwmm>mJx(iaUWrR&%9f-%WhZ~u>R zQ(1KR8H@&pPVckk9Q=T6;bT922di)3kNo(r_SkhCg85_WPjCk!)!7&==%{gmc*$r6 z`G4;*Y{jAqYR5;BiWIO7*E|E=G$;gO{+fIF_N5jKl2+Z0TNsp=qsziH7k*^_wfT?> z)$NNw$S-XUpj!3oSoaHVoxa8JidksuroJZ`_e90Vel?e~wzG=8?&YQ@X{C-^zCkOE zsT-ZLm~GBK1)0$)kxWstc~KiVdY*PYykRv@xU}lna<+63xZ*CbAa!b@=1p!4VUy$U z_EDSc_KbcdMk*P9G{g`g-IlI;|6_x`ihu+J6?MSig&510=+rwJVQ>8CQf9!}3@&Rz zGt)<HG@etS9qEmg6n*SH*zl69a+Ifuf~L&0ycxI|Vo}9}KkxoA5-v&)oH#f2J=ON& zd{5x~xn)PU`3?W_6E#_g<Ovbz0!-u=?g_LW>#~tBq`fC6E|M~V*&*fjy)vMPIP&$p zE>VrfEylK>E6C8!T)*I>RE~3yHXy|9&r{4aM{}{F-_n3TsDFO7QX%{yoAXTBg1256 zpURTiM@1Zjuf$&;904=LaJIGH%e1D>)E&g+^x59M&ZBed;E}VCROpu9KPhN!G^N?@ zI9Pw*7E2;B27C+x2**1aaAn@{ahxC~W$k$eCKLTQk{#4yH|s|_D+O3h_Z*216L~h4 zYMHE9VVM26mKfiErj#-Hq%-!eC?hED00~inQ*G6bqxu+3Wo`hcg%2O^3z?@=gub)i zInStX2pl;2hmo5!h+_9?=%sf8utVEos*k+?&7XKM163^$Owr<sG*ska+J+^Z#m8=L z*Rz091^E5$^sZXI>ydYe`p-yxT<8-;kiL=PO8r9I+F-bJ;!f=Icj5`YOa7m~-E0{{ zKm64gKUTz8-x#uVPtqBc{XiBeK+;emZyT&-chNTg)FlX3oDwDlSW*cSHYY$Sln?hd zc+t{FQ>2mNRq0RKe7DF5MALuGeQn3xdp3sXE@p?=08?jB$;1=1fg%cKlbKmm*!!JU z@y`;>!1cd(-eikz|9w%3q>V<k;e%YuyFazl0fo4enWLOBle>TjCxC{5G&n)*)}tuJ zEccj1V~NgFjA^a8;g`wryW<AR#tOM>6T0aEqk1q?kdYGdvn#eUK1zo;zWuFCx*n~> z)6tdVguu2HAX9v4YUwH-om2ls#gE>Mb>L^B7yZ;)51QXQVKA?BT->oWIm*^M{LTkV zR!IkEPBnb9!{DVHL%AR}*5}`_-N0ZR1xipZW8DB5;bFe)uQH<}QLHqr$*52(6o6UK z_G&zd$o82keeO2P5${-bp*u5*6iNH^>JFi7GW?AT|D%#(=99$JbUwbPSGPl884x2x z9e?8D?G3FSxAHEfsh`L@5;qA!NEGTRsLwB+?=51L_{>S*Hk<9VYdT&A7r<)#6)>=_ z;_{}1>-0*u4-5}m*%&;}ep+(fT>ggX##YiPoi<G2Wx5}H+sKc;>Sh!Vq`WfW>|Wa= z%*BPwe~VDS5X1GZb1|(=B@9I~vI5*!k%UTm5TyL&2d*5WcZ~X_K8C3SX`i)Bo>$`y zvsS+GfF|aHM$CT4y#)^b4$~U@f32M5R}@;f#sP<zp}UbGhZ2wuL23v=X@+6w1}UXM za_E!}DNzLJl2JmsrKBW>MmUr-LtH%PuKO3<Py5SWd#(Mv@7nMF@I1dn*$uVmQOGnw zK*fwwZX%T}*FpYNYk<=SahI|@07}BTUMGanRgace#F48Q0;U}vRY_$WiYa<Z4PQo~ z@yJ?+FuLcXMT!-d7_T0y_AEIo?lN!Y=KQnpc%XYh%u9{7HZoV{B_D^-;|+R9du5o` z$V)W5UF!*{*G>O+EF>EFORJnU=%~xRY>6=L$4&q66-46;6Iq#E)mA*YepP~)#V;*3 zxPJRJ3uFgH9dr95?X-ZaJt0;Xw(EgE9a8O~auUmlHVhPOurgx9Jg)ri%;&3?(xcrc zXtPNT(|fKs`*b#=OzFyTPMSq#+kZ!8f^lBYP72Dd(WfVbSHb)hDsVm>bL>$)IgymL zd!!CKvx^h^dbpdA>&DJQEX?6r_}){n9|X#2wysT65n<VtcIP~in#>Xg8Bx^)Y8va> z4dd1w@<B=@xubpl2`OLg0|E+WK5F02SP*HvS6EKb?b-o?M{LJyh7@|O?OFe+e_^_m zFo>B4Y%PBy7T4z=MvK*CxZuVO*#SZ1KNrf4=_DVOgG+>BARZ(Is)fE4rS&U!qrdn$ zVmN^AS9e=vU0#I9?E*EO71<|Y55qY}d~8{{ic5JhFG_yw1;Tc}!6lmz)dAq!jK(=p zsCb+gQpI{J9C|~(7Jx;?rt&b6h36#qRF3!#m^g$WaNN=TN2%mc;<F7P>bivO_{ztZ zK`zUE5sGI0ZJ26L%C&b+Xu|{&zz7{SGTJH+rZiqQ05H^7U<$gsaK*!YJQ3z+;1JC# ziPapU`uV{4s5qh7N8N8rvCj2)bceSVxWlK*b4N_-6|t)TMm?l#IEWNOuL!Dlrw7al z$BsV={ly^>*-0yHqi&RJ!(Y{RF9*-F(~@aErB5eceTi58y~4Cr;DAP4TwZB|6pTvJ zsFd%dEm<5hu)b`p-hEe;DfWwg_)|M$_JC)0kzSP8joOY?vv>lzW=zogJ)~y%EEw$n zpy+uQUWy_G(H$N!4sB=ju?RA(h5RGDAuI5u>CdNRRWtI%#qnV{KJ0x3q8<{zlNh-= zZKzixd&pjyDz^4_hAJHQ#kD^z>Y!}&eqEGN*ytGH?UwIjElVH&%+gJVCDYR5@NREo zsVhs=NtpVio8t=o1(7xGsoA^QxDJz-jY9j`lC7*hiVOKpqkHA&Qk4o7N=+flSdMM1 zUMw6W&j!sXtLE(nfDi{$n}JmOJgwYa!BsbY+6|w19yP4jBQ!G!cJ(-x#GK97;0QT> zf!8W=A}_vXlsXvJHyruV3rcdt7trrE%yD{|qVP97u00;}2iw#MYj!eKJ`mJ%s2wtq zXk41rd?UDrsZ4or2282-{2_c4`<j|^?)p3^%AN7OJ<(OFZsadv)E#{AQeU~_N`*|u zT<z)?Cs81lV{4att_x-0C({O?ouV$CR26OxFZX<(=K{%0^r)uiEF`W&v_uuz#3Fh! z)#J(5uy`|0XaKaHvsz~}i;r*84ng1PSxx~d={r%M^=iRo*_UfqcvX~%9iombOM*vM z5ev%J(T`&0HB277Q#wmN$=bHgv>R{XvXwo(Ggl)@f@?RE9e*o*zWLTWIo}j_<wJTt zxtx!#fJP!CF^&>_K~iU@1uHs2bl@j4I3zNNu`i~kn~7`^8^KwcDosdVr>ER*k=JWh zX8g&LIKG->cfo5_LYA~LRF*a!Nm5IpTf25}F>eUh^V@4|=YE7NvJ?tWKjC5ux{j$5 z&S31v*cTiA=JVR`QYb2jmvC!rlmTgEh_KoO($4+B%*AiNwysQkx)N)nd}Iudk(<n0 zWt)XQHdmzGfh%IE(-lxO3DJ9s5$DJGSf)!prpP|V*?gG4RWQrS{NC^9=WT{=ZP5n? z<#oX#{oU_MS#?enkwEuT1<I(i%E$S(^fP<Pzb!*ryMlr=sq!m^*)l3Kd-YubdCs;l z>}pIbfhl~Bs|4`(&nO5EzXj8Q_K6&F6A1&l>*On@c@h#v*J@@l;-Q)Cx|gP&XkW%v z)#FJmEvq>{xQH;JJmDX2Z^!k(UO-h6nB@pMcD<_*C)m?Lq6(;-;FLHUlac~-Za5?o z9dShb9*wph;p|RGKiQFp3E#XRUpS-`c!z}RblQv~Ogco;-ky5VMmtBz9>W$hyR3Yn zOUJ)rkl&4PX_Ie*sziUX4AjW+(nZY|(ciFGuf<qIlgG!At}l@eP^U**T>5oyd$z;3 ze%>-KP+qk{LsTMFkC=7`QE6<};^XMP9&P#3Lf;iOLI-1rk^;x|)iuhdc}vHxZl7^~ zSpv+D%#SeKkGL%~cpDxv6&}zE3WMXOldu4+?_J@Wc)qu)M+nB%*5LQWk?@hoi2WYq zB1?>y*@KN*s-&={CviJ>qwTrEK+rf-n&>6=?T9i@KFJDS>qXnSz7*^aNuOV4$A-8; zuN`RQhL`HM8Nt;JSx_e1mje>SP$t50L#_~vjLZ{cQ%}e*bPA)aEUA1S!x?|)Q~SxS zJuux_+t<H#Q#_*Pie`8XHbj;^_Pi5L;gDY<W1~isKdR{^kVro+oOn5D03#G|CnWoz z{=-`tZqA8o8f*^#hb+EJqjPY=P^*40h^%{o2{Q9W8*uACL%v7_r}!BEV_V?iUYh<- zqU6v@;~p#J^53uDidkGpH0Te>Jf`6g=<=7N{5#yPWj8QNZ;Pi>@T*rFjnv|vj*{Tj zU-Ky{!;bePwu=yz@5VeG$yHzUl+-9QC;WL795b0x>}*iaCRS)>GA?}0E?$zP4isQ% z>Res#yI}LBs|pdidNNk>4E-6y8B{M?RNy(i#xvQ@$M9yCq++UQ2sI@}klKFH+XW7p z;FO0)aqdg|MuHegRX2^hfde>B&IKUxlWTDv6&+AkeTIS*j%(@zok0s)2VCBD_m1%% zw8;~x$#?#=1lGO+5j3$=6dcsTU?2R57r)wXpAf(DconoAI}w1woeQ#*&<+Ji?uq#N zrdPDYfV>!8%<mr#6cdrG=SCS;(Wz)^qU@2>%Gc{9AKaMmTs-HQj#6{Kk~Fnf*j@J5 zba!X(zrQrnkUwZbx6rbdUk&t2*14EZWYrx?rb6)846yGrC`v`U7Ia(m1ORWdRF9x* z#IxRorLfsre(mhSylvIY7CYx3ALtI8@Kb@U>9dW$BpZmoeXQMo^{Y@m-Ct3K#dm35 zx|1xDa`hsy7bAQZWZZz}`!H~L+;4U|{U9@W7)^WA6s8h@E6QNEEQR7_N!<-7*>tMF z(D0#~St$ba-?sUwOz4^@q;2YxOI|DyZ0d<QcHQBx6^ZwQ+kc;5MF?{PNt61IgjO3G z9@#YRCd8(1IRfGjbjc!fN@_l)|K#aNmn0Sb{z#3&f<T3?dQ*h>97%y;<v*@Hny47~ zAY7vTsUWpOkJW}ElFOP%B}JrR-;|{z#Eb@XZ9jNHw}UT$d~M-rfoSP9vX{zIcoT=} zcS+1q)+C9<dfMsZo43K(3qp|D_is+8JjzqZ6#$7T>B{pu>U=Krfq$rz>a))m%Fsc% zI1cO*^<FBHpJY6H>TKTKGGb4-6*A|`P2i6oW^;Op3Wc(UJYP@flA4taZ|^uSpx%X! zpSQz`P55(yD^{VL^&c&g*T0zoeC8A(I*eB4E`W`f+^AKnPE}ulTlt3@^k-o`pVeNg z_asF$XAfip_Lu1)-f}X&@_<q1jGI}|;1wr9?xjJuG%d)v5d{As=h>E&gBGnCAFEv; z8ORx=<ykLpXPIAKSCx^tCLz8fbaH+O)E#{>2>abOg>KDba0qt_mEjfoWsZ;M@ltua zXy~bl`M3s|p*yz->KU>VWVMVa1Rgg9gc~2_gio}x<C%qbTE}BEL(Un#N%9h0=ao)N za9d~eSbZ?erv~+&#Ni~WN(^$3<)w2QLi_G85Xy#TBr{Sps`JF8+$MDwLlm6Vzw+QY zB3{^Mm#X`*8Me=QUO)6Epz~tl%8)A5Rhh~~qGRi8_6kLLXLvfN-CNnT*CJSi{#ht% z2P}UaLK=y#UvJNJQ~(Ei713Btg8Y^oqC-Uq#~49-ewFqEUs_};5nt5cug`CY6qKd| z*d_D76ZiT9DvjDAf(rT2*YzC7nv0KG`vXryhYM6(J~gm?dZt3h^9LdR0G{L&#e}o) zD!v&^Qnf+Nj!C@x1oXTqeey+m+HRVHl9Pk~jp)bo-{v~h!Ln?I>*Ayh`EYahd^rxa zniu8Ol;`-cVskZjpK>7y8XQxp75^6l7jz7S2Dj$n$Pe{zqmQLf#^zBY`i?kev#WdZ z7O9yJTgf=uR^Q3sDUUaAJog#N`-#U1@pVgzjj+{Uo$wA}^^{$e7l-~P{l==83_+o@ zpRpQN<A-k}&F{=$$9M{Kq{>srusKoS0p6IW{i+Oj%^y1093NKG24V0_`fwm3E(i>a zOg&s+rmT1erQLMlwCUZ`i+JuXhgWOZ5-@OBFm`$qgyIb-bP*YA3%lTpdZMf7@sEPd zm0a>uBj5ex{cSPsuGVi-{KNbgdx!D?bg!%8G`_=$6N-wlmUwIh44-DH($bxOxd;@n zS&j-Q%b1{4XI<mA+R7tc`NLqdOp|TYD5BAU@(vXgZX1soFJg?vN;UI_nxX<?VH!3q zF!Xcc;c@#f>NG3|du4#3K^%gTW(}8*8tCdz;zmDkPwJ>1c-7>jhnu+%^9tBT_xW?` zJ_c9Qm<asHE%3u$q!uzM|7F2fxEOv^DsFZ|0Wn)YHK%&V2y=jPpk#?P{|w~RX6nm| z{ceu@XH2Sey5NE=E$2c+7Ar2S^<zZFv9HwUH*Vk*U7C=5jHU_SrHHrMTrn|FB->%Q zjJ#0)Nxaq&@rh9_v>|*_Hs=tLPyUcc9hcge?>gaIY=L6vz~dAqE_T>_kvDamjv3BS z7XiVde7Ix_$9>q>`ifwoP$D`Y6`<WX%RvZ{&}p0%&v*857&eZpPUPO5XX;jR()sBG zQO80#o=kaQ_xe!6mRZ7kG7YVJqnrXh!a-TOk~S3WH7#6pfo{hcq|#=Zh%xDmcTGB| z(d!ip;3ClW(-M)9u`YLn21$_xS=ihwgby}F9ZM+fnz%35taXz?k2^O7?;rRjg)MSc zc24dk8$>E#2F*j!GPlFl=2rkNdn!oU=vwx%7U$V)oSGAi7-!06{LEhMWwcTNJ^X0f z+d^cuWjeIc;>x~Or_lmg>HUYr$@bcXW7D>!n09oCXq|u0QWP%{*FYc!%q%U(r?4`9 zLjm_;_=*>oZzIN{P?VTm1%4j#9>d0ON4O&WV*d4gI*g{P@%A;$%ibPEnj74O#9s`; zFA@zAoG|v>RI&U$n>Gw_THA;g@|3tD^lx&Y@nmD%BGo-EjVH>Tawd2*U295u{s+fu zp4R}B@5FlGprJ6S0C*Sq#HLRMB`&U11_1RK<D#&;UFhq;8DLYJIZFqohP4phntJr* z;jeZKJDwA`1xrw=J%HZRP2z-7Uh<Wz-S}gs_e;to;g*OZC1kXLrJn=7kEn@`DJRV* zSUl`vDM^RDsyQ~jkV^fd-2+Ez8hO_5)iYr=QVZm&Y}@&7$ee52P3hAh*$}{stvy1i zToJtxM&<S|`9HOp_h4_9#$c0t7G=4M7D6`NX?P7@PAWLPwmkRA*gwy<yP8b33o7BX z059Qs18M;a_UOK>DXfy7^(ZpFqJa}<ooYwg7CFYM<>kV({&7^_%%DO;xX_Z?iTdVV zN*Yd`BM#y_K$VeQm~KZkB~0_1qvH1tp^k<YN5}v<B{~u<Cj-&#e*6r>>-4r<Z6Le@ zeE@#d1`T1R`3y8o6|pnd;#jGCaQshFBl)_fj|1l?tR~pzBtY_CHXj23#D&52aNQAa zEq?wph`T~+nYu`eFyod%o%Ch!l!La6L8jtxWAaIB%!ly|oX|5x0CZ;Jds20)%3Rm~ zodH)}dN?3tGY~eaR^8FEolND&#qS`ySShgYYT*IBqvf<Atd6^~j{A(7vc^wUybiq6 zMeK34)BmLrj<IS(WMoxBWU5K<7QpJb{<q{O#5RVXgwLmyoDJTXPAjmiXbCh4KEucU zUz#8VdN35LuZ|&!t>fP7U#_&%a6`Fu>UbCcZL@Y@o}~Cn?4(Y-)i0g!^~D{h82Vr2 zp^&IThzze)sGi-mYhZPL+L@Tni+Ewfy|gkJ9b}W%7;Wuz$s9tkOV=`g=0EP_7@8x} zr!Y=oR@L(Zw%FW6m9v9DR>KO}`IkbH6|Kd}7m6^6jvs#^m62Sbos&Nl{$Z@-d6xIu zt;c7_vY%48yxufcvijg%^A~85Kt{X!lM%OlkAH8F132rLClY|mvYX-U&KD#r>{y1) zT<}jebFNaV?lgQ82*aGRb+<Jt-I@Qpe~y7_galYe@}dJnQ$5{Afa@j*)9P^+Y`BxN zw&NLUCt5uvOJTm=l91Z^0)4j@kKASW5A%rA@BSuo+i{zH$I`Xt3^ySAtbG+)&KM^l z&w!G%RtHW=3;BYBUENJhME({6Cu>vIV;mdmO7{>mO9%rm0ax}C)DU!Gh121e=XWyK z892*IHFft04ObR^kKm^*^M#Xdi-jEiN+28wbjMS|5W32dxCp}Z3!u-+ZGA_ZpED!H zyfxg()<wPdIJXwWM!r6LpS0(>wQ%g7n#kJG(=oVpCvgw|QzEqFWFd+?qg|aHae7Rl zbCwi1O6cYzwZ-B&vWFeFK<%Koj7>P7{%T~SkTh=n+{|5M<*)W2tor*dS{r(^V_Fm? zwY9YR&IDJTNASH#r@_cqdFd?@_mRE(`714HgkSNBebtIPLCC1=KcuKq_&9xS>A5l- z;rL1^ljEMAGkR~>|BL#h>ky~wT@Knu;wJ1rr!ioO;M9^&;*|f74*Fkn{4M*vWdF|# dis1GkXeZ*6W{$JVJ#iIFUFErQm7+!1{{UO4him`< literal 0 HcmV?d00001 diff --git a/Sources/WeiBei/Resources/Inspiration/SOURCES.md b/Sources/WeiBei/Resources/Inspiration/SOURCES.md new file mode 100644 index 000000000..631c91c6c --- /dev/null +++ b/Sources/WeiBei/Resources/Inspiration/SOURCES.md @@ -0,0 +1,34 @@ +# Empty workspace inspiration sources + +WeiBei bundles the text and selected calligraphy alpha masks in this directory so the empty workspace works without a network connection. Source links are shown in the interface for traceability; they are never required for rendering. + +No NC, ND, modern calligraphy font, or license-unclear dataset is included. Mathematical and scientific expressions are typeset with system serif text and are not rendered as calligraphy. + +## Catalog + +| Catalog ID | Original text or expression | Author and work | Reliable source | Rights basis | +| --- | --- | --- | --- | --- | +| `lanting-clear-breeze` | `天朗氣清,惠風和暢` | 王羲之《蘭亭集序》; glyphs from the Tang copy traditionally attributed to 馮承素 | [Wikimedia Commons file page, Palace Museum source](https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG) | The ancient work and its faithful digital reproduction are marked public domain and [Public Domain Mark 1.0](https://creativecommons.org/publicdomain/mark/1.0/). The bundled PNG is a transparent crop derived from that scan. | +| `lanting-universe` | `仰觀宇宙之大` | 王羲之《蘭亭集序》; glyphs from the Tang copy traditionally attributed to 馮承素 | [Wikimedia Commons file page, Palace Museum source](https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG) | Same public-domain and Public Domain Mark 1.0 basis as above. | +| `basho-old-pond` | `古池や蛙飛こむ水のおと` | 松尾芭蕉《蛙合》, 1686 | [National Diet Library Collaborative Reference Database](https://crd.ndl.go.jp/reference/detail?page=ref_view&id=1000087707) | Public-domain original text; Matsuo Bashō died in 1694. Japan's [Copyright Act, Article 51](https://www.japaneselawtranslation.go.jp/en/laws/view/3379/tb) provides a general term of 70 years after the author's death. No translation is bundled. | +| `euler-formula` | `eⁱˣ = cos x + i sin x` | Leonhard Euler, *Introductio in analysin infinitorum*, 1748; modern notation | [ETH-Bibliothek e-rara, DOI 10.3931/e-rara-8740](https://www.e-rara.ch/zut/content/titleinfo/2447176) | The digitized 1748 book is marked [Public Domain Mark](https://creativecommons.org/publicdomain/mark/1.0/). WeiBei claims no copyright in the mathematical expression. | +| `einstein-rest-energy` | `E₀ = mc²` | Albert Einstein, *Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?*, 1905; modern notation | [Max Planck Institute for the History of Science, original paper](https://einstein-annalen.mpiwg-berlin.mpg.de/annalen/alphabetical/Einst_Istdi_de_1905) | Physical formula / fact. WeiBei claims no copyright in the expression; see [U.S. Copyright Office Circular 33](https://www.copyright.gov/circs/circ33.pdf). | +| `cobb-douglas-production` | `P = bLᵏC¹⁻ᵏ` | Charles W. Cobb and Paul H. Douglas, “A Theory of Production,” 1928 | [The American Economic Review 18(1), JSTOR stable record](https://www.jstor.org/stable/1811556) | Economic formula / fact. WeiBei claims no copyright in the expression; see Circular 33 above. | + +## Calligraphy transformation + +Only the two verified `Lantingji Xu` phrases are included. The source scan itself is not bundled. The generation record below preserves the glyph coordinates used to convert selected ink into transparent alpha masks. WeiBei applies semantic ink color at runtime, so the same PNG has no white box and stays legible in both paper and inkstone modes. + +- Commons description revision checked on 2026-07-10: [`oldid=1012610416`](https://commons.wikimedia.org/w/index.php?title=File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG&oldid=1012610416) +- Palace Museum accession number: `故00002597` +- Verified original JPEG: `28,549 × 1,300`, SHA-1 `a133647a8695cd06d0f5c6215d66e0b8b8d93d56` +- `lanting-clear-breeze.png`: `856 × 132`, SHA-256 `e5c6827f44b22f5441bb208b1770103da8a076564b52f41e64f77b0da7e1835c` +- `lanting-universe.png`: `624 × 132`, SHA-256 `a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22` +- Both PNGs have zero opaque-white pixels and zero ink in the outer two-pixel border. + +The manual source rectangles are recorded below as `(left, top, right, bottom)` in the verified Commons JPEG. No generative fill, vector tracing, or font substitution is used. + +- `天朗氣清惠風和暢`: `(22732,331,22832,414)`, `(22734,414,22818,499)`, `(22733,530,22831,628)`, `(22730,626,22818,741)`, `(22734,742,22813,849)`, `(22720,847,22829,957)`, `(22714,959,22831,1050)`, `(22728,1049,22836,1152)` +- `仰觀宇宙之大`: `(22725,1151,22832,1242)`, `(22610,9,22731,143)`, `(22622,154,22705,256)`, `(22617,276,22697,351)`, `(22615,384,22703,462)`, `(22604,475,22699,548)` + +The four experimental Zhao Mengfu crops from the research workspace were rejected because they contained neighboring strokes or incomplete glyphs. They are not part of this package or catalog. diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 838f550c9..fc754711b 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -47,6 +47,7 @@ final class WorkspaceStore: ObservableObject { @Published var showReader = true @Published var showAgent = true @Published var showNotes = true + @Published var showDailyInspiration = true @Published var commandPalettePresented = false @Published var librarySearch = "" @Published var readerSearch = "" @@ -1376,6 +1377,12 @@ final class WorkspaceStore: ObservableObject { save() } + func setDailyInspirationEnabled(_ enabled: Bool) { + guard showDailyInspiration != enabled else { return } + showDailyInspiration = enabled + save() + } + func toggleImportedDocumentColorAdaptation() { setImportedDocumentColorAdaptation(!adaptImportedDocumentColors) } @@ -2071,11 +2078,25 @@ final class WorkspaceStore: ObservableObject { func runVerificationScenarioIfNeeded() async { guard !didRunVerificationScenario else { return } + guard Self.environmentValue("WEIBEI_SUPPRESS_ACTIVATION") == "1" else { return } let scenario = Self.environmentValue("WEIBEI_VERIFY_SCENARIO") + let emptyWorkspaceScenarios: Set<String> = [ + "empty-workspace-light-wide", + "empty-workspace-light-narrow", + "empty-workspace-dark-wide", + "empty-workspace-dark-narrow", + "empty-workspace-calligraphy-light", + "empty-workspace-calligraphy-dark", + "empty-workspace-inspiration-off", + "empty-workspace-open-doc", + "empty-workspace-open-chat", + "empty-workspace-open-notes", + ] guard scenario == "offline-learning-flow" || scenario == "immersive-conversation-flow" || scenario == "notebook-creation-flow" - || scenario == "pane-layout-stability-flow" else { return } + || scenario == "pane-layout-stability-flow" + || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true if scenario == "pane-layout-stability-flow" { if Self.environmentValue("WEIBEI_VERIFY_APPEARANCE") == WeiBeiAppearanceMode.inkstone.rawValue { @@ -2129,6 +2150,10 @@ final class WorkspaceStore: ObservableObject { } return } + if emptyWorkspaceScenarios.contains(scenario) { + configureEmptyWorkspaceVerificationScenario(scenario) + return + } layout = scenario == "immersive-conversation-flow" ? .immersiveConversation : .documentAgentNotes if scenario == "notebook-creation-flow" { layout = .immersiveWriting @@ -2154,6 +2179,34 @@ final class WorkspaceStore: ObservableObject { applyLastAgentAnswerToNote() } + private func configureEmptyWorkspaceVerificationScenario(_ scenario: String) { + layout = .documentAgentNotes + showLibrary = false + agentSurface = .hidden + appearanceMode = scenario.contains("dark") ? .inkstone : .paper + showDailyInspiration = scenario != "empty-workspace-inspiration-off" + + if scenario.hasPrefix("empty-workspace-open-") { + select(itemID: "sample-html") + updateNote("# Empty workspace entry state marker\n\nPane toggles must preserve this note.\n") + } + + showReader = false + showAgent = false + showNotes = false + + switch scenario { + case "empty-workspace-open-doc": + toggleReader() + case "empty-workspace-open-chat": + toggleAgent() + case "empty-workspace-open-notes": + toggleNotes() + default: + save() + } + } + func replaceSelectionWithLastAgentAnswer() { guard selectionContext?.isReplaceableNoteSelection == true, let answer = lastUsableAgentAnswer else { return } @@ -2636,6 +2689,7 @@ final class WorkspaceStore: ObservableObject { showReader = snapshot.showReader ?? true showAgent = snapshot.showAgent ?? legacyRightPane ?? true showNotes = snapshot.showNotes ?? legacyRightPane ?? true + showDailyInspiration = snapshot.showDailyInspiration ?? true if let appearanceModeRaw = snapshot.appearanceModeRaw, let appearanceMode = WeiBeiAppearanceMode(rawValue: appearanceModeRaw) { self.appearanceMode = appearanceMode @@ -2689,6 +2743,7 @@ final class WorkspaceStore: ObservableObject { showAgent: showAgent, showNotes: showNotes, showRightPane: showRightPane, + showDailyInspiration: showDailyInspiration, appearanceModeRaw: appearanceMode.rawValue, adaptImportedDocumentColors: adaptImportedDocumentColors, interfaceLanguageRaw: interfaceLanguage.rawValue diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift new file mode 100644 index 000000000..208db00a3 --- /dev/null +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -0,0 +1,294 @@ +import AppKit +import SwiftUI +import WeiBeiCore + +struct EmptyWorkspaceLauncherView: View { + @EnvironmentObject private var store: WorkspaceStore + + var body: some View { + TimelineView(.periodic(from: .now, by: 60)) { timeline in + GeometryReader { geometry in + let compact = geometry.size.width < 760 || geometry.size.height < 620 + let horizontalPadding: CGFloat = compact ? 28 : 52 + let entryWidth = min(116, max(76, (geometry.size.width - (horizontalPadding * 2) - 2) / 3)) + + ZStack { + WeiBeiTheme.paper + + VStack(spacing: compact ? 20 : 28) { + Spacer(minLength: compact ? 24 : 44) + + greeting(at: timeline.date) + + EmptyWorkspaceEntryRow(entryWidth: entryWidth) + + if store.showDailyInspiration { + EmptyWorkspaceInspirationView( + inspiration: inspiration(at: timeline.date), + compact: compact + ) + .transition(.opacity) + } + + Spacer(minLength: compact ? 24 : 44) + } + .frame(maxWidth: 760) + .padding(.horizontal, horizontalPadding) + } + } + } + .accessibilityElement(children: .contain) + .accessibilityIdentifier("empty-workspace-launcher") + } + + private func greeting(at date: Date) -> some View { + Text(EmptyWorkspaceDayPeriod.current(at: date).greeting(language: store.interfaceLanguage)) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 15, weight: .regular)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .multilineTextAlignment(.center) + .accessibilityIdentifier("empty-workspace-greeting") + } + + private func inspiration(at date: Date) -> EmptyWorkspaceInspiration { + let environment = ProcessInfo.processInfo.environment + if environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1" { + let forcedID: String? + switch environment["WEIBEI_VERIFY_SCENARIO"] { + case "empty-workspace-calligraphy-light": + forcedID = "lanting-clear-breeze" + case "empty-workspace-calligraphy-dark": + forcedID = "lanting-universe" + default: + forcedID = environment["WEIBEI_VERIFY_INSPIRATION_ID"] + } + if let forcedID, + let requested = EmptyWorkspaceInspirationCatalog.items.first(where: { $0.id == forcedID }) { + return requested + } + } + return EmptyWorkspaceInspirationCatalog.item(for: date) + } +} + +private struct EmptyWorkspaceEntryRow: View { + @EnvironmentObject private var store: WorkspaceStore + let entryWidth: CGFloat + + var body: some View { + HStack(spacing: 0) { + EmptyWorkspaceEntryButton( + title: "DOC", + accessibilityLabel: store.ui("打开文稿", "Open document"), + identifier: "empty-workspace-entry-doc", + width: entryWidth, + action: store.toggleReader + ) + + entryDivider + + EmptyWorkspaceEntryButton( + title: "CHAT", + accessibilityLabel: store.ui("打开对话", "Open chat"), + identifier: "empty-workspace-entry-chat", + width: entryWidth, + action: store.toggleAgent + ) + + entryDivider + + EmptyWorkspaceEntryButton( + title: "NOTES", + accessibilityLabel: store.ui("打开笔记", "Open notes"), + identifier: "empty-workspace-entry-notes", + width: entryWidth, + action: store.toggleNotes + ) + } + .fixedSize(horizontal: true, vertical: false) + .accessibilityElement(children: .contain) + } + + private var entryDivider: some View { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.78)) + .frame(width: 1, height: 18) + .accessibilityHidden(true) + } +} + +private struct EmptyWorkspaceEntryButton: View { + let title: String + let accessibilityLabel: String + let identifier: String + let width: CGFloat + let action: () -> Void + + @State private var hovering = false + @FocusState private var focused: Bool + + var body: some View { + Button(action: action) { + Text(title) + .font(WeiBeiTypography.englishBrandFont(size: 20, weight: .semibold)) + .tracking(2.2) + .foregroundStyle(focused || hovering ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk) + .frame(width: width, height: 48) + .contentShape(Rectangle()) + .overlay(alignment: .bottom) { + Rectangle() + .fill(WeiBeiTheme.ink.opacity(focused ? 0.62 : hovering ? 0.34 : 0)) + .frame(width: 26, height: 1) + .padding(.bottom, 4) + } + } + .buttonStyle(.plain) + .focused($focused) + .onHover { hovering = $0 } + .animation(.easeOut(duration: 0.12), value: hovering) + .animation(.easeOut(duration: 0.12), value: focused) + .accessibilityLabel(Text(accessibilityLabel)) + .accessibilityIdentifier(identifier) + .help(accessibilityLabel) + } +} + +private struct EmptyWorkspaceInspirationView: View { + let inspiration: EmptyWorkspaceInspiration + let compact: Bool + + var body: some View { + VStack(spacing: compact ? 8 : 10) { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.72)) + .frame(width: 34, height: 1) + .padding(.bottom, compact ? 2 : 5) + + inspirationContent + + Text(inspiration.credit) + .font(.system(size: compact ? 10.5 : 11.5, weight: .medium, design: .serif)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .multilineTextAlignment(.center) + .lineLimit(2) + + sourceAndRights + } + .frame(maxWidth: compact ? 560 : 660) + .accessibilityElement(children: .contain) + .accessibilityIdentifier("empty-workspace-inspiration-\(inspiration.id)") + } + + @ViewBuilder + private var inspirationContent: some View { + switch inspiration.presentation { + case let .calligraphy(assetName): + if let image = EmptyWorkspaceCalligraphyResource.image(named: assetName) { + Image(nsImage: image) + .renderingMode(.template) + .resizable() + .scaledToFit() + .foregroundStyle(WeiBeiTheme.ink.opacity(0.88)) + .frame(maxWidth: compact ? 390 : 500, maxHeight: compact ? 54 : 72) + .accessibilityLabel(Text(inspiration.text)) + } else { + inspirationText(size: compact ? 24 : 30) + } + case .quotation: + inspirationText(size: compact ? 21 : 26) + case .formula: + formulaContent(size: compact ? 24 : 30) + } + } + + private func formulaContent(size: CGFloat) -> some View { + formulaText(size: size) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) + .multilineTextAlignment(.center) + .lineLimit(1) + .minimumScaleFactor(0.78) + .accessibilityLabel(Text(inspiration.text)) + } + + private func formulaText(size: CGFloat) -> Text { + let baseFont = Font.system(size: size, weight: .regular, design: .serif) + let scriptFont = Font.system(size: size * 0.58, weight: .regular, design: .serif) + let superscript = size * 0.34 + + switch inspiration.id { + case "euler-formula": + return Text("e").font(baseFont) + + Text("ix").font(scriptFont).baselineOffset(superscript) + + Text(" = cos x + i sin x").font(baseFont) + case "einstein-rest-energy": + return Text("E").font(baseFont) + + Text("0").font(scriptFont).baselineOffset(-size * 0.16) + + Text(" = mc").font(baseFont) + + Text("2").font(scriptFont).baselineOffset(superscript) + case "cobb-douglas-production": + return Text("P = bL").font(baseFont) + + Text("k").font(scriptFont).baselineOffset(superscript) + + Text("C").font(baseFont) + + Text("1 − k").font(scriptFont).baselineOffset(superscript) + default: + return Text(inspiration.text).font(baseFont) + } + } + + private func inspirationText(size: CGFloat) -> some View { + Text(inspiration.text) + .font(.system(size: size, weight: .regular, design: .serif)) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) + .multilineTextAlignment(.center) + .lineLimit(2) + .minimumScaleFactor(0.78) + .accessibilityLabel(Text(inspiration.text)) + } + + private var sourceAndRights: some View { + ViewThatFits(in: .horizontal) { + HStack(spacing: 6) { + sourceLink + Text("·") + .accessibilityHidden(true) + rightsLink + } + + VStack(spacing: 3) { + sourceLink + rightsLink + } + } + .font(.system(size: compact ? 9 : 9.5, weight: .regular)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .multilineTextAlignment(.center) + .lineLimit(2) + } + + @ViewBuilder + private var sourceLink: some View { + if let url = inspiration.sourceURL { + Link(inspiration.sourceLabel, destination: url) + } else { + Text(inspiration.sourceLabel) + } + } + + @ViewBuilder + private var rightsLink: some View { + if let url = inspiration.rightsURL { + Link(inspiration.rightsLabel, destination: url) + } else { + Text(inspiration.rightsLabel) + } + } +} + +private enum EmptyWorkspaceCalligraphyResource { + static func image(named name: String) -> NSImage? { + let url = Bundle.module.url(forResource: name, withExtension: "png", subdirectory: "Inspiration/Calligraphy") + ?? Bundle.module.url(forResource: name, withExtension: "png", subdirectory: "Calligraphy") + ?? Bundle.module.url(forResource: name, withExtension: "png") + guard let url else { return nil } + return NSImage(contentsOf: url) + } +} diff --git a/Sources/WeiBei/Views/StableDocumentWorkspace.swift b/Sources/WeiBei/Views/StableDocumentWorkspace.swift index 443d50f25..ba2586016 100644 --- a/Sources/WeiBei/Views/StableDocumentWorkspace.swift +++ b/Sources/WeiBei/Views/StableDocumentWorkspace.swift @@ -34,7 +34,7 @@ struct StableDocumentWorkspace: NSViewRepresentable { )) }) let emptyHost = nativeHost( - EmptyWorkspaceView().environmentObject(store), + EmptyWorkspaceLauncherView().environmentObject(store), identifier: "stable-document-empty-workspace" ) splitView.install(roleHosts: roleHosts, emptyHost: emptyHost) diff --git a/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift new file mode 100644 index 000000000..1b3a1da86 --- /dev/null +++ b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift @@ -0,0 +1,178 @@ +import Foundation + +public enum EmptyWorkspaceDayPeriod: String, CaseIterable, Sendable { + case morning + case midday + case evening + case lateNight + + public init(hour: Int) { + switch hour { + case 5..<11: + self = .morning + case 11..<17: + self = .midday + case 17..<23: + self = .evening + default: + self = .lateNight + } + } + + public func greeting(language: WeiBeiInterfaceLanguage) -> String { + switch self { + case .morning: + return language.text("早安,宜开卷。", "Good morning. Open a page.") + case .midday: + return language.text("午安,慢慢读。", "Good afternoon. Read unhurriedly.") + case .evening: + return language.text("晚安,灯下可写。", "Good evening. Leave a line in the lamplight.") + case .lateNight: + return language.text("夜深了,留一页清醒。", "It is late. Keep one clear page.") + } + } + + public static func current(at date: Date, calendar: Calendar = .current) -> EmptyWorkspaceDayPeriod { + EmptyWorkspaceDayPeriod(hour: calendar.component(.hour, from: date)) + } +} + +public enum EmptyWorkspaceInspirationPresentation: Equatable, Sendable { + case calligraphy(assetName: String) + case quotation + case formula +} + +public struct EmptyWorkspaceInspiration: Identifiable, Equatable, Sendable { + public let id: String + public let text: String + public let credit: String + public let sourceLabel: String + public let sourceURLString: String + public let rightsLabel: String + public let rightsURLString: String + public let presentation: EmptyWorkspaceInspirationPresentation + + public init( + id: String, + text: String, + credit: String, + sourceLabel: String, + sourceURLString: String, + rightsLabel: String, + rightsURLString: String, + presentation: EmptyWorkspaceInspirationPresentation + ) { + self.id = id + self.text = text + self.credit = credit + self.sourceLabel = sourceLabel + self.sourceURLString = sourceURLString + self.rightsLabel = rightsLabel + self.rightsURLString = rightsURLString + self.presentation = presentation + } + + public var sourceURL: URL? { + URL(string: sourceURLString) + } + + public var rightsURL: URL? { + URL(string: rightsURLString) + } +} + +public enum EmptyWorkspaceInspirationCatalog { + public static let items: [EmptyWorkspaceInspiration] = [ + EmptyWorkspaceInspiration( + id: "lanting-clear-breeze", + text: "天朗氣清,惠風和暢", + credit: "王羲之《蘭亭集序》 · 唐摹本傳馮承素", + sourceLabel: "Wikimedia Commons / 故宫博物院", + sourceURLString: "https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG", + rightsLabel: "公版原作 · Public Domain Mark 1.0", + rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", + presentation: .calligraphy(assetName: "lanting-clear-breeze") + ), + EmptyWorkspaceInspiration( + id: "lanting-universe", + text: "仰觀宇宙之大", + credit: "王羲之《蘭亭集序》 · 唐摹本傳馮承素", + sourceLabel: "Wikimedia Commons / 故宫博物院", + sourceURLString: "https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG", + rightsLabel: "公版原作 · Public Domain Mark 1.0", + rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", + presentation: .calligraphy(assetName: "lanting-universe") + ), + EmptyWorkspaceInspiration( + id: "basho-old-pond", + text: "古池や蛙飛こむ水のおと", + credit: "松尾芭蕉《蛙合》 · 1686", + sourceLabel: "国立国会图书馆参考协同数据库", + sourceURLString: "https://crd.ndl.go.jp/reference/detail?page=ref_view&id=1000087707", + rightsLabel: "原文公版 · 日本著作权法第 51 条", + rightsURLString: "https://www.japaneselawtranslation.go.jp/en/laws/view/3379/tb", + presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "euler-formula", + text: "eⁱˣ = cos x + i sin x", + credit: "Leonhard Euler · Introductio in analysin infinitorum, 1748 · 现代记法", + sourceLabel: "ETH-Bibliothek e-rara · DOI 10.3931/e-rara-8740", + sourceURLString: "https://www.e-rara.ch/zut/content/titleinfo/2447176", + rightsLabel: "1748 原书公版 · Public Domain Mark", + rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", + presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "einstein-rest-energy", + text: "E₀ = mc²", + credit: "Albert Einstein · Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?, 1905 · 现代记法", + sourceLabel: "Max Planck Institute for the History of Science", + sourceURLString: "https://einstein-annalen.mpiwg-berlin.mpg.de/annalen/alphabetical/Einst_Istdi_de_1905", + rightsLabel: "物理公式 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "cobb-douglas-production", + text: "P = bLᵏC¹⁻ᵏ", + credit: "Charles W. Cobb & Paul H. Douglas · A Theory of Production, 1928", + sourceLabel: "The American Economic Review 18(1)", + sourceURLString: "https://www.jstor.org/stable/1811556", + rightsLabel: "经济学公式 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), + ] + + public static func item(for date: Date, calendar: Calendar = .current) -> EmptyWorkspaceInspiration { + precondition(!items.isEmpty) + let ordinal = calendar.ordinality(of: .day, in: .era, for: date) ?? 1 + return items[(ordinal - 1) % items.count] + } + + public static var validationErrors: [String] { + var errors: [String] = [] + let ids = items.map(\.id) + if Set(ids).count != ids.count { + errors.append("inspiration IDs must be unique") + } + + for item in items { + if item.id.isEmpty || item.text.isEmpty || item.credit.isEmpty || item.sourceLabel.isEmpty || item.rightsLabel.isEmpty { + errors.append("\(item.id): required metadata is missing") + } + if item.sourceURL?.scheme != "https" { + errors.append("\(item.id): source URL must use HTTPS") + } + if item.rightsURL?.scheme != "https" { + errors.append("\(item.id): rights URL must use HTTPS") + } + if case let .calligraphy(assetName) = item.presentation, assetName.isEmpty { + errors.append("\(item.id): calligraphy asset is missing") + } + } + return errors + } +} diff --git a/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift b/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift index 193e4da25..2ab06ea0f 100644 --- a/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift +++ b/Sources/WeiBeiCore/OpenAIAPIKeyStore.swift @@ -4,10 +4,12 @@ import Security public struct KeychainPasswordStore { public let service: String public let account: String + private let keychain: SecKeychain? - public init(service: String, account: String) { + public init(service: String, account: String, keychain: SecKeychain? = nil) { self.service = service self.account = account + self.keychain = keychain } public static func cleaned(_ value: String) -> String { @@ -29,11 +31,11 @@ public struct KeychainPasswordStore { } let data = Data(key.utf8) - let status = SecItemUpdate(baseQuery as CFDictionary, [kSecValueData as String: data] as CFDictionary) + let status = SecItemUpdate(matchQuery as CFDictionary, [kSecValueData as String: data] as CFDictionary) if status == errSecSuccess { return } if status == errSecItemNotFound { - var attributes = baseQuery + var attributes = addAttributes attributes[kSecValueData as String] = data attributes[kSecAttrAccessible as String] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly let addStatus = SecItemAdd(attributes as CFDictionary, nil) @@ -45,7 +47,7 @@ public struct KeychainPasswordStore { } public func delete() throws { - let status = SecItemDelete(baseQuery as CFDictionary) + let status = SecItemDelete(matchQuery as CFDictionary) guard status == errSecSuccess || status == errSecItemNotFound else { throw Self.keychainError(status) } @@ -60,12 +62,28 @@ public struct KeychainPasswordStore { } private var readQuery: [String: Any] { - var query = baseQuery + var query = matchQuery query[kSecReturnData as String] = true query[kSecMatchLimit as String] = kSecMatchLimitOne return query } + private var matchQuery: [String: Any] { + var query = baseQuery + if let keychain { + query[kSecMatchSearchList as String] = [keychain] + } + return query + } + + private var addAttributes: [String: Any] { + var attributes = baseQuery + if let keychain { + attributes[kSecUseKeychain as String] = keychain + } + return attributes + } + private static func keychainError(_ status: OSStatus) -> NSError { let message = SecCopyErrorMessageString(status, nil) as String? ?? "Keychain error \(status)" return NSError( diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index 850513b6e..c030bc367 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -723,11 +723,12 @@ public struct PersistedWorkspace: Codable { public var showAgent: Bool? public var showNotes: Bool? public var showRightPane: Bool? + public var showDailyInspiration: Bool? public var appearanceModeRaw: String? public var adaptImportedDocumentColors: Bool? public var interfaceLanguageRaw: String? - public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { + public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { self.importedItems = importedItems self.notesByItemID = notesByItemID self.selectedItemID = selectedItemID @@ -742,6 +743,7 @@ public struct PersistedWorkspace: Codable { self.showAgent = showAgent self.showNotes = showNotes self.showRightPane = showRightPane + self.showDailyInspiration = showDailyInspiration self.appearanceModeRaw = appearanceModeRaw self.adaptImportedDocumentColors = adaptImportedDocumentColors self.interfaceLanguageRaw = interfaceLanguageRaw diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index e88e87cfd..ac6571e2e 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -2,6 +2,7 @@ import AppKit import CoreText import Foundation import PDFKit +import Security import WeiBeiCore func expect(_ condition: @autoclosure () -> Bool, _ message: String) { @@ -70,6 +71,40 @@ expect(!paneToggleClusterSource.isEmpty && paneToggleClusterSource.contains("store.toggleAgent()") && paneToggleClusterSource.contains("store.toggleNotes()"), "top-bar pane switches update visibility without wrapping the container replacement in an animation transaction") +expect(EmptyWorkspaceDayPeriod(hour: 5) == .morning + && EmptyWorkspaceDayPeriod(hour: 10) == .morning + && EmptyWorkspaceDayPeriod(hour: 11) == .midday + && EmptyWorkspaceDayPeriod(hour: 16) == .midday + && EmptyWorkspaceDayPeriod(hour: 17) == .evening + && EmptyWorkspaceDayPeriod(hour: 22) == .evening + && EmptyWorkspaceDayPeriod(hour: 23) == .lateNight + && EmptyWorkspaceDayPeriod(hour: 4) == .lateNight, "empty workspace greeting follows morning, midday, evening, and late-night boundaries") +expect(EmptyWorkspaceDayPeriod.morning.greeting(language: .chinese).contains("早安") + && EmptyWorkspaceDayPeriod.midday.greeting(language: .chinese).contains("午安") + && EmptyWorkspaceDayPeriod.evening.greeting(language: .chinese).contains("晚安") + && EmptyWorkspaceDayPeriod.lateNight.greeting(language: .chinese).contains("夜深") + && !EmptyWorkspaceDayPeriod.morning.greeting(language: .english).isEmpty, "empty workspace greetings stay localized and non-empty") + +let inspirationItems = EmptyWorkspaceInspirationCatalog.items +expect(inspirationItems.count >= 6 + && EmptyWorkspaceInspirationCatalog.validationErrors.isEmpty + && inspirationItems.contains(where: { if case .calligraphy = $0.presentation { return true }; return false }) + && inspirationItems.contains(where: { $0.presentation == .quotation }) + && inspirationItems.contains(where: { $0.presentation == .formula }), "daily inspiration catalog contains validated calligraphy, original-language quotation, and formulas") +expect(inspirationItems.allSatisfy { item in + !item.text.isEmpty + && !item.credit.isEmpty + && item.sourceURL?.scheme == "https" + && !item.rightsLabel.isEmpty + && item.rightsURL?.scheme == "https" +}, "every daily inspiration keeps text, author/work credit, a reliable source, and rights metadata") +var inspirationCalendar = Calendar(identifier: .gregorian) +inspirationCalendar.timeZone = TimeZone(secondsFromGMT: 0)! +let inspirationDayOne = inspirationCalendar.date(from: DateComponents(year: 2026, month: 7, day: 10, hour: 12))! +let inspirationDayTwo = inspirationCalendar.date(byAdding: .day, value: 1, to: inspirationDayOne)! +expect(EmptyWorkspaceInspirationCatalog.item(for: inspirationDayOne, calendar: inspirationCalendar).id + != EmptyWorkspaceInspirationCatalog.item(for: inspirationDayTwo, calendar: inspirationCalendar).id, "daily inspiration rotates deterministically from one local day to the next") + let offlineChinesePreview = AgentOfflinePreview.render( AgentOfflinePreviewInput( language: .chinese, @@ -165,6 +200,61 @@ CTFontManagerRegisterFontsForURL(monoFontURL as CFURL, .process, nil) expect(NSFont(name: "WeiBeiStele-Regular", size: 18) != nil && NSFont(name: "WeiBeiSteleMono-Regular", size: 13) != nil, "bundled WeiBei English fonts register under their PostScript names") +func inspectCalligraphyAsset(_ url: URL) throws -> (width: Int, height: Int, visible: Int, transparent: Int, opaqueWhite: Int, outerInk: Int) { + let data = try Data(contentsOf: url) + guard let bitmap = NSBitmapImageRep(data: data) else { + throw NSError(domain: "WeiBeiSelfCheck", code: 1, userInfo: [NSLocalizedDescriptionKey: "Unreadable calligraphy PNG: \(url.path)"]) + } + var visible = 0 + var transparent = 0 + var opaqueWhite = 0 + var outerInk = 0 + for y in 0..<bitmap.pixelsHigh { + for x in 0..<bitmap.pixelsWide { + guard let color = bitmap.colorAt(x: x, y: y)?.usingColorSpace(.deviceRGB) else { continue } + if color.alphaComponent > 0.05 { + visible += 1 + if x < 2 || y < 2 || x >= bitmap.pixelsWide - 2 || y >= bitmap.pixelsHigh - 2 { + outerInk += 1 + } + } else { + transparent += 1 + } + if color.alphaComponent > 0.95 + && color.redComponent > 0.95 + && color.greenComponent > 0.95 + && color.blueComponent > 0.95 { + opaqueWhite += 1 + } + } + } + return (bitmap.pixelsWide, bitmap.pixelsHigh, visible, transparent, opaqueWhite, outerInk) +} + +let calligraphyDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Resources/Inspiration/Calligraphy", isDirectory: true) +let clearBreezeStats = try inspectCalligraphyAsset(calligraphyDirectoryURL.appendingPathComponent("lanting-clear-breeze.png")) +let universeStats = try inspectCalligraphyAsset(calligraphyDirectoryURL.appendingPathComponent("lanting-universe.png")) +expect(clearBreezeStats.width == 856 && clearBreezeStats.height == 132 + && universeStats.width == 624 && universeStats.height == 132 + && clearBreezeStats.visible > 1_000 && universeStats.visible > 1_000 + && clearBreezeStats.transparent > clearBreezeStats.visible + && universeStats.transparent > universeStats.visible + && clearBreezeStats.opaqueWhite == 0 && universeStats.opaqueWhite == 0 + && clearBreezeStats.outerInk == 0 && universeStats.outerInk == 0, "bundled Lanting calligraphy masks are transparent, uncropped, and free of hard white backgrounds") + +let inspirationSourcesURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Resources/Inspiration/SOURCES.md") +let inspirationSources = (try? String(contentsOf: inspirationSourcesURL, encoding: .utf8)) ?? "" +expect(inspirationSources.contains("a133647a8695cd06d0f5c6215d66e0b8b8d93d56") + && inspirationSources.contains("e5c6827f44b22f5441bb208b1770103da8a076564b52f41e64f77b0da7e1835c") + && inspirationSources.contains("a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22") + && inspirationSources.contains("Public Domain Mark 1.0") + && inspirationSources.contains("故00002597") + && inspirationSources.contains("were rejected") + && inspirationSources.contains("No NC, ND") + && inspirationSources.contains("No generative fill, vector tracing, or font substitution"), "inspiration resource documentation preserves source hashes, public-domain status, provenance, exclusions, and transformation limits") + let runScriptURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("script/build_and_run.sh") let runScript = (try? String(contentsOf: runScriptURL, encoding: .utf8)) ?? "" @@ -178,8 +268,12 @@ expect(runScript.contains("kCGWindowOwnerName") && runScript.contains("\"$APP_DI expect(runScript.contains("let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber") && runScript.contains("let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0"), "run script tolerates missing onscreen metadata when the window is otherwise capturable") expect(!runScript.contains("pid=\"$(pgrep -x \"$PRODUCT_NAME\""), "run script window verification does not depend on pgrep") expect(runScript.contains("visual_verify_window") && runScript.contains("--visual-verify") && runScript.contains("visual_non_black_ratio") && runScript.contains("visual verify failed: captured window is black or empty") && runScript.contains("nonBlackRatio < 0.02"), "run script exposes an explicit visual non-black window check") -expect(runScript.contains("weibei-visual-verify-latest.png") && runScript.contains("visual_capture_path=$latest_capture_path"), "visual verification leaves one latest screenshot path for review") -expect(runScript.contains("visual verify blocked: macOS refused window capture") && runScript.contains("Grant Screen Recording permission"), "visual verification reports capture-permission failures instead of looking like an app rendering failure") +expect(runScript.contains("weibei-visual-verify-latest.png") && runScript.contains("cp \"$capture_path\" \"$latest_capture_path\""), "visual verification leaves one latest screenshot path for review") +expect(runScript.contains("weibei-visual-verify-$VERIFY_SCENARIO.png") + && runScript.contains("visual_capture_path=$scenario_capture_path"), "visual verification preserves a separate screenshot for every empty-workspace theme and width scenario") +expect(runScript.contains("WEIBEI_VERIFY_CAPTURE_PATH") + && runScript.contains("app-owned capture and macOS window capture failed") + && runScript.contains("Grant Screen Recording permission"), "visual verification prefers an app-owned capture and reports when both capture paths fail") expect(runScript.contains("open_app() {\n /usr/bin/open \"$APP_BUNDLE\"\n}") && !runScript.contains("open_app() {\n /usr/bin/open -n \"$APP_BUNDLE\"\n}"), "regular run opens WeiBei without forcing a second app instance") expect(runScript.contains("RUN_VISUAL_VERIFY=false") @@ -190,8 +284,11 @@ expect(runScript.contains("RUN_VISUAL_VERIFY=false") expect(runScript.contains("open_app_for_verify()") && runScript.contains("VERIFY_DATA_DIR=\"$DIST_DIR/Data\"") && runScript.contains("VERIFY_SCENARIO=\"${WEIBEI_VERIFY_SCENARIO:-offline-learning-flow}\"") + && runScript.contains("VERIFY_WINDOW_SIZE=\"${WEIBEI_VERIFY_WINDOW_SIZE:-}\"") + && runScript.contains("VERIFY_INSPIRATION_ID=\"${WEIBEI_VERIFY_INSPIRATION_ID:-}\"") && runScript.contains("rm -rf \"$VERIFY_DATA_DIR\"") && runScript.contains("--env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env \"WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR\" --env \"WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO\"") + && runScript.contains("--env \"WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE\"") && runScript.contains("if [[ -n \"$VERIFY_SCENARIO\" ]]; then\n sleep 2.6\n fi") && runScript.contains("--verify|verify)\n run_verifiers\n open_app_for_verify") && runScript.contains("--visual-verify|visual-verify)\n run_verifiers\n open_app_for_verify"), "verify modes launch the app in the background with an isolated offline learning-flow workspace") @@ -201,6 +298,15 @@ expect(runScript.contains("verify_learning_flow_persistence()") && runScript.contains("把可确认依据写入笔记") && runScript.contains("! /usr/bin/grep -q \"## 离线草稿\"") && runScript.contains("! /usr/bin/grep -q \"## 可确认\""), "verify mode checks that the offline learning flow persists only the note-ready agent suggestion into the note workspace") +expect(runScript.contains("verify_empty_workspace_state()") + && runScript.contains("empty-workspace-open-doc") + && runScript.contains("empty-workspace-open-chat") + && runScript.contains("empty-workspace-open-notes") + && runScript.contains("\\\"showReader\\\":$expected_reader") + && runScript.contains("\\\"showAgent\\\":$expected_agent") + && runScript.contains("\\\"showNotes\\\":$expected_notes") + && runScript.contains("\\\"showDailyInspiration\\\":$expected_inspiration") + && runScript.contains("Empty workspace entry state marker"), "verify mode proves each empty-workspace entry opens the requested pane while preserving existing note state") expect(runScript.contains("VERIFY_MODE=true") && runScript.contains("DIST_DIR=\"${TMPDIR:-/tmp}/weibei-verify-$UID\"") && runScript.contains("elif [[ \"$VERIFY_MODE\" == true ]]; then\n :") @@ -549,15 +655,33 @@ expect( ) expect(OpenAIAPIKeyStore.cleaned(" sk-test\n") == "sk-test", "api key cleaning") -let temporaryKeychainStore = KeychainPasswordStore( - service: "com.changfenhuang.weibei.selfcheck.\(UUID().uuidString)", - account: "OPENAI_API_KEY" -) -try? temporaryKeychainStore.delete() -try temporaryKeychainStore.save(" sk-selfcheck\n") -expect(temporaryKeychainStore.load() == "sk-selfcheck", "keychain save and load") -try temporaryKeychainStore.delete() -expect(temporaryKeychainStore.load().isEmpty, "keychain delete") +do { + let temporaryKeychainURL = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-selfcheck-\(UUID().uuidString).keychain-db") + let temporaryKeychainPassword = Data("weibei-selfcheck-only".utf8) + var temporaryKeychain: SecKeychain? + let createStatus = temporaryKeychainURL.path.withCString { path in + temporaryKeychainPassword.withUnsafeBytes { password in + SecKeychainCreate(path, UInt32(password.count), password.baseAddress, false, nil, &temporaryKeychain) + } + } + expect(createStatus == errSecSuccess && temporaryKeychain != nil, "isolated self-check keychain is created without changing the user's default keychain") + guard let temporaryKeychain else { exit(1) } + defer { + SecKeychainDelete(temporaryKeychain) + } + + let temporaryKeychainStore = KeychainPasswordStore( + service: "com.changfenhuang.weibei.selfcheck.\(UUID().uuidString)", + account: "OPENAI_API_KEY", + keychain: temporaryKeychain + ) + try? temporaryKeychainStore.delete() + try temporaryKeychainStore.save(" sk-selfcheck\n") + expect(temporaryKeychainStore.load() == "sk-selfcheck", "keychain save and load") + try temporaryKeychainStore.delete() + expect(temporaryKeychainStore.load().isEmpty, "keychain delete") +} let missingSelectionInsight = QuietInsight.make( materialTitle: "利率资料", @@ -741,6 +865,12 @@ let contentViewSourceURL = URL(fileURLWithPath: FileManager.default.currentDirec .appendingPathComponent("Sources/WeiBei/Views/ContentView.swift") let contentViewSource = (try? String(contentsOf: contentViewSourceURL, encoding: .utf8)) ?? "" expect(!contentViewSource.isEmpty, "content view source is readable") +let emptyWorkspaceSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift") +let emptyWorkspaceSource = (try? String(contentsOf: emptyWorkspaceSourceURL, encoding: .utf8)) ?? "" +let inspirationCatalogSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift") +let inspirationCatalogSource = (try? String(contentsOf: inspirationCatalogSourceURL, encoding: .utf8)) ?? "" let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/ContentRailView.swift") let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" @@ -752,6 +882,40 @@ expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains(".popover(") && contentRailSource.contains("SpatialTapGesture()") && contentRailSource.contains("private func nearestItem"), "shared content rail supports normal, rail-only, delayed unclipped hover, dense-track mapping, and real image previews") +expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") + && emptyWorkspaceSource.contains("Text(title)") + && emptyWorkspaceSource.contains("title: \"DOC\"") + && emptyWorkspaceSource.contains("title: \"CHAT\"") + && emptyWorkspaceSource.contains("title: \"NOTES\"") + && emptyWorkspaceSource.contains("action: store.toggleReader") + && emptyWorkspaceSource.contains("action: store.toggleAgent") + && emptyWorkspaceSource.contains("action: store.toggleNotes"), "empty workspace exposes direct document, chat, and notes entries through the existing pane toggles") +expect(emptyWorkspaceSource.contains("WeiBeiTypography.englishBrandFont") + && emptyWorkspaceSource.contains("entryDivider") + && emptyWorkspaceSource.contains("Rectangle()") + && !emptyWorkspaceSource.contains("RoundedRectangle") + && !emptyWorkspaceSource.contains("Capsule()") + && !emptyWorkspaceSource.contains("stroke(WeiBeiTheme.cinnabar"), "empty workspace entry uses WeiBei English lettering, hairlines, and whitespace without cards, pills, or red outlines") +expect(emptyWorkspaceSource.contains("TimelineView(.periodic(from: .now, by: 60))") + && emptyWorkspaceSource.contains("EmptyWorkspaceDayPeriod.current(at:") + && emptyWorkspaceSource.contains("geometry.size.width < 760 || geometry.size.height < 620") + && emptyWorkspaceSource.contains("min(116, max(76") + && emptyWorkspaceSource.contains("minimumScaleFactor(0.78)"), "empty workspace greeting updates with time and its entry and inspiration typography adapt to compact windows") +expect(emptyWorkspaceSource.contains("if store.showDailyInspiration") + && emptyWorkspaceSource.contains("EmptyWorkspaceInspirationCatalog.item") + && emptyWorkspaceSource.contains("case \"empty-workspace-calligraphy-light\":") + && emptyWorkspaceSource.contains("forcedID = \"lanting-clear-breeze\"") + && emptyWorkspaceSource.contains("case \"empty-workspace-calligraphy-dark\":") + && emptyWorkspaceSource.contains("forcedID = \"lanting-universe\"") + && emptyWorkspaceSource.contains("Link(inspiration.sourceLabel") + && emptyWorkspaceSource.contains("Link(inspiration.rightsLabel") + && emptyWorkspaceSource.contains("Bundle.module.url(forResource:") + && !emptyWorkspaceSource.contains("URLSession") + && !inspirationCatalogSource.contains("URLSession"), "daily inspiration is bundled for offline use while retaining visible source and rights links") +expect(emptyWorkspaceSource.contains("empty-workspace-entry-doc") + && emptyWorkspaceSource.contains("empty-workspace-entry-chat") + && emptyWorkspaceSource.contains("empty-workspace-entry-notes") + && emptyWorkspaceSource.contains("accessibilityLabel"), "empty workspace entries remain individually named and reachable to accessibility automation") expect(contentViewSource.contains("case .immersiveReading:\n ZStack(alignment: .topTrailing)") && contentViewSource.contains("QuietInsightView(compact: true)") && contentViewSource.contains(".padding(.top, 24)") @@ -1474,7 +1638,15 @@ expect(appSource.contains("private var shouldActivateOnLaunch: Bool") && appSource.contains("WEIBEI_SUPPRESS_ACTIVATION") && appSource.contains("Task { await store.runVerificationScenarioIfNeeded() }") && appSource.contains("if shouldActivateOnLaunch {\n NSApp.activate(ignoringOtherApps: true)\n }"), "app activation is skipped during non-invasive verification launches") +expect(appSource.contains("applyVerificationWindowSize(to: window)") + && appSource.contains("environment[\"WEIBEI_SUPPRESS_ACTIVATION\"] == \"1\"") + && appSource.contains("environment[\"WEIBEI_VERIFY_WINDOW_SIZE\"]") + && appSource.contains("window.setContentSize(target)") + && appSource.contains("window.center()"), "verification-only window sizing supports real wide and narrow screenshots without changing normal launch behavior") expect(appSource.contains("window.isOpaque = true"), "main window declares opaque paper backing for stable capture") +expect(appSource.contains("environment[\"WEIBEI_VERIFY_CAPTURE_PATH\"]") + && appSource.contains("bitmapImageRepForCachingDisplay") + && appSource.contains("cacheDisplay(in: bounds, to: bitmap)"), "isolated verification app can capture its own rendered content without Screen Recording permission") expect(appSource.contains("sharedWorkspaceStore"), "main window and settings share one workspace store") expect(!appSource.contains("launchProbe"), "app launch path has no temporary probe logging") expect(appSource.contains("WeiBeiAppearanceTransition") @@ -1555,6 +1727,11 @@ expect(!appSource.contains("Form {") && appSource.contains("store.setTopBarVariant(variant)"), "settings center uses categorized WeiBei chrome and real bound controls instead of the default form field") expect(appSource.contains("settingsPill(\n title: store.interfaceLanguage.settingsLabel,\n icon: \"character.book.closed\",\n active: false") && appSource.contains("settingsPill(\n title: store.appearanceMode.label(language: store.interfaceLanguage),\n icon: store.appearanceMode.systemImage,\n active: false"), "settings sidebar summary pills stay neutral instead of looking permanently selected") +expect(appSource.contains("title: store.ui(\"每日灵感\", \"Daily Inspiration\")") + && appSource.contains("get: { store.showDailyInspiration }") + && appSource.contains("set: { store.setDailyInspirationEnabled($0) }") + && appSource.contains("文稿、对话和笔记入口始终保留") + && appSource.contains(".accessibilityLabel(Text(store.ui(\"显示每日灵感\""), "settings explicitly toggles daily inspiration without implying that the three work entries disappear") expect(appSource.contains("segmented(NoteRenderMode.visibleCases, active: store.noteRenderMode.visibleMode)") && !appSource.contains("笔记预览") && !appSource.contains("Note Preview") @@ -1569,6 +1746,10 @@ expect(appSource.contains("init() {\n WeiBeiTypography.registerBundledFon let workspaceStoreSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Stores/WorkspaceStore.swift") let workspaceStoreSource = (try? String(contentsOf: workspaceStoreSourceURL, encoding: .utf8)) ?? "" +expect(workspaceStoreSource.contains("@Published var showDailyInspiration = true") + && workspaceStoreSource.contains("func setDailyInspirationEnabled(_ enabled: Bool)") + && workspaceStoreSource.contains("showDailyInspiration = snapshot.showDailyInspiration ?? true") + && workspaceStoreSource.contains("showDailyInspiration: showDailyInspiration"), "daily inspiration preference persists in the isolated workspace file and older workspaces default to enabled") expect(workspaceStoreSource.contains("var brandLatinName: String") && workspaceStoreSource.contains("\"WeiBei\"") && contentViewSource.contains("Text(store.brandLatinName)") @@ -1693,6 +1874,22 @@ expect(workspaceStoreSource.contains("let sampleItems: [StudyItem] = WorkspaceSt && workspaceStoreSource.contains("CGDataConsumer(data: data as CFMutableData)") && workspaceStoreSource.contains("利率是资金使用价格的表达。") && !workspaceStoreSource.contains("StudyItem(id: \"sample-pdf\", title: \"Mishkin 教材样例\", subtitle: \"PDF 阅读\", kind: .pdf, urlPath: nil, isSample: true)"), "sample PDF item points at a generated selectable PDF file instead of the fake PDF fallback") +expect(workspaceStoreSource.contains("empty-workspace-light-wide") + && workspaceStoreSource.contains("empty-workspace-light-narrow") + && workspaceStoreSource.contains("empty-workspace-calligraphy-light") + && workspaceStoreSource.contains("empty-workspace-calligraphy-dark") + && workspaceStoreSource.contains("empty-workspace-dark-wide") + && workspaceStoreSource.contains("empty-workspace-dark-narrow") + && workspaceStoreSource.contains("empty-workspace-inspiration-off") + && workspaceStoreSource.contains("configureEmptyWorkspaceVerificationScenario") + && workspaceStoreSource.contains("guard Self.environmentValue(\"WEIBEI_SUPPRESS_ACTIVATION\") == \"1\" else { return }") + && workspaceStoreSource.contains("showReader = false") + && workspaceStoreSource.contains("showAgent = false") + && workspaceStoreSource.contains("showNotes = false") + && workspaceStoreSource.contains("case \"empty-workspace-open-doc\":\n toggleReader()") + && workspaceStoreSource.contains("case \"empty-workspace-open-chat\":\n toggleAgent()") + && workspaceStoreSource.contains("case \"empty-workspace-open-notes\":\n toggleNotes()") + && workspaceStoreSource.contains("Empty workspace entry state marker"), "verification scenarios cover empty light and dark wide and narrow windows plus all three preserved-state entry paths") expect(workspaceStoreSource.contains("ownerTitle: String? = nil") && workspaceStoreSource.contains("let resolvedOwnerTitle"), "selection updates can carry a precise reader source title") expect(workspaceStoreSource.contains("@Published var selectionAttachments: [SelectionContext] = []") && workspaceStoreSource.contains("@Published var floatingSelectionPrompt = \"\"") @@ -2261,7 +2458,7 @@ expect(contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent && contentViewSource.contains("let fallbackFrames = estimatedDocumentPaneFrames(order: order, size: geometry.size)") && contentViewSource.contains("store.threePaneReorderFrameList(order: order, fallback: fallbackFrames)") && contentViewSource.contains("onFramesChange: { reportedOrder, frames in") - && stableDocumentSource.contains("EmptyWorkspaceView().environmentObject(store)") + && stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") && stableDocumentSource.contains("addSubview(emptyHost)") && stableDocumentSource.contains("for role in WorkspacePaneRole.defaultThreePaneOrder") && stableDocumentSource.contains("addSubview(host)") @@ -2773,9 +2970,15 @@ expect(!notebookMarkdown.canBecomeNotebookNote, "notebook markdown does not offe expect(!sampleMarkdown.isImportedMarkdownFile, "sample markdown stays app-owned") expect(!sampleMarkdown.canBecomeNotebookNote, "sample markdown cannot become a backing-file note") -let persisted = PersistedWorkspace(threePaneOrder: [.agent, .reader, .notes], noteRenderMode: .preview, showLibrary: false, showReader: false, showAgent: true, showNotes: false, showRightPane: true, adaptImportedDocumentColors: false) +let persisted = PersistedWorkspace(threePaneOrder: [.agent, .reader, .notes], noteRenderMode: .preview, showLibrary: false, showReader: false, showAgent: true, showNotes: false, showRightPane: true, showDailyInspiration: false, adaptImportedDocumentColors: false) let restored = try JSONDecoder().decode(PersistedWorkspace.self, from: try JSONEncoder().encode(persisted)) expect(restored.showLibrary == false && restored.showReader == false && restored.showAgent == true && restored.showNotes == false && restored.showRightPane == true, "pane visibility state persists") +expect(restored.showDailyInspiration == false, "daily inspiration can be disabled and restored from workspace persistence") +let reenabledInspiration = try JSONDecoder().decode(PersistedWorkspace.self, from: try JSONEncoder().encode(PersistedWorkspace(showDailyInspiration: true))) +expect(reenabledInspiration.showDailyInspiration == true, "daily inspiration can be re-enabled and restored from workspace persistence") +let legacyWorkspace = try JSONDecoder().decode(PersistedWorkspace.self, from: Data(#"{"importedItems":[],"notesByItemID":{}}"#.utf8)) +expect(legacyWorkspace.showDailyInspiration == nil + && workspaceStoreSource.contains("showDailyInspiration = snapshot.showDailyInspiration ?? true"), "workspace snapshots created before daily inspiration remain decodable and default to enabled") expect(restored.adaptImportedDocumentColors == false && workspaceStoreSource.contains("adaptImportedDocumentColors = snapshot.adaptImportedDocumentColors ?? true") && workspaceStoreSource.contains("adaptImportedDocumentColors: adaptImportedDocumentColors"), "imported-document color adaptation persists while old workspaces default to adapted reading") diff --git a/script/build_and_run.sh b/script/build_and_run.sh index 48cd46642..d1aa9827d 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -47,6 +47,9 @@ INFO_PLIST="$APP_CONTENTS/Info.plist" VERIFY_PID="" VERIFY_DATA_DIR="$DIST_DIR/Data" VERIFY_SCENARIO="${WEIBEI_VERIFY_SCENARIO:-offline-learning-flow}" +VERIFY_WINDOW_SIZE="${WEIBEI_VERIFY_WINDOW_SIZE:-}" +VERIFY_INSPIRATION_ID="${WEIBEI_VERIFY_INSPIRATION_ID:-}" +VERIFY_CAPTURE_PATH="${TMPDIR:-/tmp}/weibei-self-capture-$UID-$VERIFY_SCENARIO.png" if [[ "$CHECK_ONLY" == true ]]; then : @@ -125,7 +128,8 @@ open_app_for_verify() { before_pids="$(pgrep -x "$PRODUCT_NAME" || true)" rm -rf "$VERIFY_DATA_DIR" mkdir -p "$VERIFY_DATA_DIR" - /usr/bin/open -n -g --env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" --env "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" "$APP_BUNDLE" + rm -f "$VERIFY_CAPTURE_PATH" + /usr/bin/open -n -g --env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" --env "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" --env "WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE" --env "WEIBEI_VERIFY_INSPIRATION_ID=$VERIFY_INSPIRATION_ID" --env "WEIBEI_VERIFY_CAPTURE_PATH=$VERIFY_CAPTURE_PATH" "$APP_BUNDLE" for _ in {1..50}; do local newest_pid newest_pid="$(pgrep -nx "$PRODUCT_NAME" || true)" @@ -148,21 +152,26 @@ visual_verify_window() { if [[ -n "$VERIFY_SCENARIO" ]]; then sleep 2.6 fi - local window_id - window_id="$(swift -target arm64-apple-macosx14.0 -e 'import CoreGraphics; import Foundation; let owner = CommandLine.arguments[1]; let targetPID = CommandLine.arguments.count > 2 ? Int(CommandLine.arguments[2]) : nil; func number(_ value: Any?) -> Double { (value as? NSNumber)?.doubleValue ?? 0 }; let windows = CGWindowListCopyWindowInfo([.optionAll], kCGNullWindowID) as? [[String: Any]] ?? []; guard let window = windows.first(where: { window in guard (window[kCGWindowOwnerName as String] as? String) == owner else { return false }; if let targetPID, (window[kCGWindowOwnerPID as String] as? NSNumber)?.intValue != targetPID { return false }; let bounds = window[kCGWindowBounds as String] as? [String: Any]; let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber; let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0; return visibleEnough && number(window[kCGWindowLayer as String]) == 0 && number(bounds?["Width"]) >= 600 && number(bounds?["Height"]) >= 400 }), let id = window[kCGWindowNumber as String] as? UInt32 else { exit(1) }; print(id)' "$APP_DISPLAY_NAME" "$VERIFY_PID")" - local capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.png" - local capture_error="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.err" - if ! /usr/sbin/screencapture -x -l "$window_id" "$capture_path" 2>"$capture_error"; then - cat "$capture_error" >&2 - echo "visual verify blocked: macOS refused window capture for $APP_DISPLAY_NAME. Grant Screen Recording permission to this terminal/Codex host, then rerun --visual-verify." >&2 - rm -f "$capture_path" "$capture_error" - exit 5 + local capture_path="$VERIFY_CAPTURE_PATH" + if [[ ! -s "$capture_path" ]]; then + local window_id + window_id="$(swift -target arm64-apple-macosx14.0 -e 'import CoreGraphics; import Foundation; let owner = CommandLine.arguments[1]; let targetPID = CommandLine.arguments.count > 2 ? Int(CommandLine.arguments[2]) : nil; func number(_ value: Any?) -> Double { (value as? NSNumber)?.doubleValue ?? 0 }; let windows = CGWindowListCopyWindowInfo([.optionAll], kCGNullWindowID) as? [[String: Any]] ?? []; guard let window = windows.first(where: { window in guard (window[kCGWindowOwnerName as String] as? String) == owner else { return false }; if let targetPID, (window[kCGWindowOwnerPID as String] as? NSNumber)?.intValue != targetPID { return false }; let bounds = window[kCGWindowBounds as String] as? [String: Any]; let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber; let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0; return visibleEnough && number(window[kCGWindowLayer as String]) == 0 && number(bounds?["Width"]) >= 600 && number(bounds?["Height"]) >= 400 }), let id = window[kCGWindowNumber as String] as? UInt32 else { exit(1) }; print(id)' "$APP_DISPLAY_NAME" "$VERIFY_PID")" + capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.png" + local capture_error="${TMPDIR:-/tmp}/weibei-visual-verify-$window_id.err" + if ! /usr/sbin/screencapture -x -l "$window_id" "$capture_path" 2>"$capture_error"; then + cat "$capture_error" >&2 + echo "visual verify blocked: both the app-owned capture and macOS window capture failed for $APP_DISPLAY_NAME. Grant Screen Recording permission to this terminal/Codex host, then rerun --visual-verify." >&2 + rm -f "$capture_path" "$capture_error" + exit 5 + fi + rm -f "$capture_error" fi - rm -f "$capture_error" swift -target arm64-apple-macosx14.0 -e 'import AppKit; import Foundation; let path = CommandLine.arguments[1]; guard let image = NSImage(contentsOf: URL(fileURLWithPath: path)), let data = image.tiffRepresentation, let bitmap = NSBitmapImageRep(data: data) else { exit(2) }; let xStep = max(1, bitmap.pixelsWide / 80); let yStep = max(1, bitmap.pixelsHigh / 60); var sampled = 0; var visible = 0; for y in stride(from: 0, to: bitmap.pixelsHigh, by: yStep) { for x in stride(from: 0, to: bitmap.pixelsWide, by: xStep) { guard let color = bitmap.colorAt(x: x, y: y) else { continue }; if color.redComponent > 0.08 || color.greenComponent > 0.08 || color.blueComponent > 0.08 { visible += 1 }; sampled += 1 } }; guard sampled > 0 else { exit(3) }; let nonBlackRatio = Double(visible) / Double(sampled); print("visual_non_black_ratio=\(nonBlackRatio)"); if nonBlackRatio < 0.02 { fputs("visual verify failed: captured window is black or empty\n", stderr); exit(4) }' "$capture_path" local latest_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-latest.png" + local scenario_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$VERIFY_SCENARIO.png" cp "$capture_path" "$latest_capture_path" - echo "visual_capture_path=$latest_capture_path" + cp "$capture_path" "$scenario_capture_path" + echo "visual_capture_path=$scenario_capture_path" rm -f "$capture_path" } @@ -196,11 +205,66 @@ verify_learning_flow_persistence() { return 1 } +verify_empty_workspace_state() { + case "$VERIFY_SCENARIO" in + empty-workspace-*) + ;; + *) + return 0 + ;; + esac + + local workspace_file="$VERIFY_DATA_DIR/workspace.json" + local expected_reader=false + local expected_agent=false + local expected_notes=false + local expected_inspiration=true + case "$VERIFY_SCENARIO" in + empty-workspace-open-doc) + expected_reader=true + ;; + empty-workspace-open-chat) + expected_agent=true + ;; + empty-workspace-open-notes) + expected_notes=true + ;; + empty-workspace-inspiration-off) + expected_inspiration=false + ;; + esac + + for _ in {1..30}; do + if [[ -f "$workspace_file" ]] \ + && /usr/bin/grep -q "\"showReader\":$expected_reader" "$workspace_file" \ + && /usr/bin/grep -q "\"showAgent\":$expected_agent" "$workspace_file" \ + && /usr/bin/grep -q "\"showNotes\":$expected_notes" "$workspace_file" \ + && /usr/bin/grep -q "\"showDailyInspiration\":$expected_inspiration" "$workspace_file"; then + if [[ "$VERIFY_SCENARIO" == empty-workspace-open-* ]] \ + && ! /usr/bin/grep -q "Empty workspace entry state marker" "$workspace_file"; then + sleep 0.2 + continue + fi + return 0 + fi + sleep 0.2 + done + + echo "verify failed: empty-workspace pane or inspiration state was not persisted for $VERIFY_SCENARIO." >&2 + if [[ -f "$workspace_file" ]]; then + /usr/bin/sed -n '1,80p' "$workspace_file" >&2 + else + echo "missing workspace file: $workspace_file" >&2 + fi + return 1 +} + finish_verify_window() { if [[ "$RUN_VISUAL_VERIFY" == true ]]; then visual_verify_window fi verify_learning_flow_persistence + verify_empty_workspace_state } run_verifiers() { From 27db8b12e9fc4e1af695ee5da25bf096c759fbe9 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Fri, 10 Jul 2026 23:45:26 +0800 Subject: [PATCH 06/36] feat: polish empty workspace and compact content rail --- .../Calligraphy/lanting-clear-breeze.png | Bin 33121 -> 33410 bytes .../Calligraphy/lanting-observe-kinds.png | Bin 0 -> 27251 bytes .../WeiBei/Resources/Inspiration/SOURCES.md | 55 ++-- Sources/WeiBei/Views/ContentRailView.swift | 233 ++++++++++------ .../Views/EmptyWorkspaceLauncherView.swift | 248 ++++++++++++++--- Sources/WeiBei/Views/NotesAgentView.swift | 4 +- .../EmptyWorkspaceInspiration.swift | 252 +++++++++++++++++- Sources/WeiBeiSelfCheck/main.swift | 96 +++++-- 8 files changed, 735 insertions(+), 153 deletions(-) create mode 100644 Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-observe-kinds.png diff --git a/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png b/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-clear-breeze.png index 50305cc8bfb00ae496ecdb36bfe565605e8d6ad0..5ddd8c5e9e5ed36213cd8df19f4cd5ccf484c7f6 100644 GIT binary patch literal 33410 zcmce6Wmg?M&@Jxn?q1wo5A@(#+}$0DQ{1%_cXyX!#T^b>-0k4*di$)q?)(0OyFVoP zl4N#PCYjl5qEwW=q9PF?K|nyD$^rpu5D?JX|Hh#RaR1u4m}nCSh+tV+fP{uu_IWpa zv$^!Wi2nQTKA|xbipi(|I6H)f77>aG0Sg8IBaJD6gGluO1FH%tA&!^~Ln99Yh9}Wv zB(d*jc;A`^RxJizPM<e89tCXF4ODe68oWzBp8Gm|%Mo-T2UGq3hHVg3eB}RvPNK@K zwrCNbV{&JN;y+tV38;P6{u>Yxvw+$m!RwNs_RId>n?Su@fk#yE`r1uy<jGl)G<Y3} zy*Aeq<RJ*|u=6*;{9lw5kk&=;gMD(`4A_g|t~$kP2YqE0t^~6PV+k(6*}j_sZQa67 zPRlZY{{eTR%e@C!KhLceJ_(2H-RnKg&5^pRttNbFt=f7>oB1@mb5h_DE|!IUTG%q? zf2IKzIII~+gBX7C)Oy`fWqOdNyb%mlI^x(dg4a>N>+qm<azU`nnC~j)EYmiROxu67 z{x41<0VXcs^>b4oEur?uy^kLqk@jB+NSRA7@Os<+bKXU^9^;iE>4del^#AO(z^|(& zem7nQ2~uRQjgB<LO_F@Ve)a?07e*8BW_;hdCj+lTg4$cM-OR4Z$XAG1@+{21lw$oy zlN-`hG~mC5%o-Q(B{<3`an)v!+52@1wtWX9Wj%VqpBZi!2H<rX00v+G&SyZl+eH9) zy%I?HR^@gvG|Er#Kc}lo%>LqD@8+25=IAMRSIH2b9@ssVO<mZiviE>|`22`;92v*{ z0^A4q)f$Y-|3A9_`bvbx*_!igU(J-eh-|m7Lf{Wm6s8Hfr))Pz>Fh7O12t&6VQ2lN zHl-!bFJ`3RbzV?A&%Pgr1^d6bg*UD~gy8k~#J1b7BWC|-;1x<Pb{X5|l|g^TyEzJh z*M&jti0psRI9tRPdws?Q+R6pA03ImS6_Ko^gjx?*jG;z-+KqHy{<FvQiUC;pCJSo+ z9{cv*<mPDT?F0ZQ+M({!RFgL5`nT`x#awB5f>_WGHjuMHoOK+9g4P^1=G>{gE}(AI z62tjfg4qt-%eXxqgJxrDBPBKHSFS>B?m@$^cN1pjahKHp8JzJ%hsNca)|jC*wl^e; zcfS_-3F%v%aw~8?Jr|!?A!6?@-sz=JZ43SRhVKSqiBsY0X4hdDt*V1uA%T6=gzQ=u z-~;*575+Ku6IpZvbz=ds_oo8~UJG{(4UUM~jd*XWt?}aOk3sD<*U#1{e4@eyQ6sdV z_Ocu|W#byb(bIn(b`k_PzdE{mgkC)RC?P5q@<30fx)cS>(a0$+pcSb)KZ+PAY8vc_ zoyvB56)(_Qa0_ac*{~Mo)g?v3f8$38nl@vO=j-q16U;fx*5g0W&&D<s*xC?yjAHQi zcTEKB9Krb+4#0BP^UA=;|MK9eCzHu5b<JVNe3lSsVk%VgR7j3@?0Sg{K#p}Ve|1oJ z`mo}&jQx(T=J)S}n9!##yuK}Nhz({48=s`$bLGWFK7G;;NR|RKN13*7kB!lIh)xB; zN-iLSf6hl#CoEiZC6?pnRPcL~kNv$sK~5_|Mw2);L`8iX1jj*AUOyGX(Ln6M7EiXv zXw+AXT&ZO#JPhh_LK7vwX`Jq>Vnc`<_kJ&!Dn`(?$Q2V~*=*+z{~K1@be`juH!e8E z*_dAI$|*`-q#XyjwHC`?5xUx0_-qdV3~tXN33Oq(|AllR@U_}+*!@v#cIq|z3!bzu zI=A6a0u$R7jdwp!5KJco4!FqnMT~v~0(cg`gKFSt?I5CGgY*4!QHHWa+~&5$_8MqY zI{9+k_<A9X>vDCANaf;8zw5uYT-oviZqgG@^JKdVaD#gv=U4ESmg(UVYAu*tKQ8ep zxHlay9K0u!atdbRCZ8O|0yV#bHiGj`E&QlIpk+!~_?1K=HDol%{SHZiQ^N2IFDYC) zN;v^G0Fosge>29jhJed=kxaR?=-X^J-)}psR8+P>lDG$WsCmt|Z4zQPec|#AGGNIM z!-zb-wA(8mr(sdq4gUV(K%IvYl?JiywyDE7aOpYU;iV9`7P4vi8>pQt$E`;S#@14) zZgoAhNXw^lk|&Q6*S+ReOK;Hnsv@>b2&^=4nx$ggMfoH`@GIIU&U&`#h8Q8J`uf() zo%JFDZkd4~oqUYIDklUpk;f(8QkQEAqP8U|omfEx>AvsgG7dATKngOeqt2ykpct}r zY=dfej(QG$iEj~ux`ID)ubgP>D`3!=ePPfltoOT}>?90<mbvwP-6KD^^vC3B0CfVn zxQ+C{DSwy*k!sB$P|lke`zdRYnvv)wsB}G|Znk|w;IRwyunDvMs6Tu&Zi$S<`vjI7 z)`k`IHzYu~1quw`fEO$0JC%t9?vC%I5**Zs(<P3S&3AnZAyKpxW3QmkCB4#0en_({ zK7Q)C%=X2}s{>ncW%o6&*JW^Xf$kvzTsal(_R7GVxN^VGM*keQOQIq^cjvPY^gMKF zTIv(%%?$5Yw+oO2k(My`Us0+;RpZA5RmM+Zl(&GEPz-O{9N*}>uwuiLgt`gekI2vI z{?m^q-+6X(w-9h&@a9ABmch7ULU4W-{AMwWNt|KWaGahv!b{IPf?QkRdp7%9aZb-{ zuMcUCAE`=xX^cx!#7bpK2#@e3-NKs&u}{w})$Wb*wed_OjhRA%D&RA&YdwrMu#K#5 zq2L(OY*vOPevoKcs!&rWT&J!}6k>?I@K4|9`yWKO)WB}2OX8o2WMpyGCqXjF(+p3` zfbgFv)kc}qG7EUH$JF3!i|bge6R(=^M|@0GG^E0a*ZYPFw+sC86;Nl}zKzgcqQf13 zBS$&BKuQZUvVQ<I4DJ!Il+~T`uAkS;*ag*z%z1{7rW7q0!2|_JARMxa25L9Rb^{N1 zA>e+31<;0gc=X)9hAaF98X$X@a$&#Jqb&9^$r)hRnJ`@Zym}NG6L`dKudPlYDHT-P zxwi4R&&(Wf5eC47kP3YS<ji=k?GYlRBTGZvk4@(e?gPAA&lOvFGa*S5WRpwpEQ*TV zlzNa4mEX?{6SF!CS?75M4%J5TwH{}FV3MF#zl;=GU!2om=M%wm!BSD35LTksqwK+Q zrJ-{uMY(!J2A?Va8NL<)udg6fGUtWV+{!GNv_zBq0o?T@sG1q7el@EBvK~fQwBx!` z`sPo9BrzXo%ziwd>cgO$x!@eqH(aQUIbp*N$U4%+A%2{}UoaDpz3vLW-E%{0?0BZ@ zD^t0)p{ATN;%a1j=b|ydR@0XAMoSu96s1LkxSLUw6#!BtWLkmI95_pcOuwJdgPIBm z2zsD!!0(A@o-|!T3Kco9H$U+U&dwRl>B+wTbJj3Q&>aVnA?7`F{D^(Aix1moa*&{U z#PuuA`!7)cCwL%p1@SBdp3-!M$(5_n^~!7;qr?lpG0j&M!KM2zzG!G{@umuk0_>g@ z03cEX%V`U}AjrZ1Cl6U?RrI*fK=E2IZ}gakcJ#)jW={6Gi4OmCO0iCa?qBjl>%{S# zJ#*Dq-4Fle=xtQPwGiB9?7;UocZm*X*2f%o<McJfJ?Lx2W}&0KAO2sLg~B;&+`0kO zAfRUZEVIwVd+4T6{{A;;Zlu)UT{RF115)=h_3l(%TS|pzlv-CByQT<+hBwi8uJPjf znlav;<U}7ZUbSi%A`W~>J31@MaDPcZ8Q9~QS~2gv#hfqY=FQK>&nk<_d<k(IIlH&I zSM@Dcdu0H-5CB*Za!HUf-X&devtM;<dwaumBfH>QqsS_)8T8~)xE6v3RdP26^_mvy zzuHha`Sxnf;OLNa1O+NB|4P3Z)Fl+@a9I`=J0KhX@koONK54%wO`h>3i5P1SS~;_+ zx7}Omf?L!F02^(=aBlCm2!XKN?I9WH8n&RJx9YZLl13_4*gd(t@2a-rZ_}NWuF_7J z)X{raZQhC0Qy-cizqRI!(lv=@`Hu$q$#ad3j|;*DidyT&^`pwsnoIhVb}<^luONh* zH<NZTmrT#uJrGd8kYQrpGxaPWWQKFXSiaLtfkkI|9wZ$6%9bHTJKT*B2|eD{wSN+M z{pLO=3+b*_cc-)h=CUSEZw9y2f}O0bIaat$b}|f1cEgGx!P8nrgm&}7%M!g}5#JIe zH9&49{hu5uZ;PBL)iiMUAbh4|veW!!)$W^vNzz6-Lzd_M`$cLHGIm6R$-=k1&Kh#{ z=22~C)1y!;DqHD?O4WhEv6=F1LF=?BsklM|j#@V;&V*dSjXNKc`nnb7%}znMM|?5Q z5fhSX(|(UPr)Kr-SL$#)>`)3uBCUJqlATt@50|Y<GTo`ws{@fhHjdM3y*sJAT&1Ul zyCV689s%@230<Mb=1-|`h%M|wS1ZeD^8MA?BnIvIN$T)dVLWG$0b`aDPb~BOjZtvo zc9&wIHbas$qsqY=qWZ+4b*#6DHHdA(q!(qB>ksDAe9~=){S+zg$V0EdFqI^)NPc>X zoBK{jPu%TN7Jgo^m0hB8{aC$)#9i1DNcc-PzF6*Ozpt32Q*+IMQ1z14Zy}PCDYx|2 zRJ5<PuRTzw3$;2M7_Z{z7nrYR-|&f4KWh2EyW3kki$qoj`?x=Fa}5_4&uYG2=@4L! z`4pZo7WF>Z>0NVokZDa5pqHVKQAW#rnl7qm#y=4n;^R<{r7@*Ij}J+!ZeBIqnQkx? z0K(jCVkw6@wX#nY%O0;J;-os3=y6pt=i`mC!d4W}o0}$4GvxGrDJolVMyYRNqgYwP z^-0wh=4=slDY$ETHJD-1hl~yc=jQM;;4*)00-Zj;D}?Oo7EzEDU7GD(BG*%aV2-8d z;J6?aOJj^*1c-QCZ;^a07kK~+N`!5Dd+Gv#r`f(JnCryi#!0Psbx>g}E7Oi6msuuL zE;TZ+B^|~m*AI|pTBx->R1O=|@v`>~nO^&LE?&C@k@gA_o|Ci`HXS54S21c*M0OEh zphczX==~7k#`O8E{D)WauJ}CM!Bcpd%74J-3$DM4BHAR4gjNZhoBDY9H%F)O#`e9n zYfmj<yzfL5!|<>rp7n4;m-G5cWvB}Y`^RA!arBiwKxC!|O1f3cHHL+=Ycb_Zj>FsX zT=g;(9>Znrq>+9GNYnFE*}(DF^CX{c;ia)#KL|=SWlUyNn>?BpEopwru32}OVNvcp zq2A2_y7@o&sa*F7;6Aq|HtPcAul|c{eamCF{~|YcS8e(+FM?(KBJ6h|#M7CFmc40m zS&?ZNl@2x<@Fn1<G|@4KsoKW%z3YYEaQ?1@)y(|S)-qN(Wn_7^$-O<SN331FlZfUn zI9(R|nj9x~@BLr$si&S>kRVx2`s4@j&i`nGaR+}%B>LSzK#le~mcj1BmWFU89&D&R z=uKxT=A(k(FO!-s+sEB2&Hl0aS_zLbrldVmF~Q7S5hi`4iUP&W;x5r#khILeum&&X zJO#@*q?Erain=4AJo}``9^(gb`oiVzW@%27P`G8iEwT}MXzMGhOyaNHuIWurchEsg zq%FKDC00^5>e2Eq0Au_3h+rU_MwUkv!ES0$c|{2+?rz2BAkXC*m$&ZwM8e4}rme$2 z65hbbn)Dz5qusupWs{*&pIL`ak}g6~y9-ggc%->=E$!)hWoFih>30VevuOUVi{|iR zrIfUgRgyeSAV$^6OeR8kP1$}e$Y=M#Q`MP)+{GQvBYZZC+gIKRLiHCd<mB&>l=*v` z*c7cMdg<#U^Twt-h-v+3fAQGuT*`@j;K3hbic{rkEjx=U1vi$%__7FLNFLJX$q^7J zS*RPk4u-uSQ)H*t7UcLb85cF<3uM<2=h{y@=;+#%jU{kYlKK2m7(tIhqzo_L5!E)? z7ACo=O4<4cb%MR#9_N@NG}xfO-~Jb3fLg}n59N?wH%bIMN~@6WwEBAxq5M6aWCdAa zJ_&OtuDS|sw+%OE-4f5`-gqMXqw50lC{6#w1~lf13DIS*i?GK0aI9Z30-Q1iuAy@# z6}_)_^h03Gnl2a-Ac;>#HVq6B<}dhz2~R{$SMd)|qHM}rVp@8p_>h5jT+ZrEz-ot- zT>{&-)dTdnTfLJqfU{sanBsdTb+p@&4pUIVw8l+jeBt<y;}iF}mUIrHAd2DsLan<4 zedq;7wh-*igzt>`>V8~FIp${X2>xz4D@&e<u@rwU%SMUP+g8T@@O$0%J8x5v(27t= z+H(&0&x@jnByykcv+vW<^H_p>K7^=X&rdA~wEY4TytbVrkgSvEKnpSvuzMNVxj}6^ zwC+fOgsL@dm?fF<Jz@+t4gmT>QJV1j{tRT-@66>sn#?>Mse`Qq{Xp;1FF-w*_yk3k zFGvF<Ve|DjNBe`u)JP=qPTOxXR5j8j$-c{Xj9<PX?)&)T8+J-#PzLD5)`71?ocO`< zi26o=1M%lZz2Kmd=-n-e@awO|k3Q&5`Vj{qEGTfkZ%RZyUsen9><#+cspe)`kzA60 zYM_4vTKKV!*N;=!<?Xo{!oBEnNNLd&IV5;rHo5-k0y&-}tr6`-!{uJ09`F0rIJ0`f zyXQTYq}CnZiaMb)XTK&1nr(@#_r<*uD5Ouv!tZ!-G&bgD99DdgPUpVE!3|uDa&)mI zHfDGjoF9T&62-`&x|#J=ws55B77*%;3JvaUjT`WaQrwks)u@xelffFL+Tp`ds?0>W zWU39X32lzW08d#I_4tCn@r4eHc$;Vk_RtH$tYLU~RsB+bNQC`}DI)yo2^5L9mt__! zN^|ci9bT-9p-O9Jt&$RyJjV#ytC{(o9)KM6bFl}|02!W|h?f5JGRbgUJA<agrQREx zcg(ST>;_Uah6_cT>6D6)%^*w;cjM^J>11!3f!-6PSs@_rp`7*aDG^)RGb4AR>99XO z9Y+cB1;cMrZgJ2IB8<V@a(2&|a2g~+VUAB~>`b`Q$FDfE)uop2444|l2?$<3{84`K zwqzDMz9~7jx$nm4tc4NI0X3I8nraeXR3D|J0luJ6AOsnHQ8!^U$qHNS@<uT<9iiqs zmAR<oxtS&^o^K*Imt-*;&Jm2w!tLaW=1<LL*hM<(&X7L7$(OQ-3+cPxuOuJ5Uk`g8 zRKN5K+@f66r2uUJyg=<FygoUh!yntjO&C}%e#s3d6pvK{3L1RqK&BKAuba$Bdx7>6 z*_^5QaInNrGICWBYr^rM(ZUmD=V3Ra4hD&`ebHt|#C_5AG<*!bAhdl*ogU&4n(=@% zo|%}@NZrBgo&t%I04M~eT&Q_0mjZ?(w=l;I-=AjJmw|N87b?jf!MFD}DKZ_a=rM8o zj<}LhYP==Q3|e`iri7%F51|ns5CpUMXpOA4G#97ZMfR(wT`D&Lr&HS7_tkNZVA<UE z)E_21Vkg&|@+!pwWF4i^#(4UwAaw+l=OtpoQ59pHL-1;(V0Yw#V4kS_eiZwSHwd4- zQdf>2DANZl`FyW}gpP@R)=DDG|5O(Gpn1emC8XZK)-V2ROgpCbK(N1MB?l-m)K)%4 zE%_(a_(9LT)3lUp?7!zm+7q_N7R!{CWUsWin2@&U*;smh6+~=};1aDFQe!im4xW@V zUCl-&9Xwdzc*;GXoeHQ0M1dn5ZPc%R#w+LJ+YIc6!#kNu0BV-alNO@(hM3Mn`nU1t z1U)JV(0NwFVs~x0#@YppLQ<%|Wpe8t7`J?q-jlyPtDV#|ZVt%$#WKLxsPGEqdl?2@ zzBje^FgMF_m`UJ$ei`naf4wnG7@BmefLDnkL)`oQPfVvD=fUM0YAtW_W~8;nC90}2 z7N4ZvDzG7<q#v%xpS`q}lumf;#)G*p@+yt3Jq`bWh&GSvnq>}{HqHU~eN_KK@rK_@ z0$OG^_J4LWgX0;{&mrMwH3;eoJTg2`5X@G|JaQNH<+Js6-QNATNe&iG_n$?1!x9ie z&Y8$q`+lE5QL}pV`#?Y1ii|6=k)yz6{W6wKd<gnO!08!71@6GWp-g6Y^qmEB)VUNf z2a_W;(JbAQjgD`V_`tlVS{o)QKKsseW^y`9S#%79ev+m26}kc++IAd`TcU$}8dkal zqFRSun`J5#g)7BU-d382u+&BusL2Z7T4QR^P5febl6*TW2&B0i_4`Au{FA?NFMgHU zkT(xHe!przW1Fq@xzW7Rr8B$ei4n}km{`lqcML>A61!~pief*vT4nV}G#P`da4QDF z-heoS?{4NB^pp_2ts6Ifx52q0w3CuFz~`mnCq4^28D!9KDY8pypJ6=vA+6dk|7}yi zC>n@;7YV1yTRmVF>g`C}|HYRurPp;N!c0g{`!u{Ns6|2Ckd4U(<Q<=<vD0zmSNBjI zi*U->Gg=VhY;^njis%}zrv6^_H##)jbd|{BP*&uaj8%G?N^^uj^-<o;D?3K3&a4`K zW2Ys>#h@efIv?$IsMn(_=EW@cQ4^yej6}aH!7W@Wr)rY`*N6p$uDg{F<%H!%<x4%; z;VB)txA@H%7!@JUKasCCT-9*8QbxkEaO-ay7fN%$bNuJPasc9HI6Ni82v9@^GiKzW zl|rQ46xZ+5n_bQjJH(V?M^IQQscPN_`+>3(ZAp36y^)zLp&#_9P)DP9`o@rm^*~eT z*_xQrO@$*b#ptIu{A%V^BPw3JXMth8u*by=zkY@`EHXX(l1{2kJg%(~n&jJ@T}DJ) z=09v!zasK85vfw902D~HRj@F-g(%`Q7??o2glKn}OyZX(m6Ap_ua+RnK)<0qPn5A< z1k#h&Aa0X$^P;+Rvrs>m+xsHWBSwW%TeRWYh^KxbiuRQzC%6U1qLim{u{Yoyx+}nF zv7WeJypN&y@z;%kgG^}-GAUKUpXCUbE)2L-HnHEF7WVI-`iQTkpp2l<yGP~O2U8*v zuCt&ayZm^s)^)pX;x1fuvL}e8eko&g0*ARWMyCPXb?fiR;NtKhY)PsHINmZNV&!1k zV4xm%_UL>P*-&OBwJWc<1)yY}8~d&0diZ-E1Wow@Mv-cp2j`1Xm~gsH_$Fd<oq<z~ z9HDFJK)yGrh_)zN@pFaA{g>Dw*m6QaQp3wIER-)bRk~=iHGGNy=7imuBfCVIU0wk- z!x+TrK(t(6UsygR3l4k8?pI1@I^jf)C3tg(M`BGy$M^ulcY@P%+)*S^WEl%VTEY1< z53g7Z+tWyHE5k2~i>&!DpYipccqNMs^j4iQ#gAR_97dvjl$`p`=#A)+HJrKhc1%oh zt(<Du)F1e<PfobT5=!$@<!kIyJteW121Gh)=Y(iKg~4iPp)EeSHue)m#0MBwvdS&C z#F2(Fq|tdzbKBa5+bV+2SgYRJdr>zm8js6yS{D8Rd=?6Us-^&rsPR1CM}GqNlabef zV+F#A@W0AY0m9XsySibpgGAb~q9{v>G7?2*#0<OLGCP@JDUp{UST7+E-8N*fYQI38 zG~dEZ_P)Df8Q_#ORD?+0=p`aN4YgEVFZ*2Pn{qIxazOz|G|VNt>#CvL${A|ztw~ha z*K=LTeG(FWOj&Wqj_h4G-Mg!MYX)Oa?|bpZ^1ZGzOGL8tUSj&p`}oC|m~s$&2<4M6 zgN~5PP?4GrAGbo6joF7I?<akvzzVVIWF^9PpUM_)lpG+D-ydx>ze1Msa4j4>n}0xz zny}PB%q323ZwufZujIj)t5yIcge@s(ADIZwv_h%@b&SZm@+%6zVg0e9R4`xvE|dF} zhQ>V!+V~l<YGcc1|1?wRo@d(a=@YTm2X%b;Vt0wV*sEr1M0)c2eS#9)2pYO&3CcXy zi;I^wE7B{Rd+7nwN|g}3FxNS`5Y!vyc|yWtZLKi|8V%e{oBI;~MgBQl4qpeKZ=sZx z5*X?p`(^U}u$@gTFh0d@?_L-s$5J9iB{m3J!Dh9SJ>fyw7}?RMS&mGIkC|z+GvhAK zV5X-+gL~j`V5pu-?R+jpeB<rbE1Egx?;21~Pa#wTKBbX+ryRB-t)P}(HorP#3OL<{ z_Q%e_&k*-3Z{5Tiiq3S!blqley9k_N>P&Z6%;*-{?l05kA})*CTQFm!_LLk)abrB$ zbw3YRGH*ojy({XdncO$mu~q)@1>9Un>L;#@5gofHY69hMmDM(Qk+;QsiA`XkvG7(E zu)Cf7y`@$<0V7b1o{CCb`mbzg)odS!E{fdfYNB04A)Jdk#+@((Awgx?3DT%$&Dw;k zI4T9~QqxM<Ol|>!$}zB`%@RUA1;IajbLJaKf}z}6A?tTquLT{`{Lwjbywt<<DicwR z^}0E<#kj9;V&(e6(-`a)=VBVg6)E3SD)by-p}{7jW7xEU!gPH>8VHjyJ#a+*O$ClX znR$+}*LR2|wW<7nj}P68eHi)JR>c=<#$kqHZre|VDx)d9llzS@7+Z1kP3A-u`)DmY zuM>&jPPMUXV5UU-Ydywag<wNrEMJDAD1Xx<M{AHkH7c_xj(mwAx^QHIM9^>K=)Qm} z&A5>UB%H93@hiWDFTW|$<g8I94Y8W9ZV9MbMfbcHyvxDy_WWqXN@}PGpQ3ug(Jzw@ zeIHDvo_$8QQ=oSBL1+&7*h(6SY?@;4xU4L&*7Q;6%&Ra?&+L;wAW9WR^s%KkHcc}> z^YO@mQ&}KRV{z5_*859D(9q{R=DtM|ml*)MlJ+Wxm#G;u9p#hoDZZM6k;=nUc2xdh zK>aLE!-Tedw4<$TN8k?>*s)ckq{vmx-|goGX1iR5dUQxIJSs06c)@#!TA5r5c0M=x zW2^kB_Doib@K7GvL0DNb&p|;5DMB!Jk0wlx1MT!i=&8pl#C?v<$`o|{m&|g2)ZEsC zVx>?b`TK^-pLbX=!%*K|)-EThXbRjXR%{jKQ5i3*NuVAvT!<z1jBH6a9OIXc#MXyD z&!Xd*dK~CKvuS?y>&_HiaMZ{=*@OE2NDS1|OKZMES41fJDBjEZ-!QxAXD1i>`s_91 zI5Xp6<)kgS7yP@Lm|h5td_J@}S2V@&mMuCqcq<uey*I~>4~J=>`o#0=aD*{QY~eB& zAnZbzLDXJ_I15xB{>mXQ@YygvgD+WMj=G&$DyioY_CrgKNhvV;W^K|s3?Dp}Ju6?D zWZ~c?dY`|duI-6X{G)`_%@xE!<a8c1+!rV@%_8E&aL-em;vC;phu}6z+U30^Nkol{ zA|E_!bwcaC{OU)tbUcrj1xXT-lW#p$`Gfg<*f0IpY(%Wg^YPqXb@nNF9B^t$+_~BI zr?-_B-}F?Syw>n-Ciz*2{q?ncF*a@7bdSkQjeYD!lPf4B^3#)D;P~5$!$a|k^ATCZ zQDPjDo6$}8ggznWoq==iV?o;T<tNV4Z+4Ofrk=8XVB206O-LuEtjDf+>-}yD@<#{L z!JUJw_l2JLpDF3yAVMVFdAonKmDHNIB(;iuKGHRPMcwY6*wrQQMmskOU}J)Xb#Z)? zKAik<CY@zkt((};hd^Bv%?3*nDr^7O@i&2XbLlk3fg$}K6jnpSCg2<3cY3LrRAuW@ ze&$TBCQV#<sM-v?a*O=Y(md0+9#IPuE_|Nm&(!3Ro;oH*7w<yYCY8ViBU2c=b3tXy zY8;uEog9nE2l3?|xP(h?oF)1x#=Ot<N#lZlf6m{W7^}f-pVIP^x59dQy_E5^F^mtn zgv-QuPdZ*=8CwBM*|Q(9xyzrbe+(>qKsn)=f0W%4&1gzm%OMx5k!Yx8vfzY4B_v$= z&2{k}K&rxv6!7^xhP*0~$JPt%K4o|Fy9&*N9hK%N-tAczrGPd`iktBFAaze=ot~ua zLT=}t4Xp=~@p>JVQ2(haZ0~2|-o86DbGos*Mjwn;g1KhLV-v41owUn6{UVxoe|W&! zO{yjiW`iKay^d1tCC{yBz$N6NE__UC%9a*1woCGvGADs-@z4<lS6^)!$H~yN)sFw| zSZ*n}B-fA$6V+pS3PVE``Z<j~`g{NDaBxAQFJs*~R5h43No`a#UyfpMi361^6fsz? zn@Ib`d0BDQ#HA+KRFDbMW?bO&6Nj$Hp=+&N((W9`g8wu>c^Q8E)<tbS=OO2dEcHA$ z^aPuDTI1|@pzgvX%CvC8?T$oyKf=lMc8Qo!{>)ug_LC27I|J?m*>K@Q@7%*$-m7ZW zEh7#*>6)0OJw;rXW#bH0?!~lgZ653GYlCa9=QY`%XvGIL;XON)TN1vI;*_<-k#8em zr@g*`qzG7!XxT=H@&pYUU-9gsllP+@wCyw%`bpBEO7{7S3rNC6tXyzHoPs+*jIIhP z?&?f1f}*mR)xwyBGKM56q2IC8h>t^k&>Yw@B^Dd_=<*JX#SgwrOW3n84tS%HN0G5w zPhI!aNdLJa+(<|{Xi+Sku<bW4n@vKO5Kjr?<$!ufy}WG^9K5zPm}_`be7n?6YNG_J z0c#Cu1mo0x-~)_y`#dIa{`S?*YEpvg_X;{LE}k|MI4@#4{@SrawTPz2=M(Qg-x0u{ z89}eGzda9dUMdro5n{gK*E;ca#SalQ76Xpg#n9JGU5e#$P45ggm#Bbj_8qMR8VczF zrNlj#fBWIP$&lWyiW#0Mhm6JN7Kt`GmmIse-Wl(qicw494f9U#`6HA{i-$mnztw+O zsNh?YN8fg1CDZ-Tvye2xBakmO5D6P<prK+mPug*z##5rlTZJzzt=_^Y;g)<)G|anS zSh34v2>v<EKBoPSBUAp)D&zRUdOLzNjGVRHyPLgCMl3epxj91jWC1Aq6T4^YElM6F znvRklYiMI~fnV~FpVF+*Svw7#1xA#qy_YroM5Dt^Z0_LBO-3mnnY?@n@PT3!>VjOg z2PPvH?If|#vP9YZCGN*SI#)MH&e>7pz0)k(CZU00_UvA}Oh=<FoLxGX#^p3NWa<On zaEk8~1qXuia}RfLPj=9V2*3394L*M`n-`RFG~oh}7gsOi2BPYwgX;H@XP}$I01_lL zIpt&C%CS}ReH46R``iZ?5QWxa%864pdy}U(ZjyZ>KYSl^AVn$=ICJEVsJIn$%>F{P zw^T&UHIHs`eCg{|>jq5_6~Z!leLU+zSK*6&lGyy7gd$+C+mawn$>l?5=xH5jw>IvM z?unDwce9BKc*uMeAcQZPX)4fSMV4CcLkxtT3nu0nV8Nwsz<Bzxz|~2bBIT$(lsz=o zf$>4NkTPXzOq--wOqwUIszFDqh`fMP7R&%)?yTVR;6^jI&zZ{wd$oIYbSin43OkW) z7!h_y8yd<N9I;GnFnE%zrLZ&Wv}|^gvo8sIVTl1%1QqOsG)HJ(hg4<l{{wX&&ucs9 z4uUb=g-W^#$uPHRGjGkf_xT>aNc`Eo4x_Yx`-SOnw~~E3!!xnj#xb;|U^*3q9#2k6 z)l~BP6W_RN_po$o*<-_xW^-$r#(|jz+HgQu01obD{CD0!Y^<Un(T40VbMu5yEIhfN zXeFs_nIZ3k_U@aaJ*=`Wh+}eV#{MGJ$}(zmC~o&kzEBK>s=weCFOGJWzA`eTdU??r zHFR?iPYL?@k2{OU+=<M!mmJTIyZaRsN2ne<q53(JxjZqrz#Qx#KdpQ@RU*Myh)MnN zvkhU-PnAFm-OQnmjk9*E*m`<Q778%5A#_ge3NnBqy;n~B8!ZMaDg@CTK|>M(JAVV5 z5Jh`|wipE-`F;?R+V5jDVf_X_y;OLZ6f6EZYp|h+wTWOg;1+2#9A3BDz#Hkt_ZbDQ zU(V8Q5`#zM`N7rVzA0$MoU7bEpe#ET@MAj0udX<T<%nhEtt7#dQb`H8#Hl_F)ocqq z2}bUX*h6>u$oAP^(n!f3aTvRUg1CmaKQWOuu-i|4cPXUHk-4${YNRM#52{3xQg}EO zD8ADI+V#V+7U>ux(8tp4%(gjX2oiu-cWUi~)MP}W$hl4;&zn9`#;PXshTqU0pS}qz zXVrDF4>#&vaHUASi>i@ZYaB3!cTWp*z3ZsEXQ5`JSM}L6i1AW70OV8q)GWUC`8i@` z!}Q2mr`C+<9bqrU17X0TIV6-PS2HdJcl0apGOsU;?N?dG@#n~RZNvrZf$&HZ=vm_7 zbW=fySpMid;6vYes-4v;6_GBV$-d0{TX9ltQp*|#v{JS#x-_1{j_~g|PCnhEf7F~6 z`b7?F4j5>=6C#X?D!cG@fMd5hJ!Poy&5|Psgt9_ep44TLh6Ok~c$1|nu!bJ7EBr_K z{J{OD0nyKFz#Ai%R%&Kh2ujg~iS}*abo(D4+T<5SKs+$|j>Em~p3-WBSkCRQ1NxY% zd@BA=mka#uX2+4Hqfk|Wx~R}P8%~aBwULQd!AbVaV2(||$ucWitTM-e&a;)ovd=!V zHVCqG^i%ia6ZO~wS5EP55CBd_v7Y8#Nd#sAG)~G8UV)=O#^r@T{q{UiN;b}HxxxMB z()MJ~bah+4tR%u1vZ}=@q?z%mz@SW~m^ma$*5<v2#3mHN+(4cAbw`L86HzZAJUL(% zwS#c?aM!ef3t7Afc%tn<<X#w_ZlKB_<%8u+vZw9(D2xPkdZ1pH+L$7AxaeDKOd1wS z^<$hf*+qWeG<dutt2$0?X$^tl&ufv^*nswgR{y|v0xAl3GJe^DKaBNouc*+gQOi%? zlSXy1ywGL+)9`-nIw_vp(9QI5^aF+_AW^Fwuv0LwQfH8-KfXu*HD0$xMpnF>)brbl zYi3rH<jXYigDw2}Sjv6NqQStD7{Ml{lFech<t=(S?;Zh-bX3QO`T7JyfK%09?uCsR z^o`?FGJ^nby+}tY6YyuCd@$J+gh~Uw!&xz;7F-K88pxe|2Tc%)eGq8lQ7+9dQz}7! z()%6=J7|YCJgU{un$cKuy#BcN%2bjN`_s;Ek>L3x+w2RLXaeaD`x*&oInFr0B~r9R zWJ5^?$v$$hkYHvY=18#(CHJeq@i^@0h*_-Jwd(pnsJN~1DvyqoR+Q)k^5||yL}{+g zNf@UWzd|%RR`pC5Y0r7E9~|7s5!}PJj`PiQ%$Odx%n+G2VEyQs>s2|di*7Q=5Ci)e zzg$cJwuc<5ZipUn5OMv=dflP~qa}v^An(wRZ&&azWYz(UArV$!05gh@jZ*DoidHY- z#8MC!xb)+@gZF+_)4;p^zDk|Bn)wlCTkv^a|2i<yo9o|;)ds_x`p0CETV1`ovLup@ zvHgpwdajtWBAVP9ETUrhs|Cn!i(49%Q1wk91rEILzqnm#H8N=22kyd&WPuCemHpO1 zX<^Xqi1awpo4%~IXg15PMaLmZN2vXlaa);m(tsBdwEyp_m`3;2Az4*Km{R46*)`rA zQ5xo=(>I$sIYdZV;TDqyZpDr)-q;`Fn+=*Gnsl8ir%$6xe5H_)*Emp`PmbV`P4RFy zc2#ts<a84STwW@&lWod)OC!k3xra{{Ph_T&Z|rJU&}4b^CHhQ?qYs?Y(k3YGg83?< zDytl*Uf;2tou?DrpVzQ_qHwXzmC1))gbSa~7`2dei{H#jZB+az=RA$VZW*VRiATM= z*?_Ai1HE`Bf=vx|ke)Ssaul^dU$5^W4R-!b2wAW!H!nlIyB2|ANdoxJov~4ik^3UQ zcebEHC=$w2Vtk~$a@<k;H+nHSXQdQ%rK0-*n7O>tSI8Jl^CuKU1K^tBh6ndk=>=en znXINU>Kc55=c=MRTitePkcWe~cM->uGgKL5J}8L!jP34ObF%^N7S#*k{*Aj7t|{t^ zO+;xkFE+Qwv1E}sJ{)5nIx0hS_wJA(@~MZ2S42xd(A4fPR-*%HvXY>!M+2SHICFDV zN-?e-GV%z?F7A}y$m7dBb84Zbh{)MLvBI0p_=}`S$^wJte{h;%Wk)(hRysi+WT6b# zFc<-CaXEji&XE&l@RG+OE~d_j6NGpSx!taU5=FkvOCYl|X^uS8_l|C%W(dF!<U0*{ zC?}hl=2zSUD2oZ%Pk$$i)Mu|dF^saq&x*nm)(hwMJn$LdfUe2q+1MW(y12hqC71>) z{T9kKYZt^H@g|)OY`(tx%((pWxUH{U0~!aqny~H5v%;6m`EruH+;^FTYE}&Y^1<^A z8WNFk^)`quYgH}CP58S{$S$22!-t*$&$ou=W%-+8OwjuEGjup2Pz-lkG{Gu7*n-eY zMgsviiK@O@)&MDPhtmsAkIH@;&J9`yn1_Onber@{5<%p*IYFf>9nM#Zx}qpe?09-z zYGVxy(yruGG@C3nzq&_hO8r-WTl$-`#6p+^7e4<mYWUGA=ve|b8|OSnfI1EH6CGA{ zF20}3pYrO{b@54(A)xJb^+#;kG!DPMS{Bf+kl9Lb^PPP%9w{-KhBTXNO;bQnPcb{$ zHIP}CeDYuF+rY@ncS*VCuvoz3H-LK{38&Xs-H;sIf<tvHB+mEti($F|C8KNzqBNvZ zDx1nJ6cg0vyoz-Bm)nLD&h`B%l7mBVpy0^nfDK-%z;F-SS#1+GV%aoZY`lEr)e9E% zDQ5+%kobx;7H_qa_`R`AUCV6##=98q?sTS1QfW!JA_%`<e2sE@fiR70BYWDaTfAFf zEMM|bcU+<nO^odXNoVNKU}60kUl{utuZeo+btu{^hHvkS3u5(tV%Rz}V-RKY7+vl7 zZz64PWCo!`C?Msx6PWW<hNOuVseHx$lRz%Xaw9cV7C{pR#V`o71uln89FygrVKu34 z!Dg<%5vb*x6xia3G@EvEPWcqRQA1;XDg9xAcp01>0-*LEwsu_1%<>7c;Mu^kAw?h6 zMQH)32xtRH&E!b|R>X)bg?C9vUF2l$d<Z%cE3M7NF9%V)w2Z9&?7f??-+oIO#3+V< z1Rr(O9%q57)iiVxWN2v3Y7fkHf&51_qBr8qaAj%?xO|s8V`Ws0OQTSx1aEz3VwyUi zd{pvgw5YRv6%&uoBAc?*D@t5T_``-{?fv(AOVZ_V-HK|@eCW-Qs{TWupvNSGLSO#4 z5qON9)AC?pA;Bw>Z>4^86<O5A+F=i|d2sH1T`~${hM%Dv2!A&lgss&;y6^V~glNO* zNTdr{_(?9cdZjL<KmQ5wpBRh^Z9&5vG;i`#Iet8}_jMU@l{15S{Nk<>&@tY#vIKF` zAnA-D+tk+lm(U#cgzasQ8rB{E`x_D#b3z=L&C~1d&`V`o-l<zsYQrqu#pJ6M5|&Nd zZbQ9dZ+xWi?%qEeZ+XPgGLOtnn)09y?5ta*p&X5m0TV@39`3njxUQpV`pJl6psIlK zaKvpucs<#Pj~1I#to=KiO!^&{Pe8Y+c*<=TKU@{UtI-@;TI*-hpHIoXqjY8K@>>Sc zx6c-K3VmpqhCjKkfzckQ9KZ_q6LTiw$t3#o@B9?ap2KpX=4{0?n>msyz3slFv84{G zb}fb6x#wSHMqFnwAA-~aX@=e4{X8uI(*aDURS0|WD7l(}D<j+v^s|`;ZVLw7VN)M@ z-7wu;Yu{v}oTLG)QQaxNBNYUBdzhqiub&dzqGPL1dJEMec@i>OF!<t`9~_)t?Xb_K z$^;!t&<sD-(}j?Y4Hv_LhK8MEOd8429xByCQR~%4su+Ze)dbdOnKplES?u5>aS6j! zxD^c^(H^kl&rKU^tY}~_?m8C;GinrhN?bo)j(f{jyy_~u);_<R|L`LTzSm?(Z{q5D zwizFyHDz9qYd3yhCaCB!Ee5{wO$LKs9T9pv)nEpoZn~5uEBkYeKXq8a1SC+?czO6E zpHi|}QPJMVK)I2^S*ftSwbEIqgoWL%kWA=SLVguqVIRgzo>(33a!J)_;iRb@2tnG# z#3KjHVkGYhA7sRq0)4H?Wnc`uOO4L-`x<+-W)O-KkB0<P)$MpMe$wtf(F}q%^}&Z^ zIy%z&?y^|2=!6DK1kteE5mSIs+>=qPMBGnky&T@j#Y`JLyXx2=VoIb}Tn<~yfh$+% zuDY0Vnl(pZi^xpvHmUBBvJ-6Tu%s(38M?GWUu{#~+Dl)I7TKaoa^@vS#x*Hg(#+g9 zYGHix7MI_(U!ac1{3QvN!kaBiPjR8)KQD52C>cz2BG}2oU(nPv-v?uLXwirg6DSA< zw-pp~l)G#$!=6ZagNsRyiVw?56lMgr50{#o$|>HytN-aC3=VcsvAeUDG&}~}`5htI z-w6hFO6&;`Zq)r0MyR7;zLZPP_U`J!X<fuNQ$J~p7e&C~g#BA7%ak`&diDE0or59R z!(Obq?)p$iTl!qx`$7z5{n1SFo=mO$i9`uuGK6X_$@Kl3Hv;1pFX`16hJ}NsJXr4~ zdZY%cUv9~Aw|Y8R{%SwDj3h&C?d;vfetx(=yo6KpKeDmIol^_g0*}jGy$&^VnZtc@ zzPmnDGeuL|ec@+Z$(7`wOT^3l3YYACifDtfW{p|h!1xH3hndTdjeRg~g+Kjq?}hd< z<+p5g8&B<<B^|2Q?<eK+vtg565uLezMcnew6b1e3wT^O);`3;A&XhSSX-r;5?x$Jy zPq=v@=Rby!gx>inWOu2*!+*w;t!x?mQfo(c{;f3p-h?tDv;Mp14Rwzbea=)2nfsXZ zhuf>$awn^jGXky&{MGFOZIAta(O;=mOxksRldb*J$4X;k7X?s7fzp%Mzd{ZaA1VX3 z%}Xje(M~CF`&dwHmY5cv^;hV_cr9O&VTuTCA=}HKC|}Bt59rXb1gVcpuA6L~(|OY6 zBduSsE`lFlL&Up@vw$1QhC^}DhrB^y{>6#kLgU*JyDgIEVE$gY^XM!1iB8Drnq!V{ zNUKyo>6bGH;@=e)yxzd2N)1*bD3i^jbq<=zC?`pm#nzPSxSl_k-#KdyPC)YAlo)Tb z{;-;|YRB|BRdIaC^m{a%jEJ*{YomI<-4SPf$tk5BNGj)gY5}xW0JDP;fLx7`sZgSI zrxq-@l;rb7u2n&2cGZ#h1;RSdnaw@-QEs+cUaNIU+_OSEFrE0AtyPqKbp6zM5v=QE zLgI)yt3Q;+K`E~{)AWc%`~Jm~OM86AjV*zXHY#W`i{p{jDL2*BA6l{>SaVJ+NmvJj zcCu}NHO%)sdJmWK+mBv;lC(rYa|g&lEw$wDnLeTcR``()(ZIG+))eXYoW~hnqE3w; zD?EtQ99qvPbOY83$s&)t?e7#AF7tK|gsMuwAIbZx;@d*as9_--Eo@X1umBRBOG~@Q zUjzpv*>wvjrNtpj-+Al_Eq(sdKJ-D?heF>eh4O|J%T&CqP~A|jozl`b#`lh~Bgy?F z($>eYqZH&O&bldsTy^sQSPBk{FjTsC&t>T!Wi9m{2MRUB1@UmUB6Pj_nsDTXtp2>E z{g#w>jO5jKmTg*|y)kGfkjB6*iVpi^^;;`AR#d6*s}n6kiw=gd6Wkor?~4nRyF6-! znGaiD5=ZtkJ&tVLYc*qPjio*n)69~sNi@#!kodKM<u`N;bTCi=?5I7FnS0GdRak`a z+{JGavUGn?SAkhX@Rz;57V8B}6-(^+F%GI|bkJE~7ltZ2VjC{s)jiNIakx^Z3ihMS zma{<`bdr$GE#3}I$uS&F@OM@&vYjjxBq(N-m;JrYE@jDRm@wgEKpHqv35iTP02@XU zs0VTXxEf3$d$|UCdP$lw0?iIp8gwRkALgM}8?sEwXbJmI>Zh_MZR~g$cQFn{%LS_! zw|n-EC3#F8<SV-KwI1hR2%~18G5NwN+}@}-hg5*KnD#R6_VjyFyDgazL`QkM`5V(E zZGsnE(j<Am=DIvjPBzU*WcU%9w+}4W^VZj<Abw-u{R+9WqQ-5+&B)^Irc<$>bPW*c z#r(|h!_FVIu}wpF5n`^*p$&7R*k;KKQ9Oc>N}OSu_T%!pad*X&rlcfRVVsrD_2tt~ zlbLzw_a}u+m}Ds4Pzd^d%FTWfhL^^>-|S|i^?adAwa@r3rUvuF?(;AzMIR%2FZvU# z{oL1Q?d$EJ>gzTA<EQ_9#hNDxRglI{Fjk5t2GfEGVPls^L_WPCl9$T}ec-jzTvRv| z;qZX-k%y_KxmDpjol&*A<9_uUp+34*jJ~<t3oW8sfLV2!5Vl&$Yp5W<T_7<+@!unF zA7_@P;<&M|=~CY5&3B)o{^{wa44K4;vX8dJ)k0BkHzL)2jFtrT(H7eaUn1TL2@CwM z>|wI2ougHk^(^U&AJy?bh(QJSE@X4%x1UWr6cn%I_i6L{o%8JIC~enXmwbv*5^aF` zo0-J5*U?PmJQL+~_?P7)rqa!_V`Ev=?3y!5NECJEv{XZ9{9cK#R`25D{&t5mg^=D{ zWIP4%na>N9pbc5hi(iq3s*8ppmqOS+m+3y9{HqIy@G*DJ#m1qTw;Msu*Z2zNVeq$h zpJ5n(zAB)<p)+X6^k-FKR#O8I;(x$L9Ao-T`(I^~nclotEZjCZ%uSR`XBX+Yy2)EO z6}$GZfOwV&w9OJlZ^b1=`dKjsdjQdEi0oK_NI?eEaH)<!n={8)VHV2n#74<mL8Z?h zlD|@tdpVxugM(VMLzqlM`ix)5;zoQrMixxZs2J<?%eotFyu#&!?UY_e*jHUcy+}Q7 zHDOCfywJZT6-cs6spbEx2pX~)A3l*gxh?SekroQ&9L+%ZQr$_zVweM{>$kR)vr46s zG2<UYe5SLdGMXIgn%Mo+Q%RT*;E`GMFRD2$ex>#3h8<&Jopy;=xvaFnR0W+3;0nTp zd{ce=i$H+>%%?;Jaa-t_m4VOXtMP!_5cmo#7+0;8tqnrY$8bwHks_~@#zY;fBDnPz zik#2rn52h%koB#ReRWtR@>5sCNt1k**?bWA6}*_@h&j`C7XY7VvZHQF+89M96&gU8 zeVUp*<^Ni+7V#1tH`xC8OYp|i1fFeMr$RLOE?Zu9uX#n`tBEK-|7Bancd3~1c5GyK ze;m9`)EF0E9NhSjrA54#s$iAS!t?ItxZjK#$hI@g_PLZXD?-vq)&osqNQMZV1<W zEgI2cncUP!B?1;cQWagXFp5<M0FAT2F9j#huDtU(<}bF#?cFoeYh_iN!so3)t{f7h z9Hz5b63#oAsMVjmo<jTH2Ofvb6Nk@2gb{{ba*vpM>63v5jREl?BpMF_uzCK(bFx2q zNi1T=)sQUZf1Y$~C{&_|o^pldq)g9T@`c7TjwC8BNg)ltQYdV%u8oZ<2+=VYqB9~o zQG{K~E&L_TP;XHEx;&@2@Q3C&pv8$$eeW0KMRTkhyTzg@s*1ai4NT5sdSIeLT&&*` zG{4g@#f=E8QqOzhhqQgPCnkC+!}^;yUEyVB^y&7Dm#{_d^sjC|loOp>(5dDTNtLV| zn?;H8qX+xqrSdU+<q8D8WExV9!^b&(VJ8UPYAsmmXq_m=dp(|RfE?C#0!aReaVJ%3 zP>W)ktsF{mmWJpn$FcLFtYBTSfMz!R)0n>)DZZ~IKDGRt(eQH~F5YtWoy7QR2xf}5 z>_ro9P__lJgwoutBj05OWWlZdu(1oIUoh2J<mV6M=6Qrre_AF^vQS(h3ak{ZqlDhq z?p?161><{yJF4h?*oZGCrZ+^3N*JXvJNj!<E60#AlL)eQwj-Cq%g)~+5&U!1HGn;) zw%J6Gr2LlqIJS2k{*)0I<c@H7aSSpx&rOB2S7$$CSpqz>7kn77=}%#wzUS;skNLS1 z!jUfBphItdWl^%clZq=h!>DPcVGr2&E6?4Ax4qdc*0m$;?MZG@r^EJj?_R)b@v~p% zvM5$xFALF3$FQ}BHFgR*av$5SFrK%fw4DG5{Rq1bD&FEg(Pb@OZ&JS1V7C2Gw)IK7 z^1j@kkZc$<(_*MJ4`9Z{FS&bh=ZOqxE<!tD<j43w0I)z$zg~jVZ&S>38{yN`WZhHV zLY?U6jp5Iz4v7>(%)xykJH0~gq?RYoeK;71G^F&pW=JH>!KwQx94uOQ-jB51OW;KL zT25v=roq($1vv8NBF%ZMX<hJepoPs2(7B%yLuCFEjF|zvNBj3FM$5HrBPqO_<xIci z_fMD1g0yR*QOV4W1Es&<I_Rs`kg`!JZ3#xX)|P@a%ej9ItbhHRpYSWx=sxP5=wgn^ zNmqueUFG@y4IZ3@5bc=?p|cz&+B68SZ$oK(R)k&Bgg;k^F7kN(snoGxThkkhve?;> zcNS`{yvHmF>Y@FTS#Z4m-%9F5Erng4@8+h%2;sjo#z3Qro|@a`_@3crU?pK1Hk9vx zRqR-JwG=H0zmJ2roPEr!kmp9hP5MDZqBcr7x1vMV6<Z~AC$ux*?{^_`W}7rBsf|wq z@fhv~);AD!O4^|3LMeO&X@9TbcpZw~X)t_Old)V<8bYV7*&akj-pBg>3p~WCl#hXY zXDfwJwue0@l_tH<Mn@Wppx+}DBr)Kj2z}ny5vPHTX-heNKgj#N9JPM6MvJ5^l6Zp0 z4T!2TMY%UXT&5|_uS0=$W^R(9vlVpVwkDf8LN_8$>kMKKXaA{FL|*fHz2QisZ8@aL ztrO5uKg#H>rU#!%5oBF!*N9|h5*!cw-ks&SeuN%ybjTNQt&C368F>ZX|3-%6sULFc zX94!&ae;OHGdQ9;F$QW(ryXQGo|Vynn0n3mFzncS@>VgpSxV8cpaQHl1-GOyx%>_b z?#}`5VxxQGs!@lf6aF!2pvXzHI=rlX@*M9rUiP$!ob>nEV8U9`d|w{L{#&Aa4g?G= z_GtJ${{CV@uDp#XtYs7?-t%puIM-q^DX9Q!Z9?zqH2=FWq4}bYLpSoueY7&K;+#ct zQHp`p2*T+g%(-0<<vj`!o|{F<=J62H8x9uo2`%t$!QcO2HkOc5K;eJ4A+kuSy=yU% zv*qC&U|*AgKpHg_#S<i_ooT<@Ns6y}{y5i$BU(i9xX#Rbj$I#~yRQ|n>CKjmW(<_4 z-;2VT#FE=9h2(3%xIe+Li)lmnjp3zbbSh1;;rUN*vZm5$2G*uV{^<Yw-b8#W;q$)c zE(x3DRHQ?PL*$?wEGy@zB{ZT@ls<h)%yUV)!{gYO9h6*k#Pa7&rFWd&>p1WEJUhzN z0o%msr1h%3NL$<wtq>g25YrgxtYeD`KM$>a<@+vyk&)NYT50h9x58MGJ=Ht!9E=am z>Y$#&a*ZEBmz<uk=k?=N`#0)1+W-kOl}-zgn`G&upW-t+1sD?Tytxg*g!zO_<?E2` zBbtfdf%Og}gt^5k!gu5UjC5UO{{Nv2RI_X#<v^8n)_D{Wf>$HO$@}(AVBpJpXr%FG zgjP%KA)p3UG0^aMArnSELjLzw0wax0J=A%{*SDlLVyJszDI*+HD((2FlF)+tzPW_4 z`Gb5%7Sz#ktyy0zxX)u?F|Xa#Q?tI5G>Nq5*Nu(Qdcz)(9%_2OG)zPN*Q}Cot*|nV z3J7#Y`mLe5HB$U^?e&|D<lpext9MvyVb>Mqh-<-ng55ASuv8A6VdRjG8;z@^4R`|f zD;D49p)%(8crPjqXr@f*eC751B4_k!uFN$W>CFOdu51rqoKDzOHSeW%;-o7jf~7sQ z^!Nm+rCH;=9O^L3&AKUK?bZ^MA^QZ{J<xDSBVOvp{Pm><E-)wQbf1d8OsW*~;F`J< z?_;SzIbgJGLBps=1L#k<#+}6Y2xTQO1(K<7N$Z~fXZFC2HI%!y4pa528-<L6#$TtT z)3N2m+NhgK%4+IE`se}yGLH>};hN}xqsh*jtb@j}&lGS-UsV}sW$n&z67ctnaE`OV zF>q`%M6sM~8kW^g7ZzE6)RTX$dC%LDf7>+H=O7|j$|QD;2sArk+Axu(g5~ioGY+BL zS6g?*O@<!VQow#ptAj~W7fTUQwkdM0Oq2VDyys0}FKQ{lz?vbRm7!EVTE#2*4@4O6 zLPW)xb_a_fYWqkaH6iKfMvdBJJhMDrJw{_X(9o2^QO6_8z@orj40Fj<k$!ft;60oK z`9h{Y-fvR$i5u_BQWL{-J!*PV>3HzxE6{_5n^zi<1+g^P2!ABCcb^368s10BuQqd3 z5*WU&j8rte);FNoH&c|O+;zDq$Rt9nVS7U!ar_+S`;n;KvXM`#fF&tiy>Jv>1SR}5 zq+xwk`Y^FY#?v`yimAZeCaFNpG_Fi1&!TC!|NAjoy`;%crpsE)pYZ+@6TT}nCKEBP z<)DaS{90qAF#DxNP(#O#;yma`S%YgQD9D=9JYR(}mv|j?UTS^n3mCKC<XCg|coy|a ztHGGC1UVlHDMu}JR_^^@#&vxbaM1GlR)GBZ7*TN=GqxVT4?5^Mh{`XGQWKRy2SYa{ z3W%g7?ZHKH3|d*raq%QYPTHbm)x)L9<yVAssv$vTe<>^&Ezssoe;^7&n^8*cGK=nh zG1!`EGbty6r5pX#2`PIa!L*Hda;&1rkT;(>S+-^f`%BV!lR!h_7^z#)34fodlWGy6 zxR1PVy6Kx>Qv}tkL_shM>0$brYNJ&YC2f*S!M1~p)0bg<S%Hux*q@N^V&sBCoQ!xh zR@w2M0(3>`ai)=xizI@W2721R1Tqwd@2E#lkQz5jBkGgHcoh=nA3^|+HwG3PT`QB{ zU8oJwIs?0@>bhAFYw_Dc{1Q3_;351Ol>d2CqGC?|_fvB(eNrdVNTe^72IbNB6QV@# z!?=D8KfjK>%NkbfJ!aFLlMYoTKE>R66KP5>L%~}DYf8yWlI8@R0gQ?@tdbDG(issW zMsCSSTk7GR6d`Csa6Oo2PU`TqgBcU$fHJ4nXn}IA@*^|{i&Fo09Om)~a4g!sSsE#s zl8|!7bIz28u$3@O=onl;*0I+8Tn^n*$rj!StlfSXkCR|bXe8A^_D@7w`0i4tUTg3f zt`8lAj<<*4bZf)4PDDiS9jSYp4^d%FSMD<g+V*%R1jqdZlm#t?XR<f+{ZIx7k9(y4 zROcSQ`&S^Yn3J==ml}g}%;)%??=@m(2m2~b6Q!m%U|D((e`wQh#b;-VBGU_tnJHz> zloF8#YGB+h6Yw|*&sw3T6y^KC<N2-#m@YXuK78gysoy$$5JjdfLZhpcp*?7(YV)i4 z`veF9E`&S8kR&slrbOvtV=9A>47ed&Kvb~z#C6Ov!f7T9r0J$1begBd9$kUjw5+jV zjmIdY2k@Hs`j#}1PBWnSztKpQQg3oS8d<hs`7%O*pLVE{O9F{21MmA39pW{$EYu`j zYf{%jn%YV5dQJzS!V8!mk3r#Pq|yJZNHdTMvYB$d@mjrsI2`4sg7>}+Jeb<VS&!Es z^YRq8d!^;C;w-UBBjwjm(Fc&qr5?SgA7T_cE%mTV>N_S&Z@p%LpTnD{+&@t)^YF%X zUgL_C+xzA0jm7AgGD7Bsy}w#v1n9^^HGt~KoC9Upfgv?5<w|vv>rztjijaks-cM*` zJTFER*X4EC%QOZ1r>2(b6Co;M&8s?v>zN;b&wiAoAI~zq8yA8D?qaEhUq)C2t?ph# z7QjgKui961EIx}p;o#P~<&cg;V~5W6Rp4l_^zxy(lJ>XP;ha1Jviw_E`|8l_siVko zNuXkXqPY=$sPvqN^2ZB?5v$iI+DzdX>LzZrghqGnkV$_cCb||<YM-A?;E_^Rpd=QS z^Wl-$R~A<hhFLjeBb*1PV*zMgNSCBGhVrIIBBb0a0^u&9v!&N|IYf(efzeZOq`8i2 zqfM9`djs`mc?3n;@iAD;K7m4a7Sb=r!Mk<?(kp+C&Hg?iK;iSEqA*}KktK7EZ;PaP z%!Ls18*II%3^JPJHy8&x^E|09Y%F^jKD#!a_wTS7oogtc$yk+i4Sd}g>7w*-E`#~9 zEuJIkgLlJqTn2+SPjN0c`!%J8!YVGq*}!6&>^Sk1YMKdqmw7@I2PfZ`VPv0)=>MzO zynlvNw(SrZJ~N<<aE&S3=XRiF=X*mG)k$-b`{2oeNPaVcboZfST^KOMG7sONUcq#= z&_Q{&D$?w;&h6Kmlk}=m!1-4X%J{KzKg?#)dHS}r1}Q)vYss-M((#j~G|xapq>_e9 z!8G1g9rQ`m_Pme#yvx*A&XC%;Rzz5{<h=d4*5LF1qBsTzK&aIT9coM5-$cWT8p?DU zfGnJh&z&im9u|j6I<}Q<{U$4?-J}RxJ=I3{wJuKIcV`M^yn~b3>cZuezzi8|KN*LV zhX<vI-aeE^kw2caka$iqnrM^8D}>`d6uD`31M41{R98wty-nBJ3-vuklYdKLekv4& zQ(@)LXS`T^?<1m|<c(y}P?`s!XHMn;`TlVkwAdkXjH{$xs0H`Vv^TxCqUlpJ6lgUK zN3CN)^S?_qu8N30wux7$3md~*!a7IhCw}Gw<U?~zHWA_z7UT{HQA*yLE+=W6Zy_zB zo}C^vv<^*hFwkR5MmZ|pHyNT5i^0@2B`L?9C=llQW|Sh!t80la)WClz<2#27+Qe&n zzRCIL27YsZx_>kxE88R0x5J$C=PBOatIheAg@eR0MCNIpIe_clPx=Fe<^}h~5SdE7 z!^(3#RzT)UmaHVHR_Ms;l~shpY7;msHqUsk9!?naN&zD~wFLLCl@b{Bo(H?{UL`nd zSSL*5W+2BLr{k&`^Y$fKqud9Mg`s7y<qpXfX=J&{=eURL3j?St^>uR`%SB}#&Q2*= z=)wND9CXG%3L7K${wYX7e8jX2(fyYC$q`bU-U7!v$0NxZYUj~s$T;{1oRuTtAY(dx zt8uha{?hpSW}WIS|39?uU@~%Zt&*wfVJrsC<N09k9`&TmM1(?XQJNVX{1$l8=SZr^ zqDB}k1Lc<r)@+mVcO`O9L*LN>C4%8}TNrE&;v@sNRXp*po5j)x#g#%UG<I5(#gv6v z;?-xW=+r>^7Vp~|XG3XV@i}x#9($g~gn5sda{di6-m6Aj7itI=LVA?;+3FR~Ze9V? zB8uV+nPZoV*SFr*BkSXy2|TN$yzmd;O(OwMC+1QIelEwDwDO9-w@E{7Cv_<22R@$! zo^xp^LfWf~eRhU(1dCug%W{EDoJ!X<c#acNBC{iLuF)VjvFGZQG|vt=F%CeKnJj9h z9;&GPNE8S)rl{2F8e{`m9`#HXm3IH@<akC7j<~e<`~|5<q5qwaXXxeShS)2|V&BR7 z?)x(wGD&y}pZCtlT7i4{NR%GDi@pC+L`|0!QiD7ZCY^uN6QUSaH+)~BM3vq{TCo4= z+U$bCy)Pm$*TFbHQSMLIN?j}A3E=f_2>nmx+_}&ncS3Yt^`|uX^E|R%reeN_jN$E} z|C}RwpUST%Ve~oqJg;?SjDxltvDfe}<mhwaOy2+jgCs`S0%Z0&Ql?Ra9#fZlV?mgV z+F&)_pHd{*Cxxc%IinzxO>usApz&Z*pP6O>h2IDi49+wxN1RNX2^FT+_RK)anD^EY zBXK?|jkNBMHskjR3^t~lxg5fell3eaHwv{6;nCtblE#fn0X+`=Vp#qL%1?_iHrQ*c zh-R{Gh>IAxpf|yNrqQ}49RnE#mZs^EoFt7pmakr*TrUwU4X@u@VzE3uLSHn7+UxL& zv4>E-faCIMKpqt((r`bbJ^z*zQ#XXN#imI-inPMTq)smBx$+vv2-6bR@EiDhqeU~S z0X8~a!7xk?1U%bXOR5G66-@3s`vvwquB}&*|9^3bazNK8>qd0{yB(=8X%5DPCDLV~ zz253!@1*=mdKO1w?@N1Lp7qR?A#;lX!*wh?@vOsKGUw+l0YV;}DxX&t%b^D6!6@{q z3b7(;bL=d6yEsy+87a;(u&PmmWpOpu=?u&%ecoeDFT{FwMC1i!!wN{pD~hrEmWdc^ zcE>%&8C#Tf^&pJ0vErCl88R70%pGvDTgT=N;!JE$&>gqOdu^#jH*~A7LjG}I9GQ}u zuh+)!V?Fjjy&G5;NSfNWanWhrpBFA+;_|_)3gt)Bcn07(XXCVHR~}jrcHLhLtn-nQ zumt`-$87XnP^i7vlt?O!W`X`$#!%5?Lo-?F!L?`?%KZT>Tq?6~iZPc5ov4MNa?Azx zUHpHFS%7nm@ktNwP=N~1!2u<HFh>tU*$&3#)n%Oj-%z&oGbECs=QYo>;`&`r3RP)j zu~;_mxrPE{u%ZV~H;Xrf0(N0UfOiw+c_{CJ&+RC=&R4+5bUEsMT*79cPME`GtrQ^x zCf1QMU2E_;j|%j8>Biq~g~L$auY@J4yliKlchWJ}q|7LLnJS=Z%IHieMQoQqOoX#@ z4LCVAM>_qDaQLhY<#A<ro-JxQFGfQ_nw;|N4iLhmq+@5)@RTcKJ^75H9R}AVQTVbB zAI&Tky52qMLM>59X@;IBszk$Ns<h}yszKKIUWB5{mORzCF9rmPAUx;@v`=v*v_NSD zQ08xms81+kgK2+Ew<GH;%Mp4-eie~Ay8`5=)*ly8Z@N3=%tcraqu}6w76Aa;nu#cg zGvn?+A4p!~uaSZ98|Yc{nkar6X8`px@)A%M4^^g9$=C)Da6_ckgy?Gr0uh(I;O4fA z8EpLyZz;PbS`-Ssr}f3FkQUAzz(Tpekb)!`wiKLGr3kP)p}=rQQ@FaDIfpKiM*``c zGZOAC2|VxZ62)Sn<&sEU(EH|f|6aUpL!Gk5`<f;_IQq<jz7@u%-E4kq>gDu!4@3>2 z(0SIOb$g_d*XWZs-b+Cnp6gyR7g^KA6x4d~3UMqpFidUzNOfSrc1YL{r99EJm>(pp z?|(=Q33Jv93F(`f9_-UC>Sa9Y0eo)rntD?k#kv!9q=gj2VBUlXmYy@zLoLtIC#+gC zpcF7l<8W=0P&adN0!v}&_&c0(%OfRATMP^p=y`UyhABdf6*?9IV`I|)eJYZJB3Uf+ zP?k6+a>IcXAkR7c7?lc317B+}dnn|b%$g$|f%@rz66U*a>rzdJc?;@P*E6LEjS{sg z#bHc`o5Mb5_Y}((`2yIN8I`&&!N6J;&yeI6yq>MGM%mwV2RL{5jMu>RglO#fo<-pp zvhq}Qq{AS0cR;2ASspoO6)PZ`)@hvowidl^3@kp(`Q&29iFY{3xOy)K<4n@`k-&k9 zM|a@6JUdgfg3r7S%4-^>?*JCYG9^4~PD-T`4iy+O)z2H%4ilSswAQQp6H)LqMewb_ zedSf=Z!!ygj?@8JL*i|@wpyjDQAu9|<F+&M+j(6-G|!nH)b|FVBv5Gf%ceC4fBOTj zhZNM>rT&8w(*)a$<3s8GZxSI}>v}92E{g~m2(Od#m?;k2U~83f%*~S?ZAN~TmGZTe zLV7;ywPbx1VMuyJ11n4%q;jfg_L#>_zd2?AOhrLH2^GpQpp?9+-yCzG)UO0)J+94m zT=QyBM65H$M#1z*syF<av~w6LoPv9BLa@aCm!ZQ+`9bJl{~qn3Sn5F~i_ECjAly2| z`K1TtdtNBRT@jfdjR@`u>mphbS{MBNA)(FY-)13FSP%O~y@SR?i#eFSZw=JLjc%Y$ z^DYD_=wP7XbY+5pwOk7E)n3L~_&NMO8lMZ5Y;dn#5RoqZF3PfgWHH?&a>FI0)E3~} zUI04QInuAI-Lz+5ieTOJ!{WnOMFv?fHl*wg$l#Tuxafd|8sTwcyib(za=)uy!F%bD zW_X{$dpZf8?F~?`kta`D!EroHiho1K8<h@EEzKP3O@%&P$4P7PI988gGc8qk(g0l3 zq>6?%H(s}2j9-^$R&Q9u<Ud~~<MvUBO4=u2NID1M`2y0G&XLH}2obusnT?IFWX#Hg zmOumJJ`s#Z*HJB23lvoCKX!w3vabg@!E0zw=~mC*-+)JQ6Qot~^Xe(&#z|+x5&@6x zaE2DKUnS93o3_*sVxb90N%<Ix;H-?M!2B#z+BJ=q4#5qfEL??pkYiAzd<3F89f9nF z12CR+nph=7f7kC$iXxCT^SmLh$+}zWU5K=2=|HxS_J6HkEcKWUrEDd5y(x>wz!9^E zsZq{4N<m?epRc#|#I^;Y^})USR4~w~0zXTb?W!3`YSdKe7RdY%ExI*&ICr;0>CT4< zj`LYCLY&B&5r!<L*BCupWb7px5C}zu6|M5U%qFl+f%*M+fMw9uTdf6|xj$N+w4$tN zL#*3zcoteWO9#LJ^q0EP5h;YH;b(^RLjs(N8x`Hbg3213rr8aK6Xwu_)R{(x-Val} z&dBILls5&Bo5^|7ggCTmaDnY53+QV|$5XHWVqh|(kfrkSuzY8!;G(BcPVywGH<&~P z_2Qk-6s{LVnEX?EH;h9xDQg4&4A1p0d}eY+vqvZS$=gemOqI%)OGwSox%ERa0O%#3 zE#AnsI(Y8$80Mf=>ui(NF*?Jnw~$ONB3+nKPi>>HGGt?qF%n#z7`*iYMwsW3O+6I3 z??L1}$)KV!L&BNflzOadG503P_s=UVmHe5EZk!YT?|%*uwb<hU?8%|Xevgo4aNTo0 zbxZo;P^?#yT@mx9+!LFkj?7`ul;WJ?*g80uNNACU5joH6Q^WIujFx(MCrcxNit^?e z#+CLyI#=c%_d+&!uJ=^ETA&jd47VXlx+YTURz#`Bl1P!=2$>~kn0=#9#^$f6<0jiO z8Ax4<fz^-WMPYK*Jyg%3e{(4<c{t8L2^d#)-aIOqF{{Awajemo-j?2FiqVERjU*RE zJd0ZED8T~ZgHi+xt<PJ{W-=IXfF=lmLdeMKM>EN#goI(JYbq)YE!?Al<@@D0Q`lFE zms*9`QKEF~Vzf%cpM^Qnp_kUn=DU9_Mw+IjTs4T^K}_9RO7h{8nkMt_r{S~pkYC#> z#^=jYu<n`oIH&i_sI6jc-DB|7>;pxm2*v9W7;jY4LZGMS$7b#DdzsIi2W^s4Q<O0$ zamJs7(4^LDZ%IiJ?5?0psz&NHd&eay^!<|7_OPkRa)?&FZF)TUHR<YUBdIg21r|)Z zr-Yt852kJ=jnnz?qOOB=wZ26AEv!uJM2gG8P%NGiMU=9+7g6d1;Q3z{@?|U{*Bc<S z;lO~bB;iK47$ttMc0=UN?LsqoV&{}+t_oAqd&;T3+6IwA2dAvRhCE=S>Z~I#NG4zp z8XJuOjh??Pdq5~!`YXu0a{`RTo(b6_8d(2}0-W0{l_)|N{3kMC?uT4TOJjXO7?zVr zJ<<%UKGef6mNODq$RY2(XXZh_5Io%`PV?EwVEbwyow#30XYR&4qyeYj#eP^MxnQkr zT{s?j5lcybs!-%=E(YbYD)h$D0lU)-h&8mh$uWG&{M1H--uElGw-Y7$RBG`f$74J~ z`X7m+J}V^+lba&FtVdwt`%RwsSHMtvPu^4RT<8?<#Ut=`gbWfY`oG3^)q{aW_L>8+ z0eQAYhxM_QDY{G&j-Ntdb25(?g3)`g2-c4f*;obtpU=#DuE{6Nck(rF4HA|0y$yq- zj=^^VO|XX&G@=%h2-ZKP?xS7|EIywt#JiR@7Z{1SS3a-3u*euyM0$w#Xu1ZLe?#%? z&x1^{$|0Rgoa1u?QU0sJZ2ANg@ZAiNgM#C<DjZvj2KLysL6sb;J9-!Cgj*&s0*0_T z7`OgnythSBZkcIP?X}v0@AO7vmXTpIVDgepBptuRGuP(NtHKdGMKTHUTz}T#BM5nr zReRQGDT2S179v)EcvsS2e=V|%b8y2Z$~vkhb^%M@r9z~oM>iZs4}pR992h5_+`~a9 zQYJrjHjYTB!Ro^6ltJz#TK{SzS3F*V%wij!P*&Bo;2U@>(Bta~IH#Pcp)G)7ezqa~ zsk!5kf`0{JKMSQn=*IL#A*rY&STnRCq5-yv85b=d_6M+fiH>@)SWAE^f@}(RaezuV z&v|(73z-e;Wf)9{N`v4z80Wb#yp}h`g*(ZD7z=}MhIoRRHg+czj=?B+WX0(aB7l(h zxU0@0SOtkvjgY@BX}nRPd8}*7D@HVs)JP^s#cG`%Pas`#EfY~<k+IT7_eqg=)+W~` zg{*oGelORbuM4ZCa^Hf;0S&A>0}M#D294UUo4Sy{Cm35)O1yGrBUr1M=RaGTG1hz| zsWVWq7=h^TOY+RJ6zGRgJbn<?vO|<g<qdl(?Sxe7E72hSOn6$~M-=)Z7-kN0Gh|rZ zgmK(4A>D>et6QXbwcY0y2bs~KaPl07G@)G+T5ePWjCgDNkhJGakNX;?Ek~(`-xoqC zr*~Bv;f5Z5PG#ZQl+SzC*hT;q*j6bUq5NS4;xn++Ig{>BJ+fa?o}-)!qdg%z<v^tP z9s>fI@1aiDI~FahK5m;SGu7|Lgc_{PbMBiY_)>#PGqKJxvX&0{*%D1YMAk0#qvxT| zw7_Y<8=TBM2hX=z!hPRhN+U>+Q!{YGSP{_)rNg$H{s1B@=b&ITqzG2JsVf(8D4M3} z9zTSE=mK>MjTpf?Pf||uD6i_Jm?Wu4vjTlU_7fwE$B%`if>Ds2@Z3K{=>JTq6JXwd z5nhx^)I)KREDutXPysgu!JlE&)Vi;Qe)njs3)T_RNK9h*Qln*t$s^{uTV*^pMQsk( zs5L-;gYR#JkV@LvX-K!^?1%N1QT(~~nD0GLjVbd#FZ2BN5*ZWixvBw<>A^DIf5n>P z90?g%KFXmDaVe)s!oYKRh0xVgF>jrL3f-Q@$kHf$AH4IYVExkD9-1FoEWW+eTqYf_ zg0A}*aeC3Y^&Dig7P8ZEN$+gh+~j-h9#JdD)AhJN8kAqocs6?(L#SK>OVcx#LnLKM z@yM5oyx*IJ`v&>>dRs$l1RUSg&&~x=$O&Sk>fT2^q0t=RLydNcLS^ZG9ncSw-rJ5S z`eczOozjTC&*)XYJRz?G_E+Y5$HLLh`mosnJ^f;Q|47sh(+KZFCe)YY`|p4ud4j3= z??ndB2m}%sR9Q#}KR7>qMqW*zg|^EJg?GrfVvc0D)CN@>T!h~WuqfGU>yfmC<HW1( z0-dNEC4%)kX%L&W$aFDyuiF2~CeA3ws-{qJPk7MpfKtlmO}b(S&u2&h<Z~~=OUwQW zmGDgQUN$!0qsr$1B0k=`Tq}<ljUWEJER-`|C!>3M{ZC{VSZSM2heR+m<&cpnUAOH2 z#Pk9+?kMb5$(UQJ*nK}iHgt<8Ru#gb0<Up>G5oJ6gK4vxpcBeRJAN+X@vbQQNf9i6 zFPgIJkQ!krkiBEfBN|x$K}&+eXJ^UMuxrA~5mj=S9l%=D4y3qHf&LUq3T5TfNO3tC ziia}b(PKLo5i3Sq$G}Nbj?;+pNR7WX$qE<>=LZ|T7IE(m&!JQUBa|*ws-feZZw_Nt zj>Bd75{xWQNRWiAo`#H$);lO`Tf|AAbv0DjLyp9L6OoT{DnBT9I&gGKT7KRvlyAbh z$Mekx!kmzSwG!T!b#8x6w;*cH?>a^tEM0;AgD1lA;XnIR*c5aY4?ySbluVq@gQ@Ub z<E$>iv9+9GE8RnCv3XzYbvL9?MQ9HZf=OwC>VcRK4`3)#f;d6g@HC0N$^NekRH4ja z=f;!NV6WED>mf<PV=_6?JU;5>+yJR9D*XN>sfO(-i$~`~r|E-4#X-I1bMf;<^8J-~ zu2crrOHe*l7+hNefvtv>gMc|e7B+iEX{YiJrO5o*G7T&pmyHZ*iLQaUP{23B{C_*J z@o}wa&xz3ZaV!ot&s`6Csk{Q|YOuaq;GJWh_8&`3hvK!Sk%v@5hHWHK<Fvj?9H;3> zgJ3alL6q3%4NIIi)I6f%^52Y&>&jYPPNErmORt{y@eJRFoE#xWP7*jznBvLkDaT|w zD3pnnP*2wvC{q6hioHYq&k7AjSG`@p=qc4Oawe7b)STz>P8J27$D^>9XwBRT84SHd z8X-zvW<ksNXb-O4MnH$5)TfSd8P?7#3G$75_(SGA5!D4{*k(vo-V!olTX8ZC7=4cQ zi+PN<(_w6HjTGt60=;Z|K;+}Ird*&UgVuNZ^Eojnov9b&d7nd;!7|9!+5pk3%S`XV z4~JR?YR%M07)+m}L@5}K`xw!TMQe}>)RDku7CN*xtB8R;H6?UfFDZmN2^i&gQ#R=& zfkcl|3u<LvFk|_lX=15hE<f}6^%|^!6*6qQq_CKE4wV3}b4`f?g$%3#EWEVmQ%Qr$ zGB}P$xAEuXnbWY+jrm_f5!?YGGEk<0<xIoOkH!0AH?xnh#t%){^ym%R*nFpY#@da- zljMNufn#91AvUu39p9DtSZV}|bLVuB54Z};1#WT&nsEq4<@;sr?`S^XBFdrmAfz#- z_cEM8N5K?$ZYj(D8E7do4F=B3$o1EVbQ)Oybd^MpId-2REsoK~gQY%DJ^n9%B~lHE zrNI(8O~$g`oPk*gISY~w%I_p-{X~|5lVmV0CJsho15>x11lAzuJ-Q_QI`4HCQFGh~ z;QH`N_*0nsN60?0g|JtK_PCfLIJ8jN@s#w$I?3!qMcF@B$*~7&1K?SPSVvh2DGyf` zCnnnkX>;^`$jBQcMR9e=@2PO&tN!s6N+3qz_!_dk=*-}~9XgbAO&{1)3FU>9FZ(w( zpRJX^=R+cOd|GowP8wBm{{ajBco-sV;ORtpu9rHV7fVPH<a60oyyLv@e@mJ~srQy; zU};p-H@d5&a>sj}h{YHh-yZRZF+^Rd@ze8!&N%_mi1PympU$~Q;N9^#>-v073N#I+ zfu$rRY1h{d!E$YabEL~q0pFaFigpx?5;aViUet#9rTum6c&IRC0qan#Day1X#IbT~ zLI?P)xjqxod{@EfJnw%b>U;WAqVRn(c6*y^(|cW8<{UrkBQYMs-N52A8V7^+P<e*W zV7*W#mNG{|W4g6CwA9$`g>0ArMS$yry|f09R_J8z+TM8Yp|NJ8kpX<Z3@Y_XrRzCi z4^@y^&53NCU(%4Wkd`%*bojYJ<o!&eKpj21i_GD(-6J5MxHc{|?~SNF=sdp!b#aS> zFvIF{eHgRla#FA_f;2zX$+VRcbpkpvrkNHc+Vs5#>4SSqdBbjyjk`#O9p}`A#%VGh z$E!vj(^#uI_^?)nVfBV=>is!;N#x1-tmgGo>G_<Y3QrSSp-}aQs9|{ygIEvH$$UGm z^$xN8LmMpx+t<W$r|0OSK{BcF+<PXFp78gJg!;Bpb3<8a7=5va_5eD!g5S?MX2~Yj zhi7M7P!9KtGHeMfo`z>zBSTD0bs(ZB4kCi(L}@$}o}ak^qpc5~r71YB2&@TJ_<x6M z+dWVix`NbwC9OF+JwA}yxN4&y*Y}Bd#mAJ9LNQwuzDgNbZ9>-bN{+S@?_r~Hfi%a0 zsZFF&U&OgRhP#2q=e;u0_tp}*K(Ynj+s~EIuE2ulJJs|9v}0=j)+=L0T78FW*hf+o zxgOt#2Uowd-f>NdhDcsqm*ZTlH~te0+nZ5rKNk_+tKqP_G9%j}wAb32y*$T<Df?IG z@cKw2gBc!+Nqvv)W9pqu9?`%WI#5?&efTywG>xxMYUCJvNRy5GLq844I(5P_lD{m{ zpjAiJ`Ee)o$Tk>m?J%HPgfNUe5ItgqEhbHo&kghv)OHP3#}7mau^W5n_dK1?hZ4$I zxC&~NLYrIYuw(-~y3myDQsi^$chw5}qhR`BDLAx3p91O#X{t6yl(fMX&RUWSYhbYf zC+VRpUAsaBcj-VV+X@B0(5t0{jK#Wn2i|IJ0@@P@vELxI6n_Ny2T4|V>|&nhfQ;Lu z5*qxq!H~GcTocd7v?cFVw$aff);b;!AO&$hc$L1FvzM1f@s5U<xSDIJAnBx(ZReNZ zo$kb1Vu5z08)4Gm*)K=r{VAl_@cT9W*UCP-QL!2La8_JM3^5hXgg0ayNmOwY=C4mF zb!AeQ7bJa*j=ns#I$ZO&8PbfAQ26H&#k5;w3hPW+i&xLMxCDd3d(`uySmDDfZG<{w z7EfUvD-OZIhT)BXq?%oa=rP;4aKGsv;%3(o|E-&yf&J(ANY&J+dk<cZ&r$Ech`c|P z*;Is6<I9q9K_Z|~L-c--vN;%4WF+L;ygjhrZHH@_27_>%IH+jg&8;+(>Lf%IzJL>t z!e(=pDXdjv!+PI);Q{jJaup;ls3f##nHy4;;%6s8$ivtT8uGk(_|?MUSO}LUG=1aG zpBJU~Q}K?j8u(19ph33`Jb`we%rWVKc?yQh`Thk`#*p*aH`lC$fz^T@5Wj$NaA2VE z<v<|3-H*jhT4DzeQJ;{M*g6`HmmZ&i87J?(&;!4NbY<r{Anhr~h&3bIAa#-RU5!_g zn1qNdN;w8Z-YisQ8KRMS8dzuNoR1o%eI3`#bfQWrvfQk`7iiYZXEhr%_&-Md%_a%V zM=f%%s<fzqHJlZfc8TykDs;b^0Wld-mL5Fsa-2gNNqjEBz_O{dl%Jo1<+c@0ut~;w zwji7|q$B3%pOBQsdN#61yp!iphh`d<siHxn?0;W{!!RkUWpov<LytxVGd~tZO0E*X z6cN$0BvBF71?AiC0!@Fdfpuhx?m@YCW`fM)`DRI^(x>7+Df)(eFMmEA-@A;Y`L@9s z{f1%QJr3m~s#lzb@1^6t9|m5<9gbhX7kw1yb7VcIYGAyFbRzY3*E3XM`?DyDNs+27 zg-~BFhDBVfx~y+O*?R@GKI)z2X1u!O_p^Zd5n)mq?8Kq~oQ#w>=I728<@szV3DqDA z;rS*YwWBX(E?;FnQ!YlLZq3e**;rGdbXp1x8dvQ|&AboSs7zusa@tHJxfn=y%v*b* z&VVD02YEIeF1EmXY4owvdl(2@OP7p!=sjr%6-0h_HP=xK)+_5+_R8^noGVKTYv<`0 zyGj{^9GhhjwXijMe4ajU{6YNOg}Lz#l)rTm5nV{GdCfqI;A_}O8?9!i(&SBEUi=7Y z@T{$MMkX$SsP`O67c52LD+mF@(>Wtp^weGgnK}~QStYWdQ{ZPZ7gXLnA~glI?){g9 zY8VpVsIUQ(bR9}gk!1WGR^@9cf?=(ZK^e56>~lWF^VkMUcWo9>#vCoq;iUBCixNsp zG*jf`l%BLa@8Z~#j}I7i-23{FMtcGr%j+SEznVmqPm%X_nbHF#?0eBTii_1SuG&QK zCwZY~LZP@96aHzW$JD&raRofYRFv{;cu7aEY-ZDHBoMZg)Du!)D=ofHVYnOrr?GP{ zlrg?{uwXjMXi0C<;{$2xTn%b#CyMUMSX?R?Xh^>+3`~O^r!hG9C-5}S!uQUBAYgh| zpUe|3=4*s~=bMOV4M5qSSL)RGyh3xYM;iB)q9|*9mxGt^<b)JoJ?|+Xe<_-Ks>H$Z zxoij;p0*nA`JovKGd-x2WStENgJ7k+tDKL=<zPS64XQtbZEd}Pf%OKAi&~TQ)Cx3C zb`g5}kWA>5^uCYa1lZrCV&*{`6p`B#B9r!*V;nJ|H9<Dl<)yxX3K7@lKTIRgdK>G! z@?k<1&N-N4J2)}uJx^24)*XWD36XU)61eVmz*^(}H=I+LYX$9v6)LwVihMa+(xyY{ zpF88dAx2`JcTcRP#l$%s+UttYt5!iN%x?J3iIC?jfV`<!9H4YiGg9i0pFn40)<7=| zF4egz1}er!pfIxsku1+1awC-Yqyq4I^@?SI3ejjNx-_)N+LT3vQA~(RT%XZ5sv0OD zwD}IMeK+&{>j`sQmlO!DHi(*nJkRx1Jdeu|W%)W3RO=<KB=o$!Mleuec@k-ql~9V? zq@ixop^8+O5iWbfJFX$^jfI-@6e+sAHDTVdHl)=1p*P2lg{79~xjC;_G|iC*n;xhK z4TZl90ge8`63KlgL%32fUy6Cfd)}nN=_?cA#rtlceS{wBIMCGBE;vx;q8^i2BO!t{ zewaqE+9kdBF?m*@XTg4m^9lnNDejX#6GDecyP*RpZ9n+{HLX+*LVGR0e{1wQQ~LLA zai(o1hFU!-tsmx)3v7y=2b&CmF{4MlMAeECNoZ8WG{E{myBJv7CPL?04_?2MQX(@7 zsh?VNu4M-INYA?QNOyia@O|Av>h&i$MCX-q7$>QSOs)Q>)JC=$Cl&Smez}jWs^x&v z^p^Dy7F;{<9$JDOb=D86Txj2&<pZ7HX=rH}Gwq-<bOyX_L)kp_MhSK9BOCJPP+P#s zUBvH;R;doknR!u)*Rc{P$U^!9j4BNQe~QlGuEI*jQ82Xbf|7GB2rHf!YWOoT2Aos9 zNCUgijL)VxCsT<YhbQL2fRbIr`|?n=CxM?Oc|+QqRio!?aKaP=#%wu<j?=|eG_ZJo zTS-^=q8M2A{`p+@he6ga#yS}UTPk=>zOLf}vx(_5vWJ}yJpP(tV0{SrP>JhrB+#+Y zA?dN_;~6AH);lE<F%$FP#1iKyW%4H2{JC!I{=$9aIn;D!rJ%OpI!2;rjVdH6SDrNW zL-k@<Gi^QX@D80U&{0?%qJtSBrJ~x`)##wZsvc|khYM&httNGGHt5hRvXix*g}`}Q z;lN^DRZ$}IOW?C3MJ8<q2Nq=`<>4oAHZ345<qop14OvqkieqYL!(vWZeTwYkG_al< zidtmrJ!lgqrDmPz1+%H13@`OR5)3G{zC#B$HciQ>=C$)Xv<`?gy*nE!cGhmNPu7Sb zP+}-7^C<6?Myo_9dXWz1Yb`3RT<AS5j{29$*zngx4*qfw93iEd!mAJIi!0-tYX$O< zt+HK2w0S7W3R>m)EsbzH=h%SpQsptY7^&%z`nYPPkUCj2qmlAegrMCbAOp$7H&Xg# zkPu`5UTJ;rV6LYChs3_3fai^*^L=xWh47rP3p&iHIVQUCs*Gi`%J&dB##><H??uE^ z^YbnEjFuCIsv=T3rzS*wL*TsL8;&lGQ1&M@9#%HUtn+RLCz34=pN-dRk=jPjZap|k zNuZN<Ftt1j2b5rlJQAomFZH;#O!i%?Y(@hsqMksR(}sF>HK=&>;PnSNoV&Y1cJ2r# z;vW(DBCL(^g@7|-m%ufuW0^!6FN3Uzdn$PdTH(B&9dPLGGE{PqsX)zaRE3}^P*faG z2jk!!0S32_v8AkP^b}Tm&<gOP&y?%<Har85no0C7HYzTjp%~v<c%jtrd`!m5E3TDJ ziRAaui;{*f2I|6SSaFQbGKTMQ@XFYpRcc_p0WZ){D@wXvSeR;ar&(yqXmB@v=V2AW z$3f{@ZP*k+8hP``{|lnL{!j{awSK0O5g<O#&r6}VrU4dV5KhM?@*;k|8F}#2ah)p! z>WLOa6je7$|M}s_BFOtaOP=dh8P9_9a(p04^hc>-&EvSCF|-^EyQfXl;OSUT3qw}r zsgGsa^;FCSoioLNf^@wx3~II4k45jXG=srsXXHgWMu<<zC5|=*beeItm2qN}ihZkO zV0lXIh=@uu3961#H1con63)dnKOc;!amK01eYX{I>@^rg3qdcMEcS`+nLEK*(hu3` zj1AL?&;MN<Sxl*a3?)$W)Pb|9sX=SF#Y7|)f*}1GjIJjF6OEe}6=BkzS8KpHaoXWU zvx*oG{{7P$)P~g>yiZT9e3H<AS2NF>^^8==S`qzdh4+T@#2QO;A;ica$aJL+8P}v9 zbTfxwz9oS|tOMj6Ua{W;QLSflDg@7<{&Tw=9pNhhIv94AabP-v|C?eo6lyK>?Z<mx z7m|`n)$<j=q-7&m+}wOqXNS!qYpm6YvUs4;`fJ$W>Zu-QD8T!@M%K`kIgCvjPm4(U zE|rWON{EV6Moh(gUmP`eA7I00S~cZIYl-)@l8IDWhsSJj%q%EQg<9dODYC&kZ1RHi z_gM!Uj;3KJ)VwC0vr=eFDCi&T!A7bP5#>Om<~Nu<NM%V8a#S6YSt-)%LbusA;d_ZA z-~=3tw7_;Ft0*5Qpod`*@{^H&%1x#({=%?2Gj)1%oNL4|3o6wN9JnL}W(iP49%@nv zdu7l(p~FyNZHZuMM2)%q@1>BG3<r>)pqAh7V4x2KqBccI1>DNazXFQaLurLN&ZKIu z#eEhM{<b{s=L;xgeE^E&7v$L1P#q_ouhJNaPVujbz~wV$+X*kYe<|zAlBF<hsZs{J zGJf7EW2@J85jLkWlETfJSW>QQx*A`Xg(9bEXyr0cHZlrgBxz0K)l$op^;w5HssUr1 z?~^m#QoX8QhtqBX6p!Ok3z#P@Flqiwf;>o5z}5J=MQR{wrC=moCtHrBVII@dFYCyv z3%2X|CbX#795r#*RKZENMTHG4I@}^6N<~5B$Rz9?Hwhau=U6xXcA%7lWS!F?BHw`$ zh;49wzK8D{2QrJfaMo@u``(gpd~yx$gUpUkPzyg%_OmhKWGB0-_9gW?d_;}FO^zPN zkn*|^Cd$dOalHsHG|y4Z>myz_3R$;Au9(I&98nJ*iFVTu#WKS&J?(Z$kE3!$L2+q< zN195Wk9gEF-AldgA!WToh*gq4uLY??H7_<Wn+Co6Yl&CP)<Mn1I@_qi5m8O&yFS6d z^29Brkkjy-E6DjY8tUt{hEtj#pT~(Na`2Q8J7sxcsnp*jhIcQ<=we~EN^*9nB5^n} z5IF9Gt%qwh<E=6x&Dgp^(u`}t<i`1~hp(r~gL_IaJUr8GUhF76BB=yAiCR|!f3A>$ z6%jF5bV~Z{@6CQxl%9Ke<YowmVgF$}A(e}hks3_0rjfXwvG~4ekd+Hbjo1Yy6_JdZ zCzySYDgJLsYlC{w6C=dvvNdXLP#_n<<QS@JAzl;471oPA3r|+w0_<i*t=WiLC3WYK zKpOxWTzi@KJ5kgoC!~@L7#ib_I$S6Aep<~@tGP)9_=$uL^&#Vm8_cD$&MS5OJkKZ? zQhF_Xy~I4zww&i&Uf3(u!164Y^)zp)4L*-Qn(=)C>(k|s6+FjOIY+Pj{EQT2vo<q{ znQ~`DE9b4yJmNXVBC3;=I&S4hKUgw(|9MhSD~VC&x=0e02bT|l;X%h2=Sa2j=Q3Kw zL<1|L(qPHVpNxa98wS=~v~6)^=vXVEh0oZ)KGp^YOCQp7SCy7Bi-^NxS7emjERL;Z z<(hsTpqZa7nJPo+)Qu<u<)m^{^1J!^rV+4jBaP7`PN3R@0_3M=k@rAood_i(WDIir z-b`s1;EUy59oN$gC9z6gFlts17EUUhNo=8HJ6x#>Ym3+8P&3HuP{Zz4q({)3M?#b| z3U7Md)llPozA{V=tZU5keGX}Vu7ngn2Sb3*lWV#N_SSR6qpGZ`P7LH_oO4GC;Y6WA z_csz*6<G$B9`8co(T24{8O_=eDZ8a+T>Les(cx1e%RxsKh>=QpCai(Ud$5i*B4V(h z{JOw2FE0wg#bB677s2PJz+t5_XG7Wh{P$Bnei5nddxCgs1~O47kJ;b#?122Ej6SH$ z>x~$OC}2~%7pY=r!ng{Nc0|+$RGufGj;06?5EuMz84-yVbU9Z~jC!H#-N33>Fs1Q? z9EuA!mz$8zRgK6f4V?oKv1H$>9_cwU3I^CAh@$D7Nixn?H3o$>u!c(w7N5ucCVKo4 z3>|$>8g%Tpkmz!k=?QlmSY5ToX{1DmroylrQz1Fc>uNzw7w<2tkE0r3_ajoec7qt- z!y&3OSrpH;u>O6$-gS`uXQM%VL_{S)2OiVq=c3+!Cm8aBky!<)k?IgK3Z8RbiJWy~ z?_)O4$&j^IgKc#h{yqUl;Ta;=w8?Q1*&&p}!)4!#7z8+3)`!Q78-JWU^#zWL7b+LZ z#{av3a7n@y0fng_H4Glnz$zVlX8%ZGY}Dw_H&Z&-R|17V6suoqg|3im`50crc>;>C zM%Ni>nHw;$3Wln>nZa>;ED)*mkpfqu(!giF6PO4&S2UgXW2EaH9+1fsP?TLsw1{$) z*T5<U`qteFBTH$K>k)a3D>ej=h=|A!%B!`d;qcEYbnbRI3qqj0*~aW!Kav&)cSxNT z4Z)SrGs{M<`1#)>8twPH$Ql@t8$OSJOPQSY?sXilV4B=07*<b#rkVdsLji^u>qjU= z<{-tWmg%a^k_z!sf`Z0pJ)?y2Di>5}ca%oRee(Jaa?4MZ$l8NoshpIs_E$+TuwH|~ zKNO@q^?+8>+?IU{i)j8@PEJ0fQ`0aeGv!$;p-nd;4M!o(#d~NSzH>tuTjlnkWSuRU z5Idkmd{9D)Am2AvyuD;6ZDa$>J1Qa~A_iw<9fLZ}k#Gu)s!(7clzvP3w;<SuDL=cg zXZf1*Z$Qp%fL1Cup)|%u<tfX4ifc~#&WMQrf^NbOJLkTI4LT~?^$n$IrU#}JjFPV9 zA3)eOyJB2zut$ea)qFodC_-9S-|uKBKqKjEqO1=f^?}$N)U-;y?g?)8L)ye-F&x)P zFtFajW;0wOpEML64H#ISjn0+noYEA)gWyHw+);yt$4nSoY*XNAh(jsGd5<K#P(liw z9;BY1Aymfox~FUgZ+21U^y~1rM?^#n4%96);?r6|og+!E(Al*}LLK6Vs2lw#q4kX# zSHF_IFlKf|L`0-w9;A2qroQ#8{4}ESeJ~;nufov!3_|*P6ypvBD<z{5E5bA9uj4+X zK(veZa4V#sku1gbDe-kh>j^8NHcT!CXmZ^!j9{^5YWg4v0$L?iWq!~MbMEljGpeNx zq|ZQeOz(+Z15wCQ(Sb;0JEGYeqc&_tnFbaM+Gj}<=0=b)gY~LML`2jdMmy)$L^Mll zlGEfD`&IrzoMyvekBg`R>W!f-qWZ|&3n?N$REhiw()7Lz8d%?R!wum&)9={^#*}*C z__`v}2D!12Hav~yc|am58#RyuT`2?WNilHrxjctP@`D*?Wez+MeGzAwXWx(SwzW~8 zAuVrHG@M=<uS>yjTFM;!|2I*e@Qo7tLKQPSzrHu$aG4ts5fSx`)!_)E1JR~FbN?GK zEQe7yj);her~|M!m+ehd3n6VA8QW`Ulg6?$ps?$vLt`t%Jjrybal^<#!)JM)7&-c^ z`1ANd8WwikegGr5J3%2x8mHnQQ~dJQUfF}s<ua-3iin7as1*u$orFG=McMD@w4(g- zSsyD0J{u7c5fM@6jm2wm9ZBC$MScO0-B7{KN}(vC-ptc^50@wfpW$|hEa|fvkl(*! zB2nd{6*ZDHV84%)PHWKB)4}KQv_wtondBlOB4T)<9chEVG;-^FkWfX3P((yTL_|fv zg5V9&TP-Vkp*2{ehfxH}Ve@T)ms8W>=neHXQs1qRfkoy|wqfW*{p6-n2c{7x8-c9W zVIya1?7f7#tDU7!Ttq}fM7^N}GL=Vk1VuzdL_|~^t<tk(PDUZHZ8SWbJbsMSEss>e zUerFRkuiS-*;vU4XwNkTL==|?#-|%cFUE21AX5IAK11S)xd|zwCxAp{5!1kWxES6M z5fKp)5fKp)5s60Dav)Z)x#`xx@=S@t&A@VEJnScisHePt**W)Zd0(MQ?2z+IRBK^G zv^GZr@^>=Q_j(X@>k?K%{;q##-x$jr$*A2q&bedp-RsKrD57x{5fKp)KopJ<5fKr? z&v@tu<I;mrsI382#QyNA<g9zeeYl`S$Sl@Jli!&zN*@)Yq*|B&WB5b!J-)H#vWOrp z3flI6B5m(W=$lmz-av8qC14r!{n8%7t2f4U?pUKPA|fIp!XO%05fKp)!x!5-=dQue zp=QFKC2mjr&qqfhYDc2N2$f=SG|lZtO5--@apmi`99jqTf~>?xs0iN^YpQeZUx<kP z8%Eu2&bjx@cXXH<w1|j^h=_=Yh=_=Y6l@`BWg40A{X~XidZ2<7<ehkJuQ8iqE3To_ zTn8H%I}n-VaiV%7D}+vb2ip-uL_|bHL_|bHL`0N;0&23(gOTMU9*;Zcre)B-N7NSV zrA3CvHZVS}fID$jqqDB`5Xa+#8LBt8-b!?Eo3<8aX-5awB36@!au+vbo%xt7oH9L0 wA-s#x5ad@VU=2C87!tT3j}HWRD8=_*zKefB_Sz@0_ZWb{)78&qol`;+0N#lR&j0`b literal 33121 zcmce+Wmg<bv@RGRxD%vtcL?qdP2=tacMH}KJh;0%1c%`6?(R--Xxv@zduG<0`wwP+ zs8wHT%d@R&?Fv^`ltM)!K>G6K3#yDXQ1#0f814V|K?rdFt<jMY#$Uep)5!qE)ZMer zec&6+Bv*glM<?PNL8BN0cE2PTkLZZzQ;7uxP{~l_=Z8^5e8v0?C8jP45=E2+g+nI< z?h_>m?sLkwmAzJaI$S<Fh@1vptoyXTZm!v8FY>tL3PaQvwG20M!I=Ml)4eE^6!3p( zfK03$Tvf1%$2PDtOh)k^nIKSluK&*_gOGWuH6LuR0@-jgHhS)6KFbmq;CoEzpv~ug zwHoDXrid!1%?4*rwN`l=YX2`sAkf2V_%v^-l?1Y(2T+xKyNK=H7V1B7&kn?o0$f0{ zyf*ooD+L`KRzUyv3}?KPs~@;(nQu8-8Yxz|<71q!nS66ybNH0F!fH@k-gQd<Fw2X0 zC?(O7q+arWwEKUF0Kl0P156qt&=T~-m~2Cn{T*ep$Q{ub1-1_XUr0bU(6hmm`$Feo zRybD#1wZ~T)~LYznnLgeH(Ox>3e%^jknlIuinTvq3fzPt8$1WkxrbRl=&uZj$E~a+ z|5wWeK3!GOyRj0eDLK|E*)W6TIPoX7XK&znegxrm`t;zb{!}YWHrSRA0@@Q2uH#Y_ z9v{(^r;Z8>3j=%&dw%*K>64?n%gBRSA?ng%EIkOe!2y?;lr)V{xu2F(t!~-iJxs9; zjL^?l{Ha#2Y;ZY+`IRnYBQoBJ_5U-NB460(?$`*j!35bjOFGh!L1Fv!Ea#H~y5<d? z<4xXPV$NX_8sEi_I6djL$EE(S?m*xIhFL-8e<126-N9#pr34@!b|?(vG*40B3ox&i zUC0l@2Bg(sg?V|oox9<+sn*IYu<gjR$(Ygq@VGy?bDnBFCwIV$h#CIR9wuP0-Bm!D zPY&9fz*OtcEby%WWT@}yrLF9}7H;X=R4esFD}{}zk%G7j+hj{!s1o@b(oh1I&i~_p zcPTN|10|QKPSgF%+$=Eih!-WriLNaMt?_%@{TU-MsbNre9oQb0?$Th}MbkYRvr#Nk zhO(fxp%#3>On09VGZePO?CwA`y_OG4_<WN<u#$>7m{0ydkZ(xRf9g&8KSBb-9d;cl z-RLuqlLQsB%v8FgpIB;!WvO%LKbX!D(%1Tz;2R=`x$=dtrhOy8_Bugr$HAlGVg^2_ zBNlWm%}Cn^Q>|==9GKCP=ohtB;EOGPPO*<StqvB3i^kxpcrSCx=?IHi1g|B&W@=&5 z=$*q*TF&d1|I*{Xpkk}gfcGHA#8eTOG0F&Gis=$1@L}1%RkQNl#dOUMTaa0_CeWR$ zUyJ$8E66`yF}||E*Nl$sDM^WEWxEhPWLm$N=hz$TkFf$}>Xe0v+ckS^2H7y7hwNru zjXm2>wJJ%Do+bxUAxZJ<+!8SS@o&VW(EeLd?tf4A!l`i*6h4AJmac)BTxXi#;<B^o zaF=OnN4f3*?t2t@{W0Y3MmfksL6QG5a~7jz_U~OSYgAILL~ziXn_~A<DMV5so-<yf z2QuGFWW%}SG?jgp)jq`MhGXF2uDb)t0z2flZ1S+a=gG@1`++nGqXL!Hrl)Awh)Qdi z{n%;=UD0Fg_vj603z7e7SqMjE`)(0=3-6of25K2%5G3CYNo2}kHjD}S{#NY(JE7Pj z>szk#LoCMlC)w-Ls+_TeNei?mp|;kecx$89+7q7b{tLa&StPy=ESJT6-l$HF8*L}i zxmwq(qp|lGBgyHNZ85}eHfY@YxqJ{BUdZpAEHA`}M@Jyn5_qZ-j=CIS&<ArySjlg9 zGKbIlD);(HFsYp<3(V8=#i%;Rvw&DO+Jr~%mFvoe7kHBvdzvd#kcSh{^Ekgsu)M+u z7h7e{;QVokN5Q#ifAJG`B0l@i4C?fgy@;=-+tk0PTtahi$`8CK`5%s1ZJ1?Ir9w{= z0&y80-%Ic5E$g!QedfY=tLle_*jG&7H(v!flfUCZ1RxI;y^WH<1(;xhF=hf`YluVO z@BKj3RFmkbz_(5`5eFK`&i!VPPePj$aNrZ3=Vv#Y?-rjMSK45e%T)Gp)+;lGGU@)^ z-$^-M&%)+$!CQP)v1I|@M#(6++%fkI@P&Fu7ZmIeVZc_PN}1I{7_JawcL>G^frtnQ zvh&-@FWS%lxi-pai4Op!^9>R<8#@HOyyiH8T1*oBV)Xnt6gJY6=cn**nRnBE?#ukX zJ)-F`=5Zh)p>0^a`pNM1Isevw&BK><X23GI$IVt|LK~oEW_4ff_8<NM6Q>50v6m9o z!BPuO6ah8g`j?M3j{ht72)C<YdJ}^oo59QWL>?!woUqm;Q;X5R1@DV@sg?p%tgCg@ zb~=`w@PMIde^ne{*bvoYeB%m6&q8VL2kK#RsI7giK^ZZhuT!m|*UzBe+!FZm<L?<V z9D8~!6dA|zljdIHCw9R5*VOaVEU#riXI`M`qsWst9RvO>;A(2ZGz;u@H{Y_GSN8B< z0fuh(jgo#g^xb|eFA5rAJl^<L#6oqi>Ptj+`3&<Rf?WN&cNtGEK%vzcqu7N;r#&6v z6d$_!H!F}!@RDZXZGphE8<}kPCd-}G3YfrFyiS+zK*{39HoEl_$m)8u>Q`%3fGd^f zaeRT*IL1EVxqmNA7lIj$`k=7J)7x`Xt+nk_fHl`&5U(LHBYlGpo0~S`nBade_a8<t z`D8x(f)BXU?u{{8r|!O(n8|<0K*@%rnY<81smWiPozzO}_@Q<MQt{DZLL+$<<_yxo z+(2dj7_$@c`8>QPe3(dE_j<oTVG0UNl=KAIY|QLT`HVjg#>dtE8VPMQ2K}NNv^$q> z9pH-+XMG)dK6%%|zP<Sq0xqu5J@--sIDubp@BDe^O~Yy!tn-pz?#HHc2KK*tG@YZ` zIihJe3J%F-%x!{XAX&fhCURd^g?3z4VO`TnoWNzoM~gyCMqj01%CBp`W_SsVek~pB zmG=(|1BINxF!j6lP8>)?tL3W_=aaoARy%o5^SPmotZI(*E<N)s7&k@`bph|Xm6S~l zG^9+aS^*o%!RyA(LKj)D(D?-On6i~AyLuS?W@!sp3k1}8ERR8iQhqK4Y4gey<7AXS zs0IOHwk&vhZ=n=eDo9a=P!YGkrQrpTHi_Bkr=XulBb6T>FzUX=`u>NbKl#)h8-W34 zG)&B}U7?dF%jTR#j-&lu!06PY7C+&qA%?AmR1NxXV$5+(fCc7aFeywZ-C%oM=U@`5 zP*w9#pHy7@Ab~(8jsG<VMSlD&G=8J7O*SrOV3FT4c*g5QJMMkvxcXHNJ}Zbr)r{nG z6CVD_mTV&f{Y4h4dg0%iF=wOy%5nRQ6rOl-f&|>R%l_)~7Ko%eY~`+N3pvK<U(O6k zht}K~FW96GT|ZDSyRzQR3|T1JT&4)s<{L;Z-6oZ8&<oLY5mhX?B=79{2?cehxrgZ} zI3+Nis6cZPieP$+!*r|wPxk#4@ph{^`+&e@6CHOZuN68Ak0`YeA;rzlW8lc?{d$oA zRB^V0s6s(OklhlBuW~t(V>+MHz7MHRyLHT6MOx+jY2H+B9I@5vs9BVU`W1I?e@zL; zV;!|CfIN8+b4`60H1B)FK@>RJ+O>MNswG1>eaKaFNG?97S-{4aR=S`inz){;5G_0D zq5Tw{k|LowU~Z&$d|T`!KNq2o*_z)RhB?UgwEi{{Z{f@6yTN?SBF`9YMdD(T6)VkJ zbEn*&rLwMNRs~#uTT|Vka|+XzXhA@)bSrcpXw(*wClKwA_^%cfjInS9&=jEf>xjtQ zwraUV`zRA`(Zi+0e*dQi0uhVwtQEqMkSnxH8MB;X>yO|klpr6}^O#niKErd}(Ucgm za-nnNzg#I;Yl$JLP!q!7d?@|dZ`L$2qGoHUd5ViD9A2aQrC#k#J=<)b_tP+6Y~Hey z)d`UK-Sn!?7Y}t{Mt4`6$^IxvM06qIOhZ_NkDrYIPY?dQ&ZAVN0eQ$((I~N?M3JYH z1aMZk9b4D<;FUqzP8v?hNF}ia5`gUzF)?D(L`cYYTI5wGu+Q8jeXLx|Tdas?&I0>R z?@Tbl=Ii8=31wfE9ZRKJuQ-xS#5Vl8u>K50f$E|K9!yQ-Y>hYSGpp2yiNrqrc}FFs zN8brGF$dY~d<J3ZB*AEOWwSQgg$$)F2OhrF5y7Dd?ftuAY7l!K2kZX@HiYl4knj#$ z0Y`FB>1dLPz)t_R`ko0VBd0yOs7Gj5%vS2iUixe;bCNeBNvC~xI!Oz7)>3YWmrlPe zYnghW%`eSij<|km8D+0=l@pq<l>QSk@vT@BrySeDfyBh1qE@}eYs`dA<@83W&|5b& z3VY*%fX=#UC-js(52wR&n8d)wes9N@IHErOkhJ@xV#?nk%aQ}qH$_Ove$GyaNj%;Z zo!UI|bSgV~1hAoP7FRQ^!lm~l-{Wv*uq(_2>$*s%+ipI@-dPz$ErSW!lUp7{)ot<P zr1sg&T%2YBzob><%BijVXBwc@YEcBSm&aTSi&zqfSs6Ry!KVVnVoseZ7_qaDwbzeu z+L$6=jwR>dIB*q;<&0kV2)LY)jiTn3X8t@La{9B|4-c0(e+=<GB2cvO`1MfyWHvxV z`caqrFJy~nFhgxv19;xEu=f*YsER;uIe#lsiYRf-l<RtAdGBgK0&_Jj>?}=Abk2ou ze<!stgmVc^3*I}#K<SAcCBegS>ZQxUcVKH_Hk;>%mDqDmqVl*#`1dU&pK~kIo=Ld% zZEw);CTW`KKxh3fnqS7ZIb!geX<7}2sWdgd?3wYt?!&!-dAWpRkv(`w-&uSe(C_-j zBA5J3nmrX^<f1dj$xs%z<v40W$X$m@T8V?a^^vCMd&CRIOqKeeFUG_s?Wb?agQO`X zYd8yi@)r!^rT3e|u3l>0{5iwXY94Dw8!m&3o}lMoQ$;@u4R`r+V{%iIZb1tqF3#Gt zqu#7FEFts9*+H&WuWQ$k*rFUuCc1xk$+vF#qZHA10JgI8Cr`dd1ykkgKO7_VBR|nv zt!xn}{@Q8_=}Sr++noJ~O?u|zR*Zf!bexJ6%f3g?0yh^5N{|Mp;XZi-&HsEfW4l~2 z#u2o{11Qm6N7Gq7SyB-k*~D0wb_DloNdK_}3HOgr6dDn1?*e?!eHKwe%xD+R7R+%I z7y7X7=-{B>sMG#7ed(w~?}w)T9Sz@WQA_RaB!zbU_Jcu!C%<(qXYQNSmRcF+S~#R# zF&z#!_Hjn(n9*6klKycgvip-hV)(XCRbtPR8`q{fs7PicZ|j{R%_4_wOwOt|7Zzz6 zBqy}!(Fw(!e#$yUeE7V|#fk-5nMFufn_(4iCeAl>ljQ*mO$C;W9<oa<gft8yJ!-JQ zO;Z6&nMP%--kl1_<<wLIjdQWQS+KD|(-eP^FVqZ--&*5EmZWp6A4J~0fv%2X$x(kH z<d!%G-oHcn|M?aaND}$~nm+u!1(O}8Ls#9agI%D#C?OYN4`7$Rke+RhaQFENw?6pv z&K7RN=A4VSK+7|fWpoV0Y#QJ_5~2by{K3B&ch)z!qzXX=(Ne-YVXX)qh5ymugF}y@ zHwO3UcVA#U*3G-~YojPRq&uJncNECl`4Flb8LiUIQ6j*$2L-P(nEo~ip77he^%B5s zy}aC0ZcklUsYgb>M!xwMjqs0Y!7E8Kb>5^cJ2u7A7dH#=!qnz8(a$D_QlHn>WrHer zQisl+)1Jpvng={EiHVxk;}buwQQ!7?Ni=~6GO~!FV}%;f&?5PRfcIk0bqWDdOk-P$ z!5n7f1^d9kTHlst*^os-=^t)Z=hu>N6Td}0&>qgirD^VTzV0i6flg>ba@1GXKBPkV z1*QB(ZT#6T%ob50<cr>Hvy7hLDyWmB)Lz8P;dY`K`mVAO#k$&;v*_$A;eX3biBV)- zmzE<0+D0{rJ}T++*v-K+1!3s1k>L^7%9>wVtx01@q%(dw^ExNuQ%u4LgGFYWq>$F2 zZ~)rgzRm924shY1xiq%MS>s-Jnv#<3pYDj+eTE?QQ)XaU&fwN%Y6ExvHx*JW3GJN; z*j7SZbxOt*0)07?A1KBxg7Y}WekV^W3v~&s6Dqu@{IQBSGh1QM!_I;fcTo)~K{6L& z^CcB})N!Zx`tIkrQbAA5Y+X6Mk53I}rqIiHDniO#XBkFDW%*BTamH^@$DNz~gv-VU zM#zC5B;Cm&n-Ra<$D5h<^e~UD@Pc_qW&Xl{cC!oPnQOboHBMjivB3LOCgm|E%r>oe zJX-S^8d&n&k5ooGNy1D&hPXI)Y4YN=L$^)8s*dxR!6n&I7Lr*+E2wxrqTEM^5<arI zf6v87?{hLSGe;zzRC^b|g?U9)UklO>-m1L%wZbOXUiItt_HZN@-QNKBd#OVh#W$Ov zW!l*)5Lb<Mq>5r&2~ye42-rf5L5)dbZ-5RLRVg;Ft83v0j~+!kRY=*ujE&UngJH0{ ziCoQaCEDeaSs_wYD8V?_)h9EnB~S0=X+P#ov*?Kqiw#OFh{0%$z=z=Z$Sjp;ET&x7 z@7CfG8-{UGTUgm_;m>`ICjPC~XpKpwE$$70ws55g1-=VKlU#UMrA`C98hj@VrO9>= z_TwxT!m%8nfGT~N+03*mDr9}5K(p^dvgBIusJtZnqXorgLWF%;8+a^(Sg4{q&U2(J z?d~^!^(Bp@;CWm^AF7bT$E;_*UuGYyek;hxkU&y0!cjd$GbnlYWvcpKNUdn4nZQ*< z9oPVo5Bs{ULRV`ahs{@K2&m1JftP2mcma-hqvXd|5HLNE;ZGpMcPan*R;V(~VfjNr zclJ;_GwSRCJ~ZuK3H@K>k<%mW+s~K@-}3^^0PrFGh9O`4T$o*44Fz*R@~;V~-e^m5 zs@*3l)5YHxTA`Vx_9SuYbf;JQT$roQH@7sd+{Z?dX;^hSoI=9+zh>Bz0^=kXQ@5ia zT`npCilaVO+3X`ex`i&gy0iCy(cPDSBdm#`D5Cr{hN4ZOIleP24X7}1Dd@zhrbeim z!Fdu%$Ey|rxA!+mptd#i$mo50O!07M?xF@dt?D2Xd}8tkzt9iSLTtrLOZ^4MjpbU< zYQr+0{>^W~No{3FpAdacYl@$7BgV<~rkrvi9|=J%gTKxd*f~esZ>)QEL=+C1l2xRH z{N#>8_0;=?DW0}(1k!5MQ))xMM}`kenf&os4Tr+SaA+tARr?`w{#3A`26T;bF_g>F z3{0kyTQ!aI{S>8Oi0<=Tv!YveKiDCRyPz$TJfOII1e%SH98hubGapP;MIWOs*qgJ~ z3(U#XFlSxo9<mxtg-pnrtYyIy4;(D8=@vGAn?HldB)O9xrEtTF96w=u#&a`~ELd>? zk!_4TkQ`_uhNci;ZaAzX$aEw($XMIf4)BGnY4~^`<?+t@6F%iCwY+oCTim%UC7TSV zLRkaDVa_v1=JhZU5S*t?k@VMb@p5bqT(j%Xb%494;pQpZpkONKOY+eUYm6M3m}9=4 znv<GcG=FBQYQAP(Z5tNcz}pRRMlq%?Wr-2$FBEaf*vC%XulN1##de3~gfBjH3Dh^B z`X{0HO33c5Wu@7Oz*7v6eLe~2<I<eZ4QOtK&KpM4>yBDEUQs|7W!=u>t_v1&GDx3Z zY!0j~ZNR0ReypYU1_JD~u8r`A7WG(ntIi3&ZIs`aa&~rz967}GCXk)O_^_Fsr2wa% zub-2>zlS?_!=vnYL=&20zDcK1w^q4HX~IEfBxYj8ZzJr+wgNX7&whyw!r_wsxo3~| zzxhDv2zt!>zJuZY8#>1N=~WGsXZK*)5T<PSkRj8+wOPU?%SqP+wN7$tIgcwRO|BN} z9(J?-y~!Zxnt2I$aZY1`Jv$;xK)FP#BWWtcxzGv3P1{7z9sj^Ox1n-?tu}|A18hkW zD~28XR8VdffeOxjTw#Xewmx61_u@Jnj3|C4g@oIGLH0Lzk##c5(ttWus`s1LCd4{v ztHJDDHTqPe1?7bh>PJq%8l0lF;4<tSFkEJ_P>+COt&Gh3`2|DLAx%&nb*W;A6)xVq zP4&Tz_N4^c<FNbpSP6$&kSA-@D#qzYo9VHzn(tswG~%GwjIFKMRB%$}iD9`W6({!m z5*>#Ufy|>Ly(exh|4>+)AwmD1V8?faLx*aCjtusy@f0?a1><h)mKZk`--+8zXo`lo zz{p3Z3*~aK0!NKEjAD5WlfU3hhxo%!V_2I*_%Y8k7<pl5m77sK1cY3lIG(By6@%%& zATeRl?s5m%Bxs?ReSr^n<j3(V?hSM?KG~B|S#80lX4qpfobv70=}?uMzZ1zOeXe%P zJ;w!S62FM6avP4#bOh0YvoF&PWHOeXoye%qoPg&;ML^eZ^E~V>>b-ZwrOD7Rmkt!@ zXpnbEvR~%E-WJHJHfcSKtpt9gEUR;D%I$*5Uc<CIHg|goma3RX_KO=o(b-ljw=d&e z2j(YViXLr6r<^SF2XubNU0RCQ-PrGCQ;Nj@qS7{8cMsPZO=;h!%I>fJPj70-qf}6@ zYlE%glF8UVshzMwwVIqi6Ahq6f|Y7tzvatuf?qJ&`K-|XVa{FUlOqkce<b#2@x0h# z=Kq^-+yr(PMpb_1GMa8J@Ttj5`{sr>;U(^*8KW~9z_<>8_YDaDZC6^O;^K62431YJ z+jbaZ<<0dTAtoa$M&b4P%}pq9x6WSBP0OH04hI2EQ0)}E*>k?ieT{Fj;*HOh^u)IP z8#A%`B^fhWabEsPYlu(;4~|T%C<GARR+%{S$*|um&v6%%>U|C(^fDjuz=fN%J?g!Y zA)8b}Ew5+A#ml!i;&kuCQ(&#&%>Ly8Y~EzWtQCxqs3+9s#A+UkztNR-{{UZYte3Yq zF+>_8n{DJd(rl!%El1Why`q%UnE%Pu66y7P<uQZJg)Lyu#>&P&b9IlxusIED;M~=$ zsLU2a{2(?yXOgKjb({KyCv)k6YT6|pAYoRz{oRZd<A<4`(vrG5;ZK}G8qgaL;ChRq zCm^dhRJqwW!&eS=tDQ+2YmI}5#$&2z1=IH4dwwNF3U7>jDkaCJksG5kiXTP9vZ%Kf z*h@Zt3T(KYfhh4UW-C9g1Z$c5{N^#2S7PDFPXiuIcfOKD!QAh?@3<64nfIU20!8c_ zbl)-p?h$Q_RN`A_YOYZvUbbfQ<qPpq-bC<9D`jkGW{y^nB6xE#FMV-UDZ0>QkI-T6 ziaoHUHTW-+)Nw+hw?<`LR1$`Y(U3+RSbxLL+>{S5dBNkT)o4#4U^pqqBi?t_Ax#+P z|93BQ676;TF+_BDiS9pXNfkA`cU6DyqUNC)@NIhk2_4|@(5e%F@xyP6`K~zniD-Nf z8}PB7N4lbTgj|A(RDbwr7`*aFWGL)@;#Xhmos43U;N53>U27Zw@?GyUGhwXvbULCA z?N@`}ml0#;N`$#Mg`I6a+~d_;I5U-2pqQWq8TF&=nX8t61+bbPSyzrP&5`4U3M-G| zp}a=qNgk2#+I8-!OSOh3g_mbI&9g*fz&F5aCN0ZVOLJ+Hxx)Wop^N`0w*4>;tOMD7 zP7$BHV+IZ9*Up;P)wm0?;4?HjW?a3b1VNqZ-0SuD4?O-F+gfIQ=UCkY-S-u;oeZ7& zTcyv_9FUR|?;(LZJub$la|`y@+=bA^OLV?cV;5|HQOkH}O_O@1t${`Nyb4+783Q9) zGob}GAqq-2#N2{R-d^qdJTmx*Ln3#;(v9P{D2E4k*gCl7&2dfKl0oY5Np+k%rLbkG zc~!JBe=4FUrKg*@yKD)Bt0O2gmk)l1R6rIW%cW&91>5F`|Hj+H-hR>=(1Qf*{)&@d z-2#CX7DWJ69jRvb9XO5z?$E+}XRZ;`F%9R@HQv4joE#|1Cyw-C9or{UfRd2%S~INB zTgo4?P33$e!7WDV&Q`qpzsrB5!n$+6VPO8rKcVVdJlh5+_+zo7I-j#Hkl8~A<h+u> zNZhM~Vd^wE=<A4-B@4Gbx!W<;II#T-<)eDd%-AHuXDp9U^#`4fiW<01oV5a^vVAyl zx;{+_a1#&D%Z-IGHmc{)E*rw13`_L{w=h`E&qdS=t4o!A3rww$0letqiaBJnJ1U51 zh2lmAdW2R8(;;o-_zJ^RmyZ&9k>$o_o?lhJ`84 $YTqG+>*4RV8TjEncj)K)!#m z7l+osPUk_U!p_`YB*^h}7ZPEi+r!12LmB%AA6#l7c(=Q=B7v`Ph9lty1D+y>B0l0U zk87=|3blOpR`vzQ-KaJ=*KLq#desLYJEsQ?^_)?QA&bP4o1AjwNM(n5UW|n7)$C9$ z`dwYt4;GY)kKvwGo7mua8X@E|k%Z}(s8b{EQjt&EZcGSvgFv)PeQ3&WpxsAfa}Xxd zZm$o0fhgDIEXRo80jH{tZT}=>vS&>;!!4@E({w1EEgxzT>q(IiXAMI>WE!@M(pFwp zI$NKhQ1mRcWCgjbPu4l!)j_Eb>>a#NgI26w<N(=_YLRh^)GL~x9~SEkgv(3?pLFcT zm&E1;SS!hVI%s-pJrpvc-WCOO=g{U&YZem+OAt@TQU%Mh!JXa+Jat<Jy3Day>P=lQ zl2}L(>#kk*e_>P05gP9Pz=zOD`QB2K%ZH*D^>%;VvjM!6Ma!&g755s=*g^A`H7t{v z59$?GmUZc3>41?BjVs4BmI6pzQ?0rBEWzI&Pzgf*(bt{iN(;Hn+5XiUbF>KG+ug_h zH&0k{;AdJ}deqTTe7sAiCbgY6vUwEm()TT%ByG{cyk=zTvn_9w-9OTQDDtf{3jvO2 z$V2+w8kbrCQGH~H3`ZI77gr1|bRz;0=~8cH?oB5)Srje}SHd_u_OqA6w(mjV?p+aG zcOZV{)vjO;hvz6~T?OiN2?@#rcFH+4y^-~BRu(vFC^I^r1o~iS(C-YXGMtJ6?*Yd+ zrZte~GE>^LFu+)b)l;FfkiYrP9eepW+b9r<D3mzQYVvOY(|MnFTJmgY6zJJ{Zm%NY zlr&s=a#_@|;e_mVs>(hm(=fFv0MdvNR=cvhmnuywOOV@aJX2|R7hDgX3Jm*nVdXp4 zST%nrTy;G9K$s;b#5wHR_eyO=BH9<&6TFmQsofI!w%h_Bs%7Y=?Uioc%cKfy$B=Q| z6>YlTO+x-?`&$&-R4Dj3NxpSR&f$-bq&si>2>YR^+OQ?6Rgm}ys+YpK-Yjdu1?5P* zrfx-!iHT(q`lj%yC3RYTi_$=5=LQ&?sb3fQ1+s=$dd~Qh?1z^oBB65Q>2CHJGv9nC zSLX+i{8@^P=gcRN6=M-x{GMm1R8Hq$z3^9^$Xi!ISC-_n>u=$}K{)P&_`8Z>I%b76 zY7T`qa};*Jz&OTvNR2NJ$<`=cl~RV9@TUiBU~t!?oVpuH4rVr|yvpLUq_I*H-My@$ z-<6i9cc@DPNA0S2lEe_(Bo$||I&KxG5JXW@VQYeDA0Si4Y~zQj37ddfpa4w*agM=P zUeg-pr@~ax8oPb44m+TWZu8AX^N?owNs1l*o*{_3xmhhN;2`~gXE@E5BS7ig7+SF< z?WjW1vUS1eg=W6OMAzryt!A)E>d4v&lP+^pUO^JXjMckCV20k$IML=!3LzjrzFa3? zOKEP%4+>lKFP(OF_NmTzy!JxpTwXJ5D17T8NDE6e^G)cLreFqzYQwm7Mya6x7ACy> zq5Qxp<bd~^B{eLh4N@FN@z?)N4lpRN>r>FHJkqJ|LG&vmzA>xerz$jgSB%XP9WD;K zK?m+87|WXoaD_4Gc!W??=}~>kpD)OD5GaSCJFl9wQxPa@!a_GaEbZjB=2k@&EkBRK z)cr+&475dVtwL(%e(0h11$_($r0fgF^3DepTs*x$z{4;q*;@0+O3(<O(zNxl5z58= zEg~@HoRpnAu9xWD7E|fbl5crh@AkFUIp^0kNmqcvgR0<OIqEGDPhervdfc$aaPVo5 zmoG5_mOWCIA)*|hc0pHb37dNK+j%XwHX8}ph~lAulpOWI(Y+uQ$o4c;dYVNy%<F`! zN<MQf6Jc}^KEisl`-iF{F>Xzoc7emniw$7*ufT%j5njFPhG-xqfjtXy6@Qc$utfB^ zuDXw$JKHI(lVicIulWs5AUei7h&`UEAsn+N)jPL(kvxXuG$H2Tzr-Gn=s@L56?eX; zn6*xV?jU=?La+K!T>9V^-Gt->vW<}V&EtJJjQ=S4??eOOuS+T~HG_KN-4+e=uqMil z;`>qB_o_Bz4f^^Se7cTPUBDK?M6bgCNUZGJNTo`x#QpO9($=XEk6YtM6!&N_sxfgK zevO)o?<w#j2C*AXkRlNEd`MtERh30_&B$|GBd?7FGBcXgu)+uBhEjua(sw55)aCnN z4c($ab7zidoktC9{^h62rlW1<{)UQN@(uZ1!ZhyIRjaidq{V;tQc*Hx@XCvs<sBk3 zbRrMPduTuMerlf}WdxL<o4`bZO@7$D$zOVsW^QkWDV|5~F?a}*$}PMz?gHofHdtiN z#rUk#f9dC<b5HL@L(egKysxLLi_V?Qxy!QuAz|x2eLY4jJiCHBGLlG;2O!4U@mb5r zmv4RvQMOXr8@e2o*BcAjw874*Muv*izkCqL3C5Z|JAKG!z-MJi&XaJ*|8u3%D`Kv! zbbEz#uM8g@g|lO{>+MTWr#zpwij)s)d+s*0Gq7was(mAQ1hpofPllGDxUk<rJG5wR z6!!zcIm5X*jBbqu%M856d)xMwrR<2lz3C$*s>I+gUqaA^fU35n-6(4R(<Gmhxz24u zmbFH``nE2_N(?E-w`-~Aq<6Yol;C^)mx#lAfzrUa+e4^>Wo}+P)C#SuW|f)S)Z`<} z*w)-cM^+>uLeB$rz%H8N6JZ?g##Org-;s;(tDPHVtd+ZaGkL{(0ED@#$=3@9LL3WU z6`$CP)rf$vEo1i0dbmUxJ6T3%9-3>gj0{OMa-So#qXbMfx6hu0g|tn*GrR0`o&Y<Z zWf1E0&Mw|Z*e7uo{oTZMl(G2gh~tbc+Q7Hu)<q4$AJhL?0P`5d`(f=-VR<-oMbth7 zep3cLE&!iawc+pf0UzOe>pgsyVK)y_QtA(K`GDSgjfp`G;~tK4GMOd2u*SUUlqvKW zQeukwqL%+!gn<)y{a;05KEUhl<2Q}9Y0*~?4^q{IU;V{58bBK>>_Xx|YS_sOt^T~A z;JHEx*yGAWBM~;j?B;2Qs=}5av!b6hUEh~zDe0|4T0KjAB2n{ql0&}M{E|ZN79JBT zo9JhJj`&%`X1}y^sulvRTX-2i#jFskS-f|gKmsc2=DKQq9^5Gyz)T8d*|w~%5O5Mz zX3<4b+{B8yr8d$N3Ty1l8EFwt%on1iMZ~~y%cZ~a17Bd#z4``KXuh#sty0|OH1tUD z8R?Q(uMUg){z1V<^O+VY2#h8&(S&}?8pgZ>gm=a;C(s1478949Q_oYLnosyF{dC&! z`V)#W{QmMFd*BB)^U4Bi{t=ReSH=HHAOx9QEWPytx|3{*W1mr;1z$=NyGoEbTt-uG zkFF4n`4~c<|6D6<LU9I*rh1a+GvuvhScGY+LvNn)gAkldvZ1S=WmrufMK4}Rc%?B< zpre6YI7MoLY}h97NNUDbYQBhjJM2j{+%kOLqC<v+FtO}??%Dw*sbiCL*E3f-SKg;% zkGKS^=9<aP#>&6EV4lY!jhWi_g(dhFE-CN*K^i$GD_#>E^SO=a|BPTD{WgxeXR!*> zgtH0eHF^^DM#4NKiUIXl8Rn<gG%o{<lvus3O0-haAt5oxbGc@ufb-L${XT~%z9ts! zjSskk4*_NE-@FK@_EY|~SU%`nkVCKe2i$XwQW689L!-$Tk3VP?X!T3nF!QMjiQ@!d z{r>exo=z1rLq1-b9g^E6=cL5V;r?nB4FfsH!u{upt@-~Poo5;pRhTW`9-k;#tsLQq zY@t>PUClpaN93aHt-oL2FFb8v4T+r4)3M3vvIn@L4`+OOP2De2#xFRKIRjM-mHv2D z!t)8_=5a!7G0UuU8qGY|pdi1Y6i<H%Mk)f5k<+A~GHAXPP`P&4mG`3*gah`Xi(<}q zd!CY1bCP{=gDRz_0uG3bBHpU^KSQOf%av_*OKA90&1|2@lqJZlRaxPEeiypFf6coW zC|Xg96&!$ja9}Z-8E>uX{fd-0ZG20Y(eeAT)$vM{N-|!2GUa|X7`s%aj;<18S6l!M znQuI9=eZ=~@RuZ02<*<eHYfSdn1<^+f?Hv?UXQk@{A*?pB}y-6+MaU#gb(I3@$S^? zqu>?J+)(32P>(1=v{X3&kA)hbeMz_@xF8moJDtqVBKL6QNeDOS<~uS1Uz_p?jlQ)L z<~QRZTET*%*aqi1u^EDQ{{>(gRYC3l7`NbNjY$8ow2;&Lm7g~xz0{rhzyD{h0a)UF zSe`qppNh2vQ9phf=N)HzL|(SXrAW#iS#U&Ei{2ewBw2I?GZeux=!EYQ$;eIIdRQEx z{KB3wbRc@Tu4Sdu3|6^@%Q`7H`3PobV``DA58({=4pj*+I><VegX=R_jV$`A4;%Ms zMRg3%iZDF-Id`Hg=NKg)qPXDy`dAi<yw}bhlGq@r+QgOpYT#|yco)y+9IZr1X_yVR zlk9`k3K3ak_Tsmbqcq^omNb;C%Sij9#%m`{^jbdIV#s+n_PHED@9(h<)jqLa7~7F? zv7TpC<dp+SAHSM8{hL9Ou;dGx?hfpjo5upkjR{2zm9{B3FNH?1;Xu=VLZ@|5o2sA1 zNDf5jh}3_okJ$DR9Z9mrD@nbNjy}CByE6+bkST75NbP-R3@+6dq@PZ|eMeoc{R5cG z=#o}8w!(wDDf$X?N{G>7H}ga3>Xo(+Ll=K@1*fS0-ELpG+Dz5#2(vlhoX^<aB}7vM z)!Uv2o;ziee2G&{t<$C`jE257x4*bUc{_tBsR{X8hVtWR)^nG21Oa>g6PONlYV@_D zcX1>p{3Br610UnZ9sJLPzb+DEZJv|Z7qJ0swbd2F3C30OCf*ZkB7D^uWhAypC{(FN zM#-uuzcqNrg|PRo-gFX^X^FSSZ}WmQ&nnLyk17HhOj#mb1e=m9>*D~FxN_kiE2*rx zq<%4?QAwp^#B<G2F^TaMr$;^e8EblGhXG-mTiHf}9l<vd7%3@7DCsgK87ZXtyV_+I z=oJCv_i6qlA<J^IB$)#&W~$#bwAQsBUW>N34G@lRnrZH^7^z2c45IeD!w&09^!Tje zZ(`Bq15b`?1PuId=_gkh4?8yTsLpG?Z&PKH@;n(Jo#G<nNHmgrz=dItq-J3ESgcXm z_~UxKs~TO`b@yFmA-CucY1#sBNH(q<Ld4>R)y5<{p*j@#dAu8LrPGh{Xe#sgSQUdx z6foZ?g2wjY!iKIq%AG3or@b(^=61CcaJ2g$ezVRuW*!+B^eVudX87HJOslG(E#t(q zVRTjuk8aN`#GYUH1%o_)6R5qf4kS19*Y%*`TAj?f6qw<?(C4Bf(?tmF4jLezy6U@! zHvaaX+)e&&cp$lX7E1!`58>MRkO_X92=emAM!K$3-u+%-^eHQcnZd;5h~^rj0|AU3 zVGJMV?r{E@0HD)SaAY+F+$g~9X(q8yH6qcAFTd5sTO;?S(UHqV!1d8pFy>?~{|Y%P z%RtlhQ>o>j62S$1RE<pV0pNTXtGqgh_MjCihY`sYW-In=9(tUeyUBm`@P$3_jrieQ zy)||pV>!lr0zLg}9rlX&bbXSrT>Ac95iu^d@=n=CeiTHPd=7gX7QsXMZ0^5P?x3<n z!hc$t{@3)ydj)w?IJN)HZBLB)@%)I8VE&U6ySSguCK(sWgMN#{vySF&(Ly%LZ}s{a zG!*G80vkymYZ<cFLL^AZ5F{&&nP#J!DxUb8PcU$r(ry|KEJ<0Y6aXLmJmMV#gDQMk z7N!}$6KyT=OKk_RV)+qbZ8dVQQpK)dI#FzPb&oO{8C!~)wmX)T^1NNji@~MD*(HKJ zfzGg9XmvS(-x~GgOBa^#@KbOe5Bjs(ESe=^*R6dT$6U~-xCb*~4Y>QwoNxa6BGCBZ z{L84!TrXd}Yji<<<G?8W<8c1{2T?Z)E1HAFrbN?vg@o->2*VmCYLl5x0X3{GKJc(P z(AX=5ZaNPoop$g`ao}HxEDCTC=2Wla8uaBNr!_mA^ZQd68ykCn-jVeIi<FUA^)(wW z{bi7Z9nxVe`^mNNM>IjDjU{YU@+;D4Ovz51Tk%iKaRksVUoG6-mm@Xu65E`Go@3UT zCS+dMp?!HC$gK{KvV$UfsdFID1DQ%_E*@&Q5ZNEQXdIr1!s1@?;5h<hFQcpR^G%_Z zS(;4u1pnk_zd9ItKWx<l#hLHnSglz?U)QKAKC~!<UZ@sl^1p@5Q6aF_6;l)Ixp(8@ zHhD7S5+zas0XiAxp4JOB8PWHPmT7-O;3+iap~kT`Vfo<0L7vgGg4(wB1hBdyN85BQ zBo!dNNb4zvkIP?CZk+}7lR>yDFVe7^@aS!)p%qr&XsOiRZ-AKz*r^5pqs#o9)x4^~ zVlm6?SG%%Tt71A$tVA+&cz9htuM{^Vfx?jI5g0aD#Uf<}`_2ADB}udD_~1d-r_NR1 zin<SO3b_Jm)Y;y$@yBPOO&Q8nMUG{>euL50zWcpp$x^sZ1=VLB<c2U6pTQ~r$9VmG zFW%_kSB#z0Qhz}K{wpGlVsDzV%>F+=LLZ`XVO@GVK=PyppJ8kWi<`AE9^O;B@Av!o z56#huLZv(`-}g3F=_33MMnH6FuhgX^l@vXFZ-TSTit>hjM}J3}*tKV9#0%1ljM!NC z5h<_rTIuSwC+Be0t82a;ViI*!EmC(>8{`xOGX)0pcnNi-UcIN7&wYO|9k5lK*2NOe zEExPzxojKBc?s;jdMy=O_ykML9_5%X*^KJAnSeK2K{5xV%Ley(@x@$ZJh@6~=+hLE z2j2LkQ?K}ao~5VyogHj-_gesqx#^?l`v@qN(c4`>1;v@KjI3D3WAfemd~|`SSYF;# z!PC{}a*v;*0$`Az?BE0Y6krnPe7rEKzLZO;w05a1YIPo!f-ssRo%b$<BnAb!aAnPC z0#z<T3a{-*+4)mKV`|V<H$zMXoBJ)bKzC=Bpy9VpR(IWZbJF>SY$%xa!_syuq|A2_ zFGNqvrt)~Kt%xu^EHC=U7&TVmVRHV$$IrkXpQ+@ix=Hig6XdLJsg^Hucd<Ksx|vp_ z{EJTIu2(O)JsUcJ+qw(56!CN!1d&yA@r#nB)TBcCLl>sBbVQyh`?*ZcvgOJYE1b(Q zMiBibPJkH~fW9J+?0^+-ZrWIVRsGx2u4A6yclCl_V%LwCV;<vWuew^!RguLiHw73K z&7!?o`k<3CoSD?HT4k1lfP2$|!jFh}it{a2<eW=i(J!0n6ad^5h!2G-&cm12=^MV` zZRN58b<ONps-H9rhX<7O#E~F$oEV36Q1?I8$XhfUv=xhOvem1jqK<V|i`hR&qvL|{ zlX+kGsh8r8ej*kkd6an~BR1ygX=Rf6Ff;cJG+GEfIvD%v!LoNOF2I&mOfkY30wWS_ z#VL)VlU|XH#poR6Og^PwnA94HYyjnX4bMJYyWMO^T#9IRu4}A6Y>R(Z*0RIdhtZvB z$!B*hQxb=<EQzTn{N%}D1u9gm=WXt(-G}e=NxP@Sj~*P6oG=wD?ipT+FVIB){coN? z&qu#5K~0>I^JXfDN80GrQpE^;JlgS4Qsb8W{n)dpr?=b7(j7rodx<<MG_NZ#NkfFo zR5LmdZeJqIpf*~vpFdZ-p_1?kI&EJBnCm|u2giYkY#;r#T)oWBFcJEq^yuA9t*e_L zAfQs&_Rdk<;FvdRaH9uQ{jCL=Gw0jPds`B#<|jydGntL=*4=~Nu99}Bc)^^w6N8R( z;dGHIdD`Ne`$pR&AgPDHiL}G}Hr>(~r!oCz!xzwUDHU`gRH%H-M?{(iPhChk_)<QG zq1yG6e_Knrf6P(@*&4qyAHz$NkG71nJHBz1k&6$R23XoO0D1%;D_K@M&;@`$#Z6~~ zlL|tTVi-a#?GHw=7fw48>n$~8h;)AVndF|+V;4YM?|7Jzr8ko#4%MKR1F4K$#@?UB zUpVO~3xv|nd-;uoa{Tk!$sSfa_C_`>Fn3Z|L!}+qQ{t(F<fbl<`zD&{_o=e4a&$9q z;&lWv#|ZdwML3X8XnASx$KAHQJE7Tc$moTR=)tJ8#Q*BL+X;%C@wOea{a$H#0-{@- ze4iPI%zqaS{>HVM`w;|wMP6zDuIPx6ye+>ADU-YSxnHm-v4%;#L1(<RfBI-+WaK12 zRav08QVnY!{4~(Bl{2|Q$7_^ZG-HY;*)US<)pT6iDL`}K^7amokobx4+^v)jSvRNo z&hw&SE|wMYIZLK|IW(mDn5gAckl(6dWK2qJhLdM%AnuS}$SKAps85XdEq7X7CXz|4 zwH+Y>Cl@*S;4&bG)5UPJ$2m+pd3)4!ZAb4qZC1@}mfp17It5!$7}m6uaW~nI@R^;} z5pSseuzmxh(-pvV#`b(6l!i_?O5h;*0txijyAzO?3n@^xykZQuSBvMx$BgS8fzw8N z>ZnR>R1ff$w;id3tE;Z1SPHx`JFuPWT4J0k)87v2(47Nb`h7dI2d-2FYyjY6y-C^} zz3kwrT~xn;*aXxr#zk_eqT(Lo*$rb214oxW{*{RF0dyEC^HrwmW1bwSpU0)U8-cQa zA^*_e-@u2yISYe%Q?C+xj(V~uamY|KN~#HN8J@zwA$l0=NpbcH`gD;m0+)F|Ie%3_ z*V|%+m{#53%lplyQF&bqfnUYQc8izKIP$aNzEF=gnrsU+pauuBHL_5Q!vcwPE-h>y zlK}^MS=AdT#f5>(Za7&B6L&WJK^^{4&Xtro{U+N(N{A>A%BO7cUxnu}l`|H4b_2AL zXY*E9k}Tn@x?NTDVQ@)2`LY26kTBM|Nb3)zIYm2Dqv$ARw9Ahi?I=k8!#=c(#=hkt zT!)e7vr%c*zk$<qL%F<K80_ubJp)Ac7v6A^&UCT`3o*Y=OzCnXw0mNjfc!tA?MrsN z8%8V5CUlIu2R)$Ds=&MfPPy)MpMP}d{PyT3w<5}dS^WoD?Iz5&o<odbVKJinx4S{8 z2Ft14#THQ}3w=Fpsz<qUtoAL>i~=QNO=T;YBmpXSmZs`XmChA&+)u-pVmW9fsu|GN zgvtrD^t|NeCGa<<q#N^L{Pm>|@YZ9hSl@Xj;&dXG3+fEChPUc$dc=p7#mI-ZIs%W) z=L5(_#cDW~wglK?BUzzo0?)+ngB#VV0#{J!EntByX%tq(b!`s}PDVj!IhHhajr`mD zBW;JWGc;|4>n?F*_U!D$>JQiox6ZFbQ;7?=4w_f;FOF4)qXry^UrEg}4X||N^Eky$ zTE@vTDW_Y!Ee>^#{>XQs)NL5sX%ns_8T~HsoOeJi^t4{7l3dC5G|RWyD$YYv?5b7X z=WHAgZ6VH?R}?q>f#N<6G5W?ogF&TSOGmcx7KI<0Ku3kFrA#>tzKl4XLs-jcsirhm zjul;-1iCjXqOxi_J6TI8eq=*7CA->l5IkhH1q#3!&^ISvd*>n%9O<Up@Jzk(v&R2> z!fR0hv?o$Y$4;48bQR13(GYXd_Ao|Gfayr$sqPBXxE4(LlM~DR*B`Cyq$HwWZ=KU$ z36eE+e-!`nCR3>>zFX6P(nE)Y>7Dgwv{D&QIRxFiNQwV-saA%!q$eE|)s4<6AzWsc z^JMXf;!6sZk^8)y4-F3w$!|@MbE$6XZA%<s+3F|AYOowiVI6RGJkb#U%?8Nxxw8A3 zRpA(cx$?t;w(wC6w+j_A<H?I|z3}|G>WC5d9{Vz0cJt3VjWlH4+x?O!YIBtuvqF$_ z|3SF!u+MVk+hM3McU?%?qcy*_DvTwgm-Lr@>~ZrVyp7<Q(c=o1;*DktG-k{=p4&W{ zJ2H-3{()8jgP~4>S;n!o@@pSU@k?SZZK4>xFiLaP$8@MxHG<-{FToJ`a5Gd5SpP>M zqD}Q^BVu}SM}Q!&eC)Q@g+Js@Iq_1dC@1%4qQUphLn8fzOu0QimeLIeW~34V?SeRA zu%Wn6-xS6`H!x!Tnib0z&i~&CTuN0S=Pw>mP6}3jTE$F9%)AISb2GI$%14%wk%G0V zWQE9)(pJH9P0j^-BS1iIjB(jI){Y=&Ct*8d{(~(kP%2_sg~vg|s4e<Y83&)?D+d*< zP3f4Duo}0fmTGS7089rbwqK&;=!~Th9@3WH9+f97h(nFP9-EDzUq-&&;SbHtAW=j% z?&nsNr`}YVO5H`~Pkq{dEM=$6()LasG2kFiEd@y+Upczg(Gj|)<UcJABjJ&5HY_OZ zFOBOH9m=Z(b=5)d>rzM>G0qCksNM*{X<q6qFUrjRR?-H8X_xDYSyKz<!l*S$Yqkn& z4)aUfgbDdAC}TWu8JIunN4U|Cet33EnrS~JX@}b7OJU?0qCwjDEWumCM<;n*CjCwq zK1DGd#Poq3hyS956YjFcW%e3Y<+p~s9UV6v7SBR(gI~8MzBcCxSgLY-m~7s12gNb} zA!1Mtv|y7+sVNW?VZi!Xv($~s67)}5I($l(VUScl19R9;F?ds%fu&z;-Ubg7=XFcE z)U!8h(q%ZaOV`t$<?i<3*aqA2V;yd+=qvefn4}V1Z?F_+&By%8c^o8JtGHqO@c9Sj zco)?4X=uo^LsdmCsWFV|10QUz58<3lA~%tF)R-!gg<RrE@uvI>l<+A>aCXx4jKD7h zVzn6Z%&JiAsK@y9-o|EAquhBmV@w}u8Fym(C|@!Ce=2-9gswrgiWPeB+LRQ>zZ)I! z)%KF1E*7G|tmaE5sLCz^)?c$9wM%p5qocfepm`lY<TpZ?irw#VACh(fzc3$5=r-P- zVSrm)ILp0x*H&YKxwKx-bPM%|*~^tPe42?#24k|h7pF!QTbXm{>h(~?5~)a)KR?c0 z%mBO-;n{;>00hXA)x_Q}PW%sE<sYDzC-^_4?B~wr7<=9fUyZxvSJY$?AAJKhs`H75 zNIY;-u;<$2u^LY%c|Yg-pfi(&rFFbm1F#rJeVX!d!8RP@GWLgR#?-cXCMvj_Xov6W z-XHcP`!M<2=#rF?$PM!dK|a(B?4$^cO%hae)ib0ak6we<svZ|7Y)4|)qsVAlLj(I< z@^To(YK~Pu^UhoXB`wklxf=J}NbFkLS%bQ!=otzP*|-!Zzkr-A_pxp6+I-kTF-UFT zaHHu!*3b3%)K_PTX2>D}ARD2i@WgxQxAv)POEY1MQI@I$Qn-#--K>eDPy&@<GTomt zMsIDlNmlkkJ)P#h?)`E%XTl({k2XGn>gnG454;CTQuF<_HFd!FP2KzC;L1j*v~VrW ziB<YonhTl&%%khXRN)rqsqXi}je4b9btdBvB^%GwE04?laq+SVQ#`uAX1|&6@TlpE zVNgLLYbx;fUx^S{dXJkC4_l+JtZnKp=pFJEllXH|qOpUd$p?rw80+R4_Z4kCZZ<*# z{iP*jt8GJob3|Ef96Ls{ZMVXO=LXQUW6RF$>uji1By>ITJm}U_1q!DD@G#7FO@YSu zK>!NmWaA0!Ym)P=5&->jQ*z;zeFn#S!q#Vn8E&Eew`f@ldm^fL*kzDmqeXJ`C!RcC zCbWaUK2R@CSpF0`LWz*3_jT9$tXDiu5cq$JJIC)jn6TY9cGB3~N#n-0ZQHhOd&jmL z+iC1%M~&Iowoae-yytH?_lNm7o>{Zj+}HI>g`()pFmaww-L=NftPTi+u}~8A`LX*# zpAf~4J8-6>h?k${B%O7A1UDx}B$B>26l^EwKsRn|A+n`a(Q!-EL|zf`IBDL0^BMrC z#D2hV_v+2gMka)Hu!s#3$K+#co4nx@neLMwFtw%H2CG_W0AtQg3*8>=)0yEnS08gJ z-udAtK&FIWmZLLAdKO)S)`_-;n?gRkCNX21EKbpKgIrrk#geN;j@+M@)GP!FQGRwP z`RIw>W25peAGp?&8*#R>g3WC;??T1(B0hTqU4O4q=7+z{t--L>iJ0Z8WIgd?=b6`p z{2(eMi2_3rJHG3U=R~rV)tR~J^542TsCcO2&?dJ_975-{7gSB9p5UARrgy|oC|oBL z<Zf=CRM>>+y4(6An_C#0Ou^>K1jXX3GFeRj&bwz<ve?e6WW0uu#Q2S~xGjsw_s2eF zhB{?Z=8YrowU0;A(JRv$$sDOcUkfw0l*K-#=hqo-d^!JEWj@SG%qZm2186t$6hl9} znu>2Ugr0pK@4HG}$G31oAB8QlR*}fv?n=ffSlVop87clv*Hm|N=1V~S5y`s<w0*&y z4t^=J4COmuUNAA)+|5(#Wr}~q#fRreRQ~nNmeGjbu9pF%`&>qqKO7h|Ooa4%aN9t3 zEY)L#%3yMedh4#Hh;!M5iMsNejh*n-3F}vO-mI_EXd!~v0l#*phSLmL2i0hwHT3Si z+f+v`>cIy)881gv()1o!2?qh)KDzeKX7KMOe$}IFHF&D`FQZ7hB<m}xuj6V>uo<vN zHtH;HS~ZM>^c?rH4|@Q0@9E2)E`GEn>hK;n%N3V<kLP8tdS4lb4s({0VxB)Ge7PF? zMR)*Uf7Km_!wh>N{2ISsMyA|2%XsiEpM5M#x*S(C8|S6?>&^%LW;zt~meoaWo1>D5 zOo*HqBF(5aqoiOdT1@Wunv`*r<QgH-z`#S*aT<95%9gz1>{@o(y7O|j!=UNT|B&sm zMrka66rqKTU>#x==RR908UTsd7`*h#6jU9$HLK%y{}T+PnJPTY@WAYegy1i#Xx84C z94Fb<EvA!%GzS#N-$frfOsR6S3EC%>Cd>?3xFa%>uX(x92E!r1XHI|tF9x%iAZE(e zI7_nmaE?tx8LmRwcT0%qc_~%;SOY$2PFz@VZl~`AQ{9%lQoaXk0EWlk9_0*oCVecC zZ{=WX($+-;k*bvoc5jM)#QK)JUrj@b<7InS#N^gFNZSnwJ`E^~bC#*D-6&BMLOuDZ z;F{d|yu{N{c@40Mb2jYoCj<?5yD#rdzh?YMe0=Y$XVP|95h2sL_qWOjf34G^*u^t4 zBS8IrY^!gB^oKt2Z@En!XbjZ0+oEw*&+cm=kpifNx`J~TS?N>eat%)u;kIY3O=90^ zV9e3-&5xMK*xu`@U@gdGF1<@#_V5;z50Cd^UKW<0Fb`+fXpLZyr?mZ*^`y+>G@pvz zKTo9X?Hj!~U+tt%<d&gcITeGpWY0H87H_wH85AypccYAbShxJ48@$*3?cmA27~^gy zs}thNq*9Q=u-O)MutEajIH7%naQGS4jDm45y3$eVEbq(WG4P0}B7LL9yWvzV0G$~b zFCaHbel!hzL6IXh<<DZw{ahGCfBZw(Zq{*N@%T)3b;w8q2*Xj*Kn>T@>_XlV?fNOk zG2W$*$<dZYydfpfnAFJXL`pMq>OoeA*Y{gBg0ZzcocPF`G9$lcw}%&*<^;KW3oI*- z(Hdi7cLBF>hJQ2GPti9!gku5B1RE|xfwDhys*2b$a7wLF&NZ^hJfd57;q}-pDMp6V z-$4_CG{iN3Q{O4cVm-);{*sJQO<_s+KZ^t{hL#i~uvw#DPu+529}gV^*GBYNh_s-w zpdK-%C^SS~S3iTF9LeS##_mVo<f8eV_WZQ0jXi54<P>NKQ9ga4yz3qBqydd2X;ApP z38jyh3xaxsZ;~&6%;TlO2bWV5qsx|GxiQ}QF%BwR^?rgeM}4<h(FaNp2t>U2V_3J@ z?k~_7N=a*=kWpd_!3khmX&R*R%i1R1m?CEx(>S(C)65#;X_O^f%r&ony(||0lRhbw zO={DnTz{gY_0qEb*ki0sEeJJ!_cm!~d@B`G6d8T|%X=)T6|#VaVJc^3?i~=2d(@50 z&CtUC02RAh=Tgn(!;3`d&W3}YMsfroJ*co43ibKgYOe)>BWvq#M*{`&NoeFvMwa%T zgkkuwm0rx0tc#eB4Ufx2!4jKG_}a<ig=l5Ce&&^oN$I3id$+T8ygQKQT3a?pIxj&7 zeF;v4USN{0<}E-l>1P<){z9}$xTDDqAq_6Y|4@UY_9?VzNcD8CE*b;2@te%^UgbJ% zk<S7-#bZr!ub(owE3r_cWl`u!MQi-fZKDe)6sZRcS66+@mMk&Fq_W9X>g_1^nmJ+_ zy4V{b-%M`xT<H`elTi~!Xn3|%0{!K^bF57F$)ZTgg7O|222Xac3FD68lvf++iuk2s zHAsy<Q6aB=NBWG5ZOm@F&}WEhSn9KX)n<#;WBsNWVkj(zMcD-vzB2&PFkNm1va>d6 z-N>dzUzP0?iTngerSJJ;&oplCY!n}>jfS^O*f+UO6wQo(94_HYs(9nVZz*f4Nb4uD zQXV53s#fo&hBDXNiVsC5>M+lz`FK)_!LEJRMJdZn=H|UH91*1`n5yK^F3_bsamWdI ze-RoRM*+Tavysw9B_>6|QCmp+j)d3$VU#__(bZgPSo+Y7Php|Z@#L#_e>3Ebk6<cH zRE1d;K(^ZLlFIe&>9=Sna{bP|MHIMDgS5<zjN0Q-a%m?d8pfvAv5aH6{x|bG!PB15 zO)p~JxIS!jD6^pF2E{`;_tW#HMNqr3{LH7mHR23Y{+>_o@^L01)M6YXMfen>RhUyu zN`oh-AuVb3l&_a|xr<=_NfuLEBVt96Q?_g$v6SZ$JX<N%HVhHSL#%HqwO9f&NB%Ma z^`97JtXa&`HI=y;e_GYfpDlnGfwV8ou?r{3G<+e2O3zl->^c#QBM>1H{*kCXUQ3+Q z?;FI4*1~u0=>_A2j-a*X>IS2@QP>ig>#XP3GFG5GOTo+UM9EZT2WJ4D*7>S99VN!I zRRm4PTgDP9MKPU$x$@+>2e(!>6er}2pzB3j20~q5_A6NIrGZSz+*h?E3lP3B)4AtH zyC>)vT8l=jW2eUf3Z;zQX=zVwtebcELf@)GJ%>Wws^t9@_w}1{$6_(egGj7#c`4CM z>T5h)S<kp(VE$ls>4t#Puj}g(H~qcnl=ZiR^SI&T3})fOu%6%EMmYDCibw_A%twN_ z?uL?bG9AjB`<*GO-DsvpEl=pDVW1e)VK*<rM`pSH&&<lwSJlX9&AVUnyW;NWcdH4& z`#r5PkG&$tK0UgY>q)7CA+*I*AQU6PN7W-HVGPI^g|ofIo~vYUcBQb%50ev*uE*E1 zw&df2jgt}-NcZ()sh69z3!ln4CmOV8<dD+WQ-=~5)0hM`zz-<QQT#2b8=~;|DOk+Y zHp#*X2GU2MZUKQtt|h5y710nTp{^y*X=AD&2dmLe4e&h6qnI`*qrp}1MU*CYVX2=Y z1>04QZBJVCh~~(05m+x1n3t7on&Fa76biQJ5(*@F_`zaU%N37j#9t3^JeTbSy$=}b zSGNI>RKEJE7}4hFTHHs^t&&-zys%8a``N80NQ$NWL!1g&K*_HIBaP|1O$*oE0Ws6Z zydp2MBfm;)cFx2lu}dRdxTex;ZV04^yJ>6pm~ooDqFp*x>!{f<)SYlAps^NAM<dHs z7i3qurg-28HOn8v6a9V^ebpJ>eR3(UwhEa(PX#g$u$9^7uLq{(ULh%|Qcg>G=PSUA z-ol_udJuCj1%avjTTi4@Oj!*C!W4@tvT6Ra4gVf4sX7{%oPfB3SYq0zL0hccatA3J zAh@#iU5fYYO>!A4NKmvSD_o|Zb&EcV=$6ykXH3(tys|Ebw8g0=vfg~$>&>O7|LBXt z2@wkw=Oh&Q!E0lib1)ij!j(oCOTO=DCPfw{W{{k4eWH~=Id#EaIkYCvy7)~SyZovP z5XP+kc6;ifstm5e;&>aI9Kp=q=WB)y;xRO|u5>i96_Zrp5dZke4#Yo)UeaT({3M$b z$*yfFpWV0lqz`+cR>Y7GO8s4MV|?OrfU{4?gC~6lxStx=O}QdY7K$Mx8*NusR@QO6 zlJ!~eq0QuHg8(~&t*6Gy`qHa)QWL&!kn0w9X<+K6wn>;$c%O<Gi#W`%r5mE88>5F; zlHSVtNokeiKt^Abn8{~lNtm`{STLG4=QNRykE9eO7I2!Cl(Hv}0qf$&BAs~fr$rRo zdPe|wlPdyc_qU~|Z~xr|;y1P6rT|)Es$Jsgy3x!_42Hv%+M%z?E=dDoqF0s$meb~& zR6s#1h8dS=+5B<+t!@HlX)n)(C+R_eR!^g}qoy6A#jrW<)t^DQ5PdE~)ABsaRNKPu z#anlVPn%7M7DzH2mKzu@Q%>Bq)=UltNo*5-JDND!kJ|R>wu$Cx*}m~zlf8<fdX;tA zdzwE<?;PEw$Avi_M-K{FK803rI-V3n;s1)1nMJn1@rUM(tleXAZgCMw%_#CD@QaM} z3+z@CAj9A;oan?Ar{1QIY;)jAIqZg22lv|y4j^oDVy5#)X{veyR7w1QLeyld!nt8t z!?JqAaxlO<3;a%{nx@dip@~fkxs`#Ekz(QxpMUHLy*ds=>v!y=M{EVLL=88n@!r&B z4$mVDrwY@S6j;k)sbHB$Y2=@WB!i#mbUQfYAe96SAI(yGoqOS-AM)`7@9Oez^x6I% z7KIxsl}K3S*AU&DAL>!k7g5asx!fx~{qSp!^B$b44;BH`4DTYI3zDVVQ5}mx`Ls+w z=&4Zx9FoJ=<WCiU!us;V@g6k-N7t%i{M^HxA!7`=CvSt~a-^64c*dKkkTnfD)h3c~ zG#s5KvVxE~nUF<OGU==jh<;VPYhu8%l~pXB;+aBd5yj=m=evK|9C?Z($G0~>z2jC& z7JlgkS{xr7K(EkBm~4-~Uiz>QFiUxY=ReJic?bEtIHnMF$Mk$Di^~0z8w(NjNFQxC z!6_kDG5%&yDzd&JrC<4SwVMg+?_nTgTJGl*5V}-YmS#Ck>i$G3_^Qm|L3!PakDRIc zO!*OzC$Th1KJ^4->ZZTXcM-c%d3oTB<)_R)YN?HNnso;};%$Wy_=)G7oB<4hL$Er5 zQ~Ej+tkSb4c;*iK`vwF8`KDM=M9skqc%x|${Gq^6Ma&5YNcIeK=&)@@3`BoJ&3MjC zc1#-Cnv2Y!6sD^h((pZBRXnRrVmmU%`~gFgPOZG7aVKsaEU3{_fM>Hdb0}6SxHrM; zQ2jewN<Nl}Eryujvw5R^U<^)20mq16*<9xj!eK-RnT2~v`6O||Neu?Y+H}~o@a3zY zO`3T`g$%eN7i^xx@JNRbd+k%QK!sS=jTlSNdXh0W5Wh+;*%QYqOr=Er=Sjyco&?+i z+Vb_;vrm&4i!~TKx85A1EEYtbT@8gAMCtJT_!`6amcun~sFyG7bZQvaxJG+Xt1<@> z8d<!UOJlT?##w!bxB^b)PjbGP;`*mjJ_eBYAq}vjG;o(2FVAzy=x6TTUD`KN6!}CD zZOnmS$ekgiw_2DcY73WpTDKk=^`BS_3tY{XivGrS_%m1N!xa9jxiV~H01w%1aHEk} z$)1wKPqH^rz)04nQ@Ybgnk<Ql1TO>kp<1|XAgT*b&iPV<R|qHiI=btqoml>|*F4nb zX%#SF13RL;<nXNJ=1ns}&z2P;CfUBEa8aJdunUfKsKio&BH4_tTeTHO1#=>Q;7mA3 zG4864Qv196rU7C#0x+o_<CA~X_THsX@y&@W3BFjXAfS~=^?s#~SH#<q-t*JO@#jUv zV>phB*KCwFEX}B{;r8$sW!6o;MXZ9iCk(u*Co(eC%?DTKF6Yks?_a@pzmd#z1O_D; z`Rc-$P5U|<XF8Cz=(3-5A;6e5=R(S}htGt;x^T$)x}tA+flss6W5LoSrtP?~8ogVi z6t>W(p<KdC(s0a%x)9V0577B{k%Dp#*q`nQ^Ro9J(waqYbL@v+l!SM(6S0lymEc)r zvHssmBQMY*ovy{}z$iz}EeWqVIDOT_Z`+x9L0Att*nmP3IY}>f7<eP)`37`rPny(* zJYVrS<Pe)~DqpRLWuA%QHi(D)2Vv4uTyG)?Hl$=J#S%BW6QiSl{%n^kc++CF>lD{| z3DE?99;rj(QnQ%9?jm19nb|WQM_qXuXBr6#CH6JoDw}A9{jEQoz#huFgl2R@9~i-r zKg&_SIVRy2QAM)s5eM-DyGIO2A$FH%o3I#_-dSh9om%Wu6wnb>$d;=rI_b*~To(?D zaPJ9>hiTA8m*5k;(Nct=%1AQl%z18Q!*NS3q1Op(bGAi>ITw0bQjv@7tjH#j_0@)g z4_?Uap4J``bV_PMl!Z02pk30#@m|@X4I398%rh1}^m=XnM&I);0AzI6jn9V^FHcSD z7}~B)A99rG%O^YuE`Ep4wII}Plfd(GQ}o>HA!y$1xTJPTWYd!svV*MqK5FbYxVRLd z3WH@E5&9u$-<XAU7ZUpLp-@R`G~-Q5>Zh_0;@2rw94i3`1lfV9I9L~JdKAPr1C4R$ zfZzM)UBbO94!FF-)NG(rz{RZyYVCMW&40=pQX>)uM5x$9m6%$^1O<WffsmIOQRN#- zZ1gc=<D|ZxDkYJlO)CdPwEpIdA;BmI@*Z8AsQ#ow^6lxzI|aHh+r+y<o|ea$O?lY$ zs8qH5M$QS*j_&(n>-5)*AIw1Ji13@aq-Gbq0bfbSP3`>I-<K6_A?b{u4@%Q4K6mIO z%;E7JvDxt!W_|Ppp*bRIdHv#^-vxH9lP(0(CFC?kW1`BPv9ib3h}Crk4I}7i4cL$- z<o+yU7&lZypJFpWd4OjBog9;zd;%!h{7#6JHjn}(zr#*dXO+?`Mi+Z9!AQqRohr?# zYB;7UkUx3O*pMk<)6*${38kO{xsAA?p>Osn-ZXn8NeI+8fpbY&R<CO)OX`Ilv7_8? zyX*9~%wyrJxOxzgn(dUR4dHrTzjER$DOmdXK%AEOV+_gB0(GN19bas$l~qxiWn9oR zH)mAVX$N}pSgnU$!MhpvMNNG|Lk0firFuE(K`EH@1Qn^8(Fr(FnY6l2#P)HR0mcXi z^+K*%F%(FaOriqzkO5KZPr-QRWY@Zvr4d4AoXf-xUnZg4v%6f9J1Dqox)FjNT*{-8 zmns79F#omsTf&Db%|~&ZjO7;_Y@4i;|H(f;AnXZ84dFuxmSCR&?#Q&zC8&S^LCdC> zHmyhu_JQ8H;{v8RV`OO5>LBmXIiy7^e(ZjDZX8R_4~qUiZT_%lYlS_!cW{5=C{UO* zd;9XwV99iUY%?w5#teImj$JfmYXnDo21LR$-IL`%_G>JRV)eBj_2E%Y57AK=E5j<H z5W`K0^U5*7Vw6W4W42U<a<KwmIQVHS`a9;|D2*am2j3947H+O>>k_=<c)jKehrQb| zzQSWU;ycRI%;O(^2<O+DOi$PAVBG>%WGDR&S-&k0c`fh`bld;NK>=DUS!!<V3mE*^ zdvwZ_UMn}0<i_580iREsNgZ2cMD1+Lii@i=otg+q6NK2)M~#)>P^4E!z)-yqa1U{9 zbO?3*t}o&v-RAxI$<3RD52%UG*H9qkkmtrvgZH$JU~Z25kdEqIYcA#gju0m%Jwd4m zX<^0+b!gGzQG6-(M0()O=KG~|z4e7DwmuoXF@GKc!IbBkrAZ+g(B=maS(aRyx`S!| zaYn3sC0xQML;0{J^|kyu?3`dxm{J2-$6<Cu#c7Pi!8V~K!9{g{cNf>1x6(?|%-`;j z4-U=!XU-h1Nsk^NHJwGX37$z@B-SR5a&*aVDgCJwyyuG*`<=2e{Pi;x4tnVj*Cz@Z zQdr4Itjd?63C>o<(Esa#WU}c&-A2g#GC`fPrh<6m+nGCJUf9y~JeXqWr!qESVl}gB ziRA+Yu13?1z`8?`dcm!`CpcxVy{qmys1NXL#-&g^FGG9(n(^07T>PuBo7!_jc7`KS zz{fG@f*Rr2Msif8?hC^x&D7rkHFx_Z_aHbXPnc^wxnj!@4U<*6&0cQTTPbwhWxmS@ zu}De_|JlN`*5fY=I&&5u_qf8AdXecb)m~k3>+qQx;%ME1bl+A_z&hSe2go5KMBT2Q zt<J<XT+2ay=Ju$K;<WO-lGa4!lwCa7=6gt+QXlNydt+q;+0$lZHzlqrtGOiSLb7s# z8`9yH=gTKlXlatb+17gaKL;kkMdO4wpfz^%xra<E%rf7RN_q(~@{spKc!_aPijT3% z;w~3rmUE5@fey?O8XWyRBi)ggpS7nxa84QJ%GBzIqS6-KVEg=*#1XEab3Ci3{k>|B zcL6#sVjG!s=MUvm{s`r`(nPW@Qf8SM#y9c0*y)yvz0b07co%ADb>evJuyL&?MZSp7 z>C)!?UCu97L)}%cyL!`+YVgs~25|##8SivzalF5*=DVrabkMpIO0)qeM&MG?2qj7G z)S(pArZ!0aqn87}(#Y@c*N%eXfOFVolH><O%lO*u5)hM5lTKyzbp#A8@t`)blcizH z)JOp%C7#0RfK}h8x*^Gh<`mkuIiAQ$ok>Z4U*!eU&wpQWt(Pw?x7Fo4UJZtu<#XJg zV^3ohHO6+Efa}F`2(ePg;WJVk2i1Aug7QO3@yz`v=6o)cHS*FjaufN#u>$agQa#HH z^GReYW*8gd-|9?+P6*S<Ctt~HF8T#o{i$t9*7nBh#>E-k@iA?Jpca-WLi6}g%Itr{ zEkIot)yBEC<ehV1ssC^%8#ZI2!crLj6kFX0p?V0qey@XgVa7{5dq`Y$R1{QCax9jK zMa$<thaSu3!Jgia%2m$mpplijsw{c5rWJ)Joag&s+Xur}vmo>mVg~b>U9p6=ynm-( z5SK`O|A{jNRd}sFVhjpB|98`ViG$79rAen0An->ZX84e%&(CWbd=Eb$S59DssKS1@ zR&f>wU(hUqdu&sSAc4!X$1H!bZSH%qCdqAAkhb^?@{)v*{~hyDFX`N`y$<HWYdyUP zyKgjagSF;4)_D(Cfj{2O3aq5+-s*97e6hh(ftxt3go~EIgSr$Hp*;QVbU`V3U%ByD zVr$tK_QWMQml~Z-lxIpVQGW@*bi-!-QWseGnAcrCZ?Q(b6%(;@0gFpc@MW;uh1cKr zSC<<WAE;1Rs^N~H;+o0oVIgd^fMltJ)8i3i_<@rcr*{1XH61PndNw)adC6*nu9REK zW#&A^@ui%F^dS)fSVxQ2=OuS0h%?nc`?6zSX|L%TlK-`T>3$p_Gf{;*A>ArILB&kp zw+P@jjaEZG(fv!1kG*2@FE#1JM6u6<O%xeEe&Ls+ZRKDz{s*ffMZ{_RmKgW$5jqZ- z$O>YtP5}GXdJ<KeY-R0(_C=qEcQMoC7}dC2st9|c>pL1qH(Q_%9_2}NoP5mXLn|VI zWM4@ALaV71_VdTi`O>GDY`{nA81szKr9)hi2OEt$w9Iy?aEaN&?Xu#TJ6G)Lg5c$D z0XlVZJ~w^@#iHT#@Y#_6C585vH9&(`KX^)8K&<>Xv@b*gq_;00^ic{6TQk%ObraGF zDDaq)yAm5SOHL2cJ^2W9`cWA%KM;2!*wM=Rh<8@$i;)+!m)JHTwLb)3Th3gzJzeIA z4O0<%ms74cqRCO6Zp29V11b2(uwf=-w<VbR=Y|s2kR^^U%l-?q-8nK9!H3fISo8v^ z=r_`<n+@m~LrijMHrdbC<{R;_F>Ou_8O2yjk}zw0sbTA*4-?6B-AU0DP1EY;xgO>H z+?MecDblLEV$;yvI)tin=k4GzFr;c8a74)m=(sfqS-r9CX&kN9vs4!Re(h=Auhscj zCh_{DlZ$fU_?t{K>RFTm&-XLUNn|CORF3n?W`J_#S1|OA#lXTVf6*+q(Unt1HtFE0 zc<kOI+zGp__9oeMRgHza6cCpXni7-%{Lw5UJQ=4Qi0WWRob;G;;$$$`d_eVd{U!{X zdS5FI*q9vzRnqb1-g<%X))5Q9*J*5lDFU&AzR+ph7V{stnHR|^M^xnlmI`C?T(H!= zqk)2lJ{1cO@nQ)0g{{*mnWs-}p?KBP&X?Kb&&navEDba4jcLd)tHufhG&bq4b9b{A z+67lv@RTf|{yV!Y$8C;`Y96$GL|FB(z5qaZVPlx>&xdp3KB&vS$2(_vcgnXfe$Bx; zBa+O4Kar@_cXH7tc`nzydlZ;f>IEoc{>G*^&rv{CM)*d+;iv@cM?N*GLXF>@ev0*? zh*M(qw~@@*_Y#t4^w=!#r<U0(qA20hg#&M`uEal)PT}K#!wwxYUUnfn<S5H(uvZ)3 z0NPO1`A$vJh{V#5`Ypt2$|W#8+QsUJqN#16!xuX<<{xV=f4~VALd?4BhO_nv;Ku2R z4`##Lk-1*TjdnV^g;y#<8REXtxccA#WQwnQu4nRNA7mVSEd4DTo?De&GF`jDJ1<R! zPQ;FuSb)=$FwAnt&obHBzIB^`(*w^=q9=(E=c`zYrgElG8n${?J{K=h<uvx0MQ7lX zPm`m9fWWq;jV02t!6{>jun$qBa6C3Z?TP;su0frZ@B%GtV*Z1>fSA0ejZo<xj!c2O z6xFA0uFBU-SRdwG>(E<baBk+65l;l~yd7s-fS_fNb-?GJnTgrU=em(3k%RT853rvF zF$j`5f`KNKI48gN+*Hu9n!2b3KL3MH)IwXKLL-3UK5iF$1}%81sx2TtrlRj42+6+S zYFfPBpBBlu2`lp_^p)Bh@#+xnf#x3!noBU0*9%2y>U&9z^PLw&>cH2H?etH0J2pcg zqSsSQ<g@3Ma}Tev^*#3WhC<qzsjEWWR|6sht=-)T5H`GwfSI|JE%N-!RmIRwWu+#G zsZF)vt#>0?-zVMESdEl`>KbnuebrqIN;VsUv`xI=XUg79E!CS8DqR3WR^u5E&xji6 zw^sXKLJu}Q9CCi{P`~AJXe!{>J|j<HO9i2%Qz1AXx-`7mL9(P17hH4%^Uj<J4+<)+ zxUNLMluFb><gH}fZ}xHce~B_M_&sTkSID43T?jzRPu1GOy<7)m6ZNP;voPjZIt58! zDBVXW^0_#SnOzJgTyt$Wyw6zTiUrxNlKcV8fjmsSywoHpJM0#T^U1RpN+<)Jxn6zX zt#Rg}?!;Vl`bBRvGQ`Zj;A;oY(f1kji3p98J1lnGotqTZ1d#y`VwpKbBhZ<|Z=K&P z#masf*7x`r@zjjq8Q>;>tDE8ayV)`l{!s0)N1#18OJ&7ALlvqbM<w9kqJBZB%>3k^ zrj!K(|Ed=|!$+13nBFVapLs}JD;l^mNU~nZYxGp*x@7eOR&Z7<`x5#0O8!f{2E|VF zbyDwfgYGd-Dw2&3NDPrv!lv_-)+*lt)XV{$!Vof}W+EcmMbIE#svZ2I@DMiK;XtDj zK1$)e(FV>HUJt(GQe%eBpdX1=K_2m5YXMX&gwe}c;zaYrj>+qaMI%;;Pemo)?P-R) zp_GjCIq00W6z?LVCj*$-YXLTHUQy=f6g}Qsqb$A%&dwP)Tv9u{M$wc{8u8;zl46wV z!hCuT1(F}%F?=Fk^B*h-{{SxhvIFN-YK`_~X)dU_Kzq4#@Zuj5h75CA9hfXQ-chW= zDcw`SX*Y93x?R(O$Rd>rgnP`@xdG*-$f@;*_q?brP-ZJ-W4dp=rUOfVO=<A_;vZtX zV%ruBZ5^U8PC&8#{n|YdiEIbp^tjEv>-nH4p%d929MBtLBVt;}W)pvrMtbH}2(g+D zG_%?v`boJd$EC6%YIh9GWfx@^H0v+A``4dvigJgT(XYDC-f+Cp5LUXUPmB{c;kNTq z;88@SSc?<ghLGD5Wl^QU9q&^|%Qp4U>XCZRwHR1UGlh6NZne}(1;8M+p#d2m{y(f0 zbRm1bnhc;ZmU5#~{JY<wWbF{bC7Ojn2eN}x3PW!u98C#@q6BI6Cv*7Ci7)aGu`T#v zlu>5Q`0+t@&?{qqJ$y9|O*&BNW^xw<`FDPuUpOT5dJ{${o<;F%y{%`1+9I9D@Fdwr z?)Af&soE$9Tx7H!b4XPk72#3(H#S=kkMPd&Yg3MyMlV@PhMCqp>la~ujebGZi~b^Q zpwlFyoYZ80)wfM7b6E+w<$=={NNh=<#FbSU>X)oWX>FvdhvvFs(wMKi)AxX58=d}E zi&7UV5Y!P+a*m#j;A3W)5JMddfsjh5AgNG|KFzP1^x=|9;8Vc<Ezc~{O%=PGS63@1 z!xp<_dhU$`-~hxJ{zLlDAtb8qbrhW{2q$RIX6&(uCFIFnlkEtP<F8fOHzn*_nCpy< zu%Zr1#aNl)qE$$4;;p$P`{EGY%fg&@8AQXIUj94mNl8@Obk*MFDZXxcE3|`ntF)j} zRKe}z+N=q}D>nix6U&^=VL+>C>QPM|rRz*Xq`2;P#%I?pKFF(hkk;~%i*bP!6%ri< zwNzKHJ8YT_nlk4R9?ecRv+`UoQn4r!dKq?$k-t>{ArBFatOuST3O7d(K<sccX%>v% zrZylDBgDGaYwOE#@#((wUhy=wVSQ3Jd+Urf)8)N7VaOBF4I&0)iHNv1xR1*p_8^?8 zIYR&!carvZR@tNtrqPJ*QKJ^+ah`^(W_Em|rRQc##AMnW0I^aCPV-=0dd4;0tpwDX zj<VI0oCh`noAnov1vnzR^R2KdiY+)2xqMr@VD^(+U*?|vbL`DC2#&3zD16h=tHm~H z^_7Qz98Nqe=gwqzESDFQ7%^Qa5{1CulqBAenZS1sv)#~|kL4;a!!IBA<<w`o%^1=C z)90GxKo%^<J?djfXrK3YvxY-Uuyp4KE1GL3Yjb;{8LH7rNQh?$Y=ZVt-I>d8r0sw% z&CkNPwB<*(hK&=h*Y<o_Yu+cKBtR7?^0xu`V%r~Y@d@d{;~2hXm{~8icYm6tG+Sdn zPxn^n1IK)-LH6lKDbH3m=Alm;WKoP#f6@9Js<?>$I~E4R=7)hMR@6~U@x*eHbF`4p z<rP*tqvL4hr_|=W<J4D0>pknZVBPKVznH{oLh!@3O3%N{3~%1?WnN?1oMXfr9`WN4 zO1Q9O?a1O@(Pl1~7Ln-quTm3x+tS9MlIWke{A**~p|E(jsmq892vy$Nh;V7=PkD3) z`ICN)Jv{UCw!h}a#aB&k*xdc?Bsenexgj=M*$Op&^NPIIhl<!VU~Z%r_Nl2^opkX{ zX$%NM&WD?uG7KNZsJuF1vKipX<Shzfb1bOsd%do4w8S&0TO50F^+_kie~R$OOL996 z-PD=zvS;J|HIu+oAko_IXcGbUhb+|SJoOK~_zH$qw6A_adO@pA1w3nw9bw6gEJAmL zn6v4&B^KDFGfo68BqSdaeVO9{TjNY9r8CKy^rJ-oeTcH7Wf(uyV&c52T|AZ52YpTp zIrdVYF@*fQh(?!t82n{pkYXz)ynkUA-t_L=^<y`LLkm0D1#;+$15i6!An-lpzLeLU z9n?g%$KD$Y9bm^uZqL3vbjM^j?vrZg${N)YKk6qbw1J{udUbGqP^#2jyh~Ag&`B-H zO^sBIFmWyKVNBm3*tHhNXmx#V5j#8E<O7b(=>NOyi>4n$6BHLc-51gLcYx0jEeEb{ zk~68|ulSU~Z-!3z%1MMI{>M6I<{#~c4s0d3gN4^1hG?twu@sxwyXHhECtT>Tr-~!7 z%83Y#HCVS1y37G?b-ch3q`_=3DYh=;Ig?hWUH=7+zUf-PrwRuT#2e@e_^VRs$)2=o z;@6Xb?iTTcZPBOfo^{rDurR!$r=XPS{t7Yx>GGjn(1$&~?xZPBsL7C!7=(j9eWt1o zM0P?WDUvwQe_o1aDIa*LA${zckF|M9lib><%?ZBjW+lA9@!1_h_0KSnr_*|e<scY( z)A<^5jcS@8nJA;&us!L@fKx2d0%wh5xq9Texd3M9gb^7Tp0$?_dSKm8bEAa9{rdX@ zyi`<8u@XBdsbtwsXQXEq;&-mA*>Z(yT`a1Nc&qR!*-;x_9XS&ms#b~%M(K*%9NseX zZ8vR9kemF>ONG+fvg5QY<*zid$>~#{AoFQo^(LW^FZ9K2+nhe%MY5+~(lL0NB3e#X z>9E^_!cSFhDd;=CXCrsDLtG_^Ll$U=blK7}FI?z7mD;<I_zpQ1F?~`Z+{XT&Oj1_1 zrhu3s9xvqIZTtPsY^;_kA6He5IIoK(-^G`%x$iB_8ShNsO7_zb``3)Xk}4wCf^RR{ zg35j`^>NdPJr!*5um~OA_%@L%pQtzybG$ZxT%w)k>(no09<D=M+@FPeJxNdzEA{+U z^<^Nu@?*TVK6SJm#zr(Rrn%_N6&3OayV}_nLzQ7^Ro&Hf2}G)P5MF)bu=ZQznVj}? z8^5vudk`5YS=^2i1LFjvcA5g^Qcm1)DWX}Uf*rh!khK(Zm^tZN@vBgW7u!$6$E|91 z7mD{|;IY=OC1!b{)GB2TS?)JO9Tv!WOzHR(ioHnSqTJe+{3qZwn|sl_A{7l}(HP<V z=LHf1PxiYj?Y10>s2ZiTPJZdhsg{nuI=5Ucb0gfOiJ%CpRXhQ-a1^(lkbh)s-wn~x zgiKZxGr?9z?HqIDiHUF3^ygd^VQS*~_U~u`{12u$7G@`E(Vip8PD3tu10h(PyeZuN zqVh+yvBll%8Ja|>TyTN(j)L1mQm02YYwiGg#3&Kyu>vLMX!5<QYdixPI7FLi#EAkV z)BG-EyWkCyu{3LT#SsGfncb56gBUbv8CI43WJo>1roptKJYU_uioLDn7}mADT}^## zrT0JNzkD0JJ!+}>3Z|B)2u?3bN%N+aTr5Fo#!{ZJet0vzjGeXyWb8}}a!!B1un_ap z7txgs624Oy;(kv~8CvPUpTOB(H((?*D=FbPxgkB(*Nv;F$))O~HF2smG`v66Gcr8A zdX63F5C|*x!s_)vh6G#a%CMFeDT1uyT=nP;id09P_ykujA2~`jO{sS>;EHZs^5F7> zQ$RZue$%HMi0RqC&->-%==&2tFuc5G#K&JVd_WfE)KkksOscdt%_H^hMxuzZoR7s` z(GS<w<_sFKdf7;KF(j)CRdCPLqOc8RJXBul>J8`CKOi|e6UI(a)Ltf1cFiQ-X()6F za#dFY_zF!Us+;}Aii;V?zT|Z<xPq6{BrwYEXguqaSC&)5@@*NN?9B3q<EC9i%g6@< zO%DXhMHnVc8&#Aqm&AOT$VooWZV#!rah?ZCbt(1V9OMf(iet5^0t|Bv-y_bkJ4~Ui zMF6rQcLgr>!>B@G6O&B=40QUbE-Hjz1L1)3_u7ao)d3=<NMxLyvrT-Wb9*TbOVoqt zDJPdwLB|&VMGW#nwHYt??tygD3FmJZi_I462FG4Lv4#Z$x194-RfQOBQX-orBAAsO z;_c^QFD0ZGaiLlFrqrF?6poiaE0L(5{Ew#_OpGcIyzK2=^I4`7-?E7+V35KDP`<@| z8l#Q-(TKDwGa5vD4f|}hPn^*1?F_%wiUx{+qzGZMUb(T6Q@koh$(JM}4W~Io0h$*{ zTW^uPRkKZofGwy{uo#RdseHJ?!II5cFburypH9*jWD`PToPVDjqVz4KzqTl5n&pNS zZOBU>iV2*9<Qnb__rMs<?=4d*w57=4rlT{US8yz`A!OD?k9E&R&ODU0)nWxt%a?L& z4wv=jo9y`^S+?MP4bp+$AE?N4P$dK-QZ!^LRr$$lW9)k+#?aFF8>3iAr-69Qv%yZ; z!jg2+t~tr3efpvm*+)3A?{dPqZ)4%_P)y)Q(8v2#dN2pE&ie7o4R};z!moU>G)Q0| z(IZC<Gm5=+#^%e=Bo`!D+B|IQXBH;t*!O!9q;nz`{_LF`Sqg8Ayo@&pX?M7*Ns&K! zkp5}=NLDWDad~x83-&fs>dwcUdb%PIF;8t_u3-#OL1tI^Ah!S<Q$OSCWTE=f=;i%0 z?w_pL8T<gBm6yJ~HAILrz*vN}ZU9SAd>FD+LeDo433cNZbz&q6BZ@qgOT6+AhuG=- zvymjKxe9-1wp=ah3i|f=-D9m{_^650QMnJrVw@#e9R;3l5lRGC4CEA};aH%v(%G4{ z`>YWgkWUQoiO!m#p4`caA9RYkI<5^8-r=orG;FB-MV|OldcC?!mdqXo5!0A>d#%Em zjU_$~E_B=TF{E`zN@lT^pWOIrx;koQ$j35dlZZca+{k8a$Eb~kJuwl~jumk>$4xSS ze`#8=qSe*UuQdoQ7*$w5RotzCUxQY7EX18r*HY2yti(uNYGZ^P8!GI=`6_CgRlus^ z`9S99WR~MnBS_>t)^}@)VE+wDw2Jq)8LIse0WBVb8c|40VwQbnLX{ePWilHJ8npoh z?AkO0k!tPJ?mR<CD2bS7=|j&)M;<r<+FLYuUYj1|HV4f8EC{x%U@#}kqzJ!mOcR+x zEZn4<i~W;GRF+L(I~Zi?WmG{!n(Cq~yvPALbJnwSJP&JTAiQT}7Ba<sRpv;x`uBR( zvj=(=`~I9A9G?-+bso7a&0@EY88I=U1jV#;lnt}-O52PDPZKo`aw3O)v8hUExEQ}q zU~G3|6ROe0hZFTHa17h%;e-J?2bTw?R*7(ueBKk+RBS_KTx1sh=;1t2#N!AW7=jA6 zzxr<d@uAaSrHuyNURob?M(&M`k6GtMlJd*jvvBd+R}>bz`>*yziljer50%xka>38o zaLmzTTa)KcSbf~}CTXPV<y|PeW3LL~)UZl+kF2mVTd&!$Z7)r+Yb8!<You&4Nq~d@ zOMp<yGO=`F?Gi|p1$^<RY(Cxn5^EnC;($d%RCi>)gD}y1Q~L}i#Di!IN%SxL(ywm( z;5?qKtJPcGx+zbrl=M5OBGCXK-V$#-KAy<rV7<>gE0RCfnHAI6FW!d+*{;0Mjsll5 z3`JlqN4QWA;`tm&qBIMRue-Rus&VLZiY}$tN817GOe>>&taF1y93q`UB_XPk+z+8Y zO48z=7iuFN?T6T*sB9ygY#mpv!tp)u#g<CPV(6iv3QtpnyL2ZZ=gs0el>A>FPNqzy zpQwxTZ#@EdTBu*xP??6ykQhuv?{Bi1u_9(@H~azMuYU6Z%gmtcIXN2Bnn?fV0Ur^H zQ9PMDlA$q@G1pRLTn(Pq_m2>6;4e<V5VzpWF6P@N>K||Ja^Y)?iuktiIn-Xff)FE0 zT$nPz^KWW#;ld^1ZT{{jHd5+Jbv^^IlVSGY;pu4(H}@5~#u4pYDj9e#7|;t1d%O6r zQC!$-|GG4``*eblA93Zw6n^Q_BkpFR!_<HuM!gJCSzRa%yDT+Xx5X_}Z`$LcG&O@J zt(@jqsO7>v*MBfpcL>?NgkImOLy#mE>H*gJ$unB?%@i2-Pfvz`Kar82(8%_TKER12 zwEYV1A5F?7%R%-{ZUawf5(99Ycve9d;_6EL@nR^0X#13auas<A1K!PgZWcFhmK>Xv z@00tHV^LOU{qreghmXH4@Bqkcz=DFjZBSOJF^RQGl4>74;<z-}@L6HAFrkHV%kmyS z0$hL&*wdXDM&lNY*lmontzAWY@{EQZqD1+#hUm^MZqs-p_QvlNH?wi&j8;|p5ItOh zD`3MPn=aVw1*#L3v5~71-DOv{UimPxax2SJW<_=ucw=%axji-I$&?4J2<~4+Ofyg8 znf8_Xe;^bMxUix}ohqQJ$ytK$EO_^YvcPLcmZy~=lo+4@C)}&f<VbhfdHz}w>U#Bh zAdVujVe^Wpu1;wA&gm*!!?|57RHdKrWD+ALSM5qGK(5iw>$Z>*0`jvQWYibr6hYgt zyE{JLZ5*K1R7jJ%%<5BG_+GM&BeAKwZ?yKaQ)7M{8YR!FS_?xZ<z!^!SWa^tZdkPp znTD(hUbH1-f@s%CgmLC>MxJ|i$*59CQ9(OvKR}KGB*A-{d0D#k2yEOU9ioxSUk+Xj z%ECU&mJ8YXXc?k4KPxyi%C*xxh^#2P)5|wB^!l6TJZ9xN^AGTXhxG8EEkZ2^1nohh zb9o9=JvDXLtDZVw40geoxHd5AP;l|6CUSz~!V)}vE)BM1-KgUxn%nA;T8%syI`8=| z4=$@5^y``75an5MFtnx<C8~nwiq_Z!38;<tMMoYpa8vj_dYB8)NP&8IomoN$8@}pu zffK`Ul1M+a794d!mcHAjV-sSf;^)H2(URiRd(*w67+)NvEkc0fC{!fqT#P#Sy$M;_ z_VV5F37tSbO(h5RB6X=vFUiwHRU-z{VfpPVQKf7kP+FOlb%YQ}658ad{13rHR<>#& zvCOd|F>`Huzb=g_`=3t#JPSxf>K?3Ked9bUof(%}lJnGm(1f%}@hpxO==@RQsb~K1 zhZE;9_&k%OoMH)oe`)wet?bMp*$(ugR0LHkq8ox@)IU<vgl)IQD0G?KU%b>6e}-UP z^v>5)VbW0ocZEi=k0fhu%9&y9i-ItfXn~MN2_r(wP!KjmYpw0@uGOit0~W4^#5N%z zrPx-TRnjt<!^67`2+Y#<XroK29c2cPmWLKHWfOwjZh$OAC@;T3*p;@~lQn>R!D|Tk zzJ+<BhlpkFHwu6$qVxNfWTbJbBHa~Ud!9K-l-g~uQd4lfqw?;eKA|`8!m$*unqEIa zWSXQ-1gT30NF?My1gA7l)qUcoArklWaz$!wsArdV#UlCUVpj6Zg#+%Jr@KH=-<C&9 zq-Lh(W=z6xl*1zpO9`*m`Fq!rFv-mD<mM*^k)0+FaIX3yu~El<WVnSZ4mlrQ3y#}b zFjjSj#Ry4uE5xlD74-w^U^%SJ%S#IO=j)(oCnvuEDl%;<7yj7R(eM1*8yQKvZHOTi z7GRXH*VJe25#&Cx+5IwY_f{lnBshC%S0au3k62n|O>u~-&w^WCEH_pP&%pK_kLgIs z=7Px%Z{tOT&0}cw;$Z5y(IZ9O_KuB6*II2+ajRp3&`63mbvGGMA}V7avKWTkk!+Gv z?=L2*>L4~%>-uNjOSZYa1f%0)pZNll-yNdqM_GA}ZNY!kY;wY7LM_n{yOh+D7P@P( z7F};XlL%PYlhg*9Iz*KN@HU@`;FWUWiacw>9<I(FYD3NiV31A$WWV6JuQPrMpger? z3;?eZrf4MNR3m^&|4hFm_p1?nh?~6RgR6VsZL5-Ro*Ee8LEk&d<l<$<kP8WjXx{Wi z1^UJtiFoxlp7-{x=p1#s6*GV0e>p%5P{3(GVwCYOGJ1+aRQX<Kez1_FJRGO-yGZ4p zRRsx?ME{{|5!M)M@dao2`wk|i8HI*pm5I$*4<G)^n=xeXQIbUY1OQblTN(uNm0(15 zuC?U8qLf_bAtOm1Eu!km`uDh}`Uh%+zpv?n5>J~a;~=}m(XfRjLPbp^PSIE>*}Vo; zxn8<+A_y0BuTGrn2&7@bw8`XRBK4=vvP_ECKEG^};$1v-jp5-W;`1kb-7$0FZ=P|g z_Oo`NGFIn(lVkZx4+lqNT1rrioDzyw>hWnr3RjIxN5f#{Kf^VP)hI0x?&@I`zWgWn z0_ylji!NQl$Q(R}w)~b34tk(L^v{pq4etwIu+Ca{k7;=I4C8u<m6sdI@Ff9h!`XFy zw|Zuu*X@p2+U4O0Y#44}@F38%kohr$Ood9EmPj`CG>z`Suqu_k+IJft{f{C1iK{hQ zAn(GNBMkV3fdgB*t^7$3{%AA->R4&=oqiz&x||iKPQ+2gH7I#aH0JMSCHJzB{S_$4 zz7Cn`a4-&uk9Ic^vC29LqJ{yK*t|r1cMs8Hs%2X#9xS)+B__cjt*N^5VEtZ@c+aM^ z6eH<J!VbY!qg>|`oc#f0XA(jjZ9zw@=4e<&OdX>{3XAy1uCXX~!Q?Jyg}OewE^@xC z=pWdFz|pZ)*|CZgp&s^1An#TbhtDM{$;&5I9f|8Kw}p3bmpZ(+xo-c*A-qRfq-XuR zpe>dQkgA<sZSfQ){3}s`|G`=K5QnE>F|Lop()ADGtjr`Z-{q^aEw1jLrS!s&gBq@3 zXz2${>c<!D1QVQ^G#3f#XF00dBPtPWj(KuKC@Dy!8-Ap|aT7a(r!8cc{Rw61y!k!W zu)+Lv)gKMAS^C$6Z~^Y&#%_~^stmqle$ZjY7J3(S5%8c0B5}-Jw24F5ZY35Ti4Ln7 zl=Ne2n#APwOf4ZY(vmmUb*3iDGHr>xe4OF2idQekT*N3LrUDEvu8_XyacmudnoK}7 z>K%Um{t+6f`l@3W+A;U!$rj2)n$OYqgJ2%IqXEdy8+X`2m6(E*Eg4js7WB}L!}+Sq zo4up_L11Bqe1BfRkQHf(iaL5JXt!t~Ik^srRGvP3#>|+L#su^Ag|tXXplohXp&Wj+ z{B(#<;{y1{C2nZoCNOd(SzENY3=kW1#&O&Gw^bsczxlYVZizm8pKncU=m}@HqT_*p z@3QA+Z55tM{^z#K5=y}8oAwl$SPY6504*yF4#cmc7(#kbP(e!Vsh(Oy8*Hu7`doMD z{&3U#4-fqy3|6-{7tu)mMwqLfV!(f9a?oe-ulav0%=&-a(J)tSZ8FT4Fd=slC?49d zqEK%Zg(E)IA`IW~b&|#s&@Zar0i&WtG-9;Y<W_zD#MHS<1vVuipgpOmEOzGcf5`Bm zSz(@e=m4wzB`A`@Xyn5G1`+uy5UL-)piNu-Uf8By9JvrSZSZg%oT0pIa1Q^}rlePg z0wQKA-*#{|>UCVM1X&g!&kn9tH7Gu_xZ(rnrokhX-~L}U;vxv9GzrJB{~e;p3U2LE zi}9RTVZ(JxPb#l>oJt+A%3!_<KV^VPAx&dL66$Q84Ot}BPn1{%?0BNsy>9=KcP78^ zA<R28W$^@<sENO2K@W;d-TyQC|G|u-#Z?~&RU5i2)C3)5qD5o{9SnJ{C?F~+czrdx zT<YBR3dgOGVkcEB8An>$g+uROnU-9+0Z!R9G~r&lK6Cv{=v>H)-H*7B;)gxz0L#UZ zBWnLR&Z6IxIR7KQ|07TqqQuHPi4?X%tHQkv(k3-sVm=iHW05v#qR9CR1S-AO<508= zXyObKXI|aJv6YhrH$z&k=ZmaurO$Cxp>@aqy_V@?K7K3Z3)FCkJ=tgw*ZZ&jP$Aa( z|N0;Pv-KY?J}zHmI+RalgXlRwAzpMbK{O1NW;n?*Yds=mq-J(+V%dSK8TlAYD=I+| zwU=^<{AlC%cT^vI@y(i<j;ARP*9^So|EBkU1H<;Gl^I^<^@nJ<v3Ef*#(u7+T^&od zF>P((f-Vd`4$t?@eWxOC0BxweFU&gXf8F`tNC^VBZk&loJOB_Sa3B4!nEfrWh<#ov z7Cy?($X^>d_6Ih~-)#VPuiuhlwPnpnP&}>X|1}yJNmB&Hx=S=yZ#{Ekf^M2_OrjA3 v#`HgH^nVK|)sbQ+%>Op@|F781LjHnT9vgb2$CViU_AjKw<V9<R4TJv=6M(ZW diff --git a/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-observe-kinds.png b/Sources/WeiBei/Resources/Inspiration/Calligraphy/lanting-observe-kinds.png new file mode 100644 index 0000000000000000000000000000000000000000..28e8d62be8a4e456a93224c2972a620452a7bf55 GIT binary patch literal 27251 zcmce6V|OJ?)MZB<+qUi8*tTsuxv_0q9j80CZ9D0>!<*c6(y=|yyfgC`W`C$vA8OUA zb7~#$SXE^iWCQ|)Z{NNl%gIWrfBOdM`rkeR?)!f$S~5=Lw{Q0Ra*|@2J_Q$nuo;$G zn-^7Qe5vqk5^162ND|5tSyVAd#gbysa&csk-&Iqn#Kh24p<yzZ)TqkRGRVYS(WsE@ zCfV570AAI8=k*;={%>EOKnX1!EgjFIzBMDE6{CY)%zl^P8$MjL|9?<@ntXUbhW<a` z%f31%gtMhP<e3NXst2t{#5>rfyo-?i4~pgCpjnEsutXOrZh1BV-nqa_3h+*L0gzSz zi~|7Ad(9`pIWYd8vt-3Vy{-xX@OJ?)iQ7E0+dTI1S!!?*bh4r7|HBV53b%X!IOwS0 zO*F;;RB=8!;DSK@JLLc3mC4rDbN&MsRQK&x8lxkCE(q@bqLLIOx=X>jEj{0rJcg(v zD*JGmg8KhdrW$NJv7i$%C?(P}hKRe^NhO4K{l9PImq43^u$#pAWHM*oe8_;!eN%=j z<6)AWgo6AJXK<l|FqUfjETJJw5+jXOQY2C+5Q#AJPYm;2-0aCqSCHrnQEbW(5D;2Y zWUdf)B}+@<Aa@cel8>M!VEr6m9Yf+%w}N1iZ{M&10#b*qP`f_-+gJY!(XE7U8`rgu zlKXt(#d-dJ0z4P}r^G>62JmqKaL;xA0$gA)1nNjlkqQem0`FA$B!(e4lp!!Q?88(e zpQ`=1DmX{eTe7H5g!<$y{fxN^eHM(q$-gWR*ah%5C9LrWHtovs^LozzNb(Z1Fs*!u zUK908Q%s@#@1-9IbI<q>eg<%nSU>t3V}Z`J;2p2|uJ8ijQ=WBy|9C$-JkvT9Xr_)b z47bwVvJ)PmN9#m*7`Fg8;4y!3P++imhtGWS0P%(CV47^3eonXq^0Nc)aIjw;^)gZJ zvi``YNvV=g3go<W@C5HL&v$+0y`4P3`kcJYEcuqG(vp!C?~$wHp?i7E3#E&$@|R!b zQ@f`AvIZwehH1N{u@T3Wbz?#4JwL8dPHD5@OoZDCMxs5>%y$Lzft|-atANfHz8|86 z;e4*f6r~S{<pdtNLKq)GaBFRM31DcS#(c4?Y|r_?-vDn2IBm&Rly7Q|65$u>>mz7} zHvW&UL#;5)5tskIbC=47jC3R0>VjUc{cG@p)E1Col$3{sOR8A}@|IAjhI8k;T!vp+ zOamT7{So`EiP1v%uJp>Wm?*AB<y9S1)d`~a8shgp#sE+M>988;9M!cD^6!n3Vi(2Y z!#BYRbOZR$Rv3<fr6j?qp&%jBaS<G*+s$!+H>sdbyZf6STGJC7Ei;+FfdE(;INuk7 z71=-?uz-18_#+k=2ZRTT;|oGQwNeL}Oq$|VhT{AIYj+MzYV5(?p_yrccV6ea)_(w5 z@m)BI62IGuihdg`e?DPwR3`k4m4JK8h@#OwMUnq0p=>~B30Hz5Pwp?_Hf|3x+E@d0 z2=od*)@tox`;ut`p>XwtT+fcF*4*bW5*wcz1b0iQbB;*f>!8*#^q`hJ2Y}9Z48j({ z-(t6hING^rdaVArh@wMF)QAjUy*xRmN81Wn1pLXq`8>(tPMPTUr#~`I>e)EI;r<J& z*P!ZRplKAC@IUULBV`W^Wraft#UGV;>g%Y<))%g$5jk#>xVfLG^bOm)oNj(-fKjUS zAD9Ud0>>9U=(Ip!3E+)|;Vv_MUK)wUW9G#+i%G2cRR!NNn%c29p5O*j+a3mV<O46) z=ermSfWgYDScqZ-vNTy_L;W!py*#7*c((a$6b(l+JFK*MY<gAG`3HBW;IZe~;*Iy> z;Y}Qejv3CA_?tWZUg2qxK=l~)Eh6k|e4*36(*$#UnHV!rsNZ%<qkBE%<H>O$!@Xa4 z{fw<*yUg8<9$o`_;rjRCwT?;OWyI-^f&zBaJd8)X90w?bRLZ6sN)=@nIYZ^$0jAoj zbF%vYfF3DXGT5F9gi3W9_HPcdA~W!txUCyilKhYun{>$!qXVOOrajmnz<BkH5kc^d zOy_gY3kj<l`h<^EAr<ep-Wq;yT0U^lx1kkBclZ|p0TKh#OW}C6NxdmUF}R(E<K3|9 zx4lL4R1M^p-$ELqd=Er+0}@BnGX*KoBr#VGI2HHQSf!GG;ay^$8VqlxDVc9gxiLCP zOR+*3OBi?E=l{e(Chh^iD4DiuTQ*HORJCu@l+j#?`31mr0Wgc0-{2!Q2cC8WdN0YX z5)_8$$s0WMT=HBL12tATA99zf_8{BpkwSA(xL|dr{PSffivFFNGQkZnfqI0WVFwWo z!YJ~+fG_QlLmYtmpAiG+Kc)cQB(;Zs&`)|0yZBdxsKO<$7x>z10>7p3ne$@hqDh$d zrU>wXSt5Rc+>XS~XHO5BK#5<Utks&ajoI&HsjqS52Eyj|@VC>YUHrp<Cz<!TsIEW` zR==;$XXPGL9_;W+UXaq2m2S9JS@o|V&Xh2~$!2NqyhZ9>hp>3PMdN_J`Kz%soWsCv zF?rd#BY1}kt+8_wkyx-OJb)j|j`C;_pW^B~n(foZbV2B(U|Z%kcq9OU50BG|B8gRF z6J<CeprF{)kIE+E>ypRvvLQ`m-DHWP#6p{ROI{iA0n}O!cRCP%xYX1R<UqFgV#iue z%=wyI;$(CpF0c{Ae%&lsIlcRiK_gDz0LKbeoqa%f2B13`l05qOFHef%K<bD>NND2A zL6?AGpB69ig7c52gzj>trU)(zdWbD9;+ZytTv;=+f@~Pqh8?i4dpEBX7`>{%?c{SC zydu#Uta0l=9?RdFlQo#4(Cr~&t&vl2WfKC$9K}SN@D7PuI}9DlBM!2an*%9@YSAx& z^OLo$Z9)>uXkmh!<@<(e&r&`*Ng+10b7_R|2agGKB`}S})<fL|=qm%VkyLWhT)ELl zE$2efWty%BQY?p8(^n#>p~r%d(GhbUwy@#07s)66YB?utbTAlJ#ODAql+@@GWxDzz zn)}EZ39|NsQddXJTO8cOqwyf3r&f27%d2wW9i>kit3-|&YB{}O$iRo(csz-n$){Eq zu7tnNWFJf@7<T>eb^}#DY_;rx@0Oq{VLt7Jkvc$LvdAr}mqnQ;OMKT;NeV_b@q3T5 zP9#Yur?tzhL<U)!jW-|oa%jOstX&$=DM^=BgG4uAkn&jmRzcQnm?#r}q1qK#F>&M+ zA9~L~kvYVj<K0!gA7vNmX~8RB?qQg)e0=34`nffvx@t1SjemJLDb-C|jcF3i_|6=$ ztNE8MJs6Fo>N9I%kUd`fo65|FOc#kpBYV_=O+mI3FyT%OZa_%^{gRZN%1`9PmT4FZ z=b}?rtz1ir!B8Z5(WFW8(5+R_B{=*tnb1n<iL7AuVGd#09Gf*Qjt+@?5zY|Edg2_6 zO0RKz!`bW1jK(jGnkK7t4`jIwCrZd!AP3iDI+X4_>~j{J6wB78PQ@V)1j0+!F;+}e z7`HTj@^VVKLs^loQaIVr%Z>bftep}#@cqOj5)T%ep4;JA128sI?xK;S@rC1nq}(`8 zk<UY-fALcH0enui$MKU!#7x_x)Pu+9ifqgJli4(b^J@j&c_<)0X@WXX3k9k@?#L-7 z_s0F_hbWW{?&HbsgCIEia$AX){OxcW#EDvePm+uGt{{+b-8X$JZxQj+sx#mC21AWo z8m(I(TFsTJVfC2{&wFn(Ha7iWW%j2BqbS?q?Hg(+r5PPXYCrK9dH?#~vDQe`R8#=L zt>T^XOm1*d(`usUV-oN(zW&B+{aigIcwy#_WtL651<k$!lS2H|T@^nCkqMSoTnx^O zJY20PgJt<bu7@EGmZfUpZ-^9PPBThzl*Wo6EfrL4<1(Yuh@z-}s=sAvA@sqi3OTRv z1RY(ZcZq9Im`%`k=)Z)v^MoI7SVvW>*P)+Z%vEswFp#ViyZyfN|NU<Pxq-~o&v*^v zSsT!AYOU(MzZ1~&(d=}#e8ztMN>7>zUjDZdGw{D|IZsTH6VAb5EU;J8)svjP#Dzg8 zu~}h5Y$>gA*|<W#WQI578NBGGKj}<K>*FmQ_X=#N9Uj|=uWN%7gc_t2Kg{NH|Lsyp z9=Q5=@ZtOmo_sm5@~2Ri;a{vyi&MW~Cx8QYp8@S8e-Z*m=?D<jSC5D~9v`0GYbn%& zg1$@Gc7oqvnfTx+rA~Eeh$0dF2w#_lS+_*BjXp-q>PTW1Yj%sS3g)CKyaGPO#5dyL zek9?-kakppkCtD22`6Zc;8=g4&VI-Wpv;KZ6+E~JqShI=71;W+OX58teTgf}S3NDo zT(`jk@UqU5(dB*GkixP&{%#b}nw3eTR8*88|H5vy_+U-h%a(5qKEjvbHZO}A?6-}# zjITe$Qq^8InkEWP@Q5iQM;GL;pD{COdmQPjs52&t6aJ*{re}_*E9{>9=4n-*`c0&A zCOWhcdya&ka2zxn@!)*7^J!u1tr!J40D<V7QZe@pmr8N`_Q_t4+3i4YH{a=cJ!Xxj z$V#Y*B$Fr@_RHj3Nh{y@bTahwm6}Is9Rr`T69xvejbkNTj74g`jFmQ9`JD44Zt9L7 zKz!J{BzZ;h<vkR#-hecA3;P4rMvg8|E2W|xb?JdiW75Eq>E33sm=Fndea1?&!3CP* zqZjM=843MoI#r~Q=lrgWERbK&igftsQ*3(Y)}`q1A)f75(U7hIA)q$mk>FqQb>tUs zHuNh6l7Wf5c=BI0-}=cS`Gj0A=;B^0`MAi(&vO@5_Ybq#m)`!Fr|vto1O14?_&mo6 zfGeb>C=DUbY*Ff9Rpwzuwmh#>3w+yUqOsycS-fxEWgSLLZH7r68mP?Y#BCW-5qlER z_S%nfUL&DedL>VL+_O~~a;8s9w$Meqori1a+)HphHmyU}_B`_QA2I`W-Q<NHVcfA3 zR<7iWR&Y4vg1))Ra0i~*eaT0s?r8L%;=wXEMFX1*c3+>1T?rO@5X_f&l(DN@Tr7|a zR>q|+;-jBg*xRXGSuw)gj|4m2#q_I}#eX1Vfe-KefKk=nD;Sk3at&I=K^e4iRA|U& z!dNCn_IEF>P3@v7{+69LDtfh0e{ruA4KUTvKj<UvKbz`$_HCbtIkf3k=U=YixC%ft zn4lppOdEOuYBlsSO8w;AKF~x{bY}SDf)X{Awrp39Xu_F}A&|TME9T~VFWm75n;;}% zI5aXx(XaAEZPOZfWXmRwziq%nazO=*sK7{syJAyisicJ%Xo~r(O7IIkZUtRv`Q3*u zb}tInm)GP&Ns2;?HU7LmR9wHduW%qdf$#bL<}ZZ`8{v@vr=*)eWUUI6I^;AsL-I&b znYy%omZx>lOVG*HKNNM`V=sWu`u$xT*~720G59@^6xsYp?NPAVq6pd1PwX24{XpEl zsr!Hv`+vwr-q9o1{TTks4;r_B9OF7JmDoHwRS+<g;)W~ysRM$7v&^s|aF>wT#j6{d zB7J^N?r=xwM8Fs~Ox<X5jkp=pW7ku=I&G}x7rW?cHaRTirDi0;;DerQnv5SM$Idtl z6QAI2AC<*PTZDwL>yU^~yF9ZdA81__H!)+O^<k9NA87Z$n5q(D#q@A1g04HTthvLP zpU!R4B`Xe8xgTM80MqsT@7F<|N3<p_HVB~#w;_+RSJM@<uR4)JSnD)w^HGDGPp#x6 zTgITGob^uQ6exJWN~L#j!HYj-48eq|5b#UPvp$N=e?=`64+8aEj1TM|`2K~}I;{_F z@vigyp-*z<N*Og!XJ|m+?_wP`RK?+l;yzF&)QDKBqOHQcm2(fzXDTp`^vG%5vI?nb zJ44=-BQyJaTSv!7*|5grsc&4XO<7Z+sVd{E>h>aUw?@Diybkm7iY%V{RJQZVu@LwS zcdKM=xEEpN&x$}*dd5te<FLLL8%E*q;M_lI-!nvkq{3z#$ptxdSe7k{&}sbo*2@&W z)99RjxkPaHUNg+MeEI1;6>zBq8OkU-e@20JnMk!h6}Hzz(;LM|W(eB1GRRPM(vL_m z7z<bvh3U(mBU57>Ec3%Yk?3=S@!;ARy~95a>PVkl^mb!8)tG$fThS=_qL_ygfz_II zD9&qcfK#Z)wWxm*MBtZ3Z1w}uu5)<qR-~wKNfX6z_bq-vw#{PN50kY7>`p<eu}cyT z@#bbe&L3AGi*xo0304&g&=mcGkGFuX)+QY}FI}jlRj9z1`<Oe~r86x^poI^MYCdAa zgFGjr3yfE~&by-2+vRmZG_4ClMGlprU_CWTVBR)v^}7^!eG`T1bG$$s72J|ZjwnN$ zY1ZLtT?`ZaQFQcWC}2l-*j7}sKY9?j1b&opRm?Aj6S%pG#IP<Gx060)>JEyh>82XH zOXbXARkL<A@fsf7B=A20q*l2-?NIo;u~*xoPWUnG8)p^6nZs-zQAS+fy!;dTEiqb- z^Iuy`7Mv4KkwuPI);IflHG0mF_(G?t7ttC$XN7|8KvB9Jilf%DwEFqoPH~&4%z-i1 zY=bg`TW=uQVv3zK8QdqU4#`igQ#a!?)Wu>G6F?D51hrr!ieIeo2|)Ev3i=$pD=g4$ zQ7htDS7^ZPlN}vjt^z1<BVtmKW}Wr;-3YqYda-B4B)P2`k7S<yU6t?oL;lZ~h1mZB z3&eKXHusSc=ZC-0|9yn`$W*C6zPg6@=E}}iyB3g)SzctuQgJ+4QK-$XCn$C=`o~<j zLxhqRp+&;|+mD2g6E;UW6$JAP7BLIs{<RWOhIrVdBOzq>YsZw!a)gZnz{MyzXk23G zVWS7tZFX(@wkKH;MQ7O?32Q@eq~!W^$M%(37^O5Nd|h!xaQa1=BKdt(NKF*T+Pk08 z<90Ag5vR>ESj95}0#wsG=t1+*l_e|+7hlk+3e2rYS5HvJ3#W=R`5k4E+5F&eL4vyw zrEjmM%d2?x$of0Bj65TnZu4W4ZheTjw&-_$7IqQm$5OMQ<Cbm&niY$BA6zq0FIPhz z8ry^~14hG)(~BFQyHCJySpL5b^R741WSF<H8{_YO!>y=F&7a(}RqI^3KXpnI<FpS> z5)YToS{0~WCUk1krD>dHY)g5kt5O%ksvU{L|6bcVQ3n3$WX+N-15t<<DiG%094A00 zy*Z-Xx<qH=?K+N}`!Gl>H>v(1^Hrm+!93)Jufilepk3DsF7hUIOkMq1d2bZa)vGsr zhA9cwEKQ7|xNRnmyYe^jz$8Ymoh)}uy1e26T03YU7r;L$Xn1}qS*8Def-M!-1n&4@ z$exil3I{XZCUjp3b!BI!E~7ooLWw11!p!v?{DsAG#PU#+%8HL&F@f_kaxPSgzu^m% zNLra*{?R)@*Cj%}qw2C7jRPv(1fQi|F6+H{y8Vk5%}EX~-6GIZcFCLj9eQOv-YfFA zrKMO7rOk!V6yVyut0OuYL_W+JpD=i0SOgy_uCR8J+IsMB+B|k5y$ao8A(t5Lj$PNC z_o$cXUiR(LcvUg?E%wM$RT@$T<{hoqydr^jeW?B#@73><U2vxB4~7G4HQJtvC8?0m zoftHQMF80_!z<3@7%-*GGbSaXqPkZ^I^2{rR?z%Rt6oAO=;SaX<|jisj?x65R!o-P zKyAGVD!-(V^V-JZQA=TZ**_wW1x*!pZP3`twY&a}nM=~mzwG^xi|BU*lNZlb|4Do= zMFp@1z_>=UxxA<Y$6fUhN2cI-=3F~vKx7!o?K{J);SaW_I>800t8F4(2cC$6C~XhZ zWDHsCJuzpPw@~Z@wMt120bqYxclNfi#|QSktCYw919;gh_e_ijWQFZgu8PGd>O)L_ zrC{*oMv_NSYb4a#GhmUU`O5(=8o6<0{Fa|GzCVTw2^nh4$nlgAo0M;*hzXf%?K6w) zE@Sb7K*}0Sp*{?zCSSDwO|b?NjpUhgmbkaTNcdxq{%zWYpl!7O^hWO1d_ALnX~1+> z-+n)2-)4{L`w@JK4D&UpKKhW~DBtVHU%j6zjludL|4PRB456_m)7>IY7-Z$gC3m_< zHLx_98;whd(v$6y+i-nkNGn3_RsMJP!G)REzJd_W{r|$AwHuWYBHAY(#uG69<xSv_ z<Z=d{6rrK?;oEf_oQ(^wgE92P!LnxneC@zN9}(<@fs|u}eS-n|<6ArYlC@H=i{+`0 zalt;!a-j^b9Lfp@o<O0E!F<;*?ahHiaV&)SPv!D$H9RcdM>z{_gJluzaXU&k>C&sx zUk?-sKm&X!Ht*3Csf*MHf1l0F&Zff+<3H-5Rmcud_E1K!OABv;S~+9TSHH`yQMwtt zgNhCDob~GzC5|4WXN6w3@c!oYjo>Bus?^~4r!5FdCf?G`Px<qW`<<3OxugtMx>5{> zn5-)e2Y_Rq5|Lh%0FSb;@n4@%a3%`)az7PD41UIw&qKC_wL)c99i_ya?Zbf1e}~`T zyQ{x8XNtGjGyy4RWjdo87_rZ+e=T<IM(lf44c@gVP3Dp9c>B#?7sPXX)GVgkO@3?1 z$_k}OKHnT~>xJ{x!z9b7bo5u)_efNNiZvLCuzaPw-H>Rn@n4q8z2$qHGlmOap-emR zUFnKTSb&nhFTV2>pv0ZTke)sO&^2zD6wa+nPkFl;NtN`5#_2cs3elS?@k!ej=n<QG znusay;H#BUUi&ocaZ0LRt=DtcB$M(W`yA<mLFijLLPim=swPJxaTu3@O3UTn<D6rq zNV*{SeW^s$>{{9&PqpyrW%{W?8y2R*cF>UNyF?Frox3-_BBu*UeW2Aza3Z3D9{{Cj zk?Ek{`V`4?X4w2iPt>}ieaxMvcN?U`HKL)e9lF3{7BA<?rL>~Tg@bJnX$kq?4n-J^ zV3?`968JUyB|MxhKz|wZZK|~5$zh8%S#X=vH@Kb~jwHSDDzdjLRBIA>@{ooy{eDfT z1fY8^xbXh2NPOc*@WPo{xuD51?1z9uYytSTFDg*1rVCbc9$D&~kzmQr-@x-q0^_1` ze8;UI!?ummMTwY9PFj(+cPKhHi^q+hi8hIl+f{%~+C*VP!dF95En=x<Q<SCtDBQ&n z2kp;w3wtFGlJwBXbiE#Y{;;;DGgD!6c|5EyZb`yr5+G3&|BaiZVhZNDw!nGt={JH? z<6wZcqF5ZRUymAq^=ayRKI{{aWVEXbx5&SosA_D^DHFc$`)h4>-ooE20I$ig*qJu^ z1U`*jShMEsTDa<evM%b3U@n?Spa1}F<t?MtMt!=Cna6E^mJcm@IE1KoP{9*uA7QPg z#Q`k81-6;%!e49BR=$Is)PEZ|sH&Wh&pe4n+B8W*;?8aE)nJKh*~lAv+@sibq_vMf zchKAVmUas<g8|VFm70b%D84YpJpF577t&i5+v4{mI?>2)4smZvLCVP~Bw#rP$8oB6 zJvgEv7)MlzJ;LAB`nlOsctX}Fj!&Nb;4fMqESdoeluPoWW$7{kTNPE1R6^Og)fZtD zuZpN|2Tz*NCew9o{0}EdqG4VnC=aW9EM^i@=%nvUvPA4Blnz;rTEj;tcb8JW6-)(P zTC&m#A`Oy#;*+{->=x*vYwIf#P2X%d1ST`MSW{r0psoP1g5&6dmv`khjE9n0pVGU& zCoSf97*`HXm3OD2$Uk<!)51|=$=z*-!(k*QSEVUv*P+>?kTB)*7Df)*p=;A;Hv7Ks zV40~ByzK-djhtva&az&=ZqlK-eYghF4wHO3(%M1@!e_B@$I@N|P8|@$4<vHojGzwv z^DLo(C({3hI`q-22rq-fUAC8{m1jgTN>q!i{c8>K;wR;R5|2q!_JM|w-`@snq8_o{ z&%~Y9aL%BgX?4F+B<B|94w)$czD9o9$PvinZ3A64A6jqbz}eG1@YIK6y7}fKEfb?} z?r#F`pi80Vt2Du8H;Z}u-y#(|4Jswp4_LRJ-uIkP@)I6t_oH~VKpt>gL(NzppJbeJ zmU%kYt#!i-+u2`R+nRl$q(Qyf<dWtLccB`a><0hpSsYq`FKR5MMj!&;FYT-KQayg_ z#gc2HaeL87^(ogcJ8@%}Bdr#wWvZ+XS`G-cG(p_SJi3|SQMj~D1Vu*2?h=m}rVF}f z!J32q)&Z0v7X$|NU?zmRiYO93(wkVrsbgpL?(|qrs;AgH^8wadNfOdBpPYduhAu<F z%<v}_Gsy-qatQ%MKTB9hK2pN9ltIt@#)DY8%Y(c)f#jBf61mzp83n~hR_cy~zr+Kg zh()YN=I4=W@J~N&Ihl!?>oJA)KS|1yMjxun%-=;3;s}VfF9TsNw3H(y!p2>h*Lr!1 zyy5&m4P#PSd3C|#xVHn)OH};K44Ex5fOk$1?fKJuBySB=x5#{Womrp`O(@Xyr^o22 zB+mUyVg6C7Ohk%>Plg@gO2bfOUm2aR!oG0~x$+jLa{9W>aQ=NLfT%kqwUfT3h^)^; z-YG73!cyJGpu`)s`Zg-8ExA@K8cdX=)3m^k`Qa{)&69<80W%|2lpWiG8?TeJ*Q1JI z*+s5Dclede_5C6$toX@^Vk>%sU3*ylTd0Ztr7u~Capqhknr8T*n@QDS((R=(`ixNg zdiQ`iUGKc!M0184>+oxG!k!Jt<%z85!f$pYbmK|BAV+qgpzc^vSTzg4O7V&w2z#SB z+;R=f)%cBjdckk$*)ToDz0~-+H%TeH!{yr0KC4#dPbBVZqk!p2bNY7wgLx}IO7Lo? zf^1yN_lqT-1uc6YRHo)SiX<)NX~<YkVd-D>ls&PqkZYWn1=|agY;UL;*PYC)yb)(v z@KP8QuML;^OQ<h;LzBmz@el)U2Z9~`oFD(u#mx!35>yI$+YQ0&z%U%`w>cO4y=nOO zqa6CD{+vxdnleZT%hlN0qoF?HN;3^xPn|Wc&Bg$hC~>Y+kZA?g^2jh|G5n%85PLkj zs7*3MI+<#OG);8>v}Av?3u^4`WR$Zpm%KHT%EgORD(fzs4CzsL=NlaJHC1+-X-X<t z9YQ1@GgQ~#RLCFd!$$83<wV^I)HX3MBRiO|`Tfprqe{mcJ+diaFtT*vbwR`%<Gt9W zOIu2K*nnyw>shMIDubq?-VS8LQ*@zcX1jB@>10vz!}*!0H4k~(N%{p0(AvAI%O$+x z+fc{uOV4EdUvokG_dma-VJ}P$g}A9I8wZa6YK;xW#~AHUlyc}|gT&+tjJ?eHF=coC z$p~wA|6aH$&NZ@-D5EE&{&F=)eySmuv+>1}6Z2D?d&KhpFTfg*YWF137p2bOCEqZC zW<~|PV(DHy&4!dYN0lNMvwq$<?rfyh3Vx$3$*8~ofN<iF0Zvmv>oxeoMHaBqLu`fH zlZh5R$dwzP?*2g{At0pq4VlK$iryt4kyKBuWnb<kmdnO8u0e+9zNM0se<Tz{d|`PA z_fs2&MU=3j(xo6AVvWKfiTTGNLET!~pjy=9PYTTiOKr!Pm(l}2oNC8d`zU1~$E9P9 zM^@?&H)v%6#_O+aN(9dSS@D)#VZ@1SH9GBk9y5`Rhtc2xhN9FcoOeU)DC;yu%j)01 z*!%(lu>m|2xlhU$S5*`{XpB=$oNEGu@Nu{0hH;2@>-e?ELgq)5D~%b@R0y2Us?H0A zy>v@_2bGAY?mqF#S#dal^YSH1DBp}@d?(Lt%2Gb7;nf%+e!23kXqqiy2WAw^yW)<6 z^`@*^fn9jeya=!uzCH()wYANEA$$pq!WTV+!iKH&uvSx4y><B3oyY|z71oQFZ2FGa zCTmd2P58>;h*<r_p9ZFTgUf{GbDx8|m}S#gF1z+dph}EhQDwOPOC7M$)c9DWX__EE zeq%w}sHjy@M_H@ZZ{^Q2TvUiIdx>crl}6l_Lh>7Mn;`4zwL{!iiLk$Etm7iXa<|)z z$YIn)E6obFuZxl376EA&f)2L27khc;{x)*U>fz{Z(7&wAk3e)LDc_tHeI8mpiW`WZ ziv9&v_I!eJ-kC6lm?Kj*U8}Guz?271P7*xzp{fEH;5Q@WP{C61h1Y;6j({GY%c0zA z$qHFn5?XPh&_?UEg%g?$os7^x5*h~+W&kgM6K5a;e8D!V)Zmb+g64aI_1-IIjpBKM zm7@6XRqwX}K>LC~ydC!`t<$a6rnKd)okUC|MbIU{c$y<=Zg&#CPkKB_QkHS(7kO(J zpn7?;vvpP2L9bq_Gda*w1gP@GC2fr}y2!r-@?v-UVvA4)9)>0uh_unTGOYiXNM)=o zC<=+nk7mhC&ofUZpP}6brl@WG-honVBPajJw~Id}^vB>kp~6k|Zl}LD7P{2iUFk05 z;SMOAd{$X8nS1Wyly$(l{b^YnBU_>bK~B0kA;E&mzOd*rIGu>D>m%2fjAy)0-Xa_y z0>9it1A3m7My-ySl6e;9AzirYQJRe65&S1A{z!`M#YC%@mL6aO8G3Xj;HDy&k@w`< zhgK&~p%eAytCC_>SO5FvY^bXt)zmf0L*sNOuhFbtN_ajC9=jT4jYVZ~@ok^rnQ>QS zQT!JIa;yj)Kt0m96~=6L%1t)FTRg2MvqSF+4@Lz<0spchN@e$0;rTA5zg>$^R=KK; zS}{xh6-d8~nm6k3Dv(V3WBgi^+$dwnUo^>UhO-b#+|4~fu>m_&ql<?q?hPqrE|vZF zB9~9V_%0dV^7^2K6sj`15em%+R9#_*{8cy&=67Qp_gnsjgG-*hZ9kxh7-BMAZPDt# z{)W_SFFH>1IHDsWH2L8!V^789$GDF|TN7HdpD+JpzdHG^&9#y9o~y!+h*KhLtVBhm z0)(AJwWGmcVZ~>g%5lAMqMu4*DhF5(7j8M%6{<hn+jCb@BQAb5*%P`G|0i1ok!xL| z{mXl%G>+H^`yL{Qx!yEljra~O-vVW}f66h*K(ceIDc&Kgw-(K?=LSdaK-?t{gO}fy zy?t2XJ`Vj>FQ&k#K}FoG%KhA1+d3A{Apw?HfVua;$0Sj9aG8SCIZmzJ4yZ9*1?O_~ z5S(o|CiW9IOBl-PuFM_9Gr}b=#Wngpn0s<+Gf;M4^RhPlvj_$hgH9#k_7{8RD0f|4 zZ5}JR)_++djG+%V;6flv>K-KGE`n>(%S(9C7{FVEMTjR8A86y~tl^<t%)`H&}5i zDoKZP@+~dGf+O9dF>OB{#OZVtlwW!q=Ib=@4O8CNG7E(U=FinNe^wdpkh5LYxE>r} z;XBdA%UdX(V-z#x(6M0F`mJl?Q;cgIv>p+Cv4Mez4fnmjg-=I8Bb-E<T1{rZsB#9< zg8V%_{`_8G8lpK2sst{Upb**SlE1Qy*ocZCWTCP4?hIZlYa{%@j$m-MU{WZ`kMQ#u zKH`wwOlmxx`61DV_Ls(t=yy6Z4OF>|28TY9ff`Yt{1P1}*E;AcAtD){@`9+;bRl<% zSx(hY7DUzq_U5m@dQ>I!!_R+ygYee#2CD)-`4g^6$z8*#BX+Fsr>8501BlC?C{-pe z<O15;t*h>XOt(^|o7k@d`VZjg&jz$yu$R<9x@h|TLEiQAR_prXr=TGI>0adtdo*>K zR#->!5n*$+JrO~FUvvry59MqBr;M)sg&2W*0m$s+Ds=`pvFQ<u@j^){N3ufQ6wu*Z zMZgu_%|C21OCO#hmM|ikFDr@CLLSJlh*gYk=B7@0tqftr5J-T%?hfvLPLd?uCIgjG zD=VePv};5fEXH=U(C7@t5MV>nd#J`<NZy~8ZkBh6uzt^}kfQ`RNC~!OrZM`#v7k0~ z@OW5NZ&R|T13j;;0Q|c3E+Q8SG3)l4M3$!D;-$Y><|K4U^lf<f{y9C1zYc@Fn+Okm z2?YxJbM%sru^<w*7@+5F`Ia`=Hsr9Jh(o`Zd1gRLGZNAZ2|cwN-0Jd^@&QZ+Fpo=( zl)r#4dMApV9H;)-P+XWla|mM;&ADIBw^J_IX<XQ?fq4BgkxwB?fR;Y@d>+)xYsQLW zQI8^V?{c3a%^$#J_zAVpALG7j^dqvIkpo}GPu%qn-I%c!&Z<(>pp&gIEizz1{G%FO zy~9s99jc$4r$%|Yt<VtKh)YEBGum%wy6Sc1PJ+I`8yE=1ELz-rqZNoF)|tg&F<n$M zTvr?Rj_$)xiF+@1`eB{9M1j^V+sGgBqm`CuqRTdko^Y~crSoN5+>i866oP9Sz)7qG z`bywuO!-dSzt04(+Q3X~dDr@grKW_4R${DXjN)3IUtAN;k?z98%*@VMBS2xKyfHZc z6VXPG&osD#KjAxX`kB-I!SF9GC@*uQzK_;z@C6Sj4M@#eAqVqBw$WkXODVKvrXF{z zNb{r`x;czSl5p-i>F3&WAB#yhg1R7Q^*xQuSkll0dy@|PN4z?&)&mxxJog+~9_$#) zwJVS$_i8&`4g6S4y{Z3vsWcmOl=s|acjK8AJ@}zhSb{#zuW>L;!11iTm|E<5q_(*d zNvdU=Ib(aLeyPA?BpS2gEX;CAY})2_D}3jHMhZ3LlM4DxpT9uB(N-w?)&U-^S;gHK z7y6IaL1l)?1PPIoTtsMI5NI^S-4I1sO8gSERT^<_DW*8au)e6lPO=p8)!^zCp3?n| znH(q9R9*d@##o}2d%yF<{#nQbEmEbX4>mKuf4Ys5Y&`?*Z=s4hf5ERBLE{rTu4iA+ zbr2L-mJ~^)J=u{eQZ?``|03t!)4PPiaOwm0KliplVkIzT)PwyR%?D?;NQ=(mKV*^9 zOs5e1)m$F4v6>{m6Wmjq$}{`tf<mNje!pPz0i*9z=9I^DpiB*kZ5O<Cf?s7oYmq=f zdB^KcQ&q1;T!v{L=g_%_lV^BmMb7AX;lAUY;cxkAn>+!vPG>=kXjRQ?`pt=h0=4&N z*oIg&f86!FlOav$(fRtAjXUIC?4}RVb-HEKHTdGR<4!8$LxnxRr$zD*$6IpJC8ePe z${i=`{K%DT;EmAA2Z@P&k==;8Vq$Lzzn0c%f~{%5F^?g{-vJ7)po)Fk6i1vZ)eM6i z?a)#8`_aVv76lTC64t`Z6tyOgTr5})x*qW&X*x75$x8$OlG4@f>7FHFU9E6&??3uh zy}pcH6_K5U116735Qg#lM@r96fU+MmPkA14W)FJvXKutl2CaknAmFQBx+otB?_Iy_ zvb|<Dj$3fBwDR%Ou?MlvM4for;M*T6YbP&%<qy*%d#9uirUJN$@md><hROJUig6>B z_cE=~&;eBB9`mW%DKdMT*LH%8(@+I0@r`8h><Cb&C*E{#Yq7a3<g4!RJ6_LBene~W zO@*aWcTNjodbT`$bJ+CUn)+-D-n6<xGdt(-S%Y@6W(33IHq+=Va^>+y9(s!TXnXI- zV&`$4b2<?rNoWYT?_}`X+bg^(>z8uN3)KfkU)-Z)5fy+WndvM1_USVEN~4~~FQYWD zrAZmk6Q5y3MU1oq)6BFmo+PFx?|YquP;=zlaR>WE+07oX$@vpm?*SN53x|PL-{Or4 zM<h{~88vsaO%%y1A0nT+L<LQhy;APJ5oAJrncr>i2|q=fYHNh3aS%)3FkYNG<aUsI zNWk-{t6s3mSbKC&HrXwaH@}l}=KmQif;xbg$kux1<AlwjUg{#h|0;!j2Ht1cTL(qD zX-JYVdrIAbe^%x(Ajmx%vhED{`n)XniYSp`6E7<jVBQiK19=X&<=N~?#(Y;>ITUec z&l{W5E_+DKPv1W)%r-xufHDnqu^TQNaPmpPS>F@lrbtSxCb~k<&ig+kL$n~z#J15R z`G`0#r|=t<J2(#N`i;Hq8f7k#Few}H;}&_+>uID*b?~;46WHMIZ2WsYvU=x+W0^Dr zIizaD7oN(UHqHal>KRQ<>uAWUkQFJ~lLy&bHAPDwA=t_@N4Y4c0<eVR3k#_raU*|L z$KvEB=VR)(sQ%q9o4j8RP!&4r=!gTLswB4$*-B}E267pUc^2D$F<y5ga;QuZs!bin z^^0QO*Bzr|55WT?Z3J0lj*RNVt(3q}r0_|TfTr)g;Pr#RtK27g_yGCR$k(^i=Y}X6 zSHMkx+tOxSl7y1ZUm7>k^Py8Yn^Nl`GF>{4%zlcB)%M&AJ2-YH^Wn$=wxSo9fS(JI zH97@7kAYQZD~55>JC3z%eSA=%WlzrHu}TpQN{x~i+@x!jPUjqp#nT5KKJ2*ok&j`& zh#}$C`os(#8r>QnXc8mA!FG6oZMT#9NA4={*v@e$UH=eq!4RinnFmVj#zE7Gbiwl_ z-iLoxpSuSfZ4=jj#5mU`Wu$p+l6K&2)*`g*1CS$sVYQZsPMzpeqj%CVmusJY(!5;y zy0bW{*B9;bE@TAaR&i$hK0c!;!Zeq{Q;EidaxhL{G71TN<4Uk&c6AuPbC~QeRIQdM z{e$I#)i_S+k~{Lc4KGC};J2n7&*#D~1l)mH*vX@V^uzaOQV<#EGg_s#Ipir7{vzf5 z3^D5`8lB7o7RFVo!NHu8FDztq+4-Ov#JMt-R#gS@_647tmbuu8_e;U!vJoAcLi`Jt z3#Kda_{0GSW{dyx(mhRdCZ~t6&X40enA|g=6X%&}3FaL4i@USNvaDqtx)BM7UDW%r z6&ipg2<x?DUBVn81nk&llHOMPQ;Pgz;|Kb~<`e0&CCWVLW`N?r(mYFyAa+<A{8^7E z_XU;}Z>2VU|H32zbn;`Yy$Jc$VgM`nsk%Po<>c`Hk@LUy)gtV{@6}u|d(;uZLf&ej zt$Sm@5ebF<4oiC!ne@(1E1GpRL@i|(fm|x>oqpn=H3VN9`na9sFa*>i8}SlvbeIh5 z8<d15tg4SEEd8QP6l9&=wO4sooNo5SREI*CwEAz1V-!HuRp6Gr02KJ8jJ!X)Pa(o8 z?aI#L1fwQ!OBv)GF~P~+un<R@GahAvwfwWlANMsGkW7|{*DW5oZm)`yPZ{iNaxeZ` ztvMaAq`P%Tov<;PK6j*(#8arfXAXXD&=`&)xzLk%f1iByaLwHwMldlx<kGbpDZYO5 zcmHIgA3q4nLv$HtwM2e{HZvi_?!R)8-p+OFq#*}+@S`N`p~r4J94(%)YgJ<1ho0No z+yj`zlh`Umk;RNg{AkW5QbgLf=IUQm$n#5gcx@8WSo5Ifj*u!T#B1JUg}2Ck8s^Xs z`{U+&wZ`Pr?kUmM@O2G1(S_yhK?WCvS+!AfWoZBGB|;n*gq4)n*KhWCwTs<(Tu$tX zL0&%?Ewi7R2hqAB7ejf?MXvUjA|KM6(<5+Z1GDbN=<`1>tFA45mU;KiGTaU|Pj6}` zI=Q0gH+s?+)j?ZGP6qcM166mvvd~kL<Lox9($EuQbSj^h(bzPuF8C15byX-pKIgI+ zghD~t(Ef>zP=&v-ZTWhVEu(Y#$@P~^wyD4qYb)E}LBXV2=z4sFp$@lFr4vayW$_wZ zhN|3C;!&!=y}&=n&3)AWl~OI5m-^=lwmv_xcS*G*7bp$_{ae16hNd2x#22r06s2EB zD7tcRSLwm2K_QxOMZYQup3X$6@Of6*pW5J?5Tr0K(visegvB(Ar5H}4$eV{SEd!{M zh>ztC*9JKqsgc(LmHg;Aqo+B)_(lR>;fM^xwJ-@bb3)og1jw`Hf`2vm5`etuKqHM9 zj}b1!yd#r*3i@@b>zglUlBJ(@i}{4Ud1dR{FBNXKsVk-%86wU^FM<YBsg5xC>2yM& zc8Ubu>(=imzOHs}Ri>Z8I<s9z-j>fyXN7fywMH{vP_*UPhyyE~lpRXwm37i=OsOb) za#!&^*+el^a#V!;^;Fmz08KR<v2Qdvcl<4y%5Ldti|n)2#|I{y=>w8D?qy1?&b>pn zg_ZC>`{RS(n!rq5d_?FP=(v$_1raEDRCX`j8F8jgi2HAEFq6T8q*?(ABioz=kO8(o z5N3JwWCTP{9qxVy?n@cV^iJgkPcK}f>(pPUPZHggH78(80Q-%B=OY%uxpskRUVVu| zyvr-U`<FWv$MyRbf6zO5eufCP*WG-<6h2%E{4s07%eNnO40-t|ti9{pO^bJ15Sa1L zWvbtsy4sTOb!II6@qG$Kj$r^OhGcgPeoebzM0QB24fS6ug`SJH=uC5>i(``?2w^*3 zy5@0a^rv!CY7@7voUp@~zkXkpSo>%Af%$PZPRZo-q)vIP2sGJC$Vlq+|HVR_D4c1? zYv@2wxPv*Ln@^1$vd0M_tz2+poN>+xBK*{L52f#^oLE<RL5i~7lURz7ekS<t%k+3| z)zXj1(HamXMJluJ%p5*=)8Z2&ST`S2TQ$5b%4CC4-E?|Us->$ZznA_xePPGc-;w%W z(_lx1B%SswL?4MrB!badTkctdH-<@^dZ^Abp$7+kjwt;QOao+<PV_wn!u_#9OWRxZ z;Jac3DcYWF|Ac?6TTV_m_!OG;m&UIFQVf5YptHKI9eD?YDI|9<eOfS%&K_mihP$!L zKbUX?cIlFp+XScKF=w?sr(rQ_F{;R}+ohG7-g>I#T{q8s2Eu2a^~WPPAz&d+xH{3j zX-EZ)2ckS3aZgs*r<%i&hFX-qe~w#J78SMcJ$I><J?e|y9ng^N1PLwEr(xX&mqh1S z_z>R0F5nvNZzI0oHEiG|{CTiO!I{coj?lTsi8y$C0$p$f*DrZ|m-~+_By<zXALO4P zm%V9#4)4uzd2VLZM^o5kT`<0XC+-bjWe{=ZXp@A$(qx5Yt~>3gX5^jZ>q4!jrOvn3 z`sK4m7h)*A>{-fm9mZ8VE5BbUDINQJ7e4zz`6pS}7z}DW#`YlPWK>0f$xhTEr;CH^ z@MhuqD(8Jp9`>=}YWX9*6lk1{^yE0>qz}-fe({WZ14us*(-K!=RbZ4IaxM7Ckz`8e zA!l~qHktfYQ2hskoKZWC^ToQ<=M-`?*io>XyVfuI>k7KW2O{HM=U^-V(`eEqgpK$I zd2Q{mm7uUnW*b85kdIPpA&-RCChql>fW^u9qi<YK1`=`dRn>S`vJ=^iABok@$30w? zAoTf9EoFr3$j1|S{Ei|O07jddE1rxWdB6EEP;UAp5Om3}Qj!_8prqRGm|MInq<wd@ zCxVe&-Vif%g1O$D+Z)b%u88(C^7>E^*+?vT$L@CbqDkgwab8Y0nUfNCXh@<Imzi|f zYym1oFdnGpqd@w${ble*1ZUK)6YN{ru}u!8iPPdg%9hNuDS?zoclD`aeSu>RdU8|| zOMKW-Klxa0DGbyZT4^gan|#EhvJOJcLJ<(N!7g;7flb2s!%p3-!jd(jh%){A<Vpvw zNmYtddH$AhSORxFN%YDtXJUCFABajn`bqVImDtFhFP5jwhGV%EW=!?FYulR4Wn}Io zzNbFY{1YML5J2`Sbrc%6ZCYW>0Ij>U78}>!zf%lIz=wYjP{ldBF~=*?(o1htep=X% zr5h#;B!E7S$;sliA7x^F0s`RLd7S16QE}uH)#RVsR(k8mX827ECDei(xNixvvjX=i zo%BESB9IoxyYG!1AW-^#8_DYKAr9zV5o2%7xZkUgj4#>efEN_7$g7GEOvG<VxsHBj z@0NLWt?%uT{ef{bCcWyhou{gU2{1m$Wb;~TLq>|OYx1t={k=Ieg!ts^Bbcw$nd}?W z&i;bC-{p@78sW{7ig^8R=6$D$DAgZ&FG<u1<{iJ2abLNd>UG<<1;>RET}<3ehM!)b zg#TIhnyCM{QV0?N?iz;e8p8r_t*58xg$h?=_uySBGr&yK=QZ^5fPlgmi|qV}ZDtL9 zcwJYHdM?5f`ON^V1Su-7^S8CIj$e$SgMY2{wUc_AgOBb=EoffdH0!t4*D3$$RRTFd z*r&fkEq4;ldo%U(f^86d?}+EdEFXP0Y&k^<w0v1A(Nb69heOS}^~KW5CKOK32iPPJ zs~y@zkDif?35f5;@b=!QqU8pn-z=~rx^SoY22jcp?&_H>Nn)Fl6!c8`71EbfxED<5 z71<mNN4ou3pK^?iEZC*xqyFW+Gmf9r-oCsOu76$4Z6t@G&wae!MYP1r#r+cR=Lh~Q zb5YdecDQ@njew-qmXMu!`XMzr+;1DWgta1~nhINDfZ8yZS-GAi?KZVO7IRbg_bC<8 z8(UpCV>Jzp$GnmYW%W;w1rZKqo;W~Uj{~DC`pjvahaw#$gd%-<oWn^V(qBeMntdfO zpPpu6MFW4Q+scu9kgAdK)i0=Zd7fWEYDs-^TW<f@UOv;Lm6SAv(6(EYI+Vj`R*if> zeB?bAh+?spObChVgcI!_0E78KC#aC;+E;>}!KugsdDTW7y%rS1^X*FBci;k7(o7$% zrbcc464Xg_*wh^u*OH?;X5Ggl**ZCpza*v9FiZ<)M}$1o$g{S4c1rBc@Otrq{560> z!cb#cmGLiA8pHNLYC_{T#+FC66QeWdoVMLHm&K3vqrhk}w`)9tG&ttV#hcTcSy~Ba z#p~nU=Vn094a>b_=`cScv_|^iLg*mNA-HdORG>br1q*T=D!!ip+L>!v(#JmDIN98Z zB%!f?WQ&N!hJ)p{_7{xmyTjmq?gc!tcW#{T`AZ3tfcS8am(U&OZu-lP%D8ZSVl0Ve zu)x}93)$g1<!bfqwv1`N9$0I)AHlW=;`lC(7~;q(mOiJk{E5j2V*9N1%e-O;{Pq*A zkVOt$3~}2_E@j9`I<)@}txv9x3*Yz=CE3lLxs+>Wzs=X@mJc;q_NK(Mmurar&O_W@ z47TvVY(e;_?~9nDm^ZVkx5G0fNGndFhGsupiOcNAOQQ#nFCNHw=ZDDg*CmI_(>aev zQ6JrxfN%<Ytb}41UC<&Ix<WOae<7FF&35;YoGWL<6u5tuJ9x7@F6*pb5S_3vE-c+D zX&r`Dv%g|vEKwb_f-&^)rPjGi;iQ%<>i!<BURo%<oUy1IrYdTtSl3%=xW_18G*(01 z5Hr1f^1-KR)z7?;Qqh54<k_EcGbbeJu3{%~!x90qme!R%>idtHJ+bqS0Yd>?+P*Tx zbU#B5J+G$-E$iKaBk#~S!0thSk<a@zbwz@3TRU~${c9IJ`BFzx`xJ=HroG2iq$FMv zMTcF=+RKHx+eogfgFf{YFQaEC%m}{05S-ytk+NDgW)SCj;`T{{o=WGj)o~?79?pF7 z*+CJ7IdT~@y)kkLStZ3;ndM95<KdvY<5npoX;Ii83fwsoI{%I?i~yr2g;s5}|EGHk z(`d<yBu+5Mn6lvq25^UDJ!}DL-ct};x@IIu=hoJQ@R&+Kg<p=I+3vr_8f-)TYmWM< zV??tt%CI2P$@fN&4tcfJoeWK)*<WV6__5*;h|(hQn7#eEt-*3L=&&<()oNj9b*E@z z(~;LEEuF@hy*+-rt-W7;oSOOSoA3D31;A&hWOwr1*XCYcdXMRaJX8#fhhw)5B*9m? zDe{Rz5;KH<)_OL3(!-zeox5XTZ}UIY=ujVj;JL|M?JrnqmCPG5TvyQ+{Olp@w!|}L zdXWH8+A%nhrj3+BFq1!3&wygLl*x2AQ16LFH^eISr}i|gRt|Js;C=Mwl8pZ<hni_} zP130Rlx`A*HJa#*^XHYCho;F69G^2?&zc72NjaAO_d^=;iD33$Tc;%bQm+Q;RXYba zI5%&}AsrSnwQUQOsL4^yh0J-a(G4}c$CRc7D(c$>X08nXLMlW3eq3-v9e`~1MPo{# zpx>VCGQEPo7u_Hy8_J~#d`VxfW5j;jq)S;4Xz#xcrP;*fvggt=i<#xMx?lrE+OrU^ zUtgphsT@U@=mq{bDHcAAUEB<w2yM`Vh{6S$oR0%%Aa<t|#X;0SidhO5C8ECvHns5H z4(g;-%8jfhiQr=O80Mk>)!SKi#Q`i~IuP6$26va>PLSXP2<`-TcXt_F2MYm$26qka zVF(ZgC%6ypG7xNY_ul;r+h6)?_36{6s;la)#|nnO9sE9gqQO`)<9bI{-Pj^_GSDJQ z03&>-Xw045nW?JlEbH=t1j7V*+szNvB^3@4pwvl#$)&z+Gi6mkx3dOAb3GVVFE_I2 z!6wl(x<x#wvIl(bhk68LX|LZBQ89r|s`yZ>QsS5$Bh@qN{Y^?VO}0mh3=;S;d>78| z=aZIdh_LQ-M^%#Qb#c^_a4QGkLsyuy#{_Gh_mC^K86v4BAwLFk+>vaF<ky=m08{QA zBd{zn8P>?xm?*!C4>-=TmE-B-O5<YD3Q|&n3Wx)`e|Ia$zl&v7%1ej<Wh@`%^@H`7 z{EgA6euy?wOQ>?+5e;>9W3NL>2ndr*^3*ZfnJ0OZQ&gc3J*&sAMHgH6&B^C6HN9`H z-Fp?jG+1X7JU6Es%-$qw^i?x^@mZo>c|y~@i;yjFLO*X$rz1a@oRz?`iwUXQ<>j|L zLl}2kIQye|B1v0ffx@5uTFipxB0lBJmrD4u6HkiroI}mSyc<_(Bd*@0NVbgCq16u= zUKz1F!<xO7S*r4Dxz<;R#X(B735TOHD;UyAmej4KG|N)ST%Rhe=BK_SAA6=jHrdPu zstZ-erAV>Vw&F&;{eV=(mMX1=t%VQYyTU*9a&CQOPI7zb<S4RgivF=(r`o9PUv`4G zR6S8Ds+{KSX^}?}5v*+9gOtT)S`P7d-p>;SUav-g)}pLag`8L1S^p9)460x0?5AyF zOIO77EP0)GN7*vl+kqwYd#8R^^TK5;aX4MUN~4P^#~9CN_2z4-8Ll*2j=Hb*RPU}S zxrDA-fQaxP?`hmRu&k0uQee%tG*5RP6W41g!ES=f$rP?vnsMRV?#-LM`aIU(ruwsS zzczK&D4e0*x$X$Re7eJ2^v_7QzodUkLOOP@iTsAQKIi?Ay2ORd4=$&2NcQgy#@^C; z8Gu@9%p#|PIc3&MBe7r-7MB{vHH_=S`$-Ks;eBg~udcQx=MzKqWLlMWsO}1C+ZL0n zZ;^?ktjRm;_<X3poTx?+vEpvaKRg1UV3S)6&KdFD^;*b@Gt0HjE;r#%HgN>cwpu@$ zdy(F53QEY*h4d;aV~vhgrb}7{;y2J_TJd+dF1Zte$A=LZ=VcxiPyM4nw@D7W6T#MO zhD*xCEONz|76n86%NzQ+oGoV(P>@VWKGTM$apU<cH=1MeZBbdKnr>QQ*10`te0~*r z9W(Qz^nMX}V1(rgXVYeT_8qNU;y9FntSH|a`z?=`S4Rxil_$N0bRsw0kpCwU*2)vz zP&dPEboY-*nTjFsiXhQ?fhWUj%FaFdm0fwsJ&ePi;j^l~4^0svN|7<MgFbt>`xZB< zSCAX_>nB5&J#Gb`q(0i{3GUG=;wUU4cj~8Po|(L7r)C>bzA{U<*L>E;wJTg$lq&*n zpe%}74M2EZ&+xs0ij<Vl(x+i%H)|gnA4=Z<1nSgpb?M0-9V@e>`40xiO3g|*638dA zl`~DdGJP>{DzIvV^IQHtt9=x-A_o&1wVEkxxG$(Pr@=1R_V1ybuL$J#VhvoUeF8U0 z<O}B+&5i@DEgGewRckdQ`$H>!RkmyTuCMdTW@`GibE9m>dM&LCU8a1jS8(&s0UET8 z;KKIzo7Ob^Y8mx?bNq6gH165^egF>cyoE?eB>H%7YVgeRcHj#OLlGI}^lYKI4u{$H z%PZDc7*Sue6{oTy!q!ta8nRa%$ij>I;sG~HOqT7J>h9%9)b8W&U6Z>=ggX*C!VK5k zueUl5!uj=mjkq!&>}zFpV<-ag<fp33a&9<Mqnt}!SIs{XD2lr9r2crV_x+LH<3LW{ zXNiH}KbQC3=8r<MW0nSGrmy%mj|(Dg%hjm_N&jO%=I?8l5BTMXw+}#jJ1U_sIpjfE z`}rAMK{i)W>9Hhzt^yBvmcKWS*bGAAux<i9d<p@a35w_uQA$=!gGf2*^@CYh#zXBj zL~HA-E7JCwj!}+6?4}XHU@s~D2vkmHxF5gAAe9W~>=Gbg3Da_g(IjHLh`}j2Hl@7> zIU=NH|Gvz8l-__kKR<4?=z1^xhPmY{(-c1r2FXfhq1!^15i_Bedo4{9iy_85u2dTZ zaBjfww^-%bO;my5CoNUN8Ba!}CSI5)b7~K{l$i+&pV(s5)Fs>YLq%)&Fsv?z*(T~9 z;E4zKI8dn6NxWMM1{pzrKM4Y{u08DjB&NFkn^9o!7+FI&{bNFEOJL{Psq`+C7ntFe zTmWatA^y%~(kkv|C`+Vg-HA0ikbgl({kCL97rz%B3NPhmyZsK@VmeviB#yJ-z{qpB z%vTDN^+_zZfQt*8eFTY^8kGd3O*>m~!-n05OrqqzYhH>hMiOVr18<@ATP+==lM&{2 z2_^fFGvJI?*Xp$P1gnjQJ4Jkr_|ctXfF`DsR|8s_NVka>b=1iZS&gNb9(@zX>rWmt z981hb|B|;gExCe?*dTJ55+n9wvg#s&;MzMW_P}_NtCBa!<@>;12Q(w8vApB2{YyxH z1woy2mJNtv2*`d@u#a|3s9e8IQ$@?HT*%nhlpDEqxRawaMI=@A{iriNxrW|)F^RS1 zD%aNr+}UJd)Fq@R0+^*jNb<>kJC8|wbe0;Fod<ujC_LdBJdpJN9ml%!`_{d?Ca_g3 zWoWq_CooxoE7SAv`BlY3#)0FHhbG~vtkm@NA8gzsYqX_Zsm?Qn<Z`meD5P*#+!QVh z9$3eZwzp3%Ow?BbC!|y&zG1s~)!UbA$}{h0MeYQIIi!hnYf0@9`4xj1@!Ax`omm1J z`d*^H-$c@kJ9ABGzC(Ze!ezG_L~v|HHpBmiW|edwBLU@W=XcxUCg+*j5r0idRl&xN zgZzkz>$<6Ph-I<?P1*e1D?rm=YyioK;3Q~k1$WJY!ah{AEC2p=<+rWfx_d#1@s&W3 z_4#6em>b2^8lzrG>SpkYhO~tdgJamAB~A17A^GV3%AZx{rfr2RXc|rscqMA`#w?l~ z76!JCpv<3?wB((HpH-xZa`m-bZ9gf3BBDsZf(e59QhHxSK4FZ9pkO+Hm=hOc)%V<p zMjYKI1}1#IJ!UxmV5uzMbyCP>Q|G6GAxbyn96wuDo{{B)`@ij8_V=KKKWZvz9k72% z{?+qGD>&0}4h0&)mwA-K_ZMZv#s6?ekKeqr-S+7V-n(4r=wcAokf!H$woL=M#10Wy z9Lt@r&zU4vDSda)UTdD=YJpLXOmX+DiY-PxJ>$foLO)27>?5&UTz-=J$|OrW8JE(` z&z2Z>(nSjKh#;<>h#C@CwT|pwbMc@ybKlj#VC=g`i-HSL1$uTh(w*EcL79fGiN<WB z6`{D<sQRrOA8vJ6uD}!N%_7T*T$)gC8R}!)X|K{PnIo<gheZpko^hIT2-v@GPxJ&l zZcF0&vd+BuJt;+mB&SAH(`K@LFjqXTHEZuK`$z}?W&-h;Bv!`m_RG`iDR1IrK=m=* z17A+94fGe@Djb`&fiTE_Iu0YtspSRe>)Q+K0Hi2E8*2CfQSx=v+E3Od2F*cCxYo8J zg8NYqpBdg#GR?gZJWR+(-8HXlq<i}FF1(K-BM96{8_CQQr;Do>9oI1IB_hCNfLevx z&jdz+06{x7(K?eEa8K9YfU8m4Li1TI>4OY$st@v^9f~@_f!yz|Xj~&dO-p{kYk_Pz zdtUUu;_*6Ljz&aoS?e|p@%ZD!Td^z`e-ao@vI5Kcw2XF8jFgfhMf;bY&iwmS(iTK+ zew|I#S~g0J4Mkv>*W1)d?JjWusXM>yp~O}>VOzQfmN1tMyoJ-u{L?78nX<QS{X$=s zi2lxUSS3`Vxw3j;@K+P}VI&sr+Xlv!lU?~(bMT8R;=4EPHs43sk?ImXGVRH*e11rr z(c+gJSl6nuLE+yk7I)qyAaUjfu5zDbnq>0N7}zcG*!?Z({hlM4wKX~gL78{DhB`Gt z$?$y_<hzm4^@h*DMlHGVxh0>>X24YT7pgLf(R~CKt%VmC5p8u%1D}M8*mt89zHXN; z$QH}!$n*4!(_J!lb#JR*&n<2pS;eoT+Wm#1A*`H>5MPb0Pz+>?+8ues^FU!T{j|}v zd#o&ngNOVEgs4<l#Dwg;!}op)X<I!SC;K5c3V19{5c;W>N!BVO%=y7kPnaIWJQjW` zfm;Qw)*qAWz+*MHu%kX@CZq0y`yo<E<4h{5lZlWBMkdke<NRyKVxRntsHhJ+4rOpQ z$e{5y;|hW9ZrcshrevX4hqbtU>xo?za`wuJ>bCc8On>oqM>-3JUYcfxCGTZj2tuRF ztp#T|4-SLKnk>FE)Is*B4VrYvN=<$^n4w9h7{=vC`y6~P{WNrK7+6;svopeEd$oOf zY4}6&?Rw<IwAY*rzhoC<X87?%ir<;klo}i6hbYuLmZw+bldW5GI}v-F0zn(L6d!?@ zH~Mwb52CmaSx-)9JGc`hV&7V0>xn2s{k7aLRQRdYMOg{t#Po@4)>NNN`ywM4e>oDM z%gHfs!*&W+4Z)z-td4pLi9k!%X|7EX6HwH6pdFCka;p~8_Z*33dw>QVET<-S$KpYj zA|*#m$UdZ`(o{(yxK+80J{q4_^9{Yh%<!U1UYg*{pBvx{8DBmb@vD1td@aU8ad+87 zM9o8Bb;`^eI>gO|vs3R_5Lkhlk106xgsVxio)tXmpD;x7i*mY0F?>E(tOD_FO`)Of z^M$DH;esK$cfXcf`^lqj&Hg(nsxoCBsf>F0DLx<K48@d7tM%{(%iPiUFV?t(a_hjx zkP(uO!9|?6?v`vr#ude@BqLc71<Gl#cWA7ezFJ_&Fp@X*y+7_w2wPnD>bRd@_Pm+) z6Uu{g%2vmWdgW~k*-bzD;d&p?BUDeCC1vOIT3*BV@}CQH9QvEfRnL(FHArNcKK}D= zyuZ5ocxvq4AySqBCn%Y@@Uz~)aR&@8UtPGUG0cq`J?VH+1)~W~2Hy@qz1+~e%{N@Q zLVZ);9S@;#M0Bf!hhOu)=N02Tjwv{g3^@zFPuwUmrFboqQ$SXvUnYt&#_eYvl<ytZ z9ArHz){#p?<!mymMO9T(Gy9oQn~`H-a=aVfXVp7oYfwi|#G9f*`#EJ$5GmK~ikaht zPmC%#myxw?ef3zPLZGio|L~^!88x#g60i87(w@IMD+>_KqfYZdDC=X+JoExwN7y<1 z*r{mOVK*eK27qG7Xn_Zxd+l|&QI1*8zDIQ6sZzN5tQ2e>x@spjqCCKrtzNAR>Te8< z=Ek*XwmH`q>xbJ<#)I-%x7W6Ep0ez%w*$F0LRr?EhxPZN(o4(gtK1^9jr2^WF2x!* z?}m1Uo7Lht%+zNbD?}uZ6mN{XH;k>G^NG?|MsNL<2)n=M-1Jg<6nF9nise3tlkh2y z1n`XnBIVlxv2HIf3~R$eZ98;h&PZ?(FSPtv)#PxF>WlIU-ZdJlb`Zx+>WoG{A;dni zwL=Ik7i>%;j;&k`at(n%|7ow6S`9zY60ux|%SdC2qPVfn#y=fSc;Ywx;vuP?yc1($ z-_Q(qO78Cl({=XPo_OfZ(SZe<{n;^Fk=!xAVXPM;AL2BCSURvV8n*!9p2)%+dU6+u z>_*)w{nedAOV7q%G8MKJaBr<&xd!ZwPxTg9f~l}d)$La-Qvzj~fi<R`+WmzQXF6EW zAw_6}+pjnPj-9Ofy%P;oUh{&ghNnwcSDIk&og^J+|8d(Je52)EO<~}bI;*V+!L3H+ z$;9%Uu<c*ITPE$Ju6EOsJf>RtYQmg`d`Q2HjrC|1k7aSbK=cCB$3B67KBST2Nkac4 zPl2bgUz;;0h4p4;!_*<+=Mk3FJQ7h~<+GBMmQ#)>Qp4MBG{=m<I%EcL$9q9&IXRMr zA0aGqr?Yfd794w5=pfDkcX^9fO)Vpo7nh}|1@7}B7UR~M9u069yk+Z_(vr%Th&sF1 z9_+lXZV*bVd*D8S4beZLNUzshP^RD;%xNklN7}IRPW6nG2)1&A9Xkce$U3vPERwzT zJ_RxcpQ3IeD=Yrh2Jj1oC{LjJs~Rc1DX2N)Wmavu^G2J8SS2vk3~fA^cv4N~&-M{( zN@wPg5MK+4yVfA@?%B5=h;HF`kn`Lyr*1T&k(;5U*$F{x_pEt(;?HX{yWV3PsUOXh z%|jm_QMwBqx0k-|Uncrt5cT(nX(P2o7k-h-T)p$a(uujeVAVGNW1?D58+6Cu0idT{ zsxYev6~SYV?%p;e<VSDZ5uh4l)Xa|;e0UO&%+uL2@ESA9OW+BiW&BhK|A^3BL=miK z&+XL9i&K$*hz{1qtWC4L&lbsrV*|CF5G?m?WU_@rS`H}17IqqNml+s%iTu9{NtOKx z++<};x9YhF)E9Ze^<#y_&5Zk7Z3xi3DAnXceDe~573ee1x%!*oJXYJ|EMtB{o_$Zf zOsQw?G?JN0o}1zVmPz&OwDbS2G`+|+I+oq%Y8_i@_0PHm<*&z@1;b=X0|PcE2Wg6I z#~P}j6+b^jO$HZ*Z0MG_!QjL^qGF<q#4_eVLI;l5@2E700@Mf><1kr{M~$LWYuQIX z_<P4SgQ19@^|^H2+Ue9YI1*xwRw;qLbKpx8+Wl%n`f7oNT9Vf)?^&<~ENN&4sdMCK zKsRX=h>GOW83+xJ4ZfaJ|BQFeQa`sHjM#b4@rXfBVi*hRt|oW~3E<QxRdPze%jxv$ zx@52a%H4#!Vs;jCa@n4#S)(q?*)K9`zskEOLWXYix$9$Eb=~+OP4}G_Li7otlfb4Z z%86syYi_*(`=U3{#Er2|>$&$lu&RvB+j}&?47c9_lc!A1O~tY4)m@zpyxop)wWUul zBrGA~7a;gEFN9`62tEX40R@_$P#_Q4hKi6f#l+7QGb2G>3)p`xDB7Xm8xzL|MSzTO zGqm(EY@SjgwhH$<dk?_nMvlH?a2>$vTbb0IvS+4KGU&E<+f`mZae(<)M}U}~;Xz&6 zmjL?KkI~QQ{?tE|dDO*AOVryEhbfu|+P5Vs)F56}{O6x(VM>2<zwt%;n1a{q4TiqX z8NADGlQ!68T)Z?Msa|9rRTO#<M)Y+UgxO;G73Zz0BQ>kAg^(nH6gEaeOs_sVy+Hj$ zs8ez!S48ZR@n3)czD5U1il-(sv6h%@5Wt=gYIr5eo!@a|>%x7D*i{wQ2hc~O9x89@ zwn{s6+@*Ev0~^fyjztU;AO^R$!goYQvm1g6#_p$~u@WY|D05GJYHr-01c6i;rlpAj zD{ZotXS{5oQIkVDI%A<b?d)lIYz3`3G?&|~_;S0vDycjU5%^2is)h#C9c(+P$^z)} zzuBSa9Ip|2Jg6xrZb6Wuim(+F6FL=9gEW8zr;rXkGj^O#vUiwOQ|W}T$Of<C5<502 zU*n*NsM2PLW8(fg8Lpu0+AJobt)g}<dY*|AgANrm#+<)$1YbDHwFhSTH;4*xXw&?< zdyRCz`JkierhM*U_qgQ9P0u2iVhwd=yyM*7@yoG|4GOc8id!;PtSeoa<b6l>Z?(Nf z<U#x9?}}zK$IRo1XVKhZ)Jjlapi(*-N18CBi#vI`^hy5v(a;k3$N=UA;*~rF+u`J! zW-c=1fr3|A!j!vfrOrRIzw>EVz^RW5Z%gGEr5cE}YNM0{20HHJ@Nu+<&&g6ObFOyC zj8Qlk>mq-6xksoM7C)r_+8fPO+@$)1AN}bgr`&+Uzz7#3q+XXKDX6u6z;e$qrV;-R zLW0-e&7I%1BQB=qZYnm8Xz+^5$RLON6J8sBzF}Nt7_9OwFqM8-JF4ZmIBqJa&XJM1 z&g_b}kHwzox3KE@3rYR^eU7wCoKs~s(qOyHM+qo}1oYhIg}we~euBK;5AAW{PtzH< zg|`f;`~{F&{c^p5yjYLKnn*(mbomOGxiUyRVJgN|Ta3{P#bGhn{qK*Ci-ktIN9>yE zJu|OhoO}r?`UieC?bBa8PNhG4bdQ!{RNIC&i&#gK--+z0>2Egn|Io{mxWDx-8XUDg zpiEa2G5Yg0TmonCNEq!4|Hb2%A<%M&VQ)1-IzE_QkNND7zSQ8P952L2=3*wDvt3<{ zaG(usEEdrt?&hy1?Wp@l0+yUWDK+&1y=855qnHm@ER=>n`%?3gVTs82j)Q@=k5Po? zyA=q7=kGUGwR9__co7ln)x&3rYTlgjlo!pt#~#pYXu*hGbQr}fiTS3p<bSxOfct_9 zIQpEp-xxFVn88GzK^1+Ow4(eC{h2Ravh-P0EjtC}CwiHJ4xjXx;N{BLCFggIhG{nr zbR$MIRgt1LhLYZOPR5PJ0mmA`-g$X|;wnkUzU@z8g>A8C@%##C`bC(U?5#6F;@UJT zvf!!TS{0fAS2(0Qw!o=Xi*sq7WvmzQyv?^<Oat52q=utkrCE_NzhU{#6nLe?&SuVP z^?=2B;4Ed5mYinJ;{CoRruQsJ9E-B7wIp;py+FP?vo93UUwB-SG)XQbPf%kH83MiX z*Zm+hdMoVreBv&BqOqW-KtB&)ppCIqb^6nTM%Tu)pkjzC0OPr$u}cGSrqgk+kbKnI zV=2=V&wH;>T`V5K7OYd2Aazj}HJ>XtePozNPgU5<3o<l2agOY6vDw|P3F|fx)N6Hw zyO9J3)m57v+S<<!`fre~yPEFhWQw@YKTci;Q;f^V!K!$s?cdKjTEMp|q9*~x0bPSs zUf4x1fF`;0<=NP;*vwV<h7S2I%k!41UyJhQ-5gEv#VI3k!F1de^3ee7{>;=PcX2W0 z&n3KnU>UZwKkr;$)3h?!QO5IixC%{(x-8YG5K%L#r#fNJDq&l7vXk&`u+)6{sAbWU zAt;4VUT#<K@-`FXGcoyh2}^{ZR!EM+T>MHglj*C6>Aq9a4IWZ-O6A0D@7Ijqd6Kr> z9FJx$$<dm+@cPLePdjgSiYg95K1(sT=WpGIWgBXM*A4@3u7*+-fc=&qc6er`g3bdd z@8!j+CduO?-{K98AK*hqs}-CFx5XEBz*->PsN_exFvS*}(LL^Nk61+IltDhEqMOW5 z4*{bu{8MlVO<XVCJuhEb@=AZOA4>@2a;Q)L`4;k2%r!b4_V?k2i1!B<wbrh?mpp)2 z;H(a4Xnp$3Fye{-<ux<&Pf)yeG_F}JbbxPCI$+Q-)@A|%wI7ANkSuy>8G$oD&9m7i z2WD;vV9Lf@^^idd9=PTHy|5Bul7&fLpS5kTKlsN1HRuK-d&`VcLtXQrkQaxG_G*{x z2<c{cv-U?l(G3>V>L)t1ipy*e)58lQVCVeju#LTAD&by6Gw~j?IC>Y2V7+;k7}A)~ zv<rjjz}16CW7V#V#)G<)*H~YHyxlHz^vCqf6<xkH&LG{ex8E~2OO7=yRu0W>aTYa_ z;`K0zCNJJ-t~3<H*m64LaFOP1YxlJgDIe`@tzAGbqwfPo1Xve?+V@=iLgKPN&{?q< zI)kF7)7*l7A=RUawX+emo&69z2a|*x3qUCv#1TTF{$wcUw`jn<JS5(#dX2A|89l$~ zDtEwb+!Re*s!KrbGf&zt_o4|D(%qCa^VLPpqrwkCX@%w&P2%|1{``MAht%#)uTHn9 zfaI%3B8O!Z7bczms+T&3adtm~7)xcBrvv4*NnQx;QDw|2YNN#}Z7(Qr*8d1hYwi*5 z+9eP8`VPKX5s^7#QUvyW*r$bOW+X9)8}kyS(57TQHfweYViQEQ$g?V`sv`c{M%Mo7 zDMW!;FuLL2q++y^C5`^rXAm+&QU?rRfZV7U{n%L&lzrEf(m=F?TMtE}K;05Yt2h>i z4Bto|aB<Ma_M)8ArnLV}w<{Du6VKBfWb%6pH{uH3Ac}X)(|@xy2a--8p9XAlr1t3k z@}2!zhscQflgv4fp`j03h^_jPeH$1?WO48~SL`DD$HaH?2L2v7_jVf8s-3apZNk_0 zqY&Ie@)Of_{9IXX674fJ%SCkmls{$QFe&fM=|kd&2%{i22+HlP30u}hPR9&}jo`>C zK<FjZyM-Zcv?>z+hSE>a|GREld01#DYCg?I&sA6SVABTm7KCv3c~z~pA}E+<?<;Hh zYnb=NXOW_T-eg-vJw)-VHK>#ib`(~d$E3o7P5d-3a#H~M!ZM=Y+DpO)?x0^H^7Oap zYb(l|#VZmht~;)i%zTpi0|AY9<mGbXXwP=zM;R%jw2zG9c@CQyfJ{vf{nTRaHBU9E zf<}lLM;?v{iG5^ZBvV{_<@64>(6t)|_O*ZRu0SULJxgenwd~B!SO=p<LVQ%-6KCtI zH3!>ECy$0uiN~=O7S^@9U;2tA-+X!+=O|qYs4SAO!mjFV)Xwhu9q0`yB7(qMX)As* zko;i$Xxt*lZ-=5l1L(K;0tZ6T?mKblpIylXdT1D~S0zNCwgpjT?YP^tTJjO2yC5{; zBPAOO7KA5;erKT{?4pR68}BYrXU<c94zPF;WvTH<Ozh^jGBE}AsY#`uq)56-3I@Z- zJhS^c(CTrb6?UX(>5np<fIu<FrS%VrvsK&{w$fh(hK}VU8I$f)vtP00v(*rYr3}|4 z)6Yy5p`Rv^p}=)~XR?{X$0su2H%hx=)`0U&I=5Bk2|m~_fcQlK7!N3gcQD|C=K4Y& zXho&U;D`Lk#LK>OAxH;Qy(1E590u_1pPQWn95)To8G6XCd_UVW%BX#+&U-VnKF&|K z(U^v5rr%<bXVU-r@Yew#Jh>*%)W<v7e_2bLJdYeZBTnbJzC%V{RS%>{&=%3J&cbe4 zR}0@8!KlJ9u)8_a{^xJdZ?dCoQG3>j@N*qT!UqFMUY@_A8)%^Y5iv8-WG%us<wSfm zGbn{1ck!e3ci|0+=qFN_gZB6t)Q+2H&dxos!|X3QgS0{l;C_ovB%{R&HO;7CCpE4& zaNYuOT;Hc_KnROByLRe<#Dx?*Qam6!@QIov=0imL6yK=r591qhbOWR_i<2(%e-&?~ zVwgqVXYs3YLL^Jf(G{??Q>P@LPIf*h!&ZyUqr$_Kn)p1<F^cdgGi~R6*>&M?LCm6K zAP6QQ>9xg23c=~lXYfTis|98RzSi&LFGmTt_D6~UUu{~fRDdbYZ`A6HQ3Gb8<?F6& zTxa@qf{-G&5P~+i@q~+)o4}s%Hs;qQ58TI9>PWZdAsOIIU5pk(Rd_p#4x7W0XF~2@ zBz>u_V#kii&lzK#`J=gm0bWNs)2YM2pDR1N%$ZgQgFB3P5mHPUo!#1K0^^P1@1#j4 zR5c8rLJ}y@o(5pgPfN(*K8d?Y&z}diZr0zU)jf<x-D8RwbI^o~In=H(^xe$|eS-Ax z4qKgDTchd2)E*>L7QA*DoSB%3DpGAtw$B+UOk5=F$Uz4Q`5jk9=u~|!V&`Ibca?TD z&vYYJw6GDX@r4Q&oBI{f3mT_)hm4Bn8Wy{|8_HrEilysuERaimwZGyjG|#vhV9d&m ze`7f(S{rZ_BGd_K6nq9lYP{Yj4CQQhd_Nzk7NMkFV4srpO{1o?Or}quyQeBx9Q_Kv z2>y0~wp;?C)3m*$*qv|o%lD?mM3KQM(<u}Ey1|&5-Yl7uA13u$Ws5bF_){sY-~%Ra z0O9oy($pp5qI+w$1z2b7zo1o*$m~|=YQb&O;xo=f4nz%mc=yhM&YnG2a=1612tgwp zy%9lrEwZqi`Ck@i+->ADkzS|?230&PC*LEbWJ=ZI1F#*)XEeK+833eBeFW?0EnIf# z9tUGh-hU>Uecea*O#H;Tcby|O^(RH;8fin)n_xP(0ZZ|wY35)?&tRDYj!#Jx@<t3} zC6d2}Hw-QW2_<9zGwXQ%HME+@RBB~b$0{p0W*B%Rfd+C(>cMrY&04skf?wi+A-`p` zwjF-^=GlHYJi^@NUH?MXc|7=Q;5vRO8H7FCN`N>k-zgRS5`P0KX_T)rpwT!YaYA(6 zq`VlU{(70}x0vz>5@ZiT9mCPyS|=t!L=+-AMQeY+jn+G}KzkxWdwrF54+4!OaLROe zQ<?KphbLgL7@>Riig=6$eDCV?QB0xtKHr(T7%C;k%jI1FVA*rxDz_XQa@?o#$E#rK zz(Bwd+y@c4M*UELXO5)nox?8Ueah~8B8$K29P*QxDSw+FKDXuRf=URP2l#2t*5rN; z^$m+tY1XD7^cd-mdd>pd4;ur4%_y;izjQcq=v-3-q*G2wb<z%V5{@5xOag$$9Nvl1 zBDYs-UvS@rg{eqWH;J1gog%#b8*_knLGf{&hx>(zR%lAFRQ0j97imA*64)*o+3!*p zwrt+OAXty+p$mF^)@Bgm>)X@3>^#vzMA%+k-cgL#^d^9duqDQEMcfCoU^GDdI5Orc zV=S4Zff@o-8p`Hn7&p4;3e|`O4gq$hgnVw$#OQKx4AX}<9wwDkYARO-fw8F5f}7g) zt7NdAzXrDzvJME7i`=`?;1+|F6;q9qCNN8@yyR|?H=R}!=q2Fo7+M><gEnO`B<q1K zaAy}jN#hdulVp}XajNlfoM$EiTf()Z<}@s<6G#Sz>^o#+`6gIMAZNW&(tH5x?NtDf z5uz~2^9-$_k00OGHV<6j)FmkihY<C+OW@{-mp8oq)zFKlEg&^GAA!-kIN|Syl_X0! zWBhO2j!s7jSPig8tus68jp5->g2H5AqwvbSi-f3)jzWJL3SB|+>-;d_jV8uii(T;t zCEV@KoBlc+3D9duE%J{`qRuSsYi)mA>@R|eAHrTdYVOMNMf0N+Aly<wzayT_L8p;i zIzVY*Te|YbqrrO2{{l2OV_XjnXr!1O`PXymZ`lEWMAMFKp*6DFSMgV{_qvKzQ>FzH zvwF~_w%v4m#$4Ma_pb5V07E2F<JKcl-qGW6z^;Co>3Sbk$|QB>|Kpozrl#-SoRc!v zP*o!zFz(R+<ryg88SlXT8tR#d%Aa&))*(7q9g0yn$av)s09bV?v8tyLiTuv3IC@}4 zd|Sp)&O2n4PKiMvH@keK9-W^h3W`Ts`Fr(iaz|`{AfQun0TB@eufphuOza%fT>8Ws zZ3jCR0u!rEuRMqJKPdrbqz7`!Z5~I8iMu;tn&46|8W%tur4<;a?a@_iaVP&IN(U(g zD6PZY62qT^1^OST6WPqE3_~MZ_|fA=-{NYZeVFk74>%@MvR+RVVD{k>L`|yNL%m+x zVzt}dLcP`Z_50DTaBcBJa_wGzz_l2I`RBq7{CBj$>pxV1(!ebaO%KC&+}%7F&;7+& z9I}<PEbDNZpnR$UEtQILYh3Lf`D<!gkn4X~Fo=k3SZw!22l4e(thc?lG-?ypH5U%j zxykh<daG!DAXRvfgp7+u@0aSZCR>4=Naka4|2isy?RUk4capmax7ML7ayhnq<NNdP zFV}qa{m_b#|1Vren?$=Uw~+p6Fnc&Onno>cDpr|R^oHV@s^CFlIhY}eujG!QPI@>J zz7UTx{egeWFggaee$!XCx<ID{w#|R#`CmlOoOpO{Uh2D%s!>$N@~To0RN}o14q5%d zM_N6`pVZ)Z_kREt#dfbQ5Mtv0NIGGiNIlx)J9#33dAPXY1<6E|b+Us)y|O}9cE=jB z6|H1Qs^U@fsruA=vH!Ic35lQKW7b{zMRD6*Y{-k@vOz`~{m9r*#rw<mYRZ7XHS@E| z8ML^Ye~_8~tmh+^f`n4Gbj6o{A`9oW1dvyVf@pGL@fWDVZt>Ba;SDCHEa!i)K>v6! z+DX`A?2@i+6r(zrIF%_M*TyThz0kt5;^`!O(I;>7Se$w9g#f}-oTkpQ8-)L(AWbz) zy`3V3Jz*K&UeADjXm0S4Y}{6r>u>8{FaN(YhGG3SeNBu!sa_NLz~&;nE&`A6JVOfd zrE&SMkq8LZg_Y6fUUyiS!yNx(6#f6&`UMzXaB1geXr^b9LjS>}-YCkc%GODnMf@L+ CK!HjC literal 0 HcmV?d00001 diff --git a/Sources/WeiBei/Resources/Inspiration/SOURCES.md b/Sources/WeiBei/Resources/Inspiration/SOURCES.md index 631c91c6c..afe197ea3 100644 --- a/Sources/WeiBei/Resources/Inspiration/SOURCES.md +++ b/Sources/WeiBei/Resources/Inspiration/SOURCES.md @@ -1,34 +1,55 @@ # Empty workspace inspiration sources -WeiBei bundles the text and selected calligraphy alpha masks in this directory so the empty workspace works without a network connection. Source links are shown in the interface for traceability; they are never required for rendering. +WeiBei bundles the text, formulas, and three verified calligraphy alpha masks in this directory so the empty workspace works without a network connection. Source links are visible for traceability but are never required for rendering. -No NC, ND, modern calligraphy font, or license-unclear dataset is included. Mathematical and scientific expressions are typeset with system serif text and are not rendered as calligraphy. +The first offline catalog contains 19 entries across six fields: Chinese classics, world literature, mathematics, physics, economics, and philosophy. It preserves at least five source languages: Classical Chinese, Japanese, English, German, and French. Formula-only entries use the BCP 47 `zxx` tag because they contain no linguistic text. + +No NC, ND, modern calligraphy font, license-unclear dataset, translation, or generated quotation is included. Formula and foreign-language entries are typeset normally and are never presented as calligraphy. WeiBei claims no copyright in mathematical, physical, economic, or logical facts. ## Catalog -| Catalog ID | Original text or expression | Author and work | Reliable source | Rights basis | -| --- | --- | --- | --- | --- | -| `lanting-clear-breeze` | `天朗氣清,惠風和暢` | 王羲之《蘭亭集序》; glyphs from the Tang copy traditionally attributed to 馮承素 | [Wikimedia Commons file page, Palace Museum source](https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG) | The ancient work and its faithful digital reproduction are marked public domain and [Public Domain Mark 1.0](https://creativecommons.org/publicdomain/mark/1.0/). The bundled PNG is a transparent crop derived from that scan. | -| `lanting-universe` | `仰觀宇宙之大` | 王羲之《蘭亭集序》; glyphs from the Tang copy traditionally attributed to 馮承素 | [Wikimedia Commons file page, Palace Museum source](https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG) | Same public-domain and Public Domain Mark 1.0 basis as above. | -| `basho-old-pond` | `古池や蛙飛こむ水のおと` | 松尾芭蕉《蛙合》, 1686 | [National Diet Library Collaborative Reference Database](https://crd.ndl.go.jp/reference/detail?page=ref_view&id=1000087707) | Public-domain original text; Matsuo Bashō died in 1694. Japan's [Copyright Act, Article 51](https://www.japaneselawtranslation.go.jp/en/laws/view/3379/tb) provides a general term of 70 years after the author's death. No translation is bundled. | -| `euler-formula` | `eⁱˣ = cos x + i sin x` | Leonhard Euler, *Introductio in analysin infinitorum*, 1748; modern notation | [ETH-Bibliothek e-rara, DOI 10.3931/e-rara-8740](https://www.e-rara.ch/zut/content/titleinfo/2447176) | The digitized 1748 book is marked [Public Domain Mark](https://creativecommons.org/publicdomain/mark/1.0/). WeiBei claims no copyright in the mathematical expression. | -| `einstein-rest-energy` | `E₀ = mc²` | Albert Einstein, *Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?*, 1905; modern notation | [Max Planck Institute for the History of Science, original paper](https://einstein-annalen.mpiwg-berlin.mpg.de/annalen/alphabetical/Einst_Istdi_de_1905) | Physical formula / fact. WeiBei claims no copyright in the expression; see [U.S. Copyright Office Circular 33](https://www.copyright.gov/circs/circ33.pdf). | -| `cobb-douglas-production` | `P = bLᵏC¹⁻ᵏ` | Charles W. Cobb and Paul H. Douglas, “A Theory of Production,” 1928 | [The American Economic Review 18(1), JSTOR stable record](https://www.jstor.org/stable/1811556) | Economic formula / fact. WeiBei claims no copyright in the expression; see Circular 33 above. | +| Catalog ID | Field | Original text or expression | Author and work | Reliable source | Rights basis | +| --- | --- | --- | --- | --- | --- | +| `lanting-clear-breeze` | Chinese classics / calligraphy | `天朗氣清,惠風和暢` | 王羲之《蘭亭集序》; Tang copy traditionally attributed to 馮承素 | [Wikimedia Commons file page](https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG), checked against [Palace Museum object 故00002597](https://www.dpm.org.cn/collection/handwriting/228279.html) | Ancient public-domain work; the faithful digital reproduction is marked public domain and [Public Domain Mark 1.0](https://creativecommons.org/publicdomain/mark/1.0/). | +| `lanting-universe` | Chinese classics / calligraphy | `仰觀宇宙之大` | Same work and copy | Same Commons and Palace Museum records | Same public-domain basis. | +| `lanting-observe-kinds` | Chinese classics / calligraphy | `俯察品類之盛` | Same work and copy | Same Commons and Palace Museum records | Same public-domain basis. | +| `analects-learning` | Chinese classical thought | `學而時習之,不亦說乎?` | 孔子《論語·學而》 | [Chinese Wikisource source text](https://zh.wikisource.org/zh/%E8%AB%96%E8%AA%9E/%E5%AD%B8%E8%80%8C%E7%AC%AC%E4%B8%80) | The page identifies the pre-Qin text as public domain; Wikisource text is available under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). | +| `zhuangzi-great-beauty` | Chinese classical thought | `天地有大美而不言。` | 莊子《莊子·知北遊》 | [Chinese Wikisource source text](https://zh.wikisource.org/zh-hant/%E8%8E%8A%E5%AD%90/%E7%9F%A5%E5%8C%97%E9%81%8A) | Ancient public-domain text; Wikisource CC BY-SA 4.0. | +| `laozi-name-the-way` | Chinese classical thought | `道可道,非常道;名可名,非常名。` | 老子《道德經》第一章, 王弼本 | [Chinese Wikisource source text](https://zh.wikisource.org/zh-hant/%E9%81%93%E5%BE%B7%E7%B6%93_%28%E7%8E%8B%E5%BC%BC%E6%9C%AC%29) | Ancient public-domain text; Wikisource CC BY-SA 4.0. | +| `laozi-water` | Chinese classical thought | `上善若水。水善利萬物而不爭。` | 老子《道德經》第八章, 王弼本 | Same checked Wikisource source | Ancient public-domain text; Wikisource CC BY-SA 4.0. | +| `basho-old-pond` | World literature / Japanese | `古池や蛙飛こむ水のおと` | 松尾芭蕉《蛙合》, 1686 | [National Diet Library Collaborative Reference Database](https://crd.ndl.go.jp/reference/detail?page=ref_view&id=1000087707) | Bashō died in 1694; Japan's [Copyright Act, Article 51](https://www.japaneselawtranslation.go.jp/en/laws/view/3379/tb) provides a general term of 70 years after death. No translation is bundled. | +| `shakespeare-dream-stuff` | World literature / English | `We are such stuff as dreams are made on, and our little life is rounded with a sleep.` | William Shakespeare, *The Tempest*, Act IV, Scene 1 | [Project Gutenberg eBook 1540 source text](https://www.gutenberg.org/cache/epub/1540/pg1540-images.html) | [eBook 1540](https://www.gutenberg.org/ebooks/1540) is explicitly marked public domain in the USA; Shakespeare died in 1616. No translation is bundled. The older eBook 1801 was rejected because its electronic edition carries additional restrictions. | +| `goethe-gipfeln` | World literature / German | `Ueber allen Gipfeln / Ist Ruh’,` (source line break retained in the app) | Johann Wolfgang von Goethe, *Ein Gleiches*, 1780 | [German Wikisource, twice proofread against the 1827 edition](https://de.wikisource.org/wiki/Ein_Gleiches) | Goethe died in 1832; original text is public domain. Wikisource text is available under CC BY-SA 4.0. No translation is bundled. | +| `pascal-heart-reasons` | World literature / French | `Le cœur a ses raisons, que la raison ne connaît point ; on le sent en mille choses.` | Blaise Pascal, *Pensées*, Didiot edition, 1896, p. 62 | [French Wikisource facsimile and corrected transcription](https://fr.wikisource.org/wiki/Page%3APascal_-_Pens%C3%A9es%2C_%C3%A9d._Didiot%2C_1896.djvu/80) | Pascal died in 1662 and the 1896 edition is public domain; Wikisource text is available under CC BY-SA 4.0. No translation is bundled. | +| `euler-formula` | Mathematics | `eⁱˣ = cos x + i sin x` | Leonhard Euler, *Introductio in analysin infinitorum*, 1748; modern notation | [ETH-Bibliothek e-rara, DOI 10.3931/e-rara-8740](https://www.e-rara.ch/zut/content/titleinfo/2447176) | The digitized book is marked Public Domain Mark. Mathematical expression / fact; no copyright claimed. | +| `euclid-pythagorean` | Mathematics | `a² + b² = c²` | Euclid, *Elements* I.47; modern notation | [Project Gutenberg eBook 21076](https://www.gutenberg.org/ebooks/21076) | The source edition is marked public domain in the USA. Mathematical relation / fact; see [U.S. Copyright Office Circular 33](https://www.copyright.gov/circs/circ33.pdf). | +| `bayes-theorem` | Mathematics | `P(A \| B) = P(B \| A)P(A) / P(B)` | Thomas Bayes, “An Essay towards solving a Problem in the Doctrine of Chances,” 1763; modern notation | [Royal Society, DOI 10.1098/rstl.1763.0053](https://royalsocietypublishing.org/doi/10.1098/rstl.1763.0053) | Mathematical formula / fact; no text from the paper is bundled and no copyright is claimed in the expression. Circular 33. | +| `einstein-rest-energy` | Physics | `E₀ = mc²` | Albert Einstein, “Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?”, 1905; modern notation | [Max Planck Institute for the History of Science, original paper record](https://einstein-annalen.mpiwg-berlin.mpg.de/annalen/alphabetical/Einst_Istdi_de_1905) | Physical formula / fact; no copyright claimed. Circular 33. | +| `schrodinger-equation` | Physics | `Ĥψ = Eψ` | Erwin Schrödinger, “Quantisierung als Eigenwertproblem,” 1926; modern notation | [Annalen der Physik, DOI 10.1002/andp.19263840404](https://doi.org/10.1002/andp.19263840404) | Physical formula / fact; no article text is bundled and no copyright is claimed in the expression. Circular 33. | +| `cobb-douglas-production` | Economics | `P = bLᵏC¹⁻ᵏ` | Charles W. Cobb and Paul H. Douglas, “A Theory of Production,” 1928 | [The American Economic Review 18(1), JSTOR stable record](https://www.jstor.org/stable/1811556) | Economic formula / fact; no article text is bundled and no copyright is claimed in the expression. Circular 33. | +| `fisher-exchange` | Economics | `MV + M′V′ = ΣpQ` | Irving Fisher, *The Purchasing Power of Money*, 1911 | [FRASER full text, Federal Reserve Bank of St. Louis](https://fraser.stlouisfed.org/title/purchasing-power-money-3610/fulltext) | Economic formula / fact; no source-book prose is bundled and no copyright is claimed in the expression. Circular 33. | +| `aristotle-non-contradiction` | Philosophy / logic | `¬(p ∧ ¬p)` | Aristotle, *Metaphysics* IV.3, 1005b19–20; modern logical notation | [MIT Internet Classics Archive, W. D. Ross source passage](https://classics.mit.edu/Aristotle/metaphysics.4.iv.html) | Logical principle / fact; the symbolic expression is a modern notation and no copyright is claimed. Circular 33. | ## Calligraphy transformation -Only the two verified `Lantingji Xu` phrases are included. The source scan itself is not bundled. The generation record below preserves the glyph coordinates used to convert selected ink into transparent alpha masks. WeiBei applies semantic ink color at runtime, so the same PNG has no white box and stays legible in both paper and inkstone modes. +Only the three verified *Lantingji Xu* phrases use calligraphy. The source scan itself is not bundled. Product credit must say `唐摹本傳馮承素`: the Palace Museum record says the traditional attribution to Feng Chengsu is not certain. - Commons description revision checked on 2026-07-10: [`oldid=1012610416`](https://commons.wikimedia.org/w/index.php?title=File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG&oldid=1012610416) - Palace Museum accession number: `故00002597` -- Verified original JPEG: `28,549 × 1,300`, SHA-1 `a133647a8695cd06d0f5c6215d66e0b8b8d93d56` -- `lanting-clear-breeze.png`: `856 × 132`, SHA-256 `e5c6827f44b22f5441bb208b1770103da8a076564b52f41e64f77b0da7e1835c` +- Verified original JPEG: `28,549 × 1,300`, `42,480,264` bytes +- Original SHA-1: `a133647a8695cd06d0f5c6215d66e0b8b8d93d56` +- Original SHA-256: `534f9b912f0a1b25fff9a125696b74d62e1090c6185f5f04748850187adaa7cc` +- `lanting-clear-breeze.png`: `856 × 132`, SHA-256 `b30c54279d2e0b5c7b8221369962ba3a3c0e16b264808332da38cb1b8e63d936` - `lanting-universe.png`: `624 × 132`, SHA-256 `a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22` -- Both PNGs have zero opaque-white pixels and zero ink in the outer two-pixel border. +- `lanting-observe-kinds.png`: `624 × 132`, SHA-256 `1c7965b6447392a874ed75adb1ce5703f26b562b8fc5fd6f380d1fdde0621379` +- All three PNGs have zero opaque-white pixels and zero ink in the outer two-pixel border. -The manual source rectangles are recorded below as `(left, top, right, bottom)` in the verified Commons JPEG. No generative fill, vector tracing, or font substitution is used. +The manual source rectangles are `(left, top, right, bottom)` in the verified Commons JPEG. No generative fill, vector tracing, or font substitution is used; no stroke is invented. -- `天朗氣清惠風和暢`: `(22732,331,22832,414)`, `(22734,414,22818,499)`, `(22733,530,22831,628)`, `(22730,626,22818,741)`, `(22734,742,22813,849)`, `(22720,847,22829,957)`, `(22714,959,22831,1050)`, `(22728,1049,22836,1152)` +- `天朗氣清惠風和暢`: `(22732,295,22832,414)`, `(22734,414,22818,499)`, `(22733,530,22831,628)`, `(22730,626,22818,741)`, `(22734,742,22813,849)`, `(22720,847,22829,957)`, `(22714,959,22831,1050)`, `(22728,1049,22836,1152)` - `仰觀宇宙之大`: `(22725,1151,22832,1242)`, `(22610,9,22731,143)`, `(22622,154,22705,256)`, `(22617,276,22697,351)`, `(22615,384,22703,462)`, `(22604,475,22699,548)` +- `俯察品類之盛`: `(22598,558,22716,674)`, `(22590,678,22715,812)`, `(22588,810,22705,895)`, `(22580,902,22712,1020)`, `(22580,1005,22705,1110)`, `(22582,1095,22720,1235)` + +The earlier `天` rectangle began at `y=331`, below the detached top horizontal at approximately `y=306–315`. Alpha-edge checks therefore passed the already-incomplete glyph. The corrected rectangle begins at `y=295`; semantic glyph inspection is required in addition to edge checks. -The four experimental Zhao Mengfu crops from the research workspace were rejected because they contained neighboring strokes or incomplete glyphs. They are not part of this package or catalog. +The four experimental Zhao Mengfu crops were rejected because fixed grid coordinates produced wrong glyphs, neighboring strokes, or incomplete characters. They are not part of the package or catalog. Project Gutenberg eBook 1801 was also rejected because that electronic edition says it is not public domain and restricts commercial distribution. diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index 212c091cc..ccfb625f9 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -31,7 +31,8 @@ struct ContentRailItem: Identifiable { } enum ContentRailMetrics { - static let normalWidth: CGFloat = 28 + /// Overlay hit area. Readable panes must not reserve this width in their layout. + static let normalWidth: CGFloat = 40 static let railOnlyWidth: CGFloat = 88 static let railOnlyThreshold: CGFloat = 150 static let snapThreshold: CGFloat = 160 @@ -54,6 +55,11 @@ struct ContentRailView: View { @State private var previewID: String? @State private var previewOpenWork: DispatchWorkItem? @State private var previewCloseWork: DispatchWorkItem? + @State private var isPointerInside = false + @State private var pointerY: CGFloat? + @FocusState private var focusedItemID: String? + + @Environment(\.accessibilityReduceMotion) private var reduceMotion init( label: String, @@ -79,16 +85,30 @@ struct ContentRailView: View { var body: some View { GeometryReader { geometry in - railColumn(height: geometry.size.height) + let height = compactHeight(in: geometry.size.height) + compactRail(height: height) + .position( + x: railWidth / 2, + y: compactCenterY(in: geometry.size.height) + ) } .frame(width: railWidth) .accessibilityElement(children: .contain) .accessibilityLabel(Text(label)) .animation(WeiBeiMotion.panel, value: isRailOnly) .animation(WeiBeiMotion.hover, value: previewID) - .onChange(of: items.map(\.id)) { _, ids in - guard let previewID, !ids.contains(previewID) else { return } - closePreview(immediately: true) + .onChange(of: items.map { $0.id }) { _, ids in + let staleHover = hoveredID.map { !ids.contains($0) } ?? false + let stalePreview = previewID.map { !ids.contains($0) } ?? false + if staleHover || stalePreview { + closePreview(immediately: true) + } + if let focusedItemID, !ids.contains(focusedItemID) { + self.focusedItemID = nil + } + if ids.isEmpty { + pointerY = nil + } } .onDisappear { previewOpenWork?.cancel() @@ -107,30 +127,35 @@ struct ContentRailView: View { 336 } - private func railColumn(height: CGFloat) -> some View { - ZStack(alignment: .topLeading) { - railBackground + private var compactWidth: CGFloat { + isRailOnly ? 42 : 40 + } - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(isRailOnly ? 0.54 : 0.30)) - .frame(width: 1) - .frame(maxWidth: .infinity, alignment: .trailing) - .allowsHitTesting(false) + private var resolvedActiveID: String? { + activeID ?? items.first?.id + } + + private var waveMotion: Animation? { + reduceMotion ? nil : .easeOut(duration: 0.10) + } + private func compactRail(height: CGFloat) -> some View { + ZStack { if items.isEmpty { emptyOriginMark - .position( - x: railWidth / 2, - y: railY(position: 0, height: height) - ) } else { let hitHeight = railHitHeight(for: height) ForEach(items) { item in - railButton(for: item, hitHeight: hitHeight, acceptsPointer: hitHeight >= 4) - .position( - x: railWidth / 2, - y: railY(position: item.position, height: height) - ) + railButton( + for: item, + railHeight: height, + hitHeight: hitHeight, + acceptsPointer: hitHeight >= 4 + ) + .position( + x: compactWidth / 2, + y: railY(position: item.position, height: height) + ) } if hitHeight < 4 { @@ -138,50 +163,94 @@ struct ContentRailView: View { } } } - .frame(width: railWidth, height: height) + .frame(width: compactWidth, height: height) + .contentShape(Rectangle()) + .onExitCommand { + focusedItemID = nil + isPointerInside = false + pointerY = nil + } + .onContinuousHover { phase in + switch phase { + case .active(let location): + isPointerInside = true + updatePointerY(location.y, height: height) + case .ended: + isPointerInside = false + restoreFocusedPointer(height: height) + } + } + .onChange(of: focusedItemID) { _, _ in + guard !isPointerInside else { return } + restoreFocusedPointer(height: height) + } } - private var railBackground: some View { + private var emptyOriginMark: some View { Rectangle() - .fill( - isRailOnly - ? WeiBeiTheme.paperRaised.opacity(appearanceMode == .inkstone ? 0.18 : 0.24) - : Color.clear - ) + .fill(WeiBeiTheme.hairline.opacity(0.64)) + .frame(width: 8, height: 1.5) + .frame(width: compactWidth, height: 34) + .accessibilityLabel(Text(label)) } - private var emptyOriginMark: some View { - HStack(spacing: 0) { - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(0.44)) - .frame(width: isRailOnly ? 18 : 8, height: 1.5) - Spacer(minLength: 0) + private func compactHeight(in totalHeight: CGFloat) -> CGFloat { + let top = max(topInset, 0) + 10 + let bottom = max(bottomInset, 0) + 10 + let available = max(totalHeight - top - bottom, 34) + guard items.count > 1 else { return min(items.isEmpty ? 34 : 50, available) } + + let countDrivenHeight = 72 + CGFloat(min(max(items.count - 2, 0), 14)) * 6.3 + return min(max(72, countDrivenHeight), min(160, available)) + } + + private func compactCenterY(in totalHeight: CGFloat) -> CGFloat { + let top = max(topInset, 0) + 10 + let bottom = max(bottomInset, 0) + 10 + let available = max(totalHeight - top - bottom, 0) + return min(max(top + available / 2, 17), max(totalHeight - 17, 17)) + } + + private func updatePointerY(_ y: CGFloat, height: CGFloat) { + let value = min(max(y, 0), height) + guard pointerY == nil || abs((pointerY ?? value) - value) > 0.5 else { return } + withAnimation(waveMotion) { + pointerY = value } - .padding(.horizontal, tickHorizontalInset) - .frame(width: railWidth, height: 24) - .accessibilityLabel(Text("\(label):暂无可导航内容")) } - private func railButton(for item: ContentRailItem, hitHeight: CGFloat, acceptsPointer: Bool) -> some View { - let active = item.id == activeID + private func restoreFocusedPointer(height: CGFloat) { + let focusedItem = focusedItemID.flatMap { id in + items.first(where: { $0.id == id }) + } + withAnimation(waveMotion) { + pointerY = focusedItem.map { railY(position: $0.position, height: height) } + } + } + + private func railButton( + for item: ContentRailItem, + railHeight: CGFloat, + hitHeight: CGFloat, + acceptsPointer: Bool + ) -> some View { + let active = item.id == resolvedActiveID return Button { activate(item) } label: { - HStack(spacing: 0) { - Rectangle() - .fill(tickColor(itemID: item.id, active: active)) - .frame( - width: tickLength(level: item.level, active: active), - height: active ? 2.5 : 1.5 - ) - Spacer(minLength: 0) - } - .padding(.horizontal, tickHorizontalInset) - .frame(width: railWidth, height: hitHeight) + Rectangle() + .fill(tickColor(itemID: item.id, active: active)) + .frame( + width: tickLength(for: item, active: active, railHeight: railHeight), + height: active ? 2 : 1.5 + ) + .opacity(tickOpacity(for: item, active: active, railHeight: railHeight)) + .frame(width: compactWidth, height: hitHeight) .contentShape(Rectangle()) } .buttonStyle(.plain) + .focused($focusedItemID, equals: item.id) .accessibilityLabel(Text("\(label):\(item.title)")) .accessibilityValue(Text(active ? "当前位置" : item.metadata)) .help(item.title) @@ -196,6 +265,7 @@ struct ContentRailView: View { .padding(4) } .onHover { hovering in + guard acceptsPointer else { return } if hovering { beginHover(item) } else { @@ -204,6 +274,7 @@ struct ContentRailView: View { } .animation(WeiBeiMotion.micro, value: activeID) .animation(WeiBeiMotion.hover, value: hoveredID) + .animation(waveMotion, value: pointerY) } private func denseRailPointerSurface(height: CGFloat) -> some View { @@ -212,10 +283,15 @@ struct ContentRailView: View { .onContinuousHover { phase in switch phase { case .active(let location): - if let item = nearestItem(to: location.y, height: height) { + isPointerInside = true + updatePointerY(location.y, height: height) + if let item = nearestItem(to: location.y, height: height), + hoveredID != item.id { beginHover(item) } case .ended: + isPointerInside = false + restoreFocusedPointer(height: height) if let hoveredID, let item = items.first(where: { $0.id == hoveredID }) { endHover(item) @@ -231,21 +307,32 @@ struct ContentRailView: View { activate(item) } ) - .frame(width: railWidth, height: height) + .frame(width: compactWidth, height: height) .accessibilityHidden(true) } - private var tickHorizontalInset: CGFloat { - isRailOnly ? 16 : 4 + private func tickLength(for item: ContentRailItem, active: Bool, railHeight: CGFloat) -> CGFloat { + let normal: CGFloat = active ? 8 : (item.level == 0 ? 7 : 6) + guard let pointerY else { return normal } + + let distance = abs(railY(position: item.position, height: railHeight) - pointerY) + let influenceRadius: CGFloat = 48 + guard distance < influenceRadius else { return normal } + let linear = 1 - distance / influenceRadius + let influence = linear * linear * (3 - 2 * linear) + return normal + (34 - normal) * influence } - private func tickLength(level: Int, active: Bool) -> CGFloat { - if active { - return isRailOnly ? 56 : 20 - } - let base: CGFloat = isRailOnly ? 34 : 14 - let minimum: CGFloat = isRailOnly ? 10 : 6 - return max(minimum, base - CGFloat(min(level, 4)) * (isRailOnly ? 6 : 2)) + private func tickOpacity(for item: ContentRailItem, active: Bool, railHeight: CGFloat) -> Double { + let normal: Double = active ? 1 : 0.64 + guard let pointerY else { return normal } + + let distance = abs(railY(position: item.position, height: railHeight) - pointerY) + let influenceRadius: CGFloat = 48 + guard distance < influenceRadius else { return normal } + let linear = 1 - distance / influenceRadius + let influence = Double(linear * linear * (3 - 2 * linear)) + return normal + (1 - normal) * influence } private func tickColor(itemID: String, active: Bool) -> Color { @@ -253,30 +340,26 @@ struct ContentRailView: View { return appearanceMode == .inkstone ? WeiBeiTheme.onCinnabar : WeiBeiTheme.cinnabar } if hoveredID == itemID { - return WeiBeiTheme.secondaryInk.opacity(0.72) + return WeiBeiTheme.ink.opacity(0.92) } - return WeiBeiTheme.hairline.opacity(0.86) + return WeiBeiTheme.hairline.opacity(0.92) } private func railY(position: CGFloat, height: CGFloat) -> CGFloat { - let top = max(topInset, 0) + 12 - let bottom = max(bottomInset, 0) + 12 - let available = max(height - top - bottom, 0) - return min(max(top + min(max(position, 0), 1) * available, 12), max(height - 12, 12)) + let available = max(height - 14, 0) + return min(max(7 + min(max(position, 0), 1) * available, 7), max(height - 7, 7)) } private func railHitHeight(for height: CGFloat) -> CGFloat { - guard !items.isEmpty else { return 24 } - let available = max(height - max(topInset, 0) - max(bottomInset, 0) - 24, 1) - return min(24, available / CGFloat(items.count)) + guard !items.isEmpty else { return 20 } + let available = max(height - 14, 1) + return min(20, available / CGFloat(items.count)) } private func nearestItem(to y: CGFloat, height: CGFloat) -> ContentRailItem? { guard !items.isEmpty else { return nil } - let top = max(topInset, 0) + 12 - let bottom = max(bottomInset, 0) + 12 - let available = max(height - top - bottom, 1) - let position = min(max((y - top) / available, 0), 1) + let available = max(height - 14, 1) + let position = min(max((y - 7) / available, 0), 1) return items.min { abs($0.position - position) < abs($1.position - position) } } diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index 208db00a3..402995c56 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -4,36 +4,48 @@ import WeiBeiCore struct EmptyWorkspaceLauncherView: View { @EnvironmentObject private var store: WorkspaceStore + @Environment(\.accessibilityReduceMotion) private var reduceMotion + + @State private var inspirationOffset = 0 var body: some View { TimelineView(.periodic(from: .now, by: 60)) { timeline in GeometryReader { geometry in let compact = geometry.size.width < 760 || geometry.size.height < 620 - let horizontalPadding: CGFloat = compact ? 28 : 52 + let horizontalPadding: CGFloat = compact ? 24 : 52 let entryWidth = min(116, max(76, (geometry.size.width - (horizontalPadding * 2) - 2) / 3)) + let currentInspiration = inspiration(at: timeline.date) ZStack { - WeiBeiTheme.paper + EmptyWorkspacePaperField(compact: compact) - VStack(spacing: compact ? 20 : 28) { - Spacer(minLength: compact ? 24 : 44) + VStack(spacing: 0) { + Spacer(minLength: compact ? 18 : 38) - greeting(at: timeline.date) + VStack(spacing: compact ? 14 : 19) { + greeting(at: timeline.date) - EmptyWorkspaceEntryRow(entryWidth: entryWidth) + EmptyWorkspaceEntryRow(entryWidth: entryWidth) + } if store.showDailyInspiration { + Spacer(minLength: compact ? 18 : 34) + EmptyWorkspaceInspirationView( - inspiration: inspiration(at: timeline.date), - compact: compact + inspiration: currentInspiration, + position: inspirationPosition(currentInspiration), + total: EmptyWorkspaceInspirationCatalog.rotationItems.count, + compact: compact, + onAdvance: advanceInspiration ) .transition(.opacity) } - Spacer(minLength: compact ? 24 : 44) + Spacer(minLength: compact ? 20 : 42) } .frame(maxWidth: 760) .padding(.horizontal, horizontalPadding) + .padding(.vertical, compact ? 4 : 10) } } } @@ -42,14 +54,39 @@ struct EmptyWorkspaceLauncherView: View { } private func greeting(at date: Date) -> some View { - Text(EmptyWorkspaceDayPeriod.current(at: date).greeting(language: store.interfaceLanguage)) - .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 15, weight: .regular)) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .multilineTextAlignment(.center) - .accessibilityIdentifier("empty-workspace-greeting") + HStack(spacing: 12) { + greetingRule + + Text(EmptyWorkspaceDayPeriod.current(at: date).greeting(language: store.interfaceLanguage)) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 14.5, weight: .regular)) + .tracking(store.interfaceLanguage == .chinese ? 0.8 : 0.35) + .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.92)) + .multilineTextAlignment(.center) + .fixedSize(horizontal: false, vertical: true) + .accessibilityIdentifier("empty-workspace-greeting") + + greetingRule + } + } + + private var greetingRule: some View { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.76)) + .frame(width: 18, height: 1) + .accessibilityHidden(true) } private func inspiration(at date: Date) -> EmptyWorkspaceInspiration { + let baseInspiration = dailyInspiration(at: date) + let items = EmptyWorkspaceInspirationCatalog.rotationItems + guard !items.isEmpty, + let baseIndex = items.firstIndex(where: { $0.id == baseInspiration.id }) + else { return baseInspiration } + + return items[(baseIndex + inspirationOffset) % items.count] + } + + private func dailyInspiration(at date: Date) -> EmptyWorkspaceInspiration { let environment = ProcessInfo.processInfo.environment if environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1" { let forcedID: String? @@ -62,12 +99,72 @@ struct EmptyWorkspaceLauncherView: View { forcedID = environment["WEIBEI_VERIFY_INSPIRATION_ID"] } if let forcedID, - let requested = EmptyWorkspaceInspirationCatalog.items.first(where: { $0.id == forcedID }) { + let requested = EmptyWorkspaceInspirationCatalog.rotationItems.first(where: { $0.id == forcedID }) { return requested } } return EmptyWorkspaceInspirationCatalog.item(for: date) } + + private func inspirationPosition(_ inspiration: EmptyWorkspaceInspiration) -> Int { + (EmptyWorkspaceInspirationCatalog.rotationItems.firstIndex(where: { $0.id == inspiration.id }) ?? 0) + 1 + } + + private func advanceInspiration() { + guard !EmptyWorkspaceInspirationCatalog.rotationItems.isEmpty else { return } + if reduceMotion { + inspirationOffset = (inspirationOffset + 1) % EmptyWorkspaceInspirationCatalog.rotationItems.count + } else { + withAnimation(.easeInOut(duration: 0.24)) { + inspirationOffset = (inspirationOffset + 1) % EmptyWorkspaceInspirationCatalog.rotationItems.count + } + } + } +} + +private struct EmptyWorkspacePaperField: View { + let compact: Bool + + var body: some View { + ZStack { + WeiBeiTheme.paper + + RadialGradient( + colors: [ + WeiBeiTheme.paperRaised.opacity(0.72), + WeiBeiTheme.paper.opacity(0), + ], + center: UnitPoint(x: 0.5, y: 0.42), + startRadius: 8, + endRadius: compact ? 330 : 520 + ) + + LinearGradient( + colors: [ + WeiBeiTheme.ink.opacity(0.025), + Color.clear, + WeiBeiTheme.ink.opacity(0.018), + ], + startPoint: .topLeading, + endPoint: .bottomTrailing + ) + + VStack(spacing: 0) { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.30)) + .frame(width: 1, height: compact ? 24 : 48) + + Spacer() + + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.22)) + .frame(width: 1, height: compact ? 28 : 58) + } + .padding(.vertical, compact ? 14 : 24) + } + .allowsHitTesting(false) + .accessibilityHidden(true) + } } private struct EmptyWorkspaceEntryRow: View { @@ -117,6 +214,8 @@ private struct EmptyWorkspaceEntryRow: View { } private struct EmptyWorkspaceEntryButton: View { + @Environment(\.accessibilityReduceMotion) private var reduceMotion + let title: String let accessibilityLabel: String let identifier: String @@ -127,25 +226,36 @@ private struct EmptyWorkspaceEntryButton: View { @FocusState private var focused: Bool var body: some View { + let active = focused || hovering + Button(action: action) { - Text(title) - .font(WeiBeiTypography.englishBrandFont(size: 20, weight: .semibold)) - .tracking(2.2) - .foregroundStyle(focused || hovering ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk) - .frame(width: width, height: 48) - .contentShape(Rectangle()) - .overlay(alignment: .bottom) { + VStack(spacing: 2) { + Text(title) + .font(WeiBeiTypography.englishBrandFont(size: 20, weight: .semibold)) + .tracking(active ? 3.5 : 2.2) + .foregroundStyle(active ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk.opacity(0.88)) + .offset(y: active && !reduceMotion ? -2.5 : 0) + + ZStack { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.52)) + .frame(width: active ? 42 : 14, height: 1) + Rectangle() - .fill(WeiBeiTheme.ink.opacity(focused ? 0.62 : hovering ? 0.34 : 0)) - .frame(width: 26, height: 1) - .padding(.bottom, 4) + .fill(WeiBeiTheme.ink.opacity(focused ? 0.64 : hovering ? 0.42 : 0)) + .frame(width: active ? 32 : 0, height: 1) } + .frame(height: 4) + .opacity(active ? 1 : 0.72) + } + .frame(width: width, height: 52) + .contentShape(Rectangle()) } .buttonStyle(.plain) .focused($focused) .onHover { hovering = $0 } - .animation(.easeOut(duration: 0.12), value: hovering) - .animation(.easeOut(duration: 0.12), value: focused) + .animation(reduceMotion ? nil : .easeOut(duration: 0.22), value: hovering) + .animation(reduceMotion ? nil : .easeOut(duration: 0.18), value: focused) .accessibilityLabel(Text(accessibilityLabel)) .accessibilityIdentifier(identifier) .help(accessibilityLabel) @@ -153,23 +263,48 @@ private struct EmptyWorkspaceEntryButton: View { } private struct EmptyWorkspaceInspirationView: View { + @EnvironmentObject private var store: WorkspaceStore + @Environment(\.accessibilityReduceMotion) private var reduceMotion + let inspiration: EmptyWorkspaceInspiration + let position: Int + let total: Int let compact: Bool + let onAdvance: () -> Void + + @State private var hovering = false + @FocusState private var focused: Bool var body: some View { - VStack(spacing: compact ? 8 : 10) { - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(0.72)) - .frame(width: 34, height: 1) - .padding(.bottom, compact ? 2 : 5) + VStack(spacing: compact ? 7 : 9) { + Button(action: onAdvance) { + VStack(spacing: compact ? 8 : 11) { + inspirationCounter - inspirationContent + inspirationContent - Text(inspiration.credit) - .font(.system(size: compact ? 10.5 : 11.5, weight: .medium, design: .serif)) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .multilineTextAlignment(.center) - .lineLimit(2) + Text(inspiration.credit) + .font(.system(size: compact ? 10.5 : 11.5, weight: .medium, design: .serif)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .multilineTextAlignment(.center) + .lineLimit(2) + + advanceLabel + } + .frame(maxWidth: .infinity) + .contentShape(Rectangle()) + .id(inspiration.id) + .transition(.opacity) + } + .buttonStyle(.plain) + .focused($focused) + .onHover { hovering = $0 } + .animation(reduceMotion ? nil : .easeOut(duration: 0.20), value: hovering) + .animation(reduceMotion ? nil : .easeOut(duration: 0.18), value: focused) + .accessibilityElement(children: .ignore) + .accessibilityLabel(Text("\(inspiration.text),\(inspiration.credit)")) + .accessibilityHint(Text(store.ui("切换到下一则灵感", "Show the next inspiration"))) + .accessibilityIdentifier("empty-workspace-inspiration-next") sourceAndRights } @@ -178,6 +313,38 @@ private struct EmptyWorkspaceInspirationView: View { .accessibilityIdentifier("empty-workspace-inspiration-\(inspiration.id)") } + private var inspirationCounter: some View { + HStack(spacing: 8) { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(hovering || focused ? 0.72 : 0.48)) + .frame(width: hovering || focused ? 28 : 18, height: 1) + + Text(String(format: "%02d / %02d", position, total)) + .font(.system(size: compact ? 8.5 : 9, weight: .medium, design: .monospaced)) + .tracking(1.1) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .monospacedDigit() + + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(hovering || focused ? 0.72 : 0.48)) + .frame(width: hovering || focused ? 28 : 18, height: 1) + } + .accessibilityHidden(true) + } + + private var advanceLabel: some View { + HStack(spacing: 6) { + Text(store.ui("点击换一则", "NEXT")) + Text("→") + .offset(x: hovering && !reduceMotion ? 2 : 0) + } + .font(.system(size: compact ? 8.5 : 9, weight: .medium, design: .serif)) + .tracking(store.interfaceLanguage == .chinese ? 0.7 : 1.2) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .opacity(hovering || focused ? 0.94 : 0.56) + .accessibilityHidden(true) + } + @ViewBuilder private var inspirationContent: some View { switch inspiration.presentation { @@ -189,6 +356,7 @@ private struct EmptyWorkspaceInspirationView: View { .scaledToFit() .foregroundStyle(WeiBeiTheme.ink.opacity(0.88)) .frame(maxWidth: compact ? 390 : 500, maxHeight: compact ? 54 : 72) + .padding(.vertical, compact ? 1 : 2) .accessibilityLabel(Text(inspiration.text)) } else { inspirationText(size: compact ? 24 : 30) @@ -239,8 +407,8 @@ private struct EmptyWorkspaceInspirationView: View { .font(.system(size: size, weight: .regular, design: .serif)) .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) .multilineTextAlignment(.center) - .lineLimit(2) - .minimumScaleFactor(0.78) + .lineLimit(compact ? 3 : 2) + .minimumScaleFactor(compact ? 0.72 : 0.78) .accessibilityLabel(Text(inspiration.text)) } diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 687da20e3..1cf6c8089 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -303,7 +303,6 @@ struct NotePaneView: View { } noteBody - .padding(.leading, ContentRailMetrics.normalWidth) } .opacity(railOnly ? 0 : 1) .allowsHitTesting(!railOnly) @@ -1374,7 +1373,7 @@ struct AgentPaneView: View { } GeometryReader { geometry in - let availableWidth = max(geometry.size.width - ContentRailMetrics.normalWidth, 1) + let availableWidth = max(geometry.size.width, 1) let contentWidth = min(max(availableWidth - 36, 320), agentContentMaxWidth ?? 760) ScrollView(showsIndicators: true) { @@ -1404,7 +1403,6 @@ struct AgentPaneView: View { .animation(WeiBeiMotion.panel, value: store.messages.count) } .scrollPosition(id: $visibleAgentMessageID, anchor: .center) - .padding(.leading, ContentRailMetrics.normalWidth) } agentInputTray diff --git a/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift index 1b3a1da86..1bdc02afe 100644 --- a/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift +++ b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift @@ -43,10 +43,28 @@ public enum EmptyWorkspaceInspirationPresentation: Equatable, Sendable { case formula } +public enum EmptyWorkspaceInspirationCategory: String, CaseIterable, Hashable, Sendable { + case chineseClassics + case worldLiterature + case mathematics + case physics + case economics + case philosophy +} + +public enum EmptyWorkspaceInspirationRightsBasis: String, Hashable, Sendable { + case publicDomain + case ccBySA4 + case uncopyrightableFact +} + public struct EmptyWorkspaceInspiration: Identifiable, Equatable, Sendable { public let id: String public let text: String public let credit: String + public let category: EmptyWorkspaceInspirationCategory + public let languageTag: String + public let rightsBasis: EmptyWorkspaceInspirationRightsBasis public let sourceLabel: String public let sourceURLString: String public let rightsLabel: String @@ -57,6 +75,9 @@ public struct EmptyWorkspaceInspiration: Identifiable, Equatable, Sendable { id: String, text: String, credit: String, + category: EmptyWorkspaceInspirationCategory, + languageTag: String, + rightsBasis: EmptyWorkspaceInspirationRightsBasis, sourceLabel: String, sourceURLString: String, rightsLabel: String, @@ -66,6 +87,9 @@ public struct EmptyWorkspaceInspiration: Identifiable, Equatable, Sendable { self.id = id self.text = text self.credit = credit + self.category = category + self.languageTag = languageTag + self.rightsBasis = rightsBasis self.sourceLabel = sourceLabel self.sourceURLString = sourceURLString self.rightsLabel = rightsLabel @@ -88,6 +112,9 @@ public enum EmptyWorkspaceInspirationCatalog { id: "lanting-clear-breeze", text: "天朗氣清,惠風和暢", credit: "王羲之《蘭亭集序》 · 唐摹本傳馮承素", + category: .chineseClassics, + languageTag: "zh-Hant", + rightsBasis: .publicDomain, sourceLabel: "Wikimedia Commons / 故宫博物院", sourceURLString: "https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG", rightsLabel: "公版原作 · Public Domain Mark 1.0", @@ -98,58 +125,262 @@ public enum EmptyWorkspaceInspirationCatalog { id: "lanting-universe", text: "仰觀宇宙之大", credit: "王羲之《蘭亭集序》 · 唐摹本傳馮承素", + category: .chineseClassics, + languageTag: "zh-Hant", + rightsBasis: .publicDomain, sourceLabel: "Wikimedia Commons / 故宫博物院", sourceURLString: "https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG", rightsLabel: "公版原作 · Public Domain Mark 1.0", rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", presentation: .calligraphy(assetName: "lanting-universe") ), + EmptyWorkspaceInspiration( + id: "lanting-observe-kinds", + text: "俯察品類之盛", + credit: "王羲之《蘭亭集序》 · 唐摹本傳馮承素", + category: .chineseClassics, + languageTag: "zh-Hant", + rightsBasis: .publicDomain, + sourceLabel: "Wikimedia Commons / 故宫博物院", + sourceURLString: "https://commons.wikimedia.org/wiki/File:%E7%A5%9E%E9%BE%8D%E8%98%AD%E4%BA%AD%E5%BA%8F%E5%85%A8.JPG", + rightsLabel: "公版原作 · Public Domain Mark 1.0", + rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", + presentation: .calligraphy(assetName: "lanting-observe-kinds") + ), + EmptyWorkspaceInspiration( + id: "analects-learning", + text: "學而時習之,不亦說乎?", + credit: "孔子《論語·學而》", + category: .chineseClassics, + languageTag: "zh-Hant", + rightsBasis: .ccBySA4, + sourceLabel: "維基文庫《論語·學而第一》", + sourceURLString: "https://zh.wikisource.org/zh/%E8%AB%96%E8%AA%9E/%E5%AD%B8%E8%80%8C%E7%AC%AC%E4%B8%80", + rightsLabel: "先秦原文公版 · Wikisource CC BY-SA 4.0", + rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", + presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "zhuangzi-great-beauty", + text: "天地有大美而不言。", + credit: "莊子《莊子·知北遊》", + category: .chineseClassics, + languageTag: "zh-Hant", + rightsBasis: .ccBySA4, + sourceLabel: "維基文庫《莊子·知北遊》", + sourceURLString: "https://zh.wikisource.org/zh-hant/%E8%8E%8A%E5%AD%90/%E7%9F%A5%E5%8C%97%E9%81%8A", + rightsLabel: "先秦原文公版 · Wikisource CC BY-SA 4.0", + rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", + presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "laozi-name-the-way", + text: "道可道,非常道;名可名,非常名。", + credit: "老子《道德經》第一章 · 王弼本", + category: .chineseClassics, + languageTag: "zh-Hant", + rightsBasis: .ccBySA4, + sourceLabel: "維基文庫《道德經(王弼本)》", + sourceURLString: "https://zh.wikisource.org/zh-hant/%E9%81%93%E5%BE%B7%E7%B6%93_%28%E7%8E%8B%E5%BC%BC%E6%9C%AC%29", + rightsLabel: "古代原文公版 · Wikisource CC BY-SA 4.0", + rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", + presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "laozi-water", + text: "上善若水。水善利萬物而不爭。", + credit: "老子《道德經》第八章 · 王弼本", + category: .chineseClassics, + languageTag: "zh-Hant", + rightsBasis: .ccBySA4, + sourceLabel: "維基文庫《道德經(王弼本)》", + sourceURLString: "https://zh.wikisource.org/zh-hant/%E9%81%93%E5%BE%B7%E7%B6%93_%28%E7%8E%8B%E5%BC%BC%E6%9C%AC%29", + rightsLabel: "古代原文公版 · Wikisource CC BY-SA 4.0", + rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", + presentation: .quotation + ), EmptyWorkspaceInspiration( id: "basho-old-pond", text: "古池や蛙飛こむ水のおと", credit: "松尾芭蕉《蛙合》 · 1686", + category: .worldLiterature, + languageTag: "ja", + rightsBasis: .publicDomain, sourceLabel: "国立国会图书馆参考协同数据库", sourceURLString: "https://crd.ndl.go.jp/reference/detail?page=ref_view&id=1000087707", rightsLabel: "原文公版 · 日本著作权法第 51 条", rightsURLString: "https://www.japaneselawtranslation.go.jp/en/laws/view/3379/tb", presentation: .quotation ), + EmptyWorkspaceInspiration( + id: "shakespeare-dream-stuff", + text: "We are such stuff as dreams are made on, and our little life is rounded with a sleep.", + credit: "William Shakespeare · The Tempest, Act IV, Scene 1", + category: .worldLiterature, + languageTag: "en", + rightsBasis: .publicDomain, + sourceLabel: "Project Gutenberg eBook 1540", + sourceURLString: "https://www.gutenberg.org/cache/epub/1540/pg1540-images.html", + rightsLabel: "原作公版 · PG 1540 标记美国公版", + rightsURLString: "https://www.gutenberg.org/ebooks/1540", + presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "goethe-gipfeln", + text: "Ueber allen Gipfeln\nIst Ruh’,", + credit: "Johann Wolfgang von Goethe · Ein Gleiches · 1780", + category: .worldLiterature, + languageTag: "de", + rightsBasis: .ccBySA4, + sourceLabel: "Deutsche Wikisource · 校对完成的 1827 版", + sourceURLString: "https://de.wikisource.org/wiki/Ein_Gleiches", + rightsLabel: "原文公版 · Wikisource CC BY-SA 4.0", + rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", + presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "pascal-heart-reasons", + text: "Le cœur a ses raisons, que la raison ne connaît point ; on le sent en mille choses.", + credit: "Blaise Pascal · Pensées · éd. Didiot, 1896, p. 62", + category: .worldLiterature, + languageTag: "fr", + rightsBasis: .ccBySA4, + sourceLabel: "Wikisource · 1896 年影印校对页", + sourceURLString: "https://fr.wikisource.org/wiki/Page%3APascal_-_Pens%C3%A9es%2C_%C3%A9d._Didiot%2C_1896.djvu/80", + rightsLabel: "原文公版 · Wikisource CC BY-SA 4.0", + rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", + presentation: .quotation + ), EmptyWorkspaceInspiration( id: "euler-formula", text: "eⁱˣ = cos x + i sin x", credit: "Leonhard Euler · Introductio in analysin infinitorum, 1748 · 现代记法", + category: .mathematics, + languageTag: "zxx", + rightsBasis: .publicDomain, sourceLabel: "ETH-Bibliothek e-rara · DOI 10.3931/e-rara-8740", sourceURLString: "https://www.e-rara.ch/zut/content/titleinfo/2447176", rightsLabel: "1748 原书公版 · Public Domain Mark", rightsURLString: "https://creativecommons.org/publicdomain/mark/1.0/", presentation: .formula ), + EmptyWorkspaceInspiration( + id: "euclid-pythagorean", + text: "a² + b² = c²", + credit: "Euclid · Elements, Book I, Proposition 47 · 现代记法", + category: .mathematics, + languageTag: "zxx", + rightsBasis: .publicDomain, + sourceLabel: "Project Gutenberg eBook 21076 · Euclid’s Elements", + sourceURLString: "https://www.gutenberg.org/ebooks/21076", + rightsLabel: "数学关系 / 事实 · 原书标记美国公版", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "bayes-theorem", + text: "P(A | B) = P(B | A)P(A) / P(B)", + credit: "Thomas Bayes · An Essay towards solving a Problem in the Doctrine of Chances, 1763 · 现代记法", + category: .mathematics, + languageTag: "zxx", + rightsBasis: .uncopyrightableFact, + sourceLabel: "Royal Society · DOI 10.1098/rstl.1763.0053", + sourceURLString: "https://royalsocietypublishing.org/doi/10.1098/rstl.1763.0053", + rightsLabel: "数学公式 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), EmptyWorkspaceInspiration( id: "einstein-rest-energy", text: "E₀ = mc²", credit: "Albert Einstein · Ist die Trägheit eines Körpers von seinem Energieinhalt abhängig?, 1905 · 现代记法", + category: .physics, + languageTag: "zxx", + rightsBasis: .uncopyrightableFact, sourceLabel: "Max Planck Institute for the History of Science", sourceURLString: "https://einstein-annalen.mpiwg-berlin.mpg.de/annalen/alphabetical/Einst_Istdi_de_1905", rightsLabel: "物理公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula ), + EmptyWorkspaceInspiration( + id: "schrodinger-equation", + text: "Ĥψ = Eψ", + credit: "Erwin Schrödinger · Quantisierung als Eigenwertproblem, 1926 · 现代记法", + category: .physics, + languageTag: "zxx", + rightsBasis: .uncopyrightableFact, + sourceLabel: "Annalen der Physik · DOI 10.1002/andp.19263840404", + sourceURLString: "https://doi.org/10.1002/andp.19263840404", + rightsLabel: "物理公式 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), EmptyWorkspaceInspiration( id: "cobb-douglas-production", text: "P = bLᵏC¹⁻ᵏ", credit: "Charles W. Cobb & Paul H. Douglas · A Theory of Production, 1928", + category: .economics, + languageTag: "zxx", + rightsBasis: .uncopyrightableFact, sourceLabel: "The American Economic Review 18(1)", sourceURLString: "https://www.jstor.org/stable/1811556", rightsLabel: "经济学公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula ), + EmptyWorkspaceInspiration( + id: "fisher-exchange", + text: "MV + M′V′ = ΣpQ", + credit: "Irving Fisher · The Purchasing Power of Money, 1911", + category: .economics, + languageTag: "zxx", + rightsBasis: .uncopyrightableFact, + sourceLabel: "FRASER · Federal Reserve Bank of St. Louis", + sourceURLString: "https://fraser.stlouisfed.org/title/purchasing-power-money-3610/fulltext", + rightsLabel: "经济学公式 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "aristotle-non-contradiction", + text: "¬(p ∧ ¬p)", + credit: "Aristotle · Metaphysics IV.3, 1005b19–20 · 现代逻辑记法", + category: .philosophy, + languageTag: "zxx", + rightsBasis: .uncopyrightableFact, + sourceLabel: "MIT Internet Classics Archive · W. D. Ross", + sourceURLString: "https://classics.mit.edu/Aristotle/metaphysics.4.iv.html", + rightsLabel: "逻辑原则 / 事实 · 不主张版权", + rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", + presentation: .formula + ), ] + /// Interleave fields so successive days and manual advances reveal the catalog's breadth. + public static let rotationItems: [EmptyWorkspaceInspiration] = { + let categoryOrder: [EmptyWorkspaceInspirationCategory] = [ + .chineseClassics, .worldLiterature, .mathematics, + .chineseClassics, .physics, .worldLiterature, + .chineseClassics, .economics, .mathematics, + .chineseClassics, .philosophy, .worldLiterature, + .chineseClassics, .physics, .economics, + .chineseClassics, .worldLiterature, .chineseClassics, .mathematics, + ] + var consumed: [EmptyWorkspaceInspirationCategory: Int] = [:] + return categoryOrder.compactMap { category in + let categoryItems = items.filter { $0.category == category } + let index = consumed[category, default: 0] + guard categoryItems.indices.contains(index) else { return nil } + consumed[category] = index + 1 + return categoryItems[index] + } + }() + public static func item(for date: Date, calendar: Calendar = .current) -> EmptyWorkspaceInspiration { - precondition(!items.isEmpty) + precondition(!rotationItems.isEmpty) let ordinal = calendar.ordinality(of: .day, in: .era, for: date) ?? 1 - return items[(ordinal - 1) % items.count] + return rotationItems[(ordinal - 1) % rotationItems.count] } public static var validationErrors: [String] { @@ -159,8 +390,13 @@ public enum EmptyWorkspaceInspirationCatalog { errors.append("inspiration IDs must be unique") } + let categories = Set(items.map(\.category)) + for category in EmptyWorkspaceInspirationCategory.allCases where !categories.contains(category) { + errors.append("inspiration category is missing: \(category.rawValue)") + } + for item in items { - if item.id.isEmpty || item.text.isEmpty || item.credit.isEmpty || item.sourceLabel.isEmpty || item.rightsLabel.isEmpty { + if item.id.isEmpty || item.text.isEmpty || item.credit.isEmpty || item.languageTag.isEmpty || item.sourceLabel.isEmpty || item.rightsLabel.isEmpty { errors.append("\(item.id): required metadata is missing") } if item.sourceURL?.scheme != "https" { @@ -172,6 +408,16 @@ public enum EmptyWorkspaceInspirationCatalog { if case let .calligraphy(assetName) = item.presentation, assetName.isEmpty { errors.append("\(item.id): calligraphy asset is missing") } + if case .calligraphy = item.presentation, + item.category != .chineseClassics || item.languageTag != "zh-Hant" || item.rightsBasis != .publicDomain { + errors.append("\(item.id): calligraphy must be a rights-cleared Chinese classic") + } + if item.presentation == .formula, item.languageTag != "zxx" { + errors.append("\(item.id): formula-only entries must use the zxx language tag") + } + if item.presentation != .formula, item.languageTag == "zxx" { + errors.append("\(item.id): original-language entries must preserve their language tag") + } } return errors } diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index ac6571e2e..e95f74d71 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -1,5 +1,6 @@ import AppKit import CoreText +import CryptoKit import Foundation import PDFKit import Security @@ -86,14 +87,24 @@ expect(EmptyWorkspaceDayPeriod.morning.greeting(language: .chinese).contains(" && !EmptyWorkspaceDayPeriod.morning.greeting(language: .english).isEmpty, "empty workspace greetings stay localized and non-empty") let inspirationItems = EmptyWorkspaceInspirationCatalog.items -expect(inspirationItems.count >= 6 +let rotationItems = EmptyWorkspaceInspirationCatalog.rotationItems +let inspirationLanguageTags = Set(inspirationItems.filter { $0.presentation != .formula }.map(\.languageTag)) +expect(inspirationItems.count >= 16 && EmptyWorkspaceInspirationCatalog.validationErrors.isEmpty + && Set(inspirationItems.map(\.category)) == Set(EmptyWorkspaceInspirationCategory.allCases) + && Set(["zh-Hant", "ja", "en", "de", "fr"]).isSubset(of: inspirationLanguageTags) && inspirationItems.contains(where: { if case .calligraphy = $0.presentation { return true }; return false }) && inspirationItems.contains(where: { $0.presentation == .quotation }) - && inspirationItems.contains(where: { $0.presentation == .formula }), "daily inspiration catalog contains validated calligraphy, original-language quotation, and formulas") + && inspirationItems.contains(where: { $0.presentation == .formula }), "daily inspiration catalog contains every supported field, at least five original languages, verified calligraphy, quotations, and formulas") +expect(rotationItems.count == inspirationItems.count + && Set(rotationItems.map(\.id)) == Set(inspirationItems.map(\.id)) + && rotationItems.enumerated().allSatisfy { index, item in + item.category != rotationItems[(index + 1) % rotationItems.count].category + }, "daily and manual inspiration rotation interleaves fields without losing catalog entries") expect(inspirationItems.allSatisfy { item in !item.text.isEmpty && !item.credit.isEmpty + && !item.languageTag.isEmpty && item.sourceURL?.scheme == "https" && !item.rightsLabel.isEmpty && item.rightsURL?.scheme == "https" @@ -233,24 +244,45 @@ func inspectCalligraphyAsset(_ url: URL) throws -> (width: Int, height: Int, vis let calligraphyDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Resources/Inspiration/Calligraphy", isDirectory: true) -let clearBreezeStats = try inspectCalligraphyAsset(calligraphyDirectoryURL.appendingPathComponent("lanting-clear-breeze.png")) -let universeStats = try inspectCalligraphyAsset(calligraphyDirectoryURL.appendingPathComponent("lanting-universe.png")) -expect(clearBreezeStats.width == 856 && clearBreezeStats.height == 132 - && universeStats.width == 624 && universeStats.height == 132 - && clearBreezeStats.visible > 1_000 && universeStats.visible > 1_000 - && clearBreezeStats.transparent > clearBreezeStats.visible - && universeStats.transparent > universeStats.visible - && clearBreezeStats.opaqueWhite == 0 && universeStats.opaqueWhite == 0 - && clearBreezeStats.outerInk == 0 && universeStats.outerInk == 0, "bundled Lanting calligraphy masks are transparent, uncropped, and free of hard white backgrounds") +let expectedCalligraphyAssets: [String: (width: Int, height: Int, sha256: String)] = [ + "lanting-clear-breeze": (856, 132, "b30c54279d2e0b5c7b8221369962ba3a3c0e16b264808332da38cb1b8e63d936"), + "lanting-universe": (624, 132, "a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22"), + "lanting-observe-kinds": (624, 132, "1c7965b6447392a874ed75adb1ce5703f26b562b8fc5fd6f380d1fdde0621379"), +] +let catalogCalligraphyAssets = Set(inspirationItems.compactMap { item -> String? in + if case let .calligraphy(assetName) = item.presentation { return assetName } + return nil +}) +expect(catalogCalligraphyAssets == Set(expectedCalligraphyAssets.keys), "every catalog calligraphy item has one reviewed bundled asset and no unreferenced calligraphy asset is accepted") + +func sha256Hex(of url: URL) throws -> String { + SHA256.hash(data: try Data(contentsOf: url)) + .map { String(format: "%02x", $0) } + .joined() +} + +for (assetName, expected) in expectedCalligraphyAssets { + let assetURL = calligraphyDirectoryURL.appendingPathComponent("\(assetName).png") + let stats = try inspectCalligraphyAsset(assetURL) + let actualSHA256 = try sha256Hex(of: assetURL) + expect(stats.width == expected.width && stats.height == expected.height + && stats.visible > 1_000 + && stats.transparent > stats.visible + && stats.opaqueWhite == 0 + && stats.outerInk == 0 + && actualSHA256 == expected.sha256, "reviewed calligraphy asset \(assetName) retains its approved hash, transparent background, and safe outer margin") +} let inspirationSourcesURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Resources/Inspiration/SOURCES.md") let inspirationSources = (try? String(contentsOf: inspirationSourcesURL, encoding: .utf8)) ?? "" expect(inspirationSources.contains("a133647a8695cd06d0f5c6215d66e0b8b8d93d56") - && inspirationSources.contains("e5c6827f44b22f5441bb208b1770103da8a076564b52f41e64f77b0da7e1835c") + && inspirationSources.contains("b30c54279d2e0b5c7b8221369962ba3a3c0e16b264808332da38cb1b8e63d936") && inspirationSources.contains("a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22") + && inspirationSources.contains("1c7965b6447392a874ed75adb1ce5703f26b562b8fc5fd6f380d1fdde0621379") && inspirationSources.contains("Public Domain Mark 1.0") && inspirationSources.contains("故00002597") + && inspirationSources.contains("at least five source languages") && inspirationSources.contains("were rejected") && inspirationSources.contains("No NC, ND") && inspirationSources.contains("No generative fill, vector tracing, or font substitution"), "inspiration resource documentation preserves source hashes, public-domain status, provenance, exclusions, and transformation limits") @@ -876,12 +908,26 @@ let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirec let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("static let railOnlyWidth: CGFloat = 88") - && contentRailSource.contains("static let normalWidth: CGFloat = 28") + && contentRailSource.contains("static let normalWidth: CGFloat = 40") + && contentRailSource.contains("private func compactHeight(in totalHeight: CGFloat)") + && contentRailSource.contains("private func compactCenterY(in totalHeight: CGFloat)") + && contentRailSource.contains("return min(max(72, countDrivenHeight), min(160, available))") + && contentRailSource.contains("private func tickLength(for item: ContentRailItem, active: Bool, railHeight: CGFloat)") + && contentRailSource.contains("let influenceRadius: CGFloat = 48") + && contentRailSource.contains("guard distance < influenceRadius else { return normal }") + && contentRailSource.contains("return normal + (34 - normal) * influence") + && contentRailSource.contains("@Environment(\\.accessibilityReduceMotion)") + && contentRailSource.contains("ForEach(items) { item in") + && !contentRailSource.contains("private var collapsedHandle") + && !contentRailSource.contains("private var isExpanded") + && !contentRailSource.contains("LinearGradient(") + && !contentRailSource.contains("private var railBackground") + && !contentRailSource.contains("private var railAtmosphere") && contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") && contentRailSource.contains("previewImage: NSImage?") && contentRailSource.contains(".popover(") && contentRailSource.contains("SpatialTapGesture()") - && contentRailSource.contains("private func nearestItem"), "shared content rail supports normal, rail-only, delayed unclipped hover, dense-track mapping, and real image previews") + && contentRailSource.contains("private func nearestItem"), "shared content rail stays compact at the content edge, keeps every real tick, magnifies only the pointer neighborhood, and preserves rail-only, reduced-motion, delayed preview, dense mapping, and real image previews") expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") && emptyWorkspaceSource.contains("Text(title)") && emptyWorkspaceSource.contains("title: \"DOC\"") @@ -1120,6 +1166,25 @@ expect(notesAgentSource.contains("private var noteRailItems: [ContentRailItem]") && notesAgentSource.contains("private var agentRailItems: [ContentRailItem]") && notesAgentSource.contains("store.requestPaneExpansion(.agent)") && notesAgentSource.components(separatedBy: "let railOnly = store.layout.allowsRailOnlyPanes").count >= 3, "notes and conversation share the content rail and navigate after restoring a narrow pane") +let agentRailSource: String = { + guard let start = notesAgentSource.range(of: "private var agentRailTurns: [AgentRailTurn]")?.lowerBound, + let end = notesAgentSource.range(of: "private var agentPrompt", range: start..<notesAgentSource.endIndex)?.lowerBound else { + return "" + } + return String(notesAgentSource[start..<end]) +}() +expect(!agentRailSource.isEmpty + && agentRailSource.contains("case .user:") + && agentRailSource.contains("turns.append(AgentRailTurn(") + && agentRailSource.contains("startMessageID: message.id") + && agentRailSource.contains("startIndex: index") + && agentRailSource.contains("case .assistant:") + && agentRailSource.contains("turns[turns.count - 1].answer = message.text") + && agentRailSource.contains("turns[turns.count - 1].answer += \"\\n\\n\" + message.text") + && agentRailSource.contains("title: railText(turn.question") + && agentRailSource.contains("excerpt: railText(turn.answer, fallback: store.ui(\"等待回复\", \"Waiting for response\"))") + && agentRailSource.contains("proxy.scrollTo(turn.startMessageID, anchor: .center)") + && agentRailSource.contains("$0.startIndex <= visibleIndex"), "conversation rail keeps one point per user-led turn, previews the whole question-and-answer pair, keeps pending turns visible, and navigates by the user message anchor") let notePaneHeaderSource: String = { guard let start = notesAgentSource.range(of: "struct NotePaneView: View")?.lowerBound, let end = notesAgentSource.range(of: "private func noteFileStatusColor", range: start..<notesAgentSource.endIndex)?.lowerBound else { @@ -2603,13 +2668,14 @@ expect(notesAgentSource.contains("if store.hasSelectedMaterial") && !notesAgentSource.contains("starterChip(\"梳理材料\"") && !notesAgentSource.contains("starterChip(\"出复习题\""), "agent starter chips hide material actions without a selected material and avoid clipped long labels") expect(notesAgentSource.contains("GeometryReader { geometry in") - && notesAgentSource.contains("let availableWidth = max(geometry.size.width - ContentRailMetrics.normalWidth, 1)") + && notesAgentSource.contains("let availableWidth = max(geometry.size.width, 1)") && notesAgentSource.contains("let contentWidth = min(max(availableWidth - 36, 320), agentContentMaxWidth ?? 760)") && notesAgentSource.contains("agentMessageRow(message: message, geometryWidth: availableWidth, contentWidth: contentWidth, proxy: proxy)") && notesAgentSource.contains("private func agentMessageRow(message: AgentMessage, geometryWidth: CGFloat, contentWidth: CGFloat, proxy: ScrollViewProxy) -> some View") && notesAgentSource.contains(".padding(.top, store.messages.isEmpty ? 22 : 0)") && notesAgentSource.contains(".frame(width: availableWidth, alignment: .topLeading)") && notesAgentSource.contains(".frame(minHeight: geometry.size.height, alignment: .topLeading)") + && !notesAgentSource.contains(".padding(.leading, ContentRailMetrics.normalWidth)") && !notesAgentSource.contains("alignment: store.messages.isEmpty ? .bottomLeading : .topLeading"), "agent empty state starts in the content area instead of being pinned to the composer") expect(notesAgentSource.contains("canPolishNoteSelection") && notesAgentSource.contains("store.selectionContext?.isNoteSelection == true"), "selection agent only shows polish for note selections") expect(notesAgentSource.contains("Text(store.ui(\"正在读选区...\", \"Reading selection...\"))") From 0151b1c03963546ad5758528dbbc9668742e9f2c Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 00:23:59 +0800 Subject: [PATCH 07/36] fix: anchor content rail ticks from the left --- Sources/WeiBei/Views/ContentRailView.swift | 90 ++++++++++++---------- Sources/WeiBeiSelfCheck/main.swift | 28 +++++-- 2 files changed, 72 insertions(+), 46 deletions(-) diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index ccfb625f9..c4f3552c6 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -131,6 +131,10 @@ struct ContentRailView: View { isRailOnly ? 42 : 40 } + private var tickLeadingInset: CGFloat { + isRailOnly ? 4 : 3 + } + private var resolvedActiveID: String? { activeID ?? items.first?.id } @@ -145,16 +149,17 @@ struct ContentRailView: View { emptyOriginMark } else { let hitHeight = railHitHeight(for: height) - ForEach(items) { item in + ForEach(Array(items.enumerated()), id: \.element.id) { index, item in railButton( for: item, + index: index, railHeight: height, hitHeight: hitHeight, acceptsPointer: hitHeight >= 4 ) .position( x: compactWidth / 2, - y: railY(position: item.position, height: height) + y: railY(index: index, count: items.count, height: height) ) } @@ -190,25 +195,24 @@ struct ContentRailView: View { Rectangle() .fill(WeiBeiTheme.hairline.opacity(0.64)) .frame(width: 8, height: 1.5) - .frame(width: compactWidth, height: 34) + .frame(width: compactWidth - tickLeadingInset, height: 20, alignment: .leading) + .padding(.leading, tickLeadingInset) .accessibilityLabel(Text(label)) } private func compactHeight(in totalHeight: CGFloat) -> CGFloat { let top = max(topInset, 0) + 10 let bottom = max(bottomInset, 0) + 10 - let available = max(totalHeight - top - bottom, 34) - guard items.count > 1 else { return min(items.isEmpty ? 34 : 50, available) } - - let countDrivenHeight = 72 + CGFloat(min(max(items.count - 2, 0), 14)) * 6.3 - return min(max(72, countDrivenHeight), min(160, available)) + let available = max(totalHeight - top - bottom, 1) + let desiredHeight = max(20, 14 + CGFloat(max(items.count - 1, 0)) * 8) + return min(desiredHeight, min(160, available)) } private func compactCenterY(in totalHeight: CGFloat) -> CGFloat { let top = max(topInset, 0) + 10 let bottom = max(bottomInset, 0) + 10 let available = max(totalHeight - top - bottom, 0) - return min(max(top + available / 2, 17), max(totalHeight - 17, 17)) + return min(max(top + available / 2, 0), max(totalHeight, 0)) } private func updatePointerY(_ y: CGFloat, height: CGFloat) { @@ -220,16 +224,17 @@ struct ContentRailView: View { } private func restoreFocusedPointer(height: CGFloat) { - let focusedItem = focusedItemID.flatMap { id in - items.first(where: { $0.id == id }) + let focusedIndex = focusedItemID.flatMap { id in + items.firstIndex(where: { $0.id == id }) } withAnimation(waveMotion) { - pointerY = focusedItem.map { railY(position: $0.position, height: height) } + pointerY = focusedIndex.map { railY(index: $0, count: items.count, height: height) } } } private func railButton( for item: ContentRailItem, + index: Int, railHeight: CGFloat, hitHeight: CGFloat, acceptsPointer: Bool @@ -240,13 +245,14 @@ struct ContentRailView: View { activate(item) } label: { Rectangle() - .fill(tickColor(itemID: item.id, active: active)) + .fill(tickColor(active: active)) .frame( - width: tickLength(for: item, active: active, railHeight: railHeight), + width: tickLength(for: item, index: index, active: active, railHeight: railHeight), height: active ? 2 : 1.5 ) - .opacity(tickOpacity(for: item, active: active, railHeight: railHeight)) - .frame(width: compactWidth, height: hitHeight) + .opacity(tickOpacity(active: active)) + .frame(width: compactWidth - tickLeadingInset, height: hitHeight, alignment: .leading) + .padding(.leading, tickLeadingInset) .contentShape(Rectangle()) } .buttonStyle(.plain) @@ -273,7 +279,6 @@ struct ContentRailView: View { } } .animation(WeiBeiMotion.micro, value: activeID) - .animation(WeiBeiMotion.hover, value: hoveredID) .animation(waveMotion, value: pointerY) } @@ -311,11 +316,11 @@ struct ContentRailView: View { .accessibilityHidden(true) } - private func tickLength(for item: ContentRailItem, active: Bool, railHeight: CGFloat) -> CGFloat { + private func tickLength(for item: ContentRailItem, index: Int, active: Bool, railHeight: CGFloat) -> CGFloat { let normal: CGFloat = active ? 8 : (item.level == 0 ? 7 : 6) guard let pointerY else { return normal } - let distance = abs(railY(position: item.position, height: railHeight) - pointerY) + let distance = abs(railY(index: index, count: items.count, height: railHeight) - pointerY) let influenceRadius: CGFloat = 48 guard distance < influenceRadius else { return normal } let linear = 1 - distance / influenceRadius @@ -323,44 +328,47 @@ struct ContentRailView: View { return normal + (34 - normal) * influence } - private func tickOpacity(for item: ContentRailItem, active: Bool, railHeight: CGFloat) -> Double { - let normal: Double = active ? 1 : 0.64 - guard let pointerY else { return normal } - - let distance = abs(railY(position: item.position, height: railHeight) - pointerY) - let influenceRadius: CGFloat = 48 - guard distance < influenceRadius else { return normal } - let linear = 1 - distance / influenceRadius - let influence = Double(linear * linear * (3 - 2 * linear)) - return normal + (1 - normal) * influence + private func tickOpacity(active: Bool) -> Double { + active ? 1 : 0.64 } - private func tickColor(itemID: String, active: Bool) -> Color { + private func tickColor(active: Bool) -> Color { if active { return appearanceMode == .inkstone ? WeiBeiTheme.onCinnabar : WeiBeiTheme.cinnabar } - if hoveredID == itemID { - return WeiBeiTheme.ink.opacity(0.92) - } return WeiBeiTheme.hairline.opacity(0.92) } - private func railY(position: CGFloat, height: CGFloat) -> CGFloat { - let available = max(height - 14, 0) - return min(max(7 + min(max(position, 0), 1) * available, 7), max(height - 7, 7)) + private func railSpacing(count: Int, height: CGFloat) -> CGFloat { + guard count > 1 else { return 0 } + let verticalInset = min(7, height / 2) + let available = max(height - verticalInset * 2, 0) + return min(8, available / CGFloat(count - 1)) + } + + private func railY(index: Int, count: Int, height: CGFloat) -> CGFloat { + guard count > 1 else { return height / 2 } + let spacing = railSpacing(count: count, height: height) + let span = spacing * CGFloat(count - 1) + let firstY = (height - span) / 2 + return firstY + CGFloat(min(max(index, 0), count - 1)) * spacing } private func railHitHeight(for height: CGFloat) -> CGFloat { guard !items.isEmpty else { return 20 } - let available = max(height - 14, 1) - return min(20, available / CGFloat(items.count)) + guard items.count > 1 else { return min(20, height) } + return min(20, max(railSpacing(count: items.count, height: height), 1)) } private func nearestItem(to y: CGFloat, height: CGFloat) -> ContentRailItem? { guard !items.isEmpty else { return nil } - let available = max(height - 14, 1) - let position = min(max((y - 7) / available, 0), 1) - return items.min { abs($0.position - position) < abs($1.position - position) } + guard items.count > 1 else { return items[0] } + let spacing = railSpacing(count: items.count, height: height) + guard spacing > 0 else { return items[0] } + let firstY = railY(index: 0, count: items.count, height: height) + let rawIndex = ((y - firstY) / spacing).rounded() + let index = min(max(Int(rawIndex), 0), items.count - 1) + return items[index] } private func previewCard(for item: ContentRailItem) -> some View { diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index e95f74d71..d7ad913ca 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -906,18 +906,34 @@ let inspirationCatalogSource = (try? String(contentsOf: inspirationCatalogSource let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/ContentRailView.swift") let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" +let contentRailGeometrySource: String = { + guard let start = contentRailSource.range(of: "private func compactRail(height: CGFloat)")?.lowerBound, + let end = contentRailSource.range(of: "private func previewCard", range: start..<contentRailSource.endIndex)?.lowerBound else { + return "" + } + return String(contentRailSource[start..<end]) +}() expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("static let railOnlyWidth: CGFloat = 88") && contentRailSource.contains("static let normalWidth: CGFloat = 40") && contentRailSource.contains("private func compactHeight(in totalHeight: CGFloat)") && contentRailSource.contains("private func compactCenterY(in totalHeight: CGFloat)") - && contentRailSource.contains("return min(max(72, countDrivenHeight), min(160, available))") - && contentRailSource.contains("private func tickLength(for item: ContentRailItem, active: Bool, railHeight: CGFloat)") + && contentRailSource.contains("let desiredHeight = max(20, 14 + CGFloat(max(items.count - 1, 0)) * 8)") + && contentRailSource.contains("return min(desiredHeight, min(160, available))") + && contentRailSource.contains("private func railY(index: Int, count: Int, height: CGFloat)") + && contentRailSource.contains("private func railSpacing(count: Int, height: CGFloat)") + && contentRailSource.contains("private func tickLength(for item: ContentRailItem, index: Int, active: Bool, railHeight: CGFloat)") && contentRailSource.contains("let influenceRadius: CGFloat = 48") && contentRailSource.contains("guard distance < influenceRadius else { return normal }") && contentRailSource.contains("return normal + (34 - normal) * influence") + && contentRailSource.contains("private func tickOpacity(active: Bool) -> Double") + && contentRailSource.contains("private func tickColor(active: Bool) -> Color") && contentRailSource.contains("@Environment(\\.accessibilityReduceMotion)") - && contentRailSource.contains("ForEach(items) { item in") + && contentRailGeometrySource.contains("ForEach(Array(items.enumerated()), id: \\.element.id)") + && contentRailGeometrySource.contains("alignment: .leading") + && contentRailGeometrySource.contains("let rawIndex = ((y - firstY) / spacing).rounded()") + && !contentRailGeometrySource.contains("item.position") + && !contentRailGeometrySource.contains("countDrivenHeight") && !contentRailSource.contains("private var collapsedHandle") && !contentRailSource.contains("private var isExpanded") && !contentRailSource.contains("LinearGradient(") @@ -927,7 +943,7 @@ expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("previewImage: NSImage?") && contentRailSource.contains(".popover(") && contentRailSource.contains("SpatialTapGesture()") - && contentRailSource.contains("private func nearestItem"), "shared content rail stays compact at the content edge, keeps every real tick, magnifies only the pointer neighborhood, and preserves rail-only, reduced-motion, delayed preview, dense mapping, and real image previews") + && contentRailSource.contains("private func nearestItem"), "shared content rail left-aligns every real tick, grows symmetrically with equal spacing, magnifies only the pointer neighborhood, and preserves rail-only, reduced-motion, delayed preview, dense mapping, and real image previews") expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") && emptyWorkspaceSource.contains("Text(title)") && emptyWorkspaceSource.contains("title: \"DOC\"") @@ -1333,7 +1349,8 @@ expect(readerViewSource.contains("private final class PDFContentRailPreviewLoade && readerViewSource.contains("page.thumbnail(of:") && readerViewSource.contains("static let contentRailScript") && readerViewSource.contains("window.WeiBeiContentRail") - && readerViewSource.contains("if railOnly {\n store.requestPaneExpansion(.reader)"), "PDF and HTML rails use real page or document content and restore narrow reader panes") + && readerViewSource.contains("if railOnly {\n store.requestPaneExpansion(.reader)") + && !readerViewSource.contains("ContentRailMetrics.normalWidth"), "PDF and HTML rails overlay real page or document content without reserving reading width and restore narrow reader panes") let selectionAnchorContentPointSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Support/SelectionAnchorContentPoint.swift") let selectionAnchorContentPointSource = (try? String(contentsOf: selectionAnchorContentPointSourceURL, encoding: .utf8)) ?? "" @@ -2675,6 +2692,7 @@ expect(notesAgentSource.contains("GeometryReader { geometry in") && notesAgentSource.contains(".padding(.top, store.messages.isEmpty ? 22 : 0)") && notesAgentSource.contains(".frame(width: availableWidth, alignment: .topLeading)") && notesAgentSource.contains(".frame(minHeight: geometry.size.height, alignment: .topLeading)") + && !notesAgentSource.contains("ContentRailMetrics.normalWidth") && !notesAgentSource.contains(".padding(.leading, ContentRailMetrics.normalWidth)") && !notesAgentSource.contains("alignment: store.messages.isEmpty ? .bottomLeading : .topLeading"), "agent empty state starts in the content area instead of being pinned to the composer") expect(notesAgentSource.contains("canPolishNoteSelection") && notesAgentSource.contains("store.selectionContext?.isNoteSelection == true"), "selection agent only shows polish for note selections") From b2105270f1288d59915462a7c9a0bde777748e18 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 00:55:53 +0800 Subject: [PATCH 08/36] fix: make content rail hover precise --- Sources/WeiBei/Views/ContentRailView.swift | 282 ++++++++------------- Sources/WeiBeiSelfCheck/main.swift | 20 +- 2 files changed, 114 insertions(+), 188 deletions(-) diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index c4f3552c6..279defeae 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -55,8 +55,6 @@ struct ContentRailView: View { @State private var previewID: String? @State private var previewOpenWork: DispatchWorkItem? @State private var previewCloseWork: DispatchWorkItem? - @State private var isPointerInside = false - @State private var pointerY: CGFloat? @FocusState private var focusedItemID: String? @Environment(\.accessibilityReduceMotion) private var reduceMotion @@ -86,13 +84,31 @@ struct ContentRailView: View { var body: some View { GeometryReader { geometry in let height = compactHeight(in: geometry.size.height) - compactRail(height: height) - .position( - x: railWidth / 2, - y: compactCenterY(in: geometry.size.height) - ) + ZStack(alignment: .topLeading) { + compactRail(height: height) + .position( + x: compactWidth / 2, + y: compactCenterY(in: geometry.size.height) + ) + + if let previewID, + let previewIndex = items.firstIndex(where: { $0.id == previewID }), + let width = previewWidth(in: geometry.size.width) { + previewCard(for: items[previewIndex], width: width) + .position( + x: compactWidth + 12 + width / 2, + y: previewY( + index: previewIndex, + railHeight: height, + totalHeight: geometry.size.height + ) + ) + .allowsHitTesting(false) + .transition(.opacity.combined(with: .scale(scale: 0.98, anchor: .leading))) + .zIndex(20) + } + } } - .frame(width: railWidth) .accessibilityElement(children: .contain) .accessibilityLabel(Text(label)) .animation(WeiBeiMotion.panel, value: isRailOnly) @@ -106,9 +122,6 @@ struct ContentRailView: View { if let focusedItemID, !ids.contains(focusedItemID) { self.focusedItemID = nil } - if ids.isEmpty { - pointerY = nil - } } .onDisappear { previewOpenWork?.cancel() @@ -119,14 +132,6 @@ struct ContentRailView: View { } } - private var railWidth: CGFloat { - isRailOnly ? ContentRailMetrics.railOnlyWidth : ContentRailMetrics.normalWidth - } - - private var previewWidth: CGFloat { - 336 - } - private var compactWidth: CGFloat { isRailOnly ? 42 : 40 } @@ -139,6 +144,14 @@ struct ContentRailView: View { activeID ?? items.first?.id } + private var emphasizedID: String? { + hoveredID ?? focusedItemID + } + + private var highlightedID: String? { + emphasizedID ?? resolvedActiveID + } + private var waveMotion: Animation? { reduceMotion ? nil : .easeOut(duration: 0.10) } @@ -152,10 +165,7 @@ struct ContentRailView: View { ForEach(Array(items.enumerated()), id: \.element.id) { index, item in railButton( for: item, - index: index, - railHeight: height, - hitHeight: hitHeight, - acceptsPointer: hitHeight >= 4 + hitHeight: hitHeight ) .position( x: compactWidth / 2, @@ -163,31 +173,15 @@ struct ContentRailView: View { ) } - if hitHeight < 4 { - denseRailPointerSurface(height: height) - } + railPointerSurface(height: height) + .zIndex(10) + } } .frame(width: compactWidth, height: height) .contentShape(Rectangle()) .onExitCommand { focusedItemID = nil - isPointerInside = false - pointerY = nil - } - .onContinuousHover { phase in - switch phase { - case .active(let location): - isPointerInside = true - updatePointerY(location.y, height: height) - case .ended: - isPointerInside = false - restoreFocusedPointer(height: height) - } - } - .onChange(of: focusedItemID) { _, _ in - guard !isPointerInside else { return } - restoreFocusedPointer(height: height) } } @@ -215,29 +209,24 @@ struct ContentRailView: View { return min(max(top + available / 2, 0), max(totalHeight, 0)) } - private func updatePointerY(_ y: CGFloat, height: CGFloat) { - let value = min(max(y, 0), height) - guard pointerY == nil || abs((pointerY ?? value) - value) > 0.5 else { return } - withAnimation(waveMotion) { - pointerY = value - } + private func previewWidth(in totalWidth: CGFloat) -> CGFloat? { + guard !isRailOnly else { return nil } + let available = totalWidth - compactWidth - 20 + guard available >= 220 else { return nil } + return min(336, available) } - private func restoreFocusedPointer(height: CGFloat) { - let focusedIndex = focusedItemID.flatMap { id in - items.firstIndex(where: { $0.id == id }) - } - withAnimation(waveMotion) { - pointerY = focusedIndex.map { railY(index: $0, count: items.count, height: height) } - } + private func previewY(index: Int, railHeight: CGFloat, totalHeight: CGFloat) -> CGFloat { + let localY = railY(index: index, count: items.count, height: railHeight) + let proposedY = compactCenterY(in: totalHeight) - railHeight / 2 + localY + let halfPreviewHeight: CGFloat = 74 + guard totalHeight > halfPreviewHeight * 2 else { return totalHeight / 2 } + return min(max(proposedY, halfPreviewHeight), totalHeight - halfPreviewHeight) } private func railButton( for item: ContentRailItem, - index: Int, - railHeight: CGFloat, - hitHeight: CGFloat, - acceptsPointer: Bool + hitHeight: CGFloat ) -> some View { let active = item.id == resolvedActiveID @@ -245,12 +234,11 @@ struct ContentRailView: View { activate(item) } label: { Rectangle() - .fill(tickColor(active: active)) + .fill(tickColor(for: item, active: active)) .frame( - width: tickLength(for: item, index: index, active: active, railHeight: railHeight), + width: tickLength(for: item, active: active), height: active ? 2 : 1.5 ) - .opacity(tickOpacity(active: active)) .frame(width: compactWidth - tickLeadingInset, height: hitHeight, alignment: .leading) .padding(.leading, tickLeadingInset) .contentShape(Rectangle()) @@ -260,43 +248,21 @@ struct ContentRailView: View { .accessibilityLabel(Text("\(label):\(item.title)")) .accessibilityValue(Text(active ? "当前位置" : item.metadata)) .help(item.title) - .allowsHitTesting(acceptsPointer) - .popover( - isPresented: previewBinding(for: item), - attachmentAnchor: .rect(.bounds), - arrowEdge: .leading - ) { - previewCard(for: item) - .frame(width: previewWidth) - .padding(4) - } - .onHover { hovering in - guard acceptsPointer else { return } - if hovering { - beginHover(item) - } else { - endHover(item) - } - } .animation(WeiBeiMotion.micro, value: activeID) - .animation(waveMotion, value: pointerY) + .animation(waveMotion, value: emphasizedID) } - private func denseRailPointerSurface(height: CGFloat) -> some View { + private func railPointerSurface(height: CGFloat) -> some View { Color.clear .contentShape(Rectangle()) .onContinuousHover { phase in switch phase { case .active(let location): - isPointerInside = true - updatePointerY(location.y, height: height) if let item = nearestItem(to: location.y, height: height), hoveredID != item.id { beginHover(item) } case .ended: - isPointerInside = false - restoreFocusedPointer(height: height) if let hoveredID, let item = items.first(where: { $0.id == hoveredID }) { endHover(item) @@ -316,27 +282,16 @@ struct ContentRailView: View { .accessibilityHidden(true) } - private func tickLength(for item: ContentRailItem, index: Int, active: Bool, railHeight: CGFloat) -> CGFloat { + private func tickLength(for item: ContentRailItem, active: Bool) -> CGFloat { let normal: CGFloat = active ? 8 : (item.level == 0 ? 7 : 6) - guard let pointerY else { return normal } - - let distance = abs(railY(index: index, count: items.count, height: railHeight) - pointerY) - let influenceRadius: CGFloat = 48 - guard distance < influenceRadius else { return normal } - let linear = 1 - distance / influenceRadius - let influence = linear * linear * (3 - 2 * linear) - return normal + (34 - normal) * influence + return item.id == emphasizedID ? 34 : normal } - private func tickOpacity(active: Bool) -> Double { - active ? 1 : 0.64 - } - - private func tickColor(active: Bool) -> Color { - if active { + private func tickColor(for item: ContentRailItem, active: Bool) -> Color { + if item.id == highlightedID { return appearanceMode == .inkstone ? WeiBeiTheme.onCinnabar : WeiBeiTheme.cinnabar } - return WeiBeiTheme.hairline.opacity(0.92) + return WeiBeiTheme.secondaryInk.opacity(appearanceMode == .inkstone ? 0.78 : 0.58) } private func railSpacing(count: Int, height: CGFloat) -> CGFloat { @@ -371,81 +326,59 @@ struct ContentRailView: View { return items[index] } - private func previewCard(for item: ContentRailItem) -> some View { - Button { - activate(item) - } label: { - HStack(alignment: .top, spacing: item.previewImage == nil ? 0 : 12) { - if let image = item.previewImage { - Image(nsImage: image) - .resizable() - .aspectRatio(contentMode: .fill) - .frame(width: 88, height: 112) - .clipped() - .accessibilityHidden(true) + private func previewCard(for item: ContentRailItem, width: CGFloat) -> some View { + HStack(alignment: .top, spacing: item.previewImage == nil ? 0 : 12) { + if let image = item.previewImage { + Image(nsImage: image) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 88, height: 112) + .clipped() + .accessibilityHidden(true) + } + + VStack(alignment: .leading, spacing: 7) { + Text(label) + .font(.system(size: 9.5, weight: .semibold, design: .serif)) + .tracking(0.7) + .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.78)) + .lineLimit(1) + + Text(item.title) + .font(.system(size: 13.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(2) + .frame(maxWidth: .infinity, alignment: .leading) + + if !item.excerpt.isEmpty { + Text(item.excerpt) + .font(.system(size: 12.5)) + .lineSpacing(3) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .lineLimit(item.previewImage == nil ? 4 : 3) + .frame(maxWidth: .infinity, alignment: .leading) } - VStack(alignment: .leading, spacing: 7) { - Text(label) - .font(.system(size: 9.5, weight: .semibold, design: .serif)) - .tracking(0.7) - .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.78)) + if !item.metadata.isEmpty { + Text(item.metadata) + .font(.system(size: 10.5, weight: .medium, design: .monospaced)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) .lineLimit(1) - - Text(item.title) - .font(.system(size: 13.5, weight: .semibold)) - .foregroundStyle(WeiBeiTheme.ink) - .lineLimit(2) .frame(maxWidth: .infinity, alignment: .leading) - - if !item.excerpt.isEmpty { - Text(item.excerpt) - .font(.system(size: 12.5)) - .lineSpacing(3) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .lineLimit(item.previewImage == nil ? 4 : 3) - .frame(maxWidth: .infinity, alignment: .leading) - } - - if !item.metadata.isEmpty { - Text(item.metadata) - .font(.system(size: 10.5, weight: .medium, design: .monospaced)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) - .lineLimit(1) - .frame(maxWidth: .infinity, alignment: .leading) - } } - .frame(maxWidth: .infinity, alignment: .leading) - } - .padding(12) - .frame(width: previewWidth, alignment: .leading) - .background(WeiBeiTheme.paperRaised) - .overlay { - RoundedRectangle(cornerRadius: 6, style: .continuous) - .stroke(WeiBeiTheme.hairline.opacity(0.82), lineWidth: 1) } - .clipShape(RoundedRectangle(cornerRadius: 6, style: .continuous)) - .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode == .inkstone ? 0.22 : 0.08), radius: 8, y: 4) + .frame(maxWidth: .infinity, alignment: .leading) } - .buttonStyle(.plain) - .accessibilityLabel(Text("\(item.title),点击打开")) - .onHover { hovering in - if hovering { - holdPreview(item) - } else { - endHover(item) - } + .padding(12) + .frame(width: width, alignment: .leading) + .background(WeiBeiTheme.paperRaised) + .overlay { + RoundedRectangle(cornerRadius: 6, style: .continuous) + .stroke(WeiBeiTheme.hairline.opacity(0.82), lineWidth: 1) } - } - - private func previewBinding(for item: ContentRailItem) -> Binding<Bool> { - Binding( - get: { previewID == item.id }, - set: { presented in - guard !presented, previewID == item.id else { return } - closePreview(immediately: true) - } - ) + .clipShape(RoundedRectangle(cornerRadius: 6, style: .continuous)) + .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode == .inkstone ? 0.22 : 0.08), radius: 8, y: 4) + .accessibilityHidden(true) } private func beginHover(_ item: ContentRailItem) { @@ -469,17 +402,6 @@ struct ContentRailView: View { DispatchQueue.main.asyncAfter(deadline: .now() + 0.10, execute: work) } - private func holdPreview(_ item: ContentRailItem) { - previewCloseWork?.cancel() - hoveredID = item.id - if previewID != item.id { - withAnimation(WeiBeiMotion.hover) { - previewID = item.id - } - } - onHover(item) - } - private func endHover(_ item: ContentRailItem) { if hoveredID == item.id { hoveredID = nil diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index d7ad913ca..2dc494d3a 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -922,12 +922,10 @@ expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("return min(desiredHeight, min(160, available))") && contentRailSource.contains("private func railY(index: Int, count: Int, height: CGFloat)") && contentRailSource.contains("private func railSpacing(count: Int, height: CGFloat)") - && contentRailSource.contains("private func tickLength(for item: ContentRailItem, index: Int, active: Bool, railHeight: CGFloat)") - && contentRailSource.contains("let influenceRadius: CGFloat = 48") - && contentRailSource.contains("guard distance < influenceRadius else { return normal }") - && contentRailSource.contains("return normal + (34 - normal) * influence") - && contentRailSource.contains("private func tickOpacity(active: Bool) -> Double") - && contentRailSource.contains("private func tickColor(active: Bool) -> Color") + && contentRailSource.contains("private func tickLength(for item: ContentRailItem, active: Bool)") + && contentRailSource.contains("return item.id == emphasizedID ? 34 : normal") + && contentRailSource.contains("private func tickColor(for item: ContentRailItem, active: Bool) -> Color") + && contentRailSource.contains("WeiBeiTheme.secondaryInk.opacity(appearanceMode == .inkstone ? 0.78 : 0.58)") && contentRailSource.contains("@Environment(\\.accessibilityReduceMotion)") && contentRailGeometrySource.contains("ForEach(Array(items.enumerated()), id: \\.element.id)") && contentRailGeometrySource.contains("alignment: .leading") @@ -941,9 +939,15 @@ expect(contentRailSource.contains("struct ContentRailView: View") && !contentRailSource.contains("private var railAtmosphere") && contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") && contentRailSource.contains("previewImage: NSImage?") - && contentRailSource.contains(".popover(") + && contentRailSource.contains("x: compactWidth + 12 + width / 2") + && contentRailSource.contains("guard available >= 220 else { return nil }") + && contentRailSource.contains("guard !isRailOnly else { return nil }") + && contentRailSource.contains(".allowsHitTesting(false)") + && !contentRailSource.contains(".popover(") + && !contentRailSource.contains("influenceRadius") + && !contentRailSource.contains("pointerY") && contentRailSource.contains("SpatialTapGesture()") - && contentRailSource.contains("private func nearestItem"), "shared content rail left-aligns every real tick, grows symmetrically with equal spacing, magnifies only the pointer neighborhood, and preserves rail-only, reduced-motion, delayed preview, dense mapping, and real image previews") + && contentRailSource.contains("private func nearestItem"), "shared content rail left-aligns every real tick, grows only the exact hovered tick with equal spacing, keeps mode-aware gray ticks visible, places a non-interactive preview to the right, and preserves one-click dense mapping, reduced motion, and real image previews") expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") && emptyWorkspaceSource.contains("Text(title)") && emptyWorkspaceSource.contains("title: \"DOC\"") From 77f802e40767c1f55de7b6c16ba212a1484e7a0d Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 04:05:14 +0800 Subject: [PATCH 09/36] fix: match content rail distance wave --- Sources/WeiBei/Views/ContentRailView.swift | 37 +++++++++++++++---- Sources/WeiBeiSelfCheck/main.swift | 16 ++++++--- design-qa.md | 41 ++++++++++++++++++++++ 3 files changed, 83 insertions(+), 11 deletions(-) create mode 100644 design-qa.md diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index 279defeae..9b49861b7 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -40,6 +40,16 @@ enum ContentRailMetrics { static let defaultReadableWidth: CGFloat = 420 } +enum ContentRailWaveMetrics { + static let peakLength: CGFloat = 28 + static let influences: [CGFloat] = [1, 0.70, 0.41, 0.20] + + static func length(normal: CGFloat, stepDistance: Int) -> CGFloat { + guard influences.indices.contains(stepDistance) else { return normal } + return normal + (peakLength - normal) * influences[stepDistance] + } +} + struct ContentRailView: View { let label: String let items: [ContentRailItem] @@ -96,7 +106,7 @@ struct ContentRailView: View { let width = previewWidth(in: geometry.size.width) { previewCard(for: items[previewIndex], width: width) .position( - x: compactWidth + 12 + width / 2, + x: previewLeadingX + width / 2, y: previewY( index: previewIndex, railHeight: height, @@ -140,6 +150,10 @@ struct ContentRailView: View { isRailOnly ? 4 : 3 } + private var previewLeadingX: CGFloat { + tickLeadingInset + ContentRailWaveMetrics.peakLength + 8 + } + private var resolvedActiveID: String? { activeID ?? items.first?.id } @@ -165,6 +179,7 @@ struct ContentRailView: View { ForEach(Array(items.enumerated()), id: \.element.id) { index, item in railButton( for: item, + index: index, hitHeight: hitHeight ) .position( @@ -211,9 +226,9 @@ struct ContentRailView: View { private func previewWidth(in totalWidth: CGFloat) -> CGFloat? { guard !isRailOnly else { return nil } - let available = totalWidth - compactWidth - 20 + let available = totalWidth - previewLeadingX - 8 guard available >= 220 else { return nil } - return min(336, available) + return min(360, available) } private func previewY(index: Int, railHeight: CGFloat, totalHeight: CGFloat) -> CGFloat { @@ -226,6 +241,7 @@ struct ContentRailView: View { private func railButton( for item: ContentRailItem, + index: Int, hitHeight: CGFloat ) -> some View { let active = item.id == resolvedActiveID @@ -236,7 +252,7 @@ struct ContentRailView: View { Rectangle() .fill(tickColor(for: item, active: active)) .frame( - width: tickLength(for: item, active: active), + width: tickLength(for: item, index: index, active: active), height: active ? 2 : 1.5 ) .frame(width: compactWidth - tickLeadingInset, height: hitHeight, alignment: .leading) @@ -282,14 +298,21 @@ struct ContentRailView: View { .accessibilityHidden(true) } - private func tickLength(for item: ContentRailItem, active: Bool) -> CGFloat { + private func tickLength(for item: ContentRailItem, index: Int, active: Bool) -> CGFloat { let normal: CGFloat = active ? 8 : (item.level == 0 ? 7 : 6) - return item.id == emphasizedID ? 34 : normal + guard let emphasizedID, + let emphasizedIndex = items.firstIndex(where: { $0.id == emphasizedID }) else { + return normal + } + return ContentRailWaveMetrics.length( + normal: normal, + stepDistance: abs(index - emphasizedIndex) + ) } private func tickColor(for item: ContentRailItem, active: Bool) -> Color { if item.id == highlightedID { - return appearanceMode == .inkstone ? WeiBeiTheme.onCinnabar : WeiBeiTheme.cinnabar + return WeiBeiTheme.cinnabar } return WeiBeiTheme.secondaryInk.opacity(appearanceMode == .inkstone ? 0.78 : 0.58) } diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 2dc494d3a..16e78ad84 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -922,9 +922,14 @@ expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("return min(desiredHeight, min(160, available))") && contentRailSource.contains("private func railY(index: Int, count: Int, height: CGFloat)") && contentRailSource.contains("private func railSpacing(count: Int, height: CGFloat)") - && contentRailSource.contains("private func tickLength(for item: ContentRailItem, active: Bool)") - && contentRailSource.contains("return item.id == emphasizedID ? 34 : normal") + && contentRailSource.contains("enum ContentRailWaveMetrics") + && contentRailSource.contains("static let peakLength: CGFloat = 28") + && contentRailSource.contains("static let influences: [CGFloat] = [1, 0.70, 0.41, 0.20]") + && contentRailSource.contains("return normal + (peakLength - normal) * influences[stepDistance]") + && contentRailSource.contains("private func tickLength(for item: ContentRailItem, index: Int, active: Bool)") + && contentRailSource.contains("stepDistance: abs(index - emphasizedIndex)") && contentRailSource.contains("private func tickColor(for item: ContentRailItem, active: Bool) -> Color") + && contentRailSource.contains("return WeiBeiTheme.cinnabar") && contentRailSource.contains("WeiBeiTheme.secondaryInk.opacity(appearanceMode == .inkstone ? 0.78 : 0.58)") && contentRailSource.contains("@Environment(\\.accessibilityReduceMotion)") && contentRailGeometrySource.contains("ForEach(Array(items.enumerated()), id: \\.element.id)") @@ -939,7 +944,10 @@ expect(contentRailSource.contains("struct ContentRailView: View") && !contentRailSource.contains("private var railAtmosphere") && contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") && contentRailSource.contains("previewImage: NSImage?") - && contentRailSource.contains("x: compactWidth + 12 + width / 2") + && contentRailSource.contains("x: previewLeadingX + width / 2") + && contentRailSource.contains("tickLeadingInset + ContentRailWaveMetrics.peakLength + 8") + && contentRailSource.contains("let available = totalWidth - previewLeadingX - 8") + && contentRailSource.contains("return min(360, available)") && contentRailSource.contains("guard available >= 220 else { return nil }") && contentRailSource.contains("guard !isRailOnly else { return nil }") && contentRailSource.contains(".allowsHitTesting(false)") @@ -947,7 +955,7 @@ expect(contentRailSource.contains("struct ContentRailView: View") && !contentRailSource.contains("influenceRadius") && !contentRailSource.contains("pointerY") && contentRailSource.contains("SpatialTapGesture()") - && contentRailSource.contains("private func nearestItem"), "shared content rail left-aligns every real tick, grows only the exact hovered tick with equal spacing, keeps mode-aware gray ticks visible, places a non-interactive preview to the right, and preserves one-click dense mapping, reduced motion, and real image previews") + && contentRailSource.contains("private func nearestItem"), "shared content rail left-aligns a short Codex-like distance wave with equal spacing, keeps mode-aware gray ticks visible, places a wider non-interactive preview directly after the peak, and preserves one-click dense mapping, reduced motion, and real image previews") expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") && emptyWorkspaceSource.contains("Text(title)") && emptyWorkspaceSource.contains("title: \"DOC\"") diff --git a/design-qa.md b/design-qa.md new file mode 100644 index 000000000..3427705aa --- /dev/null +++ b/design-qa.md @@ -0,0 +1,41 @@ +# Content Rail Design QA + +- Source visual truth: `/var/folders/yp/wx87z0l97wj89_yj8nw7_ptm0000gn/T/codex-clipboard-f9bffc1d-eecd-440f-9c92-ed91b8df9cc3.png` +- Light implementation screenshot: `/private/tmp/weibei-wave-qa-351.png` +- Dark implementation screenshot: `/private/tmp/weibei-wave-dark-qa-352.png` +- Focused comparison: `/private/tmp/weibei-content-rail-comparison-final.png` +- Viewport: 2560 x 1640 app capture; focused comparison normalized to 536 x 310 per side +- State: second rail item hovered, preview visible, dark appearance + +## Full-view comparison evidence + +The rail remains a floating overlay and does not reserve document width. The preview opens to the right of the wave, stays inside the pane, and leaves the reading surface usable. Light and dark captures show no overflow or clipping. + +## Focused comparison evidence + +The reference rail measures 13, 22, 31, 44, 57, 44, 31, 22, 13 pixels around its peak. The implemented four-item sample measures 44, 56, 43, 30 pixels for the available distances, within one pixel of the corresponding reference values. Both use a fixed left edge and rightward growth. + +## Required fidelity surfaces + +- Fonts and typography: existing WeiBei typography is preserved; the change does not alter type. +- Spacing and layout rhythm: peak reduced from 34 to 28 points; neighbors follow 0.70, 0.41, and 0.20 distance weights; preview begins eight points after the peak and gains up to 24 points of width. +- Colors and visual tokens: hovered tick uses semantic cinnabar in both appearances; unselected ticks retain the existing mode-aware gray. +- Image quality and asset fidelity: no image assets were added or modified. +- Copy and content: preview continues to use real document title, excerpt, metadata, and page or section count. + +## Comparison history + +1. P1: the previous peak measured 69 pixels and every neighbor stayed at 15 pixels. Fixed by reducing the peak and adding four-step distance weights. +2. P1: the first dark capture used the pale on-cinnabar foreground for the hovered tick. Fixed by using cinnabar itself in both appearances. The final dark capture shows the selected rail in red. + +## Findings + +No actionable P0, P1, or P2 differences remain. The preview-to-peak gap is six pixels tighter than the reference, an intentional P3 trade-off that gives the preview more usable width. + +## Implementation checklist + +- Run Swift build and both project checks. +- Confirm one-click navigation remains unchanged. +- Package and open a non-activating isolated preview. + +final result: passed From dd66f64da89f6c1bf7ff5cc85da72d7976e7fb71 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 04:19:44 +0800 Subject: [PATCH 10/36] fix: keep content rail off pane dividers --- Sources/WeiBei/Views/ContentRailView.swift | 10 +++++++++- Sources/WeiBei/Views/NotesAgentView.swift | 2 ++ Sources/WeiBei/Views/ReaderView.swift | 5 +++-- Sources/WeiBeiSelfCheck/main.swift | 14 ++++++++++++++ design-qa.md | 1 + 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index 9b49861b7..13faf283a 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -56,6 +56,7 @@ struct ContentRailView: View { let activeID: String? let appearanceMode: WeiBeiAppearanceMode let isRailOnly: Bool + let availableWidth: CGFloat? let topInset: CGFloat let bottomInset: CGFloat let onActivate: (ContentRailItem) -> Void @@ -75,6 +76,7 @@ struct ContentRailView: View { activeID: String? = nil, appearanceMode: WeiBeiAppearanceMode, isRailOnly: Bool = false, + availableWidth: CGFloat? = nil, topInset: CGFloat = 0, bottomInset: CGFloat = 0, onActivate: @escaping (ContentRailItem) -> Void, @@ -85,6 +87,7 @@ struct ContentRailView: View { self.activeID = activeID self.appearanceMode = appearanceMode self.isRailOnly = isRailOnly + self.availableWidth = availableWidth self.topInset = topInset self.bottomInset = bottomInset self.onActivate = onActivate @@ -103,7 +106,7 @@ struct ContentRailView: View { if let previewID, let previewIndex = items.firstIndex(where: { $0.id == previewID }), - let width = previewWidth(in: geometry.size.width) { + let width = previewWidth(in: availableWidth ?? geometry.size.width) { previewCard(for: items[previewIndex], width: width) .position( x: previewLeadingX + width / 2, @@ -119,6 +122,7 @@ struct ContentRailView: View { } } } + .frame(width: railWidth) .accessibilityElement(children: .contain) .accessibilityLabel(Text(label)) .animation(WeiBeiMotion.panel, value: isRailOnly) @@ -146,6 +150,10 @@ struct ContentRailView: View { isRailOnly ? 42 : 40 } + private var railWidth: CGFloat { + isRailOnly ? ContentRailMetrics.railOnlyWidth : ContentRailMetrics.normalWidth + } + private var tickLeadingInset: CGFloat { isRailOnly ? 4 : 3 } diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 1cf6c8089..869c58ef8 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -313,6 +313,7 @@ struct NotePaneView: View { activeID: activeNoteRailID ?? railItems.first?.id, appearanceMode: store.appearanceMode, isRailOnly: railOnly, + availableWidth: geometry.size.width, topInset: railOnly ? 0 : (showsPaneHeader ? 44 : 34), onActivate: { activateNoteRailItem($0, railOnly: railOnly) } ) @@ -1416,6 +1417,7 @@ struct AgentPaneView: View { activeID: activeAgentRailID ?? railItems.first?.id, appearanceMode: store.appearanceMode, isRailOnly: railOnly, + availableWidth: paneGeometry.size.width, topInset: railOnly ? 0 : (showsPaneHeader ? 44 : 34), bottomInset: railOnly ? 0 : 108, onActivate: { activateAgentRailItem($0, railOnly: railOnly, proxy: proxy) } diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift index 5f2f39cda..cad8d9aa7 100644 --- a/Sources/WeiBei/Views/ReaderView.swift +++ b/Sources/WeiBei/Views/ReaderView.swift @@ -175,7 +175,7 @@ struct ReaderView: View { } .overlay(alignment: .leading) { if supportsContentRail { - contentRail(isRailOnly: railOnly) + contentRail(isRailOnly: railOnly, availableWidth: geometry.size.width) .frame( width: railOnly ? min(ContentRailMetrics.railOnlyWidth, geometry.size.width) : geometry.size.width, height: geometry.size.height, @@ -281,13 +281,14 @@ struct ReaderView: View { } } - private func contentRail(isRailOnly: Bool) -> some View { + private func contentRail(isRailOnly: Bool, availableWidth: CGFloat) -> some View { ContentRailView( label: store.ui("文稿导航", "Document Navigation"), items: contentRailItems, activeID: contentRailActiveID, appearanceMode: store.appearanceMode, isRailOnly: isRailOnly, + availableWidth: availableWidth, topInset: showsFloatingTitle && !isRailOnly ? 46 : 14, bottomInset: store.selectedMaterialItem?.kind == .pdf ? 52 : 18, onActivate: { activateContentRailItem($0, railOnly: isRailOnly) }, diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 16e78ad84..072862e4f 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -906,6 +906,12 @@ let inspirationCatalogSource = (try? String(contentsOf: inspirationCatalogSource let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/ContentRailView.swift") let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" +let contentRailReaderSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/ReaderView.swift") +let contentRailReaderSource = (try? String(contentsOf: contentRailReaderSourceURL, encoding: .utf8)) ?? "" +let contentRailPaneSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/NotesAgentView.swift") +let contentRailPaneSource = (try? String(contentsOf: contentRailPaneSourceURL, encoding: .utf8)) ?? "" let contentRailGeometrySource: String = { guard let start = contentRailSource.range(of: "private func compactRail(height: CGFloat)")?.lowerBound, let end = contentRailSource.range(of: "private func previewCard", range: start..<contentRailSource.endIndex)?.lowerBound else { @@ -916,6 +922,10 @@ let contentRailGeometrySource: String = { expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("static let railOnlyWidth: CGFloat = 88") && contentRailSource.contains("static let normalWidth: CGFloat = 40") + && contentRailSource.contains("let availableWidth: CGFloat?") + && contentRailSource.contains("availableWidth: CGFloat? = nil") + && contentRailSource.contains("previewWidth(in: availableWidth ?? geometry.size.width)") + && contentRailSource.contains(".frame(width: railWidth)") && contentRailSource.contains("private func compactHeight(in totalHeight: CGFloat)") && contentRailSource.contains("private func compactCenterY(in totalHeight: CGFloat)") && contentRailSource.contains("let desiredHeight = max(20, 14 + CGFloat(max(items.count - 1, 0)) * 8)") @@ -956,6 +966,10 @@ expect(contentRailSource.contains("struct ContentRailView: View") && !contentRailSource.contains("pointerY") && contentRailSource.contains("SpatialTapGesture()") && contentRailSource.contains("private func nearestItem"), "shared content rail left-aligns a short Codex-like distance wave with equal spacing, keeps mode-aware gray ticks visible, places a wider non-interactive preview directly after the peak, and preserves one-click dense mapping, reduced motion, and real image previews") +expect(contentRailReaderSource.contains("contentRail(isRailOnly: railOnly, availableWidth: geometry.size.width)") + && contentRailReaderSource.contains("availableWidth: availableWidth") + && contentRailPaneSource.components(separatedBy: "availableWidth:").count >= 3, + "content rails keep a narrow hit surface while receiving real pane width only for preview layout") expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") && emptyWorkspaceSource.contains("Text(title)") && emptyWorkspaceSource.contains("title: \"DOC\"") diff --git a/design-qa.md b/design-qa.md index 3427705aa..2b8daa7bb 100644 --- a/design-qa.md +++ b/design-qa.md @@ -27,6 +27,7 @@ The reference rail measures 13, 22, 31, 44, 57, 44, 31, 22, 13 pixels around its 1. P1: the previous peak measured 69 pixels and every neighbor stayed at 15 pixels. Fixed by reducing the peak and adding four-step distance weights. 2. P1: the first dark capture used the pale on-cinnabar foreground for the hovered tick. Fixed by using cinnabar itself in both appearances. The final dark capture shows the selected rail in red. +3. P1: the full-width transparent rail overlay exposed background window dragging at pane borders in non-fullscreen windows. Fixed by restoring the rail's 40-point hit surface while passing pane width as layout data only. `/private/tmp/weibei-divider-qa-401.png` confirms the overflow preview still renders with the narrow hit surface. ## Findings From 2dc6255ce4dd39b5852b494b34c6e50f0fb988e4 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 05:10:06 +0800 Subject: [PATCH 11/36] fix: keep divider drags out of window movement --- Sources/WeiBei/Views/StableDocumentWorkspace.swift | 1 + Sources/WeiBeiSelfCheck/main.swift | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Sources/WeiBei/Views/StableDocumentWorkspace.swift b/Sources/WeiBei/Views/StableDocumentWorkspace.swift index ba2586016..97eb717c3 100644 --- a/Sources/WeiBei/Views/StableDocumentWorkspace.swift +++ b/Sources/WeiBei/Views/StableDocumentWorkspace.swift @@ -186,6 +186,7 @@ private final class StableDocumentDividerView: NSView { override var isFlipped: Bool { true } override var acceptsFirstResponder: Bool { false } + override var mouseDownCanMoveWindow: Bool { false } override init(frame frameRect: NSRect) { super.init(frame: frameRect) diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 072862e4f..3cef2ab7e 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -978,6 +978,9 @@ expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentOb && emptyWorkspaceSource.contains("action: store.toggleReader") && emptyWorkspaceSource.contains("action: store.toggleAgent") && emptyWorkspaceSource.contains("action: store.toggleNotes"), "empty workspace exposes direct document, chat, and notes entries through the existing pane toggles") +expect(stableDocumentSource.contains("override var mouseDownCanMoveWindow: Bool { false }") + && stableDocumentSource.contains("override func mouseDragged(with event: NSEvent)"), + "stable pane dividers resize panes instead of being claimed by movable window background dragging") expect(emptyWorkspaceSource.contains("WeiBeiTypography.englishBrandFont") && emptyWorkspaceSource.contains("entryDivider") && emptyWorkspaceSource.contains("Rectangle()") From 82732663897b4624deeca2bb98c9bee86b13098d Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 05:30:03 +0800 Subject: [PATCH 12/36] feat: expand offline inspiration catalog --- .../WeiBei/Resources/Inspiration/SOURCES.md | 13 +- .../Views/EmptyWorkspaceLauncherView.swift | 53 +--- .../EmptyWorkspaceInspiration.swift | 226 ++++++++++++++++-- Sources/WeiBeiSelfCheck/main.swift | 22 +- 4 files changed, 253 insertions(+), 61 deletions(-) diff --git a/Sources/WeiBei/Resources/Inspiration/SOURCES.md b/Sources/WeiBei/Resources/Inspiration/SOURCES.md index afe197ea3..21f240a28 100644 --- a/Sources/WeiBei/Resources/Inspiration/SOURCES.md +++ b/Sources/WeiBei/Resources/Inspiration/SOURCES.md @@ -2,7 +2,7 @@ WeiBei bundles the text, formulas, and three verified calligraphy alpha masks in this directory so the empty workspace works without a network connection. Source links are visible for traceability but are never required for rendering. -The first offline catalog contains 19 entries across six fields: Chinese classics, world literature, mathematics, physics, economics, and philosophy. It preserves at least five source languages: Classical Chinese, Japanese, English, German, and French. Formula-only entries use the BCP 47 `zxx` tag because they contain no linguistic text. +The offline catalog contains exactly 50 entries across six fields: Chinese classics, world literature, mathematics, physics, economics, and philosophy. It preserves Classical Chinese, Japanese, English, German, French, Italian, Spanish, Latin, and Portuguese. Formula-only entries use the BCP 47 `zxx` tag because they contain no linguistic text. The machine-readable ledger in `EmptyWorkspaceInspiration.swift` stores the exact source URL, rights URL, rights basis, language tag, author/work credit, and presentation mode for every entry. No NC, ND, modern calligraphy font, license-unclear dataset, translation, or generated quotation is included. Formula and foreign-language entries are typeset normally and are never presented as calligraphy. WeiBei claims no copyright in mathematical, physical, economic, or logical facts. @@ -30,6 +30,17 @@ No NC, ND, modern calligraphy font, license-unclear dataset, translation, or gen | `fisher-exchange` | Economics | `MV + M′V′ = ΣpQ` | Irving Fisher, *The Purchasing Power of Money*, 1911 | [FRASER full text, Federal Reserve Bank of St. Louis](https://fraser.stlouisfed.org/title/purchasing-power-money-3610/fulltext) | Economic formula / fact; no source-book prose is bundled and no copyright is claimed in the expression. Circular 33. | | `aristotle-non-contradiction` | Philosophy / logic | `¬(p ∧ ¬p)` | Aristotle, *Metaphysics* IV.3, 1005b19–20; modern logical notation | [MIT Internet Classics Archive, W. D. Ross source passage](https://classics.mit.edu/Aristotle/metaphysics.4.iv.html) | Logical principle / fact; the symbolic expression is a modern notation and no copyright is claimed. Circular 33. | +## Expanded 31-entry ledger + +- Chinese classics: `analects-three-companions`, `yijing-self-renewal`, and `tao-peach-blossom` use ancient public-domain originals transcribed by Chinese Wikisource under CC BY-SA 4.0. +- World originals: `dante-midway`, `cervantes-la-mancha`, and `virgil-arms-man` use Project Gutenberg public-domain editions; `rilke-change-life` and `pessoa-poet-feigns` use proofread Wikisource originals under CC BY-SA 4.0. No translations are bundled. +- Mathematics: `quadratic-formula`, `newton-leibniz`, `fourier-transform`, and `shannon-entropy` are formula/fact entries. Sources are Circular 33, BnF Gallica, and the original Shannon-paper DOI. +- Physics: `newton-second-law`, `maxwell-gauss-law`, `planck-relation`, `boltzmann-entropy`, `uncertainty-principle`, and `de-broglie-wave` cite Project Gutenberg, original-paper DOIs, or the HAL thesis record. Only modern formula notation is bundled. +- Economics: `national-income-identity`, `price-elasticity`, `present-value`, `keynes-multiplier`, and `black-scholes-pde` cite BEA, Project Gutenberg, Investor.gov, original-paper DOI records, or the scanned original book. Only formula/fact expressions are bundled. +- Philosophy: `descartes-cogito`, `kant-sapere-aude`, `spinoza-nature`, and `hume-reason-passions` use public-domain original-language texts from Wikisource or Project Gutenberg. `mao-serve-the-people`, `mao-seek-truth`, `mao-single-spark`, and `mao-double-hundred` are extremely short historical slogans or a title with People/CPC history sources; no protected poem, essay passage, translation, or *Selected Works* excerpt is bundled. + +Mao Zedong died in 1976. Article 23 of the current [Copyright Law of the People's Republic of China](https://www.npc.gov.cn/c2/c30834/202011/t20201119_308796.html) protects a natural person's economic rights through 31 December of the fiftieth year after death. Therefore Mao's poems and prose remain excluded from this 2026 package absent permission; the catalog may reconsider public-domain originals from 2027 onward. + ## Calligraphy transformation Only the three verified *Lantingji Xu* phrases use calligraphy. The source scan itself is not bundled. Product credit must say `唐摹本傳馮承素`: the Palace Museum record says the traditional attribution to Feng Chengsu is not certain. diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index 402995c56..d60740959 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -6,7 +6,7 @@ struct EmptyWorkspaceLauncherView: View { @EnvironmentObject private var store: WorkspaceStore @Environment(\.accessibilityReduceMotion) private var reduceMotion - @State private var inspirationOffset = 0 + @State private var selectedInspirationID: String? var body: some View { TimelineView(.periodic(from: .now, by: 60)) { timeline in @@ -33,10 +33,8 @@ struct EmptyWorkspaceLauncherView: View { EmptyWorkspaceInspirationView( inspiration: currentInspiration, - position: inspirationPosition(currentInspiration), - total: EmptyWorkspaceInspirationCatalog.rotationItems.count, compact: compact, - onAdvance: advanceInspiration + onAdvance: { advanceInspiration(from: currentInspiration.id) } ) .transition(.opacity) } @@ -78,12 +76,8 @@ struct EmptyWorkspaceLauncherView: View { private func inspiration(at date: Date) -> EmptyWorkspaceInspiration { let baseInspiration = dailyInspiration(at: date) - let items = EmptyWorkspaceInspirationCatalog.rotationItems - guard !items.isEmpty, - let baseIndex = items.firstIndex(where: { $0.id == baseInspiration.id }) - else { return baseInspiration } - - return items[(baseIndex + inspirationOffset) % items.count] + guard let selectedInspirationID else { return baseInspiration } + return EmptyWorkspaceInspirationCatalog.rotationItems.first(where: { $0.id == selectedInspirationID }) ?? baseInspiration } private func dailyInspiration(at date: Date) -> EmptyWorkspaceInspiration { @@ -106,17 +100,15 @@ struct EmptyWorkspaceLauncherView: View { return EmptyWorkspaceInspirationCatalog.item(for: date) } - private func inspirationPosition(_ inspiration: EmptyWorkspaceInspiration) -> Int { - (EmptyWorkspaceInspirationCatalog.rotationItems.firstIndex(where: { $0.id == inspiration.id }) ?? 0) + 1 - } - - private func advanceInspiration() { + private func advanceInspiration(from currentID: String) { guard !EmptyWorkspaceInspirationCatalog.rotationItems.isEmpty else { return } + var generator = SystemRandomNumberGenerator() + let nextID = EmptyWorkspaceInspirationCatalog.randomItem(excludingID: currentID, using: &generator).id if reduceMotion { - inspirationOffset = (inspirationOffset + 1) % EmptyWorkspaceInspirationCatalog.rotationItems.count + selectedInspirationID = nextID } else { withAnimation(.easeInOut(duration: 0.24)) { - inspirationOffset = (inspirationOffset + 1) % EmptyWorkspaceInspirationCatalog.rotationItems.count + selectedInspirationID = nextID } } } @@ -267,8 +259,6 @@ private struct EmptyWorkspaceInspirationView: View { @Environment(\.accessibilityReduceMotion) private var reduceMotion let inspiration: EmptyWorkspaceInspiration - let position: Int - let total: Int let compact: Bool let onAdvance: () -> Void @@ -279,8 +269,6 @@ private struct EmptyWorkspaceInspirationView: View { VStack(spacing: compact ? 7 : 9) { Button(action: onAdvance) { VStack(spacing: compact ? 8 : 11) { - inspirationCounter - inspirationContent Text(inspiration.credit) @@ -303,7 +291,7 @@ private struct EmptyWorkspaceInspirationView: View { .animation(reduceMotion ? nil : .easeOut(duration: 0.18), value: focused) .accessibilityElement(children: .ignore) .accessibilityLabel(Text("\(inspiration.text),\(inspiration.credit)")) - .accessibilityHint(Text(store.ui("切换到下一则灵感", "Show the next inspiration"))) + .accessibilityHint(Text(store.ui("随机换一则灵感", "Show a random inspiration"))) .accessibilityIdentifier("empty-workspace-inspiration-next") sourceAndRights @@ -313,28 +301,9 @@ private struct EmptyWorkspaceInspirationView: View { .accessibilityIdentifier("empty-workspace-inspiration-\(inspiration.id)") } - private var inspirationCounter: some View { - HStack(spacing: 8) { - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(hovering || focused ? 0.72 : 0.48)) - .frame(width: hovering || focused ? 28 : 18, height: 1) - - Text(String(format: "%02d / %02d", position, total)) - .font(.system(size: compact ? 8.5 : 9, weight: .medium, design: .monospaced)) - .tracking(1.1) - .foregroundStyle(WeiBeiTheme.tertiaryInk) - .monospacedDigit() - - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(hovering || focused ? 0.72 : 0.48)) - .frame(width: hovering || focused ? 28 : 18, height: 1) - } - .accessibilityHidden(true) - } - private var advanceLabel: some View { HStack(spacing: 6) { - Text(store.ui("点击换一则", "NEXT")) + Text(store.ui("随机换一则", "RANDOM")) Text("→") .offset(x: hovering && !reduceMotion ? 2 : 0) } diff --git a/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift index 1bdc02afe..a4529b7b1 100644 --- a/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift +++ b/Sources/WeiBeiCore/EmptyWorkspaceInspiration.swift @@ -355,28 +355,224 @@ public enum EmptyWorkspaceInspirationCatalog { rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula ), + EmptyWorkspaceInspiration( + id: "analects-three-companions", text: "三人行,必有我師焉。", credit: "孔子《論語·述而》", + category: .chineseClassics, languageTag: "zh-Hant", rightsBasis: .ccBySA4, + sourceLabel: "維基文庫《論語·述而第七》", sourceURLString: "https://zh.wikisource.org/zh-hant/%E8%AB%96%E8%AA%9E/%E8%BF%B0%E8%80%8C%E7%AC%AC%E4%B8%83", + rightsLabel: "先秦原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "yijing-self-renewal", text: "天行健,君子以自強不息。", credit: "《周易·乾卦》", + category: .chineseClassics, languageTag: "zh-Hant", rightsBasis: .ccBySA4, + sourceLabel: "維基文庫《易經》", sourceURLString: "https://zh.wikisource.org/zh-hant/%E6%98%93%E7%B6%93", + rightsLabel: "古代原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "tao-peach-blossom", text: "採菊東籬下,悠然見南山。", credit: "陶淵明《飲酒·其五》", + category: .chineseClassics, languageTag: "zh-Hant", rightsBasis: .ccBySA4, + sourceLabel: "維基文庫《飲酒二十首》", sourceURLString: "https://zh.wikisource.org/zh-hant/%E9%A3%B2%E9%85%92%E4%BA%8C%E5%8D%81%E9%A6%96", + rightsLabel: "古代原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "dante-midway", text: "Nel mezzo del cammin di nostra vita\nmi ritrovai per una selva oscura,", credit: "Dante Alighieri · Inferno, Canto I", + category: .worldLiterature, languageTag: "it", rightsBasis: .publicDomain, + sourceLabel: "Project Gutenberg eBook 1000", sourceURLString: "https://www.gutenberg.org/ebooks/1000", + rightsLabel: "原作公版 · Project Gutenberg 标记美国公版", rightsURLString: "https://www.gutenberg.org/policy/permission.html", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "cervantes-la-mancha", text: "En un lugar de la Mancha, de cuyo nombre no quiero acordarme…", credit: "Miguel de Cervantes · Don Quijote de la Mancha, I.1", + category: .worldLiterature, languageTag: "es", rightsBasis: .publicDomain, + sourceLabel: "Project Gutenberg eBook 2000", sourceURLString: "https://www.gutenberg.org/ebooks/2000", + rightsLabel: "原作公版 · Project Gutenberg 标记美国公版", rightsURLString: "https://www.gutenberg.org/policy/permission.html", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "virgil-arms-man", text: "Arma virumque cano, Troiae qui primus ab oris…", credit: "Vergilius · Aeneis, Liber I", + category: .worldLiterature, languageTag: "la", rightsBasis: .publicDomain, + sourceLabel: "Project Gutenberg eBook 227", sourceURLString: "https://www.gutenberg.org/ebooks/227", + rightsLabel: "古典原文公版 · Project Gutenberg 标记美国公版", rightsURLString: "https://www.gutenberg.org/policy/permission.html", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "rilke-change-life", text: "Du mußt dein Leben ändern.", credit: "Rainer Maria Rilke · Archaïscher Torso Apollos · 1908", + category: .worldLiterature, languageTag: "de", rightsBasis: .ccBySA4, + sourceLabel: "Deutsche Wikisource · 1918 版", sourceURLString: "https://de.wikisource.org/wiki/Archa%C3%AFscher_Torso_Apollos", + rightsLabel: "原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "pessoa-poet-feigns", text: "O poeta é um fingidor.", credit: "Fernando Pessoa · Autopsicografia · 1931", + category: .worldLiterature, languageTag: "pt", rightsBasis: .ccBySA4, + sourceLabel: "Wikisource《Autopsicografia》", sourceURLString: "https://pt.wikisource.org/wiki/Autopsicografia", + rightsLabel: "原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "quadratic-formula", text: "x = (−b ± √(b² − 4ac)) / 2a", credit: "二次方程求根公式 · 现代记法", + category: .mathematics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "U.S. Copyright Office Circular 33", sourceURLString: "https://www.copyright.gov/circs/circ33.pdf", + rightsLabel: "数学公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "newton-leibniz", text: "∫ₐᵇ f′(x) dx = f(b) − f(a)", credit: "Newton–Leibniz formula · 现代记法", + category: .mathematics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "U.S. Copyright Office Circular 33", sourceURLString: "https://www.copyright.gov/circs/circ33.pdf", + rightsLabel: "数学公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "fourier-transform", text: "F(ω) = ∫₋∞∞ f(t)e⁻ⁱωᵗ dt", credit: "Joseph Fourier · Théorie analytique de la chaleur, 1822 · 现代记法", + category: .mathematics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Bibliothèque nationale de France · Gallica", sourceURLString: "https://gallica.bnf.fr/ark:/12148/bpt6k33707", + rightsLabel: "数学公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "shannon-entropy", text: "H = −Σ pᵢ log₂ pᵢ", credit: "Claude E. Shannon · A Mathematical Theory of Communication, 1948", + category: .mathematics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Bell System Technical Journal · DOI", sourceURLString: "https://doi.org/10.1002/j.1538-7305.1948.tb01338.x", + rightsLabel: "数学公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "newton-second-law", text: "F = ma", credit: "Isaac Newton · Philosophiæ Naturalis Principia Mathematica · 现代记法", + category: .physics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Project Gutenberg eBook 28233", sourceURLString: "https://www.gutenberg.org/ebooks/28233", + rightsLabel: "物理公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "maxwell-gauss-law", text: "∇ · E = ρ / ε₀", credit: "James Clerk Maxwell · A Dynamical Theory of the Electromagnetic Field, 1865 · 现代记法", + category: .physics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Royal Society · DOI 10.1098/rstl.1865.0008", sourceURLString: "https://doi.org/10.1098/rstl.1865.0008", + rightsLabel: "物理公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "planck-relation", text: "E = hν", credit: "Max Planck · 1901 · 现代记法", + category: .physics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Annalen der Physik · DOI", sourceURLString: "https://doi.org/10.1002/andp.19013090310", + rightsLabel: "物理公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "boltzmann-entropy", text: "S = k log W", credit: "Ludwig Boltzmann · 1877 · 现代记法", + category: .physics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Wiener Berichte · DOI", sourceURLString: "https://doi.org/10.1007/BF01517726", + rightsLabel: "物理公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "uncertainty-principle", text: "Δx Δp ≥ ℏ / 2", credit: "Werner Heisenberg · 1927 · 现代记法", + category: .physics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Zeitschrift für Physik · DOI", sourceURLString: "https://doi.org/10.1007/BF01397280", + rightsLabel: "物理公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "de-broglie-wave", text: "λ = h / p", credit: "Louis de Broglie · Recherches sur la théorie des quanta, 1924 · 现代记法", + category: .physics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "HAL theses · tel-00006807", sourceURLString: "https://theses.hal.science/tel-00006807", + rightsLabel: "物理公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "national-income-identity", text: "Y = C + I + G + NX", credit: "National income accounting identity · 现代记法", + category: .economics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "U.S. Bureau of Economic Analysis · NIPA Handbook", sourceURLString: "https://www.bea.gov/resources/methodologies/nipa-handbook", + rightsLabel: "经济学恒等式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "price-elasticity", text: "ε = (dQ / Q) / (dP / P)", credit: "Alfred Marshall · Principles of Economics, 1890 · 现代记法", + category: .economics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Project Gutenberg eBook 3375", sourceURLString: "https://www.gutenberg.org/ebooks/3375", + rightsLabel: "经济学公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "present-value", text: "PV = Σₜ CFₜ / (1 + r)ᵗ", credit: "Present value relation · 现代记法", + category: .economics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "U.S. SEC Investor.gov", sourceURLString: "https://www.investor.gov/introduction-investing/investing-basics/glossary/present-value", + rightsLabel: "金融公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "keynes-multiplier", text: "k = 1 / (1 − c)", credit: "John Maynard Keynes · The General Theory, 1936 · 简化乘数记法", + category: .economics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Internet Archive · The General Theory", sourceURLString: "https://archive.org/details/in.ernet.dli.2015.50092", + rightsLabel: "经济学公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "black-scholes-pde", text: "∂V/∂t + ½σ²S²∂²V/∂S² + rS∂V/∂S − rV = 0", credit: "Fischer Black & Myron Scholes · The Pricing of Options and Corporate Liabilities, 1973", + category: .economics, languageTag: "zxx", rightsBasis: .uncopyrightableFact, + sourceLabel: "Journal of Political Economy · DOI", sourceURLString: "https://doi.org/10.1086/260062", + rightsLabel: "金融公式 / 事实 · 不主张版权", rightsURLString: "https://www.copyright.gov/circs/circ33.pdf", presentation: .formula + ), + EmptyWorkspaceInspiration( + id: "descartes-cogito", text: "Je pense, donc je suis.", credit: "René Descartes · Discours de la méthode, IV · 1637", + category: .philosophy, languageTag: "fr", rightsBasis: .ccBySA4, + sourceLabel: "Wikisource《Discours de la méthode》", sourceURLString: "https://fr.wikisource.org/wiki/Discours_de_la_m%C3%A9thode", + rightsLabel: "原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "kant-sapere-aude", text: "Sapere aude! Habe Muth dich deines eigenen Verstandes zu bedienen!", credit: "Immanuel Kant · Beantwortung der Frage: Was ist Aufklärung? · 1784", + category: .philosophy, languageTag: "de", rightsBasis: .ccBySA4, + sourceLabel: "Deutsche Wikisource · Berlinische Monatsschrift", sourceURLString: "https://de.wikisource.org/wiki/Beantwortung_der_Frage%3A_Was_ist_Aufkl%C3%A4rung%3F", + rightsLabel: "原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "spinoza-nature", text: "Deus sive Natura.", credit: "Baruch Spinoza · Ethica · 1677", + category: .philosophy, languageTag: "la", rightsBasis: .ccBySA4, + sourceLabel: "Latin Wikisource《Ethica》", sourceURLString: "https://la.wikisource.org/wiki/Ethica", + rightsLabel: "原文公版 · Wikisource CC BY-SA 4.0", rightsURLString: "https://creativecommons.org/licenses/by-sa/4.0/", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "hume-reason-passions", text: "Reason is, and ought only to be the slave of the passions.", credit: "David Hume · A Treatise of Human Nature, II.iii.3 · 1739", + category: .philosophy, languageTag: "en", rightsBasis: .publicDomain, + sourceLabel: "Project Gutenberg eBook 4705", sourceURLString: "https://www.gutenberg.org/ebooks/4705", + rightsLabel: "原文公版 · Project Gutenberg 标记美国公版", rightsURLString: "https://www.gutenberg.org/policy/permission.html", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "mao-serve-the-people", text: "為人民服務", credit: "毛澤東《為人民服務》 · 1944", + category: .philosophy, languageTag: "zh-Hant", rightsBasis: .uncopyrightableFact, + sourceLabel: "人民網黨史頻道 · 從提出到寫入黨章", sourceURLString: "https://dangshi.people.com.cn/n1/2020/0407/c85037-31663260.html", + rightsLabel: "極短歷史口號 · 不收錄仍在保護期內的文章正文", rightsURLString: "https://www.npc.gov.cn/c2/c30834/202011/t20201119_308796.html", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "mao-seek-truth", text: "實事求是", credit: "毛澤東倡導的思想路線 · 語出《漢書·河間獻王傳》", + category: .philosophy, languageTag: "zh-Hant", rightsBasis: .uncopyrightableFact, + sourceLabel: "中國共產黨新聞網 · 實事求是是最大的黨性", sourceURLString: "https://cpc.people.com.cn/n1/2022/0922/c443712-32531434.html", + rightsLabel: "古代成語與極短歷史口號 · 不收錄現代受保護正文", rightsURLString: "https://www.npc.gov.cn/c2/c30834/202011/t20201119_308796.html", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "mao-single-spark", text: "星星之火,可以燎原", credit: "毛澤東《星星之火,可以燎原》 · 1930", + category: .philosophy, languageTag: "zh-Hant", rightsBasis: .uncopyrightableFact, + sourceLabel: "中國共產黨新聞網 · 1930年1月5日黨史記錄", sourceURLString: "https://cpc.people.com.cn/BIG5/64162/64165/76621/76627/5231445.html", + rightsLabel: "極短歷史口號 / 文章標題 · 不收錄仍在保護期內的正文", rightsURLString: "https://www.npc.gov.cn/c2/c30834/202011/t20201119_308796.html", presentation: .quotation + ), + EmptyWorkspaceInspiration( + id: "mao-double-hundred", text: "百花齊放,百家爭鳴", credit: "毛澤東提出的“雙百方針” · 1956", + category: .philosophy, languageTag: "zh-Hant", rightsBasis: .uncopyrightableFact, + sourceLabel: "中國共產黨新聞網 · 雙百方針史料", sourceURLString: "https://cpc.people.com.cn/GB/33837/2534760.html", + rightsLabel: "傳統成語構成的極短歷史口號 · 不收錄現代受保護正文", rightsURLString: "https://www.npc.gov.cn/c2/c30834/202011/t20201119_308796.html", presentation: .quotation + ), ] - /// Interleave fields so successive days and manual advances reveal the catalog's breadth. + /// Interleave fields so successive days reveal the catalog's breadth. public static let rotationItems: [EmptyWorkspaceInspiration] = { - let categoryOrder: [EmptyWorkspaceInspirationCategory] = [ - .chineseClassics, .worldLiterature, .mathematics, - .chineseClassics, .physics, .worldLiterature, - .chineseClassics, .economics, .mathematics, - .chineseClassics, .philosophy, .worldLiterature, - .chineseClassics, .physics, .economics, - .chineseClassics, .worldLiterature, .chineseClassics, .mathematics, - ] + let categoryOrder = EmptyWorkspaceInspirationCategory.allCases var consumed: [EmptyWorkspaceInspirationCategory: Int] = [:] - return categoryOrder.compactMap { category in - let categoryItems = items.filter { $0.category == category } - let index = consumed[category, default: 0] - guard categoryItems.indices.contains(index) else { return nil } - consumed[category] = index + 1 - return categoryItems[index] + var result: [EmptyWorkspaceInspiration] = [] + while result.count < items.count { + for category in categoryOrder { + let categoryItems = items.filter { $0.category == category } + let index = consumed[category, default: 0] + guard categoryItems.indices.contains(index) else { continue } + consumed[category] = index + 1 + result.append(categoryItems[index]) + } } + if result.first?.category == result.last?.category, + let last = result.popLast(), + let insertion = result.indices.dropFirst().first(where: { + result[$0 - 1].category != last.category && result[$0].category != last.category + }) { + result.insert(last, at: insertion) + } + return result }() + public static func randomItem<R: RandomNumberGenerator>(excludingID: String?, using generator: inout R) -> EmptyWorkspaceInspiration { + precondition(!rotationItems.isEmpty) + let candidates = rotationItems.filter { $0.id != excludingID } + return candidates.randomElement(using: &generator) ?? rotationItems[0] + } + public static func item(for date: Date, calendar: Calendar = .current) -> EmptyWorkspaceInspiration { precondition(!rotationItems.isEmpty) let ordinal = calendar.ordinality(of: .day, in: .era, for: date) ?? 1 diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 3cef2ab7e..17110c315 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -89,13 +89,17 @@ expect(EmptyWorkspaceDayPeriod.morning.greeting(language: .chinese).contains(" let inspirationItems = EmptyWorkspaceInspirationCatalog.items let rotationItems = EmptyWorkspaceInspirationCatalog.rotationItems let inspirationLanguageTags = Set(inspirationItems.filter { $0.presentation != .formula }.map(\.languageTag)) -expect(inspirationItems.count >= 16 +expect(inspirationItems.count == 50 && EmptyWorkspaceInspirationCatalog.validationErrors.isEmpty && Set(inspirationItems.map(\.category)) == Set(EmptyWorkspaceInspirationCategory.allCases) && Set(["zh-Hant", "ja", "en", "de", "fr"]).isSubset(of: inspirationLanguageTags) && inspirationItems.contains(where: { if case .calligraphy = $0.presentation { return true }; return false }) && inspirationItems.contains(where: { $0.presentation == .quotation }) - && inspirationItems.contains(where: { $0.presentation == .formula }), "daily inspiration catalog contains every supported field, at least five original languages, verified calligraphy, quotations, and formulas") + && inspirationItems.contains(where: { $0.presentation == .formula }) + && inspirationItems.contains(where: { $0.id == "mao-serve-the-people" }) + && inspirationItems.contains(where: { $0.id == "mao-seek-truth" }) + && inspirationItems.contains(where: { $0.id == "mao-single-spark" }) + && inspirationItems.contains(where: { $0.id == "mao-double-hundred" }), "daily inspiration catalog contains exactly fifty source-backed entries across every field, original languages, verified calligraphy, quotations, formulas, and rights-safe historical slogans") expect(rotationItems.count == inspirationItems.count && Set(rotationItems.map(\.id)) == Set(inspirationItems.map(\.id)) && rotationItems.enumerated().allSatisfy { index, item in @@ -115,6 +119,11 @@ let inspirationDayOne = inspirationCalendar.date(from: DateComponents(year: 2026 let inspirationDayTwo = inspirationCalendar.date(byAdding: .day, value: 1, to: inspirationDayOne)! expect(EmptyWorkspaceInspirationCatalog.item(for: inspirationDayOne, calendar: inspirationCalendar).id != EmptyWorkspaceInspirationCatalog.item(for: inspirationDayTwo, calendar: inspirationCalendar).id, "daily inspiration rotates deterministically from one local day to the next") +var inspirationRandomGenerator = SystemRandomNumberGenerator() +let excludedInspirationID = inspirationItems[0].id +expect((0..<100).allSatisfy { _ in + EmptyWorkspaceInspirationCatalog.randomItem(excludingID: excludedInspirationID, using: &inspirationRandomGenerator).id != excludedInspirationID +}, "manual inspiration switching is random and never immediately repeats the current entry") let offlineChinesePreview = AgentOfflinePreview.render( AgentOfflinePreviewInput( @@ -282,7 +291,8 @@ expect(inspirationSources.contains("a133647a8695cd06d0f5c6215d66e0b8b8d93d56") && inspirationSources.contains("1c7965b6447392a874ed75adb1ce5703f26b562b8fc5fd6f380d1fdde0621379") && inspirationSources.contains("Public Domain Mark 1.0") && inspirationSources.contains("故00002597") - && inspirationSources.contains("at least five source languages") + && inspirationSources.contains("exactly 50 entries across six fields") + && inspirationSources.contains("Classical Chinese, Japanese, English, German, French, Italian, Spanish, Latin, and Portuguese") && inspirationSources.contains("were rejected") && inspirationSources.contains("No NC, ND") && inspirationSources.contains("No generative fill, vector tracing, or font substitution"), "inspiration resource documentation preserves source hashes, public-domain status, provenance, exclusions, and transformation limits") @@ -992,6 +1002,12 @@ expect(emptyWorkspaceSource.contains("TimelineView(.periodic(from: .now, by: 60) && emptyWorkspaceSource.contains("geometry.size.width < 760 || geometry.size.height < 620") && emptyWorkspaceSource.contains("min(116, max(76") && emptyWorkspaceSource.contains("minimumScaleFactor(0.78)"), "empty workspace greeting updates with time and its entry and inspiration typography adapt to compact windows") +expect(emptyWorkspaceSource.contains("selectedInspirationID") + && emptyWorkspaceSource.contains("randomItem(excludingID: currentID") + && emptyWorkspaceSource.contains("随机换一则") + && !emptyWorkspaceSource.contains("inspirationCounter") + && !emptyWorkspaceSource.contains("%02d / %02d") + && !emptyWorkspaceSource.contains("inspirationOffset"), "empty workspace inspiration switches randomly without repeating the current item or showing catalog counters") expect(emptyWorkspaceSource.contains("if store.showDailyInspiration") && emptyWorkspaceSource.contains("EmptyWorkspaceInspirationCatalog.item") && emptyWorkspaceSource.contains("case \"empty-workspace-calligraphy-light\":") From 24e58ee69bc3d67f2664807171614148744059c5 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 05:46:10 +0800 Subject: [PATCH 13/36] feat: embed PI as WeiBei study agent --- Package.swift | 10 +- README.md | 28 +- Sources/WeiBei/App/WeiBeiApp.swift | 74 +- Sources/WeiBei/Stores/WorkspaceStore.swift | 450 +++++-- Sources/WeiBei/Support/Theme.swift | 4 +- Sources/WeiBei/Support/WeiBeiResources.swift | 12 + Sources/WeiBei/Views/CommandPaletteView.swift | 10 +- .../Views/EmptyWorkspaceLauncherView.swift | 6 +- Sources/WeiBei/Views/NotesAgentView.swift | 106 +- .../WeiBei/Views/RichMarkdownEditorView.swift | 2 +- Sources/WeiBeiCore/AgentOfflineTurn.swift | 3 +- .../WeiBeiCore/AgentResources/extension.ts | 411 +++++++ .../skills/weibei-close-reading/SKILL.md | 57 + .../skills/weibei-note-making/SKILL.md | 69 ++ .../skills/weibei-recall-practice/SKILL.md | 77 ++ Sources/WeiBeiCore/AgentResources/system.md | 32 + .../WeiBeiCore/OpenAIResponsesClient.swift | 27 +- Sources/WeiBeiCore/PiAgentRuntime.swift | 1037 +++++++++++++++++ Sources/WeiBeiCore/PiRPCProtocol.swift | 214 ++++ Sources/WeiBeiCore/StudyAgentRuntime.swift | 224 ++++ Sources/WeiBeiCore/WorkspaceModels.swift | 23 +- Sources/WeiBeiPiCheck/main.swift | 170 +++ .../WeiBeiSelfCheck/PiAgentSelfChecks.swift | 259 ++++ Sources/WeiBeiSelfCheck/main.swift | 120 +- Vendor/PiRuntime/LICENSE | 21 + Vendor/PiRuntime/README.md | 22 + Vendor/PiRuntime/THIRD_PARTY_NOTICES.md | 15 + Vendor/PiRuntime/manifest.json | 17 + script/build_and_run.sh | 85 +- script/prepare_pi_runtime.sh | 135 +++ 30 files changed, 3536 insertions(+), 184 deletions(-) create mode 100644 Sources/WeiBei/Support/WeiBeiResources.swift create mode 100644 Sources/WeiBeiCore/AgentResources/extension.ts create mode 100644 Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md create mode 100644 Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md create mode 100644 Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md create mode 100644 Sources/WeiBeiCore/AgentResources/system.md create mode 100644 Sources/WeiBeiCore/PiAgentRuntime.swift create mode 100644 Sources/WeiBeiCore/PiRPCProtocol.swift create mode 100644 Sources/WeiBeiCore/StudyAgentRuntime.swift create mode 100644 Sources/WeiBeiPiCheck/main.swift create mode 100644 Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift create mode 100644 Vendor/PiRuntime/LICENSE create mode 100644 Vendor/PiRuntime/README.md create mode 100644 Vendor/PiRuntime/THIRD_PARTY_NOTICES.md create mode 100644 Vendor/PiRuntime/manifest.json create mode 100755 script/prepare_pi_runtime.sh diff --git a/Package.swift b/Package.swift index adf2c84b8..3c9fd98b0 100644 --- a/Package.swift +++ b/Package.swift @@ -9,11 +9,15 @@ let package = Package( products: [ .executable(name: "WeiBei", targets: ["WeiBei"]), .executable(name: "WeiBeiSelfCheck", targets: ["WeiBeiSelfCheck"]), - .executable(name: "WeiBeiWebEditorCheck", targets: ["WeiBeiWebEditorCheck"]) + .executable(name: "WeiBeiWebEditorCheck", targets: ["WeiBeiWebEditorCheck"]), + .executable(name: "WeiBeiPiCheck", targets: ["WeiBeiPiCheck"]) ], targets: [ .target( name: "WeiBeiCore", + resources: [ + .copy("AgentResources") + ], linkerSettings: [ .linkedFramework("AppKit"), .linkedFramework("PDFKit"), @@ -49,6 +53,10 @@ let package = Package( .linkedFramework("AppKit"), .linkedFramework("WebKit") ] + ), + .executableTarget( + name: "WeiBeiPiCheck", + dependencies: ["WeiBeiCore"] ) ] ) diff --git a/README.md b/README.md index e9740b4d5..72203dcec 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ | 阅读 | HTML(WebKit)、PDF(PDFKit,连续或单页,`⌘[` / `⌘]`)、Markdown 渲染 | | 笔记 | 绑当前资料,存本机;Milkdown 原地编辑,可切源码 / 对照 | | 划线 | 选区浮层带摘录,可写入或替换笔记 | -| 对话 | 上下文固定为当前材料与笔记;无 Key 时离线预览,不编造 | +| 对话 | PI 先读当前材料、选区与笔记并带来源;证据不足时标为未确认 | | 布局 | 三栏可调;文档笔记对半;沉浸阅读 / 对话 / 写作 | | Agent | 固定列、抽屉、小窗、划线浮层、静默洞察、隐藏 | | 键位 | `⌘1`–`⌘4` 聚焦,`⌘B` 资料库,`⌘K` 命令面板 | @@ -28,6 +28,7 @@ - macOS 14+ - `swift`(Xcode Command Line Tools) - 改 Web 编辑器源码时需要 Node.js +- 首次构建需要联网下载并校验固定版本的 PI 独立运行体;用户不需要安装 PI、Node.js 或 Bun ## 运行 @@ -45,12 +46,27 @@ cd weibei ## Agent -自备 API Key(设置页或环境变量),应用不托管账号。 +魏碑把 PI 当内部学习 Agent,不给它文件、终端或网络工具。PI 每轮只能读取魏碑生成的受限上下文快照;笔记整理只能返回待确认建议,最终写回仍由魏碑和用户决定。 + +应用内建固定到 `0.80.2` 的 PI macOS 独立运行体,只从自身资源目录启动,不扫描用户的 `PATH`、NVM、Node.js、Bun 或全局 PI。构建脚本按架构下载官方开源产物,先核对 SHA-256,再把最小运行文件、MIT 许可证和来源清单装进应用包。PI 内核以后可替换成我们的源码分支,Swift/RPC 契约无需跟着重写。 + +PI 在接收问题前不可用时会尝试原有在线接口,再使用离线草稿。已经被 PI 接收的请求若中途失败,不会自动重放,原问题会留在输入框供用户决定是否重试。 + +魏碑为 PI 建立独立配置目录,只迁入本机已有 PI 的认证信息和默认提供方;全局扩展、技能、提示模板、主题和会话都不会加载。PI 子进程使用环境白名单,不继承宿主里的其他密钥。PI 会话和回答轨迹默认不落盘。 + +三个内置学习技能:细读与证据核对、Markdown 笔记整理、主动回忆与自测。上下文读取、工具白名单、修订号失效和写回边界由 PI 扩展钩子强制执行。 | 变量 | 说明 | 默认 | | --- | --- | --- | | `OPENAI_API_KEY` | API Key | 无 | | `WEIBEI_OPENAI_MODEL` | 模型 | `gpt-5.1` | +| `WEIBEI_PI_PROVIDER` | 指定 PI 提供方 | PI 当前配置;有应用 Key 时为 `openai` | +| `WEIBEI_PI_MODEL` | 指定 PI 模型 | PI 当前配置;有应用 Key 时沿用应用模型 | +| `WEIBEI_PI_THINKING` | PI 思考强度 | `medium` | +| `WEIBEI_PI_DISABLED` | 设为 `1` 跳过 PI | 未设置 | +| `WEIBEI_PI_LIVE_CHECK` | `1` 强制、`0` 跳过真实笔记技能冒烟 | 有可用认证时自动运行 | +| `WEIBEI_PI_EVAL` | 运行细读、笔记、回忆三项真实评测 | 未设置 | +| `WEIBEI_PI_EXECUTABLE` | 仅供 `WeiBeiPiCheck` 指向准备好的内建运行体 | 未设置 | Key 只在本机。 @@ -59,16 +75,24 @@ Key 只在本机。 ```text Sources/WeiBei/ App、界面、编辑器资源 Sources/WeiBeiCore/ 工作区、Agent、密钥、PDF OCR + AgentResources/ PI 扩展、系统契约与三个学习技能 Sources/WeiBeiSelfCheck/ +Sources/WeiBeiPiCheck/ PI 启动检查与可选真模型冒烟 Sources/WeiBei/WebEditor/ 编辑器源码 → Resources/Editor +Vendor/PiRuntime/ PI 固定版本、哈希、许可证与维护边界 DesignReferences/ 纸 / 墨 / 石 / 朱砂参考 script/build_and_run.sh +script/prepare_pi_runtime.sh ``` ```bash swift build swift run WeiBeiSelfCheck swift run WeiBeiWebEditorCheck +PI_RUNTIME="$(./script/prepare_pi_runtime.sh)" +WEIBEI_PI_EXECUTABLE="$PI_RUNTIME/bin/pi" swift run WeiBeiPiCheck +WEIBEI_PI_EXECUTABLE="$PI_RUNTIME/bin/pi" WEIBEI_PI_LIVE_CHECK=1 swift run WeiBeiPiCheck +WEIBEI_PI_EXECUTABLE="$PI_RUNTIME/bin/pi" WEIBEI_PI_EVAL=1 swift run WeiBeiPiCheck ``` 动布局或对话结构时,把 SelfCheck 里的断言一并改掉。 diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index 11f6ec06b..a6aa0ec07 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -37,6 +37,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { func applicationWillTerminate(_ notification: Notification) { sharedWorkspaceStore.flushPendingNotePersistence() + sharedWorkspaceStore.shutdownAgentRuntime() if let shortcutMonitor { NSEvent.removeMonitor(shortcutMonitor) } @@ -214,8 +215,10 @@ struct WeiBeiApp: App { } .keyboardShortcut("f") } - if !store.isAskingAgent && !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { - Button(store.sendAgentActionTitle) { Task { await store.askAgent() } } + if store.isAskingAgent || !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + Button(store.sendAgentActionTitle) { + store.isAskingAgent ? store.cancelAgentRequest() : store.askAgent() + } .keyboardShortcut(.return, modifiers: [.command]) } } @@ -308,7 +311,10 @@ private struct WeiBeiAppearanceTransition: ViewModifier { } } +@MainActor private struct WindowChromeConfigurator: NSViewRepresentable { + private static var scheduledVerificationCaptures: Set<String> = [] + var appearanceMode: WeiBeiAppearanceMode func makeNSView(context: Context) -> NSView { @@ -361,20 +367,64 @@ private struct WindowChromeConfigurator: NSViewRepresentable { let environment = ProcessInfo.processInfo.environment guard environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1", let capturePath = environment["WEIBEI_VERIFY_CAPTURE_PATH"], - !capturePath.isEmpty else { return } + !capturePath.isEmpty, + Self.scheduledVerificationCaptures.insert(capturePath).inserted else { return } + + if environment["WEIBEI_VERIFY_SCENARIO"] == "pi-learning-flow", + let workspaceDirectory = environment["WEIBEI_WORKSPACE_DIR"] { + let stateURL = URL(fileURLWithPath: workspaceDirectory) + .appendingPathComponent("verification-state.txt") + Self.waitForVerificationCompletion( + in: window, + capturePath: capturePath, + stateURL: stateURL, + remainingAttempts: 600 + ) + return + } DispatchQueue.main.asyncAfter(deadline: .now() + 2) { - guard !FileManager.default.fileExists(atPath: capturePath), - let contentView = window.contentView else { return } - let bounds = contentView.bounds - guard bounds.width >= 600, - bounds.height >= 400, - let bitmap = contentView.bitmapImageRepForCachingDisplay(in: bounds) else { return } - contentView.cacheDisplay(in: bounds, to: bitmap) - guard let png = bitmap.representation(using: .png, properties: [:]) else { return } - try? png.write(to: URL(fileURLWithPath: capturePath), options: .atomic) + Self.capture(window, to: capturePath) } } + + private static func waitForVerificationCompletion( + in window: NSWindow, + capturePath: String, + stateURL: URL, + remainingAttempts: Int + ) { + let stages = (try? String(contentsOf: stateURL, encoding: .utf8)) ?? "" + if stages.split(separator: "\n").contains("completed") { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + capture(window, to: capturePath) + } + return + } + guard remainingAttempts > 0 else { return } + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { + waitForVerificationCompletion( + in: window, + capturePath: capturePath, + stateURL: stateURL, + remainingAttempts: remainingAttempts - 1 + ) + } + } + + private static func capture(_ window: NSWindow, to capturePath: String) { + guard !FileManager.default.fileExists(atPath: capturePath), + let contentView = window.contentView else { return } + contentView.layoutSubtreeIfNeeded() + window.displayIfNeeded() + let bounds = contentView.bounds + guard bounds.width >= 600, + bounds.height >= 400, + let bitmap = contentView.bitmapImageRepForCachingDisplay(in: bounds) else { return } + contentView.cacheDisplay(in: bounds, to: bitmap) + guard let png = bitmap.representation(using: .png, properties: [:]) else { return } + try? png.write(to: URL(fileURLWithPath: capturePath), options: .atomic) + } } struct SettingsView: View { diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 4abc2cd27..41bb690ae 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -43,6 +43,9 @@ final class WorkspaceStore: ObservableObject { @Published var agentDraft = "" @Published var messages: [AgentMessage] = [] @Published var isAskingAgent = false + @Published var agentStreamingText = "" + @Published var agentActivityText: String? + @Published private(set) var latestAgentNoteProposal: StudyAgentNoteProposal? @Published var showLibrary = true @Published var showReader = true @Published var showAgent = true @@ -87,6 +90,14 @@ final class WorkspaceStore: ObservableObject { private var notesByItemID: [String: String] = [:] private let storageURL: URL + private let piRuntime: PiAgentRuntime + private var activeAgentRequestID: UUID? + private var agentRequestTask: Task<Void, Never>? + private var quietInsightTask: Task<Void, Never>? + private var quietInsightTaskID: UUID? + private var agentContextRevision: UInt64 = 0 + private var lastAgentReplyContextRevision: UInt64? + private var stagedNoteDraft: (itemID: String, value: String)? private var quietInsightSignature = "" private var isRestoringNavigation = false private var didRunVerificationScenario = false @@ -136,7 +147,8 @@ final class WorkspaceStore: ObservableObject { } private var lastUsableAgentAnswer: AgentMessage? { - messages.last { $0.isUsableAgentAnswer } + guard lastAgentReplyContextRevision == agentContextRevision else { return nil } + return messages.last { $0.isUsableAgentAnswer } } private static let shortcutModifierMask: NSEvent.ModifierFlags = [.command, .option, .control, .shift] @@ -146,6 +158,7 @@ final class WorkspaceStore: ObservableObject { init() { let folder = Self.workspaceRootDirectory() ?? FileManager.default.temporaryDirectory.appendingPathComponent("WeiBei", isDirectory: true) storageURL = folder.appendingPathComponent("workspace.json") + piRuntime = PiAgentRuntime(runtimeDirectory: folder.appendingPathComponent("AgentRuntime", isDirectory: true)) try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) load() floatingSelectionPrompt = ui("当前选区", "Current selection") @@ -323,7 +336,7 @@ final class WorkspaceStore: ObservableObject { } var sendAgentActionTitle: String { - ui("发送问题", "Send question") + isAskingAgent ? ui("停止回答", "Stop response") : ui("发送问题", "Send question") } var agentNoteTitle: String { @@ -362,6 +375,12 @@ final class WorkspaceStore: ObservableObject { lastUsableAgentAnswer != nil } + var agentWriteActionTitle: String { + latestAgentNoteProposal == nil + ? ui("写入回答", "Write Answer") + : ui("写入建议", "Write Proposal") + } + var lastUsableAgentAnswerID: UUID? { lastUsableAgentAnswer?.id } @@ -485,6 +504,7 @@ final class WorkspaceStore: ObservableObject { } func select(itemID: String?) { + invalidateAgentContext() persistCurrentNote() notebookCreationDraft = nil notebookRenameDraft = nil @@ -513,6 +533,7 @@ final class WorkspaceStore: ObservableObject { clearReaderSearchIfNeeded() noteText = noteText(for: activeNoteItem) messages = [] + latestAgentNoteProposal = nil clearGeneratedQuietInsight() refreshQuietInsightIfNeeded() save() @@ -527,6 +548,7 @@ final class WorkspaceStore: ObservableObject { func updateNote(_ value: String) { guard noteText != value else { return } + invalidateAgentContext() noteText = value clearGeneratedQuietInsight() guard let item = activeNoteItem else { return } @@ -536,6 +558,26 @@ final class WorkspaceStore: ObservableObject { scheduleNotePersistence(value, for: item) } + func stageNoteDraft(_ value: String, for itemID: String?) { + guard let itemID else { return } + if stagedNoteDraft?.itemID != itemID || stagedNoteDraft?.value != value { + invalidateAgentContext() + } + stagedNoteDraft = (itemID, value) + } + + func clearStagedNoteDraft(for itemID: String?, matching value: String? = nil) { + guard let itemID, let stagedNoteDraft, stagedNoteDraft.itemID == itemID else { return } + if let value, stagedNoteDraft.value != value { return } + self.stagedNoteDraft = nil + } + + private func flushStagedNoteDraftForAgentContext() { + guard let stagedNoteDraft, stagedNoteDraft.itemID == activeNoteItemID else { return } + self.stagedNoteDraft = nil + updateNote(stagedNoteDraft.value, for: stagedNoteDraft.itemID) + } + func updateNote(_ value: String, for itemID: String?) { guard let itemID else { updateNote(value) @@ -830,11 +872,17 @@ final class WorkspaceStore: ObservableObject { func updateReaderLocationTitle(_ title: String?) { let cleaned = title?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" - readerLocationTitle = cleaned.isEmpty ? selectedMaterialItem.map(displayTitle) : cleaned + let nextTitle = cleaned.isEmpty ? selectedMaterialItem.map(displayTitle) : cleaned + guard readerLocationTitle != nextTitle else { return } + invalidateAgentContext() + readerLocationTitle = nextTitle } func updateReaderPageIndex(_ index: Int) { - readerPageIndex = max(index, 0) + let nextIndex = max(index, 0) + guard readerPageIndex != nextIndex else { return } + invalidateAgentContext() + readerPageIndex = nextIndex } func recordReaderPageNavigationPoint() { @@ -1137,6 +1185,7 @@ final class WorkspaceStore: ObservableObject { } private func applyNavigationSnapshot(_ snapshot: NavigationSnapshot) { + invalidateAgentContext() isRestoringNavigation = true defer { isRestoringNavigation = false } selectedItemID = snapshot.selectedItemID @@ -1157,6 +1206,7 @@ final class WorkspaceStore: ObservableObject { readerLocationTitle = selectedMaterialItem.map(displayTitle) readerTargetPageIndex = selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil messages = [] + latestAgentNoteProposal = nil showQuietInsight = agentSurface == .quietInsight clearUnpinnedFloatingSelection(keepContext: false) clearReaderSearchIfNeeded() @@ -1284,8 +1334,12 @@ final class WorkspaceStore: ObservableObject { guard hasSelectedMaterial else { return false } animatePanelChange { revealReaderSearch() } case "return": - guard !isAskingAgent && !agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return false } - Task { await askAgent() } + if isAskingAgent { + cancelAgentRequest() + } else { + guard !agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return false } + askAgent() + } default: return false } @@ -1652,6 +1706,7 @@ final class WorkspaceStore: ObservableObject { func useSelectedMarkdownAsNotebookNote() { guard let selectedItemID, let index = importedItems.firstIndex(where: { $0.id == selectedItemID && $0.canBecomeNotebookNote }) else { return } + invalidateAgentContext() persistCurrentNote() importedItems[index].isNotebookNote = true activeNotebookItemID = importedItems[index].id @@ -1735,6 +1790,7 @@ final class WorkspaceStore: ObservableObject { return } + invalidateAgentContext() clearGeneratedQuietInsight() let nextSelection = SelectionContext( text: boundedText, @@ -1780,6 +1836,7 @@ final class WorkspaceStore: ObservableObject { // Instant remove — animation here made the chip absorb the first click while hover/popover settled. cancelPendingSelectionAttachment() let removed = selectionAttachments.first(where: { $0.id == id }) + if removed != nil { invalidateAgentContext() } selectionAttachments.removeAll { $0.id == id } if selectionContext?.id == id { clearUnpinnedFloatingSelection(keepContext: false) @@ -1791,6 +1848,7 @@ final class WorkspaceStore: ObservableObject { func clearSelectionAttachments() { // Instant clear so one click always wins over hover-popover dismissal races. cancelPendingSelectionAttachment() + if !selectionAttachments.isEmpty { invalidateAgentContext() } selectionAttachments = [] lastSelectionAttachmentDate = nil lastSelectionUpdateDate = nil @@ -1836,6 +1894,7 @@ final class WorkspaceStore: ObservableObject { }) { return } + invalidateAgentContext() selectionAttachments.removeAll { sameSelectionSource($0) && SelectionAttachmentMerge.containsSelection(cleanedText, fragment: $0.text) @@ -1921,7 +1980,7 @@ final class WorkspaceStore: ObservableObject { "请根据\(agentPromptScope),把笔记整理成更清晰的大纲,保留来源信息,并标出缺少证据的位置。", "Use \(agentPromptScope) to organize the note into a clearer outline, keep source references, and mark places where evidence is missing." ) - Task { await askAgent() } + askAgent() } func askSelection() { @@ -2032,33 +2091,43 @@ final class WorkspaceStore: ObservableObject { let contextScope = hasSelectedMaterial ? ui("当前材料、当前选区和当前笔记", "the current material, current selection, and current note") : ui("当前选区和当前笔记", "the current selection and current note") let evidenceText = hasSelectedMaterial ? ui("如果材料没有证据,就直接说未在材料中确认。", "If the material has no evidence, say it is not confirmed in the material.") : ui("如果笔记和选区没有证据,就直接说未在笔记或选区中确认。", "If the note and selection have no evidence, say it is not confirmed in the note or selection.") let signature = makeQuietInsightSignature(materialText: materialText, noteText: currentNoteText, selectionText: selectionText) - guard signature != quietInsightSignature else { return } - guard let credential = resolvedOpenAIAPIKey() else { - generatedQuietInsight = nil - return - } + guard signature != quietInsightSignature, + !isAskingAgent, + !isGeneratingQuietInsight else { return } + + let requestID = UUID() + let requestWorkspaceRevision = agentContextRevision + let request = StudyAgentRequest( + id: requestID, + purpose: .quietInsight, + workflow: .closeReading, + question: ui( + "请静默阅读\(contextScope),只输出一条最值得提示给用户的洞察。要温和、短、可执行;\(evidenceText)", + "Read \(contextScope) quietly and output only the single most useful insight for the user. Keep it gentle, short, and actionable. \(evidenceText)" + ), + materialTitle: materialTitle, + materialText: materialText, + noteTitle: agentNoteTitle, + noteText: currentNoteText, + selectionTitle: selectionContext?.ownerTitle, + selectionText: selectionText, + recentMessages: [], + language: interfaceLanguage, + contextRevision: "\(requestWorkspaceRevision):\(requestID.uuidString.lowercased())" + ) isGeneratingQuietInsight = true defer { isGeneratingQuietInsight = false } do { - let client = OpenAIResponsesClient(apiKey: credential.key, model: resolvedModelName) - let answer = try await client.ask( - question: ui( - "请静默阅读\(contextScope),只输出一条最值得提示给用户的洞察。要温和、短、可执行;\(evidenceText)", - "Read \(contextScope) quietly and output only the single most useful insight for the user. Keep it gentle, short, and actionable. \(evidenceText)" - ), - materialTitle: materialTitle, - materialText: materialText, - noteTitle: agentNoteTitle, - noteText: currentNoteText, - selectionTitle: selectionContext?.ownerTitle, - selectionText: selectionText, - recentMessages: [], - language: interfaceLanguage - ) - guard signature == makeQuietInsightSignature(materialText: selectedContextText, noteText: noteText, selectionText: selectionContext?.text) else { return } - generatedQuietInsight = QuietInsight.agent(materialTitle: materialTitle, answer: answer, language: interfaceLanguage) + let reply = try await executeStudyAgentRequest(request) + guard requestWorkspaceRevision == agentContextRevision, + signature == makeQuietInsightSignature(materialText: selectedContextText, noteText: noteText, selectionText: selectionContext?.text) else { return } + guard reply.backend != .offline else { + generatedQuietInsight = nil + return + } + generatedQuietInsight = QuietInsight.agent(materialTitle: materialTitle, answer: reply.text, language: interfaceLanguage) quietInsightSignature = signature } catch { generatedQuietInsight = nil @@ -2071,7 +2140,8 @@ final class WorkspaceStore: ObservableObject { func applyLastAgentAnswerToNote() { guard let answer = lastUsableAgentAnswer else { return } - let block = "\n\n\(noteBlockForAgentAnswer(answer.text))" + let content = latestAgentNoteProposal?.markdown ?? answer.text + let block = "\n\n\(noteBlockForAgentAnswer(content))" updateNote(noteText + block) focus(.notes) } @@ -2093,10 +2163,12 @@ final class WorkspaceStore: ObservableObject { "empty-workspace-open-notes", ] guard scenario == "offline-learning-flow" + || scenario == "pi-learning-flow" || scenario == "immersive-conversation-flow" || scenario == "notebook-creation-flow" || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true + recordVerificationStage("recognized:\(scenario)") if emptyWorkspaceScenarios.contains(scenario) { configureEmptyWorkspaceVerificationScenario(scenario) return @@ -2111,6 +2183,9 @@ final class WorkspaceStore: ObservableObject { showNotes = true agentSurface = .hidden select(itemID: "sample-html") + if scenario == "pi-learning-flow" { + await waitForReaderContextToSettle() + } if scenario == "notebook-creation-flow" { promptCreateBlankNotebookNote() return @@ -2121,9 +2196,43 @@ final class WorkspaceStore: ObservableObject { source: .document, ownerTitle: currentReferenceTitle ) + recordVerificationStage("context-prepared") agentDraft = ui("解释选区,并整理成可以写入笔记的要点。", "Explain the selection and turn it into note-ready points.") - await askAgent() + await askAgentAndWait() + recordVerificationStage("reply:\(messages.last?.backend?.rawValue ?? "none")") + if messages.last?.backend == nil, let message = messages.last?.text { + recordVerificationStage("failure:\(String(message.prefix(500)))") + } + if scenario == "pi-learning-flow", messages.last?.backend == .pi { + let markerURL = storageURL.deletingLastPathComponent().appendingPathComponent("pi-agent-verified.txt") + try? "PI backend completed the packaged learning flow\n".write(to: markerURL, atomically: true, encoding: .utf8) + } applyLastAgentAnswerToNote() + recordVerificationStage("completed") + } + + private func waitForReaderContextToSettle() async { + var previousTitle = readerLocationTitle + var previousPage = readerPageIndex + var stableChecks = 0 + for _ in 0..<20 { + try? await Task.sleep(nanoseconds: 150_000_000) + if readerLocationTitle == previousTitle, readerPageIndex == previousPage { + stableChecks += 1 + if stableChecks >= 3 { return } + } else { + previousTitle = readerLocationTitle + previousPage = readerPageIndex + stableChecks = 0 + } + } + } + + private func recordVerificationStage(_ stage: String) { + guard Self.environmentValue("WEIBEI_SUPPRESS_ACTIVATION") == "1" else { return } + let url = storageURL.deletingLastPathComponent().appendingPathComponent("verification-state.txt") + let previous = (try? String(contentsOf: url, encoding: .utf8)) ?? "" + try? "\(previous)\(stage)\n".write(to: url, atomically: true, encoding: .utf8) } private func configureEmptyWorkspaceVerificationScenario(_ scenario: String) { @@ -2157,13 +2266,17 @@ final class WorkspaceStore: ObservableObject { func replaceSelectionWithLastAgentAnswer() { guard selectionContext?.isReplaceableNoteSelection == true, let answer = lastUsableAgentAnswer else { return } - noteEditorCommand = NoteEditorCommand(kind: .replaceSelection, markdown: answer.text) + noteEditorCommand = NoteEditorCommand( + kind: .replaceSelection, + markdown: latestAgentNoteProposal?.markdown ?? answer.text + ) focus(.notes) } func applyAgentPatchToEditor() { guard let answer = lastUsableAgentAnswer else { return } - noteEditorCommand = NoteEditorCommand(kind: .applyAgentPatch, markdown: "\n\(noteBlockForAgentAnswer(answer.text))") + let content = latestAgentNoteProposal?.markdown ?? answer.text + noteEditorCommand = NoteEditorCommand(kind: .applyAgentPatch, markdown: "\n\(noteBlockForAgentAnswer(content))") focus(.notes) } @@ -2176,9 +2289,28 @@ final class WorkspaceStore: ObservableObject { return "## \(ui("整理建议", "Organization suggestion"))\n\(text)" } - func askAgent() async { + func askAgent() { + flushStagedNoteDraftForAgentContext() + guard agentRequestTask == nil, + !isAskingAgent, + !agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return } + agentRequestTask = Task { @MainActor [weak self] in + await self?.performAgentRequest() + } + } + + private func askAgentAndWait() async { + askAgent() + await agentRequestTask?.value + } + + private func performAgentRequest() async { + flushStagedNoteDraftForAgentContext() let question = agentDraft.trimmingCharacters(in: .whitespacesAndNewlines) - guard !question.isEmpty, !isAskingAgent else { return } + guard !question.isEmpty, !isAskingAgent else { + agentRequestTask = nil + return + } persistCurrentNote() let sentSelectionTitle = agentSelectionTitle @@ -2186,7 +2318,24 @@ final class WorkspaceStore: ObservableObject { let shouldClearSentDocumentSelection = sentSelectionText != nil && selectionContext?.source == .document let recentMessages = Array(messages.suffix(8)) let sourceTitle = agentMessageSourceTitle + let requestID = UUID() + let requestWorkspaceRevision = agentContextRevision + let request = StudyAgentRequest( + id: requestID, + purpose: .conversation, + question: question, + materialTitle: currentReferenceTitle, + materialText: selectedContextText, + noteTitle: agentNoteTitle, + noteText: noteText, + selectionTitle: sentSelectionTitle, + selectionText: sentSelectionText, + recentMessages: recentMessages, + language: interfaceLanguage, + contextRevision: "\(requestWorkspaceRevision):\(requestID.uuidString.lowercased())" + ) agentDraft = "" + latestAgentNoteProposal = nil if !selectionAttachments.isEmpty { withAnimation(WeiBeiMotion.panel) { cancelPendingSelectionAttachment() @@ -2196,62 +2345,170 @@ final class WorkspaceStore: ObservableObject { } } if shouldClearSentDocumentSelection { - clearUnpinnedFloatingSelection(keepContext: false) + clearUnpinnedFloatingSelection(keepContext: false, invalidatesAgentContext: false) } - guard let credential = resolvedOpenAIAPIKey() else { - let notice = ui( - "未配置密钥。当前用离线模式生成草稿;设置密钥后会结合\(agentPromptScope),并在有已选文本片段时一并作答。", - "No key is configured. WeiBei is generating an offline draft. After setup, answers will use \(agentPromptScope) and any selected text fragments." - ) - openAIKeyStatus = notice - messages.append(contentsOf: AgentOfflineTurn.messages( - question: question, - sourceTitle: sourceTitle, - input: offlineAgentInput( - question: question, - selectionTitle: sentSelectionTitle, - selectionText: sentSelectionText - ) - )) - return - } - messages.append(AgentMessage(role: .user, text: question, source: sourceTitle)) isAskingAgent = true + activeAgentRequestID = request.id + agentStreamingText = "" + agentActivityText = ui("正在读取上下文", "Reading context") + defer { + if activeAgentRequestID == request.id { + activeAgentRequestID = nil + isAskingAgent = false + agentStreamingText = "" + agentActivityText = nil + agentRequestTask = nil + } + } + + if isGeneratingQuietInsight { + await piRuntime.cancel() + } do { - let client = OpenAIResponsesClient(apiKey: credential.key, model: resolvedModelName) - let answer = try await client.ask( - question: question, - materialTitle: currentReferenceTitle, - materialText: selectedContextText, - noteTitle: agentNoteTitle, - noteText: noteText, - selectionTitle: sentSelectionTitle, - selectionText: sentSelectionText, - recentMessages: recentMessages, - language: interfaceLanguage + let reply = try await executeStudyAgentRequest(request) + guard activeAgentRequestID == request.id, + requestWorkspaceRevision == agentContextRevision else { return } + latestAgentNoteProposal = reply.noteProposal + lastAgentReplyContextRevision = requestWorkspaceRevision + messages.append( + AgentMessage( + role: .assistant, + text: reply.noteProposal?.markdown ?? reply.text, + source: sourceTitle, + backend: reply.backend + ) ) - messages.append(AgentMessage(role: .assistant, text: answer, source: sourceTitle)) + } catch PiAgentRuntimeError.cancelled, is CancellationError { + return } catch { - messages.append(AgentMessage(role: .assistant, text: ui("请求失败:\(error.localizedDescription)", "Request failed: \(error.localizedDescription)"), source: sourceTitle)) + guard activeAgentRequestID == request.id else { return } + if agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + agentDraft = question + } + messages.append( + AgentMessage( + role: .assistant, + text: ui( + "请求失败:\(error.localizedDescription) 问题已保留在输入框。", + "Request failed: \(error.localizedDescription) The question remains in the composer." + ), + source: sourceTitle + ) + ) } + } + + func cancelAgentRequest() { + guard isAskingAgent || activeAgentRequestID != nil else { return } + agentRequestTask?.cancel() + agentRequestTask = nil + activeAgentRequestID = nil isAskingAgent = false + agentStreamingText = "" + agentActivityText = nil } - private func offlineAgentInput(question: String, selectionTitle: String?, selectionText: String?) -> AgentOfflinePreviewInput { - AgentOfflinePreviewInput( - language: interfaceLanguage, - question: question, - hasMaterial: hasSelectedMaterial, - materialTitle: currentReferenceTitle, - materialText: selectedContextText, - noteTitle: agentNoteTitle, - noteText: noteText, - selectionTitle: selectionTitle, - selectionText: selectionText - ) + private func executeStudyAgentRequest(_ request: StudyAgentRequest) async throws -> StudyAgentReply { + if Self.environmentValue("WEIBEI_FORCE_OFFLINE_AGENT") == "1" { + return try await OfflineStudyAgentRuntime().respond(to: request) + } + + let credential = resolvedOpenAIAPIKey() + if Self.environmentValue("WEIBEI_PI_DISABLED") != "1" { + let explicitProvider = Self.environmentValue("WEIBEI_PI_PROVIDER") + let explicitModel = Self.environmentValue("WEIBEI_PI_MODEL") + let thinking = Self.environmentValue("WEIBEI_PI_THINKING") + let usesOpenAIKey = explicitProvider == "openai" || (explicitProvider.isEmpty && credential != nil) + let configuration = PiAgentProviderConfiguration( + provider: explicitProvider.isEmpty ? (credential == nil ? nil : "openai") : explicitProvider, + model: explicitModel.isEmpty ? (usesOpenAIKey ? resolvedModelName : nil) : explicitModel, + apiKey: usesOpenAIKey ? credential?.key : nil, + thinkingLevel: thinking.isEmpty ? "medium" : thinking + ) + await piRuntime.configure(configuration) + + do { + return try await piRuntime.respond(to: request) { [weak self] progress in + await self?.applyAgentProgress(progress, requestID: request.id) + } + } catch let error as PiAgentRuntimeError { + if error == .cancelled || Task.isCancelled { + throw PiAgentRuntimeError.cancelled + } + guard error.permitsAutomaticFallback else { throw error } + openAIKeyStatus = ui( + "PI 暂不可用:\(error.localizedDescription)", + "PI is unavailable: \(error.localizedDescription)" + ) + } catch { + if Task.isCancelled { throw PiAgentRuntimeError.cancelled } + openAIKeyStatus = ui( + "PI 暂不可用:\(error.localizedDescription)", + "PI is unavailable: \(error.localizedDescription)" + ) + } + } + + if let credential { + do { + let client = OpenAIResponsesClient(apiKey: credential.key, model: resolvedModelName) + return try await client.respond(to: request) { [weak self] progress in + await self?.applyAgentProgress(progress, requestID: request.id) + } + } catch is CancellationError { + throw PiAgentRuntimeError.cancelled + } catch { + if Task.isCancelled { throw PiAgentRuntimeError.cancelled } + openAIKeyStatus = ui( + "在线请求失败,已改用离线草稿:\(error.localizedDescription)", + "Online request failed; using an offline draft: \(error.localizedDescription)" + ) + } + } else { + openAIKeyStatus = ui( + "PI 与在线密钥均不可用,当前使用离线草稿。", + "PI and an online key are unavailable; using an offline draft." + ) + } + + return try await OfflineStudyAgentRuntime().respond(to: request) { [weak self] progress in + await self?.applyAgentProgress(progress, requestID: request.id) + } + } + + func shutdownAgentRuntime() { + agentRequestTask?.cancel() + quietInsightTask?.cancel() + let runtime = piRuntime + let completion = DispatchSemaphore(value: 0) + Task.detached { + await runtime.shutdown() + completion.signal() + } + _ = completion.wait(timeout: .now() + 1) + } + + private func applyAgentProgress(_ progress: StudyAgentProgress, requestID: UUID) { + guard activeAgentRequestID == requestID else { return } + switch progress { + case .readingContext: + agentActivityText = ui("正在读取上下文", "Reading context") + case let .usingTool(name): + switch name { + case "weibei_context": + agentActivityText = ui("正在核对材料与笔记", "Checking material and notes") + case "weibei_note_proposal": + agentActivityText = ui("正在整理写入建议", "Preparing a note proposal") + default: + agentActivityText = ui("正在处理", "Working") + } + case let .text(text): + agentStreamingText = text + agentActivityText = ui("正在组织回答", "Composing answer") + } } func sampleHTML(for item: StudyItem?) -> String { @@ -2465,8 +2722,21 @@ final class WorkspaceStore: ObservableObject { } } - private func clearUnpinnedFloatingSelection(keepContext: Bool = true) { + private func invalidateAgentContext() { + agentContextRevision &+= 1 + latestAgentNoteProposal = nil + lastAgentReplyContextRevision = nil + quietInsightTask?.cancel() + if isAskingAgent || activeAgentRequestID != nil { + cancelAgentRequest() + } + } + + private func clearUnpinnedFloatingSelection(keepContext: Bool = true, invalidatesAgentContext: Bool = true) { if !keepContext { + if invalidatesAgentContext, selectionContext != nil { + invalidateAgentContext() + } cancelPendingSelectionAttachment() selectionContext = nil selectionAnchor = nil @@ -2493,7 +2763,25 @@ final class WorkspaceStore: ObservableObject { private func refreshQuietInsightIfNeeded() { guard agentSurface == .quietInsight, showQuietInsight else { return } - Task { await refreshQuietInsight() } + let previousTask = quietInsightTask + previousTask?.cancel() + let taskID = UUID() + quietInsightTaskID = taskID + quietInsightTask = Task { @MainActor [weak self] in + await previousTask?.value + guard !Task.isCancelled else { + self?.finishQuietInsightTask(id: taskID) + return + } + await self?.refreshQuietInsight() + self?.finishQuietInsightTask(id: taskID) + } + } + + private func finishQuietInsightTask(id: UUID) { + guard quietInsightTaskID == id else { return } + quietInsightTask = nil + quietInsightTaskID = nil } private func makeQuietInsightSignature(materialText: String, noteText: String, selectionText: String?) -> String { diff --git a/Sources/WeiBei/Support/Theme.swift b/Sources/WeiBei/Support/Theme.swift index 5d31cd6a4..ff2b6ec7c 100644 --- a/Sources/WeiBei/Support/Theme.swift +++ b/Sources/WeiBei/Support/Theme.swift @@ -83,8 +83,8 @@ enum WeiBeiTypography { guard !didRegisterBundledFonts else { return } didRegisterBundledFonts = true ["WeiBeiStele", "WeiBeiSteleMono"].forEach { name in - guard let url = Bundle.module.url(forResource: name, withExtension: "ttf") - ?? Bundle.module.url(forResource: name, withExtension: "ttf", subdirectory: "Fonts") + guard let url = WeiBeiResources.bundle.url(forResource: name, withExtension: "ttf") + ?? WeiBeiResources.bundle.url(forResource: name, withExtension: "ttf", subdirectory: "Fonts") else { return } CTFontManagerRegisterFontsForURL(url as CFURL, .process, nil) } diff --git a/Sources/WeiBei/Support/WeiBeiResources.swift b/Sources/WeiBei/Support/WeiBeiResources.swift new file mode 100644 index 000000000..d08824f6b --- /dev/null +++ b/Sources/WeiBei/Support/WeiBeiResources.swift @@ -0,0 +1,12 @@ +import Foundation + +enum WeiBeiResources { + static let bundle: Bundle = { + let bundleName = "WeiBei_WeiBei.bundle" + let packagedURL = Bundle.main.resourceURL?.appendingPathComponent(bundleName) + let legacyURL = Bundle.main.bundleURL.appendingPathComponent(bundleName) + return packagedURL.flatMap(Bundle.init(url:)) + ?? Bundle(url: legacyURL) + ?? Bundle.module + }() +} diff --git a/Sources/WeiBei/Views/CommandPaletteView.swift b/Sources/WeiBei/Views/CommandPaletteView.swift index 0eb254c74..3beb861a3 100644 --- a/Sources/WeiBei/Views/CommandPaletteView.swift +++ b/Sources/WeiBei/Views/CommandPaletteView.swift @@ -85,14 +85,16 @@ struct CommandPaletteView: View { if store.canReplaceNoteSelection { items.append(PaletteCommand(title: store.ui("替换笔记选区", "Replace Note Selection"), shortcut: "⌘⇧R") { store.replaceSelectionWithLastAgentAnswer() }) } - if canSendAgentDraft { - items.append(PaletteCommand(title: store.sendAgentActionTitle, shortcut: "⌘↩") { Task { await store.askAgent() } }) + if canControlAgent { + items.append(PaletteCommand(title: store.sendAgentActionTitle, shortcut: "⌘↩") { + store.isAskingAgent ? store.cancelAgentRequest() : store.askAgent() + }) } return items } - private var canSendAgentDraft: Bool { - !store.isAskingAgent && !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + private var canControlAgent: Bool { + store.isAskingAgent || !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty } private func markdownInsertCommand(title: String, markdown: String) -> PaletteCommand { diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index 208db00a3..4e2a2aa02 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -285,9 +285,9 @@ private struct EmptyWorkspaceInspirationView: View { private enum EmptyWorkspaceCalligraphyResource { static func image(named name: String) -> NSImage? { - let url = Bundle.module.url(forResource: name, withExtension: "png", subdirectory: "Inspiration/Calligraphy") - ?? Bundle.module.url(forResource: name, withExtension: "png", subdirectory: "Calligraphy") - ?? Bundle.module.url(forResource: name, withExtension: "png") + let url = WeiBeiResources.bundle.url(forResource: name, withExtension: "png", subdirectory: "Inspiration/Calligraphy") + ?? WeiBeiResources.bundle.url(forResource: name, withExtension: "png", subdirectory: "Calligraphy") + ?? WeiBeiResources.bundle.url(forResource: name, withExtension: "png") guard let url else { return nil } return NSImage(contentsOf: url) } diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index b74966b88..fb2eeddc8 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -225,6 +225,10 @@ private struct AgentComposerField: View { !store.isAskingAgent && !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty } + private var showsControl: Bool { + store.isAskingAgent || canSend + } + var body: some View { ZStack(alignment: .bottomTrailing) { TextField( @@ -243,29 +247,31 @@ private struct AgentComposerField: View { .focused(focused) .onSubmit(submit) .padding(.vertical, verticalPadding) - .padding(.trailing, canSend ? trailingPadding : 0) + .padding(.trailing, showsControl ? trailingPadding : 0) .frame(maxWidth: .infinity, alignment: .bottomLeading) .weibeiInputSurface(active: focused.wrappedValue, height: height, horizontalPadding: horizontalPadding) - if canSend { - Button(action: submit) { - Image(systemName: "paperplane.fill") + if showsControl { + Button { + store.isAskingAgent ? store.cancelAgentRequest() : submit() + } label: { + Image(systemName: store.isAskingAgent ? "stop.fill" : "paperplane.fill") } - .buttonStyle(WeiBeiIconButtonStyle(size: sendButtonSize, prominence: .primary)) - .accessibilityLabel(Text(store.ui("发送", "Send"))) - .help(store.ui("发送", "Send")) + .buttonStyle(WeiBeiIconButtonStyle(size: sendButtonSize, prominence: store.isAskingAgent ? .neutral : .primary)) + .accessibilityLabel(Text(store.isAskingAgent ? store.ui("停止回答", "Stop response") : store.ui("发送", "Send"))) + .help(store.isAskingAgent ? store.ui("停止回答", "Stop response") : store.ui("发送", "Send")) .keyboardShortcut(.return, modifiers: [.command]) .padding(.trailing, sendTrailing) .padding(.bottom, sendBottom) .transition(WeiBeiTransition.floating) - .animation(WeiBeiMotion.micro, value: canSend) + .animation(WeiBeiMotion.micro, value: showsControl) } } .contentShape(Rectangle()) .onTapGesture { focused.wrappedValue = true } - .animation(WeiBeiMotion.micro, value: canSend) + .animation(WeiBeiMotion.micro, value: showsControl) } } @@ -348,6 +354,7 @@ struct NotePaneView: View { noteDraftFlushTask = nil draftNoteText = newValue draftNoteItemID = store.activeNoteItemID + store.clearStagedNoteDraft(for: draftNoteItemID) } } .onChange(of: store.focusedPane) { _, pane in @@ -604,6 +611,7 @@ struct NotePaneView: View { guard value != draftNoteText else { return } draftNoteText = value draftNoteItemID = store.activeNoteItemID + store.stageNoteDraft(value, for: draftNoteItemID) scheduleNoteDraftFlush() } ) @@ -724,6 +732,7 @@ struct NotePaneView: View { isApplyingExternalNote = true draftNoteItemID = store.activeNoteItemID draftNoteText = store.noteText + store.clearStagedNoteDraft(for: draftNoteItemID) isApplyingExternalNote = false } @@ -748,6 +757,7 @@ struct NotePaneView: View { noteDraftFlushTask = nil guard let itemID else { return } let value = (itemID == draftNoteItemID) ? draftNoteText : draftNoteText + defer { store.clearStagedNoteDraft(for: itemID, matching: value) } if itemID == store.activeNoteItemID { if store.noteText == value { return } isApplyingExternalNote = true @@ -1380,6 +1390,11 @@ struct AgentPaneView: View { ForEach(store.messages) { message in agentMessageRow(message: message, geometryWidth: geometry.size.width, contentWidth: contentWidth, proxy: proxy) } + if store.isAskingAgent && !store.agentStreamingText.isEmpty { + AgentStreamingResponse(text: store.agentStreamingText) + .id("agent-streaming-response") + .transition(WeiBeiTransition.message) + } if store.isAskingAgent { AgentThinkingIndicator() .id("agent-thinking") @@ -1595,7 +1610,7 @@ struct AgentPaneView: View { horizontalPadding: 14, verticalPadding: 10 ) { - Task { await store.askAgent() } + store.askAgent() } } .font(.system(size: 15)) @@ -1663,7 +1678,7 @@ struct AgentPaneView: View { withAnimation(WeiBeiMotion.panel) { store.agentDraft = prompt } - Task { await store.askAgent() } + store.askAgent() } private func scrollAgentToBottom(_ proxy: ScrollViewProxy) { @@ -2039,7 +2054,7 @@ struct AgentDrawerView: View { sendTrailing: 6, sendBottom: 6 ) { - Task { await store.askAgent() } + store.askAgent() } HStack(spacing: 8) { @@ -2111,7 +2126,7 @@ struct CornerAgentView: View { sendTrailing: 5, sendBottom: 5 ) { - Task { await store.askAgent() } + store.askAgent() } } @@ -2453,7 +2468,7 @@ struct FloatingSelectionAgentView: View { expanded = true store.agentDraft = store.ui("请整理和润色当前笔记,保留原意,并标出缺少来源的位置。", "Organize and polish the current note, preserve the meaning, and mark where sources are missing.") } - Task { await store.askAgent() } + store.askAgent() } private func sendDraft() { @@ -2462,7 +2477,7 @@ struct FloatingSelectionAgentView: View { withAnimation(WeiBeiMotion.panel) { expanded = true } - Task { await store.askAgent() } + store.askAgent() } private func closeFloatingAgent() { @@ -2915,6 +2930,20 @@ private struct AgentBubble: View { ) if message.id == store.lastUsableAgentAnswerID { + if let proposal = store.latestAgentNoteProposal, !proposal.evidence.isEmpty { + VStack(alignment: .leading, spacing: 4) { + Text(store.ui("依据", "Evidence")) + .font(.system(size: 10.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + ForEach(Array(proposal.evidence.enumerated()), id: \.offset) { _, evidence in + Text("• \(evidence)") + .font(.caption) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .fixedSize(horizontal: false, vertical: true) + } + } + .padding(.vertical, 4) + } HStack(spacing: 6) { if store.selectionContext != nil { Button(store.ui("摘录", "Excerpt")) { @@ -2922,7 +2951,7 @@ private struct AgentBubble: View { } .buttonStyle(WeiBeiTextActionButtonStyle()) } - Button(store.ui("写入回答", "Write Answer")) { + Button(store.agentWriteActionTitle) { store.applyLastAgentAnswerToNote() } .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) @@ -2943,6 +2972,11 @@ private struct AgentBubble: View { Text("WeiBei") .font(WeiBeiTypography.englishBrandFont(size: 9.8, weight: .semibold)) .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.76)) + if let backend = message.backend { + Text(backendLabel(backend)) + .font(.system(size: 9.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } if let source = message.source { Text(source) .font(.caption2) @@ -2996,6 +3030,14 @@ private struct AgentBubble: View { private var assistantMarkColor: Color { (isCredentialNotice || isOfflineContextPreview) ? WeiBeiTheme.link.opacity(0.42) : WeiBeiTheme.cinnabar.opacity(0.50) } + + private func backendLabel(_ backend: StudyAgentBackend) -> String { + switch backend { + case .pi: return "PI" + case .openAI: return "API" + case .offline: return store.ui("离线", "Offline") + } + } } private struct AgentMessageMarkdownText: View { @@ -3053,7 +3095,7 @@ private struct AgentThinkingIndicator: View { ) } } - Text(store.ui("正在读取上下文", "Reading context")) + Text(store.agentActivityText ?? store.ui("正在读取上下文", "Reading context")) .font(.caption) .foregroundStyle(WeiBeiTheme.secondaryInk) } @@ -3070,3 +3112,33 @@ private struct AgentThinkingIndicator: View { } } } + +private struct AgentStreamingResponse: View { + @EnvironmentObject private var store: WorkspaceStore + var text: String + + var body: some View { + VStack(alignment: .leading, spacing: 7) { + HStack(spacing: 6) { + Text("WeiBei") + .font(WeiBeiTypography.englishBrandFont(size: 9.8, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.76)) + Text("PI") + .font(.system(size: 9.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } + AgentMessageMarkdownText(text: text, rendersRichMarkdown: false) + } + .padding(.vertical, 10) + .padding(.leading, 20) + .padding(.trailing, 8) + .frame(maxWidth: .infinity, alignment: .leading) + .overlay(alignment: .leading) { + Capsule() + .fill(WeiBeiTheme.cinnabar.opacity(0.42)) + .frame(width: 2, height: 24) + .padding(.leading, 4) + } + .accessibilityLabel(Text(store.ui("PI 正在回答", "PI is responding"))) + } +} diff --git a/Sources/WeiBei/Views/RichMarkdownEditorView.swift b/Sources/WeiBei/Views/RichMarkdownEditorView.swift index 07f6fe7da..2cdbd11e9 100644 --- a/Sources/WeiBei/Views/RichMarkdownEditorView.swift +++ b/Sources/WeiBei/Views/RichMarkdownEditorView.swift @@ -370,7 +370,7 @@ struct RichMarkdownEditorView: NSViewRepresentable { coordinator?.handleAppShortcut(key: key, modifiers: modifiers) ?? false } context.coordinator.webView = view - if let url = Bundle.module.url(forResource: "index", withExtension: "html") { + if let url = WeiBeiResources.bundle.url(forResource: "index", withExtension: "html") { let editorDirectory = url.deletingLastPathComponent() view.loadFileURL(url, allowingReadAccessTo: editorDirectory.deletingLastPathComponent()) } else { diff --git a/Sources/WeiBeiCore/AgentOfflineTurn.swift b/Sources/WeiBeiCore/AgentOfflineTurn.swift index 3d8d47212..d31163637 100644 --- a/Sources/WeiBeiCore/AgentOfflineTurn.swift +++ b/Sources/WeiBeiCore/AgentOfflineTurn.swift @@ -11,7 +11,8 @@ public enum AgentOfflineTurn { AgentMessage( role: .assistant, text: AgentOfflinePreview.render(input), - source: sourceTitle ?? input.language.text("离线模式", "Offline mode") + source: sourceTitle ?? input.language.text("离线模式", "Offline mode"), + backend: .offline ) ] } diff --git a/Sources/WeiBeiCore/AgentResources/extension.ts b/Sources/WeiBeiCore/AgentResources/extension.ts new file mode 100644 index 000000000..3df4dcb18 --- /dev/null +++ b/Sources/WeiBeiCore/AgentResources/extension.ts @@ -0,0 +1,411 @@ +import { readFile } from "node:fs/promises"; + +import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; +import { Type } from "@earendil-works/pi-ai"; + +const CONTEXT_FILE_ENV = "WEIBEI_AGENT_CONTEXT_FILE"; +const CONTEXT_TOOL = "weibei_context"; +const NOTE_PROPOSAL_TOOL = "weibei_note_proposal"; +const ALLOWED_TOOLS = new Set([CONTEXT_TOOL, NOTE_PROPOSAL_TOOL]); + +const LIMITS = { + contextFileBytes: 512 * 1024, + identifier: 256, + title: 300, + question: 4_000, + materialText: 18_000, + noteText: 6_000, + selectionText: 2_000, + recentMessages: 8, + recentMessageText: 1_200, + messageSource: 300, + proposalMarkdown: 24_000, + proposalEvidenceItems: 16, + proposalEvidenceText: 500, +} as const; + +interface SourceSnapshot { + title: string; + text: string; + isTruncated: boolean; +} + +interface RecentMessageSnapshot { + role: string; + text: string; + source?: string; +} + +interface ContextSnapshotV1 { + schemaVersion: 1; + requestID: string; + contextRevision: string; + purpose: string; + workflow: string; + language: string; + question: string; + material?: SourceSnapshot; + note: SourceSnapshot; + selection?: SourceSnapshot; + recentMessages: RecentMessageSnapshot[]; +} + +interface ContextToolDetails { + kind: "weibei_context"; + schemaVersion: 1; + contextRevision: string; + snapshot: ContextSnapshotV1; +} + +interface NoteProposalDetails { + kind: "note_proposal"; + markdown: string; + evidence: string[]; + contextRevision: string; +} + +function isRecord(value: unknown): value is Record<string, unknown> { + return typeof value === "object" && value !== null && !Array.isArray(value); +} + +function requireRecord(value: unknown, field: string): Record<string, unknown> { + if (!isRecord(value)) { + throw new Error(`魏碑上下文字段 ${field} 必须是对象`); + } + return value; +} + +function requireString(value: unknown, field: string): string { + if (typeof value !== "string") { + throw new Error(`魏碑上下文字段 ${field} 必须是字符串`); + } + return value; +} + +function requireBoolean(value: unknown, field: string): boolean { + if (typeof value !== "boolean") { + throw new Error(`魏碑上下文字段 ${field} 必须是布尔值`); + } + return value; +} + +function requireIdentifier(value: unknown, field: string): string { + const text = requireString(value, field); + if (text.length === 0 || text.length > LIMITS.identifier) { + throw new Error(`魏碑上下文字段 ${field} 长度无效`); + } + return text; +} + +function truncate(text: string, maximumCharacters: number): string { + if (text.length <= maximumCharacters) return text; + + let result = text.slice(0, maximumCharacters); + const finalCodeUnit = result.charCodeAt(result.length - 1); + if (finalCodeUnit >= 0xd800 && finalCodeUnit <= 0xdbff) { + result = result.slice(0, -1); + } + return result; +} + +function readSource(value: unknown, field: string, textLimit: number): SourceSnapshot { + const source = requireRecord(value, field); + const originalText = requireString(source.text, `${field}.text`); + return { + title: truncate(requireString(source.title, `${field}.title`), LIMITS.title), + text: truncate(originalText, textLimit), + isTruncated: + requireBoolean(source.isTruncated, `${field}.isTruncated`) || originalText.length > textLimit, + }; +} + +function readOptionalSource(value: unknown, field: string, textLimit: number): SourceSnapshot | undefined { + if (value === undefined || value === null) return undefined; + return readSource(value, field, textLimit); +} + +function readRecentMessages(value: unknown): RecentMessageSnapshot[] { + if (!Array.isArray(value)) { + throw new Error("魏碑上下文字段 recentMessages 必须是数组"); + } + + return value.slice(-LIMITS.recentMessages).map((entry, index) => { + const message = requireRecord(entry, `recentMessages[${index}]`); + const source = message.source; + return { + role: requireIdentifier(message.role, `recentMessages[${index}].role`), + text: truncate( + requireString(message.text, `recentMessages[${index}].text`), + LIMITS.recentMessageText, + ), + source: + source === undefined || source === null + ? undefined + : truncate(requireString(source, `recentMessages[${index}].source`), LIMITS.messageSource), + }; + }); +} + +async function readCurrentSnapshot(): Promise<ContextSnapshotV1> { + const contextFile = process.env[CONTEXT_FILE_ENV]?.trim(); + if (!contextFile) { + throw new Error(`缺少环境变量 ${CONTEXT_FILE_ENV}`); + } + + let data: Buffer; + try { + data = await readFile(contextFile); + } catch { + throw new Error(`${CONTEXT_FILE_ENV} 指向的上下文文件无法读取`); + } + + if (data.byteLength > LIMITS.contextFileBytes) { + throw new Error("魏碑上下文文件超过大小限制"); + } + + let parsed: unknown; + try { + parsed = JSON.parse(data.toString("utf8")) as unknown; + } catch { + throw new Error("魏碑上下文文件不是合法 JSON"); + } + + const envelope = requireRecord(parsed, "root"); + if (envelope.schemaVersion !== 1) { + throw new Error("魏碑上下文仅支持 schemaVersion=1"); + } + + return { + schemaVersion: 1, + requestID: requireIdentifier(envelope.requestID, "requestID"), + contextRevision: requireIdentifier(envelope.contextRevision, "contextRevision"), + purpose: requireIdentifier(envelope.purpose, "purpose"), + workflow: requireIdentifier(envelope.workflow, "workflow"), + language: requireIdentifier(envelope.language, "language"), + question: truncate(requireString(envelope.question, "question"), LIMITS.question), + material: readOptionalSource(envelope.material, "material", LIMITS.materialText), + note: readSource(envelope.note, "note", LIMITS.noteText), + selection: readOptionalSource(envelope.selection, "selection", LIMITS.selectionText), + recentMessages: readRecentMessages(envelope.recentMessages), + }; +} + +function contextRevisionFromDetails(details: unknown): string | undefined { + if (!isRecord(details)) return undefined; + return typeof details.contextRevision === "string" ? details.contextRevision : undefined; +} + +function evidenceLabels(snapshot: ContextSnapshotV1): string[] { + const labels = [`[笔记:${snapshot.note.title}]`]; + if (snapshot.material) labels.push(`[材料:${snapshot.material.title}]`); + if (snapshot.selection) labels.push(`[选区:${snapshot.selection.title}]`); + return labels; +} + +export default function weibeiExtension(pi: ExtensionAPI) { + let requiredContextRevision: string | undefined; + let lastReadContextRevision: string | undefined; + + pi.registerTool({ + name: CONTEXT_TOOL, + label: "读取魏碑上下文", + description: + "读取本轮受限的魏碑上下文快照。每轮必须先调用一次,并且只能依据返回的当前材料、笔记和选区回答。", + promptSnippet: "读取当前魏碑材料、笔记、选区与上下文修订号", + parameters: Type.Object({}, { additionalProperties: false }), + executionMode: "sequential", + async execute() { + const snapshot = await readCurrentSnapshot(); + requiredContextRevision = snapshot.contextRevision; + lastReadContextRevision = snapshot.contextRevision; + + const details: ContextToolDetails = { + kind: "weibei_context", + schemaVersion: 1, + contextRevision: snapshot.contextRevision, + snapshot, + }; + + return { + content: [ + { + type: "text", + text: JSON.stringify( + { + contextRevision: snapshot.contextRevision, + snapshot, + }, + null, + 2, + ), + }, + ], + details, + }; + }, + }); + + pi.registerTool({ + name: NOTE_PROPOSAL_TOOL, + label: "提出笔记建议", + description: + "向魏碑返回一份待用户确认的 Markdown 笔记建议。它不会写入笔记;调用前必须先读取当前上下文。", + promptSnippet: "提交有证据、带当前修订号且尚未写回的笔记建议", + parameters: Type.Object( + { + markdown: Type.String({ + minLength: 1, + maxLength: LIMITS.proposalMarkdown, + description: "待用户确认的 Markdown 建议正文", + }), + evidence: Type.Array( + Type.String({ minLength: 1, maxLength: LIMITS.proposalEvidenceText }), + { + minItems: 1, + maxItems: LIMITS.proposalEvidenceItems, + description: "逐项列出可核对的当前材料、笔记或选区证据", + }, + ), + contextRevision: Type.String({ + minLength: 1, + maxLength: LIMITS.identifier, + description: "最近一次 weibei_context 返回的 contextRevision", + }), + }, + { additionalProperties: false }, + ), + executionMode: "sequential", + async execute(_toolCallId, params) { + const current = await readCurrentSnapshot(); + if (lastReadContextRevision !== current.contextRevision) { + lastReadContextRevision = undefined; + throw new Error("魏碑上下文已变化;请重新调用 weibei_context 后再提出笔记建议"); + } + if (params.contextRevision !== current.contextRevision) { + throw new Error( + `笔记建议的 contextRevision 不匹配;当前修订号为 ${current.contextRevision},请重新读取上下文`, + ); + } + + const markdown = params.markdown.trim(); + const evidence = params.evidence.map((item) => item.trim()).filter((item) => item.length > 0); + if (!markdown || evidence.length === 0) { + throw new Error("笔记建议必须包含非空 Markdown 和至少一条证据"); + } + const allowedEvidenceLabels = evidenceLabels(current); + if (evidence.some((item) => !allowedEvidenceLabels.some((label) => item.startsWith(label)))) { + throw new Error("笔记建议的每条证据都必须以当前材料、笔记或选区的真实来源标签开头"); + } + + const details: NoteProposalDetails = { + kind: "note_proposal", + markdown, + evidence, + contextRevision: current.contextRevision, + }; + + return { + content: [ + { + type: "text", + text: "笔记建议格式与上下文修订号已校验;这仍是待确认建议,尚未写回任何笔记。", + }, + ], + details, + }; + }, + }); + + pi.on("before_agent_start", async (event) => { + lastReadContextRevision = undefined; + + let purpose = "unavailable"; + let revision = "unavailable"; + try { + const snapshot = await readCurrentSnapshot(); + purpose = snapshot.purpose; + revision = snapshot.contextRevision; + requiredContextRevision = revision; + } catch { + requiredContextRevision = undefined; + } + + const turnContract = [ + "<weibei_turn>", + `purpose: ${JSON.stringify(purpose)}`, + `contextRevision: ${JSON.stringify(revision)}`, + "本轮第一次工具调用必须是 weibei_context。调用成功前不得回答事实问题,也不得提出笔记建议。", + "只使用该工具本轮返回的当前材料、当前笔记和当前选区;读取失败时只能说明当前上下文未确认。", + "</weibei_turn>", + ].join("\n"); + + return { systemPrompt: `${event.systemPrompt}\n\n${turnContract}` }; + }); + + pi.on("tool_call", (event) => { + if (!ALLOWED_TOOLS.has(event.toolName)) { + return { + block: true, + reason: `魏碑 Agent 只允许调用 ${CONTEXT_TOOL} 与 ${NOTE_PROPOSAL_TOOL}`, + }; + } + + if ( + event.toolName === NOTE_PROPOSAL_TOOL && + (!requiredContextRevision || + !lastReadContextRevision || + lastReadContextRevision !== requiredContextRevision) + ) { + return { + block: true, + reason: `必须先调用 ${CONTEXT_TOOL} 读取本轮当前上下文`, + }; + } + }); + + pi.on("context", async (event) => { + let currentRevision: string | undefined; + try { + currentRevision = (await readCurrentSnapshot()).contextRevision; + } catch { + currentRevision = undefined; + } + + const staleToolCallIDs = new Set<string>(); + for (const message of event.messages) { + if ( + message.role === "toolResult" && + ALLOWED_TOOLS.has(message.toolName) && + !message.isError && + (currentRevision === undefined || + contextRevisionFromDetails(message.details) !== currentRevision) + ) { + staleToolCallIDs.add(message.toolCallId); + } + } + + if (staleToolCallIDs.size === 0) return; + + const messages: typeof event.messages = []; + for (const message of event.messages) { + if (message.role === "toolResult" && staleToolCallIDs.has(message.toolCallId)) { + continue; + } + + if (message.role === "assistant") { + const content = message.content.filter( + (item) => item.type !== "toolCall" || !staleToolCallIDs.has(item.id), + ); + if (content.length === 0) continue; + if (content.length !== message.content.length) { + messages.push({ ...message, content }); + continue; + } + } + + messages.push(message); + } + + return { messages }; + }); +} diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md new file mode 100644 index 000000000..64d4b8614 --- /dev/null +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md @@ -0,0 +1,57 @@ +--- +name: weibei-close-reading +description: 对当前材料、当前笔记或当前选区做细读、解释、论证拆解、概念辨析和证据核对。用户要求解释一段内容、比较观点、总结论证或追问“这段是什么意思”时使用。 +compatibility: 需要 PI 0.80.2 与魏碑扩展提供的 weibei_context 工具。 +allowed-tools: weibei_context +--- + +# 魏碑细读 + +## 触发场景 + +- 解释当前选区、段落、概念或论证。 +- 比较当前材料与当前笔记中的说法。 +- 提炼作者结论、前提、证据、因果链或概念关系。 +- 核对某个判断能否被当前内容支持。 + +## 工作流 + +1. 第一项动作必须调用 `weibei_context`,取得当前快照与 `contextRevision`。 +2. 确定问题范围:用户明确指向选区时优先读选区;否则按问题使用当前材料和当前笔记。 +3. 提取原文主张、支持证据、关键概念与它们之间的关系。 +4. 将原文信息与推断分开。推断必须写明推断依据,不能伪装成原文事实。 +5. 证据不足时停止补全,明确写“当前上下文未确认”以及缺少的证据。 +6. 结论先行,随后给出处和必要拆解。 + +## 工具用法 + +- 只调用 `weibei_context`。 +- 不调用 `weibei_note_proposal`;细读回答本身不是笔记写回。 +- 如果工具结果的修订号失效,重新调用 `weibei_context`,不得继续使用旧结果。 + +## 证据规则 + +- 事实依据只来自本轮快照中的 `material`、`note` 和 `selection`。 +- `isTruncated: true` 表示只拿到来源片段,不得把片段当成完整材料或完整笔记。 +- `question` 与 `recentMessages` 只能帮助理解意图,不能作为事实证据。 +- 引用使用 `[选区:标题]`、`[材料:标题]` 或 `[笔记:标题]`。 +- 不得引入外部知识,不得伪造引文、页码、章节或来源标题。 + +## 输出格式 + +```markdown +## 结论 +一句到三句直接回答。 + +## 依据 +- [选区:标题] 证据与它支持的判断。 +- [材料:标题] 证据与它支持的判断。 + +## 拆解 +仅写理解问题所需的概念、关系或推理步骤。 + +## 未确认 +只在证据不足时列出尚不能确认的内容。 +``` + +没有内容的章节省略。不得声称任何笔记已经写入或修改。 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md new file mode 100644 index 000000000..765bee1a7 --- /dev/null +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md @@ -0,0 +1,69 @@ +--- +name: weibei-note-making +description: 基于当前材料、当前笔记和当前选区整理、补充、改写或润色 Markdown 笔记建议。用户要求生成要点、整理摘录、补来源、制作大纲或修改笔记时使用。 +compatibility: 需要 PI 0.80.2 与魏碑扩展提供的 weibei_context 和 weibei_note_proposal 工具。 +allowed-tools: weibei_context weibei_note_proposal +--- + +# 魏碑笔记整理 + +## 触发场景 + +- 把当前材料或选区整理成笔记、要点、摘录或大纲。 +- 补充当前笔记缺失的来源与证据。 +- 润色、压缩、重组当前笔记,同时保持原意。 +- 生成供用户确认的 Markdown 笔记内容。 + +## 工作流 + +1. 第一项动作必须调用 `weibei_context`,读取当前快照和 `contextRevision`。 +2. 根据用户要求确定建议范围;能沿用当前笔记标题、层级和结构时优先沿用。 +3. 只依据当前材料、当前笔记和当前选区起草 Markdown。保留重要原意,不把推断写成原文事实。 +4. 为建议整理 `evidence`:每条写明来源标签和它支持的笔记内容。 +5. 必须调用 `weibei_note_proposal`,传入完整 `markdown`、非空 `evidence` 和刚读取的 `contextRevision`。 +6. 如果工具拒绝修订号,重新调用 `weibei_context`,按新快照重做建议后再提交;不得复用旧建议冒充新结果。 +7. 最终只说明建议已交给魏碑等待确认,并明确“尚未写回”。 + +## 工具用法 + +- `weibei_context` 必须先调用,用于取得唯一有效的证据范围和修订号。 +- `weibei_note_proposal` 必须调用,用于返回待确认建议;它不是写入工具。 +- 不得调用文件读取、编辑、写入、终端或其他工具。 + +## 证据规则 + +- 事实依据只来自本轮快照中的 `material`、`note` 和 `selection`。 +- `isTruncated: true` 表示只拿到来源片段;建议不得声称覆盖了完整材料或完整笔记。 +- 每条 `evidence` 使用 `[选区:标题]`、`[材料:标题]` 或 `[笔记:标题]` 开头,并简述对应依据。 +- 没有当前证据支撑的内容不得写进建议;需要保留空缺时标为“待确认”。 +- `question` 与 `recentMessages` 不是事实证据。不得伪造引文、页码、章节或来源标题。 + +## 建议正文格式 + +优先保持当前笔记已有结构。新建结构时按任务选用以下部分,不强行补齐空章节: + +```markdown +## 核心要点 +- 要点与来源标记。 + +## 摘录 +> 可核对的短摘录。 + +## 待追问 +- 当前证据尚未回答的问题。 +``` + +## 最终输出格式 + +```markdown +## 笔记建议 +已向魏碑提交一份待确认的笔记建议。 + +## 依据 +- [材料:标题] 对应依据。 +- [笔记:标题] 对应依据。 + +这只是建议,尚未写回。 +``` + +不得使用“已写入”“已保存”“已同步”或其他表示写回完成的措辞。 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md new file mode 100644 index 000000000..ecd287c2b --- /dev/null +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md @@ -0,0 +1,77 @@ +--- +name: weibei-recall-practice +description: 根据当前材料、当前笔记或当前选区生成主动回忆、自测题、答案核对和薄弱点反馈。用户要求出题、考我、复习、自测或检查掌握程度时使用。 +compatibility: 需要 PI 0.80.2 与魏碑扩展提供的 weibei_context 工具。 +allowed-tools: weibei_context +--- + +# 魏碑回忆练习 + +## 触发场景 + +- 用户要求根据当前内容出题、考查或生成复习题。 +- 用户希望逐题练习并核对答案。 +- 用户要求从当前笔记找薄弱点或遗漏点。 +- 用户提交答案,希望按当前证据判断正误。 + +## 工作流 + +1. 第一项动作必须调用 `weibei_context`,取得当前快照和 `contextRevision`。 +2. 明确练习范围。用户指向选区时只考选区;否则按要求使用当前材料和当前笔记。 +3. 只设计能由当前证据明确作答的问题。默认生成 5 题;用户指定数量或逐题模式时服从用户要求。 +4. 题目覆盖回忆、解释、比较或基于原文的简单应用,但不得要求当前证据之外的知识。 +5. 为每个标准答案准备来源标签。证据无法给出唯一答案的题目直接删除,不得凭常识补答案。 +6. 用户提交答案后,重新读取当前上下文,再给出“正确 / 部分正确 / 当前证据无法确认”的判断与依据。 + +## 工具用法 + +- 只调用 `weibei_context`。 +- 不调用 `weibei_note_proposal`;练习与反馈不得被描述为笔记写回。 +- 修订号变化后重新生成或重新核对,不得沿用旧答案依据。 + +## 证据规则 + +- 事实依据只来自本轮快照中的 `material`、`note` 和 `selection`。 +- `isTruncated: true` 时只能考查已返回片段,不得声称题目覆盖完整材料或完整笔记。 +- `question` 与 `recentMessages` 只用于识别练习模式,不是答案证据。 +- 标准答案使用 `[选区:标题]`、`[材料:标题]` 或 `[笔记:标题]` 标注来源。 +- 不得引入外部知识,不得伪造概念定义、数字、例子、引文或来源位置。 + +## 输出格式 + +成套练习: + +```markdown +## 练习 +1. 题目 +2. 题目 + +## 答案与依据 +1. 标准答案。[材料:标题] +2. 标准答案。[笔记:标题] + +## 当前未覆盖 +只列出因证据不足而没有考查的内容。 +``` + +逐题模式首次只输出: + +```markdown +## 第 1 题 +题目 +``` + +收到用户答案后输出: + +```markdown +## 判断 +正确 / 部分正确 / 当前证据无法确认 + +## 依据 +- [材料:标题] 核对说明。 + +## 下一题 +下一道题目。 +``` + +没有内容的章节省略。不得无依据扩展答案,也不得声称修改了用户笔记。 diff --git a/Sources/WeiBeiCore/AgentResources/system.md b/Sources/WeiBeiCore/AgentResources/system.md new file mode 100644 index 000000000..4c579c0d8 --- /dev/null +++ b/Sources/WeiBeiCore/AgentResources/system.md @@ -0,0 +1,32 @@ +# 魏碑学习 Agent 系统契约 + +你是魏碑内置的学习 Agent。魏碑拥有材料、选区、笔记、来源证据和最终写回权;你只负责基于本轮上下文进行理解、推理、练习设计和笔记建议。 + +## 事实边界 + +1. 每轮必须先调用 `weibei_context`,读取当前材料、当前笔记、当前选区和 `contextRevision`。 +2. 只能把该工具本轮返回的当前材料、当前笔记和当前选区作为事实依据。用户问题与近期对话只用于理解意图,不是事实证据。 +3. 不得用常识、记忆、网络知识或旧工具结果补全缺失事实。当前证据不足时,明确写“当前上下文未确认”,并指出缺少哪一项证据。 +4. 上下文修订号变化后,旧修订下的摘录、判断和建议全部失效;重新读取上下文再继续。 +5. 任一来源的 `isTruncated` 为 `true` 时,只能判断已返回的片段;被截断部分一律视为“当前上下文未确认”。 + +## 回答规则 + +1. 结论先行,再给依据和必要的推理过程。 +2. 对事实性结论就近标注来源,统一使用以下格式: + - `[选区:标题]` + - `[材料:标题]` + - `[笔记:标题]` +3. 明确区分原文信息、基于原文的推断和未确认内容。不得伪造页码、章节、引文或来源标题。 +4. 回答保持直接、简洁;除非用户要求,不复述整份上下文。 + +## 笔记边界 + +1. 只能通过 `weibei_note_proposal` 提出 Markdown 笔记建议,不得直接修改用户笔记、材料或工作区文件。 +2. 调用建议工具时必须携带刚由 `weibei_context` 返回的同一 `contextRevision`,并为建议提供可核对的 `evidence`。 +3. 笔记建议只是待用户确认的提案。不得声称“已写入”“已保存”“已同步”“已替换”或以其他方式暗示已经写回。 +4. 未调用 `weibei_note_proposal` 时,不得把普通回答描述为笔记建议已经提交。 + +## 工具边界 + +只允许使用 `weibei_context` 与 `weibei_note_proposal`。不得尝试调用读取文件、终端命令、编辑、写入、网络访问或其他工具。 diff --git a/Sources/WeiBeiCore/OpenAIResponsesClient.swift b/Sources/WeiBeiCore/OpenAIResponsesClient.swift index 7b3c4c69c..098a69e8d 100644 --- a/Sources/WeiBeiCore/OpenAIResponsesClient.swift +++ b/Sources/WeiBeiCore/OpenAIResponsesClient.swift @@ -10,7 +10,7 @@ public struct AgentPromptPayload: Equatable { } } -public struct OpenAIResponsesClient { +public struct OpenAIResponsesClient: Sendable { let apiKey: String let model: String @@ -62,6 +62,20 @@ public struct OpenAIResponsesClient { return try Self.extractText(from: data) } + public func ask(request: StudyAgentRequest) async throws -> String { + try await ask( + question: request.question, + materialTitle: request.materialTitle, + materialText: request.materialText, + noteTitle: request.noteTitle, + noteText: request.noteText, + selectionTitle: request.selectionTitle, + selectionText: request.selectionText, + recentMessages: request.recentMessages, + language: request.language + ) + } + public static func composePrompt( question: String, materialTitle: String, @@ -181,3 +195,14 @@ public struct OpenAIResponsesClient { return text } } + +extension OpenAIResponsesClient: StudyAgentRuntime { + public func respond(to request: StudyAgentRequest, progress: StudyAgentProgressHandler?) async throws -> StudyAgentReply { + await progress?(.readingContext) + let text = try await ask(request: request) + return StudyAgentReply(text: text, backend: .openAI) + } + + public func cancel() async {} + public func reset() async {} +} diff --git a/Sources/WeiBeiCore/PiAgentRuntime.swift b/Sources/WeiBeiCore/PiAgentRuntime.swift new file mode 100644 index 000000000..7dc27266b --- /dev/null +++ b/Sources/WeiBeiCore/PiAgentRuntime.swift @@ -0,0 +1,1037 @@ +import Darwin +import CryptoKit +import Foundation +import Security + +public struct PiAgentProviderConfiguration: Equatable, Sendable { + public var provider: String? + public var model: String? + public var apiKey: String? + public var thinkingLevel: String + + public init(provider: String? = nil, model: String? = nil, apiKey: String? = nil, thinkingLevel: String = "medium") { + self.provider = provider?.trimmingCharacters(in: .whitespacesAndNewlines) + self.model = model?.trimmingCharacters(in: .whitespacesAndNewlines) + self.apiKey = apiKey?.trimmingCharacters(in: .whitespacesAndNewlines) + self.thinkingLevel = thinkingLevel.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + ? "medium" + : thinkingLevel.trimmingCharacters(in: .whitespacesAndNewlines) + } +} + +public struct PiAgentResources: Sendable { + public static let requiredSkillNames = [ + "weibei-close-reading", + "weibei-note-making", + "weibei-recall-practice", + ] + + public var rootURL: URL + public var extensionURL: URL + public var skillsURL: URL + public var systemPrompt: String + + public static func bundled() throws -> PiAgentResources { + let bundleName = "WeiBei_WeiBeiCore.bundle" + let packagedBundle = Bundle.main.resourceURL + .map { $0.appendingPathComponent(bundleName) } + .flatMap(Bundle.init(url:)) + let legacyBundle = Bundle(url: Bundle.main.bundleURL.appendingPathComponent(bundleName)) + let resourceBundle = packagedBundle ?? legacyBundle ?? Bundle.module + guard let rootURL = resourceBundle.url(forResource: "AgentResources", withExtension: nil) else { + throw PiAgentRuntimeError.resourcesMissing("AgentResources") + } + let extensionURL = rootURL.appendingPathComponent("extension.ts") + let skillsURL = rootURL.appendingPathComponent("skills", isDirectory: true) + let systemURL = rootURL.appendingPathComponent("system.md") + let hasRequiredSkills = requiredSkillNames.allSatisfy { skillName in + FileManager.default.fileExists( + atPath: skillsURL.appendingPathComponent(skillName).appendingPathComponent("SKILL.md").path + ) + } + guard FileManager.default.fileExists(atPath: extensionURL.path), + hasRequiredSkills, + let systemPrompt = try? String(contentsOf: systemURL, encoding: .utf8), + !systemPrompt.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { + throw PiAgentRuntimeError.resourcesMissing(rootURL.path) + } + return PiAgentResources( + rootURL: rootURL, + extensionURL: extensionURL, + skillsURL: skillsURL, + systemPrompt: systemPrompt + ) + } +} + +public struct PiRuntimeManifest: Decodable, Equatable, Sendable { + public var schemaVersion: Int + public var piVersion: String + public var sourceRepository: String + public var sourceCommit: String + public var license: String +} + +public enum PiBundledRuntime { + public static let requiredVersion = "0.80.2" + + private struct PackageMetadata: Decodable { + var version: String + } + + public static func validate( + executableURL: URL, + fileManager: FileManager = .default, + containingAppURL: URL? = nil + ) throws -> PiRuntimeManifest { + let executableURL = executableURL.standardizedFileURL + let binURL = executableURL.deletingLastPathComponent() + let runtimeURL = binURL.deletingLastPathComponent() + let manifestURL = runtimeURL.appendingPathComponent("manifest.json") + let integrityURL = runtimeURL.appendingPathComponent("binary.sha256") + let packageURL = binURL.appendingPathComponent("package.json") + let requiredFiles = [ + executableURL, + packageURL, + binURL.appendingPathComponent("theme/dark.json"), + binURL.appendingPathComponent("theme/light.json"), + runtimeURL.appendingPathComponent("LICENSE"), + runtimeURL.appendingPathComponent("THIRD_PARTY_NOTICES.md"), + manifestURL, + integrityURL, + ] + guard fileManager.isExecutableFile(atPath: executableURL.path), + requiredFiles.dropFirst().allSatisfy({ fileManager.fileExists(atPath: $0.path) }), + let data = try? Data(contentsOf: manifestURL), + let manifest = try? JSONDecoder().decode(PiRuntimeManifest.self, from: data), + let packageData = try? Data(contentsOf: packageURL), + let package = try? JSONDecoder().decode(PackageMetadata.self, from: packageData), + let expectedHash = try? String(contentsOf: integrityURL, encoding: .utf8) + .trimmingCharacters(in: .whitespacesAndNewlines).lowercased(), + manifest.schemaVersion == 1, + manifest.piVersion == requiredVersion, + package.version == requiredVersion, + manifest.license == "MIT", + !manifest.sourceRepository.isEmpty, + manifest.sourceCommit.count == 40, + expectedHash.count == 64, + expectedHash.allSatisfy({ $0.isHexDigit }), + (try? sha256(of: executableURL)) == expectedHash, + hasExpectedArchitecture(executableURL), + hasValidCodeSignature(executableURL) else { + throw PiAgentRuntimeError.resourcesMissing(runtimeURL.path) + } + + let defaultAppURL = Bundle.main.bundleURL.pathExtension == "app" ? Bundle.main.bundleURL : nil + if let appURL = (containingAppURL ?? defaultAppURL)?.standardizedFileURL, + executableURL.path.hasPrefix(appURL.path + "/"), + !hasValidCodeSignature(appURL) { + throw PiAgentRuntimeError.resourcesMissing(appURL.path) + } + return manifest + } + + private static func sha256(of url: URL) throws -> String { + let handle = try FileHandle(forReadingFrom: url) + defer { try? handle.close() } + var hasher = SHA256() + while let data = try handle.read(upToCount: 1_048_576), !data.isEmpty { + hasher.update(data: data) + } + return hasher.finalize().map { String(format: "%02x", $0) }.joined() + } + + private static func hasExpectedArchitecture(_ url: URL) -> Bool { + guard let handle = try? FileHandle(forReadingFrom: url), + let data = try? handle.read(upToCount: 8) else { return false } + try? handle.close() + let bytes = Array(data) + guard bytes.count == 8, Array(bytes[0..<4]) == [0xcf, 0xfa, 0xed, 0xfe] else { return false } + #if arch(arm64) + return Array(bytes[4..<8]) == [0x0c, 0x00, 0x00, 0x01] + #elseif arch(x86_64) + return Array(bytes[4..<8]) == [0x07, 0x00, 0x00, 0x01] + #else + return false + #endif + } + + private static func hasValidCodeSignature(_ url: URL) -> Bool { + var staticCode: SecStaticCode? + guard SecStaticCodeCreateWithPath(url as CFURL, SecCSFlags(), &staticCode) == errSecSuccess, + let staticCode else { return false } + let flags = SecCSFlags(rawValue: UInt32(kSecCSStrictValidate)) + return SecStaticCodeCheckValidity(staticCode, flags, nil) == errSecSuccess + } +} + +public enum PiExecutableLocator { + public static func locate( + bundleURL: URL = Bundle.main.bundleURL, + fileManager: FileManager = .default, + validator: (URL, FileManager) -> Bool = { candidate, fileManager in + (try? PiBundledRuntime.validate(executableURL: candidate, fileManager: fileManager)) != nil + } + ) -> URL? { + let candidates = [ + bundleURL.appendingPathComponent("Contents/Resources/PiRuntime/bin/pi"), + bundleURL.appendingPathComponent("PiRuntime/bin/pi"), + ] + return candidates.first { candidate in + fileManager.isExecutableFile(atPath: candidate.path) && validator(candidate, fileManager) + } + } +} + +public enum PiAgentRuntimeError: LocalizedError, Equatable, Sendable { + case unavailable + case resourcesMissing(String) + case busy + case launchFailed(String) + case commandTimedOut(String) + case commandRejected(String) + case protocolFailure(String) + case agentFailed(String) + case inFlightFailed(String) + case cancelled + + public var errorDescription: String? { + switch self { + case .unavailable: + return "魏碑内建的 PI 运行时缺失或损坏,请重新安装应用。" + case let .resourcesMissing(path): + return "魏碑的 PI 资源不完整:\(path)" + case .busy: + return "PI 正在处理另一项任务" + case let .launchFailed(message): + return "PI 启动失败:\(message)" + case let .commandTimedOut(command): + return "PI 命令超时:\(command)" + case let .commandRejected(message): + return "PI 拒绝命令:\(message)" + case let .protocolFailure(message): + return "PI 通信失败:\(message)" + case let .agentFailed(message): + return "PI 回答失败:\(message)" + case let .inFlightFailed(message): + return "PI 运行中断:\(message)" + case .cancelled: + return "PI 请求已取消" + } + } + + public var permitsAutomaticFallback: Bool { + switch self { + case .unavailable, .resourcesMissing, .busy, .launchFailed, .commandRejected: + return true + case let .commandTimedOut(command): + return command != "prompt" && command != "abort" + case .protocolFailure: + return true + case .agentFailed, .inFlightFailed, .cancelled: + return false + } + } +} + +public enum PiAgentDiagnosticSanitizer { + public static func sanitize(_ value: String, secret: String? = nil) -> String { + var result = value + if let secret, !secret.isEmpty { + result = result.replacingOccurrences(of: secret, with: "[REDACTED]") + } + let redactions = [ + (#"(?i)bearer\s+[A-Za-z0-9._~+/=-]{8,}"#, "Bearer [REDACTED]"), + (#"\bsk-[A-Za-z0-9_-]{8,}\b"#, "[REDACTED]"), + (#"(?i)([\"']?(?:authorization|api[_-]?key|access[_-]?token|secret)[\"']?\s*[:=]\s*[\"']?)([^\s\"',;}]+)"#, "$1[REDACTED]"), + ] + for (pattern, replacement) in redactions { + guard let expression = try? NSRegularExpression(pattern: pattern) else { continue } + let range = NSRange(result.startIndex..<result.endIndex, in: result) + result = expression.stringByReplacingMatches( + in: result, + range: range, + withTemplate: replacement + ) + } + let trimmed = result.trimmingCharacters(in: .whitespacesAndNewlines) + return String(trimmed.prefix(2_048)) + } +} + +public actor PiAgentRuntime: StudyAgentRuntime { + private struct PendingCommand { + var continuation: CheckedContinuation<PiRPCResponse, Error> + var timeoutTask: Task<Void, Never> + } + + private struct ActiveRun { + var id: UUID + var contextRevision: String + var workflow: StudyAgentWorkflow + var allowedSourceLabels: Set<String> + var didReadContext = false + var answeredBeforeContext = false + var streamedText = "" + var proposal: StudyAgentNoteProposal? + var lastError: String? + var progress: StudyAgentProgressHandler? + var continuation: CheckedContinuation<StudyAgentReply, Error>? + var completed: Result<StudyAgentReply, Error>? + var watchdogTask: Task<Void, Never>? + } + + private let executableOverride: URL? + private let runtimeDirectory: URL + private var providerConfiguration = PiAgentProviderConfiguration() + private var process: Process? + private var inputHandle: FileHandle? + private var stdoutTask: Task<Void, Never>? + private var stderrTask: Task<Void, Never>? + private var pendingCommands: [String: PendingCommand] = [:] + private var activeRun: ActiveRun? + private var stderrBuffer = "" + private var startupFailure: PiAgentRuntimeError? + private var idleShutdownTask: Task<Void, Never>? + private let traceEnabled = ProcessInfo.processInfo.environment["WEIBEI_PI_TRACE"] == "1" + + public init(executableURL: URL? = nil, runtimeDirectory: URL? = nil) { + executableOverride = executableURL + self.runtimeDirectory = runtimeDirectory + ?? FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first? + .appendingPathComponent("WeiBei/AgentRuntime", isDirectory: true) + ?? FileManager.default.temporaryDirectory.appendingPathComponent("WeiBeiAgentRuntime", isDirectory: true) + } + + public func configure(_ configuration: PiAgentProviderConfiguration) { + guard providerConfiguration != configuration else { return } + providerConfiguration = configuration + shutdownProcess(reason: PiAgentRuntimeError.cancelled) + } + + public func healthCheck() async throws -> String { + try await ensureProcess() + return process?.executableURL?.path ?? "pi" + } + + public func respond(to request: StudyAgentRequest, progress: StudyAgentProgressHandler?) async throws -> StudyAgentReply { + guard activeRun == nil else { throw PiAgentRuntimeError.busy } + idleShutdownTask?.cancel() + idleShutdownTask = nil + try await ensureProcess() + + _ = try await sendCommand(type: "new_session", timeoutSeconds: 3) + let context = StudyAgentContextEnvelope(request: request) + try writeContext(context) + await progress?(.readingContext) + + activeRun = ActiveRun( + id: request.id, + contextRevision: request.contextRevision, + workflow: request.resolvedWorkflow, + allowedSourceLabels: sourceLabels(in: context), + progress: progress + ) + refreshRunWatchdog() + + do { + _ = try await sendCommand( + type: "prompt", + fields: ["message": piPrompt(for: request)], + timeoutSeconds: 3 + ) + } catch { + let failure = promptSubmissionFailure(from: error) + discardRun(id: request.id) + shutdownProcess(reason: failure) + throw failure + } + + return try await waitForRun(id: request.id) + } + + public func cancel() async { + guard let runID = activeRun?.id else { return } + await cancelRun(id: runID) + } + + private func cancelRun(id runID: UUID) async { + guard activeRun?.id == runID else { return } + guard process != nil else { + finishRun(id: runID, with: .failure(PiAgentRuntimeError.cancelled)) + return + } + + do { + _ = try await sendCommand(type: "abort", timeoutSeconds: 2) + } catch { + shutdownProcess(reason: PiAgentRuntimeError.cancelled) + return + } + + if activeRun?.id == runID { + finishRun(id: runID, with: .failure(PiAgentRuntimeError.cancelled)) + } + } + + public func reset() async { + await cancel() + } + + public func shutdown() async { + let runningProcess = process + shutdownProcess(reason: PiAgentRuntimeError.cancelled) + await forceStopIfNeeded(runningProcess, graceNanoseconds: 750_000_000) + } + + private func ensureProcess() async throws { + if let process, process.isRunning { return } + + let executableURL = executableOverride ?? PiExecutableLocator.locate() + guard let executableURL else { throw PiAgentRuntimeError.unavailable } + _ = try PiBundledRuntime.validate(executableURL: executableURL) + let resources = try PiAgentResources.bundled() + try FileManager.default.createDirectory(at: runtimeDirectory, withIntermediateDirectories: true) + try? FileManager.default.setAttributes([.posixPermissions: 0o700], ofItemAtPath: runtimeDirectory.path) + let piConfigurationURL = try preparePiConfigurationDirectory() + let piSessionURL = runtimeDirectory.appendingPathComponent("Sessions", isDirectory: true) + try FileManager.default.createDirectory(at: piSessionURL, withIntermediateDirectories: true) + try? FileManager.default.setAttributes([.posixPermissions: 0o700], ofItemAtPath: piSessionURL.path) + + let contextURL = runtimeDirectory.appendingPathComponent("context.json") + let process = Process() + let inputPipe = Pipe() + let outputPipe = Pipe() + let errorPipe = Pipe() + + process.executableURL = executableURL + process.currentDirectoryURL = runtimeDirectory + process.standardInput = inputPipe + process.standardOutput = outputPipe + process.standardError = errorPipe + process.arguments = launchArguments(resources: resources) + process.environment = launchEnvironment( + executableURL: executableURL, + contextURL: contextURL, + piConfigurationURL: piConfigurationURL + ) + process.terminationHandler = { [weak self] terminated in + Task { await self?.processDidTerminate(pid: terminated.processIdentifier, status: terminated.terminationStatus) } + } + + stderrBuffer = "" + startupFailure = nil + self.process = process + inputHandle = inputPipe.fileHandleForWriting + + do { + try process.run() + trace("launched pid=\(process.processIdentifier) executable=\(executableURL.path)") + } catch { + self.process = nil + inputHandle = nil + throw PiAgentRuntimeError.launchFailed(error.localizedDescription) + } + + stdoutTask = readStdout(outputPipe.fileHandleForReading) + stderrTask = readStderr(errorPipe.fileHandleForReading) + + do { + let state = try await sendCommand(type: "get_state", timeoutSeconds: 3) + guard state.dataJSON != nil else { + throw PiAgentRuntimeError.protocolFailure("get_state returned no data") + } + let commands = try await sendCommand(type: "get_commands", timeoutSeconds: 3) + try verifyRequiredSkills(in: commands) + if let startupFailure { throw startupFailure } + } catch { + shutdownProcess(reason: error) + throw error + } + } + + private func launchArguments(resources: PiAgentResources) -> [String] { + var arguments = [ + "--mode", "rpc", + "--offline", + "--no-session", + "--no-builtin-tools", + "--tools", "weibei_context,weibei_note_proposal", + "--no-extensions", + "--extension", resources.extensionURL.path, + "--no-skills", + "--skill", resources.skillsURL.path, + "--no-prompt-templates", + "--no-themes", + "--no-context-files", + "--no-approve", + "--system-prompt", resources.systemPrompt, + "--thinking", providerConfiguration.thinkingLevel, + "--name", "WeiBei", + ] + if let provider = providerConfiguration.provider, !provider.isEmpty { + arguments.append(contentsOf: ["--provider", provider]) + } + if let model = providerConfiguration.model, !model.isEmpty { + arguments.append(contentsOf: ["--model", model]) + } + return arguments + } + + private func piPrompt(for request: StudyAgentRequest) -> String { + let skillName: String + switch request.resolvedWorkflow { + case .automatic, .closeReading: + skillName = "weibei-close-reading" + case .noteMaking: + skillName = "weibei-note-making" + case .recallPractice: + skillName = "weibei-recall-practice" + } + return "/skill:\(skillName) \(request.question)" + } + + private func sourceLabels(in context: StudyAgentContextEnvelope) -> Set<String> { + var labels = ["[笔记:\(context.note.title)]"] + if let material = context.material { + labels.append("[材料:\(material.title)]") + } + if let selection = context.selection { + labels.append("[选区:\(selection.title)]") + } + return Set(labels) + } + + private func launchEnvironment( + executableURL: URL, + contextURL: URL, + piConfigurationURL: URL + ) -> [String: String] { + let executableDirectory = executableURL.deletingLastPathComponent().path + var environment = [ + "HOME": FileManager.default.homeDirectoryForCurrentUser.path, + "PATH": "\(executableDirectory):/usr/bin:/bin:/usr/sbin:/sbin", + "TMPDIR": FileManager.default.temporaryDirectory.path, + "PI_TELEMETRY": "0", + "PI_OFFLINE": "1", + "PI_SKIP_VERSION_CHECK": "1", + "PI_ZH_AUTO_UPDATE": "0", + "PI_PACKAGE_DIR": executableDirectory, + "PI_CODING_AGENT_DIR": piConfigurationURL.path, + "PI_CODING_AGENT_SESSION_DIR": runtimeDirectory.appendingPathComponent("Sessions", isDirectory: true).path, + "WEIBEI_AGENT_CONTEXT_FILE": contextURL.path, + "WEIBEI_AGENT_RUNTIME": "1", + "GIT_TERMINAL_PROMPT": "0", + "NO_COLOR": "1", + "TERM": "dumb", + ] + let hostEnvironment = ProcessInfo.processInfo.environment + for key in ["LANG", "LC_ALL"] { + if let value = hostEnvironment[key], value.count <= 128, !value.contains("\n") { + environment[key] = value + } + } + if let apiKey = providerConfiguration.apiKey, !apiKey.isEmpty { + environment["OPENAI_API_KEY"] = apiKey + } + return environment + } + + private func promptSubmissionFailure(from error: Error) -> PiAgentRuntimeError { + if error is CancellationError || Task.isCancelled { + return .cancelled + } + guard let runtimeError = error as? PiAgentRuntimeError else { + return .inFlightFailed(error.localizedDescription) + } + switch runtimeError { + case .cancelled, .commandRejected: + return runtimeError + default: + return .inFlightFailed(runtimeError.localizedDescription) + } + } + + private func preparePiConfigurationDirectory() throws -> URL { + let fileManager = FileManager.default + let destination = runtimeDirectory.appendingPathComponent("PiConfig", isDirectory: true) + try fileManager.createDirectory(at: destination, withIntermediateDirectories: true) + try? fileManager.setAttributes([.posixPermissions: 0o700], ofItemAtPath: destination.path) + + let source = fileManager.homeDirectoryForCurrentUser.appendingPathComponent(".pi/agent", isDirectory: true) + + if source.standardizedFileURL != destination.standardizedFileURL { + seedLocalPiAuth(from: source, to: destination) + seedLocalPiSettings(from: source, to: destination) + } + return destination + } + + private func seedLocalPiAuth(from sourceDirectory: URL, to destinationDirectory: URL) { + let fileManager = FileManager.default + let destination = destinationDirectory.appendingPathComponent("auth.json") + guard !fileManager.fileExists(atPath: destination.path) else { return } + let source = sourceDirectory.appendingPathComponent("auth.json") + guard let attributes = try? fileManager.attributesOfItem(atPath: source.path), + let size = attributes[.size] as? NSNumber, + size.intValue <= 1_048_576, + let data = try? Data(contentsOf: source), + (try? JSONSerialization.jsonObject(with: data)) is [String: Any] else { return } + do { + try data.write(to: destination, options: [.atomic]) + try? fileManager.setAttributes([.posixPermissions: 0o600], ofItemAtPath: destination.path) + } catch { + trace("could not seed isolated PI auth: \(error.localizedDescription)") + } + } + + private func seedLocalPiSettings(from sourceDirectory: URL, to destinationDirectory: URL) { + let source = sourceDirectory.appendingPathComponent("settings.json") + guard let data = try? Data(contentsOf: source), + let object = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else { return } + let allowedKeys = ["defaultProvider", "defaultModel", "defaultThinkingLevel"] + let settings = allowedKeys.reduce(into: [String: Any]()) { result, key in + if let value = object[key] as? String { + result[key] = value + } + } + guard JSONSerialization.isValidJSONObject(settings), + let sanitized = try? JSONSerialization.data(withJSONObject: settings, options: [.sortedKeys]) else { return } + let destination = destinationDirectory.appendingPathComponent("settings.json") + do { + try sanitized.write(to: destination, options: [.atomic]) + try? FileManager.default.setAttributes([.posixPermissions: 0o600], ofItemAtPath: destination.path) + } catch { + trace("could not seed isolated PI settings: \(error.localizedDescription)") + } + } + + private func writeContext(_ context: StudyAgentContextEnvelope) throws { + let data = try JSONEncoder().encode(context) + let url = runtimeDirectory.appendingPathComponent("context.json") + try data.write(to: url, options: [.atomic]) + try? FileManager.default.setAttributes([.posixPermissions: 0o600], ofItemAtPath: url.path) + } + + private func sendCommand( + type: String, + fields: [String: Any] = [:], + timeoutSeconds: UInt64 + ) async throws -> PiRPCResponse { + guard let inputHandle, process?.isRunning == true else { + throw PiAgentRuntimeError.unavailable + } + + let id = UUID().uuidString.lowercased() + var object = fields + object["id"] = id + object["type"] = type + var data = try JSONSerialization.data(withJSONObject: object) + data.append(0x0A) + trace("send type=\(type) id=\(id)") + + return try await withTaskCancellationHandler(operation: { + try await withCheckedThrowingContinuation { continuation in + let timeoutTask = Task { [weak self] in + do { + try await Task.sleep(nanoseconds: timeoutSeconds * 1_000_000_000) + } catch { + return + } + await self?.timeoutCommand(id: id, command: type) + } + pendingCommands[id] = PendingCommand(continuation: continuation, timeoutTask: timeoutTask) + do { + try inputHandle.write(contentsOf: data) + } catch { + if let pending = pendingCommands.removeValue(forKey: id) { + pending.timeoutTask.cancel() + pending.continuation.resume(throwing: PiAgentRuntimeError.protocolFailure(error.localizedDescription)) + } + } + } + }, onCancel: { + Task { await self.cancelPendingCommand(id: id) } + }) + } + + private func timeoutCommand(id: String, command: String) { + guard let pending = pendingCommands.removeValue(forKey: id) else { return } + trace("timeout type=\(command) id=\(id)") + pending.continuation.resume(throwing: PiAgentRuntimeError.commandTimedOut(command)) + } + + private func cancelPendingCommand(id: String) { + guard let pending = pendingCommands.removeValue(forKey: id) else { return } + pending.timeoutTask.cancel() + pending.continuation.resume(throwing: PiAgentRuntimeError.cancelled) + } + + private func waitForRun(id: UUID) async throws -> StudyAgentReply { + try await withTaskCancellationHandler(operation: { + try await withCheckedThrowingContinuation { continuation in + guard var run = activeRun, run.id == id else { + continuation.resume(throwing: PiAgentRuntimeError.cancelled) + return + } + if let completed = run.completed { + activeRun = nil + scheduleIdleShutdown() + continuation.resume(with: completed) + } else { + run.continuation = continuation + activeRun = run + } + } + }, onCancel: { + Task { await self.cancelRun(id: id) } + }) + } + + private func readStdout(_ handle: FileHandle) -> Task<Void, Never> { + Task.detached(priority: .userInitiated) { [weak self] in + await self?.trace("stdout reader started") + var framer = PiJSONLFramer() + do { + while !Task.isCancelled { + let data = handle.availableData + if data.isEmpty { break } + let lines = try framer.append(data) + for line in lines { + await self?.trace("stdout line bytes=\(line.count)") + await self?.receiveStdoutLine(line) + } + } + _ = try framer.finish() + } catch { + await self?.transportFailed(error) + } + } + } + + private func readStderr(_ handle: FileHandle) -> Task<Void, Never> { + Task.detached(priority: .utility) { [weak self] in + while !Task.isCancelled { + let data = handle.availableData + if data.isEmpty { break } + await self?.appendStderr(data) + } + } + } + + private func receiveStdoutLine(_ line: Data) async { + let message: PiRPCIncomingMessage + do { + message = try PiRPCMessageDecoder.decode(line) + } catch { + transportFailed(error) + return + } + + switch message { + case let .response(response): + guard let id = response.id, let pending = pendingCommands.removeValue(forKey: id) else { + if response.command == "parse" { + transportFailed(PiAgentRuntimeError.protocolFailure(response.error ?? "PI parse error")) + } + return + } + pending.timeoutTask.cancel() + if response.success { + pending.continuation.resume(returning: response) + } else { + pending.continuation.resume( + throwing: PiAgentRuntimeError.commandRejected( + sanitizedDiagnostic(response.error ?? response.command) + ) + ) + } + + case let .textDelta(delta): + guard var run = activeRun else { return } + guard run.didReadContext else { + run.answeredBeforeContext = true + run.lastError = "PI answered before reading the current WeiBei context" + activeRun = run + return + } + run.streamedText += delta + activeRun = run + refreshRunWatchdog() + await run.progress?(.text(run.streamedText)) + + case let .assistantError(message): + guard var run = activeRun else { return } + run.lastError = sanitizedDiagnostic(message) + activeRun = run + refreshRunWatchdog() + + case let .toolStarted(_, name): + guard let run = activeRun else { return } + guard name == "weibei_context" || name == "weibei_note_proposal" else { + finishRun( + id: run.id, + with: .failure(PiAgentRuntimeError.agentFailed("PI attempted an unavailable tool: \(name)")) + ) + return + } + refreshRunWatchdog() + await run.progress?(.usingTool(name)) + + case let .contextRead(_, contextRevision): + guard var run = activeRun else { return } + guard contextRevision == run.contextRevision else { + finishRun( + id: run.id, + with: .failure(PiAgentRuntimeError.agentFailed("PI read a stale WeiBei context")) + ) + return + } + run.didReadContext = true + activeRun = run + refreshRunWatchdog() + + case let .noteProposal(_, proposal): + guard var run = activeRun else { return } + guard run.workflow == .noteMaking else { + finishRun( + id: run.id, + with: .failure(PiAgentRuntimeError.agentFailed("PI proposed a note outside the note-making workflow")) + ) + return + } + guard proposal.contextRevision == run.contextRevision else { + finishRun( + id: run.id, + with: .failure(PiAgentRuntimeError.agentFailed("PI proposed a note for a stale context")) + ) + return + } + guard !proposal.evidence.isEmpty, + proposal.evidence.allSatisfy({ evidence in + run.allowedSourceLabels.contains(where: { evidence.hasPrefix($0) }) + }) else { + finishRun( + id: run.id, + with: .failure(PiAgentRuntimeError.agentFailed("PI returned a note proposal without current-source evidence")) + ) + return + } + run.proposal = proposal + activeRun = run + refreshRunWatchdog() + + case let .toolFailed(_, name, message): + guard var run = activeRun else { return } + run.lastError = "\(name): \(sanitizedDiagnostic(message))" + activeRun = run + refreshRunWatchdog() + + case let .agentEnded(text, stopReason): + guard let run = activeRun else { return } + let cleanText = (text.isEmpty ? run.streamedText : text).trimmingCharacters(in: .whitespacesAndNewlines) + if stopReason == "aborted" { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.cancelled)) + } else if stopReason == "error" { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed(run.lastError ?? "Unknown model error"))) + } else if run.answeredBeforeContext { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI answered before reading the current WeiBei context"))) + } else if !run.didReadContext { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI did not read the current WeiBei context"))) + } else if run.workflow == .noteMaking, run.proposal == nil { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI returned no revision-matched note proposal"))) + } else if run.workflow != .noteMaking, + !run.allowedSourceLabels.contains(where: { cleanText.contains($0) }) { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI returned an answer without a current-source label"))) + } else if cleanText.isEmpty, let proposal = run.proposal { + finishRun(id: run.id, with: .success(StudyAgentReply(text: proposal.markdown, backend: .pi, noteProposal: proposal))) + } else if cleanText.isEmpty { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed(run.lastError ?? "PI returned no readable text"))) + } else { + finishRun(id: run.id, with: .success(StudyAgentReply(text: cleanText, backend: .pi, noteProposal: run.proposal))) + } + + case let .extensionError(message): + let message = sanitizedDiagnostic(message) + if let runID = activeRun?.id { + finishRun(id: runID, with: .failure(PiAgentRuntimeError.agentFailed(message))) + } else { + startupFailure = .launchFailed(message) + } + + case .event: + refreshRunWatchdog() + } + } + + private func finishRun(id: UUID, with result: Result<StudyAgentReply, Error>) { + guard var run = activeRun, run.id == id, run.completed == nil else { return } + run.watchdogTask?.cancel() + run.watchdogTask = nil + clearContextSnapshot() + if let continuation = run.continuation { + activeRun = nil + continuation.resume(with: result) + scheduleIdleShutdown() + } else { + run.completed = result + activeRun = run + } + } + + private func discardRun(id: UUID) { + guard let run = activeRun, run.id == id else { return } + run.watchdogTask?.cancel() + activeRun = nil + clearContextSnapshot() + scheduleIdleShutdown() + } + + private func clearContextSnapshot() { + let url = runtimeDirectory.appendingPathComponent("context.json") + try? FileManager.default.removeItem(at: url) + } + + private func verifyRequiredSkills(in response: PiRPCResponse) throws { + guard let data = response.dataJSON, + let object = try? JSONSerialization.jsonObject(with: data) as? [String: Any], + let commands = object["commands"] as? [[String: Any]] else { + throw PiAgentRuntimeError.protocolFailure("get_commands returned no command list") + } + let commandNames = Set(commands.compactMap { $0["name"] as? String }) + let missing = PiAgentResources.requiredSkillNames.filter { + !commandNames.contains("skill:\($0)") + } + guard missing.isEmpty else { + throw PiAgentRuntimeError.resourcesMissing("Missing PI skills: \(missing.joined(separator: ", "))") + } + } + + private func refreshRunWatchdog() { + guard var run = activeRun else { return } + run.watchdogTask?.cancel() + let runID = run.id + run.watchdogTask = Task { [weak self] in + do { + try await Task.sleep(nanoseconds: 300 * 1_000_000_000) + } catch { + return + } + await self?.runTimedOut(id: runID) + } + activeRun = run + } + + private func runTimedOut(id: UUID) async { + guard activeRun?.id == id else { return } + finishRun(id: id, with: .failure(PiAgentRuntimeError.agentFailed("PI produced no events for five minutes"))) + do { + _ = try await sendCommand(type: "abort", timeoutSeconds: 2) + } catch { + shutdownProcess(reason: error) + } + } + + private func scheduleIdleShutdown() { + idleShutdownTask?.cancel() + idleShutdownTask = Task { [weak self] in + do { + try await Task.sleep(nanoseconds: 300 * 1_000_000_000) + } catch { + return + } + await self?.shutdownIfIdle() + } + } + + private func shutdownIfIdle() { + guard activeRun == nil else { return } + shutdownProcess(reason: PiAgentRuntimeError.cancelled) + } + + private func appendStderr(_ data: Data) { + let text = sanitizedDiagnostic(String(decoding: data, as: UTF8.self)) + stderrBuffer += text + trace("stderr bytes=\(data.count)") + if stderrBuffer.count > 16_384 { + stderrBuffer = String(stderrBuffer.suffix(16_384)) + } + } + + private func transportFailed(_ error: Error) { + shutdownProcess(reason: PiAgentRuntimeError.protocolFailure(error.localizedDescription)) + } + + private func processDidTerminate(pid: Int32, status: Int32) { + guard process?.processIdentifier == pid else { return } + let detail = stderrBuffer.trimmingCharacters(in: .whitespacesAndNewlines) + let message = detail.isEmpty ? "exit status \(status)" : String(detail.suffix(2_048)) + shutdownProcess(reason: PiAgentRuntimeError.launchFailed(message)) + } + + private func sanitizedDiagnostic(_ value: String) -> String { + PiAgentDiagnosticSanitizer.sanitize(value, secret: providerConfiguration.apiKey) + } + + private func shutdownProcess(reason: Error) { + trace("shutdown: \(reason.localizedDescription)") + clearContextSnapshot() + idleShutdownTask?.cancel() + idleShutdownTask = nil + stdoutTask?.cancel() + stderrTask?.cancel() + stdoutTask = nil + stderrTask = nil + + let runningProcess = process + process = nil + try? inputHandle?.close() + inputHandle = nil + if let processToStop = runningProcess, processToStop.isRunning { + processToStop.terminate() + Task.detached(priority: .utility) { + try? await Task.sleep(nanoseconds: 1_000_000_000) + if processToStop.isRunning { + Darwin.kill(processToStop.processIdentifier, SIGKILL) + } + } + } + + for pending in pendingCommands.values { + pending.timeoutTask.cancel() + pending.continuation.resume(throwing: reason) + } + pendingCommands.removeAll() + + if let runID = activeRun?.id { + let activeReason: Error + if reason is CancellationError || (reason as? PiAgentRuntimeError) == .cancelled { + activeReason = PiAgentRuntimeError.cancelled + } else if let error = reason as? PiAgentRuntimeError, + case .inFlightFailed = error { + activeReason = error + } else { + activeReason = PiAgentRuntimeError.inFlightFailed(reason.localizedDescription) + } + finishRun(id: runID, with: .failure(activeReason)) + } + } + + private func forceStopIfNeeded(_ process: Process?, graceNanoseconds: UInt64) async { + guard let process, process.isRunning else { return } + let interval = UInt64(50_000_000) + var waited: UInt64 = 0 + while process.isRunning, waited < graceNanoseconds { + try? await Task.sleep(nanoseconds: interval) + waited += interval + } + if process.isRunning { + Darwin.kill(process.processIdentifier, SIGKILL) + } + } + + private func trace(_ message: String) { + guard traceEnabled else { return } + FileHandle.standardError.write(Data("[WeiBei PI] \(sanitizedDiagnostic(message))\n".utf8)) + } +} diff --git a/Sources/WeiBeiCore/PiRPCProtocol.swift b/Sources/WeiBeiCore/PiRPCProtocol.swift new file mode 100644 index 000000000..59097992b --- /dev/null +++ b/Sources/WeiBeiCore/PiRPCProtocol.swift @@ -0,0 +1,214 @@ +import Foundation + +public enum PiRPCProtocolError: LocalizedError, Equatable, Sendable { + case lineTooLarge(Int) + case incompleteLine + case invalidJSON + case invalidEnvelope + + public var errorDescription: String? { + switch self { + case let .lineTooLarge(size): + return "PI RPC line exceeded the size limit (\(size) bytes)" + case .incompleteLine: + return "PI RPC ended with an incomplete JSONL record" + case .invalidJSON: + return "PI RPC emitted invalid JSON" + case .invalidEnvelope: + return "PI RPC emitted an invalid envelope" + } + } +} + +public struct PiJSONLFramer: Sendable { + public var maximumLineBytes: Int + private var buffer = Data() + + public init(maximumLineBytes: Int = 8 * 1_024 * 1_024) { + self.maximumLineBytes = maximumLineBytes + } + + public mutating func append(_ data: Data) throws -> [Data] { + buffer.append(data) + guard buffer.count <= maximumLineBytes || buffer.contains(0x0A) else { + throw PiRPCProtocolError.lineTooLarge(buffer.count) + } + + var lines: [Data] = [] + while let newline = buffer.firstIndex(of: 0x0A) { + var line = Data(buffer[..<newline]) + buffer.removeSubrange(...newline) + if line.last == 0x0D { line.removeLast() } + if line.count > maximumLineBytes { + throw PiRPCProtocolError.lineTooLarge(line.count) + } + if !line.isEmpty { lines.append(line) } + } + + if buffer.count > maximumLineBytes { + throw PiRPCProtocolError.lineTooLarge(buffer.count) + } + return lines + } + + public mutating func finish() throws -> [Data] { + guard buffer.isEmpty else { throw PiRPCProtocolError.incompleteLine } + return [] + } +} + +public struct PiRPCResponse: Equatable, Sendable { + public var id: String? + public var command: String + public var success: Bool + public var error: String? + public var dataJSON: Data? + + public init(id: String?, command: String, success: Bool, error: String?, dataJSON: Data? = nil) { + self.id = id + self.command = command + self.success = success + self.error = error + self.dataJSON = dataJSON + } +} + +public enum PiRPCIncomingMessage: Equatable, Sendable { + case response(PiRPCResponse) + case textDelta(String) + case assistantError(String) + case toolStarted(id: String, name: String) + case contextRead(id: String, contextRevision: String) + case noteProposal(id: String, StudyAgentNoteProposal) + case toolFailed(id: String, name: String, message: String) + case agentEnded(text: String, stopReason: String?) + case extensionError(String) + case event(String) +} + +public enum PiRPCMessageDecoder { + public static func decode(_ data: Data) throws -> PiRPCIncomingMessage { + let value: Any + do { + value = try JSONSerialization.jsonObject(with: data) + } catch { + throw PiRPCProtocolError.invalidJSON + } + guard let object = value as? [String: Any], let type = object["type"] as? String else { + throw PiRPCProtocolError.invalidEnvelope + } + + switch type { + case "response": + guard let command = object["command"] as? String, + let success = object["success"] as? Bool else { + throw PiRPCProtocolError.invalidEnvelope + } + return .response( + PiRPCResponse( + id: object["id"] as? String, + command: command, + success: success, + error: object["error"] as? String, + dataJSON: jsonData(object["data"]) + ) + ) + + case "message_update": + guard let event = object["assistantMessageEvent"] as? [String: Any], + let eventType = event["type"] as? String else { + return .event(type) + } + if eventType == "text_delta", let delta = event["delta"] as? String { + return .textDelta(delta) + } + if eventType == "error" { + let reason = event["error"] as? String + ?? event["reason"] as? String + ?? "PI agent request failed" + return .assistantError(reason) + } + return .event(eventType) + + case "tool_execution_start": + guard let name = object["toolName"] as? String else { + throw PiRPCProtocolError.invalidEnvelope + } + return .toolStarted(id: object["toolCallId"] as? String ?? "", name: name) + + case "tool_execution_end": + let name = object["toolName"] as? String ?? "unknown" + let isError = object["isError"] as? Bool ?? false + let result = object["result"] as? [String: Any] + if isError { + return .toolFailed( + id: object["toolCallId"] as? String ?? "", + name: name, + message: firstText(in: result) ?? "Tool failed" + ) + } + if name == "weibei_context", + let details = result?["details"] as? [String: Any], + details["kind"] as? String == "weibei_context", + let revision = details["contextRevision"] as? String { + return .contextRead( + id: object["toolCallId"] as? String ?? "", + contextRevision: revision + ) + } + if name == "weibei_note_proposal", + let details = result?["details"] as? [String: Any], + details["kind"] as? String == "note_proposal", + let markdown = details["markdown"] as? String, + let revision = details["contextRevision"] as? String { + return .noteProposal( + id: object["toolCallId"] as? String ?? "", + StudyAgentNoteProposal( + markdown: markdown, + evidence: details["evidence"] as? [String] ?? [], + contextRevision: revision + ) + ) + } + return .event(type) + + case "agent_end": + let messages = object["messages"] as? [[String: Any]] ?? [] + var finalText = "" + var stopReason: String? + for message in messages where message["role"] as? String == "assistant" { + let text = assistantText(in: message) + if !text.isEmpty { finalText = text } + stopReason = message["stopReason"] as? String ?? stopReason + } + return .agentEnded(text: finalText, stopReason: stopReason) + + case "extension_error": + let path = object["extensionPath"] as? String ?? "WeiBei extension" + let event = object["event"] as? String ?? "event" + let message = object["error"] as? String ?? "Unknown extension error" + return .extensionError("\(path) [\(event)]: \(message)") + + default: + return .event(type) + } + } + + private static func assistantText(in message: [String: Any]) -> String { + let content = message["content"] as? [[String: Any]] ?? [] + return content.compactMap { item in + guard item["type"] as? String == "text" else { return nil } + return item["text"] as? String + }.joined(separator: "\n").trimmingCharacters(in: .whitespacesAndNewlines) + } + + private static func firstText(in result: [String: Any]?) -> String? { + let content = result?["content"] as? [[String: Any]] ?? [] + return content.compactMap { $0["text"] as? String }.first + } + + private static func jsonData(_ value: Any?) -> Data? { + guard let value, JSONSerialization.isValidJSONObject(value) else { return nil } + return try? JSONSerialization.data(withJSONObject: value, options: [.sortedKeys]) + } +} diff --git a/Sources/WeiBeiCore/StudyAgentRuntime.swift b/Sources/WeiBeiCore/StudyAgentRuntime.swift new file mode 100644 index 000000000..f9b49348d --- /dev/null +++ b/Sources/WeiBeiCore/StudyAgentRuntime.swift @@ -0,0 +1,224 @@ +import Foundation + +public enum StudyAgentPurpose: String, Codable, Sendable { + case conversation + case quietInsight +} + +public enum StudyAgentWorkflow: String, Codable, Sendable { + case automatic + case closeReading + case noteMaking + case recallPractice +} + +public struct StudyAgentRequest: Sendable { + public var id: UUID + public var purpose: StudyAgentPurpose + public var workflow: StudyAgentWorkflow + public var question: String + public var materialTitle: String + public var materialText: String + public var noteTitle: String + public var noteText: String + public var selectionTitle: String? + public var selectionText: String? + public var recentMessages: [AgentMessage] + public var language: WeiBeiInterfaceLanguage + public var contextRevision: String + + public init( + id: UUID = UUID(), + purpose: StudyAgentPurpose, + workflow: StudyAgentWorkflow = .automatic, + question: String, + materialTitle: String, + materialText: String, + noteTitle: String, + noteText: String, + selectionTitle: String? = nil, + selectionText: String? = nil, + recentMessages: [AgentMessage] = [], + language: WeiBeiInterfaceLanguage = .chinese, + contextRevision: String + ) { + self.id = id + self.purpose = purpose + self.workflow = workflow + self.question = question + self.materialTitle = materialTitle + self.materialText = materialText + self.noteTitle = noteTitle + self.noteText = noteText + self.selectionTitle = selectionTitle + self.selectionText = selectionText + self.recentMessages = recentMessages + self.language = language + self.contextRevision = contextRevision + } + + public var resolvedWorkflow: StudyAgentWorkflow { + guard workflow == .automatic else { return workflow } + if purpose == .quietInsight { return .closeReading } + + let value = question.lowercased() + let recallTerms = ["出题", "测验", "复习题", "自测", "quiz", "test me", "questions"] + if recallTerms.contains(where: value.contains) { return .recallPractice } + + let noteTerms = ["整理", "写入", "笔记", "润色", "摘录", "要点", "outline", "organize", "note", "rewrite"] + if noteTerms.contains(where: value.contains) { return .noteMaking } + + return .closeReading + } + +} + +public struct StudyAgentNoteProposal: Codable, Equatable, Sendable { + public var markdown: String + public var evidence: [String] + public var contextRevision: String + + public init(markdown: String, evidence: [String], contextRevision: String) { + self.markdown = markdown + self.evidence = evidence + self.contextRevision = contextRevision + } +} + +public struct StudyAgentReply: Equatable, Sendable { + public var text: String + public var backend: StudyAgentBackend + public var noteProposal: StudyAgentNoteProposal? + + public init(text: String, backend: StudyAgentBackend, noteProposal: StudyAgentNoteProposal? = nil) { + self.text = text + self.backend = backend + self.noteProposal = noteProposal + } +} + +public enum StudyAgentProgress: Equatable, Sendable { + case readingContext + case usingTool(String) + case text(String) +} + +public typealias StudyAgentProgressHandler = @Sendable (StudyAgentProgress) async -> Void + +public protocol StudyAgentRuntime: Sendable { + func respond(to request: StudyAgentRequest, progress: StudyAgentProgressHandler?) async throws -> StudyAgentReply + func cancel() async + func reset() async +} + +public extension StudyAgentRuntime { + func respond(to request: StudyAgentRequest) async throws -> StudyAgentReply { + try await respond(to: request, progress: nil) + } +} + +public struct OfflineStudyAgentRuntime: StudyAgentRuntime { + public init() {} + + public func respond(to request: StudyAgentRequest, progress: StudyAgentProgressHandler?) async throws -> StudyAgentReply { + await progress?(.readingContext) + let text = AgentOfflinePreview.render( + AgentOfflinePreviewInput( + language: request.language, + question: request.question, + hasMaterial: !request.materialText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, + materialTitle: request.materialTitle, + materialText: request.materialText, + noteTitle: request.noteTitle, + noteText: request.noteText, + selectionTitle: request.selectionTitle, + selectionText: request.selectionText + ) + ) + return StudyAgentReply(text: text, backend: .offline) + } + + public func cancel() async {} + public func reset() async {} +} + +public struct StudyAgentContextEnvelope: Codable, Equatable, Sendable { + public struct Source: Codable, Equatable, Sendable { + public var title: String + public var text: String + public var isTruncated: Bool + + public init(title: String, text: String, isTruncated: Bool = false) { + self.title = title + self.text = text + self.isTruncated = isTruncated + } + } + + public struct Message: Codable, Equatable, Sendable { + public var role: String + public var text: String + public var source: String? + + public init(role: String, text: String, source: String?) { + self.role = role + self.text = text + self.source = source + } + } + + public var schemaVersion: Int + public var requestID: String + public var contextRevision: String + public var purpose: String + public var workflow: String + public var language: String + public var question: String + public var material: Source? + public var note: Source + public var selection: Source? + public var recentMessages: [Message] + + public init(request: StudyAgentRequest) { + schemaVersion = 1 + requestID = request.id.uuidString.lowercased() + contextRevision = request.contextRevision + purpose = request.purpose.rawValue + workflow = request.resolvedWorkflow.rawValue + language = request.language.rawValue + question = String(request.question.prefix(4_000)) + + let materialText = String(request.materialText.prefix(18_000)) + material = materialText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + ? nil + : Source( + title: String(request.materialTitle.prefix(300)), + text: materialText, + isTruncated: request.materialText.count > materialText.count + ) + + let noteText = String(request.noteText.prefix(6_000)) + note = Source( + title: String(request.noteTitle.prefix(300)), + text: noteText, + isTruncated: request.noteText.count > noteText.count + ) + + let selectedText = String((request.selectionText ?? "").prefix(2_000)) + selection = selectedText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + ? nil + : Source( + title: String((request.selectionTitle ?? request.materialTitle).prefix(300)), + text: selectedText, + isTruncated: (request.selectionText ?? "").count > selectedText.count + ) + + recentMessages = request.recentMessages.suffix(8).map { message in + Message( + role: message.role.rawValue, + text: String(message.text.prefix(1_200)), + source: message.source + ) + } + } +} diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index c030bc367..786057da3 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -public enum WeiBeiInterfaceLanguage: String, CaseIterable, Identifiable, Codable { +public enum WeiBeiInterfaceLanguage: String, CaseIterable, Identifiable, Codable, Sendable { case chinese = "zh-Hans" case english = "en" @@ -677,23 +677,38 @@ public struct StudyItem: Identifiable, Codable, Hashable { } } -public enum AgentRole: String, Codable { +public enum AgentRole: String, Codable, Sendable { case user case assistant } -public struct AgentMessage: Identifiable, Codable, Hashable { +public enum StudyAgentBackend: String, Codable, Hashable, Sendable { + case pi + case openAI + case offline +} + +public struct AgentMessage: Identifiable, Codable, Hashable, Sendable { public var id: UUID public var role: AgentRole public var text: String public var source: String? + public var backend: StudyAgentBackend? public var createdAt: Date - public init(id: UUID = UUID(), role: AgentRole, text: String, source: String?, createdAt: Date = Date()) { + public init( + id: UUID = UUID(), + role: AgentRole, + text: String, + source: String?, + backend: StudyAgentBackend? = nil, + createdAt: Date = Date() + ) { self.id = id self.role = role self.text = text self.source = source + self.backend = backend self.createdAt = createdAt } diff --git a/Sources/WeiBeiPiCheck/main.swift b/Sources/WeiBeiPiCheck/main.swift new file mode 100644 index 000000000..578538731 --- /dev/null +++ b/Sources/WeiBeiPiCheck/main.swift @@ -0,0 +1,170 @@ +import Darwin +import Foundation +import WeiBeiCore + +@main +struct WeiBeiPiCheck { + static func main() async { + let environment = ProcessInfo.processInfo.environment + let liveCheckSetting = environment["WEIBEI_PI_LIVE_CHECK"] ?? "auto" + let runsEvaluation = environment["WEIBEI_PI_EVAL"] == "1" + let explicitPath = environment["WEIBEI_PI_EXECUTABLE"]? + .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + let executableURL = explicitPath.isEmpty + ? PiExecutableLocator.locate() + : URL(fileURLWithPath: explicitPath) + let containingAppPath = environment["WEIBEI_PI_APP_BUNDLE"]? + .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + let containingAppURL = containingAppPath.isEmpty ? nil : URL(fileURLWithPath: containingAppPath) + + guard let executableURL else { + fputs("pi-check failed: embedded PI runtime not found\n", stderr) + exit(1) + } + + let runtimeRoot = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-pi-check-\(UUID().uuidString)", isDirectory: true) + let runtime = PiAgentRuntime(executableURL: executableURL, runtimeDirectory: runtimeRoot) + + do { + let manifest = try PiBundledRuntime.validate( + executableURL: executableURL, + containingAppURL: containingAppURL + ) + let launchedPath = try await runtime.healthCheck() + let isolatedConfig = runtimeRoot.appendingPathComponent("PiConfig", isDirectory: true) + guard FileManager.default.fileExists(atPath: isolatedConfig.path) else { + throw PiCheckError.missingIsolatedConfiguration + } + print("pi-check ready: PI \(manifest.piVersion) at \(launchedPath)") + + let isolatedAuth = isolatedConfig.appendingPathComponent("auth.json") + let hasConfiguredAuth = ((try? isolatedAuth.resourceValues(forKeys: [.fileSizeKey]).fileSize) ?? 0) > 2 + let runsLiveCheck = runsEvaluation + || liveCheckSetting == "1" + || (liveCheckSetting != "0" && hasConfiguredAuth) + if runsLiveCheck { + try await checkNoteMaking(runtime) + } + if runsEvaluation { + try await checkCloseReading(runtime) + try await checkRecallPractice(runtime) + print("pi-eval passed: close-reading, note-making, recall-practice") + } + try verifyNoPersistedTurnState(runtimeRoot) + + await runtime.shutdown() + try? FileManager.default.removeItem(at: runtimeRoot) + } catch { + await runtime.shutdown() + try? FileManager.default.removeItem(at: runtimeRoot) + fputs("pi-check failed: \(error.localizedDescription)\n", stderr) + exit(1) + } + } + + private static func checkNoteMaking(_ runtime: PiAgentRuntime) async throws { + let reply = try await runtime.respond( + to: request( + workflow: .noteMaking, + question: "请把当前选区整理成一个带来源的 Markdown 核心要点,并提交待确认的笔记建议。", + revision: "pi-check-note" + ) + ) + guard reply.backend == .pi, + !reply.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, + let proposal = reply.noteProposal, + proposal.contextRevision == "pi-check-note", + !proposal.markdown.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, + !proposal.evidence.isEmpty else { + throw PiCheckError.invalidLiveReply + } + print("pi-live-check passed: proposal=\(proposal.markdown.count) chars evidence=\(proposal.evidence.count)") + } + + private static func checkCloseReading(_ runtime: PiAgentRuntime) async throws { + let reply = try await runtime.respond( + to: request( + workflow: .closeReading, + question: "只根据当前内容解释为什么利率可称为资金价格,并标明来源。", + revision: "pi-check-reading" + ) + ) + guard reply.backend == .pi, + reply.noteProposal == nil, + reply.text.contains("资金"), + containsSourceLabel(reply.text) else { + throw PiCheckError.invalidEvaluation("close-reading") + } + } + + private static func checkRecallPractice(_ runtime: PiAgentRuntime) async throws { + let reply = try await runtime.respond( + to: request( + workflow: .recallPractice, + question: "只根据当前内容出 2 道复习题,并给出带来源的答案。", + revision: "pi-check-recall" + ) + ) + guard reply.backend == .pi, + reply.noteProposal == nil, + reply.text.contains("?") || reply.text.contains("?"), + containsSourceLabel(reply.text) else { + throw PiCheckError.invalidEvaluation("recall-practice") + } + } + + private static func request( + workflow: StudyAgentWorkflow, + question: String, + revision: String + ) -> StudyAgentRequest { + StudyAgentRequest( + purpose: .conversation, + workflow: workflow, + question: question, + materialTitle: "利率课程", + materialText: "利率是资金使用价格的表达。名义利率以货币单位表示,实际利率扣除了通货膨胀后的购买力变化。", + noteTitle: "课堂笔记", + noteText: "# 利率\n\n## 待整理", + selectionTitle: "利率定义", + selectionText: "利率是资金使用价格的表达。", + language: .chinese, + contextRevision: revision + ) + } + + private static func containsSourceLabel(_ text: String) -> Bool { + text.contains("[选区:") || text.contains("[材料:") || text.contains("[笔记:") + } + + private static func verifyNoPersistedTurnState(_ runtimeRoot: URL) throws { + let fileManager = FileManager.default + let contextURL = runtimeRoot.appendingPathComponent("context.json") + let sessionsURL = runtimeRoot.appendingPathComponent("Sessions", isDirectory: true) + let sessionEntries = (try? fileManager.contentsOfDirectory(atPath: sessionsURL.path)) ?? [] + guard !fileManager.fileExists(atPath: contextURL.path), sessionEntries.isEmpty else { + throw PiCheckError.persistedTurnState + } + } +} + +private enum PiCheckError: LocalizedError { + case invalidLiveReply + case invalidEvaluation(String) + case missingIsolatedConfiguration + case persistedTurnState + + var errorDescription: String? { + switch self { + case .invalidLiveReply: + "PI returned no revision-matched note proposal" + case let .invalidEvaluation(name): + "PI evaluation failed: \(name)" + case .missingIsolatedConfiguration: + "PI did not use an isolated WeiBei configuration directory" + case .persistedTurnState: + "PI persisted a context snapshot or session after the turn" + } + } +} diff --git a/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift new file mode 100644 index 000000000..14b42d873 --- /dev/null +++ b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift @@ -0,0 +1,259 @@ +import Foundation +import WeiBeiCore + +func runPiAgentSelfChecks() throws { + try checkJSONLFraming() + try checkRPCDecoding() + try checkStudyAgentContext() + try checkBundledAgentResources() + try checkPiExecutableLocation() +} + +private func piRequire(_ condition: @autoclosure () throws -> Bool, _ message: String) throws { + guard try condition() else { throw PiAgentSelfCheckError.failed(message) } +} + +private func checkJSONLFraming() throws { + let delta = "中文跨字节\u{2028}仍在同一条 JSON 记录" + let first = #"{"type":"message_update","assistantMessageEvent":{"type":"text_delta","delta":"中文跨字节
仍在同一条 JSON 记录"}}"# + let second = #"{"type":"tool_execution_start","toolCallId":"tool-1","toolName":"weibei_context"}"# + var framer = PiJSONLFramer() + var records: [Data] = [] + for byte in Data("\(first)\r\n\(second)\n".utf8) { + records.append(contentsOf: try framer.append(Data([byte]))) + } + _ = try framer.finish() + try piRequire(records.count == 2, "PI JSONL keeps CRLF compatibility and emits two records") + try piRequire(PiRPCMessageDecoder.decode(records[0]) == .textDelta(delta), "PI JSONL preserves split UTF-8 and U+2028") + try piRequire(PiRPCMessageDecoder.decode(records[1]) == .toolStarted(id: "tool-1", name: "weibei_context"), "PI JSONL preserves tool ids") + + var incomplete = PiJSONLFramer() + _ = try incomplete.append(Data("{\"type\":\"event\"}".utf8)) + do { + _ = try incomplete.finish() + throw PiAgentSelfCheckError.failed("PI JSONL accepted an unterminated record") + } catch let error as PiRPCProtocolError { + try piRequire(error == .incompleteLine, "PI JSONL rejects an unterminated record") + } + + var bounded = PiJSONLFramer(maximumLineBytes: 3) + do { + _ = try bounded.append(Data("four".utf8)) + throw PiAgentSelfCheckError.failed("PI JSONL accepted an oversized record") + } catch let error as PiRPCProtocolError { + try piRequire(error == .lineTooLarge(4), "PI JSONL enforces its byte limit") + } +} + +private func checkRPCDecoding() throws { + let state = try PiRPCMessageDecoder.decode(Data(#"{"id":"state-1","type":"response","command":"get_state","success":true,"data":{"isStreaming":false}}"#.utf8)) + guard case let .response(response) = state else { + throw PiAgentSelfCheckError.failed("PI get_state response did not decode") + } + try piRequire(response.id == "state-1" && response.command == "get_state" && response.success && response.dataJSON != nil, "PI get_state keeps correlation and data") + + let rejection = try PiRPCMessageDecoder.decode(Data(#"{"id":"prompt-1","type":"response","command":"prompt","success":false,"error":"busy"}"#.utf8)) + try piRequire(rejection == .response(PiRPCResponse(id: "prompt-1", command: "prompt", success: false, error: "busy")), "PI rejected commands keep their errors") + + let failedTool = try PiRPCMessageDecoder.decode(Data(#"{"type":"tool_execution_end","toolCallId":"tool-2","toolName":"weibei_context","isError":true,"result":{"content":[{"type":"text","text":"stale context"}]}}"#.utf8)) + try piRequire(failedTool == .toolFailed(id: "tool-2", name: "weibei_context", message: "stale context"), "PI tool failures keep ids and messages") + + let contextRead = try PiRPCMessageDecoder.decode(Data(#"{"type":"tool_execution_end","toolCallId":"tool-context","toolName":"weibei_context","isError":false,"result":{"details":{"kind":"weibei_context","contextRevision":"revision-7"}}}"#.utf8)) + try piRequire(contextRead == .contextRead(id: "tool-context", contextRevision: "revision-7"), "PI context reads preserve the validated revision") + + let proposalData = try JSONSerialization.data(withJSONObject: [ + "type": "tool_execution_end", + "toolCallId": "tool-3", + "toolName": "weibei_note_proposal", + "isError": false, + "result": [ + "content": [["type": "text", "text": "accepted"]], + "details": [ + "kind": "note_proposal", + "markdown": "## 核心要点\n- 利率是资金价格。", + "evidence": ["[选区:利率定义]"], + "contextRevision": "revision-7", + ], + ], + ]) + let proposal = try PiRPCMessageDecoder.decode(proposalData) + try piRequire( + proposal == .noteProposal( + id: "tool-3", + StudyAgentNoteProposal( + markdown: "## 核心要点\n- 利率是资金价格。", + evidence: ["[选区:利率定义]"], + contextRevision: "revision-7" + ) + ), + "PI note proposals preserve Markdown, evidence, and revision" + ) + + let ended = try PiRPCMessageDecoder.decode(Data(#"{"type":"agent_end","messages":[{"role":"assistant","content":[{"type":"text","text":"第一轮"}],"stopReason":"toolUse"},{"role":"assistant","content":[{"type":"text","text":"最终回答"}],"stopReason":"stop"}]}"#.utf8)) + try piRequire(ended == .agentEnded(text: "最终回答", stopReason: "stop"), "PI agent_end selects the final assistant answer") + try piRequire(try PiRPCMessageDecoder.decode(Data(#"{"type":"future_event"}"#.utf8)) == .event("future_event"), "PI decoder tolerates unknown future events") + + do { + _ = try PiRPCMessageDecoder.decode(Data("not-json".utf8)) + throw PiAgentSelfCheckError.failed("PI decoder accepted invalid JSON") + } catch let error as PiRPCProtocolError { + try piRequire(error == .invalidJSON, "PI decoder rejects invalid JSON") + } +} + +private func checkStudyAgentContext() throws { + let recentMessages = (0..<10).map { index in + AgentMessage(role: index.isMultiple(of: 2) ? .user : .assistant, text: "message-\(index)" + String(repeating: "字", count: 1_300), source: "source-\(index)") + } + let request = StudyAgentRequest( + purpose: .conversation, + question: "请根据当前材料出题", + materialTitle: String(repeating: "材", count: 320), + materialText: String(repeating: "材", count: 18_100), + noteTitle: String(repeating: "记", count: 320), + noteText: String(repeating: "记", count: 6_100), + selectionTitle: String(repeating: "选", count: 320), + selectionText: String(repeating: "选", count: 2_100), + recentMessages: recentMessages, + language: .chinese, + contextRevision: "revision-9" + ) + try piRequire(request.resolvedWorkflow == .recallPractice, "study-agent automatic routing selects recall practice") + let noteRequest = StudyAgentRequest( + purpose: .conversation, + question: "整理成笔记", + materialTitle: "材料", + materialText: "正文", + noteTitle: "笔记", + noteText: "", + contextRevision: "revision-10" + ) + try piRequire(noteRequest.resolvedWorkflow == .noteMaking, "study-agent automatic routing selects note making") + let quietRequest = StudyAgentRequest( + purpose: .quietInsight, + question: "出题", + materialTitle: "材料", + materialText: "正文", + noteTitle: "笔记", + noteText: "", + contextRevision: "revision-11" + ) + try piRequire(quietRequest.resolvedWorkflow == .closeReading, "quiet insight stays on close reading") + + let envelope = StudyAgentContextEnvelope(request: request) + try piRequire(envelope.schemaVersion == 1 && envelope.contextRevision == "revision-9", "study-agent context carries schema and revision") + try piRequire(envelope.workflow == StudyAgentWorkflow.recallPractice.rawValue, "study-agent context carries resolved workflow") + try piRequire(envelope.material?.text.count == 18_000 && envelope.note.text.count == 6_000 && envelope.selection?.text.count == 2_000, "study-agent context applies source limits") + try piRequire(envelope.material?.title.count == 300 && envelope.note.title.count == 300 && envelope.selection?.title.count == 300, "study-agent context bounds source labels consistently") + try piRequire(envelope.material?.isTruncated == true && envelope.note.isTruncated && envelope.selection?.isTruncated == true, "study-agent context marks every truncated source") + try piRequire(envelope.recentMessages.count == 8 && envelope.recentMessages.first?.text.hasPrefix("message-2") == true, "study-agent context keeps the latest eight messages") + try piRequire(envelope.recentMessages.allSatisfy { $0.text.count <= 1_200 }, "study-agent context bounds recent messages") + + let message = AgentMessage(role: .assistant, text: "PI answer", source: "材料", backend: .pi) + let encoded = try JSONEncoder().encode(message) + try piRequire(try JSONDecoder().decode(AgentMessage.self, from: encoded).backend == .pi, "agent backend round-trips") + var legacyObject = try JSONSerialization.jsonObject(with: encoded) as? [String: Any] ?? [:] + legacyObject.removeValue(forKey: "backend") + let legacyData = try JSONSerialization.data(withJSONObject: legacyObject) + try piRequire(try JSONDecoder().decode(AgentMessage.self, from: legacyData).backend == nil, "legacy agent messages remain decodable") + + try piRequire(PiAgentRuntimeError.unavailable.permitsAutomaticFallback, "PI startup failures may use the existing fallback") + try piRequire(!PiAgentRuntimeError.agentFailed("model error").permitsAutomaticFallback, "accepted PI runs are never replayed automatically") + try piRequire(!PiAgentRuntimeError.commandTimedOut("prompt").permitsAutomaticFallback, "unknown prompt acceptance is never replayed automatically") + + let diagnostic = PiAgentDiagnosticSanitizer.sanitize( + #"Authorization: Bearer abcdefghijklmnop api_key="sk-sensitive-token""#, + secret: "sk-sensitive-token" + ) + try piRequire( + diagnostic.contains("[REDACTED]") + && !diagnostic.contains("abcdefghijklmnop") + && !diagnostic.contains("sk-sensitive-token"), + "PI diagnostics redact provider credentials before reaching logs or UI" + ) +} + +private func checkBundledAgentResources() throws { + let resources = try PiAgentResources.bundled() + try piRequire(resources.systemPrompt.contains("魏碑拥有材料、选区、笔记"), "PI system contract is bundled") + let extensionSource = try String(contentsOf: resources.extensionURL, encoding: .utf8) + try piRequire(extensionSource.contains("before_agent_start") && extensionSource.contains("tool_call") && extensionSource.contains("pi.on(\"context\""), "PI extension bundles source, permission, and stale-context hooks") + try piRequire(extensionSource.contains("weibei_context") && extensionSource.contains("weibei_note_proposal"), "PI extension bundles only WeiBei-owned tools") + + for skillName in PiAgentResources.requiredSkillNames { + let skillURL = resources.skillsURL.appendingPathComponent(skillName).appendingPathComponent("SKILL.md") + let source = try String(contentsOf: skillURL, encoding: .utf8) + try piRequire(source.contains("name: \(skillName)") && source.contains("description:"), "PI skill \(skillName) has valid frontmatter") + } + + let runtimeSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBeiCore/PiAgentRuntime.swift") + let runtimeSource = try String(contentsOf: runtimeSourceURL, encoding: .utf8) + try piRequire( + runtimeSource.contains("answeredBeforeContext") + && runtimeSource.contains("allowedSourceLabels") + && runtimeSource.contains("PI returned an answer without a current-source label") + && runtimeSource.contains("binary.sha256") + && runtimeSource.contains("SecStaticCodeCheckValidity"), + "PI host enforces context-first answers, source labels, binary integrity, and code signatures" + ) +} + +private func checkPiExecutableLocation() throws { + let fileManager = FileManager.default + let root = fileManager.temporaryDirectory.appendingPathComponent("weibei-pi-locator-\(UUID().uuidString)", isDirectory: true) + defer { try? fileManager.removeItem(at: root) } + + func makeExecutable(_ url: URL) throws { + try fileManager.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true) + try Data("#!/bin/sh\nexit 0\n".utf8).write(to: url) + try fileManager.setAttributes([.posixPermissions: 0o755], ofItemAtPath: url.path) + } + + let bundleURL = root.appendingPathComponent("WeiBei.app", isDirectory: true) + let runtimeURL = bundleURL.appendingPathComponent("Contents/Resources/PiRuntime", isDirectory: true) + let executableURL = runtimeURL.appendingPathComponent("bin/pi") + try makeExecutable(executableURL) + + try piRequire( + PiExecutableLocator.locate( + bundleURL: bundleURL, + fileManager: fileManager, + validator: { candidate, _ in candidate.standardizedFileURL == executableURL.standardizedFileURL } + )?.standardizedFileURL == executableURL.standardizedFileURL, + "PI executable locator resolves the app-bundled runtime path" + ) + try piRequire( + PiExecutableLocator.locate(bundleURL: bundleURL, fileManager: fileManager) == nil, + "PI executable locator rejects a bundled runtime that fails integrity validation" + ) + + let externalPi = root.appendingPathComponent(".nvm/versions/node/v24.13.0/bin/pi") + try makeExecutable(externalPi) + let emptyBundle = root.appendingPathComponent("Empty.app", isDirectory: true) + try piRequire( + PiExecutableLocator.locate( + bundleURL: emptyBundle, + fileManager: fileManager, + validator: { _, _ in true } + ) == nil, + "PI executable locator never falls back to a user-installed runtime" + ) + + let preparedRuntime = ProcessInfo.processInfo.environment["WEIBEI_PI_EXECUTABLE"]? + .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + if !preparedRuntime.isEmpty { + let manifest = try PiBundledRuntime.validate(executableURL: URL(fileURLWithPath: preparedRuntime)) + try piRequire(manifest.piVersion == PiBundledRuntime.requiredVersion, "PI runtime validation pins binary integrity and version") + } +} + +private enum PiAgentSelfCheckError: LocalizedError { + case failed(String) + + var errorDescription: String? { + switch self { + case let .failed(message): message + } + } +} diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 70ce02ecc..41f3e5a50 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -12,6 +12,8 @@ func expect(_ condition: @autoclosure () -> Bool, _ message: String) { } } +try runPiAgentSelfChecks() + expect(EmptyWorkspaceDayPeriod(hour: 5) == .morning && EmptyWorkspaceDayPeriod(hour: 10) == .morning && EmptyWorkspaceDayPeriod(hour: 11) == .midday @@ -204,11 +206,20 @@ expect(runScript.contains("BUILD_CONFIGURATION=\"release\"") && runScript.contains("swift build -c \"$BUILD_CONFIGURATION\"") && runScript.contains("swift build -c \"$BUILD_CONFIGURATION\" --show-bin-path") && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiSelfCheck") - && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiWebEditorCheck"), "user-facing app builds are optimized while check and debugger modes remain debuggable") + && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiWebEditorCheck") + && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiPiCheck"), "user-facing app builds are optimized while check and debugger modes remain debuggable") +expect(runScript.contains("${PRODUCT_NAME}_WeiBeiCore.bundle") + && runScript.contains("for resource_bundle in \"${RESOURCE_BUNDLES[@]}\"") + && runScript.contains("cp -R \"$resource_bundle\" \"$APP_RESOURCES/\"") + && !runScript.contains("cp -R \"$resource_bundle\" \"$APP_BUNDLE/\""), "packaging places both Swift resource bundles once in the signed app Resources directory") +expect(runScript.contains("prepare_pi_runtime.sh") + && runScript.contains("PiRuntime/bin/pi") + && runScript.contains("binary.sha256") + && runScript.contains("codesign --verify --deep --strict \"$APP_BUNDLE\""), "packaging embeds and integrity-checks the signed PI runtime inside the app") expect(runScript.contains("kCGWindowOwnerName") && runScript.contains("\"$APP_DISPLAY_NAME\""), "run script verifies the visible app window by owner name") expect(runScript.contains("let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber") && runScript.contains("let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0"), "run script tolerates missing onscreen metadata when the window is otherwise capturable") expect(!runScript.contains("pid=\"$(pgrep -x \"$PRODUCT_NAME\""), "run script window verification does not depend on pgrep") -expect(runScript.contains("visual_verify_window") && runScript.contains("--visual-verify") && runScript.contains("visual_non_black_ratio") && runScript.contains("visual verify failed: captured window is black or empty") && runScript.contains("nonBlackRatio < 0.02"), "run script exposes an explicit visual non-black window check") +expect(runScript.contains("visual_verify_window") && runScript.contains("--visual-verify") && runScript.contains("visual_non_black_ratio") && runScript.contains("visual_black_ratio") && runScript.contains("blackRatio > 0.12") && runScript.contains("nonBlackRatio < 0.02"), "run script rejects empty captures and black rendering blocks") expect(runScript.contains("weibei-visual-verify-latest.png") && runScript.contains("cp \"$capture_path\" \"$latest_capture_path\""), "visual verification leaves one latest screenshot path for review") expect(runScript.contains("weibei-visual-verify-$VERIFY_SCENARIO.png") && runScript.contains("visual_capture_path=$scenario_capture_path"), "visual verification preserves a separate screenshot for every empty-workspace theme and width scenario") @@ -221,24 +232,30 @@ expect(runScript.contains("RUN_VISUAL_VERIFY=false") && runScript.contains("if [[ \"${2:-}\" == \"--visual-verify\"") && runScript.contains("finish_verify_window()") && runScript.contains("if [[ \"$RUN_VISUAL_VERIFY\" == true ]]; then\n visual_verify_window") - && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiWebEditorCheck"), "run script verify mode includes Web editor checks and honors --verify --visual-verify") + && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiWebEditorCheck") + && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiPiCheck"), "run script verify mode includes Web editor and PI checks and honors --verify --visual-verify") expect(runScript.contains("open_app_for_verify()") && runScript.contains("VERIFY_DATA_DIR=\"$DIST_DIR/Data\"") && runScript.contains("VERIFY_SCENARIO=\"${WEIBEI_VERIFY_SCENARIO:-offline-learning-flow}\"") && runScript.contains("VERIFY_WINDOW_SIZE=\"${WEIBEI_VERIFY_WINDOW_SIZE:-}\"") && runScript.contains("VERIFY_INSPIRATION_ID=\"${WEIBEI_VERIFY_INSPIRATION_ID:-}\"") && runScript.contains("rm -rf \"$VERIFY_DATA_DIR\"") - && runScript.contains("--env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env \"WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR\" --env \"WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO\"") + && runScript.contains("local agent_environment=(--env WEIBEI_FORCE_OFFLINE_AGENT=1)") + && runScript.contains("if [[ \"$VERIFY_SCENARIO\" == \"pi-learning-flow\" ]]") + && runScript.contains("--env WEIBEI_SUPPRESS_ACTIVATION=1 \"${agent_environment[@]}\" --env \"WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR\" --env \"WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO\"") && runScript.contains("--env \"WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE\"") && runScript.contains("if [[ -n \"$VERIFY_SCENARIO\" ]]; then\n sleep 2.6\n fi") && runScript.contains("--verify|verify)\n run_verifiers\n open_app_for_verify") - && runScript.contains("--visual-verify|visual-verify)\n run_verifiers\n open_app_for_verify"), "verify modes launch the app in the background with an isolated offline learning-flow workspace") + && runScript.contains("--visual-verify|visual-verify)\n run_verifiers\n open_app_for_verify"), "verify modes launch the app in the background with an isolated offline or PI-backed learning-flow workspace") expect(runScript.contains("verify_learning_flow_persistence()") && runScript.contains("workspace.json") && runScript.contains("## 整理建议") && runScript.contains("把可确认依据写入笔记") && runScript.contains("! /usr/bin/grep -q \"## 离线草稿\"") && runScript.contains("! /usr/bin/grep -q \"## 可确认\""), "verify mode checks that the offline learning flow persists only the note-ready agent suggestion into the note workspace") +expect(runScript.contains("pi-agent-verified.txt") + && runScript.contains("packaged PI did not complete the in-app learning flow") + && workspaceStoreSource.contains("scenario == \"pi-learning-flow\", messages.last?.backend == .pi"), "verify mode can prove the packaged app itself completed a real PI-backed learning flow") expect(runScript.contains("verify_empty_workspace_state()") && runScript.contains("empty-workspace-open-doc") && runScript.contains("empty-workspace-open-chat") @@ -854,7 +871,7 @@ expect(emptyWorkspaceSource.contains("if store.showDailyInspiration") && emptyWorkspaceSource.contains("forcedID = \"lanting-universe\"") && emptyWorkspaceSource.contains("Link(inspiration.sourceLabel") && emptyWorkspaceSource.contains("Link(inspiration.rightsLabel") - && emptyWorkspaceSource.contains("Bundle.module.url(forResource:") + && emptyWorkspaceSource.contains("WeiBeiResources.bundle.url(forResource:") && !emptyWorkspaceSource.contains("URLSession") && !inspirationCatalogSource.contains("URLSession"), "daily inspiration is bundled for offline use while retaining visible source and rights links") expect(emptyWorkspaceSource.contains("empty-workspace-entry-doc") @@ -908,7 +925,7 @@ expect(themeSource.contains("static let appearance = Animation.easeInOut(duratio expect(themeSource.contains("tertiaryInk.opacity(0.58)") && themeSource.contains("tertiaryInk.opacity(0.60)"), "disabled button text remains legible on light paper surfaces") expect(themeSource.contains("englishDisplayFontName = \"WeiBeiStele-Regular\"") && themeSource.contains("englishMonoFontName = \"WeiBeiSteleMono-Regular\"") - && themeSource.contains("Bundle.module.url(forResource: name, withExtension: \"ttf\")\n ?? Bundle.module.url(forResource: name, withExtension: \"ttf\", subdirectory: \"Fonts\")") + && themeSource.contains("WeiBeiResources.bundle.url(forResource: name, withExtension: \"ttf\")\n ?? WeiBeiResources.bundle.url(forResource: name, withExtension: \"ttf\", subdirectory: \"Fonts\")") && themeSource.contains("case .english:\n registerBundledFonts()\n return .custom(englishDisplayFontName, size: size).weight(weight)") && themeSource.contains("static func englishBrandFont(size: CGFloat, weight: Font.Weight = .semibold) -> Font {\n registerBundledFonts()") && themeSource.contains("case .english:\n registerBundledFonts()\n return .custom(englishMonoFontName, size: size)") @@ -1188,7 +1205,9 @@ expect(commandPaletteSource.contains("if store.canCopyReference") && commandPaletteSource.contains("PaletteCommand(title: store.ui(\"打开资料内搜索\""), "command palette names copy-reference by the actual current target") expect(appSource.contains("Button(store.copyReferenceActionTitle) { store.copyCurrentReference() }") && contentViewSource.contains("topIconButton(\"quote.opening\", help: store.copyReferenceActionTitle)"), "top bar and app menu share the same copy-reference wording") -expect(commandPaletteSource.contains("private var canSendAgentDraft: Bool") && commandPaletteSource.contains("PaletteCommand(title: store.sendAgentActionTitle"), "command palette hides the agent send command until a draft exists") +expect(commandPaletteSource.contains("private var canControlAgent: Bool") + && commandPaletteSource.contains("store.isAskingAgent || !store.agentDraft.trimmingCharacters") + && commandPaletteSource.contains("store.isAskingAgent ? store.cancelAgentRequest() : store.askAgent()"), "command palette switches the send command to stop while the agent is running") expect(commandPaletteSource.contains("if store.canApplyAgentAnswer") && commandPaletteSource.contains("if store.canReplaceNoteSelection") && commandPaletteSource.contains("PaletteCommand(title: store.ui(\"替换笔记选区\""), "command palette hides agent answer actions until they can work") if let selectionCommandStart = commandPaletteSource.range(of: "PaletteCommand(title: store.ui(\"问当前选区\"")?.lowerBound, let selectionCommandEnd = commandPaletteSource[selectionCommandStart...].range(of: "\n })")?.upperBound { @@ -1593,7 +1612,9 @@ expect(appSource.contains("applyVerificationWindowSize(to: window)") expect(appSource.contains("window.isOpaque = true"), "main window declares opaque paper backing for stable capture") expect(appSource.contains("environment[\"WEIBEI_VERIFY_CAPTURE_PATH\"]") && appSource.contains("bitmapImageRepForCachingDisplay") - && appSource.contains("cacheDisplay(in: bounds, to: bitmap)"), "isolated verification app can capture its own rendered content without Screen Recording permission") + && appSource.contains("cacheDisplay(in: bounds, to: bitmap)") + && appSource.contains("waitForVerificationCompletion") + && appSource.contains("stages.split(separator: \"\\n\").contains(\"completed\")"), "isolated verification app captures the completed PI flow without Screen Recording permission") expect(appSource.contains("sharedWorkspaceStore"), "main window and settings share one workspace store") expect(!appSource.contains("launchProbe"), "app launch path has no temporary probe logging") expect(appSource.contains("WeiBeiAppearanceTransition") @@ -1748,7 +1769,10 @@ expect(workspaceStoreSource.contains("var canCopyReference: Bool") && workspaceStoreSource.contains("if hasSelectedMaterial { return ui(\"复制资料引用\"") && workspaceStoreSource.contains("guard canCopyReference else { return false }") && workspaceStoreSource.contains("guard hasSelectedMaterial else { return false }"), "app shortcuts and menus name copy-reference by the actual current target") -expect(workspaceStoreSource.contains("selectAdjacentItem(step: -1)") && workspaceStoreSource.contains("Task { await askAgent() }"), "app shortcut handler covers navigation and agent send") +expect(workspaceStoreSource.contains("selectAdjacentItem(step: -1)") + && workspaceStoreSource.contains("if isAskingAgent {\n cancelAgentRequest()") + && workspaceStoreSource.contains("guard !agentDraft.trimmingCharacters") + && workspaceStoreSource.contains("askAgent()"), "app shortcut handler covers navigation plus agent send and stop") expect(workspaceStoreSource.contains("return allItems.filter { itemMatchesLibrarySearch($0, query: query) }") && workspaceStoreSource.contains("return materialItems.filter { itemMatchesLibrarySearch($0, query: query) }") && workspaceStoreSource.contains("func displayTags(for item: StudyItem, limit: Int = 3) -> [String]") @@ -1772,7 +1796,8 @@ expect(workspaceStoreSource.contains("@Published var readerPageIndex = 0") && workspaceStoreSource.contains("func recordReaderPageNavigationPoint()") && workspaceStoreSource.contains("readerPageIndex: readerPageIndex") && workspaceStoreSource.contains("readerTargetPageIndex = selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil"), "workspace navigation snapshots restore PDF page position instead of only restoring the selected document") -expect(workspaceStoreSource.contains("case \"return\":\n guard !isAskingAgent && !agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return false }\n Task { await askAgent() }"), "app shortcut does not swallow command-return when there is no sendable agent draft") +expect(workspaceStoreSource.contains("case \"return\":\n if isAskingAgent") + && workspaceStoreSource.contains("guard !agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return false }"), "app shortcut stops a running answer but does not swallow command-return when idle with no draft") expect(workspaceStoreSource.contains("showQuietInsight = agentSurface == .quietInsight") && !workspaceStoreSource.contains("agentSurface = .quietInsight\n showQuietInsight = true"), "immersive reading preserves the chosen agent surface") expect(workspaceStoreSource.contains("@Published var activeNotebookItemID") && workspaceStoreSource.contains("var activeNoteItem: StudyItem?") @@ -1803,7 +1828,7 @@ expect(workspaceStoreSource.contains("let sampleItems: [StudyItem] = WorkspaceSt && workspaceStoreSource.contains("if scenario == \"notebook-creation-flow\" {\n layout = .immersiveWriting") && workspaceStoreSource.contains("showLibrary = scenario != \"immersive-conversation-flow\"") && workspaceStoreSource.contains("updateSelection(\n ui(\"利率是资金使用价格的表达。\"") - && workspaceStoreSource.contains("await askAgent()") + && workspaceStoreSource.contains("await askAgentAndWait()") && workspaceStoreSource.contains("applyLastAgentAnswerToNote()") && workspaceStoreSource.contains("WEIBEI_FORCE_OFFLINE_AGENT") && workspaceStoreSource.contains("private static func workspaceRootDirectory() -> URL?") @@ -1952,7 +1977,8 @@ expect(workspaceStoreSource.contains("materialTitle: currentReferenceTitle"), "a expect(workspaceStoreSource.contains("private var quietInsightReferenceTitle: String") && workspaceStoreSource.contains("selectionContext?.ownerTitle ?? (hasSelectedMaterial ? currentReferenceTitle : activeNoteItem.map(displayTitle)) ?? ui(\"当前笔记\"") && workspaceStoreSource.contains("没有证据就说\\(evidenceText)"), "quiet insight uses real selection, current reader location, or note source wording") -expect(workspaceStoreSource.contains("private func clearUnpinnedFloatingSelection(keepContext: Bool = true)") +expect(workspaceStoreSource.contains("private func clearUnpinnedFloatingSelection(keepContext: Bool = true, invalidatesAgentContext: Bool = true)") + && workspaceStoreSource.contains("if invalidatesAgentContext, selectionContext != nil") && workspaceStoreSource.contains("selectionContext = nil") && workspaceStoreSource.contains("selectionAnchor = nil") && workspaceStoreSource.contains("floatingSelectionPrompt = ui(\"当前选区\"") @@ -2053,10 +2079,9 @@ expect(!workspaceStoreSource.contains("selectedItem?.title ?? \"当前材料\"") && !workspaceStoreSource.contains("Agent 请求失败:") && workspaceStoreSource.contains("请求失败:\\(error.localizedDescription)") && !workspaceStoreSource.contains("Agent 设置") - && workspaceStoreSource.contains("未配置密钥。当前用离线模式生成草稿") - && workspaceStoreSource.contains("AgentOfflineTurn.messages(") - && workspaceStoreSource.contains("offlineAgentInput(") - && workspaceStoreSource.contains("AgentOfflinePreviewInput(") + && workspaceStoreSource.contains("PI 与在线密钥均不可用,当前使用离线草稿。") + && workspaceStoreSource.contains("OfflineStudyAgentRuntime().respond") + && workspaceStoreSource.contains("PiAgentRuntime") && workspaceStoreSource.contains("messages.append(AgentMessage(role: .user, text: question, source: sourceTitle))") && !workspaceStoreSource.contains("未配置 OPENAI_API_KEY 或钥匙串密钥") && workspaceStoreSource.contains("正在使用本机环境密钥。") @@ -2068,26 +2093,30 @@ expect(!workspaceStoreSource.contains("selectedItem?.title ?? \"当前材料\"") && !workspaceStoreSource.contains("已清除钥匙串密钥。") && !workspaceStoreSource.contains("已保存到 macOS 钥匙串。") && !workspaceStoreSource.contains("已选择材料、当前选区和右侧笔记"), "agent context and setup notices avoid fake material fallback copy and visible internal agent labels") -if let askAgentStart = workspaceStoreSource.range(of: "func askAgent() async")?.lowerBound, - let offlineInputStart = workspaceStoreSource.range(of: "private func offlineAgentInput")?.lowerBound { - let askAgentSource = String(workspaceStoreSource[askAgentStart..<offlineInputStart]) - let credentialRange = askAgentSource.range(of: "guard let credential = resolvedOpenAIAPIKey()")! - expect(askAgentSource.range(of: "agentDraft = \"\"") != nil - && askAgentSource.range(of: "selectionAttachments = []") != nil - && askAgentSource.range(of: "let shouldClearSentDocumentSelection = sentSelectionText != nil && selectionContext?.source == .document") != nil - && askAgentSource.range(of: "clearUnpinnedFloatingSelection(keepContext: false)") != nil - && askAgentSource.range(of: "messages.append(contentsOf: AgentOfflineTurn.messages(") != nil - && askAgentSource.range(of: "messages.append(AgentMessage(role: .user, text: question, source: sourceTitle))") != nil - && askAgentSource.range(of: "let shouldClearSentDocumentSelection")!.lowerBound > askAgentSource.range(of: "let sentSelectionText = agentSelectionText")!.lowerBound - && askAgentSource.range(of: "agentDraft = \"\"")!.lowerBound < credentialRange.lowerBound - && askAgentSource.range(of: "selectionAttachments = []")!.lowerBound < credentialRange.lowerBound - && askAgentSource.range(of: "clearUnpinnedFloatingSelection(keepContext: false)")!.lowerBound < credentialRange.lowerBound - && askAgentSource.range(of: "messages.append(contentsOf: AgentOfflineTurn.messages(")!.lowerBound > credentialRange.lowerBound - && askAgentSource.range(of: "messages.append(AgentMessage(role: .user, text: question, source: sourceTitle))")!.lowerBound > credentialRange.lowerBound, - "agent send clears the composer before key validation and uses the offline turn helper when no API key exists") +if let requestStart = workspaceStoreSource.range(of: "private func performAgentRequest() async")?.lowerBound, + let executionStart = workspaceStoreSource.range(of: "private func executeStudyAgentRequest")?.lowerBound { + let requestSource = String(workspaceStoreSource[requestStart..<executionStart]) + expect(requestSource.contains("agentDraft = \"\"") + && requestSource.contains("flushStagedNoteDraftForAgentContext()") + && requestSource.contains("selectionAttachments = []") + && requestSource.contains("let shouldClearSentDocumentSelection = sentSelectionText != nil && selectionContext?.source == .document") + && requestSource.contains("clearUnpinnedFloatingSelection(keepContext: false, invalidatesAgentContext: false)") + && requestSource.contains("messages.append(AgentMessage(role: .user, text: question, source: sourceTitle))") + && requestSource.contains("let reply = try await executeStudyAgentRequest(request)") + && requestSource.contains("requestWorkspaceRevision == agentContextRevision") + && requestSource.contains("lastAgentReplyContextRevision = requestWorkspaceRevision") + && requestSource.contains("contextRevision: \"\\(requestWorkspaceRevision):\\(requestID.uuidString.lowercased())\""), + "agent send clears the composer, executes the unified runtime, and accepts only the current context revision") } else { - expect(false, "askAgent source is readable") + expect(false, "unified agent request source is readable") } +expect(workspaceStoreSource.contains("func stageNoteDraft(_ value: String, for itemID: String?)") + && workspaceStoreSource.contains("if stagedNoteDraft?.itemID != itemID || stagedNoteDraft?.value != value {\n invalidateAgentContext()") + && workspaceStoreSource.contains("private func flushStagedNoteDraftForAgentContext()") + && notesAgentSource.contains("store.stageNoteDraft(value, for: draftNoteItemID)"), "agent requests flush the current local note-editor draft before snapshotting context") +expect(workspaceStoreSource.contains("func updateReaderLocationTitle(_ title: String?)") + && workspaceStoreSource.contains("guard readerLocationTitle != nextTitle else { return }\n invalidateAgentContext()") + && workspaceStoreSource.contains("guard readerPageIndex != nextIndex else { return }\n invalidateAgentContext()"), "reader heading and page changes invalidate stale agent answers") expect(workspaceStoreSource.contains("var agentPromptScope") && workspaceStoreSource.contains("var selectionPromptScope") && !workspaceStoreSource.contains("var libraryOrganizationScope"), "agent prompt builders avoid half-built library organization context") expect(!workspaceStoreSource.contains("请根据当前文档和当前笔记") && !workspaceStoreSource.contains("请根据当前材料和当前笔记") && !workspaceStoreSource.contains("结合当前文档和笔记"), "agent draft presets do not hardcode fake material context") expect(workspaceStoreSource.contains("正在静默阅读当前材料和笔记。") @@ -2099,8 +2128,9 @@ expect(workspaceStoreSource.contains("private func noteBlockForAgentAnswer") && workspaceStoreSource.contains("AgentOfflinePreview.suggestedNoteBlock(from: text, language: interfaceLanguage)") && workspaceStoreSource.contains("guard !text.hasPrefix(\"#\") else { return text }") && workspaceStoreSource.contains("return \"## \\(ui(\"整理建议\", \"Organization suggestion\"))\\n\\(text)\"") - && workspaceStoreSource.contains("markdown: \"\\n\\(noteBlockForAgentAnswer(answer.text))\"") - && !workspaceStoreSource.contains("## Agent 整理建议"), "agent note writeback uses a note-ready offline section before falling back to a plain reader-facing suggestion heading") + && workspaceStoreSource.contains("let content = latestAgentNoteProposal?.markdown ?? answer.text") + && workspaceStoreSource.contains("markdown: \"\\n\\(noteBlockForAgentAnswer(content))\"") + && !workspaceStoreSource.contains("## Agent 整理建议"), "agent note writeback prefers a revision-matched PI proposal before falling back to a reader-facing answer section") expect(workspaceStoreSource.contains("func createBlankNotebookNote()") && workspaceStoreSource.contains("func createNotebookNoteFromCurrentMaterial()") && workspaceStoreSource.contains("func promptCreateBlankNotebookNote()") @@ -2123,7 +2153,7 @@ expect(workspaceStoreSource.contains("func cancelNotebookNoteCreation()") && workspaceStoreSource.contains("func confirmNotebookNoteCreation()") && workspaceStoreSource.contains("notebookCreationDraft = NotebookCreationDraft(") && workspaceStoreSource.contains("let title = draft.title.trimmingCharacters") - && workspaceStoreSource.contains("func select(itemID: String?) {\n persistCurrentNote()\n notebookCreationDraft = nil") + && workspaceStoreSource.contains("func select(itemID: String?) {\n invalidateAgentContext()\n persistCurrentNote()\n notebookCreationDraft = nil") && !workspaceStoreSource.contains("private func promptCreateNotebookNote(seed: NotebookNoteSeed)") && !workspaceStoreSource.contains("alert.messageText = seed.isBlank"), "new-note creation opens the inline naming strip and confirms through the shared local markdown creator") expect(workspaceStoreSource.contains("importedItems.append(item)\n activeNotebookItemID = item.id\n noteText = markdown\n revealRichWritingSurface()\n focus(.notes)\n save()"), "new notebook notes open in the note pane without replacing the reader material") @@ -2176,7 +2206,8 @@ expect(appSource.contains("Button(store.ui(\"新建空白笔记\"") && appSource && appSource.contains("Button(store.ui(\"从当前资料开笔记\"") && appSource.contains("animateLayout { store.promptCreateNotebookNoteFromCurrentMaterial() }"), "new-note menu commands use layout motion and expose blank/material paths separately") expect(appSource.contains("Button(store.sendAgentActionTitle)") && workspaceStoreSource.contains("var sendAgentActionTitle: String"), "app send command uses one stable action label") -expect(appSource.contains("if !store.isAskingAgent && !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty") +expect(appSource.contains("if store.isAskingAgent || !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty") + && appSource.contains("store.isAskingAgent ? store.cancelAgentRequest() : store.askAgent()") && appSource.contains(".keyboardShortcut(.return, modifiers: [.command])"), "app menu hides the agent send action until a draft can really send") expect(appSource.contains("Button(store.showLibrary ? store.ui(\"收起课程目录\"") && !appSource.contains("恢复资料") @@ -2319,7 +2350,7 @@ expect(notesAgentSource.contains("func weibeiPaneHeaderChrome(appearanceMode: We && agentPaneHeaderSource.contains("EmptyView()") && !agentPaneHeaderSource.contains("agentToolButton(") && !notesAgentSource.contains("private func agentToolButton") - && notesAgentSource.contains("Button(store.ui(\"写入回答\", \"Write Answer\"") + && notesAgentSource.contains("Button(store.agentWriteActionTitle)") && notesAgentSource.contains("Button(store.ui(\"替换\", \"Replace\"") && !notesAgentSource.contains(".labelStyle(.titleAndIcon)\n }\n .buttonStyle(WeiBeiTextActionButtonStyle())") && notePaneHeaderSource.contains(".background(WeiBeiTheme.paper)") @@ -2790,19 +2821,20 @@ expect(notesAgentSource.contains("WeiBeiTheme.ink.opacity(0.42), WeiBeiTheme.ink && !notesAgentSource.contains(".black.opacity(0.72), .black"), "agent input tray fade mask uses semantic ink instead of a fixed black ramp") expect(notesAgentSource.contains("lineLimit: 1...6") && notesAgentSource.contains(".fixedSize(horizontal: false, vertical: true)") - && notesAgentSource.contains(".padding(.trailing, canSend ? trailingPadding : 0)") + && notesAgentSource.contains(".padding(.trailing, showsControl ? trailingPadding : 0)") && notesAgentSource.contains(".frame(minHeight: 56, alignment: .bottom)") && notesAgentSource.contains(".weibeiInputSurface(active: focused.wrappedValue, height: height, horizontalPadding: horizontalPadding)") && notesAgentSource.contains("height: 56") && notesAgentSource.contains("horizontalPadding: 14") && notesAgentSource.contains("prompt: agentPrompt") - && notesAgentSource.contains("WeiBeiIconButtonStyle(size: sendButtonSize, prominence: .primary)") + && notesAgentSource.contains("WeiBeiIconButtonStyle(size: sendButtonSize, prominence: store.isAskingAgent ? .neutral : .primary)") && notesAgentSource.contains("sendButtonSize: 30") && notesAgentSource.contains("sendTrailing: 10") && notesAgentSource.contains("sendBottom: 10"), "main agent input grows upward like a real chat composer and keeps send visually inside the field edge") -expect(notesAgentSource.contains("Image(systemName: \"paperplane.fill\")") +expect(notesAgentSource.contains("Image(systemName: store.isAskingAgent ? \"stop.fill\" : \"paperplane.fill\")") + && notesAgentSource.contains("store.isAskingAgent ? store.cancelAgentRequest() : submit()") && !notesAgentSource.contains("Image(systemName: \"arrow.up\")") - && !notesAgentSource.contains("AgentComposerSendButtonStyle"), "main agent send affordance stays the cinnabar paper-plane control while sitting inside the composer edge") + && !notesAgentSource.contains("AgentComposerSendButtonStyle"), "main agent composer switches between the paper-plane send control and a stop control") expect(!notesAgentSource.contains("RoundedRectangle(cornerRadius: 9)") && !notesAgentSource.contains(".stroke(draftFocused ? WeiBeiTheme.link.opacity(0.16) : WeiBeiTheme.hairline.opacity(0.34), lineWidth: 1)") && !notesAgentSource.contains("WeiBeiTheme.paperRaised.opacity(0.46)"), "agent input tray avoids a heavy nested form border") diff --git a/Vendor/PiRuntime/LICENSE b/Vendor/PiRuntime/LICENSE new file mode 100644 index 000000000..4864295e1 --- /dev/null +++ b/Vendor/PiRuntime/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Mario Zechner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Vendor/PiRuntime/README.md b/Vendor/PiRuntime/README.md new file mode 100644 index 000000000..f45925c6c --- /dev/null +++ b/Vendor/PiRuntime/README.md @@ -0,0 +1,22 @@ +# WeiBei embedded Pi runtime + +WeiBei owns the runtime boundary. The app package contains a pinned standalone Pi +executable and starts only that copy. It never searches the user's PATH, Node, +NVM, Bun, or global Pi installation. + +`manifest.json` is the source of truth for the Pi version, source commit, release +artifacts, and archive digests. `script/prepare_pi_runtime.sh` downloads the +matching macOS artifact, verifies SHA-256 before extraction, and keeps only the +files needed by WeiBei RPC mode. + +WeiBei-specific behavior is deliberately outside the upstream CLI surface: + +- Swift owns current material, selection, notes, cancellation, fallback, and write-back. +- `AgentResources/extension.ts` owns the two allowlisted tools and guard hooks. +- `AgentResources/skills/` owns the three study workflows. +- Pi runs without built-in tools, sessions, global extensions, or global skills. + +To maintain a deeper Pi fork, publish a standalone artifact from the fork, update +the repository, commit, version, filenames, and digests in `manifest.json`, then +run the same self-contained package and live-evaluation checks. The Swift/RPC +contract does not need to change unless the fork intentionally changes protocol. diff --git a/Vendor/PiRuntime/THIRD_PARTY_NOTICES.md b/Vendor/PiRuntime/THIRD_PARTY_NOTICES.md new file mode 100644 index 000000000..fde236f59 --- /dev/null +++ b/Vendor/PiRuntime/THIRD_PARTY_NOTICES.md @@ -0,0 +1,15 @@ +# Third-party notices + +WeiBei embeds the standalone macOS build of Pi coding agent 0.80.2. + +- Project: Pi coding agent +- Source: https://github.com/earendil-works/pi +- Pinned commit: 0201806adfa825ab3d7957a4267d46e5030fd357 +- License: MIT +- Copyright: 2025 Mario Zechner + +The standalone executable is produced with Bun and includes transitive open-source +dependencies from the pinned Pi source tree. Their package names, versions, and +license declarations are recorded by the source lockfiles at the pinned commit. +Before a notarized public distribution, regenerate and review the complete +dependency-license report from that exact source revision. diff --git a/Vendor/PiRuntime/manifest.json b/Vendor/PiRuntime/manifest.json new file mode 100644 index 000000000..4cec4d6c9 --- /dev/null +++ b/Vendor/PiRuntime/manifest.json @@ -0,0 +1,17 @@ +{ + "schemaVersion": 1, + "piVersion": "0.80.2", + "sourceRepository": "https://github.com/earendil-works/pi", + "sourceCommit": "0201806adfa825ab3d7957a4267d46e5030fd357", + "license": "MIT", + "artifacts": { + "darwin-arm64": { + "archive": "pi-darwin-arm64.tar.gz", + "sha256": "c7d125bbdebd863fa76d92274458ba0eb405e5cde39db34db1f49f767ed9f1dd" + }, + "darwin-x64": { + "archive": "pi-darwin-x64.tar.gz", + "sha256": "d4b6b62a0c34c0f2e4cb16ee6fd4f0086b86ad70e0488fd3daa9231216d84e2b" + } + } +} diff --git a/script/build_and_run.sh b/script/build_and_run.sh index d1aa9827d..816eaa76d 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -42,6 +42,7 @@ fi APP_BUNDLE="$DIST_DIR/$APP_DISPLAY_NAME.app" APP_CONTENTS="$APP_BUNDLE/Contents" APP_MACOS="$APP_CONTENTS/MacOS" +APP_RESOURCES="$APP_CONTENTS/Resources" APP_BINARY="$APP_MACOS/$PRODUCT_NAME" INFO_PLIST="$APP_CONTENTS/Info.plist" VERIFY_PID="" @@ -72,21 +73,48 @@ if [[ -d "$ROOT_DIR/node_modules" ]]; then npm run build:editor >/dev/null fi +PI_RUNTIME_DIR="$("$ROOT_DIR/script/prepare_pi_runtime.sh")" +PI_RUNTIME_BINARY="$PI_RUNTIME_DIR/bin/pi" +PI_RUNTIME_VERSION="$(/usr/bin/plutil -extract piVersion raw -o - "$PI_RUNTIME_DIR/manifest.json")" +if [[ ! -x "$PI_RUNTIME_BINARY" ]]; then + echo "build failed: embedded PI runtime was not prepared" >&2 + exit 8 +fi + swift build -c "$BUILD_CONFIGURATION" if [[ "$CHECK_ONLY" != true ]]; then BUILD_DIR="$(swift build -c "$BUILD_CONFIGURATION" --show-bin-path)" BUILD_BINARY="$BUILD_DIR/$PRODUCT_NAME" - RESOURCE_BUNDLE="$BUILD_DIR/${PRODUCT_NAME}_${PRODUCT_NAME}.bundle" + RESOURCE_BUNDLES=( + "$BUILD_DIR/${PRODUCT_NAME}_${PRODUCT_NAME}.bundle" + "$BUILD_DIR/${PRODUCT_NAME}_WeiBeiCore.bundle" + ) rm -rf "$APP_BUNDLE" - mkdir -p "$APP_MACOS" + mkdir -p "$APP_MACOS" "$APP_RESOURCES" cp "$BUILD_BINARY" "$APP_BINARY" chmod +x "$APP_BINARY" - if [[ -d "$RESOURCE_BUNDLE" ]]; then - cp -R "$RESOURCE_BUNDLE" "$APP_BUNDLE/" - mkdir -p "$APP_CONTENTS/Resources" - cp -R "$RESOURCE_BUNDLE" "$APP_CONTENTS/Resources/" + for resource_bundle in "${RESOURCE_BUNDLES[@]}"; do + if [[ ! -d "$resource_bundle" ]]; then + echo "package failed: missing resource bundle $resource_bundle" >&2 + exit 7 + fi + cp -R "$resource_bundle" "$APP_RESOURCES/" + done + cp -R "$PI_RUNTIME_DIR" "$APP_RESOURCES/PiRuntime" + + PACKAGED_PI="$APP_RESOURCES/PiRuntime/bin/pi" + if [[ ! -x "$PACKAGED_PI" ]] \ + || [[ ! -f "$APP_RESOURCES/PiRuntime/manifest.json" ]] \ + || [[ ! -f "$APP_RESOURCES/PiRuntime/LICENSE" ]] \ + || [[ ! -f "$APP_RESOURCES/PiRuntime/THIRD_PARTY_NOTICES.md" ]] \ + || [[ ! -f "$APP_RESOURCES/PiRuntime/binary.sha256" ]] \ + || ! /usr/bin/codesign --verify --strict "$PACKAGED_PI" >/dev/null 2>&1 \ + || [[ "$(/usr/bin/shasum -a 256 "$PACKAGED_PI" | /usr/bin/awk '{print $1}')" != "$(<"$APP_RESOURCES/PiRuntime/binary.sha256")" ]] \ + || [[ "$("$PACKAGED_PI" --version 2>/dev/null)" != "$PI_RUNTIME_VERSION" ]]; then + echo "package failed: embedded PI runtime is incomplete" >&2 + exit 9 fi cat >"$INFO_PLIST" <<PLIST @@ -111,6 +139,10 @@ if [[ "$CHECK_ONLY" != true ]]; then </dict> </plist> PLIST + /usr/bin/codesign --force --sign - --timestamp=none "$APP_BUNDLE" >/dev/null + /usr/bin/codesign --verify --deep --strict "$APP_BUNDLE" + WEIBEI_PI_EXECUTABLE="$PACKAGED_PI" WEIBEI_PI_APP_BUNDLE="$APP_BUNDLE" WEIBEI_PI_LIVE_CHECK=0 \ + "$BUILD_DIR/WeiBeiPiCheck" fi open_app() { @@ -125,11 +157,19 @@ cleanup_verify_app() { open_app_for_verify() { local before_pids + local agent_environment=(--env WEIBEI_FORCE_OFFLINE_AGENT=1) + if [[ "$VERIFY_SCENARIO" == "pi-learning-flow" ]]; then + agent_environment=( + --env WEIBEI_FORCE_OFFLINE_AGENT=0 + --env WEIBEI_PI_PROVIDER=openai-codex + --env WEIBEI_PI_MODEL=gpt-5.5 + ) + fi before_pids="$(pgrep -x "$PRODUCT_NAME" || true)" rm -rf "$VERIFY_DATA_DIR" mkdir -p "$VERIFY_DATA_DIR" rm -f "$VERIFY_CAPTURE_PATH" - /usr/bin/open -n -g --env WEIBEI_SUPPRESS_ACTIVATION=1 --env WEIBEI_FORCE_OFFLINE_AGENT=1 --env "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" --env "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" --env "WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE" --env "WEIBEI_VERIFY_INSPIRATION_ID=$VERIFY_INSPIRATION_ID" --env "WEIBEI_VERIFY_CAPTURE_PATH=$VERIFY_CAPTURE_PATH" "$APP_BUNDLE" + /usr/bin/open -n -g --env WEIBEI_SUPPRESS_ACTIVATION=1 "${agent_environment[@]}" --env "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" --env "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" --env "WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE" --env "WEIBEI_VERIFY_INSPIRATION_ID=$VERIFY_INSPIRATION_ID" --env "WEIBEI_VERIFY_CAPTURE_PATH=$VERIFY_CAPTURE_PATH" "$APP_BUNDLE" for _ in {1..50}; do local newest_pid newest_pid="$(pgrep -nx "$PRODUCT_NAME" || true)" @@ -166,7 +206,7 @@ visual_verify_window() { fi rm -f "$capture_error" fi - swift -target arm64-apple-macosx14.0 -e 'import AppKit; import Foundation; let path = CommandLine.arguments[1]; guard let image = NSImage(contentsOf: URL(fileURLWithPath: path)), let data = image.tiffRepresentation, let bitmap = NSBitmapImageRep(data: data) else { exit(2) }; let xStep = max(1, bitmap.pixelsWide / 80); let yStep = max(1, bitmap.pixelsHigh / 60); var sampled = 0; var visible = 0; for y in stride(from: 0, to: bitmap.pixelsHigh, by: yStep) { for x in stride(from: 0, to: bitmap.pixelsWide, by: xStep) { guard let color = bitmap.colorAt(x: x, y: y) else { continue }; if color.redComponent > 0.08 || color.greenComponent > 0.08 || color.blueComponent > 0.08 { visible += 1 }; sampled += 1 } }; guard sampled > 0 else { exit(3) }; let nonBlackRatio = Double(visible) / Double(sampled); print("visual_non_black_ratio=\(nonBlackRatio)"); if nonBlackRatio < 0.02 { fputs("visual verify failed: captured window is black or empty\n", stderr); exit(4) }' "$capture_path" + swift -target arm64-apple-macosx14.0 -e 'import AppKit; import Foundation; let path = CommandLine.arguments[1]; guard let image = NSImage(contentsOf: URL(fileURLWithPath: path)), let data = image.tiffRepresentation, let bitmap = NSBitmapImageRep(data: data) else { exit(2) }; let xStep = max(1, bitmap.pixelsWide / 80); let yStep = max(1, bitmap.pixelsHigh / 60); var sampled = 0; var visible = 0; var black = 0; for y in stride(from: 0, to: bitmap.pixelsHigh, by: yStep) { for x in stride(from: 0, to: bitmap.pixelsWide, by: xStep) { guard let color = bitmap.colorAt(x: x, y: y) else { continue }; if color.redComponent > 0.08 || color.greenComponent > 0.08 || color.blueComponent > 0.08 { visible += 1 }; if color.redComponent < 0.035 && color.greenComponent < 0.035 && color.blueComponent < 0.035 { black += 1 }; sampled += 1 } }; guard sampled > 0 else { exit(3) }; let nonBlackRatio = Double(visible) / Double(sampled); let blackRatio = Double(black) / Double(sampled); print("visual_non_black_ratio=\(nonBlackRatio)"); print("visual_black_ratio=\(blackRatio)"); if nonBlackRatio < 0.02 || blackRatio > 0.12 { fputs("visual verify failed: captured window is empty or contains black rendering blocks\n", stderr); exit(4) }' "$capture_path" local latest_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-latest.png" local scenario_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$VERIFY_SCENARIO.png" cp "$capture_path" "$latest_capture_path" @@ -176,6 +216,26 @@ visual_verify_window() { } verify_learning_flow_persistence() { + if [[ "$VERIFY_SCENARIO" == "pi-learning-flow" ]]; then + local workspace_file="$VERIFY_DATA_DIR/workspace.json" + local marker_file="$VERIFY_DATA_DIR/pi-agent-verified.txt" + for _ in {1..600}; do + if [[ -s "$marker_file" ]] \ + && [[ -f "$workspace_file" ]] \ + && /usr/bin/grep -q "视觉验收笔记" "$workspace_file" \ + && /usr/bin/grep -q "利率" "$workspace_file" \ + && ! /usr/bin/grep -q "## 离线草稿" "$workspace_file"; then + return 0 + fi + sleep 0.2 + done + echo "verify failed: packaged PI did not complete the in-app learning flow." >&2 + if [[ -f "$VERIFY_DATA_DIR/verification-state.txt" ]]; then + cat "$VERIFY_DATA_DIR/verification-state.txt" >&2 + fi + return 1 + fi + case "$VERIFY_SCENARIO" in offline-learning-flow|immersive-conversation-flow) ;; @@ -260,16 +320,19 @@ verify_empty_workspace_state() { } finish_verify_window() { + verify_learning_flow_persistence + verify_empty_workspace_state if [[ "$RUN_VISUAL_VERIFY" == true ]]; then visual_verify_window fi - verify_learning_flow_persistence - verify_empty_workspace_state } run_verifiers() { - swift run -c "$BUILD_CONFIGURATION" WeiBeiSelfCheck + WEIBEI_PI_EXECUTABLE="$PI_RUNTIME_BINARY" \ + swift run -c "$BUILD_CONFIGURATION" WeiBeiSelfCheck swift run -c "$BUILD_CONFIGURATION" WeiBeiWebEditorCheck + WEIBEI_PI_EXECUTABLE="$PI_RUNTIME_BINARY" \ + swift run -c "$BUILD_CONFIGURATION" WeiBeiPiCheck } case "$MODE" in diff --git a/script/prepare_pi_runtime.sh b/script/prepare_pi_runtime.sh new file mode 100755 index 000000000..2b770e5a4 --- /dev/null +++ b/script/prepare_pi_runtime.sh @@ -0,0 +1,135 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +MANIFEST="$ROOT_DIR/Vendor/PiRuntime/manifest.json" +VERSION="$(/usr/bin/plutil -extract piVersion raw -o - "$MANIFEST")" +SOURCE_REPOSITORY="$(/usr/bin/plutil -extract sourceRepository raw -o - "$MANIFEST")" +HOST_ARCH="${WEIBEI_PI_ARCH:-$(uname -m)}" + +case "$HOST_ARCH" in + arm64) + ARTIFACT_KEY="darwin-arm64" + ;; + x86_64) + ARTIFACT_KEY="darwin-x64" + ;; + *) + echo "embedded PI preparation failed: unsupported macOS architecture $HOST_ARCH" >&2 + exit 2 + ;; +esac + +ARCHIVE_NAME="$(/usr/bin/plutil -extract "artifacts.$ARTIFACT_KEY.archive" raw -o - "$MANIFEST")" +EXPECTED_SHA256="$(/usr/bin/plutil -extract "artifacts.$ARTIFACT_KEY.sha256" raw -o - "$MANIFEST")" +CACHE_ROOT="${WEIBEI_PI_CACHE_DIR:-$ROOT_DIR/.build/pi-runtime}" +DOWNLOAD_DIR="$CACHE_ROOT/downloads" +RUNTIME_PARENT="$CACHE_ROOT/$VERSION/$ARTIFACT_KEY" +RUNTIME_DIR="$RUNTIME_PARENT/PiRuntime" +RUNTIME_BINARY="$RUNTIME_DIR/bin/pi" + +runtime_is_ready() { + [[ -x "$RUNTIME_BINARY" ]] \ + && [[ -f "$RUNTIME_DIR/bin/package.json" ]] \ + && [[ -f "$RUNTIME_DIR/bin/theme/dark.json" ]] \ + && [[ -f "$RUNTIME_DIR/bin/theme/light.json" ]] \ + && [[ -f "$RUNTIME_DIR/LICENSE" ]] \ + && [[ -f "$RUNTIME_DIR/THIRD_PARTY_NOTICES.md" ]] \ + && [[ -f "$RUNTIME_DIR/binary.sha256" ]] \ + && cmp -s "$MANIFEST" "$RUNTIME_DIR/manifest.json" \ + && /usr/bin/codesign --verify --strict "$RUNTIME_BINARY" >/dev/null 2>&1 \ + && [[ "$(/usr/bin/shasum -a 256 "$RUNTIME_BINARY" | /usr/bin/awk '{print $1}')" == "$(<"$RUNTIME_DIR/binary.sha256")" ]] \ + && [[ "$("$RUNTIME_BINARY" --version 2>/dev/null)" == "$VERSION" ]] +} + +if runtime_is_ready; then + printf '%s\n' "$RUNTIME_DIR" + exit 0 +fi + +mkdir -p "$DOWNLOAD_DIR" "$RUNTIME_PARENT" +LOCK_DIR="$CACHE_ROOT/.prepare-$ARTIFACT_KEY.lock" +LOCK_ACQUIRED=false +STAGING_DIR="" +cleanup() { + if [[ -n "$STAGING_DIR" ]]; then + rm -rf "$STAGING_DIR" + fi + if [[ "$LOCK_ACQUIRED" == true ]]; then + rm -rf "$LOCK_DIR" + fi +} +trap cleanup EXIT + +for _ in {1..300}; do + if mkdir "$LOCK_DIR" 2>/dev/null; then + LOCK_ACQUIRED=true + printf '%s\n' "$$" >"$LOCK_DIR/pid" + break + fi + LOCK_MODIFIED="$(/usr/bin/stat -f %m "$LOCK_DIR" 2>/dev/null || echo 0)" + if (( $(date +%s) - LOCK_MODIFIED > 600 )); then + rm -rf "$LOCK_DIR" + continue + fi + sleep 0.1 +done +if [[ "$LOCK_ACQUIRED" != true ]]; then + echo "embedded PI preparation failed: timed out waiting for runtime cache lock" >&2 + exit 6 +fi + +if runtime_is_ready; then + printf '%s\n' "$RUNTIME_DIR" + exit 0 +fi + +ARCHIVE_PATH="${WEIBEI_PI_ARCHIVE:-$DOWNLOAD_DIR/$ARCHIVE_NAME}" +if [[ ! -f "$ARCHIVE_PATH" ]]; then + RELEASE_URL="$SOURCE_REPOSITORY/releases/download/v$VERSION/$ARCHIVE_NAME" + echo "downloading embedded PI $VERSION for $HOST_ARCH" >&2 + /usr/bin/curl --fail --location --retry 3 --output "$DOWNLOAD_DIR/$ARCHIVE_NAME.part" "$RELEASE_URL" + mv "$DOWNLOAD_DIR/$ARCHIVE_NAME.part" "$DOWNLOAD_DIR/$ARCHIVE_NAME" + ARCHIVE_PATH="$DOWNLOAD_DIR/$ARCHIVE_NAME" +fi + +ACTUAL_SHA256="$(/usr/bin/shasum -a 256 "$ARCHIVE_PATH" | /usr/bin/awk '{print $1}')" +if [[ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]]; then + echo "embedded PI preparation failed: SHA-256 mismatch for $ARCHIVE_PATH" >&2 + exit 3 +fi + +STAGING_DIR="$RUNTIME_PARENT/.staging-$$" +rm -rf "$STAGING_DIR" +mkdir -p "$STAGING_DIR/extracted" "$STAGING_DIR/PiRuntime/bin" +/usr/bin/tar -xzf "$ARCHIVE_PATH" -C "$STAGING_DIR/extracted" + +SOURCE_DIR="$STAGING_DIR/extracted/pi" +for required in pi package.json theme/dark.json theme/light.json; do + if [[ ! -e "$SOURCE_DIR/$required" ]]; then + echo "embedded PI preparation failed: archive is missing $required" >&2 + exit 4 + fi +done + +cp "$SOURCE_DIR/pi" "$STAGING_DIR/PiRuntime/bin/pi" +cp "$SOURCE_DIR/package.json" "$STAGING_DIR/PiRuntime/bin/package.json" +cp -R "$SOURCE_DIR/theme" "$STAGING_DIR/PiRuntime/bin/theme" +cp "$MANIFEST" "$STAGING_DIR/PiRuntime/manifest.json" +cp "$ROOT_DIR/Vendor/PiRuntime/LICENSE" "$STAGING_DIR/PiRuntime/LICENSE" +cp "$ROOT_DIR/Vendor/PiRuntime/THIRD_PARTY_NOTICES.md" "$STAGING_DIR/PiRuntime/THIRD_PARTY_NOTICES.md" +printf '%s %s\n' "$EXPECTED_SHA256" "$ARCHIVE_NAME" >"$STAGING_DIR/PiRuntime/artifact.sha256" +chmod 755 "$STAGING_DIR/PiRuntime/bin/pi" +/usr/bin/xattr -dr com.apple.quarantine "$STAGING_DIR/PiRuntime" 2>/dev/null || true +/usr/bin/codesign --force --sign - --timestamp=none "$STAGING_DIR/PiRuntime/bin/pi" >/dev/null +/usr/bin/codesign --verify --strict "$STAGING_DIR/PiRuntime/bin/pi" +/usr/bin/shasum -a 256 "$STAGING_DIR/PiRuntime/bin/pi" | /usr/bin/awk '{print $1}' >"$STAGING_DIR/PiRuntime/binary.sha256" + +rm -rf "$RUNTIME_DIR" +mv "$STAGING_DIR/PiRuntime" "$RUNTIME_DIR" +if ! runtime_is_ready; then + echo "embedded PI preparation failed: prepared runtime did not pass validation" >&2 + exit 5 +fi + +printf '%s\n' "$RUNTIME_DIR" From e54d972eb8d52c9220e8357c4a47d0361b973708 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 06:33:26 +0800 Subject: [PATCH 14/36] fix: keep workspace entries fixed during inspiration changes --- Sources/WeiBei/App/WeiBeiApp.swift | 35 ++++++++++--------- .../Views/EmptyWorkspaceLauncherView.swift | 25 +++++++------ Sources/WeiBeiSelfCheck/main.swift | 9 +++-- 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index 11f6ec06b..20312f145 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -638,6 +638,25 @@ struct SettingsView: View { } } + settingsGroup(store.ui("空白页", "Empty Workspace")) { + settingsRow( + title: store.ui("每日灵感", "Daily Inspiration"), + detail: store.ui("关闭后只隐藏语录;文稿、对话和笔记入口始终保留。", "Hides sourced quotations only; document, chat, and notes entries always remain.") + ) { + Toggle( + "", + isOn: Binding( + get: { store.showDailyInspiration }, + set: { store.setDailyInspirationEnabled($0) } + ) + ) + .labelsHidden() + .toggleStyle(.switch) + .tint(WeiBeiTheme.cinnabar) + .accessibilityLabel(Text(store.ui("显示每日灵感", "Show Daily Inspiration"))) + } + } + settingsGroup(store.ui("快速进入", "Jump To")) { settingsRouteRow( title: store.ui("外观与语言", "Appearance & Language"), @@ -721,22 +740,6 @@ struct SettingsView: View { } } - settingsRow( - title: store.ui("每日灵感", "Daily Inspiration"), - detail: store.ui("只控制空工作区里的出处内容;文稿、对话和笔记入口始终保留。", "Controls sourced material on the empty workspace only; document, chat, and notes entries always remain.") - ) { - Toggle( - "", - isOn: Binding( - get: { store.showDailyInspiration }, - set: { store.setDailyInspirationEnabled($0) } - ) - ) - .labelsHidden() - .toggleStyle(.switch) - .tint(WeiBeiTheme.cinnabar) - .accessibilityLabel(Text(store.ui("显示每日灵感", "Show Daily Inspiration"))) - } } } } diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index d60740959..f20c21ac5 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -14,6 +14,7 @@ struct EmptyWorkspaceLauncherView: View { let compact = geometry.size.width < 760 || geometry.size.height < 620 let horizontalPadding: CGFloat = compact ? 24 : 52 let entryWidth = min(116, max(76, (geometry.size.width - (horizontalPadding * 2) - 2) / 3)) + let inspirationSlotHeight: CGFloat = compact ? 176 : 210 let currentInspiration = inspiration(at: timeline.date) ZStack { @@ -28,16 +29,20 @@ struct EmptyWorkspaceLauncherView: View { EmptyWorkspaceEntryRow(entryWidth: entryWidth) } - if store.showDailyInspiration { - Spacer(minLength: compact ? 18 : 34) - - EmptyWorkspaceInspirationView( - inspiration: currentInspiration, - compact: compact, - onAdvance: { advanceInspiration(from: currentInspiration.id) } - ) - .transition(.opacity) + Spacer(minLength: compact ? 18 : 34) + + ZStack { + if store.showDailyInspiration { + EmptyWorkspaceInspirationView( + inspiration: currentInspiration, + compact: compact, + onAdvance: { advanceInspiration(from: currentInspiration.id) } + ) + .id(currentInspiration.id) + .transition(.opacity) + } } + .frame(height: inspirationSlotHeight) Spacer(minLength: compact ? 20 : 42) } @@ -281,8 +286,6 @@ private struct EmptyWorkspaceInspirationView: View { } .frame(maxWidth: .infinity) .contentShape(Rectangle()) - .id(inspiration.id) - .transition(.opacity) } .buttonStyle(.plain) .focused($focused) diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 17110c315..26b9e5f79 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -1004,6 +1004,10 @@ expect(emptyWorkspaceSource.contains("TimelineView(.periodic(from: .now, by: 60) && emptyWorkspaceSource.contains("minimumScaleFactor(0.78)"), "empty workspace greeting updates with time and its entry and inspiration typography adapt to compact windows") expect(emptyWorkspaceSource.contains("selectedInspirationID") && emptyWorkspaceSource.contains("randomItem(excludingID: currentID") + && emptyWorkspaceSource.contains("let inspirationSlotHeight: CGFloat = compact ? 176 : 210") + && emptyWorkspaceSource.contains(".frame(height: inspirationSlotHeight)") + && emptyWorkspaceSource.contains(".id(currentInspiration.id)") + && emptyWorkspaceSource.contains(".transition(.opacity)") && emptyWorkspaceSource.contains("随机换一则") && !emptyWorkspaceSource.contains("inspirationCounter") && !emptyWorkspaceSource.contains("%02d / %02d") @@ -1854,10 +1858,11 @@ expect(!appSource.contains("Form {") && appSource.contains("store.setTopBarVariant(variant)"), "settings center uses categorized WeiBei chrome and real bound controls instead of the default form field") expect(appSource.contains("settingsPill(\n title: store.interfaceLanguage.settingsLabel,\n icon: \"character.book.closed\",\n active: false") && appSource.contains("settingsPill(\n title: store.appearanceMode.label(language: store.interfaceLanguage),\n icon: store.appearanceMode.systemImage,\n active: false"), "settings sidebar summary pills stay neutral instead of looking permanently selected") -expect(appSource.contains("title: store.ui(\"每日灵感\", \"Daily Inspiration\")") +expect(appSource.contains("settingsGroup(store.ui(\"空白页\", \"Empty Workspace\"))") + && appSource.contains("title: store.ui(\"每日灵感\", \"Daily Inspiration\")") && appSource.contains("get: { store.showDailyInspiration }") && appSource.contains("set: { store.setDailyInspirationEnabled($0) }") - && appSource.contains("文稿、对话和笔记入口始终保留") + && appSource.contains("关闭后只隐藏语录;文稿、对话和笔记入口始终保留。") && appSource.contains(".accessibilityLabel(Text(store.ui(\"显示每日灵感\""), "settings explicitly toggles daily inspiration without implying that the three work entries disappear") expect(appSource.contains("segmented(NoteRenderMode.visibleCases, active: store.noteRenderMode.visibleMode)") && !appSource.contains("笔记预览") From 3e7325b2bc3d71be315baeeddb25b403c9eb7be2 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 07:40:27 +0800 Subject: [PATCH 15/36] fix: center empty workspace when inspiration is hidden --- .../Views/EmptyWorkspaceLauncherView.swift | 98 +++++++++++++------ Sources/WeiBeiSelfCheck/main.swift | 8 +- design-qa.md | 27 +++++ 3 files changed, 103 insertions(+), 30 deletions(-) diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index f20c21ac5..12d6d783a 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -20,35 +20,14 @@ struct EmptyWorkspaceLauncherView: View { ZStack { EmptyWorkspacePaperField(compact: compact) - VStack(spacing: 0) { - Spacer(minLength: compact ? 18 : 38) - - VStack(spacing: compact ? 14 : 19) { - greeting(at: timeline.date) - - EmptyWorkspaceEntryRow(entryWidth: entryWidth) - } - - Spacer(minLength: compact ? 18 : 34) - - ZStack { - if store.showDailyInspiration { - EmptyWorkspaceInspirationView( - inspiration: currentInspiration, - compact: compact, - onAdvance: { advanceInspiration(from: currentInspiration.id) } - ) - .id(currentInspiration.id) - .transition(.opacity) - } - } - .frame(height: inspirationSlotHeight) - - Spacer(minLength: compact ? 20 : 42) - } - .frame(maxWidth: 760) - .padding(.horizontal, horizontalPadding) - .padding(.vertical, compact ? 4 : 10) + workspaceContent( + at: timeline.date, + inspiration: currentInspiration, + compact: compact, + horizontalPadding: horizontalPadding, + entryWidth: entryWidth, + inspirationSlotHeight: inspirationSlotHeight + ) } } } @@ -56,6 +35,67 @@ struct EmptyWorkspaceLauncherView: View { .accessibilityIdentifier("empty-workspace-launcher") } + @ViewBuilder + private func workspaceContent( + at date: Date, + inspiration: EmptyWorkspaceInspiration, + compact: Bool, + horizontalPadding: CGFloat, + entryWidth: CGFloat, + inspirationSlotHeight: CGFloat + ) -> some View { + if store.showDailyInspiration { + VStack(spacing: 0) { + Spacer(minLength: compact ? 18 : 38) + + entryCluster( + at: date, + spacing: compact ? 14 : 19, + entryWidth: entryWidth + ) + + Spacer(minLength: compact ? 18 : 34) + + ZStack { + EmptyWorkspaceInspirationView( + inspiration: inspiration, + compact: compact, + onAdvance: { advanceInspiration(from: inspiration.id) } + ) + .id(inspiration.id) + .transition(.opacity) + } + .frame(height: inspirationSlotHeight) + + Spacer(minLength: compact ? 20 : 42) + } + .frame(maxWidth: 760) + .padding(.horizontal, horizontalPadding) + .padding(.vertical, compact ? 4 : 10) + } else { + VStack(spacing: 0) { + Spacer(minLength: compact ? 20 : 40) + entryCluster( + at: date, + spacing: compact ? 16 : 29, + entryWidth: entryWidth + ) + .offset(y: compact ? 0 : 5) + Spacer(minLength: compact ? 20 : 40) + } + .frame(maxWidth: 760, maxHeight: .infinity) + .padding(.horizontal, horizontalPadding) + .padding(.vertical, compact ? 4 : 10) + } + } + + private func entryCluster(at date: Date, spacing: CGFloat, entryWidth: CGFloat) -> some View { + VStack(spacing: spacing) { + greeting(at: date) + EmptyWorkspaceEntryRow(entryWidth: entryWidth) + } + } + private func greeting(at date: Date) -> some View { HStack(spacing: 12) { greetingRule diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 26b9e5f79..8d8954a70 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -1006,7 +1006,13 @@ expect(emptyWorkspaceSource.contains("selectedInspirationID") && emptyWorkspaceSource.contains("randomItem(excludingID: currentID") && emptyWorkspaceSource.contains("let inspirationSlotHeight: CGFloat = compact ? 176 : 210") && emptyWorkspaceSource.contains(".frame(height: inspirationSlotHeight)") - && emptyWorkspaceSource.contains(".id(currentInspiration.id)") + && emptyWorkspaceSource.contains("private func workspaceContent(") + && emptyWorkspaceSource.contains("if store.showDailyInspiration") + && emptyWorkspaceSource.contains(".frame(maxWidth: 760, maxHeight: .infinity)") + && emptyWorkspaceSource.contains("private func entryCluster(") + && emptyWorkspaceSource.contains("spacing: compact ? 16 : 29") + && emptyWorkspaceSource.contains(".offset(y: compact ? 0 : 5)") + && emptyWorkspaceSource.contains(".id(inspiration.id)") && emptyWorkspaceSource.contains(".transition(.opacity)") && emptyWorkspaceSource.contains("随机换一则") && !emptyWorkspaceSource.contains("inspirationCounter") diff --git a/design-qa.md b/design-qa.md index 2b8daa7bb..f4176c191 100644 --- a/design-qa.md +++ b/design-qa.md @@ -40,3 +40,30 @@ No actionable P0, P1, or P2 differences remain. The preview-to-peak gap is six p - Package and open a non-activating isolated preview. final result: passed + +--- + +# Empty Workspace Design QA: Inspiration Disabled + +- Reference: `/var/folders/yp/wx87z0l97wj89_yj8nw7_ptm0000gn/T/codex-clipboard-a2fc8532-c763-4611-aeef-eb42bcab300d.png` +- Implementation capture: `/var/folders/yp/wx87z0l97wj89_yj8nw7_ptm0000gn/T/weibei-visual-verify-empty-workspace-inspiration-off.png` +- Side-by-side comparison: `/private/tmp/weibei-empty-off-reference-comparison.png` +- Comparison viewport: 1180 x 760 points, 2360 x 1520 pixels +- State: light appearance, all work panes closed, daily inspiration disabled + +## Comparison + +- The greeting and `DOC | CHAT | NOTES` form one centered cluster. +- The cluster's horizontal center, greeting baseline, entry baseline, and vertical gap match the reference at the same viewport. +- Disabling inspiration removes the entire lower inspiration surface instead of reserving an invisible slot. +- Existing WeiBei hairlines and hover affordances remain; no new visual language or asset was introduced. +- The three work entries remain interactive and continue to use the existing pane toggles. + +## Findings + +- P0: none +- P1: none +- P2: none +- P3: the runtime greeting differs from the reference because it follows the actual time of day; this is expected behavior. + +final result: passed From 3728839e644c626348f559b2b3b98bb5ea2d521c Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 07:46:30 +0800 Subject: [PATCH 16/36] feat: add course-aware study memory --- CONTEXT.md | 10 + README.md | 17 +- Sources/WeiBei/App/WeiBeiApp.swift | 2 +- .../Services/DocumentTextExtractor.swift | 86 ++- Sources/WeiBei/Stores/WorkspaceStore.swift | 616 ++++++++++++++- Sources/WeiBei/Views/NotesAgentView.swift | 107 ++- .../WeiBeiCore/AgentResources/extension.ts | 714 +++++++++++++++++- .../skills/weibei-close-reading/SKILL.md | 8 +- .../skills/weibei-course-wayfinding/SKILL.md | 28 + .../skills/weibei-note-making/SKILL.md | 2 +- .../skills/weibei-recall-practice/SKILL.md | 18 +- .../skills/weibei-study-companion/SKILL.md | 33 + Sources/WeiBeiCore/AgentResources/system.md | 17 +- Sources/WeiBeiCore/CourseKnowledgeIndex.swift | 241 ++++++ Sources/WeiBeiCore/LearningModels.swift | 155 ++++ Sources/WeiBeiCore/PiAgentRuntime.swift | 77 +- Sources/WeiBeiCore/PiRPCProtocol.swift | 32 + Sources/WeiBeiCore/StudyAgentRuntime.swift | 361 ++++++++- Sources/WeiBeiCore/WorkspaceModels.swift | 18 +- Sources/WeiBeiPiCheck/main.swift | 105 ++- .../WeiBeiSelfCheck/PiAgentSelfChecks.swift | 292 ++++++- Sources/WeiBeiSelfCheck/main.swift | 89 ++- script/build_and_run.sh | 69 +- 23 files changed, 2970 insertions(+), 127 deletions(-) create mode 100644 CONTEXT.md create mode 100644 Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md create mode 100644 Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md create mode 100644 Sources/WeiBeiCore/CourseKnowledgeIndex.swift create mode 100644 Sources/WeiBeiCore/LearningModels.swift diff --git a/CONTEXT.md b/CONTEXT.md new file mode 100644 index 000000000..bc9eb4cc2 --- /dev/null +++ b/CONTEXT.md @@ -0,0 +1,10 @@ +# Domain Context + +- **Course workspace**: The current collection of materials, notes, relations, study sessions, and learning memory. It is the Agent's durable scope; it is not the currently open file. +- **Material**: A source document used as course evidence, such as a PDF, HTML page, text file, or non-notebook Markdown file. +- **Notebook**: A user-editable course note. A notebook can be linked to many materials, and a material can be linked to many notebooks. +- **Note-source link**: A durable relation saying that a notebook uses or discusses a material. Opening a file does not create this relation. +- **Study location**: Observed navigation state for a material, including its last page or section and visit time. It is recorded by the app rather than inferred by the model. +- **Learning memory**: Durable user learning state such as goals, understood concepts, confusions, next steps, and preferences. Every entry keeps its origin and evidence; it is not course-source evidence. +- **Study session**: A recoverable conversation around a learning goal. Sessions persist across material navigation and own their messages, summary, focus items, and suggested study phase. +- **Study flow**: A flexible phase suggestion for orienting, exploring, close reading, note-making, recall, consolidation, or planning. The user can move between phases at any time. diff --git a/README.md b/README.md index 72203dcec..7111d9954 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,12 @@ | | | | --- | --- | -| 资料 | 导入 HTML、PDF、Markdown、纯文本 | +| 资料 | 导入单个文件或整个课程目录;支持 HTML、PDF、Markdown、纯文本 | | 阅读 | HTML(WebKit)、PDF(PDFKit,连续或单页,`⌘[` / `⌘]`)、Markdown 渲染 | | 笔记 | 绑当前资料,存本机;Milkdown 原地编辑,可切源码 / 对照 | | 划线 | 选区浮层带摘录,可写入或替换笔记 | -| 对话 | PI 先读当前材料、选区与笔记并带来源;证据不足时标为未确认 | +| 对话 | PI 可检索整个课程的材料、笔记与关联,说明关系并给出可点击来源 | +| 学习 | 记录上次位置、目标、已掌握、困惑和下一步;按会话继续或切换学习主题 | | 布局 | 三栏可调;文档笔记对半;沉浸阅读 / 对话 / 写作 | | Agent | 固定列、抽屉、小窗、划线浮层、静默洞察、隐藏 | | 键位 | `⌘1`–`⌘4` 聚焦,`⌘B` 资料库,`⌘K` 命令面板 | @@ -46,15 +47,17 @@ cd weibei ## Agent -魏碑把 PI 当内部学习 Agent,不给它文件、终端或网络工具。PI 每轮只能读取魏碑生成的受限上下文快照;笔记整理只能返回待确认建议,最终写回仍由魏碑和用户决定。 +魏碑把 PI 当内部学习 Agent,不给它文件、终端或网络工具。魏碑先索引当前课程里的材料与笔记,再把有界课程目录、关联、相关摘录、学习进度和当前会话交给 PI。PI 只能读取这份受限快照;笔记整理只能返回待确认建议,最终写回仍由魏碑和用户决定。 + +单个课程目录最多导入 500 个支持文件。PI 通过分页课程地图认识完整文件清单;每轮按用户问题选出最多 80 份相关知识片段,不把整个课程全文一次塞进模型。首次索引在后台进行,后续按文件修改时间复用缓存;导入文件的本机绝对路径会在进入 PI 上下文前替换成临时匿名 ID。 应用内建固定到 `0.80.2` 的 PI macOS 独立运行体,只从自身资源目录启动,不扫描用户的 `PATH`、NVM、Node.js、Bun 或全局 PI。构建脚本按架构下载官方开源产物,先核对 SHA-256,再把最小运行文件、MIT 许可证和来源清单装进应用包。PI 内核以后可替换成我们的源码分支,Swift/RPC 契约无需跟着重写。 PI 在接收问题前不可用时会尝试原有在线接口,再使用离线草稿。已经被 PI 接收的请求若中途失败,不会自动重放,原问题会留在输入框供用户决定是否重试。 -魏碑为 PI 建立独立配置目录,只迁入本机已有 PI 的认证信息和默认提供方;全局扩展、技能、提示模板、主题和会话都不会加载。PI 子进程使用环境白名单,不继承宿主里的其他密钥。PI 会话和回答轨迹默认不落盘。 +魏碑为 PI 建立独立配置目录,只迁入本机已有 PI 的认证信息和默认提供方;全局扩展、技能、提示模板、主题和会话都不会加载。PI 子进程使用环境白名单,不继承宿主里的其他密钥。PI 自己的原始会话轨迹不落盘;魏碑会持久化面向用户的学习会话、上次位置和经过证据约束的学习记忆。 -三个内置学习技能:细读与证据核对、Markdown 笔记整理、主动回忆与自测。上下文读取、工具白名单、修订号失效和写回边界由 PI 扩展钩子强制执行。 +五个内置学习技能:学习陪伴、课程关联导航、细读与证据核对、Markdown 笔记整理、主动回忆与自测。六个魏碑专用工具负责读取当前上下文、浏览课程地图、检索课程知识、读取学习记忆、提交学习更新和生成笔记建议。上下文先读、记忆先读、工具白名单、修订号失效和写回边界由 PI 扩展钩子强制执行。 | 变量 | 说明 | 默认 | | --- | --- | --- | @@ -65,7 +68,7 @@ PI 在接收问题前不可用时会尝试原有在线接口,再使用离线 | `WEIBEI_PI_THINKING` | PI 思考强度 | `medium` | | `WEIBEI_PI_DISABLED` | 设为 `1` 跳过 PI | 未设置 | | `WEIBEI_PI_LIVE_CHECK` | `1` 强制、`0` 跳过真实笔记技能冒烟 | 有可用认证时自动运行 | -| `WEIBEI_PI_EVAL` | 运行细读、笔记、回忆三项真实评测 | 未设置 | +| `WEIBEI_PI_EVAL` | 运行学习陪伴、课程导航、细读、笔记、回忆五项真实评测 | 未设置 | | `WEIBEI_PI_EXECUTABLE` | 仅供 `WeiBeiPiCheck` 指向准备好的内建运行体 | 未设置 | Key 只在本机。 @@ -75,7 +78,7 @@ Key 只在本机。 ```text Sources/WeiBei/ App、界面、编辑器资源 Sources/WeiBeiCore/ 工作区、Agent、密钥、PDF OCR - AgentResources/ PI 扩展、系统契约与三个学习技能 + AgentResources/ PI 扩展、系统契约与五个学习技能 Sources/WeiBeiSelfCheck/ Sources/WeiBeiPiCheck/ PI 启动检查与可选真模型冒烟 Sources/WeiBei/WebEditor/ 编辑器源码 → Resources/Editor diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index a6aa0ec07..6bf836358 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -370,7 +370,7 @@ private struct WindowChromeConfigurator: NSViewRepresentable { !capturePath.isEmpty, Self.scheduledVerificationCaptures.insert(capturePath).inserted else { return } - if environment["WEIBEI_VERIFY_SCENARIO"] == "pi-learning-flow", + if ["pi-learning-flow", "pi-course-memory-flow"].contains(environment["WEIBEI_VERIFY_SCENARIO"]), let workspaceDirectory = environment["WEIBEI_WORKSPACE_DIR"] { let stateURL = URL(fileURLWithPath: workspaceDirectory) .appendingPathComponent("verification-state.txt") diff --git a/Sources/WeiBei/Services/DocumentTextExtractor.swift b/Sources/WeiBei/Services/DocumentTextExtractor.swift index 6e38d3d88..f289f42db 100644 --- a/Sources/WeiBei/Services/DocumentTextExtractor.swift +++ b/Sources/WeiBei/Services/DocumentTextExtractor.swift @@ -4,7 +4,15 @@ import PDFKit import WeiBeiCore enum DocumentTextExtractor { + private enum TextCache { + case pdf + case pdfIndex + case file + } + + private static let cacheLock = NSLock() private static var pdfTextCache: [String: String] = [:] + private static var pdfIndexTextCache: [String: String] = [:] private static var fileTextCache: [String: String] = [:] static func text(for item: StudyItem) -> String? { @@ -22,9 +30,36 @@ enum DocumentTextExtractor { } } + static func indexText(for item: StudyItem, maximumCharacters: Int = 24_000) -> String? { + guard let url = item.url else { return nil } + let text: String? + switch item.kind { + case .pdf: + let cacheKey = fileCacheKey(for: url) + if let cached = cachedValue(for: cacheKey, cache: .pdf) { + text = cached + } else { + let indexCacheKey = "\(cacheKey)#\(maximumCharacters)" + if let cached = cachedValue(for: indexCacheKey, cache: .pdfIndex) { + text = cached + } else { + let indexed = pdfIndexText(url: url, maximumCharacters: maximumCharacters) + if let indexed, !indexed.isEmpty { + store(indexed, for: indexCacheKey, cache: .pdfIndex) + } + text = indexed + } + } + case .html, .markdown, .text: + text = self.text(for: item) + } + guard let text, !text.isEmpty else { return nil } + return String(text.prefix(maximumCharacters)) + } + private static func pdfText(url: URL) -> String? { let cacheKey = fileCacheKey(for: url) - if let cached = pdfTextCache[cacheKey] { + if let cached = cachedValue(for: cacheKey, cache: .pdf) { return cached } @@ -32,7 +67,7 @@ enum DocumentTextExtractor { let textLayerText = pagedText(from: document) let text = textLayerText.isEmpty ? PDFOCRTextExtractor.text(from: document) : textLayerText if let text, !text.isEmpty { - pdfTextCache[cacheKey] = text + store(text, for: cacheKey, cache: .pdf) return text } return nil @@ -48,6 +83,23 @@ enum DocumentTextExtractor { .joined(separator: "\n\n") } + private static func pdfIndexText(url: URL, maximumCharacters: Int) -> String? { + guard let document = PDFDocument(url: url) else { return nil } + var sections: [String] = [] + var characterCount = 0 + for index in 0..<min(document.pageCount, 32) { + guard let page = document.page(at: index), + let pageText = page.string?.trimmingCharacters(in: .whitespacesAndNewlines), + !pageText.isEmpty else { continue } + let section = "第 \(index + 1) 页\n\(pageText)" + sections.append(section) + characterCount += section.count + if characterCount >= maximumCharacters { break } + } + let text = sections.joined(separator: "\n\n") + return text.isEmpty ? nil : String(text.prefix(maximumCharacters)) + } + private static func fileCacheKey(for url: URL) -> String { let modified = (try? FileManager.default.attributesOfItem(atPath: url.path)[.modificationDate] as? Date)? .timeIntervalSince1970 ?? 0 @@ -56,16 +108,42 @@ enum DocumentTextExtractor { private static func cachedFileText(url: URL, load: (URL) -> String?) -> String? { let cacheKey = fileCacheKey(for: url) - if let cached = fileTextCache[cacheKey] { + if let cached = cachedValue(for: cacheKey, cache: .file) { return cached } guard let text = load(url) else { return nil } if !text.isEmpty { - fileTextCache[cacheKey] = text + store(text, for: cacheKey, cache: .file) } return text } + private static func cachedValue(for key: String, cache: TextCache) -> String? { + cacheLock.lock() + defer { cacheLock.unlock() } + switch cache { + case .pdf: + return pdfTextCache[key] + case .pdfIndex: + return pdfIndexTextCache[key] + case .file: + return fileTextCache[key] + } + } + + private static func store(_ value: String, for key: String, cache: TextCache) { + cacheLock.lock() + defer { cacheLock.unlock() } + switch cache { + case .pdf: + pdfTextCache[key] = value + case .pdfIndex: + pdfIndexTextCache[key] = value + case .file: + fileTextCache[key] = value + } + } + private static func htmlText(url: URL) -> String? { guard let data = try? Data(contentsOf: url) else { return nil } if let attributed = try? NSAttributedString( diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 41bb690ae..85946a374 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -46,6 +46,13 @@ final class WorkspaceStore: ObservableObject { @Published var agentStreamingText = "" @Published var agentActivityText: String? @Published private(set) var latestAgentNoteProposal: StudyAgentNoteProposal? + @Published private(set) var latestAgentLearningUpdate: StudyAgentLearningUpdate? + @Published private(set) var noteSourceLinks: [NoteSourceLink] = [] + @Published private(set) var studyLocationsByItemID: [String: StudyLocation] = [:] + @Published private(set) var learningMemoryEntries: [LearningMemoryEntry] = [] + @Published private(set) var learningMemoryRevision: UInt64 = 0 + @Published private(set) var studySessions: [StudySession] = [] + @Published private(set) var activeStudySessionID: UUID? @Published var showLibrary = true @Published var showReader = true @Published var showAgent = true @@ -110,6 +117,8 @@ final class WorkspaceStore: ObservableObject { private var pendingNotePersistenceByItemID: [String: PendingNotePersistence] = [:] private var pendingNotePersistenceTasks: [String: Task<Void, Never>] = [:] private let notePersistenceDebounceDelay: UInt64 = 420_000_000 + private var studyProgressSaveTask: Task<Void, Never>? + private let studyProgressSaveDelay: UInt64 = 900_000_000 var showRightPane: Bool { get { showNotes || showAgent } @@ -146,6 +155,14 @@ final class WorkspaceStore: ObservableObject { var markdown: String } + private struct CourseIndexCandidate: Sendable { + var item: StudyItem + var title: String + var subtitle: String + var embeddedText: String? + var fallbackText: String + } + private var lastUsableAgentAnswer: AgentMessage? { guard lastAgentReplyContextRevision == agentContextRevision else { return nil } return messages.last { $0.isUsableAgentAnswer } @@ -161,9 +178,14 @@ final class WorkspaceStore: ObservableObject { piRuntime = PiAgentRuntime(runtimeDirectory: folder.appendingPathComponent("AgentRuntime", isDirectory: true)) try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) load() + ensureActiveStudySession() + migrateNoteSourceLinksFromMarkdown() floatingSelectionPrompt = ui("当前选区", "Current selection") if selectedItemID == nil { select(itemID: sampleItems[0].id) + } else { + restoreCurrentStudyLocation() + recordCurrentStudyLocation(incrementVisit: false) } } @@ -177,6 +199,153 @@ final class WorkspaceStore: ObservableObject { return allItems.filter { itemMatchesLibrarySearch($0, query: query) } } + var activeStudySession: StudySession? { + guard let activeStudySessionID else { return nil } + return studySessions.first { $0.id == activeStudySessionID } + } + + var orderedStudySessions: [StudySession] { + studySessions.sorted { $0.updatedAt > $1.updatedAt } + } + + var activeStudySessionTitle: String { + activeStudySession?.title ?? ui("新学习会话", "New Study Session") + } + + var lastStudyLocation: StudyLocation? { + studyLocationsByItemID.values.max { $0.lastStudiedAt < $1.lastStudiedAt } + } + + var canResumePreviousStudy: Bool { + lastStudyLocation != nil + } + + var hasCurrentSessionInferredMemory: Bool { + guard let activeStudySessionID else { return false } + return learningMemoryEntries.contains { + $0.sessionID == activeStudySessionID && $0.origin == .agentInference + } + } + + func createStudySession() { + cancelAgentRequest() + syncActiveStudySession() + let session = StudySession(title: ui("新学习会话", "New Study Session")) + studySessions.append(session) + activeStudySessionID = session.id + messages = [] + latestAgentNoteProposal = nil + latestAgentLearningUpdate = nil + lastAgentReplyContextRevision = nil + invalidateAgentContext() + save() + } + + func activateStudySession(_ id: UUID) { + guard id != activeStudySessionID, + let session = studySessions.first(where: { $0.id == id }) else { return } + cancelAgentRequest() + syncActiveStudySession() + activeStudySessionID = id + messages = session.messages + latestAgentNoteProposal = nil + latestAgentLearningUpdate = nil + lastAgentReplyContextRevision = nil + invalidateAgentContext() + save() + } + + func deleteStudySession(_ id: UUID) { + guard studySessions.count > 1, + let index = studySessions.firstIndex(where: { $0.id == id }) else { return } + let deletingActiveSession = activeStudySessionID == id + if deletingActiveSession { cancelAgentRequest() } + studySessions.remove(at: index) + learningMemoryEntries.removeAll { $0.sessionID == id && $0.origin == .agentInference } + if deletingActiveSession, let replacement = orderedStudySessions.first { + activeStudySessionID = replacement.id + messages = replacement.messages + latestAgentNoteProposal = nil + latestAgentLearningUpdate = nil + lastAgentReplyContextRevision = nil + invalidateAgentContext() + } + learningMemoryRevision &+= 1 + save() + } + + func clearCurrentSessionInferredMemory() { + guard let activeStudySessionID else { return } + let previousCount = learningMemoryEntries.count + learningMemoryEntries.removeAll { + $0.sessionID == activeStudySessionID && $0.origin == .agentInference + } + guard learningMemoryEntries.count != previousCount else { return } + learningMemoryRevision &+= 1 + latestAgentLearningUpdate = nil + invalidateAgentContext() + save() + } + + func resumePreviousStudy() { + guard let location = lastStudyLocation, + allItems.contains(where: { $0.id == location.itemID }) else { return } + select(itemID: location.itemID) + readerTargetPageIndex = location.pageIndex + showReader = true + focus(.reader) + } + + private func ensureActiveStudySession() { + if let activeStudySessionID, + let session = studySessions.first(where: { $0.id == activeStudySessionID }) { + messages = session.messages + return + } + if let session = orderedStudySessions.first { + activeStudySessionID = session.id + messages = session.messages + return + } + let session = StudySession(title: ui("新学习会话", "New Study Session")) + studySessions = [session] + activeStudySessionID = session.id + messages = [] + } + + private func appendAgentMessage(_ message: AgentMessage) { + messages.append(message) + syncActiveStudySession(titleSeed: message.role == .user ? message.text : nil) + save() + } + + private func syncActiveStudySession(titleSeed: String? = nil) { + guard let activeStudySessionID, + let index = studySessions.firstIndex(where: { $0.id == activeStudySessionID }) else { return } + studySessions[index].messages = messages + studySessions[index].updatedAt = Date() + if let titleSeed, + studySessions[index].messages.filter({ $0.role == .user }).count == 1 { + studySessions[index].title = Self.sessionTitle(from: titleSeed) + } + for itemID in [selectedItemID, activeNoteItemID].compactMap({ $0 }) { + if !studySessions[index].focusItemIDs.contains(itemID) { + studySessions[index].focusItemIDs.append(itemID) + } + } + if studySessions[index].focusItemIDs.count > 24 { + studySessions[index].focusItemIDs.removeFirst(studySessions[index].focusItemIDs.count - 24) + } + } + + private static func sessionTitle(from text: String) -> String { + let title = text + .replacingOccurrences(of: #"[`*_>#\[\]()]"#, with: "", options: .regularExpression) + .split(whereSeparator: { $0.isWhitespace }) + .joined(separator: " ") + return title.isEmpty ? "Study Session" : String(title.prefix(36)) + } + var navigableItems: [StudyItem] { let materialItems = allItems.filter { !$0.isNotebookNote } let query = librarySearch.trimmingCharacters(in: .whitespacesAndNewlines) @@ -350,10 +519,7 @@ final class WorkspaceStore: ObservableObject { } var agentConversationSubtitle: String { - if let item = selectedMaterialItem { - return displayTitle(for: item) - } - return activeNoteItem.map(displayTitle) ?? ui("无上下文", "No context") + activeStudySessionTitle } var agentPromptScope: String { @@ -364,7 +530,9 @@ final class WorkspaceStore: ObservableObject { if hasSelectionAttachments { return ui("输入问题", "Ask a question") } - return hasSelectedMaterial ? ui("问当前材料", "Ask current material") : ui("问当前笔记", "Ask current note") + return hasSelectedMaterial + ? ui("问当前课程或材料", "Ask the course or current material") + : ui("问当前课程或笔记", "Ask the course or current note") } var selectionPromptScope: String { @@ -512,6 +680,9 @@ final class WorkspaceStore: ObservableObject { let item = allItems.first(where: { $0.id == itemID && $0.isNotebookNote }) { activeNotebookItemID = item.id noteText = noteText(for: item) + latestAgentNoteProposal = nil + latestAgentLearningUpdate = nil + syncActiveStudySession() revealRichWritingSurface() focus(.notes) save() @@ -532,8 +703,10 @@ final class WorkspaceStore: ObservableObject { readerLocationTitle = selectedMaterialItem.map(displayTitle) clearReaderSearchIfNeeded() noteText = noteText(for: activeNoteItem) - messages = [] latestAgentNoteProposal = nil + latestAgentLearningUpdate = nil + syncActiveStudySession() + recordCurrentStudyLocation(incrementVisit: itemChanged) clearGeneratedQuietInsight() refreshQuietInsightIfNeeded() save() @@ -876,6 +1049,7 @@ final class WorkspaceStore: ObservableObject { guard readerLocationTitle != nextTitle else { return } invalidateAgentContext() readerLocationTitle = nextTitle + recordCurrentStudyLocation(incrementVisit: false) } func updateReaderPageIndex(_ index: Int) { @@ -883,6 +1057,41 @@ final class WorkspaceStore: ObservableObject { guard readerPageIndex != nextIndex else { return } invalidateAgentContext() readerPageIndex = nextIndex + recordCurrentStudyLocation(incrementVisit: false) + } + + private func recordCurrentStudyLocation(incrementVisit: Bool) { + guard let item = selectedMaterialItem else { return } + let previous = studyLocationsByItemID[item.id] + studyLocationsByItemID[item.id] = StudyLocation( + itemID: item.id, + itemTitle: displayTitle(for: item), + locationTitle: readerLocationTitle, + pageIndex: item.kind == .pdf ? readerPageIndex : nil, + lastStudiedAt: Date(), + visitCount: max((previous?.visitCount ?? 0) + (incrementVisit ? 1 : 0), 1) + ) + studyProgressSaveTask?.cancel() + let delay = studyProgressSaveDelay + studyProgressSaveTask = Task { @MainActor [weak self] in + try? await Task.sleep(nanoseconds: delay) + guard !Task.isCancelled else { return } + self?.studyProgressSaveTask = nil + self?.save() + } + } + + private func restoreCurrentStudyLocation() { + guard let item = selectedMaterialItem else { return } + guard let location = studyLocationsByItemID[item.id] else { + readerLocationTitle = displayTitle(for: item) + return + } + readerLocationTitle = location.locationTitle ?? displayTitle(for: item) + if item.kind == .pdf { + readerPageIndex = max(location.pageIndex ?? 0, 0) + readerTargetPageIndex = location.pageIndex.map { max($0, 0) } + } } func recordReaderPageNavigationPoint() { @@ -905,6 +1114,10 @@ final class WorkspaceStore: ObservableObject { guard let item = sourceReferenceItem(from: rawReference) else { return false } let reference = SourceReferenceTitle.parse(rawReference) select(itemID: item.id) + if item.isNotebookNote { + focus(.notes) + return true + } readerTargetPageIndex = item.kind == .pdf ? reference.pageIndex : nil focus(.reader) return true @@ -1205,8 +1418,10 @@ final class WorkspaceStore: ObservableObject { noteText = noteText(for: activeNoteItem) readerLocationTitle = selectedMaterialItem.map(displayTitle) readerTargetPageIndex = selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil - messages = [] latestAgentNoteProposal = nil + latestAgentLearningUpdate = nil + syncActiveStudySession() + recordCurrentStudyLocation(incrementVisit: false) showQuietInsight = agentSurface == .quietInsight clearUnpinnedFloatingSelection(keepContext: false) clearReaderSearchIfNeeded() @@ -1478,9 +1693,10 @@ final class WorkspaceStore: ObservableObject { func importFilesFromPanel() { let panel = NSOpenPanel() - panel.title = ui("选择学习资料", "Choose study materials") + panel.title = ui("选择学习资料或课程文件夹", "Choose study materials or a course folder") panel.allowsMultipleSelection = true - panel.canChooseDirectories = false + panel.canChooseDirectories = true + panel.canChooseFiles = true panel.allowedContentTypes = [ .pdf, .html, @@ -1495,7 +1711,14 @@ final class WorkspaceStore: ObservableObject { func importFiles(_ urls: [URL]) { let existing = Set(importedItems.compactMap(\.urlPath)) - let newItems = urls + let expandedURLs = urls + .flatMap(Self.supportedCourseFiles(at:)) + .reduce(into: [URL]()) { result, url in + if !result.contains(where: { $0.standardizedFileURL == url.standardizedFileURL }) { + result.append(url) + } + } + let newItems = expandedURLs .filter { !existing.contains($0.path) } .map { url in StudyItem( @@ -1516,6 +1739,33 @@ final class WorkspaceStore: ObservableObject { } } + private static func supportedCourseFiles(at url: URL) -> [URL] { + var isDirectory: ObjCBool = false + guard FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory) else { return [] } + if !isDirectory.boolValue { + return isSupportedCourseFile(url) ? [url] : [] + } + + guard let enumerator = FileManager.default.enumerator( + at: url, + includingPropertiesForKeys: [.isRegularFileKey], + options: [.skipsHiddenFiles, .skipsPackageDescendants] + ) else { return [] } + var files: [URL] = [] + for case let fileURL as URL in enumerator { + guard isSupportedCourseFile(fileURL), + (try? fileURL.resourceValues(forKeys: [.isRegularFileKey]).isRegularFile) == true else { continue } + files.append(fileURL) + if files.count == 500 { break } + } + return files.sorted { $0.path.localizedStandardCompare($1.path) == .orderedAscending } + } + + private static func isSupportedCourseFile(_ url: URL) -> Bool { + ["pdf", "html", "htm", "md", "markdown", "txt", "text"] + .contains(url.pathExtension.lowercased()) + } + func promptRenameNotebookNote(itemID: String) { guard let item = allItems.first(where: { $0.id == itemID && $0.isNotebookNote }) else { return } notebookCreationDraft = nil @@ -1570,6 +1820,14 @@ final class WorkspaceStore: ObservableObject { if let cached = notesByItemID.removeValue(forKey: oldID) { notesByItemID[newID] = retitledMarkdown(cached, from: oldTitle, to: importedItems[index].title) } + for linkIndex in noteSourceLinks.indices where noteSourceLinks[linkIndex].noteItemID == oldID { + noteSourceLinks[linkIndex].noteItemID = newID + } + for sessionIndex in studySessions.indices { + studySessions[sessionIndex].focusItemIDs = studySessions[sessionIndex].focusItemIDs.map { + $0 == oldID ? newID : $0 + } + } if selectedItemID == oldID { selectedItemID = newID } @@ -1656,6 +1914,9 @@ final class WorkspaceStore: ObservableObject { let markdown = defaultNotebookNote(title: item.title, sourceItem: sourceItem) try markdown.write(to: url, atomically: true, encoding: .utf8) importedItems.append(item) + if let sourceItem { + addNoteSourceLink(noteItemID: item.id, sourceItemID: sourceItem.id) + } activeNotebookItemID = item.id noteText = markdown revealRichWritingSurface() @@ -1970,9 +2231,202 @@ final class WorkspaceStore: ObservableObject { let reference = SourceReferenceTitle.parse(rawReference ?? "") guard !reference.title.isEmpty else { return nil } return allItems.first { - !$0.isNotebookNote - && ($0.title == reference.title || $0.subtitle == reference.title) + $0.title == reference.title || $0.subtitle == reference.title + } + } + + private func addNoteSourceLink(noteItemID: String, sourceItemID: String) { + guard noteItemID != sourceItemID, + !noteSourceLinks.contains(where: { + $0.noteItemID == noteItemID && $0.sourceItemID == sourceItemID + }) else { return } + noteSourceLinks.append(NoteSourceLink(noteItemID: noteItemID, sourceItemID: sourceItemID)) + } + + private func migrateNoteSourceLinksFromMarkdown() { + let previousCount = noteSourceLinks.count + let materials = allItems.filter { !$0.isNotebookNote } + for note in allItems where note.isNotebookNote { + let markdown = noteMarkdownText(for: note) + for rawLine in markdown.components(separatedBy: .newlines) { + let line = rawLine.trimmingCharacters(in: .whitespacesAndNewlines) + guard line.contains("来源:") || line.localizedCaseInsensitiveContains("source:") else { continue } + let reference = SourceReferenceTitle.parse(line) + guard let source = materials.first(where: { + $0.title == reference.title || $0.subtitle == reference.title + }) else { continue } + addNoteSourceLink(noteItemID: note.id, sourceItemID: source.id) + } + } + if noteSourceLinks.count != previousCount { save() } + } + + private func makeCourseContext(query: String) async throws -> StudyAgentCourseContext { + let candidates = allItems.map { item in + let embeddedText: String? + if item.isNotebookNote { + embeddedText = noteMarkdownText(for: item) + } else if item.id == selectedItemID { + embeddedText = selectedContextText + } else { + embeddedText = nil + } + let fallbackText = item.id == "sample-md" + ? notesByItemID[item.id] ?? defaultNote(for: item) + : sampleText(for: item) + return CourseIndexCandidate( + item: item, + title: displayTitle(for: item), + subtitle: displaySubtitle(for: item), + embeddedText: embeddedText, + fallbackText: fallbackText + ) + } + let title = ui("当前课程", "Current Course") + let links = noteSourceLinks + let currentMaterialID = selectedMaterialItem?.id + let currentNoteID = activeNoteItem?.isNotebookNote == true ? activeNoteItem?.id : nil + let indexingTask = Task.detached(priority: .userInitiated) { + var sources: [CourseKnowledgeSource] = [] + sources.reserveCapacity(candidates.count) + for candidate in candidates { + try Task.checkCancellation() + let text = candidate.embeddedText + ?? DocumentTextExtractor.indexText(for: candidate.item) + ?? candidate.fallbackText + sources.append( + CourseKnowledgeSource( + id: candidate.item.id, + title: candidate.title, + subtitle: candidate.subtitle, + kind: candidate.item.kind.rawValue, + role: candidate.item.isNotebookNote ? "note" : "material", + text: text + ) + ) + } + return CourseKnowledgeIndex.build( + title: title, + sources: sources, + links: links, + query: query, + currentMaterialID: currentMaterialID, + currentNoteID: currentNoteID + ) + } + return try await withTaskCancellationHandler { + try await indexingTask.value + } onCancel: { + indexingTask.cancel() + } + } + + private func makeLearningContext() -> StudyAgentLearningContext { + let session = activeStudySession.map { session in + StudyAgentSessionSnapshot( + id: session.id.uuidString.lowercased(), + title: session.title, + summary: session.summary, + phase: session.flow.phase.rawValue, + focusItemIDs: session.focusItemIDs, + turnCount: session.messages.count + ) + } + return StudyAgentLearningContext( + memoryRevision: learningMemoryRevision, + lastLocation: lastStudyLocation, + memories: learningMemoryEntries, + session: session + ) + } + + private func applyLearningUpdate( + _ update: StudyAgentLearningUpdate?, + expectedContextRevision: String, + expectedMemoryRevision: UInt64 + ) { + latestAgentLearningUpdate = nil + guard let update, + update.contextRevision == expectedContextRevision, + update.memoryRevision == expectedMemoryRevision, + learningMemoryRevision == expectedMemoryRevision else { return } + + var changed = false + let now = Date() + for proposed in update.entries.prefix(12) { + let text = proposed.text.trimmingCharacters(in: .whitespacesAndNewlines) + let evidence = proposed.evidence.trimmingCharacters(in: .whitespacesAndNewlines) + guard !text.isEmpty, !evidence.isEmpty else { continue } + let normalized = Self.normalizedMemoryText(text) + if let index = learningMemoryEntries.firstIndex(where: { + $0.kind == proposed.kind + && $0.status == .active + && Self.normalizedMemoryText($0.text) == normalized + }) { + learningMemoryEntries[index].text = String(text.prefix(500)) + learningMemoryEntries[index].evidence = String(evidence.prefix(400)) + if proposed.origin == .userStatement { + learningMemoryEntries[index].origin = .userStatement + } + learningMemoryEntries[index].sessionID = activeStudySessionID + learningMemoryEntries[index].updatedAt = now + changed = true + } else { + learningMemoryEntries.append( + LearningMemoryEntry( + kind: proposed.kind, + text: String(text.prefix(500)), + evidence: String(evidence.prefix(400)), + origin: proposed.origin == .observed ? .agentInference : proposed.origin, + sessionID: activeStudySessionID, + createdAt: now, + updatedAt: now + ) + ) + changed = true + } } + + if let activeStudySessionID, + let index = studySessions.firstIndex(where: { $0.id == activeStudySessionID }) { + if let summary = update.sessionSummary?.trimmingCharacters(in: .whitespacesAndNewlines), + !summary.isEmpty { + studySessions[index].summary = String(summary.prefix(2_000)) + changed = true + } + if !studySessions[index].flow.pinnedByUser, + let phase = update.suggestedPhase { + studySessions[index].flow.phase = phase + changed = true + } + let next = update.suggestedNext + .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) } + .filter { !$0.isEmpty } + .prefix(3) + .map { String($0.prefix(300)) } + if !next.isEmpty { + studySessions[index].flow.suggestedNext = next + changed = true + } + studySessions[index].updatedAt = now + } + + if learningMemoryEntries.count > 200 { + learningMemoryEntries = Array( + learningMemoryEntries + .sorted { $0.updatedAt > $1.updatedAt } + .prefix(200) + ) + } + if changed { learningMemoryRevision &+= 1 } + latestAgentLearningUpdate = update + } + + private static func normalizedMemoryText(_ text: String) -> String { + text + .lowercased() + .split(whereSeparator: { $0.isWhitespace || $0.isPunctuation }) + .joined() } func askToOrganizeNote() { @@ -2164,6 +2618,7 @@ final class WorkspaceStore: ObservableObject { ] guard scenario == "offline-learning-flow" || scenario == "pi-learning-flow" + || scenario == "pi-course-memory-flow" || scenario == "immersive-conversation-flow" || scenario == "notebook-creation-flow" || emptyWorkspaceScenarios.contains(scenario) else { return } @@ -2183,13 +2638,35 @@ final class WorkspaceStore: ObservableObject { showNotes = true agentSurface = .hidden select(itemID: "sample-html") - if scenario == "pi-learning-flow" { + if scenario == "pi-learning-flow" || scenario == "pi-course-memory-flow" { await waitForReaderContextToSettle() } if scenario == "notebook-creation-flow" { promptCreateBlankNotebookNote() return } + if scenario == "pi-course-memory-flow" { + updateReaderLocationTitle(ui("实际利率", "Real interest rates")) + updateNote(ui("# 课程学习记录\n\n", "# Course study record\n\n")) + recordVerificationStage("course-memory-context-prepared") + agentDraft = ui( + "我上次学到哪?课程里哪份其他资料也提到利率,为什么相关?我还不懂名义利率和实际利率的区别,请记住这个困惑,并给出可点击来源。", + "Where did I stop last time? Which other course material discusses interest rates, and why is it related? I still do not understand nominal versus real rates. Remember that confusion and give me a clickable source." + ) + await askAgentAndWait() + let answer = messages.last?.text ?? "" + let recordedConfusion = latestAgentLearningUpdate?.entries.contains { $0.kind == .confusion } == true + let hasJumpReference = answer.contains(ui("来源:", "Source:")) + recordVerificationStage("course-memory-reply:\(messages.last?.backend?.rawValue ?? "none")") + recordVerificationStage("course-memory-update:\(recordedConfusion)") + recordVerificationStage("course-memory-jump:\(hasJumpReference)") + if messages.last?.backend == .pi, recordedConfusion, hasJumpReference { + let markerURL = storageURL.deletingLastPathComponent().appendingPathComponent("pi-course-memory-verified.txt") + try? "PI backend completed course memory and wayfinding\n".write(to: markerURL, atomically: true, encoding: .utf8) + } + recordVerificationStage("completed") + return + } updateNote(ui("# 视觉验收笔记\n\n", "# Visual verification note\n\n")) updateSelection( ui("利率是资金使用价格的表达。", "An interest rate is the price paid for using funds."), @@ -2320,22 +2797,18 @@ final class WorkspaceStore: ObservableObject { let sourceTitle = agentMessageSourceTitle let requestID = UUID() let requestWorkspaceRevision = agentContextRevision - let request = StudyAgentRequest( - id: requestID, - purpose: .conversation, - question: question, - materialTitle: currentReferenceTitle, - materialText: selectedContextText, - noteTitle: agentNoteTitle, - noteText: noteText, - selectionTitle: sentSelectionTitle, - selectionText: sentSelectionText, - recentMessages: recentMessages, - language: interfaceLanguage, - contextRevision: "\(requestWorkspaceRevision):\(requestID.uuidString.lowercased())" - ) + let requestMemoryRevision = learningMemoryRevision + let sentMaterialTitle = currentReferenceTitle + let sentMaterialText = selectedContextText + let sentNoteTitle = agentNoteTitle + let sentNoteText = noteText + let sentLearningContext = makeLearningContext() + let sentLanguage = interfaceLanguage + let courseQuery = [question, sentSelectionText ?? "", String(sentNoteText.prefix(2_000))] + .joined(separator: "\n\n") agentDraft = "" latestAgentNoteProposal = nil + latestAgentLearningUpdate = nil if !selectionAttachments.isEmpty { withAnimation(WeiBeiMotion.panel) { cancelPendingSelectionAttachment() @@ -2347,13 +2820,12 @@ final class WorkspaceStore: ObservableObject { if shouldClearSentDocumentSelection { clearUnpinnedFloatingSelection(keepContext: false, invalidatesAgentContext: false) } - messages.append(AgentMessage(role: .user, text: question, source: sourceTitle)) isAskingAgent = true - activeAgentRequestID = request.id + activeAgentRequestID = requestID agentStreamingText = "" - agentActivityText = ui("正在读取上下文", "Reading context") + agentActivityText = ui("正在整理课程目录", "Indexing course") defer { - if activeAgentRequestID == request.id { + if activeAgentRequestID == requestID { activeAgentRequestID = nil isAskingAgent = false agentStreamingText = "" @@ -2362,17 +2834,50 @@ final class WorkspaceStore: ObservableObject { } } - if isGeneratingQuietInsight { - await piRuntime.cancel() - } - + var didAppendUserMessage = false do { + let courseContext = try await makeCourseContext(query: courseQuery) + guard activeAgentRequestID == requestID, + requestWorkspaceRevision == agentContextRevision, + requestMemoryRevision == learningMemoryRevision else { + if agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + agentDraft = question + } + return + } + let request = StudyAgentRequest( + id: requestID, + purpose: .conversation, + question: question, + materialTitle: sentMaterialTitle, + materialText: sentMaterialText, + noteTitle: sentNoteTitle, + noteText: sentNoteText, + selectionTitle: sentSelectionTitle, + selectionText: sentSelectionText, + recentMessages: recentMessages, + courseContext: courseContext, + learningContext: sentLearningContext, + language: sentLanguage, + contextRevision: "\(requestWorkspaceRevision):\(requestID.uuidString.lowercased())" + ) + appendAgentMessage(AgentMessage(role: .user, text: question, source: sourceTitle)) + didAppendUserMessage = true + agentActivityText = ui("正在读取上下文", "Reading context") + if isGeneratingQuietInsight { + await piRuntime.cancel() + } let reply = try await executeStudyAgentRequest(request) guard activeAgentRequestID == request.id, requestWorkspaceRevision == agentContextRevision else { return } latestAgentNoteProposal = reply.noteProposal + applyLearningUpdate( + reply.learningUpdate, + expectedContextRevision: request.contextRevision, + expectedMemoryRevision: requestMemoryRevision + ) lastAgentReplyContextRevision = requestWorkspaceRevision - messages.append( + appendAgentMessage( AgentMessage( role: .assistant, text: reply.noteProposal?.markdown ?? reply.text, @@ -2381,13 +2886,20 @@ final class WorkspaceStore: ObservableObject { ) ) } catch PiAgentRuntimeError.cancelled, is CancellationError { + if !didAppendUserMessage, + agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + agentDraft = question + } return } catch { - guard activeAgentRequestID == request.id else { return } + guard activeAgentRequestID == requestID else { return } + if !didAppendUserMessage { + appendAgentMessage(AgentMessage(role: .user, text: question, source: sourceTitle)) + } if agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { agentDraft = question } - messages.append( + appendAgentMessage( AgentMessage( role: .assistant, text: ui( @@ -2500,6 +3012,12 @@ final class WorkspaceStore: ObservableObject { switch name { case "weibei_context": agentActivityText = ui("正在核对材料与笔记", "Checking material and notes") + case "weibei_course_map", "weibei_course_search": + agentActivityText = ui("正在查找课程关联", "Finding course connections") + case "weibei_learning_memory": + agentActivityText = ui("正在回顾学习记忆", "Reviewing learning memory") + case "weibei_learning_update": + agentActivityText = ui("正在整理学习进展", "Updating study progress") case "weibei_note_proposal": agentActivityText = ui("正在整理写入建议", "Preparing a note proposal") default: @@ -2840,6 +3358,10 @@ final class WorkspaceStore: ObservableObject { func flushPendingNotePersistence() { let itemIDs = Array(pendingNotePersistenceByItemID.keys) itemIDs.forEach { flushPendingNotePersistence(for: $0) } + studyProgressSaveTask?.cancel() + studyProgressSaveTask = nil + syncActiveStudySession() + save() } private func scheduleNotePersistence(_ markdown: String, for item: StudyItem) { @@ -2891,6 +3413,18 @@ final class WorkspaceStore: ObservableObject { notesByItemID = snapshot.notesByItemID.mapValues(cleanLegacyPlaceholder) selectedItemID = snapshot.selectedItemID activeNotebookItemID = snapshot.activeNotebookItemID + noteSourceLinks = snapshot.noteSourceLinks ?? [] + studyLocationsByItemID = snapshot.studyLocationsByItemID ?? [:] + learningMemoryEntries = snapshot.learningMemoryEntries ?? [] + learningMemoryRevision = snapshot.learningMemoryRevision ?? 0 + studySessions = (snapshot.studySessions ?? []).map { session in + var bounded = session + if bounded.messages.count > 500 { + bounded.messages = Array(bounded.messages.suffix(500)) + } + return bounded + } + activeStudySessionID = snapshot.activeStudySessionID if selectedItem?.isNotebookNote == true { activeNotebookItemID = selectedItemID selectedItemID = sampleItems.first?.id @@ -2968,6 +3502,12 @@ final class WorkspaceStore: ObservableObject { notesByItemID: notesByItemID, selectedItemID: selectedItemID, activeNotebookItemID: activeNotebookItemID, + noteSourceLinks: noteSourceLinks, + studyLocationsByItemID: studyLocationsByItemID, + learningMemoryEntries: learningMemoryEntries, + learningMemoryRevision: learningMemoryRevision, + studySessions: studySessions, + activeStudySessionID: activeStudySessionID, modelName: modelName, workspaceLayout: layout, threePaneOrder: normalizedThreePaneOrder, diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index fb2eeddc8..87614a7f6 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -1378,7 +1378,7 @@ struct AgentPaneView: View { appearanceMode: store.appearanceMode, reorderRole: reorderRole ) { - EmptyView() + sessionMenu } } @@ -1648,6 +1648,17 @@ struct AgentPaneView: View { private var emptyAgentState: some View { VStack(alignment: .leading, spacing: 8) { LazyVGrid(columns: starterChipColumns, alignment: .leading, spacing: 6) { + if store.canResumePreviousStudy { + starterChip(store.ui("继续上次", "Resume"), systemImage: "arrow.uturn.forward", help: store.ui("回顾上次学习位置并继续", "Review the last study location and continue")) { + store.resumePreviousStudy() + askWith(store.ui("上次学到哪了?请结合学习记忆告诉我当时的位置、还没解决的问题和现在最适合的下一步。", "Where did I stop last time? Use my learning memory to give the location, unresolved questions, and the best next step.")) + } + } + if store.allItems.count > 1 { + starterChip(store.ui("关联", "Connections"), systemImage: "point.3.connected.trianglepath.dotted", help: store.ui("查找当前概念在课程里的关联", "Find related course materials and notes")) { + askWith(store.ui("请查找当前材料、选区或笔记在整个课程里的知识关联,说清为什么相关,并给出可跳转的来源。", "Find connections between the current material, selection, or note and the rest of the course. Explain each connection and provide jumpable sources.")) + } + } if store.hasSelectedMaterial { starterChip(store.ui("梳理", "Outline"), systemImage: "text.alignleft", help: store.ui("梳理当前材料", "Outline current material")) { askWith(store.ui("请基于当前材料提炼核心概念、关键公式和需要回看出处的位置。", "Extract the core concepts, key formulas, and places that need source review from the current material.")) @@ -1681,6 +1692,52 @@ struct AgentPaneView: View { store.askAgent() } + private var sessionMenu: some View { + Menu { + Button { + store.createStudySession() + } label: { + Label(store.ui("新学习会话", "New Study Session"), systemImage: "plus") + } + + Divider() + + ForEach(store.orderedStudySessions) { session in + Button { + store.activateStudySession(session.id) + } label: { + if session.id == store.activeStudySessionID { + Label(session.title, systemImage: "checkmark") + } else { + Text(session.title) + } + } + } + + if store.hasCurrentSessionInferredMemory { + Divider() + Button(role: .destructive) { + store.clearCurrentSessionInferredMemory() + } label: { + Label(store.ui("清除本会话推断记忆", "Clear Inferred Memory"), systemImage: "brain.head.profile") + } + } + + if let activeID = store.activeStudySessionID, store.studySessions.count > 1 { + Button(role: .destructive) { + store.deleteStudySession(activeID) + } label: { + Label(store.ui("删除当前会话", "Delete Current Session"), systemImage: "trash") + } + } + } label: { + Image(systemName: "bubble.left.and.bubble.right") + } + .buttonStyle(WeiBeiIconButtonStyle(size: 24)) + .accessibilityLabel(Text(store.ui("学习会话", "Study Sessions"))) + .help(store.ui("新建或切换学习会话", "Create or switch study sessions")) + } + private func scrollAgentToBottom(_ proxy: ScrollViewProxy) { guard agentFollowsLatest else { return } DispatchQueue.main.async { @@ -2930,6 +2987,10 @@ private struct AgentBubble: View { ) if message.id == store.lastUsableAgentAnswerID { + if let update = store.latestAgentLearningUpdate, + !update.entries.isEmpty || !update.suggestedNext.isEmpty { + learningUpdateContent(update) + } if let proposal = store.latestAgentNoteProposal, !proposal.evidence.isEmpty { VStack(alignment: .leading, spacing: 4) { Text(store.ui("依据", "Evidence")) @@ -2967,6 +3028,50 @@ private struct AgentBubble: View { } } + private func learningUpdateContent(_ update: StudyAgentLearningUpdate) -> some View { + VStack(alignment: .leading, spacing: 5) { + Label(store.ui("本轮记住", "Remembered This Turn"), systemImage: "brain.head.profile") + .font(.system(size: 10.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + + ForEach(Array(update.entries.prefix(4).enumerated()), id: \.offset) { _, entry in + Text("\(memoryKindLabel(entry.kind)):\(entry.text)") + .font(.caption) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .fixedSize(horizontal: false, vertical: true) + } + + ForEach(Array(update.suggestedNext.prefix(3).enumerated()), id: \.offset) { _, next in + Text("→ \(next)") + .font(.caption) + .foregroundStyle(WeiBeiTheme.link) + .fixedSize(horizontal: false, vertical: true) + } + } + .padding(.leading, 9) + .padding(.vertical, 5) + .overlay(alignment: .leading) { + Rectangle() + .fill(WeiBeiTheme.cinnabar.opacity(0.34)) + .frame(width: 1) + } + } + + private func memoryKindLabel(_ kind: LearningMemoryKind) -> String { + switch kind { + case .goal: + return store.ui("目标", "Goal") + case .understood: + return store.ui("已理解", "Understood") + case .confusion: + return store.ui("困惑", "Confusion") + case .nextStep: + return store.ui("下一步", "Next Step") + case .preference: + return store.ui("偏好", "Preference") + } + } + private var messageMetadata: some View { HStack(spacing: 6) { Text("WeiBei") diff --git a/Sources/WeiBeiCore/AgentResources/extension.ts b/Sources/WeiBeiCore/AgentResources/extension.ts index 3df4dcb18..4ba4d4026 100644 --- a/Sources/WeiBeiCore/AgentResources/extension.ts +++ b/Sources/WeiBeiCore/AgentResources/extension.ts @@ -5,11 +5,22 @@ import { Type } from "@earendil-works/pi-ai"; const CONTEXT_FILE_ENV = "WEIBEI_AGENT_CONTEXT_FILE"; const CONTEXT_TOOL = "weibei_context"; +const COURSE_MAP_TOOL = "weibei_course_map"; +const COURSE_SEARCH_TOOL = "weibei_course_search"; +const LEARNING_MEMORY_TOOL = "weibei_learning_memory"; +const LEARNING_UPDATE_TOOL = "weibei_learning_update"; const NOTE_PROPOSAL_TOOL = "weibei_note_proposal"; -const ALLOWED_TOOLS = new Set([CONTEXT_TOOL, NOTE_PROPOSAL_TOOL]); +const ALLOWED_TOOLS = new Set([ + CONTEXT_TOOL, + COURSE_MAP_TOOL, + COURSE_SEARCH_TOOL, + LEARNING_MEMORY_TOOL, + LEARNING_UPDATE_TOOL, + NOTE_PROPOSAL_TOOL, +]); const LIMITS = { - contextFileBytes: 512 * 1024, + contextFileBytes: 2 * 1024 * 1024, identifier: 256, title: 300, question: 4_000, @@ -19,6 +30,18 @@ const LIMITS = { recentMessages: 8, recentMessageText: 1_200, messageSource: 300, + courseCatalogItems: 500, + courseItems: 80, + courseRelations: 500, + courseMapPageItems: 60, + courseSearchText: 2_400, + courseHeadings: 12, + courseTags: 16, + courseLinkedItems: 24, + learningMemories: 48, + learningText: 500, + learningEvidence: 400, + sessionSummary: 2_000, proposalMarkdown: 24_000, proposalEvidenceItems: 16, proposalEvidenceText: 500, @@ -36,8 +59,84 @@ interface RecentMessageSnapshot { source?: string; } -interface ContextSnapshotV1 { - schemaVersion: 1; +interface CourseCatalogItemSnapshot { + id: string; + title: string; + subtitle: string; + kind: string; + role: "material" | "note"; + isCurrentMaterial: boolean; + isCurrentNote: boolean; + linkedItemIDs: string[]; + tags: string[]; +} + +interface CourseItemSnapshot extends CourseCatalogItemSnapshot { + headings: string[]; + searchText: string; + isTruncated: boolean; +} + +interface CourseRelationSnapshot { + noteItemID: string; + sourceItemID: string; +} + +interface CourseMapRelationSnapshot extends CourseRelationSnapshot { + noteTitle: string; + sourceTitle: string; +} + +interface CourseSnapshot { + title: string; + catalog: CourseCatalogItemSnapshot[]; + items: CourseItemSnapshot[]; + relations: CourseRelationSnapshot[]; + isTruncated: boolean; +} + +type LearningMemoryKind = "goal" | "understood" | "confusion" | "nextStep" | "preference"; +type LearningMemoryOrigin = "userStatement" | "agentInference" | "observed"; + +interface LearningMemoryEntrySnapshot { + id: string; + kind: LearningMemoryKind; + text: string; + evidence: string; + origin: LearningMemoryOrigin; + status: "active" | "resolved"; + sessionID?: string; + createdAt: number; + updatedAt: number; +} + +interface StudyLocationSnapshot { + itemID: string; + itemTitle: string; + locationTitle?: string; + pageIndex?: number; + lastStudiedAt: number; + visitCount: number; +} + +interface SessionSnapshot { + id: string; + title: string; + summary: string; + phase: string; + focusItemIDs: string[]; + turnCount: number; +} + +interface LearningSnapshot { + memoryRevision: number; + lastLocation?: StudyLocationSnapshot; + memories: LearningMemoryEntrySnapshot[]; + session?: SessionSnapshot; +} + +interface ContextSnapshotV2 { + schemaVersion: 2; requestID: string; contextRevision: string; purpose: string; @@ -48,13 +147,57 @@ interface ContextSnapshotV1 { note: SourceSnapshot; selection?: SourceSnapshot; recentMessages: RecentMessageSnapshot[]; + course: CourseSnapshot; + learning: LearningSnapshot; } interface ContextToolDetails { kind: "weibei_context"; - schemaVersion: 1; + schemaVersion: 2; + contextRevision: string; + snapshot: ContextSnapshotV2; +} + +interface CourseMapToolDetails { + kind: "course_map"; + contextRevision: string; + title: string; + offset: number; + limit: number; + total: number; + hasMore: boolean; + catalog: Array<CourseCatalogItemSnapshot & { jumpReference: string }>; + relations: CourseMapRelationSnapshot[]; + isTruncated: boolean; +} + +interface CourseSearchToolDetails { + kind: "course_search"; + contextRevision: string; + query: string; + results: CourseItemSnapshot[]; +} + +interface LearningMemoryToolDetails { + kind: "learning_memory"; contextRevision: string; - snapshot: ContextSnapshotV1; + memoryRevision: number; + learning: LearningSnapshot; +} + +interface LearningUpdateDetails { + kind: "learning_update"; + contextRevision: string; + memoryRevision: number; + sessionSummary?: string; + suggestedPhase?: string; + suggestedNext: string[]; + entries: Array<{ + kind: LearningMemoryKind; + text: string; + evidence: string; + origin: "userStatement" | "agentInference"; + }>; } interface NoteProposalDetails { @@ -89,6 +232,13 @@ function requireBoolean(value: unknown, field: string): boolean { return value; } +function requireNumber(value: unknown, field: string): number { + if (typeof value !== "number" || !Number.isFinite(value)) { + throw new Error(`魏碑上下文字段 ${field} 必须是数字`); + } + return value; +} + function requireIdentifier(value: unknown, field: string): string { const text = requireString(value, field); if (text.length === 0 || text.length > LIMITS.identifier) { @@ -146,7 +296,222 @@ function readRecentMessages(value: unknown): RecentMessageSnapshot[] { }); } -async function readCurrentSnapshot(): Promise<ContextSnapshotV1> { +function readStringArray( + value: unknown, + field: string, + maximumItems: number, + maximumCharacters: number, +): string[] { + if (!Array.isArray(value)) { + throw new Error(`魏碑上下文字段 ${field} 必须是数组`); + } + return value + .slice(0, maximumItems) + .map((item, index) => truncate(requireString(item, `${field}[${index}]`), maximumCharacters)); +} + +function readCourseCatalogItem( + item: Record<string, unknown>, + field: string, +): CourseCatalogItemSnapshot { + const role = requireString(item.role, `${field}.role`); + if (role !== "material" && role !== "note") { + throw new Error(`${field}.role 无效`); + } + return { + id: requireIdentifier(item.id, `${field}.id`), + title: truncate(requireString(item.title, `${field}.title`), LIMITS.title), + subtitle: truncate(requireString(item.subtitle, `${field}.subtitle`), LIMITS.title), + kind: requireIdentifier(item.kind, `${field}.kind`), + role, + isCurrentMaterial: requireBoolean(item.isCurrentMaterial, `${field}.isCurrentMaterial`), + isCurrentNote: requireBoolean(item.isCurrentNote, `${field}.isCurrentNote`), + linkedItemIDs: readStringArray( + item.linkedItemIDs, + `${field}.linkedItemIDs`, + LIMITS.courseLinkedItems, + LIMITS.identifier, + ), + tags: readStringArray(item.tags, `${field}.tags`, LIMITS.courseTags, 64), + }; +} + +function readCourse(value: unknown): CourseSnapshot { + const course = requireRecord(value, "course"); + if ( + !Array.isArray(course.catalog) || + !Array.isArray(course.items) || + !Array.isArray(course.relations) + ) { + throw new Error("魏碑课程快照缺少 catalog、items 或 relations"); + } + const catalog = course.catalog.slice(0, LIMITS.courseCatalogItems).map((entry, index) => { + const field = `course.catalog[${index}]`; + return readCourseCatalogItem(requireRecord(entry, field), field); + }); + const catalogIDs = new Set<string>(); + catalog.forEach((item, index) => { + if (catalogIDs.has(item.id)) { + throw new Error(`course.catalog[${index}].id 与已有 catalog ID 重复`); + } + catalogIDs.add(item.id); + }); + const items = course.items.slice(0, LIMITS.courseItems).map((entry, index) => { + const field = `course.items[${index}]`; + const item = requireRecord(entry, field); + const parsedItem = { + ...readCourseCatalogItem(item, field), + headings: readStringArray( + item.headings, + `${field}.headings`, + LIMITS.courseHeadings, + 200, + ), + searchText: truncate( + requireString(item.searchText, `${field}.searchText`), + LIMITS.courseSearchText, + ), + isTruncated: requireBoolean(item.isTruncated, `${field}.isTruncated`), + } satisfies CourseItemSnapshot; + if (!catalogIDs.has(parsedItem.id)) { + throw new Error(`${field}.id 在 catalog 中不存在`); + } + return parsedItem; + }); + const relations = course.relations + .slice(0, LIMITS.courseRelations) + .map((entry, index) => { + const relation = requireRecord(entry, `course.relations[${index}]`); + const parsedRelation = { + noteItemID: requireIdentifier( + relation.noteItemID, + `course.relations[${index}].noteItemID`, + ), + sourceItemID: requireIdentifier( + relation.sourceItemID, + `course.relations[${index}].sourceItemID`, + ), + }; + if ( + !catalogIDs.has(parsedRelation.noteItemID) || + !catalogIDs.has(parsedRelation.sourceItemID) + ) { + throw new Error(`course.relations[${index}] 引用了 catalog 中不存在的 ID`); + } + return parsedRelation; + }); + return { + title: truncate(requireString(course.title, "course.title"), LIMITS.title), + catalog, + items, + relations, + isTruncated: + requireBoolean(course.isTruncated, "course.isTruncated") || + course.catalog.length > catalog.length || + course.items.length > items.length || + course.relations.length > relations.length, + }; +} + +function readLearning(value: unknown): LearningSnapshot { + const learning = requireRecord(value, "learning"); + if (!Array.isArray(learning.memories)) { + throw new Error("魏碑学习记忆字段 memories 必须是数组"); + } + const allowedKinds = new Set<LearningMemoryKind>([ + "goal", + "understood", + "confusion", + "nextStep", + "preference", + ]); + const allowedOrigins = new Set<LearningMemoryOrigin>([ + "userStatement", + "agentInference", + "observed", + ]); + const memories = learning.memories.slice(0, LIMITS.learningMemories).map((entry, index) => { + const memory = requireRecord(entry, `learning.memories[${index}]`); + const kind = requireString(memory.kind, `learning.memories[${index}].kind`) as LearningMemoryKind; + const origin = requireString( + memory.origin, + `learning.memories[${index}].origin`, + ) as LearningMemoryOrigin; + const status = requireString(memory.status, `learning.memories[${index}].status`); + if (!allowedKinds.has(kind) || !allowedOrigins.has(origin) || !["active", "resolved"].includes(status)) { + throw new Error(`learning.memories[${index}] 枚举值无效`); + } + return { + id: requireIdentifier(memory.id, `learning.memories[${index}].id`), + kind, + text: truncate( + requireString(memory.text, `learning.memories[${index}].text`), + LIMITS.learningText, + ), + evidence: truncate( + requireString(memory.evidence, `learning.memories[${index}].evidence`), + LIMITS.learningEvidence, + ), + origin, + status: status as "active" | "resolved", + sessionID: + memory.sessionID === undefined || memory.sessionID === null + ? undefined + : requireIdentifier(memory.sessionID, `learning.memories[${index}].sessionID`), + createdAt: requireNumber(memory.createdAt, `learning.memories[${index}].createdAt`), + updatedAt: requireNumber(memory.updatedAt, `learning.memories[${index}].updatedAt`), + } satisfies LearningMemoryEntrySnapshot; + }); + + let lastLocation: StudyLocationSnapshot | undefined; + if (learning.lastLocation !== undefined && learning.lastLocation !== null) { + const location = requireRecord(learning.lastLocation, "learning.lastLocation"); + lastLocation = { + itemID: requireIdentifier(location.itemID, "learning.lastLocation.itemID"), + itemTitle: truncate(requireString(location.itemTitle, "learning.lastLocation.itemTitle"), LIMITS.title), + locationTitle: + location.locationTitle === undefined || location.locationTitle === null + ? undefined + : truncate(requireString(location.locationTitle, "learning.lastLocation.locationTitle"), LIMITS.title), + pageIndex: + location.pageIndex === undefined || location.pageIndex === null + ? undefined + : Math.max(0, Math.trunc(requireNumber(location.pageIndex, "learning.lastLocation.pageIndex"))), + lastStudiedAt: requireNumber(location.lastStudiedAt, "learning.lastLocation.lastStudiedAt"), + visitCount: Math.max(1, Math.trunc(requireNumber(location.visitCount, "learning.lastLocation.visitCount"))), + }; + } + + let session: SessionSnapshot | undefined; + if (learning.session !== undefined && learning.session !== null) { + const rawSession = requireRecord(learning.session, "learning.session"); + session = { + id: requireIdentifier(rawSession.id, "learning.session.id"), + title: truncate(requireString(rawSession.title, "learning.session.title"), LIMITS.title), + summary: truncate( + requireString(rawSession.summary, "learning.session.summary"), + LIMITS.sessionSummary, + ), + phase: requireIdentifier(rawSession.phase, "learning.session.phase"), + focusItemIDs: readStringArray( + rawSession.focusItemIDs, + "learning.session.focusItemIDs", + LIMITS.courseLinkedItems, + LIMITS.identifier, + ), + turnCount: Math.max(0, Math.trunc(requireNumber(rawSession.turnCount, "learning.session.turnCount"))), + }; + } + + return { + memoryRevision: Math.max(0, Math.trunc(requireNumber(learning.memoryRevision, "learning.memoryRevision"))), + lastLocation, + memories, + session, + }; +} + +async function readCurrentSnapshot(): Promise<ContextSnapshotV2> { const contextFile = process.env[CONTEXT_FILE_ENV]?.trim(); if (!contextFile) { throw new Error(`缺少环境变量 ${CONTEXT_FILE_ENV}`); @@ -171,12 +536,12 @@ async function readCurrentSnapshot(): Promise<ContextSnapshotV1> { } const envelope = requireRecord(parsed, "root"); - if (envelope.schemaVersion !== 1) { - throw new Error("魏碑上下文仅支持 schemaVersion=1"); + if (envelope.schemaVersion !== 2) { + throw new Error("魏碑上下文仅支持 schemaVersion=2"); } return { - schemaVersion: 1, + schemaVersion: 2, requestID: requireIdentifier(envelope.requestID, "requestID"), contextRevision: requireIdentifier(envelope.contextRevision, "contextRevision"), purpose: requireIdentifier(envelope.purpose, "purpose"), @@ -187,6 +552,8 @@ async function readCurrentSnapshot(): Promise<ContextSnapshotV1> { note: readSource(envelope.note, "note", LIMITS.noteText), selection: readOptionalSource(envelope.selection, "selection", LIMITS.selectionText), recentMessages: readRecentMessages(envelope.recentMessages), + course: readCourse(envelope.course), + learning: readLearning(envelope.learning), }; } @@ -195,16 +562,49 @@ function contextRevisionFromDetails(details: unknown): string | undefined { return typeof details.contextRevision === "string" ? details.contextRevision : undefined; } -function evidenceLabels(snapshot: ContextSnapshotV1): string[] { +function evidenceLabels(snapshot: ContextSnapshotV2): string[] { const labels = [`[笔记:${snapshot.note.title}]`]; if (snapshot.material) labels.push(`[材料:${snapshot.material.title}]`); if (snapshot.selection) labels.push(`[选区:${snapshot.selection.title}]`); return labels; } +function courseSearchTerms(query: string): string[] { + const lower = query.toLowerCase(); + const terms = lower.match(/[\p{L}\p{N}_-]{2,}/gu) ?? []; + const chineseRuns = lower.match(/[\u4e00-\u9fff]{2,}/g) ?? []; + for (const run of chineseRuns) { + if (run.length <= 20) terms.push(run); + for (let index = 0; index < run.length - 1; index += 1) { + terms.push(run.slice(index, index + 2)); + } + } + return Array.from(new Set(terms)).sort((left, right) => right.length - left.length); +} + +function searchCourse(course: CourseSnapshot, query: string, limit: number): CourseItemSnapshot[] { + const terms = courseSearchTerms(query); + return course.items + .map((item, index) => { + const title = `${item.title} ${item.subtitle} ${item.headings.join(" ")} ${item.tags.join(" ")}`.toLowerCase(); + const body = item.searchText.toLowerCase(); + const score = terms.reduce((total, term) => { + const titleMatches = title.split(term).length - 1; + const bodyMatches = Math.min(body.split(term).length - 1, 8); + return total + titleMatches * 8 + bodyMatches; + }, item.isCurrentMaterial || item.isCurrentNote ? 1 : 0); + return { item, index, score }; + }) + .filter((entry) => entry.score > 0 || terms.length === 0) + .sort((left, right) => right.score - left.score || left.index - right.index) + .slice(0, limit) + .map((entry) => entry.item); +} + export default function weibeiExtension(pi: ExtensionAPI) { let requiredContextRevision: string | undefined; let lastReadContextRevision: string | undefined; + let lastReadMemoryRevision: number | undefined; pi.registerTool({ name: CONTEXT_TOOL, @@ -221,7 +621,7 @@ export default function weibeiExtension(pi: ExtensionAPI) { const details: ContextToolDetails = { kind: "weibei_context", - schemaVersion: 1, + schemaVersion: 2, contextRevision: snapshot.contextRevision, snapshot, }; @@ -233,7 +633,23 @@ export default function weibeiExtension(pi: ExtensionAPI) { text: JSON.stringify( { contextRevision: snapshot.contextRevision, - snapshot, + material: snapshot.material, + note: snapshot.note, + selection: snapshot.selection, + recentMessages: snapshot.recentMessages, + course: { + title: snapshot.course.title, + catalogCount: snapshot.course.catalog.length, + searchCandidateCount: snapshot.course.items.length, + relationCount: snapshot.course.relations.length, + isTruncated: snapshot.course.isTruncated, + }, + learning: { + revision: snapshot.learning.memoryRevision, + hasLastLocation: snapshot.learning.lastLocation !== undefined, + memoryCount: snapshot.learning.memories.length, + session: snapshot.learning.session, + }, }, null, 2, @@ -245,6 +661,263 @@ export default function weibeiExtension(pi: ExtensionAPI) { }, }); + pi.registerTool({ + name: COURSE_MAP_TOOL, + label: "查看课程地图", + description: + "分页返回当前课程的材料、笔记、标签与长期关联。只有需要跨文件理解或导航时才调用。", + promptSnippet: "查看课程里有哪些材料、笔记和已确认关联", + parameters: Type.Object( + { + offset: Type.Optional(Type.Integer({ minimum: 0 })), + limit: Type.Optional( + Type.Integer({ minimum: 1, maximum: LIMITS.courseMapPageItems }), + ), + }, + { additionalProperties: false }, + ), + executionMode: "sequential", + async execute(_toolCallId, params) { + const snapshot = await readCurrentSnapshot(); + if (lastReadContextRevision !== snapshot.contextRevision) { + throw new Error(`必须先调用 ${CONTEXT_TOOL} 读取本轮当前上下文`); + } + const offset = params.offset ?? 0; + const limit = params.limit ?? 40; + const catalog = snapshot.course.catalog.slice(offset, offset + limit).map((item) => ({ + ...item, + jumpReference: `来源:${item.title}`, + })); + const pageCatalogIDs = new Set(catalog.map((item) => item.id)); + const catalogByID = new Map( + snapshot.course.catalog.map((item) => [item.id, item] as const), + ); + const relations = snapshot.course.relations + .filter( + (relation) => + pageCatalogIDs.has(relation.noteItemID) || + pageCatalogIDs.has(relation.sourceItemID), + ) + .map((relation) => ({ + ...relation, + noteTitle: catalogByID.get(relation.noteItemID)!.title, + sourceTitle: catalogByID.get(relation.sourceItemID)!.title, + })); + const total = snapshot.course.catalog.length; + const page = { + title: snapshot.course.title, + offset, + limit, + total, + hasMore: offset + catalog.length < total, + catalog, + relations, + isTruncated: snapshot.course.isTruncated, + }; + const details: CourseMapToolDetails = { + kind: "course_map", + contextRevision: snapshot.contextRevision, + ...page, + }; + return { + content: [{ type: "text", text: JSON.stringify(page, null, 2) }], + details, + }; + }, + }); + + pi.registerTool({ + name: COURSE_SEARCH_TOOL, + label: "搜索课程关联", + description: + "在魏碑已建立的课程索引片段中搜索相关材料与笔记,返回可用于说明关联和跳转的精确标题。", + promptSnippet: "按概念或学习问题搜索课程文件", + parameters: Type.Object( + { + query: Type.String({ minLength: 1, maxLength: 500 }), + limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 8 })), + }, + { additionalProperties: false }, + ), + executionMode: "sequential", + async execute(_toolCallId, params) { + const snapshot = await readCurrentSnapshot(); + if (lastReadContextRevision !== snapshot.contextRevision) { + throw new Error(`必须先调用 ${CONTEXT_TOOL} 读取本轮当前上下文`); + } + const query = params.query.trim(); + const results = searchCourse(snapshot.course, query, params.limit ?? 5); + const details: CourseSearchToolDetails = { + kind: "course_search", + contextRevision: snapshot.contextRevision, + query, + results, + }; + return { + content: [ + { + type: "text", + text: JSON.stringify( + results.map((item) => ({ + ...item, + jumpReference: `来源:${item.title}`, + })), + null, + 2, + ), + }, + ], + details, + }; + }, + }); + + pi.registerTool({ + name: LEARNING_MEMORY_TOOL, + label: "读取学习记忆", + description: + "读取用户上次学到的位置、当前会话摘要、学习目标、理解、困惑和下一步。记忆不是课程事实证据。", + promptSnippet: "读取用户学习历史与当前会话状态", + parameters: Type.Object({}, { additionalProperties: false }), + executionMode: "sequential", + async execute() { + const snapshot = await readCurrentSnapshot(); + if (lastReadContextRevision !== snapshot.contextRevision) { + throw new Error(`必须先调用 ${CONTEXT_TOOL} 读取本轮当前上下文`); + } + lastReadMemoryRevision = snapshot.learning.memoryRevision; + const details: LearningMemoryToolDetails = { + kind: "learning_memory", + contextRevision: snapshot.contextRevision, + memoryRevision: snapshot.learning.memoryRevision, + learning: snapshot.learning, + }; + return { + content: [{ type: "text", text: JSON.stringify(snapshot.learning, null, 2) }], + details, + }; + }, + }); + + pi.registerTool({ + name: LEARNING_UPDATE_TOOL, + label: "提出学习状态更新", + description: + "向魏碑提交带依据的学习记忆和会话状态建议。它不能修改材料或笔记。", + promptSnippet: "仅在出现可长期复用的目标、理解、困惑或下一步时提交更新", + parameters: Type.Object( + { + contextRevision: Type.String({ minLength: 1, maxLength: LIMITS.identifier }), + memoryRevision: Type.Integer({ minimum: 0 }), + sessionSummary: Type.Optional( + Type.String({ minLength: 1, maxLength: LIMITS.sessionSummary }), + ), + suggestedPhase: Type.Optional( + Type.Union( + ["orient", "explore", "closeRead", "note", "recall", "consolidate", "plan"].map( + (value) => Type.Literal(value), + ), + ), + ), + suggestedNext: Type.Array(Type.String({ minLength: 1, maxLength: 300 }), { + maxItems: 3, + }), + entries: Type.Array( + Type.Object( + { + kind: Type.Union( + ["goal", "understood", "confusion", "nextStep", "preference"].map((value) => + Type.Literal(value), + ), + ), + text: Type.String({ minLength: 1, maxLength: LIMITS.learningText }), + evidence: Type.String({ minLength: 1, maxLength: LIMITS.learningEvidence }), + origin: Type.Union([Type.Literal("userStatement"), Type.Literal("agentInference")]), + }, + { additionalProperties: false }, + ), + { maxItems: 12 }, + ), + }, + { additionalProperties: false }, + ), + executionMode: "sequential", + async execute(_toolCallId, params) { + const current = await readCurrentSnapshot(); + if ( + lastReadContextRevision !== current.contextRevision || + lastReadMemoryRevision !== current.learning.memoryRevision + ) { + throw new Error( + `学习状态已变化;请重新调用 ${CONTEXT_TOOL} 和 ${LEARNING_MEMORY_TOOL}`, + ); + } + if ( + params.contextRevision !== current.contextRevision || + params.memoryRevision !== current.learning.memoryRevision + ) { + throw new Error("学习状态建议的上下文或记忆修订号不匹配"); + } + const entries = params.entries.map((entry) => ({ + kind: entry.kind as LearningMemoryKind, + text: entry.text.trim(), + evidence: entry.evidence.trim(), + origin: entry.origin as "userStatement" | "agentInference", + })); + const allowedEvidencePrefixes = [ + "[用户:本轮]", + "[会话:当前]", + ...evidenceLabels(current), + ...current.course.catalog.map((item) => + item.role === "note" ? `[笔记:${item.title}]` : `[材料:${item.title}]`, + ), + ]; + if ( + entries.some( + (entry) => + !entry.text || + !entry.evidence || + !allowedEvidencePrefixes.some((prefix) => entry.evidence.startsWith(prefix)), + ) + ) { + throw new Error("每条学习记忆都必须携带当前用户、会话或来源依据标签"); + } + if ( + entries.some( + (entry) => + entry.origin === "userStatement" && !entry.evidence.startsWith("[用户:本轮]"), + ) + ) { + throw new Error("用户陈述型记忆必须直接依据本轮用户原话"); + } + const suggestedNext = params.suggestedNext + .map((item) => item.trim()) + .filter((item) => item.length > 0); + const sessionSummary = params.sessionSummary?.trim(); + if (!sessionSummary && !params.suggestedPhase && suggestedNext.length === 0 && entries.length === 0) { + throw new Error("学习状态建议不能为空"); + } + const details: LearningUpdateDetails = { + kind: "learning_update", + contextRevision: current.contextRevision, + memoryRevision: current.learning.memoryRevision, + sessionSummary, + suggestedPhase: params.suggestedPhase, + suggestedNext, + entries, + }; + return { + content: [ + { + type: "text", + text: "学习状态建议已校验并交给魏碑;这不会修改课程材料或用户笔记。", + }, + ], + details, + }; + }, + }); + pi.registerTool({ name: NOTE_PROPOSAL_TOOL, label: "提出笔记建议", @@ -318,6 +991,7 @@ export default function weibeiExtension(pi: ExtensionAPI) { pi.on("before_agent_start", async (event) => { lastReadContextRevision = undefined; + lastReadMemoryRevision = undefined; let purpose = "unavailable"; let revision = "unavailable"; @@ -335,7 +1009,8 @@ export default function weibeiExtension(pi: ExtensionAPI) { `purpose: ${JSON.stringify(purpose)}`, `contextRevision: ${JSON.stringify(revision)}`, "本轮第一次工具调用必须是 weibei_context。调用成功前不得回答事实问题,也不得提出笔记建议。", - "只使用该工具本轮返回的当前材料、当前笔记和当前选区;读取失败时只能说明当前上下文未确认。", + "当前材料、笔记和选区是本轮直接证据;课程关联需要读课程地图或搜索;学习历史需要读学习记忆。", + "学习记忆只能说明用户的学习状态,不能作为课程事实证据。", "</weibei_turn>", ].join("\n"); @@ -346,12 +1021,12 @@ export default function weibeiExtension(pi: ExtensionAPI) { if (!ALLOWED_TOOLS.has(event.toolName)) { return { block: true, - reason: `魏碑 Agent 只允许调用 ${CONTEXT_TOOL} 与 ${NOTE_PROPOSAL_TOOL}`, + reason: `魏碑 Agent 只允许调用受控的上下文、课程、记忆与笔记建议工具`, }; } if ( - event.toolName === NOTE_PROPOSAL_TOOL && + event.toolName !== CONTEXT_TOOL && (!requiredContextRevision || !lastReadContextRevision || lastReadContextRevision !== requiredContextRevision) @@ -361,6 +1036,13 @@ export default function weibeiExtension(pi: ExtensionAPI) { reason: `必须先调用 ${CONTEXT_TOOL} 读取本轮当前上下文`, }; } + + if (event.toolName === LEARNING_UPDATE_TOOL && lastReadMemoryRevision === undefined) { + return { + block: true, + reason: `提出学习状态更新前必须调用 ${LEARNING_MEMORY_TOOL}`, + }; + } }); pi.on("context", async (event) => { diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md index 64d4b8614..32d83a6ea 100644 --- a/Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-close-reading/SKILL.md @@ -1,8 +1,8 @@ --- name: weibei-close-reading description: 对当前材料、当前笔记或当前选区做细读、解释、论证拆解、概念辨析和证据核对。用户要求解释一段内容、比较观点、总结论证或追问“这段是什么意思”时使用。 -compatibility: 需要 PI 0.80.2 与魏碑扩展提供的 weibei_context 工具。 -allowed-tools: weibei_context +compatibility: 需要 PI 0.80.2 与魏碑扩展提供的上下文和课程搜索工具。 +allowed-tools: weibei_context weibei_course_map weibei_course_search --- # 魏碑细读 @@ -25,13 +25,13 @@ allowed-tools: weibei_context ## 工具用法 -- 只调用 `weibei_context`。 +- 必须调用 `weibei_context`;只有用户要求跨文件比较或查关联时,才调用课程地图或搜索。 - 不调用 `weibei_note_proposal`;细读回答本身不是笔记写回。 - 如果工具结果的修订号失效,重新调用 `weibei_context`,不得继续使用旧结果。 ## 证据规则 -- 事实依据只来自本轮快照中的 `material`、`note` 和 `selection`。 +- 当前文件事实来自本轮快照中的 `material`、`note` 和 `selection`;跨文件事实只能来自本轮课程搜索返回的索引片段。 - `isTruncated: true` 表示只拿到来源片段,不得把片段当成完整材料或完整笔记。 - `question` 与 `recentMessages` 只能帮助理解意图,不能作为事实证据。 - 引用使用 `[选区:标题]`、`[材料:标题]` 或 `[笔记:标题]`。 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md new file mode 100644 index 000000000..095b1f2cd --- /dev/null +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md @@ -0,0 +1,28 @@ +--- +name: weibei-course-wayfinding +description: 在当前课程的多份材料与笔记中查找知识关联、前置与复习路径,并给出可点击的来源跳转。 +compatibility: 需要 PI 0.80.2 与魏碑扩展提供的课程地图、课程搜索和学习记忆工具。 +allowed-tools: weibei_context weibei_course_map weibei_course_search weibei_learning_memory weibei_learning_update +--- + +# 魏碑课程寻路 + +## 工作流 + +1. 先调用 `weibei_context`,确认当前材料、选区、笔记和用户问题。 +2. 调用 `weibei_course_map`,分页了解课程里有哪些材料、笔记和已确认的笔记-材料关联;目录标题本身不是内容证据。 +3. 把用户的问题、当前选区或核心概念组成简短查询,调用 `weibei_course_search`。如果用户问“下一步学什么”,再调用 `weibei_learning_memory`。 +4. 对每个候选项分别说明关联类型:同一概念、前置、解释、例子、对比、笔记归纳或待补证据。 +5. 只推荐工具真实返回的文件;索引片段被截断时,不声称已检查整本书。 + +## 输出 + +不强制固定篇幅。有多个有效去处时,使用简短的“关联”段落: + +```markdown +## 关联 +- **关联原因**:这份材料如何帮助当前问题。[材料:精确标题] + 来源:精确标题 +``` + +`\[材料:标题\]` 或 `\[笔记:标题\]` 用于证据;单独的 `来源:标题` 用于魏碑点击跳转。 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md index 765bee1a7..bee05f56d 100644 --- a/Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-note-making/SKILL.md @@ -17,7 +17,7 @@ allowed-tools: weibei_context weibei_note_proposal ## 工作流 1. 第一项动作必须调用 `weibei_context`,读取当前快照和 `contextRevision`。 -2. 根据用户要求确定建议范围;能沿用当前笔记标题、层级和结构时优先沿用。 +2. 根据用户要求确定建议范围;能沿用当前笔记标题、层级和结构时优先沿用。跨文件内容先让用户跳转并确认目标资料,本技能不把未打开的课程材料混入写回建议。 3. 只依据当前材料、当前笔记和当前选区起草 Markdown。保留重要原意,不把推断写成原文事实。 4. 为建议整理 `evidence`:每条写明来源标签和它支持的笔记内容。 5. 必须调用 `weibei_note_proposal`,传入完整 `markdown`、非空 `evidence` 和刚读取的 `contextRevision`。 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md index ecd287c2b..043342a2c 100644 --- a/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md @@ -1,8 +1,8 @@ --- name: weibei-recall-practice description: 根据当前材料、当前笔记或当前选区生成主动回忆、自测题、答案核对和薄弱点反馈。用户要求出题、考我、复习、自测或检查掌握程度时使用。 -compatibility: 需要 PI 0.80.2 与魏碑扩展提供的 weibei_context 工具。 -allowed-tools: weibei_context +compatibility: 需要 PI 0.80.2 与魏碑扩展提供的上下文、学习记忆和学习状态建议工具。 +allowed-tools: weibei_context weibei_learning_memory weibei_learning_update --- # 魏碑回忆练习 @@ -17,15 +17,17 @@ allowed-tools: weibei_context ## 工作流 1. 第一项动作必须调用 `weibei_context`,取得当前快照和 `contextRevision`。 -2. 明确练习范围。用户指向选区时只考选区;否则按要求使用当前材料和当前笔记。 -3. 只设计能由当前证据明确作答的问题。默认生成 5 题;用户指定数量或逐题模式时服从用户要求。 -4. 题目覆盖回忆、解释、比较或基于原文的简单应用,但不得要求当前证据之外的知识。 -5. 为每个标准答案准备来源标签。证据无法给出唯一答案的题目直接删除,不得凭常识补答案。 -6. 用户提交答案后,重新读取当前上下文,再给出“正确 / 部分正确 / 当前证据无法确认”的判断与依据。 +2. 调用 `weibei_learning_memory`,优先看当前仍有效的困惑和待复习项。 +3. 明确练习范围。用户指向选区时只考选区;否则按要求使用当前材料和当前笔记。 +4. 只设计能由当前证据明确作答的问题。默认生成 5 题;用户指定数量或逐题模式时服从用户要求。 +5. 题目覆盖回忆、解释、比较或基于原文的简单应用,但不得要求当前证据之外的知识。 +6. 为每个标准答案准备来源标签。证据无法给出唯一答案的题目直接删除,不得凭常识补答案。 +7. 用户提交答案后,重新读取当前上下文,再给出“正确 / 部分正确 / 当前证据无法确认”的判断与依据。只有表现足以支持长期判断时,才调用 `weibei_learning_update`记录理解或困惑。 ## 工具用法 -- 只调用 `weibei_context`。 +- 先调用 `weibei_context`,再调用 `weibei_learning_memory`。 +- 只在用户实际作答并产生可复用判断时调用 `weibei_learning_update`。 - 不调用 `weibei_note_proposal`;练习与反馈不得被描述为笔记写回。 - 修订号变化后重新生成或重新核对,不得沿用旧答案依据。 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md new file mode 100644 index 000000000..66d983668 --- /dev/null +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md @@ -0,0 +1,33 @@ +--- +name: weibei-study-companion +description: 作为魏碑的长期学习伙伴,结合当前材料、整个课程、学习记忆和当前会话,帮用户理解、继续学习并选择下一步。 +compatibility: 需要 PI 0.80.2 与魏碑扩展提供的上下文、课程、记忆和笔记建议工具。 +allowed-tools: weibei_context weibei_course_map weibei_course_search weibei_learning_memory weibei_learning_update weibei_note_proposal +--- + +# 魏碑学习伙伴 + +## 身份 + +你是一个长期陪伴用户学习当前课程的 Agent,不是一次性问答机器。你需要知道用户正在看什么、上次停在哪里、已经理解什么、还在困惑什么,但不得把学习记忆当作课程事实。 + +## 每轮骨架 + +1. 第一项动作必须调用 `weibei_context`。 +2. 第二项动作调用 `weibei_learning_memory`,了解上次位置、当前会话和长期学习状态。 +3. 只有问题涉及关联、前置、其他书或笔记、下一步去哪里学时,才调用 `weibei_course_map` 或 `weibei_course_search`。 +4. 根据用户当下意图回答。不强制按固定阶段讲解,用户可以随时跳到细读、笔记、自测或规划。 +5. 只有本轮产生可长期复用的目标、理解、困惑、偏好或下一步时,才调用 `weibei_learning_update`。普通寒暄、一次性问题和 Agent 自己的推测不应进入长期记忆。 + +## 记忆规则 + +- `lastLocation` 是魏碑观测到的阅读位置,可用 `[学习记录:上次位置]` 标注。 +- 目标、困惑和偏好是用户状态,可用 `[学习记忆:用户状态]` 标注。 +- 来自用户本轮的记忆依据以 `[用户:本轮]` 开头;基于当前会话表现的判断以 `[会话:当前]` 开头。 +- 不得仅因为用户读过一页或 Agent 解释过一次,就标记为“已理解”。 + +## 回答方式 + +- 先直接回答用户现在的问题,再在有帮助时给 1-3 个下一步。 +- 需要跳转时,每个建议说清“为什么相关”,并单独输出 `来源:精确标题`;PDF 有页码时使用 `来源:精确标题,第 N 页`。 +- 当前上下文不足时明确说未确认,不用常识补齐课程内容。 diff --git a/Sources/WeiBeiCore/AgentResources/system.md b/Sources/WeiBeiCore/AgentResources/system.md index 4c579c0d8..c75684b72 100644 --- a/Sources/WeiBeiCore/AgentResources/system.md +++ b/Sources/WeiBeiCore/AgentResources/system.md @@ -5,11 +5,24 @@ ## 事实边界 1. 每轮必须先调用 `weibei_context`,读取当前材料、当前笔记、当前选区和 `contextRevision`。 -2. 只能把该工具本轮返回的当前材料、当前笔记和当前选区作为事实依据。用户问题与近期对话只用于理解意图,不是事实证据。 +2. 当前文件的事实只能来自 `weibei_context` 返回的材料、笔记和选区;跨文件事实只能来自本轮 `weibei_course_search` 返回的索引片段。用户问题、近期对话、目录文件名和学习记忆只用于理解意图,不是课程事实证据。 3. 不得用常识、记忆、网络知识或旧工具结果补全缺失事实。当前证据不足时,明确写“当前上下文未确认”,并指出缺少哪一项证据。 4. 上下文修订号变化后,旧修订下的摘录、判断和建议全部失效;重新读取上下文再继续。 5. 任一来源的 `isTruncated` 为 `true` 时,只能判断已返回的片段;被截断部分一律视为“当前上下文未确认”。 +## 课程地图 + +1. “当前课程”包含多份材料、多份笔记与它们的长期关联,不等于当前打开的文件。 +2. `weibei_course_map` 用于确认目录里有哪些文件和已确认关联;`weibei_course_search` 用于取得与本轮问题相关的知识片段。不得把只有标题、没有索引片段的目录项当成内容证据。 +3. 建议用户跳转时,说清关联原因,并输出单独的 `来源:精确标题`;PDF 有可确认页码时可输出 `来源:精确标题,第 N 页`。 + +## 学习记忆与会话 + +1. 魏碑持有长期会话、阅读位置和学习记忆;PI 的临时运行会话不是长期记忆。 +2. `StudyLocation` 是应用观测到的阅读事实。目标、理解、困惑、下一步和偏好是用户学习状态,不是课程内容证据。 +3. 只有出现可长期复用的新信息时才调用 `weibei_learning_update`。更新必须同时匹配 `contextRevision` 与 `memoryRevision`,并携带当前用户、会话或来源依据。 +4. 学习阶段只是建议骨架。用户可以随时跳过、回退或改变阶段。 + ## 回答规则 1. 结论先行,再给依据和必要的推理过程。 @@ -29,4 +42,4 @@ ## 工具边界 -只允许使用 `weibei_context` 与 `weibei_note_proposal`。不得尝试调用读取文件、终端命令、编辑、写入、网络访问或其他工具。 +只允许使用魏碑提供的上下文、课程地图、课程搜索、学习记忆、学习状态建议与笔记建议工具。不得尝试调用读取文件、终端命令、编辑、写入、网络访问或其他工具。 diff --git a/Sources/WeiBeiCore/CourseKnowledgeIndex.swift b/Sources/WeiBeiCore/CourseKnowledgeIndex.swift new file mode 100644 index 000000000..9e32e6b17 --- /dev/null +++ b/Sources/WeiBeiCore/CourseKnowledgeIndex.swift @@ -0,0 +1,241 @@ +import Foundation + +public struct CourseKnowledgeSource: Sendable { + public var id: String + public var title: String + public var subtitle: String + public var kind: String + public var role: String + public var text: String + + public init( + id: String, + title: String, + subtitle: String, + kind: String, + role: String, + text: String + ) { + self.id = id + self.title = title + self.subtitle = subtitle + self.kind = kind + self.role = role + self.text = text + } +} + +public enum CourseKnowledgeIndex { + private struct RankedSource { + var index: Int + var source: CourseKnowledgeSource + var score: Int + } + + public static func build( + title: String, + sources: [CourseKnowledgeSource], + links: [NoteSourceLink], + query: String, + currentMaterialID: String?, + currentNoteID: String? + ) -> StudyAgentCourseContext { + let maximumCatalogItems = 500 + let maximumSearchItems = 80 + let maximumRelations = 500 + let includedSources = Array(sources.prefix(maximumCatalogItems)) + let includedIDs = Set(includedSources.map(\.id)) + let validLinks = links.filter { + includedIDs.contains($0.noteItemID) && includedIDs.contains($0.sourceItemID) + } + let linkedIDsByItem = validLinks.reduce(into: [String: Set<String>]()) { result, link in + result[link.noteItemID, default: []].insert(link.sourceItemID) + result[link.sourceItemID, default: []].insert(link.noteItemID) + } + let terms = Array(searchTerms(in: query).prefix(32)) + let currentIDs = Set([currentMaterialID, currentNoteID].compactMap { $0 }) + let directlyLinkedIDs = currentIDs.reduce(into: Set<String>()) { result, itemID in + result.formUnion(linkedIDsByItem[itemID] ?? []) + } + var rankedSources: [RankedSource] = [] + rankedSources.reserveCapacity(includedSources.count) + for (index, source) in includedSources.enumerated() { + let score = relevanceScore( + source: source, + terms: terms, + isCurrent: currentIDs.contains(source.id), + isDirectlyLinked: directlyLinkedIDs.contains(source.id) + ) + rankedSources.append(RankedSource(index: index, source: source, score: score)) + } + rankedSources.sort { lhs, rhs in + lhs.score == rhs.score ? lhs.index < rhs.index : lhs.score > rhs.score + } + let searchSources = rankedSources.prefix(maximumSearchItems).map { $0.source } + + let catalog = includedSources.map { source in + StudyAgentCourseCatalogItem( + id: source.id, + title: source.title, + subtitle: source.subtitle, + kind: source.kind, + role: source.role, + isCurrentMaterial: source.id == currentMaterialID, + isCurrentNote: source.id == currentNoteID, + linkedItemIDs: (linkedIDsByItem[source.id] ?? []).sorted(), + tags: source.role == "note" ? MarkdownTagSearch.tags(in: source.text) : [] + ) + } + let items = searchSources.map { source in + let excerpt = relevantExcerpt(in: source.text, terms: terms) + return StudyAgentCourseItem( + id: source.id, + title: source.title, + subtitle: source.subtitle, + kind: source.kind, + role: source.role, + isCurrentMaterial: source.id == currentMaterialID, + isCurrentNote: source.id == currentNoteID, + linkedItemIDs: (linkedIDsByItem[source.id] ?? []).sorted(), + headings: headings(in: source.text), + tags: source.role == "note" ? MarkdownTagSearch.tags(in: source.text) : [], + searchText: excerpt.text, + isTruncated: excerpt.isTruncated + ) + } + let relations = validLinks.prefix(maximumRelations).map { + StudyAgentCourseRelation(noteItemID: $0.noteItemID, sourceItemID: $0.sourceItemID) + } + return StudyAgentCourseContext( + title: title, + catalog: catalog, + items: items, + relations: relations, + isTruncated: sources.count > includedSources.count || validLinks.count > relations.count + ) + } + + private static func relevanceScore( + source: CourseKnowledgeSource, + terms: [String], + isCurrent: Bool, + isDirectlyLinked: Bool + ) -> Int { + let titleTerms = Set(searchTerms(in: "\(source.title) \(source.subtitle)")) + let bodyTerms = Set(searchTerms(in: source.text)) + var score = isCurrent ? 100_000 : 0 + if isDirectlyLinked { score += 50_000 } + for term in terms { + if titleTerms.contains(term) { score += 40 } + if bodyTerms.contains(term) { score += 2 } + } + return score + } + + private static func relevantExcerpt(in text: String, terms: [String]) -> (text: String, isTruncated: Bool) { + let maximumCharacters = 2_400 + let sections = text + .components(separatedBy: #"\n\s*\n"#, options: .regularExpression) + .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) } + .filter { !$0.isEmpty } + guard !sections.isEmpty else { return ("", false) } + + let ranked = sections.enumerated().map { index, section in + let normalized = section.lowercased() + let score = terms.reduce(0) { result, term in + result + normalized.components(separatedBy: term).count - 1 + } + return (index: index, section: section, score: score) + } + let selected: [String] + if ranked.contains(where: { $0.score > 0 }) { + selected = ranked + .filter { $0.score > 0 } + .sorted { lhs, rhs in + lhs.score == rhs.score ? lhs.index < rhs.index : lhs.score > rhs.score + } + .prefix(4) + .sorted { $0.index < $1.index } + .map(\.section) + } else { + selected = Array(sections.prefix(3)) + } + + let joined = selected.joined(separator: "\n\n") + let excerpt = String(joined.prefix(maximumCharacters)) + return (excerpt, text.count > excerpt.count || joined.count > excerpt.count) + } + + private static func headings(in text: String) -> [String] { + var result: [String] = [] + for rawLine in text.components(separatedBy: .newlines) { + let line = rawLine.trimmingCharacters(in: .whitespacesAndNewlines) + guard !line.isEmpty else { continue } + let heading: String? + if line.hasPrefix("#") { + heading = line.trimmingCharacters(in: CharacterSet(charactersIn: "# ")) + } else if line.range(of: #"^第\s*\d+\s*页$"#, options: .regularExpression) != nil { + heading = line + } else if line.count <= 80, + line.range(of: #"^(?:第.+[章节讲部分]|Chapter\s+\d+|Section\s+\d+)"#, options: [.regularExpression, .caseInsensitive]) != nil { + heading = line + } else { + heading = nil + } + if let heading, !heading.isEmpty, !result.contains(heading) { + result.append(String(heading.prefix(200))) + if result.count == 12 { break } + } + } + return result + } + + private static func searchTerms(in query: String) -> [String] { + let lower = query.lowercased() + var terms = lower + .components(separatedBy: CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "_")).inverted) + .filter { $0.count >= 2 } + + var current = "" + var runs: [String] = [] + for scalar in lower.unicodeScalars { + if (0x4E00...0x9FFF).contains(Int(scalar.value)) { + current.unicodeScalars.append(scalar) + } else if !current.isEmpty { + runs.append(current) + current = "" + } + } + if !current.isEmpty { runs.append(current) } + for run in runs { + if run.count <= 20 { terms.append(run) } + let characters = Array(run) + if characters.count >= 2 { + for index in 0..<(characters.count - 1) { + terms.append(String(characters[index...index + 1])) + } + } + } + return Array(Set(terms)).sorted { $0.count > $1.count } + } +} + +private extension String { + func components(separatedBy pattern: String, options: NSString.CompareOptions) -> [String] { + guard let regex = try? NSRegularExpression(pattern: pattern) else { return [self] } + let range = NSRange(startIndex..<endIndex, in: self) + var result: [String] = [] + var cursor = range.location + for match in regex.matches(in: self, range: range) { + let length = match.range.location - cursor + if let swiftRange = Range(NSRange(location: cursor, length: length), in: self) { + result.append(String(self[swiftRange])) + } + cursor = match.range.location + match.range.length + } + if let swiftRange = Range(NSRange(location: cursor, length: range.location + range.length - cursor), in: self) { + result.append(String(self[swiftRange])) + } + return result + } +} diff --git a/Sources/WeiBeiCore/LearningModels.swift b/Sources/WeiBeiCore/LearningModels.swift new file mode 100644 index 000000000..f18b115a5 --- /dev/null +++ b/Sources/WeiBeiCore/LearningModels.swift @@ -0,0 +1,155 @@ +import Foundation + +public struct NoteSourceLink: Identifiable, Codable, Hashable, Sendable { + public var id: UUID + public var noteItemID: String + public var sourceItemID: String + public var createdAt: Date + + public init( + id: UUID = UUID(), + noteItemID: String, + sourceItemID: String, + createdAt: Date = Date() + ) { + self.id = id + self.noteItemID = noteItemID + self.sourceItemID = sourceItemID + self.createdAt = createdAt + } +} + +public struct StudyLocation: Codable, Hashable, Sendable { + public var itemID: String + public var itemTitle: String + public var locationTitle: String? + public var pageIndex: Int? + public var lastStudiedAt: Date + public var visitCount: Int + + public init( + itemID: String, + itemTitle: String, + locationTitle: String? = nil, + pageIndex: Int? = nil, + lastStudiedAt: Date = Date(), + visitCount: Int = 1 + ) { + self.itemID = itemID + self.itemTitle = itemTitle + self.locationTitle = locationTitle + self.pageIndex = pageIndex + self.lastStudiedAt = lastStudiedAt + self.visitCount = visitCount + } +} + +public enum LearningMemoryKind: String, Codable, CaseIterable, Hashable, Sendable { + case goal + case understood + case confusion + case nextStep + case preference +} + +public enum LearningMemoryOrigin: String, Codable, Hashable, Sendable { + case userStatement + case agentInference + case observed +} + +public enum LearningMemoryStatus: String, Codable, Hashable, Sendable { + case active + case resolved +} + +public struct LearningMemoryEntry: Identifiable, Codable, Hashable, Sendable { + public var id: UUID + public var kind: LearningMemoryKind + public var text: String + public var evidence: String + public var origin: LearningMemoryOrigin + public var status: LearningMemoryStatus + public var sessionID: UUID? + public var createdAt: Date + public var updatedAt: Date + + public init( + id: UUID = UUID(), + kind: LearningMemoryKind, + text: String, + evidence: String, + origin: LearningMemoryOrigin, + status: LearningMemoryStatus = .active, + sessionID: UUID? = nil, + createdAt: Date = Date(), + updatedAt: Date = Date() + ) { + self.id = id + self.kind = kind + self.text = text + self.evidence = evidence + self.origin = origin + self.status = status + self.sessionID = sessionID + self.createdAt = createdAt + self.updatedAt = updatedAt + } +} + +public enum StudyPhase: String, Codable, CaseIterable, Hashable, Sendable { + case orient + case explore + case closeRead + case note + case recall + case consolidate + case plan +} + +public struct StudyFlowState: Codable, Hashable, Sendable { + public var phase: StudyPhase + public var pinnedByUser: Bool + public var suggestedNext: [String] + + public init( + phase: StudyPhase = .orient, + pinnedByUser: Bool = false, + suggestedNext: [String] = [] + ) { + self.phase = phase + self.pinnedByUser = pinnedByUser + self.suggestedNext = suggestedNext + } +} + +public struct StudySession: Identifiable, Codable, Hashable, Sendable { + public var id: UUID + public var title: String + public var messages: [AgentMessage] + public var summary: String + public var focusItemIDs: [String] + public var flow: StudyFlowState + public var createdAt: Date + public var updatedAt: Date + + public init( + id: UUID = UUID(), + title: String, + messages: [AgentMessage] = [], + summary: String = "", + focusItemIDs: [String] = [], + flow: StudyFlowState = StudyFlowState(), + createdAt: Date = Date(), + updatedAt: Date = Date() + ) { + self.id = id + self.title = title + self.messages = messages + self.summary = summary + self.focusItemIDs = focusItemIDs + self.flow = flow + self.createdAt = createdAt + self.updatedAt = updatedAt + } +} diff --git a/Sources/WeiBeiCore/PiAgentRuntime.swift b/Sources/WeiBeiCore/PiAgentRuntime.swift index 7dc27266b..25186d68a 100644 --- a/Sources/WeiBeiCore/PiAgentRuntime.swift +++ b/Sources/WeiBeiCore/PiAgentRuntime.swift @@ -21,6 +21,8 @@ public struct PiAgentProviderConfiguration: Equatable, Sendable { public struct PiAgentResources: Sendable { public static let requiredSkillNames = [ + "weibei-study-companion", + "weibei-course-wayfinding", "weibei-close-reading", "weibei-note-making", "weibei-recall-practice", @@ -268,12 +270,15 @@ public actor PiAgentRuntime: StudyAgentRuntime { private struct ActiveRun { var id: UUID var contextRevision: String + var memoryRevision: UInt64 var workflow: StudyAgentWorkflow var allowedSourceLabels: Set<String> + var allowedNoteSourceLabels: Set<String> var didReadContext = false var answeredBeforeContext = false var streamedText = "" var proposal: StudyAgentNoteProposal? + var learningUpdate: StudyAgentLearningUpdate? var lastError: String? var progress: StudyAgentProgressHandler? var continuation: CheckedContinuation<StudyAgentReply, Error>? @@ -328,8 +333,10 @@ public actor PiAgentRuntime: StudyAgentRuntime { activeRun = ActiveRun( id: request.id, contextRevision: request.contextRevision, + memoryRevision: request.learningContext.memoryRevision, workflow: request.resolvedWorkflow, - allowedSourceLabels: sourceLabels(in: context), + allowedSourceLabels: sourceLabels(in: context, includeCourse: true), + allowedNoteSourceLabels: sourceLabels(in: context, includeCourse: false), progress: progress ) refreshRunWatchdog() @@ -456,7 +463,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { "--offline", "--no-session", "--no-builtin-tools", - "--tools", "weibei_context,weibei_note_proposal", + "--tools", "weibei_context,weibei_course_map,weibei_course_search,weibei_learning_memory,weibei_learning_update,weibei_note_proposal", "--no-extensions", "--extension", resources.extensionURL.path, "--no-skills", @@ -481,7 +488,11 @@ public actor PiAgentRuntime: StudyAgentRuntime { private func piPrompt(for request: StudyAgentRequest) -> String { let skillName: String switch request.resolvedWorkflow { - case .automatic, .closeReading: + case .automatic, .studyCompanion: + skillName = "weibei-study-companion" + case .courseWayfinding: + skillName = "weibei-course-wayfinding" + case .closeReading: skillName = "weibei-close-reading" case .noteMaking: skillName = "weibei-note-making" @@ -491,7 +502,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { return "/skill:\(skillName) \(request.question)" } - private func sourceLabels(in context: StudyAgentContextEnvelope) -> Set<String> { + private func sourceLabels(in context: StudyAgentContextEnvelope, includeCourse: Bool) -> Set<String> { var labels = ["[笔记:\(context.note.title)]"] if let material = context.material { labels.append("[材料:\(material.title)]") @@ -499,6 +510,14 @@ public actor PiAgentRuntime: StudyAgentRuntime { if let selection = context.selection { labels.append("[选区:\(selection.title)]") } + if includeCourse { + labels.append(contentsOf: context.course.catalog.map { item in + item.role == "note" ? "[笔记:\(item.title)]" : "[材料:\(item.title)]" + }) + labels.append("[学习记录:上次位置]") + labels.append("[学习记忆:用户状态]") + labels.append("[会话:当前]") + } return Set(labels) } @@ -768,7 +787,15 @@ public actor PiAgentRuntime: StudyAgentRuntime { case let .toolStarted(_, name): guard let run = activeRun else { return } - guard name == "weibei_context" || name == "weibei_note_proposal" else { + let allowedTools = Set([ + "weibei_context", + "weibei_course_map", + "weibei_course_search", + "weibei_learning_memory", + "weibei_learning_update", + "weibei_note_proposal", + ]) + guard allowedTools.contains(name) else { finishRun( id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI attempted an unavailable tool: \(name)")) @@ -809,7 +836,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { } guard !proposal.evidence.isEmpty, proposal.evidence.allSatisfy({ evidence in - run.allowedSourceLabels.contains(where: { evidence.hasPrefix($0) }) + run.allowedNoteSourceLabels.contains(where: { evidence.hasPrefix($0) }) }) else { finishRun( id: run.id, @@ -821,6 +848,20 @@ public actor PiAgentRuntime: StudyAgentRuntime { activeRun = run refreshRunWatchdog() + case let .learningUpdate(_, update): + guard var run = activeRun else { return } + guard update.contextRevision == run.contextRevision, + update.memoryRevision == run.memoryRevision else { + finishRun( + id: run.id, + with: .failure(PiAgentRuntimeError.agentFailed("PI proposed a stale learning-memory update")) + ) + return + } + run.learningUpdate = update + activeRun = run + refreshRunWatchdog() + case let .toolFailed(_, name, message): guard var run = activeRun else { return } run.lastError = "\(name): \(sanitizedDiagnostic(message))" @@ -844,11 +885,31 @@ public actor PiAgentRuntime: StudyAgentRuntime { !run.allowedSourceLabels.contains(where: { cleanText.contains($0) }) { finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI returned an answer without a current-source label"))) } else if cleanText.isEmpty, let proposal = run.proposal { - finishRun(id: run.id, with: .success(StudyAgentReply(text: proposal.markdown, backend: .pi, noteProposal: proposal))) + finishRun( + id: run.id, + with: .success( + StudyAgentReply( + text: proposal.markdown, + backend: .pi, + noteProposal: proposal, + learningUpdate: run.learningUpdate + ) + ) + ) } else if cleanText.isEmpty { finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed(run.lastError ?? "PI returned no readable text"))) } else { - finishRun(id: run.id, with: .success(StudyAgentReply(text: cleanText, backend: .pi, noteProposal: run.proposal))) + finishRun( + id: run.id, + with: .success( + StudyAgentReply( + text: cleanText, + backend: .pi, + noteProposal: run.proposal, + learningUpdate: run.learningUpdate + ) + ) + ) } case let .extensionError(message): diff --git a/Sources/WeiBeiCore/PiRPCProtocol.swift b/Sources/WeiBeiCore/PiRPCProtocol.swift index 59097992b..472693e33 100644 --- a/Sources/WeiBeiCore/PiRPCProtocol.swift +++ b/Sources/WeiBeiCore/PiRPCProtocol.swift @@ -80,6 +80,7 @@ public enum PiRPCIncomingMessage: Equatable, Sendable { case toolStarted(id: String, name: String) case contextRead(id: String, contextRevision: String) case noteProposal(id: String, StudyAgentNoteProposal) + case learningUpdate(id: String, StudyAgentLearningUpdate) case toolFailed(id: String, name: String, message: String) case agentEnded(text: String, stopReason: String?) case extensionError(String) @@ -170,6 +171,37 @@ public enum PiRPCMessageDecoder { ) ) } + if name == "weibei_learning_update", + let details = result?["details"] as? [String: Any], + details["kind"] as? String == "learning_update", + let revision = details["contextRevision"] as? String, + let memoryRevision = details["memoryRevision"] as? NSNumber { + let entries = (details["entries"] as? [[String: Any]] ?? []).compactMap { entry -> StudyAgentMemoryUpdateEntry? in + guard let kindRaw = entry["kind"] as? String, + let kind = LearningMemoryKind(rawValue: kindRaw), + let text = entry["text"] as? String, + let evidence = entry["evidence"] as? String, + let originRaw = entry["origin"] as? String, + let origin = LearningMemoryOrigin(rawValue: originRaw) else { return nil } + return StudyAgentMemoryUpdateEntry( + kind: kind, + text: text, + evidence: evidence, + origin: origin + ) + } + return .learningUpdate( + id: object["toolCallId"] as? String ?? "", + StudyAgentLearningUpdate( + contextRevision: revision, + memoryRevision: memoryRevision.uint64Value, + sessionSummary: details["sessionSummary"] as? String, + suggestedPhase: (details["suggestedPhase"] as? String).flatMap(StudyPhase.init(rawValue:)), + suggestedNext: details["suggestedNext"] as? [String] ?? [], + entries: entries + ) + ) + } return .event(type) case "agent_end": diff --git a/Sources/WeiBeiCore/StudyAgentRuntime.swift b/Sources/WeiBeiCore/StudyAgentRuntime.swift index f9b49348d..232f858ca 100644 --- a/Sources/WeiBeiCore/StudyAgentRuntime.swift +++ b/Sources/WeiBeiCore/StudyAgentRuntime.swift @@ -7,11 +7,184 @@ public enum StudyAgentPurpose: String, Codable, Sendable { public enum StudyAgentWorkflow: String, Codable, Sendable { case automatic + case studyCompanion + case courseWayfinding case closeReading case noteMaking case recallPractice } +public struct StudyAgentCourseCatalogItem: Codable, Equatable, Sendable { + public var id: String + public var title: String + public var subtitle: String + public var kind: String + public var role: String + public var isCurrentMaterial: Bool + public var isCurrentNote: Bool + public var linkedItemIDs: [String] + public var tags: [String] + + public init( + id: String, + title: String, + subtitle: String, + kind: String, + role: String, + isCurrentMaterial: Bool = false, + isCurrentNote: Bool = false, + linkedItemIDs: [String] = [], + tags: [String] = [] + ) { + self.id = id + self.title = title + self.subtitle = subtitle + self.kind = kind + self.role = role + self.isCurrentMaterial = isCurrentMaterial + self.isCurrentNote = isCurrentNote + self.linkedItemIDs = linkedItemIDs + self.tags = tags + } + + public init(item: StudyAgentCourseItem) { + self.init( + id: item.id, + title: item.title, + subtitle: item.subtitle, + kind: item.kind, + role: item.role, + isCurrentMaterial: item.isCurrentMaterial, + isCurrentNote: item.isCurrentNote, + linkedItemIDs: item.linkedItemIDs, + tags: item.tags + ) + } +} + +public struct StudyAgentCourseItem: Codable, Equatable, Sendable { + public var id: String + public var title: String + public var subtitle: String + public var kind: String + public var role: String + public var isCurrentMaterial: Bool + public var isCurrentNote: Bool + public var linkedItemIDs: [String] + public var headings: [String] + public var tags: [String] + public var searchText: String + public var isTruncated: Bool + + public init( + id: String, + title: String, + subtitle: String, + kind: String, + role: String, + isCurrentMaterial: Bool = false, + isCurrentNote: Bool = false, + linkedItemIDs: [String] = [], + headings: [String] = [], + tags: [String] = [], + searchText: String = "", + isTruncated: Bool = false + ) { + self.id = id + self.title = title + self.subtitle = subtitle + self.kind = kind + self.role = role + self.isCurrentMaterial = isCurrentMaterial + self.isCurrentNote = isCurrentNote + self.linkedItemIDs = linkedItemIDs + self.headings = headings + self.tags = tags + self.searchText = searchText + self.isTruncated = isTruncated + } +} + +public struct StudyAgentCourseRelation: Codable, Equatable, Sendable { + public var noteItemID: String + public var sourceItemID: String + + public init(noteItemID: String, sourceItemID: String) { + self.noteItemID = noteItemID + self.sourceItemID = sourceItemID + } +} + +public struct StudyAgentCourseContext: Codable, Equatable, Sendable { + public var title: String + public var catalog: [StudyAgentCourseCatalogItem] + public var items: [StudyAgentCourseItem] + public var relations: [StudyAgentCourseRelation] + public var isTruncated: Bool + + public init( + title: String, + catalog: [StudyAgentCourseCatalogItem] = [], + items: [StudyAgentCourseItem] = [], + relations: [StudyAgentCourseRelation] = [], + isTruncated: Bool = false + ) { + self.title = title + self.catalog = catalog.isEmpty ? items.map(StudyAgentCourseCatalogItem.init(item:)) : catalog + self.items = items + self.relations = relations + self.isTruncated = isTruncated + } + + public static let empty = StudyAgentCourseContext(title: "Course") +} + +public struct StudyAgentSessionSnapshot: Codable, Equatable, Sendable { + public var id: String + public var title: String + public var summary: String + public var phase: String + public var focusItemIDs: [String] + public var turnCount: Int + + public init( + id: String, + title: String, + summary: String, + phase: String, + focusItemIDs: [String], + turnCount: Int + ) { + self.id = id + self.title = title + self.summary = summary + self.phase = phase + self.focusItemIDs = focusItemIDs + self.turnCount = turnCount + } +} + +public struct StudyAgentLearningContext: Codable, Equatable, Sendable { + public var memoryRevision: UInt64 + public var lastLocation: StudyLocation? + public var memories: [LearningMemoryEntry] + public var session: StudyAgentSessionSnapshot? + + public init( + memoryRevision: UInt64 = 0, + lastLocation: StudyLocation? = nil, + memories: [LearningMemoryEntry] = [], + session: StudyAgentSessionSnapshot? = nil + ) { + self.memoryRevision = memoryRevision + self.lastLocation = lastLocation + self.memories = memories + self.session = session + } + + public static let empty = StudyAgentLearningContext() +} + public struct StudyAgentRequest: Sendable { public var id: UUID public var purpose: StudyAgentPurpose @@ -24,6 +197,8 @@ public struct StudyAgentRequest: Sendable { public var selectionTitle: String? public var selectionText: String? public var recentMessages: [AgentMessage] + public var courseContext: StudyAgentCourseContext + public var learningContext: StudyAgentLearningContext public var language: WeiBeiInterfaceLanguage public var contextRevision: String @@ -39,6 +214,8 @@ public struct StudyAgentRequest: Sendable { selectionTitle: String? = nil, selectionText: String? = nil, recentMessages: [AgentMessage] = [], + courseContext: StudyAgentCourseContext = .empty, + learningContext: StudyAgentLearningContext = .empty, language: WeiBeiInterfaceLanguage = .chinese, contextRevision: String ) { @@ -53,6 +230,8 @@ public struct StudyAgentRequest: Sendable { self.selectionTitle = selectionTitle self.selectionText = selectionText self.recentMessages = recentMessages + self.courseContext = courseContext + self.learningContext = learningContext self.language = language self.contextRevision = contextRevision } @@ -62,13 +241,19 @@ public struct StudyAgentRequest: Sendable { if purpose == .quietInsight { return .closeReading } let value = question.lowercased() + let resumeTerms = ["上次", "继续学", "学到哪", "学习进度", "resume", "last time", "continue learning"] + if resumeTerms.contains(where: value.contains) { return .studyCompanion } + + let wayfindingTerms = ["关联", "相关", "哪本", "哪份", "哪个文件", "跳转", "去哪里", "先学", "前置", "related", "connect", "which file", "where should", "prerequisite"] + if wayfindingTerms.contains(where: value.contains) { return .courseWayfinding } + let recallTerms = ["出题", "测验", "复习题", "自测", "quiz", "test me", "questions"] if recallTerms.contains(where: value.contains) { return .recallPractice } let noteTerms = ["整理", "写入", "笔记", "润色", "摘录", "要点", "outline", "organize", "note", "rewrite"] if noteTerms.contains(where: value.contains) { return .noteMaking } - return .closeReading + return .studyCompanion } } @@ -85,15 +270,66 @@ public struct StudyAgentNoteProposal: Codable, Equatable, Sendable { } } +public struct StudyAgentMemoryUpdateEntry: Codable, Equatable, Sendable { + public var kind: LearningMemoryKind + public var text: String + public var evidence: String + public var origin: LearningMemoryOrigin + + public init( + kind: LearningMemoryKind, + text: String, + evidence: String, + origin: LearningMemoryOrigin + ) { + self.kind = kind + self.text = text + self.evidence = evidence + self.origin = origin + } +} + +public struct StudyAgentLearningUpdate: Codable, Equatable, Sendable { + public var contextRevision: String + public var memoryRevision: UInt64 + public var sessionSummary: String? + public var suggestedPhase: StudyPhase? + public var suggestedNext: [String] + public var entries: [StudyAgentMemoryUpdateEntry] + + public init( + contextRevision: String, + memoryRevision: UInt64, + sessionSummary: String? = nil, + suggestedPhase: StudyPhase? = nil, + suggestedNext: [String] = [], + entries: [StudyAgentMemoryUpdateEntry] = [] + ) { + self.contextRevision = contextRevision + self.memoryRevision = memoryRevision + self.sessionSummary = sessionSummary + self.suggestedPhase = suggestedPhase + self.suggestedNext = suggestedNext + self.entries = entries + } +} + public struct StudyAgentReply: Equatable, Sendable { public var text: String public var backend: StudyAgentBackend public var noteProposal: StudyAgentNoteProposal? + public var learningUpdate: StudyAgentLearningUpdate? - public init(text: String, backend: StudyAgentBackend, noteProposal: StudyAgentNoteProposal? = nil) { + public init( + text: String, + backend: StudyAgentBackend, + noteProposal: StudyAgentNoteProposal? = nil, + learningUpdate: StudyAgentLearningUpdate? = nil + ) { self.text = text self.backend = backend self.noteProposal = noteProposal + self.learningUpdate = learningUpdate } } @@ -178,9 +414,11 @@ public struct StudyAgentContextEnvelope: Codable, Equatable, Sendable { public var note: Source public var selection: Source? public var recentMessages: [Message] + public var course: StudyAgentCourseContext + public var learning: StudyAgentLearningContext public init(request: StudyAgentRequest) { - schemaVersion = 1 + schemaVersion = 2 requestID = request.id.uuidString.lowercased() contextRevision = request.contextRevision purpose = request.purpose.rawValue @@ -220,5 +458,122 @@ public struct StudyAgentContextEnvelope: Codable, Equatable, Sendable { source: message.source ) } + let boundedCourse = Self.boundedCourseContext(request.courseContext) + course = boundedCourse.context + learning = Self.boundedLearningContext(request.learningContext, itemIDMap: boundedCourse.itemIDMap) + } + + private static func boundedCourseContext( + _ context: StudyAgentCourseContext + ) -> (context: StudyAgentCourseContext, itemIDMap: [String: String]) { + let maximumCatalogItems = 500 + let maximumItems = 80 + let sourceCatalog = Array(context.catalog.prefix(maximumCatalogItems)) + var itemIDMap: [String: String] = [:] + for (index, item) in sourceCatalog.enumerated() where itemIDMap[item.id] == nil { + itemIDMap[item.id] = "course-item-\(index + 1)" + } + let catalog = sourceCatalog.compactMap { item -> StudyAgentCourseCatalogItem? in + guard let itemID = itemIDMap[item.id] else { return nil } + return StudyAgentCourseCatalogItem( + id: itemID, + title: String(item.title.prefix(300)), + subtitle: String(item.subtitle.prefix(300)), + kind: String(item.kind.prefix(64)), + role: String(item.role.prefix(64)), + isCurrentMaterial: item.isCurrentMaterial, + isCurrentNote: item.isCurrentNote, + linkedItemIDs: item.linkedItemIDs.prefix(24).compactMap { itemIDMap[$0] }, + tags: item.tags.prefix(16).map { String($0.prefix(64)) } + ) + } + let items = context.items.prefix(maximumItems).compactMap { item -> StudyAgentCourseItem? in + guard let itemID = itemIDMap[item.id] else { return nil } + let searchText = String(item.searchText.prefix(2_400)) + return StudyAgentCourseItem( + id: itemID, + title: String(item.title.prefix(300)), + subtitle: String(item.subtitle.prefix(300)), + kind: String(item.kind.prefix(64)), + role: String(item.role.prefix(64)), + isCurrentMaterial: item.isCurrentMaterial, + isCurrentNote: item.isCurrentNote, + linkedItemIDs: item.linkedItemIDs.prefix(24).compactMap { itemIDMap[$0] }, + headings: item.headings.prefix(12).map { String($0.prefix(200)) }, + tags: item.tags.prefix(16).map { String($0.prefix(64)) }, + searchText: searchText, + isTruncated: item.isTruncated || item.searchText.count > searchText.count + ) + } + let relations = context.relations + .prefix(500) + .compactMap { relation -> StudyAgentCourseRelation? in + guard let noteItemID = itemIDMap[relation.noteItemID], + let sourceItemID = itemIDMap[relation.sourceItemID] else { return nil } + return StudyAgentCourseRelation(noteItemID: noteItemID, sourceItemID: sourceItemID) + } + return ( + StudyAgentCourseContext( + title: String(context.title.prefix(300)), + catalog: catalog, + items: items, + relations: relations, + isTruncated: context.isTruncated + || context.catalog.count > catalog.count + || context.items.count > items.count + || context.relations.count > relations.count + ), + itemIDMap + ) + } + + private static func boundedLearningContext( + _ context: StudyAgentLearningContext, + itemIDMap: [String: String] + ) -> StudyAgentLearningContext { + let memories = context.memories + .filter { $0.status == .active } + .sorted { $0.updatedAt > $1.updatedAt } + .prefix(48) + .map { memory in + LearningMemoryEntry( + id: memory.id, + kind: memory.kind, + text: String(memory.text.prefix(500)), + evidence: String(memory.evidence.prefix(400)), + origin: memory.origin, + status: memory.status, + sessionID: memory.sessionID, + createdAt: memory.createdAt, + updatedAt: memory.updatedAt + ) + } + let location = context.lastLocation.flatMap { location -> StudyLocation? in + guard let itemID = itemIDMap[location.itemID] else { return nil } + return StudyLocation( + itemID: itemID, + itemTitle: String(location.itemTitle.prefix(300)), + locationTitle: location.locationTitle.map { String($0.prefix(300)) }, + pageIndex: location.pageIndex, + lastStudiedAt: location.lastStudiedAt, + visitCount: location.visitCount + ) + } + let session = context.session.map { session in + StudyAgentSessionSnapshot( + id: String(session.id.prefix(256)), + title: String(session.title.prefix(300)), + summary: String(session.summary.prefix(2_000)), + phase: String(session.phase.prefix(64)), + focusItemIDs: session.focusItemIDs.prefix(24).compactMap { itemIDMap[$0] }, + turnCount: session.turnCount + ) + } + return StudyAgentLearningContext( + memoryRevision: context.memoryRevision, + lastLocation: location, + memories: memories, + session: session + ) } } diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index 786057da3..6f46a59a1 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -35,7 +35,7 @@ public enum WeiBeiInterfaceLanguage: String, CaseIterable, Identifiable, Codable } } -public enum StudyItemKind: String, Codable, CaseIterable, Identifiable { +public enum StudyItemKind: String, Codable, CaseIterable, Identifiable, Sendable { case html case pdf case markdown @@ -620,7 +620,7 @@ public enum SelectionFloatingAgentPlacement { } } -public struct StudyItem: Identifiable, Codable, Hashable { +public struct StudyItem: Identifiable, Codable, Hashable, Sendable { public var id: String public var title: String public var subtitle: String @@ -728,6 +728,12 @@ public struct PersistedWorkspace: Codable { public var notesByItemID: [String: String] public var selectedItemID: String? public var activeNotebookItemID: String? + public var noteSourceLinks: [NoteSourceLink]? + public var studyLocationsByItemID: [String: StudyLocation]? + public var learningMemoryEntries: [LearningMemoryEntry]? + public var learningMemoryRevision: UInt64? + public var studySessions: [StudySession]? + public var activeStudySessionID: UUID? public var modelName: String? public var workspaceLayout: WorkspaceLayout? public var threePaneOrder: [WorkspacePaneRole]? @@ -743,11 +749,17 @@ public struct PersistedWorkspace: Codable { public var adaptImportedDocumentColors: Bool? public var interfaceLanguageRaw: String? - public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { + public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, noteSourceLinks: [NoteSourceLink]? = nil, studyLocationsByItemID: [String: StudyLocation]? = nil, learningMemoryEntries: [LearningMemoryEntry]? = nil, learningMemoryRevision: UInt64? = nil, studySessions: [StudySession]? = nil, activeStudySessionID: UUID? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { self.importedItems = importedItems self.notesByItemID = notesByItemID self.selectedItemID = selectedItemID self.activeNotebookItemID = activeNotebookItemID + self.noteSourceLinks = noteSourceLinks + self.studyLocationsByItemID = studyLocationsByItemID + self.learningMemoryEntries = learningMemoryEntries + self.learningMemoryRevision = learningMemoryRevision + self.studySessions = studySessions + self.activeStudySessionID = activeStudySessionID self.modelName = modelName self.workspaceLayout = workspaceLayout self.threePaneOrder = threePaneOrder diff --git a/Sources/WeiBeiPiCheck/main.swift b/Sources/WeiBeiPiCheck/main.swift index 578538731..9e4f6c234 100644 --- a/Sources/WeiBeiPiCheck/main.swift +++ b/Sources/WeiBeiPiCheck/main.swift @@ -47,9 +47,11 @@ struct WeiBeiPiCheck { try await checkNoteMaking(runtime) } if runsEvaluation { + try await checkStudyCompanion(runtime) + try await checkCourseWayfinding(runtime) try await checkCloseReading(runtime) try await checkRecallPractice(runtime) - print("pi-eval passed: close-reading, note-making, recall-practice") + print("pi-eval passed: study-companion, course-wayfinding, close-reading, note-making, recall-practice") } try verifyNoPersistedTurnState(runtimeRoot) @@ -98,6 +100,37 @@ struct WeiBeiPiCheck { } } + private static func checkStudyCompanion(_ runtime: PiAgentRuntime) async throws { + let reply = try await runtime.respond( + to: request( + workflow: .studyCompanion, + question: "我上次学到哪了?请告诉我位置和下一步。", + revision: "pi-check-companion" + ) + ) + guard reply.backend == .pi, + reply.text.contains("期限结构") || reply.text.contains("第 12 页") || reply.text.contains("第12页"), + reply.text.contains("[学习记录:上次位置]") else { + throw PiCheckError.invalidEvaluation("study-companion") + } + } + + private static func checkCourseWayfinding(_ runtime: PiAgentRuntime) async throws { + let reply = try await runtime.respond( + to: request( + workflow: .courseWayfinding, + question: "利率和通货膨胀在课程里有哪份相关材料?说明关联并给出跳转来源。", + revision: "pi-check-wayfinding" + ) + ) + guard reply.backend == .pi, + reply.text.contains("通货膨胀补充材料"), + reply.text.contains("来源:通货膨胀补充材料"), + containsSourceLabel(reply.text) else { + throw PiCheckError.invalidEvaluation("course-wayfinding") + } + } + private static func checkRecallPractice(_ runtime: PiAgentRuntime) async throws { let reply = try await runtime.respond( to: request( @@ -129,13 +162,81 @@ struct WeiBeiPiCheck { noteText: "# 利率\n\n## 待整理", selectionTitle: "利率定义", selectionText: "利率是资金使用价格的表达。", + courseContext: StudyAgentCourseContext( + title: "货币金融学", + items: [ + StudyAgentCourseItem( + id: "material-rates", + title: "利率课程", + subtitle: "利率讲义", + kind: "html", + role: "material", + isCurrentMaterial: true, + linkedItemIDs: ["note-rates"], + headings: ["利率的含义", "名义利率与实际利率"], + searchText: "利率是资金使用价格的表达。实际利率会扣除通货膨胀对购买力的影响。" + ), + StudyAgentCourseItem( + id: "material-inflation", + title: "通货膨胀补充材料", + subtitle: "PDF 第 4 章", + kind: "pdf", + role: "material", + headings: ["购买力与实际利率"], + searchText: "通货膨胀会改变货币购买力,区分名义利率与实际利率时需要考虑通货膨胀。" + ), + StudyAgentCourseItem( + id: "note-rates", + title: "利率笔记", + subtitle: "Markdown", + kind: "markdown", + role: "note", + isCurrentNote: true, + linkedItemIDs: ["material-rates"], + headings: ["核心要点"], + searchText: "名义利率与实际利率的区别还需要复习。" + ), + ], + relations: [ + StudyAgentCourseRelation(noteItemID: "note-rates", sourceItemID: "material-rates"), + ] + ), + learningContext: StudyAgentLearningContext( + memoryRevision: 3, + lastLocation: StudyLocation( + itemID: "material-rates", + itemTitle: "利率课程", + locationTitle: "期限结构", + pageIndex: 11 + ), + memories: [ + LearningMemoryEntry( + kind: .confusion, + text: "还不能稳定区分名义利率与实际利率", + evidence: "[用户:本轮] 用户上次明确说这个区别还没掌握", + origin: .userStatement + ), + ], + session: StudyAgentSessionSnapshot( + id: "pi-check-session", + title: "利率复习", + summary: "上次学到期限结构,实际利率与通货膨胀的关系还需要复习。", + phase: StudyPhase.recall.rawValue, + focusItemIDs: ["material-rates", "note-rates"], + turnCount: 6 + ) + ), language: .chinese, contextRevision: revision ) } private static func containsSourceLabel(_ text: String) -> Bool { - text.contains("[选区:") || text.contains("[材料:") || text.contains("[笔记:") + text.contains("[选区:") + || text.contains("[材料:") + || text.contains("[笔记:") + || text.contains("[学习记录:") + || text.contains("[学习记忆:") } private static func verifyNoPersistedTurnState(_ runtimeRoot: URL) throws { diff --git a/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift index 14b42d873..3407b4a74 100644 --- a/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift +++ b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift @@ -89,6 +89,53 @@ private func checkRPCDecoding() throws { "PI note proposals preserve Markdown, evidence, and revision" ) + let learningData = try JSONSerialization.data(withJSONObject: [ + "type": "tool_execution_end", + "toolCallId": "tool-memory", + "toolName": "weibei_learning_update", + "isError": false, + "result": [ + "details": [ + "kind": "learning_update", + "contextRevision": "revision-7", + "memoryRevision": 4, + "sessionSummary": "学到实际利率。", + "suggestedPhase": "recall", + "suggestedNext": ["用一道题区分名义利率与实际利率"], + "entries": [ + [ + "kind": "confusion", + "text": "还不熟悉费雪方程", + "evidence": "[用户:本轮] 用户明确说不熟悉", + "origin": "userStatement", + ], + ], + ], + ], + ]) + let learningUpdate = try PiRPCMessageDecoder.decode(learningData) + try piRequire( + learningUpdate == .learningUpdate( + id: "tool-memory", + StudyAgentLearningUpdate( + contextRevision: "revision-7", + memoryRevision: 4, + sessionSummary: "学到实际利率。", + suggestedPhase: .recall, + suggestedNext: ["用一道题区分名义利率与实际利率"], + entries: [ + StudyAgentMemoryUpdateEntry( + kind: .confusion, + text: "还不熟悉费雪方程", + evidence: "[用户:本轮] 用户明确说不熟悉", + origin: .userStatement + ), + ] + ) + ), + "PI learning updates preserve context, memory revision, evidence, and flow" + ) + let ended = try PiRPCMessageDecoder.decode(Data(#"{"type":"agent_end","messages":[{"role":"assistant","content":[{"type":"text","text":"第一轮"}],"stopReason":"toolUse"},{"role":"assistant","content":[{"type":"text","text":"最终回答"}],"stopReason":"stop"}]}"#.utf8)) try piRequire(ended == .agentEnded(text: "最终回答", stopReason: "stop"), "PI agent_end selects the final assistant answer") try piRequire(try PiRPCMessageDecoder.decode(Data(#"{"type":"future_event"}"#.utf8)) == .event("future_event"), "PI decoder tolerates unknown future events") @@ -105,6 +152,28 @@ private func checkStudyAgentContext() throws { let recentMessages = (0..<10).map { index in AgentMessage(role: index.isMultiple(of: 2) ? .user : .assistant, text: "message-\(index)" + String(repeating: "字", count: 1_300), source: "source-\(index)") } + let courseItems = (0..<90).map { index in + StudyAgentCourseItem( + id: "item-\(index)", + title: "课程条目 \(index)", + subtitle: "subtitle-\(index)", + kind: index.isMultiple(of: 2) ? "pdf" : "markdown", + role: index.isMultiple(of: 2) ? "material" : "note", + linkedItemIDs: (0..<30).map { "linked-\($0)" }, + headings: (0..<18).map { "heading-\($0)" }, + tags: (0..<20).map { "#tag-\($0)" }, + searchText: String(repeating: "课", count: 2_500) + ) + } + let learningMemories = (0..<60).map { index in + LearningMemoryEntry( + kind: index.isMultiple(of: 2) ? .confusion : .nextStep, + text: "memory-\(index)" + String(repeating: "学", count: 520), + evidence: "[用户:本轮] evidence-\(index)" + String(repeating: "据", count: 420), + origin: .userStatement, + updatedAt: Date(timeIntervalSinceReferenceDate: TimeInterval(index)) + ) + } let request = StudyAgentRequest( purpose: .conversation, question: "请根据当前材料出题", @@ -115,6 +184,31 @@ private func checkStudyAgentContext() throws { selectionTitle: String(repeating: "选", count: 320), selectionText: String(repeating: "选", count: 2_100), recentMessages: recentMessages, + courseContext: StudyAgentCourseContext( + title: "测试课程", + items: courseItems, + relations: (0..<210).map { + StudyAgentCourseRelation(noteItemID: "item-\($0 % 80)", sourceItemID: "item-\(($0 + 1) % 80)") + } + ), + learningContext: StudyAgentLearningContext( + memoryRevision: 7, + lastLocation: StudyLocation( + itemID: "item-0", + itemTitle: String(repeating: "位", count: 320), + locationTitle: String(repeating: "章", count: 320), + pageIndex: 12 + ), + memories: learningMemories, + session: StudyAgentSessionSnapshot( + id: "session-1", + title: String(repeating: "会", count: 320), + summary: String(repeating: "摘", count: 2_100), + phase: StudyPhase.recall.rawValue, + focusItemIDs: (0..<30).map { "item-\($0)" }, + turnCount: 20 + ) + ), language: .chinese, contextRevision: "revision-9" ) @@ -129,6 +223,26 @@ private func checkStudyAgentContext() throws { contextRevision: "revision-10" ) try piRequire(noteRequest.resolvedWorkflow == .noteMaking, "study-agent automatic routing selects note making") + let wayfindingRequest = StudyAgentRequest( + purpose: .conversation, + question: "这个概念和课程里哪本书相关?", + materialTitle: "材料", + materialText: "正文", + noteTitle: "笔记", + noteText: "", + contextRevision: "revision-wayfinding" + ) + try piRequire(wayfindingRequest.resolvedWorkflow == .courseWayfinding, "study-agent automatic routing selects course wayfinding") + let companionRequest = StudyAgentRequest( + purpose: .conversation, + question: "我上次学到哪了?", + materialTitle: "材料", + materialText: "正文", + noteTitle: "笔记", + noteText: "", + contextRevision: "revision-companion" + ) + try piRequire(companionRequest.resolvedWorkflow == .studyCompanion, "study-agent automatic routing selects the study companion") let quietRequest = StudyAgentRequest( purpose: .quietInsight, question: "出题", @@ -141,13 +255,111 @@ private func checkStudyAgentContext() throws { try piRequire(quietRequest.resolvedWorkflow == .closeReading, "quiet insight stays on close reading") let envelope = StudyAgentContextEnvelope(request: request) - try piRequire(envelope.schemaVersion == 1 && envelope.contextRevision == "revision-9", "study-agent context carries schema and revision") + try piRequire(envelope.schemaVersion == 2 && envelope.contextRevision == "revision-9", "study-agent context carries schema and revision") try piRequire(envelope.workflow == StudyAgentWorkflow.recallPractice.rawValue, "study-agent context carries resolved workflow") try piRequire(envelope.material?.text.count == 18_000 && envelope.note.text.count == 6_000 && envelope.selection?.text.count == 2_000, "study-agent context applies source limits") try piRequire(envelope.material?.title.count == 300 && envelope.note.title.count == 300 && envelope.selection?.title.count == 300, "study-agent context bounds source labels consistently") try piRequire(envelope.material?.isTruncated == true && envelope.note.isTruncated && envelope.selection?.isTruncated == true, "study-agent context marks every truncated source") try piRequire(envelope.recentMessages.count == 8 && envelope.recentMessages.first?.text.hasPrefix("message-2") == true, "study-agent context keeps the latest eight messages") try piRequire(envelope.recentMessages.allSatisfy { $0.text.count <= 1_200 }, "study-agent context bounds recent messages") + try piRequire(envelope.course.catalog.count == 90 && envelope.course.items.count == 80 && envelope.course.relations.count == 210 && envelope.course.isTruncated, "study-agent context keeps the full catalog while bounding query candidates") + try piRequire( + envelope.course.catalog.allSatisfy { $0.id.hasPrefix("course-item-") } + && envelope.course.items.allSatisfy { $0.id.hasPrefix("course-item-") } + && envelope.course.relations.allSatisfy { + $0.noteItemID.hasPrefix("course-item-") && $0.sourceItemID.hasPrefix("course-item-") + }, + "study-agent context replaces workspace item ids with request-local opaque ids" + ) + try piRequire(envelope.course.items.allSatisfy { $0.searchText.count <= 2_400 && $0.headings.count <= 12 && $0.tags.count <= 16 && $0.linkedItemIDs.count <= 24 }, "study-agent context bounds course search metadata") + try piRequire(envelope.learning.memoryRevision == 7 && envelope.learning.memories.count == 48, "study-agent context carries a bounded learning-memory revision") + try piRequire(envelope.learning.memories.allSatisfy { $0.text.count <= 500 && $0.evidence.count <= 400 }, "study-agent context bounds durable learning memory") + try piRequire(envelope.learning.lastLocation?.itemTitle.count == 300 && envelope.learning.lastLocation?.itemID == "course-item-1" && envelope.learning.session?.summary.count == 2_000 && envelope.learning.session?.focusItemIDs.count == 24, "study-agent context bounds location and session state with opaque course ids") + + let privatePath = "/Users/student/Private Course/secret.pdf" + let privateItem = StudyAgentCourseItem( + id: "file:\(privatePath)", + title: "课程资料", + subtitle: "secret.pdf", + kind: "pdf", + role: "material", + searchText: "测试内容" + ) + let privateEnvelope = StudyAgentContextEnvelope( + request: StudyAgentRequest( + purpose: .conversation, + question: "解释", + materialTitle: "课程资料", + materialText: "测试内容", + noteTitle: "笔记", + noteText: "", + courseContext: StudyAgentCourseContext(title: "课程", items: [privateItem]), + learningContext: StudyAgentLearningContext( + lastLocation: StudyLocation(itemID: "file:\(privatePath)", itemTitle: "课程资料") + ), + contextRevision: "private-path-test" + ) + ) + let privateEnvelopeJSON = String(decoding: try JSONEncoder().encode(privateEnvelope), as: UTF8.self) + try piRequire( + !privateEnvelopeJSON.contains(privatePath) + && privateEnvelope.course.catalog.first?.id == "course-item-1" + && privateEnvelope.learning.lastLocation?.itemID == "course-item-1", + "study-agent context never exposes imported absolute paths to PI" + ) + + let courseIndex = CourseKnowledgeIndex.build( + title: "货币金融学", + sources: [ + CourseKnowledgeSource( + id: "rates", + title: "利率", + subtitle: "HTML", + kind: "html", + role: "material", + text: "## 名义利率\n\n名义利率以货币单位表示。\n\n## 实际利率\n\n实际利率扣除通货膨胀影响。" + ), + CourseKnowledgeSource( + id: "inflation-note", + title: "通货膨胀笔记", + subtitle: "Markdown", + kind: "markdown", + role: "note", + text: "# 通货膨胀\n\n#购买力\n\n通货膨胀会影响实际利率和购买力。" + ), + ], + links: [NoteSourceLink(noteItemID: "inflation-note", sourceItemID: "rates")], + query: "通货膨胀和实际利率的关联", + currentMaterialID: "rates", + currentNoteID: "inflation-note" + ) + try piRequire(courseIndex.catalog.count == 2 && courseIndex.items.count == 2 && courseIndex.relations.count == 1, "course index preserves materials, notes, and durable links") + try piRequire(courseIndex.items.first(where: { $0.id == "inflation-note" })?.searchText.contains("实际利率") == true, "course index selects query-relevant knowledge excerpts") + try piRequire(courseIndex.items.first(where: { $0.id == "inflation-note" })?.tags.contains("#购买力") == true, "course index exposes notebook tags") + + let largeCourseIndex = CourseKnowledgeIndex.build( + title: "微观经济学", + sources: (0..<100).map { index in + CourseKnowledgeSource( + id: "chapter-\(index)", + title: "课程文件 \(index)", + subtitle: "chapter-\(index).md", + kind: "markdown", + role: "material", + text: index == 99 ? "边际替代率描述消费者愿意交换两种商品的比例。" : "一般课程内容 \(index)" + ) + }, + links: [], + query: "边际替代率在哪个文件?", + currentMaterialID: nil, + currentNoteID: nil + ) + try piRequire( + largeCourseIndex.catalog.count == 100 + && largeCourseIndex.items.count == 80 + && largeCourseIndex.items.contains(where: { $0.id == "chapter-99" }), + "course index keeps every file name and ranks a relevant file beyond the first eighty into the search window" + ) let message = AgentMessage(role: .assistant, text: "PI answer", source: "材料", backend: .pi) let encoded = try JSONEncoder().encode(message) @@ -157,6 +369,55 @@ private func checkStudyAgentContext() throws { let legacyData = try JSONSerialization.data(withJSONObject: legacyObject) try piRequire(try JSONDecoder().decode(AgentMessage.self, from: legacyData).backend == nil, "legacy agent messages remain decodable") + let sessionID = UUID() + let persisted = PersistedWorkspace( + noteSourceLinks: [NoteSourceLink(noteItemID: "inflation-note", sourceItemID: "rates")], + studyLocationsByItemID: [ + "rates": StudyLocation(itemID: "rates", itemTitle: "利率", locationTitle: "实际利率", pageIndex: 3), + ], + learningMemoryEntries: [ + LearningMemoryEntry( + kind: .confusion, + text: "还不熟悉费雪方程", + evidence: "[用户:本轮] 用户明确说不熟悉", + origin: .userStatement, + sessionID: sessionID + ), + ], + learningMemoryRevision: 4, + studySessions: [ + StudySession( + id: sessionID, + title: "实际利率", + messages: [message], + summary: "学到实际利率。", + focusItemIDs: ["rates"], + flow: StudyFlowState(phase: .recall, suggestedNext: ["练习费雪方程"]) + ), + ], + activeStudySessionID: sessionID + ) + let persistedData = try JSONEncoder().encode(persisted) + let decodedPersisted = try JSONDecoder().decode(PersistedWorkspace.self, from: persistedData) + try piRequire( + decodedPersisted.noteSourceLinks?.count == 1 + && decodedPersisted.studyLocationsByItemID?["rates"]?.pageIndex == 3 + && decodedPersisted.learningMemoryEntries?.first?.sessionID == sessionID + && decodedPersisted.learningMemoryRevision == 4 + && decodedPersisted.studySessions?.first?.flow.phase == .recall + && decodedPersisted.activeStudySessionID == sessionID, + "course links, progress, learning memory, and sessions round-trip through workspace persistence" + ) + let legacyWorkspaceData = Data(#"{"importedItems":[],"notesByItemID":{}}"#.utf8) + let legacyWorkspace = try JSONDecoder().decode(PersistedWorkspace.self, from: legacyWorkspaceData) + try piRequire( + legacyWorkspace.noteSourceLinks == nil + && legacyWorkspace.studyLocationsByItemID == nil + && legacyWorkspace.learningMemoryEntries == nil + && legacyWorkspace.studySessions == nil, + "legacy workspaces remain decodable without course-learning state" + ) + try piRequire(PiAgentRuntimeError.unavailable.permitsAutomaticFallback, "PI startup failures may use the existing fallback") try piRequire(!PiAgentRuntimeError.agentFailed("model error").permitsAutomaticFallback, "accepted PI runs are never replayed automatically") try piRequire(!PiAgentRuntimeError.commandTimedOut("prompt").permitsAutomaticFallback, "unknown prompt acceptance is never replayed automatically") @@ -176,9 +437,33 @@ private func checkStudyAgentContext() throws { private func checkBundledAgentResources() throws { let resources = try PiAgentResources.bundled() try piRequire(resources.systemPrompt.contains("魏碑拥有材料、选区、笔记"), "PI system contract is bundled") + try piRequire(resources.systemPrompt.contains("课程地图") && resources.systemPrompt.contains("学习记忆与会话"), "PI system contract separates course evidence from learning memory") let extensionSource = try String(contentsOf: resources.extensionURL, encoding: .utf8) try piRequire(extensionSource.contains("before_agent_start") && extensionSource.contains("tool_call") && extensionSource.contains("pi.on(\"context\""), "PI extension bundles source, permission, and stale-context hooks") - try piRequire(extensionSource.contains("weibei_context") && extensionSource.contains("weibei_note_proposal"), "PI extension bundles only WeiBei-owned tools") + try piRequire( + [ + "weibei_context", + "weibei_course_map", + "weibei_course_search", + "weibei_learning_memory", + "weibei_learning_update", + "weibei_note_proposal", + ].allSatisfy(extensionSource.contains), + "PI extension bundles the WeiBei-owned course, memory, and note tools" + ) + try piRequire( + extensionSource.contains("contextFileBytes: 2 * 1024 * 1024") + && extensionSource.contains("courseCatalogItems: 500") + && extensionSource.contains("courseMapPageItems: 60") + && extensionSource.contains("catalogCount: snapshot.course.catalog.length") + && extensionSource.contains("const offset = params.offset ?? 0") + && extensionSource.contains("const limit = params.limit ?? 40") + && extensionSource.contains("与已有 catalog ID 重复") + && extensionSource.contains("noteTitle: catalogByID.get(relation.noteItemID)!.title") + && extensionSource.contains("...current.course.catalog.map((item) =>") + && extensionSource.contains("用户陈述型记忆必须直接依据本轮用户原话"), + "PI extension keeps a paged full catalog, compact context output, strict ids, and catalog-backed memory evidence" + ) for skillName in PiAgentResources.requiredSkillNames { let skillURL = resources.skillsURL.appendingPathComponent(skillName).appendingPathComponent("SKILL.md") @@ -192,6 +477,9 @@ private func checkBundledAgentResources() throws { try piRequire( runtimeSource.contains("answeredBeforeContext") && runtimeSource.contains("allowedSourceLabels") + && runtimeSource.contains("allowedNoteSourceLabels") + && runtimeSource.contains("memoryRevision") + && runtimeSource.contains("context.course.catalog.map") && runtimeSource.contains("PI returned an answer without a current-source label") && runtimeSource.contains("binary.sha256") && runtimeSource.contains("SecStaticCodeCheckValidity"), diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 41f3e5a50..ee97625ad 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -215,6 +215,9 @@ expect(runScript.contains("${PRODUCT_NAME}_WeiBeiCore.bundle") expect(runScript.contains("prepare_pi_runtime.sh") && runScript.contains("PiRuntime/bin/pi") && runScript.contains("binary.sha256") + && runScript.contains("cmp -s \"$BUILD_BINARY\" \"$APP_BINARY\"") + && runScript.contains("PACKAGED_UUID=") + && runScript.contains("signed app binary UUID does not match the current Swift build") && runScript.contains("codesign --verify --deep --strict \"$APP_BUNDLE\""), "packaging embeds and integrity-checks the signed PI runtime inside the app") expect(runScript.contains("kCGWindowOwnerName") && runScript.contains("\"$APP_DISPLAY_NAME\""), "run script verifies the visible app window by owner name") expect(runScript.contains("let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber") && runScript.contains("let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0"), "run script tolerates missing onscreen metadata when the window is otherwise capturable") @@ -240,10 +243,15 @@ expect(runScript.contains("open_app_for_verify()") && runScript.contains("VERIFY_WINDOW_SIZE=\"${WEIBEI_VERIFY_WINDOW_SIZE:-}\"") && runScript.contains("VERIFY_INSPIRATION_ID=\"${WEIBEI_VERIFY_INSPIRATION_ID:-}\"") && runScript.contains("rm -rf \"$VERIFY_DATA_DIR\"") - && runScript.contains("local agent_environment=(--env WEIBEI_FORCE_OFFLINE_AGENT=1)") - && runScript.contains("if [[ \"$VERIFY_SCENARIO\" == \"pi-learning-flow\" ]]") - && runScript.contains("--env WEIBEI_SUPPRESS_ACTIVATION=1 \"${agent_environment[@]}\" --env \"WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR\" --env \"WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO\"") - && runScript.contains("--env \"WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE\"") + && runScript.contains("local agent_environment=(WEIBEI_FORCE_OFFLINE_AGENT=1)") + && runScript.contains("if [[ \"$VERIFY_SCENARIO\" == \"pi-learning-flow\" || \"$VERIFY_SCENARIO\" == \"pi-course-memory-flow\" ]]") + && runScript.contains("/usr/bin/env \\") + && runScript.contains("WEIBEI_SUPPRESS_ACTIVATION=1 \\") + && runScript.contains("\"WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR\"") + && runScript.contains("\"WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO\"") + && runScript.contains("\"WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE\"") + && runScript.contains("\"$APP_BINARY\" >\"$VERIFY_STDOUT\" 2>\"$VERIFY_STDERR\" &") + && runScript.contains("VERIFY_PID=\"$!\"") && runScript.contains("if [[ -n \"$VERIFY_SCENARIO\" ]]; then\n sleep 2.6\n fi") && runScript.contains("--verify|verify)\n run_verifiers\n open_app_for_verify") && runScript.contains("--visual-verify|visual-verify)\n run_verifiers\n open_app_for_verify"), "verify modes launch the app in the background with an isolated offline or PI-backed learning-flow workspace") @@ -256,6 +264,14 @@ expect(runScript.contains("verify_learning_flow_persistence()") expect(runScript.contains("pi-agent-verified.txt") && runScript.contains("packaged PI did not complete the in-app learning flow") && workspaceStoreSource.contains("scenario == \"pi-learning-flow\", messages.last?.backend == .pi"), "verify mode can prove the packaged app itself completed a real PI-backed learning flow") +expect(runScript.contains("pi-course-memory-verified.txt") + && runScript.contains("packaged PI did not persist the course-memory learning flow") + && runScript.contains("'\"learningMemoryEntries\"'") + && runScript.contains("'\"studyLocationsByItemID\"'") + && runScript.contains("'\"studySessions\"'") + && workspaceStoreSource.contains("scenario == \"pi-course-memory-flow\"") + && workspaceStoreSource.contains("latestAgentLearningUpdate?.entries.contains { $0.kind == .confusion }") + && workspaceStoreSource.contains("pi-course-memory-verified.txt"), "verify mode proves the packaged PI can resume, navigate across course files, and persist a user-stated confusion") expect(runScript.contains("verify_empty_workspace_state()") && runScript.contains("empty-workspace-open-doc") && runScript.contains("empty-workspace-open-chat") @@ -269,7 +285,9 @@ expect(runScript.contains("VERIFY_MODE=true") && runScript.contains("DIST_DIR=\"${TMPDIR:-/tmp}/weibei-verify-$UID\"") && runScript.contains("elif [[ \"$VERIFY_MODE\" == true ]]; then\n :") && runScript.contains("VERIFY_PID") - && runScript.contains("pgrep -nx \"$PRODUCT_NAME\"") + && !runScript.contains("pgrep -nx \"$PRODUCT_NAME\"") + && runScript.contains("kill -0 \"$VERIFY_PID\"") + && runScript.contains("\"$APP_BINARY\" >\"$VERIFY_STDOUT\" 2>\"$VERIFY_STDERR\" &") && runScript.contains("trap cleanup_verify_app EXIT") && runScript.contains("kCGWindowOwnerPID"), "verify modes use an isolated temporary app and PID-scoped window checks instead of killing the user's active WeiBei window") expect(runScript.contains("PACKAGE_ONLY=false") @@ -395,12 +413,15 @@ let documentTextExtractorURL = URL(fileURLWithPath: FileManager.default.currentD .appendingPathComponent("Sources/WeiBei/Services/DocumentTextExtractor.swift") let documentTextExtractorSource = (try? String(contentsOf: documentTextExtractorURL, encoding: .utf8)) ?? "" expect(documentTextExtractorSource.contains("private static var pdfTextCache") + && documentTextExtractorSource.contains("private static var pdfIndexTextCache") + && documentTextExtractorSource.contains("private static let cacheLock = NSLock()") && documentTextExtractorSource.contains("return pdfText(url: url)") && documentTextExtractorSource.contains("private static func pagedText(from document: PDFDocument) -> String") && documentTextExtractorSource.contains("return \"第 \\(index + 1) 页\\n\\(text)\"") && !documentTextExtractorSource.contains("let textLayerText = document.string?.trimmingCharacters") && documentTextExtractorSource.contains("let text = textLayerText.isEmpty ? PDFOCRTextExtractor.text(from: document) : textLayerText") - && documentTextExtractorSource.contains("pdfTextCache[cacheKey] = text"), "PDF material extraction uses cached OCR fallback when the native text layer is empty") + && documentTextExtractorSource.contains("store(text, for: cacheKey, cache: .pdf)") + && documentTextExtractorSource.contains("store(indexed, for: indexCacheKey, cache: .pdfIndex)"), "PDF material extraction and background course indexing use thread-safe caches with OCR limited to the active material") let quietScrollersSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Support/QuietScrollers.swift") let quietScrollersSource = (try? String(contentsOf: quietScrollersSourceURL, encoding: .utf8)) ?? "" @@ -1613,6 +1634,7 @@ expect(appSource.contains("window.isOpaque = true"), "main window declares opaqu expect(appSource.contains("environment[\"WEIBEI_VERIFY_CAPTURE_PATH\"]") && appSource.contains("bitmapImageRepForCachingDisplay") && appSource.contains("cacheDisplay(in: bounds, to: bitmap)") + && appSource.contains("[\"pi-learning-flow\", \"pi-course-memory-flow\"].contains(environment[\"WEIBEI_VERIFY_SCENARIO\"])") && appSource.contains("waitForVerificationCompletion") && appSource.contains("stages.split(separator: \"\\n\").contains(\"completed\")"), "isolated verification app captures the completed PI flow without Screen Recording permission") expect(appSource.contains("sharedWorkspaceStore"), "main window and settings share one workspace store") @@ -1973,7 +1995,8 @@ if let hideReaderSearchStart = workspaceStoreSource.range(of: "func hideReaderSe } expect(workspaceStoreSource.contains("var selectedMaterialTitle") && workspaceStoreSource.contains("selectedMaterialItem.map(displayTitle) ?? ui(\"未选择材料\""), "agent material title does not invent a current material") expect(workspaceStoreSource.contains("var agentMessageSourceTitle: String?") && workspaceStoreSource.contains("hasSelectedMaterial ? currentReferenceTitle : activeNoteItem.map(displayTitle)") && !workspaceStoreSource.contains("source: selectedMaterialItem?.title"), "agent message source uses the current reader location and falls back to the localized active note title") -expect(workspaceStoreSource.contains("materialTitle: currentReferenceTitle"), "agent prompt uses the current reader location title so PDF page context reaches the model") +expect(workspaceStoreSource.contains("let sentMaterialTitle = currentReferenceTitle") + && workspaceStoreSource.contains("materialTitle: sentMaterialTitle"), "agent prompt snapshots the current reader location title so PDF page context reaches the model after background indexing") expect(workspaceStoreSource.contains("private var quietInsightReferenceTitle: String") && workspaceStoreSource.contains("selectionContext?.ownerTitle ?? (hasSelectedMaterial ? currentReferenceTitle : activeNoteItem.map(displayTitle)) ?? ui(\"当前笔记\"") && workspaceStoreSource.contains("没有证据就说\\(evidenceText)"), "quiet insight uses real selection, current reader location, or note source wording") @@ -2082,7 +2105,7 @@ expect(!workspaceStoreSource.contains("selectedItem?.title ?? \"当前材料\"") && workspaceStoreSource.contains("PI 与在线密钥均不可用,当前使用离线草稿。") && workspaceStoreSource.contains("OfflineStudyAgentRuntime().respond") && workspaceStoreSource.contains("PiAgentRuntime") - && workspaceStoreSource.contains("messages.append(AgentMessage(role: .user, text: question, source: sourceTitle))") + && workspaceStoreSource.contains("appendAgentMessage(AgentMessage(role: .user, text: question, source: sourceTitle))") && !workspaceStoreSource.contains("未配置 OPENAI_API_KEY 或钥匙串密钥") && workspaceStoreSource.contains("正在使用本机环境密钥。") && workspaceStoreSource.contains("密钥已保存,可直接用于对话。") @@ -2101,15 +2124,51 @@ if let requestStart = workspaceStoreSource.range(of: "private func performAgentR && requestSource.contains("selectionAttachments = []") && requestSource.contains("let shouldClearSentDocumentSelection = sentSelectionText != nil && selectionContext?.source == .document") && requestSource.contains("clearUnpinnedFloatingSelection(keepContext: false, invalidatesAgentContext: false)") - && requestSource.contains("messages.append(AgentMessage(role: .user, text: question, source: sourceTitle))") + && requestSource.contains("appendAgentMessage(AgentMessage(role: .user, text: question, source: sourceTitle))") + && requestSource.contains("let sentLearningContext = makeLearningContext()") + && requestSource.contains("let courseContext = try await makeCourseContext(query: courseQuery)") + && requestSource.contains("courseContext: courseContext") + && requestSource.contains("learningContext: sentLearningContext") && requestSource.contains("let reply = try await executeStudyAgentRequest(request)") + && requestSource.contains("applyLearningUpdate(") && requestSource.contains("requestWorkspaceRevision == agentContextRevision") + && requestSource.contains("requestMemoryRevision == learningMemoryRevision") && requestSource.contains("lastAgentReplyContextRevision = requestWorkspaceRevision") && requestSource.contains("contextRevision: \"\\(requestWorkspaceRevision):\\(requestID.uuidString.lowercased())\""), "agent send clears the composer, executes the unified runtime, and accepts only the current context revision") } else { expect(false, "unified agent request source is readable") } +expect(workspaceStoreSource.contains("@Published private(set) var studySessions") + && workspaceStoreSource.contains("func createStudySession()") + && workspaceStoreSource.contains("func activateStudySession(_ id: UUID)") + && workspaceStoreSource.contains("private func syncActiveStudySession(titleSeed: String? = nil)") + && workspaceStoreSource.contains("private func appendAgentMessage(_ message: AgentMessage)"), "agent conversations are durable course study sessions") +expect(workspaceStoreSource.contains("noteSourceLinks: noteSourceLinks") + && workspaceStoreSource.contains("studyLocationsByItemID: studyLocationsByItemID") + && workspaceStoreSource.contains("learningMemoryEntries: learningMemoryEntries") + && workspaceStoreSource.contains("learningMemoryRevision: learningMemoryRevision") + && workspaceStoreSource.contains("studySessions: studySessions") + && workspaceStoreSource.contains("activeStudySessionID: activeStudySessionID"), "course links, progress, memory, and sessions are saved with the workspace") +expect(workspaceStoreSource.contains("} else {\n restoreCurrentStudyLocation()\n recordCurrentStudyLocation(incrementVisit: false)\n }") + && workspaceStoreSource.contains("private func restoreCurrentStudyLocation()") + && workspaceStoreSource.contains("readerPageIndex = max(location.pageIndex ?? 0, 0)") + && workspaceStoreSource.contains("readerTargetPageIndex = location.pageIndex.map { max($0, 0) }"), "saved heading and PDF page are restored before startup records the current study location") +expect(workspaceStoreSource.contains("private func makeCourseContext(query: String) async throws") + && workspaceStoreSource.contains("CourseKnowledgeIndex.build(") + && workspaceStoreSource.contains("DocumentTextExtractor.indexText(for:") + && workspaceStoreSource.contains("Task.detached(priority: .userInitiated)") + && workspaceStoreSource.contains("withTaskCancellationHandler") + && workspaceStoreSource.contains("migrateNoteSourceLinksFromMarkdown()"), "agent requests index every course item and migrate durable note-source links") +if let selectStart = workspaceStoreSource.range(of: "func select(itemID: String?)")?.lowerBound, + let selectEnd = workspaceStoreSource[selectStart...].range(of: "\n func ", options: [], range: workspaceStoreSource.index(after: selectStart)..<workspaceStoreSource.endIndex)?.lowerBound { + let selectSource = String(workspaceStoreSource[selectStart..<selectEnd]) + expect(!selectSource.contains("messages = []") + && selectSource.contains("syncActiveStudySession()") + && selectSource.contains("recordCurrentStudyLocation("), "changing course material preserves the active conversation and records progress") +} else { + expect(false, "course material selection source is readable") +} expect(workspaceStoreSource.contains("func stageNoteDraft(_ value: String, for itemID: String?)") && workspaceStoreSource.contains("if stagedNoteDraft?.itemID != itemID || stagedNoteDraft?.value != value {\n invalidateAgentContext()") && workspaceStoreSource.contains("private func flushStagedNoteDraftForAgentContext()") @@ -2156,7 +2215,7 @@ expect(workspaceStoreSource.contains("func cancelNotebookNoteCreation()") && workspaceStoreSource.contains("func select(itemID: String?) {\n invalidateAgentContext()\n persistCurrentNote()\n notebookCreationDraft = nil") && !workspaceStoreSource.contains("private func promptCreateNotebookNote(seed: NotebookNoteSeed)") && !workspaceStoreSource.contains("alert.messageText = seed.isBlank"), "new-note creation opens the inline naming strip and confirms through the shared local markdown creator") -expect(workspaceStoreSource.contains("importedItems.append(item)\n activeNotebookItemID = item.id\n noteText = markdown\n revealRichWritingSurface()\n focus(.notes)\n save()"), "new notebook notes open in the note pane without replacing the reader material") +expect(workspaceStoreSource.contains("importedItems.append(item)\n if let sourceItem {\n addNoteSourceLink(noteItemID: item.id, sourceItemID: sourceItem.id)\n }\n activeNotebookItemID = item.id\n noteText = markdown\n revealRichWritingSurface()\n focus(.notes)\n save()"), "new notebook notes persist their material link and open in the note pane without replacing the reader material") expect(workspaceStoreSource.contains("private func showTransientNoteStatus(_ message: String)") && workspaceStoreSource.contains("Task { @MainActor [weak self] in") && workspaceStoreSource.contains("if self?.noteFileError == message") @@ -2347,7 +2406,11 @@ expect(notesAgentSource.contains("func weibeiPaneHeaderChrome(appearanceMode: We && !notesAgentSource.contains("NSAlert()") && !notePaneHeaderSource.contains("NoteCreateMenuLabel") && !notePaneHeaderSource.contains("Button(\"作为笔记编辑\")") - && agentPaneHeaderSource.contains("EmptyView()") + && agentPaneHeaderSource.contains("sessionMenu") + && notesAgentSource.contains("private var sessionMenu: some View") + && notesAgentSource.contains("store.createStudySession()") + && notesAgentSource.contains("store.activateStudySession(session.id)") + && notesAgentSource.contains("store.clearCurrentSessionInferredMemory()") && !agentPaneHeaderSource.contains("agentToolButton(") && !notesAgentSource.contains("private func agentToolButton") && notesAgentSource.contains("Button(store.agentWriteActionTitle)") @@ -2676,8 +2739,8 @@ expect(!notesAgentSource.contains("Label(store.ui(\"把当前 Markdown 作为笔 && !commandPaletteSource.contains("写回当前 Markdown 文件"), "imported markdown conversion is named as editing, not an immediate overwrite") expect(workspaceStoreSource.contains("var agentInputPrompt: String") && workspaceStoreSource.contains("if hasSelectionAttachments {\n return ui(\"输入问题\"") - && workspaceStoreSource.contains("return hasSelectedMaterial ? ui(\"问当前材料\"") - && workspaceStoreSource.contains(": ui(\"问当前笔记\"") + && workspaceStoreSource.contains("? ui(\"问当前课程或材料\"") + && workspaceStoreSource.contains(": ui(\"问当前课程或笔记\"") && !notesAgentSource.contains("问当前选区或当前材料") && !workspaceStoreSource.contains("追问已选文本片段"), "agent placeholders stay clean once selected fragments are represented by the attachment pill") expect(notesAgentSource.contains("func weibeiFloatingHeaderChrome(appearanceMode: WeiBeiAppearanceMode) -> some View") diff --git a/script/build_and_run.sh b/script/build_and_run.sh index 816eaa76d..46fd19039 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -47,6 +47,8 @@ APP_BINARY="$APP_MACOS/$PRODUCT_NAME" INFO_PLIST="$APP_CONTENTS/Info.plist" VERIFY_PID="" VERIFY_DATA_DIR="$DIST_DIR/Data" +VERIFY_STDOUT="$VERIFY_DATA_DIR/app-stdout.log" +VERIFY_STDERR="$VERIFY_DATA_DIR/app-stderr.log" VERIFY_SCENARIO="${WEIBEI_VERIFY_SCENARIO:-offline-learning-flow}" VERIFY_WINDOW_SIZE="${WEIBEI_VERIFY_WINDOW_SIZE:-}" VERIFY_INSPIRATION_ID="${WEIBEI_VERIFY_INSPIRATION_ID:-}" @@ -94,6 +96,10 @@ if [[ "$CHECK_ONLY" != true ]]; then rm -rf "$APP_BUNDLE" mkdir -p "$APP_MACOS" "$APP_RESOURCES" cp "$BUILD_BINARY" "$APP_BINARY" + if ! /usr/bin/cmp -s "$BUILD_BINARY" "$APP_BINARY"; then + echo "package failed: copied app binary does not match the current Swift build" >&2 + exit 10 + fi chmod +x "$APP_BINARY" for resource_bundle in "${RESOURCE_BUNDLES[@]}"; do if [[ ! -d "$resource_bundle" ]]; then @@ -141,6 +147,12 @@ if [[ "$CHECK_ONLY" != true ]]; then PLIST /usr/bin/codesign --force --sign - --timestamp=none "$APP_BUNDLE" >/dev/null /usr/bin/codesign --verify --deep --strict "$APP_BUNDLE" + BUILD_UUID="$(/usr/bin/dwarfdump --uuid "$BUILD_BINARY" | /usr/bin/awk 'NR == 1 {print $2}')" + PACKAGED_UUID="$(/usr/bin/dwarfdump --uuid "$APP_BINARY" | /usr/bin/awk 'NR == 1 {print $2}')" + if [[ -z "$BUILD_UUID" || "$PACKAGED_UUID" != "$BUILD_UUID" ]]; then + echo "package failed: signed app binary UUID does not match the current Swift build" >&2 + exit 11 + fi WEIBEI_PI_EXECUTABLE="$PACKAGED_PI" WEIBEI_PI_APP_BUNDLE="$APP_BUNDLE" WEIBEI_PI_LIVE_CHECK=0 \ "$BUILD_DIR/WeiBeiPiCheck" fi @@ -156,31 +168,36 @@ cleanup_verify_app() { } open_app_for_verify() { - local before_pids - local agent_environment=(--env WEIBEI_FORCE_OFFLINE_AGENT=1) - if [[ "$VERIFY_SCENARIO" == "pi-learning-flow" ]]; then + local agent_environment=(WEIBEI_FORCE_OFFLINE_AGENT=1) + if [[ "$VERIFY_SCENARIO" == "pi-learning-flow" || "$VERIFY_SCENARIO" == "pi-course-memory-flow" ]]; then agent_environment=( - --env WEIBEI_FORCE_OFFLINE_AGENT=0 - --env WEIBEI_PI_PROVIDER=openai-codex - --env WEIBEI_PI_MODEL=gpt-5.5 + WEIBEI_FORCE_OFFLINE_AGENT=0 + WEIBEI_PI_PROVIDER=openai-codex + WEIBEI_PI_MODEL=gpt-5.5 ) fi - before_pids="$(pgrep -x "$PRODUCT_NAME" || true)" rm -rf "$VERIFY_DATA_DIR" mkdir -p "$VERIFY_DATA_DIR" rm -f "$VERIFY_CAPTURE_PATH" - /usr/bin/open -n -g --env WEIBEI_SUPPRESS_ACTIVATION=1 "${agent_environment[@]}" --env "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" --env "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" --env "WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE" --env "WEIBEI_VERIFY_INSPIRATION_ID=$VERIFY_INSPIRATION_ID" --env "WEIBEI_VERIFY_CAPTURE_PATH=$VERIFY_CAPTURE_PATH" "$APP_BUNDLE" + /usr/bin/env \ + WEIBEI_SUPPRESS_ACTIVATION=1 \ + "${agent_environment[@]}" \ + "WEIBEI_WORKSPACE_DIR=$VERIFY_DATA_DIR" \ + "WEIBEI_VERIFY_SCENARIO=$VERIFY_SCENARIO" \ + "WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE" \ + "WEIBEI_VERIFY_INSPIRATION_ID=$VERIFY_INSPIRATION_ID" \ + "WEIBEI_VERIFY_CAPTURE_PATH=$VERIFY_CAPTURE_PATH" \ + "$APP_BINARY" >"$VERIFY_STDOUT" 2>"$VERIFY_STDERR" & + VERIFY_PID="$!" + trap cleanup_verify_app EXIT for _ in {1..50}; do - local newest_pid - newest_pid="$(pgrep -nx "$PRODUCT_NAME" || true)" - if [[ -n "$newest_pid" ]] && [[ $'\n'"$before_pids"$'\n' != *$'\n'"$newest_pid"$'\n'* ]]; then - VERIFY_PID="$newest_pid" - trap cleanup_verify_app EXIT + if kill -0 "$VERIFY_PID" >/dev/null 2>&1; then return 0 fi sleep 0.1 done - echo "verify launch failed: could not isolate a background $APP_DISPLAY_NAME process." >&2 + echo "verify launch failed: signed $APP_DISPLAY_NAME process exited before opening a window." >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 return 1 } @@ -216,6 +233,30 @@ visual_verify_window() { } verify_learning_flow_persistence() { + if [[ "$VERIFY_SCENARIO" == "pi-course-memory-flow" ]]; then + local workspace_file="$VERIFY_DATA_DIR/workspace.json" + local marker_file="$VERIFY_DATA_DIR/pi-course-memory-verified.txt" + for _ in {1..600}; do + if [[ -s "$marker_file" ]] \ + && [[ -f "$workspace_file" ]] \ + && /usr/bin/grep -q '"learningMemoryEntries"' "$workspace_file" \ + && /usr/bin/grep -q '"studyLocationsByItemID"' "$workspace_file" \ + && /usr/bin/grep -q '"studySessions"' "$workspace_file" \ + && /usr/bin/grep -q '"confusion"' "$workspace_file" \ + && /usr/bin/grep -q '"userStatement"' "$workspace_file" \ + && /usr/bin/grep -q '"pi"' "$workspace_file"; then + return 0 + fi + sleep 0.2 + done + echo "verify failed: packaged PI did not persist the course-memory learning flow." >&2 + if [[ -f "$VERIFY_DATA_DIR/verification-state.txt" ]]; then + cat "$VERIFY_DATA_DIR/verification-state.txt" >&2 + fi + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 + fi + if [[ "$VERIFY_SCENARIO" == "pi-learning-flow" ]]; then local workspace_file="$VERIFY_DATA_DIR/workspace.json" local marker_file="$VERIFY_DATA_DIR/pi-agent-verified.txt" From 006c54174528fb530ac316c08daa5d3b5c37e81f Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 07:56:39 +0800 Subject: [PATCH 17/36] fix: keep empty workspace hover active in preview windows --- .../Views/EmptyWorkspaceLauncherView.swift | 56 ++++++++++++++++++- Sources/WeiBeiSelfCheck/main.swift | 4 ++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index 12d6d783a..d607d3919 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -290,7 +290,11 @@ private struct EmptyWorkspaceEntryButton: View { } .buttonStyle(.plain) .focused($focused) - .onHover { hovering = $0 } + .background { + EmptyWorkspaceAlwaysActiveHoverRegion { isHovering in + hovering = isHovering + } + } .animation(reduceMotion ? nil : .easeOut(duration: 0.22), value: hovering) .animation(reduceMotion ? nil : .easeOut(duration: 0.18), value: focused) .accessibilityLabel(Text(accessibilityLabel)) @@ -299,6 +303,56 @@ private struct EmptyWorkspaceEntryButton: View { } } +private struct EmptyWorkspaceAlwaysActiveHoverRegion: NSViewRepresentable { + let onHoverChange: (Bool) -> Void + + func makeNSView(context: Context) -> HoverTrackingView { + HoverTrackingView(onHoverChange: onHoverChange) + } + + func updateNSView(_ view: HoverTrackingView, context: Context) { + view.onHoverChange = onHoverChange + } + + final class HoverTrackingView: NSView { + var onHoverChange: (Bool) -> Void + private var activeTrackingArea: NSTrackingArea? + + init(onHoverChange: @escaping (Bool) -> Void) { + self.onHoverChange = onHoverChange + super.init(frame: .zero) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func updateTrackingAreas() { + super.updateTrackingAreas() + if let activeTrackingArea { + removeTrackingArea(activeTrackingArea) + } + let options: NSTrackingArea.Options = [.mouseEnteredAndExited, .activeAlways, .inVisibleRect] + let trackingArea = NSTrackingArea(rect: .zero, options: options, owner: self) + addTrackingArea(trackingArea) + activeTrackingArea = trackingArea + } + + override func mouseEntered(with event: NSEvent) { + onHoverChange(true) + } + + override func mouseExited(with event: NSEvent) { + onHoverChange(false) + } + + override func hitTest(_ point: NSPoint) -> NSView? { + nil + } + } +} + private struct EmptyWorkspaceInspirationView: View { @EnvironmentObject private var store: WorkspaceStore @Environment(\.accessibilityReduceMotion) private var reduceMotion diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 8d8954a70..964da833a 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -997,6 +997,10 @@ expect(emptyWorkspaceSource.contains("WeiBeiTypography.englishBrandFont") && !emptyWorkspaceSource.contains("RoundedRectangle") && !emptyWorkspaceSource.contains("Capsule()") && !emptyWorkspaceSource.contains("stroke(WeiBeiTheme.cinnabar"), "empty workspace entry uses WeiBei English lettering, hairlines, and whitespace without cards, pills, or red outlines") +expect(emptyWorkspaceSource.contains("private struct EmptyWorkspaceAlwaysActiveHoverRegion") + && emptyWorkspaceSource.contains("NSTrackingArea.Options") + && emptyWorkspaceSource.contains(".activeAlways") + && emptyWorkspaceSource.contains("onHoverChange"), "empty workspace entry hover remains live when an isolated preview window is not the active application") expect(emptyWorkspaceSource.contains("TimelineView(.periodic(from: .now, by: 60))") && emptyWorkspaceSource.contains("EmptyWorkspaceDayPeriod.current(at:") && emptyWorkspaceSource.contains("geometry.size.width < 760 || geometry.size.height < 620") From 1399ef61f37ab7718327ac78e09ef2a731e4b165 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 15:30:35 +0800 Subject: [PATCH 18/36] fix: unify content rail collapse and preview states --- Sources/WeiBei/Views/ContentRailView.swift | 55 +++++++++++----------- Sources/WeiBei/Views/NotesAgentView.swift | 10 +++- Sources/WeiBei/Views/ReaderView.swift | 5 +- Sources/WeiBeiCore/ContentRailPolicy.swift | 38 +++++++++++++++ Sources/WeiBeiSelfCheck/main.swift | 37 ++++++++++----- design-qa.md | 1 + 6 files changed, 105 insertions(+), 41 deletions(-) create mode 100644 Sources/WeiBeiCore/ContentRailPolicy.swift diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index 13faf283a..942c4f3f2 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -1,6 +1,7 @@ import AppKit import Foundation import SwiftUI +import WeiBeiCore struct ContentRailItem: Identifiable { let id: String @@ -32,12 +33,19 @@ struct ContentRailItem: Identifiable { enum ContentRailMetrics { /// Overlay hit area. Readable panes must not reserve this width in their layout. - static let normalWidth: CGFloat = 40 - static let railOnlyWidth: CGFloat = 88 - static let railOnlyThreshold: CGFloat = 150 - static let snapThreshold: CGFloat = 160 - static let readableWidth: CGFloat = 240 - static let defaultReadableWidth: CGFloat = 420 + static let normalWidth: CGFloat = ContentRailPolicy.dormantWidth + static let railOnlyWidth: CGFloat = normalWidth + static let railOnlyThreshold = ContentRailPolicy.railOnlyThreshold + static let snapThreshold = ContentRailPolicy.snapThreshold + static let readableWidth = ContentRailPolicy.readableWidth + static let defaultReadableWidth = ContentRailPolicy.defaultReadableWidth + + static func isRailOnly(availableWidth: CGFloat, allowed: Bool) -> Bool { + ContentRailPolicy.presentation( + availableWidth: availableWidth, + allowsRailOnly: allowed + ) == .railOnly + } } enum ContentRailWaveMetrics { @@ -64,7 +72,6 @@ struct ContentRailView: View { @State private var hoveredID: String? @State private var previewID: String? - @State private var previewOpenWork: DispatchWorkItem? @State private var previewCloseWork: DispatchWorkItem? @FocusState private var focusedItemID: String? @@ -138,7 +145,6 @@ struct ContentRailView: View { } } .onDisappear { - previewOpenWork?.cancel() previewCloseWork?.cancel() if previewID != nil { onHover(nil) @@ -147,7 +153,7 @@ struct ContentRailView: View { } private var compactWidth: CGFloat { - isRailOnly ? 42 : 40 + ContentRailMetrics.normalWidth } private var railWidth: CGFloat { @@ -155,7 +161,7 @@ struct ContentRailView: View { } private var tickLeadingInset: CGFloat { - isRailOnly ? 4 : 3 + 3 } private var previewLeadingX: CGFloat { @@ -233,10 +239,10 @@ struct ContentRailView: View { } private func previewWidth(in totalWidth: CGFloat) -> CGFloat? { - guard !isRailOnly else { return nil } - let available = totalWidth - previewLeadingX - 8 - guard available >= 220 else { return nil } - return min(360, available) + ContentRailPolicy.previewWidth( + totalWidth: totalWidth, + previewLeadingX: previewLeadingX + ) } private func previewY(index: Int, railHeight: CGFloat, totalHeight: CGFloat) -> CGFloat { @@ -358,8 +364,10 @@ struct ContentRailView: View { } private func previewCard(for item: ContentRailItem, width: CGFloat) -> some View { - HStack(alignment: .top, spacing: item.previewImage == nil ? 0 : 12) { - if let image = item.previewImage { + let showsPreviewImage = item.previewImage != nil && width >= ContentRailPolicy.previewImageMinimumWidth + + return HStack(alignment: .top, spacing: showsPreviewImage ? 12 : 0) { + if showsPreviewImage, let image = item.previewImage { Image(nsImage: image) .resizable() .aspectRatio(contentMode: .fill) @@ -386,7 +394,7 @@ struct ContentRailView: View { .font(.system(size: 12.5)) .lineSpacing(3) .foregroundStyle(WeiBeiTheme.secondaryInk) - .lineLimit(item.previewImage == nil ? 4 : 3) + .lineLimit(showsPreviewImage ? 3 : 4) .frame(maxWidth: .infinity, alignment: .leading) } @@ -414,7 +422,6 @@ struct ContentRailView: View { private func beginHover(_ item: ContentRailItem) { previewCloseWork?.cancel() - previewOpenWork?.cancel() hoveredID = item.id guard previewID != item.id else { @@ -422,15 +429,10 @@ struct ContentRailView: View { return } - let work = DispatchWorkItem { - guard hoveredID == item.id else { return } - withAnimation(WeiBeiMotion.hover) { - previewID = item.id - } - onHover(item) + withAnimation(WeiBeiMotion.hover) { + previewID = item.id } - previewOpenWork = work - DispatchQueue.main.asyncAfter(deadline: .now() + 0.10, execute: work) + onHover(item) } private func endHover(_ item: ContentRailItem) { @@ -451,7 +453,6 @@ struct ContentRailView: View { } private func closePreview(immediately: Bool) { - previewOpenWork?.cancel() previewCloseWork?.cancel() hoveredID = nil if immediately { diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 869c58ef8..b2d72f1f7 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -285,7 +285,10 @@ struct NotePaneView: View { var body: some View { GeometryReader { geometry in - let railOnly = store.layout.allowsRailOnlyPanes && geometry.size.width < ContentRailMetrics.railOnlyThreshold + let railOnly = ContentRailMetrics.isRailOnly( + availableWidth: geometry.size.width, + allowed: store.layout.allowsRailOnlyPanes + ) let railItems = noteRailItems ZStack(alignment: .topLeading) { VStack(spacing: 0) { @@ -1356,7 +1359,10 @@ struct AgentPaneView: View { var body: some View { GeometryReader { paneGeometry in - let railOnly = store.layout.allowsRailOnlyPanes && paneGeometry.size.width < ContentRailMetrics.railOnlyThreshold + let railOnly = ContentRailMetrics.isRailOnly( + availableWidth: paneGeometry.size.width, + allowed: store.layout.allowsRailOnlyPanes + ) let railItems = agentRailItems ScrollViewReader { proxy in ZStack(alignment: .topLeading) { diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift index cad8d9aa7..fa6b66485 100644 --- a/Sources/WeiBei/Views/ReaderView.swift +++ b/Sources/WeiBei/Views/ReaderView.swift @@ -150,7 +150,10 @@ struct ReaderView: View { var body: some View { GeometryReader { geometry in - let railOnly = supportsContentRail && !isImmersive && geometry.size.width < ContentRailMetrics.railOnlyThreshold + let railOnly = ContentRailMetrics.isRailOnly( + availableWidth: geometry.size.width, + allowed: supportsContentRail && !isImmersive + ) ZStack(alignment: .bottomTrailing) { VStack(spacing: 0) { readerBody diff --git a/Sources/WeiBeiCore/ContentRailPolicy.swift b/Sources/WeiBeiCore/ContentRailPolicy.swift new file mode 100644 index 000000000..cc3ecb41e --- /dev/null +++ b/Sources/WeiBeiCore/ContentRailPolicy.swift @@ -0,0 +1,38 @@ +import Foundation + +public enum ContentRailPresentation: Equatable, Sendable { + case railOnly + case content +} + +public enum ContentRailPolicy { + /// The rail is the pane's entire dormant surface, not an additional sidebar. + public static let dormantWidth: CGFloat = 40 + /// At 190pt the 40pt rail plus a compact 140pt text preview and insets fit without overlap. + public static let railOnlyThreshold: CGFloat = 190 + public static let snapThreshold: CGFloat = 190 + public static let readableWidth: CGFloat = 240 + public static let defaultReadableWidth: CGFloat = 420 + public static let previewMinimumWidth: CGFloat = 140 + public static let previewMaximumWidth: CGFloat = 360 + public static let previewImageMinimumWidth: CGFloat = 240 + + public static func presentation( + availableWidth: CGFloat, + allowsRailOnly: Bool + ) -> ContentRailPresentation { + // Deliberately expose two stable states. Intermediate widths are drag-time geometry, + // never a third persistent presentation callers need to understand. + allowsRailOnly && availableWidth < railOnlyThreshold ? .railOnly : .content + } + + public static func previewWidth( + totalWidth: CGFloat, + previewLeadingX: CGFloat, + trailingInset: CGFloat = 8 + ) -> CGFloat? { + let available = totalWidth - previewLeadingX - trailingInset + guard available >= previewMinimumWidth else { return nil } + return min(previewMaximumWidth, available) + } +} diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 964da833a..1eeb0b19c 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -929,9 +929,22 @@ let contentRailGeometrySource: String = { } return String(contentRailSource[start..<end]) }() +expect(ContentRailPolicy.dormantWidth == 40 + && ContentRailPolicy.snapThreshold == ContentRailPolicy.railOnlyThreshold + && ContentRailPolicy.presentation(availableWidth: 40, allowsRailOnly: true) == .railOnly + && ContentRailPolicy.presentation(availableWidth: 189, allowsRailOnly: true) == .railOnly + && ContentRailPolicy.presentation(availableWidth: 190, allowsRailOnly: true) == .content + && ContentRailPolicy.presentation(availableWidth: 40, allowsRailOnly: false) == .content, + "content rail policy exposes only a 40pt dormant state and a readable content state") +expect(ContentRailPolicy.previewWidth(totalWidth: 178, previewLeadingX: 39) == nil + && ContentRailPolicy.previewWidth(totalWidth: 190, previewLeadingX: 39) == 143 + && ContentRailPolicy.previewWidth(totalWidth: 520, previewLeadingX: 39) == 360, + "content rail preview policy removes the no-preview intermediate range and caps wide previews") expect(contentRailSource.contains("struct ContentRailView: View") - && contentRailSource.contains("static let railOnlyWidth: CGFloat = 88") - && contentRailSource.contains("static let normalWidth: CGFloat = 40") + && contentRailSource.contains("static let normalWidth: CGFloat = ContentRailPolicy.dormantWidth") + && contentRailSource.contains("static let railOnlyWidth: CGFloat = normalWidth") + && contentRailSource.contains("static let railOnlyThreshold = ContentRailPolicy.railOnlyThreshold") + && contentRailSource.contains("static func isRailOnly(availableWidth: CGFloat, allowed: Bool)") && contentRailSource.contains("let availableWidth: CGFloat?") && contentRailSource.contains("availableWidth: CGFloat? = nil") && contentRailSource.contains("previewWidth(in: availableWidth ?? geometry.size.width)") @@ -962,14 +975,15 @@ expect(contentRailSource.contains("struct ContentRailView: View") && !contentRailSource.contains("LinearGradient(") && !contentRailSource.contains("private var railBackground") && !contentRailSource.contains("private var railAtmosphere") - && contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") + && !contentRailSource.contains("previewOpenWork") + && !contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") + && contentRailSource.contains("previewID = item.id") && contentRailSource.contains("previewImage: NSImage?") && contentRailSource.contains("x: previewLeadingX + width / 2") && contentRailSource.contains("tickLeadingInset + ContentRailWaveMetrics.peakLength + 8") - && contentRailSource.contains("let available = totalWidth - previewLeadingX - 8") - && contentRailSource.contains("return min(360, available)") - && contentRailSource.contains("guard available >= 220 else { return nil }") - && contentRailSource.contains("guard !isRailOnly else { return nil }") + && contentRailSource.contains("ContentRailPolicy.previewWidth(") + && !contentRailSource.contains("guard !isRailOnly else { return nil }") + && contentRailSource.contains("width >= ContentRailPolicy.previewImageMinimumWidth") && contentRailSource.contains(".allowsHitTesting(false)") && !contentRailSource.contains(".popover(") && !contentRailSource.contains("influenceRadius") @@ -1104,9 +1118,9 @@ expect(contentViewSource.contains("override func layout()"), "native split appli expect(contentViewSource.contains("libraryResizeHandle"), "library pane keeps SwiftUI resize handle") expect(contentViewSource.contains("minimumContentWidthWithLibrary"), "library leaves readable width for the workspace") expect(contentViewSource.contains("private let railWidth = ContentRailMetrics.railOnlyWidth") - && contentRailSource.contains("static let snapThreshold: CGFloat = 160") - && contentRailSource.contains("static let readableWidth: CGFloat = 240") - && contentViewSource.contains("handleExpansionRequest(store.paneExpansionRequest"), "normal multi-pane layouts snap to a restorable 88pt content rail state") + && contentRailSource.contains("static let snapThreshold = ContentRailPolicy.snapThreshold") + && contentRailSource.contains("static let readableWidth = ContentRailPolicy.readableWidth") + && contentViewSource.contains("handleExpansionRequest(store.paneExpansionRequest"), "normal multi-pane layouts snap to a restorable 40pt content rail state") expect(!contentViewSource.contains("DragGesture()"), "content panes avoid SwiftUI drag resizing") expect(!contentViewSource.contains(".id(store.layout)"), "layout changes avoid whole-screen identity resets") expect(!contentViewSource.contains("PaneSeparator"), "content panes avoid hand-drawn split separators") @@ -1240,7 +1254,8 @@ expect(notesAgentSource.contains("private var noteRailItems: [ContentRailItem]") && notesAgentSource.contains("NoteEditorCommand(kind: .scrollToHeading") && notesAgentSource.contains("private var agentRailItems: [ContentRailItem]") && notesAgentSource.contains("store.requestPaneExpansion(.agent)") - && notesAgentSource.components(separatedBy: "let railOnly = store.layout.allowsRailOnlyPanes").count >= 3, "notes and conversation share the content rail and navigate after restoring a narrow pane") + && notesAgentSource.components(separatedBy: "ContentRailMetrics.isRailOnly").count >= 2 + && contentRailReaderSource.contains("ContentRailMetrics.isRailOnly"), "reader, notes, and conversation share one rail-only policy and navigate after restoring a narrow pane") let agentRailSource: String = { guard let start = notesAgentSource.range(of: "private var agentRailTurns: [AgentRailTurn]")?.lowerBound, let end = notesAgentSource.range(of: "private var agentPrompt", range: start..<notesAgentSource.endIndex)?.lowerBound else { diff --git a/design-qa.md b/design-qa.md index f4176c191..beb5ec2d1 100644 --- a/design-qa.md +++ b/design-qa.md @@ -28,6 +28,7 @@ The reference rail measures 13, 22, 31, 44, 57, 44, 31, 22, 13 pixels around its 1. P1: the previous peak measured 69 pixels and every neighbor stayed at 15 pixels. Fixed by reducing the peak and adding four-step distance weights. 2. P1: the first dark capture used the pale on-cinnabar foreground for the hovered tick. Fixed by using cinnabar itself in both appearances. The final dark capture shows the selected rail in red. 3. P1: the full-width transparent rail overlay exposed background window dragging at pane borders in non-fullscreen windows. Fixed by restoring the rail's 40-point hit surface while passing pane width as layout data only. `/private/tmp/weibei-divider-qa-401.png` confirms the overflow preview still renders with the narrow hit surface. +4. P1: the pane previously snapped to an 88-point rail-only shell even though the dormant rail itself is 40 points, and widths between the rail threshold and the old 220-point preview minimum could suppress the preview entirely. The rail-only state now equals the 40-point dormant surface, widths below 190 points resolve to that state, compact text previews fit from 190 points, and hover opens immediately instead of racing a delayed work item. ## Findings From 244d58b2483556e5e46f0d241511622ff6623b04 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 15:58:45 +0800 Subject: [PATCH 19/36] feat: add persistent course agent index --- CONTEXT.md | 7 +- Package.swift | 12 +- README.md | 15 +- Sources/WeiBei/Resources/Editor/editor.js | 2 +- .../Services/DocumentTextExtractor.swift | 240 ++- Sources/WeiBei/Stores/WorkspaceStore.swift | 443 +++++- Sources/WeiBei/Views/NotesAgentView.swift | 58 +- Sources/WeiBei/Views/ReaderView.swift | 115 +- Sources/WeiBei/WebEditor/src/editor.js | 2 +- .../WeiBeiCore/AgentResources/extension.ts | 308 +++- .../skills/weibei-course-wayfinding/SKILL.md | 3 +- .../skills/weibei-recall-practice/SKILL.md | 1 + .../skills/weibei-study-companion/SKILL.md | 8 +- Sources/WeiBeiCore/AgentResources/system.md | 8 +- .../WeiBeiCore/BoundedPDFTextExtractor.swift | 284 ++++ .../CourseDocumentSearchIndex.swift | 1333 +++++++++++++++++ Sources/WeiBeiCore/CourseKnowledgeIndex.swift | 18 +- Sources/WeiBeiCore/LearningModels.swift | 9 + .../WeiBeiCore/OpenAIResponsesClient.swift | 2 +- Sources/WeiBeiCore/PDFOCRTextExtractor.swift | 32 +- Sources/WeiBeiCore/PiAgentRuntime.swift | 245 ++- Sources/WeiBeiCore/PiRPCProtocol.swift | 65 +- Sources/WeiBeiCore/StudyAgentRuntime.swift | 176 ++- Sources/WeiBeiCore/WorkspaceModels.swift | 118 +- Sources/WeiBeiPDFTextWorker/main.swift | 110 ++ Sources/WeiBeiPiCheck/main.swift | 6 +- .../WeiBeiSelfCheck/PiAgentSelfChecks.swift | 167 ++- Sources/WeiBeiSelfCheck/main.swift | 495 +++++- script/build_and_run.sh | 26 +- 29 files changed, 4064 insertions(+), 244 deletions(-) create mode 100644 Sources/WeiBeiCore/BoundedPDFTextExtractor.swift create mode 100644 Sources/WeiBeiCore/CourseDocumentSearchIndex.swift create mode 100644 Sources/WeiBeiPDFTextWorker/main.swift diff --git a/CONTEXT.md b/CONTEXT.md index bc9eb4cc2..f726ef2ae 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -4,7 +4,8 @@ - **Material**: A source document used as course evidence, such as a PDF, HTML page, text file, or non-notebook Markdown file. - **Notebook**: A user-editable course note. A notebook can be linked to many materials, and a material can be linked to many notebooks. - **Note-source link**: A durable relation saying that a notebook uses or discusses a material. Opening a file does not create this relation. -- **Study location**: Observed navigation state for a material, including its last page or section and visit time. It is recorded by the app rather than inferred by the model. -- **Learning memory**: Durable user learning state such as goals, understood concepts, confusions, next steps, and preferences. Every entry keeps its origin and evidence; it is not course-source evidence. -- **Study session**: A recoverable conversation around a learning goal. Sessions persist across material navigation and own their messages, summary, focus items, and suggested study phase. +- **Study location**: Observed navigation state for a material, including its last PDF page or stable HTML section id, section title, and visit time. It is recorded by the app rather than inferred by the model. +- **Learning memory**: Durable user learning state such as goals, understood concepts, confusions, next steps, and preferences. Every entry keeps its origin and evidence; it is not course-source evidence. An active memory can be resolved only from an explicit current-turn user statement or demonstrated performance in the current conversation. +- **Study session**: A recoverable conversation around a learning goal. Sessions persist across material navigation and own all messages, a rolling summary, bounded earlier-turn excerpts, focus items, and the suggested study phase. PI runs are clean; WeiBei injects this durable continuity every turn. - **Study flow**: A flexible phase suggestion for orienting, exploring, close reading, note-making, recall, consolidation, or planning. The user can move between phases at any time. +- **Course search index**: A local persistent full-text index. PDF text layers are extracted in a separately monitored helper with CPU, resident-memory, output, and timeout limits; scanned pages are then OCRed incrementally. Truncated or failed pages are terminal partial evidence until the source file changes, so incomplete indexing is exposed instead of retried on every question or treated as a complete search. diff --git a/Package.swift b/Package.swift index 3c9fd98b0..8a52ab140 100644 --- a/Package.swift +++ b/Package.swift @@ -10,7 +10,8 @@ let package = Package( .executable(name: "WeiBei", targets: ["WeiBei"]), .executable(name: "WeiBeiSelfCheck", targets: ["WeiBeiSelfCheck"]), .executable(name: "WeiBeiWebEditorCheck", targets: ["WeiBeiWebEditorCheck"]), - .executable(name: "WeiBeiPiCheck", targets: ["WeiBeiPiCheck"]) + .executable(name: "WeiBeiPiCheck", targets: ["WeiBeiPiCheck"]), + .executable(name: "WeiBeiPDFTextWorker", targets: ["WeiBeiPDFTextWorker"]) ], targets: [ .target( @@ -22,7 +23,8 @@ let package = Package( .linkedFramework("AppKit"), .linkedFramework("PDFKit"), .linkedFramework("Security"), - .linkedFramework("Vision") + .linkedFramework("Vision"), + .linkedLibrary("sqlite3") ] ), .executableTarget( @@ -57,6 +59,12 @@ let package = Package( .executableTarget( name: "WeiBeiPiCheck", dependencies: ["WeiBeiCore"] + ), + .executableTarget( + name: "WeiBeiPDFTextWorker", + linkerSettings: [ + .linkedFramework("PDFKit") + ] ) ] ) diff --git a/README.md b/README.md index 7111d9954..18f9b78be 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ | 阅读 | HTML(WebKit)、PDF(PDFKit,连续或单页,`⌘[` / `⌘]`)、Markdown 渲染 | | 笔记 | 绑当前资料,存本机;Milkdown 原地编辑,可切源码 / 对照 | | 划线 | 选区浮层带摘录,可写入或替换笔记 | -| 对话 | PI 可检索整个课程的材料、笔记与关联,说明关系并给出可点击来源 | -| 学习 | 记录上次位置、目标、已掌握、困惑和下一步;按会话继续或切换学习主题 | +| 对话 | PI 可检索整个课程的材料、笔记与关联,说明关系并给出可点击的文件、PDF 页或 HTML 章节 | +| 学习 | 记录上次位置、目标、已掌握、困惑和下一步;旧困惑只能凭用户原话或可验证的回忆表现提出结案,用户确认后才落盘且可撤销 | | 布局 | 三栏可调;文档笔记对半;沉浸阅读 / 对话 / 写作 | | Agent | 固定列、抽屉、小窗、划线浮层、静默洞察、隐藏 | | 键位 | `⌘1`–`⌘4` 聚焦,`⌘B` 资料库,`⌘K` 命令面板 | @@ -49,15 +49,15 @@ cd weibei 魏碑把 PI 当内部学习 Agent,不给它文件、终端或网络工具。魏碑先索引当前课程里的材料与笔记,再把有界课程目录、关联、相关摘录、学习进度和当前会话交给 PI。PI 只能读取这份受限快照;笔记整理只能返回待确认建议,最终写回仍由魏碑和用户决定。 -单个课程目录最多导入 500 个支持文件。PI 通过分页课程地图认识完整文件清单;每轮按用户问题选出最多 80 份相关知识片段,不把整个课程全文一次塞进模型。首次索引在后台进行,后续按文件修改时间复用缓存;导入文件的本机绝对路径会在进入 PI 上下文前替换成临时匿名 ID。 +单个课程目录最多导入 500 个支持文件。PI 通过分页课程地图认识完整文件清单;每轮按用户问题选出最多 80 份相关知识片段,不把整个课程全文一次塞进模型。课程全文索引持久化在本机 SQLite:后台先快速扫完所有文字层和普通文本,再用独立低优先级队列逐页补齐纯扫描页 OCR,包括第 12 页之后的页面。PDF 原生文字层由应用包内单独的受限进程批量提取,每次打开同一份 PDF 处理最多 8 页,并设置内存监测、CPU、输出和超时边界,异常页面不会拖垮主应用;界面线程只读缓存,前台索引每份 PDF 最多尝试 32 页且单份预算 2 秒,整轮同步补索引最多 4 秒,剩余文字页分批在后台续跑。只有已经完成文字层尝试且确认无文字的页才进入 OCR,不会把长教材中尚未扫描到的后续文字页误当成图片页。确认无文字的空白页会记为已检查,截断页和 OCR 失败页会记为终态不完整,只有文件内容变化后才重建,不会在每次提问时永久重试。未完成的索引和只返回局部命中的摘录都会明确标记为不完整;每次提问先轻量核对文件签名,前台最多同步补齐 24 个缺失或真正改过的来源。单个可全文索引的 HTML、Markdown 或纯文本文件上限为 32MB,单页 PDF 最多索引 128K 字;更大的内容仍出现在课程目录,但内容索引明确保持不完整。跨文件检索先保证每份命中材料都有自己的候选片段,避免一本大书挤掉其他关联来源。索引目录使用私有权限;SQLite 主库按连接限制为 768MB,整个索引目录以 1GB 为停止新增写入的预算并为 WAL 留出余量,但不是操作系统磁盘配额。全文与可索引元数据分表保存,写入使用可回滚事务。达到预算时保持“未完成”标记。索引只保存文件标识的哈希,已移出课程的材料会清理并增量回收物理页;导入文件的本机绝对路径进入 PI 上下文前还会再次替换成临时匿名 ID。 应用内建固定到 `0.80.2` 的 PI macOS 独立运行体,只从自身资源目录启动,不扫描用户的 `PATH`、NVM、Node.js、Bun 或全局 PI。构建脚本按架构下载官方开源产物,先核对 SHA-256,再把最小运行文件、MIT 许可证和来源清单装进应用包。PI 内核以后可替换成我们的源码分支,Swift/RPC 契约无需跟着重写。 -PI 在接收问题前不可用时会尝试原有在线接口,再使用离线草稿。已经被 PI 接收的请求若中途失败,不会自动重放,原问题会留在输入框供用户决定是否重试。 +正式学习对话始终由 PI 处理。PI 启动、提供方或工具失败时,魏碑会明确报错并保留原问题,不会静默降级成不认识课程、记忆和工具的普通对话。静默洞察不属于用户学习会话,仍可在 PI 启动前失败时使用原有有界在线/离线路径。 -魏碑为 PI 建立独立配置目录,只迁入本机已有 PI 的认证信息和默认提供方;全局扩展、技能、提示模板、主题和会话都不会加载。PI 子进程使用环境白名单,不继承宿主里的其他密钥。PI 自己的原始会话轨迹不落盘;魏碑会持久化面向用户的学习会话、上次位置和经过证据约束的学习记忆。 +魏碑为 PI 建立独立配置目录,只迁入本机已有 PI 的认证信息和默认提供方;全局扩展、技能、提示模板、主题和会话都不会加载。PI 子进程使用环境白名单,不继承宿主里的其他密钥。PI 自己的原始会话轨迹不落盘;魏碑持久化完整的用户学习会话,每轮向干净的 PI 运行会话注入最近 20 条消息、受限的更早对话摘录、会话摘要、上次位置和经过证据约束的学习记忆,因此切换材料或重启应用不会把学习连续性交给 PI 的隐藏状态。 -五个内置学习技能:学习陪伴、课程关联导航、细读与证据核对、Markdown 笔记整理、主动回忆与自测。六个魏碑专用工具负责读取当前上下文、浏览课程地图、检索课程知识、读取学习记忆、提交学习更新和生成笔记建议。上下文先读、记忆先读、工具白名单、修订号失效和写回边界由 PI 扩展钩子强制执行。 +五个内置学习技能:学习陪伴、课程关联导航、细读与证据核对、Markdown 笔记整理、主动回忆与自测。六个魏碑专用工具负责读取当前上下文、浏览课程地图、检索课程知识、读取学习记忆、提交学习更新和生成笔记建议。上下文先读、目录不等于读过来源、记忆先读、工具白名单、修订号失效和写回边界由 PI 扩展钩子与 Swift 宿主双重校验。可点击来源也由宿主按完整位置验真:重复文件的条目序号、PDF 页码、HTML 章节序号和章节名必须与本轮工具返回值一致。 | 变量 | 说明 | 默认 | | --- | --- | --- | @@ -66,7 +66,7 @@ PI 在接收问题前不可用时会尝试原有在线接口,再使用离线 | `WEIBEI_PI_PROVIDER` | 指定 PI 提供方 | PI 当前配置;有应用 Key 时为 `openai` | | `WEIBEI_PI_MODEL` | 指定 PI 模型 | PI 当前配置;有应用 Key 时沿用应用模型 | | `WEIBEI_PI_THINKING` | PI 思考强度 | `medium` | -| `WEIBEI_PI_DISABLED` | 设为 `1` 跳过 PI | 未设置 | +| `WEIBEI_PI_DISABLED` | 设为 `1` 跳过 PI;正式学习对话将明确报不可用 | 未设置 | | `WEIBEI_PI_LIVE_CHECK` | `1` 强制、`0` 跳过真实笔记技能冒烟 | 有可用认证时自动运行 | | `WEIBEI_PI_EVAL` | 运行学习陪伴、课程导航、细读、笔记、回忆五项真实评测 | 未设置 | | `WEIBEI_PI_EXECUTABLE` | 仅供 `WeiBeiPiCheck` 指向准备好的内建运行体 | 未设置 | @@ -81,6 +81,7 @@ Sources/WeiBeiCore/ 工作区、Agent、密钥、PDF OCR AgentResources/ PI 扩展、系统契约与五个学习技能 Sources/WeiBeiSelfCheck/ Sources/WeiBeiPiCheck/ PI 启动检查与可选真模型冒烟 +Sources/WeiBeiPDFTextWorker/ 受限的 PDF 原生文字提取进程 Sources/WeiBei/WebEditor/ 编辑器源码 → Resources/Editor Vendor/PiRuntime/ PI 固定版本、哈希、许可证与维护边界 DesignReferences/ 纸 / 墨 / 石 / 朱砂参考 diff --git a/Sources/WeiBei/Resources/Editor/editor.js b/Sources/WeiBei/Resources/Editor/editor.js index a34aaba91..8d46f9b74 100644 --- a/Sources/WeiBei/Resources/Editor/editor.js +++ b/Sources/WeiBei/Resources/Editor/editor.js @@ -3860,7 +3860,7 @@ ${r}`:r},xur=e=>String(e||"").split(/\r?\n/).slice(1,-1).map(t=>{let r=t.match(/ <rect x="17" y="11" width="20" height="14" rx="2" fill="none" stroke="${e.accent}" stroke-width="1.2"/> <text x="48" y="22" fill="${e.text}" font-family="-apple-system, BlinkMacSystemFont, 'Songti SC', serif" font-size="13">${coe(xc("imageMissing"))}</text> </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`},boe=e=>{if(!e||/^(?:https?:|data:|blob:|weibeiimage:)/i.test(e))return e;try{let t=new URL(e,hit||window.location.href).href;return/^file:/i.test(t)?bur(t):t}catch{return e}},Tur=e=>{let t=[];return e.doc.descendants(r=>(r.type.name==="image"&&r.attrs.src&&t.push(r.attrs.src),!0)),t},Sit=()=>{document.body.dataset.editable=Ed?"true":"false"},Cur=e=>{let t=Tur(e.state);Array.from(e.dom.querySelectorAll("img")).forEach((n,i)=>{let a=t[i];if(!a)return;let s=boe(a),{alt:o,size:l}=kit(n.getAttribute("alt")||"");o&&n.setAttribute("alt",o),wit(n,l),n.dataset.weibeiMarkdownSrc=a,n.dataset.weibeiImageEventsBound||(n.dataset.weibeiImageEventsBound="true",n.addEventListener("error",()=>{n.dataset.weibeiImageMissingFor=n.dataset.weibeiResolvedSrc||n.getAttribute("src")||"",n.dataset.weibeiImagePlaceholder="true",n.classList.add("weibei-image-missing"),n.setAttribute("src",xoe())}),n.addEventListener("load",()=>{n.dataset.weibeiImagePlaceholder!=="true"&&n.classList.remove("weibei-image-missing")})),!(n.dataset.weibeiImageMissingFor===s&&n.dataset.weibeiImagePlaceholder==="true")&&s&&n.getAttribute("src")!==s&&(n.dataset.weibeiResolvedSrc=s,delete n.dataset.weibeiImagePlaceholder,n.classList.remove("weibei-image-missing"),n.setAttribute("src",s))})},uoe=e=>{window.cancelAnimationFrame(Ynt),Ynt=window.requestAnimationFrame(()=>Cur(e))},Sur=()=>{ea&&ea.action(e=>uoe(e.get(Li)))},fP=()=>{if(!ea)return null;let e=ea.action(t=>t.get(Li).state.selection);return!e||e.empty?null:{from:e.from,to:e.to}},Eit=()=>ea?ea.action(e=>{let{selection:t}=e.get(Li).state;if(!t||t.empty)return"";let r=t.content().content;return pit(r.textBetween(0,r.size,` -`))}):"",Ait=()=>pit(window.getSelection()?.toString()||Eit()),Ji=(e,t,r,n,i={})=>{r<=t||e.push(mi.inline(t,r,{...i,class:n}))},rit=(e,t,r)=>{let n=e.doc.resolve(t);for(let i=n.depth;i>=0;i-=1)if(n.node(i).type.name===r)return!0;return!1},Eur=(e,t,r,n,i,a)=>{for(let s of t.matchAll(n)){let o=r+(s.index||0),l=o+s[0].length;Ji(e,o,o+i,"weibei-md-marker"),Ji(e,o+i,l-i,a),Ji(e,l-i,l,"weibei-md-marker")}},Aur=(e,t,r)=>{for(let n of t.matchAll(/(^|[^\\])\^\[([^\]\n]+)\]/g)){let i=n[1]?.length||0,a=n[2]||"",s=r+(n.index||0)+i,o=s+n[0].length-i;Ji(e,s,s+2,"weibei-md-marker"),Ji(e,s+2,o-1,"weibei-inline-footnote",{title:xc("inlineFootnote",{value:a}),"aria-label":xc("inlineFootnote",{value:a})}),Ji(e,o-1,o,"weibei-md-marker")}},_ur=(e,t,r)=>{for(let n of t.matchAll(/\[\[([^\]\n]+)\]\]/g)){let i=n.index||0;if(t[i-1]==="!")continue;let a=r+i,s=a+n[0].length,o=voe(n[1]),l=o.noteTitle||o.target,u=o.target||l;Ji(e,a,a+2,"weibei-md-marker"),o.aliasRange&&o.aliasRange.end>o.aliasRange.start?(Ji(e,a+2,a+2+o.aliasRange.start,"weibei-md-marker"),Ji(e,a+2+o.aliasRange.start,a+2+o.aliasRange.end,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,a+2+o.aliasRange.end,s-2,"weibei-md-marker")):Ji(e,a+2,s-2,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,s-2,s,"weibei-md-marker")}},Rur=(e,t,r)=>{for(let n of t.matchAll(/(?:^|\s)((?:来源:|Source:)[^\n]+)/g)){let i=n[0].startsWith(n[1])?0:1,a=n[1].startsWith("\u6765\u6E90\uFF1A")?"\u6765\u6E90\uFF1A":"Source:",s=r+(n.index||0)+i,o=s+n[1].length;Ji(e,s,o,"weibei-source-reference",{role:"link",tabindex:"0",title:xc("openSource",{value:n[1].slice(a.length).trim()}),"data-source-reference":n[1]})}},Lur=(e,t,r)=>{for(let n of t.matchAll(/!\[\[([^\]\n]+)\]\]/g)){let i=r+(n.index||0),a=i+n[0].length,s=Cit(n[1]);Ji(e,i,a,"weibei-embed-source"),e.push(mi.widget(a,()=>{if(wur.test(s.target)){let l=document.createElement("img");return l.className="weibei-embed-preview weibei-embed-image",l.alt=s.target,l.src=boe(s.target),wit(l,s.size),l.addEventListener("error",()=>{l.src=xoe(),l.classList.add("weibei-image-missing")}),l}let o=document.createElement("span");return o.className="weibei-embed-preview weibei-embed-note",o.textContent=xc("embed",{value:s.label||s.target}),o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("title",xc("openOrCreateNote",{value:s.target})),o.dataset.wikilinkTarget=s.target,o.dataset.wikilinkTitle=s.target,o},{side:1}))}},Iur=(e,t,r,n)=>{let i=0;for(;i<t.length;){if(n.open){let o=t.indexOf("%%",i);if(o<0){Ji(e,r+i,r+t.length,"weibei-comment");return}Ji(e,r+i,r+o+2,"weibei-comment"),n.open=!1,i=o+2;continue}let a=t.indexOf("%%",i);if(a<0)return;let s=t.indexOf("%%",a+2);if(s<0){Ji(e,r+a,r+t.length,"weibei-comment"),n.open=!0;return}Ji(e,r+a,r+s+2,"weibei-comment"),i=s+2}},Mur=(e,t,r)=>{for(let n of t.matchAll(/(^|\s)(#[\p{L}\p{N}_/-]+)\b/gu)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-tag")}for(let n of t.matchAll(/(^|\s)(\^[A-Za-z0-9-]+)\s*$/g)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-block-id")}},Nur=(e,t,r)=>{for(let n of t.matchAll(/<br\s*\/?>/gi)){let i=r+(n.index||0),a=i+n[0].length;Ji(e,i,a,"weibei-html-break-source"),e.push(mi.widget(a,()=>{let s=document.createElement("br");return s.className="weibei-html-break-preview",s},{side:1}))}},Dur=e=>{let t=document.createElement("div");return t.className="weibei-mermaid-render",t.textContent=xc("mermaidRendering"),window.setTimeout(async()=>{try{let r=`weibei-mermaid-${Jcr+=1}`,{svg:n,bindFunctions:i}=await ioe.render(r,e,t);t.innerHTML=n,i?.(t),t.dataset.rendered="true"}catch(r){t.classList.add("weibei-mermaid-error"),t.textContent=xc("mermaidFailed",{value:String(r?.message||r)})}},0),t},Our=(e,t,r)=>Rit(t.attrs.language||"")!=="mermaid"?!1:(e.push(mi.node(r,r+t.nodeSize,{class:"weibei-code-block weibei-mermaid-block","data-language":"mermaid"})),e.push(mi.widget(r+t.nodeSize-1,()=>Dur(t.textContent),{side:1})),!0),Pur=e=>{let t=voe(e);return t.target||t.noteTitle},Bur=e=>{let t=e instanceof Element?e.closest(".weibei-wikilink, .weibei-embed-note[data-wikilink-title]"):null;return t?.getAttribute("data-wikilink-title")||t?.textContent?.trim()||""},hoe=e=>{let t=Bur(e);return t?(Zo("wikiLinkActivated",{title:t}),!0):!1},Fur=e=>(e instanceof Element?e.closest(".weibei-source-reference[data-source-reference]"):null)?.getAttribute("data-source-reference")||"",foe=e=>{let t=Fur(e);return t?(Zo("sourceReferenceActivated",{reference:t}),!0):!1},_it=e=>{if(Ed||!(e instanceof Element))return!1;let t=e.closest('blockquote.weibei-callout[data-callout-fold="-"]');return t?(t.classList.toggle("weibei-callout-open"),!0):!1},Rit=e=>{let t=(e||"").trim().toLowerCase();return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",md:"markdown",yml:"yaml"}[t]||t},Lit=e=>typeof e=="string"?e.length:Array.isArray(e.content)?e.content.reduce((t,r)=>t+Lit(r),0):String(e.content||"").length,$ur=e=>{let t=Array.isArray(e.alias)?e.alias:e.alias?[e.alias]:[];return["weibei-prism-token","token",e.type,...t].filter(Boolean).join(" ")},Iit=(e,t,r)=>{let n=r;for(let i of t){let a=Lit(i);typeof i!="string"&&a>0&&(Ji(e,n,n+a,$ur(i)),Array.isArray(i.content)&&Iit(e,i.content,n)),n+=a}},zur=(e,t,r)=>{let n=Rit(t.attrs.language||"");if(!(!n||!oP.default.languages[n]))try{Iit(e,oP.default.tokenize(t.textContent,oP.default.languages[n]),r+1)}catch{}},Gur=()=>ea?ea.action(e=>{let t=e.get(Li),r=t.state.selection.from,n="";return t.state.doc.descendants((i,a)=>{if(!i.isText||n)return!0;let s=i.text||"",o=a,l=a+s.length;if(r<o||r>l)return!0;for(let u of s.matchAll(/\[\[([^\]\n]+)\]\]/g)){let h=o+(u.index||0),f=h+u[0].length;if(r>=h&&r<=f)return n=Pur(u[1]),!1}return!0}),n}):"",Mit=async e=>{let{alt:t,src:r}=await gG(e);if(!cit?.imageAttachmentRequested)return{alt:t,src:r};let n=`attachment-${Date.now()}-${Qcr+=1}`;return new Promise((i,a)=>{H2.set(n,{resolve:i,reject:a}),Zo("imageAttachmentRequested",{id:n,name:e.name||t||"image",mime:e.type||"image/png",dataURL:r}),window.setTimeout(()=>{H2.has(n)&&(H2.delete(n),a(new Error("Attachment save timed out")))},15e3)})},qur=e=>{let t=String(e||""),r=t.trim();return r?t.includes(` +`))}):"",Ait=()=>pit(window.getSelection()?.toString()||Eit()),Ji=(e,t,r,n,i={})=>{r<=t||e.push(mi.inline(t,r,{...i,class:n}))},rit=(e,t,r)=>{let n=e.doc.resolve(t);for(let i=n.depth;i>=0;i-=1)if(n.node(i).type.name===r)return!0;return!1},Eur=(e,t,r,n,i,a)=>{for(let s of t.matchAll(n)){let o=r+(s.index||0),l=o+s[0].length;Ji(e,o,o+i,"weibei-md-marker"),Ji(e,o+i,l-i,a),Ji(e,l-i,l,"weibei-md-marker")}},Aur=(e,t,r)=>{for(let n of t.matchAll(/(^|[^\\])\^\[([^\]\n]+)\]/g)){let i=n[1]?.length||0,a=n[2]||"",s=r+(n.index||0)+i,o=s+n[0].length-i;Ji(e,s,s+2,"weibei-md-marker"),Ji(e,s+2,o-1,"weibei-inline-footnote",{title:xc("inlineFootnote",{value:a}),"aria-label":xc("inlineFootnote",{value:a})}),Ji(e,o-1,o,"weibei-md-marker")}},_ur=(e,t,r)=>{for(let n of t.matchAll(/\[\[([^\]\n]+)\]\]/g)){let i=n.index||0;if(t[i-1]==="!")continue;let a=r+i,s=a+n[0].length,o=voe(n[1]),l=o.noteTitle||o.target,u=o.target||l;Ji(e,a,a+2,"weibei-md-marker"),o.aliasRange&&o.aliasRange.end>o.aliasRange.start?(Ji(e,a+2,a+2+o.aliasRange.start,"weibei-md-marker"),Ji(e,a+2+o.aliasRange.start,a+2+o.aliasRange.end,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,a+2+o.aliasRange.end,s-2,"weibei-md-marker")):Ji(e,a+2,s-2,"weibei-wikilink",{role:"link",tabindex:"0",title:xc("openOrCreateNote",{value:l}),"data-wikilink-target":o.target,"data-wikilink-title":u}),Ji(e,s-2,s,"weibei-md-marker")}},Rur=(e,t,r)=>{for(let n of t.matchAll(/(?:^|[\s`])((?:来源:|Source:)[^`\n]+)/g)){let i=n[0].startsWith(n[1])?0:1,a=n[1].startsWith("\u6765\u6E90\uFF1A")?"\u6765\u6E90\uFF1A":"Source:",s=r+(n.index||0)+i,o=s+n[1].length;Ji(e,s,o,"weibei-source-reference",{role:"link",tabindex:"0",title:xc("openSource",{value:n[1].slice(a.length).trim()}),"data-source-reference":n[1]})}},Lur=(e,t,r)=>{for(let n of t.matchAll(/!\[\[([^\]\n]+)\]\]/g)){let i=r+(n.index||0),a=i+n[0].length,s=Cit(n[1]);Ji(e,i,a,"weibei-embed-source"),e.push(mi.widget(a,()=>{if(wur.test(s.target)){let l=document.createElement("img");return l.className="weibei-embed-preview weibei-embed-image",l.alt=s.target,l.src=boe(s.target),wit(l,s.size),l.addEventListener("error",()=>{l.src=xoe(),l.classList.add("weibei-image-missing")}),l}let o=document.createElement("span");return o.className="weibei-embed-preview weibei-embed-note",o.textContent=xc("embed",{value:s.label||s.target}),o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("title",xc("openOrCreateNote",{value:s.target})),o.dataset.wikilinkTarget=s.target,o.dataset.wikilinkTitle=s.target,o},{side:1}))}},Iur=(e,t,r,n)=>{let i=0;for(;i<t.length;){if(n.open){let o=t.indexOf("%%",i);if(o<0){Ji(e,r+i,r+t.length,"weibei-comment");return}Ji(e,r+i,r+o+2,"weibei-comment"),n.open=!1,i=o+2;continue}let a=t.indexOf("%%",i);if(a<0)return;let s=t.indexOf("%%",a+2);if(s<0){Ji(e,r+a,r+t.length,"weibei-comment"),n.open=!0;return}Ji(e,r+a,r+s+2,"weibei-comment"),i=s+2}},Mur=(e,t,r)=>{for(let n of t.matchAll(/(^|\s)(#[\p{L}\p{N}_/-]+)\b/gu)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-tag")}for(let n of t.matchAll(/(^|\s)(\^[A-Za-z0-9-]+)\s*$/g)){let i=r+(n.index||0)+n[1].length;Ji(e,i,i+n[2].length,"weibei-block-id")}},Nur=(e,t,r)=>{for(let n of t.matchAll(/<br\s*\/?>/gi)){let i=r+(n.index||0),a=i+n[0].length;Ji(e,i,a,"weibei-html-break-source"),e.push(mi.widget(a,()=>{let s=document.createElement("br");return s.className="weibei-html-break-preview",s},{side:1}))}},Dur=e=>{let t=document.createElement("div");return t.className="weibei-mermaid-render",t.textContent=xc("mermaidRendering"),window.setTimeout(async()=>{try{let r=`weibei-mermaid-${Jcr+=1}`,{svg:n,bindFunctions:i}=await ioe.render(r,e,t);t.innerHTML=n,i?.(t),t.dataset.rendered="true"}catch(r){t.classList.add("weibei-mermaid-error"),t.textContent=xc("mermaidFailed",{value:String(r?.message||r)})}},0),t},Our=(e,t,r)=>Rit(t.attrs.language||"")!=="mermaid"?!1:(e.push(mi.node(r,r+t.nodeSize,{class:"weibei-code-block weibei-mermaid-block","data-language":"mermaid"})),e.push(mi.widget(r+t.nodeSize-1,()=>Dur(t.textContent),{side:1})),!0),Pur=e=>{let t=voe(e);return t.target||t.noteTitle},Bur=e=>{let t=e instanceof Element?e.closest(".weibei-wikilink, .weibei-embed-note[data-wikilink-title]"):null;return t?.getAttribute("data-wikilink-title")||t?.textContent?.trim()||""},hoe=e=>{let t=Bur(e);return t?(Zo("wikiLinkActivated",{title:t}),!0):!1},Fur=e=>(e instanceof Element?e.closest(".weibei-source-reference[data-source-reference]"):null)?.getAttribute("data-source-reference")||"",foe=e=>{let t=Fur(e);return t?(Zo("sourceReferenceActivated",{reference:t}),!0):!1},_it=e=>{if(Ed||!(e instanceof Element))return!1;let t=e.closest('blockquote.weibei-callout[data-callout-fold="-"]');return t?(t.classList.toggle("weibei-callout-open"),!0):!1},Rit=e=>{let t=(e||"").trim().toLowerCase();return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",md:"markdown",yml:"yaml"}[t]||t},Lit=e=>typeof e=="string"?e.length:Array.isArray(e.content)?e.content.reduce((t,r)=>t+Lit(r),0):String(e.content||"").length,$ur=e=>{let t=Array.isArray(e.alias)?e.alias:e.alias?[e.alias]:[];return["weibei-prism-token","token",e.type,...t].filter(Boolean).join(" ")},Iit=(e,t,r)=>{let n=r;for(let i of t){let a=Lit(i);typeof i!="string"&&a>0&&(Ji(e,n,n+a,$ur(i)),Array.isArray(i.content)&&Iit(e,i.content,n)),n+=a}},zur=(e,t,r)=>{let n=Rit(t.attrs.language||"");if(!(!n||!oP.default.languages[n]))try{Iit(e,oP.default.tokenize(t.textContent,oP.default.languages[n]),r+1)}catch{}},Gur=()=>ea?ea.action(e=>{let t=e.get(Li),r=t.state.selection.from,n="";return t.state.doc.descendants((i,a)=>{if(!i.isText||n)return!0;let s=i.text||"",o=a,l=a+s.length;if(r<o||r>l)return!0;for(let u of s.matchAll(/\[\[([^\]\n]+)\]\]/g)){let h=o+(u.index||0),f=h+u[0].length;if(r>=h&&r<=f)return n=Pur(u[1]),!1}return!0}),n}):"",Mit=async e=>{let{alt:t,src:r}=await gG(e);if(!cit?.imageAttachmentRequested)return{alt:t,src:r};let n=`attachment-${Date.now()}-${Qcr+=1}`;return new Promise((i,a)=>{H2.set(n,{resolve:i,reject:a}),Zo("imageAttachmentRequested",{id:n,name:e.name||t||"image",mime:e.type||"image/png",dataURL:r}),window.setTimeout(()=>{H2.has(n)&&(H2.delete(n),a(new Error("Attachment save timed out")))},15e3)})},qur=e=>{let t=String(e||""),r=t.trim();return r?t.includes(` `)?!0:/^(?:#{1,6}\s|[-*+]\s|\d+\.\s|>\s|```|~~~|\$\$|\|.*\||---$)/.test(r):!1},Vur=e=>{let t=String(e||"");return qur(t)?` ${t.trim()} diff --git a/Sources/WeiBei/Services/DocumentTextExtractor.swift b/Sources/WeiBei/Services/DocumentTextExtractor.swift index f289f42db..acbfec729 100644 --- a/Sources/WeiBei/Services/DocumentTextExtractor.swift +++ b/Sources/WeiBei/Services/DocumentTextExtractor.swift @@ -6,18 +6,25 @@ import WeiBeiCore enum DocumentTextExtractor { private enum TextCache { case pdf - case pdfIndex case file } private static let cacheLock = NSLock() + private static let maximumPDFCacheEntryBytes = 4 * 1_024 * 1_024 + private static let maximumPDFCacheBytes = 12 * 1_024 * 1_024 + private static let maximumFileCacheEntryBytes = 2 * 1_024 * 1_024 + private static let maximumFileCacheBytes = 8 * 1_024 * 1_024 + private static let maximumActiveFileBytes = 4 * 1_024 * 1_024 + private static let maximumActivePDFPages = 12 + private static let maximumActivePDFCharacters = 64_000 + private static let maximumActivePDFTextSeconds: TimeInterval = 2 private static var pdfTextCache: [String: String] = [:] - private static var pdfIndexTextCache: [String: String] = [:] private static var fileTextCache: [String: String] = [:] + private static var pdfTextCacheOrder: [String] = [] + private static var fileTextCacheOrder: [String] = [] static func text(for item: StudyItem) -> String? { guard let url = item.url else { return nil } - switch item.kind { case .pdf: return pdfText(url: url) @@ -25,36 +32,28 @@ enum DocumentTextExtractor { return cachedFileText(url: url, load: htmlText) case .markdown, .text: return cachedFileText(url: url) { fileURL in - try? String(contentsOf: fileURL, encoding: .utf8) + prefixData(from: fileURL).map { String(decoding: $0, as: UTF8.self) } } } } - static func indexText(for item: StudyItem, maximumCharacters: Int = 24_000) -> String? { + static func cachedText(for item: StudyItem) -> String? { guard let url = item.url else { return nil } - let text: String? - switch item.kind { - case .pdf: - let cacheKey = fileCacheKey(for: url) - if let cached = cachedValue(for: cacheKey, cache: .pdf) { - text = cached - } else { - let indexCacheKey = "\(cacheKey)#\(maximumCharacters)" - if let cached = cachedValue(for: indexCacheKey, cache: .pdfIndex) { - text = cached - } else { - let indexed = pdfIndexText(url: url, maximumCharacters: maximumCharacters) - if let indexed, !indexed.isEmpty { - store(indexed, for: indexCacheKey, cache: .pdfIndex) - } - text = indexed - } - } - case .html, .markdown, .text: - text = self.text(for: item) - } - guard let text, !text.isEmpty else { return nil } - return String(text.prefix(maximumCharacters)) + let cache: TextCache = item.kind == .pdf ? .pdf : .file + return cachedValue(for: fileCacheKey(for: url), cache: cache) + } + + static func indexText( + for item: StudyItem, + maximumCharacters: Int = 24_000, + query: String = "" + ) -> String? { + guard let text = text(for: item), !text.isEmpty else { return nil } + return relevantText( + text, + query: query, + maximumCharacters: max(maximumCharacters, 1) + ) } private static func pdfText(url: URL) -> String? { @@ -62,10 +61,29 @@ enum DocumentTextExtractor { if let cached = cachedValue(for: cacheKey, cache: .pdf) { return cached } - guard let document = PDFDocument(url: url) else { return nil } - let textLayerText = pagedText(from: document) - let text = textLayerText.isEmpty ? PDFOCRTextExtractor.text(from: document) : textLayerText + var nativePages: [String] = [] + var nativeCharacterCount = 0 + let pageLimit = min(max(document.pageCount, 0), maximumActivePDFPages) + let nativeTextByPage = BoundedPDFTextExtractor.pages( + from: url, + pageIndexes: Array(0..<pageLimit), + maximumCharactersPerPage: maximumActivePDFCharacters, + timeout: maximumActivePDFTextSeconds + ) ?? [:] + for pageIndex in 0..<pageLimit { + guard let page = nativeTextByPage[pageIndex] else { continue } + let text = page.text.trimmingCharacters(in: .whitespacesAndNewlines) + guard !text.isEmpty else { continue } + let pageText = "第 \(pageIndex + 1) 页\n\(text)" + nativePages.append(pageText) + nativeCharacterCount += pageText.count + if nativeCharacterCount >= maximumActivePDFCharacters { break } + } + let nativeText = String(nativePages.joined(separator: "\n\n").prefix(maximumActivePDFCharacters)) + let text = nativeText.isEmpty + ? PDFOCRTextExtractor.text(from: document, maxPages: 12) + : nativeText if let text, !text.isEmpty { store(text, for: cacheKey, cache: .pdf) return text @@ -73,31 +91,86 @@ enum DocumentTextExtractor { return nil } - private static func pagedText(from document: PDFDocument) -> String { - (0..<max(document.pageCount, 0)).compactMap { index in - guard let page = document.page(at: index), - let text = page.string?.trimmingCharacters(in: .whitespacesAndNewlines), - !text.isEmpty else { return nil } - return "第 \(index + 1) 页\n\(text)" + private static func htmlText(url: URL) -> String? { + guard let data = prefixData(from: url) else { return nil } + if let attributed = try? NSAttributedString( + data: data, + options: [ + .documentType: NSAttributedString.DocumentType.html, + .characterEncoding: String.Encoding.utf8.rawValue, + ], + documentAttributes: nil + ) { + return attributed.string } - .joined(separator: "\n\n") + return String(decoding: data, as: UTF8.self) } - private static func pdfIndexText(url: URL, maximumCharacters: Int) -> String? { - guard let document = PDFDocument(url: url) else { return nil } - var sections: [String] = [] - var characterCount = 0 - for index in 0..<min(document.pageCount, 32) { - guard let page = document.page(at: index), - let pageText = page.string?.trimmingCharacters(in: .whitespacesAndNewlines), - !pageText.isEmpty else { continue } - let section = "第 \(index + 1) 页\n\(pageText)" - sections.append(section) - characterCount += section.count - if characterCount >= maximumCharacters { break } + private static func prefixData(from url: URL) -> Data? { + guard let handle = try? FileHandle(forReadingFrom: url) else { return nil } + defer { try? handle.close() } + return try? handle.read(upToCount: maximumActiveFileBytes) + } + + private static func relevantText( + _ text: String, + query: String, + maximumCharacters: Int + ) -> String { + let terms = Array(searchTerms(in: query).prefix(24)) + guard !terms.isEmpty else { return String(text.prefix(maximumCharacters)) } + let chunks = chunked(text, maximumCharacters: 2_000) + var ranked: [(index: Int, chunk: String, score: Int)] = [] + for (index, chunk) in chunks.enumerated() { + let lower = chunk.lowercased() + var score = 0 + for term in terms { + score += min(lower.components(separatedBy: term).count - 1, 12) + } + if score > 0 { + ranked.append((index: index, chunk: chunk, score: score)) + } + } + ranked.sort { lhs, rhs in + if lhs.score != rhs.score { return lhs.score > rhs.score } + return lhs.index < rhs.index + } + guard !ranked.isEmpty else { return String(text.prefix(maximumCharacters)) } + let selected = ranked.prefix(12).sorted { lhs, rhs in + lhs.index < rhs.index + } + let joined = selected.map { $0.chunk }.joined(separator: "\n\n") + return String(joined.prefix(maximumCharacters)) + } + + private static func chunked(_ text: String, maximumCharacters: Int) -> [String] { + guard text.count > maximumCharacters else { return [text] } + var chunks: [String] = [] + var start = text.startIndex + while start < text.endIndex { + let end = text.index(start, offsetBy: maximumCharacters, limitedBy: text.endIndex) ?? text.endIndex + chunks.append(String(text[start..<end])) + start = end } - let text = sections.joined(separator: "\n\n") - return text.isEmpty ? nil : String(text.prefix(maximumCharacters)) + return chunks + } + + private static func searchTerms(in query: String) -> [String] { + let lower = query.lowercased() + var terms = lower + .components(separatedBy: CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "_")).inverted) + .filter { $0.count >= 2 } + let characters = Array(lower) + if characters.count >= 2 { + for index in 0..<(characters.count - 1) { + let pair = String(characters[index...index + 1]) + if pair.unicodeScalars.allSatisfy({ (0x4E00...0x9FFF).contains(Int($0.value)) }) { + terms.append(pair) + } + } + } + var seen: Set<String> = [] + return terms.filter { seen.insert($0).inserted } } private static func fileCacheKey(for url: URL) -> String { @@ -111,10 +184,8 @@ enum DocumentTextExtractor { if let cached = cachedValue(for: cacheKey, cache: .file) { return cached } - guard let text = load(url) else { return nil } - if !text.isEmpty { - store(text, for: cacheKey, cache: .file) - } + guard let text = load(url), !text.isEmpty else { return nil } + store(text, for: cacheKey, cache: .file) return text } @@ -123,39 +194,60 @@ enum DocumentTextExtractor { defer { cacheLock.unlock() } switch cache { case .pdf: - return pdfTextCache[key] - case .pdfIndex: - return pdfIndexTextCache[key] + guard let value = pdfTextCache[key] else { return nil } + touch(key, in: &pdfTextCacheOrder) + return value case .file: - return fileTextCache[key] + guard let value = fileTextCache[key] else { return nil } + touch(key, in: &fileTextCacheOrder) + return value } } private static func store(_ value: String, for key: String, cache: TextCache) { cacheLock.lock() defer { cacheLock.unlock() } + let valueBytes = value.utf8.count switch cache { case .pdf: + guard valueBytes <= maximumPDFCacheEntryBytes else { return } pdfTextCache[key] = value - case .pdfIndex: - pdfIndexTextCache[key] = value + touch(key, in: &pdfTextCacheOrder) + trim( + &pdfTextCache, + order: &pdfTextCacheOrder, + countLimit: 4, + byteLimit: maximumPDFCacheBytes + ) case .file: + guard valueBytes <= maximumFileCacheEntryBytes else { return } fileTextCache[key] = value + touch(key, in: &fileTextCacheOrder) + trim( + &fileTextCache, + order: &fileTextCacheOrder, + countLimit: 8, + byteLimit: maximumFileCacheBytes + ) } } - private static func htmlText(url: URL) -> String? { - guard let data = try? Data(contentsOf: url) else { return nil } - if let attributed = try? NSAttributedString( - data: data, - options: [ - .documentType: NSAttributedString.DocumentType.html, - .characterEncoding: String.Encoding.utf8.rawValue - ], - documentAttributes: nil - ) { - return attributed.string + private static func touch(_ key: String, in order: inout [String]) { + order.removeAll { $0 == key } + order.append(key) + } + + private static func trim( + _ values: inout [String: String], + order: inout [String], + countLimit: Int, + byteLimit: Int + ) { + var totalBytes = values.values.reduce(0) { $0 + $1.utf8.count } + while order.count > countLimit || totalBytes > byteLimit { + guard !order.isEmpty else { break } + let key = order.removeFirst() + totalBytes -= values.removeValue(forKey: key)?.utf8.count ?? 0 } - return String(data: data, encoding: .utf8) } } diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 85946a374..8a60fe1c1 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -62,9 +62,12 @@ final class WorkspaceStore: ObservableObject { @Published var librarySearch = "" @Published var readerSearch = "" @Published var showReaderSearch = false + @Published var readerLocationID: String? @Published var readerLocationTitle: String? @Published var readerPageIndex = 0 @Published var readerTargetPageIndex: Int? + @Published var readerTargetLocationID: String? + @Published var readerTargetLocationTitle: String? @Published var focusedPane: PaneFocus = .reader @Published var focusRequest = 0 @Published var layout: WorkspaceLayout = .documentAgentNotes @@ -98,12 +101,14 @@ final class WorkspaceStore: ObservableObject { private var notesByItemID: [String: String] = [:] private let storageURL: URL private let piRuntime: PiAgentRuntime + private let courseDocumentSearchIndex: CourseDocumentSearchIndex private var activeAgentRequestID: UUID? private var agentRequestTask: Task<Void, Never>? private var quietInsightTask: Task<Void, Never>? private var quietInsightTaskID: UUID? private var agentContextRevision: UInt64 = 0 private var lastAgentReplyContextRevision: UInt64? + private var latestAgentLearningUpdateQuestion: String? private var stagedNoteDraft: (itemID: String, value: String)? private var quietInsightSignature = "" private var isRestoringNavigation = false @@ -140,6 +145,8 @@ final class WorkspaceStore: ObservableObject { var noteRenderMode: NoteRenderMode var showReaderSearch: Bool var readerSearch: String + var readerLocationID: String? + var readerLocationTitle: String? var readerPageIndex: Int var focusedPane: PaneFocus var threePaneOrder: [WorkspacePaneRole] @@ -163,6 +170,12 @@ final class WorkspaceStore: ObservableObject { var fallbackText: String } + private struct CourseContextBuildResult: Sendable { + var context: StudyAgentCourseContext + var selectedMaterialText: String? + var selectedMaterialIsTruncated: Bool + } + private var lastUsableAgentAnswer: AgentMessage? { guard lastAgentReplyContextRevision == agentContextRevision else { return nil } return messages.last { $0.isUsableAgentAnswer } @@ -176,10 +189,18 @@ final class WorkspaceStore: ObservableObject { let folder = Self.workspaceRootDirectory() ?? FileManager.default.temporaryDirectory.appendingPathComponent("WeiBei", isDirectory: true) storageURL = folder.appendingPathComponent("workspace.json") piRuntime = PiAgentRuntime(runtimeDirectory: folder.appendingPathComponent("AgentRuntime", isDirectory: true)) + let courseIndexDirectory = folder.appendingPathComponent("CourseIndex", isDirectory: true) + Self.removeLegacyCourseIndex(in: courseIndexDirectory) + courseDocumentSearchIndex = CourseDocumentSearchIndex( + databaseURL: courseIndexDirectory.appendingPathComponent("course-search-v3.sqlite3") + ) try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) load() + let migratedStudyLocationTitles = refreshStudyLocationReferenceTitles() + courseDocumentSearchIndex.synchronize(allItems) ensureActiveStudySession() migrateNoteSourceLinksFromMarkdown() + if migratedStudyLocationTitles { save() } floatingSelectionPrompt = ui("当前选区", "Current selection") if selectedItemID == nil { select(itemID: sampleItems[0].id) @@ -208,6 +229,20 @@ final class WorkspaceStore: ObservableObject { studySessions.sorted { $0.updatedAt > $1.updatedAt } } + var orderedLearningMemoryEntries: [LearningMemoryEntry] { + learningMemoryEntries.sorted { $0.updatedAt > $1.updatedAt } + } + + func learningMemoryKindLabel(_ kind: LearningMemoryKind) -> String { + switch kind { + case .goal: ui("目标", "Goal") + case .understood: ui("已理解", "Understood") + case .confusion: ui("困惑", "Confusion") + case .nextStep: ui("下一步", "Next Step") + case .preference: ui("偏好", "Preference") + } + } + var activeStudySessionTitle: String { activeStudySession?.title ?? ui("新学习会话", "New Study Session") } @@ -292,6 +327,8 @@ final class WorkspaceStore: ObservableObject { allItems.contains(where: { $0.id == location.itemID }) else { return } select(itemID: location.itemID) readerTargetPageIndex = location.pageIndex + readerTargetLocationID = location.locationID + readerTargetLocationTitle = location.locationTitle showReader = true focus(.reader) } @@ -448,7 +485,7 @@ final class WorkspaceStore: ObservableObject { var selectedContextText: String { guard let item = selectedMaterialItem else { return "" } - if let text = DocumentTextExtractor.text(for: item) { + if let text = DocumentTextExtractor.cachedText(for: item) { return text } return sampleText(for: item) @@ -459,13 +496,60 @@ final class WorkspaceStore: ObservableObject { } var agentMessageSourceTitle: String? { - hasSelectedMaterial ? currentReferenceTitle : activeNoteItem.map(displayTitle) + hasSelectedMaterial ? currentSourceReferenceTitle : activeNoteItem.map(displayTitle) } var currentReferenceTitle: String { readerLocationTitle ?? selectedMaterialItem.map(displayTitle) ?? activeNoteItem.map(displayTitle) ?? ui("当前笔记", "Current note") } + var currentSourceReferenceTitle: String { + guard let item = selectedMaterialItem else { + return activeNoteItem.map(displayTitle) ?? ui("当前笔记", "Current note") + } + let itemTitle = sourceReferenceBaseTitle(for: item) + switch item.kind { + case .pdf: + return ui("\(itemTitle),第 \(readerPageIndex + 1) 页", "\(itemTitle), page \(readerPageIndex + 1)") + case .html: + guard let locationTitle = readerLocationTitle, + locationTitle != itemTitle else { return itemTitle } + if let locationID = readerLocationID, + locationID.hasPrefix("html-section-") { + return ui( + "\(itemTitle),章节标识:\(locationID),章节:\(locationTitle)", + "\(itemTitle), section id: \(locationID), section: \(locationTitle)" + ) + } + let sectionOrdinal = readerLocationID.flatMap { id -> Int? in + guard id.hasPrefix("html-heading-") else { return nil } + return Int(id.dropFirst("html-heading-".count)).map { $0 + 1 } + } + if let sectionOrdinal { + return ui( + "\(itemTitle),章节序号:\(sectionOrdinal),章节:\(locationTitle)", + "\(itemTitle), section number: \(sectionOrdinal), section: \(locationTitle)" + ) + } + return ui("\(itemTitle),章节:\(locationTitle)", "\(itemTitle), section: \(locationTitle)") + case .markdown, .text: + return itemTitle + } + } + + private func sourceReferenceBaseTitle(for item: StudyItem) -> String { + let title = displayTitle(for: item) + let catalog = Array(allItems.prefix(500)) + let matchingIndexes = catalog.indices.filter { + displayTitle(for: catalog[$0]) == title + } + guard matchingIndexes.count > 1, + let index = catalog.firstIndex(where: { $0.id == item.id }) else { + return title + } + return ui("\(title),条目:\(index + 1)", "\(title), item: \(index + 1)") + } + var hasSelectionAttachments: Bool { !selectionAttachments.isEmpty } @@ -699,8 +783,17 @@ final class WorkspaceStore: ObservableObject { selectionAttachments = [] lastSelectionAttachmentDate = nil readerPageIndex = 0 + readerLocationID = nil + readerTargetPageIndex = nil + readerTargetLocationID = nil + readerTargetLocationTitle = nil + } + if itemChanged { + readerLocationTitle = selectedMaterialItem.map(displayTitle) + restoreCurrentStudyLocation() + } else if readerLocationTitle == nil { + readerLocationTitle = selectedMaterialItem.map(displayTitle) } - readerLocationTitle = selectedMaterialItem.map(displayTitle) clearReaderSearchIfNeeded() noteText = noteText(for: activeNoteItem) latestAgentNoteProposal = nil @@ -1052,6 +1145,25 @@ final class WorkspaceStore: ObservableObject { recordCurrentStudyLocation(incrementVisit: false) } + func updateReaderHTMLLocation(id: String?, title: String?) { + guard selectedMaterialItem?.kind == .html else { return } + let cleanedID = id?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + let cleanedTitle = title?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + let nextID = cleanedID.isEmpty ? nil : String(cleanedID.prefix(500)) + let nextTitle = cleanedTitle.isEmpty ? selectedMaterialItem.map(displayTitle) : String(cleanedTitle.prefix(300)) + guard readerLocationID != nextID || readerLocationTitle != nextTitle else { return } + invalidateAgentContext() + readerLocationID = nextID + readerLocationTitle = nextTitle + if readerTargetLocationID == nextID { + readerTargetLocationID = nil + } + if readerTargetLocationTitle == nextTitle { + readerTargetLocationTitle = nil + } + recordCurrentStudyLocation(incrementVisit: false) + } + func updateReaderPageIndex(_ index: Int) { let nextIndex = max(index, 0) guard readerPageIndex != nextIndex else { return } @@ -1065,7 +1177,8 @@ final class WorkspaceStore: ObservableObject { let previous = studyLocationsByItemID[item.id] studyLocationsByItemID[item.id] = StudyLocation( itemID: item.id, - itemTitle: displayTitle(for: item), + itemTitle: sourceReferenceBaseTitle(for: item), + locationID: item.kind == .html ? readerLocationID : nil, locationTitle: readerLocationTitle, pageIndex: item.kind == .pdf ? readerPageIndex : nil, lastStudiedAt: Date(), @@ -1084,13 +1197,18 @@ final class WorkspaceStore: ObservableObject { private func restoreCurrentStudyLocation() { guard let item = selectedMaterialItem else { return } guard let location = studyLocationsByItemID[item.id] else { + readerLocationID = nil readerLocationTitle = displayTitle(for: item) return } + readerLocationID = item.kind == .html ? location.locationID : nil readerLocationTitle = location.locationTitle ?? displayTitle(for: item) if item.kind == .pdf { readerPageIndex = max(location.pageIndex ?? 0, 0) readerTargetPageIndex = location.pageIndex.map { max($0, 0) } + } else if item.kind == .html { + readerTargetLocationID = location.locationID + readerTargetLocationTitle = location.locationTitle } } @@ -1119,6 +1237,11 @@ final class WorkspaceStore: ObservableObject { return true } readerTargetPageIndex = item.kind == .pdf ? reference.pageIndex : nil + readerTargetLocationID = item.kind == .html + ? reference.sectionLocationID + ?? reference.sectionOrdinal.map { "html-heading-\(max($0 - 1, 0))" } + : nil + readerTargetLocationTitle = item.kind == .html ? reference.sectionTitle : nil focus(.reader) return true } @@ -1391,6 +1514,8 @@ final class WorkspaceStore: ObservableObject { noteRenderMode: noteRenderMode, showReaderSearch: showReaderSearch, readerSearch: readerSearch, + readerLocationID: readerLocationID, + readerLocationTitle: readerLocationTitle, readerPageIndex: readerPageIndex, focusedPane: focusedPane, threePaneOrder: normalizedThreePaneOrder @@ -1412,12 +1537,15 @@ final class WorkspaceStore: ObservableObject { noteRenderMode = snapshot.noteRenderMode.visibleMode showReaderSearch = snapshot.showReaderSearch readerSearch = snapshot.readerSearch + readerLocationID = snapshot.readerLocationID + readerLocationTitle = snapshot.readerLocationTitle readerPageIndex = snapshot.readerPageIndex focusedPane = snapshot.focusedPane threePaneOrder = WorkspacePaneRole.normalized(snapshot.threePaneOrder) noteText = noteText(for: activeNoteItem) - readerLocationTitle = selectedMaterialItem.map(displayTitle) readerTargetPageIndex = selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil + readerTargetLocationID = selectedMaterialItem?.kind == .html ? snapshot.readerLocationID : nil + readerTargetLocationTitle = selectedMaterialItem?.kind == .html ? snapshot.readerLocationTitle : nil latestAgentNoteProposal = nil latestAgentLearningUpdate = nil syncActiveStudySession() @@ -1672,6 +1800,7 @@ final class WorkspaceStore: ObservableObject { guard interfaceLanguage != language else { return } interfaceLanguage = language floatingSelectionPrompt = ui("当前选区", "Current selection") + _ = refreshStudyLocationReferenceTitles() save() } @@ -1732,6 +1861,7 @@ final class WorkspaceStore: ObservableObject { } importedItems.append(contentsOf: newItems) + courseDocumentSearchIndex.synchronize(allItems) if let first = newItems.first { select(itemID: first.id) } else { @@ -1832,6 +1962,7 @@ final class WorkspaceStore: ObservableObject { selectedItemID = newID } replaceNavigationItemID(oldID, with: newID) + courseDocumentSearchIndex.synchronize(allItems) save() notebookRenameDraft = nil showTransientNoteStatus(ui("已重命名为:\(newURL.lastPathComponent)", "Renamed to: \(newURL.lastPathComponent)")) @@ -1874,6 +2005,7 @@ final class WorkspaceStore: ObservableObject { if !importedItems.contains(where: { $0.urlPath == url.path }) { importedItems.append(item) } + courseDocumentSearchIndex.synchronize(allItems) select(itemID: item.id) showTransientNoteStatus(ui("已创建双链笔记:\(url.lastPathComponent)", "Created wiki note: \(url.lastPathComponent)")) } catch { @@ -1914,6 +2046,7 @@ final class WorkspaceStore: ObservableObject { let markdown = defaultNotebookNote(title: item.title, sourceItem: sourceItem) try markdown.write(to: url, atomically: true, encoding: .utf8) importedItems.append(item) + courseDocumentSearchIndex.synchronize(allItems) if let sourceItem { addNoteSourceLink(noteItemID: item.id, sourceItemID: sourceItem.id) } @@ -1992,7 +2125,7 @@ final class WorkspaceStore: ObservableObject { reference = quotedReferenceBlock(text: selection, sourceTitle: selectionContext.ownerTitle) } else { guard selectedMaterialItem != nil || activeNoteItem?.isNotebookNote == true else { return } - reference = ui("来源:\(currentReferenceTitle)", "Source: \(currentReferenceTitle)") + reference = ui("来源:\(currentSourceReferenceTitle)", "Source: \(currentSourceReferenceTitle)") } NSPasteboard.general.clearContents() NSPasteboard.general.setString(reference, forType: .string) @@ -2213,7 +2346,7 @@ final class WorkspaceStore: ObservableObject { if source == .note || activeNoteItem?.isNotebookNote == true { return activeNoteItem.map(displayTitle) ?? ui("当前笔记", "Current note") } - return currentReferenceTitle + return currentSourceReferenceTitle } private static func boundedSelectionText(_ text: String) -> String { @@ -2230,9 +2363,19 @@ final class WorkspaceStore: ObservableObject { private func sourceReferenceItem(from rawReference: String?) -> StudyItem? { let reference = SourceReferenceTitle.parse(rawReference ?? "") guard !reference.title.isEmpty else { return nil } - return allItems.first { - $0.title == reference.title || $0.subtitle == reference.title + if let ordinal = reference.courseItemOrdinal { + let catalog = Array(allItems.prefix(500)) + let index = ordinal - 1 + guard catalog.indices.contains(index) else { return nil } + let item = catalog[index] + guard displayTitle(for: item) == reference.title + || displaySubtitle(for: item) == reference.title else { return nil } + return item + } + let matches = allItems.filter { + displayTitle(for: $0) == reference.title || displaySubtitle(for: $0) == reference.title } + return matches.count == 1 ? matches[0] : nil } private func addNoteSourceLink(noteItemID: String, sourceItemID: String) { @@ -2245,23 +2388,34 @@ final class WorkspaceStore: ObservableObject { private func migrateNoteSourceLinksFromMarkdown() { let previousCount = noteSourceLinks.count - let materials = allItems.filter { !$0.isNotebookNote } for note in allItems where note.isNotebookNote { let markdown = noteMarkdownText(for: note) for rawLine in markdown.components(separatedBy: .newlines) { let line = rawLine.trimmingCharacters(in: .whitespacesAndNewlines) guard line.contains("来源:") || line.localizedCaseInsensitiveContains("source:") else { continue } - let reference = SourceReferenceTitle.parse(line) - guard let source = materials.first(where: { - $0.title == reference.title || $0.subtitle == reference.title - }) else { continue } + guard let source = sourceReferenceItem(from: line), !source.isNotebookNote else { continue } addNoteSourceLink(noteItemID: note.id, sourceItemID: source.id) } } if noteSourceLinks.count != previousCount { save() } } - private func makeCourseContext(query: String) async throws -> StudyAgentCourseContext { + @discardableResult + private func refreshStudyLocationReferenceTitles() -> Bool { + var changed = false + for itemID in Array(studyLocationsByItemID.keys) { + guard let item = allItems.first(where: { $0.id == itemID }), + var location = studyLocationsByItemID[itemID] else { continue } + let title = sourceReferenceBaseTitle(for: item) + guard location.itemTitle != title else { continue } + location.itemTitle = title + studyLocationsByItemID[itemID] = location + changed = true + } + return changed + } + + private func makeCourseContext(query: String) async throws -> CourseContextBuildResult { let candidates = allItems.map { item in let embeddedText: String? if item.isNotebookNote { @@ -2286,14 +2440,28 @@ final class WorkspaceStore: ObservableObject { let links = noteSourceLinks let currentMaterialID = selectedMaterialItem?.id let currentNoteID = activeNoteItem?.isNotebookNote == true ? activeNoteItem?.id : nil + let searchIndex = courseDocumentSearchIndex let indexingTask = Task.detached(priority: .userInitiated) { + let indexedByItemID = searchIndex.lookup( + items: candidates.map(\.item), + query: query + ) var sources: [CourseKnowledgeSource] = [] sources.reserveCapacity(candidates.count) for candidate in candidates { try Task.checkCancellation() - let text = candidate.embeddedText - ?? DocumentTextExtractor.indexText(for: candidate.item) + let indexed = indexedByItemID[candidate.item.id] + let sampleIndexedText = candidate.item.isSample + ? DocumentTextExtractor.indexText(for: candidate.item, query: query) + : nil + let selectedIndexedText = candidate.item.id == currentMaterialID ? indexed?.text : nil + let text = selectedIndexedText + ?? candidate.embeddedText + ?? indexed?.text + ?? sampleIndexedText ?? candidate.fallbackText + let isTruncated = indexed?.isTruncated + ?? (candidate.item.url != nil && !candidate.item.isSample) sources.append( CourseKnowledgeSource( id: candidate.item.id, @@ -2301,17 +2469,23 @@ final class WorkspaceStore: ObservableObject { subtitle: candidate.subtitle, kind: candidate.item.kind.rawValue, role: candidate.item.isNotebookNote ? "note" : "material", - text: text + text: text, + isTruncated: isTruncated ) ) } - return CourseKnowledgeIndex.build( - title: title, - sources: sources, - links: links, - query: query, - currentMaterialID: currentMaterialID, - currentNoteID: currentNoteID + let selectedIndex = currentMaterialID.flatMap { indexedByItemID[$0] } + return CourseContextBuildResult( + context: CourseKnowledgeIndex.build( + title: title, + sources: sources, + links: links, + query: query, + currentMaterialID: currentMaterialID, + currentNoteID: currentNoteID + ), + selectedMaterialText: selectedIndex?.text, + selectedMaterialIsTruncated: selectedIndex?.isTruncated ?? false ) } return try await withTaskCancellationHandler { @@ -2326,7 +2500,7 @@ final class WorkspaceStore: ObservableObject { StudyAgentSessionSnapshot( id: session.id.uuidString.lowercased(), title: session.title, - summary: session.summary, + summary: sessionContinuitySummary(for: session), phase: session.flow.phase.rawValue, focusItemIDs: session.focusItemIDs, turnCount: session.messages.count @@ -2340,10 +2514,35 @@ final class WorkspaceStore: ObservableObject { ) } + private func sessionContinuitySummary(for session: StudySession) -> String { + let recentMessageLimit = 20 + let olderMessages = Array(session.messages.dropLast(min(session.messages.count, recentMessageLimit))) + let selectedOlderMessages: [AgentMessage] + if olderMessages.count <= 12 { + selectedOlderMessages = olderMessages + } else { + selectedOlderMessages = Array(olderMessages.prefix(4)) + Array(olderMessages.suffix(8)) + } + let earlierTranscript = selectedOlderMessages.map { message in + let role = message.role == .user ? ui("用户", "User") : ui("助手", "Assistant") + let text = message.text + .replacingOccurrences(of: #"\s+"#, with: " ", options: .regularExpression) + .trimmingCharacters(in: .whitespacesAndNewlines) + return "\(role):\(String(text.prefix(220)))" + }.joined(separator: "\n") + let persistedSummary = session.summary.trimmingCharacters(in: .whitespacesAndNewlines) + let parts = [ + persistedSummary, + earlierTranscript.isEmpty ? "" : "\(ui("更早对话摘录", "Earlier conversation excerpts")):\n\(earlierTranscript)", + ].filter { !$0.isEmpty } + return String(parts.joined(separator: "\n\n").prefix(2_000)) + } + private func applyLearningUpdate( _ update: StudyAgentLearningUpdate?, expectedContextRevision: String, - expectedMemoryRevision: UInt64 + expectedMemoryRevision: UInt64, + expectedUserQuestion: String ) { latestAgentLearningUpdate = nil guard let update, @@ -2357,18 +2556,35 @@ final class WorkspaceStore: ObservableObject { let text = proposed.text.trimmingCharacters(in: .whitespacesAndNewlines) let evidence = proposed.evidence.trimmingCharacters(in: .whitespacesAndNewlines) guard !text.isEmpty, !evidence.isEmpty else { continue } + if (evidence.hasPrefix("[用户:本轮]") || evidence.hasPrefix("[会话:当前]")), + !Self.currentTurnEvidenceMatches(evidence, question: expectedUserQuestion) { + continue + } + if proposed.origin == .userStatement, + !evidence.hasPrefix("[用户:本轮]") { + continue + } let normalized = Self.normalizedMemoryText(text) if let index = learningMemoryEntries.firstIndex(where: { $0.kind == proposed.kind && $0.status == .active && Self.normalizedMemoryText($0.text) == normalized + && ( + $0.origin == .userStatement + || proposed.origin == .userStatement + || $0.sessionID == activeStudySessionID + ) }) { + if learningMemoryEntries[index].origin == .userStatement, + proposed.origin != .userStatement { + continue + } learningMemoryEntries[index].text = String(text.prefix(500)) learningMemoryEntries[index].evidence = String(evidence.prefix(400)) if proposed.origin == .userStatement { learningMemoryEntries[index].origin = .userStatement + learningMemoryEntries[index].sessionID = activeStudySessionID } - learningMemoryEntries[index].sessionID = activeStudySessionID learningMemoryEntries[index].updatedAt = now changed = true } else { @@ -2419,7 +2635,79 @@ final class WorkspaceStore: ObservableObject { ) } if changed { learningMemoryRevision &+= 1 } - latestAgentLearningUpdate = update + var acceptedUpdate = update + acceptedUpdate.resolutions = update.resolutions.prefix(12).filter { resolution in + guard Self.resolutionEvidenceMatches( + resolution.evidence.trimmingCharacters(in: .whitespacesAndNewlines), + question: expectedUserQuestion + ), + let memoryID = UUID(uuidString: resolution.memoryID), + let memory = learningMemoryEntries.first(where: { $0.id == memoryID }) else { + return false + } + return memory.status == .active + && (memory.kind == .goal || memory.kind == .confusion || memory.kind == .nextStep) + } + latestAgentLearningUpdate = acceptedUpdate + latestAgentLearningUpdateQuestion = expectedUserQuestion + } + + func isLearningMemoryResolved(_ memoryID: String) -> Bool { + guard let id = UUID(uuidString: memoryID) else { return false } + return learningMemoryEntries.first(where: { $0.id == id })?.status == .resolved + } + + func confirmLearningMemoryResolution(_ resolution: StudyAgentMemoryResolution) { + guard latestAgentLearningUpdate?.resolutions.contains(resolution) == true, + let question = latestAgentLearningUpdateQuestion, + Self.resolutionEvidenceMatches(resolution.evidence, question: question), + let memoryID = UUID(uuidString: resolution.memoryID), + let index = learningMemoryEntries.firstIndex(where: { + $0.id == memoryID + && $0.status == .active + && ($0.kind == .goal || $0.kind == .confusion || $0.kind == .nextStep) + }) else { return } + let now = Date() + learningMemoryEntries[index].status = .resolved + learningMemoryEntries[index].resolvedAt = now + learningMemoryEntries[index].resolutionEvidence = String(resolution.evidence.prefix(400)) + learningMemoryEntries[index].updatedAt = now + learningMemoryRevision &+= 1 + save() + } + + func resolveLearningMemory(_ memoryID: UUID) { + guard let index = learningMemoryEntries.firstIndex(where: { + $0.id == memoryID + && $0.status == .active + && ($0.kind == .goal || $0.kind == .confusion || $0.kind == .nextStep) + }) else { return } + let now = Date() + learningMemoryEntries[index].status = .resolved + learningMemoryEntries[index].resolvedAt = now + learningMemoryEntries[index].resolutionEvidence = "[用户:界面确认]" + learningMemoryEntries[index].updatedAt = now + learningMemoryRevision &+= 1 + save() + } + + func restoreLearningMemory(_ memoryID: UUID) { + guard let index = learningMemoryEntries.firstIndex(where: { + $0.id == memoryID && $0.status == .resolved + }) else { return } + let now = Date() + learningMemoryEntries[index].status = .active + learningMemoryEntries[index].resolvedAt = nil + learningMemoryEntries[index].resolutionEvidence = nil + learningMemoryEntries[index].updatedAt = now + learningMemoryRevision &+= 1 + save() + } + + func restoreLearningMemoryResolution(_ resolution: StudyAgentMemoryResolution) { + guard latestAgentLearningUpdate?.resolutions.contains(resolution) == true, + let memoryID = UUID(uuidString: resolution.memoryID) else { return } + restoreLearningMemory(memoryID) } private static func normalizedMemoryText(_ text: String) -> String { @@ -2429,6 +2717,14 @@ final class WorkspaceStore: ObservableObject { .joined() } + private static func currentTurnEvidenceMatches(_ evidence: String, question: String) -> Bool { + StudyAgentCurrentTurnEvidence.matches(evidence, question: question) + } + + private static func resolutionEvidenceMatches(_ evidence: String, question: String) -> Bool { + StudyAgentResolutionEvidence.matches(evidence, question: question) + } + func askToOrganizeNote() { agentDraft = ui( "请根据\(agentPromptScope),把笔记整理成更清晰的大纲,保留来源信息,并标出缺少证据的位置。", @@ -2538,16 +2834,30 @@ final class WorkspaceStore: ObservableObject { } func refreshQuietInsight() async { + guard !isAskingAgent, !isGeneratingQuietInsight else { return } + isGeneratingQuietInsight = true + defer { isGeneratingQuietInsight = false } + let materialTitle = quietInsightReferenceTitle - let materialText = selectedContextText + let materialItem = selectedMaterialItem + let cachedMaterialText = selectedContextText + let loadedMaterialText: String? + if cachedMaterialText.isEmpty, let materialItem { + loadedMaterialText = await Task.detached(priority: .utility) { + DocumentTextExtractor.text(for: materialItem) + }.value + } else { + loadedMaterialText = nil + } + guard !Task.isCancelled, + materialItem?.id == selectedMaterialItem?.id else { return } + let materialText = loadedMaterialText ?? cachedMaterialText let currentNoteText = noteText let selectionText = selectionContext?.text let contextScope = hasSelectedMaterial ? ui("当前材料、当前选区和当前笔记", "the current material, current selection, and current note") : ui("当前选区和当前笔记", "the current selection and current note") let evidenceText = hasSelectedMaterial ? ui("如果材料没有证据,就直接说未在材料中确认。", "If the material has no evidence, say it is not confirmed in the material.") : ui("如果笔记和选区没有证据,就直接说未在笔记或选区中确认。", "If the note and selection have no evidence, say it is not confirmed in the note or selection.") let signature = makeQuietInsightSignature(materialText: materialText, noteText: currentNoteText, selectionText: selectionText) - guard signature != quietInsightSignature, - !isAskingAgent, - !isGeneratingQuietInsight else { return } + guard signature != quietInsightSignature else { return } let requestID = UUID() let requestWorkspaceRevision = agentContextRevision @@ -2570,13 +2880,10 @@ final class WorkspaceStore: ObservableObject { contextRevision: "\(requestWorkspaceRevision):\(requestID.uuidString.lowercased())" ) - isGeneratingQuietInsight = true - defer { isGeneratingQuietInsight = false } - do { let reply = try await executeStudyAgentRequest(request) guard requestWorkspaceRevision == agentContextRevision, - signature == makeQuietInsightSignature(materialText: selectedContextText, noteText: noteText, selectionText: selectionContext?.text) else { return } + materialItem?.id == selectedMaterialItem?.id else { return } guard reply.backend != .offline else { generatedQuietInsight = nil return @@ -2589,7 +2896,7 @@ final class WorkspaceStore: ObservableObject { } private var quietInsightReferenceTitle: String { - selectionContext?.ownerTitle ?? (hasSelectedMaterial ? currentReferenceTitle : activeNoteItem.map(displayTitle)) ?? ui("当前笔记", "Current note") + selectionContext?.ownerTitle ?? (hasSelectedMaterial ? currentSourceReferenceTitle : activeNoteItem.map(displayTitle)) ?? ui("当前笔记", "Current note") } func applyLastAgentAnswerToNote() { @@ -2657,10 +2964,21 @@ final class WorkspaceStore: ObservableObject { let answer = messages.last?.text ?? "" let recordedConfusion = latestAgentLearningUpdate?.entries.contains { $0.kind == .confusion } == true let hasJumpReference = answer.contains(ui("来源:", "Source:")) + let previousItemID = selectedItemID + let previousLearningUpdate = latestAgentLearningUpdate + let openedJumpReference = openSourceReference(answer) + if openedJumpReference, let previousItemID { + select(itemID: previousItemID) + latestAgentLearningUpdate = previousLearningUpdate + lastAgentReplyContextRevision = agentContextRevision + } recordVerificationStage("course-memory-reply:\(messages.last?.backend?.rawValue ?? "none")") recordVerificationStage("course-memory-update:\(recordedConfusion)") - recordVerificationStage("course-memory-jump:\(hasJumpReference)") - if messages.last?.backend == .pi, recordedConfusion, hasJumpReference { + recordVerificationStage("course-memory-jump:\(hasJumpReference && openedJumpReference)") + if messages.last?.backend == .pi, + recordedConfusion, + hasJumpReference, + openedJumpReference { let markerURL = storageURL.deletingLastPathComponent().appendingPathComponent("pi-course-memory-verified.txt") try? "PI backend completed course memory and wayfinding\n".write(to: markerURL, atomically: true, encoding: .utf8) } @@ -2671,7 +2989,7 @@ final class WorkspaceStore: ObservableObject { updateSelection( ui("利率是资金使用价格的表达。", "An interest rate is the price paid for using funds."), source: .document, - ownerTitle: currentReferenceTitle + ownerTitle: currentSourceReferenceTitle ) recordVerificationStage("context-prepared") agentDraft = ui("解释选区,并整理成可以写入笔记的要点。", "Explain the selection and turn it into note-ready points.") @@ -2793,12 +3111,12 @@ final class WorkspaceStore: ObservableObject { let sentSelectionTitle = agentSelectionTitle let sentSelectionText = agentSelectionText let shouldClearSentDocumentSelection = sentSelectionText != nil && selectionContext?.source == .document - let recentMessages = Array(messages.suffix(8)) + let recentMessages = Array(messages.suffix(20)) let sourceTitle = agentMessageSourceTitle let requestID = UUID() let requestWorkspaceRevision = agentContextRevision let requestMemoryRevision = learningMemoryRevision - let sentMaterialTitle = currentReferenceTitle + let sentMaterialTitle = currentSourceReferenceTitle let sentMaterialText = selectedContextText let sentNoteTitle = agentNoteTitle let sentNoteText = noteText @@ -2836,7 +3154,7 @@ final class WorkspaceStore: ObservableObject { var didAppendUserMessage = false do { - let courseContext = try await makeCourseContext(query: courseQuery) + let courseBuild = try await makeCourseContext(query: courseQuery) guard activeAgentRequestID == requestID, requestWorkspaceRevision == agentContextRevision, requestMemoryRevision == learningMemoryRevision else { @@ -2850,13 +3168,14 @@ final class WorkspaceStore: ObservableObject { purpose: .conversation, question: question, materialTitle: sentMaterialTitle, - materialText: sentMaterialText, + materialText: courseBuild.selectedMaterialText ?? sentMaterialText, + materialIsTruncated: courseBuild.selectedMaterialIsTruncated, noteTitle: sentNoteTitle, noteText: sentNoteText, selectionTitle: sentSelectionTitle, selectionText: sentSelectionText, recentMessages: recentMessages, - courseContext: courseContext, + courseContext: courseBuild.context, learningContext: sentLearningContext, language: sentLanguage, contextRevision: "\(requestWorkspaceRevision):\(requestID.uuidString.lowercased())" @@ -2869,12 +3188,14 @@ final class WorkspaceStore: ObservableObject { } let reply = try await executeStudyAgentRequest(request) guard activeAgentRequestID == request.id, - requestWorkspaceRevision == agentContextRevision else { return } + requestWorkspaceRevision == agentContextRevision, + requestMemoryRevision == learningMemoryRevision else { return } latestAgentNoteProposal = reply.noteProposal applyLearningUpdate( reply.learningUpdate, expectedContextRevision: request.contextRevision, - expectedMemoryRevision: requestMemoryRevision + expectedMemoryRevision: requestMemoryRevision, + expectedUserQuestion: request.question ) lastAgentReplyContextRevision = requestWorkspaceRevision appendAgentMessage( @@ -2924,11 +3245,15 @@ final class WorkspaceStore: ObservableObject { } private func executeStudyAgentRequest(_ request: StudyAgentRequest) async throws -> StudyAgentReply { - if Self.environmentValue("WEIBEI_FORCE_OFFLINE_AGENT") == "1" { + let isExplicitOfflineVerification = Self.environmentValue("WEIBEI_FORCE_OFFLINE_AGENT") == "1" + && Self.environmentValue("WEIBEI_SUPPRESS_ACTIVATION") == "1" + && Self.environmentValue("WEIBEI_VERIFY_SCENARIO") == "offline-learning-flow" + if isExplicitOfflineVerification { return try await OfflineStudyAgentRuntime().respond(to: request) } let credential = resolvedOpenAIAPIKey() + var piFailure: Error? if Self.environmentValue("WEIBEI_PI_DISABLED") != "1" { let explicitProvider = Self.environmentValue("WEIBEI_PI_PROVIDER") let explicitModel = Self.environmentValue("WEIBEI_PI_MODEL") @@ -2951,12 +3276,14 @@ final class WorkspaceStore: ObservableObject { throw PiAgentRuntimeError.cancelled } guard error.permitsAutomaticFallback else { throw error } + piFailure = error openAIKeyStatus = ui( "PI 暂不可用:\(error.localizedDescription)", "PI is unavailable: \(error.localizedDescription)" ) } catch { if Task.isCancelled { throw PiAgentRuntimeError.cancelled } + piFailure = error openAIKeyStatus = ui( "PI 暂不可用:\(error.localizedDescription)", "PI is unavailable: \(error.localizedDescription)" @@ -2964,6 +3291,10 @@ final class WorkspaceStore: ObservableObject { } } + if request.purpose == .conversation { + throw piFailure ?? PiAgentRuntimeError.unavailable + } + if let credential { do { let client = OpenAIResponsesClient(apiKey: credential.key, model: resolvedModelName) @@ -3395,6 +3726,7 @@ final class WorkspaceStore: ObservableObject { try markdown.write(to: url, atomically: true, encoding: .utf8) notesByItemID.removeValue(forKey: noteItemID) noteFileError = nil + courseDocumentSearchIndex.schedule([item]) } catch { notesByItemID[noteItemID] = markdown noteFileError = ui("无法写回原 Markdown:\(url.lastPathComponent)", "Could not write original Markdown: \(url.lastPathComponent)") @@ -3554,6 +3886,19 @@ final class WorkspaceStore: ObservableObject { OpenAIAPIKeyStore.cleaned(ProcessInfo.processInfo.environment[name] ?? "") } + private static func removeLegacyCourseIndex(in directory: URL) { + for version in ["v1", "v2"] { + let legacy = directory.appendingPathComponent("course-search-\(version).sqlite3") + for url in [ + legacy, + URL(fileURLWithPath: legacy.path + "-wal"), + URL(fileURLWithPath: legacy.path + "-shm"), + ] where FileManager.default.fileExists(atPath: url.path) { + try? FileManager.default.removeItem(at: url) + } + } + } + private static func workspaceRootDirectory() -> URL? { let override = environmentValue("WEIBEI_WORKSPACE_DIR") if !override.isEmpty { diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 87614a7f6..698f1bca3 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -1714,6 +1714,40 @@ struct AgentPaneView: View { } } + if !store.orderedLearningMemoryEntries.isEmpty { + Divider() + Menu { + ForEach(Array(store.orderedLearningMemoryEntries.prefix(20))) { memory in + if memory.status == .resolved { + Button { + store.restoreLearningMemory(memory.id) + } label: { + Label( + "\(store.learningMemoryKindLabel(memory.kind)):\(String(memory.text.prefix(64)))", + systemImage: "arrow.uturn.backward" + ) + } + } else if memory.kind == .goal || memory.kind == .confusion || memory.kind == .nextStep { + Button { + store.resolveLearningMemory(memory.id) + } label: { + Label( + "\(store.learningMemoryKindLabel(memory.kind)):\(String(memory.text.prefix(64)))", + systemImage: "checkmark.circle" + ) + } + } else { + Label( + "\(store.learningMemoryKindLabel(memory.kind)):\(String(memory.text.prefix(64)))", + systemImage: "brain.head.profile" + ) + } + } + } label: { + Label(store.ui("学习记忆", "Learning Memory"), systemImage: "brain.head.profile") + } + } + if store.hasCurrentSessionInferredMemory { Divider() Button(role: .destructive) { @@ -2988,7 +3022,7 @@ private struct AgentBubble: View { if message.id == store.lastUsableAgentAnswerID { if let update = store.latestAgentLearningUpdate, - !update.entries.isEmpty || !update.suggestedNext.isEmpty { + !update.entries.isEmpty || !update.resolutions.isEmpty || !update.suggestedNext.isEmpty { learningUpdateContent(update) } if let proposal = store.latestAgentNoteProposal, !proposal.evidence.isEmpty { @@ -3041,6 +3075,28 @@ private struct AgentBubble: View { .fixedSize(horizontal: false, vertical: true) } + ForEach(Array(update.resolutions.prefix(4).enumerated()), id: \.offset) { _, resolution in + let isResolved = store.isLearningMemoryResolved(resolution.memoryID) + HStack(alignment: .top, spacing: 6) { + Text(store.ui("建议结案:\(resolution.text)", "Suggested resolution: \(resolution.text)")) + .font(.caption) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .fixedSize(horizontal: false, vertical: true) + Spacer(minLength: 4) + Button { + if isResolved { + store.restoreLearningMemoryResolution(resolution) + } else { + store.confirmLearningMemoryResolution(resolution) + } + } label: { + Image(systemName: isResolved ? "arrow.uturn.backward" : "checkmark.circle") + } + .buttonStyle(WeiBeiIconButtonStyle(active: isResolved, size: 22)) + .help(store.ui(isResolved ? "撤销结案" : "确认结案", isResolved ? "Undo resolution" : "Confirm resolution")) + } + } + ForEach(Array(update.suggestedNext.prefix(3).enumerated()), id: \.offset) { _, next in Text("→ \(next)") .font(.caption) diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift index 5f2f39cda..9297199cd 100644 --- a/Sources/WeiBei/Views/ReaderView.swift +++ b/Sources/WeiBei/Views/ReaderView.swift @@ -205,7 +205,9 @@ struct ReaderView: View { .onAppear { syncReaderLocationTitle() pendingPDFPageIndex = store.readerTargetPageIndex + htmlContentRailActiveID = store.readerLocationID applyPendingPDFPageIfReady() + applyPendingHTMLLocationIfReady() rebuildPDFContentRail() } .onChange(of: store.selectedItemID) { _, _ in @@ -216,11 +218,12 @@ struct ReaderView: View { pdfRailTargetPageIndex = nil pendingPDFRailPreviewPages = [] htmlContentRailItems = [] - htmlContentRailActiveID = nil + htmlContentRailActiveID = store.readerLocationID htmlContentRailTarget = nil syncReaderLocationTitle() pendingPDFPageIndex = store.readerTargetPageIndex applyPendingPDFPageIfReady() + applyPendingHTMLLocationIfReady() rebuildPDFContentRail() } .onChange(of: pdfPageIndex) { _, _ in @@ -236,6 +239,12 @@ struct ReaderView: View { pendingPDFPageIndex = target applyPendingPDFPageIfReady() } + .onChange(of: store.readerTargetLocationID) { _, _ in + applyPendingHTMLLocationIfReady() + } + .onChange(of: store.readerTargetLocationTitle) { _, _ in + applyPendingHTMLLocationIfReady() + } } private func syncReaderLocationTitle() { @@ -244,6 +253,12 @@ struct ReaderView: View { return } let displayTitle = store.displayTitle(for: item) + if item.kind == .html { + if store.readerLocationTitle == nil { + store.updateReaderLocationTitle(displayTitle) + } + return + } let title = item.kind == .pdf ? store.ui("\(displayTitle),第 \(pdfPageIndex + 1) 页", "\(displayTitle), page \(pdfPageIndex + 1)") : displayTitle @@ -371,8 +386,49 @@ struct ReaderView: View { } if let activeID = htmlContentRailActiveID, !htmlContentRailItems.contains(where: { $0.id == activeID }) { - htmlContentRailActiveID = htmlContentRailItems.first?.id + applyHTMLContentRailActiveID(htmlContentRailItems.first?.id) + } else if let activeID = htmlContentRailActiveID { + applyHTMLContentRailActiveID(activeID) + } + applyPendingHTMLLocationIfReady() + } + + private func applyHTMLContentRailActiveID(_ id: String?) { + htmlContentRailActiveID = id + let title = id.flatMap { activeID in + htmlContentRailItems.first(where: { $0.id == activeID })?.title + } + store.updateReaderHTMLLocation(id: id, title: title) + } + + private func applyPendingHTMLLocationIfReady() { + guard store.selectedMaterialItem?.kind == .html, + !htmlContentRailItems.isEmpty else { return } + let targetID: String? + if let savedID = store.readerTargetLocationID, + let savedSection = htmlContentRailItems.first(where: { $0.id == savedID }), + store.readerTargetLocationTitle.map({ + Self.normalizedHTMLSectionTitle($0) == Self.normalizedHTMLSectionTitle(savedSection.title) + }) ?? true { + targetID = savedSection.id + } else if let targetTitle = store.readerTargetLocationTitle { + let normalizedTarget = Self.normalizedHTMLSectionTitle(targetTitle) + let matches = htmlContentRailItems.filter { + Self.normalizedHTMLSectionTitle($0.title) == normalizedTarget + } + targetID = matches.count == 1 ? matches[0].id : nil + } else { + targetID = nil } + guard let targetID else { return } + htmlContentRailTarget = WebReaderContentRailTarget(id: targetID) + } + + private static func normalizedHTMLSectionTitle(_ title: String) -> String { + title + .lowercased() + .split(whereSeparator: { $0.isWhitespace || $0.isPunctuation }) + .joined() } private static func pdfContentRailID(pageIndex: Int) -> String { @@ -643,7 +699,7 @@ struct ReaderView: View { adaptsDocumentColors: store.adaptImportedDocumentColors, contentRailTarget: htmlContentRailTarget, onContentRailChange: applyHTMLContentRailSections, - onContentRailActiveChange: { htmlContentRailActiveID = $0 }, + onContentRailActiveChange: applyHTMLContentRailActiveID, onAppShortcut: { key, modifiers in store.handleAppShortcut(key: key, modifiers: modifiers) } ) { text, anchor in store.updateSelection(text, source: .document, anchor: anchor) @@ -656,7 +712,7 @@ struct ReaderView: View { adaptsDocumentColors: true, contentRailTarget: htmlContentRailTarget, onContentRailChange: applyHTMLContentRailSections, - onContentRailActiveChange: { htmlContentRailActiveID = $0 }, + onContentRailActiveChange: applyHTMLContentRailActiveID, onAppShortcut: { key, modifiers in store.handleAppShortcut(key: key, modifiers: modifiers) } ) { text, anchor in store.updateSelection(text, source: .document, anchor: anchor) @@ -1733,14 +1789,56 @@ struct WebReaderRepresentable: NSViewRepresentable { return ""; }; - const headingSections = () => Array.from(document.querySelectorAll("h1, h2, h3, h4, [role='heading']")) - .filter((element) => visible(element) && clean(element.textContent)) + const sectionFingerprintBody = (heading, nextHeading) => { + try { + const range = document.createRange(); + range.setStartAfter(heading); + if (nextHeading) { + range.setEndBefore(nextHeading); + } else if (document.body?.lastChild) { + range.setEndAfter(document.body.lastChild); + } else { + return ""; + } + const fragment = range.cloneContents(); + fragment.querySelectorAll?.("script, style, noscript, template").forEach((element) => element.remove()); + return clean(fragment.textContent); + } catch (_) { + return excerptAfterHeading(heading); + } + }; + + const sectionLocationID = (title, body) => { + const normalized = `${title}|${body}` + .toLocaleLowerCase() + .match(/[\\p{L}\\p{N}]/gu)?.join("").slice(0, 500) || ""; + const bytes = new TextEncoder().encode(normalized); + let hash = 0x811c9dc5; + bytes.forEach((byte) => { + hash ^= byte; + hash = Math.imul(hash, 0x01000193) >>> 0; + }); + return `html-section-${hash.toString(16).padStart(8, "0")}`; + }; + + const headingSections = () => { + const headings = Array.from(document.querySelectorAll("h1, h2, h3, h4")); + const locationIDCounts = new Map(); + return headings .map((element, index) => { + const title = clean(element.textContent); + const baseID = sectionLocationID(title, sectionFingerprintBody(element, headings[index + 1])); + const count = (locationIDCounts.get(baseID) || 0) + 1; + locationIDCounts.set(baseID, count); + const id = count === 1 ? baseID : `${baseID}-dup-${count}`; + element.dataset.weibeiContentRailID = id; + return { element, index, id }; + }) + .filter(({ element }) => visible(element) && clean(element.textContent)) + .map(({ element, index, id }) => { const explicitLevel = Number(element.getAttribute("aria-level")); const tagLevel = /^H[1-4]$/.test(element.tagName) ? Number(element.tagName.slice(1)) : 2; const level = Math.max(1, Math.min(4, Number.isFinite(explicitLevel) && explicitLevel > 0 ? explicitLevel : tagLevel)); - const id = element.dataset.weibeiContentRailID || `html-heading-${index}`; - element.dataset.weibeiContentRailID = id; return { id, element, @@ -1752,6 +1850,7 @@ struct WebReaderRepresentable: NSViewRepresentable { fallback: false }; }); + }; const fallbackSections = () => { const root = document.querySelector("main, article") || document.body; diff --git a/Sources/WeiBei/WebEditor/src/editor.js b/Sources/WeiBei/WebEditor/src/editor.js index 136925dea..2c5dd5d64 100644 --- a/Sources/WeiBei/WebEditor/src/editor.js +++ b/Sources/WeiBei/WebEditor/src/editor.js @@ -751,7 +751,7 @@ const decorateWikiLinks = (decorations, text, pos) => { }; const decorateSourceReferences = (decorations, text, pos) => { - for (const match of text.matchAll(/(?:^|\s)((?:来源:|Source:)[^\n]+)/g)) { + for (const match of text.matchAll(/(?:^|[\s`])((?:来源:|Source:)[^`\n]+)/g)) { const prefixLength = match[0].startsWith(match[1]) ? 0 : 1; const sourcePrefix = match[1].startsWith('来源:') ? '来源:' : 'Source:'; const from = pos + (match.index || 0) + prefixLength; diff --git a/Sources/WeiBeiCore/AgentResources/extension.ts b/Sources/WeiBeiCore/AgentResources/extension.ts index 4ba4d4026..0450ca47f 100644 --- a/Sources/WeiBeiCore/AgentResources/extension.ts +++ b/Sources/WeiBeiCore/AgentResources/extension.ts @@ -20,14 +20,14 @@ const ALLOWED_TOOLS = new Set([ ]); const LIMITS = { - contextFileBytes: 2 * 1024 * 1024, + contextFileBytes: 4 * 1024 * 1024, identifier: 256, title: 300, question: 4_000, materialText: 18_000, noteText: 6_000, selectionText: 2_000, - recentMessages: 8, + recentMessages: 20, recentMessageText: 1_200, messageSource: 300, courseCatalogItems: 500, @@ -113,6 +113,7 @@ interface LearningMemoryEntrySnapshot { interface StudyLocationSnapshot { itemID: string; itemTitle: string; + locationID?: string; locationTitle?: string; pageIndex?: number; lastStudiedAt: number; @@ -176,6 +177,9 @@ interface CourseSearchToolDetails { contextRevision: string; query: string; results: CourseItemSnapshot[]; + evidenceLabels: string[]; + jumpReferences: string[]; + jumpEvidence: Record<string, string>; } interface LearningMemoryToolDetails { @@ -183,6 +187,8 @@ interface LearningMemoryToolDetails { contextRevision: string; memoryRevision: number; learning: LearningSnapshot; + jumpReferences: string[]; + jumpEvidence: Record<string, string>; } interface LearningUpdateDetails { @@ -198,6 +204,11 @@ interface LearningUpdateDetails { evidence: string; origin: "userStatement" | "agentInference"; }>; + resolutions: Array<{ + memoryID: string; + text: string; + evidence: string; + }>; } interface NoteProposalDetails { @@ -469,6 +480,10 @@ function readLearning(value: unknown): LearningSnapshot { lastLocation = { itemID: requireIdentifier(location.itemID, "learning.lastLocation.itemID"), itemTitle: truncate(requireString(location.itemTitle, "learning.lastLocation.itemTitle"), LIMITS.title), + locationID: + location.locationID === undefined || location.locationID === null + ? undefined + : requireIdentifier(location.locationID, "learning.lastLocation.locationID"), locationTitle: location.locationTitle === undefined || location.locationTitle === null ? undefined @@ -563,12 +578,92 @@ function contextRevisionFromDetails(details: unknown): string | undefined { } function evidenceLabels(snapshot: ContextSnapshotV2): string[] { - const labels = [`[笔记:${snapshot.note.title}]`]; - if (snapshot.material) labels.push(`[材料:${snapshot.material.title}]`); - if (snapshot.selection) labels.push(`[选区:${snapshot.selection.title}]`); + const labels: string[] = []; + if (snapshot.note.text.trim()) labels.push(`[笔记:${snapshot.note.title}]`); + if (snapshot.material?.text.trim()) labels.push(`[材料:${snapshot.material.title}]`); + if (snapshot.selection?.text.trim()) labels.push(`[选区:${snapshot.selection.title}]`); return labels; } +function currentTurnEvidenceMatches(snapshot: ContextSnapshotV2, evidence: string): boolean { + const statement = currentTurnEvidenceStatement(evidence); + if (!statement || statement.length < 2) return false; + const normalize = (value: string) => value.replace(/[\p{P}\p{Z}\s]/gu, ""); + if (statement.length < 4) return normalize(statement) === normalize(snapshot.question); + let searchStart = 0; + while (searchStart < snapshot.question.length) { + const index = snapshot.question.indexOf(statement, searchStart); + if (index < 0) return false; + const end = index + statement.length; + const before = index === 0 ? "" : snapshot.question[index - 1]; + const after = end >= snapshot.question.length ? "" : snapshot.question[end]; + const isBoundary = (value: string) => !value || /[\p{P}\p{Z}\s]/u.test(value); + const prefix = snapshot.question.slice(0, index).toLowerCase(); + const immediate = prefix.trimEnd(); + const immediateNegation = ["不", "没", "未", "无", "别", "勿"] + .some((term) => immediate.endsWith(term)); + const clause = prefix.split(/[,,。!?;;::.!?]/u).at(-1) ?? prefix; + const paddedClause = ` ${clause} `; + const negativePhrases = [ + "不想", "不喜欢", "不太", "不能", "不会", "不要", "不愿", "没有", "没法", "尚未", "还没", "并不", "并非", + " not ", " never ", " no ", " without ", "cannot", "can't", "don't", "doesn't", "didn't", + ]; + if ( + isBoundary(before) && + isBoundary(after) && + !immediateNegation && + !negativePhrases.some((term) => paddedClause.includes(term)) + ) { + return true; + } + searchStart = end; + } + return false; +} + +function resolutionEvidenceMatches(snapshot: ContextSnapshotV2, evidence: string): boolean { + if (!currentTurnEvidenceMatches(snapshot, evidence)) return false; + const statement = currentTurnEvidenceStatement(evidence); + if (!statement) return false; + const value = statement.toLowerCase(); + const unresolvedTerms = [ + "不懂", "不理解", "不会", "没懂", "仍然困惑", "还是困惑", "不知道", "不能区分", "不能够", + "还不能", "尚不能", "无法", "没法", "尚未", "还没", "并不", "不太", "不确定", + "不正确", "并非正确", "答错", "错误", "不对", + "don't understand", "do not understand", "can't", "cannot", "still confused", "not sure", + "not able", "unable", "not yet", "have not", "haven't", "incorrect", "not correct", "wrong answer", "is wrong", + ]; + if (unresolvedTerms.some((term) => value.includes(term))) return false; + const questionTerms = ["什么", "为什么", "怎么", "为何", "吗", "?", "?", "what", "why", "how"]; + if (questionTerms.some((term) => value.includes(term))) return false; + const masteryTerms = [ + "懂了", "明白了", "会了", "掌握了", "可以区分", "能够区分", "能解释", "答对", "正确", + "解决了", "不再困惑", "understand now", "got it", "can distinguish", "can explain", "correct", + ]; + if (masteryTerms.some((term) => value.includes(term))) return true; + const answerMarkers = [ + "是", "指", "因为", "所以", "而", "但是", "扣除", "等于", "相比", "表示", "反映", "意味着", "即", "=", + " is ", " means", "because", "therefore", "while", "equals", "represents", "reflects", "differs", + ]; + if (!answerMarkers.some((term) => value.includes(term))) return false; + return (statement.match(/[\p{L}\p{N}]/gu) ?? []).length >= 12; +} + +function currentTurnEvidenceStatement(evidence: string): string | undefined { + const prefix = evidence.startsWith("[用户:本轮]") + ? "[用户:本轮]" + : evidence.startsWith("[会话:当前]") + ? "[会话:当前]" + : undefined; + if (!prefix) return undefined; + const statement = evidence + .slice(prefix.length) + .trim() + .replace(/^["'“”‘’]+|["'“”‘’]+$/g, "") + .trim(); + return statement || undefined; +} + function courseSearchTerms(query: string): string[] { const lower = query.toLowerCase(); const terms = lower.match(/[\p{L}\p{N}_-]{2,}/gu) ?? []; @@ -601,10 +696,85 @@ function searchCourse(course: CourseSnapshot, query: string, limit: number): Cou .map((entry) => entry.item); } +function courseJumpReference( + course: CourseSnapshot, + item: CourseCatalogItemSnapshot, + rawHeading?: string, +): string { + const duplicateTitle = course.catalog.filter((candidate) => candidate.title === item.title).length > 1; + const ordinal = course.catalog.findIndex((candidate) => candidate.id === item.id) + 1; + const ordinalSuffix = duplicateTitle && ordinal > 0 ? `,条目:${ordinal}` : ""; + const page = rawHeading ? coursePage(rawHeading) : undefined; + const heading = rawHeading && !page ? courseHeading(rawHeading) : undefined; + const pageSuffix = page ? `,第 ${page} 页` : ""; + const sectionLocationSuffix = heading?.locationID ? `,章节标识:${heading.locationID}` : ""; + const sectionOrdinalSuffix = heading?.ordinal ? `,章节序号:${heading.ordinal}` : ""; + const sectionSuffix = heading?.title ? `,章节:${heading.title}` : ""; + return `来源:${item.title}${ordinalSuffix}${pageSuffix}${sectionLocationSuffix}${sectionOrdinalSuffix}${sectionSuffix}`; +} + +function courseEvidenceLabel( + course: CourseSnapshot, + item: CourseCatalogItemSnapshot, +): string { + const duplicateTitle = course.catalog.filter((candidate) => candidate.title === item.title).length > 1; + const ordinal = course.catalog.findIndex((candidate) => candidate.id === item.id) + 1; + const ordinalSuffix = duplicateTitle && ordinal > 0 ? `,条目:${ordinal}` : ""; + return item.role === "note" + ? `[笔记:${item.title}${ordinalSuffix}]` + : `[材料:${item.title}${ordinalSuffix}]`; +} + +function courseHeading(rawHeading: string): { title: string; ordinal?: number; locationID?: string } { + const stableMatch = rawHeading.match(/^\[(html-section-[A-Za-z0-9-]+)\]\[html-heading-(\d+)\]\s+(.+)$/); + if (stableMatch) { + return { + title: stableMatch[3], + ordinal: Number(stableMatch[2]) + 1, + locationID: stableMatch[1], + }; + } + const stableOnlyMatch = rawHeading.match(/^\[(html-section-[A-Za-z0-9-]+)\]\s+(.+)$/); + if (stableOnlyMatch) return { title: stableOnlyMatch[2], locationID: stableOnlyMatch[1] }; + const legacyMatch = rawHeading.match(/^\[html-heading-(\d+)\]\s+(.+)$/); + if (!legacyMatch) return { title: rawHeading }; + return { title: legacyMatch[2], ordinal: Number(legacyMatch[1]) + 1 }; +} + +function coursePage(rawHeading: string): number | undefined { + const match = rawHeading.match(/^第\s*(\d+)\s*页(?:(OCR))?$/); + if (!match) return undefined; + const page = Number(match[1]); + return Number.isInteger(page) && page > 0 ? page : undefined; +} + +function learningLocationJumpReference(snapshot: ContextSnapshotV2): string | undefined { + const location = snapshot.learning.lastLocation; + if (!location) return undefined; + const item = snapshot.course.catalog.find((candidate) => candidate.id === location.itemID); + if (!item) return undefined; + if (location.pageIndex && location.pageIndex > 0) { + return courseJumpReference(snapshot.course, item, `第 ${location.pageIndex} 页`); + } + if ( + (location.locationID?.startsWith("html-section-") || + location.locationID?.startsWith("html-heading-")) && + location.locationTitle + ) { + return courseJumpReference( + snapshot.course, + item, + `[${location.locationID}] ${location.locationTitle}`, + ); + } + return courseJumpReference(snapshot.course, item); +} + export default function weibeiExtension(pi: ExtensionAPI) { let requiredContextRevision: string | undefined; let lastReadContextRevision: string | undefined; let lastReadMemoryRevision: number | undefined; + const searchedCourseItemIDs = new Set<string>(); pi.registerTool({ name: CONTEXT_TOOL, @@ -686,7 +856,7 @@ export default function weibeiExtension(pi: ExtensionAPI) { const limit = params.limit ?? 40; const catalog = snapshot.course.catalog.slice(offset, offset + limit).map((item) => ({ ...item, - jumpReference: `来源:${item.title}`, + jumpReference: courseJumpReference(snapshot.course, item), })); const pageCatalogIDs = new Set(catalog.map((item) => item.id)); const catalogByID = new Map( @@ -747,21 +917,59 @@ export default function weibeiExtension(pi: ExtensionAPI) { } const query = params.query.trim(); const results = searchCourse(snapshot.course, query, params.limit ?? 5); + results + .filter((item) => item.searchText.trim().length > 0) + .forEach((item) => searchedCourseItemIDs.add(item.id)); + const presentedResults = results.map((item) => { + const hasEvidence = item.searchText.trim().length > 0; + const sectionJumpReferences = + hasEvidence && item.kind === "html" + ? item.headings + .slice(0, 5) + .map((heading) => courseJumpReference(snapshot.course, item, heading)) + : []; + const pageJumpReferences = + hasEvidence && item.kind === "pdf" + ? item.headings + .filter((heading) => coursePage(heading) !== undefined) + .slice(0, 5) + .map((heading) => courseJumpReference(snapshot.course, item, heading)) + : []; + return { + ...item, + headings: item.headings.map((heading) => courseHeading(heading).title), + evidenceLabel: hasEvidence ? courseEvidenceLabel(snapshot.course, item) : undefined, + jumpReference: hasEvidence ? courseJumpReference(snapshot.course, item) : undefined, + sectionJumpReferences, + pageJumpReferences, + }; + }); + const evidenceLabels = presentedResults.flatMap((item) => + item.evidenceLabel ? [item.evidenceLabel] : [], + ); + const jumpEvidence = Object.fromEntries( + presentedResults.flatMap((item) => { + if (!item.evidenceLabel || !item.jumpReference) return []; + return [item.jumpReference, ...item.sectionJumpReferences, ...item.pageJumpReferences] + .map((jumpReference) => [jumpReference, item.evidenceLabel] as const); + }), + ); + const jumpReferences = Object.keys(jumpEvidence); const details: CourseSearchToolDetails = { kind: "course_search", contextRevision: snapshot.contextRevision, query, results, + evidenceLabels, + jumpReferences, + jumpEvidence, }; return { content: [ { type: "text", text: JSON.stringify( - results.map((item) => ({ - ...item, - jumpReference: `来源:${item.title}`, - })), + presentedResults, null, 2, ), @@ -786,14 +994,30 @@ export default function weibeiExtension(pi: ExtensionAPI) { throw new Error(`必须先调用 ${CONTEXT_TOOL} 读取本轮当前上下文`); } lastReadMemoryRevision = snapshot.learning.memoryRevision; + const locationJumpReference = learningLocationJumpReference(snapshot); + const jumpReferences = locationJumpReference ? [locationJumpReference] : []; + const jumpEvidence = locationJumpReference + ? { [locationJumpReference]: "[学习记录:上次位置]" } + : {}; const details: LearningMemoryToolDetails = { kind: "learning_memory", contextRevision: snapshot.contextRevision, memoryRevision: snapshot.learning.memoryRevision, learning: snapshot.learning, + jumpReferences, + jumpEvidence, }; + const learningForTool = locationJumpReference && snapshot.learning.lastLocation + ? { + ...snapshot.learning, + lastLocation: { + ...snapshot.learning.lastLocation, + jumpReference: locationJumpReference, + }, + } + : snapshot.learning; return { - content: [{ type: "text", text: JSON.stringify(snapshot.learning, null, 2) }], + content: [{ type: "text", text: JSON.stringify(learningForTool, null, 2) }], details, }; }, @@ -838,6 +1062,18 @@ export default function weibeiExtension(pi: ExtensionAPI) { ), { maxItems: 12 }, ), + resolutions: Type.Optional( + Type.Array( + Type.Object( + { + memoryID: Type.String({ minLength: 1, maxLength: LIMITS.identifier }), + evidence: Type.String({ minLength: 1, maxLength: LIMITS.learningEvidence }), + }, + { additionalProperties: false }, + ), + { maxItems: 12 }, + ), + ), }, { additionalProperties: false }, ), @@ -868,9 +1104,9 @@ export default function weibeiExtension(pi: ExtensionAPI) { "[用户:本轮]", "[会话:当前]", ...evidenceLabels(current), - ...current.course.catalog.map((item) => - item.role === "note" ? `[笔记:${item.title}]` : `[材料:${item.title}]`, - ), + ...current.course.catalog + .filter((item) => searchedCourseItemIDs.has(item.id)) + .map((item) => courseEvidenceLabel(current.course, item)), ]; if ( entries.some( @@ -882,6 +1118,16 @@ export default function weibeiExtension(pi: ExtensionAPI) { ) { throw new Error("每条学习记忆都必须携带当前用户、会话或来源依据标签"); } + if ( + entries.some( + (entry) => + (entry.evidence.startsWith("[用户:本轮]") || + entry.evidence.startsWith("[会话:当前]")) && + !currentTurnEvidenceMatches(current, entry.evidence), + ) + ) { + throw new Error("本轮用户或会话依据必须在标签后逐字引用用户本轮真实原话"); + } if ( entries.some( (entry) => @@ -894,7 +1140,37 @@ export default function weibeiExtension(pi: ExtensionAPI) { .map((item) => item.trim()) .filter((item) => item.length > 0); const sessionSummary = params.sessionSummary?.trim(); - if (!sessionSummary && !params.suggestedPhase && suggestedNext.length === 0 && entries.length === 0) { + const activeMemoryByID = new Map( + current.learning.memories + .filter( + (memory) => + memory.status === "active" && + ["goal", "confusion", "nextStep"].includes(memory.kind), + ) + .map((memory) => [memory.id, memory] as const), + ); + const resolutions = (params.resolutions ?? []).map((resolution) => { + const memory = activeMemoryByID.get(resolution.memoryID); + const evidence = resolution.evidence.trim(); + if (!memory) { + throw new Error("只能结案当前学习记忆中仍处于活跃状态的项目"); + } + if (!resolutionEvidenceMatches(current, evidence)) { + throw new Error("学习记忆结案必须逐字引用用户本轮的确认或回忆表现"); + } + return { + memoryID: memory.id, + text: memory.text, + evidence, + }; + }); + if ( + !sessionSummary && + !params.suggestedPhase && + suggestedNext.length === 0 && + entries.length === 0 && + resolutions.length === 0 + ) { throw new Error("学习状态建议不能为空"); } const details: LearningUpdateDetails = { @@ -905,6 +1181,7 @@ export default function weibeiExtension(pi: ExtensionAPI) { suggestedPhase: params.suggestedPhase, suggestedNext, entries, + resolutions, }; return { content: [ @@ -992,6 +1269,7 @@ export default function weibeiExtension(pi: ExtensionAPI) { pi.on("before_agent_start", async (event) => { lastReadContextRevision = undefined; lastReadMemoryRevision = undefined; + searchedCourseItemIDs.clear(); let purpose = "unavailable"; let revision = "unavailable"; diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md index 095b1f2cd..ff0f280b7 100644 --- a/Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-course-wayfinding/SKILL.md @@ -25,4 +25,5 @@ allowed-tools: weibei_context weibei_course_map weibei_course_search weibei_lear 来源:精确标题 ``` -`\[材料:标题\]` 或 `\[笔记:标题\]` 用于证据;单独的 `来源:标题` 用于魏碑点击跳转。 +工具返回的 `evidenceLabel` 用于证据;单独的来源行用于魏碑点击跳转。必须原样复制 `evidenceLabel` 以及工具返回的 `jumpReference`、`sectionJumpReferences` 或 `pageJumpReferences`,不得删掉重复文件所需的 `条目`、HTML 定位所需的 `章节标识` / `章节序号` 或 PDF 页码,也不得自行改写章节名。 +工具返回页或章节级跳转时,优先给最精确的位置,不退回只打开整份文件。 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md index 043342a2c..456e91807 100644 --- a/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-recall-practice/SKILL.md @@ -23,6 +23,7 @@ allowed-tools: weibei_context weibei_learning_memory weibei_learning_update 5. 题目覆盖回忆、解释、比较或基于原文的简单应用,但不得要求当前证据之外的知识。 6. 为每个标准答案准备来源标签。证据无法给出唯一答案的题目直接删除,不得凭常识补答案。 7. 用户提交答案后,重新读取当前上下文,再给出“正确 / 部分正确 / 当前证据无法确认”的判断与依据。只有表现足以支持长期判断时,才调用 `weibei_learning_update`记录理解或困惑。 +8. 如果用户对某条活跃困惑完成了可核对的回忆或解释,可用 `resolutions` 和 `[会话:当前]` 依据提出结案建议。标签后必须逐字引用户本轮答案;仅仅看过标准答案、Agent 解释过,或单题蒙对,都不得提出结案。建议必须由用户在魏碑界面确认。 ## 工具用法 diff --git a/Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md b/Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md index 66d983668..4239f6a50 100644 --- a/Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md +++ b/Sources/WeiBeiCore/AgentResources/skills/weibei-study-companion/SKILL.md @@ -21,13 +21,15 @@ allowed-tools: weibei_context weibei_course_map weibei_course_search weibei_lear ## 记忆规则 -- `lastLocation` 是魏碑观测到的阅读位置,可用 `[学习记录:上次位置]` 标注。 +- `lastLocation` 是魏碑观测到的阅读位置;回答时同时标注 `[学习记录:上次位置]` 和 `[材料:lastLocation.itemTitle]`。学习标签说明位置来自进度记录,材料标签让宿主核对具体文件。 +- 学习记忆工具返回 `[学习记忆:无记录]` 时,只能说明当前没有可恢复记录,再询问用户从哪里开始;不得猜测上次位置。 - 目标、困惑和偏好是用户状态,可用 `[学习记忆:用户状态]` 标注。 -- 来自用户本轮的记忆依据以 `[用户:本轮]` 开头;基于当前会话表现的判断以 `[会话:当前]` 开头。 +- 来自用户本轮的记忆依据以 `[用户:本轮]` 开头;基于当前会话表现的判断以 `[会话:当前]` 开头。标签后必须逐字引用用户本轮原话,不得写“用户表示……”式转述。 - 不得仅因为用户读过一页或 Agent 解释过一次,就标记为“已理解”。 +- 只有用户本轮明确确认掌握,或在当前会话的回忆/自测中真正展示掌握,才用 `resolutions` 提出结案旧困惑;Agent 自己解释完不算证据。魏碑仍会要求用户点击确认。 ## 回答方式 - 先直接回答用户现在的问题,再在有帮助时给 1-3 个下一步。 -- 需要跳转时,每个建议说清“为什么相关”,并单独输出 `来源:精确标题`;PDF 有页码时使用 `来源:精确标题,第 N 页`。 +- 需要跳转时,每个建议说清“为什么相关”,并原样复制课程工具返回的 `evidenceLabel` 及 `jumpReference`、`sectionJumpReferences` 或 `pageJumpReferences`;不得删掉重复文件所需的 `条目`、HTML 定位所需的 `章节标识` / `章节序号` 或 PDF 页码,也不得自行改写章节名。 - 当前上下文不足时明确说未确认,不用常识补齐课程内容。 diff --git a/Sources/WeiBeiCore/AgentResources/system.md b/Sources/WeiBeiCore/AgentResources/system.md index c75684b72..7352bb3c6 100644 --- a/Sources/WeiBeiCore/AgentResources/system.md +++ b/Sources/WeiBeiCore/AgentResources/system.md @@ -14,14 +14,17 @@ 1. “当前课程”包含多份材料、多份笔记与它们的长期关联,不等于当前打开的文件。 2. `weibei_course_map` 用于确认目录里有哪些文件和已确认关联;`weibei_course_search` 用于取得与本轮问题相关的知识片段。不得把只有标题、没有索引片段的目录项当成内容证据。 -3. 建议用户跳转时,说清关联原因,并输出单独的 `来源:精确标题`;PDF 有可确认页码时可输出 `来源:精确标题,第 N 页`。 +3. 课程搜索返回的 `evidenceLabel` 是该条目的精确证据标签;重复文件标题会带 `条目`。引用内容时必须原样使用,不能拿一个条目的证据去支持另一个条目的跳转。 +4. 建议用户跳转时,说清关联原因,并原样输出工具返回的 `jumpReference`、`sectionJumpReferences` 或 `pageJumpReferences`。存在页或章节级结果时优先使用最精确的跳转。重复文件标题会带 `条目` 定位符,HTML 章节会带内容生成的稳定 `章节标识` 和辅助 `章节序号`,PDF 命中会带已确认页码;这些定位符都不得删改。 ## 学习记忆与会话 1. 魏碑持有长期会话、阅读位置和学习记忆;PI 的临时运行会话不是长期记忆。 2. `StudyLocation` 是应用观测到的阅读事实。目标、理解、困惑、下一步和偏好是用户学习状态,不是课程内容证据。 3. 只有出现可长期复用的新信息时才调用 `weibei_learning_update`。更新必须同时匹配 `contextRevision` 与 `memoryRevision`,并携带当前用户、会话或来源依据。 -4. 学习阶段只是建议骨架。用户可以随时跳过、回退或改变阶段。 +4. 活跃困惑只能根据本轮用户明确确认,或当前会话中可验证的回忆/自测表现提出结案建议。证据标签后必须逐字引用用户本轮原话;“不懂”“仍困惑”一类未掌握表述和只有问题、没有作答的句子不得作为结案证据。Agent 自己解释过不算掌握证据。建议仍需用户在魏碑界面确认才会改变长期记忆。 +5. 学习阶段只是建议骨架。用户可以随时跳过、回退或改变阶段。 +6. 只能使用学习记忆工具实际返回的学习标签;没有位置、记忆和会话记录时,用 `[学习记忆:无记录]` 说明“当前没有记录”,不得假造上次进度。 ## 回答规则 @@ -32,6 +35,7 @@ - `[笔记:标题]` 3. 明确区分原文信息、基于原文的推断和未确认内容。不得伪造页码、章节、引文或来源标题。 4. 回答保持直接、简洁;除非用户要求,不复述整份上下文。 +5. 只有纯粹询问上次位置、学习进度、个人目标、困惑或下一步时,才可只使用学习记忆标签;只要回答课程概念、材料关系或内容事实,就必须同时引用本轮真实读到的来源。 ## 笔记边界 diff --git a/Sources/WeiBeiCore/BoundedPDFTextExtractor.swift b/Sources/WeiBeiCore/BoundedPDFTextExtractor.swift new file mode 100644 index 000000000..8dc0770a4 --- /dev/null +++ b/Sources/WeiBeiCore/BoundedPDFTextExtractor.swift @@ -0,0 +1,284 @@ +import Darwin +import Foundation + +public struct BoundedPDFTextPage: Sendable { + public var text: String + public var isPartial: Bool + + public init(text: String, isPartial: Bool) { + self.text = text + self.isPartial = isPartial + } +} + +public enum BoundedPDFTextExtractor { + private final class WorkerOutputBox: @unchecked Sendable { + private let lock = NSLock() + private var output = Data() + private var overflowed = false + + func append(_ data: Data, limit: Int) -> Bool { + lock.lock() + defer { lock.unlock() } + guard !overflowed, output.count + data.count <= limit else { + overflowed = true + return false + } + output.append(data) + return true + } + + func load() -> (output: Data, overflowed: Bool) { + lock.lock() + defer { lock.unlock() } + return (output, overflowed) + } + } + + private final class WorkerTerminationState: @unchecked Sendable { + private let lock = NSLock() + private var value = false + + func markTerminated() { + lock.lock() + value = true + lock.unlock() + } + + func wasTerminated() -> Bool { + lock.lock() + defer { lock.unlock() } + return value + } + } + + private struct WorkerResponse: Decodable { + var pages: [WorkerPage] + } + + private struct WorkerPage: Decodable { + var pageIndex: Int + var status: String + var text: String + } + + private static let maximumWorkerTimeout: TimeInterval = 3.5 + private static let maximumWorkerResidentBytes: UInt64 = 384 * 1_024 * 1_024 + private static let maximumPagesPerRun = 16 + private static let workerName = "WeiBeiPDFTextWorker" + + public static func page( + from url: URL, + pageIndex: Int, + maximumCharacters: Int + ) -> BoundedPDFTextPage? { + pages( + from: url, + pageIndexes: [pageIndex], + maximumCharactersPerPage: maximumCharacters + )?[pageIndex] + } + + public static func pages( + from url: URL, + pageIndexes: [Int], + maximumCharactersPerPage: Int, + timeout: TimeInterval = 3.5 + ) -> [Int: BoundedPDFTextPage]? { + let requestedIndexes = Array(Set(pageIndexes)) + .filter { $0 >= 0 } + .sorted() + guard !Task.isCancelled, + !requestedIndexes.isEmpty, + requestedIndexes.count <= maximumPagesPerRun, + maximumCharactersPerPage > 0, + maximumCharactersPerPage <= 1_000_000 else { return nil } + let boundedTimeout = min(max(timeout, 0.1), maximumWorkerTimeout) + let maximumOutputBytes = requestedIndexes.count * (maximumCharactersPerPage * 6 + 256) + 1_024 + guard let output = runWorker( + arguments: [ + url.path, + requestedIndexes.map(String.init).joined(separator: ","), + String(maximumCharactersPerPage), + ], + timeout: boundedTimeout, + maximumResidentBytes: maximumWorkerResidentBytes, + maximumOutputBytes: maximumOutputBytes + ), let response = try? JSONDecoder().decode(WorkerResponse.self, from: output) else { return nil } + let requestedSet = Set(requestedIndexes) + return response.pages.reduce(into: [Int: BoundedPDFTextPage]()) { result, page in + guard requestedSet.contains(page.pageIndex), + page.status == "complete" || page.status == "partial" else { return } + result[page.pageIndex] = BoundedPDFTextPage( + text: page.text, + isPartial: page.status == "partial" + ) + } + } + + public static func runSafetySelfCheck() -> Bool { + guard runWorker( + arguments: ["--verification-probe", "normal"], + timeout: 1, + maximumResidentBytes: maximumWorkerResidentBytes, + maximumOutputBytes: 1_024, + enablesVerificationProbe: true + ) == Data("verification-ok\n".utf8) else { return false } + + let timeoutStart = Date() + guard runWorker( + arguments: ["--verification-probe", "timeout"], + timeout: 0.15, + maximumResidentBytes: maximumWorkerResidentBytes, + maximumOutputBytes: 1_024, + enablesVerificationProbe: true + ) == nil, Date().timeIntervalSince(timeoutStart) < 1 else { return false } + + let outputStart = Date() + guard runWorker( + arguments: ["--verification-probe", "output"], + timeout: 1, + maximumResidentBytes: maximumWorkerResidentBytes, + maximumOutputBytes: 1_024, + enablesVerificationProbe: true + ) == nil, Date().timeIntervalSince(outputStart) < 1 else { return false } + + let memoryStart = Date() + guard runWorker( + arguments: ["--verification-probe", "memory"], + timeout: 2, + maximumResidentBytes: 128 * 1_024 * 1_024, + maximumOutputBytes: 1_024, + enablesVerificationProbe: true + ) == nil, Date().timeIntervalSince(memoryStart) < 1.5 else { return false } + + let cancellationCompletion = DispatchSemaphore(value: 0) + let cancellationTask = Task.detached { + _ = runWorker( + arguments: ["--verification-probe", "timeout"], + timeout: 2, + maximumResidentBytes: maximumWorkerResidentBytes, + maximumOutputBytes: 1_024, + enablesVerificationProbe: true + ) + cancellationCompletion.signal() + } + Thread.sleep(forTimeInterval: 0.05) + let cancellationStart = Date() + cancellationTask.cancel() + return cancellationCompletion.wait(timeout: .now() + 1) == .success + && Date().timeIntervalSince(cancellationStart) < 1 + } + + private static func runWorker( + arguments: [String], + timeout: TimeInterval, + maximumResidentBytes: UInt64, + maximumOutputBytes: Int, + enablesVerificationProbe: Bool = false + ) -> Data? { + guard !Task.isCancelled, + maximumOutputBytes > 0, + let workerURL = workerURL() else { return nil } + let process = Process() + let outputPipe = Pipe() + process.executableURL = workerURL + process.arguments = arguments + process.standardOutput = outputPipe + process.standardError = Pipe() + var environment = [ + "LANG": "en_US.UTF-8", + "PATH": "/usr/bin:/bin", + "TMPDIR": FileManager.default.temporaryDirectory.path, + ] + if enablesVerificationProbe { + environment["WEIBEI_PDF_WORKER_VERIFY"] = "1" + } + process.environment = environment + + do { + try process.run() + } catch { + return nil + } + + let outputBox = WorkerOutputBox() + let terminationState = WorkerTerminationState() + let completion = DispatchSemaphore(value: 0) + DispatchQueue.global(qos: .utility).async { + while true { + let chunk = outputPipe.fileHandleForReading.readData(ofLength: 64 * 1_024) + guard !chunk.isEmpty else { break } + guard outputBox.append(chunk, limit: maximumOutputBytes) else { + terminationState.markTerminated() + terminate(process) + break + } + } + process.waitUntilExit() + completion.signal() + } + let deadline = Date().addingTimeInterval(timeout) + var terminated = false + while completion.wait(timeout: .now() + 0.02) == .timedOut { + if Task.isCancelled + || Date() >= deadline + || workerResidentBytes(process.processIdentifier).map({ $0 > maximumResidentBytes }) == true { + terminate(process) + terminated = true + break + } + } + if terminated { + _ = completion.wait(timeout: .now() + 1) + } + + let captured = outputBox.load() + guard !Task.isCancelled, + !terminated, + !terminationState.wasTerminated(), + process.terminationReason == .exit, + process.terminationStatus == 0, + !captured.overflowed else { return nil } + return captured.output + } + + private static func workerURL() -> URL? { + let fileManager = FileManager.default + var candidates: [URL] = [ + Bundle.main.bundleURL + .appendingPathComponent("Contents/Helpers", isDirectory: true) + .appendingPathComponent(workerName), + ] + if let executableURL = Bundle.main.executableURL { + candidates.append(executableURL.deletingLastPathComponent().appendingPathComponent(workerName)) + } + if let executablePath = ProcessInfo.processInfo.arguments.first { + candidates.append( + URL(fileURLWithPath: executablePath) + .standardizedFileURL + .deletingLastPathComponent() + .appendingPathComponent(workerName) + ) + } + return candidates.first { fileManager.isExecutableFile(atPath: $0.path) } + } + + private static func workerResidentBytes(_ processID: pid_t) -> UInt64? { + var information = proc_taskinfo() + let size = MemoryLayout<proc_taskinfo>.size + let result = withUnsafeMutablePointer(to: &information) { pointer in + proc_pidinfo(processID, PROC_PIDTASKINFO, 0, pointer, Int32(size)) + } + return result == Int32(size) ? information.pti_resident_size : nil + } + + private static func terminate(_ process: Process) { + guard process.isRunning else { return } + process.terminate() + Thread.sleep(forTimeInterval: 0.1) + if process.isRunning { + Darwin.kill(process.processIdentifier, SIGKILL) + } + } +} diff --git a/Sources/WeiBeiCore/CourseDocumentSearchIndex.swift b/Sources/WeiBeiCore/CourseDocumentSearchIndex.swift new file mode 100644 index 000000000..0c0789a71 --- /dev/null +++ b/Sources/WeiBeiCore/CourseDocumentSearchIndex.swift @@ -0,0 +1,1333 @@ +import AppKit +import CryptoKit +import Foundation +import PDFKit +import SQLite3 + +private final class CourseIndexCancellationProbe { + var isCancelled: Bool { + var cancelled = false + withUnsafeCurrentTask { task in + cancelled = task?.isCancelled ?? false + } + return cancelled + } +} + +public struct CourseDocumentIndexResult: Sendable { + public var text: String? + public var isTruncated: Bool + + public init(text: String?, isTruncated: Bool) { + self.text = text + self.isTruncated = isTruncated + } +} + +public typealias CourseNativePDFTextLoader = @Sendable ( + _ url: URL, + _ pageIndexes: [Int], + _ maximumCharactersPerPage: Int, + _ timeout: TimeInterval +) -> [Int: BoundedPDFTextPage]? + +public final class CourseDocumentSearchIndex: @unchecked Sendable { + private static let maximumDatabaseBytes: UInt64 = 1_024 * 1_024 * 1_024 + private static let maximumSQLiteBytes: UInt64 = 768 * 1_024 * 1_024 + private static let sqlitePageBytes: UInt64 = 4_096 + private static let minimumWriteReserveBytes: UInt64 = 1 * 1_024 * 1_024 + private static let maximumImmediateRefreshItems = 24 + private static let maximumImmediateRefreshSeconds: TimeInterval = 4 + private static let maximumTextSourceBytes: UInt64 = 32 * 1_024 * 1_024 + private static let maximumForegroundPDFPages = 32 + private static let maximumNativePDFPagesPerWorker = 8 + private static let maximumPDFPageCharacters = 128_000 + private static let foregroundPDFTextBudget: TimeInterval = 2 + private static let backgroundPDFTextBudget: TimeInterval = 20 + private struct FileState { + var signature: String + var isComplete: Bool + var chunkCount: Int + var hasPartialExtraction: Bool + } + + private struct RankedChunk { + var sortOrder: Int + var text: String + } + + private let databaseURL: URL + private let nativePDFTextLoader: CourseNativePDFTextLoader + private let indexingQueue = DispatchQueue( + label: "com.changfenhuang.weibei.course-index", + qos: .utility + ) + private let ocrQueue = DispatchQueue( + label: "com.changfenhuang.weibei.course-index.ocr", + qos: .background + ) + private let schedulingLock = NSLock() + private let databaseWriteLock = NSLock() + private let itemIndexLockRegistryLock = NSLock() + private var scheduledSignatures: Set<String> = [] + private var expectedSignaturesByStorageID: [String: String] = [:] + private var itemIndexLocks: [String: NSLock] = [:] + private let transientDestructor = unsafeBitCast(-1, to: sqlite3_destructor_type.self) + + public init( + databaseURL: URL, + nativePDFTextLoader: @escaping CourseNativePDFTextLoader = { url, pageIndexes, maximumCharacters, timeout in + BoundedPDFTextExtractor.pages( + from: url, + pageIndexes: pageIndexes, + maximumCharactersPerPage: maximumCharacters, + timeout: timeout + ) + } + ) { + self.databaseURL = databaseURL + self.nativePDFTextLoader = nativePDFTextLoader + try? FileManager.default.createDirectory( + at: databaseURL.deletingLastPathComponent(), + withIntermediateDirectories: true + ) + try? FileManager.default.setAttributes( + [.posixPermissions: 0o700], + ofItemAtPath: databaseURL.deletingLastPathComponent().path + ) + guard let database = openDatabase() else { return } + defer { sqlite3_close(database) } + _ = execute("PRAGMA page_size=4096", in: database) + _ = execute( + "PRAGMA max_page_count=\(Self.maximumSQLiteBytes / Self.sqlitePageBytes)", + in: database + ) + _ = execute("PRAGMA auto_vacuum=INCREMENTAL", in: database) + _ = execute("PRAGMA journal_mode=WAL", in: database) + _ = execute("PRAGMA synchronous=NORMAL", in: database) + _ = execute("PRAGMA journal_size_limit=67108864", in: database) + _ = execute("PRAGMA wal_autocheckpoint=256", in: database) + _ = execute( + """ + CREATE TABLE IF NOT EXISTS files ( + item_id TEXT PRIMARY KEY, + signature TEXT NOT NULL, + kind TEXT NOT NULL, + page_count INTEGER NOT NULL DEFAULT 0, + processed_count INTEGER NOT NULL DEFAULT 0, + is_complete INTEGER NOT NULL DEFAULT 0, + chunk_count INTEGER NOT NULL DEFAULT 0 + ) + """, + in: database + ) + _ = execute( + "ALTER TABLE files ADD COLUMN chunk_count INTEGER NOT NULL DEFAULT 0", + in: database + ) + _ = execute( + """ + CREATE TABLE IF NOT EXISTS processed_pages ( + item_id TEXT NOT NULL, + page_index INTEGER NOT NULL, + extraction_kind TEXT NOT NULL, + PRIMARY KEY (item_id, page_index) + ) + """, + in: database + ) + _ = execute( + """ + CREATE TABLE IF NOT EXISTS native_attempted_pages ( + item_id TEXT NOT NULL, + page_index INTEGER NOT NULL, + PRIMARY KEY (item_id, page_index) + ) + """, + in: database + ) + _ = execute( + """ + CREATE VIRTUAL TABLE IF NOT EXISTS chunks USING fts5( + item_id UNINDEXED, + sort_order UNINDEXED, + location UNINDEXED, + text UNINDEXED, + terms, + tokenize = 'unicode61 remove_diacritics 2' + ) + """, + in: database + ) + _ = execute( + """ + CREATE TABLE IF NOT EXISTS chunk_index ( + chunk_rowid INTEGER PRIMARY KEY, + item_id TEXT NOT NULL, + sort_order INTEGER NOT NULL + ) + """, + in: database + ) + _ = execute( + "CREATE INDEX IF NOT EXISTS chunk_index_item_sort ON chunk_index(item_id, sort_order)", + in: database + ) + } + + public func schedule(_ items: [StudyItem]) { + let scheduledItems = items.compactMap(Self.scheduledItem) + schedulingLock.lock() + for scheduled in scheduledItems { + expectedSignaturesByStorageID[scheduled.storageID] = scheduled.signature + } + schedulingLock.unlock() + scheduledItems.forEach(schedule) + } + + public func synchronize(_ items: [StudyItem]) { + let scheduledItems = items.compactMap(Self.scheduledItem) + let validStorageIDs = Set(scheduledItems.map(\.storageID)) + schedulingLock.lock() + expectedSignaturesByStorageID = Dictionary( + uniqueKeysWithValues: scheduledItems.map { ($0.storageID, $0.signature) } + ) + schedulingLock.unlock() + indexingQueue.async { [weak self] in + self?.pruneMissingItems(validStorageIDs: validStorageIDs) + } + scheduledItems.forEach(schedule) + } + + public func lookup( + items: [StudyItem], + query: String, + maximumCharactersPerItem: Int = 24_000 + ) -> [String: CourseDocumentIndexResult] { + refreshChangedItemsForLookup(items) + guard !Task.isCancelled else { return [:] } + guard let database = openDatabase() else { return [:] } + defer { sqlite3_close(database) } + let cancellationProbe = CourseIndexCancellationProbe() + let cancellationContext = Unmanaged.passRetained(cancellationProbe).toOpaque() + sqlite3_progress_handler( + database, + 1_000, + { context in + guard let context else { return 0 } + let probe = Unmanaged<CourseIndexCancellationProbe> + .fromOpaque(context) + .takeUnretainedValue() + return probe.isCancelled ? 1 : 0 + }, + cancellationContext + ) + defer { + sqlite3_progress_handler(database, 0, nil, nil) + Unmanaged<CourseIndexCancellationProbe>.fromOpaque(cancellationContext).release() + } + guard execute("BEGIN DEFERRED", in: database) else { return [:] } + defer { _ = execute("COMMIT", in: database) } + + let itemMappings = items.compactMap { item -> (item: StudyItem, itemID: String, storageID: String)? in + guard item.url != nil else { return nil } + return (item, item.id, Self.storageID(for: item.id)) + } + let itemByStorageID = Dictionary( + uniqueKeysWithValues: itemMappings.map { ($0.storageID, $0.item) } + ) + schedulingLock.lock() + let expectedSignatures = expectedSignaturesByStorageID + schedulingLock.unlock() + let states = fileStates(in: database) + let validStates = itemMappings.reduce(into: [String: FileState]()) { result, mapping in + guard let signature = expectedSignatures[mapping.storageID], + let state = states[mapping.storageID], + state.signature == signature else { return } + result[mapping.storageID] = state + } + var rankedByStorageID: [String: [RankedChunk]] = [:] + var liveValidStorageIDs: Set<String> = [] + var checkedStorageIDs: Set<String> = [] + var staleItemsByStorageID: [String: StudyItem] = [:] + let terms = Array(Self.searchTerms(in: query).prefix(32)) + if !terms.isEmpty, + let statement = prepare( + """ + WITH matches AS ( + SELECT item_id, sort_order, text, bm25(chunks) AS rank + FROM chunks + WHERE terms MATCH ? + ), ranked AS ( + SELECT item_id, sort_order, text, rank, + ROW_NUMBER() OVER (PARTITION BY item_id ORDER BY rank) AS row_number + FROM matches + ) + SELECT item_id, sort_order, text + FROM ranked + WHERE row_number <= 12 + ORDER BY rank + LIMIT 6000 + """, + in: database + ) { + defer { sqlite3_finalize(statement) } + let expression = terms + .map { "\"\($0.replacingOccurrences(of: "\"", with: "\"\""))\"" } + .joined(separator: " OR ") + bind(expression, at: 1, in: statement) + while sqlite3_step(statement) == SQLITE_ROW { + guard !cancellationProbe.isCancelled else { break } + guard let storageID = columnText(statement, at: 0), + let item = itemByStorageID[storageID], + validStates[storageID] != nil, + let text = columnText(statement, at: 2), + !text.isEmpty else { continue } + if checkedStorageIDs.insert(storageID).inserted { + if let currentSignature = Self.fileSignature(for: item), + currentSignature == expectedSignatures[storageID] { + liveValidStorageIDs.insert(storageID) + } else { + staleItemsByStorageID[storageID] = item + } + } + guard liveValidStorageIDs.contains(storageID) else { continue } + var chunks = rankedByStorageID[storageID] ?? [] + guard chunks.count < 12 else { continue } + chunks.append( + RankedChunk( + sortOrder: Int(sqlite3_column_int64(statement, 1)), + text: text + ) + ) + rankedByStorageID[storageID] = chunks + } + } + for (storageID, item) in staleItemsByStorageID { + if Self.fileSignature(for: item) != nil { + schedule([item]) + } else { + invalidate(storageID: storageID) + } + } + + let characterLimit = max(maximumCharactersPerItem, 1) + return itemMappings.reduce(into: [String: CourseDocumentIndexResult]()) { result, mapping in + let state = validStates[mapping.storageID] + let chunks = (rankedByStorageID[mapping.storageID] ?? []).sorted { $0.sortOrder < $1.sortOrder } + let joined = chunks.map(\.text).joined(separator: "\n\n") + result[mapping.itemID] = CourseDocumentIndexResult( + text: joined.isEmpty ? nil : String(joined.prefix(characterLimit)), + isTruncated: state?.isComplete != true + || state?.hasPartialExtraction == true + || (state?.chunkCount ?? 0) > chunks.count + || joined.count > characterLimit + ) + } + } + + private struct ScheduledItem { + var item: StudyItem + var storageID: String + var signature: String + } + + private func schedule(_ scheduled: ScheduledItem) { + let scheduleKey = "\(scheduled.storageID)#\(scheduled.signature)" + schedulingLock.lock() + let inserted = scheduledSignatures.insert(scheduleKey).inserted + schedulingLock.unlock() + guard inserted else { return } + + indexingQueue.async { [weak self] in + guard let self else { return } + if self.index( + scheduled.item, + storageID: scheduled.storageID, + signature: scheduled.signature + ) { + self.ocrQueue.async { [weak self] in + guard let self else { return } + self.finishPDFOCR( + item: scheduled.item, + storageID: scheduled.storageID, + signature: scheduled.signature + ) + let needsAnotherNativePass = self.hasPendingNativePDFPages( + item: scheduled.item, + storageID: scheduled.storageID, + signature: scheduled.signature + ) + self.clearScheduledSignature(scheduleKey) + if needsAnotherNativePass { + self.schedule(scheduled) + } + } + } else { + self.clearScheduledSignature(scheduleKey) + } + } + } + + private func clearScheduledSignature(_ signature: String) { + schedulingLock.lock() + scheduledSignatures.remove(signature) + schedulingLock.unlock() + } + + private func invalidate(storageID: String) { + schedulingLock.lock() + expectedSignaturesByStorageID.removeValue(forKey: storageID) + let validStorageIDs = Set(expectedSignaturesByStorageID.keys) + schedulingLock.unlock() + indexingQueue.async { [weak self] in + self?.pruneMissingItems(validStorageIDs: validStorageIDs) + } + } + + private func refreshChangedItemsForLookup(_ items: [StudyItem]) { + let scheduledItems = items.compactMap(Self.scheduledItem) + let requestedStorageIDs = Set(items.filter { $0.url != nil }.map { Self.storageID(for: $0.id) }) + let currentStorageIDs = Set(scheduledItems.map(\.storageID)) + schedulingLock.lock() + for storageID in requestedStorageIDs.subtracting(currentStorageIDs) { + expectedSignaturesByStorageID.removeValue(forKey: storageID) + } + for scheduled in scheduledItems { + expectedSignaturesByStorageID[scheduled.storageID] = scheduled.signature + } + let validStorageIDs = Set(expectedSignaturesByStorageID.keys) + schedulingLock.unlock() + + if requestedStorageIDs != currentStorageIDs { + indexingQueue.async { [weak self] in + self?.pruneMissingItems(validStorageIDs: validStorageIDs) + } + } + + let persistedStates: [String: FileState] + if let database = openDatabase() { + persistedStates = fileStates(in: database) + sqlite3_close(database) + } else { + persistedStates = [:] + } + var immediateRefreshCount = 0 + let immediateRefreshDeadline = Date().addingTimeInterval(Self.maximumImmediateRefreshSeconds) + for scheduled in scheduledItems { + guard !Task.isCancelled else { return } + let state = persistedStates[scheduled.storageID] + let shouldIndexImmediately: Bool + if let state { + shouldIndexImmediately = state.signature != scheduled.signature + } else { + shouldIndexImmediately = true + } + if shouldIndexImmediately, + immediateRefreshCount < Self.maximumImmediateRefreshItems, + immediateRefreshDeadline.timeIntervalSinceNow > 0 { + immediateRefreshCount += 1 + let needsBackgroundCompletion = index( + scheduled.item, + storageID: scheduled.storageID, + signature: scheduled.signature, + maximumNativePDFPages: Self.maximumForegroundPDFPages, + maximumNativePDFSeconds: min( + Self.foregroundPDFTextBudget, + immediateRefreshDeadline.timeIntervalSinceNow + ) + ) + if needsBackgroundCompletion { + schedule(scheduled) + } + } else if shouldIndexImmediately + || state == nil + || (state?.isComplete == false && scheduled.item.kind == .pdf) { + schedule(scheduled) + } + } + } + + private func index( + _ item: StudyItem, + storageID: String, + signature: String, + maximumNativePDFPages: Int? = nil, + maximumNativePDFSeconds: TimeInterval? = nil + ) -> Bool { + guard let itemLock = acquireItemIndexLock(for: storageID) else { return false } + defer { itemLock.unlock() } + guard isExpected(signature: signature, for: storageID), + let database = openDatabase(), + let url = item.url else { return false } + defer { sqlite3_close(database) } + if let state = fileState(for: storageID, in: database), + state.signature == signature, + state.isComplete { + return false + } + if let state = fileState(for: storageID, in: database), + state.signature == signature, + !state.isComplete, + item.kind != .pdf { + return false + } + + switch item.kind { + case .pdf: + return indexPDFTextLayer( + item: item, + storageID: storageID, + url: url, + signature: signature, + maximumPages: maximumNativePDFPages, + maximumSeconds: maximumNativePDFSeconds, + in: database + ) + case .html, .markdown, .text: + indexTextFile(item: item, storageID: storageID, signature: signature, in: database) + return false + } + } + + private func acquireItemIndexLock(for storageID: String) -> NSLock? { + itemIndexLockRegistryLock.lock() + let lock: NSLock + if let existing = itemIndexLocks[storageID] { + lock = existing + } else { + lock = NSLock() + itemIndexLocks[storageID] = lock + } + itemIndexLockRegistryLock.unlock() + while !lock.try() { + guard !Task.isCancelled else { return nil } + Thread.sleep(forTimeInterval: 0.01) + } + return lock + } + + private func indexTextFile( + item: StudyItem, + storageID: String, + signature: String, + in database: OpaquePointer + ) { + guard let text = Self.text(for: item) else { return } + var indexedAllChunks = true + var indexedChunkCount = 0 + _ = withWriteTransaction(in: database) { + guard isExpected(signature: signature, for: storageID) else { return false } + guard deleteIndexedContent(for: storageID, in: database) else { return false } + var start = text.startIndex + while start < text.endIndex { + guard !Task.isCancelled else { return false } + guard isExpected(signature: signature, for: storageID) else { return false } + guard hasDatabaseCapacity() else { + indexedAllChunks = false + break + } + let end = text.index(start, offsetBy: 2_000, limitedBy: text.endIndex) ?? text.endIndex + let chunk = String(text[start..<end]) + guard insertChunk( + itemID: storageID, + sortOrder: indexedChunkCount, + location: "", + text: chunk, + in: database + ) else { return false } + indexedChunkCount += 1 + start = end + } + guard isExpected(signature: signature, for: storageID) else { return false } + return replaceFileRecord( + itemID: storageID, + kind: item.kind, + signature: signature, + pageCount: 1, + processedCount: indexedAllChunks ? 1 : 0, + isComplete: indexedAllChunks, + chunkCount: indexedChunkCount, + in: database + ) + } + } + + private func indexPDFTextLayer( + item: StudyItem, + storageID: String, + url: URL, + signature: String, + maximumPages: Int?, + maximumSeconds: TimeInterval?, + in database: OpaquePointer + ) -> Bool { + guard let document = PDFDocument(url: url) else { return false } + let pageCount = max(document.pageCount, 0) + let existingState = fileState(for: storageID, in: database) + if existingState?.signature != signature || storedPageCount(for: storageID, in: database) != pageCount { + let reset = withWriteTransaction(in: database) { + isExpected(signature: signature, for: storageID) + && deleteIndexedContent(for: storageID, in: database) + && replaceFileRecord( + itemID: storageID, + kind: item.kind, + signature: signature, + pageCount: pageCount, + processedCount: 0, + isComplete: pageCount == 0, + chunkCount: 0, + in: database + ) + } + guard reset else { return false } + } + + var processedPages = processedPageIndexes(for: storageID, in: database) + var nativeAttemptedPages = nativeAttemptedPageIndexes(for: storageID, in: database) + let nativePageLimit = min(pageCount, maximumPages.map { max($0, 0) } ?? pageCount) + let extractionDeadline = Date().addingTimeInterval( + maximumSeconds + ?? (maximumPages == nil ? Self.backgroundPDFTextBudget : Self.foregroundPDFTextBudget) + ) + let pendingPageIndexes = (0..<nativePageLimit).filter { !nativeAttemptedPages.contains($0) } + var pendingBatches: [[Int]] = [] + var pendingOffset = 0 + while pendingOffset < pendingPageIndexes.count { + let endOffset = min( + pendingOffset + Self.maximumNativePDFPagesPerWorker, + pendingPageIndexes.count + ) + pendingBatches.append(Array(pendingPageIndexes[pendingOffset..<endOffset])) + pendingOffset = endOffset + } + pendingBatches.reverse() + while let batch = pendingBatches.popLast() { + guard !Task.isCancelled else { return true } + let remainingTime = extractionDeadline.timeIntervalSinceNow + guard remainingTime > 0 else { break } + guard isExpected(signature: signature, for: storageID), + Self.fileSignature(for: item) == signature else { return false } + guard hasDatabaseCapacity() else { break } + guard let extractions = nativePDFTextLoader( + url, + batch, + Self.maximumPDFPageCharacters, + remainingTime + ) else { + guard !Task.isCancelled else { return true } + guard extractionDeadline.timeIntervalSinceNow > 0 else { break } + if batch.count > 1 { + let midpoint = batch.count / 2 + pendingBatches.append(Array(batch[midpoint...])) + pendingBatches.append(Array(batch[..<midpoint])) + continue + } + guard let pageIndex = batch.first else { continue } + if markNativeAttempted( + itemID: storageID, + expectedSignature: signature, + pageIndex: pageIndex, + in: database + ) { + nativeAttemptedPages.insert(pageIndex) + } + continue + } + guard !Task.isCancelled else { return true } + for pageIndex in batch { + guard isExpected(signature: signature, for: storageID), + Self.fileSignature(for: item) == signature else { return false } + if let extraction = extractions[pageIndex], + Self.hasMeaningfulText(extraction.text) { + let extractionKind = extraction.isPartial ? "text-partial" : "text" + guard replacePDFPage( + itemID: storageID, + expectedSignature: signature, + pageIndex: pageIndex, + pageText: extraction.text, + extractionKind: extractionKind, + in: database + ) else { continue } + processedPages.insert(pageIndex) + } + guard markNativeAttempted( + itemID: storageID, + expectedSignature: signature, + pageIndex: pageIndex, + in: database + ) else { continue } + nativeAttemptedPages.insert(pageIndex) + } + } + _ = updateFileProgress( + itemID: storageID, + expectedSignature: signature, + processedCount: processedPages.count, + isComplete: processedPages.count == pageCount, + in: database + ) + return processedPages.count < pageCount + } + + private func finishPDFOCR(item: StudyItem, storageID: String, signature: String) { + guard let itemLock = acquireItemIndexLock(for: storageID) else { return } + defer { itemLock.unlock() } + guard isExpected(signature: signature, for: storageID), + Self.fileSignature(for: item) == signature, + let database = openDatabase(), + let url = item.url, + let document = PDFDocument(url: url), + fileState(for: storageID, in: database)?.signature == signature else { return } + defer { sqlite3_close(database) } + let pageCount = max(document.pageCount, 0) + var processedPages = processedPageIndexes(for: storageID, in: database) + let nativeAttemptedPages = nativeAttemptedPageIndexes(for: storageID, in: database) + let pagesToOCR = nativeAttemptedPages.subtracting(processedPages).sorted() + for pageIndex in pagesToOCR { + guard hasDatabaseCapacity() else { return } + guard isExpected(signature: signature, for: storageID), + Self.fileSignature(for: item) == signature, + fileState(for: storageID, in: database)?.signature == signature else { return } + let pageText: String + let extractionKind: String + switch PDFOCRTextExtractor.pageOutcome(from: document, pageIndex: pageIndex) { + case let .text(page): + let rawText = page.text + pageText = String(rawText.prefix(Self.maximumPDFPageCharacters)) + extractionKind = rawText.count > pageText.count ? "ocr-partial" : "ocr" + case .empty: + pageText = "" + extractionKind = "empty" + case .failed: + pageText = "" + extractionKind = "failed" + } + guard replacePDFPage( + itemID: storageID, + expectedSignature: signature, + pageIndex: pageIndex, + pageText: pageText, + extractionKind: extractionKind, + in: database + ) else { continue } + processedPages.insert(pageIndex) + _ = updateFileProgress( + itemID: storageID, + expectedSignature: signature, + processedCount: processedPages.count, + isComplete: processedPages.count == pageCount, + in: database + ) + } + } + + private func hasPendingNativePDFPages( + item: StudyItem, + storageID: String, + signature: String + ) -> Bool { + guard isExpected(signature: signature, for: storageID), + Self.fileSignature(for: item) == signature, + hasDatabaseCapacity(), + let database = openDatabase() else { return false } + defer { sqlite3_close(database) } + guard let state = fileState(for: storageID, in: database), + state.signature == signature, + !state.isComplete, + let pageCount = storedPageCount(for: storageID, in: database), + pageCount > 0 else { return false } + let resolvedPages = nativeAttemptedPageIndexes(for: storageID, in: database) + .union(processedPageIndexes(for: storageID, in: database)) + return resolvedPages.count < pageCount + } + + private func replacePDFPage( + itemID: String, + expectedSignature: String, + pageIndex: Int, + pageText: String, + extractionKind: String, + in database: OpaquePointer + ) -> Bool { + withWriteTransaction(in: database) { + guard isExpected(signature: expectedSignature, for: itemID) else { return false } + let pageRange = (pageIndex * 1_000)...(pageIndex * 1_000 + 999) + guard deleteChunks(for: itemID, sortOrderRange: pageRange, in: database) else { return false } + + let marker = extractionKind.hasPrefix("ocr") ? "(OCR)" : "" + let location = "第 \(pageIndex + 1) 页\(marker)" + var start = pageText.startIndex + var chunkIndex = 0 + while start < pageText.endIndex { + guard !Task.isCancelled else { return false } + let end = pageText.index(start, offsetBy: 1_900, limitedBy: pageText.endIndex) + ?? pageText.endIndex + let chunk = String(pageText[start..<end]) + guard hasDatabaseCapacity(), insertChunk( + itemID: itemID, + sortOrder: pageIndex * 1_000 + chunkIndex, + location: location, + text: "\(location)\n\(chunk)", + in: database + ) else { return false } + chunkIndex += 1 + start = end + } + guard let statement = prepare( + "INSERT OR REPLACE INTO processed_pages (item_id, page_index, extraction_kind) VALUES (?, ?, ?)", + in: database + ) else { return false } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + sqlite3_bind_int64(statement, 2, sqlite3_int64(pageIndex)) + bind(extractionKind, at: 3, in: statement) + return sqlite3_step(statement) == SQLITE_DONE + } + } + + private func insertChunk( + itemID: String, + sortOrder: Int, + location: String, + text: String, + in database: OpaquePointer + ) -> Bool { + guard let statement = prepare( + "INSERT INTO chunks (item_id, sort_order, location, text, terms) VALUES (?, ?, ?, ?, ?)", + in: database + ) else { return false } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + sqlite3_bind_int64(statement, 2, sqlite3_int64(sortOrder)) + bind(location, at: 3, in: statement) + bind(text, at: 4, in: statement) + bind(Self.searchTerms(in: text).joined(separator: " "), at: 5, in: statement) + guard sqlite3_step(statement) == SQLITE_DONE else { return false } + let rowID = sqlite3_last_insert_rowid(database) + guard let metadata = prepare( + "INSERT INTO chunk_index (chunk_rowid, item_id, sort_order) VALUES (?, ?, ?)", + in: database + ) else { return false } + defer { sqlite3_finalize(metadata) } + sqlite3_bind_int64(metadata, 1, rowID) + bind(itemID, at: 2, in: metadata) + sqlite3_bind_int64(metadata, 3, sqlite3_int64(sortOrder)) + return sqlite3_step(metadata) == SQLITE_DONE + } + + private func deleteIndexedContent(for itemID: String, in database: OpaquePointer) -> Bool { + guard deleteChunks(for: itemID, sortOrderRange: nil, in: database) else { return false } + for sql in [ + "DELETE FROM processed_pages WHERE item_id = ?", + "DELETE FROM native_attempted_pages WHERE item_id = ?", + "DELETE FROM files WHERE item_id = ?", + ] { + guard let statement = prepare(sql, in: database) else { return false } + bind(itemID, at: 1, in: statement) + let result = sqlite3_step(statement) + sqlite3_finalize(statement) + guard result == SQLITE_DONE else { return false } + } + return true + } + + private func deleteChunks( + for itemID: String, + sortOrderRange: ClosedRange<Int>?, + in database: OpaquePointer + ) -> Bool { + let predicate = sortOrderRange == nil + ? "item_id = ?" + : "item_id = ? AND sort_order BETWEEN ? AND ?" + for sql in [ + "DELETE FROM chunks WHERE rowid IN (SELECT chunk_rowid FROM chunk_index WHERE \(predicate))", + "DELETE FROM chunk_index WHERE \(predicate)", + ] { + guard let statement = prepare(sql, in: database) else { return false } + bind(itemID, at: 1, in: statement) + if let sortOrderRange { + sqlite3_bind_int64(statement, 2, sqlite3_int64(sortOrderRange.lowerBound)) + sqlite3_bind_int64(statement, 3, sqlite3_int64(sortOrderRange.upperBound)) + } + let result = sqlite3_step(statement) + sqlite3_finalize(statement) + guard result == SQLITE_DONE else { return false } + } + return true + } + + private func replaceFileRecord( + itemID: String, + kind: StudyItemKind, + signature: String, + pageCount: Int, + processedCount: Int, + isComplete: Bool, + chunkCount: Int, + in database: OpaquePointer + ) -> Bool { + guard let statement = prepare( + """ + INSERT OR REPLACE INTO files + (item_id, signature, kind, page_count, processed_count, is_complete, chunk_count) + VALUES (?, ?, ?, ?, ?, ?, ?) + """, + in: database + ) else { return false } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + bind(signature, at: 2, in: statement) + bind(kind.rawValue, at: 3, in: statement) + sqlite3_bind_int64(statement, 4, sqlite3_int64(pageCount)) + sqlite3_bind_int64(statement, 5, sqlite3_int64(processedCount)) + sqlite3_bind_int(statement, 6, isComplete ? 1 : 0) + sqlite3_bind_int64(statement, 7, sqlite3_int64(chunkCount)) + return sqlite3_step(statement) == SQLITE_DONE + } + + private func updateFileProgress( + itemID: String, + expectedSignature: String, + processedCount: Int, + isComplete: Bool, + in database: OpaquePointer + ) -> Bool { + databaseWriteLock.lock() + defer { databaseWriteLock.unlock() } + guard let statement = prepare( + """ + UPDATE files + SET processed_count = ?, + is_complete = ?, + chunk_count = CASE + WHEN ? = 1 THEN (SELECT COUNT(*) FROM chunk_index WHERE item_id = ?) + ELSE chunk_count + END + WHERE item_id = ? AND signature = ? + """, + in: database + ) else { return false } + defer { sqlite3_finalize(statement) } + sqlite3_bind_int64(statement, 1, sqlite3_int64(processedCount)) + sqlite3_bind_int(statement, 2, isComplete ? 1 : 0) + sqlite3_bind_int(statement, 3, isComplete ? 1 : 0) + bind(itemID, at: 4, in: statement) + bind(itemID, at: 5, in: statement) + bind(expectedSignature, at: 6, in: statement) + return sqlite3_step(statement) == SQLITE_DONE + } + + private func withWriteTransaction( + in database: OpaquePointer, + _ body: () -> Bool + ) -> Bool { + databaseWriteLock.lock() + defer { databaseWriteLock.unlock() } + guard execute("BEGIN IMMEDIATE", in: database) else { return false } + guard body() else { + _ = execute("ROLLBACK", in: database) + return false + } + guard execute("COMMIT", in: database) else { + _ = execute("ROLLBACK", in: database) + return false + } + return true + } + + private func pruneMissingItems(validStorageIDs: Set<String>) { + guard let database = openDatabase() else { return } + defer { sqlite3_close(database) } + let staleIDs = persistedItemIDs(in: database).subtracting(validStorageIDs) + guard !staleIDs.isEmpty else { return } + let pruned = withWriteTransaction(in: database) { + staleIDs.allSatisfy { deleteIndexedContent(for: $0, in: database) } + } + guard pruned else { return } + databaseWriteLock.lock() + _ = execute("PRAGMA wal_checkpoint(TRUNCATE)", in: database) + if hasDatabaseCapacity(reserving: 16 * 1_024 * 1_024) { + _ = execute("PRAGMA incremental_vacuum(2000)", in: database) + _ = execute("PRAGMA wal_checkpoint(TRUNCATE)", in: database) + } + if hasDatabaseCapacity(reserving: 4 * 1_024 * 1_024) { + _ = execute("INSERT INTO chunks(chunks, rank) VALUES('merge', 64)", in: database) + _ = execute("PRAGMA wal_checkpoint(TRUNCATE)", in: database) + } + databaseWriteLock.unlock() + } + + private func isExpected(signature: String, for storageID: String) -> Bool { + schedulingLock.lock() + defer { schedulingLock.unlock() } + return expectedSignaturesByStorageID[storageID] == signature + } + + private func processedPageIndexes(for itemID: String, in database: OpaquePointer) -> Set<Int> { + guard let statement = prepare( + "SELECT page_index FROM processed_pages WHERE item_id = ?", + in: database + ) else { return [] } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + var indexes: Set<Int> = [] + while sqlite3_step(statement) == SQLITE_ROW { + indexes.insert(Int(sqlite3_column_int64(statement, 0))) + } + return indexes + } + + private func nativeAttemptedPageIndexes(for itemID: String, in database: OpaquePointer) -> Set<Int> { + guard let statement = prepare( + "SELECT page_index FROM native_attempted_pages WHERE item_id = ?", + in: database + ) else { return [] } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + var indexes: Set<Int> = [] + while sqlite3_step(statement) == SQLITE_ROW { + indexes.insert(Int(sqlite3_column_int64(statement, 0))) + } + return indexes + } + + private func markNativeAttempted( + itemID: String, + expectedSignature: String, + pageIndex: Int, + in database: OpaquePointer + ) -> Bool { + databaseWriteLock.lock() + defer { databaseWriteLock.unlock() } + guard isExpected(signature: expectedSignature, for: itemID), + fileState(for: itemID, in: database)?.signature == expectedSignature, + let statement = prepare( + "INSERT OR IGNORE INTO native_attempted_pages (item_id, page_index) VALUES (?, ?)", + in: database + ) else { return false } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + sqlite3_bind_int64(statement, 2, sqlite3_int64(pageIndex)) + return sqlite3_step(statement) == SQLITE_DONE + } + + private func storedPageCount(for itemID: String, in database: OpaquePointer) -> Int? { + guard let statement = prepare( + "SELECT page_count FROM files WHERE item_id = ?", + in: database + ) else { return nil } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + guard sqlite3_step(statement) == SQLITE_ROW else { return nil } + return Int(sqlite3_column_int64(statement, 0)) + } + + private func fileState(for itemID: String, in database: OpaquePointer) -> FileState? { + guard let statement = prepare( + """ + SELECT signature, is_complete, chunk_count, + EXISTS( + SELECT 1 FROM processed_pages + WHERE processed_pages.item_id = files.item_id + AND (extraction_kind LIKE '%-partial' OR extraction_kind = 'failed') + ) + FROM files + WHERE item_id = ? + """, + in: database + ) else { return nil } + defer { sqlite3_finalize(statement) } + bind(itemID, at: 1, in: statement) + guard sqlite3_step(statement) == SQLITE_ROW, + let signature = columnText(statement, at: 0) else { return nil } + return FileState( + signature: signature, + isComplete: sqlite3_column_int(statement, 1) != 0, + chunkCount: Int(sqlite3_column_int64(statement, 2)), + hasPartialExtraction: sqlite3_column_int(statement, 3) != 0 + ) + } + + private func fileStates(in database: OpaquePointer) -> [String: FileState] { + guard let statement = prepare( + """ + SELECT item_id, signature, is_complete, chunk_count, + EXISTS( + SELECT 1 FROM processed_pages + WHERE processed_pages.item_id = files.item_id + AND (extraction_kind LIKE '%-partial' OR extraction_kind = 'failed') + ) + FROM files + """, + in: database + ) else { return [:] } + defer { sqlite3_finalize(statement) } + var states: [String: FileState] = [:] + while sqlite3_step(statement) == SQLITE_ROW { + guard let itemID = columnText(statement, at: 0), + let signature = columnText(statement, at: 1) else { continue } + states[itemID] = FileState( + signature: signature, + isComplete: sqlite3_column_int(statement, 2) != 0, + chunkCount: Int(sqlite3_column_int64(statement, 3)), + hasPartialExtraction: sqlite3_column_int(statement, 4) != 0 + ) + } + return states + } + + private func persistedItemIDs(in database: OpaquePointer) -> Set<String> { + var itemIDs: Set<String> = [] + for table in ["files", "processed_pages", "native_attempted_pages", "chunk_index"] { + guard let statement = prepare("SELECT DISTINCT item_id FROM \(table)", in: database) else { + continue + } + while sqlite3_step(statement) == SQLITE_ROW { + if let itemID = columnText(statement, at: 0) { + itemIDs.insert(itemID) + } + } + sqlite3_finalize(statement) + } + return itemIDs + } + + private func openDatabase() -> OpaquePointer? { + var database: OpaquePointer? + let result = sqlite3_open_v2( + databaseURL.path, + &database, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, + nil + ) + guard result == SQLITE_OK, let database else { + if let database { sqlite3_close(database) } + return nil + } + sqlite3_busy_timeout(database, 2_000) + let maximumPageCount = Int64(Self.maximumSQLiteBytes / Self.sqlitePageBytes) + guard execute("PRAGMA page_size=4096", in: database), + integerValue("PRAGMA page_size", in: database) == Int64(Self.sqlitePageBytes), + execute("PRAGMA max_page_count=\(maximumPageCount)", in: database), + integerValue("PRAGMA max_page_count", in: database) == maximumPageCount else { + sqlite3_close(database) + return nil + } + _ = execute("PRAGMA journal_size_limit=67108864", in: database) + _ = execute("PRAGMA wal_autocheckpoint=256", in: database) + for url in [ + databaseURL, + URL(fileURLWithPath: databaseURL.path + "-wal"), + URL(fileURLWithPath: databaseURL.path + "-shm"), + ] where FileManager.default.fileExists(atPath: url.path) { + try? FileManager.default.setAttributes([.posixPermissions: 0o600], ofItemAtPath: url.path) + } + return database + } + + private func integerValue(_ sql: String, in database: OpaquePointer) -> Int64? { + guard let statement = prepare(sql, in: database) else { return nil } + defer { sqlite3_finalize(statement) } + guard sqlite3_step(statement) == SQLITE_ROW else { return nil } + return sqlite3_column_int64(statement, 0) + } + + private func hasDatabaseCapacity( + reserving reserveBytes: UInt64 = CourseDocumentSearchIndex.minimumWriteReserveBytes + ) -> Bool { + let urls = [ + databaseURL, + URL(fileURLWithPath: databaseURL.path + "-wal"), + URL(fileURLWithPath: databaseURL.path + "-shm"), + ] + let bytes = urls.reduce(UInt64(0)) { total, url in + let size = (try? FileManager.default.attributesOfItem(atPath: url.path)[.size] as? NSNumber)? + .uint64Value ?? 0 + return total + size + } + return bytes <= Self.maximumDatabaseBytes - min(reserveBytes, Self.maximumDatabaseBytes) + } + + private func execute(_ sql: String, in database: OpaquePointer) -> Bool { + sqlite3_exec(database, sql, nil, nil, nil) == SQLITE_OK + } + + private func prepare(_ sql: String, in database: OpaquePointer) -> OpaquePointer? { + var statement: OpaquePointer? + guard sqlite3_prepare_v2(database, sql, -1, &statement, nil) == SQLITE_OK else { + return nil + } + return statement + } + + private func bind(_ value: String, at index: Int32, in statement: OpaquePointer) { + sqlite3_bind_text(statement, index, value, -1, transientDestructor) + } + + private func columnText(_ statement: OpaquePointer, at index: Int32) -> String? { + guard let value = sqlite3_column_text(statement, index) else { return nil } + return String(cString: value) + } + + private static func fileSignature(for item: StudyItem) -> String? { + guard let url = item.url, + let attributes = try? FileManager.default.attributesOfItem(atPath: url.path) else { + return nil + } + let modified = (attributes[FileAttributeKey.modificationDate] as? Date)?.timeIntervalSince1970 ?? 0 + let size = (attributes[FileAttributeKey.size] as? NSNumber)?.uint64Value ?? 0 + return "v4#\(item.kind.rawValue)#\(modified)#\(size)" + } + + private static func scheduledItem(_ item: StudyItem) -> ScheduledItem? { + guard let url = item.url, + let attributes = try? FileManager.default.attributesOfItem(atPath: url.path), + let signature = fileSignature(for: item) else { return nil } + let fileBytes = (attributes[.size] as? NSNumber)?.uint64Value ?? 0 + guard item.kind == .pdf || fileBytes <= maximumTextSourceBytes else { return nil } + return ScheduledItem( + item: item, + storageID: storageID(for: item.id), + signature: signature + ) + } + + private static func storageID(for itemID: String) -> String { + let digest = SHA256.hash(data: Data(itemID.utf8)) + return digest.map { String(format: "%02x", $0) }.joined() + } + + private static func text(for item: StudyItem) -> String? { + guard let url = item.url else { return nil } + switch item.kind { + case .html: + guard let data = try? Data(contentsOf: url) else { return nil } + let headings = htmlHeadings(in: data) + if let attributed = try? NSAttributedString( + data: data, + options: [ + .documentType: NSAttributedString.DocumentType.html, + .characterEncoding: String.Encoding.utf8.rawValue, + ], + documentAttributes: nil + ) { + let headingText = headings.map { "# \($0)" }.joined(separator: "\n") + return headingText.isEmpty ? attributed.string : "\(headingText)\n\n\(attributed.string)" + } + return String(data: data, encoding: .utf8) + case .markdown, .text: + return try? String(contentsOf: url, encoding: .utf8) + case .pdf: + return nil + } + } + + private static func htmlHeadings(in data: Data) -> [String] { + guard let html = String(data: data, encoding: .utf8), + let regex = try? NSRegularExpression( + pattern: #"<h([1-4])\b[^>]*>(.*?)</h\1\s*>"#, + options: [.caseInsensitive, .dotMatchesLineSeparators] + ) else { return [] } + let range = NSRange(html.startIndex..<html.endIndex, in: html) + var headings: [String] = [] + var locationIDCounts: [String: Int] = [:] + let matches = regex.matches(in: html, range: range) + for (index, match) in matches.enumerated() { + guard match.numberOfRanges > 2, + let matchRange = Range(match.range(at: 2), in: html) else { continue } + let text = htmlPlainText(String(html[matchRange])) + if !text.isEmpty { + let bodyStart = NSMaxRange(match.range) + let bodyEnd = index + 1 < matches.count ? matches[index + 1].range.location : range.length + let body: String + if bodyStart <= bodyEnd, + let bodyRange = Range(NSRange(location: bodyStart, length: bodyEnd - bodyStart), in: html) { + body = htmlPlainText(String(html[bodyRange])) + } else { + body = "" + } + let baseLocationID = htmlSectionLocationID(title: text, body: body) + let count = locationIDCounts[baseLocationID, default: 0] + 1 + locationIDCounts[baseLocationID] = count + let locationID = count == 1 ? baseLocationID : "\(baseLocationID)-dup-\(count)" + headings.append("[\(locationID)][html-heading-\(index)] \(text.prefix(300))") + } + } + return headings + } + + private static func htmlPlainText(_ fragment: String) -> String { + let data = Data("<html><body>\(fragment)</body></html>".utf8) + return (try? NSAttributedString( + data: data, + options: [ + .documentType: NSAttributedString.DocumentType.html, + .characterEncoding: String.Encoding.utf8.rawValue, + ], + documentAttributes: nil + ))?.string.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + } + + private static func htmlSectionLocationID(title: String, body: String) -> String { + let source = "\(title)|\(body)".lowercased() + let normalized = String(source.unicodeScalars.filter { + CharacterSet.alphanumerics.contains($0) + }.map(String.init).joined().prefix(500)) + var hash: UInt32 = 2_166_136_261 + for byte in normalized.utf8 { + hash ^= UInt32(byte) + hash = hash &* 16_777_619 + } + return String(format: "html-section-%08x", hash) + } + + private static func hasMeaningfulText(_ text: String) -> Bool { + text.unicodeScalars.filter { + !CharacterSet.whitespacesAndNewlines.contains($0) + && !CharacterSet.punctuationCharacters.contains($0) + }.count >= 20 + } + + private static func chunked(_ text: String, maximumCharacters: Int) -> [String] { + guard text.count > maximumCharacters else { return text.isEmpty ? [] : [text] } + var chunks: [String] = [] + var start = text.startIndex + while start < text.endIndex { + let end = text.index(start, offsetBy: maximumCharacters, limitedBy: text.endIndex) ?? text.endIndex + chunks.append(String(text[start..<end])) + start = end + } + return chunks + } + + private static func searchTerms(in text: String) -> [String] { + let lower = text.lowercased() + var terms = lower + .components(separatedBy: CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "_")).inverted) + .filter { $0.count >= 2 } + var run = "" + for scalar in lower.unicodeScalars { + if (0x4E00...0x9FFF).contains(Int(scalar.value)) { + run.unicodeScalars.append(scalar) + } else if !run.isEmpty { + appendChineseTerms(from: run, to: &terms) + run = "" + } + } + if !run.isEmpty { appendChineseTerms(from: run, to: &terms) } + var seen: Set<String> = [] + return terms.filter { term in + seen.insert(term).inserted + } + } + + private static func appendChineseTerms(from run: String, to terms: inout [String]) { + if run.count <= 20 { terms.append(run) } + let characters = Array(run) + guard characters.count >= 2 else { return } + for index in 0..<(characters.count - 1) { + terms.append(String(characters[index...index + 1])) + } + } +} diff --git a/Sources/WeiBeiCore/CourseKnowledgeIndex.swift b/Sources/WeiBeiCore/CourseKnowledgeIndex.swift index 9e32e6b17..4d8286d80 100644 --- a/Sources/WeiBeiCore/CourseKnowledgeIndex.swift +++ b/Sources/WeiBeiCore/CourseKnowledgeIndex.swift @@ -7,6 +7,7 @@ public struct CourseKnowledgeSource: Sendable { public var kind: String public var role: String public var text: String + public var isTruncated: Bool public init( id: String, @@ -14,7 +15,8 @@ public struct CourseKnowledgeSource: Sendable { subtitle: String, kind: String, role: String, - text: String + text: String, + isTruncated: Bool = false ) { self.id = id self.title = title @@ -22,6 +24,7 @@ public struct CourseKnowledgeSource: Sendable { self.kind = kind self.role = role self.text = text + self.isTruncated = isTruncated } } @@ -100,7 +103,7 @@ public enum CourseKnowledgeIndex { headings: headings(in: source.text), tags: source.role == "note" ? MarkdownTagSearch.tags(in: source.text) : [], searchText: excerpt.text, - isTruncated: excerpt.isTruncated + isTruncated: source.isTruncated || excerpt.isTruncated ) } let relations = validLinks.prefix(maximumRelations).map { @@ -111,7 +114,9 @@ public enum CourseKnowledgeIndex { catalog: catalog, items: items, relations: relations, - isTruncated: sources.count > includedSources.count || validLinks.count > relations.count + isTruncated: sources.count > includedSources.count + || validLinks.count > relations.count + || includedSources.contains { $0.isTruncated } ) } @@ -174,7 +179,7 @@ public enum CourseKnowledgeIndex { let heading: String? if line.hasPrefix("#") { heading = line.trimmingCharacters(in: CharacterSet(charactersIn: "# ")) - } else if line.range(of: #"^第\s*\d+\s*页$"#, options: .regularExpression) != nil { + } else if line.range(of: #"^第\s*\d+\s*页(?:(OCR))?$"#, options: .regularExpression) != nil { heading = line } else if line.count <= 80, line.range(of: #"^(?:第.+[章节讲部分]|Chapter\s+\d+|Section\s+\d+)"#, options: [.regularExpression, .caseInsensitive]) != nil { @@ -216,7 +221,10 @@ public enum CourseKnowledgeIndex { } } } - return Array(Set(terms)).sorted { $0.count > $1.count } + var seen: Set<String> = [] + return terms.filter { term in + seen.insert(term).inserted + } } } diff --git a/Sources/WeiBeiCore/LearningModels.swift b/Sources/WeiBeiCore/LearningModels.swift index f18b115a5..131dc108a 100644 --- a/Sources/WeiBeiCore/LearningModels.swift +++ b/Sources/WeiBeiCore/LearningModels.swift @@ -22,6 +22,7 @@ public struct NoteSourceLink: Identifiable, Codable, Hashable, Sendable { public struct StudyLocation: Codable, Hashable, Sendable { public var itemID: String public var itemTitle: String + public var locationID: String? public var locationTitle: String? public var pageIndex: Int? public var lastStudiedAt: Date @@ -30,6 +31,7 @@ public struct StudyLocation: Codable, Hashable, Sendable { public init( itemID: String, itemTitle: String, + locationID: String? = nil, locationTitle: String? = nil, pageIndex: Int? = nil, lastStudiedAt: Date = Date(), @@ -37,6 +39,7 @@ public struct StudyLocation: Codable, Hashable, Sendable { ) { self.itemID = itemID self.itemTitle = itemTitle + self.locationID = locationID self.locationTitle = locationTitle self.pageIndex = pageIndex self.lastStudiedAt = lastStudiedAt @@ -71,6 +74,8 @@ public struct LearningMemoryEntry: Identifiable, Codable, Hashable, Sendable { public var origin: LearningMemoryOrigin public var status: LearningMemoryStatus public var sessionID: UUID? + public var resolvedAt: Date? + public var resolutionEvidence: String? public var createdAt: Date public var updatedAt: Date @@ -82,6 +87,8 @@ public struct LearningMemoryEntry: Identifiable, Codable, Hashable, Sendable { origin: LearningMemoryOrigin, status: LearningMemoryStatus = .active, sessionID: UUID? = nil, + resolvedAt: Date? = nil, + resolutionEvidence: String? = nil, createdAt: Date = Date(), updatedAt: Date = Date() ) { @@ -92,6 +99,8 @@ public struct LearningMemoryEntry: Identifiable, Codable, Hashable, Sendable { self.origin = origin self.status = status self.sessionID = sessionID + self.resolvedAt = resolvedAt + self.resolutionEvidence = resolutionEvidence self.createdAt = createdAt self.updatedAt = updatedAt } diff --git a/Sources/WeiBeiCore/OpenAIResponsesClient.swift b/Sources/WeiBeiCore/OpenAIResponsesClient.swift index 098a69e8d..0ce9326dd 100644 --- a/Sources/WeiBeiCore/OpenAIResponsesClient.swift +++ b/Sources/WeiBeiCore/OpenAIResponsesClient.swift @@ -120,7 +120,7 @@ public struct OpenAIResponsesClient: Sendable { \(language.text("笔记内容", "Note content"))\(headingColon) \(trimmedNote.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ? language.text("无", "none") : trimmedNote) """ - let dialogue = recentMessages.suffix(8).map { message in + let dialogue = recentMessages.suffix(20).map { message in let role = message.role == .user ? language.text("用户", "User") : language.text("助手", "Assistant") let source = message.source?.trimmingCharacters(in: .whitespacesAndNewlines) let sourceText = source?.isEmpty == false ? language.text("(来源:\(source!))", " (source: \(source!))") : "" diff --git a/Sources/WeiBeiCore/PDFOCRTextExtractor.swift b/Sources/WeiBeiCore/PDFOCRTextExtractor.swift index dede1aa50..929a1fea7 100644 --- a/Sources/WeiBeiCore/PDFOCRTextExtractor.swift +++ b/Sources/WeiBeiCore/PDFOCRTextExtractor.swift @@ -27,6 +27,12 @@ public struct PDFOCRPage: Equatable { } } +public enum PDFOCRPageOutcome: Equatable { + case text(PDFOCRPage) + case empty(pageIndex: Int) + case failed(pageIndex: Int) +} + public enum PDFOCRTextExtractor { public static func text(from document: PDFDocument, maxPages: Int = 12) -> String? { let text = pages(from: document, maxPages: maxPages) @@ -48,12 +54,24 @@ public enum PDFOCRTextExtractor { .filter { $0 >= 0 && $0 < pageCount } .sorted() - return indexes.compactMap { index -> PDFOCRPage? in - guard let page = document.page(at: index), - let image = cgImage(for: page) else { return nil } - let lines = recognizeLines(in: image) - return lines.isEmpty ? nil : PDFOCRPage(pageIndex: index, lines: lines) + return indexes.compactMap { index in + guard case let .text(page) = pageOutcome(from: document, pageIndex: index) else { + return nil + } + return page + } + } + + public static func pageOutcome(from document: PDFDocument, pageIndex: Int) -> PDFOCRPageOutcome { + guard pageIndex >= 0, + pageIndex < document.pageCount, + let page = document.page(at: pageIndex), + let image = cgImage(for: page), + let lines = recognizeLines(in: image) else { + return .failed(pageIndex: pageIndex) } + guard !lines.isEmpty else { return .empty(pageIndex: pageIndex) } + return .text(PDFOCRPage(pageIndex: pageIndex, lines: lines)) } private static func cgImage(for page: PDFPage) -> CGImage? { @@ -65,7 +83,7 @@ public enum PDFOCRTextExtractor { return page.thumbnail(of: size, for: .mediaBox).cgImage(forProposedRect: &rect, context: nil, hints: nil) } - private static func recognizeLines(in image: CGImage) -> [PDFOCRLine] { + private static func recognizeLines(in image: CGImage) -> [PDFOCRLine]? { let request = VNRecognizeTextRequest() request.recognitionLevel = .accurate request.usesLanguageCorrection = true @@ -79,7 +97,7 @@ public enum PDFOCRTextExtractor { do { try VNImageRequestHandler(cgImage: image, options: [:]).perform([request]) } catch { - return [] + return nil } return (request.results ?? []) diff --git a/Sources/WeiBeiCore/PiAgentRuntime.swift b/Sources/WeiBeiCore/PiAgentRuntime.swift index 25186d68a..635954d2f 100644 --- a/Sources/WeiBeiCore/PiAgentRuntime.swift +++ b/Sources/WeiBeiCore/PiAgentRuntime.swift @@ -271,8 +271,15 @@ public actor PiAgentRuntime: StudyAgentRuntime { var id: UUID var contextRevision: String var memoryRevision: UInt64 + var userQuestion: String var workflow: StudyAgentWorkflow + var allowsLearningOnlyAnswer: Bool + var resolvableMemoryIDs: Set<String> var allowedSourceLabels: Set<String> + var allowedJumpReferences: Set<String> + var jumpEvidenceLabels: [String: Set<String>] + var allowedLearningLabels: Set<String> = [] + var lastLocationSourceLabel: String? var allowedNoteSourceLabels: Set<String> var didReadContext = false var answeredBeforeContext = false @@ -330,13 +337,26 @@ public actor PiAgentRuntime: StudyAgentRuntime { try writeContext(context) await progress?(.readingContext) + let currentJumpEvidence = currentJumpEvidence(in: context) activeRun = ActiveRun( id: request.id, contextRevision: request.contextRevision, memoryRevision: request.learningContext.memoryRevision, + userQuestion: request.question, workflow: request.resolvedWorkflow, - allowedSourceLabels: sourceLabels(in: context, includeCourse: true), - allowedNoteSourceLabels: sourceLabels(in: context, includeCourse: false), + allowsLearningOnlyAnswer: StudyAgentQuestionScope.allowsLearningOnlyAnswer(request.question), + resolvableMemoryIDs: Set(request.learningContext.memories.compactMap { memory in + guard memory.status == .active, + memory.kind == .goal || memory.kind == .confusion || memory.kind == .nextStep else { + return nil + } + return memory.id.uuidString.lowercased() + }), + allowedSourceLabels: currentSourceLabels(in: context), + allowedJumpReferences: Set(currentJumpEvidence.keys), + jumpEvidenceLabels: currentJumpEvidence, + lastLocationSourceLabel: context.learning.lastLocation.map { "[材料:\($0.itemTitle)]" }, + allowedNoteSourceLabels: currentSourceLabels(in: context), progress: progress ) refreshRunWatchdog() @@ -502,25 +522,190 @@ public actor PiAgentRuntime: StudyAgentRuntime { return "/skill:\(skillName) \(request.question)" } - private func sourceLabels(in context: StudyAgentContextEnvelope, includeCourse: Bool) -> Set<String> { - var labels = ["[笔记:\(context.note.title)]"] - if let material = context.material { + private func currentSourceLabels(in context: StudyAgentContextEnvelope) -> Set<String> { + var labels: [String] = [] + if !context.note.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + labels.append("[笔记:\(context.note.title)]") + } + if let material = context.material, + !material.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { labels.append("[材料:\(material.title)]") } - if let selection = context.selection { + if let selection = context.selection, + !selection.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { labels.append("[选区:\(selection.title)]") } - if includeCourse { - labels.append(contentsOf: context.course.catalog.map { item in - item.role == "note" ? "[笔记:\(item.title)]" : "[材料:\(item.title)]" - }) - labels.append("[学习记录:上次位置]") - labels.append("[学习记忆:用户状态]") - labels.append("[会话:当前]") - } return Set(labels) } + private func currentJumpEvidence(in context: StudyAgentContextEnvelope) -> [String: Set<String>] { + var evidence: [String: Set<String>] = [:] + func add(_ rawReference: String, label: String) { + guard let reference = canonicalJumpReference(rawReference) else { return } + evidence[reference, default: []].insert(label) + } + if !context.note.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + add("来源:\(context.note.title)", label: "[笔记:\(context.note.title)]") + } + if let material = context.material, + !material.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + add("来源:\(material.title)", label: "[材料:\(material.title)]") + } + if let selection = context.selection, + !selection.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + add("来源:\(selection.title)", label: "[选区:\(selection.title)]") + } + return evidence + } + + private func registerJumpEvidence( + _ jumpEvidence: [String: String], + in run: inout ActiveRun + ) { + for (rawReference, label) in jumpEvidence { + guard let reference = canonicalJumpReference(rawReference) else { continue } + run.allowedJumpReferences.insert(reference) + run.jumpEvidenceLabels[reference, default: []].insert(label) + } + } + + private func citedContentLabels(in text: String) -> Set<String> { + labels(in: text, pattern: #"\[(?:材料|笔记|选区):[^\]\n]{1,300}\]"#) + } + + private func citedLearningLabels(in text: String) -> Set<String> { + Set(["[学习记录:上次位置]", "[学习记忆:用户状态]", "[学习记忆:无记录]", "[会话:当前]"]) + .filter { text.contains($0) } + } + + private func citedJumpReferences(in text: String) -> Set<String> { + Set(text.components(separatedBy: .newlines).compactMap { rawLine in + var line = rawLine.trimmingCharacters(in: .whitespacesAndNewlines) + if line.hasPrefix(">") { + line = String(line.dropFirst()).trimmingCharacters(in: .whitespacesAndNewlines) + } + guard line.contains("来源:") || line.localizedCaseInsensitiveContains("source:") else { + return nil + } + guard isDedicatedJumpLine(line) else { return nil } + return canonicalJumpReference(line) + }) + } + + private func isDedicatedJumpLine(_ line: String) -> Bool { + line.range( + of: #"^\s*(?:[-*+>→]\s*)?(?:(?:(?:可点击)?(?:来源|跳转)\s*[::]?|(?:clickable\s+)?(?:source|jump)\s*:?)\s*)?[`*_]*(?:来源:|source:)"#, + options: [.regularExpression, .caseInsensitive] + ) != nil + } + + private func canonicalJumpReference(_ raw: String) -> String? { + let reference = SourceReferenceTitle.parse(raw) + let title = reference.title.trimmingCharacters(in: .whitespacesAndNewlines) + guard !title.isEmpty, + !title.hasPrefix("["), + !title.contains("来源:"), + !title.localizedCaseInsensitiveContains("source:") else { return nil } + var result = "来源:\(title)" + if let ordinal = reference.courseItemOrdinal { + result += ",条目:\(ordinal)" + } + if let pageIndex = reference.pageIndex { + result += ",第 \(pageIndex + 1) 页" + } + if let sectionLocationID = reference.sectionLocationID { + result += ",章节标识:\(sectionLocationID)" + } + if let sectionOrdinal = reference.sectionOrdinal { + result += ",章节序号:\(sectionOrdinal)" + } + if let sectionTitle = reference.sectionTitle { + result += ",章节:\(sectionTitle)" + } + return result + } + + private func labels(in text: String, pattern: String) -> Set<String> { + guard let regex = try? NSRegularExpression(pattern: pattern) else { return [] } + let range = NSRange(text.startIndex..<text.endIndex, in: text) + return Set(regex.matches(in: text, range: range).compactMap { match in + Range(match.range, in: text).map { String(text[$0]) } + }) + } + + private func answerValidationError(text: String, run: ActiveRun) -> String? { + let contentLabels = citedContentLabels(in: text) + let learningLabels = citedLearningLabels(in: text) + guard !contentLabels.isEmpty + || (run.allowsLearningOnlyAnswer && !learningLabels.isEmpty) else { + return "PI returned a content answer without a source read in the current turn" + } + guard contentLabels.isSubset(of: run.allowedSourceLabels) else { + return "PI cited a source that was not read in the current turn" + } + let jumpReferences = citedJumpReferences(in: text) + let unverifiedJumpReferences = jumpReferences.subtracting(run.allowedJumpReferences) + guard unverifiedJumpReferences.isEmpty else { + return "PI suggested a jump location that was not returned by a current-turn tool: \(unverifiedJumpReferences.sorted().joined(separator: ", "))" + } + let citedEvidenceLabels = contentLabels.union(learningLabels) + let mismatchedJumpReferences = jumpReferences.filter { reference in + guard let requiredLabels = run.jumpEvidenceLabels[reference], !requiredLabels.isEmpty else { + return true + } + return requiredLabels.isDisjoint(with: citedEvidenceLabels) + } + guard mismatchedJumpReferences.isEmpty else { + return "PI suggested a jump that does not match its cited evidence: \(mismatchedJumpReferences.sorted().joined(separator: ", "))" + } + guard learningLabels.isSubset(of: run.allowedLearningLabels) else { + return "PI cited learning memory before reading it" + } + return nil + } + + private func learningUpdateValidationError( + _ update: StudyAgentLearningUpdate, + run: ActiveRun + ) -> String? { + guard !run.allowedLearningLabels.isEmpty else { + return "PI proposed a learning-memory update before reading learning memory" + } + for entry in update.entries { + let evidenceIsCurrentTurn = entry.evidence.hasPrefix("[用户:本轮]") + || entry.evidence.hasPrefix("[会话:当前]") + if evidenceIsCurrentTurn, + !currentTurnEvidenceMatches(entry.evidence, question: run.userQuestion) { + return "PI proposed learning memory without quoting the current user turn" + } + let evidenceIsReadSource = run.allowedSourceLabels.contains { + entry.evidence.hasPrefix($0) + } + guard evidenceIsCurrentTurn || evidenceIsReadSource else { + return "PI proposed learning memory with evidence that was not read" + } + if entry.origin == .userStatement, + !entry.evidence.hasPrefix("[用户:本轮]") { + return "PI marked a memory as a user statement without direct user evidence" + } + } + guard update.resolutions.allSatisfy({ resolution in + run.resolvableMemoryIDs.contains(resolution.memoryID.lowercased()) + && resolutionEvidenceMatches(resolution.evidence, question: run.userQuestion) + }) else { + return "PI resolved learning memory without current-turn evidence" + } + return nil + } + + private func currentTurnEvidenceMatches(_ evidence: String, question: String) -> Bool { + StudyAgentCurrentTurnEvidence.matches(evidence, question: question) + } + + private func resolutionEvidenceMatches(_ evidence: String, question: String) -> Bool { + StudyAgentResolutionEvidence.matches(evidence, question: question) + } + private func launchEnvironment( executableURL: URL, contextURL: URL, @@ -818,6 +1003,27 @@ public actor PiAgentRuntime: StudyAgentRuntime { activeRun = run refreshRunWatchdog() + case let .courseSourcesRead(_, contextRevision, labels, jumpEvidence): + guard var run = activeRun, contextRevision == run.contextRevision else { return } + run.allowedSourceLabels.formUnion(labels) + run.allowedNoteSourceLabels.formUnion(labels) + registerJumpEvidence(jumpEvidence, in: &run) + activeRun = run + refreshRunWatchdog() + + case let .learningMemoryRead(_, contextRevision, memoryRevision, labels, jumpEvidence): + guard var run = activeRun, + contextRevision == run.contextRevision, + memoryRevision == run.memoryRevision else { return } + run.allowedLearningLabels = Set(labels) + registerJumpEvidence(jumpEvidence, in: &run) + if labels.contains("[学习记录:上次位置]"), + let lastLocationSourceLabel = run.lastLocationSourceLabel { + run.allowedSourceLabels.insert(lastLocationSourceLabel) + } + activeRun = run + refreshRunWatchdog() + case let .noteProposal(_, proposal): guard var run = activeRun else { return } guard run.workflow == .noteMaking else { @@ -858,6 +1064,13 @@ public actor PiAgentRuntime: StudyAgentRuntime { ) return } + if let validationError = learningUpdateValidationError(update, run: run) { + finishRun( + id: run.id, + with: .failure(PiAgentRuntimeError.agentFailed(validationError)) + ) + return + } run.learningUpdate = update activeRun = run refreshRunWatchdog() @@ -882,8 +1095,8 @@ public actor PiAgentRuntime: StudyAgentRuntime { } else if run.workflow == .noteMaking, run.proposal == nil { finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI returned no revision-matched note proposal"))) } else if run.workflow != .noteMaking, - !run.allowedSourceLabels.contains(where: { cleanText.contains($0) }) { - finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI returned an answer without a current-source label"))) + let validationError = answerValidationError(text: cleanText, run: run) { + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed(validationError))) } else if cleanText.isEmpty, let proposal = run.proposal { finishRun( id: run.id, diff --git a/Sources/WeiBeiCore/PiRPCProtocol.swift b/Sources/WeiBeiCore/PiRPCProtocol.swift index 472693e33..8d6a73ba4 100644 --- a/Sources/WeiBeiCore/PiRPCProtocol.swift +++ b/Sources/WeiBeiCore/PiRPCProtocol.swift @@ -79,6 +79,8 @@ public enum PiRPCIncomingMessage: Equatable, Sendable { case assistantError(String) case toolStarted(id: String, name: String) case contextRead(id: String, contextRevision: String) + case courseSourcesRead(id: String, contextRevision: String, labels: [String], jumpEvidence: [String: String]) + case learningMemoryRead(id: String, contextRevision: String, memoryRevision: UInt64, labels: [String], jumpEvidence: [String: String]) case noteProposal(id: String, StudyAgentNoteProposal) case learningUpdate(id: String, StudyAgentLearningUpdate) case toolFailed(id: String, name: String, message: String) @@ -157,6 +159,56 @@ public enum PiRPCMessageDecoder { contextRevision: revision ) } + if name == "weibei_course_search", + let details = result?["details"] as? [String: Any], + let contextRevision = details["contextRevision"] as? String { + let entries = (details["catalog"] as? [[String: Any]]) + ?? (details["results"] as? [[String: Any]]) + ?? [] + let legacyLabels = entries.compactMap { entry -> String? in + guard let title = entry["title"] as? String, + let role = entry["role"] as? String, + role == "material" || role == "note", + let searchText = entry["searchText"] as? String, + !searchText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { + return nil + } + return role == "note" ? "[笔记:\(title)]" : "[材料:\(title)]" + } + return .courseSourcesRead( + id: object["toolCallId"] as? String ?? "", + contextRevision: contextRevision, + labels: details["evidenceLabels"] as? [String] ?? legacyLabels, + jumpEvidence: details["jumpEvidence"] as? [String: String] ?? [:] + ) + } + if name == "weibei_learning_memory", + let details = result?["details"] as? [String: Any], + details["kind"] as? String == "learning_memory", + let contextRevision = details["contextRevision"] as? String, + let memoryRevision = details["memoryRevision"] as? NSNumber { + let learning = details["learning"] as? [String: Any] ?? [:] + var labels: [String] = [] + if learning["lastLocation"] is [String: Any] { + labels.append("[学习记录:上次位置]") + } + if let memories = learning["memories"] as? [[String: Any]], !memories.isEmpty { + labels.append("[学习记忆:用户状态]") + } + if learning["session"] is [String: Any] { + labels.append("[会话:当前]") + } + if labels.isEmpty { + labels.append("[学习记忆:无记录]") + } + return .learningMemoryRead( + id: object["toolCallId"] as? String ?? "", + contextRevision: contextRevision, + memoryRevision: memoryRevision.uint64Value, + labels: labels, + jumpEvidence: details["jumpEvidence"] as? [String: String] ?? [:] + ) + } if name == "weibei_note_proposal", let details = result?["details"] as? [String: Any], details["kind"] as? String == "note_proposal", @@ -190,6 +242,16 @@ public enum PiRPCMessageDecoder { origin: origin ) } + let resolutions = (details["resolutions"] as? [[String: Any]] ?? []).compactMap { resolution -> StudyAgentMemoryResolution? in + guard let memoryID = resolution["memoryID"] as? String, + let text = resolution["text"] as? String, + let evidence = resolution["evidence"] as? String else { return nil } + return StudyAgentMemoryResolution( + memoryID: memoryID, + text: text, + evidence: evidence + ) + } return .learningUpdate( id: object["toolCallId"] as? String ?? "", StudyAgentLearningUpdate( @@ -198,7 +260,8 @@ public enum PiRPCMessageDecoder { sessionSummary: details["sessionSummary"] as? String, suggestedPhase: (details["suggestedPhase"] as? String).flatMap(StudyPhase.init(rawValue:)), suggestedNext: details["suggestedNext"] as? [String] ?? [], - entries: entries + entries: entries, + resolutions: resolutions ) ) } diff --git a/Sources/WeiBeiCore/StudyAgentRuntime.swift b/Sources/WeiBeiCore/StudyAgentRuntime.swift index 232f858ca..a0f4082d7 100644 --- a/Sources/WeiBeiCore/StudyAgentRuntime.swift +++ b/Sources/WeiBeiCore/StudyAgentRuntime.swift @@ -14,6 +14,153 @@ public enum StudyAgentWorkflow: String, Codable, Sendable { case recallPractice } +public enum StudyAgentQuestionScope { + public static func allowsLearningOnlyAnswer(_ question: String) -> Bool { + var remainder = question.lowercased().unicodeScalars.filter { + CharacterSet.alphanumerics.contains($0) + || (0x4E00...0x9FFF).contains(Int($0.value)) + }.map(String.init).joined() + let statePhrases = [ + "你记得我的学习情况吗", "你记得我学到哪吗", "我上次学习到哪了", "我上次学习到哪", + "我上次学到哪了", "我上次学到哪", "上次学习到哪了", "上次学习到哪", + "上次学到哪了", "上次学到哪", "我的学习进度", "学习进度", "我的学习目标", "学习目标", + "我的目标", "我的学习困惑", "学习困惑", "我的困惑", "接下来学什么", + "接下来做什么", "下一步学什么", "下一步做什么", "下一步", "你记得我吗", + "wheredidistoplasttime", "whereididstoplasttime", "learningprogress", "mygoal", "mylearninggoal", + "myconfusion", "whatnext", "doyourememberme", + ] + var matchedStatePhrase = false + for phrase in statePhrases where remainder.contains(phrase) { + remainder = remainder.replacingOccurrences(of: phrase, with: "") + matchedStatePhrase = true + } + guard matchedStatePhrase else { return false } + let benignWords = [ + "请告诉我一下", "请告诉我", "告诉我一下", "告诉我", "我", "的", "是", "什么", + "有哪些", "请", "一下", "了", "吗", "呢", "和", "以及", "位置", "在哪", "哪里", + "当前", "现在", "想", "要", "please", "tellme", "the", "and", "location", + "current", "now", "what", "is", "are", "my", "i", "did", "lasttime", + ] + for word in benignWords { + remainder = remainder.replacingOccurrences(of: word, with: "") + } + return remainder.isEmpty + } +} + +public enum StudyAgentResolutionEvidence { + public static func matches(_ evidence: String, question: String) -> Bool { + guard StudyAgentCurrentTurnEvidence.matches(evidence, question: question), + let statement = statement(in: evidence) else { return false } + let value = statement.lowercased() + let unresolvedTerms = [ + "不懂", "不理解", "不会", "没懂", "仍然困惑", "还是困惑", "不知道", "不能区分", "不能够", + "还不能", "尚不能", "无法", "没法", "尚未", "还没", "并不", "不太", "不确定", + "不正确", "并非正确", "答错", "错误", "不对", + "don't understand", "do not understand", "can't", "cannot", "still confused", "not sure", + "not able", "unable", "not yet", "have not", "haven't", "incorrect", "not correct", "wrong answer", "is wrong", + ] + guard !unresolvedTerms.contains(where: value.contains) else { return false } + let questionTerms = ["什么", "为什么", "怎么", "为何", "吗", "?", "?", "what", "why", "how"] + guard !questionTerms.contains(where: value.contains) else { return false } + let masteryTerms = [ + "懂了", "明白了", "会了", "掌握了", "可以区分", "能够区分", "能解释", "答对", "正确", + "解决了", "不再困惑", "understand now", "got it", "can distinguish", "can explain", "correct", + ] + if masteryTerms.contains(where: value.contains) { return true } + let answerMarkers = [ + "是", "指", "因为", "所以", "而", "但是", "扣除", "等于", "相比", "表示", "反映", "意味着", "即", "=", + " is ", " means", "because", "therefore", "while", "equals", "represents", "reflects", "differs", + ] + guard answerMarkers.contains(where: value.contains) else { return false } + let meaningfulCount = statement.unicodeScalars.filter { + CharacterSet.alphanumerics.contains($0) + || (0x4E00...0x9FFF).contains(Int($0.value)) + }.count + return meaningfulCount >= 12 + } + + private static func statement(in evidence: String) -> String? { + let prefixes = ["[用户:本轮]", "[会话:当前]"] + guard let prefix = prefixes.first(where: { evidence.hasPrefix($0) }) else { return nil } + let quoteCharacters = CharacterSet(charactersIn: "\"'“”‘’") + let value = String(evidence.dropFirst(prefix.count)) + .trimmingCharacters(in: .whitespacesAndNewlines) + .trimmingCharacters(in: quoteCharacters) + .trimmingCharacters(in: .whitespacesAndNewlines) + return value.isEmpty ? nil : value + } + +} + +public enum StudyAgentCurrentTurnEvidence { + public static func matches(_ evidence: String, question: String) -> Bool { + guard let statement = statement(in: evidence), statement.count >= 2 else { return false } + if statement.count < 4 { + return normalized(statement) == normalized(question) + } + var searchStart = question.startIndex + while searchStart < question.endIndex, + let range = question.range(of: statement, range: searchStart..<question.endIndex) { + if hasClauseBoundaries(range, in: question), + !omitsLeadingNegation(range, in: question) { + return true + } + searchStart = range.upperBound + } + return false + } + + private static func hasClauseBoundaries(_ range: Range<String.Index>, in question: String) -> Bool { + let startsAtBoundary = range.lowerBound == question.startIndex + || question[question.index(before: range.lowerBound)].isWhitespace + || question[question.index(before: range.lowerBound)].isPunctuation + let endsAtBoundary = range.upperBound == question.endIndex + || question[range.upperBound].isWhitespace + || question[range.upperBound].isPunctuation + return startsAtBoundary && endsAtBoundary + } + + private static func omitsLeadingNegation( + _ range: Range<String.Index>, + in question: String + ) -> Bool { + guard range.lowerBound > question.startIndex else { return false } + let prefix = String(question[..<range.lowerBound]).lowercased() + let immediate = prefix.trimmingCharacters(in: .whitespacesAndNewlines) + if ["不", "没", "未", "无", "别", "勿"].contains(where: immediate.hasSuffix) { + return true + } + let clause = prefix + .components(separatedBy: CharacterSet(charactersIn: ",,。!?;;::.!?")) + .last ?? prefix + let negativePhrases = [ + "不想", "不喜欢", "不太", "不能", "不会", "不要", "不愿", "没有", "没法", "尚未", "还没", "并不", "并非", + " not ", " never ", " no ", " without ", "cannot", "can't", "don't", "doesn't", "didn't", + ] + let paddedClause = " \(clause) " + return negativePhrases.contains(where: paddedClause.contains) + } + + private static func statement(in evidence: String) -> String? { + let prefixes = ["[用户:本轮]", "[会话:当前]"] + guard let prefix = prefixes.first(where: { evidence.hasPrefix($0) }) else { return nil } + let quoteCharacters = CharacterSet(charactersIn: "\"'“”‘’") + let value = String(evidence.dropFirst(prefix.count)) + .trimmingCharacters(in: .whitespacesAndNewlines) + .trimmingCharacters(in: quoteCharacters) + .trimmingCharacters(in: .whitespacesAndNewlines) + return value.isEmpty ? nil : value + } + + private static func normalized(_ text: String) -> String { + text.unicodeScalars.filter { + !CharacterSet.whitespacesAndNewlines.contains($0) + && !CharacterSet.punctuationCharacters.contains($0) + }.map(String.init).joined() + } +} + public struct StudyAgentCourseCatalogItem: Codable, Equatable, Sendable { public var id: String public var title: String @@ -192,6 +339,7 @@ public struct StudyAgentRequest: Sendable { public var question: String public var materialTitle: String public var materialText: String + public var materialIsTruncated: Bool public var noteTitle: String public var noteText: String public var selectionTitle: String? @@ -209,6 +357,7 @@ public struct StudyAgentRequest: Sendable { question: String, materialTitle: String, materialText: String, + materialIsTruncated: Bool = false, noteTitle: String, noteText: String, selectionTitle: String? = nil, @@ -225,6 +374,7 @@ public struct StudyAgentRequest: Sendable { self.question = question self.materialTitle = materialTitle self.materialText = materialText + self.materialIsTruncated = materialIsTruncated self.noteTitle = noteTitle self.noteText = noteText self.selectionTitle = selectionTitle @@ -289,6 +439,18 @@ public struct StudyAgentMemoryUpdateEntry: Codable, Equatable, Sendable { } } +public struct StudyAgentMemoryResolution: Codable, Equatable, Sendable { + public var memoryID: String + public var text: String + public var evidence: String + + public init(memoryID: String, text: String, evidence: String) { + self.memoryID = memoryID + self.text = text + self.evidence = evidence + } +} + public struct StudyAgentLearningUpdate: Codable, Equatable, Sendable { public var contextRevision: String public var memoryRevision: UInt64 @@ -296,6 +458,7 @@ public struct StudyAgentLearningUpdate: Codable, Equatable, Sendable { public var suggestedPhase: StudyPhase? public var suggestedNext: [String] public var entries: [StudyAgentMemoryUpdateEntry] + public var resolutions: [StudyAgentMemoryResolution] public init( contextRevision: String, @@ -303,7 +466,8 @@ public struct StudyAgentLearningUpdate: Codable, Equatable, Sendable { sessionSummary: String? = nil, suggestedPhase: StudyPhase? = nil, suggestedNext: [String] = [], - entries: [StudyAgentMemoryUpdateEntry] = [] + entries: [StudyAgentMemoryUpdateEntry] = [], + resolutions: [StudyAgentMemoryResolution] = [] ) { self.contextRevision = contextRevision self.memoryRevision = memoryRevision @@ -311,6 +475,7 @@ public struct StudyAgentLearningUpdate: Codable, Equatable, Sendable { self.suggestedPhase = suggestedPhase self.suggestedNext = suggestedNext self.entries = entries + self.resolutions = resolutions } } @@ -432,7 +597,7 @@ public struct StudyAgentContextEnvelope: Codable, Equatable, Sendable { : Source( title: String(request.materialTitle.prefix(300)), text: materialText, - isTruncated: request.materialText.count > materialText.count + isTruncated: request.materialIsTruncated || request.materialText.count > materialText.count ) let noteText = String(request.noteText.prefix(6_000)) @@ -451,7 +616,7 @@ public struct StudyAgentContextEnvelope: Codable, Equatable, Sendable { isTruncated: (request.selectionText ?? "").count > selectedText.count ) - recentMessages = request.recentMessages.suffix(8).map { message in + recentMessages = request.recentMessages.suffix(20).map { message in Message( role: message.role.rawValue, text: String(message.text.prefix(1_200)), @@ -544,6 +709,8 @@ public struct StudyAgentContextEnvelope: Codable, Equatable, Sendable { origin: memory.origin, status: memory.status, sessionID: memory.sessionID, + resolvedAt: memory.resolvedAt, + resolutionEvidence: memory.resolutionEvidence.map { String($0.prefix(400)) }, createdAt: memory.createdAt, updatedAt: memory.updatedAt ) @@ -553,8 +720,9 @@ public struct StudyAgentContextEnvelope: Codable, Equatable, Sendable { return StudyLocation( itemID: itemID, itemTitle: String(location.itemTitle.prefix(300)), + locationID: location.locationID.map { String($0.prefix(500)) }, locationTitle: location.locationTitle.map { String($0.prefix(300)) }, - pageIndex: location.pageIndex, + pageIndex: location.pageIndex.map { max($0, 0) + 1 }, lastStudiedAt: location.lastStudiedAt, visitCount: location.visitCount ) diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index 6f46a59a1..2573f0abc 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -251,12 +251,22 @@ public enum WikiLink { } public enum SourceReferenceTitle { - public static func parse(_ raw: String) -> (title: String, pageIndex: Int?) { + public static func parse( + _ raw: String + ) -> ( + title: String, + pageIndex: Int?, + sectionTitle: String?, + sectionLocationID: String?, + sectionOrdinal: Int?, + courseItemOrdinal: Int? + ) { var text = raw .components(separatedBy: .newlines) .reversed() - .map(cleanedLine) - .first(where: { $0.hasPrefix("来源:") || $0.localizedCaseInsensitiveContains("source:") }) + .compactMap(sourceFragment) + .first + ?? sourceFragment(in: raw) ?? cleanedLine(raw) text = text.trimmingCharacters(in: .whitespacesAndNewlines) if text.hasPrefix(">") { @@ -267,14 +277,104 @@ public enum SourceReferenceTitle { } else if text.lowercased().hasPrefix("source:") { text = String(text.dropFirst("source:".count)).trimmingCharacters(in: .whitespacesAndNewlines) } + text = text.trimmingCharacters(in: CharacterSet(charactersIn: "`")) + .trimmingCharacters(in: .whitespacesAndNewlines) + + var sectionTitle: String? + if let markerRange = text.range(of: ",章节:", options: .backwards) { + let section = text[markerRange.upperBound...].trimmingCharacters(in: .whitespacesAndNewlines) + sectionTitle = section.isEmpty ? nil : unwrappedInlineMarkup(String(section)) + text = text[..<markerRange.lowerBound].trimmingCharacters(in: .whitespacesAndNewlines) + } else if let markerRange = text.range(of: #",\s*section:\s*"#, options: [.regularExpression, .caseInsensitive]) { + let section = text[markerRange.upperBound...].trimmingCharacters(in: .whitespacesAndNewlines) + sectionTitle = section.isEmpty ? nil : unwrappedInlineMarkup(String(section)) + text = text[..<markerRange.lowerBound].trimmingCharacters(in: .whitespacesAndNewlines) + } + + var sectionOrdinal: Int? + if let range = text.range( + of: #"(?:,章节序号:\s*\d+|,\s*section\s*(?:ordinal|number):?\s*\d+)$"#, + options: [.regularExpression, .caseInsensitive] + ) { + sectionOrdinal = Int(text[range].filter(\.isNumber)) + text = text[..<range.lowerBound].trimmingCharacters(in: .whitespacesAndNewlines) + } + + var sectionLocationID: String? + if let range = text.range( + of: #"(?:,章节标识:\s*[A-Za-z0-9-]+|,\s*section\s*(?:id|identifier):?\s*[A-Za-z0-9-]+)$"#, + options: [.regularExpression, .caseInsensitive] + ) { + let suffix = String(text[range]) + let separator = suffix.lastIndex(where: { $0 == ":" || $0 == ":" }) + let identifier = (separator.map { String(suffix[suffix.index(after: $0)...]) } ?? "") + .trimmingCharacters(in: .whitespacesAndNewlines) + sectionLocationID = identifier.isEmpty ? nil : identifier + text = text[..<range.lowerBound].trimmingCharacters(in: .whitespacesAndNewlines) + } + + var pageIndex: Int? + if let range = text.range( + of: #"(?:,第\s*\d+\s*页|,\s*page\s*\d+)$"#, + options: [.regularExpression, .caseInsensitive] + ) { + let suffix = text[range] + pageIndex = Int(suffix.filter(\.isNumber)).map { max($0 - 1, 0) } + text = text[..<range.lowerBound].trimmingCharacters(in: .whitespacesAndNewlines) + } + + var courseItemOrdinal: Int? + if let range = text.range( + of: #"(?:,条目:\s*\d+|,\s*(?:item|entry):?\s*\d+)$"#, + options: [.regularExpression, .caseInsensitive] + ) { + courseItemOrdinal = Int(text[range].filter(\.isNumber)) + text = text[..<range.lowerBound].trimmingCharacters(in: .whitespacesAndNewlines) + } + return ( + unwrappedInlineMarkup(text), + pageIndex, + sectionTitle, + sectionLocationID, + sectionOrdinal, + courseItemOrdinal + ) + } + + private static func unwrappedInlineMarkup(_ raw: String) -> String { + var text = raw + .trimmingCharacters(in: .whitespacesAndNewlines) + .trimmingCharacters(in: CharacterSet(charactersIn: "`")) + .trimmingCharacters(in: .whitespacesAndNewlines) + for marker in ["**", "__", "`", "*"] { + if text.hasPrefix(marker), text.hasSuffix(marker), text.count > marker.count * 2 { + text = String(text.dropFirst(marker.count).dropLast(marker.count)) + .trimmingCharacters(in: .whitespacesAndNewlines) + } + } + return text + } - guard let range = text.range(of: #"(?:,第\s*\d+\s*页|,\s*page\s*\d+)$"#, options: [.regularExpression, .caseInsensitive]) else { - return (text, nil) + private static func sourceFragment(in raw: String) -> String? { + let line = cleanedLine(raw) + let chinese = line.range(of: "来源:", options: .backwards) + let english = line.range(of: "source:", options: [.backwards, .caseInsensitive]) + let markerRange: Range<String.Index>? + switch (chinese, english) { + case let (left?, right?): markerRange = left.lowerBound > right.lowerBound ? left : right + case let (left?, nil): markerRange = left + case let (nil, right?): markerRange = right + case (nil, nil): markerRange = nil } - let suffix = text[range] - let pageNumber = Int(suffix.filter(\.isNumber)) - let title = text[..<range.lowerBound].trimmingCharacters(in: .whitespacesAndNewlines) - return (title, pageNumber.map { max($0 - 1, 0) }) + guard let markerRange else { return nil } + let fragment = String(line[markerRange.lowerBound...]) + .trimmingCharacters(in: .whitespacesAndNewlines) + let markerLength = fragment.hasPrefix("来源:") ? "来源:".count : "source:".count + let suffix = String(fragment.dropFirst(markerLength)) + .trimmingCharacters(in: .whitespacesAndNewlines) + .trimmingCharacters(in: CharacterSet(charactersIn: "`")) + .trimmingCharacters(in: .whitespacesAndNewlines) + return suffix.isEmpty ? nil : fragment } private static func cleanedLine(_ raw: String) -> String { diff --git a/Sources/WeiBeiPDFTextWorker/main.swift b/Sources/WeiBeiPDFTextWorker/main.swift new file mode 100644 index 000000000..b9e404d17 --- /dev/null +++ b/Sources/WeiBeiPDFTextWorker/main.swift @@ -0,0 +1,110 @@ +import Darwin +import Foundation +import PDFKit + +private enum PDFTextWorkerExit: Int32 { + case invalidArguments = 2 + case resourceLimit = 3 + case unreadablePage = 4 +} + +private struct WorkerResponse: Encodable { + var pages: [WorkerPage] +} + +private struct WorkerPage: Encodable { + var pageIndex: Int + var status: String + var text: String +} + +private func fail(_ reason: PDFTextWorkerExit) -> Never { + exit(reason.rawValue) +} + +private func applyResourceLimits() { + var cpuLimit = rlimit(rlim_cur: 3, rlim_max: 3) + guard setrlimit(RLIMIT_CPU, &cpuLimit) == 0 else { + fail(.resourceLimit) + } +} + +private func runVerificationProbe(_ name: String) -> Never { + switch name { + case "normal": + FileHandle.standardOutput.write(Data("verification-ok\n".utf8)) + case "timeout": + Thread.sleep(forTimeInterval: 5) + case "output": + FileHandle.standardOutput.write(Data(repeating: 65, count: 2 * 1_024 * 1_024)) + case "memory": + var allocation = Data(count: 256 * 1_024 * 1_024) + allocation.withUnsafeMutableBytes { bytes in + guard let baseAddress = bytes.baseAddress else { return } + for offset in stride(from: 0, to: bytes.count, by: 4_096) { + baseAddress.storeBytes(of: UInt8(1), toByteOffset: offset, as: UInt8.self) + } + } + withExtendedLifetime(allocation) { + Thread.sleep(forTimeInterval: 5) + } + default: + fail(.invalidArguments) + } + exit(0) +} + +applyResourceLimits() + +if ProcessInfo.processInfo.environment["WEIBEI_PDF_WORKER_VERIFY"] == "1", + CommandLine.arguments.count == 3, + CommandLine.arguments[1] == "--verification-probe" { + runVerificationProbe(CommandLine.arguments[2]) +} + +guard CommandLine.arguments.count == 4, + let maximumCharacters = Int(CommandLine.arguments[3]), + maximumCharacters > 0, + maximumCharacters <= 1_000_000 else { + fail(.invalidArguments) +} +let pageIndexes = CommandLine.arguments[2] + .split(separator: ",") + .compactMap { Int($0) } +guard !pageIndexes.isEmpty, + pageIndexes.count <= 16, + pageIndexes.allSatisfy({ $0 >= 0 }) else { + fail(.invalidArguments) +} + +let url = URL(fileURLWithPath: CommandLine.arguments[1]) +guard let document = PDFDocument(url: url) else { + fail(.unreadablePage) +} + +let maximumUTF8Bytes = maximumCharacters * 4 +private let pages = pageIndexes.map { pageIndex -> WorkerPage in + guard pageIndex < document.pageCount, + let rawText = document.page(at: pageIndex)?.string? + .trimmingCharacters(in: .whitespacesAndNewlines) else { + return WorkerPage(pageIndex: pageIndex, status: "missing", text: "") + } + var text = "" + text.reserveCapacity(min(rawText.count, maximumCharacters)) + var utf8Bytes = 0 + for character in rawText.prefix(maximumCharacters) { + let characterBytes = String(character).utf8.count + guard utf8Bytes + characterBytes <= maximumUTF8Bytes else { break } + text.append(character) + utf8Bytes += characterBytes + } + return WorkerPage( + pageIndex: pageIndex, + status: rawText.count > text.count ? "partial" : "complete", + text: text + ) +} +guard let output = try? JSONEncoder().encode(WorkerResponse(pages: pages)) else { + fail(.unreadablePage) +} +FileHandle.standardOutput.write(output) diff --git a/Sources/WeiBeiPiCheck/main.swift b/Sources/WeiBeiPiCheck/main.swift index 9e4f6c234..404340e5d 100644 --- a/Sources/WeiBeiPiCheck/main.swift +++ b/Sources/WeiBeiPiCheck/main.swift @@ -119,13 +119,13 @@ struct WeiBeiPiCheck { let reply = try await runtime.respond( to: request( workflow: .courseWayfinding, - question: "利率和通货膨胀在课程里有哪份相关材料?说明关联并给出跳转来源。", + question: "利率和通货膨胀在课程里有哪份相关材料?说明关联,并原样给出工具返回的最精确 PDF 页码跳转。", revision: "pi-check-wayfinding" ) ) guard reply.backend == .pi, reply.text.contains("通货膨胀补充材料"), - reply.text.contains("来源:通货膨胀补充材料"), + reply.text.contains("来源:通货膨胀补充材料,第 4 页"), containsSourceLabel(reply.text) else { throw PiCheckError.invalidEvaluation("course-wayfinding") } @@ -182,7 +182,7 @@ struct WeiBeiPiCheck { subtitle: "PDF 第 4 章", kind: "pdf", role: "material", - headings: ["购买力与实际利率"], + headings: ["第 4 页", "购买力与实际利率"], searchText: "通货膨胀会改变货币购买力,区分名义利率与实际利率时需要考虑通货膨胀。" ), StudyAgentCourseItem( diff --git a/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift index 3407b4a74..f72027f09 100644 --- a/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift +++ b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift @@ -61,6 +61,34 @@ private func checkRPCDecoding() throws { let contextRead = try PiRPCMessageDecoder.decode(Data(#"{"type":"tool_execution_end","toolCallId":"tool-context","toolName":"weibei_context","isError":false,"result":{"details":{"kind":"weibei_context","contextRevision":"revision-7"}}}"#.utf8)) try piRequire(contextRead == .contextRead(id: "tool-context", contextRevision: "revision-7"), "PI context reads preserve the validated revision") + let courseRead = try PiRPCMessageDecoder.decode(Data(#"{"type":"tool_execution_end","toolCallId":"tool-course","toolName":"weibei_course_search","isError":false,"result":{"details":{"kind":"course_search","contextRevision":"revision-7","results":[{"title":"利率","role":"material","searchText":"利率正文"},{"title":"课堂笔记","role":"note","searchText":"笔记正文"},{"title":"只有标题","role":"material","searchText":""}],"evidenceLabels":["[材料:利率,条目:2]","[笔记:课堂笔记]"],"jumpEvidence":{"来源:利率,条目:2,第 3 页":"[材料:利率,条目:2]"}}}}"#.utf8)) + try piRequire( + courseRead == .courseSourcesRead( + id: "tool-course", + contextRevision: "revision-7", + labels: ["[材料:利率,条目:2]", "[笔记:课堂笔记]"], + jumpEvidence: ["来源:利率,条目:2,第 3 页": "[材料:利率,条目:2]"] + ), + "PI course tools expose only labels backed by non-empty source excerpts read this turn" + ) + let mapRead = try PiRPCMessageDecoder.decode(Data(#"{"type":"tool_execution_end","toolCallId":"tool-map","toolName":"weibei_course_map","isError":false,"result":{"details":{"kind":"course_map","catalog":[{"title":"只有目录标题","role":"material"}]}}}"#.utf8)) + try piRequire( + mapRead == .event("tool_execution_end"), + "PI course-map metadata does not unlock a material as content evidence" + ) + + let memoryRead = try PiRPCMessageDecoder.decode(Data(#"{"type":"tool_execution_end","toolCallId":"tool-learning","toolName":"weibei_learning_memory","isError":false,"result":{"details":{"kind":"learning_memory","contextRevision":"revision-7","memoryRevision":4,"learning":{"memories":[]},"jumpEvidence":{}}}}"#.utf8)) + try piRequire( + memoryRead == .learningMemoryRead( + id: "tool-learning", + contextRevision: "revision-7", + memoryRevision: 4, + labels: ["[学习记忆:无记录]"], + jumpEvidence: [:] + ), + "PI learning-memory reads preserve the validated revision and expose only the memory evidence that actually exists" + ) + let proposalData = try JSONSerialization.data(withJSONObject: [ "type": "tool_execution_end", "toolCallId": "tool-3", @@ -110,6 +138,13 @@ private func checkRPCDecoding() throws { "origin": "userStatement", ], ], + "resolutions": [ + [ + "memoryID": "00000000-0000-0000-0000-000000000004", + "text": "曾经不熟悉费雪方程", + "evidence": "[会话:当前] 用户在回忆题中正确解释", + ], + ], ], ], ]) @@ -130,6 +165,13 @@ private func checkRPCDecoding() throws { evidence: "[用户:本轮] 用户明确说不熟悉", origin: .userStatement ), + ], + resolutions: [ + StudyAgentMemoryResolution( + memoryID: "00000000-0000-0000-0000-000000000004", + text: "曾经不熟悉费雪方程", + evidence: "[会话:当前] 用户在回忆题中正确解释" + ), ] ) ), @@ -149,7 +191,7 @@ private func checkRPCDecoding() throws { } private func checkStudyAgentContext() throws { - let recentMessages = (0..<10).map { index in + let recentMessages = (0..<24).map { index in AgentMessage(role: index.isMultiple(of: 2) ? .user : .assistant, text: "message-\(index)" + String(repeating: "字", count: 1_300), source: "source-\(index)") } let courseItems = (0..<90).map { index in @@ -196,6 +238,7 @@ private func checkStudyAgentContext() throws { lastLocation: StudyLocation( itemID: "item-0", itemTitle: String(repeating: "位", count: 320), + locationID: "html-section-a1b2c3d4", locationTitle: String(repeating: "章", count: 320), pageIndex: 12 ), @@ -243,6 +286,61 @@ private func checkStudyAgentContext() throws { contextRevision: "revision-companion" ) try piRequire(companionRequest.resolvedWorkflow == .studyCompanion, "study-agent automatic routing selects the study companion") + try piRequire( + StudyAgentQuestionScope.allowsLearningOnlyAnswer("我上次学到哪了?请告诉我位置和下一步。") + && StudyAgentQuestionScope.allowsLearningOnlyAnswer("我的学习目标是什么?") + && !StudyAgentQuestionScope.allowsLearningOnlyAnswer("继续学习") + && !StudyAgentQuestionScope.allowsLearningOnlyAnswer("continue learning") + && !StudyAgentQuestionScope.allowsLearningOnlyAnswer("我上次学到的费雪方程怎么算?") + && !StudyAgentQuestionScope.allowsLearningOnlyAnswer("我的困惑是名义利率;请解释它和实际利率的区别。"), + "learning-only answers are limited to structured progress and memory questions, not course-content questions that mention prior study" + ) + try piRequire( + StudyAgentCurrentTurnEvidence.matches( + "[用户:本轮]我还不懂名义利率和实际利率的区别", + question: "上次学到哪?我还不懂名义利率和实际利率的区别,请记住。" + ) + && StudyAgentCurrentTurnEvidence.matches( + "[用户:本轮]I like reasoning from first principles", + question: "I do not like rote memorization, I like reasoning from first principles." + ) + && !StudyAgentCurrentTurnEvidence.matches( + "[用户:本轮]喜欢死记硬背", + question: "我不喜欢死记硬背" + ) + && !StudyAgentCurrentTurnEvidence.matches( + "[用户:本轮]喜欢死记硬背", + question: "我不太喜欢死记硬背" + ) + && !StudyAgentCurrentTurnEvidence.matches( + "[用户:本轮]like rote memorization", + question: "I do not like rote memorization" + ), + "current-turn memory evidence requires a bounded verbatim clause and cannot omit leading negation" + ) + try piRequire( + !StudyAgentResolutionEvidence.matches( + "[用户:本轮]我还不能够区分名义利率和实际利率", + question: "我还不能够区分名义利率和实际利率" + ) + && !StudyAgentResolutionEvidence.matches( + "[用户:本轮]I am not yet able to distinguish nominal and real rates", + question: "I am not yet able to distinguish nominal and real rates" + ) + && !StudyAgentResolutionEvidence.matches( + "[用户:本轮]这个答案不正确", + question: "这个答案不正确" + ) + && !StudyAgentResolutionEvidence.matches( + "[用户:本轮]This answer is not correct", + question: "This answer is not correct" + ) + && StudyAgentResolutionEvidence.matches( + "[用户:本轮]我已经能够区分名义利率和实际利率了", + question: "我已经能够区分名义利率和实际利率了" + ), + "learning-memory resolution rejects negated mastery phrases before accepting explicit mastery" + ) let quietRequest = StudyAgentRequest( purpose: .quietInsight, question: "出题", @@ -260,7 +358,7 @@ private func checkStudyAgentContext() throws { try piRequire(envelope.material?.text.count == 18_000 && envelope.note.text.count == 6_000 && envelope.selection?.text.count == 2_000, "study-agent context applies source limits") try piRequire(envelope.material?.title.count == 300 && envelope.note.title.count == 300 && envelope.selection?.title.count == 300, "study-agent context bounds source labels consistently") try piRequire(envelope.material?.isTruncated == true && envelope.note.isTruncated && envelope.selection?.isTruncated == true, "study-agent context marks every truncated source") - try piRequire(envelope.recentMessages.count == 8 && envelope.recentMessages.first?.text.hasPrefix("message-2") == true, "study-agent context keeps the latest eight messages") + try piRequire(envelope.recentMessages.count == 20 && envelope.recentMessages.first?.text.hasPrefix("message-4") == true, "study-agent context keeps the latest twenty messages") try piRequire(envelope.recentMessages.allSatisfy { $0.text.count <= 1_200 }, "study-agent context bounds recent messages") try piRequire(envelope.course.catalog.count == 90 && envelope.course.items.count == 80 && envelope.course.relations.count == 210 && envelope.course.isTruncated, "study-agent context keeps the full catalog while bounding query candidates") try piRequire( @@ -274,7 +372,15 @@ private func checkStudyAgentContext() throws { try piRequire(envelope.course.items.allSatisfy { $0.searchText.count <= 2_400 && $0.headings.count <= 12 && $0.tags.count <= 16 && $0.linkedItemIDs.count <= 24 }, "study-agent context bounds course search metadata") try piRequire(envelope.learning.memoryRevision == 7 && envelope.learning.memories.count == 48, "study-agent context carries a bounded learning-memory revision") try piRequire(envelope.learning.memories.allSatisfy { $0.text.count <= 500 && $0.evidence.count <= 400 }, "study-agent context bounds durable learning memory") - try piRequire(envelope.learning.lastLocation?.itemTitle.count == 300 && envelope.learning.lastLocation?.itemID == "course-item-1" && envelope.learning.session?.summary.count == 2_000 && envelope.learning.session?.focusItemIDs.count == 24, "study-agent context bounds location and session state with opaque course ids") + try piRequire( + envelope.learning.lastLocation?.itemTitle.count == 300 + && envelope.learning.lastLocation?.itemID == "course-item-1" + && envelope.learning.lastLocation?.locationID == "html-section-a1b2c3d4" + && envelope.learning.lastLocation?.pageIndex == 13 + && envelope.learning.session?.summary.count == 2_000 + && envelope.learning.session?.focusItemIDs.count == 24, + "study-agent context bounds location and session state, uses opaque ids, and exposes one-based page numbers" + ) let privatePath = "/Users/student/Private Course/secret.pdf" let privateItem = StudyAgentCourseItem( @@ -373,7 +479,13 @@ private func checkStudyAgentContext() throws { let persisted = PersistedWorkspace( noteSourceLinks: [NoteSourceLink(noteItemID: "inflation-note", sourceItemID: "rates")], studyLocationsByItemID: [ - "rates": StudyLocation(itemID: "rates", itemTitle: "利率", locationTitle: "实际利率", pageIndex: 3), + "rates": StudyLocation( + itemID: "rates", + itemTitle: "利率", + locationID: "section-real-rate", + locationTitle: "实际利率", + pageIndex: 3 + ), ], learningMemoryEntries: [ LearningMemoryEntry( @@ -381,7 +493,10 @@ private func checkStudyAgentContext() throws { text: "还不熟悉费雪方程", evidence: "[用户:本轮] 用户明确说不熟悉", origin: .userStatement, - sessionID: sessionID + status: .resolved, + sessionID: sessionID, + resolvedAt: Date(timeIntervalSinceReferenceDate: 200), + resolutionEvidence: "[会话:当前] 用户已正确解释" ), ], learningMemoryRevision: 4, @@ -402,7 +517,10 @@ private func checkStudyAgentContext() throws { try piRequire( decodedPersisted.noteSourceLinks?.count == 1 && decodedPersisted.studyLocationsByItemID?["rates"]?.pageIndex == 3 + && decodedPersisted.studyLocationsByItemID?["rates"]?.locationID == "section-real-rate" && decodedPersisted.learningMemoryEntries?.first?.sessionID == sessionID + && decodedPersisted.learningMemoryEntries?.first?.status == .resolved + && decodedPersisted.learningMemoryEntries?.first?.resolutionEvidence?.hasPrefix("[会话:当前]") == true && decodedPersisted.learningMemoryRevision == 4 && decodedPersisted.studySessions?.first?.flow.phase == .recall && decodedPersisted.activeStudySessionID == sessionID, @@ -452,7 +570,7 @@ private func checkBundledAgentResources() throws { "PI extension bundles the WeiBei-owned course, memory, and note tools" ) try piRequire( - extensionSource.contains("contextFileBytes: 2 * 1024 * 1024") + extensionSource.contains("contextFileBytes: 4 * 1024 * 1024") && extensionSource.contains("courseCatalogItems: 500") && extensionSource.contains("courseMapPageItems: 60") && extensionSource.contains("catalogCount: snapshot.course.catalog.length") @@ -460,9 +578,26 @@ private func checkBundledAgentResources() throws { && extensionSource.contains("const limit = params.limit ?? 40") && extensionSource.contains("与已有 catalog ID 重复") && extensionSource.contains("noteTitle: catalogByID.get(relation.noteItemID)!.title") - && extensionSource.contains("...current.course.catalog.map((item) =>") + && extensionSource.contains("searchedCourseItemIDs.has(item.id)") + && extensionSource.contains("courseJumpReference") + && extensionSource.contains("courseEvidenceLabel") + && extensionSource.contains("jumpEvidence") + && extensionSource.contains("courseHeading") + && extensionSource.contains("coursePage") + && extensionSource.contains("pageJumpReferences") + && extensionSource.contains("learningLocationJumpReference") + && extensionSource.contains("duplicateTitle") + && extensionSource.contains("章节标识") + && extensionSource.contains("章节序号") + && extensionSource.contains("resolutionEvidenceMatches") + && extensionSource.contains("unresolvedTerms") + && extensionSource.contains("不能够") + && extensionSource.contains("not yet") + && extensionSource.contains("不正确") + && extensionSource.contains("immediateNegation") + && extensionSource.contains("html-section-") && extensionSource.contains("用户陈述型记忆必须直接依据本轮用户原话"), - "PI extension keeps a paged full catalog, compact context output, strict ids, and catalog-backed memory evidence" + "PI extension keeps a paged full catalog, stable file and section jumps, compact context output, strict ids, and read-backed memory evidence" ) for skillName in PiAgentResources.requiredSkillNames { @@ -479,8 +614,20 @@ private func checkBundledAgentResources() throws { && runtimeSource.contains("allowedSourceLabels") && runtimeSource.contains("allowedNoteSourceLabels") && runtimeSource.contains("memoryRevision") - && runtimeSource.contains("context.course.catalog.map") - && runtimeSource.contains("PI returned an answer without a current-source label") + && runtimeSource.contains("courseSourcesRead") + && runtimeSource.contains("allowedJumpReferences") + && runtimeSource.contains("jumpEvidenceLabels") + && runtimeSource.contains("registerJumpEvidence") + && runtimeSource.contains("canonicalJumpReference") + && runtimeSource.contains("isDedicatedJumpLine") + && runtimeSource.contains("contextRevision == run.contextRevision") + && runtimeSource.contains("citedJumpReferences") + && runtimeSource.contains("learningUpdateValidationError") + && runtimeSource.contains("resolutionEvidenceMatches") + && runtimeSource.contains("StudyAgentResolutionEvidence.matches") + && runtimeSource.contains("StudyAgentCurrentTurnEvidence.matches") + && runtimeSource.contains("allowsLearningOnlyAnswer") + && runtimeSource.contains("PI returned a content answer without a source read in the current turn") && runtimeSource.contains("binary.sha256") && runtimeSource.contains("SecStaticCodeCheckValidity"), "PI host enforces context-first answers, source labels, binary integrity, and code signatures" diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index ee97625ad..837ef750a 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -219,6 +219,11 @@ expect(runScript.contains("prepare_pi_runtime.sh") && runScript.contains("PACKAGED_UUID=") && runScript.contains("signed app binary UUID does not match the current Swift build") && runScript.contains("codesign --verify --deep --strict \"$APP_BUNDLE\""), "packaging embeds and integrity-checks the signed PI runtime inside the app") +expect(runScript.contains("PDF_TEXT_WORKER_NAME=\"WeiBeiPDFTextWorker\"") + && runScript.contains("cp \"$BUILD_PDF_TEXT_WORKER\" \"$PDF_TEXT_WORKER\"") + && runScript.contains("cmp -s \"$BUILD_PDF_TEXT_WORKER\" \"$PDF_TEXT_WORKER\"") + && runScript.contains("codesign --force --sign - --timestamp=none \"$PDF_TEXT_WORKER\"") + && runScript.contains("WEIBEI_PDF_WORKER_VERIFY=1 \"$PDF_TEXT_WORKER\" --verification-probe normal"), "packaging embeds, signs, and executes the bounded PDF text worker") expect(runScript.contains("kCGWindowOwnerName") && runScript.contains("\"$APP_DISPLAY_NAME\""), "run script verifies the visible app window by owner name") expect(runScript.contains("let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber") && runScript.contains("let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0"), "run script tolerates missing onscreen metadata when the window is otherwise capturable") expect(!runScript.contains("pid=\"$(pgrep -x \"$PRODUCT_NAME\""), "run script window verification does not depend on pgrep") @@ -227,6 +232,7 @@ expect(runScript.contains("weibei-visual-verify-latest.png") && runScript.contai expect(runScript.contains("weibei-visual-verify-$VERIFY_SCENARIO.png") && runScript.contains("visual_capture_path=$scenario_capture_path"), "visual verification preserves a separate screenshot for every empty-workspace theme and width scenario") expect(runScript.contains("WEIBEI_VERIFY_CAPTURE_PATH") + && runScript.contains("[[ -s \"$VERIFY_CAPTURE_PATH\" ]] && break") && runScript.contains("app-owned capture and macOS window capture failed") && runScript.contains("Grant Screen Recording permission"), "visual verification prefers an app-owned capture and reports when both capture paths fail") expect(runScript.contains("open_app() {\n /usr/bin/open \"$APP_BUNDLE\"\n}") @@ -252,7 +258,7 @@ expect(runScript.contains("open_app_for_verify()") && runScript.contains("\"WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE\"") && runScript.contains("\"$APP_BINARY\" >\"$VERIFY_STDOUT\" 2>\"$VERIFY_STDERR\" &") && runScript.contains("VERIFY_PID=\"$!\"") - && runScript.contains("if [[ -n \"$VERIFY_SCENARIO\" ]]; then\n sleep 2.6\n fi") + && runScript.contains("if [[ -n \"$VERIFY_SCENARIO\" ]]; then\n for _ in {1..50}; do") && runScript.contains("--verify|verify)\n run_verifiers\n open_app_for_verify") && runScript.contains("--visual-verify|visual-verify)\n run_verifiers\n open_app_for_verify"), "verify modes launch the app in the background with an isolated offline or PI-backed learning-flow workspace") expect(runScript.contains("verify_learning_flow_persistence()") @@ -413,15 +419,96 @@ let documentTextExtractorURL = URL(fileURLWithPath: FileManager.default.currentD .appendingPathComponent("Sources/WeiBei/Services/DocumentTextExtractor.swift") let documentTextExtractorSource = (try? String(contentsOf: documentTextExtractorURL, encoding: .utf8)) ?? "" expect(documentTextExtractorSource.contains("private static var pdfTextCache") - && documentTextExtractorSource.contains("private static var pdfIndexTextCache") + && documentTextExtractorSource.contains("private static var fileTextCache") && documentTextExtractorSource.contains("private static let cacheLock = NSLock()") && documentTextExtractorSource.contains("return pdfText(url: url)") - && documentTextExtractorSource.contains("private static func pagedText(from document: PDFDocument) -> String") - && documentTextExtractorSource.contains("return \"第 \\(index + 1) 页\\n\\(text)\"") - && !documentTextExtractorSource.contains("let textLayerText = document.string?.trimmingCharacters") - && documentTextExtractorSource.contains("let text = textLayerText.isEmpty ? PDFOCRTextExtractor.text(from: document) : textLayerText") + && documentTextExtractorSource.contains("PDFOCRTextExtractor.text(from: document, maxPages: 12)") && documentTextExtractorSource.contains("store(text, for: cacheKey, cache: .pdf)") - && documentTextExtractorSource.contains("store(indexed, for: indexCacheKey, cache: .pdfIndex)"), "PDF material extraction and background course indexing use thread-safe caches with OCR limited to the active material") + && documentTextExtractorSource.contains("maximumPDFCacheBytes") + && documentTextExtractorSource.contains("maximumFileCacheBytes") + && documentTextExtractorSource.contains("maximumActiveFileBytes = 4 * 1_024 * 1_024") + && documentTextExtractorSource.contains("maximumActivePDFPages = 12") + && documentTextExtractorSource.contains("maximumActivePDFCharacters = 64_000") + && documentTextExtractorSource.contains("maximumActivePDFTextSeconds: TimeInterval = 2") + && documentTextExtractorSource.contains("BoundedPDFTextExtractor.pages") + && documentTextExtractorSource.contains("static func cachedText(for item: StudyItem)") + && !documentTextExtractorSource.contains("page.string") + && documentTextExtractorSource.contains("handle.read(upToCount: maximumActiveFileBytes)") + && documentTextExtractorSource.contains("totalBytes > byteLimit"), "active-material extraction uses byte-bounded thread-safe caches while the persistent course index owns full-library search") +let courseDocumentIndexURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBeiCore/CourseDocumentSearchIndex.swift") +let courseDocumentIndexSource = (try? String(contentsOf: courseDocumentIndexURL, encoding: .utf8)) ?? "" +let pdfTextWorkerURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBeiPDFTextWorker/main.swift") +let pdfTextWorkerSource = (try? String(contentsOf: pdfTextWorkerURL, encoding: .utf8)) ?? "" +let boundedPDFTextExtractorURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBeiCore/BoundedPDFTextExtractor.swift") +let boundedPDFTextExtractorSource = (try? String(contentsOf: boundedPDFTextExtractorURL, encoding: .utf8)) ?? "" +expect(courseDocumentIndexSource.contains("CREATE VIRTUAL TABLE IF NOT EXISTS chunks USING fts5") + && courseDocumentIndexSource.contains("private let indexingQueue") + && courseDocumentIndexSource.contains("private let ocrQueue") + && courseDocumentIndexSource.contains("indexPDFTextLayer") + && courseDocumentIndexSource.contains("finishPDFOCR") + && courseDocumentIndexSource.contains("PDFOCRTextExtractor.pageOutcome") + && courseDocumentIndexSource.contains("withWriteTransaction") + && courseDocumentIndexSource.contains("ROLLBACK") + && courseDocumentIndexSource.contains("storageID(for: item.id)") + && courseDocumentIndexSource.contains("ROW_NUMBER() OVER (PARTITION BY item_id ORDER BY rank)") + && courseDocumentIndexSource.contains("state?.chunkCount") + && courseDocumentIndexSource.contains("refreshChangedItemsForLookup") + && courseDocumentIndexSource.contains("let persistedStates: [String: FileState]") + && courseDocumentIndexSource.contains("shouldIndexImmediately = state.signature != scheduled.signature") + && courseDocumentIndexSource.contains("shouldIndexImmediately = true") + && courseDocumentIndexSource.contains("maximumImmediateRefreshItems = 24") + && courseDocumentIndexSource.contains("maximumImmediateRefreshSeconds: TimeInterval = 4") + && courseDocumentIndexSource.contains("maximumTextSourceBytes: UInt64 = 32 * 1_024 * 1_024") + && courseDocumentIndexSource.contains("maximumForegroundPDFPages = 32") + && courseDocumentIndexSource.contains("maximumPDFPageCharacters = 128_000") + && courseDocumentIndexSource.contains("maximumNativePDFPages: Self.maximumForegroundPDFPages") + && courseDocumentIndexSource.contains("maximumNativePDFSeconds: min(") + && courseDocumentIndexSource.contains("guard !Task.isCancelled else { return false }") + && courseDocumentIndexSource.contains("CourseIndexCancellationProbe") + && courseDocumentIndexSource.contains("sqlite3_progress_handler") + && courseDocumentIndexSource.contains("Unmanaged.passRetained(cancellationProbe)") + && courseDocumentIndexSource.contains("fromOpaque(cancellationContext).release()") + && courseDocumentIndexSource.contains("acquireItemIndexLock") + && courseDocumentIndexSource.contains("BoundedPDFTextExtractor.pages") + && courseDocumentIndexSource.contains("foregroundPDFTextBudget: TimeInterval = 2") + && courseDocumentIndexSource.contains("backgroundPDFTextBudget: TimeInterval = 20") + && courseDocumentIndexSource.contains("CREATE TABLE IF NOT EXISTS native_attempted_pages") + && courseDocumentIndexSource.contains("let pagesToOCR = nativeAttemptedPages.subtracting(processedPages).sorted()") + && courseDocumentIndexSource.contains("hasPendingNativePDFPages") + && courseDocumentIndexSource.contains("extraction_kind = 'failed'") + && !courseDocumentIndexSource.contains("page.string") + && courseDocumentIndexSource.contains("text-partial") + && courseDocumentIndexSource.contains("htmlSectionLocationID") + && courseDocumentIndexSource.contains("html-section-%08x") + && courseDocumentIndexSource.contains("[\\(locationID)][html-heading-\\(index)]") + && courseDocumentIndexSource.contains("guard isExpected(signature: signature, for: storageID) else { return false }") + && courseDocumentIndexSource.contains("BEGIN DEFERRED") + && courseDocumentIndexSource.contains("CREATE INDEX IF NOT EXISTS chunk_index_item_sort") + && courseDocumentIndexSource.contains("SELECT COUNT(*) FROM chunk_index WHERE item_id = ?") + && courseDocumentIndexSource.contains("WHERE item_id = ? AND signature = ?") + && courseDocumentIndexSource.contains("PRAGMA max_page_count") + && courseDocumentIndexSource.contains("integerValue(\"PRAGMA max_page_count\"") + && courseDocumentIndexSource.contains("PRAGMA journal_size_limit=67108864") + && courseDocumentIndexSource.contains("INSERT INTO chunks(chunks, rank) VALUES('merge', 64)") + && !courseDocumentIndexSource.contains("VALUES('optimize')") + && courseDocumentIndexSource.contains("PRAGMA incremental_vacuum") + && !courseDocumentIndexSource.contains("public func lookup(\n items: [StudyItem],\n query: String,\n maximumCharactersPerItem: Int = 24_000\n ) -> [String: CourseDocumentIndexResult] {\n schedule(items)"), "course search persists private FTS chunks, uses rollback-safe writes, OCRs every missing PDF page, and reports incomplete excerpts without rescanning files per question") +expect(pdfTextWorkerSource.contains("setrlimit(RLIMIT_CPU") + && pdfTextWorkerSource.contains("maximumUTF8Bytes") + && pdfTextWorkerSource.contains("rawText.prefix(maximumCharacters)") + && pdfTextWorkerSource.contains("runVerificationProbe"), "native PDF text extraction runs in a resource-limited helper with bounded output") +expect(boundedPDFTextExtractorSource.contains("maximumWorkerTimeout: TimeInterval = 3.5") + && boundedPDFTextExtractorSource.contains("maximumWorkerResidentBytes: UInt64 = 384 * 1_024 * 1_024") + && boundedPDFTextExtractorSource.contains("process.environment = environment") + && boundedPDFTextExtractorSource.contains("proc_pidinfo(processID, PROC_PIDTASKINFO") + && boundedPDFTextExtractorSource.contains("$0 > maximumResidentBytes") + && boundedPDFTextExtractorSource.contains("process.terminate()") + && boundedPDFTextExtractorSource.contains("Darwin.kill(process.processIdentifier, SIGKILL)") + && boundedPDFTextExtractorSource.contains("outputBox.append(chunk, limit: maximumOutputBytes)") + && boundedPDFTextExtractorSource.contains("runSafetySelfCheck"), "PDF text worker calls are cancellable, time-limited, memory-monitored, output-bounded, and expose a real safety self-check") let quietScrollersSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Support/QuietScrollers.swift") let quietScrollersSource = (try? String(contentsOf: quietScrollersSourceURL, encoding: .utf8)) ?? "" @@ -494,6 +581,21 @@ func makeImageOnlyPDF(at url: URL) { expect(document.write(to: url), "write image-only pdf") } +func makeBlankImageOnlyPDF(at url: URL) { + let image = NSImage(size: NSSize(width: 600, height: 300)) + image.lockFocus() + NSColor.white.setFill() + NSRect(origin: .zero, size: image.size).fill() + image.unlockFocus() + let document = PDFDocument() + guard let page = PDFPage(image: image) else { + expect(false, "create blank image-only pdf page") + return + } + document.insert(page, at: 0) + expect(document.write(to: url), "write blank image-only pdf") +} + let selectablePDFURL = FileManager.default.temporaryDirectory .appendingPathComponent("weibei-selectable-pdf-check-\(UUID().uuidString).pdf") makeSelectablePDF(at: selectablePDFURL) @@ -530,6 +632,272 @@ let targetedOCRPages = imageOnlyPDF.map { PDFOCRTextExtractor.pages(from: $0, pa expect(targetedOCRPages.count == 1 && targetedOCRPages[0].pageIndex == 0, "Vision OCR can target a specific PDF page for mixed text and scanned documents") let outOfRangeOCRPages = imageOnlyPDF.map { PDFOCRTextExtractor.pages(from: $0, pageIndexes: [1]) } ?? [] expect(outOfRangeOCRPages.isEmpty, "targeted OCR ignores pages outside the PDF") +let blankImagePDFURL = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-blank-image-pdf-check-\(UUID().uuidString).pdf") +makeBlankImageOnlyPDF(at: blankImagePDFURL) +defer { try? FileManager.default.removeItem(at: blankImagePDFURL) } +if let blankImagePDF = PDFDocument(url: blankImagePDFURL) { + expect( + PDFOCRTextExtractor.pageOutcome(from: blankImagePDF, pageIndex: 0) == .empty(pageIndex: 0), + "Vision OCR distinguishes a successfully scanned blank page from an extraction failure" + ) +} else { + expect(false, "open blank image-only pdf") +} + +func makeMixedLateOCRPDF(at url: URL) { + let data = NSMutableData() + var mediaBox = CGRect(x: 0, y: 0, width: 720, height: 420) + guard let consumer = CGDataConsumer(data: data as CFMutableData), + let context = CGContext(consumer: consumer, mediaBox: &mediaBox, nil) else { + expect(false, "create mixed PDF context") + return + } + + for pageIndex in 0..<13 { + context.beginPDFPage(nil) + context.setFillColor(NSColor.white.cgColor) + context.fill(mediaBox) + if pageIndex < 12 { + NSGraphicsContext.saveGraphicsState() + NSGraphicsContext.current = NSGraphicsContext(cgContext: context, flipped: false) + NSString(string: "Native text layer content for page \(pageIndex + 1) with enough characters").draw( + at: CGPoint(x: 48, y: 210), + withAttributes: [ + .font: NSFont.systemFont(ofSize: 24), + .foregroundColor: NSColor.black, + ] + ) + NSGraphicsContext.restoreGraphicsState() + } else { + let image = NSImage(size: NSSize(width: 1_200, height: 500)) + image.lockFocus() + NSColor.white.setFill() + NSRect(origin: .zero, size: image.size).fill() + NSString(string: "LATEPAGE OCR TARGET").draw( + at: CGPoint(x: 70, y: 190), + withAttributes: [ + .font: NSFont.boldSystemFont(ofSize: 82), + .foregroundColor: NSColor.black, + ] + ) + image.unlockFocus() + var imageRect = CGRect(origin: .zero, size: image.size) + if let cgImage = image.cgImage(forProposedRect: &imageRect, context: nil, hints: nil) { + context.draw(cgImage, in: CGRect(x: 35, y: 70, width: 650, height: 270)) + } + } + context.endPDFPage() + } + context.closePDF() + expect(data.write(to: url, atomically: true), "write mixed late-OCR PDF") +} + +let courseIndexRoot = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-course-index-check-\(UUID().uuidString)", isDirectory: true) +try? FileManager.default.createDirectory(at: courseIndexRoot, withIntermediateDirectories: true) +defer { try? FileManager.default.removeItem(at: courseIndexRoot) } +let mixedPDFURL = courseIndexRoot.appendingPathComponent("mixed-late-ocr.pdf") +makeMixedLateOCRPDF(at: mixedPDFURL) +let mixedPDFItem = StudyItem( + id: "file:\(mixedPDFURL.path)", + title: "Mixed late OCR", + subtitle: mixedPDFURL.lastPathComponent, + kind: .pdf, + urlPath: mixedPDFURL.path, + isSample: false +) +let markdownIndexURL = courseIndexRoot.appendingPathComponent("late-section.md") +let lateMarkdownToken = "PERSISTENT_LATE_INDEX_TOKEN" +try? (String(repeating: "ordinary material\n\n", count: 1_500) + lateMarkdownToken) + .write(to: markdownIndexURL, atomically: true, encoding: .utf8) +let markdownIndexItem = StudyItem( + id: "file:\(markdownIndexURL.path)", + title: "Late markdown section", + subtitle: markdownIndexURL.lastPathComponent, + kind: .markdown, + urlPath: markdownIndexURL.path, + isSample: false +) +let stableHTMLURL = courseIndexRoot.appendingPathComponent("stable-sections.html") +let stableHTMLOriginal = """ +<html><body> +<h1>利率</h1><p>ORIGINAL_ALPHA_SECTION 资金价格。</p> +<h2>利率</h2><p>ORIGINAL_BETA_SECTION 购买力变化。</p> +</body></html> +""" +try? stableHTMLOriginal.write(to: stableHTMLURL, atomically: true, encoding: .utf8) +let stableHTMLItem = StudyItem( + id: "file:\(stableHTMLURL.path)", + title: "Stable duplicate sections", + subtitle: stableHTMLURL.lastPathComponent, + kind: .html, + urlPath: stableHTMLURL.path, + isSample: false +) +let blankPDFIndexItem = StudyItem( + id: "file:\(blankImagePDFURL.path)", + title: "Blank scanned page", + subtitle: blankImagePDFURL.lastPathComponent, + kind: .pdf, + urlPath: blankImagePDFURL.path, + isSample: false +) +let courseIndexDatabaseURL = courseIndexRoot.appendingPathComponent("course-search.sqlite3") +let courseIndex = CourseDocumentSearchIndex(databaseURL: courseIndexDatabaseURL) +expect( + BoundedPDFTextExtractor.runSafetySelfCheck(), + "bounded PDF worker passes normal execution, timeout, cancellation, memory, and output-overflow probes" +) +let boundedNativeProbe = BoundedPDFTextExtractor.pages( + from: mixedPDFURL, + pageIndexes: Array(0..<8), + maximumCharactersPerPage: 128_000, + timeout: 3.5 +) +if boundedNativeProbe?[0]?.text.contains("Native text layer content for page 1") != true { + fputs("bounded native PDF diagnostic: \(String(describing: boundedNativeProbe))\n", stderr) +} +expect( + boundedNativeProbe?[0]?.text.contains("Native text layer content for page 1") == true, + "bounded PDF worker returns native text for a generated multi-page PDF" +) +courseIndex.schedule([mixedPDFItem, markdownIndexItem, stableHTMLItem, blankPDFIndexItem]) +var mixedIndexResult: CourseDocumentIndexResult? +var markdownIndexResult: CourseDocumentIndexResult? +var blankPDFIndexResult: CourseDocumentIndexResult? +var stableHTMLIndexResult: CourseDocumentIndexResult? +for _ in 0..<200 { + mixedIndexResult = courseIndex.lookup(items: [mixedPDFItem], query: "LATEPAGE OCR TARGET")[mixedPDFItem.id] + markdownIndexResult = courseIndex.lookup(items: [markdownIndexItem], query: lateMarkdownToken)[markdownIndexItem.id] + blankPDFIndexResult = courseIndex.lookup(items: [blankPDFIndexItem], query: "blank page")[blankPDFIndexItem.id] + stableHTMLIndexResult = courseIndex.lookup(items: [stableHTMLItem], query: "ORIGINAL_ALPHA_SECTION ORIGINAL_BETA_SECTION")[stableHTMLItem.id] + if mixedIndexResult?.text?.uppercased().contains("LATEPAGE") == true, + markdownIndexResult?.text?.contains(lateMarkdownToken) == true, + stableHTMLIndexResult?.text?.contains("ORIGINAL_ALPHA_SECTION") == true, + blankPDFIndexResult?.isTruncated == false { + break + } + Thread.sleep(forTimeInterval: 0.05) +} +expect( + mixedIndexResult?.isTruncated == true + && mixedIndexResult?.text?.uppercased().contains("LATEPAGE") == true + && mixedIndexResult?.text?.contains("第 13 页(OCR)") == true, + "persistent course index OCRs a scanned page beyond page twelve, keeps its page location, and marks the returned excerpt partial" +) +let nativePDFIndexResult = courseIndex.lookup( + items: [mixedPDFItem], + query: "Native text layer content for page 1" +)[mixedPDFItem.id] +if nativePDFIndexResult?.text?.contains("Native text layer content for page 1") != true + || nativePDFIndexResult?.text?.contains("第 1 页(OCR)") == true { + fputs("native PDF index diagnostic: \(nativePDFIndexResult?.text ?? "<nil>")\n", stderr) +} +expect( + nativePDFIndexResult?.text?.contains("Native text layer content for page 1") == true + && nativePDFIndexResult?.text?.contains("第 1 页(OCR)") != true, + "persistent course index executes the bounded worker and preserves a real native PDF text-layer result" +) +let indexedPDFCourseContext = CourseKnowledgeIndex.build( + title: "Indexed PDF", + sources: [ + CourseKnowledgeSource( + id: mixedPDFItem.id, + title: mixedPDFItem.title, + subtitle: mixedPDFItem.subtitle, + kind: mixedPDFItem.kind.rawValue, + role: "material", + text: mixedIndexResult?.text ?? "", + isTruncated: mixedIndexResult?.isTruncated ?? true + ), + ], + links: [], + query: "LATEPAGE OCR TARGET", + currentMaterialID: nil, + currentNoteID: nil +) +expect( + indexedPDFCourseContext.items.first?.headings.contains("第 13 页(OCR)") == true, + "course search preserves confirmed OCR page locations for exact PDF jumps" +) +expect( + blankPDFIndexResult?.isTruncated == false && blankPDFIndexResult?.text == nil, + "persistent course index records a successfully scanned blank PDF page without retrying it forever" +) +expect( + markdownIndexResult?.isTruncated == true + && markdownIndexResult?.text?.contains(lateMarkdownToken) == true, + "persistent course index finds a late text-file section without per-question rescanning and marks the excerpt partial" +) +func stableHTMLSectionIDs(in text: String) -> Set<String> { + guard let regex = try? NSRegularExpression(pattern: #"\[(html-section-[A-Za-z0-9-]+)\]"#) else { + return [] + } + let range = NSRange(text.startIndex..<text.endIndex, in: text) + return Set(regex.matches(in: text, range: range).compactMap { match in + guard match.numberOfRanges > 1, + let range = Range(match.range(at: 1), in: text) else { return nil } + return String(text[range]) + }) +} +let originalStableSectionIDs = stableHTMLSectionIDs(in: stableHTMLIndexResult?.text ?? "") +let stableHTMLWithInsertedDuplicate = """ +<html><body> +<h1>利率</h1><p>NEW_INSERTED_SECTION 新增解释。</p> +<h1>利率</h1><p>ORIGINAL_ALPHA_SECTION 资金价格。</p> +<h2>利率</h2><p>ORIGINAL_BETA_SECTION 购买力变化。</p> +</body></html> +""" +try? stableHTMLWithInsertedDuplicate.write(to: stableHTMLURL, atomically: true, encoding: .utf8) +let refreshedStableHTML = courseIndex.lookup( + items: [stableHTMLItem], + query: "ORIGINAL_ALPHA_SECTION ORIGINAL_BETA_SECTION" +)[stableHTMLItem.id] +let refreshedStableSectionIDs = stableHTMLSectionIDs(in: refreshedStableHTML?.text ?? "") +expect( + originalStableSectionIDs.count == 2 + && originalStableSectionIDs.isSubset(of: refreshedStableSectionIDs) + && refreshedStableSectionIDs.count == 3, + "HTML section content fingerprints survive insertion of a new same-title section before existing sections" +) +let reopenedCourseIndex = CourseDocumentSearchIndex(databaseURL: courseIndexDatabaseURL) +reopenedCourseIndex.schedule([mixedPDFItem]) +let reopenedResult = reopenedCourseIndex.lookup( + items: [mixedPDFItem], + query: "LATEPAGE OCR TARGET" +)[mixedPDFItem.id] +expect( + reopenedResult?.isTruncated == true + && reopenedResult?.text?.uppercased().contains("LATEPAGE") == true, + "course full-text index survives reopening without rebuilding the PDF" +) + +let splitFailureIndex = CourseDocumentSearchIndex( + databaseURL: courseIndexRoot.appendingPathComponent("course-search-split-failure.sqlite3"), + nativePDFTextLoader: { _, pageIndexes, _, _ in + guard pageIndexes.count == 1, let pageIndex = pageIndexes.first else { return nil } + let text = pageIndex < 12 + ? "SPLIT_NATIVE_LAYER_PAGE_\(pageIndex + 1) remains native after a failed batch extraction" + : "" + return [pageIndex: BoundedPDFTextPage(text: text, isPartial: false)] + } +) +splitFailureIndex.schedule([mixedPDFItem]) +var splitFailureResult: CourseDocumentIndexResult? +for _ in 0..<200 { + splitFailureResult = splitFailureIndex.lookup( + items: [mixedPDFItem], + query: "SPLIT_NATIVE_LAYER_PAGE_1" + )[mixedPDFItem.id] + if splitFailureResult?.text?.contains("SPLIT_NATIVE_LAYER_PAGE_1") == true { break } + Thread.sleep(forTimeInterval: 0.05) +} +expect( + splitFailureResult?.text?.contains("SPLIT_NATIVE_LAYER_PAGE_1") == true + && splitFailureResult?.text?.contains("第 1 页(OCR)") != true, + "a failed native PDF batch is bisected to single pages instead of sending unattempted text pages to OCR" +) let data = Data(""" {"output":[{"content":[{"type":"output_text","text":"只根据当前材料回答。"}]}]} @@ -794,6 +1162,37 @@ expect(ReaderSearch.firstMatch(in: "Money and Banking", query: "money")?.locatio expect(ReaderSearch.firstMatch(in: "Money and Banking", query: " ") == nil, "reader search ignores empty query") let pdfSourceReference = SourceReferenceTitle.parse("> 来源:Mishkin 教材样例,第 3 页") expect(pdfSourceReference.title == "Mishkin 教材样例" && pdfSourceReference.pageIndex == 2, "source reference parses pdf page") +let htmlSourceReference = SourceReferenceTitle.parse("来源:货币金融学课程 HTML,章节:实际利率") +expect( + htmlSourceReference.title == "货币金融学课程 HTML" + && htmlSourceReference.pageIndex == nil + && htmlSourceReference.sectionTitle == "实际利率" + && htmlSourceReference.sectionLocationID == nil + && htmlSourceReference.sectionOrdinal == nil, + "source reference parses an exact HTML section" +) +let disambiguatedSourceReference = SourceReferenceTitle.parse("来源:重复教材,条目:7,章节标识:html-section-a1b2c3d4,章节序号:4,章节:利率") +expect( + disambiguatedSourceReference.title == "重复教材" + && disambiguatedSourceReference.courseItemOrdinal == 7 + && disambiguatedSourceReference.sectionLocationID == "html-section-a1b2c3d4" + && disambiguatedSourceReference.sectionOrdinal == 4 + && disambiguatedSourceReference.sectionTitle == "利率", + "source reference preserves the file and section ordinals needed to disambiguate duplicate titles" +) +let englishSectionReference = SourceReferenceTitle.parse("Source: Repeated Course, item: 2, section id: html-section-d4c3b2a1, section number: 5, section: Interest") +expect( + englishSectionReference.title == "Repeated Course" + && englishSectionReference.courseItemOrdinal == 2 + && englishSectionReference.sectionLocationID == "html-section-d4c3b2a1" + && englishSectionReference.sectionOrdinal == 5 + && englishSectionReference.sectionTitle == "Interest", + "source reference preserves stable HTML section ordinals in English" +) +let emphasizedSourceReference = SourceReferenceTitle.parse("来源:**Mishkin 教材样例**") +expect(emphasizedSourceReference.title == "Mishkin 教材样例", "source reference ignores whole-title Markdown emphasis") +let inlineCodeSourceReference = SourceReferenceTitle.parse("- 相关资料:`来源:Mishkin 教材样例`") +expect(inlineCodeSourceReference.title == "Mishkin 教材样例", "source reference remains actionable when PI wraps the jump in inline code") let calloutSourceReference = SourceReferenceTitle.parse(""" > [!quote] 选区摘录 > 实际利率 @@ -1483,6 +1882,19 @@ expect(readerViewSource.contains("static func readerStyleScript(for mode: WeiBei && readerViewSource.contains("element.removeAttribute(\"data-weibei-paper-surface\")") && !readerStyleScriptSource.contains("MutationObserver"), "HTML adaptation is reversible and bounds its one-time near-white surface pass without a persistent DOM observer") expect(readerViewSource.contains("pendingPDFPageIndex") && readerViewSource.contains("applyPendingPDFPageIfReady") && readerViewSource.contains("store.readerTargetPageIndex = nil"), "pdf reader consumes source-jump target pages") +expect(readerViewSource.contains("applyPendingHTMLLocationIfReady") + && readerViewSource.contains("store.readerTargetLocationID") + && readerViewSource.contains("store.readerTargetLocationTitle") + && readerViewSource.contains("targetID = matches.count == 1 ? matches[0].id : nil") + && readerViewSource.contains("Self.normalizedHTMLSectionTitle(savedSection.title)") + && readerViewSource.contains("document.querySelectorAll(\"h1, h2, h3, h4\")") + && !readerViewSource.contains("h1, h2, h3, h4, [role='heading']") + && readerViewSource.contains("const headings = Array.from(document.querySelectorAll") + && readerViewSource.contains("sectionFingerprintBody") + && readerViewSource.contains("sectionLocationID") + && readerViewSource.contains("new TextEncoder().encode(normalized)") + && readerViewSource.contains("`html-section-${hash.toString(16).padStart(8, \"0\")}`") + && readerViewSource.contains("store.updateReaderHTMLLocation(id: id, title: title)"), "HTML reader persists the active section and consumes exact section jumps") expect(readerViewSource.contains("onSourceReference: { reference in store.openSourceReference(reference) }"), "markdown reader source references can jump back to material") expect(readerViewSource.contains("private struct SamplePDFView") && readerViewSource.contains("ScrollView {") @@ -1736,6 +2148,9 @@ expect(appSource.contains("init() {\n WeiBeiTypography.registerBundledFon let workspaceStoreSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Stores/WorkspaceStore.swift") let workspaceStoreSource = (try? String(contentsOf: workspaceStoreSourceURL, encoding: .utf8)) ?? "" +expect(workspaceStoreSource.contains("DocumentTextExtractor.cachedText(for: item)") + && workspaceStoreSource.contains("loadedMaterialText = await Task.detached(priority: .utility)") + && !workspaceStoreSource.contains("if let text = DocumentTextExtractor.text(for: item)"), "main-actor workspace reads only cached document text while bounded extraction runs off the UI thread") expect(workspaceStoreSource.contains("@Published var showDailyInspiration = true") && workspaceStoreSource.contains("func setDailyInspirationEnabled(_ enabled: Bool)") && workspaceStoreSource.contains("showDailyInspiration = snapshot.showDailyInspiration ?? true") @@ -1836,8 +2251,29 @@ expect(workspaceStoreSource.contains("let item = allItems.first(where: { $0.id = && workspaceStoreSource.contains("activeNotebookItemID = item.id") && workspaceStoreSource.contains("noteText = noteText(for: item)") && !workspaceStoreSource.contains("select(itemID: item.id)\n noteFileError = ui(\"已创建笔记"), "selecting or creating a notebook note does not replace the current reader material") -expect(workspaceStoreSource.contains("@Published var readerLocationTitle") && workspaceStoreSource.contains("var currentReferenceTitle"), "store tracks the current reader reference title") -expect(workspaceStoreSource.contains("@Published var readerTargetPageIndex") && workspaceStoreSource.contains("func openSourceReference") && workspaceStoreSource.contains("SourceReferenceTitle.parse"), "store can jump from source reference text to the referenced material") +expect(workspaceStoreSource.contains("@Published var readerLocationID") + && workspaceStoreSource.contains("@Published var readerLocationTitle") + && workspaceStoreSource.contains("func updateReaderHTMLLocation") + && workspaceStoreSource.contains("var currentReferenceTitle"), "store tracks durable PDF and HTML reader locations") +expect(workspaceStoreSource.contains("private func sessionContinuitySummary(for session: StudySession)") + && workspaceStoreSource.contains("messages.suffix(20)") + && workspaceStoreSource.contains("olderMessages.prefix(4)") + && workspaceStoreSource.contains("olderMessages.suffix(8)"), "durable study sessions inject recent turns plus bounded earlier conversation excerpts into each clean PI run") +expect(workspaceStoreSource.contains("itemTitle: sourceReferenceBaseTitle(for: item)") + && workspaceStoreSource.contains("private func refreshStudyLocationReferenceTitles() -> Bool") + && workspaceStoreSource.contains("learningMemoryEntries[index].origin = .userStatement\n learningMemoryEntries[index].sessionID = activeStudySessionID") + && workspaceStoreSource.contains("$0.sessionID == activeStudySessionID") + && workspaceStoreSource.contains("learningMemoryEntries[index].origin == .userStatement") + && workspaceStoreSource.contains("proposed.origin != .userStatement") + && !workspaceStoreSource.contains("learningMemoryEntries[index].sessionID = activeStudySessionID\n learningMemoryEntries[index].updatedAt"), "learning locations preserve duplicate-file identity and inferred memories keep their original session provenance") +expect(workspaceStoreSource.contains("@Published var readerTargetPageIndex") + && workspaceStoreSource.contains("@Published var readerTargetLocationTitle") + && workspaceStoreSource.contains("func openSourceReference") + && workspaceStoreSource.contains("reference.sectionTitle") + && workspaceStoreSource.contains("reference.sectionLocationID") + && workspaceStoreSource.contains("reference.sectionOrdinal.map { \"html-heading-\\(max($0 - 1, 0))\" }") + && workspaceStoreSource.contains("private func sourceReferenceBaseTitle") + && workspaceStoreSource.contains("return matches.count == 1 ? matches[0] : nil"), "store can jump from source references to PDF pages and HTML sections without guessing between duplicate file titles") expect(workspaceStoreSource.contains("let sampleItems: [StudyItem] = WorkspaceStore.makeSampleItems()") && workspaceStoreSource.contains("StudyItem(id: \"sample-pdf\", title: \"Mishkin 教材样例\", subtitle: \"PDF 阅读\", kind: .pdf, urlPath: samplePDFURL()?.path, isSample: true)") && workspaceStoreSource.contains("private var didRunVerificationScenario = false") @@ -1960,7 +2396,9 @@ if let askSelectionStart = workspaceStoreSource.range(of: "func askSelection()") } expect(workspaceStoreSource.contains("selectionAttachments\n .map { quotedReferenceBlock(text: $0.text, sourceTitle: $0.ownerTitle) }") && workspaceStoreSource.contains("sourceTitle: selectionContext.ownerTitle") - && workspaceStoreSource.contains("来源:\\(currentReferenceTitle)"), "copy reference uses attached selections, the live selection, or the current reader source") + && workspaceStoreSource.contains("来源:\\(currentSourceReferenceTitle)") + && workspaceStoreSource.contains("\\(itemTitle),章节标识:\\(locationID),章节:\\(locationTitle)") + && workspaceStoreSource.contains("\\(itemTitle),章节序号:\\(sectionOrdinal),章节:\\(locationTitle)"), "copy reference uses attached selections or a canonical file-plus-location source") expect(workspaceStoreSource.contains("private func quotedReferenceBlock") && workspaceStoreSource.contains("let quoted = MarkdownSelectionSanitizer.clean(text)") && workspaceStoreSource.contains("> [!quote] 选区摘录") @@ -1994,11 +2432,11 @@ if let hideReaderSearchStart = workspaceStoreSource.range(of: "func hideReaderSe expect(false, "reader search dismissal source is readable") } expect(workspaceStoreSource.contains("var selectedMaterialTitle") && workspaceStoreSource.contains("selectedMaterialItem.map(displayTitle) ?? ui(\"未选择材料\""), "agent material title does not invent a current material") -expect(workspaceStoreSource.contains("var agentMessageSourceTitle: String?") && workspaceStoreSource.contains("hasSelectedMaterial ? currentReferenceTitle : activeNoteItem.map(displayTitle)") && !workspaceStoreSource.contains("source: selectedMaterialItem?.title"), "agent message source uses the current reader location and falls back to the localized active note title") -expect(workspaceStoreSource.contains("let sentMaterialTitle = currentReferenceTitle") - && workspaceStoreSource.contains("materialTitle: sentMaterialTitle"), "agent prompt snapshots the current reader location title so PDF page context reaches the model after background indexing") +expect(workspaceStoreSource.contains("var agentMessageSourceTitle: String?") && workspaceStoreSource.contains("hasSelectedMaterial ? currentSourceReferenceTitle : activeNoteItem.map(displayTitle)") && !workspaceStoreSource.contains("source: selectedMaterialItem?.title"), "agent message source uses the canonical file location and falls back to the localized active note title") +expect(workspaceStoreSource.contains("let sentMaterialTitle = currentSourceReferenceTitle") + && workspaceStoreSource.contains("materialTitle: sentMaterialTitle"), "agent prompt snapshots the canonical file location so PDF pages and HTML sections reach the model") expect(workspaceStoreSource.contains("private var quietInsightReferenceTitle: String") - && workspaceStoreSource.contains("selectionContext?.ownerTitle ?? (hasSelectedMaterial ? currentReferenceTitle : activeNoteItem.map(displayTitle)) ?? ui(\"当前笔记\"") + && workspaceStoreSource.contains("selectionContext?.ownerTitle ?? (hasSelectedMaterial ? currentSourceReferenceTitle : activeNoteItem.map(displayTitle)) ?? ui(\"当前笔记\"") && workspaceStoreSource.contains("没有证据就说\\(evidenceText)"), "quiet insight uses real selection, current reader location, or note source wording") expect(workspaceStoreSource.contains("private func clearUnpinnedFloatingSelection(keepContext: Bool = true, invalidatesAgentContext: Bool = true)") && workspaceStoreSource.contains("if invalidatesAgentContext, selectionContext != nil") @@ -2126,11 +2564,13 @@ if let requestStart = workspaceStoreSource.range(of: "private func performAgentR && requestSource.contains("clearUnpinnedFloatingSelection(keepContext: false, invalidatesAgentContext: false)") && requestSource.contains("appendAgentMessage(AgentMessage(role: .user, text: question, source: sourceTitle))") && requestSource.contains("let sentLearningContext = makeLearningContext()") - && requestSource.contains("let courseContext = try await makeCourseContext(query: courseQuery)") - && requestSource.contains("courseContext: courseContext") + && requestSource.contains("let courseBuild = try await makeCourseContext(query: courseQuery)") + && requestSource.contains("materialIsTruncated: courseBuild.selectedMaterialIsTruncated") + && requestSource.contains("courseContext: courseBuild.context") && requestSource.contains("learningContext: sentLearningContext") && requestSource.contains("let reply = try await executeStudyAgentRequest(request)") && requestSource.contains("applyLearningUpdate(") + && requestSource.contains("expectedUserQuestion: request.question") && requestSource.contains("requestWorkspaceRevision == agentContextRevision") && requestSource.contains("requestMemoryRevision == learningMemoryRevision") && requestSource.contains("lastAgentReplyContextRevision = requestWorkspaceRevision") @@ -2150,16 +2590,29 @@ expect(workspaceStoreSource.contains("noteSourceLinks: noteSourceLinks") && workspaceStoreSource.contains("learningMemoryRevision: learningMemoryRevision") && workspaceStoreSource.contains("studySessions: studySessions") && workspaceStoreSource.contains("activeStudySessionID: activeStudySessionID"), "course links, progress, memory, and sessions are saved with the workspace") +expect(workspaceStoreSource.contains("acceptedUpdate.resolutions = update.resolutions.prefix(12).filter") + && workspaceStoreSource.contains("func confirmLearningMemoryResolution") + && workspaceStoreSource.contains("private static func resolutionEvidenceMatches") + && workspaceStoreSource.contains("StudyAgentResolutionEvidence.matches") + && workspaceStoreSource.contains("func restoreLearningMemory(") + && workspaceStoreSource.contains("resolutionEvidence = \"[用户:界面确认]\"") + && notesAgentSource.contains("建议结案:") + && notesAgentSource.contains("store.confirmLearningMemoryResolution(resolution)") + && notesAgentSource.contains("store.restoreLearningMemoryResolution(resolution)"), "PI can only propose memory resolution; user confirmation persists it and the UI can undo it") expect(workspaceStoreSource.contains("} else {\n restoreCurrentStudyLocation()\n recordCurrentStudyLocation(incrementVisit: false)\n }") && workspaceStoreSource.contains("private func restoreCurrentStudyLocation()") && workspaceStoreSource.contains("readerPageIndex = max(location.pageIndex ?? 0, 0)") && workspaceStoreSource.contains("readerTargetPageIndex = location.pageIndex.map { max($0, 0) }"), "saved heading and PDF page are restored before startup records the current study location") expect(workspaceStoreSource.contains("private func makeCourseContext(query: String) async throws") && workspaceStoreSource.contains("CourseKnowledgeIndex.build(") - && workspaceStoreSource.contains("DocumentTextExtractor.indexText(for:") + && workspaceStoreSource.contains("courseDocumentSearchIndex: CourseDocumentSearchIndex") + && workspaceStoreSource.contains("course-search-v3.sqlite3") + && workspaceStoreSource.contains("removeLegacyCourseIndex") + && workspaceStoreSource.contains("let indexedByItemID = searchIndex.lookup(") + && workspaceStoreSource.contains("candidate.item.isSample") && workspaceStoreSource.contains("Task.detached(priority: .userInitiated)") && workspaceStoreSource.contains("withTaskCancellationHandler") - && workspaceStoreSource.contains("migrateNoteSourceLinksFromMarkdown()"), "agent requests index every course item and migrate durable note-source links") + && workspaceStoreSource.contains("migrateNoteSourceLinksFromMarkdown()"), "agent queries the persistent course index in the background and migrates durable note-source links") if let selectStart = workspaceStoreSource.range(of: "func select(itemID: String?)")?.lowerBound, let selectEnd = workspaceStoreSource[selectStart...].range(of: "\n func ", options: [], range: workspaceStoreSource.index(after: selectStart)..<workspaceStoreSource.endIndex)?.lowerBound { let selectSource = String(workspaceStoreSource[selectStart..<selectEnd]) @@ -2175,6 +2628,7 @@ expect(workspaceStoreSource.contains("func stageNoteDraft(_ value: String, for i && notesAgentSource.contains("store.stageNoteDraft(value, for: draftNoteItemID)"), "agent requests flush the current local note-editor draft before snapshotting context") expect(workspaceStoreSource.contains("func updateReaderLocationTitle(_ title: String?)") && workspaceStoreSource.contains("guard readerLocationTitle != nextTitle else { return }\n invalidateAgentContext()") + && workspaceStoreSource.contains("func updateReaderHTMLLocation(id: String?, title: String?)") && workspaceStoreSource.contains("guard readerPageIndex != nextIndex else { return }\n invalidateAgentContext()"), "reader heading and page changes invalidate stale agent answers") expect(workspaceStoreSource.contains("var agentPromptScope") && workspaceStoreSource.contains("var selectionPromptScope") && !workspaceStoreSource.contains("var libraryOrganizationScope"), "agent prompt builders avoid half-built library organization context") expect(!workspaceStoreSource.contains("请根据当前文档和当前笔记") && !workspaceStoreSource.contains("请根据当前材料和当前笔记") && !workspaceStoreSource.contains("结合当前文档和笔记"), "agent draft presets do not hardcode fake material context") @@ -2215,7 +2669,10 @@ expect(workspaceStoreSource.contains("func cancelNotebookNoteCreation()") && workspaceStoreSource.contains("func select(itemID: String?) {\n invalidateAgentContext()\n persistCurrentNote()\n notebookCreationDraft = nil") && !workspaceStoreSource.contains("private func promptCreateNotebookNote(seed: NotebookNoteSeed)") && !workspaceStoreSource.contains("alert.messageText = seed.isBlank"), "new-note creation opens the inline naming strip and confirms through the shared local markdown creator") -expect(workspaceStoreSource.contains("importedItems.append(item)\n if let sourceItem {\n addNoteSourceLink(noteItemID: item.id, sourceItemID: sourceItem.id)\n }\n activeNotebookItemID = item.id\n noteText = markdown\n revealRichWritingSurface()\n focus(.notes)\n save()"), "new notebook notes persist their material link and open in the note pane without replacing the reader material") +expect(workspaceStoreSource.contains("importedItems.append(item)") + && workspaceStoreSource.contains("courseDocumentSearchIndex.synchronize(allItems)") + && workspaceStoreSource.contains("addNoteSourceLink(noteItemID: item.id, sourceItemID: sourceItem.id)") + && workspaceStoreSource.contains("activeNotebookItemID = item.id\n noteText = markdown\n revealRichWritingSurface()\n focus(.notes)\n save()"), "new notebook notes persist their material link, join the course index, and open in the note pane without replacing the reader material") expect(workspaceStoreSource.contains("private func showTransientNoteStatus(_ message: String)") && workspaceStoreSource.contains("Task { @MainActor [weak self] in") && workspaceStoreSource.contains("if self?.noteFileError == message") diff --git a/script/build_and_run.sh b/script/build_and_run.sh index 46fd19039..26a50016f 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -42,8 +42,11 @@ fi APP_BUNDLE="$DIST_DIR/$APP_DISPLAY_NAME.app" APP_CONTENTS="$APP_BUNDLE/Contents" APP_MACOS="$APP_CONTENTS/MacOS" +APP_HELPERS="$APP_CONTENTS/Helpers" APP_RESOURCES="$APP_CONTENTS/Resources" APP_BINARY="$APP_MACOS/$PRODUCT_NAME" +PDF_TEXT_WORKER_NAME="WeiBeiPDFTextWorker" +PDF_TEXT_WORKER="$APP_HELPERS/$PDF_TEXT_WORKER_NAME" INFO_PLIST="$APP_CONTENTS/Info.plist" VERIFY_PID="" VERIFY_DATA_DIR="$DIST_DIR/Data" @@ -94,13 +97,24 @@ if [[ "$CHECK_ONLY" != true ]]; then ) rm -rf "$APP_BUNDLE" - mkdir -p "$APP_MACOS" "$APP_RESOURCES" + mkdir -p "$APP_MACOS" "$APP_HELPERS" "$APP_RESOURCES" cp "$BUILD_BINARY" "$APP_BINARY" if ! /usr/bin/cmp -s "$BUILD_BINARY" "$APP_BINARY"; then echo "package failed: copied app binary does not match the current Swift build" >&2 exit 10 fi chmod +x "$APP_BINARY" + BUILD_PDF_TEXT_WORKER="$BUILD_DIR/$PDF_TEXT_WORKER_NAME" + if [[ ! -x "$BUILD_PDF_TEXT_WORKER" ]]; then + echo "package failed: missing bounded PDF text worker" >&2 + exit 12 + fi + cp "$BUILD_PDF_TEXT_WORKER" "$PDF_TEXT_WORKER" + if ! /usr/bin/cmp -s "$BUILD_PDF_TEXT_WORKER" "$PDF_TEXT_WORKER"; then + echo "package failed: copied PDF text worker does not match the current Swift build" >&2 + exit 13 + fi + chmod +x "$PDF_TEXT_WORKER" for resource_bundle in "${RESOURCE_BUNDLES[@]}"; do if [[ ! -d "$resource_bundle" ]]; then echo "package failed: missing resource bundle $resource_bundle" >&2 @@ -145,8 +159,13 @@ if [[ "$CHECK_ONLY" != true ]]; then </dict> </plist> PLIST + /usr/bin/codesign --force --sign - --timestamp=none "$PDF_TEXT_WORKER" >/dev/null /usr/bin/codesign --force --sign - --timestamp=none "$APP_BUNDLE" >/dev/null /usr/bin/codesign --verify --deep --strict "$APP_BUNDLE" + if [[ "$(/usr/bin/env WEIBEI_PDF_WORKER_VERIFY=1 "$PDF_TEXT_WORKER" --verification-probe normal)" != "verification-ok" ]]; then + echo "package failed: signed PDF text worker did not complete its runtime probe" >&2 + exit 14 + fi BUILD_UUID="$(/usr/bin/dwarfdump --uuid "$BUILD_BINARY" | /usr/bin/awk 'NR == 1 {print $2}')" PACKAGED_UUID="$(/usr/bin/dwarfdump --uuid "$APP_BINARY" | /usr/bin/awk 'NR == 1 {print $2}')" if [[ -z "$BUILD_UUID" || "$PACKAGED_UUID" != "$BUILD_UUID" ]]; then @@ -207,7 +226,10 @@ verify_window() { visual_verify_window() { if [[ -n "$VERIFY_SCENARIO" ]]; then - sleep 2.6 + for _ in {1..50}; do + [[ -s "$VERIFY_CAPTURE_PATH" ]] && break + sleep 0.2 + done fi local capture_path="$VERIFY_CAPTURE_PATH" if [[ ! -s "$capture_path" ]]; then From df86c88f0769a891094f398cd29c452c8211fbca Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 19:21:46 +0800 Subject: [PATCH 20/36] fix: make dormant content rails useful --- Sources/WeiBei/Stores/WorkspaceStore.swift | 13 + Sources/WeiBei/Views/ContentRailView.swift | 254 ++++++++++++++---- Sources/WeiBei/Views/ContentView.swift | 16 +- .../Views/StableDocumentWorkspace.swift | 2 +- Sources/WeiBeiCore/ContentRailPolicy.swift | 18 +- Sources/WeiBeiSelfCheck/main.swift | 24 +- design-qa.md | 6 + 7 files changed, 261 insertions(+), 72 deletions(-) diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index fc754711b..bbf965961 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -2096,6 +2096,7 @@ final class WorkspaceStore: ObservableObject { || scenario == "immersive-conversation-flow" || scenario == "notebook-creation-flow" || scenario == "pane-layout-stability-flow" + || scenario == "content-rail-dormant-preview" || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true if scenario == "pane-layout-stability-flow" { @@ -2154,6 +2155,18 @@ final class WorkspaceStore: ObservableObject { configureEmptyWorkspaceVerificationScenario(scenario) return } + if scenario == "content-rail-dormant-preview" { + layout = .documentAgentNotes + showLibrary = false + showReader = true + showAgent = true + showNotes = true + agentSurface = .hidden + select(itemID: "sample-html") + updateNote(ui("# 收起轨道验收\n\n悬浮简介必须越过收起边界显示。\n", "# Dormant rail check\n\nThe hover preview must cross the dormant pane boundary.\n")) + save() + return + } layout = scenario == "immersive-conversation-flow" ? .immersiveConversation : .documentAgentNotes if scenario == "notebook-creation-flow" { layout = .immersiveWriting diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index 942c4f3f2..b1fac2118 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -104,6 +104,11 @@ struct ContentRailView: View { var body: some View { GeometryReader { geometry in let height = compactHeight(in: geometry.size.height) + let previewIndex = previewID.flatMap { id in items.firstIndex(where: { $0.id == id }) } + let previewItem = previewIndex.map { items[$0] } + let previewAnchorY = previewIndex.map { + previewY(index: $0, railHeight: height, totalHeight: geometry.size.height) + } ?? compactCenterY(in: geometry.size.height) ZStack(alignment: .topLeading) { compactRail(height: height) .position( @@ -111,21 +116,24 @@ struct ContentRailView: View { y: compactCenterY(in: geometry.size.height) ) - if let previewID, - let previewIndex = items.firstIndex(where: { $0.id == previewID }), - let width = previewWidth(in: availableWidth ?? geometry.size.width) { - previewCard(for: items[previewIndex], width: width) - .position( - x: previewLeadingX + width / 2, - y: previewY( - index: previewIndex, - railHeight: height, - totalHeight: geometry.size.height - ) - ) - .allowsHitTesting(false) - .transition(.opacity.combined(with: .scale(scale: 0.98, anchor: .leading))) - .zIndex(20) + ContentRailFloatingPreviewBridge( + label: label, + item: isRailOnly ? previewItem : nil, + appearanceMode: appearanceMode, + width: ContentRailPolicy.dormantPreviewWidth + ) + .frame(width: 1, height: 1) + .position(x: previewLeadingX, y: previewAnchorY) + .allowsHitTesting(false) + + if !isRailOnly, let item = previewItem { + if let width = previewWidth(in: availableWidth ?? geometry.size.width) { + previewCard(for: item, width: width) + .position(x: previewLeadingX + width / 2, y: previewAnchorY) + .allowsHitTesting(false) + .transition(.opacity.combined(with: .scale(scale: 0.98, anchor: .leading))) + .zIndex(20) + } } } } @@ -150,6 +158,14 @@ struct ContentRailView: View { onHover(nil) } } + .task(id: "\(isRailOnly)-\(items.first?.id ?? "empty")") { + guard isRailOnly, + ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] == "content-rail-dormant-preview", + let first = items.first else { return } + try? await Task.sleep(nanoseconds: 500_000_000) + guard !Task.isCancelled else { return } + beginHover(first) + } } private var compactWidth: CGFloat { @@ -241,7 +257,8 @@ struct ContentRailView: View { private func previewWidth(in totalWidth: CGFloat) -> CGFloat? { ContentRailPolicy.previewWidth( totalWidth: totalWidth, - previewLeadingX: previewLeadingX + previewLeadingX: previewLeadingX, + isRailOnly: false ) } @@ -364,9 +381,75 @@ struct ContentRailView: View { } private func previewCard(for item: ContentRailItem, width: CGFloat) -> some View { + ContentRailPreviewCard( + label: label, + item: item, + appearanceMode: appearanceMode, + width: width + ) + } + + private func beginHover(_ item: ContentRailItem) { + previewCloseWork?.cancel() + hoveredID = item.id + + guard previewID != item.id else { + onHover(item) + return + } + + withAnimation(WeiBeiMotion.hover) { + previewID = item.id + } + onHover(item) + } + + private func endHover(_ item: ContentRailItem) { + if hoveredID == item.id { + hoveredID = nil + } + schedulePreviewClose() + } + + private func schedulePreviewClose() { + previewCloseWork?.cancel() + let work = DispatchWorkItem { + guard hoveredID == nil else { return } + closePreview(immediately: false) + } + previewCloseWork = work + DispatchQueue.main.asyncAfter(deadline: .now() + 0.15, execute: work) + } + + private func closePreview(immediately: Bool) { + previewCloseWork?.cancel() + hoveredID = nil + if immediately { + previewID = nil + } else { + withAnimation(WeiBeiMotion.hover) { + previewID = nil + } + } + onHover(nil) + } + + private func activate(_ item: ContentRailItem) { + closePreview(immediately: true) + onActivate(item) + } +} + +private struct ContentRailPreviewCard: View { + let label: String + let item: ContentRailItem + let appearanceMode: WeiBeiAppearanceMode + let width: CGFloat + + var body: some View { let showsPreviewImage = item.previewImage != nil && width >= ContentRailPolicy.previewImageMinimumWidth - return HStack(alignment: .top, spacing: showsPreviewImage ? 12 : 0) { + HStack(alignment: .top, spacing: showsPreviewImage ? 12 : 0) { if showsPreviewImage, let image = item.previewImage { Image(nsImage: image) .resizable() @@ -419,54 +502,119 @@ struct ContentRailView: View { .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode == .inkstone ? 0.22 : 0.08), radius: 8, y: 4) .accessibilityHidden(true) } +} - private func beginHover(_ item: ContentRailItem) { - previewCloseWork?.cancel() - hoveredID = item.id - - guard previewID != item.id else { - onHover(item) - return - } +/// The dormant pane is only 40pt wide, so its preview cannot live inside that pane's +/// clipped host. This bridge places the same SwiftUI card in the existing window root. +private struct ContentRailFloatingPreviewBridge: NSViewRepresentable { + let label: String + let item: ContentRailItem? + let appearanceMode: WeiBeiAppearanceMode + let width: CGFloat - withAnimation(WeiBeiMotion.hover) { - previewID = item.id - } - onHover(item) + func makeCoordinator() -> Coordinator { + Coordinator() } - private func endHover(_ item: ContentRailItem) { - if hoveredID == item.id { - hoveredID = nil - } - schedulePreviewClose() + func makeNSView(context: Context) -> NSView { + NSView(frame: .zero) } - private func schedulePreviewClose() { - previewCloseWork?.cancel() - let work = DispatchWorkItem { - guard hoveredID == nil else { return } - closePreview(immediately: false) + func updateNSView(_ anchorView: NSView, context: Context) { + guard let item else { + context.coordinator.dismiss() + return } - previewCloseWork = work - DispatchQueue.main.asyncAfter(deadline: .now() + 0.15, execute: work) + context.coordinator.update( + anchorView: anchorView, + label: label, + item: item, + appearanceMode: appearanceMode, + width: width + ) } - private func closePreview(immediately: Bool) { - previewCloseWork?.cancel() - hoveredID = nil - if immediately { - previewID = nil - } else { - withAnimation(WeiBeiMotion.hover) { - previewID = nil + static func dismantleNSView(_ nsView: NSView, coordinator: Coordinator) { + coordinator.dismiss() + } + + final class Coordinator { + private var hostingView: ContentRailPassthroughHostingView? + private weak var containerView: NSView? + private var updateGeneration = 0 + + func update( + anchorView: NSView, + label: String, + item: ContentRailItem, + appearanceMode: WeiBeiAppearanceMode, + width: CGFloat + ) { + updateGeneration += 1 + let generation = updateGeneration + DispatchQueue.main.async { [weak self, weak anchorView] in + guard let self, let anchorView, generation == self.updateGeneration, + let contentView = anchorView.window?.contentView, + let container = contentView.superview else { return } + + let card = AnyView( + ContentRailPreviewCard( + label: label, + item: item, + appearanceMode: appearanceMode, + width: width + ) + .preferredColorScheme(appearanceMode.colorScheme) + ) + let hosting: ContentRailPassthroughHostingView + if let existing = self.hostingView { + existing.rootView = card + hosting = existing + } else { + hosting = ContentRailPassthroughHostingView(rootView: card) + hosting.wantsLayer = true + hosting.layer?.backgroundColor = NSColor.clear.cgColor + hosting.layer?.zPosition = 1_000 + self.hostingView = hosting + } + + if hosting.superview !== container { + hosting.removeFromSuperview() + container.addSubview(hosting, positioned: .above, relativeTo: contentView) + self.containerView = container + } + + hosting.frame.size = NSSize(width: width, height: max(132, hosting.fittingSize.height)) + let anchorCenter = anchorView.convert( + NSPoint(x: anchorView.bounds.midX, y: anchorView.bounds.midY), + to: container + ) + let inset: CGFloat = 8 + let proposedX = anchorCenter.x + 4 + let maximumX = max(inset, container.bounds.maxX - hosting.frame.width - inset) + let x = min(max(proposedX, inset), maximumX) + let proposedY = anchorCenter.y - hosting.frame.height / 2 + let maximumY = max(inset, container.bounds.maxY - hosting.frame.height - inset) + let y = min(max(proposedY, inset), maximumY) + hosting.frame.origin = NSPoint(x: x, y: y) } } - onHover(nil) + + func dismiss() { + updateGeneration += 1 + hostingView?.removeFromSuperview() + hostingView = nil + containerView = nil + } } +} - private func activate(_ item: ContentRailItem) { - closePreview(immediately: true) - onActivate(item) +private final class ContentRailPassthroughHostingView: NSHostingView<AnyView> { + override func hitTest(_ point: NSPoint) -> NSView? { + nil + } + + override var mouseDownCanMoveWindow: Bool { + false } } diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index 20422f89a..f61b478c5 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -768,11 +768,21 @@ private struct LayoutContentView: View { } private var firstSplit: Binding<CGFloat> { - numericBinding($firstSplitStorage) + if Self.isDormantRailPreviewVerification { + return .constant(0.035) + } + return numericBinding($firstSplitStorage) } private var secondSplit: Binding<CGFloat> { - numericBinding($secondSplitStorage) + if Self.isDormantRailPreviewVerification { + return .constant(0.55) + } + return numericBinding($secondSplitStorage) + } + + private static var isDormantRailPreviewVerification: Bool { + ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] == "content-rail-dormant-preview" } private var halfSplit: Binding<CGFloat> { @@ -1721,7 +1731,7 @@ private final class NativeSplitCoordinator: NSObject, NSSplitViewDelegate { let widths = splitView.arrangedSubviews.map(\.frame.width) guard widths.count >= 2 else { return } - let snapIndices = widths.indices.filter { widths[$0] < railSnapThreshold } + let snapIndices = widths.indices.filter { widths[$0] <= railSnapThreshold } guard snapIndices.contains(where: { abs(widths[$0] - railWidth) > 0.5 }) else { return } var targetWidths = widths diff --git a/Sources/WeiBei/Views/StableDocumentWorkspace.swift b/Sources/WeiBei/Views/StableDocumentWorkspace.swift index 97eb717c3..500127b35 100644 --- a/Sources/WeiBei/Views/StableDocumentWorkspace.swift +++ b/Sources/WeiBei/Views/StableDocumentWorkspace.swift @@ -748,7 +748,7 @@ final class StableDocumentSplitCoordinator { private func snappedWidths(_ widths: [CGFloat]) -> [CGFloat] { guard widths.count >= 2 else { return widths } - let snapIndices = widths.indices.filter { widths[$0] < railSnapThreshold } + let snapIndices = widths.indices.filter { widths[$0] <= railSnapThreshold } guard !snapIndices.isEmpty else { return widths } var target = widths for index in snapIndices { diff --git a/Sources/WeiBeiCore/ContentRailPolicy.swift b/Sources/WeiBeiCore/ContentRailPolicy.swift index cc3ecb41e..a49c73b63 100644 --- a/Sources/WeiBeiCore/ContentRailPolicy.swift +++ b/Sources/WeiBeiCore/ContentRailPolicy.swift @@ -8,29 +8,33 @@ public enum ContentRailPresentation: Equatable, Sendable { public enum ContentRailPolicy { /// The rail is the pane's entire dormant surface, not an additional sidebar. public static let dormantWidth: CGFloat = 40 - /// At 190pt the 40pt rail plus a compact 140pt text preview and insets fit without overlap. - public static let railOnlyThreshold: CGFloat = 190 - public static let snapThreshold: CGFloat = 190 + /// A short end-stop makes the dormant state discoverable without hijacking useful narrow widths. + public static let magneticSnapDistance: CGFloat = 12 + public static let railOnlyThreshold: CGFloat = dormantWidth + magneticSnapDistance + public static let snapThreshold: CGFloat = railOnlyThreshold public static let readableWidth: CGFloat = 240 public static let defaultReadableWidth: CGFloat = 420 public static let previewMinimumWidth: CGFloat = 140 public static let previewMaximumWidth: CGFloat = 360 + public static let dormantPreviewWidth: CGFloat = 280 public static let previewImageMinimumWidth: CGFloat = 240 public static func presentation( availableWidth: CGFloat, allowsRailOnly: Bool ) -> ContentRailPresentation { - // Deliberately expose two stable states. Intermediate widths are drag-time geometry, - // never a third persistent presentation callers need to understand. - allowsRailOnly && availableWidth < railOnlyThreshold ? .railOnly : .content + allowsRailOnly && availableWidth <= railOnlyThreshold ? .railOnly : .content } public static func previewWidth( totalWidth: CGFloat, previewLeadingX: CGFloat, - trailingInset: CGFloat = 8 + trailingInset: CGFloat = 8, + isRailOnly: Bool = false ) -> CGFloat? { + if isRailOnly { + return dormantPreviewWidth + } let available = totalWidth - previewLeadingX - trailingInset guard available >= previewMinimumWidth else { return nil } return min(previewMaximumWidth, available) diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 1eeb0b19c..11bfd1a85 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -930,16 +930,19 @@ let contentRailGeometrySource: String = { return String(contentRailSource[start..<end]) }() expect(ContentRailPolicy.dormantWidth == 40 - && ContentRailPolicy.snapThreshold == ContentRailPolicy.railOnlyThreshold + && ContentRailPolicy.magneticSnapDistance == 12 + && ContentRailPolicy.snapThreshold == ContentRailPolicy.dormantWidth + ContentRailPolicy.magneticSnapDistance && ContentRailPolicy.presentation(availableWidth: 40, allowsRailOnly: true) == .railOnly - && ContentRailPolicy.presentation(availableWidth: 189, allowsRailOnly: true) == .railOnly - && ContentRailPolicy.presentation(availableWidth: 190, allowsRailOnly: true) == .content + && ContentRailPolicy.presentation(availableWidth: 52, allowsRailOnly: true) == .railOnly + && ContentRailPolicy.presentation(availableWidth: 53, allowsRailOnly: true) == .content + && ContentRailPolicy.presentation(availableWidth: 189, allowsRailOnly: true) == .content && ContentRailPolicy.presentation(availableWidth: 40, allowsRailOnly: false) == .content, - "content rail policy exposes only a 40pt dormant state and a readable content state") -expect(ContentRailPolicy.previewWidth(totalWidth: 178, previewLeadingX: 39) == nil - && ContentRailPolicy.previewWidth(totalWidth: 190, previewLeadingX: 39) == 143 + "content rail policy preserves user-chosen narrow widths and reserves snapping for the final 12pt magnetic zone") +expect(ContentRailPolicy.previewWidth(totalWidth: 40, previewLeadingX: 39, isRailOnly: true) == 280 + && ContentRailPolicy.previewWidth(totalWidth: 178, previewLeadingX: 39, isRailOnly: false) == nil + && ContentRailPolicy.previewWidth(totalWidth: 190, previewLeadingX: 39, isRailOnly: false) == 143 && ContentRailPolicy.previewWidth(totalWidth: 520, previewLeadingX: 39) == 360, - "content rail preview policy removes the no-preview intermediate range and caps wide previews") + "collapsed rails always provide a compact floating preview while readable panes keep previews inside available space") expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("static let normalWidth: CGFloat = ContentRailPolicy.dormantWidth") && contentRailSource.contains("static let railOnlyWidth: CGFloat = normalWidth") @@ -979,9 +982,14 @@ expect(contentRailSource.contains("struct ContentRailView: View") && !contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") && contentRailSource.contains("previewID = item.id") && contentRailSource.contains("previewImage: NSImage?") - && contentRailSource.contains("x: previewLeadingX + width / 2") + && contentRailSource.contains(".position(x: previewLeadingX + width / 2") && contentRailSource.contains("tickLeadingInset + ContentRailWaveMetrics.peakLength + 8") && contentRailSource.contains("ContentRailPolicy.previewWidth(") + && contentRailSource.contains("ContentRailFloatingPreviewBridge(") + && contentRailSource.contains("anchorView.window?.contentView") + && contentRailSource.contains("container.addSubview(hosting, positioned: .above") + && contentRailSource.contains("ContentRailPassthroughHostingView") + && contentRailSource.contains("override func hitTest(_ point: NSPoint) -> NSView?") && !contentRailSource.contains("guard !isRailOnly else { return nil }") && contentRailSource.contains("width >= ContentRailPolicy.previewImageMinimumWidth") && contentRailSource.contains(".allowsHitTesting(false)") diff --git a/design-qa.md b/design-qa.md index beb5ec2d1..0e6f284a4 100644 --- a/design-qa.md +++ b/design-qa.md @@ -68,3 +68,9 @@ final result: passed - P3: the runtime greeting differs from the reference because it follows the actual time of day; this is expected behavior. final result: passed +### 2026-07-11:收起轨道改为末端吸附并保留简介 + +- 分栏不再在 190pt 自动收起;用户拖到 53pt 以上时保留其实际宽度。 +- 仅最后 12pt(40–52pt)作为可感知的磁吸区,松手后收成 40pt 轨道。 +- 40pt 收起态悬浮仍显示 280pt 简介浮层;浮层越过分栏边界但不改宽、不抢焦点,点击沿用原有“恢复并跳转”行为。 +- 新增 `content-rail-dormant-preview` 隔离验收场景,真实截图确认轨道、简介与相邻分栏无裁切或挤压。 From 408c1d0af7b2368918f4d64ff0ec5fe7a2cb2e97 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sat, 11 Jul 2026 19:42:07 +0800 Subject: [PATCH 21/36] fix: tighten dormant rail restoration --- Sources/WeiBei/Stores/WorkspaceStore.swift | 3 ++- Sources/WeiBei/Views/ContentRailView.swift | 20 +++++++++++--- Sources/WeiBei/Views/ContentView.swift | 7 ++--- .../Views/StableDocumentWorkspace.swift | 2 +- Sources/WeiBeiCore/ContentRailPolicy.swift | 14 ++++++++-- Sources/WeiBeiSelfCheck/main.swift | 27 ++++++++++++------- design-qa.md | 6 +++++ 7 files changed, 59 insertions(+), 20 deletions(-) diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index bbf965961..59f879a0d 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -2097,6 +2097,7 @@ final class WorkspaceStore: ObservableObject { || scenario == "notebook-creation-flow" || scenario == "pane-layout-stability-flow" || scenario == "content-rail-dormant-preview" + || scenario == "content-rail-activation-preview" || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true if scenario == "pane-layout-stability-flow" { @@ -2155,7 +2156,7 @@ final class WorkspaceStore: ObservableObject { configureEmptyWorkspaceVerificationScenario(scenario) return } - if scenario == "content-rail-dormant-preview" { + if scenario == "content-rail-dormant-preview" || scenario == "content-rail-activation-preview" { layout = .documentAgentNotes showLibrary = false showReader = true diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift index b1fac2118..39beac351 100644 --- a/Sources/WeiBei/Views/ContentRailView.swift +++ b/Sources/WeiBei/Views/ContentRailView.swift @@ -123,7 +123,7 @@ struct ContentRailView: View { width: ContentRailPolicy.dormantPreviewWidth ) .frame(width: 1, height: 1) - .position(x: previewLeadingX, y: previewAnchorY) + .position(x: floatingPreviewAnchorX, y: previewAnchorY) .allowsHitTesting(false) if !isRailOnly, let item = previewItem { @@ -159,12 +159,17 @@ struct ContentRailView: View { } } .task(id: "\(isRailOnly)-\(items.first?.id ?? "empty")") { + let verificationScenario = ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] guard isRailOnly, - ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] == "content-rail-dormant-preview", + verificationScenario == "content-rail-dormant-preview" || verificationScenario == "content-rail-activation-preview", let first = items.first else { return } - try? await Task.sleep(nanoseconds: 500_000_000) + try? await Task.sleep(nanoseconds: 50_000_000) guard !Task.isCancelled else { return } - beginHover(first) + if verificationScenario == "content-rail-activation-preview" { + activate(first) + } else { + beginHover(first) + } } } @@ -184,6 +189,10 @@ struct ContentRailView: View { tickLeadingInset + ContentRailWaveMetrics.peakLength + 8 } + private var floatingPreviewAnchorX: CGFloat { + max(1, compactWidth - 1) + } + private var resolvedActiveID: String? { activeID ?? items.first?.id } @@ -412,6 +421,9 @@ struct ContentRailView: View { } private func schedulePreviewClose() { + if ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] == "content-rail-dormant-preview" { + return + } previewCloseWork?.cancel() let work = DispatchWorkItem { guard hoveredID == nil else { return } diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index f61b478c5..872a5f9b4 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -769,7 +769,7 @@ private struct LayoutContentView: View { private var firstSplit: Binding<CGFloat> { if Self.isDormantRailPreviewVerification { - return .constant(0.035) + return .constant(0.02) } return numericBinding($firstSplitStorage) } @@ -782,7 +782,8 @@ private struct LayoutContentView: View { } private static var isDormantRailPreviewVerification: Bool { - ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] == "content-rail-dormant-preview" + let scenario = ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] + return scenario == "content-rail-dormant-preview" || scenario == "content-rail-activation-preview" } private var halfSplit: Binding<CGFloat> { @@ -1772,7 +1773,7 @@ private final class NativeSplitCoordinator: NSObject, NSSplitViewDelegate { partial + (minimums[safe: index] ?? railWidth) } let requestedMinimum = minimums[safe: requestedIndex] ?? railWidth - let desiredWidth = max(recentReadableWidths[role] ?? defaultReadableWidth, readableWidthThreshold) + let desiredWidth = ContentRailPolicy.expansionWidth(recentWidth: recentReadableWidths[role]) let requestedWidth = clamped( desiredWidth, min: requestedMinimum, diff --git a/Sources/WeiBei/Views/StableDocumentWorkspace.swift b/Sources/WeiBei/Views/StableDocumentWorkspace.swift index 500127b35..cb4e2e0d7 100644 --- a/Sources/WeiBei/Views/StableDocumentWorkspace.swift +++ b/Sources/WeiBei/Views/StableDocumentWorkspace.swift @@ -852,7 +852,7 @@ final class StableDocumentSplitCoordinator { let minimum = minimumPaneWidth(total: total, count: widths.count) let maxRequested = max(minimum, total - minimum * CGFloat(widths.count - 1)) let requested = clamped( - max(recentReadableWidths[role] ?? defaultReadableWidth, readableWidthThreshold), + ContentRailPolicy.expansionWidth(recentWidth: recentReadableWidths[role]), min: minimum, max: maxRequested ) diff --git a/Sources/WeiBeiCore/ContentRailPolicy.swift b/Sources/WeiBeiCore/ContentRailPolicy.swift index a49c73b63..fe7d8267f 100644 --- a/Sources/WeiBeiCore/ContentRailPolicy.swift +++ b/Sources/WeiBeiCore/ContentRailPolicy.swift @@ -7,13 +7,16 @@ public enum ContentRailPresentation: Equatable, Sendable { public enum ContentRailPolicy { /// The rail is the pane's entire dormant surface, not an additional sidebar. - public static let dormantWidth: CGFloat = 40 + public static let dormantWidth: CGFloat = 28 /// A short end-stop makes the dormant state discoverable without hijacking useful narrow widths. - public static let magneticSnapDistance: CGFloat = 12 + public static let magneticSnapDistance: CGFloat = 10 public static let railOnlyThreshold: CGFloat = dormantWidth + magneticSnapDistance public static let snapThreshold: CGFloat = railOnlyThreshold public static let readableWidth: CGFloat = 240 public static let defaultReadableWidth: CGFloat = 420 + public static let expansionMinimumWidth: CGFloat = 300 + public static let expansionPreferredWidth: CGFloat = 340 + public static let expansionMaximumWidth: CGFloat = 380 public static let previewMinimumWidth: CGFloat = 140 public static let previewMaximumWidth: CGFloat = 360 public static let dormantPreviewWidth: CGFloat = 280 @@ -26,6 +29,13 @@ public enum ContentRailPolicy { allowsRailOnly && availableWidth <= railOnlyThreshold ? .railOnly : .content } + public static func expansionWidth(recentWidth: CGFloat?) -> CGFloat { + min( + expansionMaximumWidth, + max(expansionMinimumWidth, recentWidth ?? expansionPreferredWidth) + ) + } + public static func previewWidth( totalWidth: CGFloat, previewLeadingX: CGFloat, diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 11bfd1a85..3bc5f560c 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -929,16 +929,21 @@ let contentRailGeometrySource: String = { } return String(contentRailSource[start..<end]) }() -expect(ContentRailPolicy.dormantWidth == 40 - && ContentRailPolicy.magneticSnapDistance == 12 +expect(ContentRailPolicy.dormantWidth == 28 + && ContentRailPolicy.magneticSnapDistance == 10 && ContentRailPolicy.snapThreshold == ContentRailPolicy.dormantWidth + ContentRailPolicy.magneticSnapDistance - && ContentRailPolicy.presentation(availableWidth: 40, allowsRailOnly: true) == .railOnly - && ContentRailPolicy.presentation(availableWidth: 52, allowsRailOnly: true) == .railOnly - && ContentRailPolicy.presentation(availableWidth: 53, allowsRailOnly: true) == .content + && ContentRailPolicy.presentation(availableWidth: 28, allowsRailOnly: true) == .railOnly + && ContentRailPolicy.presentation(availableWidth: 38, allowsRailOnly: true) == .railOnly + && ContentRailPolicy.presentation(availableWidth: 39, allowsRailOnly: true) == .content && ContentRailPolicy.presentation(availableWidth: 189, allowsRailOnly: true) == .content - && ContentRailPolicy.presentation(availableWidth: 40, allowsRailOnly: false) == .content, - "content rail policy preserves user-chosen narrow widths and reserves snapping for the final 12pt magnetic zone") -expect(ContentRailPolicy.previewWidth(totalWidth: 40, previewLeadingX: 39, isRailOnly: true) == 280 + && ContentRailPolicy.presentation(availableWidth: 28, allowsRailOnly: false) == .content, + "content rail policy preserves user-chosen narrow widths and reserves snapping for a compact 28pt rail") +expect(ContentRailPolicy.expansionWidth(recentWidth: nil) == 340 + && ContentRailPolicy.expansionWidth(recentWidth: 250) == 300 + && ContentRailPolicy.expansionWidth(recentWidth: 350) == 350 + && ContentRailPolicy.expansionWidth(recentWidth: 720) == 380, + "activating a dormant rail restores a comfortable bounded pane width") +expect(ContentRailPolicy.previewWidth(totalWidth: 28, previewLeadingX: 39, isRailOnly: true) == 280 && ContentRailPolicy.previewWidth(totalWidth: 178, previewLeadingX: 39, isRailOnly: false) == nil && ContentRailPolicy.previewWidth(totalWidth: 190, previewLeadingX: 39, isRailOnly: false) == 143 && ContentRailPolicy.previewWidth(totalWidth: 520, previewLeadingX: 39) == 360, @@ -984,6 +989,8 @@ expect(contentRailSource.contains("struct ContentRailView: View") && contentRailSource.contains("previewImage: NSImage?") && contentRailSource.contains(".position(x: previewLeadingX + width / 2") && contentRailSource.contains("tickLeadingInset + ContentRailWaveMetrics.peakLength + 8") + && contentRailSource.contains("max(1, compactWidth - 1)") + && contentRailSource.contains(".position(x: floatingPreviewAnchorX") && contentRailSource.contains("ContentRailPolicy.previewWidth(") && contentRailSource.contains("ContentRailFloatingPreviewBridge(") && contentRailSource.contains("anchorView.window?.contentView") @@ -1128,7 +1135,9 @@ expect(contentViewSource.contains("minimumContentWidthWithLibrary"), "library le expect(contentViewSource.contains("private let railWidth = ContentRailMetrics.railOnlyWidth") && contentRailSource.contains("static let snapThreshold = ContentRailPolicy.snapThreshold") && contentRailSource.contains("static let readableWidth = ContentRailPolicy.readableWidth") - && contentViewSource.contains("handleExpansionRequest(store.paneExpansionRequest"), "normal multi-pane layouts snap to a restorable 40pt content rail state") + && contentViewSource.contains("ContentRailPolicy.expansionWidth(recentWidth:") + && stableDocumentSource.contains("ContentRailPolicy.expansionWidth(recentWidth:") + && contentViewSource.contains("handleExpansionRequest(store.paneExpansionRequest"), "normal multi-pane layouts snap to a compact 28pt rail and restore to a bounded reading width") expect(!contentViewSource.contains("DragGesture()"), "content panes avoid SwiftUI drag resizing") expect(!contentViewSource.contains(".id(store.layout)"), "layout changes avoid whole-screen identity resets") expect(!contentViewSource.contains("PaneSeparator"), "content panes avoid hand-drawn split separators") diff --git a/design-qa.md b/design-qa.md index 0e6f284a4..3e1fe3ca3 100644 --- a/design-qa.md +++ b/design-qa.md @@ -68,6 +68,12 @@ final result: passed - P3: the runtime greeting differs from the reference because it follows the actual time of day; this is expected behavior. final result: passed +### 2026-07-11:收起轨道缩至真实休眠尺寸 + +- 休眠轨道从 40pt 缩至 28pt,磁吸区同步收窄为最后 10pt,减少对阅读面积的占用。 +- 点击轨道节点时,恢复宽度限制在 300–380pt;没有可用历史宽度时使用 340pt,避免恢复成过宽或过窄面板。 +- 历史宽度只在舒适区内原样恢复,超出区间时取最近边界;内容、选区与滚动位置仍沿用原有状态。 + ### 2026-07-11:收起轨道改为末端吸附并保留简介 - 分栏不再在 190pt 自动收起;用户拖到 53pt 以上时保留其实际宽度。 From 5b4fd5a3f474c5957b0ec576294eae9f86264b63 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Sun, 12 Jul 2026 02:57:28 +0800 Subject: [PATCH 22/36] feat: unify note sources and restore pure writing --- Sources/WeiBei/App/WeiBeiApp.swift | 80 +- Sources/WeiBei/Stores/WorkspaceStore.swift | 834 ++++++++++++++++-- .../Support/PaneContinuityRecorder.swift | 82 +- Sources/WeiBei/Views/CommandPaletteView.swift | 4 +- Sources/WeiBei/Views/ContentView.swift | 184 +--- Sources/WeiBei/Views/LinkedSourcesView.swift | 186 ++++ Sources/WeiBei/Views/NotesAgentView.swift | 279 ++---- Sources/WeiBei/Views/ReaderView.swift | 358 ++++++-- Sources/WeiBei/Views/SidebarView.swift | 8 +- .../Views/StableDocumentWorkspace.swift | 64 +- .../CourseDocumentSearchIndex.swift | 78 +- Sources/WeiBeiCore/NoteSourceRelations.swift | 71 ++ Sources/WeiBeiCore/WorkspaceModels.swift | 8 +- Sources/WeiBeiSelfCheck/main.swift | 323 ++++--- script/build_and_run.sh | 266 +++++- 15 files changed, 2127 insertions(+), 698 deletions(-) create mode 100644 Sources/WeiBei/Views/LinkedSourcesView.swift create mode 100644 Sources/WeiBeiCore/NoteSourceRelations.swift diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index 51866099a..1d1f48514 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -1,5 +1,6 @@ import AppKit import SwiftUI +import WebKit import WeiBeiCore @MainActor private let sharedWorkspaceStore = WorkspaceStore() @@ -92,7 +93,7 @@ struct WeiBeiApp: App { Divider() - Button(store.ui("聚焦课程目录", "Focus Course Index")) { animateLayout { store.focus(.library) } } + Button(store.ui("聚焦资料库", "Focus Library")) { animateLayout { store.focus(.library) } } .keyboardShortcut("1") Button(store.ui("聚焦阅读", "Focus Reader")) { animateLayout { store.focus(.reader) } } .keyboardShortcut("2") @@ -110,7 +111,7 @@ struct WeiBeiApp: App { Divider() - Button(store.showLibrary ? store.ui("收起课程目录", "Hide Course Index") : store.ui("打开课程目录", "Show Course Index")) { + Button(store.showLibrary ? store.ui("收起资料库", "Hide Library") : store.ui("打开资料库", "Show Library")) { animateLayout { store.toggleLibrary() } @@ -370,7 +371,8 @@ private struct WindowChromeConfigurator: NSViewRepresentable { !capturePath.isEmpty, Self.scheduledVerificationCaptures.insert(capturePath).inserted else { return } - if ["pi-learning-flow", "pi-course-memory-flow"].contains(environment["WEIBEI_VERIFY_SCENARIO"]), + let scenario = environment["WEIBEI_VERIFY_SCENARIO"] ?? "" + if ["pi-learning-flow", "pi-course-memory-flow", "pane-toggle-continuity-flow", "reader-scroll-persistence-flow"].contains(scenario), let workspaceDirectory = environment["WEIBEI_WORKSPACE_DIR"] { let stateURL = URL(fileURLWithPath: workspaceDirectory) .appendingPathComponent("verification-state.txt") @@ -378,7 +380,7 @@ private struct WindowChromeConfigurator: NSViewRepresentable { in: window, capturePath: capturePath, stateURL: stateURL, - remainingAttempts: 600 + remainingAttempts: scenario == "pane-toggle-continuity-flow" ? 1_800 : 600 ) return } @@ -422,8 +424,70 @@ private struct WindowChromeConfigurator: NSViewRepresentable { bounds.height >= 400, let bitmap = contentView.bitmapImageRepForCachingDisplay(in: bounds) else { return } contentView.cacheDisplay(in: bounds, to: bitmap) - guard let png = bitmap.representation(using: .png, properties: [:]) else { return } - try? png.write(to: URL(fileURLWithPath: capturePath), options: .atomic) + let baseImage = NSImage(size: bounds.size) + baseImage.addRepresentation(bitmap) + let webViews = visibleWebViews(in: contentView) + captureWebViews(webViews, at: 0, relativeTo: contentView, overlays: []) { overlays in + let composite = NSImage(size: bounds.size) + composite.lockFocus() + baseImage.draw(in: bounds) + for overlay in overlays { + overlay.image.draw(in: overlay.rect, from: .zero, operation: .copy, fraction: 1) + } + composite.unlockFocus() + guard let tiff = composite.tiffRepresentation, + let representation = NSBitmapImageRep(data: tiff), + let png = representation.representation(using: .png, properties: [:]) else { return } + try? png.write(to: URL(fileURLWithPath: capturePath), options: .atomic) + } + } + + private struct WebViewSnapshot { + var rect: NSRect + var image: NSImage + } + + private static func visibleWebViews(in view: NSView) -> [WKWebView] { + view.subviews.flatMap { child -> [WKWebView] in + var matches = child.isHidden ? [] : visibleWebViews(in: child) + if let webView = child as? WKWebView, !webView.isHidden, webView.window != nil { + matches.insert(webView, at: 0) + } + return matches + } + } + + private static func captureWebViews( + _ webViews: [WKWebView], + at index: Int, + relativeTo contentView: NSView, + overlays: [WebViewSnapshot], + completion: @escaping ([WebViewSnapshot]) -> Void + ) { + guard webViews.indices.contains(index) else { + completion(overlays) + return + } + let webView = webViews[index] + let converted = webView.convert(webView.bounds, to: contentView) + let rect = contentView.isFlipped + ? NSRect(x: converted.minX, y: contentView.bounds.height - converted.maxY, width: converted.width, height: converted.height) + : converted + webView.takeSnapshot(with: nil) { image, _ in + DispatchQueue.main.async { + var nextOverlays = overlays + if let image, rect.width > 1, rect.height > 1 { + nextOverlays.append(WebViewSnapshot(rect: rect, image: image)) + } + captureWebViews( + webViews, + at: index + 1, + relativeTo: contentView, + overlays: nextOverlays, + completion: completion + ) + } + } } } @@ -1033,7 +1097,7 @@ struct SettingsView: View { private var shortcutRows: [(String, String, String)] { [ (store.ui("命令面板", "Command Palette"), "⌘K", store.ui("搜索并执行魏碑动作。", "Search and run WeiBei actions.")), - (store.ui("课程目录", "Course Index"), "⌘B", store.ui("打开或收起课程目录。", "Show or hide the course index.")), + (store.ui("资料库", "Library"), "⌘B", store.ui("打开或收起资料库。", "Show or hide the library.")), (store.ui("资料内搜索", "Search in Material"), "⌘F", store.ui("搜索当前打开的资料。", "Search the current material.")), (store.ui("聚焦阅读", "Focus Reader"), "⌘2", store.ui("把键盘焦点交给阅读区。", "Move keyboard focus to the reader.")), (store.ui("聚焦笔记", "Focus Notes"), "⌘3", store.ui("把键盘焦点交给笔记区。", "Move keyboard focus to notes.")), @@ -1044,7 +1108,7 @@ struct SettingsView: View { private var dataSettings: some View { VStack(alignment: .leading, spacing: 16) { - settingsGroup(store.ui("课程目录", "Course Index")) { + settingsGroup(store.ui("资料库", "Library")) { settingsRow( title: store.ui("导入资料", "Import Material"), detail: store.ui("导入 HTML、PDF、Markdown 或文本文件。", "Import HTML, PDF, Markdown, or text files.") diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 1c598e553..d28165525 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -34,6 +34,120 @@ struct PaneExpansionRequest: Equatable { let role: WorkspacePaneRole } +enum PaneToggleContinuityVerifier { + private(set) static var isMeasuring = false + private(set) static var htmlEventSequence = 0 + private(set) static var htmlSectionEventCount = 0 + private(set) static var htmlActiveEventCount = 0 + private(set) static var htmlLocationCallCount = 0 + private(set) static var htmlLocationCommitCount = 0 + private(set) static var htmlLocationReasons: [String: Int] = [:] + private(set) static var webReaderMakeCount = 0 + private(set) static var webReaderDismantleCount = 0 + private(set) static var pdfReaderMakeCount = 0 + private(set) static var pdfReaderDismantleCount = 0 + private(set) static var noteEditorMakeCount = 0 + private(set) static var noteEditorDismantleCount = 0 + private(set) static var verificationScrollScheduleCount = 0 + private(set) static var verificationScrollResult = "" + + static var isEnabled: Bool { + let scenario = ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] + return scenario == "pane-toggle-continuity-flow" + || scenario == "pane-layout-stability-flow" + || scenario == "pane-reorder-width-flow" + || scenario == "reader-scroll-persistence-flow" + } + + static func beginMeasurement() { + guard isEnabled else { return } + isMeasuring = true + htmlSectionEventCount = 0 + htmlActiveEventCount = 0 + htmlLocationCallCount = 0 + htmlLocationCommitCount = 0 + htmlLocationReasons = [:] + webReaderMakeCount = 0 + webReaderDismantleCount = 0 + pdfReaderMakeCount = 0 + pdfReaderDismantleCount = 0 + noteEditorMakeCount = 0 + noteEditorDismantleCount = 0 + verificationScrollScheduleCount = 0 + verificationScrollResult = "" + } + + static func endMeasurement() { + guard isEnabled else { return } + isMeasuring = false + } + + static func recordHTMLActiveEvent(reason: String) { + guard isEnabled else { return } + htmlEventSequence += 1 + if isMeasuring { + htmlActiveEventCount += 1 + } + } + + static func recordHTMLSectionEvent(count: Int) { + guard isEnabled else { return } + htmlEventSequence += 1 + if isMeasuring { htmlSectionEventCount += 1 } + } + + static func recordHTMLLocationCall(reason: String) { + guard isMeasuring else { return } + htmlLocationCallCount += 1 + htmlLocationReasons[reason, default: 0] += 1 + } + + static func recordHTMLLocationCommit(reason: String) { + guard isMeasuring else { return } + htmlLocationCommitCount += 1 + } + + static func recordWebReaderMake() { + guard isEnabled else { return } + if isMeasuring { webReaderMakeCount += 1 } + } + + static func recordWebReaderDismantle() { + guard isEnabled else { return } + if isMeasuring { webReaderDismantleCount += 1 } + } + + static func recordNoteEditorMake() { + guard isEnabled else { return } + if isMeasuring { noteEditorMakeCount += 1 } + } + + static func recordPDFReaderMake() { + guard isEnabled else { return } + if isMeasuring { pdfReaderMakeCount += 1 } + } + + static func recordPDFReaderDismantle() { + guard isEnabled else { return } + if isMeasuring { pdfReaderDismantleCount += 1 } + } + + static func recordNoteEditorDismantle() { + guard isEnabled else { return } + if isMeasuring { noteEditorDismantleCount += 1 } + } + + static func recordVerificationScrollScheduled() { + guard isEnabled else { return } + verificationScrollScheduleCount += 1 + } + + static func recordVerificationScrollResult(_ result: String) { + guard isEnabled else { return } + verificationScrollResult = result + } +} + @MainActor final class WorkspaceStore: ObservableObject { @Published var importedItems: [StudyItem] = [] @@ -48,7 +162,8 @@ final class WorkspaceStore: ObservableObject { @Published private(set) var latestAgentNoteProposal: StudyAgentNoteProposal? @Published private(set) var latestAgentLearningUpdate: StudyAgentLearningUpdate? @Published private(set) var noteSourceLinks: [NoteSourceLink] = [] - @Published private(set) var studyLocationsByItemID: [String: StudyLocation] = [:] + @Published var linkedSourcesPresented = false + private(set) var studyLocationsByItemID: [String: StudyLocation] = [:] @Published private(set) var learningMemoryEntries: [LearningMemoryEntry] = [] @Published private(set) var learningMemoryRevision: UInt64 = 0 @Published private(set) var studySessions: [StudySession] = [] @@ -66,8 +181,11 @@ final class WorkspaceStore: ObservableObject { @Published var readerLocationTitle: String? @Published var readerPageIndex = 0 @Published var readerTargetPageIndex: Int? + @Published private(set) var readerTargetPageRequestID = UUID() + @Published private(set) var readerTargetPageRecordsLocation = false @Published var readerTargetLocationID: String? @Published var readerTargetLocationTitle: String? + @Published private(set) var readerTargetLocationRequestID = UUID() @Published var focusedPane: PaneFocus = .reader @Published var focusRequest = 0 @Published var layout: WorkspaceLayout = .documentAgentNotes @@ -124,6 +242,7 @@ final class WorkspaceStore: ObservableObject { private let notePersistenceDebounceDelay: UInt64 = 420_000_000 private var studyProgressSaveTask: Task<Void, Never>? private let studyProgressSaveDelay: UInt64 = 900_000_000 + private var noteSourceLinksMigrationVersion = 0 var showRightPane: Bool { get { showNotes || showAgent } @@ -197,10 +316,16 @@ final class WorkspaceStore: ObservableObject { try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) load() let migratedStudyLocationTitles = refreshStudyLocationReferenceTitles() + let sanitizedNoteSourceLinks = sanitizeNoteSourceLinks() courseDocumentSearchIndex.synchronize(allItems) ensureActiveStudySession() - migrateNoteSourceLinksFromMarkdown() - if migratedStudyLocationTitles { save() } + if noteSourceLinksMigrationVersion < 1 { + migrateNoteSourceLinksFromMarkdown() + noteSourceLinksMigrationVersion = 1 + save() + } else if migratedStudyLocationTitles || sanitizedNoteSourceLinks { + save() + } floatingSelectionPrompt = ui("当前选区", "Current selection") if selectedItemID == nil { select(itemID: sampleItems[0].id) @@ -214,6 +339,24 @@ final class WorkspaceStore: ObservableObject { sampleItems + importedItems } + var linkedSourceIDsForActiveNote: [String] { + guard let noteItemID = activeNotebookItemID else { return [] } + return linkedSourceIDs(for: noteItemID) + } + + func linkedSourceIDs(for noteItemID: String) -> [String] { + NoteSourceRelations(links: noteSourceLinks).sourceIDs(for: noteItemID) + } + + var linkedSourcesForActiveNote: [StudyItem] { + let linkedIDs = Set(linkedSourceIDsForActiveNote) + return allItems.filter { linkedIDs.contains($0.id) && !$0.isNotebookNote } + } + + var linkedSourceCount: Int { + linkedSourcesForActiveNote.count + } + var filteredItems: [StudyItem] { let query = librarySearch.trimmingCharacters(in: .whitespacesAndNewlines) guard !query.isEmpty else { return allItems } @@ -326,9 +469,8 @@ final class WorkspaceStore: ObservableObject { guard let location = lastStudyLocation, allItems.contains(where: { $0.id == location.itemID }) else { return } select(itemID: location.itemID) - readerTargetPageIndex = location.pageIndex - readerTargetLocationID = location.locationID - readerTargetLocationTitle = location.locationTitle + requestReaderPDFPage(location.pageIndex, recordsLocation: false) + requestReaderHTMLLocation(id: location.locationID, title: location.locationTitle) showReader = true focus(.reader) } @@ -778,13 +920,12 @@ final class WorkspaceStore: ObservableObject { } selectedItemID = itemID if itemChanged { - activeNotebookItemID = nil clearUnpinnedFloatingSelection(keepContext: false) selectionAttachments = [] lastSelectionAttachmentDate = nil readerPageIndex = 0 readerLocationID = nil - readerTargetPageIndex = nil + requestReaderPDFPage(nil, recordsLocation: false) readerTargetLocationID = nil readerTargetLocationTitle = nil } @@ -805,6 +946,25 @@ final class WorkspaceStore: ObservableObject { save() } + func setLinkedSourceIDsForActiveNote(_ sourceItemIDs: Set<String>) { + guard let noteItemID = activeNotebookItemID else { return } + setLinkedSourceIDs(sourceItemIDs, for: noteItemID) + } + + func setLinkedSourceIDs(_ sourceItemIDs: Set<String>, for noteItemID: String) { + guard allItems.contains(where: { $0.id == noteItemID && $0.isNotebookNote }) else { return } + let validSourceIDs = Set(allItems.lazy.filter { !$0.isNotebookNote }.map(\.id)) + var relations = NoteSourceRelations(links: noteSourceLinks) + relations.replaceSources( + for: noteItemID, + sourceItemIDs: sourceItemIDs.intersection(validSourceIDs) + ) + guard relations.links != noteSourceLinks else { return } + invalidateAgentContext() + noteSourceLinks = relations.links + save() + } + func selectAdjacentItem(step: Int) { let ids = navigableItems.map(\.id) guard let nextID = LibraryNavigator.adjacentID(in: ids, selectedID: selectedItemID, step: step) else { return } @@ -1140,34 +1300,53 @@ final class WorkspaceStore: ObservableObject { let cleaned = title?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" let nextTitle = cleaned.isEmpty ? selectedMaterialItem.map(displayTitle) : cleaned guard readerLocationTitle != nextTitle else { return } - invalidateAgentContext() readerLocationTitle = nextTitle - recordCurrentStudyLocation(incrementVisit: false) } - func updateReaderHTMLLocation(id: String?, title: String?) { + func updateReaderHTMLLocation(id: String?, title: String?, reason: String) { guard selectedMaterialItem?.kind == .html else { return } + PaneToggleContinuityVerifier.recordHTMLLocationCall(reason: reason) let cleanedID = id?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" let cleanedTitle = title?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" let nextID = cleanedID.isEmpty ? nil : String(cleanedID.prefix(500)) let nextTitle = cleanedTitle.isEmpty ? selectedMaterialItem.map(displayTitle) : String(cleanedTitle.prefix(300)) + if reason == "jump" { + clearReaderHTMLLocationTarget() + } guard readerLocationID != nextID || readerLocationTitle != nextTitle else { return } - invalidateAgentContext() + PaneToggleContinuityVerifier.recordHTMLLocationCommit(reason: reason) readerLocationID = nextID readerLocationTitle = nextTitle - if readerTargetLocationID == nextID { - readerTargetLocationID = nil - } - if readerTargetLocationTitle == nextTitle { - readerTargetLocationTitle = nil - } recordCurrentStudyLocation(incrementVisit: false) } + private func requestReaderHTMLLocation(id: String?, title: String?) { + readerTargetLocationID = id + readerTargetLocationTitle = title + readerTargetLocationRequestID = UUID() + } + + private func clearReaderHTMLLocationTarget() { + guard readerTargetLocationID != nil || readerTargetLocationTitle != nil else { return } + readerTargetLocationID = nil + readerTargetLocationTitle = nil + } + + private func requestReaderPDFPage(_ pageIndex: Int?, recordsLocation: Bool) { + readerTargetPageRecordsLocation = recordsLocation && pageIndex != nil + readerTargetPageIndex = pageIndex.map { max($0, 0) } + readerTargetPageRequestID = UUID() + } + + func consumeReaderPDFPageRequest(_ requestID: UUID) { + guard readerTargetPageRequestID == requestID else { return } + readerTargetPageIndex = nil + readerTargetPageRecordsLocation = false + } + func updateReaderPageIndex(_ index: Int) { let nextIndex = max(index, 0) guard readerPageIndex != nextIndex else { return } - invalidateAgentContext() readerPageIndex = nextIndex recordCurrentStudyLocation(incrementVisit: false) } @@ -1175,12 +1354,22 @@ final class WorkspaceStore: ObservableObject { private func recordCurrentStudyLocation(incrementVisit: Bool) { guard let item = selectedMaterialItem else { return } let previous = studyLocationsByItemID[item.id] + let itemTitle = sourceReferenceBaseTitle(for: item) + let locationID = item.kind == .html ? readerLocationID : nil + let pageIndex = item.kind == .pdf ? readerPageIndex : nil + if !incrementVisit, + previous?.itemTitle == itemTitle, + previous?.locationID == locationID, + previous?.locationTitle == readerLocationTitle, + previous?.pageIndex == pageIndex { + return + } studyLocationsByItemID[item.id] = StudyLocation( itemID: item.id, - itemTitle: sourceReferenceBaseTitle(for: item), - locationID: item.kind == .html ? readerLocationID : nil, + itemTitle: itemTitle, + locationID: locationID, locationTitle: readerLocationTitle, - pageIndex: item.kind == .pdf ? readerPageIndex : nil, + pageIndex: pageIndex, lastStudiedAt: Date(), visitCount: max((previous?.visitCount ?? 0) + (incrementVisit ? 1 : 0), 1) ) @@ -1205,10 +1394,9 @@ final class WorkspaceStore: ObservableObject { readerLocationTitle = location.locationTitle ?? displayTitle(for: item) if item.kind == .pdf { readerPageIndex = max(location.pageIndex ?? 0, 0) - readerTargetPageIndex = location.pageIndex.map { max($0, 0) } + requestReaderPDFPage(location.pageIndex, recordsLocation: false) } else if item.kind == .html { - readerTargetLocationID = location.locationID - readerTargetLocationTitle = location.locationTitle + requestReaderHTMLLocation(id: location.locationID, title: location.locationTitle) } } @@ -1236,12 +1424,18 @@ final class WorkspaceStore: ObservableObject { focus(.notes) return true } - readerTargetPageIndex = item.kind == .pdf ? reference.pageIndex : nil - readerTargetLocationID = item.kind == .html + requestReaderPDFPage( + item.kind == .pdf ? reference.pageIndex : nil, + recordsLocation: item.kind == .pdf && reference.pageIndex != nil + ) + let htmlTargetID = item.kind == .html ? reference.sectionLocationID ?? reference.sectionOrdinal.map { "html-heading-\(max($0 - 1, 0))" } : nil - readerTargetLocationTitle = item.kind == .html ? reference.sectionTitle : nil + requestReaderHTMLLocation( + id: htmlTargetID, + title: item.kind == .html ? reference.sectionTitle : nil + ) focus(.reader) return true } @@ -1543,9 +1737,14 @@ final class WorkspaceStore: ObservableObject { focusedPane = snapshot.focusedPane threePaneOrder = WorkspacePaneRole.normalized(snapshot.threePaneOrder) noteText = noteText(for: activeNoteItem) - readerTargetPageIndex = selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil - readerTargetLocationID = selectedMaterialItem?.kind == .html ? snapshot.readerLocationID : nil - readerTargetLocationTitle = selectedMaterialItem?.kind == .html ? snapshot.readerLocationTitle : nil + requestReaderPDFPage( + selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil, + recordsLocation: false + ) + requestReaderHTMLLocation( + id: selectedMaterialItem?.kind == .html ? snapshot.readerLocationID : nil, + title: selectedMaterialItem?.kind == .html ? snapshot.readerLocationTitle : nil + ) latestAgentNoteProposal = nil latestAgentLearningUpdate = nil syncActiveStudySession() @@ -1821,6 +2020,14 @@ final class WorkspaceStore: ObservableObject { } func importFilesFromPanel() { + presentImportPanel(linkToActiveNote: false) + } + + func importAndLinkSourcesFromPanel() { + presentImportPanel(linkToActiveNote: true) + } + + private func presentImportPanel(linkToActiveNote: Bool) { let panel = NSOpenPanel() panel.title = ui("选择学习资料或课程文件夹", "Choose study materials or a course folder") panel.allowsMultipleSelection = true @@ -1835,10 +2042,17 @@ final class WorkspaceStore: ObservableObject { ] guard panel.runModal() == .OK else { return } - importFiles(panel.urls) + let targetNoteID = linkToActiveNote ? activeNotebookItemID : nil + let selectedItems = importFiles(panel.urls) + if let targetNoteID, targetNoteID == activeNotebookItemID { + setLinkedSourceIDsForActiveNote( + Set(linkedSourceIDsForActiveNote).union(selectedItems.map(\.id)) + ) + } } - func importFiles(_ urls: [URL]) { + @discardableResult + func importFiles(_ urls: [URL]) -> [StudyItem] { let existing = Set(importedItems.compactMap(\.urlPath)) let expandedURLs = urls .flatMap(Self.supportedCourseFiles(at:)) @@ -1867,6 +2081,8 @@ final class WorkspaceStore: ObservableObject { } else { save() } + let selectedIDs = Set(expandedURLs.map { "file:\($0.path)" }) + return allItems.filter { selectedIDs.contains($0.id) && !$0.isNotebookNote } } private static func supportedCourseFiles(at url: URL) -> [URL] { @@ -1981,6 +2197,7 @@ final class WorkspaceStore: ObservableObject { if let index = importedItems.firstIndex(where: { $0.urlPath == url.path }) { importedItems[index].isNotebookNote = true + removeLinksWhereSourceItemID(importedItems[index].id) select(itemID: importedItems[index].id) showTransientNoteStatus(ui("已打开双链笔记:\(importedItems[index].subtitle)", "Opened wiki note: \(importedItems[index].subtitle)")) save() @@ -2050,6 +2267,7 @@ final class WorkspaceStore: ObservableObject { if let sourceItem { addNoteSourceLink(noteItemID: item.id, sourceItemID: sourceItem.id) } + invalidateAgentContext() activeNotebookItemID = item.id noteText = markdown revealRichWritingSurface() @@ -2067,6 +2285,7 @@ final class WorkspaceStore: ObservableObject { @discardableResult private func openExistingNotebookNote(for material: StudyItem) -> Bool { guard let item = existingNotebookNote(for: material) else { return false } + invalidateAgentContext() activeNotebookItemID = item.id noteText = noteText(for: item) revealRichWritingSurface() @@ -2103,6 +2322,7 @@ final class WorkspaceStore: ObservableObject { invalidateAgentContext() persistCurrentNote() importedItems[index].isNotebookNote = true + removeLinksWhereSourceItemID(importedItems[index].id) activeNotebookItemID = importedItems[index].id if selectedItemID == importedItems[index].id { self.selectedItemID = sampleItems.first?.id @@ -2386,6 +2606,14 @@ final class WorkspaceStore: ObservableObject { noteSourceLinks.append(NoteSourceLink(noteItemID: noteItemID, sourceItemID: sourceItemID)) } + private func removeLinksWhereSourceItemID(_ sourceItemID: String) { + let previousCount = noteSourceLinks.count + noteSourceLinks.removeAll { $0.sourceItemID == sourceItemID } + if noteSourceLinks.count != previousCount { + invalidateAgentContext() + } + } + private func migrateNoteSourceLinksFromMarkdown() { let previousCount = noteSourceLinks.count for note in allItems where note.isNotebookNote { @@ -2400,6 +2628,20 @@ final class WorkspaceStore: ObservableObject { if noteSourceLinks.count != previousCount { save() } } + @discardableResult + private func sanitizeNoteSourceLinks() -> Bool { + let previous = noteSourceLinks + let validNoteItemIDs = Set(allItems.lazy.filter(\.isNotebookNote).map(\.id)) + let validSourceItemIDs = Set(allItems.lazy.filter { !$0.isNotebookNote }.map(\.id)) + var relations = NoteSourceRelations(links: noteSourceLinks) + relations.sanitize( + validNoteItemIDs: validNoteItemIDs, + validSourceItemIDs: validSourceItemIDs + ) + noteSourceLinks = relations.links + return noteSourceLinks != previous + } + @discardableResult private func refreshStudyLocationReferenceTitles() -> Bool { var changed = false @@ -2928,64 +3170,17 @@ final class WorkspaceStore: ObservableObject { || scenario == "pi-course-memory-flow" || scenario == "immersive-conversation-flow" || scenario == "notebook-creation-flow" + || scenario == "pure-writing-flow" + || scenario == "linked-sources-flow" || scenario == "pane-layout-stability-flow" || scenario == "content-rail-dormant-preview" || scenario == "content-rail-activation-preview" + || scenario == "pane-toggle-continuity-flow" + || scenario == "pane-reorder-width-flow" + || scenario == "reader-scroll-persistence-flow" || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true recordVerificationStage("recognized:\(scenario)") - if scenario == "pane-layout-stability-flow" { - if Self.environmentValue("WEIBEI_VERIFY_APPEARANCE") == WeiBeiAppearanceMode.inkstone.rawValue { - appearanceMode = .inkstone - } - let rawOrder = Self.environmentValue("WEIBEI_VERIFY_PANE_ORDER") - if !rawOrder.isEmpty { - let requestedOrder = rawOrder - .split(separator: ",") - .compactMap { WorkspacePaneRole(rawValue: String($0)) } - if requestedOrder.count == WorkspacePaneRole.allCases.count, - Set(requestedOrder).count == WorkspacePaneRole.allCases.count { - threePaneOrder = requestedOrder - } - } - layout = layoutMatchingThreePaneOrder(threePaneOrder) - showLibrary = false - showReader = true - showAgent = false - showNotes = false - agentSurface = .hidden - select(itemID: "sample-html") - agentDraft = ui("保留这段尚未发送的提问", "Keep this unsent question") - updateNote(ui("# 分栏连续性验收\n\n笔记内容必须保留。\n", "# Pane continuity check\n\nThe note must survive pane changes.\n")) - save() - try? await Task.sleep(nanoseconds: 2_000_000_000) - showAgent = true - save() - try? await Task.sleep(nanoseconds: 900_000_000) - showNotes = true - save() - try? await Task.sleep(nanoseconds: 900_000_000) - showNotes = false - save() - try? await Task.sleep(nanoseconds: 900_000_000) - showAgent = false - save() - let completionURL = storageURL.deletingLastPathComponent().appendingPathComponent("pane-layout-stability.complete") - let receipt: [String: Any] = [ - "agentDraft": agentDraft, - "appearance": appearanceMode.rawValue, - "noteText": noteText, - "order": normalizedThreePaneOrder.map(\.rawValue), - "selectedItemID": selectedItemID ?? "", - "showAgent": showAgent, - "showNotes": showNotes, - "showReader": showReader - ] - if let data = try? JSONSerialization.data(withJSONObject: receipt, options: [.prettyPrinted, .sortedKeys]) { - try? data.write(to: completionURL, options: .atomic) - } - return - } if emptyWorkspaceScenarios.contains(scenario) { configureEmptyWorkspaceVerificationScenario(scenario) return @@ -3002,16 +3197,50 @@ final class WorkspaceStore: ObservableObject { save() return } + if scenario == "pane-toggle-continuity-flow" { + await runPaneToggleContinuityVerification() + return + } + if scenario == "pane-layout-stability-flow" { + await runPaneLayoutStabilityVerification() + return + } + if scenario == "pane-reorder-width-flow" { + await runPaneReorderWidthVerification() + return + } + if scenario == "reader-scroll-persistence-flow" { + await runReaderScrollPersistenceVerification() + return + } layout = scenario == "immersive-conversation-flow" ? .immersiveConversation : .documentAgentNotes if scenario == "notebook-creation-flow" { layout = .immersiveWriting } + if scenario == "pure-writing-flow" || scenario == "linked-sources-flow" { + layout = .immersiveWriting + } showLibrary = scenario != "immersive-conversation-flow" showReader = true showAgent = true showNotes = true agentSurface = .hidden select(itemID: "sample-html") + if scenario == "pure-writing-flow" || scenario == "linked-sources-flow" { + createNotebookNote( + seed: .currentMaterial(sampleItems[0]), + title: ui("多资料研究笔记", "Multi-source research note") + ) + setLinkedSourceIDsForActiveNote(["sample-html", "sample-pdf"]) + select(itemID: "sample-pdf") + showLibrary = false + linkedSourcesPresented = scenario == "linked-sources-flow" + if scenario == "linked-sources-flow" { + noteRenderMode = .source + } + save() + return + } if scenario == "pi-learning-flow" || scenario == "pi-course-memory-flow" { await waitForReaderContextToSettle() } @@ -3052,7 +3281,8 @@ final class WorkspaceStore: ObservableObject { recordVerificationStage("completed") return } - updateNote(ui("# 视觉验收笔记\n\n", "# Visual verification note\n\n")) + let verificationNoteSeed = ui("# 视觉验收笔记\n\n", "# Visual verification note\n\n") + updateNote(verificationNoteSeed) updateSelection( ui("利率是资金使用价格的表达。", "An interest rate is the price paid for using funds."), source: .document, @@ -3065,11 +3295,15 @@ final class WorkspaceStore: ObservableObject { if messages.last?.backend == nil, let message = messages.last?.text { recordVerificationStage("failure:\(String(message.prefix(500)))") } - if scenario == "pi-learning-flow", messages.last?.backend == .pi { - let markerURL = storageURL.deletingLastPathComponent().appendingPathComponent("pi-agent-verified.txt") - try? "PI backend completed the packaged learning flow\n".write(to: markerURL, atomically: true, encoding: .utf8) - } applyLastAgentAnswerToNote() + if scenario == "pi-learning-flow" { + try? await Task.sleep(nanoseconds: 700_000_000) + if messages.last?.backend == .pi, noteText.count > verificationNoteSeed.count { + let markerURL = storageURL.deletingLastPathComponent().appendingPathComponent("pi-agent-verified.txt") + try? "PI backend completed the packaged learning flow and persisted its note proposal\n" + .write(to: markerURL, atomically: true, encoding: .utf8) + } + } recordVerificationStage("completed") } @@ -3090,6 +3324,424 @@ final class WorkspaceStore: ObservableObject { } } + private func runPaneToggleContinuityVerification() async { + layout = .documentAgentNotes + showLibrary = true + showReader = true + showAgent = false + showNotes = true + agentSurface = .hidden + recordVerificationStage("pane-toggle-context-prepared") + let agentMarker = AgentMessage( + role: .assistant, + text: "Pane continuity conversation marker", + source: "verification", + backend: .offline + ) + messages = [agentMarker] + let baselineOrder = normalizedThreePaneOrder + let cases: [(itemID: String, agentVisible: Bool)] = [ + ("sample-html", false), + ("sample-html", true), + ("sample-pdf", false), + ("sample-pdf", true), + ("sample-md", false), + ("sample-md", true), + ] + var caseReports: [String] = [] + var allPassed = true + + for verificationCase in cases { + showReader = true + showAgent = verificationCase.agentVisible + showNotes = true + select(itemID: verificationCase.itemID) + if verificationCase.itemID == "sample-html" { + await waitForHTMLContentRailToSettle() + requestReaderHTMLLocation( + id: nil, + title: ui("名义利率与实际利率", "Nominal and Real Interest Rates") + ) + await waitForHTMLContentRailToSettle() + } else { + try? await Task.sleep(nanoseconds: 900_000_000) + } + try? await Task.sleep(nanoseconds: 700_000_000) + + let noteMarker = "# Pane continuity \(verificationCase.itemID) \(verificationCase.agentVisible ? "agent-on" : "agent-off")\n\nUncommitted note state must survive pane toggles.\n" + updateNote(noteMarker) + try? await Task.sleep(nanoseconds: 450_000_000) + let itemID = selectedMaterialItem?.id + let baselineRevision = agentContextRevision + let baselineLocation = itemID.flatMap { studyLocationsByItemID[$0] } + let baselineMessages = messages + PaneToggleContinuityVerifier.beginMeasurement() + + for _ in 1...20 { + toggleNotes() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleNotes() + try? await Task.sleep(nanoseconds: 520_000_000) + } + for _ in 1...20 { + toggleReader() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleReader() + try? await Task.sleep(nanoseconds: 520_000_000) + } + if verificationCase.itemID == "sample-html" { + await waitForHTMLContentRailToSettle() + } else { + try? await Task.sleep(nanoseconds: 700_000_000) + } + + let finalLocation = itemID.flatMap { studyLocationsByItemID[$0] } + let revisionDelta = agentContextRevision &- baselineRevision + let studyLocationChanged = baselineLocation != finalLocation + let lifecycleStable = PaneToggleContinuityVerifier.webReaderMakeCount == 0 + && PaneToggleContinuityVerifier.webReaderDismantleCount == 0 + && PaneToggleContinuityVerifier.pdfReaderMakeCount == 0 + && PaneToggleContinuityVerifier.pdfReaderDismantleCount == 0 + && PaneToggleContinuityVerifier.noteEditorMakeCount == 0 + && PaneToggleContinuityVerifier.noteEditorDismantleCount == 0 + let exercisedResizeChain = verificationCase.itemID != "sample-html" + || PaneToggleContinuityVerifier.htmlSectionEventCount > 0 + let casePassed = exercisedResizeChain + && PaneToggleContinuityVerifier.htmlLocationCallCount == 0 + && PaneToggleContinuityVerifier.htmlLocationCommitCount == 0 + && revisionDelta == 0 + && !studyLocationChanged + && lifecycleStable + && noteText == noteMarker + && messages == baselineMessages + && normalizedThreePaneOrder == baselineOrder + && showReader + && showAgent == verificationCase.agentVisible + && showNotes + allPassed = allPassed && casePassed + let caseName = "\(verificationCase.itemID)-agent-\(verificationCase.agentVisible ? "on" : "off")" + let locationReasons = PaneToggleContinuityVerifier.htmlLocationReasons + .sorted { $0.key < $1.key } + .map { "\($0.key):\($0.value)" } + .joined(separator: ",") + caseReports.append([ + "case=\(caseName)", + "case_result=\(casePassed ? "pass" : "fail")", + "agent_revision_delta=\(revisionDelta)", + "study_location_changed=\(studyLocationChanged)", + "html_location_calls=\(PaneToggleContinuityVerifier.htmlLocationCallCount)", + "html_location_commits=\(PaneToggleContinuityVerifier.htmlLocationCommitCount)", + "html_location_reasons=\(locationReasons)", + "web_reader_make=\(PaneToggleContinuityVerifier.webReaderMakeCount)", + "web_reader_dismantle=\(PaneToggleContinuityVerifier.webReaderDismantleCount)", + "pdf_reader_make=\(PaneToggleContinuityVerifier.pdfReaderMakeCount)", + "pdf_reader_dismantle=\(PaneToggleContinuityVerifier.pdfReaderDismantleCount)", + "markdown_editor_make=\(PaneToggleContinuityVerifier.noteEditorMakeCount)", + "markdown_editor_dismantle=\(PaneToggleContinuityVerifier.noteEditorDismantleCount)", + "note_preserved=\(noteText == noteMarker)", + "conversation_preserved=\(messages == baselineMessages)", + "pane_order_preserved=\(normalizedThreePaneOrder == baselineOrder)", + ].joined(separator: " ")) + PaneToggleContinuityVerifier.endMeasurement() + } + + let report = ([ + "result=\(allPassed ? "pass" : "fail")", + "cases=\(cases.count)", + "notes_cycles_per_case=20", + "reader_cycles_per_case=20", + ] + caseReports).joined(separator: "\n") + "\n" + let reportURL = storageURL.deletingLastPathComponent() + .appendingPathComponent("pane-toggle-continuity-report.txt") + try? report.write(to: reportURL, atomically: true, encoding: .utf8) + recordVerificationStage("pane-toggle-result:\(allPassed ? "pass" : "fail")") + recordVerificationStage("completed") + } + + private func runPaneLayoutStabilityVerification() async { + layout = .documentAgentNotes + showLibrary = false + showReader = true + showAgent = false + showNotes = true + agentSurface = .hidden + select(itemID: "sample-html") + await waitForHTMLContentRailToSettle() + + let noteMarker = "# Pane ownership marker\n\nUnsaved note input must survive stable slot animations.\n" + let draftMarker = "Unsent agent draft must survive stable slot animations." + let messageMarker = AgentMessage( + role: .assistant, + text: "Stable parent conversation marker", + source: "verification", + backend: .offline + ) + updateNote(noteMarker) + agentDraft = draftMarker + messages = [messageMarker] + try? await Task.sleep(nanoseconds: 700_000_000) + + let itemID = selectedMaterialItem?.id + let baselineLocation = itemID.flatMap { studyLocationsByItemID[$0] } + let baselineRevision = agentContextRevision + let baselineOrder = normalizedThreePaneOrder + PaneToggleContinuityVerifier.beginMeasurement() + recordVerificationStage("pane-layout-context-prepared") + + toggleNotes() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleNotes() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleAgent() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleReader() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleReader() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleAgent() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleNotes() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleNotes() + try? await Task.sleep(nanoseconds: 700_000_000) + + let finalLocation = itemID.flatMap { studyLocationsByItemID[$0] } + let revisionDelta = agentContextRevision &- baselineRevision + let passed = showReader + && !showAgent + && showNotes + && noteText == noteMarker + && agentDraft == draftMarker + && messages == [messageMarker] + && normalizedThreePaneOrder == baselineOrder + && finalLocation == baselineLocation + && revisionDelta == 0 + && PaneToggleContinuityVerifier.htmlLocationCallCount == 0 + && PaneToggleContinuityVerifier.webReaderMakeCount == 0 + && PaneToggleContinuityVerifier.webReaderDismantleCount == 0 + && PaneToggleContinuityVerifier.noteEditorMakeCount == 0 + && PaneToggleContinuityVerifier.noteEditorDismantleCount == 0 + let report = [ + "result=\(passed ? "pass" : "fail")", + "transitions=8", + "reader_visible=\(showReader)", + "agent_visible=\(showAgent)", + "notes_visible=\(showNotes)", + "agent_revision_delta=\(revisionDelta)", + "study_location_changed=\(finalLocation != baselineLocation)", + "html_location_calls=\(PaneToggleContinuityVerifier.htmlLocationCallCount)", + "web_reader_make=\(PaneToggleContinuityVerifier.webReaderMakeCount)", + "web_reader_dismantle=\(PaneToggleContinuityVerifier.webReaderDismantleCount)", + "note_editor_make=\(PaneToggleContinuityVerifier.noteEditorMakeCount)", + "note_editor_dismantle=\(PaneToggleContinuityVerifier.noteEditorDismantleCount)", + "note_preserved=\(noteText == noteMarker)", + "agent_draft_preserved=\(agentDraft == draftMarker)", + "conversation_preserved=\(messages == [messageMarker])", + "pane_order_preserved=\(normalizedThreePaneOrder == baselineOrder)", + ].joined(separator: "\n") + "\n" + PaneToggleContinuityVerifier.endMeasurement() + let reportURL = storageURL.deletingLastPathComponent() + .appendingPathComponent("pane-layout-stability-report.txt") + try? report.write(to: reportURL, atomically: true, encoding: .utf8) + recordVerificationStage("pane-layout-result:\(passed ? "pass" : "fail")") + recordVerificationStage("completed") + } + + private func runPaneReorderWidthVerification() async { + layout = .documentAgentNotes + showLibrary = false + showReader = true + showAgent = true + showNotes = true + agentSurface = .hidden + select(itemID: "sample-html") + await waitForHTMLContentRailToSettle() + + let noteMarker = "# Reorder and width marker\n\nUnsaved text must survive pane movement.\n" + let draftMarker = "Unsent draft must survive pane movement." + let messageMarker = AgentMessage( + role: .assistant, + text: "Reorder conversation marker", + source: "verification", + backend: .offline + ) + updateNote(noteMarker) + agentDraft = draftMarker + messages = [messageMarker] + + for _ in 0..<30 { + let order = visibleDocumentPaneOrder + if order.count == 3, order.allSatisfy({ threePaneReorderFrames[$0] != nil }) { + break + } + try? await Task.sleep(nanoseconds: 100_000_000) + } + + let baselineOrder = normalizedThreePaneOrder + let baselineRevision = agentContextRevision + let itemID = selectedMaterialItem?.id + let baselineLocation = itemID.flatMap { studyLocationsByItemID[$0] } + let baselineAgentWidth = threePaneReorderFrames[.agent]?.width ?? 0 + PaneToggleContinuityVerifier.beginMeasurement() + recordVerificationStage("pane-reorder-width-context-prepared") + + requestPaneExpansion(.agent) + for _ in 0..<20 { + guard paneExpansionRequest != nil else { break } + try? await Task.sleep(nanoseconds: 100_000_000) + } + try? await Task.sleep(nanoseconds: 350_000_000) + let expandedAgentWidth = threePaneReorderFrames[.agent]?.width ?? 0 + + beginThreePaneReorder(.reader) + let dragDistance = max( + (threePaneReorderFrames[.notes]?.midX ?? 1_000) + - (threePaneReorderFrames[.reader]?.midX ?? 0), + 1_000 + ) + updateThreePaneReorder(.reader, horizontalDelta: dragDistance) + finishThreePaneReorder(.reader, horizontalDelta: dragDistance) + try? await Task.sleep(nanoseconds: 700_000_000) + let reorderedOrder = normalizedThreePaneOrder + let reorderedAgentWidth = threePaneReorderFrames[.agent]?.width ?? 0 + + toggleAgent() + try? await Task.sleep(nanoseconds: 520_000_000) + toggleAgent() + try? await Task.sleep(nanoseconds: 700_000_000) + let restoredAgentWidth = threePaneReorderFrames[.agent]?.width ?? 0 + let restoredStore = WorkspaceStore() + let persistedOrder = restoredStore.normalizedThreePaneOrder + let widthTolerance = max(12, reorderedAgentWidth * 0.12) + let finalLocation = itemID.flatMap { studyLocationsByItemID[$0] } + let lifecycleStable = PaneToggleContinuityVerifier.webReaderMakeCount == 0 + && PaneToggleContinuityVerifier.webReaderDismantleCount == 0 + && PaneToggleContinuityVerifier.noteEditorMakeCount == 0 + && PaneToggleContinuityVerifier.noteEditorDismantleCount == 0 + let passed = baselineOrder != reorderedOrder + && reorderedOrder.last == .reader + && persistedOrder == reorderedOrder + && paneExpansionRequest == nil + && expandedAgentWidth >= ContentRailMetrics.readableWidth + && reorderedAgentWidth >= ContentRailMetrics.readableWidth + && abs(restoredAgentWidth - reorderedAgentWidth) <= widthTolerance + && noteText == noteMarker + && agentDraft == draftMarker + && messages == [messageMarker] + && finalLocation == baselineLocation + && agentContextRevision == baselineRevision + && lifecycleStable + + let report = [ + "result=\(passed ? "pass" : "fail")", + "baseline_order=\(baselineOrder.map(\.rawValue).joined(separator: ","))", + "reordered_order=\(reorderedOrder.map(\.rawValue).joined(separator: ","))", + "persisted_order=\(persistedOrder.map(\.rawValue).joined(separator: ","))", + "baseline_agent_width=\(baselineAgentWidth)", + "expanded_agent_width=\(expandedAgentWidth)", + "reordered_agent_width=\(reorderedAgentWidth)", + "restored_agent_width=\(restoredAgentWidth)", + "width_tolerance=\(widthTolerance)", + "expansion_consumed=\(paneExpansionRequest == nil)", + "note_preserved=\(noteText == noteMarker)", + "agent_draft_preserved=\(agentDraft == draftMarker)", + "conversation_preserved=\(messages == [messageMarker])", + "study_location_changed=\(finalLocation != baselineLocation)", + "agent_revision_delta=\(agentContextRevision &- baselineRevision)", + "native_lifecycle_stable=\(lifecycleStable)", + ].joined(separator: "\n") + "\n" + PaneToggleContinuityVerifier.endMeasurement() + let reportURL = storageURL.deletingLastPathComponent() + .appendingPathComponent("pane-reorder-width-report.txt") + try? report.write(to: reportURL, atomically: true, encoding: .utf8) + recordVerificationStage("pane-reorder-width-result:\(passed ? "pass" : "fail")") + recordVerificationStage("completed") + } + + private func runReaderScrollPersistenceVerification() async { + PaneToggleContinuityVerifier.beginMeasurement() + layout = .documentAgentNotes + showLibrary = true + showReader = true + showAgent = true + showNotes = true + agentSurface = .hidden + select(itemID: "sample-html") + await waitForHTMLContentRailToSettle() + let baseline = studyLocationsByItemID["sample-html"] + let previousScrollSchedules = PaneToggleContinuityVerifier.verificationScrollScheduleCount + NotificationCenter.default.post(name: .weiBeiVerificationUserScroll, object: nil) + try? await Task.sleep(nanoseconds: 100_000_000) + let didTriggerScroll = PaneToggleContinuityVerifier.verificationScrollScheduleCount > previousScrollSchedules + recordVerificationStage("reader-scroll-context-prepared") + + var finalLocation = studyLocationsByItemID["sample-html"] + for _ in 0..<60 { + try? await Task.sleep(nanoseconds: 150_000_000) + finalLocation = studyLocationsByItemID["sample-html"] + if finalLocation?.locationID != nil, + finalLocation?.locationID != baseline?.locationID { + break + } + } + save() + try? await Task.sleep(nanoseconds: 250_000_000) + let restoredStore = WorkspaceStore() + let persisted = restoredStore.studyLocationsByItemID["sample-html"] + let scrolled = finalLocation?.locationID != nil + && finalLocation?.locationID != baseline?.locationID + && finalLocation?.lastStudiedAt != baseline?.lastStudiedAt + let restored = restoredStore.selectedItemID == "sample-html" + && restoredStore.readerLocationID == finalLocation?.locationID + && restoredStore.readerTargetLocationID == finalLocation?.locationID + && persisted?.locationID == finalLocation?.locationID + && persisted?.locationTitle == finalLocation?.locationTitle + let passed = didTriggerScroll && scrolled && restored + let locationReasons = PaneToggleContinuityVerifier.htmlLocationReasons + .sorted { $0.key < $1.key } + .map { "\($0.key):\($0.value)" } + .joined(separator: ",") + let report = [ + "result=\(passed ? "pass" : "fail")", + "input_path=dom-wheel-event", + "verification_scroll_triggered=\(didTriggerScroll)", + "baseline_location_id=\(baseline?.locationID ?? "")", + "final_location_id=\(finalLocation?.locationID ?? "")", + "final_location_title=\(finalLocation?.locationTitle ?? "")", + "timestamp_changed=\(finalLocation?.lastStudiedAt != baseline?.lastStudiedAt)", + "restored_location_id=\(restoredStore.readerLocationID ?? "")", + "restored_target_id=\(restoredStore.readerTargetLocationID ?? "")", + "html_section_events=\(PaneToggleContinuityVerifier.htmlSectionEventCount)", + "html_active_events=\(PaneToggleContinuityVerifier.htmlActiveEventCount)", + "html_location_calls=\(PaneToggleContinuityVerifier.htmlLocationCallCount)", + "html_location_reasons=\(locationReasons)", + "verification_scroll_schedules=\(PaneToggleContinuityVerifier.verificationScrollScheduleCount)", + "verification_scroll_result=\(PaneToggleContinuityVerifier.verificationScrollResult)", + ].joined(separator: "\n") + "\n" + PaneToggleContinuityVerifier.endMeasurement() + let reportURL = storageURL.deletingLastPathComponent() + .appendingPathComponent("reader-scroll-persistence-report.txt") + try? report.write(to: reportURL, atomically: true, encoding: .utf8) + recordVerificationStage("reader-scroll-result:\(passed ? "pass" : "fail")") + recordVerificationStage("completed") + } + + private func waitForHTMLContentRailToSettle() async { + var previousEventCount = PaneToggleContinuityVerifier.htmlEventSequence + var stableChecks = 0 + for _ in 0..<40 { + try? await Task.sleep(nanoseconds: 150_000_000) + let currentEventCount = PaneToggleContinuityVerifier.htmlEventSequence + if currentEventCount == previousEventCount { + stableChecks += 1 + if stableChecks >= 4 { return } + } else { + previousEventCount = currentEventCount + stableChecks = 0 + } + } + } + private func recordVerificationStage(_ stage: String) { guard Self.environmentValue("WEIBEI_SUPPRESS_ACTIVATION") == "1" else { return } let url = storageURL.deletingLastPathComponent().appendingPathComponent("verification-state.txt") @@ -3813,6 +4465,7 @@ final class WorkspaceStore: ObservableObject { selectedItemID = snapshot.selectedItemID activeNotebookItemID = snapshot.activeNotebookItemID noteSourceLinks = snapshot.noteSourceLinks ?? [] + noteSourceLinksMigrationVersion = snapshot.noteSourceLinksMigrationVersion ?? 0 studyLocationsByItemID = snapshot.studyLocationsByItemID ?? [:] learningMemoryEntries = snapshot.learningMemoryEntries ?? [] learningMemoryRevision = snapshot.learningMemoryRevision ?? 0 @@ -3902,6 +4555,7 @@ final class WorkspaceStore: ObservableObject { selectedItemID: selectedItemID, activeNotebookItemID: activeNotebookItemID, noteSourceLinks: noteSourceLinks, + noteSourceLinksMigrationVersion: noteSourceLinksMigrationVersion, studyLocationsByItemID: studyLocationsByItemID, learningMemoryEntries: learningMemoryEntries, learningMemoryRevision: learningMemoryRevision, diff --git a/Sources/WeiBei/Support/PaneContinuityRecorder.swift b/Sources/WeiBei/Support/PaneContinuityRecorder.swift index d351a6abd..418e15545 100644 --- a/Sources/WeiBei/Support/PaneContinuityRecorder.swift +++ b/Sources/WeiBei/Support/PaneContinuityRecorder.swift @@ -1,4 +1,3 @@ -#if DEBUG import AppKit import Foundation @@ -6,6 +5,11 @@ struct PaneContinuityRoleSample: Codable { let role: String let hostID: String let parentID: String + let contentHostID: String? + let contentParentID: String? + let contentAttached: Bool + let slotHasVisibleArea: Bool + let visibleContentReady: Bool let hidden: Bool let modelFrame: CGRect let presentationFrame: CGRect @@ -17,25 +21,54 @@ struct PaneContinuitySample: Codable { let frame: Int let timestamp: TimeInterval let stableOwnership: Bool + let noBlankVisibleSlots: Bool let containerBounds: CGRect let roles: [PaneContinuityRoleSample] } +private struct PaneContinuityRoleIdentity: Codable, Equatable { + let hostID: String + let parentID: String + let contentHostID: String? + let contentParentID: String? +} + +private struct PaneContinuitySummary: Codable { + let recorderID: String + let samples: Int + let transitions: Int + let ownershipFailures: Int + let blankVisibleFailures: Int + let identityFailures: Int + let roleIdentities: [String: PaneContinuityRoleIdentity] +} + @MainActor final class PaneContinuityRecorder { private let directory: URL + private let writesIndividualSamples: Bool private let recorderID = UUID().uuidString private var transitionIndex = 0 + private var sampleCount = 0 + private var ownershipFailureCount = 0 + private var blankVisibleFailureCount = 0 + private var identityFailureCount = 0 + private var roleIdentities: [String: PaneContinuityRoleIdentity] = [:] static func configuredFromEnvironment() -> PaneContinuityRecorder? { let path = ProcessInfo.processInfo.environment["WEIBEI_VERIFY_PANE_TRACE_DIR"]? .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" guard !path.isEmpty else { return nil } - return PaneContinuityRecorder(directory: URL(fileURLWithPath: path, isDirectory: true)) + let writesIndividualSamples = ProcessInfo.processInfo.environment["WEIBEI_VERIFY_PANE_TRACE_SAMPLES"] == "1" + return PaneContinuityRecorder( + directory: URL(fileURLWithPath: path, isDirectory: true), + writesIndividualSamples: writesIndividualSamples + ) } - private init(directory: URL) { + private init(directory: URL, writesIndividualSamples: Bool) { self.directory = directory + self.writesIndividualSamples = writesIndividualSamples try? FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) } @@ -54,6 +87,8 @@ final class PaneContinuityRecorder { transition: transition, frame: frame ) + self.updateSummary(with: sample, writesSnapshot: frame == frameCount - 1) + guard self.writesIndividualSamples else { return } guard let data = try? JSONEncoder().encode(sample) else { return } let name = String( format: "container-%@-transition-%02d-frame-%02d.json", @@ -68,5 +103,44 @@ final class PaneContinuityRecorder { } } } + + private func updateSummary(with sample: PaneContinuitySample, writesSnapshot: Bool) { + sampleCount += 1 + if !sample.stableOwnership { + ownershipFailureCount += 1 + } + if !sample.noBlankVisibleSlots { + blankVisibleFailureCount += 1 + } + for role in sample.roles { + let identity = PaneContinuityRoleIdentity( + hostID: role.hostID, + parentID: role.parentID, + contentHostID: role.contentHostID, + contentParentID: role.contentParentID + ) + if let baseline = roleIdentities[role.role] { + if baseline != identity { + identityFailureCount += 1 + } + } else { + roleIdentities[role.role] = identity + } + } + guard writesSnapshot else { return } + let summary = PaneContinuitySummary( + recorderID: recorderID, + samples: sampleCount, + transitions: transitionIndex, + ownershipFailures: ownershipFailureCount, + blankVisibleFailures: blankVisibleFailureCount, + identityFailures: identityFailureCount, + roleIdentities: roleIdentities + ) + guard let data = try? JSONEncoder().encode(summary) else { return } + let destination = directory.appendingPathComponent("summary.json") + DispatchQueue.global(qos: .utility).async { + try? data.write(to: destination, options: .atomic) + } + } } -#endif diff --git a/Sources/WeiBei/Views/CommandPaletteView.swift b/Sources/WeiBei/Views/CommandPaletteView.swift index 3beb861a3..97d710e9c 100644 --- a/Sources/WeiBei/Views/CommandPaletteView.swift +++ b/Sources/WeiBei/Views/CommandPaletteView.swift @@ -12,13 +12,13 @@ struct CommandPaletteView: View { var items = [ PaletteCommand(title: store.ui("打开资料", "Open Material"), shortcut: "⌘O") { store.importFilesFromPanel() }, PaletteCommand(title: store.ui("新建空白笔记", "New Blank Note"), shortcut: "⌘N") { store.promptCreateBlankNotebookNote() }, - PaletteCommand(title: store.ui("聚焦课程目录", "Focus Course Index"), shortcut: "⌘1", animation: WeiBeiMotion.layout) { store.focus(.library) }, + PaletteCommand(title: store.ui("聚焦资料库", "Focus Library"), shortcut: "⌘1", animation: WeiBeiMotion.layout) { store.focus(.library) }, PaletteCommand(title: store.ui("聚焦阅读", "Focus Reader"), shortcut: "⌘2", animation: WeiBeiMotion.layout) { store.focus(.reader) }, PaletteCommand(title: store.ui("聚焦笔记", "Focus Notes"), shortcut: "⌘3", animation: WeiBeiMotion.layout) { store.focus(.notes) }, PaletteCommand(title: store.ui("聚焦对话", "Focus Chat"), shortcut: "⌘4", animation: WeiBeiMotion.layout) { store.focus(.agent) }, PaletteCommand(title: store.ui("上一份资料", "Previous Material"), shortcut: "⌥⌘↑", animation: WeiBeiMotion.layout) { store.selectAdjacentItem(step: -1) }, PaletteCommand(title: store.ui("下一份资料", "Next Material"), shortcut: "⌥⌘↓", animation: WeiBeiMotion.layout) { store.selectAdjacentItem(step: 1) }, - PaletteCommand(title: store.showLibrary ? store.ui("收起课程目录", "Hide Course Index") : store.ui("打开课程目录", "Show Course Index"), shortcut: "⌘B", animation: WeiBeiMotion.layout) { store.toggleLibrary() }, + PaletteCommand(title: store.showLibrary ? store.ui("收起资料库", "Hide Library") : store.ui("打开资料库", "Show Library"), shortcut: "⌘B", animation: WeiBeiMotion.layout) { store.toggleLibrary() }, PaletteCommand(title: store.ui("三栏工作台", "Three-Pane Workspace"), shortcut: "⌥⌘1", animation: WeiBeiMotion.layout) { store.setLayout(.documentAgentNotes) }, PaletteCommand(title: WorkspaceLayout.documentNotesSplit.label(language: store.interfaceLanguage), shortcut: "⌥⌘2", animation: WeiBeiMotion.layout) { store.setLayout(.documentNotesSplit) }, PaletteCommand(title: WorkspaceLayout.immersiveReading.label(language: store.interfaceLanguage), shortcut: "⌥⌘R", animation: WeiBeiMotion.layout) { store.setLayout(.immersiveReading) }, diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index 872a5f9b4..0066a8d01 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -166,7 +166,7 @@ struct ContentView: View { libraryDragStartWidth = nil } ) - .help(store.ui("拖动调整课程目录宽度", "Drag to resize the course index")) + .help(store.ui("拖动调整资料库宽度", "Drag to resize the library")) } } @@ -572,7 +572,7 @@ private struct UnifiedTopBarView: View { @ViewBuilder private var libraryButton: some View { - topIconButton("sidebar.left", help: store.showLibrary ? store.ui("收起课程目录", "Hide course index") : store.ui("打开课程目录", "Show course index"), active: store.showLibrary) { + topIconButton("sidebar.left", help: store.showLibrary ? store.ui("收起资料库", "Hide library") : store.ui("打开资料库", "Show library"), active: store.showLibrary) { withAnimation(WeiBeiMotion.layout) { store.toggleLibrary() } @@ -695,12 +695,6 @@ private struct LayoutContentView: View { @SceneStorage("documentThreePaneFirstSplit") private var firstSplitStorage: Double = 0.34 @SceneStorage("documentThreePaneSecondSplit") private var secondSplitStorage: Double = 0.67 @SceneStorage("documentNotesHalfSplit") private var halfSplitStorage: Double = 0.50 - @SceneStorage("conversationFirstSplit") private var conversationFirstSplitStorage: Double = 0.12 - @SceneStorage("conversationSecondSplit") private var conversationSecondSplitStorage: Double = 0.90 - @SceneStorage("conversationLeftSplit") private var conversationLeftSplitStorage: Double = 0.13 - @SceneStorage("writingFirstSplit") private var writingFirstSplitStorage: Double = 0.13 - @SceneStorage("writingSecondSplit") private var writingSecondSplitStorage: Double = 0.90 - @SceneStorage("writingLeftSplit") private var writingLeftSplitStorage: Double = 0.13 var body: some View { Group { @@ -728,32 +722,8 @@ private struct LayoutContentView: View { .transition(WeiBeiTransition.layout) case .immersiveWriting: ZStack(alignment: agentAlignment) { - if store.showRightPane { - ResizableThreePane( - firstSplit: writingFirstSplit, - secondSplit: writingSecondSplit, - minFirst: 96, - minSecond: 540, - minThird: 104 - ) { - ContextRailView(title: store.ui("文档", "Documents"), items: writingDocumentRailItems, edge: .trailing) - .transition(WeiBeiTransition.rail) - } second: { - PersistentPaneHost(role: .notes, registry: paneHostRegistry) - } third: { - ContextRailView(title: store.ui("写作辅助", "Writing Aids"), items: writingAssistRailItems, edge: .leading) - .transition(WeiBeiTransition.rail) - } - .transition(WeiBeiTransition.rightPanel) - } else { - ResizableTwoPane(split: writingLeftSplit, minFirst: 96, minSecond: 540) { - ContextRailView(title: store.ui("文档", "Documents"), items: writingDocumentRailItems, edge: .trailing) - .transition(WeiBeiTransition.rail) - } second: { - PersistentPaneHost(role: .notes, registry: paneHostRegistry) - } - .transition(WeiBeiTransition.layout) - } + PersistentPaneHost(role: .notes, registry: paneHostRegistry) + .frame(maxWidth: .infinity, maxHeight: .infinity) if store.agentSurface != .quietInsight { agentOverlay @@ -790,30 +760,6 @@ private struct LayoutContentView: View { numericBinding($halfSplitStorage) } - private var conversationFirstSplit: Binding<CGFloat> { - numericBinding($conversationFirstSplitStorage) - } - - private var conversationSecondSplit: Binding<CGFloat> { - numericBinding($conversationSecondSplitStorage) - } - - private var conversationLeftSplit: Binding<CGFloat> { - numericBinding($conversationLeftSplitStorage) - } - - private var writingFirstSplit: Binding<CGFloat> { - numericBinding($writingFirstSplitStorage) - } - - private var writingSecondSplit: Binding<CGFloat> { - numericBinding($writingSecondSplitStorage) - } - - private var writingLeftSplit: Binding<CGFloat> { - numericBinding($writingLeftSplitStorage) - } - @ViewBuilder private func documentPaneLayoutView() -> some View { let order = store.visibleDocumentPaneOrder @@ -928,94 +874,6 @@ private struct LayoutContentView: View { Swift.min(Swift.max(value, min), Swift.max(min, max)) } - private var conversationSourceRailItems: [ContextRailItem] { - var items: [ContextRailItem] = [] - if let item = store.selectedMaterialItem { - items.append( - ContextRailItem( - title: store.displayTitle(for: item), - help: store.ui("切回沉浸阅读", "Return to immersive reading"), - systemImage: item.kind.systemImage, - emphasized: true - ) { - openReader() - } - ) - } - items.append( - ContextRailItem(title: store.ui("当前笔记", "Current Note"), help: store.ui("切回沉浸写作", "Return to immersive writing"), systemImage: "square.and.pencil") { - openWriting() - } - ) - if store.selectionContext != nil { - items.append( - ContextRailItem(title: store.ui("选区", "Selection"), help: store.ui("追问当前选区", "Ask about current selection"), systemImage: "text.cursor") { - askCurrentSelection() - } - ) - } - return items - } - - private var conversationTargetRailItems: [ContextRailItem] { - var items = [ - ContextRailItem(title: store.ui("当前笔记", "Current Note"), help: store.ui("打开写作区", "Open writing area"), systemImage: "square.and.pencil", emphasized: true) { - openWriting() - } - ] - if store.selectionContext != nil { - items.append( - ContextRailItem(title: store.ui("摘录区", "Excerpt Area"), help: store.ui("把当前选区收进笔记", "Save the current selection to notes"), systemImage: "quote.opening") { - appendSelectionAndOpenWriting() - } - ) - } - items.append( - ContextRailItem(title: store.ui("问题与结论", "Questions & Conclusions"), help: store.ui("整理问题、结论和缺少证据", "Organize questions, conclusions, and missing evidence"), systemImage: "checkmark.circle") { - prepareAgentDraft(store.ui("请根据\(store.agentPromptScope),整理出问题、结论和还缺少的证据。", "Use \(store.agentPromptScope) to organize questions, conclusions, and missing evidence.")) - } - ) - return items - } - - private var writingDocumentRailItems: [ContextRailItem] { - var items: [ContextRailItem] = [] - if let item = store.selectedMaterialItem { - items.append( - ContextRailItem( - title: store.displayTitle(for: item), - help: store.ui("切回沉浸阅读", "Return to immersive reading"), - systemImage: item.kind.systemImage, - emphasized: true - ) { - openReader() - } - ) - } - if store.hasSelectedMaterial || store.selectionContext != nil { - items.append( - ContextRailItem(title: store.ui("引用", "Reference"), help: store.ui("复制当前材料或选区引用", "Copy current material or selection reference"), systemImage: "quote.opening") { - store.copyCurrentReference() - } - ) - } - return items - } - - private var writingAssistRailItems: [ContextRailItem] { - [ - ContextRailItem(title: store.ui("大纲建议", "Outline"), help: store.ui("生成笔记大纲", "Generate a note outline"), systemImage: "list.bullet.rectangle", emphasized: true) { - prepareAgentDraft(store.ui("请根据\(store.agentPromptScope),给出一版更清晰的笔记大纲。", "Use \(store.agentPromptScope) to produce a clearer note outline.")) - }, - ContextRailItem(title: store.ui("补来源", "Add Sources"), help: store.ui("检查笔记缺少来源的位置", "Find places where notes need sources"), systemImage: "link") { - prepareAgentDraft(store.hasSelectedMaterial ? store.ui("请检查当前笔记缺少来源的位置,并建议应该引用当前材料的哪些部分。", "Find where the current note needs sources and suggest which parts of the current material to cite.") : store.ui("请检查当前笔记缺少来源的位置,并标出需要补证据的段落。", "Find where the current note needs sources and mark the paragraphs that need evidence.")) - }, - ContextRailItem(title: store.ui("润色表达", "Polish"), help: store.ui("润色当前笔记", "Polish current note"), systemImage: "text.quote") { - prepareAgentDraft(store.ui("请整理和润色当前笔记,保留原意,并标出缺少来源的位置。", "Organize and polish the current note, preserve the meaning, and mark where sources are missing.")) - } - ] - } - private func numericBinding(_ storage: Binding<Double>) -> Binding<CGFloat> { Binding( get: { CGFloat(storage.wrappedValue) }, @@ -1023,40 +881,6 @@ private struct LayoutContentView: View { ) } - private func openReader() { - withAnimation(WeiBeiMotion.layout) { - store.setLayout(.immersiveReading) - } - } - - private func openWriting() { - withAnimation(WeiBeiMotion.layout) { - store.setLayout(.immersiveWriting) - store.revealRightPane(focusing: .notes) - } - } - - private func askCurrentSelection() { - store.askSelection() - withAnimation(WeiBeiMotion.layout) { - store.setLayout(.immersiveConversation) - store.revealRightPane(focusing: .agent) - } - } - - private func appendSelectionAndOpenWriting() { - store.appendSelectionToNote() - openWriting() - } - - private func prepareAgentDraft(_ prompt: String) { - withAnimation(WeiBeiMotion.layout) { - store.agentDraft = prompt - store.setLayout(.immersiveConversation) - store.revealRightPane(focusing: .agent) - } - } - private var agentAlignment: Alignment { switch store.agentSurface { case .bottomDrawer: diff --git a/Sources/WeiBei/Views/LinkedSourcesView.swift b/Sources/WeiBei/Views/LinkedSourcesView.swift new file mode 100644 index 000000000..22a678db7 --- /dev/null +++ b/Sources/WeiBei/Views/LinkedSourcesView.swift @@ -0,0 +1,186 @@ +import SwiftUI +import WeiBeiCore + +struct LinkedSourcesControl: View { + @EnvironmentObject private var store: WorkspaceStore + + var body: some View { + Button { + store.linkedSourcesPresented.toggle() + } label: { + Label( + store.ui("资料 \(store.linkedSourceCount)", "Sources \(store.linkedSourceCount)"), + systemImage: "link" + ) + } + .buttonStyle(WeiBeiTextActionButtonStyle(active: store.linkedSourcesPresented)) + .disabled(store.activeNotebookItemID == nil) + .popover(isPresented: $store.linkedSourcesPresented, arrowEdge: .bottom) { + LinkedSourcesPopover(dismiss: { store.linkedSourcesPresented = false }) + .environmentObject(store) + } + .accessibilityLabel(Text(store.ui( + "管理这份笔记的资料,当前 \(store.linkedSourceCount) 份", + "Manage sources for this note, \(store.linkedSourceCount) selected" + ))) + .help(store.ui("为当前笔记选择长期关联的资料", "Choose durable source links for this note")) + } +} + +struct LinkedSourcesPopover: View { + @EnvironmentObject private var store: WorkspaceStore + @State private var query = "" + @State private var draftIDs = Set<String>() + @State private var noteItemID: String? + let dismiss: () -> Void + + private var materials: [StudyItem] { + store.allItems.filter { item in + guard !item.isNotebookNote else { return false } + let cleaned = query.trimmingCharacters(in: .whitespacesAndNewlines) + return cleaned.isEmpty + || store.displayTitle(for: item).localizedCaseInsensitiveContains(cleaned) + || store.displaySubtitle(for: item).localizedCaseInsensitiveContains(cleaned) + } + } + + private var groupedMaterials: [(String, [StudyItem])] { + let groups = Dictionary(grouping: materials.filter { $0.id != store.selectedMaterialItem?.id }) { item in + item.url?.deletingLastPathComponent().path.replacingOccurrences(of: NSHomeDirectory(), with: "~") + ?? store.ui("内置资料", "Built-in") + } + return groups.keys.sorted().map { ($0, groups[$0] ?? []) } + } + + var body: some View { + VStack(alignment: .leading, spacing: 0) { + VStack(alignment: .leading, spacing: 12) { + HStack(alignment: .firstTextBaseline) { + VStack(alignment: .leading, spacing: 3) { + Text(store.ui("这份笔记的资料", "Sources for this note")) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 16, weight: .semibold)) + Text(store.ui("选中的资料会一直跟随这份笔记", "Selected sources stay with this note")) + .font(.caption) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } + Spacer() + Text("\(draftIDs.count)") + .font(.system(size: 18, weight: .medium, design: .serif)) + .foregroundStyle(WeiBeiTheme.cinnabar) + } + + HStack(spacing: 7) { + Image(systemName: "magnifyingglass") + .foregroundStyle(WeiBeiTheme.tertiaryInk) + TextField(store.ui("搜索标题、文件名", "Search title or file name"), text: $query) + .textFieldStyle(.plain) + } + .font(.system(size: 13)) + .weibeiInputSurface(height: 32) + + if let current = store.selectedMaterialItem { + sourceButton(current, showsCurrentLabel: true) + } + } + .padding(16) + + Divider().overlay(WeiBeiTheme.hairline) + + ScrollView { + LazyVStack(alignment: .leading, spacing: 12) { + ForEach(groupedMaterials, id: \.0) { group in + VStack(alignment: .leading, spacing: 4) { + Text(group.0) + .font(.system(size: 10, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .padding(.horizontal, 7) + ForEach(group.1) { item in + sourceButton(item) + } + } + } + if materials.isEmpty { + Text(store.ui("没有匹配的资料", "No matching sources")) + .font(.caption) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(maxWidth: .infinity) + .padding(.vertical, 36) + } + } + .padding(12) + } + .frame(height: 290) + + Divider().overlay(WeiBeiTheme.hairline) + + HStack { + Button { + store.importAndLinkSourcesFromPanel() + dismiss() + } label: { + Label(store.ui("导入资料", "Import sources"), systemImage: "plus") + } + .buttonStyle(WeiBeiTextActionButtonStyle()) + + Spacer() + + Button(store.ui("取消", "Cancel"), action: dismiss) + .buttonStyle(WeiBeiTextActionButtonStyle()) + Button(store.ui("保存关联", "Save links")) { + if let noteItemID { + store.setLinkedSourceIDs(draftIDs, for: noteItemID) + } + dismiss() + } + .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) + } + .padding(12) + } + .frame(width: 440) + .background(WeiBeiTheme.paperRaised) + .onAppear { + noteItemID = store.activeNotebookItemID + if let noteItemID { + draftIDs = Set(store.linkedSourceIDs(for: noteItemID)) + } + } + } + + private func sourceButton(_ item: StudyItem, showsCurrentLabel: Bool = false) -> some View { + Button { toggle(item.id) } label: { + HStack(spacing: 9) { + Image(systemName: draftIDs.contains(item.id) ? "checkmark.square.fill" : "square") + .foregroundStyle(draftIDs.contains(item.id) ? WeiBeiTheme.cinnabar : WeiBeiTheme.tertiaryInk) + Image(systemName: item.kind.systemImage) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(width: 17) + VStack(alignment: .leading, spacing: 2) { + Text(store.displayTitle(for: item)).lineLimit(1) + if !showsCurrentLabel { + Text(item.url?.deletingLastPathComponent().path.replacingOccurrences(of: NSHomeDirectory(), with: "~") ?? store.displaySubtitle(for: item)) + .font(.caption2) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .lineLimit(1) + } + } + Spacer() + Text(showsCurrentLabel ? store.ui("当前", "Open") : item.kind.label(language: store.interfaceLanguage)) + .font(.caption2) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + } + .contentShape(Rectangle()) + .padding(.horizontal, 8) + .frame(height: showsCurrentLabel ? 36 : 42) + } + .buttonStyle(.plain) + .accessibilityValue(Text(draftIDs.contains(item.id) ? store.ui("已关联", "Linked") : store.ui("未关联", "Not linked"))) + } + + private func toggle(_ sourceID: String) { + if draftIDs.contains(sourceID) { + draftIDs.remove(sourceID) + } else { + draftIDs.insert(sourceID) + } + } +} diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 439497fcd..7a5755f7a 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -289,6 +289,11 @@ struct NotePaneView: View { private let noteDraftFlushDelayNanoseconds: UInt64 = 220_000_000 + private static var showsLinkedSourcesVerificationOverlay: Bool { + ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] == "linked-sources-flow" + && ProcessInfo.processInfo.environment["WEIBEI_SUPPRESS_ACTIVATION"] == "1" + } + var body: some View { GeometryReader { geometry in let railOnly = ContentRailMetrics.isRailOnly( @@ -316,17 +321,19 @@ struct NotePaneView: View { .opacity(railOnly ? 0 : 1) .allowsHitTesting(!railOnly) - ContentRailView( - label: store.ui("文稿目录", "Draft outline"), - items: railItems, - activeID: activeNoteRailID ?? railItems.first?.id, - appearanceMode: store.appearanceMode, - isRailOnly: railOnly, - availableWidth: geometry.size.width, - topInset: railOnly ? 0 : (showsPaneHeader ? 44 : 34), - onActivate: { activateNoteRailItem($0, railOnly: railOnly) } - ) - .zIndex(4) + if store.layout != .immersiveWriting { + ContentRailView( + label: store.ui("文稿目录", "Draft outline"), + items: railItems, + activeID: activeNoteRailID ?? railItems.first?.id, + appearanceMode: store.appearanceMode, + isRailOnly: railOnly, + availableWidth: geometry.size.width, + topInset: railOnly ? 0 : (showsPaneHeader ? 44 : 34), + onActivate: { activateNoteRailItem($0, railOnly: railOnly) } + ) + .zIndex(4) + } } } .frame(minHeight: 280) @@ -337,6 +344,17 @@ struct NotePaneView: View { immersiveNoteHeader } } + .overlay(alignment: .topTrailing) { + if Self.showsLinkedSourcesVerificationOverlay { + LinkedSourcesPopover(dismiss: {}) + .environmentObject(store) + .clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous)) + .shadow(color: WeiBeiTheme.ink.opacity(0.16), radius: 22, y: 10) + .padding(.top, 48) + .padding(.trailing, 24) + .allowsHitTesting(false) + } + } .animation(WeiBeiMotion.panel, value: store.notebookCreationDraft?.id) .onAppear { pullExternalNoteText() @@ -386,6 +404,8 @@ struct NotePaneView: View { appearanceMode: store.appearanceMode, reorderRole: reorderRole ) { + LinkedSourcesControl() + writingAssistControl noteModeControl newNoteControl } @@ -402,10 +422,12 @@ struct NotePaneView: View { mark: "NOTES", title: noteHeaderSubtitle, appearanceMode: store.appearanceMode, - isPinned: store.notebookCreationDraft != nil, + isPinned: store.notebookCreationDraft != nil || store.linkedSourcesPresented, actionsAlignedTrailing: true, reorderRole: reorderRole ) { + LinkedSourcesControl() + writingAssistControl noteModeControl newNoteControl } @@ -440,6 +462,57 @@ struct NotePaneView: View { ) } + private var writingAssistControl: some View { + Menu { + Button { + prepareWritingAssist(store.ui( + "请根据\(store.agentPromptScope),给出一版更清晰的笔记大纲。", + "Use \(store.agentPromptScope) to produce a clearer note outline." + )) + } label: { + Label(store.ui("大纲建议", "Outline"), systemImage: "list.bullet.rectangle") + } + Button { + prepareWritingAssist(store.hasSelectedMaterial + ? store.ui( + "请检查当前笔记缺少来源的位置,并建议应该引用当前资料的哪些部分。", + "Find where the current note needs sources and suggest which parts of the current material to cite." + ) + : store.ui( + "请检查当前笔记缺少来源的位置,并标出需要补证据的段落。", + "Find where the current note needs sources and mark the paragraphs that need evidence." + )) + } label: { + Label(store.ui("补来源", "Add Sources"), systemImage: "link") + } + Button { + prepareWritingAssist(store.ui( + "请整理和润色当前笔记,保留原意,并标出缺少来源的位置。", + "Organize and polish the current note, preserve the meaning, and mark where sources are missing." + )) + } label: { + Label(store.ui("润色表达", "Polish"), systemImage: "text.quote") + } + } label: { + Label(store.ui("整理", "Refine"), systemImage: "text.badge.checkmark") + } + .menuStyle(.borderlessButton) + .fixedSize() + .font(.system(size: 11, weight: .medium)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .accessibilityLabel(Text(store.ui("整理当前笔记", "Refine current note"))) + .help(store.ui("按需生成大纲、补来源或润色表达", "Create an outline, add sources, or polish on demand")) + } + + private func prepareWritingAssist(_ prompt: String) { + flushNoteDraft(immediate: true) + withAnimation(WeiBeiMotion.layout) { + store.agentDraft = prompt + store.setLayout(.immersiveConversation) + store.revealRightPane(focusing: .agent) + } + } + @ViewBuilder private var newNoteControl: some View { if store.hasSelectedMaterial { @@ -2735,188 +2808,6 @@ struct QuietInsightView: View { } } -struct ContextRailItem: Identifiable { - var title: String - var help: String? - var systemImage: String? - var emphasized = false - var action: (() -> Void)? - - var id: String { - title - } -} - -struct ContextRailView: View { - var title: String - var items: [ContextRailItem] - var edge: HorizontalEdge = .trailing - @State private var appeared = false - - var body: some View { - VStack(alignment: .leading, spacing: 11) { - HStack(spacing: 6) { - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(0.80)) - .frame(width: 12, height: 1) - Text(title) - .font(.system(size: 11, weight: .semibold, design: .serif)) - .foregroundStyle(WeiBeiTheme.secondaryInk) - } - .padding(.horizontal, 4) - - ForEach(items) { item in - ContextRailLine(item: item, inwardOffset: inwardOffset) - .transition(WeiBeiTransition.message) - } - - Spacer() - } - .padding(.top, 17) - .padding(.horizontal, 12) - .frame(maxWidth: .infinity, alignment: .leading) - .foregroundStyle(WeiBeiTheme.ink) - .background(railBackground) - .overlay(alignment: separatorAlignment) { - LinearGradient( - colors: [ - .clear, - WeiBeiTheme.hairline.opacity(0.34), - .clear - ], - startPoint: .top, - endPoint: .bottom - ) - .frame(width: 1) - } - .overlay(alignment: highlightAlignment) { - LinearGradient( - colors: [ - WeiBeiTheme.glassHighlight.opacity(0.22), - .clear - ], - startPoint: .top, - endPoint: .bottom - ) - .frame(width: 1) - } - .opacity(appeared ? 1 : 0) - .offset(y: appeared ? 0 : 8) - .onAppear { - withAnimation(WeiBeiMotion.reveal) { - appeared = true - } - } - } - - private var inwardOffset: CGFloat { - edge == .leading ? -3 : 3 - } - - private var railBackground: some View { - ZStack(alignment: highlightAlignment) { - WeiBeiTheme.paperRaised.opacity(0.10) - LinearGradient( - colors: [ - WeiBeiTheme.paperRaised.opacity(0.26), - WeiBeiTheme.paper.opacity(0.08), - .clear - ], - startPoint: edge == .leading ? .leading : .trailing, - endPoint: edge == .leading ? .trailing : .leading - ) - .frame(width: 22) - LinearGradient( - colors: [ - WeiBeiTheme.glassHighlight.opacity(0.12), - .clear - ], - startPoint: .top, - endPoint: .bottom - ) - .frame(width: 1) - } - } - - private var separatorAlignment: Alignment { - edge == .leading ? .leading : .trailing - } - - private var highlightAlignment: Alignment { - edge == .leading ? .trailing : .leading - } -} - -private struct ContextRailLine: View { - var item: ContextRailItem - var inwardOffset: CGFloat - @State private var hovering = false - - var body: some View { - if let action = item.action { - Button(action: action) { - lineContent - } - .buttonStyle(.plain) - .contentShape(Rectangle()) - .help(item.help ?? item.title) - .accessibilityLabel(Text(item.help ?? item.title)) - .onHover { hovering in - setHovering(hovering) - } - .animation(WeiBeiMotion.micro, value: item.emphasized) - } else { - lineContent - .onHover { hovering in - setHovering(hovering) - } - .animation(WeiBeiMotion.micro, value: item.emphasized) - } - } - - private var lineContent: some View { - HStack(alignment: .firstTextBaseline, spacing: 8) { - Capsule() - .fill(railMarkColor) - .frame(width: 2, height: hovering || item.emphasized ? 15 : 10) - if let systemImage = item.systemImage { - Image(systemName: systemImage) - .font(.system(size: 11, weight: .semibold)) - .frame(width: 14) - .foregroundStyle(iconColor) - } - Text(item.title) - .lineLimit(2) - } - .font(.system(size: 12, weight: item.emphasized ? .semibold : .medium)) - .foregroundStyle(item.emphasized || hovering ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk) - .padding(.horizontal, 5) - .padding(.vertical, 4) - .frame(minHeight: 24, alignment: .leading) - .frame(maxWidth: .infinity, alignment: .leading) - .background(WeiBeiTheme.paperInset.opacity(hovering ? 0.16 : item.emphasized ? 0.06 : 0)) - .clipShape(RoundedRectangle(cornerRadius: 5)) - .offset(x: hovering ? inwardOffset : 0) - } - - private var railMarkColor: Color { - if item.emphasized { return WeiBeiTheme.cinnabar.opacity(hovering ? 0.54 : 0.38) } - if hovering { return WeiBeiTheme.cinnabar.opacity(0.28) } - return WeiBeiTheme.hairline.opacity(0.90) - } - - private var iconColor: Color { - if item.emphasized || hovering { return WeiBeiTheme.cinnabar.opacity(0.74) } - return WeiBeiTheme.tertiaryInk - } - - private func setHovering(_ hovering: Bool) { - withAnimation(WeiBeiMotion.hover) { - self.hovering = hovering - } - } -} - private struct AgentBubble: View { @EnvironmentObject private var store: WorkspaceStore var message: AgentMessage diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift index 901371d5c..8021f65fa 100644 --- a/Sources/WeiBei/Views/ReaderView.swift +++ b/Sources/WeiBei/Views/ReaderView.swift @@ -4,6 +4,10 @@ import SwiftUI import WeiBeiCore import WebKit +extension Notification.Name { + static let weiBeiVerificationUserScroll = Notification.Name("WeiBeiVerificationUserScroll") +} + struct ImmersiveHoverTitleView<Actions: View>: View { let mark: String let title: String @@ -140,6 +144,8 @@ struct ReaderView: View { @State private var pdfControlsExpanded = false @State private var pdfControlsCollapseToken = UUID() @State private var pendingPDFPageIndex: Int? + @State private var pendingPDFPageRequestID: UUID? + @State private var pendingPDFPageRecordsLocation = false @State private var pdfHasSelectableText: Bool? @State private var pdfContentRailItems: [ContentRailItem] = [] @State private var pdfRailTargetPageIndex: Int? @@ -147,6 +153,8 @@ struct ReaderView: View { @State private var htmlContentRailItems: [ContentRailItem] = [] @State private var htmlContentRailActiveID: String? @State private var htmlContentRailTarget: WebReaderContentRailTarget? + @State private var pendingHTMLLocationCommit: Task<Void, Never>? + @State private var pendingPDFLocationCommit: Task<Void, Never>? var body: some View { GeometryReader { geometry in @@ -207,13 +215,17 @@ struct ReaderView: View { .animation(WeiBeiMotion.panel, value: pdfHasSelectableText) .onAppear { syncReaderLocationTitle() - pendingPDFPageIndex = store.readerTargetPageIndex + capturePendingPDFPageRequest() htmlContentRailActiveID = store.readerLocationID applyPendingPDFPageIfReady() applyPendingHTMLLocationIfReady() rebuildPDFContentRail() } .onChange(of: store.selectedItemID) { _, _ in + pendingHTMLLocationCommit?.cancel() + pendingHTMLLocationCommit = nil + pendingPDFLocationCommit?.cancel() + pendingPDFLocationCommit = nil pdfPageIndex = 0 pdfPageCount = store.selectedMaterialItem?.kind == .pdf && store.selectedMaterialItem?.url == nil ? 1 : 0 pdfHasSelectableText = store.selectedMaterialItem?.kind == .pdf && store.selectedMaterialItem?.url == nil ? true : nil @@ -224,13 +236,12 @@ struct ReaderView: View { htmlContentRailActiveID = store.readerLocationID htmlContentRailTarget = nil syncReaderLocationTitle() - pendingPDFPageIndex = store.readerTargetPageIndex + capturePendingPDFPageRequest() applyPendingPDFPageIfReady() applyPendingHTMLLocationIfReady() rebuildPDFContentRail() } .onChange(of: pdfPageIndex) { _, _ in - store.updateReaderPageIndex(pdfPageIndex) syncReaderLocationTitle() } .onChange(of: pdfPageCount) { _, _ in @@ -239,7 +250,11 @@ struct ReaderView: View { rebuildPDFContentRail() } .onChange(of: store.readerTargetPageIndex) { _, target in - pendingPDFPageIndex = target + capturePendingPDFPageRequest() + applyPendingPDFPageIfReady() + } + .onChange(of: store.readerTargetPageRequestID) { _, _ in + capturePendingPDFPageRequest() applyPendingPDFPageIfReady() } .onChange(of: store.readerTargetLocationID) { _, _ in @@ -248,6 +263,9 @@ struct ReaderView: View { .onChange(of: store.readerTargetLocationTitle) { _, _ in applyPendingHTMLLocationIfReady() } + .onChange(of: store.readerTargetLocationRequestID) { _, _ in + applyPendingHTMLLocationIfReady() + } } private func syncReaderLocationTitle() { @@ -320,7 +338,10 @@ struct ReaderView: View { } switch store.selectedMaterialItem?.kind { case .pdf: - pdfRailTargetPageIndex = Self.pdfPageIndex(fromContentRailID: item.id) + if let pageIndex = Self.pdfPageIndex(fromContentRailID: item.id) { + pdfRailTargetPageIndex = pageIndex + schedulePDFLocationCommit(pageIndex) + } case .html: htmlContentRailTarget = WebReaderContentRailTarget(id: item.id) default: @@ -378,7 +399,7 @@ struct ReaderView: View { } private func applyHTMLContentRailSections(_ sections: [WebReaderContentRailSection]) { - htmlContentRailItems = sections.map { section in + let items = sections.map { section in ContentRailItem( id: section.id, position: section.position, @@ -388,21 +409,54 @@ struct ReaderView: View { metadata: section.metadata ) } + htmlContentRailItems = items if let activeID = htmlContentRailActiveID, !htmlContentRailItems.contains(where: { $0.id == activeID }) { - applyHTMLContentRailActiveID(htmlContentRailItems.first?.id) - } else if let activeID = htmlContentRailActiveID { - applyHTMLContentRailActiveID(activeID) + htmlContentRailActiveID = htmlContentRailItems.first?.id } applyPendingHTMLLocationIfReady() } - private func applyHTMLContentRailActiveID(_ id: String?) { - htmlContentRailActiveID = id + private func applyHTMLContentRailActiveID(_ change: WebReaderContentRailActiveChange) { + let id = change.id + if htmlContentRailActiveID != id { + htmlContentRailActiveID = id + } + guard change.reason == .scroll || change.reason == .jump else { return } let title = id.flatMap { activeID in htmlContentRailItems.first(where: { $0.id == activeID })?.title } - store.updateReaderHTMLLocation(id: id, title: title) + scheduleHTMLLocationCommit(id: id, title: title, reason: change.reason) + } + + private func scheduleHTMLLocationCommit( + id: String?, + title: String?, + reason: WebReaderContentRailEventReason + ) { + pendingHTMLLocationCommit?.cancel() + let itemID = store.selectedMaterialItem?.id + pendingHTMLLocationCommit = Task { @MainActor in + try? await Task.sleep(nanoseconds: 350_000_000) + guard !Task.isCancelled, + store.selectedMaterialItem?.id == itemID, + htmlContentRailActiveID == id else { return } + pendingHTMLLocationCommit = nil + store.updateReaderHTMLLocation(id: id, title: title, reason: reason.rawValue) + } + } + + private func schedulePDFLocationCommit(_ pageIndex: Int) { + pendingPDFLocationCommit?.cancel() + let itemID = store.selectedMaterialItem?.id + pendingPDFLocationCommit = Task { @MainActor in + try? await Task.sleep(nanoseconds: 350_000_000) + guard !Task.isCancelled, + store.selectedMaterialItem?.id == itemID, + pdfPageIndex == pageIndex else { return } + pendingPDFLocationCommit = nil + store.updateReaderPageIndex(pageIndex) + } } private func applyPendingHTMLLocationIfReady() { @@ -425,7 +479,9 @@ struct ReaderView: View { targetID = nil } guard let targetID else { return } - htmlContentRailTarget = WebReaderContentRailTarget(id: targetID) + let requestID = store.readerTargetLocationRequestID + guard htmlContentRailTarget?.requestID != requestID else { return } + htmlContentRailTarget = WebReaderContentRailTarget(id: targetID, requestID: requestID) } private static func normalizedHTMLSectionTitle(_ title: String) -> String { @@ -480,15 +536,28 @@ struct ReaderView: View { private func applyPendingPDFPageIfReady() { guard let target = pendingPDFPageIndex, + let requestID = pendingPDFPageRequestID, store.selectedMaterialItem?.kind == .pdf, pdfPageCount > 0 else { return } pdfBrowseMode = .page - pdfPageIndex = min(max(target, 0), max(pdfPageCount - 1, 0)) + let resolvedPageIndex = min(max(target, 0), max(pdfPageCount - 1, 0)) + pdfPageIndex = resolvedPageIndex + if pendingPDFPageRecordsLocation { + schedulePDFLocationCommit(resolvedPageIndex) + } pendingPDFPageIndex = nil - store.readerTargetPageIndex = nil + pendingPDFPageRequestID = nil + pendingPDFPageRecordsLocation = false + store.consumeReaderPDFPageRequest(requestID) syncReaderLocationTitle() } + private func capturePendingPDFPageRequest() { + pendingPDFPageIndex = store.readerTargetPageIndex + pendingPDFPageRequestID = store.readerTargetPageRequestID + pendingPDFPageRecordsLocation = store.readerTargetPageRecordsLocation + } + private var pdfFloatingControls: some View { HStack(spacing: 6) { pdfControls @@ -564,6 +633,7 @@ struct ReaderView: View { guard next != pdfPageIndex else { return } store.recordReaderPageNavigationPoint() pdfPageIndex = next + schedulePDFLocationCommit(next) } label: { Image(systemName: "chevron.left") } @@ -583,6 +653,7 @@ struct ReaderView: View { guard next != pdfPageIndex else { return } store.recordReaderPageNavigationPoint() pdfPageIndex = next + schedulePDFLocationCommit(next) } label: { Image(systemName: "chevron.right") } @@ -679,6 +750,7 @@ struct ReaderView: View { pageIndex: $pdfPageIndex, pageCount: $pdfPageCount, railTargetPageIndex: $pdfRailTargetPageIndex, + onUserPageChange: schedulePDFLocationCommit, onSelectableTextChange: { available in pdfHasSelectableText = available } ) { text, anchor, selectionPageIndex in let title = store.displayTitle(for: item) @@ -781,6 +853,21 @@ struct WebReaderContentRailTarget: Equatable { var requestID = UUID() } +enum WebReaderContentRailEventReason: String { + case initial + case resize + case mutation + case scroll + case jump + case programmatic + case unknown +} + +struct WebReaderContentRailActiveChange { + var id: String? + var reason: WebReaderContentRailEventReason +} + private struct PDFContentRailPreview { var image: NSImage var title: String @@ -909,6 +996,7 @@ private struct PDFReaderRepresentable: NSViewRepresentable { @Binding var pageIndex: Int @Binding var pageCount: Int @Binding var railTargetPageIndex: Int? + var onUserPageChange: (Int) -> Void var onSelectableTextChange: (Bool?) -> Void = { _ in } var onSelectionChange: (String, CGPoint?, Int) -> Void @@ -916,12 +1004,14 @@ private struct PDFReaderRepresentable: NSViewRepresentable { Coordinator( pageIndex: $pageIndex, pageCount: $pageCount, + onUserPageChange: onUserPageChange, onSelectableTextChange: onSelectableTextChange, onSelectionChange: onSelectionChange ) } func makeNSView(context: Context) -> ReaderPDFView { + PaneToggleContinuityVerifier.recordPDFReaderMake() let view = ReaderPDFView() view.autoScales = true view.displayDirection = .vertical @@ -947,6 +1037,7 @@ private struct PDFReaderRepresentable: NSViewRepresentable { context.coordinator.pageIndex = $pageIndex context.coordinator.pageCount = $pageCount context.coordinator.appearanceMode = appearanceMode + context.coordinator.onUserPageChange = onUserPageChange context.coordinator.onSelectableTextChange = onSelectableTextChange view.backgroundColor = WeiBeiNativePalette.paper(for: appearanceMode) view.configureDocumentColorAdaptation(enabled: adaptsDocumentColors, appearanceMode: appearanceMode) @@ -993,9 +1084,16 @@ private struct PDFReaderRepresentable: NSViewRepresentable { } } + static func dismantleNSView(_ view: ReaderPDFView, coordinator: Coordinator) { + PaneToggleContinuityVerifier.recordPDFReaderDismantle() + coordinator.suspend() + view.reportCurrentSelection = nil + } + final class Coordinator: NSObject { var pageIndex: Binding<Int> var pageCount: Binding<Int> + var onUserPageChange: (Int) -> Void var onSelectableTextChange: (Bool?) -> Void var onSelectionChange: (String, CGPoint?, Int) -> Void var appearanceMode: WeiBeiAppearanceMode = .paper @@ -1010,15 +1108,22 @@ private struct PDFReaderRepresentable: NSViewRepresentable { private var ocrHighlightedLinesByPageIndex: [Int: Set<Int>] = [:] private var lastSearchQuery = "" private var loadGeneration = 0 + private var userNavigationDeadline = Date.distantPast private(set) var loadedURL: URL? - init(pageIndex: Binding<Int>, pageCount: Binding<Int>, onSelectableTextChange: @escaping (Bool?) -> Void, onSelectionChange: @escaping (String, CGPoint?, Int) -> Void) { + init(pageIndex: Binding<Int>, pageCount: Binding<Int>, onUserPageChange: @escaping (Int) -> Void, onSelectableTextChange: @escaping (Bool?) -> Void, onSelectionChange: @escaping (String, CGPoint?, Int) -> Void) { self.pageIndex = pageIndex self.pageCount = pageCount + self.onUserPageChange = onUserPageChange self.onSelectableTextChange = onSelectableTextChange self.onSelectionChange = onSelectionChange } + func suspend() { + selectionWork?.cancel() + removeObservers() + } + func load(_ url: URL, in view: PDFView) { loadGeneration += 1 let generation = loadGeneration @@ -1184,14 +1289,28 @@ private struct PDFReaderRepresentable: NSViewRepresentable { ) { [weak self] _ in guard let self, let view = self.observedView, let document = view.document, let page = view.currentPage else { return } self.pageCount.wrappedValue = document.pageCount - self.pageIndex.wrappedValue = document.index(for: page) + let index = document.index(for: page) + self.pageIndex.wrappedValue = index + if Date() <= self.userNavigationDeadline { + self.onUserPageChange(index) + } self.updateSelectableTextState(in: view) self.ensureOCRForCurrentPage(in: view) } - eventMonitor = NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown, .leftMouseDragged, .leftMouseUp]) { [weak self, weak view] event in + eventMonitor = NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown, .leftMouseDragged, .leftMouseUp, .scrollWheel, .keyDown]) { [weak self, weak view] event in guard let self, let view, event.window === view.window else { return event } + if event.type == .keyDown { + if self.isFirstResponderInside(view) { + self.markUserNavigationIntent() + } + return event + } let location = view.convert(event.locationInWindow, from: nil) guard view.bounds.contains(location) else { return event } + if event.type == .scrollWheel { + self.markUserNavigationIntent() + return event + } if event.type == .leftMouseDown { view.window?.makeFirstResponder(view) return event @@ -1204,6 +1323,15 @@ private struct PDFReaderRepresentable: NSViewRepresentable { } } + private func markUserNavigationIntent() { + userNavigationDeadline = Date().addingTimeInterval(0.9) + } + + private func isFirstResponderInside(_ view: NSView) -> Bool { + guard let responder = view.window?.firstResponder as? NSView else { return false } + return responder === view || responder.isDescendant(of: view) + } + private func removeObservers() { if let observer { NotificationCenter.default.removeObserver(observer) @@ -1314,8 +1442,7 @@ private struct PDFReaderRepresentable: NSViewRepresentable { } deinit { - selectionWork?.cancel() - removeObservers() + suspend() } } } @@ -1532,10 +1659,17 @@ struct WebReaderRepresentable: NSViewRepresentable { var adaptsDocumentColors: Bool var contentRailTarget: WebReaderContentRailTarget? var onContentRailChange: ([WebReaderContentRailSection]) -> Void - var onContentRailActiveChange: (String?) -> Void + var onContentRailActiveChange: (WebReaderContentRailActiveChange) -> Void var onAppShortcut: (String, NSEvent.ModifierFlags) -> Bool var onSelectionChange: (String, CGPoint?) -> Void + private static let scriptMessageNames = [ + "selection", + "appShortcut", + "contentRailSections", + "contentRailActive" + ] + init( html: String, searchQuery: String = "", @@ -1543,7 +1677,7 @@ struct WebReaderRepresentable: NSViewRepresentable { adaptsDocumentColors: Bool = true, contentRailTarget: WebReaderContentRailTarget? = nil, onContentRailChange: @escaping ([WebReaderContentRailSection]) -> Void = { _ in }, - onContentRailActiveChange: @escaping (String?) -> Void = { _ in }, + onContentRailActiveChange: @escaping (WebReaderContentRailActiveChange) -> Void = { _ in }, onAppShortcut: @escaping (String, NSEvent.ModifierFlags) -> Bool = { _, _ in false }, onSelectionChange: @escaping (String, CGPoint?) -> Void ) { @@ -1566,7 +1700,7 @@ struct WebReaderRepresentable: NSViewRepresentable { adaptsDocumentColors: Bool = true, contentRailTarget: WebReaderContentRailTarget? = nil, onContentRailChange: @escaping ([WebReaderContentRailSection]) -> Void = { _ in }, - onContentRailActiveChange: @escaping (String?) -> Void = { _ in }, + onContentRailActiveChange: @escaping (WebReaderContentRailActiveChange) -> Void = { _ in }, onAppShortcut: @escaping (String, NSEvent.ModifierFlags) -> Bool = { _, _ in false }, onSelectionChange: @escaping (String, CGPoint?) -> Void ) { @@ -1595,12 +1729,12 @@ struct WebReaderRepresentable: NSViewRepresentable { } func makeNSView(context: Context) -> WKWebView { + PaneToggleContinuityVerifier.recordWebReaderMake() let configuration = WKWebViewConfiguration() let controller = WKUserContentController() - controller.add(context.coordinator, name: "selection") - controller.add(context.coordinator, name: "appShortcut") - controller.add(context.coordinator, name: "contentRailSections") - controller.add(context.coordinator, name: "contentRailActive") + for name in Self.scriptMessageNames { + controller.add(context.coordinator, name: name) + } controller.addUserScript(WKUserScript( source: Self.appShortcutScript, injectionTime: .atDocumentStart, @@ -1627,6 +1761,7 @@ struct WebReaderRepresentable: NSViewRepresentable { view.setValue(false, forKey: "drawsBackground") context.coordinator.webView = view view.navigationDelegate = context.coordinator + context.coordinator.installVerificationScrollObserverIfNeeded() return view } @@ -1663,10 +1798,17 @@ struct WebReaderRepresentable: NSViewRepresentable { } static func dismantleNSView(_ view: WKWebView, coordinator: Coordinator) { - view.configuration.userContentController.removeScriptMessageHandler(forName: "selection") - view.configuration.userContentController.removeScriptMessageHandler(forName: "appShortcut") - view.configuration.userContentController.removeScriptMessageHandler(forName: "contentRailSections") - view.configuration.userContentController.removeScriptMessageHandler(forName: "contentRailActive") + PaneToggleContinuityVerifier.recordWebReaderDismantle() + coordinator.removeVerificationScrollObserver() + unbindScriptMessages(in: view) + view.navigationDelegate = nil + } + + private static func unbindScriptMessages(in view: WKWebView) { + let controller = view.configuration.userContentController + for name in scriptMessageNames { + controller.removeScriptMessageHandler(forName: name) + } } static let appShortcutScript = """ @@ -1757,7 +1899,10 @@ struct WebReaderRepresentable: NSViewRepresentable { items: [], activeID: "", activeFrame: 0, - scanTimer: 0 + scanTimer: 0, + pendingScanReason: "initial", + jumpUntil: 0, + userScrollUntil: 0 }; const clean = (value) => String(value || "").replace(/\\s+/g, " ").trim(); const clipped = (value, limit) => clean(value).slice(0, limit); @@ -1899,61 +2044,100 @@ struct WebReaderRepresentable: NSViewRepresentable { }))); }; - const updateActive = () => { - window.cancelAnimationFrame(state.activeFrame); - state.activeFrame = window.requestAnimationFrame(() => { - if (state.items.length === 0) { - if (state.activeID) { - state.activeID = ""; - window.webkit?.messageHandlers?.contentRailActive?.postMessage({ id: "" }); - } - return; - } - const readingLine = window.scrollY + window.innerHeight * 0.32; - let active = state.items[0]; - for (const item of state.items) { - if (item.top <= readingLine) active = item; - else break; + const applyActive = (requestedReason = "unknown") => { + const now = Date.now(); + const reason = requestedReason === "scroll" + ? (now <= state.jumpUntil ? "jump" : now <= state.userScrollUntil ? "scroll" : "programmatic") + : requestedReason; + if (state.items.length === 0) { + if (state.activeID) { + state.activeID = ""; + window.webkit?.messageHandlers?.contentRailActive?.postMessage({ id: "", reason }); } - if (active.id === state.activeID) return; - state.activeID = active.id; - window.webkit?.messageHandlers?.contentRailActive?.postMessage({ id: active.id }); - }); + return; + } + const readingLine = window.scrollY + window.innerHeight * 0.32; + let active = state.items[0]; + for (const item of state.items) { + if (item.top <= readingLine) active = item; + else break; + } + if (active.id === state.activeID) return; + state.activeID = active.id; + window.webkit?.messageHandlers?.contentRailActive?.postMessage({ id: active.id, reason }); + }; + + const updateActive = (requestedReason = "unknown") => { + window.cancelAnimationFrame(state.activeFrame); + state.activeFrame = window.requestAnimationFrame(() => applyActive(requestedReason)); }; - const scan = () => { + const scan = (reason = "unknown") => { const headings = headingSections(); state.items = (headings.length > 0 ? headings : fallbackSections()) .sort((left, right) => left.top - right.top); postSections(); - updateActive(); + updateActive(reason); }; - const scheduleScan = () => { + const scheduleScan = (reason) => { + state.pendingScanReason = reason; window.clearTimeout(state.scanTimer); - state.scanTimer = window.setTimeout(scan, 160); + state.scanTimer = window.setTimeout(() => scan(state.pendingScanReason), 160); }; const scrollTo = (id) => { const item = state.items.find((candidate) => candidate.id === id); if (!item?.element) return false; + state.jumpUntil = Date.now() + 1600; item.element.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" }); window.setTimeout(() => window.scrollBy({ top: -44, behavior: "auto" }), 180); + window.setTimeout(() => { + state.activeID = id; + window.webkit?.messageHandlers?.contentRailActive?.postMessage({ id, reason: "jump" }); + }, 240); return true; }; - window.WeiBeiContentRail = { installed: true, scan, scrollTo }; - window.addEventListener("scroll", updateActive, { passive: true }); - window.addEventListener("resize", scheduleScan, { passive: true }); - new MutationObserver(scheduleScan).observe(document.body || document.documentElement, { + const markUserScrollIntent = () => { + state.userScrollUntil = Date.now() + 900; + }; + + const markKeyboardScrollIntent = (event) => { + const keys = ["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]; + if (keys.includes(event.key)) markUserScrollIntent(); + }; + + const simulateUserScrollForVerification = () => { + const before = window.scrollY; + const maximum = maximumScroll(); + state.activeID = ""; + window.dispatchEvent(new WheelEvent("wheel", { deltaY: window.innerHeight * 2.4 })); + window.scrollTo({ top: maximum, behavior: "auto" }); + applyActive("scroll"); + return `before:${before},after:${window.scrollY},max:${maximum},intent:${state.userScrollUntil > Date.now()}`; + }; + + window.WeiBeiContentRail = { + installed: true, + scan: () => scan("initial"), + scrollTo, + simulateUserScrollForVerification + }; + window.addEventListener("wheel", markUserScrollIntent, { passive: true }); + window.addEventListener("touchmove", markUserScrollIntent, { passive: true }); + window.addEventListener("keydown", markKeyboardScrollIntent, { passive: true }); + window.addEventListener("scroll", () => updateActive("scroll"), { passive: true }); + window.addEventListener("resize", () => scheduleScan("resize"), { passive: true }); + new MutationObserver(() => scheduleScan("mutation")).observe(document.body || document.documentElement, { childList: true, characterData: true, subtree: true }); if (window.ResizeObserver) { - new ResizeObserver(scheduleScan).observe(document.body || document.documentElement); + new ResizeObserver(() => scheduleScan("resize")).observe(document.body || document.documentElement); } - window.requestAnimationFrame(scan); + window.requestAnimationFrame(() => scan("initial")); })(); """ @@ -2054,7 +2238,7 @@ struct WebReaderRepresentable: NSViewRepresentable { var onSelectionChange: (String, CGPoint?) -> Void var onAppShortcut: (String, NSEvent.ModifierFlags) -> Bool var onContentRailChange: ([WebReaderContentRailSection]) -> Void - var onContentRailActiveChange: (String?) -> Void + var onContentRailActiveChange: (WebReaderContentRailActiveChange) -> Void var contentRailTarget: WebReaderContentRailTarget? var loadedSignature: String? var searchQuery = "" @@ -2062,6 +2246,7 @@ struct WebReaderRepresentable: NSViewRepresentable { var adaptsDocumentColors = true private var lastAppliedSearchQuery = "" private var lastAppliedContentRailTargetRequestID: UUID? + private var observesVerificationScroll = false weak var webView: WKWebView? init( @@ -2069,7 +2254,7 @@ struct WebReaderRepresentable: NSViewRepresentable { adaptsDocumentColors: Bool, contentRailTarget: WebReaderContentRailTarget?, onContentRailChange: @escaping ([WebReaderContentRailSection]) -> Void, - onContentRailActiveChange: @escaping (String?) -> Void, + onContentRailActiveChange: @escaping (WebReaderContentRailActiveChange) -> Void, onAppShortcut: @escaping (String, NSEvent.ModifierFlags) -> Bool, onSelectionChange: @escaping (String, CGPoint?) -> Void ) { @@ -2082,6 +2267,37 @@ struct WebReaderRepresentable: NSViewRepresentable { self.onSelectionChange = onSelectionChange } + func installVerificationScrollObserverIfNeeded() { + guard !observesVerificationScroll, + ProcessInfo.processInfo.environment["WEIBEI_VERIFY_SCENARIO"] == "reader-scroll-persistence-flow" else { return } + observesVerificationScroll = true + NotificationCenter.default.addObserver( + self, + selector: #selector(performVerificationUserScroll), + name: .weiBeiVerificationUserScroll, + object: nil + ) + } + + func removeVerificationScrollObserver() { + guard observesVerificationScroll else { return } + NotificationCenter.default.removeObserver(self, name: .weiBeiVerificationUserScroll, object: nil) + observesVerificationScroll = false + } + + @objc private func performVerificationUserScroll() { + guard let webView else { return } + PaneToggleContinuityVerifier.recordVerificationScrollScheduled() + webView.evaluateJavaScript( + "window.WeiBeiContentRail?.simulateUserScrollForVerification()" + ) { result, error in + let value = result as? String + ?? error.map { "error:\($0.localizedDescription)" } + ?? "missing-result" + PaneToggleContinuityVerifier.recordVerificationScrollResult(value) + } + } + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { if message.name == "appShortcut" { guard let body = message.body as? [String: Any], @@ -2093,6 +2309,7 @@ struct WebReaderRepresentable: NSViewRepresentable { if message.name == "contentRailSections" { guard let rows = message.body as? [[String: Any]] else { return } let sections = rows.compactMap(Self.contentRailSection(from:)) + PaneToggleContinuityVerifier.recordHTMLSectionEvent(count: sections.count) Task { @MainActor in self.onContentRailChange(sections) } @@ -2100,9 +2317,18 @@ struct WebReaderRepresentable: NSViewRepresentable { } if message.name == "contentRailActive" { - let id = (message.body as? [String: Any])?["id"] as? String + let body = message.body as? [String: Any] + let id = body?["id"] as? String + let reason = (body?["reason"] as? String) + .flatMap(WebReaderContentRailEventReason.init(rawValue:)) ?? .unknown + PaneToggleContinuityVerifier.recordHTMLActiveEvent(reason: reason.rawValue) Task { @MainActor in - self.onContentRailActiveChange(id?.isEmpty == false ? id : nil) + self.onContentRailActiveChange( + WebReaderContentRailActiveChange( + id: id?.isEmpty == false ? id : nil, + reason: reason + ) + ) } return } @@ -2260,7 +2486,7 @@ private struct EmptyReaderView: View { var body: some View { ReaderStateMessage( title: store.ui("选择资料", "Choose Material"), - detail: store.ui("从课程目录打开 HTML、PDF 或 Markdown。", "Open HTML, PDF, or Markdown from the course index."), + detail: store.ui("从资料库打开 HTML、PDF 或 Markdown。", "Open HTML, PDF, or Markdown from the library."), systemImage: "doc.text.magnifyingglass" ) } diff --git a/Sources/WeiBei/Views/SidebarView.swift b/Sources/WeiBei/Views/SidebarView.swift index be285b67b..839cc9708 100644 --- a/Sources/WeiBei/Views/SidebarView.swift +++ b/Sources/WeiBei/Views/SidebarView.swift @@ -10,7 +10,7 @@ struct SidebarView: View { VStack(spacing: 0) { HStack(alignment: .firstTextBaseline) { VStack(alignment: .leading, spacing: 1) { - Text(store.ui("课程目录", "Course Index")) + Text(store.ui("资料库", "Library")) .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 22, weight: .semibold)) Text(store.interfaceLanguage == .chinese ? "WEIBEI STUDY" : "WEIBEI") .font(WeiBeiTypography.englishBrandFont(size: 8.5, weight: .semibold)) @@ -32,7 +32,7 @@ struct SidebarView: View { TextField( "", text: $store.librarySearch, - prompt: Text(store.ui("搜索当前课程", "Search current course")) + prompt: Text(store.ui("搜索资料与笔记", "Search materials and notes")) .font(.system(size: 13)) .foregroundStyle(WeiBeiTheme.placeholderInk) ) @@ -53,8 +53,8 @@ struct SidebarView: View { ScrollView(showsIndicators: false) { LazyVStack(alignment: .leading, spacing: 14) { - sidebarSection(title: store.ui("课程样例", "Course Samples"), items: store.sampleItems) - sidebarSection(title: store.ui("我的资料", "My Materials"), items: importedMaterialItems) + sidebarSection(title: store.ui("课程资料", "Course Materials"), items: store.sampleItems) + sidebarSection(title: store.ui("导入资料", "Imported Materials"), items: importedMaterialItems) sidebarSection(title: store.ui("我的笔记", "My Notes"), items: notebookItems) } .padding(.horizontal, 10) diff --git a/Sources/WeiBei/Views/StableDocumentWorkspace.swift b/Sources/WeiBei/Views/StableDocumentWorkspace.swift index cb4e2e0d7..369f070a6 100644 --- a/Sources/WeiBei/Views/StableDocumentWorkspace.swift +++ b/Sources/WeiBei/Views/StableDocumentWorkspace.swift @@ -105,9 +105,7 @@ final class StableDocumentSplitView: NSView { fileprivate var emptyHost: NSHostingView<AnyView>? fileprivate let dividerViews = [StableDocumentDividerView(), StableDocumentDividerView()] fileprivate weak var coordinator: StableDocumentSplitCoordinator? -#if DEBUG private let continuityRecorder = PaneContinuityRecorder.configuredFromEnvironment() -#endif override var isFlipped: Bool { true } @@ -140,7 +138,6 @@ final class StableDocumentSplitView: NSView { assert(dividerViews.allSatisfy { $0.superview === self }) } -#if DEBUG func recordContinuityTransition(duration: TimeInterval) { continuityRecorder?.recordTransition(view: self, duration: duration) } @@ -150,10 +147,24 @@ final class StableDocumentSplitView: NSView { let roles = WorkspacePaneRole.allCases.compactMap { role -> PaneContinuityRoleSample? in guard let host = roleHosts[role] else { return nil } let presentationFrame = host.layer?.presentation()?.frame ?? host.frame + let contentHost = descendant( + identifiedBy: "persistent-pane-\(role.rawValue)", + in: host + ) + let contentAttached = contentHost?.superview != nil && contentHost?.window != nil + let slotHasVisibleArea = !host.isHidden + && host.alphaValue > 0.01 + && presentationFrame.width > 0.5 + && presentationFrame.height > 0.5 return PaneContinuityRoleSample( role: role.rawValue, hostID: String(describing: ObjectIdentifier(host)), parentID: host.superview.map { String(describing: ObjectIdentifier($0)) } ?? "none", + contentHostID: contentHost.map { String(describing: ObjectIdentifier($0)) }, + contentParentID: contentHost?.superview.map { String(describing: ObjectIdentifier($0)) }, + contentAttached: contentAttached, + slotHasVisibleArea: slotHasVisibleArea, + visibleContentReady: !slotHasVisibleArea || (contentAttached && contentHost?.isHidden == false), hidden: host.isHidden, modelFrame: host.frame, presentationFrame: presentationFrame @@ -165,12 +176,24 @@ final class StableDocumentSplitView: NSView { frame: frame, timestamp: ProcessInfo.processInfo.systemUptime, stableOwnership: roles.count == WorkspacePaneRole.allCases.count - && roles.allSatisfy { $0.parentID == parentID }, + && roles.allSatisfy { $0.parentID == parentID && $0.contentAttached }, + noBlankVisibleSlots: roles.allSatisfy(\.visibleContentReady), containerBounds: bounds, roles: roles ) } -#endif + + private func descendant(identifiedBy identifier: String, in root: NSView) -> NSView? { + if root.identifier?.rawValue == identifier { + return root + } + for subview in root.subviews { + if let match = descendant(identifiedBy: identifier, in: subview) { + return match + } + } + return nil + } override func layout() { super.layout() @@ -448,9 +471,7 @@ final class StableDocumentSplitCoordinator { deadline: .now() + layoutAnimationDuration + animationFallbackGrace, execute: finishAnimation ) -#if DEBUG splitView.recordContinuityTransition(duration: layoutAnimationDuration) -#endif } private func paneWidths( @@ -467,6 +488,34 @@ final class StableDocumentSplitCoordinator { } if preserveCurrentWidths, appliedState != nil { + let minimum = minimumPaneWidth(total: usable, count: count) + let enteringRoles = visibleOrder.filter { !displayedVisibleOrder.contains($0) } + let retainedRoles = visibleOrder.filter { displayedVisibleOrder.contains($0) } + if !enteringRoles.isEmpty { + let enteringDesired = enteringRoles.map { role in + max(minimum, recentReadableWidths[role] ?? defaultReadableWidth) + } + let maximumEnteringTotal = max( + minimum * CGFloat(enteringRoles.count), + usable - minimum * CGFloat(retainedRoles.count) + ) + let enteringTotal = retainedRoles.isEmpty + ? usable + : min(maximumEnteringTotal, enteringDesired.reduce(0, +)) + let enteringWidths = normalizedWidths(enteringDesired, total: enteringTotal) + let retainedDesired = retainedRoles.map { role in + splitView.roleHosts[role]?.frame.width ?? defaultReadableWidth + } + let retainedWidths = normalizedWidths( + retainedDesired, + total: max(0, usable - enteringWidths.reduce(0, +)) + ) + let widthsByRole = Dictionary( + uniqueKeysWithValues: Array(zip(enteringRoles, enteringWidths)) + + Array(zip(retainedRoles, retainedWidths)) + ) + return visibleOrder.map { widthsByRole[$0] ?? minimum } + } let desired = visibleOrder.map { role -> CGFloat in if displayedVisibleOrder.contains(role), let width = splitView.roleHosts[role]?.frame.width, width > 0.5 { return width @@ -800,6 +849,7 @@ final class StableDocumentSplitCoordinator { } updateDividerFrames(dividers, animated: true, in: splitView) }, completionHandler: finishAnimation) + splitView.recordContinuityTransition(duration: duration) DispatchQueue.main.asyncAfter( deadline: .now() + duration + animationFallbackGrace, execute: finishAnimation diff --git a/Sources/WeiBeiCore/CourseDocumentSearchIndex.swift b/Sources/WeiBeiCore/CourseDocumentSearchIndex.swift index 0c0789a71..e1772f3d9 100644 --- a/Sources/WeiBeiCore/CourseDocumentSearchIndex.swift +++ b/Sources/WeiBeiCore/CourseDocumentSearchIndex.swift @@ -1,5 +1,6 @@ import AppKit import CryptoKit +import Darwin import Foundation import PDFKit import SQLite3 @@ -62,6 +63,10 @@ public final class CourseDocumentSearchIndex: @unchecked Sendable { label: "com.changfenhuang.weibei.course-index", qos: .utility ) + private let metadataQueue = DispatchQueue( + label: "com.changfenhuang.weibei.course-index.metadata", + qos: .utility + ) private let ocrQueue = DispatchQueue( label: "com.changfenhuang.weibei.course-index.ocr", qos: .background @@ -176,27 +181,33 @@ public final class CourseDocumentSearchIndex: @unchecked Sendable { } public func schedule(_ items: [StudyItem]) { - let scheduledItems = items.compactMap(Self.scheduledItem) - schedulingLock.lock() - for scheduled in scheduledItems { - expectedSignaturesByStorageID[scheduled.storageID] = scheduled.signature + metadataQueue.async { [weak self] in + guard let self else { return } + let scheduledItems = items.compactMap(Self.scheduledItem) + self.schedulingLock.lock() + for scheduled in scheduledItems { + self.expectedSignaturesByStorageID[scheduled.storageID] = scheduled.signature + } + self.schedulingLock.unlock() + scheduledItems.forEach(self.schedule) } - schedulingLock.unlock() - scheduledItems.forEach(schedule) } public func synchronize(_ items: [StudyItem]) { - let scheduledItems = items.compactMap(Self.scheduledItem) - let validStorageIDs = Set(scheduledItems.map(\.storageID)) - schedulingLock.lock() - expectedSignaturesByStorageID = Dictionary( - uniqueKeysWithValues: scheduledItems.map { ($0.storageID, $0.signature) } - ) - schedulingLock.unlock() - indexingQueue.async { [weak self] in - self?.pruneMissingItems(validStorageIDs: validStorageIDs) + metadataQueue.async { [weak self] in + guard let self else { return } + let scheduledItems = items.compactMap(Self.scheduledItem) + let validStorageIDs = Set(scheduledItems.map(\.storageID)) + self.schedulingLock.lock() + self.expectedSignaturesByStorageID = Dictionary( + uniqueKeysWithValues: scheduledItems.map { ($0.storageID, $0.signature) } + ) + self.schedulingLock.unlock() + self.indexingQueue.async { [weak self] in + self?.pruneMissingItems(validStorageIDs: validStorageIDs) + } + scheduledItems.forEach(self.schedule) } - scheduledItems.forEach(schedule) } public func lookup( @@ -1170,26 +1181,37 @@ public final class CourseDocumentSearchIndex: @unchecked Sendable { return String(cString: value) } + private struct FileMetadata { + var modified: TimeInterval + var size: UInt64 + } + + private static func fileMetadata(for url: URL) -> FileMetadata? { + let resolvedURL = url.resolvingSymlinksInPath() + guard let values = try? resolvedURL.resourceValues(forKeys: [ + .contentModificationDateKey, + .fileSizeKey, + .isRegularFileKey, + ]), values.isRegularFile == true else { return nil } + return FileMetadata( + modified: values.contentModificationDate?.timeIntervalSince1970 ?? 0, + size: UInt64(max(values.fileSize ?? 0, 0)) + ) + } + private static func fileSignature(for item: StudyItem) -> String? { - guard let url = item.url, - let attributes = try? FileManager.default.attributesOfItem(atPath: url.path) else { - return nil - } - let modified = (attributes[FileAttributeKey.modificationDate] as? Date)?.timeIntervalSince1970 ?? 0 - let size = (attributes[FileAttributeKey.size] as? NSNumber)?.uint64Value ?? 0 - return "v4#\(item.kind.rawValue)#\(modified)#\(size)" + guard let url = item.url, let metadata = fileMetadata(for: url) else { return nil } + return "v5#\(item.kind.rawValue)#\(metadata.modified)#\(metadata.size)" } private static func scheduledItem(_ item: StudyItem) -> ScheduledItem? { guard let url = item.url, - let attributes = try? FileManager.default.attributesOfItem(atPath: url.path), - let signature = fileSignature(for: item) else { return nil } - let fileBytes = (attributes[.size] as? NSNumber)?.uint64Value ?? 0 - guard item.kind == .pdf || fileBytes <= maximumTextSourceBytes else { return nil } + let metadata = fileMetadata(for: url) else { return nil } + guard item.kind == .pdf || metadata.size <= maximumTextSourceBytes else { return nil } return ScheduledItem( item: item, storageID: storageID(for: item.id), - signature: signature + signature: "v5#\(item.kind.rawValue)#\(metadata.modified)#\(metadata.size)" ) } diff --git a/Sources/WeiBeiCore/NoteSourceRelations.swift b/Sources/WeiBeiCore/NoteSourceRelations.swift new file mode 100644 index 000000000..74b372c4b --- /dev/null +++ b/Sources/WeiBeiCore/NoteSourceRelations.swift @@ -0,0 +1,71 @@ +import Foundation + +/// Durable many-to-many links between independent notes and source documents. +/// +/// The current document and current note remain session state. This value only +/// manages relationships the user explicitly chose to keep with a note. +public struct NoteSourceRelations: Sendable { + public private(set) var links: [NoteSourceLink] + + public init(links: [NoteSourceLink]) { + self.links = Self.deduplicated(links) + } + + public func sourceIDs(for noteItemID: String) -> [String] { + links + .filter { $0.noteItemID == noteItemID } + .sorted { lhs, rhs in + if lhs.createdAt == rhs.createdAt { + return lhs.sourceItemID < rhs.sourceItemID + } + return lhs.createdAt < rhs.createdAt + } + .map(\.sourceItemID) + } + + public func isLinked(noteItemID: String, sourceItemID: String) -> Bool { + links.contains { + $0.noteItemID == noteItemID && $0.sourceItemID == sourceItemID + } + } + + public mutating func replaceSources(for noteItemID: String, sourceItemIDs: Set<String>) { + let retained = links.filter { + $0.noteItemID != noteItemID || sourceItemIDs.contains($0.sourceItemID) + } + let existingIDs = Set(retained.lazy.filter { $0.noteItemID == noteItemID }.map(\.sourceItemID)) + let additions = sourceItemIDs + .subtracting(existingIDs) + .sorted() + .map { NoteSourceLink(noteItemID: noteItemID, sourceItemID: $0) } + links = Self.deduplicated(retained + additions) + } + + public mutating func removeLinks(involving itemID: String) { + links.removeAll { + $0.noteItemID == itemID || $0.sourceItemID == itemID + } + } + + public mutating func sanitize(validNoteItemIDs: Set<String>, validSourceItemIDs: Set<String>) { + links = Self.deduplicated(links.filter { + validNoteItemIDs.contains($0.noteItemID) + && validSourceItemIDs.contains($0.sourceItemID) + && $0.noteItemID != $0.sourceItemID + }) + } + + private static func deduplicated(_ links: [NoteSourceLink]) -> [NoteSourceLink] { + var seen = Set<String>() + return links + .sorted { lhs, rhs in + if lhs.createdAt == rhs.createdAt { + return lhs.id.uuidString < rhs.id.uuidString + } + return lhs.createdAt < rhs.createdAt + } + .filter { link in + seen.insert("\(link.noteItemID)\u{1F}\(link.sourceItemID)").inserted + } + } +} diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index 2573f0abc..1fb650b6d 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -415,9 +415,9 @@ public enum WorkspaceLayout: String, Codable, CaseIterable, Identifiable { public var hasCollapsibleRightPane: Bool { switch self { - case .documentAgentNotes, .documentNotesAgent, .documentNotesSplit, .immersiveConversation, .immersiveWriting: + case .documentAgentNotes, .documentNotesAgent, .documentNotesSplit, .immersiveConversation: return true - case .immersiveReading: + case .immersiveReading, .immersiveWriting: return false } } @@ -829,6 +829,7 @@ public struct PersistedWorkspace: Codable { public var selectedItemID: String? public var activeNotebookItemID: String? public var noteSourceLinks: [NoteSourceLink]? + public var noteSourceLinksMigrationVersion: Int? public var studyLocationsByItemID: [String: StudyLocation]? public var learningMemoryEntries: [LearningMemoryEntry]? public var learningMemoryRevision: UInt64? @@ -849,12 +850,13 @@ public struct PersistedWorkspace: Codable { public var adaptImportedDocumentColors: Bool? public var interfaceLanguageRaw: String? - public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, noteSourceLinks: [NoteSourceLink]? = nil, studyLocationsByItemID: [String: StudyLocation]? = nil, learningMemoryEntries: [LearningMemoryEntry]? = nil, learningMemoryRevision: UInt64? = nil, studySessions: [StudySession]? = nil, activeStudySessionID: UUID? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { + public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, noteSourceLinks: [NoteSourceLink]? = nil, noteSourceLinksMigrationVersion: Int? = nil, studyLocationsByItemID: [String: StudyLocation]? = nil, learningMemoryEntries: [LearningMemoryEntry]? = nil, learningMemoryRevision: UInt64? = nil, studySessions: [StudySession]? = nil, activeStudySessionID: UUID? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { self.importedItems = importedItems self.notesByItemID = notesByItemID self.selectedItemID = selectedItemID self.activeNotebookItemID = activeNotebookItemID self.noteSourceLinks = noteSourceLinks + self.noteSourceLinksMigrationVersion = noteSourceLinksMigrationVersion self.studyLocationsByItemID = studyLocationsByItemID self.learningMemoryEntries = learningMemoryEntries self.learningMemoryRevision = learningMemoryRevision diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 837ef750a..50cab2ef1 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -190,8 +190,9 @@ let inspirationSourcesURL = URL(fileURLWithPath: FileManager.default.currentDire .appendingPathComponent("Sources/WeiBei/Resources/Inspiration/SOURCES.md") let inspirationSources = (try? String(contentsOf: inspirationSourcesURL, encoding: .utf8)) ?? "" expect(inspirationSources.contains("a133647a8695cd06d0f5c6215d66e0b8b8d93d56") - && inspirationSources.contains("e5c6827f44b22f5441bb208b1770103da8a076564b52f41e64f77b0da7e1835c") + && inspirationSources.contains("b30c54279d2e0b5c7b8221369962ba3a3c0e16b264808332da38cb1b8e63d936") && inspirationSources.contains("a915d1e460c68a0634c2cfaad90f802fda04ea8c25227632cd4812c51647df22") + && inspirationSources.contains("1c7965b6447392a874ed75adb1ce5703f26b562b8fc5fd6f380d1fdde0621379") && inspirationSources.contains("Public Domain Mark 1.0") && inspirationSources.contains("故00002597") && inspirationSources.contains("were rejected") @@ -288,7 +289,7 @@ expect(runScript.contains("verify_empty_workspace_state()") && runScript.contains("\\\"showDailyInspiration\\\":$expected_inspiration") && runScript.contains("Empty workspace entry state marker"), "verify mode proves each empty-workspace entry opens the requested pane while preserving existing note state") expect(runScript.contains("VERIFY_MODE=true") - && runScript.contains("DIST_DIR=\"${TMPDIR:-/tmp}/weibei-verify-$UID\"") + && runScript.contains("DIST_DIR=\"${TMPDIR:-/tmp}/weibei-verify-$UID-$$\"") && runScript.contains("elif [[ \"$VERIFY_MODE\" == true ]]; then\n :") && runScript.contains("VERIFY_PID") && !runScript.contains("pgrep -nx \"$PRODUCT_NAME\"") @@ -446,6 +447,12 @@ let boundedPDFTextExtractorURL = URL(fileURLWithPath: FileManager.default.curren let boundedPDFTextExtractorSource = (try? String(contentsOf: boundedPDFTextExtractorURL, encoding: .utf8)) ?? "" expect(courseDocumentIndexSource.contains("CREATE VIRTUAL TABLE IF NOT EXISTS chunks USING fts5") && courseDocumentIndexSource.contains("private let indexingQueue") + && courseDocumentIndexSource.contains("private let metadataQueue") + && courseDocumentIndexSource.contains("metadataQueue.async { [weak self] in") + && courseDocumentIndexSource.contains("let resolvedURL = url.resolvingSymlinksInPath()") + && courseDocumentIndexSource.contains("resolvedURL.resourceValues") + && courseDocumentIndexSource.contains("return \"v5#\\(item.kind.rawValue)#\\(metadata.modified)#\\(metadata.size)\"") + && courseDocumentIndexSource.contains("let metadata = fileMetadata(for: url)") && courseDocumentIndexSource.contains("private let ocrQueue") && courseDocumentIndexSource.contains("indexPDFTextLayer") && courseDocumentIndexSource.contains("finishPDFOCR") @@ -1210,6 +1217,7 @@ expect(WikiLink.enclosingTitle(in: "没有双链", cursor: 2) == nil, "wikilink expect(WorkspaceLayout.documentAgentNotes.hasCollapsibleRightPane, "three-pane layout can collapse right pane") expect(WorkspaceLayout.documentNotesSplit.hasCollapsibleRightPane, "split layout can collapse right pane") expect(!WorkspaceLayout.immersiveReading.hasCollapsibleRightPane, "immersive reading has no right pane to collapse") +expect(!WorkspaceLayout.immersiveWriting.hasCollapsibleRightPane, "immersive writing keeps one uninterrupted note canvas") expect(WorkspaceLayout.documentAgentNotes.isDocumentThreePane && WorkspaceLayout.documentNotesAgent.isDocumentThreePane && !WorkspaceLayout.documentNotesSplit.isDocumentThreePane, "only full document layouts participate in three-pane reordering") @@ -1243,6 +1251,55 @@ let contentViewSourceURL = URL(fileURLWithPath: FileManager.default.currentDirec .appendingPathComponent("Sources/WeiBei/Views/ContentView.swift") let contentViewSource = (try? String(contentsOf: contentViewSourceURL, encoding: .utf8)) ?? "" expect(!contentViewSource.isEmpty, "content view source is readable") +let stableDocumentSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/StableDocumentWorkspace.swift") +let stableDocumentSource = (try? String(contentsOf: stableDocumentSourceURL, encoding: .utf8)) ?? "" +let paneContinuityRecorderSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Support/PaneContinuityRecorder.swift") +let paneContinuityRecorderSource = (try? String(contentsOf: paneContinuityRecorderSourceURL, encoding: .utf8)) ?? "" +let documentPaneTransitionSource: String = { + guard let start = contentViewSource.range(of: "private func documentPaneLayoutView() -> some View")?.lowerBound, + let end = contentViewSource[start...].range(of: "private func threePaneReorderOverlay")?.lowerBound else { + return "" + } + return String(contentViewSource[start..<end]) +}() +expect(!documentPaneTransitionSource.isEmpty + && documentPaneTransitionSource.contains("StableDocumentWorkspace(") + && !documentPaneTransitionSource.contains("switch order.count") + && !documentPaneTransitionSource.contains("ResizableTwoPane(") + && !documentPaneTransitionSource.contains("ResizableThreePane(") + && !documentPaneTransitionSource.contains(".transition(WeiBeiTransition.layout)") + && !documentPaneTransitionSource.contains(".transition(WeiBeiTransition.rightPanel)"), "ordinary pane-count changes keep one stable container instead of replacing the layout tree") +expect(stableDocumentSource.contains("WorkspacePaneRole.allCases.map") + && stableDocumentSource.contains("splitView.install(roleHosts: roleHosts, emptyHost: emptyHost)") + && stableDocumentSource.contains("animator().frame = frame") + && stableDocumentSource.contains("private let layoutAnimationDuration = 0.24") + && stableDocumentSource.contains("func assertStableOwnership()") + && stableDocumentSource.contains("roleHosts.values.allSatisfy { $0.superview === self }") + && stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") + && !stableDocumentSource.contains("removeFromSuperview()") + && !stableDocumentSource.contains("rootView ="), "document pane hosts remain under one AppKit parent while frames animate") +expect(stableDocumentSource.contains("recordContinuityTransition(duration: layoutAnimationDuration)") + && stableDocumentSource.contains("host.layer?.presentation()?.frame ?? host.frame") + && paneContinuityRecorderSource.contains("WEIBEI_VERIFY_PANE_TRACE_DIR") + && paneContinuityRecorderSource.contains("1.0 / 60.0"), "pane verification records ownership and presentation frames throughout each animation") +expect(!contentViewSource.contains(".animation(WeiBeiMotion.panel, value: store.showReader)") + && !contentViewSource.contains(".animation(WeiBeiMotion.panel, value: store.showAgent)") + && !contentViewSource.contains(".animation(WeiBeiMotion.panel, value: store.showNotes)") + && !contentViewSource.contains(".animation(WeiBeiMotion.panel, value: store.showRightPane)"), "pane toggles do not animate the entire layout tree") +let paneToggleClusterSource: String = { + guard let start = contentViewSource.range(of: "private var paneToggleCluster: some View")?.lowerBound, + let end = contentViewSource[start...].range(of: "private var agentPaneToggleHelp: String")?.lowerBound else { + return "" + } + return String(contentViewSource[start..<end]) +}() +expect(!paneToggleClusterSource.isEmpty + && !paneToggleClusterSource.contains("withAnimation") + && paneToggleClusterSource.contains("store.toggleReader()") + && paneToggleClusterSource.contains("store.toggleAgent()") + && paneToggleClusterSource.contains("store.toggleNotes()"), "top-bar pane toggles hand animation ownership to the stable AppKit container") let emptyWorkspaceSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift") let emptyWorkspaceSource = (try? String(contentsOf: emptyWorkspaceSourceURL, encoding: .utf8)) ?? "" @@ -1253,18 +1310,14 @@ let contentRailSourceURL = URL(fileURLWithPath: FileManager.default.currentDirec .appendingPathComponent("Sources/WeiBei/Views/ContentRailView.swift") let contentRailSource = (try? String(contentsOf: contentRailSourceURL, encoding: .utf8)) ?? "" expect(contentRailSource.contains("struct ContentRailView: View") - && contentRailSource.contains("static let railOnlyWidth: CGFloat = 88") - && contentRailSource.contains("static let normalWidth: CGFloat = 16") - && contentRailSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 0.10") - && contentRailSource.contains("previewImage: NSImage?") - && contentRailSource.contains(".popover(") + && contentRailSource.contains("static let normalWidth: CGFloat = ContentRailPolicy.dormantWidth") + && contentRailSource.contains("static let railOnlyThreshold = ContentRailPolicy.railOnlyThreshold") + && contentRailSource.contains("ContentRailPolicy.previewWidth(") + && contentRailSource.contains("ContentRailFloatingPreviewBridge(") && contentRailSource.contains("SpatialTapGesture()") && contentRailSource.contains("private func nearestItem") - && contentRailSource.contains("private func hoverInfluence") - && contentRailSource.contains("case 1:\n return 0.52") - && contentRailSource.contains("case 2:\n return 0.22") - && !contentRailSource.contains("WeiBeiTheme.hairline.opacity(isRailOnly"), "shared content rail floats on the existing pane edge without adding a second divider") -expect(contentViewSource.contains("case 0:\n EmptyWorkspaceLauncherView()") + && !contentRailSource.contains(".popover("), "shared content rail uses the latest compact policy and floats previews beyond the existing pane edge") +expect(stableDocumentSource.contains("EmptyWorkspaceLauncherView().environmentObject(store)") && emptyWorkspaceSource.contains("Text(title)") && emptyWorkspaceSource.contains("title: \"DOC\"") && emptyWorkspaceSource.contains("title: \"CHAT\"") @@ -1291,7 +1344,7 @@ expect(emptyWorkspaceSource.contains("if store.showDailyInspiration") && emptyWorkspaceSource.contains("forcedID = \"lanting-universe\"") && emptyWorkspaceSource.contains("Link(inspiration.sourceLabel") && emptyWorkspaceSource.contains("Link(inspiration.rightsLabel") - && emptyWorkspaceSource.contains("WeiBeiResources.bundle.url(forResource:") + && emptyWorkspaceSource.contains("Bundle.module.url(forResource:") && !emptyWorkspaceSource.contains("URLSession") && !inspirationCatalogSource.contains("URLSession"), "daily inspiration is bundled for offline use while retaining visible source and rights links") expect(emptyWorkspaceSource.contains("empty-workspace-entry-doc") @@ -1365,20 +1418,26 @@ expect(contentViewSource.contains("override func layout()"), "native split appli expect(contentViewSource.contains("libraryResizeHandle"), "library pane keeps SwiftUI resize handle") expect(contentViewSource.contains("minimumContentWidthWithLibrary"), "library leaves readable width for the workspace") expect(contentViewSource.contains("private let railWidth = ContentRailMetrics.railOnlyWidth") - && contentRailSource.contains("static let snapThreshold: CGFloat = 160") - && contentRailSource.contains("static let readableWidth: CGFloat = 240") - && contentViewSource.contains("handleExpansionRequest(store.paneExpansionRequest"), "normal multi-pane layouts snap to a restorable 88pt content rail state") + && contentRailSource.contains("static let snapThreshold = ContentRailPolicy.snapThreshold") + && contentRailSource.contains("static let readableWidth = ContentRailPolicy.readableWidth") + && contentViewSource.contains("handleExpansionRequest(store.paneExpansionRequest") + && stableDocumentSource.contains("ContentRailPolicy.expansionWidth(recentWidth:"), "normal multi-pane layouts snap to the latest compact rail and restore a bounded readable width") expect(!contentViewSource.contains("DragGesture()"), "content panes avoid SwiftUI drag resizing") expect(!contentViewSource.contains(".id(store.layout)"), "layout changes avoid whole-screen identity resets") +expect(contentViewSource.contains("case .immersiveWriting:\n ZStack(alignment: agentAlignment) {\n PersistentPaneHost(role: .notes") + && !contentViewSource.contains("writingDocumentRailItems") + && !contentViewSource.contains("writingAssistRailItems") + && !contentViewSource.contains("writingFirstSplitStorage"), "immersive writing reuses the persistent note host without permanent document or writing-aid rails") expect(!contentViewSource.contains("PaneSeparator"), "content panes avoid hand-drawn split separators") -expect(contentViewSource.components(separatedBy: ".transition(WeiBeiTransition.rightPanel)").count >= 5 - && contentViewSource.components(separatedBy: ".transition(WeiBeiTransition.layout)").count >= 3, "right-pane visibility changes use shared transitions instead of naked tree swaps") +expect(contentViewSource.components(separatedBy: ".transition(WeiBeiTransition.rightPanel)").count >= 2 + && contentViewSource.components(separatedBy: ".transition(WeiBeiTransition.layout)").count >= 2 + && !documentPaneTransitionSource.contains(".transition(WeiBeiTransition"), "immersive layouts keep shared transitions while ordinary pane visibility is animated inside the stable container") expect(!contentViewSource.contains("topBarContentFade"), "top bar avoids a duplicate content fade wash") expect(contentViewSource.contains("store.toggleLibrary()") && contentViewSource.contains("sidebar.left") && contentViewSource.contains("private var libraryButton: some View") && contentViewSource.contains("active: store.showLibrary") - && contentViewSource.contains("store.showLibrary ? store.ui(\"收起课程目录\"") + && contentViewSource.contains("store.showLibrary ? store.ui(\"收起资料库\"") && !contentViewSource.contains("恢复资料库") && !contentViewSource.contains(".opacity(isImmersiveLayout ? 0.45 : 1)"), "immersive top bar keeps a clear stateful library chooser instead of dimming a live control") if let leftControlsStart = contentViewSource.range(of: "private var leftPrimaryControls: some View")?.lowerBound, @@ -1414,16 +1473,9 @@ expect(!contentViewSource.contains("文代笔") && !contentViewSource.contains("对话中栏") && !contentViewSource.contains("对话右栏") && contentViewSource.contains("store.threePaneOrderLabel(compact: true)"), "top bar short layout label reflects the real draggable pane order without legacy fixed-position labels") -for helperName in ["openReader", "openWriting", "askCurrentSelection", "prepareAgentDraft"] { - if let helperStart = contentViewSource.range(of: "private func \(helperName)")?.lowerBound, - let helperEnd = contentViewSource[helperStart...].range(of: "\n }\n")?.upperBound { - let helperSource = String(contentViewSource[helperStart..<helperEnd]) - expect(!helperSource.contains("showLibrary = false"), "\(helperName) keeps a user-opened immersive library visible") - expect(!helperSource.contains("store.layout =") && !helperSource.contains("store.showRightPane = true") && !helperSource.contains("store.showLibrary = true"), "\(helperName) routes durable layout changes through WorkspaceStore helpers") - } else { - expect(false, "\(helperName) source is readable") - } -} +expect(!contentViewSource.contains("showLibrary = false") + && !contentViewSource.contains("store.layout = ") + && !contentViewSource.contains("store.showRightPane = true"), "content view routes durable layout changes through WorkspaceStore without closing a user-opened library") expect(contentViewSource.contains(".weibeiInputSurface(active: searchFocused.wrappedValue, height: controlHeight)") && contentViewSource.contains("prompt: Text(store.ui(\"资料内搜索\"") && contentViewSource.contains(".foregroundStyle(WeiBeiTheme.placeholderInk)") @@ -1492,10 +1544,10 @@ expect(themeSource.contains("language.text(\"标准\"") let sidebarSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/SidebarView.swift") let sidebarSource = (try? String(contentsOf: sidebarSourceURL, encoding: .utf8)) ?? "" -expect(sidebarSource.contains("Text(store.ui(\"课程目录\", \"Course Index\")") - && sidebarSource.contains("prompt: Text(store.ui(\"搜索当前课程\"") +expect(sidebarSource.contains("Text(store.ui(\"资料库\", \"Library\")") + && sidebarSource.contains("prompt: Text(store.ui(\"搜索资料与笔记\"") && sidebarSource.contains(".foregroundStyle(WeiBeiTheme.placeholderInk)") - && sidebarSource.contains(".foregroundColor(WeiBeiTheme.ink)"), "course index search uses current-course language with readable ink") + && sidebarSource.contains(".foregroundColor(WeiBeiTheme.ink)"), "library search clearly covers materials and notes with readable ink") let notesAgentSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/NotesAgentView.swift") let notesAgentSource = (try? String(contentsOf: notesAgentSourceURL, encoding: .utf8)) ?? "" @@ -1503,7 +1555,7 @@ expect(notesAgentSource.contains("private var noteRailItems: [ContentRailItem]") && notesAgentSource.contains("NoteEditorCommand(kind: .scrollToHeading") && notesAgentSource.contains("private var agentRailItems: [ContentRailItem]") && notesAgentSource.contains("store.requestPaneExpansion(.agent)") - && notesAgentSource.components(separatedBy: "let railOnly = store.layout.allowsRailOnlyPanes").count >= 3, "notes and conversation share the content rail and navigate after restoring a narrow pane") + && notesAgentSource.components(separatedBy: "let railOnly = ContentRailMetrics.isRailOnly(").count >= 3, "notes and conversation share the content rail and navigate after restoring a narrow pane") let notePaneHeaderSource: String = { guard let start = notesAgentSource.range(of: "struct NotePaneView: View")?.lowerBound, let end = notesAgentSource.range(of: "private func noteFileStatusColor", range: start..<notesAgentSource.endIndex)?.lowerBound else { @@ -1539,13 +1591,6 @@ let emptyAgentStateSource: String = { } return String(notesAgentSource[start..<end]) }() -let railBackgroundSource: String = { - guard let start = notesAgentSource.range(of: "private var railBackground: some View")?.lowerBound, - let end = notesAgentSource.range(of: "private var separatorAlignment", range: start..<notesAgentSource.endIndex)?.lowerBound else { - return "" - } - return String(notesAgentSource[start..<end]) -}() let notebookCreationPanelSource: String = { guard let start = notesAgentSource.range(of: "private struct NotebookCreationPanel")?.lowerBound, let end = notesAgentSource.range(of: "final class MarkdownSourceTextView", range: start..<notesAgentSource.endIndex)?.lowerBound else { @@ -1576,7 +1621,7 @@ expect(notesAgentSource.contains("private func refreshSourcePresentation(in text && notesAgentSource.contains("case .insertMarkdown"), "source editor refreshes callout presentation after agent, command, or attachment insertions") expect(!sidebarSource.contains("commandPalettePresented.toggle()") && !sidebarSource.contains("Label(\"命令\", systemImage: \"command\")"), "sidebar does not duplicate the command palette entry") expect(sidebarSource.contains("ScrollView(showsIndicators: false)"), "sidebar hides the heavy system scroll indicator that reads as a divider") -expect(sidebarSource.contains("sidebarSection(title: store.ui(\"我的资料\"") && sidebarSource.contains("sidebarSection(title: store.ui(\"我的笔记\""), "sidebar separates user materials from notebook notes") +expect(sidebarSource.contains("sidebarSection(title: store.ui(\"导入资料\"") && sidebarSource.contains("sidebarSection(title: store.ui(\"我的笔记\""), "library separates imported materials from notebook notes") expect(sidebarSource.contains("!$0.isSample && !$0.isNotebookNote") && sidebarSource.contains("store.filteredItems.filter(\\.isNotebookNote)"), "sidebar material list excludes notebook notes without hiding notes") expect(sidebarSource.contains("item.isNotebookNote ? store.activeNotebookItemID == item.id : store.selectedItemID == item.id"), "sidebar highlights the active notebook note separately from the selected reader material") expect(sidebarSource.contains(".contextMenu") @@ -1610,9 +1655,9 @@ expect(commandPaletteSource.contains("PaletteCommand(title: store.ui(\"聚焦对 && !commandPaletteSource.contains("PaletteCommand(title: \"聚焦 Agent\""), "command palette names the conversation pane by task language") expect(!commandPaletteSource.contains("收起右栏"), "command palette avoids fixed right-pane wording") expect(!commandPaletteSource.contains("Agent 整理资料与笔记") && !commandPaletteSource.contains("本地排序资料库"), "command palette avoids half-built library organization shortcuts") -expect(commandPaletteSource.contains("store.showLibrary ? store.ui(\"收起课程目录\"") - && commandPaletteSource.contains("PaletteCommand(title: store.ui(\"聚焦课程目录\"") - && !commandPaletteSource.contains("恢复资料"), "command palette names the course index toggle as an explicit course action") +expect(commandPaletteSource.contains("store.showLibrary ? store.ui(\"收起资料库\"") + && commandPaletteSource.contains("PaletteCommand(title: store.ui(\"聚焦资料库\"") + && !commandPaletteSource.contains("恢复资料"), "command palette names the unified library action explicitly") expect(!commandPaletteSource.contains("PaletteCommand(title: \"顶栏") && contentViewSource.contains("Section(store.ui(\"顶部栏\""), "top bar variants live in the settings menu instead of the command palette") expect(commandPaletteSource.contains("private var rightPaneCommand: PaletteCommand?") && commandPaletteSource.contains("store.layout.hasCollapsibleRightPane"), "command palette hides right pane command when the layout has no auxiliary pane") expect(commandPaletteSource.contains("收起辅助栏") && commandPaletteSource.contains("展开辅助栏"), "command palette names auxiliary pane action by current state") @@ -1686,12 +1731,15 @@ expect(readerViewSource.contains("document.addEventListener(\"selectionchange\", && readerViewSource.contains("window.weiBeiSuppressSelectionReport = true;") && readerViewSource.contains("x: null,") && readerViewSource.contains("y: null"), "html reader reports selection changes live and also clears the floating agent when selection is empty") -expect(readerViewSource.contains("controller.add(context.coordinator, name: \"appShortcut\")") +expect(readerViewSource.contains("private static let scriptMessageNames = [") + && readerViewSource.contains("\"appShortcut\"") + && readerViewSource.contains("private static let scriptMessageNames") + && readerViewSource.contains("controller.add(context.coordinator, name: name)") && readerViewSource.contains("static let appShortcutScript") && readerViewSource.contains("[\"1\", \"2\", \"3\", \"a\", \"n\", \"r\", \"t\"].includes(key)") && readerViewSource.contains("[\"1\", \"2\", \"3\", \"4\", \"[\", \"]\", \"b\", \"j\", \"k\", \"f\"].includes(key)") && readerViewSource.contains("store.handleAppShortcut(key: key, modifiers: modifiers)") - && readerViewSource.contains("removeScriptMessageHandler(forName: \"appShortcut\")"), "html reader forwards app keyboard shortcuts while the web document has focus") + && readerViewSource.contains("controller.removeScriptMessageHandler(forName: name)"), "html reader forwards app keyboard shortcuts while the web document has focus") expect(!readerViewSource.contains("readerHeader") && !readerViewSource.contains("statusBar"), "reader avoids duplicate internal chrome under unified top bar") expect(readerViewSource.contains("ReaderStateMessage") && !readerViewSource.contains("ContentUnavailableView("), "reader empty states use WeiBei paper styling") expect(readerViewSource.contains("store.selectedMaterialItem?.kind == .pdf") && readerViewSource.contains("if let item = store.selectedMaterialItem"), "reader renders materials, not notebook notes") @@ -1752,7 +1800,12 @@ expect(readerViewSource.contains(".keyboardShortcut(\"[\", modifiers: [.command, && readerViewSource.contains(".keyboardShortcut(\"]\", modifiers: [.command, .option])"), "pdf page shortcuts yield command-brackets to workspace history") expect(!readerViewSource.contains(".disabled(pdfPageIndex"), "pdf pager keeps arrows visible instead of showing grey dead buttons") expect(readerViewSource.contains("syncReaderLocationTitle") - && readerViewSource.contains("store.updateReaderPageIndex(pdfPageIndex)") + && readerViewSource.contains("onUserPageChange: schedulePDFLocationCommit") + && readerViewSource.contains("if pendingPDFPageRecordsLocation") + && readerViewSource.contains("Date() <= self.userNavigationDeadline") + && readerViewSource.contains("[.leftMouseDown, .leftMouseDragged, .leftMouseUp, .scrollWheel, .keyDown]") + && readerViewSource.components(separatedBy: "schedulePDFLocationCommit(next)").count >= 3 + && readerViewSource.contains("store.updateReaderPageIndex(pageIndex)") && readerViewSource.components(separatedBy: "store.recordReaderPageNavigationPoint()").count >= 3 && readerViewSource.contains("let next = PageNavigator.previous(pdfPageIndex)") && readerViewSource.contains("let next = PageNavigator.next(pdfPageIndex, pageCount: pdfPageCount)") @@ -1786,7 +1839,7 @@ if let pdfViewStart = readerViewSource.range(of: "private final class ReaderPDFV expect(readerViewSource.contains("func reportCurrentSelection(in view: PDFView)") && readerViewSource.contains("view.reportCurrentSelection = { [weak coordinator = context.coordinator, weak view] in") && readerViewSource.contains("coordinator?.reportCurrentSelection(in: view)") - && readerViewSource.contains("NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown, .leftMouseDragged, .leftMouseUp])") + && readerViewSource.contains("NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown, .leftMouseDragged, .leftMouseUp, .scrollWheel, .keyDown])") && readerViewSource.contains("if event.type == .leftMouseDown") && readerViewSource.contains("view.bounds.contains(location)") && readerViewSource.contains("NSEvent.removeMonitor(eventMonitor)"), "PDF selection reporting polls currentSelection after PDFKit internal drag gestures instead of relying only on outer PDFView mouse events") @@ -1881,7 +1934,10 @@ expect(readerViewSource.contains("static func readerStyleScript(for mode: WeiBei && readerViewSource.contains(".slice(0, 2500)") && readerViewSource.contains("element.removeAttribute(\"data-weibei-paper-surface\")") && !readerStyleScriptSource.contains("MutationObserver"), "HTML adaptation is reversible and bounds its one-time near-white surface pass without a persistent DOM observer") -expect(readerViewSource.contains("pendingPDFPageIndex") && readerViewSource.contains("applyPendingPDFPageIfReady") && readerViewSource.contains("store.readerTargetPageIndex = nil"), "pdf reader consumes source-jump target pages") +expect(readerViewSource.contains("pendingPDFPageIndex") + && readerViewSource.contains("pendingPDFPageRecordsLocation") + && readerViewSource.contains("applyPendingPDFPageIfReady") + && readerViewSource.contains("store.consumeReaderPDFPageRequest(requestID)"), "pdf reader consumes source-jump target pages and only persists requests marked as user navigation") expect(readerViewSource.contains("applyPendingHTMLLocationIfReady") && readerViewSource.contains("store.readerTargetLocationID") && readerViewSource.contains("store.readerTargetLocationTitle") @@ -1894,7 +1950,7 @@ expect(readerViewSource.contains("applyPendingHTMLLocationIfReady") && readerViewSource.contains("sectionLocationID") && readerViewSource.contains("new TextEncoder().encode(normalized)") && readerViewSource.contains("`html-section-${hash.toString(16).padStart(8, \"0\")}`") - && readerViewSource.contains("store.updateReaderHTMLLocation(id: id, title: title)"), "HTML reader persists the active section and consumes exact section jumps") + && readerViewSource.contains("store.updateReaderHTMLLocation(id: id, title: title, reason: reason.rawValue)"), "HTML reader persists the active section and consumes exact section jumps") expect(readerViewSource.contains("onSourceReference: { reference in store.openSourceReference(reference) }"), "markdown reader source references can jump back to material") expect(readerViewSource.contains("private struct SamplePDFView") && readerViewSource.contains("ScrollView {") @@ -1926,6 +1982,10 @@ expect(richEditorSource.contains("var passesVerticalScrollToSuperview = false") && richEditorSource.contains("bounds.contains(localPoint)") && richEditorSource.contains("return nil"), "compact markdown previews pass vertical wheel events to the outer conversation scroll instead of trapping the pointer over message text") expect(richEditorSource.contains("var documentID = \"\"") && richEditorSource.contains("var pendingExternalMarkdown: String?"), "rich editor tracks document identity and pending external sync") +expect(!richEditorSource.contains("nativeViewCache") + && !richEditorSource.contains("cached.view.removeFromSuperview()") + && !readerViewSource.contains("nativeViewCache") + && !readerViewSource.contains("cached.view.removeFromSuperview()"), "native readers and editors rely on stable pane ownership instead of detach-and-reattach caches") expect( richEditorSource.contains("window.weiBeiDocumentID") && richEditorSource.contains("func setDocumentID(_ id: String)") @@ -2046,9 +2106,14 @@ expect(appSource.contains("window.isOpaque = true"), "main window declares opaqu expect(appSource.contains("environment[\"WEIBEI_VERIFY_CAPTURE_PATH\"]") && appSource.contains("bitmapImageRepForCachingDisplay") && appSource.contains("cacheDisplay(in: bounds, to: bitmap)") - && appSource.contains("[\"pi-learning-flow\", \"pi-course-memory-flow\"].contains(environment[\"WEIBEI_VERIFY_SCENARIO\"])") + && appSource.contains("visibleWebViews(in: contentView)") + && appSource.contains("webView.takeSnapshot(with: nil)") + && appSource.contains("overlay.image.draw(in: overlay.rect") + && appSource.contains("let scenario = environment[\"WEIBEI_VERIFY_SCENARIO\"] ?? \"\"") + && appSource.contains("[\"pi-learning-flow\", \"pi-course-memory-flow\", \"pane-toggle-continuity-flow\", \"reader-scroll-persistence-flow\"].contains(scenario)") + && appSource.contains("remainingAttempts: scenario == \"pane-toggle-continuity-flow\" ? 1_800 : 600") && appSource.contains("waitForVerificationCompletion") - && appSource.contains("stages.split(separator: \"\\n\").contains(\"completed\")"), "isolated verification app captures the completed PI flow without Screen Recording permission") + && appSource.contains("stages.split(separator: \"\\n\").contains(\"completed\")"), "isolated verification app captures completed PI and pane-continuity flows without Screen Recording permission") expect(appSource.contains("sharedWorkspaceStore"), "main window and settings share one workspace store") expect(!appSource.contains("launchProbe"), "app launch path has no temporary probe logging") expect(appSource.contains("WeiBeiAppearanceTransition") @@ -2148,6 +2213,26 @@ expect(appSource.contains("init() {\n WeiBeiTypography.registerBundledFon let workspaceStoreSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Stores/WorkspaceStore.swift") let workspaceStoreSource = (try? String(contentsOf: workspaceStoreSourceURL, encoding: .utf8)) ?? "" +let linkedSourcesSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views/LinkedSourcesView.swift") +let linkedSourcesSource = (try? String(contentsOf: linkedSourcesSourceURL, encoding: .utf8)) ?? "" +let selectItemSource: String = { + guard let start = workspaceStoreSource.range(of: "func select(itemID: String?)")?.lowerBound, + let end = workspaceStoreSource[start...].range(of: "func selectAdjacentItem")?.lowerBound else { + return "" + } + return String(workspaceStoreSource[start..<end]) +}() +expect(!selectItemSource.contains("activeNotebookItemID = nil") + && selectItemSource.contains("selectedItemID = itemID"), "opening another material does not detach the note the user is writing") +expect(workspaceStoreSource.contains("noteSourceLinksMigrationVersion < 1") + && workspaceStoreSource.contains("noteSourceLinksMigrationVersion = 1") + && workspaceStoreSource.contains("setLinkedSourceIDsForActiveNote"), "note-source migration runs once and explicit relationship management remains available") +expect(workspaceStoreSource.contains("invalidateAgentContext()\n activeNotebookItemID = item.id") + && workspaceStoreSource.components(separatedBy: "removeLinksWhereSourceItemID").count >= 3, "switching notes invalidates in-flight agent work and source-to-note conversion removes invalid relationships") +expect(linkedSourcesSource.contains("@State private var noteItemID: String?") + && linkedSourcesSource.contains("noteItemID = store.activeNotebookItemID") + && linkedSourcesSource.contains("store.setLinkedSourceIDs(draftIDs, for: noteItemID)"), "relationship editing remains bound to the note that opened the popover") expect(workspaceStoreSource.contains("DocumentTextExtractor.cachedText(for: item)") && workspaceStoreSource.contains("loadedMaterialText = await Task.detached(priority: .utility)") && !workspaceStoreSource.contains("if let text = DocumentTextExtractor.text(for: item)"), "main-actor workspace reads only cached document text while bounded extraction runs off the UI thread") @@ -2232,7 +2317,8 @@ expect(workspaceStoreSource.contains("@Published var readerPageIndex = 0") && workspaceStoreSource.contains("func updateReaderPageIndex(_ index: Int)") && workspaceStoreSource.contains("func recordReaderPageNavigationPoint()") && workspaceStoreSource.contains("readerPageIndex: readerPageIndex") - && workspaceStoreSource.contains("readerTargetPageIndex = selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil"), "workspace navigation snapshots restore PDF page position instead of only restoring the selected document") + && workspaceStoreSource.contains("selectedMaterialItem?.kind == .pdf ? snapshot.readerPageIndex : nil") + && workspaceStoreSource.contains("recordsLocation: false"), "workspace navigation snapshots restore PDF page position without treating restoration as new study activity") expect(workspaceStoreSource.contains("case \"return\":\n if isAskingAgent") && workspaceStoreSource.contains("guard !agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return false }"), "app shortcut stops a running answer but does not swallow command-return when idle with no draft") expect(workspaceStoreSource.contains("showQuietInsight = agentSurface == .quietInsight") && !workspaceStoreSource.contains("agentSurface = .quietInsight\n showQuietInsight = true"), "immersive reading preserves the chosen agent surface") @@ -2259,7 +2345,8 @@ expect(workspaceStoreSource.contains("private func sessionContinuitySummary(for && workspaceStoreSource.contains("messages.suffix(20)") && workspaceStoreSource.contains("olderMessages.prefix(4)") && workspaceStoreSource.contains("olderMessages.suffix(8)"), "durable study sessions inject recent turns plus bounded earlier conversation excerpts into each clean PI run") -expect(workspaceStoreSource.contains("itemTitle: sourceReferenceBaseTitle(for: item)") +expect(workspaceStoreSource.contains("let itemTitle = sourceReferenceBaseTitle(for: item)") + && workspaceStoreSource.contains("itemTitle: itemTitle") && workspaceStoreSource.contains("private func refreshStudyLocationReferenceTitles() -> Bool") && workspaceStoreSource.contains("learningMemoryEntries[index].origin = .userStatement\n learningMemoryEntries[index].sessionID = activeStudySessionID") && workspaceStoreSource.contains("$0.sessionID == activeStudySessionID") @@ -2602,7 +2689,7 @@ expect(workspaceStoreSource.contains("acceptedUpdate.resolutions = update.resolu expect(workspaceStoreSource.contains("} else {\n restoreCurrentStudyLocation()\n recordCurrentStudyLocation(incrementVisit: false)\n }") && workspaceStoreSource.contains("private func restoreCurrentStudyLocation()") && workspaceStoreSource.contains("readerPageIndex = max(location.pageIndex ?? 0, 0)") - && workspaceStoreSource.contains("readerTargetPageIndex = location.pageIndex.map { max($0, 0) }"), "saved heading and PDF page are restored before startup records the current study location") + && workspaceStoreSource.contains("requestReaderPDFPage(location.pageIndex, recordsLocation: false)"), "saved heading and PDF page are restored before startup records the current study location") expect(workspaceStoreSource.contains("private func makeCourseContext(query: String) async throws") && workspaceStoreSource.contains("CourseKnowledgeIndex.build(") && workspaceStoreSource.contains("courseDocumentSearchIndex: CourseDocumentSearchIndex") @@ -2627,9 +2714,14 @@ expect(workspaceStoreSource.contains("func stageNoteDraft(_ value: String, for i && workspaceStoreSource.contains("private func flushStagedNoteDraftForAgentContext()") && notesAgentSource.contains("store.stageNoteDraft(value, for: draftNoteItemID)"), "agent requests flush the current local note-editor draft before snapshotting context") expect(workspaceStoreSource.contains("func updateReaderLocationTitle(_ title: String?)") - && workspaceStoreSource.contains("guard readerLocationTitle != nextTitle else { return }\n invalidateAgentContext()") - && workspaceStoreSource.contains("func updateReaderHTMLLocation(id: String?, title: String?)") - && workspaceStoreSource.contains("guard readerPageIndex != nextIndex else { return }\n invalidateAgentContext()"), "reader heading and page changes invalidate stale agent answers") + && workspaceStoreSource.contains("func updateReaderHTMLLocation(id: String?, title: String?, reason: String)") + && workspaceStoreSource.contains("PaneToggleContinuityVerifier.recordHTMLLocationCall(reason: reason)") + && workspaceStoreSource.contains("if !incrementVisit,") + && workspaceStoreSource.contains("previous?.locationID == locationID") + && workspaceStoreSource.contains("private(set) var studyLocationsByItemID") + && !workspaceStoreSource.contains("@Published private(set) var studyLocationsByItemID") + && readerViewSource.contains("guard change.reason == .scroll || change.reason == .jump else { return }") + && readerViewSource.contains("Task.sleep(nanoseconds: 350_000_000)"), "passive reader layout stays local while settled user navigation persists without publishing duplicate study locations") expect(workspaceStoreSource.contains("var agentPromptScope") && workspaceStoreSource.contains("var selectionPromptScope") && !workspaceStoreSource.contains("var libraryOrganizationScope"), "agent prompt builders avoid half-built library organization context") expect(!workspaceStoreSource.contains("请根据当前文档和当前笔记") && !workspaceStoreSource.contains("请根据当前材料和当前笔记") && !workspaceStoreSource.contains("结合当前文档和笔记"), "agent draft presets do not hardcode fake material context") expect(workspaceStoreSource.contains("正在静默阅读当前材料和笔记。") @@ -2725,7 +2817,7 @@ expect(appSource.contains("Button(store.sendAgentActionTitle)") && workspaceStor expect(appSource.contains("if store.isAskingAgent || !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty") && appSource.contains("store.isAskingAgent ? store.cancelAgentRequest() : store.askAgent()") && appSource.contains(".keyboardShortcut(.return, modifiers: [.command])"), "app menu hides the agent send action until a draft can really send") -expect(appSource.contains("Button(store.showLibrary ? store.ui(\"收起课程目录\"") +expect(appSource.contains("Button(store.showLibrary ? store.ui(\"收起资料库\"") && !appSource.contains("恢复资料") && appSource.contains("Button(store.showRightPane ? store.ui(\"收起辅助栏\""), "app menu names pane toggles by current state") expect(appSource.contains("Button(store.ui(\"三栏工作台\", \"Three-Pane Workspace\"))") @@ -2749,7 +2841,7 @@ expect(appSource.contains("if store.layout.hasCollapsibleRightPane") && appSource.contains("if store.canApplyAgentAnswer") && appSource.contains("if store.canReplaceNoteSelection") && !appSource.contains(".disabled("), "app menu hides unavailable actions instead of showing disabled grey items") -expect(appSource.contains("Button(store.ui(\"聚焦课程目录\"") +expect(appSource.contains("Button(store.ui(\"聚焦资料库\"") && appSource.contains("{ animateLayout { store.focus(.library) } }") && appSource.contains("Button(store.ui(\"聚焦对话\"") && appSource.contains("{ animateLayout { store.focus(.agent) } }") @@ -2898,26 +2990,18 @@ expect(noteModeControlSource.contains("NoteRenderMode.visibleCases") && noteModeControlSource.contains(".weibeiHeaderAccessoryGroup()") && noteModeControlSource.contains(".scaleEffect(hovering && !selected ? 1.012 : 1)") && !noteModeControlSource.contains(".stroke(WeiBeiTheme.hairline.opacity(0.14), lineWidth: 1)"), "note mode control is icon-only so narrow panes never collapse labels into ellipses") -expect(notesAgentSource.contains("ContextRailLine") && notesAgentSource.contains(".onHover"), "context rails keep hover motion") expect(!notesAgentSource.contains(".id(store.noteRenderMode)"), "note mode changes avoid forced hard view identity resets") -expect(notesAgentSource.contains("struct ContextRailItem: Identifiable") && notesAgentSource.contains("Button(action: action)"), "context rails expose actionable rows") -expect(notesAgentSource.contains("var systemImage: String?") && notesAgentSource.contains("Image(systemName: systemImage)"), "context rail rows support semantic icons") -expect(notesAgentSource.contains(".accessibilityLabel(Text(item.help ?? item.title))") && notesAgentSource.contains(".help(item.help ?? item.title)"), "context rail actions explain their intent") -expect(notesAgentSource.contains("var edge: HorizontalEdge = .trailing") && notesAgentSource.contains("edge == .leading ? -3 : 3"), "context rails move inward from either side") -expect(!railBackgroundSource.isEmpty - && railBackgroundSource.contains("WeiBeiTheme.paperRaised.opacity(0.10)") - && railBackgroundSource.contains("WeiBeiTheme.paperRaised.opacity(0.26)") - && railBackgroundSource.contains(".frame(width: 22)") - && !railBackgroundSource.contains("WeiBeiTheme.paper.opacity(0.18)") - && !railBackgroundSource.contains("WeiBeiTheme.paperRaised.opacity(0.40),\n WeiBeiTheme.paper.opacity(0.42),\n WeiBeiTheme.paper.opacity(0.28)"), "immersive context rails avoid full-height heavy background bands") expect(!notesAgentSource.contains(".id(expanded)"), "selection agent expands without forcing a hard view identity reset") -expect(contentViewSource.contains("edge: .leading") && contentViewSource.contains("edge: .trailing"), "immersive rails declare their content-facing edge") -expect(contentViewSource.contains("conversationSourceRailItems") && contentViewSource.contains("conversationTargetRailItems") && contentViewSource.contains("writingAssistRailItems"), "immersive rails wire role-specific actions") -expect(contentViewSource.contains("systemImage: \"square.and.pencil\"") && contentViewSource.contains("systemImage: \"quote.opening\""), "immersive rail actions use stable semantic icons") +expect(!contentViewSource.contains("ContextRailView(title: store.ui(\"文档\"") + && !contentViewSource.contains("ContextRailView(title: store.ui(\"写作辅助\""), "immersive writing has no permanent side rails") +expect(notesAgentSource.contains("LinkedSourcesControl()") + && notesAgentSource.contains("private var writingAssistControl: some View") + && notesAgentSource.contains("if store.layout != .immersiveWriting") + && notesAgentSource.contains(".accessibilityLabel(Text(store.ui(\"整理当前笔记\""), "note relationships and writing aids live in accessible, on-demand header actions") expect(contentViewSource.contains("@StateObject private var paneHostRegistry = PersistentPaneHostRegistry()") - && contentViewSource.contains("private final class PersistentPaneHostRegistry: ObservableObject") - && contentViewSource.contains("private struct PersistentPaneHost: NSViewRepresentable") - && contentViewSource.contains("private final class PersistentPaneContainerView: NSView") + && contentViewSource.contains("final class PersistentPaneHostRegistry: ObservableObject") + && contentViewSource.contains("struct PersistentPaneHost: NSViewRepresentable") + && contentViewSource.contains("final class PersistentPaneContainerView: NSView") && contentViewSource.contains("override func viewDidMoveToWindow()") && contentViewSource.contains("guard container.window != nil else") && contentViewSource.contains("PersistentPaneHost(role: .reader, registry: paneHostRegistry)") @@ -2925,18 +3009,18 @@ expect(contentViewSource.contains("@StateObject private var paneHostRegistry = P && contentViewSource.contains("PersistentPaneHost(role: .notes, registry: paneHostRegistry)") && contentViewSource.contains("host.removeFromSuperview()") && contentViewSource.contains("host.autoresizingMask = [.width, .height]") - && contentViewSource.contains("private struct OwnerToken: Equatable") + && contentViewSource.contains("struct OwnerToken: Equatable") && contentViewSource.contains("func registerOwner(for role: WorkspacePaneRole) -> OwnerToken") && contentViewSource.contains("guard latestOwnerGeneration[role] == owner.generation else { return }") && contentViewSource.contains("guard activeOwners[role] == owner, host.superview === container else { return }") && !contentViewSource.contains("paneView(for: drag.role, reorderable: false)"), "core pane hosts survive immersive, single-pane, and split-layout changes instead of recreating their reader or editor state") expect(contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent:") - && contentViewSource.contains("documentPaneLayoutView()") - && contentViewSource.contains("reorderablePaneView(for: order[0])") + || contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent, .documentNotesSplit:"), "ordinary document layouts share one routing branch") +expect(contentViewSource.contains("documentPaneLayoutView()") + && contentViewSource.contains("StableDocumentWorkspace(") && contentViewSource.contains("PaneReorderPreviewView(role: drag.role)") - && contentViewSource.contains(".opacity(drag?.role == role ? 0.08 : 1)") && contentViewSource.contains(".opacity(0.11)") - && contentViewSource.contains("PersistentPaneHost(role: role, registry: paneHostRegistry)") + && stableDocumentSource.contains("PersistentPaneHost(role: role, registry: registry)") && contentViewSource.contains("private struct PersistentPaneRoot: View") && contentViewSource.contains("AgentPaneView(showsPaneHeader: false, reorderRole: reorderRole)") && contentViewSource.contains("NotePaneView(showsPaneHeader: false, reorderRole: reorderRole)") @@ -2945,13 +3029,13 @@ expect(contentViewSource.contains("case .documentAgentNotes, .documentNotesAgent && contentViewSource.contains("threePaneReorderOverlay(order: order") && contentViewSource.contains("private func documentPaneLayoutView() -> some View") && contentViewSource.contains("let order = store.visibleDocumentPaneOrder") - && contentViewSource.contains("EmptyWorkspaceLauncherView()") - && contentViewSource.contains("documentTwoPaneView(order: order)") - && contentViewSource.contains("documentThreePaneView(order: Array(order.prefix(3)))") - && contentViewSource.contains("let estimatedFrames = threePaneFrames(order: order, size: geometry.size)") - && contentViewSource.contains("store.threePaneReorderFrameList(order: order, fallback: estimatedFrames)") - && contentViewSource.contains("onFramesChange: { frames in") - && contentViewSource.contains("ThreePaneReorderFrameReporter(order: order, frames: estimatedFrames)") + && stableDocumentSource.contains("EmptyWorkspaceLauncherView()") + && !contentViewSource.contains("documentTwoPaneView(order: order)") + && !contentViewSource.contains("documentThreePaneView(order: Array(order.prefix(3)))") + && contentViewSource.contains("let fallbackFrames = estimatedDocumentPaneFrames(order: order, size: geometry.size)") + && contentViewSource.contains("store.threePaneReorderFrameList(order: order, fallback: fallbackFrames)") + && contentViewSource.contains("onFramesChange: { reportedOrder, frames in") + && stableDocumentSource.contains("self?.onFramesChange?(order, frames)") && !contentViewSource.contains("case .documentAgentNotes:\n if store.showRightPane"), "document pane layouts render from the visible pane set and one draggable pane role order") expect(paneHeaderReorderSource.contains("struct PaneHeaderReorderModifier") && paneHeaderReorderSource.contains(".textSelection(.disabled)") @@ -3021,27 +3105,24 @@ expect(workspaceStoreSource.contains("@Published var threePaneOrder") && !workspaceStoreSource.contains("guard role != .reader else { return }") && workspaceStoreSource.contains("layoutMatchingThreePaneOrder") && workspaceStoreSource.contains("threePaneOrder: normalizedThreePaneOrder"), "workspace store owns, drags, swaps, and persists custom three-pane order") -expect(!contentViewSource.contains("ContextRailItem(title: store.ui(\"课程目录\"") +expect(!contentViewSource.contains("ContextRailItem") && contentViewSource.contains("topIconButton(\"sidebar.left\"") && contentViewSource.contains("store.toggleLibrary()") - && workspaceStoreSource.contains("func revealLibrary()"), "immersive rails do not duplicate the course index because the top bar owns the library entry") + && workspaceStoreSource.contains("func revealLibrary()"), "immersive surfaces do not duplicate the library because the top bar owns its entry") expect(!appSource.contains("沉浸模式也保留课程目录入口") && !appSource.contains("Immersive modes keep the course index entry") && !appSource.contains("Button(store.showLibrary ? store.ui(\"收起\", \"Hide\") : store.ui(\"打开\", \"Show\"))"), "settings does not duplicate the top bar course index toggle") -expect(contentViewSource.contains("help: store.ui(\"追问当前选区\"") - && contentViewSource.contains("help: store.ui(\"整理问题、结论和缺少证据\"") - && contentViewSource.contains("help: store.ui(\"生成笔记大纲\"") - && contentViewSource.contains("help: store.ui(\"检查笔记缺少来源的位置\"") - && contentViewSource.contains("help: store.ui(\"润色当前笔记\"") - && !contentViewSource.contains("help: \"用 Agent") - && !contentViewSource.contains("help: \"让 Agent"), "immersive rail help text uses direct task language instead of internal agent wording") -expect(contentViewSource.contains("store.agentPromptScope") - && contentViewSource.contains("store.hasSelectedMaterial ? store.ui(\"请检查当前笔记缺少来源的位置") - && contentViewSource.contains("store.ui(\"请检查当前笔记缺少来源的位置,并标出需要补证据的段落。\""), "immersive agent rails reuse real context wording") +expect(notesAgentSource.contains("store.ui(\"大纲建议\"") + && notesAgentSource.contains("store.ui(\"补来源\"") + && notesAgentSource.contains("store.ui(\"润色表达\"") + && !notesAgentSource.contains("help: \"用 Agent") + && !notesAgentSource.contains("help: \"让 Agent"), "on-demand writing tools use direct task language instead of internal agent wording") +expect(notesAgentSource.contains("store.agentPromptScope") + && notesAgentSource.contains("store.hasSelectedMaterial") + && notesAgentSource.contains("请检查当前笔记缺少来源的位置,并标出需要补证据的段落。"), "on-demand writing tools reuse real context wording") expect(contentViewSource.contains(".overlay(alignment: agentAlignment)") && contentViewSource.contains("if store.agentSurface != .quietInsight {\n agentOverlay"), "immersive layouts can show the lightweight agent overlay") -expect(!contentViewSource.contains("来源预览"), "immersive writing document rail avoids duplicate reader entries") -expect(!contentViewSource.contains("title: store.selectedItem?.title ?? \"当前材料\"") && contentViewSource.contains("if let item = store.selectedMaterialItem"), "immersive rails avoid fake current material entries") -expect(contentViewSource.contains("store.appendSelectionToNote()") && contentViewSource.contains("store.copyCurrentReference()") && contentViewSource.contains("prepareAgentDraft"), "immersive rails connect to existing note, reference, and agent actions") +expect(!contentViewSource.contains("来源预览"), "immersive writing avoids duplicate reader entries") +expect(!contentViewSource.contains("title: store.selectedItem?.title ?? \"当前材料\""), "immersive writing avoids fake current material entries") expect(!notesAgentSource.contains("Agent 抽屉"), "agent drawer avoids engineering labels") expect(!notesAgentSource.contains("Agent 只在右下角待命"), "corner agent avoids explanatory placeholder copy") expect(!notesAgentSource.contains("魏碑会优先读取材料"), "agent empty state avoids product-explainer copy") @@ -3093,7 +3174,8 @@ expect(notesAgentSource.contains("if store.hasSelectedMaterial") && !notesAgentSource.contains("starterChip(\"梳理材料\"") && !notesAgentSource.contains("starterChip(\"出复习题\""), "agent starter chips hide material actions without a selected material and avoid clipped long labels") expect(notesAgentSource.contains("GeometryReader { geometry in") - && notesAgentSource.contains("let contentWidth = min(max(geometry.size.width - 36, 320), agentContentMaxWidth ?? 760)") + && notesAgentSource.contains("let availableWidth = max(geometry.size.width, 1)") + && notesAgentSource.contains("let contentWidth = min(max(availableWidth - 36, 320), agentContentMaxWidth ?? 760)") && notesAgentSource.contains("agentMessageRow(message: message, geometryWidth: geometry.size.width, contentWidth: contentWidth, proxy: proxy)") && notesAgentSource.contains("private func agentMessageRow(message: AgentMessage, geometryWidth: CGFloat, contentWidth: CGFloat, proxy: ScrollViewProxy) -> some View") && notesAgentSource.contains(".padding(.top, store.messages.isEmpty ? 22 : 0)") @@ -3269,8 +3351,8 @@ expect(notesAgentSource.contains("private struct CompactAgentMessagePreviewList" && notesAgentSource.contains("## Offline Draft") && !notesAgentSource.contains("question was still sent into the chat"), "drawer and corner chat surfaces show recent local/offline replies with the current offline-preview detection") if let selectionStart = notesAgentSource.range(of: "struct FloatingSelectionAgentView")?.lowerBound, - let contextRailStart = notesAgentSource.range(of: "struct ContextRailItem")?.lowerBound { - let floatingSelectionSource = String(notesAgentSource[selectionStart..<contextRailStart]) + let agentBubbleStart = notesAgentSource.range(of: "private struct AgentBubble")?.lowerBound { + let floatingSelectionSource = String(notesAgentSource[selectionStart..<agentBubbleStart]) expect(floatingSelectionSource.contains("private var promptSeparator: some View") && floatingSelectionSource.contains("WeiBeiTheme.hairline.opacity(0.78)") && !floatingSelectionSource.contains("Divider()"), "selection floating agent uses WeiBei hairline separators instead of system dividers") @@ -3460,7 +3542,31 @@ expect(!notebookMarkdown.canBecomeNotebookNote, "notebook markdown does not offe expect(!sampleMarkdown.isImportedMarkdownFile, "sample markdown stays app-owned") expect(!sampleMarkdown.canBecomeNotebookNote, "sample markdown cannot become a backing-file note") -let persisted = PersistedWorkspace(threePaneOrder: [.agent, .reader, .notes], noteRenderMode: .preview, showLibrary: false, showReader: false, showAgent: true, showNotes: false, showRightPane: true, showDailyInspiration: false, adaptImportedDocumentColors: false) +let relationNoteID = "note:research" +let relationSourceA = "file:/tmp/a.pdf" +let relationSourceB = "file:/tmp/b.html" +let oldestLink = NoteSourceLink( + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + noteItemID: relationNoteID, + sourceItemID: relationSourceA, + createdAt: Date(timeIntervalSince1970: 1) +) +let duplicateLink = NoteSourceLink( + id: UUID(uuidString: "00000000-0000-0000-0000-000000000002")!, + noteItemID: relationNoteID, + sourceItemID: relationSourceA, + createdAt: Date(timeIntervalSince1970: 2) +) +var noteSourceRelations = NoteSourceRelations(links: [duplicateLink, oldestLink]) +expect(noteSourceRelations.links == [oldestLink] + && noteSourceRelations.sourceIDs(for: relationNoteID) == [relationSourceA], "note-source relations keep one durable pair and preserve the oldest identity") +noteSourceRelations.replaceSources(for: relationNoteID, sourceItemIDs: [relationSourceB]) +expect(noteSourceRelations.sourceIDs(for: relationNoteID) == [relationSourceB] + && !noteSourceRelations.isLinked(noteItemID: relationNoteID, sourceItemID: relationSourceA), "explicitly replacing a note's sources removes unlinked material") +noteSourceRelations.sanitize(validNoteItemIDs: [relationNoteID], validSourceItemIDs: [relationSourceA]) +expect(noteSourceRelations.links.isEmpty, "note-source sanitation removes relationships whose source no longer exists") + +let persisted = PersistedWorkspace(noteSourceLinks: [oldestLink], noteSourceLinksMigrationVersion: 1, threePaneOrder: [.agent, .reader, .notes], noteRenderMode: .preview, showLibrary: false, showReader: false, showAgent: true, showNotes: false, showRightPane: true, showDailyInspiration: false, adaptImportedDocumentColors: false) let restored = try JSONDecoder().decode(PersistedWorkspace.self, from: try JSONEncoder().encode(persisted)) expect(restored.showLibrary == false && restored.showReader == false && restored.showAgent == true && restored.showNotes == false && restored.showRightPane == true, "pane visibility state persists") expect(restored.showDailyInspiration == false, "daily inspiration can be disabled and restored from workspace persistence") @@ -3474,6 +3580,7 @@ expect(restored.adaptImportedDocumentColors == false && workspaceStoreSource.contains("adaptImportedDocumentColors: adaptImportedDocumentColors"), "imported-document color adaptation persists while old workspaces default to adapted reading") expect(restored.noteRenderMode == .preview, "legacy preview note mode remains decodable for old workspace snapshots") expect(restored.threePaneOrder == [.agent, .reader, .notes], "custom three-pane order persists") +expect(restored.noteSourceLinks == [oldestLink] && restored.noteSourceLinksMigrationVersion == 1, "note-source relations and one-time migration state persist together") expect(workspaceStoreSource.contains("if let noteRenderMode = snapshot.noteRenderMode {\n self.noteRenderMode = noteRenderMode.visibleMode\n }") && workspaceStoreSource.contains("noteRenderMode = snapshot.noteRenderMode.visibleMode") && workspaceStoreSource.contains("let nextMode = mode.visibleMode") diff --git a/script/build_and_run.sh b/script/build_and_run.sh index 26a50016f..d9c84f379 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -34,10 +34,15 @@ if [[ "$MODE" == "check" || "$MODE" == "--debug" || "$MODE" == "debug" ]]; then fi ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +FINAL_DIST_DIR="$ROOT_DIR/dist" +FINAL_APP_BUNDLE="$FINAL_DIST_DIR/$APP_DISPLAY_NAME.app" +FINAL_APP_BINARY="$FINAL_APP_BUNDLE/Contents/MacOS/$PRODUCT_NAME" if [[ "$VERIFY_MODE" == true ]]; then - DIST_DIR="${TMPDIR:-/tmp}/weibei-verify-$UID" + DIST_DIR="${TMPDIR:-/tmp}/weibei-verify-$UID-$$" +elif [[ "$PACKAGE_ONLY" == true ]]; then + DIST_DIR="${TMPDIR:-/tmp}/weibei-package-$UID" else - DIST_DIR="$ROOT_DIR/dist" + DIST_DIR="$FINAL_DIST_DIR" fi APP_BUNDLE="$DIST_DIR/$APP_DISPLAY_NAME.app" APP_CONTENTS="$APP_BUNDLE/Contents" @@ -45,6 +50,9 @@ APP_MACOS="$APP_CONTENTS/MacOS" APP_HELPERS="$APP_CONTENTS/Helpers" APP_RESOURCES="$APP_CONTENTS/Resources" APP_BINARY="$APP_MACOS/$PRODUCT_NAME" +FINAL_AUDIT_DIR="$DIST_DIR/final-audit" +FINAL_AUDIT_APP_BUNDLE="$FINAL_AUDIT_DIR/$APP_DISPLAY_NAME.app" +FINAL_AUDIT_APP_BINARY="$FINAL_AUDIT_APP_BUNDLE/Contents/MacOS/$PRODUCT_NAME" PDF_TEXT_WORKER_NAME="WeiBeiPDFTextWorker" PDF_TEXT_WORKER="$APP_HELPERS/$PDF_TEXT_WORKER_NAME" INFO_PLIST="$APP_CONTENTS/Info.plist" @@ -55,14 +63,29 @@ VERIFY_STDERR="$VERIFY_DATA_DIR/app-stderr.log" VERIFY_SCENARIO="${WEIBEI_VERIFY_SCENARIO:-offline-learning-flow}" VERIFY_WINDOW_SIZE="${WEIBEI_VERIFY_WINDOW_SIZE:-}" VERIFY_INSPIRATION_ID="${WEIBEI_VERIFY_INSPIRATION_ID:-}" -VERIFY_CAPTURE_PATH="${TMPDIR:-/tmp}/weibei-self-capture-$UID-$VERIFY_SCENARIO.png" +VERIFY_CAPTURE_PATH="${TMPDIR:-/tmp}/weibei-self-capture-$UID-$$-$VERIFY_SCENARIO.png" + +target_app_is_running() { + local pid command target_binary="$APP_BINARY" + if [[ "$PACKAGE_ONLY" == true ]]; then + target_binary="$FINAL_APP_BINARY" + fi + while IFS= read -r pid; do + [[ -n "$pid" ]] || continue + command="$(ps -p "$pid" -o command= 2>/dev/null || true)" + if [[ "$command" == "$target_binary" || "$command" == "$target_binary "* ]]; then + return 0 + fi + done < <(pgrep -x "$PRODUCT_NAME" 2>/dev/null || true) + return 1 +} if [[ "$CHECK_ONLY" == true ]]; then : elif [[ "$VERIFY_MODE" == true ]]; then : elif [[ "$PACKAGE_ONLY" == true ]]; then - if pgrep -x "$PRODUCT_NAME" >/dev/null; then + if target_app_is_running; then echo "package blocked: $APP_DISPLAY_NAME is running; quit it first so dist can be replaced without touching the active window." >&2 exit 6 fi @@ -159,6 +182,7 @@ if [[ "$CHECK_ONLY" != true ]]; then </dict> </plist> PLIST + /usr/bin/xattr -cr "$APP_BUNDLE" /usr/bin/codesign --force --sign - --timestamp=none "$PDF_TEXT_WORKER" >/dev/null /usr/bin/codesign --force --sign - --timestamp=none "$APP_BUNDLE" >/dev/null /usr/bin/codesign --verify --deep --strict "$APP_BUNDLE" @@ -174,6 +198,36 @@ PLIST fi WEIBEI_PI_EXECUTABLE="$PACKAGED_PI" WEIBEI_PI_APP_BUNDLE="$APP_BUNDLE" WEIBEI_PI_LIVE_CHECK=0 \ "$BUILD_DIR/WeiBeiPiCheck" + if [[ "$PACKAGE_ONLY" == true ]]; then + rm -rf "$FINAL_APP_BUNDLE" + mkdir -p "$FINAL_DIST_DIR" + /usr/bin/ditto --norsrc --noextattr "$APP_BUNDLE" "$FINAL_APP_BUNDLE" + /usr/bin/xattr -cr "$FINAL_APP_BUNDLE" + if ! /usr/bin/cmp -s "$APP_BINARY" "$FINAL_APP_BINARY"; then + echo "package failed: final app binary changed while copying from signed staging" >&2 + exit 15 + fi + /usr/bin/codesign --verify --deep "$FINAL_APP_BUNDLE" + FINAL_UUID="$(/usr/bin/dwarfdump --uuid "$FINAL_APP_BINARY" | /usr/bin/awk 'NR == 1 {print $2}')" + if [[ -z "$FINAL_UUID" || "$FINAL_UUID" != "$PACKAGED_UUID" ]]; then + echo "package failed: final app binary UUID changed while copying from signed staging" >&2 + exit 16 + fi + rm -rf "$FINAL_AUDIT_DIR" + mkdir -p "$FINAL_AUDIT_DIR" + /usr/bin/ditto --norsrc --noextattr "$FINAL_APP_BUNDLE" "$FINAL_AUDIT_APP_BUNDLE" + /usr/bin/xattr -cr "$FINAL_AUDIT_APP_BUNDLE" + /usr/bin/codesign --verify --deep --strict "$FINAL_AUDIT_APP_BUNDLE" + if ! /usr/bin/cmp -s "$FINAL_APP_BINARY" "$FINAL_AUDIT_APP_BINARY"; then + echo "package failed: strict-audit copy changed the final app binary" >&2 + exit 17 + fi + AUDITED_UUID="$(/usr/bin/dwarfdump --uuid "$FINAL_AUDIT_APP_BINARY" | /usr/bin/awk 'NR == 1 {print $2}')" + if [[ -z "$AUDITED_UUID" || "$AUDITED_UUID" != "$FINAL_UUID" ]]; then + echo "package failed: strict-audit copy changed the final app binary UUID" >&2 + exit 18 + fi + fi fi open_app() { @@ -188,6 +242,8 @@ cleanup_verify_app() { open_app_for_verify() { local agent_environment=(WEIBEI_FORCE_OFFLINE_AGENT=1) + local pane_trace_dir="" + local pane_trace_samples=0 if [[ "$VERIFY_SCENARIO" == "pi-learning-flow" || "$VERIFY_SCENARIO" == "pi-course-memory-flow" ]]; then agent_environment=( WEIBEI_FORCE_OFFLINE_AGENT=0 @@ -195,6 +251,12 @@ open_app_for_verify() { WEIBEI_PI_MODEL=gpt-5.5 ) fi + if [[ "$VERIFY_SCENARIO" == "pane-layout-stability-flow" || "$VERIFY_SCENARIO" == "pane-toggle-continuity-flow" || "$VERIFY_SCENARIO" == "pane-reorder-width-flow" ]]; then + pane_trace_dir="$VERIFY_DATA_DIR/pane-trace" + fi + if [[ "$VERIFY_SCENARIO" == "pane-layout-stability-flow" ]]; then + pane_trace_samples=1 + fi rm -rf "$VERIFY_DATA_DIR" mkdir -p "$VERIFY_DATA_DIR" rm -f "$VERIFY_CAPTURE_PATH" @@ -206,6 +268,8 @@ open_app_for_verify() { "WEIBEI_VERIFY_WINDOW_SIZE=$VERIFY_WINDOW_SIZE" \ "WEIBEI_VERIFY_INSPIRATION_ID=$VERIFY_INSPIRATION_ID" \ "WEIBEI_VERIFY_CAPTURE_PATH=$VERIFY_CAPTURE_PATH" \ + "WEIBEI_VERIFY_PANE_TRACE_DIR=$pane_trace_dir" \ + "WEIBEI_VERIFY_PANE_TRACE_SAMPLES=$pane_trace_samples" \ "$APP_BINARY" >"$VERIFY_STDOUT" 2>"$VERIFY_STDERR" & VERIFY_PID="$!" trap cleanup_verify_app EXIT @@ -382,9 +446,203 @@ verify_empty_workspace_state() { return 1 } +verify_linked_sources_flow() { + if [[ "$VERIFY_SCENARIO" != "linked-sources-flow" ]]; then + return 0 + fi + + local workspace_file="$VERIFY_DATA_DIR/workspace.json" + for _ in {1..30}; do + if [[ -f "$workspace_file" ]] \ + && /usr/bin/grep -q '"noteSourceLinks"' "$workspace_file" \ + && /usr/bin/grep -q '"sourceItemID":"sample-html"' "$workspace_file" \ + && /usr/bin/grep -q '"sourceItemID":"sample-pdf"' "$workspace_file" \ + && /usr/bin/grep -q '"selectedItemID":"sample-pdf"' "$workspace_file" \ + && /usr/bin/grep -q '"showLibrary":false' "$workspace_file" \ + && /usr/bin/grep -q '"activeNotebookItemID":"file:' "$workspace_file"; then + return 0 + fi + sleep 0.2 + done + + echo "verify failed: linked-sources-flow did not persist two sources while keeping the active note independent." >&2 + return 1 +} + +verify_pane_toggle_continuity() { + if [[ "$VERIFY_SCENARIO" != "pane-toggle-continuity-flow" ]]; then + return 0 + fi + + local report_file="$VERIFY_DATA_DIR/pane-toggle-continuity-report.txt" + for _ in {1..1800}; do + if [[ -f "$report_file" ]]; then + if /usr/bin/grep -q '^result=pass$' "$report_file"; then + verify_pane_trace_summary 480 + return $? + fi + echo "verify failed: pane toggles changed passive reading state or recreated a persistent pane." >&2 + cat "$report_file" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 + fi + sleep 0.2 + done + + echo "verify failed: pane-toggle continuity report was not produced." >&2 + [[ -f "$VERIFY_DATA_DIR/verification-state.txt" ]] && cat "$VERIFY_DATA_DIR/verification-state.txt" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 +} + +verify_pane_trace_summary() { + local minimum_transitions="$1" + local summary_file="$VERIFY_DATA_DIR/pane-trace/summary.json" + for _ in {1..100}; do + if [[ -s "$summary_file" ]] \ + && /usr/bin/jq -e ".transitions >= $minimum_transitions" "$summary_file" >/dev/null 2>&1; then + break + fi + sleep 0.1 + done + if [[ ! -s "$summary_file" ]]; then + echo "verify failed: pane frame summary was not produced." >&2 + return 1 + fi + if ! /usr/bin/jq -e ".transitions >= $minimum_transitions and .ownershipFailures == 0 and .blankVisibleFailures == 0 and .identityFailures == 0 and (.roleIdentities | length) == 3" "$summary_file" >/dev/null; then + echo "verify failed: pane frame summary recorded unstable ownership or an empty visible slot." >&2 + /usr/bin/jq . "$summary_file" >&2 + return 1 + fi + /usr/bin/jq -r '"pane_summary_samples=\(.samples)\npane_summary_transitions=\(.transitions)\npane_summary_failures=\(.ownershipFailures + .blankVisibleFailures + .identityFailures)"' "$summary_file" +} + +verify_pane_layout_stability() { + if [[ "$VERIFY_SCENARIO" != "pane-layout-stability-flow" ]]; then + return 0 + fi + + local report_file="$VERIFY_DATA_DIR/pane-layout-stability-report.txt" + local trace_dir="$VERIFY_DATA_DIR/pane-trace" + for _ in {1..180}; do + if [[ -f "$report_file" ]]; then + if ! /usr/bin/grep -q '^result=pass$' "$report_file"; then + echo "verify failed: pane state changed while exercising the stable workspace." >&2 + cat "$report_file" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 + fi + break + fi + sleep 0.2 + done + + if [[ ! -f "$report_file" ]]; then + echo "verify failed: pane-layout stability report was not produced." >&2 + [[ -f "$VERIFY_DATA_DIR/verification-state.txt" ]] && cat "$VERIFY_DATA_DIR/verification-state.txt" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 + fi + + local trace_files=() + for _ in {1..50}; do + shopt -s nullglob + trace_files=("$trace_dir"/container-*.json) + shopt -u nullglob + (( ${#trace_files[@]} >= 120 )) && break + sleep 0.1 + done + if (( ${#trace_files[@]} < 120 )); then + echo "verify failed: expected frame-level pane traces, found ${#trace_files[@]}." >&2 + return 1 + fi + + if ! /usr/bin/jq -s -e ' + def role_is_stable($role): + ([.[] | .roles[] | select(.role == $role) | .hostID] | unique | length) == 1 + and ([.[] | .roles[] | select(.role == $role) | .parentID] | unique | length) == 1 + and ([.[] | .roles[] | select(.role == $role) | .contentHostID] | unique | length) == 1 + and ([.[] | .roles[] | select(.role == $role) | .contentParentID] | unique | length) == 1; + ([.[].recorderID] | unique | length) == 1 + and ([.[].transition] | unique | length) >= 8 + and all(.[]; .stableOwnership == true and .noBlankVisibleSlots == true) + and all((sort_by(.transition) | group_by(.transition))[]; length >= 15) + and role_is_stable("reader") + and role_is_stable("agent") + and role_is_stable("notes") + ' "${trace_files[@]}" >/dev/null; then + echo "verify failed: a pane host changed identity/parent or exposed an empty visible slot during animation." >&2 + /usr/bin/jq -s '{samples:length, transitions:([.[].transition] | unique | length), ownership_failures:[.[] | select(.stableOwnership != true)] | length, blank_visible_failures:[.[] | select(.noBlankVisibleSlots != true)] | length}' "${trace_files[@]}" >&2 + return 1 + fi + + local transition_count + transition_count="$(/usr/bin/jq -s '[.[].transition] | unique | length' "${trace_files[@]}")" + echo "pane_trace_samples=${#trace_files[@]}" + echo "pane_trace_transitions=$transition_count" + echo "pane_host_and_parent_identity=stable" + echo "pane_visible_slots=nonblank" +} + +verify_pane_reorder_width() { + if [[ "$VERIFY_SCENARIO" != "pane-reorder-width-flow" ]]; then + return 0 + fi + + local report_file="$VERIFY_DATA_DIR/pane-reorder-width-report.txt" + for _ in {1..180}; do + if [[ -f "$report_file" ]]; then + if ! /usr/bin/grep -q '^result=pass$' "$report_file"; then + echo "verify failed: pane reorder, width restoration, or persistent state changed unexpectedly." >&2 + cat "$report_file" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 + fi + verify_pane_trace_summary 4 + return $? + fi + sleep 0.2 + done + + echo "verify failed: pane reorder and width report was not produced." >&2 + [[ -f "$VERIFY_DATA_DIR/verification-state.txt" ]] && cat "$VERIFY_DATA_DIR/verification-state.txt" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 +} + +verify_reader_scroll_persistence() { + if [[ "$VERIFY_SCENARIO" != "reader-scroll-persistence-flow" ]]; then + return 0 + fi + + local report_file="$VERIFY_DATA_DIR/reader-scroll-persistence-report.txt" + for _ in {1..120}; do + if [[ -f "$report_file" ]]; then + if /usr/bin/grep -q '^result=pass$' "$report_file"; then + return 0 + fi + echo "verify failed: user scroll did not persist and restore the HTML section." >&2 + cat "$report_file" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 + fi + sleep 0.2 + done + + echo "verify failed: reader scroll persistence report was not produced." >&2 + [[ -f "$VERIFY_DATA_DIR/verification-state.txt" ]] && cat "$VERIFY_DATA_DIR/verification-state.txt" >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 +} + finish_verify_window() { verify_learning_flow_persistence verify_empty_workspace_state + verify_linked_sources_flow + verify_pane_toggle_continuity + verify_pane_layout_stability + verify_pane_reorder_width + verify_reader_scroll_persistence if [[ "$RUN_VISUAL_VERIFY" == true ]]; then visual_verify_window fi From 366892c14dd6c97cacc687af8edf33433f29f7f6 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Mon, 13 Jul 2026 06:27:03 +0800 Subject: [PATCH 23/36] feat: add course workspace management --- Sources/WeiBei/App/WeiBeiApp.swift | 5 + Sources/WeiBei/Stores/WorkspaceStore.swift | 696 +++++++++++++++++- Sources/WeiBei/Views/CommandPaletteView.swift | 1 + Sources/WeiBei/Views/ContentView.swift | 104 +-- Sources/WeiBei/Views/CourseOverviewView.swift | 236 ++++++ Sources/WeiBei/Views/CourseRecordsView.swift | 194 +++++ .../WeiBei/Views/CourseRelationsView.swift | 389 ++++++++++ .../Views/CourseWorkspaceComponents.swift | 383 ++++++++++ .../WeiBei/Views/CourseWorkspaceView.swift | 531 +++++++++++++ Sources/WeiBei/Views/LinkedSourcesView.swift | 8 + Sources/WeiBei/Views/ReaderView.swift | 17 +- .../WeiBeiCore/CourseWorkspaceSummary.swift | 44 ++ Sources/WeiBeiCore/NoteSourceRelations.swift | 59 ++ Sources/WeiBeiSelfCheck/main.swift | 157 ++++ script/build_and_run.sh | 72 ++ 15 files changed, 2828 insertions(+), 68 deletions(-) create mode 100644 Sources/WeiBei/Views/CourseOverviewView.swift create mode 100644 Sources/WeiBei/Views/CourseRecordsView.swift create mode 100644 Sources/WeiBei/Views/CourseRelationsView.swift create mode 100644 Sources/WeiBei/Views/CourseWorkspaceComponents.swift create mode 100644 Sources/WeiBei/Views/CourseWorkspaceView.swift create mode 100644 Sources/WeiBeiCore/CourseWorkspaceSummary.swift diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index 1d1f48514..d646d05a6 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -80,6 +80,11 @@ struct WeiBeiApp: App { .windowStyle(.hiddenTitleBar) .commands { CommandMenu(store.appDisplayName) { + Button(store.ui("打开课程台", "Open Course Workspace")) { store.presentCourseWorkspace() } + .keyboardShortcut("0") + + Divider() + Button(store.ui("打开资料", "Open Material")) { store.importFilesFromPanel() } .keyboardShortcut("o") diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index d28165525..b7c35aebc 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -23,6 +23,14 @@ struct NotebookRenameDraft: Identifiable, Equatable { var title: String } +struct CourseFolderImportDraft: Identifiable { + let id = UUID() + var rootURLs: [URL] + var markdownFiles: [URL] + var notePaths: Set<String> + var automaticMaterialCount: Int +} + struct ThreePaneReorderDrag: Equatable { var role: WorkspacePaneRole var translation: CGFloat @@ -57,6 +65,7 @@ enum PaneToggleContinuityVerifier { || scenario == "pane-layout-stability-flow" || scenario == "pane-reorder-width-flow" || scenario == "reader-scroll-persistence-flow" + || scenario == "course-workspace-workflow-flow" } static func beginMeasurement() { @@ -148,6 +157,13 @@ enum PaneToggleContinuityVerifier { } } +enum CourseWorkspaceDestination: String, CaseIterable, Sendable { + case overview + case materials + case notes + case sessions +} + @MainActor final class WorkspaceStore: ObservableObject { @Published var importedItems: [StudyItem] = [] @@ -161,7 +177,11 @@ final class WorkspaceStore: ObservableObject { @Published var agentActivityText: String? @Published private(set) var latestAgentNoteProposal: StudyAgentNoteProposal? @Published private(set) var latestAgentLearningUpdate: StudyAgentLearningUpdate? - @Published private(set) var noteSourceLinks: [NoteSourceLink] = [] + @Published private(set) var noteSourceLinks: [NoteSourceLink] = [] { + didSet { + noteSourceRelationIndex = NoteSourceRelationIndex(links: noteSourceLinks) + } + } @Published var linkedSourcesPresented = false private(set) var studyLocationsByItemID: [String: StudyLocation] = [:] @Published private(set) var learningMemoryEntries: [LearningMemoryEntry] = [] @@ -204,6 +224,7 @@ final class WorkspaceStore: ObservableObject { @Published var selectionAnchor: CGPoint? @Published var noteEditorCommand: NoteEditorCommand? @Published var noteFileError: String? + @Published private(set) var workspaceSaveError: String? @Published var notebookCreationDraft: NotebookCreationDraft? @Published var notebookRenameDraft: NotebookRenameDraft? @Published var modelName: String = ProcessInfo.processInfo.environment["WEIBEI_OPENAI_MODEL"] ?? "gpt-5.1" @@ -213,6 +234,10 @@ final class WorkspaceStore: ObservableObject { @Published var adaptImportedDocumentColors = true @Published var interfaceLanguage: WeiBeiInterfaceLanguage = .chinese @Published var topBarVariant: TopBarVariant = TopBarVariant(rawValue: UserDefaults.standard.string(forKey: "topBarVariant") ?? "") ?? .balanced + @Published var courseWorkspacePresented = false + @Published private(set) var courseWorkspaceDestination: CourseWorkspaceDestination = .overview + @Published private(set) var courseWorkspaceTargetItemID: String? + @Published var courseFolderImportDraft: CourseFolderImportDraft? @Published private var backNavigationStack: [NavigationSnapshot] = [] @Published private var forwardNavigationStack: [NavigationSnapshot] = [] @@ -243,6 +268,8 @@ final class WorkspaceStore: ObservableObject { private var studyProgressSaveTask: Task<Void, Never>? private let studyProgressSaveDelay: UInt64 = 900_000_000 private var noteSourceLinksMigrationVersion = 0 + private var noteSourceRelationIndex = NoteSourceRelationIndex(links: []) + private var courseWorkspaceReturnFocus: PaneFocus? var showRightPane: Bool { get { showNotes || showAgent } @@ -339,13 +366,91 @@ final class WorkspaceStore: ObservableObject { sampleItems + importedItems } + var courseMaterials: [StudyItem] { + importedItems.filter { !$0.isNotebookNote } + } + + var courseNotebookItems: [StudyItem] { + importedItems.filter(\.isNotebookNote) + } + + var recentCourseSessions: [StudySession] { + orderedStudySessions.filter { !$0.messages.isEmpty } + } + + var activeCourseMemories: [LearningMemoryEntry] { + orderedLearningMemoryEntries.filter { $0.status == .active } + } + + var recentCourseMessages: [AgentMessage] { + studySessions + .flatMap(\.messages) + .sorted { $0.createdAt > $1.createdAt } + } + + var courseWorkspaceSummary: CourseWorkspaceSummary { + CourseWorkspaceSummary( + importedItems: importedItems, + noteSourceLinks: noteSourceLinks, + studyLocationsByItemID: studyLocationsByItemID, + studySessions: studySessions, + learningMemoryEntries: learningMemoryEntries + ) + } + + var courseMaterialsWithoutReadingPosition: [StudyItem] { + courseMaterials.filter { studyLocationsByItemID[$0.id] == nil } + } + + var courseMaterialsWithoutNoteLinks: [StudyItem] { + let validNoteIDs = Set(courseNotebookItems.map(\.id)) + let linkedIDs = Set(noteSourceLinks.lazy.filter { validNoteIDs.contains($0.noteItemID) }.map(\.sourceItemID)) + return courseMaterials.filter { !linkedIDs.contains($0.id) } + } + + var courseNotesWithoutSourceLinks: [StudyItem] { + let validSourceIDs = Set(courseMaterials.map(\.id)) + let linkedIDs = Set(noteSourceLinks.lazy.filter { validSourceIDs.contains($0.sourceItemID) }.map(\.noteItemID)) + return courseNotebookItems.filter { !linkedIDs.contains($0.id) } + } + + func studyLocation(for itemID: String) -> StudyLocation? { + studyLocationsByItemID[itemID] + } + + func linkedNotes(for sourceItemID: String) -> [StudyItem] { + let noteIDs = Set(linkedNoteIDs(for: sourceItemID)) + return courseNotebookItems.filter { noteIDs.contains($0.id) } + } + + func linkedNoteIDs(for sourceItemID: String) -> [String] { + noteSourceRelationIndex.noteIDs(for: sourceItemID) + } + + func linkedNoteCount(for sourceItemID: String) -> Int { + noteSourceRelationIndex.noteCount(for: sourceItemID) + } + + func item(withID itemID: String) -> StudyItem? { + allItems.first { $0.id == itemID } + } + var linkedSourceIDsForActiveNote: [String] { guard let noteItemID = activeNotebookItemID else { return [] } return linkedSourceIDs(for: noteItemID) } func linkedSourceIDs(for noteItemID: String) -> [String] { - NoteSourceRelations(links: noteSourceLinks).sourceIDs(for: noteItemID) + noteSourceRelationIndex.sourceIDs(for: noteItemID) + } + + func linkedSourceCount(for noteItemID: String) -> Int { + noteSourceRelationIndex.sourceCount(for: noteItemID) + } + + func linkedCourseSourceIDs(for noteItemID: String) -> [String] { + let validCourseIDs = Set(courseMaterials.map(\.id)) + return noteSourceRelationIndex.sourceIDs(for: noteItemID).filter(validCourseIDs.contains) } var linkedSourcesForActiveNote: [StudyItem] { @@ -965,6 +1070,84 @@ final class WorkspaceStore: ObservableObject { save() } + func setLinkedCourseSourceIDs(_ sourceItemIDs: Set<String>, for noteItemID: String) { + let courseSourceIDs = Set(courseMaterials.map(\.id)) + let retainedNonCourseIDs = Set(linkedSourceIDs(for: noteItemID)).subtracting(courseSourceIDs) + setLinkedSourceIDs( + retainedNonCourseIDs.union(sourceItemIDs.intersection(courseSourceIDs)), + for: noteItemID + ) + } + + func setLinkedNoteIDs(_ noteItemIDs: Set<String>, for sourceItemID: String) { + guard allItems.contains(where: { $0.id == sourceItemID && !$0.isNotebookNote }) else { return } + let validNoteIDs = Set(courseNotebookItems.map(\.id)) + var relations = NoteSourceRelations(links: noteSourceLinks) + relations.replaceNotes( + for: sourceItemID, + noteItemIDs: noteItemIDs.intersection(validNoteIDs) + ) + guard relations.links != noteSourceLinks else { return } + invalidateAgentContext() + noteSourceLinks = relations.links + save() + } + + func presentCourseWorkspace( + _ destination: CourseWorkspaceDestination = .overview, + selecting itemID: String? = nil + ) { + persistCurrentNote() + courseWorkspaceReturnFocus = focusedPane + courseWorkspaceDestination = destination + courseWorkspaceTargetItemID = itemID + courseWorkspacePresented = true + } + + func dismissCourseWorkspace() { + dismissCourseWorkspace(restoringFocus: true) + } + + func openCourseMaterial(_ itemID: String) { + guard courseMaterials.contains(where: { $0.id == itemID }) else { return } + dismissCourseWorkspace(restoringFocus: false) + select(itemID: itemID) + if layout == .immersiveWriting || layout == .immersiveConversation { + setLayout(.immersiveReading) + } else { + showReader = true + focus(.reader) + save() + } + } + + func openCourseNote(_ itemID: String) { + guard courseNotebookItems.contains(where: { $0.id == itemID }) else { return } + dismissCourseWorkspace(restoringFocus: false) + select(itemID: itemID) + } + + func continueCourseSession(_ sessionID: UUID) { + guard studySessions.contains(where: { $0.id == sessionID && !$0.messages.isEmpty }) else { return } + activateStudySession(sessionID) + dismissCourseWorkspace(restoringFocus: false) + setLayout(.immersiveConversation) + } + + private func dismissCourseWorkspace(restoringFocus: Bool) { + guard courseWorkspacePresented else { return } + courseWorkspacePresented = false + courseWorkspaceTargetItemID = nil + courseFolderImportDraft = nil + guard restoringFocus, let courseWorkspaceReturnFocus else { + self.courseWorkspaceReturnFocus = nil + return + } + focusedPane = courseWorkspaceReturnFocus + focusRequest += 1 + self.courseWorkspaceReturnFocus = nil + } + func selectAdjacentItem(step: Int) { let ids = navigableItems.map(\.id) guard let nextID = LibraryNavigator.adjacentID(in: ids, selectedID: selectedItemID, step: step) else { return } @@ -1031,6 +1214,11 @@ final class WorkspaceStore: ObservableObject { createNotebookNote(seed: .blank) } + @discardableResult + func createCourseNotebookNote(title: String) -> String? { + createNotebookNote(seed: .blank, title: title)?.id + } + func createNotebookNoteFromCurrentMaterial() { guard let selectedMaterialItem else { createBlankNotebookNote() @@ -2023,27 +2211,90 @@ final class WorkspaceStore: ObservableObject { presentImportPanel(linkToActiveNote: false) } + func prepareCourseFolderImportFromPanel() { + let panel = NSOpenPanel() + panel.title = ui("选择课程文件夹", "Choose a course folder") + panel.allowsMultipleSelection = true + panel.canChooseDirectories = true + panel.canChooseFiles = false + guard panel.runModal() == .OK else { + courseFolderImportDraft = nil + return + } + + let draft = makeCourseFolderImportDraft(rootURLs: panel.urls) + guard !draft.markdownFiles.isEmpty else { + _ = importFiles(panel.urls, selectsFirstImportedItem: false) + courseFolderImportDraft = nil + return + } + courseFolderImportDraft = draft + } + + func importCourseFolder(_ draft: CourseFolderImportDraft, notePaths: Set<String>) { + _ = importFiles( + draft.rootURLs, + selectsFirstImportedItem: false, + markdownNotePaths: notePaths, + reclassifiesExistingMarkdown: true + ) + } + + @discardableResult + func retryWorkspaceSave() -> Bool { + save() + } + + func importCourseMaterialsFromPanel() { + presentImportPanel( + linkToActiveNote: false, + selectsFirstImportedItem: false, + reclassifiesExistingMarkdown: true, + panelTitle: ui("选择课程资料或文件夹", "Choose course materials or a folder") + ) + } + + func importCourseNotesFromPanel() { + presentImportPanel( + linkToActiveNote: false, + selectsFirstImportedItem: false, + markdownAsNotes: true, + markdownOnly: true, + reclassifiesExistingMarkdown: true, + panelTitle: ui("选择 Markdown 笔记或文件夹", "Choose Markdown notes or a folder") + ) + } + func importAndLinkSourcesFromPanel() { presentImportPanel(linkToActiveNote: true) } - private func presentImportPanel(linkToActiveNote: Bool) { + private func presentImportPanel( + linkToActiveNote: Bool, + selectsFirstImportedItem: Bool = true, + markdownAsNotes: Bool = false, + markdownOnly: Bool = false, + reclassifiesExistingMarkdown: Bool = false, + panelTitle: String? = nil + ) { let panel = NSOpenPanel() - panel.title = ui("选择学习资料或课程文件夹", "Choose study materials or a course folder") + panel.title = panelTitle ?? ui("选择学习资料或课程文件夹", "Choose study materials or a course folder") panel.allowsMultipleSelection = true panel.canChooseDirectories = true panel.canChooseFiles = true - panel.allowedContentTypes = [ - .pdf, - .html, - .plainText, - UTType(filenameExtension: "md") ?? .plainText, - UTType(filenameExtension: "markdown") ?? .plainText - ] + panel.allowedContentTypes = markdownOnly + ? [UTType(filenameExtension: "md") ?? .plainText, UTType(filenameExtension: "markdown") ?? .plainText] + : [.pdf, .html, .plainText, UTType(filenameExtension: "md") ?? .plainText, UTType(filenameExtension: "markdown") ?? .plainText] guard panel.runModal() == .OK else { return } let targetNoteID = linkToActiveNote ? activeNotebookItemID : nil - let selectedItems = importFiles(panel.urls) + let selectedItems = importFiles( + panel.urls, + selectsFirstImportedItem: selectsFirstImportedItem, + markdownAsNotes: markdownAsNotes, + markdownOnly: markdownOnly, + reclassifiesExistingMarkdown: reclassifiesExistingMarkdown + ) if let targetNoteID, targetNoteID == activeNotebookItemID { setLinkedSourceIDsForActiveNote( Set(linkedSourceIDsForActiveNote).union(selectedItems.map(\.id)) @@ -2052,15 +2303,56 @@ final class WorkspaceStore: ObservableObject { } @discardableResult - func importFiles(_ urls: [URL]) -> [StudyItem] { + func importFiles( + _ urls: [URL], + selectsFirstImportedItem: Bool = true, + markdownAsNotes: Bool = false, + markdownOnly: Bool = false, + markdownNotePaths: Set<String>? = nil, + reclassifiesExistingMarkdown: Bool = false + ) -> [StudyItem] { let existing = Set(importedItems.compactMap(\.urlPath)) - let expandedURLs = urls + let supportedURLs = urls .flatMap(Self.supportedCourseFiles(at:)) .reduce(into: [URL]()) { result, url in if !result.contains(where: { $0.standardizedFileURL == url.standardizedFileURL }) { result.append(url) } } + let expandedURLs = markdownOnly + ? supportedURLs.filter(Self.isMarkdownFile) + : supportedURLs + let isNotebookNote: (URL) -> Bool = { url in + guard Self.isMarkdownFile(url) else { return false } + return markdownNotePaths?.contains(url.path) ?? markdownAsNotes + } + + var roleChanged = false + if reclassifiesExistingMarkdown || markdownNotePaths != nil { + persistCurrentNote() + for url in expandedURLs where Self.isMarkdownFile(url) { + guard let index = importedItems.firstIndex(where: { $0.urlPath == url.path }) else { continue } + let nextRole = isNotebookNote(url) + guard importedItems[index].isNotebookNote != nextRole else { continue } + importedItems[index].isNotebookNote = nextRole + roleChanged = true + } + if roleChanged { + if let selectedItemID, + importedItems.first(where: { $0.id == selectedItemID })?.isNotebookNote == true { + self.selectedItemID = courseMaterials.first?.id ?? sampleItems.first?.id + readerLocationTitle = selectedMaterialItem.map(displayTitle) + restoreCurrentStudyLocation() + } + if let activeNotebookItemID, + importedItems.first(where: { $0.id == activeNotebookItemID })?.isNotebookNote == false { + self.activeNotebookItemID = courseNotebookItems.first?.id + noteText = noteText(for: activeNoteItem) + } + _ = sanitizeNoteSourceLinks() + invalidateAgentContext() + } + } let newItems = expandedURLs .filter { !existing.contains($0.path) } .map { url in @@ -2070,13 +2362,14 @@ final class WorkspaceStore: ObservableObject { subtitle: url.lastPathComponent, kind: StudyItemKind.detect(from: url), urlPath: url.path, - isSample: false + isSample: false, + isNotebookNote: isNotebookNote(url) ) } importedItems.append(contentsOf: newItems) courseDocumentSearchIndex.synchronize(allItems) - if let first = newItems.first { + if selectsFirstImportedItem, let first = newItems.first { select(itemID: first.id) } else { save() @@ -2085,6 +2378,23 @@ final class WorkspaceStore: ObservableObject { return allItems.filter { selectedIDs.contains($0.id) && !$0.isNotebookNote } } + private func makeCourseFolderImportDraft(rootURLs: [URL]) -> CourseFolderImportDraft { + let supportedFiles = rootURLs + .flatMap(Self.supportedCourseFiles(at:)) + .reduce(into: [URL]()) { result, url in + if !result.contains(where: { $0.standardizedFileURL == url.standardizedFileURL }) { + result.append(url) + } + } + let markdownFiles = supportedFiles.filter(Self.isMarkdownFile) + return CourseFolderImportDraft( + rootURLs: rootURLs, + markdownFiles: markdownFiles, + notePaths: Set(markdownFiles.filter(Self.defaultMarkdownIsNotebookNote).map(\.path)), + automaticMaterialCount: supportedFiles.count - markdownFiles.count + ) + } + private static func supportedCourseFiles(at url: URL) -> [URL] { var isDirectory: ObjCBool = false guard FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory) else { return [] } @@ -2112,6 +2422,16 @@ final class WorkspaceStore: ObservableObject { .contains(url.pathExtension.lowercased()) } + private static func isMarkdownFile(_ url: URL) -> Bool { + ["md", "markdown"].contains(url.pathExtension.lowercased()) + } + + private static func defaultMarkdownIsNotebookNote(_ url: URL) -> Bool { + let description = (url.deletingPathExtension().lastPathComponent + " " + + url.deletingLastPathComponent().pathComponents.suffix(3).joined(separator: " ")).lowercased() + return ["笔记", "note", "notes", "notebook"].contains { description.contains($0) } + } + func promptRenameNotebookNote(itemID: String) { guard let item = allItems.first(where: { $0.id == itemID && $0.isNotebookNote }) else { return } notebookCreationDraft = nil @@ -2230,7 +2550,8 @@ final class WorkspaceStore: ObservableObject { } } - private func createNotebookNote(seed: NotebookNoteSeed, title rawTitle: String? = nil) { + @discardableResult + private func createNotebookNote(seed: NotebookNoteSeed, title rawTitle: String? = nil) -> StudyItem? { let sourceItem: StudyItem? let defaultTitle = suggestedNotebookTitle(for: seed) switch seed { @@ -2242,7 +2563,7 @@ final class WorkspaceStore: ObservableObject { let title = (rawTitle ?? defaultTitle).trimmingCharacters(in: .whitespacesAndNewlines) guard !title.isEmpty else { noteFileError = ui("笔记名不能为空。", "Note name cannot be empty.") - return + return nil } persistCurrentNote() @@ -2277,8 +2598,10 @@ final class WorkspaceStore: ObservableObject { ? ui("已新建空白笔记:\(url.lastPathComponent)", "Created blank note: \(url.lastPathComponent)") : ui("已为当前资料新建笔记:\(url.lastPathComponent)", "Created note from current material: \(url.lastPathComponent)") showTransientNoteStatus(status) + return item } catch { noteFileError = ui("无法创建笔记:\(error.localizedDescription)", "Could not create note: \(error.localizedDescription)") + return nil } } @@ -3178,6 +3501,8 @@ final class WorkspaceStore: ObservableObject { || scenario == "pane-toggle-continuity-flow" || scenario == "pane-reorder-width-flow" || scenario == "reader-scroll-persistence-flow" + || scenario == "course-workspace-overview-flow" + || scenario == "course-workspace-workflow-flow" || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true recordVerificationStage("recognized:\(scenario)") @@ -3197,6 +3522,10 @@ final class WorkspaceStore: ObservableObject { save() return } + if scenario == "course-workspace-overview-flow" || scenario == "course-workspace-workflow-flow" { + await runCourseWorkspaceVerification(scenario) + return + } if scenario == "pane-toggle-continuity-flow" { await runPaneToggleContinuityVerification() return @@ -3307,6 +3636,320 @@ final class WorkspaceStore: ObservableObject { recordVerificationStage("completed") } + private func runCourseWorkspaceVerification(_ scenario: String) async { + let fixtureDirectory = storageURL.deletingLastPathComponent() + .appendingPathComponent("CourseWorkspaceFixtures", isDirectory: true) + try? FileManager.default.createDirectory(at: fixtureDirectory, withIntermediateDirectories: true) + + func fixtureURL(_ name: String, extension fileExtension: String) -> URL { + fixtureDirectory.appendingPathComponent(name).appendingPathExtension(fileExtension) + } + + let materialAURL = fixtureURL("利率基础", extension: "html") + let materialBURL = fixtureURL("货币政策", extension: "md") + let materialCURL = fixtureURL("复习问题", extension: "txt") + let noteAURL = fixtureURL("利率研究笔记", extension: "md") + let noteBURL = fixtureURL("政策工具笔记", extension: "md") + let noteCURL = fixtureURL("期末复习笔记", extension: "md") + try? "<h1>利率基础</h1><p>名义利率与实际利率。</p>".write(to: materialAURL, atomically: true, encoding: .utf8) + try? "# 货币政策\n\n公开市场操作与政策利率。\n".write(to: materialBURL, atomically: true, encoding: .utf8) + try? "复习:比较名义利率与实际利率。\n".write(to: materialCURL, atomically: true, encoding: .utf8) + try? "# 利率研究笔记\n\n## 核心要点\n".write(to: noteAURL, atomically: true, encoding: .utf8) + try? "# 政策工具笔记\n\n## 摘录\n".write(to: noteBURL, atomically: true, encoding: .utf8) + try? "# 期末复习笔记\n\n## 待追问\n".write(to: noteCURL, atomically: true, encoding: .utf8) + + let selectionBeforeFolderImport = selectedItemID + let folderImportDraft = makeCourseFolderImportDraft(rootURLs: [fixtureDirectory]) + importCourseFolder(folderImportDraft, notePaths: folderImportDraft.notePaths) + let importedFolderItems = importedItems.filter { + $0.url?.deletingLastPathComponent().standardizedFileURL.path == fixtureDirectory.standardizedFileURL.path + } + let importedFolderRoles = Dictionary(uniqueKeysWithValues: importedFolderItems.map { + ($0.subtitle, $0.isNotebookNote) + }) + let folderItemCountPassed = importedFolderItems.count == 6 + let folderMaterialDefaultPassed = (importedFolderRoles[materialBURL.lastPathComponent] ?? true) == false + let folderNoteDefaultsPassed = [noteAURL, noteBURL, noteCURL].allSatisfy { url in + (importedFolderRoles[url.lastPathComponent] ?? false) == true + } + let folderCountSummaryPassed = folderImportDraft.automaticMaterialCount + + folderImportDraft.markdownFiles.count + - folderImportDraft.notePaths.count == 3 + let initialFolderClassificationPassed = folderItemCountPassed + && folderMaterialDefaultPassed + && folderNoteDefaultsPassed + && folderCountSummaryPassed + _ = importFiles( + [materialBURL], + selectsFirstImportedItem: false, + markdownAsNotes: true, + markdownOnly: true, + reclassifiesExistingMarkdown: true + ) + let correctedExistingFileToNote = importedItems.first(where: { $0.urlPath == materialBURL.path })?.isNotebookNote == true + _ = importFiles( + [materialBURL], + selectsFirstImportedItem: false, + reclassifiesExistingMarkdown: true + ) + let correctedExistingFileBackToMaterial = importedItems.first(where: { $0.urlPath == materialBURL.path })?.isNotebookNote == false + let importClassificationPassed = initialFolderClassificationPassed + && correctedExistingFileToNote + && correctedExistingFileBackToMaterial + && selectedItemID == selectionBeforeFolderImport + let importSelectionPreserved = selectedItemID == selectionBeforeFolderImport + + let materialA = StudyItem(id: "course-material-a", title: "利率基础", subtitle: materialAURL.lastPathComponent, kind: .html, urlPath: materialAURL.path, isSample: false) + let materialB = StudyItem(id: "course-material-b", title: "货币政策", subtitle: materialBURL.lastPathComponent, kind: .markdown, urlPath: materialBURL.path, isSample: false) + let materialC = StudyItem(id: "course-material-c", title: "复习问题", subtitle: materialCURL.lastPathComponent, kind: .text, urlPath: materialCURL.path, isSample: false) + let noteA = StudyItem(id: "course-note-a", title: "利率研究笔记", subtitle: noteAURL.lastPathComponent, kind: .markdown, urlPath: noteAURL.path, isSample: false, isNotebookNote: true) + let noteB = StudyItem(id: "course-note-b", title: "政策工具笔记", subtitle: noteBURL.lastPathComponent, kind: .markdown, urlPath: noteBURL.path, isSample: false, isNotebookNote: true) + let noteC = StudyItem(id: "course-note-c", title: "期末复习笔记", subtitle: noteCURL.lastPathComponent, kind: .markdown, urlPath: noteCURL.path, isSample: false, isNotebookNote: true) + + importedItems = [materialA, materialB, materialC, noteA, noteB, noteC] + notesByItemID = [ + noteA.id: "# 利率研究笔记\n\n## 核心要点\n", + noteB.id: "# 政策工具笔记\n\n## 摘录\n", + noteC.id: "# 期末复习笔记\n\n## 待追问\n", + ] + selectedItemID = materialA.id + activeNotebookItemID = noteA.id + noteText = notesByItemID[noteA.id] ?? "" + noteSourceLinks = [ + NoteSourceLink(noteItemID: noteA.id, sourceItemID: materialA.id), + NoteSourceLink(noteItemID: noteA.id, sourceItemID: materialB.id), + NoteSourceLink(noteItemID: noteB.id, sourceItemID: materialB.id), + ] + studyLocationsByItemID = [ + materialA.id: StudyLocation( + itemID: materialA.id, + itemTitle: materialA.title, + locationID: "html-heading-1", + locationTitle: "名义利率与实际利率", + lastStudiedAt: Date().addingTimeInterval(-1_800), + visitCount: 3 + ) + ] + let activeSession = StudySession( + title: "利率为什么会变化", + messages: [ + AgentMessage(role: .user, text: "名义利率和实际利率有什么区别?", source: materialA.title, backend: .pi), + AgentMessage(role: .assistant, text: "实际利率会扣除通货膨胀的影响。", source: materialA.title, backend: .pi), + ], + summary: "比较名义利率与实际利率,并联系货币政策工具。", + focusItemIDs: [materialA.id, materialB.id, noteA.id], + flow: StudyFlowState(phase: .note, suggestedNext: ["把利率公式整理到复习笔记", "用一道例题检验区别"]), + updatedAt: Date().addingTimeInterval(-900) + ) + let emptySession = StudySession(title: "新学习会话") + studySessions = [activeSession, emptySession] + activeStudySessionID = activeSession.id + messages = activeSession.messages + learningMemoryEntries = [ + LearningMemoryEntry( + kind: .confusion, + text: "仍不确定通货膨胀预期如何传导到名义利率。", + evidence: "用户在当前会话中明确提出", + origin: .userStatement, + sessionID: activeSession.id + ), + LearningMemoryEntry( + kind: .nextStep, + text: "完成名义利率与实际利率的对照例题。", + evidence: "当前会话建议", + origin: .agentInference, + sessionID: activeSession.id + ), + ] + layout = .documentAgentNotes + showLibrary = false + showReader = true + showAgent = true + showNotes = true + agentSurface = .hidden + courseDocumentSearchIndex.synchronize(allItems) + save() + + let noteCountBeforeInvalidCreation = courseNotebookItems.count + let invalidNoteID = createCourseNotebookNote(title: " ") + let invalidNoteCreationPassed = invalidNoteID == nil + && courseNotebookItems.count == noteCountBeforeInvalidCreation + && noteFileError?.isEmpty == false + noteFileError = nil + + let initialSummary = courseWorkspaceSummary + let initialRelations = NoteSourceRelations(links: noteSourceLinks) + if scenario == "course-workspace-overview-flow" { + let requestedPage = Self.environmentValue("WEIBEI_VERIFY_COURSE_PAGE") + if requestedPage == "notes" { + presentCourseWorkspace(.notes, selecting: noteA.id) + } else if requestedPage == "materials" { + presentCourseWorkspace(.materials, selecting: materialB.id) + } else if requestedPage == "sessions" { + presentCourseWorkspace(.sessions, selecting: activeSession.id.uuidString) + } else { + presentCourseWorkspace(.overview) + } + writeCourseWorkspaceVerificationReport( + name: "course-workspace-overview-report.json", + payload: [ + "result": initialSummary.materialCount == 3 + && initialSummary.noteCount == 3 + && initialSummary.explicitLinkCount == 3 + && initialSummary.readingPositionCount == 1 + && initialSummary.unlinkedMaterialCount == 1 + && initialSummary.unlinkedNoteCount == 1 + && initialSummary.studySessionCount == 1 + && initialSummary.unresolvedConfusionCount == 1 + && importClassificationPassed ? "pass" : "fail", + "importClassificationPassed": importClassificationPassed, + "invalidNoteCreationPassed": invalidNoteCreationPassed, + "initialFolderClassificationPassed": initialFolderClassificationPassed, + "correctedExistingFileToNote": correctedExistingFileToNote, + "correctedExistingFileBackToMaterial": correctedExistingFileBackToMaterial, + "importSelectionPreserved": importSelectionPreserved, + "importedFolderItemCount": importedFolderItems.count, + "importedFolderRoles": importedFolderRoles, + "folderMaterialDefaultPassed": folderMaterialDefaultPassed, + "folderNoteDefaultsPassed": folderNoteDefaultsPassed, + "folderCountSummaryPassed": folderCountSummaryPassed, + "materialCount": initialSummary.materialCount, + "noteCount": initialSummary.noteCount, + "explicitLinkCount": initialSummary.explicitLinkCount, + "readingPositionCount": initialSummary.readingPositionCount, + "unlinkedMaterialIDs": courseMaterialsWithoutNoteLinks.map(\.id).sorted(), + "unlinkedNoteIDs": courseNotesWithoutSourceLinks.map(\.id).sorted(), + "studySessionCount": initialSummary.studySessionCount, + "unresolvedConfusionCount": initialSummary.unresolvedConfusionCount, + "currentMaterialID": selectedItemID ?? "", + "currentNoteID": activeNotebookItemID ?? "", + "courseWorkspacePresented": courseWorkspacePresented, + ] + ) + return + } + + func verifyCourseOverlayContinuity(itemID: String) async -> (passed: Bool, makeCount: Int, dismantleCount: Int) { + select(itemID: itemID) + try? await Task.sleep(nanoseconds: 900_000_000) + let baselineLayout = layout + let baselineMaterialID = selectedItemID + let baselineNoteID = activeNotebookItemID + let baselineNoteText = noteText + let baselineMessages = messages + let baselineOrder = threePaneOrder + let baselineLocation = selectedItemID.flatMap { studyLocationsByItemID[$0] } + PaneToggleContinuityVerifier.beginMeasurement() + presentCourseWorkspace(.overview) + try? await Task.sleep(nanoseconds: 500_000_000) + dismissCourseWorkspace() + try? await Task.sleep(nanoseconds: 500_000_000) + let makeCount = PaneToggleContinuityVerifier.webReaderMakeCount + + PaneToggleContinuityVerifier.pdfReaderMakeCount + + PaneToggleContinuityVerifier.noteEditorMakeCount + let dismantleCount = PaneToggleContinuityVerifier.webReaderDismantleCount + + PaneToggleContinuityVerifier.pdfReaderDismantleCount + + PaneToggleContinuityVerifier.noteEditorDismantleCount + let passed = layout == baselineLayout + && selectedItemID == baselineMaterialID + && activeNotebookItemID == baselineNoteID + && noteText == baselineNoteText + && messages == baselineMessages + && threePaneOrder == baselineOrder + && selectedItemID.flatMap { studyLocationsByItemID[$0] } == baselineLocation + && makeCount == 0 + && dismantleCount == 0 + PaneToggleContinuityVerifier.endMeasurement() + return (passed, makeCount, dismantleCount) + } + + let htmlContinuity = await verifyCourseOverlayContinuity(itemID: materialA.id) + let pdfContinuity = await verifyCourseOverlayContinuity(itemID: "sample-pdf") + let continuityPassed = htmlContinuity.passed && pdfContinuity.passed + let paneMakeCount = htmlContinuity.makeCount + pdfContinuity.makeCount + let paneDismantleCount = htmlContinuity.dismantleCount + pdfContinuity.dismantleCount + select(itemID: materialA.id) + + setLinkedSourceIDs([materialA.id], for: noteA.id) + setLinkedSourceIDs([materialB.id, materialC.id], for: noteC.id) + let editedRelations = NoteSourceRelations(links: noteSourceLinks) + + presentCourseWorkspace(.materials, selecting: materialC.id) + openCourseMaterial(materialC.id) + let materialNavigationPassed = selectedItemID == materialC.id + && activeNotebookItemID == noteA.id + && !editedRelations.isLinked(noteItemID: noteA.id, sourceItemID: materialC.id) + + presentCourseWorkspace(.notes, selecting: noteC.id) + openCourseNote(noteC.id) + let noteNavigationPassed = selectedItemID == materialC.id + && activeNotebookItemID == noteC.id + + flushPendingNotePersistence() + save() + let diskData = try? Data(contentsOf: storageURL) + let diskSnapshot = diskData.flatMap { try? JSONDecoder().decode(PersistedWorkspace.self, from: $0) } + let diskRelations = NoteSourceRelations(links: diskSnapshot?.noteSourceLinks ?? []) + let diskSummary = diskSnapshot.map { + CourseWorkspaceSummary( + importedItems: $0.importedItems, + noteSourceLinks: $0.noteSourceLinks ?? [], + studyLocationsByItemID: $0.studyLocationsByItemID ?? [:], + studySessions: $0.studySessions ?? [], + learningMemoryEntries: $0.learningMemoryEntries ?? [] + ) + } + let persistencePassed = diskRelations.sourceIDs(for: noteA.id) == [materialA.id] + && Set(diskRelations.sourceIDs(for: noteC.id)) == Set([materialB.id, materialC.id]) + && Set(diskRelations.noteIDs(for: materialB.id)) == Set([noteB.id, noteC.id]) + && diskSummary?.explicitLinkCount == 4 + && diskSummary?.unlinkedMaterialCount == 0 + && diskSummary?.unlinkedNoteCount == 0 + + let resultPassed = initialRelations.links.count == 3 + && importClassificationPassed + && invalidNoteCreationPassed + && continuityPassed + && materialNavigationPassed + && noteNavigationPassed + && persistencePassed + writeCourseWorkspaceVerificationReport( + name: "course-workspace-workflow-report.json", + payload: [ + "result": resultPassed ? "pass" : "fail", + "continuityPassed": continuityPassed, + "importClassificationPassed": importClassificationPassed, + "invalidNoteCreationPassed": invalidNoteCreationPassed, + "initialFolderClassificationPassed": initialFolderClassificationPassed, + "correctedExistingFileToNote": correctedExistingFileToNote, + "correctedExistingFileBackToMaterial": correctedExistingFileBackToMaterial, + "importSelectionPreserved": importSelectionPreserved, + "importedFolderItemCount": importedFolderItems.count, + "importedFolderRoles": importedFolderRoles, + "folderMaterialDefaultPassed": folderMaterialDefaultPassed, + "folderNoteDefaultsPassed": folderNoteDefaultsPassed, + "folderCountSummaryPassed": folderCountSummaryPassed, + "materialNavigationPassed": materialNavigationPassed, + "noteNavigationPassed": noteNavigationPassed, + "persistencePassed": persistencePassed, + "finalMaterialID": selectedItemID ?? "", + "finalNoteID": activeNotebookItemID ?? "", + "noteA_sources": diskRelations.sourceIDs(for: noteA.id), + "noteC_sources": diskRelations.sourceIDs(for: noteC.id), + "materialB_notes": diskRelations.noteIDs(for: materialB.id), + "paneMakeCount": paneMakeCount, + "paneDismantleCount": paneDismantleCount, + ] + ) + } + + private func writeCourseWorkspaceVerificationReport(name: String, payload: [String: Any]) { + guard JSONSerialization.isValidJSONObject(payload), + let data = try? JSONSerialization.data(withJSONObject: payload, options: [.prettyPrinted, .sortedKeys]) else { return } + let url = storageURL.deletingLastPathComponent().appendingPathComponent(name) + try? data.write(to: url, options: .atomic) + } + private func waitForReaderContextToSettle() async { var previousTitle = readerLocationTitle var previousPage = readerPageIndex @@ -4548,7 +5191,8 @@ final class WorkspaceStore: ObservableObject { .replacingOccurrences(of: "\n- <br />", with: "") } - private func save() { + @discardableResult + private func save() -> Bool { let snapshot = PersistedWorkspace( importedItems: importedItems, notesByItemID: notesByItemID, @@ -4576,8 +5220,18 @@ final class WorkspaceStore: ObservableObject { adaptImportedDocumentColors: adaptImportedDocumentColors, interfaceLanguageRaw: interfaceLanguage.rawValue ) - guard let data = try? JSONEncoder().encode(snapshot) else { return } - try? data.write(to: storageURL, options: [.atomic]) + do { + let data = try JSONEncoder().encode(snapshot) + try data.write(to: storageURL, options: [.atomic]) + workspaceSaveError = nil + return true + } catch { + workspaceSaveError = ui( + "课程更改尚未写入磁盘:\(error.localizedDescription)", + "Course changes were not saved to disk: \(error.localizedDescription)" + ) + return false + } } private func resolvedOpenAIAPIKey() -> (key: String, source: String)? { diff --git a/Sources/WeiBei/Views/CommandPaletteView.swift b/Sources/WeiBei/Views/CommandPaletteView.swift index 97d710e9c..87c1bb63d 100644 --- a/Sources/WeiBei/Views/CommandPaletteView.swift +++ b/Sources/WeiBei/Views/CommandPaletteView.swift @@ -10,6 +10,7 @@ struct CommandPaletteView: View { private var commands: [PaletteCommand] { var items = [ + PaletteCommand(title: store.ui("打开课程台", "Open Course Workspace"), shortcut: "⌘0", animation: WeiBeiMotion.panel) { store.presentCourseWorkspace() }, PaletteCommand(title: store.ui("打开资料", "Open Material"), shortcut: "⌘O") { store.importFilesFromPanel() }, PaletteCommand(title: store.ui("新建空白笔记", "New Blank Note"), shortcut: "⌘N") { store.promptCreateBlankNotebookNote() }, PaletteCommand(title: store.ui("聚焦资料库", "Focus Library"), shortcut: "⌘1", animation: WeiBeiMotion.layout) { store.focus(.library) }, diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index 0066a8d01..34884ed83 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -13,60 +13,74 @@ struct ContentView: View { var body: some View { GeometryReader { geometry in - VStack(spacing: 0) { - UnifiedTopBarView( - isImmersiveLayout: isImmersiveLayout, - isFullScreen: windowIsFullScreen, - searchFocused: $topSearchFocused - ) + ZStack { + VStack(spacing: 0) { + UnifiedTopBarView( + isImmersiveLayout: isImmersiveLayout, + isFullScreen: windowIsFullScreen, + searchFocused: $topSearchFocused + ) - ZStack(alignment: .top) { - HStack(spacing: 0) { - if store.showLibrary { - SidebarView() - .frame(width: libraryWidth(in: geometry.size.width)) - .focused($focusedPane, equals: .library) - .transition(WeiBeiTransition.sidePanel) - .zIndex(2) - - libraryResizeHandle(totalWidth: geometry.size.width) - .transition(.opacity) + ZStack(alignment: .top) { + HStack(spacing: 0) { + if store.showLibrary { + SidebarView() + .frame(width: libraryWidth(in: geometry.size.width)) + .focused($focusedPane, equals: .library) + .transition(WeiBeiTransition.sidePanel) + .zIndex(2) + + libraryResizeHandle(totalWidth: geometry.size.width) + .transition(.opacity) + } + + LayoutContentView() + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + .background(WeiBeiTheme.paper) + .animation(WeiBeiMotion.layout, value: store.showLibrary) + .animation(WeiBeiMotion.layout, value: store.layout) + + if store.commandPalettePresented { + CommandPaletteView() + .transition(WeiBeiTransition.commandPalette) + .zIndex(40) } - LayoutContentView() - .frame(maxWidth: .infinity, maxHeight: .infinity) - } - .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(WeiBeiTheme.paper) - .animation(WeiBeiMotion.layout, value: store.showLibrary) - .animation(WeiBeiMotion.layout, value: store.layout) - - if store.commandPalettePresented { - CommandPaletteView() - .transition(WeiBeiTransition.commandPalette) - .zIndex(40) - } + if showsGlobalFloatingAgent { + FloatingSelectionAgentView( + expanded: $floatingAgentExpanded, + routesToConversation: store.isConversationSurfaceVisible + ) + .position(floatingAgentPosition(in: geometry.size)) + .transition(WeiBeiTransition.floating) + .zIndex(30) + } - if showsGlobalFloatingAgent { - FloatingSelectionAgentView( - expanded: $floatingAgentExpanded, - routesToConversation: store.isConversationSurfaceVisible - ) - .position(floatingAgentPosition(in: geometry.size)) - .transition(WeiBeiTransition.floating) - .zIndex(30) } + } + .allowsHitTesting(!store.courseWorkspacePresented) + .accessibilityHidden(store.courseWorkspacePresented) + if store.courseWorkspacePresented { + ZStack { + WeiBeiTheme.paper + CourseWorkspaceView() + } + .frame(width: geometry.size.width, height: geometry.size.height) + .transition(.opacity.combined(with: .scale(scale: 0.995, anchor: .top))) + .zIndex(100) } } .background { - if showsGlobalFloatingAgent { + if !store.courseWorkspacePresented && showsGlobalFloatingAgent { EscapeKeyBridge { store.dismissFloatingSelectionAgent() } } - if store.showReaderSearch { + if !store.courseWorkspacePresented && store.showReaderSearch { EscapeKeyBridge { store.hideReaderSearch() topSearchFocused = false @@ -85,10 +99,12 @@ struct ContentView: View { focusedPane = store.focusedPane } .animation(WeiBeiMotion.appearance, value: store.appearanceMode) + .animation(WeiBeiMotion.panel, value: store.courseWorkspacePresented) } private var showsGlobalFloatingAgent: Bool { - return store.canShowSelectionPromptSurface && SelectionFloatingAgentPlacement.isVisible( + return !store.courseWorkspacePresented + && store.canShowSelectionPromptSurface && SelectionFloatingAgentPlacement.isVisible( surface: store.agentSurface, hasSelection: store.selectionContext != nil, hasAnchor: store.selectionAnchor != nil, @@ -449,6 +465,10 @@ private struct UnifiedTopBarView: View { @ViewBuilder private var leftPrimaryControls: some View { HStack(spacing: 5) { + topIconButton("books.vertical", help: store.ui("打开课程台", "Open course workspace")) { + store.presentCourseWorkspace() + } + libraryButton navigationButtons @@ -998,6 +1018,7 @@ struct PersistentPaneHost: NSViewRepresentable { func makeNSView(context: Context) -> PersistentPaneContainerView { let container = PersistentPaneContainerView() + container.isHidden = store.courseWorkspacePresented container.onWindowChange = { [weak coordinator = context.coordinator] container in coordinator?.windowChanged(container) } @@ -1006,6 +1027,7 @@ struct PersistentPaneHost: NSViewRepresentable { } func updateNSView(_ container: PersistentPaneContainerView, context: Context) { + container.isHidden = store.courseWorkspacePresented context.coordinator.update(role: role, registry: registry, store: store, container: container) } diff --git a/Sources/WeiBei/Views/CourseOverviewView.swift b/Sources/WeiBei/Views/CourseOverviewView.swift new file mode 100644 index 000000000..a197f443d --- /dev/null +++ b/Sources/WeiBei/Views/CourseOverviewView.swift @@ -0,0 +1,236 @@ +import Foundation +import SwiftUI +import WeiBeiCore + +struct CourseOverviewView: View { + @EnvironmentObject private var store: WorkspaceStore + let showUnlinkedNotes: () -> Void + let showUnlinkedMaterials: () -> Void + let showMaterialsWithoutReadingPosition: () -> Void + let showRecords: (UUID?) -> Void + + private var summary: CourseWorkspaceSummary { + store.courseWorkspaceSummary + } + + private var recentLocations: [(StudyItem, StudyLocation)] { + store.courseMaterials + .compactMap { item in store.studyLocation(for: item.id).map { (item, $0) } } + .sorted { $0.1.lastStudiedAt > $1.1.lastStudiedAt } + } + + private var nextSteps: [String] { + let memorySteps = store.activeCourseMemories + .filter { $0.kind == .nextStep } + .map(\.text) + let flowSteps = store.activeStudySession?.flow.suggestedNext ?? [] + var seen = Set<String>() + return (memorySteps + flowSteps).filter { seen.insert($0).inserted }.prefix(6).map { $0 } + } + + private var unresolvedConfusions: [LearningMemoryEntry] { + store.activeCourseMemories.filter { $0.kind == .confusion } + } + + var body: some View { + ScrollView { + VStack(alignment: .leading, spacing: 0) { + overviewLead + + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.72)) + .frame(height: 1) + .padding(.vertical, 22) + + ViewThatFits(in: .horizontal) { + HStack(alignment: .top, spacing: 0) { + VStack(alignment: .leading, spacing: 26) { + currentContextSection + continueSection + attentionSection + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(.trailing, 34) + + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.66)) + .frame(width: 1) + + VStack(alignment: .leading, spacing: 26) { + nextStepSection + recentDiscussionSection + } + .frame(width: 390, alignment: .leading) + .padding(.leading, 34) + } + + VStack(alignment: .leading, spacing: 28) { + currentContextSection + continueSection + attentionSection + nextStepSection + recentDiscussionSection + } + } + } + .frame(maxWidth: 1260, alignment: .leading) + .padding(.horizontal, 42) + .padding(.top, 34) + .padding(.bottom, 54) + .frame(maxWidth: .infinity, alignment: .top) + } + .background(WeiBeiTheme.paper) + } + + private var overviewLead: some View { + HStack(alignment: .firstTextBaseline) { + VStack(alignment: .leading, spacing: 6) { + Text(store.ui("把这门课重新看清楚", "See the whole course clearly")) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 25, weight: .semibold)) + Text(store.ui( + "打开只是当前动作,关联才是长期关系。", + "Opening is temporary. Linking creates a durable relationship." + )) + .font(.system(size: 13)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } + + Spacer() + + Text(store.ui( + "\(summary.materialCount) 份资料 · \(summary.noteCount) 份笔记 · \(summary.studySessionCount) 次讨论", + "\(summary.materialCount) materials · \(summary.noteCount) notes · \(summary.studySessionCount) discussions" + )) + .font(.system(size: 12, weight: .medium, design: .monospaced)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + } + } + + private var currentContextSection: some View { + CourseDetailSection(title: store.ui("此刻", "Right now")) { + VStack(spacing: 0) { + CourseContextLine( + icon: "doc.text", + label: store.ui("正在阅读", "Reading"), + value: store.selectedMaterialItem.map(store.displayTitle) ?? store.ui("还没有打开资料", "No material open") + ) + CourseHairline() + CourseContextLine( + icon: "note.text", + label: store.ui("正在写", "Writing"), + value: store.activeNoteItem.map(store.displayTitle) ?? store.ui("还没有当前笔记", "No current note") + ) + } + } + } + + @ViewBuilder + private var continueSection: some View { + if let latest = recentLocations.first { + CourseDetailSection(title: store.ui("继续上次", "Continue")) { + CourseActionRow( + icon: latest.0.kind.systemImage, + title: store.displayTitle(for: latest.0), + detail: "\(courseLocationLabel(latest.1, store: store)) · \(courseRelativeDate(latest.1.lastStudiedAt, language: store.interfaceLanguage))", + actionTitle: store.ui("继续阅读", "Continue reading") + ) { + store.openCourseMaterial(latest.0.id) + } + } + } + } + + private var attentionSection: some View { + CourseDetailSection(title: store.ui("待整理", "Needs attention")) { + VStack(spacing: 0) { + CourseAttentionRow( + title: store.ui("尚未建立资料关联的笔记", "Notes without material links"), + count: summary.unlinkedNoteCount, + detail: store.ui("明确哪些资料长期支撑这些笔记", "Choose which materials support these notes"), + action: showUnlinkedNotes + ) + CourseHairline() + CourseAttentionRow( + title: store.ui("还没有进入任何笔记的资料", "Materials not linked to any note"), + count: summary.unlinkedMaterialCount, + detail: store.ui("这不代表没有阅读,只代表尚未建立关系", "This means no relationship has been recorded"), + action: showUnlinkedMaterials + ) + CourseHairline() + CourseAttentionRow( + title: store.ui("尚无阅读位置的资料", "Materials without a reading position"), + count: store.courseMaterialsWithoutReadingPosition.count, + detail: store.ui("应用还没有记录到页码或章节", "No page or section has been recorded"), + action: showMaterialsWithoutReadingPosition + ) + if summary.unresolvedConfusionCount > 0 { + CourseHairline() + CourseAttentionRow( + title: store.ui("还没有解决的困惑", "Unresolved questions"), + count: summary.unresolvedConfusionCount, + detail: unresolvedConfusions.first?.text ?? "", + action: { showRecords(unresolvedConfusions.first?.sessionID) } + ) + } + } + } + } + + private var nextStepSection: some View { + CourseDetailSection(title: store.ui("下一步", "Next steps")) { + if nextSteps.isEmpty { + CourseEmptyState( + title: store.ui("还没有明确的下一步", "No next step yet"), + detail: store.ui("继续阅读或对话后,课程台会把真实建议放在这里。", "Continue reading or chatting to build the next step."), + systemImage: "arrow.forward" + ) + } else { + VStack(alignment: .leading, spacing: 12) { + ForEach(Array(nextSteps.enumerated()), id: \.offset) { index, step in + HStack(alignment: .top, spacing: 10) { + Text("\(index + 1)") + .font(.system(size: 11, weight: .semibold, design: .monospaced)) + .foregroundStyle(WeiBeiTheme.cinnabar) + .frame(width: 18, alignment: .leading) + Text(step) + .font(.system(size: 13)) + .foregroundStyle(WeiBeiTheme.ink) + .fixedSize(horizontal: false, vertical: true) + } + } + } + } + } + } + + private var recentDiscussionSection: some View { + CourseDetailSection(title: store.ui("最近讨论", "Recent discussions")) { + if store.recentCourseSessions.isEmpty { + CourseEmptyState( + title: store.ui("还没有课程讨论", "No course discussions yet"), + detail: store.ui("对话记录会按学习会话保存在这里。", "Conversations will appear here by learning session."), + systemImage: "bubble.left.and.text.bubble.right" + ) + } else { + VStack(spacing: 0) { + ForEach(Array(store.recentCourseSessions.prefix(4).enumerated()), id: \.element.id) { index, session in + CourseActionRow( + icon: "bubble.left.and.text.bubble.right", + title: session.title, + detail: store.ui( + "\(session.messages.count) 条消息 · \(courseRelativeDate(session.updatedAt, language: store.interfaceLanguage))", + "\(session.messages.count) messages · \(courseRelativeDate(session.updatedAt, language: store.interfaceLanguage))" + ), + actionTitle: store.ui("查看", "View") + ) { + showRecords(session.id) + } + if index < min(store.recentCourseSessions.count, 4) - 1 { + CourseHairline() + } + } + } + } + } + } +} diff --git a/Sources/WeiBei/Views/CourseRecordsView.swift b/Sources/WeiBei/Views/CourseRecordsView.swift new file mode 100644 index 000000000..2203b154d --- /dev/null +++ b/Sources/WeiBei/Views/CourseRecordsView.swift @@ -0,0 +1,194 @@ +import Foundation +import SwiftUI +import WeiBeiCore + +struct CourseRecordsView: View { + @EnvironmentObject private var store: WorkspaceStore + let search: String + @Binding var selectedSessionID: UUID? + let isCompact: Bool + + private var sessions: [StudySession] { + let cleaned = search.trimmingCharacters(in: .whitespacesAndNewlines) + guard !cleaned.isEmpty else { return store.recentCourseSessions } + return store.recentCourseSessions.filter { session in + session.title.localizedCaseInsensitiveContains(cleaned) + || session.summary.localizedCaseInsensitiveContains(cleaned) + || session.messages.contains { $0.text.localizedCaseInsensitiveContains(cleaned) } + } + } + + private var resolvedSession: StudySession? { + if let selectedSessionID, + let session = sessions.first(where: { $0.id == selectedSessionID }) { + return session + } + return sessions.first + } + + var body: some View { + Group { + if sessions.isEmpty { + CourseEmptyState( + title: store.ui("还没有学习记录", "No learning records yet"), + detail: store.ui("发生过真实对话的学习会话会保存在这里;空白会话不计入。", "Learning sessions with real messages appear here. Empty sessions are not counted."), + systemImage: "bubble.left.and.text.bubble.right" + ) + .frame(maxWidth: .infinity, maxHeight: .infinity) + .padding(30) + } else if isCompact { + VStack(spacing: 0) { + sessionList + CourseHairline() + CourseSessionDetail(session: resolvedSession) + .frame(minHeight: 400) + } + } else { + HStack(spacing: 0) { + sessionList + .frame(width: 390) + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.72)) + .frame(width: 1) + CourseSessionDetail(session: resolvedSession) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } + } + .onAppear { + if selectedSessionID == nil { + selectedSessionID = sessions.first?.id + } + } + } + + private var sessionList: some View { + ScrollView { + LazyVStack(spacing: 0) { + ForEach(sessions) { session in + CourseWorkspaceRow( + icon: "bubble.left.and.text.bubble.right", + title: session.title, + detail: store.ui( + "\(session.messages.count) 条消息 · \(coursePhaseLabel(session.flow.phase, store: store))", + "\(session.messages.count) messages · \(coursePhaseLabel(session.flow.phase, store: store))" + ), + status: courseRelativeDate(session.updatedAt, language: store.interfaceLanguage), + selected: session.id == resolvedSession?.id + ) { + selectedSessionID = session.id + } + CourseHairline() + } + } + .padding(.vertical, 6) + } + .background(WeiBeiTheme.paperRaised.opacity(0.22)) + } +} +struct CourseSessionDetail: View { + @EnvironmentObject private var store: WorkspaceStore + let session: StudySession? + + var body: some View { + if let session { + VStack(spacing: 0) { + CourseRelationDetailHeader( + mark: "SESSION", + title: session.title, + detail: store.ui( + "\(session.messages.count) 条消息 · 更新于 \(courseRelativeDate(session.updatedAt, language: store.interfaceLanguage))", + "\(session.messages.count) messages · updated \(courseRelativeDate(session.updatedAt, language: store.interfaceLanguage))" + ), + openTitle: store.ui("继续对话", "Continue chat"), + open: { store.continueCourseSession(session.id) } + ) + + CourseHairline() + + ScrollView { + VStack(alignment: .leading, spacing: 26) { + CourseDetailSection(title: store.ui("会话摘要", "Session summary")) { + Text(session.summary.isEmpty + ? store.ui("这次讨论还没有生成摘要。", "This discussion does not have a summary yet.") + : session.summary + ) + .font(.system(size: 13)) + .foregroundStyle(session.summary.isEmpty ? WeiBeiTheme.tertiaryInk : WeiBeiTheme.ink) + .lineSpacing(4) + .textSelection(.enabled) + } + + if !session.focusItemIDs.isEmpty { + CourseDetailSection(title: store.ui("会话中出现过", "Referenced in this session")) { + VStack(spacing: 0) { + ForEach(session.focusItemIDs.compactMap(store.item(withID:)), id: \.id) { item in + CourseContextLine( + icon: item.kind.systemImage, + label: item.isNotebookNote ? store.ui("笔记", "Note") : store.ui("资料", "Material"), + value: store.displayTitle(for: item) + ) + CourseHairline() + } + } + } + } + + if !session.flow.suggestedNext.isEmpty { + CourseDetailSection(title: store.ui("建议下一步", "Suggested next")) { + VStack(alignment: .leading, spacing: 10) { + ForEach(Array(session.flow.suggestedNext.enumerated()), id: \.offset) { index, item in + HStack(alignment: .top, spacing: 10) { + Text("\(index + 1)") + .font(.system(size: 11, weight: .semibold, design: .monospaced)) + .foregroundStyle(WeiBeiTheme.cinnabar) + .frame(width: 18, alignment: .leading) + Text(item) + .font(.system(size: 13)) + } + } + } + } + } + + CourseDetailSection(title: store.ui("最近消息", "Recent messages")) { + VStack(spacing: 0) { + ForEach(Array(session.messages.suffix(8))) { message in + VStack(alignment: .leading, spacing: 5) { + HStack { + Text(message.role == .user ? store.ui("我", "Me") : store.ui("魏碑", "WeiBei")) + .font(.system(size: 11, weight: .semibold)) + .foregroundStyle(message.role == .user ? WeiBeiTheme.cinnabar : WeiBeiTheme.secondaryInk) + Spacer() + Text(courseRelativeDate(message.createdAt, language: store.interfaceLanguage)) + .font(.system(size: 10)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + } + Text(message.text) + .font(.system(size: 12.5)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(5) + .lineSpacing(3) + .textSelection(.enabled) + } + .padding(.vertical, 12) + CourseHairline() + } + } + } + } + .padding(26) + .frame(maxWidth: 840, alignment: .leading) + .frame(maxWidth: .infinity, alignment: .topLeading) + } + } + } else { + CourseEmptyState( + title: store.ui("选择一条学习记录", "Select a learning record"), + detail: store.ui("这里会显示真实摘要、相关资料和下一步建议。", "See the real summary, referenced items, and next steps here."), + systemImage: "bubble.left.and.text.bubble.right" + ) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } +} diff --git a/Sources/WeiBei/Views/CourseRelationsView.swift b/Sources/WeiBei/Views/CourseRelationsView.swift new file mode 100644 index 000000000..757e86f72 --- /dev/null +++ b/Sources/WeiBei/Views/CourseRelationsView.swift @@ -0,0 +1,389 @@ +import Foundation +import SwiftUI +import WeiBeiCore + +struct CourseRelationsView: View { + @EnvironmentObject private var store: WorkspaceStore + @Binding var lens: CourseRelationLens + let search: String + @Binding var selectedNoteID: String? + @Binding var selectedMaterialID: String? + let isCompact: Bool + + private var filteredNotes: [StudyItem] { + filtered(store.courseNotebookItems) + } + + private var filteredMaterials: [StudyItem] { + filtered(store.courseMaterials) + } + + var body: some View { + VStack(spacing: 0) { + HStack(spacing: 18) { + ForEach(CourseRelationLens.allCases) { candidate in + CourseWorkspaceTab( + title: candidate.label(language: store.interfaceLanguage), + active: candidate == lens + ) { + withAnimation(WeiBeiMotion.panel) { + lens = candidate + } + } + } + + Spacer() + + Text(store.ui( + "选择条目只查看关系,点“打开”才会离开课程台。", + "Selecting shows relationships. Open only when you are ready to leave." + )) + .font(.system(size: 11)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + } + .padding(.horizontal, 22) + .frame(height: 44) + .background(WeiBeiTheme.paperRaised.opacity(0.34)) + + CourseHairline() + + if lens == .notes { + relationSplit( + list: noteList, + detail: AnyView(NoteRelationDetail(noteID: resolvedNoteID)) + ) + } else { + relationSplit( + list: materialList, + detail: AnyView(MaterialRelationDetail(materialID: resolvedMaterialID)) + ) + } + } + .onAppear(perform: ensureSelections) + .onChange(of: lens) { _, _ in ensureSelections() } + .onChange(of: store.importedItems) { _, _ in ensureSelections() } + } + + private var resolvedNoteID: String? { + if let selectedNoteID, filteredNotes.contains(where: { $0.id == selectedNoteID }) { + return selectedNoteID + } + return filteredNotes.first?.id + } + + private var resolvedMaterialID: String? { + if let selectedMaterialID, filteredMaterials.contains(where: { $0.id == selectedMaterialID }) { + return selectedMaterialID + } + return filteredMaterials.first?.id + } + + private var noteList: AnyView { + AnyView( + CourseEntityList( + items: filteredNotes, + selectedID: resolvedNoteID, + emptyTitle: store.ui("还没有课程笔记", "No course notes yet"), + emptyDetail: store.ui("点顶部“加入”,新建或导入 Markdown 笔记。", "Use Add above to create or import Markdown notes."), + status: { item in + let count = store.linkedCourseSourceIDs(for: item.id).count + return count == 0 + ? store.ui("尚未关联资料", "No material links") + : store.ui("\(count) 份资料", "\(count) materials") + }, + detail: { item in courseFolderLabel(item, store: store) }, + select: { selectedNoteID = $0 } + ) + ) + } + + private var materialList: AnyView { + AnyView( + CourseEntityList( + items: filteredMaterials, + selectedID: resolvedMaterialID, + emptyTitle: store.ui("还没有课程资料", "No course materials yet"), + emptyDetail: store.ui("点顶部“导入”,选择 PDF、HTML、Markdown、文本或文件夹。", "Use Import for PDF, HTML, Markdown, text, or folders."), + status: { item in + let count = store.linkedNoteCount(for: item.id) + return count == 0 + ? store.ui("尚未关联笔记", "No note links") + : store.ui("\(count) 份笔记", "\(count) notes") + }, + detail: { item in + if let location = store.studyLocation(for: item.id) { + return courseLocationLabel(location, store: store) + } + return courseFolderLabel(item, store: store) + }, + select: { selectedMaterialID = $0 } + ) + ) + } + + @ViewBuilder + private func relationSplit(list: AnyView, detail: AnyView) -> some View { + if isCompact { + VStack(spacing: 0) { + list + CourseHairline() + detail.frame(minHeight: 360) + } + } else { + HStack(spacing: 0) { + list + .frame(width: 390) + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.72)) + .frame(width: 1) + detail + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } + } + + private func ensureSelections() { + if selectedNoteID == nil || !store.courseNotebookItems.contains(where: { $0.id == selectedNoteID }) { + selectedNoteID = store.courseNotebookItems.first?.id + } + if selectedMaterialID == nil || !store.courseMaterials.contains(where: { $0.id == selectedMaterialID }) { + selectedMaterialID = store.courseMaterials.first?.id + } + } + + private func filtered(_ items: [StudyItem]) -> [StudyItem] { + let cleaned = search.trimmingCharacters(in: .whitespacesAndNewlines) + guard !cleaned.isEmpty else { return items } + return items.filter { item in + store.displayTitle(for: item).localizedCaseInsensitiveContains(cleaned) + || store.displaySubtitle(for: item).localizedCaseInsensitiveContains(cleaned) + || (item.url?.path.localizedCaseInsensitiveContains(cleaned) == true) + } + } +} + +struct CourseEntityList: View { + @EnvironmentObject private var store: WorkspaceStore + let items: [StudyItem] + let selectedID: String? + let emptyTitle: String + let emptyDetail: String + let status: (StudyItem) -> String + let detail: (StudyItem) -> String + let select: (String) -> Void + + var body: some View { + if items.isEmpty { + CourseEmptyState(title: emptyTitle, detail: emptyDetail, systemImage: "tray") + .frame(maxWidth: .infinity, maxHeight: .infinity) + .padding(24) + } else { + ScrollView { + LazyVStack(spacing: 0) { + ForEach(items) { item in + CourseWorkspaceRow( + icon: item.kind.systemImage, + title: store.displayTitle(for: item), + detail: detail(item), + status: status(item), + selected: item.id == selectedID + ) { + select(item.id) + } + CourseHairline() + } + } + .padding(.vertical, 6) + } + .background(WeiBeiTheme.paperRaised.opacity(0.22)) + } + } +} + +struct NoteRelationDetail: View { + @EnvironmentObject private var store: WorkspaceStore + let noteID: String? + + private var note: StudyItem? { + noteID.flatMap(store.item(withID:)) + } + + private var linkedSourceIDs: Set<String> { + Set(noteID.map(store.linkedCourseSourceIDs(for:)) ?? []) + } + + var body: some View { + if let note, let noteID { + VStack(spacing: 0) { + CourseRelationDetailHeader( + mark: "NOTE", + title: store.displayTitle(for: note), + detail: store.ui( + "\(linkedSourceIDs.count) 份长期关联资料", + "\(linkedSourceIDs.count) linked materials" + ), + openTitle: store.ui("打开笔记", "Open note"), + open: { store.openCourseNote(noteID) } + ) + + CourseHairline() + + ScrollView { + VStack(alignment: .leading, spacing: 20) { + Text(store.ui( + "勾选的资料会长期跟随这份笔记。打开其他文稿不会改变这里。", + "Checked materials stay with this note. Opening another document does not change them." + )) + .font(.system(size: 12)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + + if store.courseMaterials.isEmpty { + CourseEmptyState( + title: store.ui("还没有可关联资料", "No materials to link"), + detail: store.ui("点课程台顶部“导入”添加资料或文件夹。", "Use Import above to add materials or folders."), + systemImage: "books.vertical" + ) + } else { + VStack(spacing: 0) { + ForEach(store.courseMaterials) { material in + RelationSelectionRow( + item: material, + checked: linkedSourceIDs.contains(material.id), + detail: courseFolderLabel(material, store: store) + ) { + store.setLinkedCourseSourceIDs( + toggled(material.id, in: linkedSourceIDs), + for: noteID + ) + } + CourseHairline() + } + } + } + } + .padding(24) + .frame(maxWidth: 820, alignment: .leading) + .frame(maxWidth: .infinity, alignment: .topLeading) + } + + CourseHairline() + + relationFooter( + countTitle: store.ui( + "已关联 \(linkedSourceIDs.count) 份资料", + "\(linkedSourceIDs.count) linked materials" + ), + statusTitle: store.ui("更改自动保存", "Changes save automatically"), + errorTitle: store.workspaceSaveError, + retryTitle: store.ui("重试保存", "Retry save"), + retry: { _ = store.retryWorkspaceSave() } + ) + } + } else { + CourseEmptyState( + title: store.ui("选择一份笔记", "Select a note"), + detail: store.ui("在左侧选择笔记后,可以集中管理它的资料关系。", "Choose a note to manage its material relationships."), + systemImage: "note.text" + ) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } + +} + +struct MaterialRelationDetail: View { + @EnvironmentObject private var store: WorkspaceStore + let materialID: String? + + private var material: StudyItem? { + materialID.flatMap(store.item(withID:)) + } + + private var linkedNoteIDs: Set<String> { + Set(materialID.map(store.linkedNoteIDs(for:)) ?? []) + } + + var body: some View { + if let material, let materialID { + VStack(spacing: 0) { + CourseRelationDetailHeader( + mark: courseMaterialMark(material.kind), + title: store.displayTitle(for: material), + detail: materialDetail(material), + openTitle: store.ui("打开资料", "Open material"), + open: { store.openCourseMaterial(materialID) } + ) + + CourseHairline() + + ScrollView { + VStack(alignment: .leading, spacing: 20) { + Text(store.ui( + "同一份资料可以进入多份笔记。这里只编辑长期关系,不改变当前文稿。", + "One material can support many notes. This edits durable links without changing the open document." + )) + .font(.system(size: 12)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + + if store.courseNotebookItems.isEmpty { + CourseEmptyState( + title: store.ui("还没有课程笔记", "No course notes yet"), + detail: store.ui("先新建或导入笔记,再回来建立关系。", "Create or import a note before linking this material."), + systemImage: "note.text" + ) + } else { + VStack(spacing: 0) { + ForEach(store.courseNotebookItems) { note in + RelationSelectionRow( + item: note, + checked: linkedNoteIDs.contains(note.id), + detail: store.ui( + "\(store.linkedCourseSourceIDs(for: note.id).count) 份资料", + "\(store.linkedCourseSourceIDs(for: note.id).count) materials" + ) + ) { + store.setLinkedNoteIDs( + toggled(note.id, in: linkedNoteIDs), + for: materialID + ) + } + CourseHairline() + } + } + } + } + .padding(24) + .frame(maxWidth: 820, alignment: .leading) + .frame(maxWidth: .infinity, alignment: .topLeading) + } + + CourseHairline() + + relationFooter( + countTitle: store.ui( + "已关联 \(linkedNoteIDs.count) 份笔记", + "\(linkedNoteIDs.count) linked notes" + ), + statusTitle: store.ui("更改自动保存", "Changes save automatically"), + errorTitle: store.workspaceSaveError, + retryTitle: store.ui("重试保存", "Retry save"), + retry: { _ = store.retryWorkspaceSave() } + ) + } + } else { + CourseEmptyState( + title: store.ui("选择一份资料", "Select a material"), + detail: store.ui("在左侧选择资料后,可以查看阅读位置并管理相关笔记。", "Choose a material to inspect its reading position and note links."), + systemImage: "books.vertical" + ) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } + + private func materialDetail(_ material: StudyItem) -> String { + if let location = store.studyLocation(for: material.id) { + return "\(courseLocationLabel(location, store: store)) · \(courseRelativeDate(location.lastStudiedAt, language: store.interfaceLanguage))" + } + return store.ui("尚无阅读位置", "No reading position") + } +} diff --git a/Sources/WeiBei/Views/CourseWorkspaceComponents.swift b/Sources/WeiBei/Views/CourseWorkspaceComponents.swift new file mode 100644 index 000000000..130af3b72 --- /dev/null +++ b/Sources/WeiBei/Views/CourseWorkspaceComponents.swift @@ -0,0 +1,383 @@ +import Foundation +import SwiftUI +import WeiBeiCore + +struct CourseRelationDetailHeader: View { + @EnvironmentObject private var store: WorkspaceStore + let mark: String + let title: String + let detail: String + let openTitle: String + let open: () -> Void + + var body: some View { + HStack(alignment: .center, spacing: 18) { + VStack(alignment: .leading, spacing: 4) { + Text(mark.uppercased()) + .font(WeiBeiTypography.englishBrandFont(size: 9, weight: .semibold)) + .tracking(0.8) + .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.76)) + Text(title) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 20, weight: .semibold)) + .lineLimit(2) + Text(detail) + .font(.system(size: 11)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } + + Spacer() + + Button(openTitle, action: open) + .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) + } + .padding(.horizontal, 24) + .frame(minHeight: 88) + .background(WeiBeiTheme.paperRaised.opacity(0.28)) + } +} + +struct CourseWorkspaceRow: View { + let icon: String + let title: String + let detail: String + let status: String + let selected: Bool + let action: () -> Void + @State private var hovering = false + + var body: some View { + Button(action: action) { + HStack(spacing: 11) { + Image(systemName: icon) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(selected ? WeiBeiTheme.cinnabar : WeiBeiTheme.secondaryInk) + .frame(width: 20) + + VStack(alignment: .leading, spacing: 3) { + Text(title) + .font(.system(size: 13, weight: selected ? .semibold : .medium)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(1) + Text(detail) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .lineLimit(1) + } + + Spacer(minLength: 10) + + Text(status) + .font(.system(size: 10.5, weight: .medium)) + .foregroundStyle(selected ? WeiBeiTheme.cinnabar : WeiBeiTheme.secondaryInk) + .multilineTextAlignment(.trailing) + .lineLimit(2) + } + .padding(.horizontal, 14) + .frame(minHeight: 58) + .contentShape(Rectangle()) + .background(selected ? WeiBeiTheme.paperInset.opacity(0.38) : hovering ? WeiBeiTheme.paperInset.opacity(0.18) : Color.clear) + .overlay(alignment: .leading) { + if selected { + Capsule() + .fill(WeiBeiTheme.cinnabar) + .frame(width: 2, height: 24) + .padding(.leading, 3) + } + } + } + .buttonStyle(.plain) + .onHover { hovering = $0 } + .animation(WeiBeiMotion.hover, value: hovering) + } +} + +struct RelationSelectionRow: View { + @EnvironmentObject private var store: WorkspaceStore + let item: StudyItem + let checked: Bool + let detail: String + let action: () -> Void + @State private var hovering = false + + var body: some View { + Button(action: action) { + HStack(spacing: 11) { + Image(systemName: checked ? "checkmark.square.fill" : "square") + .font(.system(size: 14, weight: .medium)) + .foregroundStyle(checked ? WeiBeiTheme.cinnabar : WeiBeiTheme.tertiaryInk) + .frame(width: 20) + Image(systemName: item.kind.systemImage) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(width: 18) + VStack(alignment: .leading, spacing: 2) { + Text(store.displayTitle(for: item)) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(1) + Text(detail) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .lineLimit(1) + } + Spacer() + Text(item.isNotebookNote + ? store.ui("笔记", "Note") + : item.kind.label(language: store.interfaceLanguage)) + .font(.system(size: 10, weight: .medium)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + } + .padding(.horizontal, 10) + .frame(minHeight: 48) + .contentShape(Rectangle()) + .background(hovering ? WeiBeiTheme.paperInset.opacity(0.18) : Color.clear) + } + .buttonStyle(.plain) + .onHover { hovering = $0 } + .accessibilityValue(Text(checked ? store.ui("已关联", "Linked") : store.ui("未关联", "Not linked"))) + } +} + +struct CourseDetailSection<Content: View>: View { + let title: String + @ViewBuilder let content: Content + + init(title: String, @ViewBuilder content: () -> Content) { + self.title = title + self.content = content() + } + + var body: some View { + VStack(alignment: .leading, spacing: 12) { + Text(title) + .font(.system(size: 11, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + content + } + } +} + +struct CourseContextLine: View { + let icon: String + let label: String + let value: String + + var body: some View { + HStack(spacing: 11) { + Image(systemName: icon) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(width: 18) + Text(label) + .font(.system(size: 11, weight: .medium)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .frame(width: 76, alignment: .leading) + Text(value) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(1) + Spacer() + } + .padding(.horizontal, 12) + .frame(minHeight: 44) + .background(WeiBeiTheme.paperRaised.opacity(0.30)) + } +} + +struct CourseActionRow: View { + let icon: String + let title: String + let detail: String + let actionTitle: String + let action: () -> Void + + var body: some View { + HStack(spacing: 11) { + Image(systemName: icon) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(width: 18) + VStack(alignment: .leading, spacing: 3) { + Text(title) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(1) + Text(detail) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .lineLimit(2) + } + Spacer() + Button(actionTitle, action: action) + .buttonStyle(WeiBeiTextActionButtonStyle()) + } + .padding(.horizontal, 12) + .frame(minHeight: 50) + .background(WeiBeiTheme.paperRaised.opacity(0.24)) + } +} + +struct CourseAttentionRow: View { + let title: String + let count: Int + let detail: String + let action: () -> Void + @State private var hovering = false + + var body: some View { + Button(action: action) { + HStack(spacing: 12) { + Text("\(count)") + .font(.system(size: 15, weight: .semibold, design: .monospaced)) + .foregroundStyle(count == 0 ? WeiBeiTheme.tertiaryInk : WeiBeiTheme.cinnabar) + .frame(width: 34, alignment: .leading) + VStack(alignment: .leading, spacing: 2) { + Text(title) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(WeiBeiTheme.ink) + Text(detail) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .lineLimit(2) + } + Spacer() + Image(systemName: "chevron.right") + .font(.system(size: 10, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + } + .padding(.horizontal, 12) + .frame(minHeight: 52) + .contentShape(Rectangle()) + .background(hovering ? WeiBeiTheme.paperInset.opacity(0.18) : WeiBeiTheme.paperRaised.opacity(0.22)) + } + .buttonStyle(.plain) + .onHover { hovering = $0 } + } +} + +struct CourseEmptyState: View { + let title: String + let detail: String + let systemImage: String + + var body: some View { + VStack(alignment: .leading, spacing: 8) { + Image(systemName: systemImage) + .font(.system(size: 19, weight: .regular)) + .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.58)) + Text(title) + .font(.system(size: 13, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.ink) + Text(detail) + .font(.system(size: 11.5)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .fixedSize(horizontal: false, vertical: true) + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(.vertical, 8) + } +} + +struct CourseHairline: View { + var body: some View { + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.62)) + .frame(height: 1) + } +} + +func relationFooter( + countTitle: String, + statusTitle: String, + errorTitle: String?, + retryTitle: String, + retry: @escaping () -> Void +) -> some View { + HStack { + Text(countTitle) + .font(.system(size: 11.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.cinnabar) + Spacer() + if let errorTitle { + Text(errorTitle) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.cinnabar) + .lineLimit(1) + Button(retryTitle, action: retry) + .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) + } else { + Text(statusTitle) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + } + } + .padding(.horizontal, 18) + .frame(height: 46) + .background(WeiBeiTheme.paperRaised.opacity(0.36)) +} + +func toggled(_ itemID: String, in values: Set<String>) -> Set<String> { + var result = values + if result.contains(itemID) { + result.remove(itemID) + } else { + result.insert(itemID) + } + return result +} + +@MainActor +func courseFolderLabel(_ item: StudyItem, store: WorkspaceStore) -> String { + guard let url = item.url else { + return item.isSample ? store.ui("内置示例", "Built-in sample") : store.displaySubtitle(for: item) + } + let folder = url.deletingLastPathComponent().lastPathComponent + return folder.isEmpty ? url.deletingLastPathComponent().path : folder +} + +@MainActor +func courseLocationLabel(_ location: StudyLocation, store: WorkspaceStore) -> String { + if let title = location.locationTitle, !title.isEmpty { + return title + } + if let page = location.pageIndex { + return store.ui("第 \(page + 1) 页", "Page \(page + 1)") + } + return store.ui("已有阅读位置", "Reading position saved") +} + +func courseRelativeDate(_ date: Date, language: WeiBeiInterfaceLanguage) -> String { + if abs(date.timeIntervalSinceNow) < 60 { + return language.text("刚刚", "Now") + } + let formatter = RelativeDateTimeFormatter() + formatter.locale = Locale(identifier: language == .chinese ? "zh-Hans" : "en") + formatter.unitsStyle = .short + return formatter.localizedString(for: date, relativeTo: Date()) +} + +func courseMaterialMark(_ kind: StudyItemKind) -> String { + switch kind { + case .html: "HTML" + case .pdf: "PDF" + case .markdown: "MARKDOWN" + case .text: "TEXT" + } +} + +@MainActor +func coursePhaseLabel(_ phase: StudyPhase, store: WorkspaceStore) -> String { + switch phase { + case .orient: + store.ui("定位", "Orient") + case .explore: + store.ui("探索", "Explore") + case .closeRead: + store.ui("细读", "Close read") + case .note: + store.ui("记笔记", "Note") + case .recall: + store.ui("回忆", "Recall") + case .consolidate: + store.ui("巩固", "Consolidate") + case .plan: + store.ui("计划", "Plan") + } +} diff --git a/Sources/WeiBei/Views/CourseWorkspaceView.swift b/Sources/WeiBei/Views/CourseWorkspaceView.swift new file mode 100644 index 000000000..99c387f73 --- /dev/null +++ b/Sources/WeiBei/Views/CourseWorkspaceView.swift @@ -0,0 +1,531 @@ +import Foundation +import SwiftUI +import WeiBeiCore + +enum CourseWorkspacePage: String, CaseIterable, Identifiable { + case overview + case relations + case records + + var id: String { rawValue } + + func label(language: WeiBeiInterfaceLanguage) -> String { + switch self { + case .overview: + language.text("总览", "Overview") + case .relations: + language.text("资料与笔记", "Materials & Notes") + case .records: + language.text("学习记录", "Learning Records") + } + } +} + +enum CourseRelationLens: String, CaseIterable, Identifiable { + case notes + case materials + + var id: String { rawValue } + + func label(language: WeiBeiInterfaceLanguage) -> String { + switch self { + case .notes: + language.text("按笔记", "By Note") + case .materials: + language.text("按资料", "By Material") + } + } +} + +struct CourseWorkspaceView: View { + @EnvironmentObject private var store: WorkspaceStore + @State private var page: CourseWorkspacePage = .overview + @State private var relationLens: CourseRelationLens = .notes + @State private var selectedNoteID: String? + @State private var selectedMaterialID: String? + @State private var selectedSessionID: UUID? + @State private var search = "" + @State private var newNoteTitle = "" + @State private var newNoteError: String? + @State private var showsNewNotePrompt = false + @FocusState private var searchFocused: Bool + + var body: some View { + GeometryReader { geometry in + VStack(spacing: 0) { + CourseWorkspaceHeader( + page: $page, + search: $search, + searchFocused: $searchFocused, + isCompact: geometry.size.width < 900, + dismiss: store.dismissCourseWorkspace, + importCourseFolder: store.prepareCourseFolderImportFromPanel, + importMaterials: store.importCourseMaterialsFromPanel, + importNotes: store.importCourseNotesFromPanel, + createNote: promptForNewNote + ) + + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.72)) + .frame(height: 1) + + pageContent(size: geometry.size) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) + .background(WeiBeiTheme.paper) + .foregroundStyle(WeiBeiTheme.ink) + .background { + EscapeKeyBridge( + isEnabled: !showsNewNotePrompt && store.courseFolderImportDraft == nil + ) { + store.dismissCourseWorkspace() + } + } + } + .onAppear(perform: prepareInitialRoute) + .onChange(of: page) { _, _ in + search = "" + } + .sheet(isPresented: $showsNewNotePrompt) { + CourseNewNoteSheet( + title: $newNoteTitle, + error: newNoteError, + cancel: { showsNewNotePrompt = false }, + create: createNewNote + ) + .environmentObject(store) + } + .sheet(item: $store.courseFolderImportDraft) { draft in + CourseFolderImportSheet( + draft: draft, + cancel: { store.courseFolderImportDraft = nil }, + confirm: { notePaths in + store.importCourseFolder(draft, notePaths: notePaths) + if store.workspaceSaveError == nil { + store.courseFolderImportDraft = nil + } + } + ) + .environmentObject(store) + } + } + + @ViewBuilder + private func pageContent(size: CGSize) -> some View { + switch page { + case .overview: + CourseOverviewView( + showUnlinkedNotes: { + relationLens = .notes + selectedNoteID = store.courseNotesWithoutSourceLinks.first?.id + page = .relations + }, + showUnlinkedMaterials: { + relationLens = .materials + selectedMaterialID = store.courseMaterialsWithoutNoteLinks.first?.id + page = .relations + }, + showMaterialsWithoutReadingPosition: { + relationLens = .materials + selectedMaterialID = store.courseMaterialsWithoutReadingPosition.first?.id + page = .relations + }, + showRecords: { sessionID in + selectedSessionID = sessionID ?? store.recentCourseSessions.first?.id + page = .records + } + ) + case .relations: + CourseRelationsView( + lens: $relationLens, + search: search, + selectedNoteID: $selectedNoteID, + selectedMaterialID: $selectedMaterialID, + isCompact: size.width < 900 + ) + case .records: + CourseRecordsView( + search: search, + selectedSessionID: $selectedSessionID, + isCompact: size.width < 900 + ) + } + } + + private func promptForNewNote() { + newNoteTitle = store.ui("新笔记", "New Note") + newNoteError = nil + store.noteFileError = nil + showsNewNotePrompt = true + } + + private func createNewNote() { + guard let noteID = store.createCourseNotebookNote(title: newNoteTitle) else { + newNoteError = store.noteFileError ?? store.ui("无法新建笔记。", "Could not create the note.") + return + } + selectedNoteID = noteID + relationLens = .notes + page = .relations + showsNewNotePrompt = false + } + + private func prepareInitialRoute() { + switch store.courseWorkspaceDestination { + case .overview: + page = .overview + case .materials: + relationLens = .materials + selectedMaterialID = store.courseWorkspaceTargetItemID ?? store.courseMaterials.first?.id + page = .relations + case .notes: + relationLens = .notes + selectedNoteID = store.courseWorkspaceTargetItemID ?? store.courseNotebookItems.first?.id + page = .relations + case .sessions: + if let rawID = store.courseWorkspaceTargetItemID { + selectedSessionID = UUID(uuidString: rawID) + } + selectedSessionID = selectedSessionID ?? store.recentCourseSessions.first?.id + page = .records + } + } + +} + +private struct CourseNewNoteSheet: View { + @EnvironmentObject private var store: WorkspaceStore + @Binding var title: String + let error: String? + let cancel: () -> Void + let create: () -> Void + + private var cleanedTitle: String { + title.trimmingCharacters(in: .whitespacesAndNewlines) + } + + var body: some View { + VStack(alignment: .leading, spacing: 18) { + VStack(alignment: .leading, spacing: 6) { + Text(store.ui("新建课程笔记", "New course note")) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 20, weight: .semibold)) + Text(store.ui("新笔记会进入课程台,并保存到本地笔记目录。", "The note will appear in the course workspace and save locally.")) + .font(.system(size: 12)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } + + TextField(store.ui("笔记名称", "Note name"), text: $title) + .textFieldStyle(.roundedBorder) + + if let error, !error.isEmpty { + Text(error) + .font(.system(size: 11.5)) + .foregroundStyle(WeiBeiTheme.cinnabar) + } + + HStack { + Spacer() + Button(store.ui("取消", "Cancel"), action: cancel) + .keyboardShortcut(.cancelAction) + Button(store.ui("新建", "Create"), action: create) + .keyboardShortcut(.defaultAction) + .disabled(cleanedTitle.isEmpty) + } + } + .padding(24) + .frame(width: 440) + .background(WeiBeiTheme.paper) + } +} + +private struct CourseFolderImportSheet: View { + @EnvironmentObject private var store: WorkspaceStore + let draft: CourseFolderImportDraft + let cancel: () -> Void + let confirm: (Set<String>) -> Void + @State private var notePaths: Set<String> + + init( + draft: CourseFolderImportDraft, + cancel: @escaping () -> Void, + confirm: @escaping (Set<String>) -> Void + ) { + self.draft = draft + self.cancel = cancel + self.confirm = confirm + _notePaths = State(initialValue: draft.notePaths) + } + + var body: some View { + VStack(spacing: 0) { + HStack(alignment: .top, spacing: 18) { + VStack(alignment: .leading, spacing: 6) { + Text(store.ui("确认 Markdown 的角色", "Classify Markdown files")) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 20, weight: .semibold)) + Text(store.ui( + "PDF、HTML 和文本会作为资料加入。请确认每个 Markdown 是课程资料还是笔记。", + "PDF, HTML, and text files are materials. Choose whether each Markdown file is material or a note." + )) + .font(.system(size: 12)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } + Spacer() + Menu(store.ui("批量设置", "Set all")) { + Button(store.ui("全部作为资料", "All as materials")) { notePaths.removeAll() } + Button(store.ui("全部作为笔记", "All as notes")) { + notePaths = Set(draft.markdownFiles.map(\.path)) + } + } + .menuStyle(.borderlessButton) + .fixedSize() + } + .padding(22) + + CourseHairline() + + ScrollView { + LazyVStack(spacing: 0) { + ForEach(draft.markdownFiles, id: \.path) { url in + HStack(spacing: 14) { + Image(systemName: "doc.richtext") + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(width: 20) + VStack(alignment: .leading, spacing: 3) { + Text(url.deletingPathExtension().lastPathComponent) + .font(.system(size: 13, weight: .medium)) + .lineLimit(1) + Text(url.deletingLastPathComponent().path) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) + .lineLimit(1) + .truncationMode(.middle) + } + .help(url.path) + Spacer() + Picker("", selection: roleBinding(for: url)) { + Text(store.ui("资料", "Material")).tag(false) + Text(store.ui("笔记", "Note")).tag(true) + } + .labelsHidden() + .pickerStyle(.segmented) + .frame(width: 150) + } + .padding(.horizontal, 22) + .frame(minHeight: 58) + CourseHairline() + } + } + } + + HStack { + if let error = store.workspaceSaveError { + Text(error) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.cinnabar) + .lineLimit(2) + Button(store.ui("重试保存", "Retry save")) { + if store.retryWorkspaceSave() { + store.courseFolderImportDraft = nil + } + } + .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) + } else { + let materialCount = draft.automaticMaterialCount + draft.markdownFiles.count - notePaths.count + Text(store.ui( + "\(materialCount) 份资料 · \(notePaths.count) 份笔记", + "\(materialCount) materials · \(notePaths.count) notes" + )) + .font(.system(size: 11.5, weight: .medium)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + } + Spacer() + Button(store.ui("取消", "Cancel"), action: cancel) + .keyboardShortcut(.cancelAction) + Button(store.ui("加入课程台", "Add to course")) { confirm(notePaths) } + .keyboardShortcut(.defaultAction) + } + .padding(.horizontal, 22) + .frame(height: 54) + } + .frame(width: 680, height: 560) + .background(WeiBeiTheme.paper) + } + + private func roleBinding(for url: URL) -> Binding<Bool> { + Binding( + get: { notePaths.contains(url.path) }, + set: { isNote in + if isNote { + notePaths.insert(url.path) + } else { + notePaths.remove(url.path) + } + } + ) + } +} + +struct CourseWorkspaceHeader: View { + @EnvironmentObject private var store: WorkspaceStore + @Binding var page: CourseWorkspacePage + @Binding var search: String + var searchFocused: FocusState<Bool>.Binding + let isCompact: Bool + let dismiss: () -> Void + let importCourseFolder: () -> Void + let importMaterials: () -> Void + let importNotes: () -> Void + let createNote: () -> Void + + var body: some View { + HStack(spacing: 14) { + Button(action: dismiss) { + HStack(spacing: 6) { + Image(systemName: "chevron.left") + Text(store.ui("返回工作台", "Back to workspace")) + } + .font(.system(size: 12, weight: .medium)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(minHeight: 32) + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + .accessibilityLabel(Text(store.ui("关闭课程台并返回工作台", "Close course workspace"))) + + VStack(alignment: .leading, spacing: 0) { + Text(store.ui("课程台", "Course Workspace")) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 20, weight: .semibold)) + Text(store.interfaceLanguage == .chinese ? "COURSE DESK" : "WEIBEI") + .font(WeiBeiTypography.englishBrandFont(size: 8.5, weight: .semibold)) + .tracking(0.9) + .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.74)) + } + .frame(width: isCompact ? 122 : 148, alignment: .leading) + + if isCompact { + Menu { + ForEach(CourseWorkspacePage.allCases) { candidate in + Button(candidate.label(language: store.interfaceLanguage)) { + page = candidate + } + } + } label: { + Label(page.label(language: store.interfaceLanguage), systemImage: "chevron.down") + .font(.system(size: 12, weight: .semibold)) + } + .menuStyle(.borderlessButton) + .fixedSize() + } else { + HStack(spacing: 22) { + ForEach(CourseWorkspacePage.allCases) { candidate in + CourseWorkspaceTab( + title: candidate.label(language: store.interfaceLanguage), + active: candidate == page + ) { + withAnimation(WeiBeiMotion.panel) { + page = candidate + } + } + } + } + } + + Spacer(minLength: 12) + + if let saveError = store.workspaceSaveError { + Button(action: { _ = store.retryWorkspaceSave() }) { + Label(store.ui("保存失败,点此重试", "Save failed, retry"), systemImage: "exclamationmark.triangle") + .font(.system(size: 10.5, weight: .medium)) + .foregroundStyle(WeiBeiTheme.cinnabar) + } + .buttonStyle(.plain) + .help(saveError) + } + + if page != .overview { + HStack(spacing: 7) { + Image(systemName: "magnifyingglass") + .foregroundStyle(WeiBeiTheme.tertiaryInk) + TextField(searchPrompt, text: $search) + .textFieldStyle(.plain) + .focused(searchFocused) + .font(.system(size: 12)) + } + .weibeiInputSurface(active: searchFocused.wrappedValue, height: 30) + .frame(width: isCompact ? 160 : 220) + } + + Menu { + Button(action: importCourseFolder) { + Label(store.ui("导入课程文件夹", "Import course folder"), systemImage: "folder.badge.plus") + } + Button(action: importMaterials) { + Label(store.ui("导入资料", "Import materials"), systemImage: "doc.badge.plus") + } + Button(action: importNotes) { + Label(store.ui("导入 Markdown 笔记", "Import Markdown notes"), systemImage: "note.text.badge.plus") + } + Divider() + Button(action: createNote) { + Label(store.ui("新建笔记", "New note"), systemImage: "square.and.pencil") + } + } label: { + Label(store.ui("加入", "Add"), systemImage: "plus") + .font(.system(size: 11, weight: .medium)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .padding(.horizontal, 8) + .frame(height: 24) + .background(WeiBeiTheme.paperInset.opacity(0.20)) + .clipShape(RoundedRectangle(cornerRadius: 6)) + } + .menuStyle(.borderlessButton) + .fixedSize() + .help(store.ui("加入课程文件夹、资料或笔记", "Add course folders, materials, or notes")) + + Button(action: dismiss) { + Image(systemName: "xmark") + } + .buttonStyle(WeiBeiIconButtonStyle(size: 28)) + .accessibilityLabel(Text(store.ui("关闭课程台", "Close course workspace"))) + .keyboardShortcut(.cancelAction) + } + .padding(.horizontal, 16) + .frame(height: 52) + .background(WeiBeiGlassHeaderBackground(paperOpacity: 0.88, materialOpacity: 0.05)) + } + + private var searchPrompt: String { + switch page { + case .overview: + store.ui("搜索课程", "Search course") + case .relations: + store.ui("搜索资料与笔记", "Search materials and notes") + case .records: + store.ui("搜索学习记录", "Search learning records") + } + } +} + +struct CourseWorkspaceTab: View { + let title: String + let active: Bool + let action: () -> Void + + var body: some View { + Button(action: action) { + Text(title) + .font(.system(size: 12.5, weight: active ? .semibold : .medium)) + .foregroundStyle(active ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk) + .padding(.horizontal, 2) + .frame(height: 34) + .overlay(alignment: .bottom) { + Rectangle() + .fill(active ? WeiBeiTheme.cinnabar : Color.clear) + .frame(height: 2) + } + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + } +} diff --git a/Sources/WeiBei/Views/LinkedSourcesView.swift b/Sources/WeiBei/Views/LinkedSourcesView.swift index 22a678db7..56135f589 100644 --- a/Sources/WeiBei/Views/LinkedSourcesView.swift +++ b/Sources/WeiBei/Views/LinkedSourcesView.swift @@ -122,6 +122,14 @@ struct LinkedSourcesPopover: View { } .buttonStyle(WeiBeiTextActionButtonStyle()) + Button { + store.presentCourseWorkspace(.notes, selecting: noteItemID) + dismiss() + } label: { + Label(store.ui("课程台", "Course"), systemImage: "books.vertical") + } + .buttonStyle(WeiBeiTextActionButtonStyle()) + Spacer() Button(store.ui("取消", "Cancel"), action: dismiss) diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift index 8021f65fa..0a541fdf7 100644 --- a/Sources/WeiBei/Views/ReaderView.swift +++ b/Sources/WeiBei/Views/ReaderView.swift @@ -1901,7 +1901,6 @@ struct WebReaderRepresentable: NSViewRepresentable { activeFrame: 0, scanTimer: 0, pendingScanReason: "initial", - jumpUntil: 0, userScrollUntil: 0 }; const clean = (value) => String(value || "").replace(/\\s+/g, " ").trim(); @@ -2047,7 +2046,7 @@ struct WebReaderRepresentable: NSViewRepresentable { const applyActive = (requestedReason = "unknown") => { const now = Date.now(); const reason = requestedReason === "scroll" - ? (now <= state.jumpUntil ? "jump" : now <= state.userScrollUntil ? "scroll" : "programmatic") + ? (now <= state.userScrollUntil ? "scroll" : "programmatic") : requestedReason; if (state.items.length === 0) { if (state.activeID) { @@ -2089,7 +2088,6 @@ struct WebReaderRepresentable: NSViewRepresentable { const scrollTo = (id) => { const item = state.items.find((candidate) => candidate.id === id); if (!item?.element) return false; - state.jumpUntil = Date.now() + 1600; item.element.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" }); window.setTimeout(() => window.scrollBy({ top: -44, behavior: "auto" }), 180); window.setTimeout(() => { @@ -2791,10 +2789,11 @@ private class ReaderSelectableTextView: NSTextView { } struct EscapeKeyBridge: NSViewRepresentable { + var isEnabled = true var onEscape: () -> Void func makeCoordinator() -> Coordinator { - Coordinator(onEscape: onEscape) + Coordinator(isEnabled: isEnabled, onEscape: onEscape) } func makeNSView(context: Context) -> NSView { @@ -2804,6 +2803,7 @@ struct EscapeKeyBridge: NSViewRepresentable { } func updateNSView(_ view: NSView, context: Context) { + context.coordinator.isEnabled = isEnabled context.coordinator.onEscape = onEscape } @@ -2812,17 +2812,22 @@ struct EscapeKeyBridge: NSViewRepresentable { } final class Coordinator { + var isEnabled: Bool var onEscape: () -> Void private var monitor: Any? - init(onEscape: @escaping () -> Void) { + init(isEnabled: Bool, onEscape: @escaping () -> Void) { + self.isEnabled = isEnabled self.onEscape = onEscape } func installMonitor() { guard monitor == nil else { return } monitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { [weak self] event in - guard event.keyCode == 53 else { return event } + guard event.keyCode == 53, + self?.isEnabled == true, + NSApp.modalWindow == nil, + event.window?.attachedSheet == nil else { return event } self?.onEscape() return nil } diff --git a/Sources/WeiBeiCore/CourseWorkspaceSummary.swift b/Sources/WeiBeiCore/CourseWorkspaceSummary.swift new file mode 100644 index 000000000..27c31fae5 --- /dev/null +++ b/Sources/WeiBeiCore/CourseWorkspaceSummary.swift @@ -0,0 +1,44 @@ +import Foundation + +/// Course-level counts derived only from persisted workspace facts. +public struct CourseWorkspaceSummary: Equatable, Sendable { + public let materialCount: Int + public let noteCount: Int + public let explicitLinkCount: Int + public let readingPositionCount: Int + public let unlinkedMaterialCount: Int + public let unlinkedNoteCount: Int + public let studySessionCount: Int + public let unresolvedConfusionCount: Int + + public init( + importedItems: [StudyItem], + noteSourceLinks: [NoteSourceLink], + studyLocationsByItemID: [String: StudyLocation], + studySessions: [StudySession], + learningMemoryEntries: [LearningMemoryEntry] + ) { + let courseItems = importedItems.filter { !$0.isSample } + let materialIDs = Set(courseItems.lazy.filter { !$0.isNotebookNote }.map(\.id)) + let noteIDs = Set(courseItems.lazy.filter(\.isNotebookNote).map(\.id)) + + var relations = NoteSourceRelations(links: noteSourceLinks) + relations.sanitize( + validNoteItemIDs: noteIDs, + validSourceItemIDs: materialIDs + ) + let linkedMaterialIDs = Set(relations.links.lazy.map(\.sourceItemID)) + let linkedNoteIDs = Set(relations.links.lazy.map(\.noteItemID)) + + materialCount = materialIDs.count + noteCount = noteIDs.count + explicitLinkCount = relations.links.count + readingPositionCount = materialIDs.lazy.filter { studyLocationsByItemID[$0] != nil }.count + unlinkedMaterialCount = materialIDs.subtracting(linkedMaterialIDs).count + unlinkedNoteCount = noteIDs.subtracting(linkedNoteIDs).count + studySessionCount = studySessions.lazy.filter { !$0.messages.isEmpty }.count + unresolvedConfusionCount = learningMemoryEntries.lazy.filter { + $0.kind == .confusion && $0.status == .active + }.count + } +} diff --git a/Sources/WeiBeiCore/NoteSourceRelations.swift b/Sources/WeiBeiCore/NoteSourceRelations.swift index 74b372c4b..861147838 100644 --- a/Sources/WeiBeiCore/NoteSourceRelations.swift +++ b/Sources/WeiBeiCore/NoteSourceRelations.swift @@ -23,6 +23,18 @@ public struct NoteSourceRelations: Sendable { .map(\.sourceItemID) } + public func noteIDs(for sourceItemID: String) -> [String] { + links + .filter { $0.sourceItemID == sourceItemID } + .sorted { lhs, rhs in + if lhs.createdAt == rhs.createdAt { + return lhs.noteItemID < rhs.noteItemID + } + return lhs.createdAt < rhs.createdAt + } + .map(\.noteItemID) + } + public func isLinked(noteItemID: String, sourceItemID: String) -> Bool { links.contains { $0.noteItemID == noteItemID && $0.sourceItemID == sourceItemID @@ -41,6 +53,18 @@ public struct NoteSourceRelations: Sendable { links = Self.deduplicated(retained + additions) } + public mutating func replaceNotes(for sourceItemID: String, noteItemIDs: Set<String>) { + let retained = links.filter { + $0.sourceItemID != sourceItemID || noteItemIDs.contains($0.noteItemID) + } + let existingIDs = Set(retained.lazy.filter { $0.sourceItemID == sourceItemID }.map(\.noteItemID)) + let additions = noteItemIDs + .subtracting(existingIDs) + .sorted() + .map { NoteSourceLink(noteItemID: $0, sourceItemID: sourceItemID) } + links = Self.deduplicated(retained + additions) + } + public mutating func removeLinks(involving itemID: String) { links.removeAll { $0.noteItemID == itemID || $0.sourceItemID == itemID @@ -69,3 +93,38 @@ public struct NoteSourceRelations: Sendable { } } } + +/// Read-optimized snapshot for rendering the many-to-many relationship graph. +/// Build it when the durable links change, then reuse its constant-time lookups. +public struct NoteSourceRelationIndex: Sendable { + private let sourceIDsByNoteID: [String: [String]] + private let noteIDsBySourceID: [String: [String]] + + public init(links: [NoteSourceLink]) { + let normalizedLinks = NoteSourceRelations(links: links).links + var sources: [String: [String]] = [:] + var notes: [String: [String]] = [:] + for link in normalizedLinks { + sources[link.noteItemID, default: []].append(link.sourceItemID) + notes[link.sourceItemID, default: []].append(link.noteItemID) + } + sourceIDsByNoteID = sources + noteIDsBySourceID = notes + } + + public func sourceIDs(for noteItemID: String) -> [String] { + sourceIDsByNoteID[noteItemID] ?? [] + } + + public func noteIDs(for sourceItemID: String) -> [String] { + noteIDsBySourceID[sourceItemID] ?? [] + } + + public func sourceCount(for noteItemID: String) -> Int { + sourceIDsByNoteID[noteItemID]?.count ?? 0 + } + + public func noteCount(for sourceItemID: String) -> Int { + noteIDsBySourceID[sourceItemID]?.count ?? 0 + } +} diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 50cab2ef1..9da6c5c5e 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -1700,6 +1700,9 @@ expect(readerViewSource.contains("private final class PDFContentRailPreviewLoade && readerViewSource.contains("static let contentRailScript") && readerViewSource.contains("window.WeiBeiContentRail") && readerViewSource.contains("if railOnly {\n store.requestPaneExpansion(.reader)"), "PDF and HTML rails use real page or document content and restore narrow reader panes") +expect(readerViewSource.contains("now <= state.userScrollUntil ? \"scroll\"") + && !readerViewSource.contains("jumpUntil") + && readerViewSource.contains("postMessage({ id, reason: \"jump\" })"), "html reader treats only the explicit target acknowledgement as a jump and lets real user scrolling take priority") let selectionAnchorContentPointSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Support/SelectionAnchorContentPoint.swift") let selectionAnchorContentPointSource = (try? String(contentsOf: selectionAnchorContentPointSourceURL, encoding: .utf8)) ?? "" @@ -2216,6 +2219,19 @@ let workspaceStoreSource = (try? String(contentsOf: workspaceStoreSourceURL, enc let linkedSourcesSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/LinkedSourcesView.swift") let linkedSourcesSource = (try? String(contentsOf: linkedSourcesSourceURL, encoding: .utf8)) ?? "" +let courseWorkspaceSourceNames = [ + "CourseWorkspaceView.swift", + "CourseOverviewView.swift", + "CourseRelationsView.swift", + "CourseRecordsView.swift", + "CourseWorkspaceComponents.swift", +] +let courseWorkspaceSource = courseWorkspaceSourceNames.map { name in + let url = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Views") + .appendingPathComponent(name) + return (try? String(contentsOf: url, encoding: .utf8)) ?? "" +}.joined(separator: "\n") let selectItemSource: String = { guard let start = workspaceStoreSource.range(of: "func select(itemID: String?)")?.lowerBound, let end = workspaceStoreSource[start...].range(of: "func selectAdjacentItem")?.lowerBound else { @@ -2233,6 +2249,55 @@ expect(workspaceStoreSource.contains("invalidateAgentContext()\n acti expect(linkedSourcesSource.contains("@State private var noteItemID: String?") && linkedSourcesSource.contains("noteItemID = store.activeNotebookItemID") && linkedSourcesSource.contains("store.setLinkedSourceIDs(draftIDs, for: noteItemID)"), "relationship editing remains bound to the note that opened the popover") +expect(contentViewSource.contains("if store.courseWorkspacePresented") + && contentViewSource.contains("CourseWorkspaceView()") + && contentViewSource.contains("LayoutContentView()") + && contentViewSource.contains("container.isHidden = store.courseWorkspacePresented") + && !contentViewSource.contains("if store.courseWorkspacePresented {\n CourseWorkspaceView()\n } else"), "course workspace covers and hides native pane hosts without replacing the persistent pane tree") +expect(courseWorkspaceSource.contains("case overview") + && courseWorkspaceSource.contains("case relations") + && courseWorkspaceSource.contains("case records") + && courseWorkspaceSource.contains("打开只是当前动作,关联才是长期关系。") + && courseWorkspaceSource.contains("尚未建立资料关联") + && courseWorkspaceSource.contains("尚无阅读位置") + && !courseWorkspaceSource.contains("已消化") + && !courseWorkspaceSource.contains("消化率"), "course workspace exposes overview, relationships, and learning records using only evidence-backed status language") +expect(courseWorkspaceSource.contains("更改自动保存") + && courseWorkspaceSource.contains("showRecords(session.id)") + && courseWorkspaceSource.contains("courseMaterialsWithoutReadingPosition.first?.id") + && !courseWorkspaceSource.contains("store.courseMaterials + store.sampleItems"), "course relationship edits save immediately, route to the selected fact, and keep built-in samples outside course counts") +expect(workspaceStoreSource.contains("@Published private(set) var workspaceSaveError") + && workspaceStoreSource.contains("func retryWorkspaceSave()") + && workspaceStoreSource.contains("Course changes were not saved to disk") + && courseWorkspaceSource.contains("保存失败,点此重试") + && courseWorkspaceSource.contains("draft.automaticMaterialCount + draft.markdownFiles.count - notePaths.count") + && courseWorkspaceSource.contains("url.deletingLastPathComponent().path"), "course autosave failures stay visible and mixed-folder classification reports complete counts with unambiguous paths") +expect(workspaceStoreSource.contains("func presentCourseWorkspace(") + && workspaceStoreSource.contains("func dismissCourseWorkspace()") + && workspaceStoreSource.contains("func openCourseMaterial(") + && workspaceStoreSource.contains("func openCourseNote(") + && workspaceStoreSource.contains("func continueCourseSession(") + && workspaceStoreSource.contains("func prepareCourseFolderImportFromPanel()") + && workspaceStoreSource.contains("func importCourseMaterialsFromPanel()") + && workspaceStoreSource.contains("func importCourseNotesFromPanel()") + && workspaceStoreSource.contains("markdownNotePaths: Set<String>? = nil") + && workspaceStoreSource.contains("reclassifiesExistingMarkdown: true") + && workspaceStoreSource.contains("defaultMarkdownIsNotebookNote") + && workspaceStoreSource.contains("func createCourseNotebookNote(title: String) -> String?") + && courseWorkspaceSource.contains("确认 Markdown 的角色") + && courseWorkspaceSource.contains("guard let noteID = store.createCourseNotebookNote") + && courseWorkspaceSource.contains("newNoteError = store.noteFileError") + && appSource.contains("打开课程台") + && commandPaletteSource.contains("打开课程台") + && linkedSourcesSource.contains("store.presentCourseWorkspace(.notes"), "course workspace is reachable from top-level commands and note relationships, while explicit open actions own navigation") +expect(workspaceStoreSource.contains("noteSourceRelationIndex = NoteSourceRelationIndex(links: noteSourceLinks)") + && workspaceStoreSource.contains("func linkedNoteCount(for sourceItemID: String)") + && workspaceStoreSource.contains("verifyCourseOverlayContinuity(itemID:") + && workspaceStoreSource.contains("verifyCourseOverlayContinuity(itemID: \"sample-pdf\")") + && workspaceStoreSource.contains("PaneToggleContinuityVerifier.endMeasurement()"), "course relationships use a reusable index and overlay continuity measures live HTML and PDF panes") +expect(readerViewSource.contains("var isEnabled = true") + && readerViewSource.contains("NSApp.modalWindow == nil") + && courseWorkspaceSource.contains("isEnabled: !showsNewNotePrompt && store.courseFolderImportDraft == nil"), "escape dismisses only the active course surface and leaves sheets or file panels in control") expect(workspaceStoreSource.contains("DocumentTextExtractor.cachedText(for: item)") && workspaceStoreSource.contains("loadedMaterialText = await Task.detached(priority: .utility)") && !workspaceStoreSource.contains("if let text = DocumentTextExtractor.text(for: item)"), "main-actor workspace reads only cached document text while bounded extraction runs off the UI thread") @@ -3543,6 +3608,8 @@ expect(!sampleMarkdown.isImportedMarkdownFile, "sample markdown stays app-owned" expect(!sampleMarkdown.canBecomeNotebookNote, "sample markdown cannot become a backing-file note") let relationNoteID = "note:research" +let relationNoteB = "note:shared" +let relationNoteC = "note:replacement" let relationSourceA = "file:/tmp/a.pdf" let relationSourceB = "file:/tmp/b.html" let oldestLink = NoteSourceLink( @@ -3557,6 +3624,24 @@ let duplicateLink = NoteSourceLink( sourceItemID: relationSourceA, createdAt: Date(timeIntervalSince1970: 2) ) +let sharedSourceLink = NoteSourceLink( + id: UUID(uuidString: "00000000-0000-0000-0000-000000000003")!, + noteItemID: relationNoteB, + sourceItemID: relationSourceA, + createdAt: Date(timeIntervalSince1970: 3) +) +let sharedSourceDuplicate = NoteSourceLink( + id: UUID(uuidString: "00000000-0000-0000-0000-000000000004")!, + noteItemID: relationNoteB, + sourceItemID: relationSourceA, + createdAt: Date(timeIntervalSince1970: 4) +) +let unrelatedSourceLink = NoteSourceLink( + id: UUID(uuidString: "00000000-0000-0000-0000-000000000005")!, + noteItemID: relationNoteID, + sourceItemID: relationSourceB, + createdAt: Date(timeIntervalSince1970: 5) +) var noteSourceRelations = NoteSourceRelations(links: [duplicateLink, oldestLink]) expect(noteSourceRelations.links == [oldestLink] && noteSourceRelations.sourceIDs(for: relationNoteID) == [relationSourceA], "note-source relations keep one durable pair and preserve the oldest identity") @@ -3566,6 +3651,78 @@ expect(noteSourceRelations.sourceIDs(for: relationNoteID) == [relationSourceB] noteSourceRelations.sanitize(validNoteItemIDs: [relationNoteID], validSourceItemIDs: [relationSourceA]) expect(noteSourceRelations.links.isEmpty, "note-source sanitation removes relationships whose source no longer exists") +var sharedSourceRelations = NoteSourceRelations( + links: [unrelatedSourceLink, sharedSourceDuplicate, sharedSourceLink, duplicateLink, oldestLink] +) +expect(sharedSourceRelations.links == [oldestLink, sharedSourceLink, unrelatedSourceLink] + && sharedSourceRelations.noteIDs(for: relationSourceA) == [relationNoteID, relationNoteB], "one source can be shared by multiple notes while duplicate pairs keep their oldest identity") +sharedSourceRelations.replaceNotes( + for: relationSourceA, + noteItemIDs: [relationNoteB, relationNoteC] +) +expect(sharedSourceRelations.noteIDs(for: relationSourceA) == [relationNoteB, relationNoteC] + && sharedSourceRelations.links.contains(sharedSourceLink) + && sharedSourceRelations.links.contains(unrelatedSourceLink) + && !sharedSourceRelations.isLinked(noteItemID: relationNoteID, sourceItemID: relationSourceA), "replacing a source's notes preserves retained links and removes only deselected notes") +let relationIndex = NoteSourceRelationIndex(links: sharedSourceRelations.links) +expect(relationIndex.sourceIDs(for: relationNoteB) == [relationSourceA] + && relationIndex.noteIDs(for: relationSourceA) == [relationNoteB, relationNoteC] + && relationIndex.sourceCount(for: relationNoteID) == 1 + && relationIndex.noteCount(for: relationSourceB) == 1, "relationship index reuses normalized note-to-source and source-to-note lookups") + +let courseMaterials = [ + StudyItem(id: "material:a", title: "第一讲", subtitle: "第一讲.pdf", kind: .pdf, urlPath: "/tmp/course/a.pdf", isSample: false), + StudyItem(id: "material:b", title: "第二讲", subtitle: "第二讲.html", kind: .html, urlPath: "/tmp/course/b.html", isSample: false), + StudyItem(id: "material:c", title: "补充材料", subtitle: "补充材料.txt", kind: .text, urlPath: "/tmp/course/c.txt", isSample: false) +] +let courseNotes = [ + StudyItem(id: "note:a", title: "第一讲笔记", subtitle: "第一讲笔记.md", kind: .markdown, urlPath: "/tmp/course/note-a.md", isSample: false, isNotebookNote: true), + StudyItem(id: "note:b", title: "共同主题", subtitle: "共同主题.md", kind: .markdown, urlPath: "/tmp/course/note-b.md", isSample: false, isNotebookNote: true), + StudyItem(id: "note:c", title: "待整理", subtitle: "待整理.md", kind: .markdown, urlPath: "/tmp/course/note-c.md", isSample: false, isNotebookNote: true) +] +let builtInSample = StudyItem(id: "sample:ignored", title: "内置样例", subtitle: "样例", kind: .html, urlPath: nil, isSample: true) +let courseLinks = [ + NoteSourceLink(noteItemID: "note:a", sourceItemID: "material:a", createdAt: Date(timeIntervalSince1970: 10)), + NoteSourceLink(noteItemID: "note:b", sourceItemID: "material:a", createdAt: Date(timeIntervalSince1970: 11)), + NoteSourceLink(noteItemID: "note:b", sourceItemID: "material:b", createdAt: Date(timeIntervalSince1970: 12)), + NoteSourceLink(noteItemID: "note:b", sourceItemID: "material:b", createdAt: Date(timeIntervalSince1970: 13)), + NoteSourceLink(noteItemID: "note:missing", sourceItemID: "material:c", createdAt: Date(timeIntervalSince1970: 14)), + NoteSourceLink(noteItemID: "note:a", sourceItemID: "sample:ignored", createdAt: Date(timeIntervalSince1970: 15)) +] +let firstCourseSessionID = UUID(uuidString: "10000000-0000-0000-0000-000000000001")! +let secondCourseSessionID = UUID(uuidString: "10000000-0000-0000-0000-000000000002")! +let courseSummary = CourseWorkspaceSummary( + importedItems: courseMaterials + courseNotes + [builtInSample], + noteSourceLinks: courseLinks, + studyLocationsByItemID: [ + "material:a": StudyLocation(itemID: "material:a", itemTitle: "第一讲"), + "material:c": StudyLocation(itemID: "material:c", itemTitle: "补充材料"), + "material:missing": StudyLocation(itemID: "material:missing", itemTitle: "已移除资料") + ], + studySessions: [ + StudySession( + id: firstCourseSessionID, + title: "第一次学习", + messages: [AgentMessage(role: .user, text: "解释第一讲", source: "第一讲")] + ), + StudySession(id: secondCourseSessionID, title: "第二次学习") + ], + learningMemoryEntries: [ + LearningMemoryEntry(kind: .confusion, text: "困惑一", evidence: "用户提出", origin: .userStatement), + LearningMemoryEntry(kind: .confusion, text: "困惑二", evidence: "用户提出", origin: .userStatement), + LearningMemoryEntry(kind: .confusion, text: "已解决困惑", evidence: "用户提出", origin: .userStatement, status: .resolved), + LearningMemoryEntry(kind: .goal, text: "课程目标", evidence: "用户提出", origin: .userStatement) + ] +) +expect(courseSummary.materialCount == 3 + && courseSummary.noteCount == 3 + && courseSummary.explicitLinkCount == 3 + && courseSummary.readingPositionCount == 2 + && courseSummary.unlinkedMaterialCount == 1 + && courseSummary.unlinkedNoteCount == 1 + && courseSummary.studySessionCount == 1 + && courseSummary.unresolvedConfusionCount == 2, "course workspace summary reports only durable facts from the imported course") + let persisted = PersistedWorkspace(noteSourceLinks: [oldestLink], noteSourceLinksMigrationVersion: 1, threePaneOrder: [.agent, .reader, .notes], noteRenderMode: .preview, showLibrary: false, showReader: false, showAgent: true, showNotes: false, showRightPane: true, showDailyInspiration: false, adaptImportedDocumentColors: false) let restored = try JSONDecoder().decode(PersistedWorkspace.self, from: try JSONEncoder().encode(persisted)) expect(restored.showLibrary == false && restored.showReader == false && restored.showAgent == true && restored.showNotes == false && restored.showRightPane == true, "pane visibility state persists") diff --git a/script/build_and_run.sh b/script/build_and_run.sh index d9c84f379..9ab96e87f 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -469,6 +469,77 @@ verify_linked_sources_flow() { return 1 } +verify_course_workspace_flow() { + local report_file="" + case "$VERIFY_SCENARIO" in + course-workspace-overview-flow) + report_file="$VERIFY_DATA_DIR/course-workspace-overview-report.json" + ;; + course-workspace-workflow-flow) + report_file="$VERIFY_DATA_DIR/course-workspace-workflow-report.json" + ;; + *) + return 0 + ;; + esac + + for _ in {1..150}; do + if [[ -s "$report_file" ]]; then + break + fi + sleep 0.2 + done + if [[ ! -s "$report_file" ]]; then + echo "verify failed: course workspace report was not produced for $VERIFY_SCENARIO." >&2 + [[ -s "$VERIFY_STDERR" ]] && cat "$VERIFY_STDERR" >&2 + return 1 + fi + + if [[ "$VERIFY_SCENARIO" == "course-workspace-overview-flow" ]]; then + if ! /usr/bin/jq -e ' + .result == "pass" + and .materialCount == 3 + and .noteCount == 3 + and .explicitLinkCount == 3 + and .readingPositionCount == 1 + and .studySessionCount == 1 + and .unresolvedConfusionCount == 1 + and .importClassificationPassed == true + and .invalidNoteCreationPassed == true + and .folderCountSummaryPassed == true + and .unlinkedMaterialIDs == ["course-material-c"] + and .unlinkedNoteIDs == ["course-note-c"] + and .courseWorkspacePresented == true + ' "$report_file" >/dev/null; then + echo "verify failed: course workspace overview exposed inaccurate facts." >&2 + /usr/bin/jq . "$report_file" >&2 + return 1 + fi + elif ! /usr/bin/jq -e ' + .result == "pass" + and .continuityPassed == true + and .importClassificationPassed == true + and .invalidNoteCreationPassed == true + and .folderCountSummaryPassed == true + and .materialNavigationPassed == true + and .noteNavigationPassed == true + and .persistencePassed == true + and .finalMaterialID == "course-material-c" + and .finalNoteID == "course-note-c" + and .noteA_sources == ["course-material-a"] + and (.noteC_sources | sort) == ["course-material-b", "course-material-c"] + and (.materialB_notes | sort) == ["course-note-b", "course-note-c"] + and .paneMakeCount == 0 + and .paneDismantleCount == 0 + ' "$report_file" >/dev/null; then + echo "verify failed: course workspace relationship workflow or pane continuity regressed." >&2 + /usr/bin/jq . "$report_file" >&2 + return 1 + fi + + /usr/bin/jq -r '"course_workspace_result=\(.result)"' "$report_file" +} + verify_pane_toggle_continuity() { if [[ "$VERIFY_SCENARIO" != "pane-toggle-continuity-flow" ]]; then return 0 @@ -639,6 +710,7 @@ finish_verify_window() { verify_learning_flow_persistence verify_empty_workspace_state verify_linked_sources_flow + verify_course_workspace_flow verify_pane_toggle_continuity verify_pane_layout_stability verify_pane_reorder_width From 1fbc755162abeaa98b162e657d3bbb806fe4fffc Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:45:08 +0800 Subject: [PATCH 24/36] feat: refine course home navigation --- Sources/WeiBei/App/WeiBeiApp.swift | 10 +- Sources/WeiBei/Stores/WorkspaceStore.swift | 12 ++ Sources/WeiBei/Views/CommandPaletteView.swift | 6 +- Sources/WeiBei/Views/ContentView.swift | 8 +- Sources/WeiBei/Views/CourseOverviewView.swift | 118 ++++++---- .../WeiBei/Views/CourseRelationsView.swift | 202 ++++++++++++------ .../Views/CourseWorkspaceComponents.swift | 77 ++++++- .../WeiBei/Views/CourseWorkspaceView.swift | 75 ++++--- Sources/WeiBei/Views/LinkedSourcesView.swift | 2 +- Sources/WeiBei/Views/ReaderView.swift | 2 +- Sources/WeiBei/Views/SidebarView.swift | 28 ++- Sources/WeiBeiSelfCheck/main.swift | 41 ++-- 12 files changed, 408 insertions(+), 173 deletions(-) diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index d646d05a6..a05342d26 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -80,7 +80,7 @@ struct WeiBeiApp: App { .windowStyle(.hiddenTitleBar) .commands { CommandMenu(store.appDisplayName) { - Button(store.ui("打开课程台", "Open Course Workspace")) { store.presentCourseWorkspace() } + Button(store.ui("打开课程首页", "Open Course Home")) { store.presentCourseWorkspace() } .keyboardShortcut("0") Divider() @@ -98,7 +98,7 @@ struct WeiBeiApp: App { Divider() - Button(store.ui("聚焦资料库", "Focus Library")) { animateLayout { store.focus(.library) } } + Button(store.ui("聚焦课程目录", "Focus Course Index")) { animateLayout { store.focus(.library) } } .keyboardShortcut("1") Button(store.ui("聚焦阅读", "Focus Reader")) { animateLayout { store.focus(.reader) } } .keyboardShortcut("2") @@ -116,7 +116,7 @@ struct WeiBeiApp: App { Divider() - Button(store.showLibrary ? store.ui("收起资料库", "Hide Library") : store.ui("打开资料库", "Show Library")) { + Button(store.showLibrary ? store.ui("收起课程目录", "Hide Course Index") : store.ui("打开课程目录", "Show Course Index")) { animateLayout { store.toggleLibrary() } @@ -1102,7 +1102,7 @@ struct SettingsView: View { private var shortcutRows: [(String, String, String)] { [ (store.ui("命令面板", "Command Palette"), "⌘K", store.ui("搜索并执行魏碑动作。", "Search and run WeiBei actions.")), - (store.ui("资料库", "Library"), "⌘B", store.ui("打开或收起资料库。", "Show or hide the library.")), + (store.ui("课程目录", "Course Index"), "⌘B", store.ui("打开或收起课程目录。", "Show or hide the course index.")), (store.ui("资料内搜索", "Search in Material"), "⌘F", store.ui("搜索当前打开的资料。", "Search the current material.")), (store.ui("聚焦阅读", "Focus Reader"), "⌘2", store.ui("把键盘焦点交给阅读区。", "Move keyboard focus to the reader.")), (store.ui("聚焦笔记", "Focus Notes"), "⌘3", store.ui("把键盘焦点交给笔记区。", "Move keyboard focus to notes.")), @@ -1113,7 +1113,7 @@ struct SettingsView: View { private var dataSettings: some View { VStack(alignment: .leading, spacing: 16) { - settingsGroup(store.ui("资料库", "Library")) { + settingsGroup(store.ui("课程资料", "Course Materials")) { settingsRow( title: store.ui("导入资料", "Import Material"), detail: store.ui("导入 HTML、PDF、Markdown 或文本文件。", "Import HTML, PDF, Markdown, or text files.") diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index b7c35aebc..c8aded405 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -3503,6 +3503,7 @@ final class WorkspaceStore: ObservableObject { || scenario == "reader-scroll-persistence-flow" || scenario == "course-workspace-overview-flow" || scenario == "course-workspace-workflow-flow" + || scenario == "course-index-navigation-flow" || emptyWorkspaceScenarios.contains(scenario) else { return } didRunVerificationScenario = true recordVerificationStage("recognized:\(scenario)") @@ -3526,6 +3527,17 @@ final class WorkspaceStore: ObservableObject { await runCourseWorkspaceVerification(scenario) return } + if scenario == "course-index-navigation-flow" { + layout = .documentAgentNotes + showLibrary = true + showReader = false + showAgent = false + showNotes = false + agentSurface = .hidden + showDailyInspiration = true + save() + return + } if scenario == "pane-toggle-continuity-flow" { await runPaneToggleContinuityVerification() return diff --git a/Sources/WeiBei/Views/CommandPaletteView.swift b/Sources/WeiBei/Views/CommandPaletteView.swift index 87c1bb63d..2c70c8d9d 100644 --- a/Sources/WeiBei/Views/CommandPaletteView.swift +++ b/Sources/WeiBei/Views/CommandPaletteView.swift @@ -10,16 +10,16 @@ struct CommandPaletteView: View { private var commands: [PaletteCommand] { var items = [ - PaletteCommand(title: store.ui("打开课程台", "Open Course Workspace"), shortcut: "⌘0", animation: WeiBeiMotion.panel) { store.presentCourseWorkspace() }, + PaletteCommand(title: store.ui("打开课程首页", "Open Course Home"), shortcut: "⌘0", animation: WeiBeiMotion.panel) { store.presentCourseWorkspace() }, PaletteCommand(title: store.ui("打开资料", "Open Material"), shortcut: "⌘O") { store.importFilesFromPanel() }, PaletteCommand(title: store.ui("新建空白笔记", "New Blank Note"), shortcut: "⌘N") { store.promptCreateBlankNotebookNote() }, - PaletteCommand(title: store.ui("聚焦资料库", "Focus Library"), shortcut: "⌘1", animation: WeiBeiMotion.layout) { store.focus(.library) }, + PaletteCommand(title: store.ui("聚焦课程目录", "Focus Course Index"), shortcut: "⌘1", animation: WeiBeiMotion.layout) { store.focus(.library) }, PaletteCommand(title: store.ui("聚焦阅读", "Focus Reader"), shortcut: "⌘2", animation: WeiBeiMotion.layout) { store.focus(.reader) }, PaletteCommand(title: store.ui("聚焦笔记", "Focus Notes"), shortcut: "⌘3", animation: WeiBeiMotion.layout) { store.focus(.notes) }, PaletteCommand(title: store.ui("聚焦对话", "Focus Chat"), shortcut: "⌘4", animation: WeiBeiMotion.layout) { store.focus(.agent) }, PaletteCommand(title: store.ui("上一份资料", "Previous Material"), shortcut: "⌥⌘↑", animation: WeiBeiMotion.layout) { store.selectAdjacentItem(step: -1) }, PaletteCommand(title: store.ui("下一份资料", "Next Material"), shortcut: "⌥⌘↓", animation: WeiBeiMotion.layout) { store.selectAdjacentItem(step: 1) }, - PaletteCommand(title: store.showLibrary ? store.ui("收起资料库", "Hide Library") : store.ui("打开资料库", "Show Library"), shortcut: "⌘B", animation: WeiBeiMotion.layout) { store.toggleLibrary() }, + PaletteCommand(title: store.showLibrary ? store.ui("收起课程目录", "Hide Course Index") : store.ui("打开课程目录", "Show Course Index"), shortcut: "⌘B", animation: WeiBeiMotion.layout) { store.toggleLibrary() }, PaletteCommand(title: store.ui("三栏工作台", "Three-Pane Workspace"), shortcut: "⌥⌘1", animation: WeiBeiMotion.layout) { store.setLayout(.documentAgentNotes) }, PaletteCommand(title: WorkspaceLayout.documentNotesSplit.label(language: store.interfaceLanguage), shortcut: "⌥⌘2", animation: WeiBeiMotion.layout) { store.setLayout(.documentNotesSplit) }, PaletteCommand(title: WorkspaceLayout.immersiveReading.label(language: store.interfaceLanguage), shortcut: "⌥⌘R", animation: WeiBeiMotion.layout) { store.setLayout(.immersiveReading) }, diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index 34884ed83..e4195b676 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -182,7 +182,7 @@ struct ContentView: View { libraryDragStartWidth = nil } ) - .help(store.ui("拖动调整资料库宽度", "Drag to resize the library")) + .help(store.ui("拖动调整课程目录宽度", "Drag to resize the course index")) } } @@ -465,10 +465,6 @@ private struct UnifiedTopBarView: View { @ViewBuilder private var leftPrimaryControls: some View { HStack(spacing: 5) { - topIconButton("books.vertical", help: store.ui("打开课程台", "Open course workspace")) { - store.presentCourseWorkspace() - } - libraryButton navigationButtons @@ -592,7 +588,7 @@ private struct UnifiedTopBarView: View { @ViewBuilder private var libraryButton: some View { - topIconButton("sidebar.left", help: store.showLibrary ? store.ui("收起资料库", "Hide library") : store.ui("打开资料库", "Show library"), active: store.showLibrary) { + topIconButton("sidebar.left", help: store.showLibrary ? store.ui("收起课程目录", "Hide course index") : store.ui("打开课程目录", "Show course index"), active: store.showLibrary) { withAnimation(WeiBeiMotion.layout) { store.toggleLibrary() } diff --git a/Sources/WeiBei/Views/CourseOverviewView.swift b/Sources/WeiBei/Views/CourseOverviewView.swift index a197f443d..4e5eef7fe 100644 --- a/Sources/WeiBei/Views/CourseOverviewView.swift +++ b/Sources/WeiBei/Views/CourseOverviewView.swift @@ -8,6 +8,7 @@ struct CourseOverviewView: View { let showUnlinkedMaterials: () -> Void let showMaterialsWithoutReadingPosition: () -> Void let showRecords: (UUID?) -> Void + @State private var showsAttention = false private var summary: CourseWorkspaceSummary { store.courseWorkspaceSummary @@ -25,13 +26,20 @@ struct CourseOverviewView: View { .map(\.text) let flowSteps = store.activeStudySession?.flow.suggestedNext ?? [] var seen = Set<String>() - return (memorySteps + flowSteps).filter { seen.insert($0).inserted }.prefix(6).map { $0 } + return (memorySteps + flowSteps).filter { seen.insert($0).inserted }.prefix(3).map { $0 } } private var unresolvedConfusions: [LearningMemoryEntry] { store.activeCourseMemories.filter { $0.kind == .confusion } } + private var attentionCount: Int { + summary.unlinkedNoteCount + + summary.unlinkedMaterialCount + + store.courseMaterialsWithoutReadingPosition.count + + summary.unresolvedConfusionCount + } + var body: some View { ScrollView { VStack(alignment: .leading, spacing: 0) { @@ -45,8 +53,8 @@ struct CourseOverviewView: View { ViewThatFits(in: .horizontal) { HStack(alignment: .top, spacing: 0) { VStack(alignment: .leading, spacing: 26) { - currentContextSection continueSection + currentContextSection attentionSection } .frame(maxWidth: .infinity, alignment: .leading) @@ -60,20 +68,20 @@ struct CourseOverviewView: View { nextStepSection recentDiscussionSection } - .frame(width: 390, alignment: .leading) + .frame(width: 340, alignment: .leading) .padding(.leading, 34) } VStack(alignment: .leading, spacing: 28) { - currentContextSection continueSection + currentContextSection attentionSection nextStepSection recentDiscussionSection } } } - .frame(maxWidth: 1260, alignment: .leading) + .frame(maxWidth: 1120, alignment: .leading) .padding(.horizontal, 42) .padding(.top, 34) .padding(.bottom, 54) @@ -140,37 +148,75 @@ struct CourseOverviewView: View { } } + @ViewBuilder private var attentionSection: some View { - CourseDetailSection(title: store.ui("待整理", "Needs attention")) { - VStack(spacing: 0) { - CourseAttentionRow( - title: store.ui("尚未建立资料关联的笔记", "Notes without material links"), - count: summary.unlinkedNoteCount, - detail: store.ui("明确哪些资料长期支撑这些笔记", "Choose which materials support these notes"), - action: showUnlinkedNotes - ) - CourseHairline() - CourseAttentionRow( - title: store.ui("还没有进入任何笔记的资料", "Materials not linked to any note"), - count: summary.unlinkedMaterialCount, - detail: store.ui("这不代表没有阅读,只代表尚未建立关系", "This means no relationship has been recorded"), - action: showUnlinkedMaterials - ) - CourseHairline() - CourseAttentionRow( - title: store.ui("尚无阅读位置的资料", "Materials without a reading position"), - count: store.courseMaterialsWithoutReadingPosition.count, - detail: store.ui("应用还没有记录到页码或章节", "No page or section has been recorded"), - action: showMaterialsWithoutReadingPosition - ) - if summary.unresolvedConfusionCount > 0 { - CourseHairline() - CourseAttentionRow( - title: store.ui("还没有解决的困惑", "Unresolved questions"), - count: summary.unresolvedConfusionCount, - detail: unresolvedConfusions.first?.text ?? "", - action: { showRecords(unresolvedConfusions.first?.sessionID) } - ) + if attentionCount > 0 { + CourseDetailSection(title: store.ui("待整理", "Needs attention")) { + VStack(spacing: 0) { + Button { + withAnimation(WeiBeiMotion.reveal) { + showsAttention.toggle() + } + } label: { + HStack(spacing: 12) { + Text(store.ui("\(attentionCount) 项需要整理", "\(attentionCount) items to review")) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(WeiBeiTheme.ink) + Spacer() + Text(showsAttention ? store.ui("收起", "Collapse") : store.ui("展开", "Expand")) + .font(.system(size: 10.5, weight: .medium)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + Image(systemName: "chevron.down") + .font(.system(size: 9, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .rotationEffect(.degrees(showsAttention ? 180 : 0)) + } + .padding(.horizontal, 12) + .frame(minHeight: 46) + .contentShape(Rectangle()) + .background(WeiBeiTheme.paperRaised.opacity(0.28)) + } + .buttonStyle(.plain) + .accessibilityValue(Text(showsAttention ? store.ui("已展开", "Expanded") : store.ui("已收起", "Collapsed"))) + + if showsAttention { + if summary.unlinkedNoteCount > 0 { + CourseHairline() + CourseAttentionRow( + title: store.ui("尚未建立资料关联的笔记", "Notes without material links"), + count: summary.unlinkedNoteCount, + detail: store.ui("明确哪些资料长期支撑这些笔记", "Choose which materials support these notes"), + action: showUnlinkedNotes + ) + } + if summary.unlinkedMaterialCount > 0 { + CourseHairline() + CourseAttentionRow( + title: store.ui("还没有进入任何笔记的资料", "Materials not linked to any note"), + count: summary.unlinkedMaterialCount, + detail: store.ui("只代表尚未建立长期关系", "No durable relationship has been recorded"), + action: showUnlinkedMaterials + ) + } + if !store.courseMaterialsWithoutReadingPosition.isEmpty { + CourseHairline() + CourseAttentionRow( + title: store.ui("尚无阅读位置的资料", "Materials without a reading position"), + count: store.courseMaterialsWithoutReadingPosition.count, + detail: store.ui("应用还没有记录到页码或章节", "No page or section has been recorded"), + action: showMaterialsWithoutReadingPosition + ) + } + if summary.unresolvedConfusionCount > 0 { + CourseHairline() + CourseAttentionRow( + title: store.ui("还没有解决的困惑", "Unresolved questions"), + count: summary.unresolvedConfusionCount, + detail: unresolvedConfusions.first?.text ?? "", + action: { showRecords(unresolvedConfusions.first?.sessionID) } + ) + } + } } } } @@ -181,7 +227,7 @@ struct CourseOverviewView: View { if nextSteps.isEmpty { CourseEmptyState( title: store.ui("还没有明确的下一步", "No next step yet"), - detail: store.ui("继续阅读或对话后,课程台会把真实建议放在这里。", "Continue reading or chatting to build the next step."), + detail: store.ui("继续阅读或对话后,课程首页会把真实建议放在这里。", "Continue reading or chatting to build the next step."), systemImage: "arrow.forward" ) } else { diff --git a/Sources/WeiBei/Views/CourseRelationsView.swift b/Sources/WeiBei/Views/CourseRelationsView.swift index 757e86f72..9fe2e1d6d 100644 --- a/Sources/WeiBei/Views/CourseRelationsView.swift +++ b/Sources/WeiBei/Views/CourseRelationsView.swift @@ -20,30 +20,43 @@ struct CourseRelationsView: View { var body: some View { VStack(spacing: 0) { - HStack(spacing: 18) { - ForEach(CourseRelationLens.allCases) { candidate in - CourseWorkspaceTab( - title: candidate.label(language: store.interfaceLanguage), - active: candidate == lens - ) { - withAnimation(WeiBeiMotion.panel) { - lens = candidate + HStack(spacing: 12) { + Text(store.ui("查看", "View")) + .font(.system(size: 11, weight: .medium)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + + Menu { + ForEach(CourseRelationLens.allCases) { candidate in + Button(candidate.label(language: store.interfaceLanguage)) { + withAnimation(WeiBeiMotion.panel) { + lens = candidate + } } } + } label: { + HStack(spacing: 5) { + Text(lens.label(language: store.interfaceLanguage)) + .font(.system(size: 12, weight: .semibold)) + Image(systemName: "chevron.down") + .font(.system(size: 9, weight: .semibold)) + } + .foregroundStyle(WeiBeiTheme.ink) } + .menuStyle(.borderlessButton) + .fixedSize() Spacer() Text(store.ui( - "选择条目只查看关系,点“打开”才会离开课程台。", - "Selecting shows relationships. Open only when you are ready to leave." + "先查看长期关联,需要调整时再进入管理。", + "Review durable links first. Manage them only when needed." )) .font(.system(size: 11)) .foregroundStyle(WeiBeiTheme.tertiaryInk) } .padding(.horizontal, 22) - .frame(height: 44) - .background(WeiBeiTheme.paperRaised.opacity(0.34)) + .frame(height: 40) + .background(WeiBeiTheme.paperRaised.opacity(0.28)) CourseHairline() @@ -132,7 +145,7 @@ struct CourseRelationsView: View { } else { HStack(spacing: 0) { list - .frame(width: 390) + .frame(width: 350) Rectangle() .fill(WeiBeiTheme.hairline.opacity(0.72)) .frame(width: 1) @@ -203,6 +216,7 @@ struct CourseEntityList: View { struct NoteRelationDetail: View { @EnvironmentObject private var store: WorkspaceStore let noteID: String? + @State private var isManagingLinks = false private var note: StudyItem? { noteID.flatMap(store.item(withID:)) @@ -213,8 +227,9 @@ struct NoteRelationDetail: View { } var body: some View { - if let note, let noteID { - VStack(spacing: 0) { + Group { + if let note, let noteID { + VStack(spacing: 0) { CourseRelationDetailHeader( mark: "NOTE", title: store.displayTitle(for: note), @@ -222,6 +237,14 @@ struct NoteRelationDetail: View { "\(linkedSourceIDs.count) 份长期关联资料", "\(linkedSourceIDs.count) linked materials" ), + manageTitle: isManagingLinks + ? store.ui("完成", "Done") + : store.ui("管理关联", "Manage links"), + manage: { + withAnimation(WeiBeiMotion.reveal) { + isManagingLinks.toggle() + } + }, openTitle: store.ui("打开笔记", "Open note"), open: { store.openCourseNote(noteID) } ) @@ -231,8 +254,12 @@ struct NoteRelationDetail: View { ScrollView { VStack(alignment: .leading, spacing: 20) { Text(store.ui( - "勾选的资料会长期跟随这份笔记。打开其他文稿不会改变这里。", - "Checked materials stay with this note. Opening another document does not change them." + isManagingLinks + ? "选择长期支撑这份笔记的资料。更改会自动保存。" + : "这些资料会长期跟随这份笔记,打开其他文稿不会改变它们。", + isManagingLinks + ? "Choose the materials that support this note. Changes save automatically." + : "These materials stay with this note even when another document is open." )) .font(.system(size: 12)) .foregroundStyle(WeiBeiTheme.secondaryInk) @@ -240,10 +267,10 @@ struct NoteRelationDetail: View { if store.courseMaterials.isEmpty { CourseEmptyState( title: store.ui("还没有可关联资料", "No materials to link"), - detail: store.ui("点课程台顶部“导入”添加资料或文件夹。", "Use Import above to add materials or folders."), + detail: store.ui("点课程首页顶部“导入”添加资料或文件夹。", "Use Import above to add materials or folders."), systemImage: "books.vertical" ) - } else { + } else if isManagingLinks { VStack(spacing: 0) { ForEach(store.courseMaterials) { material in RelationSelectionRow( @@ -259,6 +286,22 @@ struct NoteRelationDetail: View { CourseHairline() } } + } else if linkedSourceIDs.isEmpty { + CourseEmptyState( + title: store.ui("还没有关联资料", "No linked materials"), + detail: store.ui("需要时点“管理关联”,为这份笔记选择长期资料。", "Use Manage links when this note needs supporting materials."), + systemImage: "link" + ) + } else { + VStack(spacing: 0) { + ForEach(store.courseMaterials.filter { linkedSourceIDs.contains($0.id) }) { material in + CourseLinkedItemRow( + item: material, + detail: courseFolderLabel(material, store: store) + ) + CourseHairline() + } + } } } .padding(24) @@ -266,27 +309,30 @@ struct NoteRelationDetail: View { .frame(maxWidth: .infinity, alignment: .topLeading) } - CourseHairline() - - relationFooter( - countTitle: store.ui( - "已关联 \(linkedSourceIDs.count) 份资料", - "\(linkedSourceIDs.count) linked materials" - ), - statusTitle: store.ui("更改自动保存", "Changes save automatically"), - errorTitle: store.workspaceSaveError, - retryTitle: store.ui("重试保存", "Retry save"), - retry: { _ = store.retryWorkspaceSave() } + if isManagingLinks { + CourseHairline() + relationFooter( + countTitle: store.ui( + "已关联 \(linkedSourceIDs.count) 份资料", + "\(linkedSourceIDs.count) linked materials" + ), + statusTitle: store.ui("更改自动保存", "Changes save automatically"), + errorTitle: store.workspaceSaveError, + retryTitle: store.ui("重试保存", "Retry save"), + retry: { _ = store.retryWorkspaceSave() } + ) + } + } + } else { + CourseEmptyState( + title: store.ui("选择一份笔记", "Select a note"), + detail: store.ui("在左侧选择笔记后,可以查看它的长期资料关系。", "Choose a note to review its material relationships."), + systemImage: "note.text" ) + .frame(maxWidth: .infinity, maxHeight: .infinity) } - } else { - CourseEmptyState( - title: store.ui("选择一份笔记", "Select a note"), - detail: store.ui("在左侧选择笔记后,可以集中管理它的资料关系。", "Choose a note to manage its material relationships."), - systemImage: "note.text" - ) - .frame(maxWidth: .infinity, maxHeight: .infinity) } + .onChange(of: noteID) { _, _ in isManagingLinks = false } } } @@ -294,6 +340,7 @@ struct NoteRelationDetail: View { struct MaterialRelationDetail: View { @EnvironmentObject private var store: WorkspaceStore let materialID: String? + @State private var isManagingLinks = false private var material: StudyItem? { materialID.flatMap(store.item(withID:)) @@ -304,12 +351,21 @@ struct MaterialRelationDetail: View { } var body: some View { - if let material, let materialID { - VStack(spacing: 0) { + Group { + if let material, let materialID { + VStack(spacing: 0) { CourseRelationDetailHeader( mark: courseMaterialMark(material.kind), title: store.displayTitle(for: material), detail: materialDetail(material), + manageTitle: isManagingLinks + ? store.ui("完成", "Done") + : store.ui("管理关联", "Manage links"), + manage: { + withAnimation(WeiBeiMotion.reveal) { + isManagingLinks.toggle() + } + }, openTitle: store.ui("打开资料", "Open material"), open: { store.openCourseMaterial(materialID) } ) @@ -319,8 +375,12 @@ struct MaterialRelationDetail: View { ScrollView { VStack(alignment: .leading, spacing: 20) { Text(store.ui( - "同一份资料可以进入多份笔记。这里只编辑长期关系,不改变当前文稿。", - "One material can support many notes. This edits durable links without changing the open document." + isManagingLinks + ? "选择会长期使用这份资料的笔记。更改不会切换当前文稿。" + : "这些笔记长期使用这份资料,查看关系不会切换当前文稿。", + isManagingLinks + ? "Choose the notes that use this material. Changes do not switch the open document." + : "These notes use this material. Reviewing links does not switch the open document." )) .font(.system(size: 12)) .foregroundStyle(WeiBeiTheme.secondaryInk) @@ -331,7 +391,7 @@ struct MaterialRelationDetail: View { detail: store.ui("先新建或导入笔记,再回来建立关系。", "Create or import a note before linking this material."), systemImage: "note.text" ) - } else { + } else if isManagingLinks { VStack(spacing: 0) { ForEach(store.courseNotebookItems) { note in RelationSelectionRow( @@ -350,6 +410,25 @@ struct MaterialRelationDetail: View { CourseHairline() } } + } else if linkedNoteIDs.isEmpty { + CourseEmptyState( + title: store.ui("还没有关联笔记", "No linked notes"), + detail: store.ui("需要时点“管理关联”,选择会使用这份资料的笔记。", "Use Manage links when notes should use this material."), + systemImage: "link" + ) + } else { + VStack(spacing: 0) { + ForEach(store.courseNotebookItems.filter { linkedNoteIDs.contains($0.id) }) { note in + CourseLinkedItemRow( + item: note, + detail: store.ui( + "\(store.linkedCourseSourceIDs(for: note.id).count) 份资料", + "\(store.linkedCourseSourceIDs(for: note.id).count) materials" + ) + ) + CourseHairline() + } + } } } .padding(24) @@ -357,27 +436,30 @@ struct MaterialRelationDetail: View { .frame(maxWidth: .infinity, alignment: .topLeading) } - CourseHairline() - - relationFooter( - countTitle: store.ui( - "已关联 \(linkedNoteIDs.count) 份笔记", - "\(linkedNoteIDs.count) linked notes" - ), - statusTitle: store.ui("更改自动保存", "Changes save automatically"), - errorTitle: store.workspaceSaveError, - retryTitle: store.ui("重试保存", "Retry save"), - retry: { _ = store.retryWorkspaceSave() } + if isManagingLinks { + CourseHairline() + relationFooter( + countTitle: store.ui( + "已关联 \(linkedNoteIDs.count) 份笔记", + "\(linkedNoteIDs.count) linked notes" + ), + statusTitle: store.ui("更改自动保存", "Changes save automatically"), + errorTitle: store.workspaceSaveError, + retryTitle: store.ui("重试保存", "Retry save"), + retry: { _ = store.retryWorkspaceSave() } + ) + } + } + } else { + CourseEmptyState( + title: store.ui("选择一份资料", "Select a material"), + detail: store.ui("在左侧选择资料后,可以查看阅读位置和关联笔记。", "Choose a material to inspect its reading position and note links."), + systemImage: "books.vertical" ) + .frame(maxWidth: .infinity, maxHeight: .infinity) } - } else { - CourseEmptyState( - title: store.ui("选择一份资料", "Select a material"), - detail: store.ui("在左侧选择资料后,可以查看阅读位置并管理相关笔记。", "Choose a material to inspect its reading position and note links."), - systemImage: "books.vertical" - ) - .frame(maxWidth: .infinity, maxHeight: .infinity) } + .onChange(of: materialID) { _, _ in isManagingLinks = false } } private func materialDetail(_ material: StudyItem) -> String { diff --git a/Sources/WeiBei/Views/CourseWorkspaceComponents.swift b/Sources/WeiBei/Views/CourseWorkspaceComponents.swift index 130af3b72..d04fdee29 100644 --- a/Sources/WeiBei/Views/CourseWorkspaceComponents.swift +++ b/Sources/WeiBei/Views/CourseWorkspaceComponents.swift @@ -7,9 +7,29 @@ struct CourseRelationDetailHeader: View { let mark: String let title: String let detail: String + let manageTitle: String? + let manage: (() -> Void)? let openTitle: String let open: () -> Void + init( + mark: String, + title: String, + detail: String, + manageTitle: String? = nil, + manage: (() -> Void)? = nil, + openTitle: String, + open: @escaping () -> Void + ) { + self.mark = mark + self.title = title + self.detail = detail + self.manageTitle = manageTitle + self.manage = manage + self.openTitle = openTitle + self.open = open + } + var body: some View { HStack(alignment: .center, spacing: 18) { VStack(alignment: .leading, spacing: 4) { @@ -27,8 +47,14 @@ struct CourseRelationDetailHeader: View { Spacer() - Button(openTitle, action: open) - .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) + HStack(spacing: 8) { + if let manageTitle, let manage { + Button(manageTitle, action: manage) + .buttonStyle(WeiBeiTextActionButtonStyle()) + } + Button(openTitle, action: open) + .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) + } } .padding(.horizontal, 24) .frame(minHeight: 88) @@ -36,6 +62,38 @@ struct CourseRelationDetailHeader: View { } } +struct CourseLinkedItemRow: View { + @EnvironmentObject private var store: WorkspaceStore + let item: StudyItem + let detail: String + + var body: some View { + HStack(spacing: 11) { + Image(systemName: item.kind.systemImage) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .frame(width: 20) + VStack(alignment: .leading, spacing: 3) { + Text(store.displayTitle(for: item)) + .font(.system(size: 13, weight: .medium)) + .foregroundStyle(WeiBeiTheme.ink) + .lineLimit(1) + Text(detail) + .font(.system(size: 10.5)) + .foregroundStyle(WeiBeiTheme.secondaryInk) + .lineLimit(1) + } + Spacer() + Text(store.ui("已关联", "Linked")) + .font(.system(size: 10.5, weight: .medium)) + .foregroundStyle(WeiBeiTheme.cinnabar) + } + .padding(.horizontal, 10) + .frame(minHeight: 48) + .accessibilityElement(children: .combine) + } +} + struct CourseWorkspaceRow: View { let icon: String let title: String @@ -60,7 +118,7 @@ struct CourseWorkspaceRow: View { .lineLimit(1) Text(detail) .font(.system(size: 10.5)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) .lineLimit(1) } @@ -88,6 +146,7 @@ struct CourseWorkspaceRow: View { .buttonStyle(.plain) .onHover { hovering = $0 } .animation(WeiBeiMotion.hover, value: hovering) + .accessibilityAddTraits(selected ? .isSelected : []) } } @@ -116,7 +175,7 @@ struct RelationSelectionRow: View { .lineLimit(1) Text(detail) .font(.system(size: 10.5)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) .lineLimit(1) } Spacer() @@ -150,7 +209,7 @@ struct CourseDetailSection<Content: View>: View { VStack(alignment: .leading, spacing: 12) { Text(title) .font(.system(size: 11, weight: .semibold)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) content } } @@ -168,7 +227,7 @@ struct CourseContextLine: View { .frame(width: 18) Text(label) .font(.system(size: 11, weight: .medium)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) .frame(width: 76, alignment: .leading) Text(value) .font(.system(size: 13, weight: .medium)) @@ -201,7 +260,7 @@ struct CourseActionRow: View { .lineLimit(1) Text(detail) .font(.system(size: 10.5)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) .lineLimit(2) } Spacer() @@ -234,7 +293,7 @@ struct CourseAttentionRow: View { .foregroundStyle(WeiBeiTheme.ink) Text(detail) .font(.system(size: 10.5)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) .lineLimit(2) } Spacer() @@ -305,7 +364,7 @@ func relationFooter( } else { Text(statusTitle) .font(.system(size: 10.5)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) } } .padding(.horizontal, 18) diff --git a/Sources/WeiBei/Views/CourseWorkspaceView.swift b/Sources/WeiBei/Views/CourseWorkspaceView.swift index 99c387f73..4ec349979 100644 --- a/Sources/WeiBei/Views/CourseWorkspaceView.swift +++ b/Sources/WeiBei/Views/CourseWorkspaceView.swift @@ -12,9 +12,9 @@ enum CourseWorkspacePage: String, CaseIterable, Identifiable { func label(language: WeiBeiInterfaceLanguage) -> String { switch self { case .overview: - language.text("总览", "Overview") + language.text("概览", "Overview") case .relations: - language.text("资料与笔记", "Materials & Notes") + language.text("课程内容", "Course Content") case .records: language.text("学习记录", "Learning Records") } @@ -30,9 +30,9 @@ enum CourseRelationLens: String, CaseIterable, Identifiable { func label(language: WeiBeiInterfaceLanguage) -> String { switch self { case .notes: - language.text("按笔记", "By Note") + language.text("笔记", "Notes") case .materials: - language.text("按资料", "By Material") + language.text("资料", "Materials") } } } @@ -210,7 +210,7 @@ private struct CourseNewNoteSheet: View { VStack(alignment: .leading, spacing: 6) { Text(store.ui("新建课程笔记", "New course note")) .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 20, weight: .semibold)) - Text(store.ui("新笔记会进入课程台,并保存到本地笔记目录。", "The note will appear in the course workspace and save locally.")) + Text(store.ui("新笔记会进入课程首页,并保存到本地笔记目录。", "The note will appear in the course home and save locally.")) .font(.system(size: 12)) .foregroundStyle(WeiBeiTheme.secondaryInk) } @@ -264,8 +264,8 @@ private struct CourseFolderImportSheet: View { Text(store.ui("确认 Markdown 的角色", "Classify Markdown files")) .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 20, weight: .semibold)) Text(store.ui( - "PDF、HTML 和文本会作为资料加入。请确认每个 Markdown 是课程资料还是笔记。", - "PDF, HTML, and text files are materials. Choose whether each Markdown file is material or a note." + "其他文件已经按资料处理。这里只需确认 Markdown 是课程资料还是笔记。", + "Other files are already materials. Only classify each Markdown file as material or note." )) .font(.system(size: 12)) .foregroundStyle(WeiBeiTheme.secondaryInk) @@ -295,9 +295,9 @@ private struct CourseFolderImportSheet: View { Text(url.deletingPathExtension().lastPathComponent) .font(.system(size: 13, weight: .medium)) .lineLimit(1) - Text(url.deletingLastPathComponent().path) + Text(relativeFolderLabel(for: url)) .font(.system(size: 10.5)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .foregroundStyle(WeiBeiTheme.secondaryInk) .lineLimit(1) .truncationMode(.middle) } @@ -309,7 +309,12 @@ private struct CourseFolderImportSheet: View { } .labelsHidden() .pickerStyle(.segmented) + .tint(WeiBeiTheme.cinnabar) .frame(width: 150) + .accessibilityLabel(Text(store.ui( + "\(url.deletingPathExtension().lastPathComponent) 的角色", + "Role for \(url.deletingPathExtension().lastPathComponent)" + ))) } .padding(.horizontal, 22) .frame(minHeight: 58) @@ -342,16 +347,36 @@ private struct CourseFolderImportSheet: View { Spacer() Button(store.ui("取消", "Cancel"), action: cancel) .keyboardShortcut(.cancelAction) - Button(store.ui("加入课程台", "Add to course")) { confirm(notePaths) } + Button(store.ui("添加到课程", "Add to course")) { confirm(notePaths) } + .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) .keyboardShortcut(.defaultAction) } .padding(.horizontal, 22) .frame(height: 54) } - .frame(width: 680, height: 560) + .frame(width: 680, height: sheetHeight) .background(WeiBeiTheme.paper) } + private var sheetHeight: CGFloat { + min(560, max(360, CGFloat(220 + draft.markdownFiles.count * 58))) + } + + private func relativeFolderLabel(for url: URL) -> String { + let folder = url.deletingLastPathComponent().standardizedFileURL + guard let root = draft.rootURLs.first?.standardizedFileURL else { + return folder.lastPathComponent + } + if folder == root { + return store.ui("课程根目录", "Course root") + } + let rootPrefix = root.path.hasSuffix("/") ? root.path : root.path + "/" + if folder.path.hasPrefix(rootPrefix) { + return String(folder.path.dropFirst(rootPrefix.count)) + } + return folder.lastPathComponent + } + private func roleBinding(for url: URL) -> Binding<Bool> { Binding( get: { notePaths.contains(url.path) }, @@ -391,12 +416,12 @@ struct CourseWorkspaceHeader: View { .contentShape(Rectangle()) } .buttonStyle(.plain) - .accessibilityLabel(Text(store.ui("关闭课程台并返回工作台", "Close course workspace"))) + .accessibilityLabel(Text(store.ui("关闭课程首页并返回工作台", "Close course home"))) VStack(alignment: .leading, spacing: 0) { - Text(store.ui("课程台", "Course Workspace")) + Text(store.ui("课程首页", "Course Home")) .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 20, weight: .semibold)) - Text(store.interfaceLanguage == .chinese ? "COURSE DESK" : "WEIBEI") + Text(store.interfaceLanguage == .chinese ? "COURSE HOME" : "WEIBEI") .font(WeiBeiTypography.englishBrandFont(size: 8.5, weight: .semibold)) .tracking(0.9) .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.74)) @@ -471,24 +496,17 @@ struct CourseWorkspaceHeader: View { Label(store.ui("新建笔记", "New note"), systemImage: "square.and.pencil") } } label: { - Label(store.ui("加入", "Add"), systemImage: "plus") + Label(store.ui("添加", "Add"), systemImage: "plus") .font(.system(size: 11, weight: .medium)) .foregroundStyle(WeiBeiTheme.secondaryInk) - .padding(.horizontal, 8) - .frame(height: 24) + .padding(.horizontal, 9) + .frame(height: 28) .background(WeiBeiTheme.paperInset.opacity(0.20)) .clipShape(RoundedRectangle(cornerRadius: 6)) } .menuStyle(.borderlessButton) .fixedSize() - .help(store.ui("加入课程文件夹、资料或笔记", "Add course folders, materials, or notes")) - - Button(action: dismiss) { - Image(systemName: "xmark") - } - .buttonStyle(WeiBeiIconButtonStyle(size: 28)) - .accessibilityLabel(Text(store.ui("关闭课程台", "Close course workspace"))) - .keyboardShortcut(.cancelAction) + .help(store.ui("添加课程文件夹、资料或笔记", "Add course folders, materials, or notes")) } .padding(.horizontal, 16) .frame(height: 52) @@ -500,7 +518,7 @@ struct CourseWorkspaceHeader: View { case .overview: store.ui("搜索课程", "Search course") case .relations: - store.ui("搜索资料与笔记", "Search materials and notes") + store.ui("搜索课程内容", "Search course content") case .records: store.ui("搜索学习记录", "Search learning records") } @@ -517,8 +535,8 @@ struct CourseWorkspaceTab: View { Text(title) .font(.system(size: 12.5, weight: active ? .semibold : .medium)) .foregroundStyle(active ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk) - .padding(.horizontal, 2) - .frame(height: 34) + .padding(.horizontal, 8) + .frame(height: 40) .overlay(alignment: .bottom) { Rectangle() .fill(active ? WeiBeiTheme.cinnabar : Color.clear) @@ -527,5 +545,6 @@ struct CourseWorkspaceTab: View { .contentShape(Rectangle()) } .buttonStyle(.plain) + .accessibilityAddTraits(active ? .isSelected : []) } } diff --git a/Sources/WeiBei/Views/LinkedSourcesView.swift b/Sources/WeiBei/Views/LinkedSourcesView.swift index 56135f589..598efa29c 100644 --- a/Sources/WeiBei/Views/LinkedSourcesView.swift +++ b/Sources/WeiBei/Views/LinkedSourcesView.swift @@ -126,7 +126,7 @@ struct LinkedSourcesPopover: View { store.presentCourseWorkspace(.notes, selecting: noteItemID) dismiss() } label: { - Label(store.ui("课程台", "Course"), systemImage: "books.vertical") + Label(store.ui("课程首页", "Course Home"), systemImage: "books.vertical") } .buttonStyle(WeiBeiTextActionButtonStyle()) diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift index 0a541fdf7..2339da00a 100644 --- a/Sources/WeiBei/Views/ReaderView.swift +++ b/Sources/WeiBei/Views/ReaderView.swift @@ -2484,7 +2484,7 @@ private struct EmptyReaderView: View { var body: some View { ReaderStateMessage( title: store.ui("选择资料", "Choose Material"), - detail: store.ui("从资料库打开 HTML、PDF 或 Markdown。", "Open HTML, PDF, or Markdown from the library."), + detail: store.ui("从课程目录打开 HTML、PDF 或 Markdown。", "Open HTML, PDF, or Markdown from the course index."), systemImage: "doc.text.magnifyingglass" ) } diff --git a/Sources/WeiBei/Views/SidebarView.swift b/Sources/WeiBei/Views/SidebarView.swift index 839cc9708..9b1b93d43 100644 --- a/Sources/WeiBei/Views/SidebarView.swift +++ b/Sources/WeiBei/Views/SidebarView.swift @@ -10,12 +10,22 @@ struct SidebarView: View { VStack(spacing: 0) { HStack(alignment: .firstTextBaseline) { VStack(alignment: .leading, spacing: 1) { - Text(store.ui("资料库", "Library")) + Text(store.ui("课程目录", "Course Index")) .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 22, weight: .semibold)) - Text(store.interfaceLanguage == .chinese ? "WEIBEI STUDY" : "WEIBEI") - .font(WeiBeiTypography.englishBrandFont(size: 8.5, weight: .semibold)) - .tracking(0.9) - .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.74)) + Button { + store.presentCourseWorkspace() + } label: { + HStack(spacing: 3) { + Text(store.ui("课程首页", "Course Home")) + Image(systemName: "chevron.right") + .font(.system(size: 8, weight: .bold)) + } + .font(.system(size: 10.5, weight: .semibold)) + .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.78)) + } + .buttonStyle(.plain) + .accessibilityLabel(Text(store.ui("打开课程首页", "Open course home"))) + .help(store.ui("打开课程首页", "Open course home")) } Spacer() Button { store.importFilesFromPanel() } label: { @@ -32,7 +42,7 @@ struct SidebarView: View { TextField( "", text: $store.librarySearch, - prompt: Text(store.ui("搜索资料与笔记", "Search materials and notes")) + prompt: Text(store.ui("搜索课程资料与笔记", "Search course materials and notes")) .font(.system(size: 13)) .foregroundStyle(WeiBeiTheme.placeholderInk) ) @@ -53,9 +63,9 @@ struct SidebarView: View { ScrollView(showsIndicators: false) { LazyVStack(alignment: .leading, spacing: 14) { - sidebarSection(title: store.ui("课程资料", "Course Materials"), items: store.sampleItems) - sidebarSection(title: store.ui("导入资料", "Imported Materials"), items: importedMaterialItems) - sidebarSection(title: store.ui("我的笔记", "My Notes"), items: notebookItems) + sidebarSection(title: store.ui("内置示例", "Built-in Examples"), items: store.sampleItems) + sidebarSection(title: store.ui("课程资料", "Course Materials"), items: importedMaterialItems) + sidebarSection(title: store.ui("课程笔记", "Course Notes"), items: notebookItems) } .padding(.horizontal, 10) .padding(.vertical, 10) diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 9da6c5c5e..52ff14a0b 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -1437,8 +1437,8 @@ expect(contentViewSource.contains("store.toggleLibrary()") && contentViewSource.contains("sidebar.left") && contentViewSource.contains("private var libraryButton: some View") && contentViewSource.contains("active: store.showLibrary") - && contentViewSource.contains("store.showLibrary ? store.ui(\"收起资料库\"") - && !contentViewSource.contains("恢复资料库") + && contentViewSource.contains("store.showLibrary ? store.ui(\"收起课程目录\"") + && !contentViewSource.contains("恢复课程目录") && !contentViewSource.contains(".opacity(isImmersiveLayout ? 0.45 : 1)"), "immersive top bar keeps a clear stateful library chooser instead of dimming a live control") if let leftControlsStart = contentViewSource.range(of: "private var leftPrimaryControls: some View")?.lowerBound, let leftControlsEnd = contentViewSource[leftControlsStart...].range(of: "\n }\n\n @ViewBuilder\n private var brandBlock")?.lowerBound { @@ -1447,7 +1447,9 @@ if let leftControlsStart = contentViewSource.range(of: "private var leftPrimaryC let navigationRange = leftControlsSource.range(of: "navigationButtons"), let settingsRange = leftControlsSource.range(of: "settingsMenu") { expect(libraryRange.lowerBound < navigationRange.lowerBound - && navigationRange.lowerBound < settingsRange.lowerBound, "top-left controls keep library first, then back/forward, then settings") + && navigationRange.lowerBound < settingsRange.lowerBound + && !leftControlsSource.contains("books.vertical") + && !leftControlsSource.contains("presentCourseWorkspace"), "top-left controls keep one course-index entry before navigation and settings") } else { expect(false, "top-left controls expose library, navigation, and settings controls") } @@ -1544,10 +1546,12 @@ expect(themeSource.contains("language.text(\"标准\"") let sidebarSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/SidebarView.swift") let sidebarSource = (try? String(contentsOf: sidebarSourceURL, encoding: .utf8)) ?? "" -expect(sidebarSource.contains("Text(store.ui(\"资料库\", \"Library\")") - && sidebarSource.contains("prompt: Text(store.ui(\"搜索资料与笔记\"") +expect(sidebarSource.contains("Text(store.ui(\"课程目录\", \"Course Index\")") + && sidebarSource.contains("Text(store.ui(\"课程首页\", \"Course Home\")") + && sidebarSource.contains("store.presentCourseWorkspace()") + && sidebarSource.contains("prompt: Text(store.ui(\"搜索课程资料与笔记\"") && sidebarSource.contains(".foregroundStyle(WeiBeiTheme.placeholderInk)") - && sidebarSource.contains(".foregroundColor(WeiBeiTheme.ink)"), "library search clearly covers materials and notes with readable ink") + && sidebarSource.contains(".foregroundColor(WeiBeiTheme.ink)"), "course index exposes a textual course-home path and searches materials and notes with readable ink") let notesAgentSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/NotesAgentView.swift") let notesAgentSource = (try? String(contentsOf: notesAgentSourceURL, encoding: .utf8)) ?? "" @@ -1621,7 +1625,9 @@ expect(notesAgentSource.contains("private func refreshSourcePresentation(in text && notesAgentSource.contains("case .insertMarkdown"), "source editor refreshes callout presentation after agent, command, or attachment insertions") expect(!sidebarSource.contains("commandPalettePresented.toggle()") && !sidebarSource.contains("Label(\"命令\", systemImage: \"command\")"), "sidebar does not duplicate the command palette entry") expect(sidebarSource.contains("ScrollView(showsIndicators: false)"), "sidebar hides the heavy system scroll indicator that reads as a divider") -expect(sidebarSource.contains("sidebarSection(title: store.ui(\"导入资料\"") && sidebarSource.contains("sidebarSection(title: store.ui(\"我的笔记\""), "library separates imported materials from notebook notes") +expect(sidebarSource.contains("sidebarSection(title: store.ui(\"内置示例\"") + && sidebarSource.contains("sidebarSection(title: store.ui(\"课程资料\"") + && sidebarSource.contains("sidebarSection(title: store.ui(\"课程笔记\""), "course index separates built-in examples, course materials, and course notes") expect(sidebarSource.contains("!$0.isSample && !$0.isNotebookNote") && sidebarSource.contains("store.filteredItems.filter(\\.isNotebookNote)"), "sidebar material list excludes notebook notes without hiding notes") expect(sidebarSource.contains("item.isNotebookNote ? store.activeNotebookItemID == item.id : store.selectedItemID == item.id"), "sidebar highlights the active notebook note separately from the selected reader material") expect(sidebarSource.contains(".contextMenu") @@ -1655,8 +1661,8 @@ expect(commandPaletteSource.contains("PaletteCommand(title: store.ui(\"聚焦对 && !commandPaletteSource.contains("PaletteCommand(title: \"聚焦 Agent\""), "command palette names the conversation pane by task language") expect(!commandPaletteSource.contains("收起右栏"), "command palette avoids fixed right-pane wording") expect(!commandPaletteSource.contains("Agent 整理资料与笔记") && !commandPaletteSource.contains("本地排序资料库"), "command palette avoids half-built library organization shortcuts") -expect(commandPaletteSource.contains("store.showLibrary ? store.ui(\"收起资料库\"") - && commandPaletteSource.contains("PaletteCommand(title: store.ui(\"聚焦资料库\"") +expect(commandPaletteSource.contains("store.showLibrary ? store.ui(\"收起课程目录\"") + && commandPaletteSource.contains("PaletteCommand(title: store.ui(\"聚焦课程目录\"") && !commandPaletteSource.contains("恢复资料"), "command palette names the unified library action explicitly") expect(!commandPaletteSource.contains("PaletteCommand(title: \"顶栏") && contentViewSource.contains("Section(store.ui(\"顶部栏\""), "top bar variants live in the settings menu instead of the command palette") expect(commandPaletteSource.contains("private var rightPaneCommand: PaletteCommand?") && commandPaletteSource.contains("store.layout.hasCollapsibleRightPane"), "command palette hides right pane command when the layout has no auxiliary pane") @@ -2287,9 +2293,15 @@ expect(workspaceStoreSource.contains("func presentCourseWorkspace(") && courseWorkspaceSource.contains("确认 Markdown 的角色") && courseWorkspaceSource.contains("guard let noteID = store.createCourseNotebookNote") && courseWorkspaceSource.contains("newNoteError = store.noteFileError") - && appSource.contains("打开课程台") - && commandPaletteSource.contains("打开课程台") + && appSource.contains("打开课程首页") + && commandPaletteSource.contains("打开课程首页") + && sidebarSource.contains("store.presentCourseWorkspace()") && linkedSourcesSource.contains("store.presentCourseWorkspace(.notes"), "course workspace is reachable from top-level commands and note relationships, while explicit open actions own navigation") +expect(workspaceStoreSource.contains("scenario == \"course-index-navigation-flow\"") + && workspaceStoreSource.contains("showLibrary = true") + && workspaceStoreSource.contains("showReader = false") + && workspaceStoreSource.contains("showAgent = false") + && workspaceStoreSource.contains("showNotes = false"), "course-index verification owns a quiet real-window state for the unified navigation path") expect(workspaceStoreSource.contains("noteSourceRelationIndex = NoteSourceRelationIndex(links: noteSourceLinks)") && workspaceStoreSource.contains("func linkedNoteCount(for sourceItemID: String)") && workspaceStoreSource.contains("verifyCourseOverlayContinuity(itemID:") @@ -2313,9 +2325,8 @@ expect(workspaceStoreSource.contains("var brandLatinName: String") && contentViewSource.contains("WeiBeiTypography.englishBrandFont(size: variant == .wide ? 17 : 16") && appSource.contains("Text(store.brandLatinName)") && appSource.contains("WeiBeiTypography.englishBrandFont(size: 18") - && sidebarSource.contains("WEIBEI STUDY") && notesAgentSource.contains("latinMark: store.interfaceLanguage == .chinese ? \"NOTES\" : nil") - && notesAgentSource.contains("latinMark: store.interfaceLanguage == .chinese ? \"CHAT\" : nil"), "custom English font has visible Latin brand marks in the top bar, settings, library, and pane headers") + && notesAgentSource.contains("latinMark: store.interfaceLanguage == .chinese ? \"CHAT\" : nil"), "custom English font has visible Latin brand marks in the top bar, settings, and pane headers") expect(notesAgentSource.contains("ForEach(NoteRenderMode.visibleCases)") && notesAgentSource.contains("switch store.noteRenderMode.visibleMode") && !notesAgentSource.contains("ForEach(NoteRenderMode.allCases)") @@ -2882,7 +2893,7 @@ expect(appSource.contains("Button(store.sendAgentActionTitle)") && workspaceStor expect(appSource.contains("if store.isAskingAgent || !store.agentDraft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty") && appSource.contains("store.isAskingAgent ? store.cancelAgentRequest() : store.askAgent()") && appSource.contains(".keyboardShortcut(.return, modifiers: [.command])"), "app menu hides the agent send action until a draft can really send") -expect(appSource.contains("Button(store.showLibrary ? store.ui(\"收起资料库\"") +expect(appSource.contains("Button(store.showLibrary ? store.ui(\"收起课程目录\"") && !appSource.contains("恢复资料") && appSource.contains("Button(store.showRightPane ? store.ui(\"收起辅助栏\""), "app menu names pane toggles by current state") expect(appSource.contains("Button(store.ui(\"三栏工作台\", \"Three-Pane Workspace\"))") @@ -2906,7 +2917,7 @@ expect(appSource.contains("if store.layout.hasCollapsibleRightPane") && appSource.contains("if store.canApplyAgentAnswer") && appSource.contains("if store.canReplaceNoteSelection") && !appSource.contains(".disabled("), "app menu hides unavailable actions instead of showing disabled grey items") -expect(appSource.contains("Button(store.ui(\"聚焦资料库\"") +expect(appSource.contains("Button(store.ui(\"聚焦课程目录\"") && appSource.contains("{ animateLayout { store.focus(.library) } }") && appSource.contains("Button(store.ui(\"聚焦对话\"") && appSource.contains("{ animateLayout { store.focus(.agent) } }") From aaf13e5588d6b2e13b63fbe62750fcd9940b259e Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Tue, 14 Jul 2026 22:53:05 +0800 Subject: [PATCH 25/36] fix: preserve Pi startup cancellation --- Sources/WeiBeiCore/PiAgentRuntime.swift | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Sources/WeiBeiCore/PiAgentRuntime.swift b/Sources/WeiBeiCore/PiAgentRuntime.swift index 635954d2f..ba3c51733 100644 --- a/Sources/WeiBeiCore/PiAgentRuntime.swift +++ b/Sources/WeiBeiCore/PiAgentRuntime.swift @@ -302,6 +302,8 @@ public actor PiAgentRuntime: StudyAgentRuntime { private var stderrTask: Task<Void, Never>? private var pendingCommands: [String: PendingCommand] = [:] private var activeRun: ActiveRun? + private var startingRunID: UUID? + private var cancelledStartingRunIDs: Set<UUID> = [] private var stderrBuffer = "" private var startupFailure: PiAgentRuntimeError? private var idleShutdownTask: Task<Void, Never>? @@ -327,12 +329,21 @@ public actor PiAgentRuntime: StudyAgentRuntime { } public func respond(to request: StudyAgentRequest, progress: StudyAgentProgressHandler?) async throws -> StudyAgentReply { - guard activeRun == nil else { throw PiAgentRuntimeError.busy } + guard activeRun == nil, startingRunID == nil else { throw PiAgentRuntimeError.busy } + startingRunID = request.id + defer { + if startingRunID == request.id { + startingRunID = nil + } + cancelledStartingRunIDs.remove(request.id) + } idleShutdownTask?.cancel() idleShutdownTask = nil try await ensureProcess() + try requireStartingRun(request.id) _ = try await sendCommand(type: "new_session", timeoutSeconds: 3) + try requireStartingRun(request.id) let context = StudyAgentContextEnvelope(request: request) try writeContext(context) await progress?(.readingContext) @@ -359,8 +370,8 @@ public actor PiAgentRuntime: StudyAgentRuntime { allowedNoteSourceLabels: currentSourceLabels(in: context), progress: progress ) + startingRunID = nil refreshRunWatchdog() - do { _ = try await sendCommand( type: "prompt", @@ -378,8 +389,20 @@ public actor PiAgentRuntime: StudyAgentRuntime { } public func cancel() async { - guard let runID = activeRun?.id else { return } - await cancelRun(id: runID) + if let runID = activeRun?.id { + await cancelRun(id: runID) + return + } + guard let runID = startingRunID else { return } + cancelledStartingRunIDs.insert(runID) + startingRunID = nil + shutdownProcess(reason: PiAgentRuntimeError.cancelled) + } + + private func requireStartingRun(_ runID: UUID) throws { + guard startingRunID == runID, !cancelledStartingRunIDs.contains(runID) else { + throw PiAgentRuntimeError.cancelled + } } private func cancelRun(id runID: UUID) async { From d032feae178c06e488188a382a531784e637a931 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Tue, 14 Jul 2026 23:05:23 +0800 Subject: [PATCH 26/36] fix: extend Pi startup readiness window --- Sources/WeiBeiCore/PiAgentRuntime.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sources/WeiBeiCore/PiAgentRuntime.swift b/Sources/WeiBeiCore/PiAgentRuntime.swift index ba3c51733..184d60c77 100644 --- a/Sources/WeiBeiCore/PiAgentRuntime.swift +++ b/Sources/WeiBeiCore/PiAgentRuntime.swift @@ -262,6 +262,8 @@ public enum PiAgentDiagnosticSanitizer { } public actor PiAgentRuntime: StudyAgentRuntime { + private static let processReadinessTimeoutSeconds: UInt64 = 12 + private struct PendingCommand { var continuation: CheckedContinuation<PiRPCResponse, Error> var timeoutTask: Task<Void, Never> @@ -487,11 +489,17 @@ public actor PiAgentRuntime: StudyAgentRuntime { stderrTask = readStderr(errorPipe.fileHandleForReading) do { - let state = try await sendCommand(type: "get_state", timeoutSeconds: 3) + let state = try await sendCommand( + type: "get_state", + timeoutSeconds: Self.processReadinessTimeoutSeconds + ) guard state.dataJSON != nil else { throw PiAgentRuntimeError.protocolFailure("get_state returned no data") } - let commands = try await sendCommand(type: "get_commands", timeoutSeconds: 3) + let commands = try await sendCommand( + type: "get_commands", + timeoutSeconds: Self.processReadinessTimeoutSeconds + ) try verifyRequiredSkills(in: commands) if let startupFailure { throw startupFailure } } catch { From ea81cd72aac8739d927e1399fbe7ac607b756fa5 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Tue, 14 Jul 2026 23:39:59 +0800 Subject: [PATCH 27/36] fix: refine empty workspace composition # Conflicts: # Sources/WeiBeiSelfCheck/main.swift --- .../Views/EmptyWorkspaceLauncherView.swift | 184 ++++++++++-------- Sources/WeiBeiSelfCheck/main.swift | 38 +++- 2 files changed, 139 insertions(+), 83 deletions(-) diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index d607d3919..6a8fa58c2 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -2,6 +2,17 @@ import AppKit import SwiftUI import WeiBeiCore +private enum EmptyWorkspaceLayoutMetrics { + static let compactWidthThreshold: CGFloat = 1140 + static let compactHeightThreshold: CGFloat = 680 + static let entryCenterRatio: CGFloat = 0.402 + static let inspirationCenterRatio: CGFloat = 0.66 + static let contentMaxWidth: CGFloat = 760 + static let inspirationMaxWidth: CGFloat = 660 + static let inspirationSlotHeight: CGFloat = 210 + static let compactInspirationSlotHeight: CGFloat = 176 +} + struct EmptyWorkspaceLauncherView: View { @EnvironmentObject private var store: WorkspaceStore @Environment(\.accessibilityReduceMotion) private var reduceMotion @@ -11,10 +22,13 @@ struct EmptyWorkspaceLauncherView: View { var body: some View { TimelineView(.periodic(from: .now, by: 60)) { timeline in GeometryReader { geometry in - let compact = geometry.size.width < 760 || geometry.size.height < 620 + let compact = geometry.size.width < EmptyWorkspaceLayoutMetrics.compactWidthThreshold + || geometry.size.height < EmptyWorkspaceLayoutMetrics.compactHeightThreshold let horizontalPadding: CGFloat = compact ? 24 : 52 let entryWidth = min(116, max(76, (geometry.size.width - (horizontalPadding * 2) - 2) / 3)) - let inspirationSlotHeight: CGFloat = compact ? 176 : 210 + let inspirationSlotHeight = compact + ? EmptyWorkspaceLayoutMetrics.compactInspirationSlotHeight + : EmptyWorkspaceLayoutMetrics.inspirationSlotHeight let currentInspiration = inspiration(at: timeline.date) ZStack { @@ -23,6 +37,7 @@ struct EmptyWorkspaceLauncherView: View { workspaceContent( at: timeline.date, inspiration: currentInspiration, + availableSize: geometry.size, compact: compact, horizontalPadding: horizontalPadding, entryWidth: entryWidth, @@ -39,23 +54,49 @@ struct EmptyWorkspaceLauncherView: View { private func workspaceContent( at date: Date, inspiration: EmptyWorkspaceInspiration, + availableSize: CGSize, compact: Bool, horizontalPadding: CGFloat, entryWidth: CGFloat, inspirationSlotHeight: CGFloat ) -> some View { - if store.showDailyInspiration { - VStack(spacing: 0) { - Spacer(minLength: compact ? 18 : 38) - - entryCluster( - at: date, - spacing: compact ? 14 : 19, - entryWidth: entryWidth - ) + let contentWidth = max( + 1, + min(EmptyWorkspaceLayoutMetrics.contentMaxWidth, availableSize.width - horizontalPadding * 2) + ) + let entryHeight: CGFloat = compact ? 84 : 98 + let entryCenterRatio: CGFloat = store.showDailyInspiration ? EmptyWorkspaceLayoutMetrics.entryCenterRatio : 0.5 + let entryCenterY = clampedCenterY( + ratio: entryCenterRatio, + elementHeight: entryHeight, + availableHeight: availableSize.height, + edgeInset: compact ? 14 : 20 + ) + let minimumInspirationCenterY = max( + clampedCenterY( + ratio: EmptyWorkspaceLayoutMetrics.inspirationCenterRatio, + elementHeight: inspirationSlotHeight, + availableHeight: availableSize.height, + edgeInset: compact ? 12 : 18 + ), + entryCenterY + entryHeight / 2 + (compact ? 12 : 20) + inspirationSlotHeight / 2 + ) + let inspirationCenterY = min( + minimumInspirationCenterY, + availableSize.height - (compact ? 12 : 18) - inspirationSlotHeight / 2 + ) - Spacer(minLength: compact ? 18 : 34) + ZStack { + entryCluster( + at: date, + compact: compact, + spacing: store.showDailyInspiration ? (compact ? 18 : 26) : (compact ? 16 : 29), + entryWidth: entryWidth + ) + .frame(width: contentWidth) + .position(x: availableSize.width / 2, y: entryCenterY) + if store.showDailyInspiration { ZStack { EmptyWorkspaceInspirationView( inspiration: inspiration, @@ -65,58 +106,44 @@ struct EmptyWorkspaceLauncherView: View { .id(inspiration.id) .transition(.opacity) } - .frame(height: inspirationSlotHeight) - - Spacer(minLength: compact ? 20 : 42) - } - .frame(maxWidth: 760) - .padding(.horizontal, horizontalPadding) - .padding(.vertical, compact ? 4 : 10) - } else { - VStack(spacing: 0) { - Spacer(minLength: compact ? 20 : 40) - entryCluster( - at: date, - spacing: compact ? 16 : 29, - entryWidth: entryWidth + .frame( + width: min(EmptyWorkspaceLayoutMetrics.inspirationMaxWidth, contentWidth), + height: inspirationSlotHeight ) - .offset(y: compact ? 0 : 5) - Spacer(minLength: compact ? 20 : 40) + .position(x: availableSize.width / 2, y: inspirationCenterY) } - .frame(maxWidth: 760, maxHeight: .infinity) - .padding(.horizontal, horizontalPadding) - .padding(.vertical, compact ? 4 : 10) } + .frame(maxWidth: .infinity, maxHeight: .infinity) } - private func entryCluster(at date: Date, spacing: CGFloat, entryWidth: CGFloat) -> some View { - VStack(spacing: spacing) { - greeting(at: date) - EmptyWorkspaceEntryRow(entryWidth: entryWidth) - } + private func clampedCenterY( + ratio: CGFloat, + elementHeight: CGFloat, + availableHeight: CGFloat, + edgeInset: CGFloat + ) -> CGFloat { + let halfHeight = elementHeight / 2 + return min( + max(availableHeight * ratio, edgeInset + halfHeight), + availableHeight - edgeInset - halfHeight + ) } - private func greeting(at date: Date) -> some View { - HStack(spacing: 12) { - greetingRule - - Text(EmptyWorkspaceDayPeriod.current(at: date).greeting(language: store.interfaceLanguage)) - .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: 14.5, weight: .regular)) - .tracking(store.interfaceLanguage == .chinese ? 0.8 : 0.35) - .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.92)) - .multilineTextAlignment(.center) - .fixedSize(horizontal: false, vertical: true) - .accessibilityIdentifier("empty-workspace-greeting") - - greetingRule + private func entryCluster(at date: Date, compact: Bool, spacing: CGFloat, entryWidth: CGFloat) -> some View { + VStack(spacing: spacing) { + greeting(at: date, compact: compact) + EmptyWorkspaceEntryRow(entryWidth: entryWidth) } } - private var greetingRule: some View { - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(0.76)) - .frame(width: 18, height: 1) - .accessibilityHidden(true) + private func greeting(at date: Date, compact: Bool) -> some View { + Text(EmptyWorkspaceDayPeriod.current(at: date).greeting(language: store.interfaceLanguage)) + .font(WeiBeiTypography.brandFont(language: store.interfaceLanguage, size: compact ? 14.5 : 16, weight: .regular)) + .tracking(store.interfaceLanguage == .chinese ? 0.8 : 0.35) + .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.92)) + .multilineTextAlignment(.center) + .fixedSize(horizontal: false, vertical: true) + .accessibilityIdentifier("empty-workspace-greeting") } private func inspiration(at date: Date) -> EmptyWorkspaceInspiration { @@ -186,18 +213,11 @@ private struct EmptyWorkspacePaperField: View { endPoint: .bottomTrailing ) - VStack(spacing: 0) { - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(0.30)) - .frame(width: 1, height: compact ? 24 : 48) - - Spacer() - - Rectangle() - .fill(WeiBeiTheme.hairline.opacity(0.22)) - .frame(width: 1, height: compact ? 28 : 58) - } - .padding(.vertical, compact ? 14 : 24) + Rectangle() + .fill(WeiBeiTheme.hairline.opacity(0.30)) + .frame(width: 1, height: compact ? 24 : 48) + .frame(maxHeight: .infinity, alignment: .top) + .padding(.top, compact ? 14 : 24) } .allowsHitTesting(false) .accessibilityHidden(true) @@ -268,7 +288,7 @@ private struct EmptyWorkspaceEntryButton: View { Button(action: action) { VStack(spacing: 2) { Text(title) - .font(WeiBeiTypography.englishBrandFont(size: 20, weight: .semibold)) + .font(WeiBeiTypography.englishBrandFont(size: 22, weight: .semibold)) .tracking(active ? 3.5 : 2.2) .foregroundStyle(active ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk.opacity(0.88)) .offset(y: active && !reduceMotion ? -2.5 : 0) @@ -365,14 +385,14 @@ private struct EmptyWorkspaceInspirationView: View { @FocusState private var focused: Bool var body: some View { - VStack(spacing: compact ? 7 : 9) { + VStack(spacing: compact ? 7 : 8) { Button(action: onAdvance) { - VStack(spacing: compact ? 8 : 11) { + VStack(spacing: compact ? 8 : 9) { inspirationContent Text(inspiration.credit) - .font(.system(size: compact ? 10.5 : 11.5, weight: .medium, design: .serif)) - .foregroundStyle(WeiBeiTheme.secondaryInk) + .font(.system(size: compact ? 11 : 12, weight: .medium, design: .serif)) + .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.86)) .multilineTextAlignment(.center) .lineLimit(2) @@ -404,10 +424,10 @@ private struct EmptyWorkspaceInspirationView: View { Text("→") .offset(x: hovering && !reduceMotion ? 2 : 0) } - .font(.system(size: compact ? 8.5 : 9, weight: .medium, design: .serif)) + .font(.system(size: compact ? 9.5 : 10.5, weight: .medium, design: .serif)) .tracking(store.interfaceLanguage == .chinese ? 0.7 : 1.2) - .foregroundStyle(WeiBeiTheme.tertiaryInk) - .opacity(hovering || focused ? 0.94 : 0.56) + .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.82)) + .opacity(hovering || focused ? 1 : 0.78) .accessibilityHidden(true) } @@ -421,22 +441,22 @@ private struct EmptyWorkspaceInspirationView: View { .resizable() .scaledToFit() .foregroundStyle(WeiBeiTheme.ink.opacity(0.88)) - .frame(maxWidth: compact ? 390 : 500, maxHeight: compact ? 54 : 72) + .frame(maxWidth: compact ? 390 : 470, maxHeight: compact ? 54 : 64) .padding(.vertical, compact ? 1 : 2) .accessibilityLabel(Text(inspiration.text)) } else { - inspirationText(size: compact ? 24 : 30) + inspirationText(size: compact ? 21 : 24) } case .quotation: - inspirationText(size: compact ? 21 : 26) + inspirationText(size: compact ? 20 : 23.5) case .formula: - formulaContent(size: compact ? 24 : 30) + formulaContent(size: compact ? 21 : 24) } } private func formulaContent(size: CGFloat) -> some View { formulaText(size: size) - .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.78)) .multilineTextAlignment(.center) .lineLimit(1) .minimumScaleFactor(0.78) @@ -471,7 +491,7 @@ private struct EmptyWorkspaceInspirationView: View { private func inspirationText(size: CGFloat) -> some View { Text(inspiration.text) .font(.system(size: size, weight: .regular, design: .serif)) - .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.78)) .multilineTextAlignment(.center) .lineLimit(compact ? 3 : 2) .minimumScaleFactor(compact ? 0.72 : 0.78) @@ -492,8 +512,8 @@ private struct EmptyWorkspaceInspirationView: View { rightsLink } } - .font(.system(size: compact ? 9 : 9.5, weight: .regular)) - .foregroundStyle(WeiBeiTheme.tertiaryInk) + .font(.system(size: compact ? 9.5 : 10.5, weight: .regular)) + .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.78)) .multilineTextAlignment(.center) .lineLimit(2) } diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 52ff14a0b..c4c586c41 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -142,6 +142,14 @@ CTFontManagerRegisterFontsForURL(displayFontURL as CFURL, .process, nil) CTFontManagerRegisterFontsForURL(monoFontURL as CFURL, .process, nil) expect(NSFont(name: "WeiBeiStele-Regular", size: 18) != nil && NSFont(name: "WeiBeiSteleMono-Regular", size: 13) != nil, "bundled WeiBei English fonts register under their PostScript names") +let emptyWorkspaceEntryFont = CTFontCreateWithName("WeiBeiStele-Regular" as CFString, 22, nil) +let emptyWorkspaceEntryCharacters = Array("DOCCHATNOTES".utf16) +var emptyWorkspaceEntryGlyphs = Array(repeating: CGGlyph(), count: emptyWorkspaceEntryCharacters.count) +expect(emptyWorkspaceEntryCharacters.withUnsafeBufferPointer { characters in + emptyWorkspaceEntryGlyphs.withUnsafeMutableBufferPointer { glyphs in + CTFontGetGlyphsForCharacters(emptyWorkspaceEntryFont, characters.baseAddress!, glyphs.baseAddress!, characters.count) + } +} && emptyWorkspaceEntryGlyphs.allSatisfy { $0 != 0 }, "WeiBeiStele keeps every glyph required by the DOC, CHAT, and NOTES work entries") func inspectCalligraphyAsset(_ url: URL) throws -> (width: Int, height: Int, visible: Int, transparent: Int, opaqueWhite: Int, outerInk: Int) { let data = try Data(contentsOf: url) @@ -1333,9 +1341,37 @@ expect(emptyWorkspaceSource.contains("WeiBeiTypography.englishBrandFont") && !emptyWorkspaceSource.contains("stroke(WeiBeiTheme.cinnabar"), "empty workspace entry uses WeiBei English lettering, hairlines, and whitespace without cards, pills, or red outlines") expect(emptyWorkspaceSource.contains("TimelineView(.periodic(from: .now, by: 60))") && emptyWorkspaceSource.contains("EmptyWorkspaceDayPeriod.current(at:") - && emptyWorkspaceSource.contains("geometry.size.width < 760 || geometry.size.height < 620") + && emptyWorkspaceSource.contains("static let compactWidthThreshold: CGFloat = 1140") + && emptyWorkspaceSource.contains("static let compactHeightThreshold: CGFloat = 680") + && emptyWorkspaceSource.contains("geometry.size.width < EmptyWorkspaceLayoutMetrics.compactWidthThreshold") && emptyWorkspaceSource.contains("min(116, max(76") && emptyWorkspaceSource.contains("minimumScaleFactor(0.78)"), "empty workspace greeting updates with time and its entry and inspiration typography adapt to compact windows") +expect(emptyWorkspaceSource.contains("selectedInspirationID") + && emptyWorkspaceSource.contains("randomItem(excludingID: currentID") + && emptyWorkspaceSource.contains("static let entryCenterRatio: CGFloat = 0.402") + && emptyWorkspaceSource.contains("static let inspirationCenterRatio: CGFloat = 0.66") + && emptyWorkspaceSource.contains("let entryCenterY = clampedCenterY(") + && emptyWorkspaceSource.contains("let minimumInspirationCenterY = max(") + && emptyWorkspaceSource.contains("let inspirationCenterY = min(") + && emptyWorkspaceSource.contains(".position(x: availableSize.width / 2, y: entryCenterY)") + && emptyWorkspaceSource.contains(".position(x: availableSize.width / 2, y: inspirationCenterY)") + && emptyWorkspaceSource.contains("let inspirationSlotHeight = compact") + && emptyWorkspaceSource.contains("height: inspirationSlotHeight") + && emptyWorkspaceSource.contains("private func workspaceContent(") + && emptyWorkspaceSource.contains("if store.showDailyInspiration") + && emptyWorkspaceSource.contains(".frame(maxWidth: .infinity, maxHeight: .infinity)") + && emptyWorkspaceSource.contains("private func entryCluster(") + && emptyWorkspaceSource.contains("let entryCenterRatio: CGFloat = store.showDailyInspiration ? EmptyWorkspaceLayoutMetrics.entryCenterRatio : 0.5") + && emptyWorkspaceSource.contains(".id(inspiration.id)") + && emptyWorkspaceSource.contains(".transition(.opacity)") + && emptyWorkspaceSource.contains("随机换一则") + && emptyWorkspaceSource.contains("WeiBeiTypography.englishBrandFont(size: 22, weight: .semibold)") + && emptyWorkspaceSource.contains("foregroundStyle(WeiBeiTheme.ink.opacity(0.78))") + && emptyWorkspaceSource.contains("foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.86))") + && !emptyWorkspaceSource.contains("greetingRule") + && !emptyWorkspaceSource.contains("inspirationCounter") + && !emptyWorkspaceSource.contains("%02d / %02d") + && !emptyWorkspaceSource.contains("inspirationOffset"), "empty workspace inspiration switches randomly without repeating the current item or showing catalog counters") expect(emptyWorkspaceSource.contains("if store.showDailyInspiration") && emptyWorkspaceSource.contains("EmptyWorkspaceInspirationCatalog.item") && emptyWorkspaceSource.contains("case \"empty-workspace-calligraphy-light\":") From 2e1d26e74e5104fdad72f02da2d1dd603abbfab6 Mon Sep 17 00:00:00 2001 From: changfenhuang <138446308+taekchef@users.noreply.github.com> Date: Wed, 15 Jul 2026 02:59:20 +0800 Subject: [PATCH 28/36] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E7=A9=BA=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8C=BA=E7=81=B5=E6=84=9F=E5=86=85=E5=AE=B9=E7=9A=84?= =?UTF-8?q?=E8=A7=86=E8=A7=89=E5=B1=82=E7=BA=A7=20(#4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 经浅色宽窗、深色窄窗和书法场景真窗口验收后合入课程整合线。 --- .../Views/EmptyWorkspaceLauncherView.swift | 47 +++++-------------- Sources/WeiBeiSelfCheck/main.swift | 8 +++- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift index 6a8fa58c2..e3b6be418 100644 --- a/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift +++ b/Sources/WeiBei/Views/EmptyWorkspaceLauncherView.swift @@ -375,37 +375,27 @@ private struct EmptyWorkspaceAlwaysActiveHoverRegion: NSViewRepresentable { private struct EmptyWorkspaceInspirationView: View { @EnvironmentObject private var store: WorkspaceStore - @Environment(\.accessibilityReduceMotion) private var reduceMotion let inspiration: EmptyWorkspaceInspiration let compact: Bool let onAdvance: () -> Void - @State private var hovering = false - @FocusState private var focused: Bool - var body: some View { - VStack(spacing: compact ? 7 : 8) { + VStack(spacing: compact ? 7 : 9) { Button(action: onAdvance) { - VStack(spacing: compact ? 8 : 9) { + VStack(spacing: compact ? 8 : 11) { inspirationContent Text(inspiration.credit) - .font(.system(size: compact ? 11 : 12, weight: .medium, design: .serif)) - .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.86)) + .font(.system(size: compact ? 10.5 : 11.5, weight: .medium, design: .serif)) + .foregroundStyle(WeiBeiTheme.secondaryInk) .multilineTextAlignment(.center) .lineLimit(2) - - advanceLabel } .frame(maxWidth: .infinity) .contentShape(Rectangle()) } .buttonStyle(.plain) - .focused($focused) - .onHover { hovering = $0 } - .animation(reduceMotion ? nil : .easeOut(duration: 0.20), value: hovering) - .animation(reduceMotion ? nil : .easeOut(duration: 0.18), value: focused) .accessibilityElement(children: .ignore) .accessibilityLabel(Text("\(inspiration.text),\(inspiration.credit)")) .accessibilityHint(Text(store.ui("随机换一则灵感", "Show a random inspiration"))) @@ -418,19 +408,6 @@ private struct EmptyWorkspaceInspirationView: View { .accessibilityIdentifier("empty-workspace-inspiration-\(inspiration.id)") } - private var advanceLabel: some View { - HStack(spacing: 6) { - Text(store.ui("随机换一则", "RANDOM")) - Text("→") - .offset(x: hovering && !reduceMotion ? 2 : 0) - } - .font(.system(size: compact ? 9.5 : 10.5, weight: .medium, design: .serif)) - .tracking(store.interfaceLanguage == .chinese ? 0.7 : 1.2) - .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.82)) - .opacity(hovering || focused ? 1 : 0.78) - .accessibilityHidden(true) - } - @ViewBuilder private var inspirationContent: some View { switch inspiration.presentation { @@ -441,22 +418,22 @@ private struct EmptyWorkspaceInspirationView: View { .resizable() .scaledToFit() .foregroundStyle(WeiBeiTheme.ink.opacity(0.88)) - .frame(maxWidth: compact ? 390 : 470, maxHeight: compact ? 54 : 64) + .frame(maxWidth: compact ? 390 : 500, maxHeight: compact ? 54 : 72) .padding(.vertical, compact ? 1 : 2) .accessibilityLabel(Text(inspiration.text)) } else { - inspirationText(size: compact ? 21 : 24) + inspirationText(size: compact ? 24 : 30) } case .quotation: - inspirationText(size: compact ? 20 : 23.5) + inspirationText(size: compact ? 21 : 26) case .formula: - formulaContent(size: compact ? 21 : 24) + formulaContent(size: compact ? 24 : 30) } } private func formulaContent(size: CGFloat) -> some View { formulaText(size: size) - .foregroundStyle(WeiBeiTheme.ink.opacity(0.78)) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) .multilineTextAlignment(.center) .lineLimit(1) .minimumScaleFactor(0.78) @@ -491,7 +468,7 @@ private struct EmptyWorkspaceInspirationView: View { private func inspirationText(size: CGFloat) -> some View { Text(inspiration.text) .font(.system(size: size, weight: .regular, design: .serif)) - .foregroundStyle(WeiBeiTheme.ink.opacity(0.78)) + .foregroundStyle(WeiBeiTheme.ink.opacity(0.90)) .multilineTextAlignment(.center) .lineLimit(compact ? 3 : 2) .minimumScaleFactor(compact ? 0.72 : 0.78) @@ -512,8 +489,8 @@ private struct EmptyWorkspaceInspirationView: View { rightsLink } } - .font(.system(size: compact ? 9.5 : 10.5, weight: .regular)) - .foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.78)) + .font(.system(size: compact ? 9 : 9.5, weight: .regular)) + .foregroundStyle(WeiBeiTheme.tertiaryInk) .multilineTextAlignment(.center) .lineLimit(2) } diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index c4c586c41..5f807a260 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -1366,8 +1366,12 @@ expect(emptyWorkspaceSource.contains("selectedInspirationID") && emptyWorkspaceSource.contains(".transition(.opacity)") && emptyWorkspaceSource.contains("随机换一则") && emptyWorkspaceSource.contains("WeiBeiTypography.englishBrandFont(size: 22, weight: .semibold)") - && emptyWorkspaceSource.contains("foregroundStyle(WeiBeiTheme.ink.opacity(0.78))") - && emptyWorkspaceSource.contains("foregroundStyle(WeiBeiTheme.secondaryInk.opacity(0.86))") + && emptyWorkspaceSource.contains("formulaContent(size: compact ? 24 : 30)") + && emptyWorkspaceSource.contains("inspirationText(size: compact ? 21 : 26)") + && emptyWorkspaceSource.contains("foregroundStyle(WeiBeiTheme.ink.opacity(0.90))") + && emptyWorkspaceSource.contains("foregroundStyle(WeiBeiTheme.tertiaryInk)") + && !emptyWorkspaceSource.contains("Text(store.ui(\"随机换一则\", \"RANDOM\"))") + && emptyWorkspaceSource.contains("accessibilityHint(Text(store.ui(\"随机换一则灵感\", \"Show a random inspiration\")))") && !emptyWorkspaceSource.contains("greetingRule") && !emptyWorkspaceSource.contains("inspirationCounter") && !emptyWorkspaceSource.contains("%02d / %02d") From 385d290c64f07c5866839e55fd75324272d0f2c7 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Wed, 15 Jul 2026 08:51:11 +0800 Subject: [PATCH 29/36] chore: add release guardrails --- .github/pull_request_template.md | 37 ++++++++++++ .github/workflows/pr-checks.yml | 49 ++++++++++++++++ AGENTS.md | 42 ++++++++++++++ README.md | 1 + VERSION | 1 + script/build_and_run.sh | 32 +++++++++++ script/verify_release_metadata.sh | 95 +++++++++++++++++++++++++++++++ 7 files changed, 257 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/pr-checks.yml create mode 100644 AGENTS.md create mode 100644 VERSION create mode 100755 script/verify_release_metadata.sh diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..e2376de2c --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,37 @@ +## 这次解决什么 + +关联任务:# + +<!-- 用产品语言说明用户会得到什么。 --> + +## 实际改动 + +- + +## 明确没做 + +- + +## 分支与共享文件 + +- [ ] 本分支从当时最新的 `origin/codex/course-workspace` 创建 +- [ ] 开工当天已推送并建立草稿合并请求 +- [ ] 未整体合入、变基或批量挑取旧功能分支 / 救援分支 +- 共享核心文件占用:无 / 请列出文件、对应任务和释放条件 + +## 验证证据 + +<!-- 写真实命令和结果;不要只写“已测试”。不适用的项目说明原因。 --> + +- [ ] `swift build` +- [ ] `swift run WeiBeiSelfCheck` +- [ ] `swift run WeiBeiWebEditorCheck` +- [ ] 界面改动已完成真实窗口验收 +- [ ] 发布链路改动已运行 `./script/build_and_run.sh package` +- [ ] 发布链路改动已运行 `./script/verify_release_metadata.sh --require-clean` + +## 交给整合任务 + +- [ ] 改动范围单一,工作树干净,分支已推送 +- [ ] 风险、依赖和后续动作已写清 +- [ ] 我没有自行合并、创建标签或发布正式安装包 diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 000000000..d9ccb65e0 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,49 @@ +name: 魏碑合并请求检查 + +on: + pull_request: + branches: + - codex/course-workspace + - main + push: + branches: + - codex/course-workspace + - main + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-check-package: + name: 编译、自检与安装包追溯 + runs-on: macos-14 + timeout-minutes: 45 + + steps: + - name: 取出完整源码历史 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + + - name: 编译 + run: swift build + + - name: 运行应用自检 + run: swift run WeiBeiSelfCheck + + - name: 运行编辑器自检 + run: swift run WeiBeiWebEditorCheck + + - name: 生成可追溯安装包 + run: ./script/build_and_run.sh package + + - name: 校验版本、构建号与提交来源 + run: ./script/verify_release_metadata.sh --require-clean + + - name: 校验安装包签名 + run: /usr/bin/codesign --verify --deep --strict "dist/魏碑.app" diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..42f504130 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,42 @@ +# 魏碑 Agent 开发与发布规则 + +本文件适用于整个仓库。用户已授权把这些规则作为长期流程约束;所有 Agent 和新任务都必须遵守。 + +## 分支与合并请求 + +1. `codex/course-workspace` 是唯一开发整合线,`main` 只接收整合线验收通过的版本。 +2. 每个新任务先拉取远端,再从最新 `origin/codex/course-workspace` 创建一个短分支 `codex/<任务名>`。普通功能任务不得直接在整合线或 `main` 上开发。 +3. 一个任务只对应一个分支、一个工作目录和一个合并请求。开始工作的当天必须推送分支,并建立目标为 `codex/course-workspace` 的草稿合并请求;不能把未推送的本地工作目录当作长期成果保存处。 +4. 旧功能分支和救援分支只可用于取证。禁止把旧分支整体 merge、rebase 或批量 cherry-pick 到当前开发线。需要复用旧成果时,必须从最新整合线开新分支,只迁移经过审查的最小改动,并重新完成验证。 + +## 共享核心文件占用 + +以下位置默认属于共享核心面: + +- `Sources/WeiBei/Stores/WorkspaceStore.swift` +- `Sources/WeiBei/App/WeiBeiApp.swift` +- `Sources/WeiBei/Views/ContentView.swift` +- `Sources/WeiBei/Views/StableDocumentWorkspace.swift` +- `Sources/WeiBeiSelfCheck/main.swift` +- `Package.swift` +- `script/` +- `.github/` +- `VERSION` + +修改共享核心面之前,必须在任务对应的 issue 或草稿合并请求中写明“占用文件、负责人任务、预计释放条件”。同一文件同一时间只能由一个活跃任务占用;发现已有占用时,停止修改并交由整合任务协调,不得在另一条分支上并行改出第二套实现。 + +## 权限边界 + +- 只有明确标记为“整合”或“发布”的任务可以合并合并请求、更新 `codex/course-workspace`、把整合线合入 `main`、创建标签、发布版本或上传正式安装包。 +- 功能任务可以生成本地安装包做验收,但不得把它当作正式发布物,也不得自行合并自己的合并请求。 +- 不绕过自动检查,不用回退实现伪造通过结果;检查失败必须修复或明确记录真实阻塞。 + +## 完成定义 + +任务只有同时满足下列条件才算完成: + +1. 需求范围内的实现和必要文档已经完成,没有混入无关改动。 +2. 已运行与风险相称的构建、自检和真实体验验收;界面改动必须有真实窗口证据,发布链路改动必须验证安装包元数据和签名。 +3. 草稿合并请求已更新,写清实际改动、未做内容、共享文件占用、验证命令和结果。 +4. 分支已推送,工作树干净,成果不只存在于本地或临时目录。 +5. 已把合并风险和后续动作交给整合任务;只有整合任务可以宣布已合并或已发布。 diff --git a/README.md b/README.md index 18f9b78be..41a5ea488 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ cd weibei ```bash ./script/build_and_run.sh check ./script/build_and_run.sh package +./script/verify_release_metadata.sh --require-clean ./script/build_and_run.sh --verify ``` diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..6e8bf73aa --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/script/build_and_run.sh b/script/build_and_run.sh index 9ab96e87f..3d46ebe8e 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -34,6 +34,7 @@ if [[ "$MODE" == "check" || "$MODE" == "--debug" || "$MODE" == "debug" ]]; then fi ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +VERSION_FILE="$ROOT_DIR/VERSION" FINAL_DIST_DIR="$ROOT_DIR/dist" FINAL_APP_BUNDLE="$FINAL_DIST_DIR/$APP_DISPLAY_NAME.app" FINAL_APP_BINARY="$FINAL_APP_BUNDLE/Contents/MacOS/$PRODUCT_NAME" @@ -101,6 +102,28 @@ if [[ -d "$ROOT_DIR/node_modules" ]]; then npm run build:editor >/dev/null fi +if [[ "$CHECK_ONLY" != true ]]; then + if [[ ! -f "$VERSION_FILE" ]]; then + echo "build failed: missing VERSION" >&2 + exit 19 + fi + APP_VERSION="$(/usr/bin/tr -d '\r\n' <"$VERSION_FILE")" + if [[ ! "$APP_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "build failed: VERSION must use numeric major.minor.patch" >&2 + exit 20 + fi + if [[ "$(git -C "$ROOT_DIR" rev-parse --is-shallow-repository)" == "true" ]]; then + echo "build failed: full Git history is required for a stable build number" >&2 + exit 21 + fi + GIT_COMMIT="$(git -C "$ROOT_DIR" rev-parse --verify HEAD)" + BUILD_NUMBER="$(git -C "$ROOT_DIR" rev-list --count "$GIT_COMMIT")" + SOURCE_DIRTY=false + if [[ -n "$(git -C "$ROOT_DIR" status --porcelain=v1 --untracked-files=normal)" ]]; then + SOURCE_DIRTY=true + fi +fi + PI_RUNTIME_DIR="$("$ROOT_DIR/script/prepare_pi_runtime.sh")" PI_RUNTIME_BINARY="$PI_RUNTIME_DIR/bin/pi" PI_RUNTIME_VERSION="$(/usr/bin/plutil -extract piVersion raw -o - "$PI_RUNTIME_DIR/manifest.json")" @@ -175,6 +198,14 @@ if [[ "$CHECK_ONLY" != true ]]; then <string>$APP_DISPLAY_NAME</string> <key>CFBundlePackageType</key> <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>$APP_VERSION</string> + <key>CFBundleVersion</key> + <string>$BUILD_NUMBER</string> + <key>WeiBeiGitCommit</key> + <string>$GIT_COMMIT</string> + <key>WeiBeiSourceDirty</key> + <$SOURCE_DIRTY/> <key>LSMinimumSystemVersion</key> <string>$MIN_SYSTEM_VERSION</string> <key>NSPrincipalClass</key> @@ -227,6 +258,7 @@ PLIST echo "package failed: strict-audit copy changed the final app binary UUID" >&2 exit 18 fi + "$ROOT_DIR/script/verify_release_metadata.sh" "$FINAL_APP_BUNDLE" fi fi diff --git a/script/verify_release_metadata.sh b/script/verify_release_metadata.sh new file mode 100755 index 000000000..1506f5009 --- /dev/null +++ b/script/verify_release_metadata.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +APP_BUNDLE="$ROOT_DIR/dist/魏碑.app" +APP_BUNDLE_SET=false +REQUIRE_CLEAN=false + +usage() { + echo "usage: $0 [--require-clean] [path/to/魏碑.app]" >&2 +} + +while (( $# > 0 )); do + case "$1" in + --require-clean) + REQUIRE_CLEAN=true + ;; + --help|-h) + usage + exit 0 + ;; + -* ) + usage + exit 2 + ;; + *) + if [[ "$APP_BUNDLE_SET" == true ]]; then + usage + exit 2 + fi + APP_BUNDLE="$1" + APP_BUNDLE_SET=true + ;; + esac + shift +done + +VERSION_FILE="$ROOT_DIR/VERSION" +INFO_PLIST="$APP_BUNDLE/Contents/Info.plist" +APP_BINARY="$APP_BUNDLE/Contents/MacOS/WeiBei" + +if [[ ! -f "$VERSION_FILE" ]]; then + echo "metadata check failed: missing VERSION" >&2 + exit 3 +fi +if [[ ! -f "$INFO_PLIST" || ! -x "$APP_BINARY" ]]; then + echo "metadata check failed: incomplete app bundle at $APP_BUNDLE" >&2 + exit 4 +fi +if [[ "$(git -C "$ROOT_DIR" rev-parse --is-shallow-repository)" == "true" ]]; then + echo "metadata check failed: full Git history is required for a stable build number" >&2 + exit 5 +fi + +EXPECTED_VERSION="$(/usr/bin/tr -d '\r\n' <"$VERSION_FILE")" +if [[ ! "$EXPECTED_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "metadata check failed: VERSION must use numeric major.minor.patch" >&2 + exit 6 +fi + +EXPECTED_COMMIT="$(git -C "$ROOT_DIR" rev-parse --verify HEAD)" +EXPECTED_BUILD="$(git -C "$ROOT_DIR" rev-list --count "$EXPECTED_COMMIT")" +EXPECTED_DIRTY=false +if [[ -n "$(git -C "$ROOT_DIR" status --porcelain=v1 --untracked-files=normal)" ]]; then + EXPECTED_DIRTY=true +fi + +if [[ "$REQUIRE_CLEAN" == true && "$EXPECTED_DIRTY" == true ]]; then + echo "metadata check failed: a formal package must come from a clean worktree" >&2 + exit 7 +fi + +/usr/bin/plutil -lint "$INFO_PLIST" >/dev/null +ACTUAL_VERSION="$(/usr/bin/plutil -extract CFBundleShortVersionString raw -o - "$INFO_PLIST")" +ACTUAL_BUILD="$(/usr/bin/plutil -extract CFBundleVersion raw -o - "$INFO_PLIST")" +ACTUAL_COMMIT="$(/usr/bin/plutil -extract WeiBeiGitCommit raw -o - "$INFO_PLIST")" +ACTUAL_DIRTY="$(/usr/bin/plutil -extract WeiBeiSourceDirty raw -o - "$INFO_PLIST")" + +assert_equal() { + local label="$1" expected="$2" actual="$3" + if [[ "$actual" != "$expected" ]]; then + echo "metadata check failed: $label expected $expected, got $actual" >&2 + exit 8 + fi +} + +assert_equal "version" "$EXPECTED_VERSION" "$ACTUAL_VERSION" +assert_equal "build" "$EXPECTED_BUILD" "$ACTUAL_BUILD" +assert_equal "commit" "$EXPECTED_COMMIT" "$ACTUAL_COMMIT" +assert_equal "source dirty state" "$EXPECTED_DIRTY" "$ACTUAL_DIRTY" + +echo "release_metadata_version=$ACTUAL_VERSION" +echo "release_metadata_build=$ACTUAL_BUILD" +echo "release_metadata_commit=$ACTUAL_COMMIT" +echo "release_metadata_source_dirty=$ACTUAL_DIRTY" From 09520e560ae364ed21ef899aec38dfb7c7ba04d7 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Wed, 15 Jul 2026 09:14:07 +0800 Subject: [PATCH 30/36] ci: use current macOS toolchain --- .github/workflows/pr-checks.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index d9ccb65e0..d50f46e70 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -21,7 +21,7 @@ concurrency: jobs: build-check-package: name: 编译、自检与安装包追溯 - runs-on: macos-14 + runs-on: macos-26 timeout-minutes: 45 steps: @@ -30,6 +30,11 @@ jobs: with: fetch-depth: 0 + - name: 记录构建工具链 + run: | + swift --version + xcodebuild -version + - name: 编译 run: swift build From 80ffbe28b0f513e2610c062d027310218706325d Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:38:38 +0800 Subject: [PATCH 31/36] ci: verify Pi terminal semantics when available --- .github/workflows/pr-checks.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index d50f46e70..edb9806ed 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -41,6 +41,10 @@ jobs: - name: 运行应用自检 run: swift run WeiBeiSelfCheck + - name: 运行 Pi 终止语义自检 + if: ${{ hashFiles('Sources/WeiBeiSelfCheck/PiTerminalRuntimeSelfChecks.swift') != '' }} + run: WEIBEI_PI_TERMINAL_SELF_CHECK_ONLY=1 swift run WeiBeiSelfCheck + - name: 运行编辑器自检 run: swift run WeiBeiWebEditorCheck From 6f79c14c6d8b8d627c00ec3e3d766737b0a5d768 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:49:04 +0800 Subject: [PATCH 32/36] fix: preserve Pi terminal errors and cancellation --- Sources/WeiBeiCore/PiAgentRuntime.swift | 79 ++-- Sources/WeiBeiCore/PiRPCProtocol.swift | 54 ++- .../WeiBeiSelfCheck/PiAgentSelfChecks.swift | 27 +- .../PiTerminalRuntimeSelfChecks.swift | 367 ++++++++++++++++++ Sources/WeiBeiSelfCheck/main.swift | 10 +- 5 files changed, 507 insertions(+), 30 deletions(-) create mode 100644 Sources/WeiBeiSelfCheck/PiTerminalRuntimeSelfChecks.swift diff --git a/Sources/WeiBeiCore/PiAgentRuntime.swift b/Sources/WeiBeiCore/PiAgentRuntime.swift index 184d60c77..ec0dbda32 100644 --- a/Sources/WeiBeiCore/PiAgentRuntime.swift +++ b/Sources/WeiBeiCore/PiAgentRuntime.swift @@ -264,6 +264,32 @@ public enum PiAgentDiagnosticSanitizer { public actor PiAgentRuntime: StudyAgentRuntime { private static let processReadinessTimeoutSeconds: UInt64 = 12 + private struct ProgressDelivery: Sendable { + let continuation: AsyncStream<StudyAgentProgress>.Continuation + let task: Task<Void, Never> + + init(handler: @escaping StudyAgentProgressHandler) { + let pair = AsyncStream<StudyAgentProgress>.makeStream( + bufferingPolicy: .bufferingNewest(32) + ) + continuation = pair.continuation + task = Task.detached(priority: .userInitiated) { + for await event in pair.stream { + await handler(event) + } + } + } + + func yield(_ event: StudyAgentProgress) { + continuation.yield(event) + } + + func finish() { + continuation.finish() + task.cancel() + } + } + private struct PendingCommand { var continuation: CheckedContinuation<PiRPCResponse, Error> var timeoutTask: Task<Void, Never> @@ -289,7 +315,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { var proposal: StudyAgentNoteProposal? var learningUpdate: StudyAgentLearningUpdate? var lastError: String? - var progress: StudyAgentProgressHandler? + var progressDelivery: ProgressDelivery? var continuation: CheckedContinuation<StudyAgentReply, Error>? var completed: Result<StudyAgentReply, Error>? var watchdogTask: Task<Void, Never>? @@ -297,6 +323,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { private let executableOverride: URL? private let runtimeDirectory: URL + private let runInactivityTimeoutNanoseconds: UInt64 private var providerConfiguration = PiAgentProviderConfiguration() private var process: Process? private var inputHandle: FileHandle? @@ -311,12 +338,17 @@ public actor PiAgentRuntime: StudyAgentRuntime { private var idleShutdownTask: Task<Void, Never>? private let traceEnabled = ProcessInfo.processInfo.environment["WEIBEI_PI_TRACE"] == "1" - public init(executableURL: URL? = nil, runtimeDirectory: URL? = nil) { + public init( + executableURL: URL? = nil, + runtimeDirectory: URL? = nil, + runInactivityTimeoutNanoseconds: UInt64 = 300_000_000_000 + ) { executableOverride = executableURL self.runtimeDirectory = runtimeDirectory ?? FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first? .appendingPathComponent("WeiBei/AgentRuntime", isDirectory: true) ?? FileManager.default.temporaryDirectory.appendingPathComponent("WeiBeiAgentRuntime", isDirectory: true) + self.runInactivityTimeoutNanoseconds = max(1, runInactivityTimeoutNanoseconds) } public func configure(_ configuration: PiAgentProviderConfiguration) { @@ -348,7 +380,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { try requireStartingRun(request.id) let context = StudyAgentContextEnvelope(request: request) try writeContext(context) - await progress?(.readingContext) + let progressDelivery = progress.map(ProgressDelivery.init(handler:)) let currentJumpEvidence = currentJumpEvidence(in: context) activeRun = ActiveRun( @@ -370,8 +402,9 @@ public actor PiAgentRuntime: StudyAgentRuntime { jumpEvidenceLabels: currentJumpEvidence, lastLocationSourceLabel: context.learning.lastLocation.map { "[材料:\($0.itemTitle)]" }, allowedNoteSourceLabels: currentSourceLabels(in: context), - progress: progress + progressDelivery: progressDelivery ) + progressDelivery?.yield(.readingContext) startingRunID = nil refreshRunWatchdog() do { @@ -409,21 +442,8 @@ public actor PiAgentRuntime: StudyAgentRuntime { private func cancelRun(id runID: UUID) async { guard activeRun?.id == runID else { return } - guard process != nil else { - finishRun(id: runID, with: .failure(PiAgentRuntimeError.cancelled)) - return - } - - do { - _ = try await sendCommand(type: "abort", timeoutSeconds: 2) - } catch { - shutdownProcess(reason: PiAgentRuntimeError.cancelled) - return - } - - if activeRun?.id == runID { - finishRun(id: runID, with: .failure(PiAgentRuntimeError.cancelled)) - } + finishRun(id: runID, with: .failure(PiAgentRuntimeError.cancelled)) + shutdownProcess(reason: PiAgentRuntimeError.cancelled) } public func reset() async { @@ -993,7 +1013,10 @@ public actor PiAgentRuntime: StudyAgentRuntime { run.streamedText += delta activeRun = run refreshRunWatchdog() - await run.progress?(.text(run.streamedText)) + run.progressDelivery?.yield(.text(run.streamedText)) + + case .runActivity: + refreshRunWatchdog() case let .assistantError(message): guard var run = activeRun else { return } @@ -1019,7 +1042,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { return } refreshRunWatchdog() - await run.progress?(.usingTool(name)) + run.progressDelivery?.yield(.usingTool(name)) case let .contextRead(_, contextRevision): guard var run = activeRun else { return } @@ -1112,13 +1135,16 @@ public actor PiAgentRuntime: StudyAgentRuntime { activeRun = run refreshRunWatchdog() - case let .agentEnded(text, stopReason): + case let .agentEnded(text, stopReason, modelError): guard let run = activeRun else { return } let cleanText = (text.isEmpty ? run.streamedText : text).trimmingCharacters(in: .whitespacesAndNewlines) if stopReason == "aborted" { finishRun(id: run.id, with: .failure(PiAgentRuntimeError.cancelled)) } else if stopReason == "error" { - finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed(run.lastError ?? "Unknown model error"))) + let detail = modelError.map(sanitizedDiagnostic) + ?? run.lastError + ?? "PI 模型请求失败,但运行时没有返回错误详情" + finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed(detail))) } else if run.answeredBeforeContext { finishRun(id: run.id, with: .failure(PiAgentRuntimeError.agentFailed("PI answered before reading the current WeiBei context"))) } else if !run.didReadContext { @@ -1165,7 +1191,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { } case .event: - refreshRunWatchdog() + break } } @@ -1173,6 +1199,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { guard var run = activeRun, run.id == id, run.completed == nil else { return } run.watchdogTask?.cancel() run.watchdogTask = nil + run.progressDelivery?.finish() clearContextSnapshot() if let continuation = run.continuation { activeRun = nil @@ -1187,6 +1214,7 @@ public actor PiAgentRuntime: StudyAgentRuntime { private func discardRun(id: UUID) { guard let run = activeRun, run.id == id else { return } run.watchdogTask?.cancel() + run.progressDelivery?.finish() activeRun = nil clearContextSnapshot() scheduleIdleShutdown() @@ -1216,9 +1244,10 @@ public actor PiAgentRuntime: StudyAgentRuntime { guard var run = activeRun else { return } run.watchdogTask?.cancel() let runID = run.id + let inactivityTimeoutNanoseconds = runInactivityTimeoutNanoseconds run.watchdogTask = Task { [weak self] in do { - try await Task.sleep(nanoseconds: 300 * 1_000_000_000) + try await Task.sleep(nanoseconds: inactivityTimeoutNanoseconds) } catch { return } diff --git a/Sources/WeiBeiCore/PiRPCProtocol.swift b/Sources/WeiBeiCore/PiRPCProtocol.swift index 8d6a73ba4..7752dad4e 100644 --- a/Sources/WeiBeiCore/PiRPCProtocol.swift +++ b/Sources/WeiBeiCore/PiRPCProtocol.swift @@ -73,9 +73,16 @@ public struct PiRPCResponse: Equatable, Sendable { } } +public enum PiRPCRunActivity: Equatable, Sendable { + case thinking + case tool + case retrying +} + public enum PiRPCIncomingMessage: Equatable, Sendable { case response(PiRPCResponse) case textDelta(String) + case runActivity(PiRPCRunActivity) case assistantError(String) case toolStarted(id: String, name: String) case contextRead(id: String, contextRevision: String) @@ -84,7 +91,7 @@ public enum PiRPCIncomingMessage: Equatable, Sendable { case noteProposal(id: String, StudyAgentNoteProposal) case learningUpdate(id: String, StudyAgentLearningUpdate) case toolFailed(id: String, name: String, message: String) - case agentEnded(text: String, stopReason: String?) + case agentEnded(text: String, stopReason: String?, error: String?) case extensionError(String) case event(String) } @@ -125,6 +132,9 @@ public enum PiRPCMessageDecoder { if eventType == "text_delta", let delta = event["delta"] as? String { return .textDelta(delta) } + if ["thinking_start", "thinking_delta", "thinking_end"].contains(eventType) { + return .runActivity(.thinking) + } if eventType == "error" { let reason = event["error"] as? String ?? event["reason"] as? String @@ -133,6 +143,21 @@ public enum PiRPCMessageDecoder { } return .event(eventType) + case "auto_retry_start", "auto_retry_end": + return .runActivity(.retrying) + + case "tool_execution_update": + return .runActivity(.tool) + + case "message_end", "turn_end": + guard let message = object["message"] as? [String: Any], + message["role"] as? String == "assistant", + message["stopReason"] as? String == "error", + let error = assistantError(in: message) else { + return .event(type) + } + return .assistantError(error) + case "tool_execution_start": guard let name = object["toolName"] as? String else { throw PiRPCProtocolError.invalidEnvelope @@ -271,12 +296,14 @@ public enum PiRPCMessageDecoder { let messages = object["messages"] as? [[String: Any]] ?? [] var finalText = "" var stopReason: String? + var finalError: String? for message in messages where message["role"] as? String == "assistant" { let text = assistantText(in: message) if !text.isEmpty { finalText = text } stopReason = message["stopReason"] as? String ?? stopReason + finalError = assistantError(in: message) ?? finalError } - return .agentEnded(text: finalText, stopReason: stopReason) + return .agentEnded(text: finalText, stopReason: stopReason, error: finalError) case "extension_error": let path = object["extensionPath"] as? String ?? "WeiBei extension" @@ -297,6 +324,29 @@ public enum PiRPCMessageDecoder { }.joined(separator: "\n").trimmingCharacters(in: .whitespacesAndNewlines) } + private static func assistantError(in message: [String: Any]) -> String? { + if let errorMessage = nonEmptyString(message["errorMessage"]) { + return errorMessage + } + let diagnostics = message["diagnostics"] as? [[String: Any]] ?? [] + for diagnostic in diagnostics.reversed() { + if let error = diagnostic["error"] as? [String: Any], + let message = nonEmptyString(error["message"]) { + return message + } + if let message = nonEmptyString(diagnostic["message"]) { + return message + } + } + return nil + } + + private static func nonEmptyString(_ value: Any?) -> String? { + guard let value = value as? String else { return nil } + let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines) + return trimmed.isEmpty ? nil : trimmed + } + private static func firstText(in result: [String: Any]?) -> String? { let content = result?["content"] as? [[String: Any]] ?? [] return content.compactMap { $0["text"] as? String }.first diff --git a/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift index f72027f09..bcb4f07a0 100644 --- a/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift +++ b/Sources/WeiBeiSelfCheck/PiAgentSelfChecks.swift @@ -179,7 +179,32 @@ private func checkRPCDecoding() throws { ) let ended = try PiRPCMessageDecoder.decode(Data(#"{"type":"agent_end","messages":[{"role":"assistant","content":[{"type":"text","text":"第一轮"}],"stopReason":"toolUse"},{"role":"assistant","content":[{"type":"text","text":"最终回答"}],"stopReason":"stop"}]}"#.utf8)) - try piRequire(ended == .agentEnded(text: "最终回答", stopReason: "stop"), "PI agent_end selects the final assistant answer") + try piRequire(ended == .agentEnded(text: "最终回答", stopReason: "stop", error: nil), "PI agent_end selects the final assistant answer") + + let messageEndError = try PiRPCMessageDecoder.decode(Data(#"{"type":"message_end","message":{"role":"assistant","stopReason":"error","errorMessage":"上游服务拒绝了这次请求"}}"#.utf8)) + try piRequire( + messageEndError == .assistantError("上游服务拒绝了这次请求"), + "PI message_end exposes the assistant error instead of collapsing it into an unknown error" + ) + + let turnEndError = try PiRPCMessageDecoder.decode(Data(#"{"type":"turn_end","message":{"role":"assistant","stopReason":"error","diagnostics":[{"message":"旧诊断"},{"error":{"message":"证书校验失败"}}]}}"#.utf8)) + try piRequire( + turnEndError == .assistantError("证书校验失败"), + "PI turn_end exposes the newest nested diagnostic" + ) + + let thinking = try PiRPCMessageDecoder.decode(Data(#"{"type":"message_update","assistantMessageEvent":{"type":"thinking_delta","delta":"正在核对来源"}}"#.utf8)) + try piRequire(thinking == .runActivity(.thinking), "PI thinking deltas count as real run activity") + let retrying = try PiRPCMessageDecoder.decode(Data(#"{"type":"auto_retry_start","attempt":2}"#.utf8)) + try piRequire(retrying == .runActivity(.retrying), "PI provider retries count as real run activity") + let toolUpdate = try PiRPCMessageDecoder.decode(Data(#"{"type":"tool_execution_update","toolCallId":"tool-9","toolName":"weibei_course_search"}"#.utf8)) + try piRequire(toolUpdate == .runActivity(.tool), "PI tool updates count as real run activity") + + let endedWithError = try PiRPCMessageDecoder.decode(Data(#"{"type":"agent_end","messages":[{"role":"assistant","content":[],"stopReason":"error","diagnostics":[{"error":{"message":"真实模型错误"}}]}]}"#.utf8)) + try piRequire( + endedWithError == .agentEnded(text: "", stopReason: "error", error: "真实模型错误"), + "PI agent_end preserves the terminal model error" + ) try piRequire(try PiRPCMessageDecoder.decode(Data(#"{"type":"future_event"}"#.utf8)) == .event("future_event"), "PI decoder tolerates unknown future events") do { diff --git a/Sources/WeiBeiSelfCheck/PiTerminalRuntimeSelfChecks.swift b/Sources/WeiBeiSelfCheck/PiTerminalRuntimeSelfChecks.swift new file mode 100644 index 000000000..a548e2d4c --- /dev/null +++ b/Sources/WeiBeiSelfCheck/PiTerminalRuntimeSelfChecks.swift @@ -0,0 +1,367 @@ +import CryptoKit +import Foundation +import WeiBeiCore + +private struct PiTerminalRuntimeFixture { + var rootURL: URL + var executableURL: URL + + func workingDirectory(named name: String) throws -> URL { + let url = rootURL.appendingPathComponent(name, isDirectory: true) + try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true) + return url + } +} + +private enum PiTerminalRuntimeSelfCheckError: LocalizedError { + case failed(String) + + var errorDescription: String? { + switch self { + case let .failed(message): message + } + } +} + +private actor PiProgressProbe { + private var reachedReadingContext = false + + func record(_ event: StudyAgentProgress) { + if event == .readingContext { + reachedReadingContext = true + } + } + + func waitForReadingContext() async -> Bool { + for _ in 0..<250 { + if reachedReadingContext { return true } + try? await Task.sleep(nanoseconds: 20_000_000) + } + return false + } +} + +func runPiTerminalRuntimeSelfChecks() async throws { + let fixture = try makePiTerminalRuntimeFixture() + defer { try? FileManager.default.removeItem(at: fixture.rootURL) } + + try await checkUserStopReturnsImmediately(fixture) + try await checkTerminalErrorBypassesSlowProgress(fixture) + try await checkGenericEventsDoNotDefeatWatchdog(fixture) + try await checkMeaningfulThinkingKeepsRunAlive(fixture) +} + +private func checkUserStopReturnsImmediately(_ fixture: PiTerminalRuntimeFixture) async throws { + let runtime = PiAgentRuntime( + executableURL: fixture.executableURL, + runtimeDirectory: try fixture.workingDirectory(named: "CancelMode"), + runInactivityTimeoutNanoseconds: 2_000_000_000 + ) + let probe = PiProgressProbe() + let run = Task { + await terminalOutcome(runtime: runtime, revision: "cancel-test") { event in + await probe.record(event) + } + } + guard await probe.waitForReadingContext() else { + await runtime.shutdown() + throw PiTerminalRuntimeSelfCheckError.failed("PI cancellation fixture never reached the active run") + } + try? await Task.sleep(nanoseconds: 100_000_000) + + let startedAt = Date() + await runtime.cancel() + let cancellationSeconds = Date().timeIntervalSince(startedAt) + let outcome = await run.value + await runtime.shutdown() + + guard outcome == "error:PI 请求已取消", cancellationSeconds < 0.5 else { + throw PiTerminalRuntimeSelfCheckError.failed( + "PI stop waited for the unresponsive abort command (outcome=\(outcome), seconds=\(cancellationSeconds))" + ) + } +} + +private func checkTerminalErrorBypassesSlowProgress(_ fixture: PiTerminalRuntimeFixture) async throws { + let runtime = PiAgentRuntime( + executableURL: fixture.executableURL, + runtimeDirectory: try fixture.workingDirectory(named: "ErrorMode"), + runInactivityTimeoutNanoseconds: 2_000_000_000 + ) + let startedAt = Date() + let outcome = await terminalOutcome(runtime: runtime, revision: "error-test") { event in + if case .text = event { + try? await Task.sleep(nanoseconds: 3_000_000_000) + } + } + let completionSeconds = Date().timeIntervalSince(startedAt) + await runtime.shutdown() + + guard outcome == "error:PI 回答失败:真实终止错误", completionSeconds < 1.0 else { + throw PiTerminalRuntimeSelfCheckError.failed( + "PI terminal error was hidden or blocked behind progress delivery (outcome=\(outcome), seconds=\(completionSeconds))" + ) + } +} + +private func checkGenericEventsDoNotDefeatWatchdog(_ fixture: PiTerminalRuntimeFixture) async throws { + let runtime = PiAgentRuntime( + executableURL: fixture.executableURL, + runtimeDirectory: try fixture.workingDirectory(named: "HeartbeatMode"), + runInactivityTimeoutNanoseconds: 300_000_000 + ) + let startedAt = Date() + let outcome = await terminalOutcomeWithin( + runtime: runtime, + revision: "heartbeat-test", + timeoutNanoseconds: 1_500_000_000 + ) + let completionSeconds = Date().timeIntervalSince(startedAt) + await runtime.shutdown() + + guard outcome.contains("PI produced no events for five minutes"), completionSeconds < 1.5 else { + throw PiTerminalRuntimeSelfCheckError.failed( + "PI generic event spam defeated the inactivity watchdog (outcome=\(outcome), seconds=\(completionSeconds))" + ) + } +} + +private func terminalOutcomeWithin( + runtime: PiAgentRuntime, + revision: String, + timeoutNanoseconds: UInt64 +) async -> String { + await withTaskGroup(of: String.self) { group in + group.addTask { + await terminalOutcome(runtime: runtime, revision: revision, progress: nil) + } + group.addTask { + try? await Task.sleep(nanoseconds: timeoutNanoseconds) + return "self-check-timeout" + } + let first = await group.next() ?? "self-check-timeout" + group.cancelAll() + return first + } +} + +private func checkMeaningfulThinkingKeepsRunAlive(_ fixture: PiTerminalRuntimeFixture) async throws { + let runtime = PiAgentRuntime( + executableURL: fixture.executableURL, + runtimeDirectory: try fixture.workingDirectory(named: "ThinkingMode"), + runInactivityTimeoutNanoseconds: 300_000_000 + ) + let outcome = await terminalOutcome(runtime: runtime, revision: "thinking-test", progress: nil) + await runtime.shutdown() + + guard outcome == "reply:[材料:测试材料] 思考完成" else { + throw PiTerminalRuntimeSelfCheckError.failed( + "PI meaningful thinking did not keep the run alive (\(outcome))" + ) + } +} + +private func terminalOutcome( + runtime: PiAgentRuntime, + revision: String, + progress: StudyAgentProgressHandler? +) async -> String { + let request = StudyAgentRequest( + purpose: .conversation, + question: "请解释测试材料", + materialTitle: "测试材料", + materialText: "测试正文", + noteTitle: "测试笔记", + noteText: "", + contextRevision: revision + ) + do { + let reply = try await runtime.respond(to: request, progress: progress) + return "reply:\(reply.text)" + } catch { + return "error:\(error.localizedDescription)" + } +} + +private func makePiTerminalRuntimeFixture() throws -> PiTerminalRuntimeFixture { + let fileManager = FileManager.default + let rootURL = fileManager.temporaryDirectory + .appendingPathComponent("weibei-pi-terminal-\(UUID().uuidString)", isDirectory: true) + let runtimeURL = rootURL.appendingPathComponent("PiRuntime", isDirectory: true) + let binURL = runtimeURL.appendingPathComponent("bin", isDirectory: true) + let themeURL = binURL.appendingPathComponent("theme", isDirectory: true) + let executableURL = binURL.appendingPathComponent("pi") + let sourceURL = rootURL.appendingPathComponent("fake-pi.c") + + try fileManager.createDirectory(at: themeURL, withIntermediateDirectories: true) + try Data(fakePiTerminalSource.utf8).write(to: sourceURL, options: .atomic) + try runPiFixtureCommand( + executableURL: URL(fileURLWithPath: "/usr/bin/clang"), + arguments: [sourceURL.path, "-O0", "-o", executableURL.path] + ) + try runPiFixtureCommand( + executableURL: URL(fileURLWithPath: "/usr/bin/codesign"), + arguments: ["--force", "--sign", "-", executableURL.path] + ) + + try Data(#"{"version":"0.80.2"}"#.utf8) + .write(to: binURL.appendingPathComponent("package.json"), options: .atomic) + try Data("{}\n".utf8).write(to: themeURL.appendingPathComponent("dark.json"), options: .atomic) + try Data("{}\n".utf8).write(to: themeURL.appendingPathComponent("light.json"), options: .atomic) + try Data("MIT\n".utf8).write(to: runtimeURL.appendingPathComponent("LICENSE"), options: .atomic) + try Data("Self-check fixture only.\n".utf8) + .write(to: runtimeURL.appendingPathComponent("THIRD_PARTY_NOTICES.md"), options: .atomic) + let manifest = #"{"schemaVersion":1,"piVersion":"0.80.2","sourceRepository":"self-check","sourceCommit":"0000000000000000000000000000000000000000","license":"MIT"}"# + try Data(manifest.utf8).write(to: runtimeURL.appendingPathComponent("manifest.json"), options: .atomic) + + let executableData = try Data(contentsOf: executableURL) + let hash = SHA256.hash(data: executableData).map { String(format: "%02x", $0) }.joined() + try Data("\(hash)\n".utf8).write(to: runtimeURL.appendingPathComponent("binary.sha256"), options: .atomic) + + return PiTerminalRuntimeFixture(rootURL: rootURL, executableURL: executableURL) +} + +private func runPiFixtureCommand(executableURL: URL, arguments: [String]) throws { + let process = Process() + let pipe = Pipe() + process.executableURL = executableURL + process.arguments = arguments + process.standardOutput = pipe + process.standardError = pipe + try process.run() + process.waitUntilExit() + guard process.terminationStatus == 0 else { + let detail = String(decoding: pipe.fileHandleForReading.readDataToEndOfFile(), as: UTF8.self) + throw PiTerminalRuntimeSelfCheckError.failed( + "fixture command failed: \(executableURL.lastPathComponent) \(detail)" + ) + } +} + +private let fakePiTerminalSource = #""" +#include <signal.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <unistd.h> + +static pid_t emitter_pid = -1; +static int cancel_mode = 0; + +static int json_value(const char *line, const char *key, char *output, size_t capacity) { + char pattern[64]; + snprintf(pattern, sizeof(pattern), "\"%s\":\"", key); + const char *start = strstr(line, pattern); + if (start == NULL) return 0; + start += strlen(pattern); + const char *end = strchr(start, '\"'); + if (end == NULL) return 0; + size_t length = (size_t)(end - start); + if (length + 1 > capacity) return 0; + memcpy(output, start, length); + output[length] = '\0'; + return 1; +} + +static void respond(const char *id, const char *command, const char *data) { + printf("{\"id\":\"%s\",\"type\":\"response\",\"command\":\"%s\",\"success\":true,\"data\":%s}\n", id, command, data); + fflush(stdout); +} + +static void stop_emitter(void) { + if (emitter_pid <= 0) return; + kill(emitter_pid, SIGTERM); + waitpid(emitter_pid, NULL, 0); + emitter_pid = -1; +} + +static void terminate_fixture(int signal_number) { + (void)signal_number; + if (emitter_pid > 0) kill(emitter_pid, SIGTERM); + _exit(0); +} + +static void emit_context(const char *revision) { + printf("{\"type\":\"tool_execution_end\",\"toolCallId\":\"ctx\",\"toolName\":\"weibei_context\",\"isError\":false,\"result\":{\"details\":{\"kind\":\"weibei_context\",\"contextRevision\":\"%s\"}}}\n", revision); + fflush(stdout); +} + +static void start_emitter(void) { + if (emitter_pid > 0) return; + char cwd[PATH_MAX]; + getcwd(cwd, sizeof(cwd)); + cancel_mode = strstr(cwd, "CancelMode") != NULL; + int error_mode = strstr(cwd, "ErrorMode") != NULL; + int thinking_mode = strstr(cwd, "ThinkingMode") != NULL; + emitter_pid = fork(); + if (emitter_pid != 0) return; + + if (error_mode) { + emit_context("error-test"); + for (int index = 0; index < 256; index++) { + printf("{\"type\":\"message_update\",\"assistantMessageEvent\":{\"type\":\"text_delta\",\"delta\":\"临时文本\"}}\n"); + } + printf("{\"type\":\"message_end\",\"message\":{\"role\":\"assistant\",\"stopReason\":\"error\",\"errorMessage\":\"真实终止错误\"}}\n"); + printf("{\"type\":\"agent_end\",\"messages\":[{\"role\":\"assistant\",\"content\":[],\"stopReason\":\"error\",\"diagnostics\":[{\"error\":{\"message\":\"真实终止错误\"}}]}]}\n"); + fflush(stdout); + _exit(0); + } + + if (thinking_mode) { + emit_context("thinking-test"); + for (int index = 0; index < 6; index++) { + if (index == 1 || index == 2) { + printf("{\"type\":\"tool_execution_update\",\"toolCallId\":\"tool-long\",\"toolName\":\"weibei_course_search\"}\n"); + } else if (index == 3) { + printf("{\"type\":\"auto_retry_start\",\"attempt\":2}\n"); + } else { + printf("{\"type\":\"message_update\",\"assistantMessageEvent\":{\"type\":\"thinking_delta\",\"delta\":\"核对中\"}}\n"); + } + fflush(stdout); + usleep(120000); + } + printf("{\"type\":\"agent_end\",\"messages\":[{\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"[材料:测试材料] 思考完成\"}],\"stopReason\":\"stop\"}]}\n"); + fflush(stdout); + _exit(0); + } + + emit_context(cancel_mode ? "cancel-test" : "heartbeat-test"); + for (;;) { + printf("{\"type\":\"future_event\"}\n"); + fflush(stdout); + usleep(20000); + } +} + +int main(void) { + signal(SIGTERM, terminate_fixture); + setvbuf(stdout, NULL, _IOLBF, 0); + char *line = NULL; + size_t line_capacity = 0; + while (getline(&line, &line_capacity, stdin) >= 0) { + char id[128]; + char type[64]; + if (!json_value(line, "id", id, sizeof(id)) || !json_value(line, "type", type, sizeof(type))) continue; + if (strcmp(type, "get_state") == 0) { + respond(id, type, "{\"isStreaming\":false}"); + } else if (strcmp(type, "get_commands") == 0) { + respond(id, type, "{\"commands\":[{\"name\":\"skill:weibei-study-companion\"},{\"name\":\"skill:weibei-course-wayfinding\"},{\"name\":\"skill:weibei-close-reading\"},{\"name\":\"skill:weibei-note-making\"},{\"name\":\"skill:weibei-recall-practice\"},{\"name\":\"skill:weibei-interactive-study\"}]}"); + } else if (strcmp(type, "prompt") == 0) { + respond(id, type, "{}"); + start_emitter(); + } else if (strcmp(type, "abort") == 0) { + if (cancel_mode) continue; + stop_emitter(); + respond(id, type, "{}"); + } else { + respond(id, type, "{}"); + } + } + stop_emitter(); + free(line); + return 0; +} +"""# diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 5f807a260..cbd13fd7a 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -12,6 +12,12 @@ func expect(_ condition: @autoclosure () -> Bool, _ message: String) { } } +if ProcessInfo.processInfo.environment["WEIBEI_PI_TERMINAL_SELF_CHECK_ONLY"] == "1" { + try await runPiTerminalRuntimeSelfChecks() + print("WeiBei PI terminal runtime self-check passed") + exit(0) +} + try runPiAgentSelfChecks() expect(EmptyWorkspaceDayPeriod(hour: 5) == .morning @@ -793,7 +799,7 @@ for _ in 0..<200 { blankPDFIndexResult?.isTruncated == false { break } - Thread.sleep(forTimeInterval: 0.05) + try? await Task.sleep(nanoseconds: 50_000_000) } expect( mixedIndexResult?.isTruncated == true @@ -906,7 +912,7 @@ for _ in 0..<200 { query: "SPLIT_NATIVE_LAYER_PAGE_1" )[mixedPDFItem.id] if splitFailureResult?.text?.contains("SPLIT_NATIVE_LAYER_PAGE_1") == true { break } - Thread.sleep(forTimeInterval: 0.05) + try? await Task.sleep(nanoseconds: 50_000_000) } expect( splitFailureResult?.text?.contains("SPLIT_NATIVE_LAYER_PAGE_1") == true From 7b63ee3399d3f6b83727802175b7aea7bc6ec8aa Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:58:05 +0800 Subject: [PATCH 33/36] ci: make release checks unambiguous --- .github/workflows/pr-checks.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index edb9806ed..8aeb7574c 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -7,7 +7,6 @@ on: - main push: branches: - - codex/course-workspace - main workflow_dispatch: @@ -42,7 +41,6 @@ jobs: run: swift run WeiBeiSelfCheck - name: 运行 Pi 终止语义自检 - if: ${{ hashFiles('Sources/WeiBeiSelfCheck/PiTerminalRuntimeSelfChecks.swift') != '' }} run: WEIBEI_PI_TERMINAL_SELF_CHECK_ONLY=1 swift run WeiBeiSelfCheck - name: 运行编辑器自检 From 7ee57a703dd88c1454abb1fbc60134499f12c338 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Wed, 15 Jul 2026 23:00:24 +0800 Subject: [PATCH 34/36] feat: preserve imported file identity across moves --- Sources/WeiBei/App/WeiBeiApp.swift | 19 +- Sources/WeiBei/Stores/WorkspaceStore.swift | 427 +++++++++++++++--- .../Support/ImportedIdentitySelfCheck.swift | 316 +++++++++++++ Sources/WeiBeiCore/WorkspaceModels.swift | 44 +- Sources/WeiBeiSelfCheck/main.swift | 6 +- script/build_and_run.sh | 5 +- 6 files changed, 752 insertions(+), 65 deletions(-) create mode 100644 Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index a05342d26..ae3f146b8 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -3,7 +3,13 @@ import SwiftUI import WebKit import WeiBeiCore -@MainActor private let sharedWorkspaceStore = WorkspaceStore() +private let runsImportedIdentitySelfCheck = ProcessInfo.processInfo.arguments.contains("--self-check-imported-identity") +private let importedIdentitySelfCheckBootstrapDirectory = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-imported-identity-bootstrap-\(ProcessInfo.processInfo.processIdentifier)", isDirectory: true) + +@MainActor private let sharedWorkspaceStore = runsImportedIdentitySelfCheck + ? WorkspaceStore(workspaceDirectory: importedIdentitySelfCheckBootstrapDirectory) + : WorkspaceStore() @MainActor final class AppDelegate: NSObject, NSApplicationDelegate { @@ -55,6 +61,17 @@ struct WeiBeiApp: App { @StateObject private var store = sharedWorkspaceStore init() { + if runsImportedIdentitySelfCheck { + defer { try? FileManager.default.removeItem(at: importedIdentitySelfCheckBootstrapDirectory) } + do { + try ImportedIdentitySelfCheck.run() + print("WeiBei imported identity self-checks passed") + exit(EXIT_SUCCESS) + } catch { + fputs("WeiBei imported identity self-check failed: \(error.localizedDescription)\n", stderr) + exit(EXIT_FAILURE) + } + } WeiBeiTypography.registerBundledFonts() } diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index c8aded405..9362fca16 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -1,5 +1,6 @@ import AppKit import Combine +import Darwin import Foundation import SwiftUI import UniformTypeIdentifiers @@ -243,6 +244,7 @@ final class WorkspaceStore: ObservableObject { private var notesByItemID: [String: String] = [:] private let storageURL: URL + private let importedFileIdentityResolver: (URL) -> ImportedFileIdentity? private let piRuntime: PiAgentRuntime private let courseDocumentSearchIndex: CourseDocumentSearchIndex private var activeAgentRequestID: UUID? @@ -322,6 +324,11 @@ final class WorkspaceStore: ObservableObject { var selectedMaterialIsTruncated: Bool } + private struct ResolvedImportedFileBookmark { + var url: URL + var isStale: Bool + } + private var lastUsableAgentAnswer: AgentMessage? { guard lastAgentReplyContextRevision == agentContextRevision else { return nil } return messages.last { $0.isUsableAgentAnswer } @@ -331,9 +338,18 @@ final class WorkspaceStore: ObservableObject { let sampleItems: [StudyItem] = WorkspaceStore.makeSampleItems() - init() { - let folder = Self.workspaceRootDirectory() ?? FileManager.default.temporaryDirectory.appendingPathComponent("WeiBei", isDirectory: true) + convenience init() { + let folder = Self.workspaceRootDirectory() + ?? FileManager.default.temporaryDirectory.appendingPathComponent("WeiBei", isDirectory: true) + self.init(workspaceDirectory: folder) + } + + init( + workspaceDirectory folder: URL, + importedFileIdentityResolver: @escaping (URL) -> ImportedFileIdentity? = WorkspaceStore.resolveImportedFileIdentity + ) { storageURL = folder.appendingPathComponent("workspace.json") + self.importedFileIdentityResolver = importedFileIdentityResolver piRuntime = PiAgentRuntime(runtimeDirectory: folder.appendingPathComponent("AgentRuntime", isDirectory: true)) let courseIndexDirectory = folder.appendingPathComponent("CourseIndex", isDirectory: true) Self.removeLegacyCourseIndex(in: courseIndexDirectory) @@ -342,6 +358,8 @@ final class WorkspaceStore: ObservableObject { ) try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) load() + let resolvedImportedFileBookmarks = resolvePersistedImportedFileBookmarks() + let migratedImportedItemIdentities = migrateLegacyImportedItemIdentities() let migratedStudyLocationTitles = refreshStudyLocationReferenceTitles() let sanitizedNoteSourceLinks = sanitizeNoteSourceLinks() courseDocumentSearchIndex.synchronize(allItems) @@ -350,7 +368,10 @@ final class WorkspaceStore: ObservableObject { migrateNoteSourceLinksFromMarkdown() noteSourceLinksMigrationVersion = 1 save() - } else if migratedStudyLocationTitles || sanitizedNoteSourceLinks { + } else if resolvedImportedFileBookmarks + || migratedImportedItemIdentities + || migratedStudyLocationTitles + || sanitizedNoteSourceLinks { save() } floatingSelectionPrompt = ui("当前选区", "Current selection") @@ -2311,7 +2332,6 @@ final class WorkspaceStore: ObservableObject { markdownNotePaths: Set<String>? = nil, reclassifiesExistingMarkdown: Bool = false ) -> [StudyItem] { - let existing = Set(importedItems.compactMap(\.urlPath)) let supportedURLs = urls .flatMap(Self.supportedCourseFiles(at:)) .reduce(into: [URL]()) { result, url in @@ -2327,55 +2347,157 @@ final class WorkspaceStore: ObservableObject { return markdownNotePaths?.contains(url.path) ?? markdownAsNotes } - var roleChanged = false if reclassifiesExistingMarkdown || markdownNotePaths != nil { persistCurrentNote() - for url in expandedURLs where Self.isMarkdownFile(url) { - guard let index = importedItems.firstIndex(where: { $0.urlPath == url.path }) else { continue } - let nextRole = isNotebookNote(url) - guard importedItems[index].isNotebookNote != nextRole else { continue } - importedItems[index].isNotebookNote = nextRole - roleChanged = true + } + var roleChanged = false + var importedIDs: [String] = [] + var didChangeItems = false + for url in expandedURLs { + let identity = importedFileIdentityResolver(url) + let bookmarkData = identity.flatMap { _ in Self.makeImportedFileBookmark(for: url) } + if let identity { + for index in importedItems.indices + where importedItems[index].urlPath == url.path + && importedItems[index].importedFileIdentity != nil + && importedItems[index].importedFileIdentity != identity { + importedItems[index].importedFileLastKnownPath = url.path + importedItems[index].urlPath = nil + didChangeItems = true + } } - if roleChanged { - if let selectedItemID, - importedItems.first(where: { $0.id == selectedItemID })?.isNotebookNote == true { - self.selectedItemID = courseMaterials.first?.id ?? sampleItems.first?.id - readerLocationTitle = selectedMaterialItem.map(displayTitle) - restoreCurrentStudyLocation() + let matchingIndex = importedItems.firstIndex { item in + if let identity { + return item.importedFileIdentity == identity } - if let activeNotebookItemID, - importedItems.first(where: { $0.id == activeNotebookItemID })?.isNotebookNote == false { - self.activeNotebookItemID = courseNotebookItems.first?.id - noteText = noteText(for: activeNoteItem) + return item.importedFileIdentity == nil && item.urlPath == url.path + } + + if let matchingIndex { + if identity != nil, importedItems[matchingIndex].id.hasPrefix("file:") { + let oldID = importedItems[matchingIndex].id + let newID = Self.makeImportedItemID() + importedItems[matchingIndex].id = newID + replaceItemIDEverywhere(oldID, with: newID) + didChangeItems = true } - _ = sanitizeNoteSourceLinks() - invalidateAgentContext() + importedIDs.append(importedItems[matchingIndex].id) + let nextTitle = url.deletingPathExtension().lastPathComponent + let nextSubtitle = url.lastPathComponent + let nextKind = StudyItemKind.detect(from: url) + let nextRole = isNotebookNote(url) + if importedItems[matchingIndex].isNotebookNote != nextRole { + roleChanged = true + } + if importedItems[matchingIndex].urlPath != url.path + || importedItems[matchingIndex].title != nextTitle + || importedItems[matchingIndex].subtitle != nextSubtitle + || importedItems[matchingIndex].kind != nextKind + || importedItems[matchingIndex].isNotebookNote != nextRole + || importedItems[matchingIndex].importedFileIdentity != identity + || importedItems[matchingIndex].importedFileBookmarkData != bookmarkData + || importedItems[matchingIndex].importedFileLastKnownPath != url.path { + importedItems[matchingIndex].urlPath = url.path + importedItems[matchingIndex].title = nextTitle + importedItems[matchingIndex].subtitle = nextSubtitle + importedItems[matchingIndex].kind = nextKind + importedItems[matchingIndex].isNotebookNote = nextRole + importedItems[matchingIndex].importedFileIdentity = identity + importedItems[matchingIndex].importedFileBookmarkData = bookmarkData + ?? importedItems[matchingIndex].importedFileBookmarkData + importedItems[matchingIndex].importedFileLastKnownPath = url.path + didChangeItems = true + } + continue } + + let item = StudyItem( + id: Self.makeImportedItemID(), + title: url.deletingPathExtension().lastPathComponent, + subtitle: url.lastPathComponent, + kind: StudyItemKind.detect(from: url), + urlPath: url.path, + importedFileIdentity: identity, + importedFileBookmarkData: bookmarkData, + importedFileLastKnownPath: url.path, + isSample: false, + isNotebookNote: isNotebookNote(url) + ) + importedItems.append(item) + importedIDs.append(item.id) + didChangeItems = true } - let newItems = expandedURLs - .filter { !existing.contains($0.path) } - .map { url in - StudyItem( - id: "file:\(url.path)", - title: url.deletingPathExtension().lastPathComponent, - subtitle: url.lastPathComponent, - kind: StudyItemKind.detect(from: url), - urlPath: url.path, - isSample: false, - isNotebookNote: isNotebookNote(url) - ) - } - importedItems.append(contentsOf: newItems) + if roleChanged { + if let selectedItemID, + importedItems.first(where: { $0.id == selectedItemID })?.isNotebookNote == true { + self.selectedItemID = courseMaterials.first?.id ?? sampleItems.first?.id + readerLocationTitle = selectedMaterialItem.map(displayTitle) + restoreCurrentStudyLocation() + } + if let activeNotebookItemID, + importedItems.first(where: { $0.id == activeNotebookItemID })?.isNotebookNote == false { + self.activeNotebookItemID = courseNotebookItems.first?.id + noteText = noteText(for: activeNoteItem) + } + _ = sanitizeNoteSourceLinks() + invalidateAgentContext() + } courseDocumentSearchIndex.synchronize(allItems) - if selectsFirstImportedItem, let first = newItems.first { + let importedIDSet = Set(importedIDs) + let selectedItems = importedItems.filter { importedIDSet.contains($0.id) && !$0.isNotebookNote } + if selectsFirstImportedItem, let first = selectedItems.first { select(itemID: first.id) - } else { + } else if didChangeItems { save() } - let selectedIDs = Set(expandedURLs.map { "file:\($0.path)" }) - return allItems.filter { selectedIDs.contains($0.id) && !$0.isNotebookNote } + return selectedItems + } + + nonisolated private static func resolveImportedFileIdentity(at url: URL) -> ImportedFileIdentity? { + var fileStat = Darwin.stat() + guard url.withUnsafeFileSystemRepresentation({ path in + guard let path else { return false } + return Darwin.lstat(path, &fileStat) == 0 + }) else { + return nil + } + return ImportedFileIdentity( + volumeID: UInt64(fileStat.st_dev), + fileID: UInt64(fileStat.st_ino), + birthTimeSeconds: Int64(fileStat.st_birthtimespec.tv_sec), + birthTimeNanoseconds: Int64(fileStat.st_birthtimespec.tv_nsec) + ) + } + + nonisolated private static func makeImportedFileBookmark(for url: URL) -> Data? { + let resourceKeys: Set<URLResourceKey> = [ + .fileResourceIdentifierKey, + .volumeIdentifierKey, + .creationDateKey, + ] + return try? url.bookmarkData( + options: [.withSecurityScope], + includingResourceValuesForKeys: resourceKeys, + relativeTo: nil + ) + } + + nonisolated private static func resolveImportedFileBookmark(_ data: Data) -> ResolvedImportedFileBookmark? { + var isStale = false + guard let url = try? URL( + resolvingBookmarkData: data, + options: [.withSecurityScope, .withoutUI], + relativeTo: nil, + bookmarkDataIsStale: &isStale + ) else { + return nil + } + return ResolvedImportedFileBookmark(url: url.standardizedFileURL, isStale: isStale) + } + + nonisolated private static func makeImportedItemID() -> String { + "imported:\(UUID().uuidString.lowercased())" } private func makeCourseFolderImportDraft(rootURLs: [URL]) -> CourseFolderImportDraft { @@ -2462,19 +2584,27 @@ final class WorkspaceStore: ObservableObject { let oldItem = importedItems[index] let oldID = oldItem.id let oldTitle = displayTitle(for: oldItem) + let wasActiveNotebook = activeNotebookItemID == oldID let newURL = renamedNotebookURL(in: oldURL.deletingLastPathComponent(), title: title, currentURL: oldURL) do { if oldURL.path != newURL.path { try FileManager.default.moveItem(at: oldURL, to: newURL) } - let newID = "file:\(newURL.path)" + let resolvedIdentity = importedFileIdentityResolver(newURL) + let newID = oldID.hasPrefix("file:") && resolvedIdentity != nil + ? Self.makeImportedItemID() + : (oldID.hasPrefix("file:") ? "file:\(newURL.path)" : oldID) importedItems[index].id = newID importedItems[index].title = newURL.deletingPathExtension().lastPathComponent importedItems[index].subtitle = newURL.lastPathComponent importedItems[index].urlPath = newURL.path - if activeNotebookItemID == oldID { - activeNotebookItemID = newID + importedItems[index].importedFileIdentity = resolvedIdentity ?? oldItem.importedFileIdentity + importedItems[index].importedFileBookmarkData = Self.makeImportedFileBookmark(for: newURL) + ?? oldItem.importedFileBookmarkData + importedItems[index].importedFileLastKnownPath = newURL.path + replaceItemIDEverywhere(oldID, with: newID) + if wasActiveNotebook { noteText = retitledMarkdown(noteText, from: oldTitle, to: importedItems[index].title) persistCurrentNote() } else if let markdown = try? String(contentsOf: newURL, encoding: .utf8) { @@ -2483,21 +2613,9 @@ final class WorkspaceStore: ObservableObject { try updated.write(to: newURL, atomically: true, encoding: .utf8) } } - if let cached = notesByItemID.removeValue(forKey: oldID) { + if let cached = notesByItemID[newID] { notesByItemID[newID] = retitledMarkdown(cached, from: oldTitle, to: importedItems[index].title) } - for linkIndex in noteSourceLinks.indices where noteSourceLinks[linkIndex].noteItemID == oldID { - noteSourceLinks[linkIndex].noteItemID = newID - } - for sessionIndex in studySessions.indices { - studySessions[sessionIndex].focusItemIDs = studySessions[sessionIndex].focusItemIDs.map { - $0 == oldID ? newID : $0 - } - } - if selectedItemID == oldID { - selectedItemID = newID - } - replaceNavigationItemID(oldID, with: newID) courseDocumentSearchIndex.synchronize(allItems) save() notebookRenameDraft = nil @@ -2514,8 +2632,14 @@ final class WorkspaceStore: ObservableObject { let notesDirectory = appOwnedFilesDirectory().appendingPathComponent("Notes", isDirectory: true) let fileName = "\(safeFileStem(title)).md" let url = notesDirectory.appendingPathComponent(fileName) + let existingIdentity = importedFileIdentityResolver(url) - if let index = importedItems.firstIndex(where: { $0.urlPath == url.path }) { + if let index = importedItems.firstIndex(where: { item in + if let existingIdentity { + return item.importedFileIdentity == existingIdentity + } + return item.importedFileIdentity == nil && item.urlPath == url.path + }) { importedItems[index].isNotebookNote = true removeLinksWhereSourceItemID(importedItems[index].id) select(itemID: importedItems[index].id) @@ -2529,13 +2653,26 @@ final class WorkspaceStore: ObservableObject { if !FileManager.default.fileExists(atPath: url.path) { try "# \(title)\n\n".write(to: url, atomically: true, encoding: .utf8) } + let identity = importedFileIdentityResolver(url) + if let identity { + for index in importedItems.indices + where importedItems[index].urlPath == url.path + && importedItems[index].importedFileIdentity != nil + && importedItems[index].importedFileIdentity != identity { + importedItems[index].importedFileLastKnownPath = url.path + importedItems[index].urlPath = nil + } + } let item = StudyItem( - id: "file:\(url.path)", + id: Self.makeImportedItemID(), title: title, subtitle: url.lastPathComponent, kind: .markdown, urlPath: url.path, + importedFileIdentity: identity, + importedFileBookmarkData: identity.flatMap { _ in Self.makeImportedFileBookmark(for: url) }, + importedFileLastKnownPath: url.path, isSample: false, isNotebookNote: true ) @@ -2572,8 +2709,8 @@ final class WorkspaceStore: ObservableObject { do { try FileManager.default.createDirectory(at: notesDirectory, withIntermediateDirectories: true) let url = nextNotebookNoteURL(in: notesDirectory, title: title) - let item = StudyItem( - id: "file:\(url.path)", + var item = StudyItem( + id: Self.makeImportedItemID(), title: url.deletingPathExtension().lastPathComponent, subtitle: url.lastPathComponent, kind: .markdown, @@ -2583,6 +2720,11 @@ final class WorkspaceStore: ObservableObject { ) let markdown = defaultNotebookNote(title: item.title, sourceItem: sourceItem) try markdown.write(to: url, atomically: true, encoding: .utf8) + item.importedFileIdentity = importedFileIdentityResolver(url) + item.importedFileBookmarkData = item.importedFileIdentity.flatMap { _ in + Self.makeImportedFileBookmark(for: url) + } + item.importedFileLastKnownPath = url.path importedItems.append(item) courseDocumentSearchIndex.synchronize(allItems) if let sourceItem { @@ -4893,6 +5035,169 @@ final class WorkspaceStore: ObservableObject { return "# \(newTitle)\n" + String(markdown.dropFirst(prefix.count)) } + @discardableResult + private func resolvePersistedImportedFileBookmarks() -> Bool { + var changed = false + for index in importedItems.indices { + guard let storedIdentity = importedItems[index].importedFileIdentity else { continue } + let currentURL = importedItems[index].urlPath + .map { URL(fileURLWithPath: $0).standardizedFileURL } + let currentPathIsValid = currentURL.map { + importedFileIdentityResolver($0) == storedIdentity + } ?? false + let bookmarkResolution = currentPathIsValid + ? nil + : importedItems[index].importedFileBookmarkData.flatMap(Self.resolveImportedFileBookmark) + let fallbackPath = importedItems[index].urlPath + ?? importedItems[index].importedFileLastKnownPath + let candidateURL = (currentPathIsValid ? currentURL : nil) + ?? bookmarkResolution?.url + ?? fallbackPath.map { URL(fileURLWithPath: $0).standardizedFileURL } + guard let candidateURL, + importedFileIdentityResolver(candidateURL) == storedIdentity else { + if let path = importedItems[index].urlPath { + importedItems[index].importedFileLastKnownPath = path + importedItems[index].urlPath = nil + changed = true + } + continue + } + + let nextPath = candidateURL.path + let nextTitle = candidateURL.deletingPathExtension().lastPathComponent + let nextSubtitle = candidateURL.lastPathComponent + let nextKind = StudyItemKind.detect(from: candidateURL) + if importedItems[index].urlPath != nextPath + || importedItems[index].importedFileLastKnownPath != nextPath + || importedItems[index].title != nextTitle + || importedItems[index].subtitle != nextSubtitle + || importedItems[index].kind != nextKind { + importedItems[index].urlPath = nextPath + importedItems[index].importedFileLastKnownPath = nextPath + importedItems[index].title = nextTitle + importedItems[index].subtitle = nextSubtitle + importedItems[index].kind = nextKind + changed = true + } + let resolvedThroughFallback = !currentPathIsValid && bookmarkResolution == nil + if importedItems[index].importedFileBookmarkData == nil + || bookmarkResolution?.isStale == true + || resolvedThroughFallback, + let refreshedBookmark = Self.makeImportedFileBookmark(for: candidateURL), + importedItems[index].importedFileBookmarkData != refreshedBookmark { + importedItems[index].importedFileBookmarkData = refreshedBookmark + changed = true + } + } + return changed + } + + @discardableResult + private func migrateLegacyImportedItemIdentities() -> Bool { + var changed = false + var canonicalIDByIdentity: [ImportedFileIdentity: String] = [:] + for item in importedItems + where item.importedFileIdentity != nil && !item.id.hasPrefix("file:") { + if let identity = item.importedFileIdentity { + canonicalIDByIdentity[identity] = item.id + } + } + + var migratedItems: [StudyItem] = [] + migratedItems.reserveCapacity(importedItems.count) + for var item in importedItems { + let resolvedIdentity = item.importedFileIdentity + ?? item.url.flatMap(importedFileIdentityResolver) + if item.importedFileIdentity != resolvedIdentity { + item.importedFileIdentity = resolvedIdentity + changed = true + } + if item.importedFileLastKnownPath == nil, let path = item.urlPath { + item.importedFileLastKnownPath = path + changed = true + } + if resolvedIdentity != nil, + item.importedFileBookmarkData == nil, + let url = item.url, + let bookmark = Self.makeImportedFileBookmark(for: url) { + item.importedFileBookmarkData = bookmark + changed = true + } + + if let resolvedIdentity, + let canonicalID = canonicalIDByIdentity[resolvedIdentity], + canonicalID != item.id { + replaceItemIDEverywhere(item.id, with: canonicalID) + changed = true + continue + } + + if resolvedIdentity != nil, item.id.hasPrefix("file:") { + let oldID = item.id + item.id = Self.makeImportedItemID() + replaceItemIDEverywhere(oldID, with: item.id) + changed = true + } + if let resolvedIdentity { + canonicalIDByIdentity[resolvedIdentity] = item.id + } + migratedItems.append(item) + } + importedItems = migratedItems + return changed + } + + private func replaceItemIDEverywhere(_ oldID: String, with newID: String) { + guard oldID != newID else { return } + + if let oldNote = notesByItemID.removeValue(forKey: oldID), notesByItemID[newID] == nil { + notesByItemID[newID] = oldNote + } + if selectedItemID == oldID { selectedItemID = newID } + if activeNotebookItemID == oldID { activeNotebookItemID = newID } + if courseWorkspaceTargetItemID == oldID { courseWorkspaceTargetItemID = newID } + + noteSourceLinks = NoteSourceRelations( + links: noteSourceLinks.map { link in + var copy = link + if copy.noteItemID == oldID { copy.noteItemID = newID } + if copy.sourceItemID == oldID { copy.sourceItemID = newID } + return copy + } + ).links + + if var location = studyLocationsByItemID.removeValue(forKey: oldID) { + location.itemID = newID + if studyLocationsByItemID[newID] == nil { + studyLocationsByItemID[newID] = location + } + } + for index in studySessions.indices { + var seen = Set<String>() + studySessions[index].focusItemIDs = studySessions[index].focusItemIDs.compactMap { itemID in + let migratedID = itemID == oldID ? newID : itemID + return seen.insert(migratedID).inserted ? migratedID : nil + } + } + + if stagedNoteDraft?.itemID == oldID, let value = stagedNoteDraft?.value { + stagedNoteDraft = (newID, value) + } + if notebookCreationDraft?.sourceItemID == oldID { + notebookCreationDraft?.sourceItemID = newID + } + if notebookRenameDraft?.itemID == oldID { + notebookRenameDraft?.itemID = newID + } + + pendingNotePersistenceTasks.removeValue(forKey: oldID)?.cancel() + if var pending = pendingNotePersistenceByItemID.removeValue(forKey: oldID) { + pending.item.id = newID + scheduleNotePersistence(pending.markdown, for: pending.item) + } + replaceNavigationItemID(oldID, with: newID) + } + private func replaceNavigationItemID(_ oldID: String, with newID: String) { backNavigationStack = backNavigationStack.map { snapshot in var copy = snapshot diff --git a/Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift b/Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift new file mode 100644 index 000000000..34e786dd3 --- /dev/null +++ b/Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift @@ -0,0 +1,316 @@ +import Foundation +import WeiBeiCore + +enum ImportedIdentitySelfCheck { + @MainActor + static func run() throws { + try legacyPathSnapshotMigratesItsEntireRelationshipGraph() + try sameVolumeMoveKeepsIdentityRelationsNavigationAndIndex() + try replacedAndCrossVolumeFilesReceiveNewIdentities() + } + + @MainActor + private static func legacyPathSnapshotMigratesItsEntireRelationshipGraph() throws { + let fixture = try WorkspaceFixture(name: "legacy-graph") + defer { fixture.remove() } + + let materialURL = fixture.importsDirectory.appendingPathComponent("第一讲.txt") + let noteURL = fixture.importsDirectory.appendingPathComponent("第一讲笔记.md") + try Data("遗留资料中的货币乘数".utf8).write(to: materialURL) + try Data("# 第一讲笔记\n\n遗留笔记正文".utf8).write(to: noteURL) + + let legacyMaterialID = "file:\(materialURL.path)" + let legacyNoteID = "file:\(noteURL.path)" + let session = StudySession( + title: "第一讲复习", + focusItemIDs: [legacyMaterialID, legacyNoteID] + ) + let snapshot = PersistedWorkspace( + importedItems: [ + StudyItem( + id: legacyMaterialID, + title: "第一讲", + subtitle: materialURL.lastPathComponent, + kind: .text, + urlPath: materialURL.path, + isSample: false + ), + StudyItem( + id: legacyNoteID, + title: "第一讲笔记", + subtitle: noteURL.lastPathComponent, + kind: .markdown, + urlPath: noteURL.path, + isSample: false, + isNotebookNote: true + ), + ], + notesByItemID: [legacyNoteID: "遗留缓存笔记"], + selectedItemID: legacyMaterialID, + activeNotebookItemID: legacyNoteID, + noteSourceLinks: [ + NoteSourceLink(noteItemID: legacyNoteID, sourceItemID: legacyMaterialID), + ], + noteSourceLinksMigrationVersion: 1, + studyLocationsByItemID: [ + legacyMaterialID: StudyLocation( + itemID: legacyMaterialID, + itemTitle: "第一讲", + locationTitle: "上次读到这里", + visitCount: 3 + ), + ], + studySessions: [session], + activeStudySessionID: session.id + ) + try fixture.write(snapshot) + + let store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + let material = try require( + store.importedItems.first { $0.urlPath == materialURL.path }, + "旧快照迁移后找不到资料" + ) + let note = try require( + store.importedItems.first { $0.urlPath == noteURL.path }, + "旧快照迁移后找不到笔记" + ) + + try check(material.id.hasPrefix("imported:"), "旧资料仍在使用路径身份") + try check(note.id.hasPrefix("imported:"), "旧笔记仍在使用路径身份") + try check(material.importedFileIdentity != nil, "旧资料没有补入文件身份") + try check(note.importedFileIdentity != nil, "旧笔记没有补入文件身份") + try check(material.importedFileBookmarkData != nil, "旧资料没有补入持久文件书签") + try check(note.importedFileBookmarkData != nil, "旧笔记没有补入持久文件书签") + try check(material.importedFileLastKnownPath == materialURL.path, "旧资料没有保留最后路径") + try check(store.selectedItemID == material.id, "当前资料没有迁移到新身份") + try check(store.activeNotebookItemID == note.id, "当前笔记没有迁移到新身份") + try check(store.linkedSourceIDs(for: note.id) == [material.id], "笔记资料关系没有随身份迁移") + try check(store.studyLocation(for: material.id)?.itemID == material.id, "阅读位置没有随身份迁移") + try check(Set(store.activeStudySession?.focusItemIDs ?? []) == Set([material.id, note.id]), "学习会话没有随身份迁移") + + let persisted = try fixture.readSnapshot() + try check(persisted.notesByItemID[note.id] == "遗留缓存笔记", "笔记缓存没有随身份迁移") + try check(persisted.notesByItemID[legacyNoteID] == nil, "旧路径身份仍残留在笔记缓存") + try check(persisted.studyLocationsByItemID?[legacyMaterialID] == nil, "旧路径身份仍残留在阅读位置") + } + + @MainActor + private static func sameVolumeMoveKeepsIdentityRelationsNavigationAndIndex() throws { + let fixture = try WorkspaceFixture(name: "same-volume-move") + defer { fixture.remove() } + + let originalURL = fixture.importsDirectory.appendingPathComponent("第二讲.txt") + let noteURL = fixture.importsDirectory.appendingPathComponent("第二讲笔记.md") + try Data("原始索引词:流动性偏好".utf8).write(to: originalURL) + try Data("# 第二讲笔记\n".utf8).write(to: noteURL) + + var store: WorkspaceStore? = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + _ = store?.importFiles( + [originalURL, noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let firstMaterial = try require( + store?.courseMaterials.first { $0.urlPath == originalURL.path }, + "首次导入没有返回资料" + ) + let note = try require( + store?.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "首次导入没有返回笔记" + ) + try check(firstMaterial.id.hasPrefix("imported:"), "新导入资料没有使用稳定身份") + try check(firstMaterial.importedFileBookmarkData != nil, "新导入资料没有持久文件书签") + + store?.setLinkedSourceIDs([firstMaterial.id], for: note.id) + store?.select(itemID: note.id) + store?.select(itemID: firstMaterial.id) + store?.flushPendingNotePersistence() + let originalSessionID = store?.activeStudySessionID + + let searchIndex = CourseDocumentSearchIndex( + databaseURL: fixture.indexDirectory.appendingPathComponent("search.sqlite3") + ) + let originalSearch = searchIndex.lookup(items: [firstMaterial], query: "流动性偏好") + try check(originalSearch[firstMaterial.id]?.text?.contains("流动性偏好") == true, "首次导入没有进入全文索引") + + let renamedURL = fixture.importsDirectory.appendingPathComponent("第二讲-改名.txt") + try FileManager.default.moveItem(at: originalURL, to: renamedURL) + store = nil + + store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + let renamedMaterial = try require( + store?.courseMaterials.first { $0.id == firstMaterial.id }, + "重启后找不到改名资料" + ) + try check(renamedMaterial.id == firstMaterial.id, "同卷改名并重启后资料身份发生变化") + try check(renamedMaterial.urlPath == renamedURL.path, "同卷改名后必须重新导入才能找到新路径") + try check(store?.importedItems.filter { $0.id == firstMaterial.id }.count == 1, "同卷改名后出现重复资料") + try check(store?.linkedSourceIDs(for: note.id) == [firstMaterial.id], "改名后笔记关系丢失") + try check(store?.studyLocation(for: firstMaterial.id) != nil, "改名后阅读位置丢失") + try check(store?.activeStudySessionID == originalSessionID, "改名后学习会话被替换") + try check(Set(store?.activeStudySession?.focusItemIDs ?? []).isSuperset(of: [firstMaterial.id, note.id]), "改名后学习会话焦点丢失") + + let countBeforeDuplicateImport = store?.importedItems.count + let duplicateImport = try require( + store?.importFiles([renamedURL], selectsFirstImportedItem: false).first, + "改名资料重复导入失败" + ) + try check(duplicateImport.id == firstMaterial.id, "重复导入改名资料产生了新身份") + try check(store?.importedItems.count == countBeforeDuplicateImport, "重复导入改名资料产生了重复项") + + store?.select(itemID: firstMaterial.id) + store?.select(itemID: "sample-pdf") + store?.navigateBackInWorkspace() + try check(store?.selectedItemID == firstMaterial.id, "资料改名后后退导航没有回到原资料") + try check(store?.selectedMaterialItem?.urlPath == renamedURL.path, "改名后的后退导航仍指向旧路径") + let movedDirectory = fixture.importsDirectory.appendingPathComponent("已整理", isDirectory: true) + try FileManager.default.createDirectory(at: movedDirectory, withIntermediateDirectories: true) + let movedURL = movedDirectory.appendingPathComponent("第二讲最终版.txt") + try FileManager.default.moveItem(at: renamedURL, to: movedURL) + try Data("更新后的索引词:期限结构理论".utf8).write(to: movedURL) + store?.flushPendingNotePersistence() + store = nil + + store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + let movedMaterial = try require( + store?.courseMaterials.first { $0.id == firstMaterial.id }, + "再次重启后找不到移动资料" + ) + try check(movedMaterial.id == firstMaterial.id, "同卷移动后资料身份发生变化") + try check(movedMaterial.urlPath == movedURL.path, "同卷移动后必须重新导入才能找到新路径") + + searchIndex.synchronize([movedMaterial]) + let movedSearch = searchIndex.lookup(items: [movedMaterial], query: "期限结构理论") + try check(movedSearch[firstMaterial.id]?.text?.contains("期限结构理论") == true, "资料移动后全文索引没有沿用身份并刷新内容") + + try check(store?.linkedSourceIDs(for: note.id) == [firstMaterial.id], "再次重启后笔记关系丢失") + } + + @MainActor + private static func replacedAndCrossVolumeFilesReceiveNewIdentities() throws { + let fixture = try WorkspaceFixture(name: "identity-boundaries") + defer { fixture.remove() } + + let sourceURL = fixture.importsDirectory.appendingPathComponent("第三讲.txt") + let copyURL = fixture.importsDirectory.appendingPathComponent("第三讲-副本.txt") + try Data("第三讲原文件".utf8).write(to: sourceURL) + try Data("第三讲跨卷副本".utf8).write(to: copyURL) + + let firstIdentity = ImportedFileIdentity( + volumeID: 10, + fileID: 99, + birthTimeSeconds: 1_000, + birthTimeNanoseconds: 10 + ) + let replacementIdentity = ImportedFileIdentity( + volumeID: 10, + fileID: 99, + birthTimeSeconds: 2_000, + birthTimeNanoseconds: 20 + ) + let crossVolumeIdentity = ImportedFileIdentity( + volumeID: 11, + fileID: 99, + birthTimeSeconds: 1_000, + birthTimeNanoseconds: 10 + ) + var identities = [ + sourceURL.path: firstIdentity, + copyURL.path: crossVolumeIdentity, + ] + var store: WorkspaceStore? = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: { identities[$0.path] } + ) + + let first = try require( + store?.importFiles([sourceURL], selectsFirstImportedItem: false).first, + "首次导入身份边界资料失败" + ) + store?.select(itemID: first.id) + try check(store?.studyLocation(for: first.id) != nil, "首次资料没有阅读位置") + store?.flushPendingNotePersistence() + + try FileManager.default.removeItem(at: sourceURL) + try Data("第三讲删除后重建".utf8).write(to: sourceURL) + identities[sourceURL.path] = replacementIdentity + store = nil + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: { identities[$0.path] } + ) + try check(store?.importedItems.first { $0.id == first.id }?.urlPath == nil, "重启时书签错误接受了世代不同的重建文件") + let replacement = try require( + store?.importFiles([sourceURL], selectsFirstImportedItem: false).first, + "删除重建后重新导入失败" + ) + try check(replacement.id != first.id, "删除重建的文件错误继承了旧身份") + try check(store?.studyLocation(for: replacement.id) == nil, "删除重建的文件错误继承了旧阅读位置") + try check(store?.importedItems.first { $0.id == first.id }?.urlPath == nil, "旧资料仍错误指向删除重建后的文件") + + let crossVolumeCopy = try require( + store?.importFiles([copyURL], selectsFirstImportedItem: false).first, + "跨卷副本导入失败" + ) + try check(crossVolumeCopy.id != first.id, "跨卷副本错误继承了原文件身份") + try check(crossVolumeCopy.id != replacement.id, "跨卷副本错误继承了重建文件身份") + let countBeforeDuplicateImport = store?.importedItems.count + let duplicate = try require( + store?.importFiles([copyURL], selectsFirstImportedItem: false).first, + "重复导入跨卷副本失败" + ) + try check(duplicate.id == crossVolumeCopy.id, "重复导入同一文件产生了新身份") + try check(store?.importedItems.count == countBeforeDuplicateImport, "重复导入同一文件产生了重复资料") + } + + private static func require<T>(_ value: T?, _ message: String) throws -> T { + guard let value else { throw CheckError.failed(message) } + return value + } + + private static func check(_ condition: @autoclosure () -> Bool, _ message: String) throws { + guard condition() else { throw CheckError.failed(message) } + } + + private enum CheckError: LocalizedError { + case failed(String) + + var errorDescription: String? { + switch self { + case .failed(let message): message + } + } + } + + private struct WorkspaceFixture { + let root: URL + let workspaceDirectory: URL + let importsDirectory: URL + let indexDirectory: URL + + init(name: String) throws { + root = FileManager.default.temporaryDirectory + .appendingPathComponent("weibei-stable-identity-\(name)-\(UUID().uuidString)", isDirectory: true) + workspaceDirectory = root.appendingPathComponent("Workspace", isDirectory: true) + importsDirectory = root.appendingPathComponent("Imports", isDirectory: true) + indexDirectory = root.appendingPathComponent("Index", isDirectory: true) + try FileManager.default.createDirectory(at: workspaceDirectory, withIntermediateDirectories: true) + try FileManager.default.createDirectory(at: importsDirectory, withIntermediateDirectories: true) + try FileManager.default.createDirectory(at: indexDirectory, withIntermediateDirectories: true) + } + + func write(_ snapshot: PersistedWorkspace) throws { + let data = try JSONEncoder().encode(snapshot) + try data.write(to: workspaceDirectory.appendingPathComponent("workspace.json"), options: [.atomic]) + } + + func readSnapshot() throws -> PersistedWorkspace { + let data = try Data(contentsOf: workspaceDirectory.appendingPathComponent("workspace.json")) + return try JSONDecoder().decode(PersistedWorkspace.self, from: data) + } + + func remove() { + try? FileManager.default.removeItem(at: root) + } + } +} diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index 1fb650b6d..d9571077e 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -720,21 +720,57 @@ public enum SelectionFloatingAgentPlacement { } } +public struct ImportedFileIdentity: Codable, Hashable, Sendable { + public var volumeID: UInt64 + public var fileID: UInt64 + public var birthTimeSeconds: Int64 + public var birthTimeNanoseconds: Int64 + + public init( + volumeID: UInt64, + fileID: UInt64, + birthTimeSeconds: Int64, + birthTimeNanoseconds: Int64 + ) { + self.volumeID = volumeID + self.fileID = fileID + self.birthTimeSeconds = birthTimeSeconds + self.birthTimeNanoseconds = birthTimeNanoseconds + } +} + public struct StudyItem: Identifiable, Codable, Hashable, Sendable { public var id: String public var title: String public var subtitle: String public var kind: StudyItemKind public var urlPath: String? + public var importedFileIdentity: ImportedFileIdentity? + public var importedFileBookmarkData: Data? + public var importedFileLastKnownPath: String? public var isSample: Bool public var isNotebookNote: Bool - public init(id: String, title: String, subtitle: String, kind: StudyItemKind, urlPath: String?, isSample: Bool, isNotebookNote: Bool = false) { + public init( + id: String, + title: String, + subtitle: String, + kind: StudyItemKind, + urlPath: String?, + importedFileIdentity: ImportedFileIdentity? = nil, + importedFileBookmarkData: Data? = nil, + importedFileLastKnownPath: String? = nil, + isSample: Bool, + isNotebookNote: Bool = false + ) { self.id = id self.title = title self.subtitle = subtitle self.kind = kind self.urlPath = urlPath + self.importedFileIdentity = importedFileIdentity + self.importedFileBookmarkData = importedFileBookmarkData + self.importedFileLastKnownPath = importedFileLastKnownPath ?? urlPath self.isSample = isSample self.isNotebookNote = isNotebookNote } @@ -745,6 +781,9 @@ public struct StudyItem: Identifiable, Codable, Hashable, Sendable { case subtitle case kind case urlPath + case importedFileIdentity + case importedFileBookmarkData + case importedFileLastKnownPath case isSample case isNotebookNote } @@ -756,6 +795,9 @@ public struct StudyItem: Identifiable, Codable, Hashable, Sendable { subtitle = try container.decode(String.self, forKey: .subtitle) kind = try container.decode(StudyItemKind.self, forKey: .kind) urlPath = try container.decodeIfPresent(String.self, forKey: .urlPath) + importedFileIdentity = try container.decodeIfPresent(ImportedFileIdentity.self, forKey: .importedFileIdentity) + importedFileBookmarkData = try container.decodeIfPresent(Data.self, forKey: .importedFileBookmarkData) + importedFileLastKnownPath = try container.decodeIfPresent(String.self, forKey: .importedFileLastKnownPath) ?? urlPath isSample = try container.decode(Bool.self, forKey: .isSample) isNotebookNote = try container.decodeIfPresent(Bool.self, forKey: .isNotebookNote) ?? false } diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index cbd13fd7a..d8cd0789a 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -221,8 +221,11 @@ expect(runScript.contains("BUILD_CONFIGURATION=\"release\"") && runScript.contains("swift build -c \"$BUILD_CONFIGURATION\"") && runScript.contains("swift build -c \"$BUILD_CONFIGURATION\" --show-bin-path") && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiSelfCheck") + && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBei --self-check-imported-identity") && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiWebEditorCheck") && runScript.contains("swift run -c \"$BUILD_CONFIGURATION\" WeiBeiPiCheck"), "user-facing app builds are optimized while check and debugger modes remain debuggable") +expect(runScript.contains("'\"activeNotebookItemID\":\"imported:'") + && runScript.contains("&& ! /usr/bin/grep -q '\"activeNotebookItemID\":\"file:'"), "linked-source verification requires stable notebook identity and rejects a legacy path identity") expect(runScript.contains("${PRODUCT_NAME}_WeiBeiCore.bundle") && runScript.contains("for resource_bundle in \"${RESOURCE_BUNDLES[@]}\"") && runScript.contains("cp -R \"$resource_bundle\" \"$APP_RESOURCES/\"") @@ -2264,7 +2267,8 @@ expect(appSource.contains("segmented(NoteRenderMode.visibleCases, active: store. let interactiveInputSources = [contentViewSource, sidebarSource, commandPaletteSource, notesAgentSource, appSource].joined(separator: "\n") expect(!interactiveInputSources.contains(".weibeiInputPrompt("), "interactive input placeholders stay on native prompts instead of overlay text") expect(appSource.contains("WeiBeiTextActionButtonStyle(active: true)") && appSource.contains(".background(WeiBeiTheme.paper)") && appSource.contains("WeiBeiGlassHeaderBackground(paperOpacity: 0.66"), "settings view uses WeiBei paper, glass header, and button styles") -expect(appSource.contains("init() {\n WeiBeiTypography.registerBundledFonts()\n }"), "app registers bundled WeiBei fonts before the SwiftUI window tree is built") +expect(appSource.contains("init() {") + && appSource.contains("WeiBeiTypography.registerBundledFonts()"), "app registers bundled WeiBei fonts before the SwiftUI window tree is built") let workspaceStoreSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Stores/WorkspaceStore.swift") let workspaceStoreSource = (try? String(contentsOf: workspaceStoreSourceURL, encoding: .utf8)) ?? "" diff --git a/script/build_and_run.sh b/script/build_and_run.sh index 3d46ebe8e..af0169744 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -491,7 +491,8 @@ verify_linked_sources_flow() { && /usr/bin/grep -q '"sourceItemID":"sample-pdf"' "$workspace_file" \ && /usr/bin/grep -q '"selectedItemID":"sample-pdf"' "$workspace_file" \ && /usr/bin/grep -q '"showLibrary":false' "$workspace_file" \ - && /usr/bin/grep -q '"activeNotebookItemID":"file:' "$workspace_file"; then + && /usr/bin/grep -q '"activeNotebookItemID":"imported:' "$workspace_file" \ + && ! /usr/bin/grep -q '"activeNotebookItemID":"file:' "$workspace_file"; then return 0 fi sleep 0.2 @@ -755,6 +756,8 @@ finish_verify_window() { run_verifiers() { WEIBEI_PI_EXECUTABLE="$PI_RUNTIME_BINARY" \ swift run -c "$BUILD_CONFIGURATION" WeiBeiSelfCheck + WEIBEI_SUPPRESS_ACTIVATION=1 \ + swift run -c "$BUILD_CONFIGURATION" WeiBei --self-check-imported-identity swift run -c "$BUILD_CONFIGURATION" WeiBeiWebEditorCheck WEIBEI_PI_EXECUTABLE="$PI_RUNTIME_BINARY" \ swift run -c "$BUILD_CONFIGURATION" WeiBeiPiCheck From fdba7ed60a42591ba62ad59d340df2f3c4399741 Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:04:10 +0800 Subject: [PATCH 35/36] fix: make imported identity recovery lossless --- Sources/WeiBei/Stores/WorkspaceStore.swift | 865 ++++++++++++++++-- .../Support/ImportedIdentitySelfCheck.swift | 856 ++++++++++++++++- Sources/WeiBeiCore/WorkspaceModels.swift | 16 +- Sources/WeiBeiSelfCheck/main.swift | 15 +- 4 files changed, 1656 insertions(+), 96 deletions(-) diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 9362fca16..7d95f7ef0 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -1,5 +1,6 @@ import AppKit import Combine +import CryptoKit import Darwin import Foundation import SwiftUI @@ -243,8 +244,15 @@ final class WorkspaceStore: ObservableObject { @Published private var forwardNavigationStack: [NavigationSnapshot] = [] private var notesByItemID: [String: String] = [:] + private var pendingNoteWritesByItemID: [String: PendingNoteWriteState] = [:] + private var noteBackingContentDigestsByItemID: [String: String] = [:] private let storageURL: URL + private let notebookRenameJournalURL: URL private let importedFileIdentityResolver: (URL) -> ImportedFileIdentity? + private let notebookMarkdownReader: (URL) throws -> String + private let notebookMarkdownWriter: (String, URL) throws -> Void + private let notebookFileMover: (URL, URL) throws -> Void + private let workspaceSnapshotWriter: (Data, URL) throws -> Void private let piRuntime: PiAgentRuntime private let courseDocumentSearchIndex: CourseDocumentSearchIndex private var activeAgentRequestID: UUID? @@ -329,6 +337,18 @@ final class WorkspaceStore: ObservableObject { var isStale: Bool } + private struct PendingNotebookRenameJournal: Codable { + var oldItem: StudyItem + var replacementItemID: String + var oldPath: String + var newPath: String + var newTitle: String + var sourceMarkdown: String + var retitledMarkdown: String + var originalContentDigest: String + var retitledContentDigest: String + } + private var lastUsableAgentAnswer: AgentMessage? { guard lastAgentReplyContextRevision == agentContextRevision else { return nil } return messages.last { $0.isUsableAgentAnswer } @@ -346,10 +366,19 @@ final class WorkspaceStore: ObservableObject { init( workspaceDirectory folder: URL, - importedFileIdentityResolver: @escaping (URL) -> ImportedFileIdentity? = WorkspaceStore.resolveImportedFileIdentity + importedFileIdentityResolver: @escaping (URL) -> ImportedFileIdentity? = WorkspaceStore.resolveImportedFileIdentity, + notebookMarkdownReader: @escaping (URL) throws -> String = WorkspaceStore.readNotebookMarkdown, + notebookMarkdownWriter: @escaping (String, URL) throws -> Void = WorkspaceStore.writeNotebookMarkdown, + notebookFileMover: @escaping (URL, URL) throws -> Void = WorkspaceStore.moveNotebookFile, + workspaceSnapshotWriter: @escaping (Data, URL) throws -> Void = WorkspaceStore.writeWorkspaceSnapshot ) { storageURL = folder.appendingPathComponent("workspace.json") + notebookRenameJournalURL = folder.appendingPathComponent("pending-notebook-rename.json") self.importedFileIdentityResolver = importedFileIdentityResolver + self.notebookMarkdownReader = notebookMarkdownReader + self.notebookMarkdownWriter = notebookMarkdownWriter + self.notebookFileMover = notebookFileMover + self.workspaceSnapshotWriter = workspaceSnapshotWriter piRuntime = PiAgentRuntime(runtimeDirectory: folder.appendingPathComponent("AgentRuntime", isDirectory: true)) let courseIndexDirectory = folder.appendingPathComponent("CourseIndex", isDirectory: true) Self.removeLegacyCourseIndex(in: courseIndexDirectory) @@ -358,21 +387,34 @@ final class WorkspaceStore: ObservableObject { ) try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) load() + let recoveredPendingNotebookRename = recoverPendingNotebookRenameIfNeeded() let resolvedImportedFileBookmarks = resolvePersistedImportedFileBookmarks() let migratedImportedItemIdentities = migrateLegacyImportedItemIdentities() + if recoveredPendingNotebookRename + || resolvedImportedFileBookmarks + || migratedImportedItemIdentities { + noteText = noteText(for: activeNoteItem) + } let migratedStudyLocationTitles = refreshStudyLocationReferenceTitles() let sanitizedNoteSourceLinks = sanitizeNoteSourceLinks() courseDocumentSearchIndex.synchronize(allItems) ensureActiveStudySession() + let savedInitializationChanges: Bool if noteSourceLinksMigrationVersion < 1 { migrateNoteSourceLinksFromMarkdown() noteSourceLinksMigrationVersion = 1 - save() + savedInitializationChanges = save() } else if resolvedImportedFileBookmarks + || recoveredPendingNotebookRename || migratedImportedItemIdentities || migratedStudyLocationTitles || sanitizedNoteSourceLinks { - save() + savedInitializationChanges = save() + } else { + savedInitializationChanges = true + } + if recoveredPendingNotebookRename, savedInitializationChanges { + removePendingNotebookRenameJournal() } floatingSelectionPrompt = ui("当前选区", "Current selection") if selectedItemID == nil { @@ -2366,12 +2408,18 @@ final class WorkspaceStore: ObservableObject { didChangeItems = true } } - let matchingIndex = importedItems.firstIndex { item in + let identityMatchingIndex = importedItems.firstIndex { item in if let identity { return item.importedFileIdentity == identity } return item.importedFileIdentity == nil && item.urlPath == url.path } + let legacyPathMatchingIndex = identity == nil ? nil : importedItems.firstIndex { item in + item.id.hasPrefix("file:") + && item.importedFileIdentity == nil + && (item.urlPath == url.path || item.importedFileLastKnownPath == url.path) + } + let matchingIndex = identityMatchingIndex ?? legacyPathMatchingIndex if let matchingIndex { if identity != nil, importedItems[matchingIndex].id.hasPrefix("file:") { @@ -2476,24 +2524,38 @@ final class WorkspaceStore: ObservableObject { .volumeIdentifierKey, .creationDateKey, ] - return try? url.bookmarkData( + if let scopedBookmark = try? url.bookmarkData( options: [.withSecurityScope], includingResourceValuesForKeys: resourceKeys, relativeTo: nil + ) { + return scopedBookmark + } + return try? url.bookmarkData( + options: [], + includingResourceValuesForKeys: resourceKeys, + relativeTo: nil ) } nonisolated private static func resolveImportedFileBookmark(_ data: Data) -> ResolvedImportedFileBookmark? { var isStale = false - guard let url = try? URL( + if let scopedURL = try? URL( resolvingBookmarkData: data, options: [.withSecurityScope, .withoutUI], relativeTo: nil, bookmarkDataIsStale: &isStale - ) else { - return nil + ) { + return ResolvedImportedFileBookmark(url: scopedURL.standardizedFileURL, isStale: isStale) } - return ResolvedImportedFileBookmark(url: url.standardizedFileURL, isStale: isStale) + isStale = false + guard let plainURL = try? URL( + resolvingBookmarkData: data, + options: [.withoutUI], + relativeTo: nil, + bookmarkDataIsStale: &isStale + ) else { return nil } + return ResolvedImportedFileBookmark(url: plainURL.standardizedFileURL, isStale: isStale) } nonisolated private static func makeImportedItemID() -> String { @@ -2577,51 +2639,354 @@ final class WorkspaceStore: ObservableObject { noteFileError = ui("笔记名不能为空。", "Note name cannot be empty.") return } - guard let index = importedItems.firstIndex(where: { $0.id == itemID && $0.isNotebookNote }), - let oldURL = importedItems[index].url else { return } + guard let initialIndex = importedItems.firstIndex(where: { $0.id == itemID && $0.isNotebookNote }) else { return } + let oldTitle = displayTitle(for: importedItems[initialIndex]) + if let stagedNoteDraft, stagedNoteDraft.itemID == itemID { + self.stagedNoteDraft = nil + updateNote(stagedNoteDraft.value, for: itemID) + } + flushPendingNotePersistence(for: itemID) persistCurrentNote() + if pendingNoteWritesByItemID[itemID] != nil { + noteFileError = ui( + "这份笔记还有待写草稿或外部冲突;两份内容都已保留,处理完成前不会重命名文件。", + "This note still has a pending draft or external conflict. Both versions were kept, and the file will not be renamed until it is resolved." + ) + save() + return + } + guard let index = importedItems.firstIndex(where: { $0.id == itemID && $0.isNotebookNote }) else { return } + let resolution = resolveTrackedImportedFile(at: index) + guard let oldURL = resolution.url else { + noteFileError = ui( + "找不到这份笔记的当前位置,最新编辑已保留,未执行重命名。", + "The current note location could not be found. The latest edit was retained and the note was not renamed." + ) + save() + return + } let oldItem = importedItems[index] let oldID = oldItem.id - let oldTitle = displayTitle(for: oldItem) let wasActiveNotebook = activeNotebookItemID == oldID let newURL = renamedNotebookURL(in: oldURL.deletingLastPathComponent(), title: title, currentURL: oldURL) + let newTitle = newURL.deletingPathExtension().lastPathComponent + let sourceMarkdown: String + do { + sourceMarkdown = wasActiveNotebook ? noteText : try notebookMarkdownReader(oldURL) + } catch { + noteFileError = ui( + "无法重命名笔记:无法读取原 Markdown,文件和课程关系均未改动。", + "Could not rename the note because the original Markdown could not be read. The file and course relationships were not changed." + ) + save() + return + } + let retitledMarkdown = retitledMarkdown(sourceMarkdown, from: oldTitle, to: newTitle) + guard let originalContentDigest = noteBackingContentDigestsByItemID[oldID] + ?? Self.noteContentDigest(at: oldURL) else { + noteFileError = ui( + "无法重命名笔记:无法确认原 Markdown 内容,文件和课程关系均未改动。", + "Could not rename the note because the original Markdown contents could not be verified. The file and course relationships were not changed." + ) + save() + return + } + let sourceMarkdownDigest = Self.noteContentDigest(Data(sourceMarkdown.utf8)) + let willRewriteMarkdown = retitledMarkdown != sourceMarkdown + let expectedOutputDigest = willRewriteMarkdown + ? Self.noteContentDigest(Data(retitledMarkdown.utf8)) + : originalContentDigest + let originalIdentity = oldItem.importedFileIdentity + ?? importedFileIdentityResolver(oldURL) + let replacementItemID = oldID.hasPrefix("file:") && originalIdentity != nil + ? Self.makeImportedItemID() + : (oldID.hasPrefix("file:") ? "file:\(newURL.path)" : oldID) + var journalOldItem = oldItem + journalOldItem.importedFileIdentity = originalIdentity + let renameJournal = PendingNotebookRenameJournal( + oldItem: journalOldItem, + replacementItemID: replacementItemID, + oldPath: oldURL.path, + newPath: newURL.path, + newTitle: newTitle, + sourceMarkdown: sourceMarkdown, + retitledMarkdown: retitledMarkdown, + originalContentDigest: originalContentDigest, + retitledContentDigest: expectedOutputDigest + ) + guard save() else { + noteFileError = ui( + "无法重命名笔记:当前课程状态尚未安全保存,文件和关系均未改动。", + "Could not rename the note because the current course state was not safely saved. The file and relationships were not changed." + ) + return + } + removePendingNotebookRenameJournal() + do { + try writePendingNotebookRenameJournal(renameJournal) + } catch { + noteFileError = ui( + "无法重命名笔记:无法建立崩溃恢复记录,文件和课程关系均未改动。", + "Could not rename the note because a crash-recovery record could not be created. The file and course relationships were not changed." + ) + save() + return + } + + var movedFile = false + var verifiedApplicationOutput = false do { if oldURL.path != newURL.path { - try FileManager.default.moveItem(at: oldURL, to: newURL) + try notebookFileMover(oldURL, newURL) + movedFile = true + } + let movedIdentity = importedFileIdentityResolver(newURL) + let identityChanged = !oldID.hasPrefix("file:") + && (originalIdentity == nil || movedIdentity != originalIdentity) + let movedContentDigest = Self.noteContentDigest(at: newURL) + let contentChanged = movedContentDigest != originalContentDigest + if identityChanged || contentChanged { + throw NSError( + domain: "WeiBei.ImportedFileIdentity", + code: 1, + userInfo: [ + NSLocalizedDescriptionKey: ui( + "文件身份或内容在重命名期间发生变化,操作已中止。", + "The file identity or content changed during rename, so the operation was stopped." + ), + ] + ) } - let resolvedIdentity = importedFileIdentityResolver(newURL) - let newID = oldID.hasPrefix("file:") && resolvedIdentity != nil - ? Self.makeImportedItemID() - : (oldID.hasPrefix("file:") ? "file:\(newURL.path)" : oldID) - importedItems[index].id = newID - importedItems[index].title = newURL.deletingPathExtension().lastPathComponent - importedItems[index].subtitle = newURL.lastPathComponent - importedItems[index].urlPath = newURL.path - importedItems[index].importedFileIdentity = resolvedIdentity ?? oldItem.importedFileIdentity - importedItems[index].importedFileBookmarkData = Self.makeImportedFileBookmark(for: newURL) + + var coordinatedIdentity: ImportedFileIdentity? + var coordinatedDigest: String? + var coordinationError: NSError? + var operationError: Error? + let coordinator = NSFileCoordinator(filePresenter: nil) + coordinator.coordinate( + writingItemAt: newURL, + options: .forReplacing, + error: &coordinationError + ) { coordinatedURL in + do { + guard importedFileIdentityResolver(coordinatedURL) == movedIdentity, + Self.noteContentDigest(at: coordinatedURL) == originalContentDigest else { + throw NSError( + domain: "WeiBei.ImportedFileIdentity", + code: 2, + userInfo: [ + NSLocalizedDescriptionKey: ui( + "写入前检测到文件被外部修改,操作已中止。", + "The file changed externally before writing, so the operation was stopped." + ), + ] + ) + } + if willRewriteMarkdown { + try notebookMarkdownWriter(retitledMarkdown, coordinatedURL) + } + let identityBeforeRead = importedFileIdentityResolver(coordinatedURL) + let outputData = try Data(contentsOf: coordinatedURL) + let identityAfterRead = importedFileIdentityResolver(coordinatedURL) + let outputDigest = Self.noteContentDigest(outputData) + guard identityBeforeRead == identityAfterRead, + outputDigest == expectedOutputDigest else { + throw NSError( + domain: "WeiBei.ImportedFileIdentity", + code: 3, + userInfo: [ + NSLocalizedDescriptionKey: ui( + "写入后文件内容或身份不一致,操作已中止。", + "The file contents or identity did not match after writing, so the operation was stopped." + ), + ] + ) + } + if !oldID.hasPrefix("file:"), identityAfterRead == nil { + throw NSError( + domain: "WeiBei.ImportedFileIdentity", + code: 4, + userInfo: [ + NSLocalizedDescriptionKey: ui( + "写入标题后无法确认文件身份,操作已中止。", + "The file identity could not be confirmed after writing the title, so the operation was stopped." + ), + ] + ) + } + coordinatedIdentity = identityAfterRead + coordinatedDigest = outputDigest + verifiedApplicationOutput = true + } catch { + operationError = error + } + } + if let coordinationError { throw coordinationError } + if let operationError { throw operationError } + guard let finalContentDigest = coordinatedDigest, + importedFileIdentityResolver(newURL) == coordinatedIdentity, + Self.noteContentDigest(at: newURL) == finalContentDigest else { + throw NSError( + domain: "WeiBei.ImportedFileIdentity", + code: 5, + userInfo: [ + NSLocalizedDescriptionKey: ui( + "提交前检测到文件再次变化,操作已中止。", + "The file changed again before the rename could be committed, so the operation was stopped." + ), + ] + ) + } + var renamedItem = oldItem + renamedItem.id = replacementItemID + renamedItem.title = newTitle + renamedItem.subtitle = newURL.lastPathComponent + renamedItem.urlPath = newURL.path + renamedItem.importedFileIdentity = coordinatedIdentity ?? originalIdentity + renamedItem.importedFileBookmarkData = Self.makeImportedFileBookmark(for: newURL) ?? oldItem.importedFileBookmarkData - importedItems[index].importedFileLastKnownPath = newURL.path - replaceItemIDEverywhere(oldID, with: newID) + renamedItem.importedFileLastKnownPath = newURL.path + importedItems[index] = renamedItem + replaceItemIDEverywhere(oldID, with: replacementItemID) if wasActiveNotebook { - noteText = retitledMarkdown(noteText, from: oldTitle, to: importedItems[index].title) - persistCurrentNote() - } else if let markdown = try? String(contentsOf: newURL, encoding: .utf8) { - let updated = retitledMarkdown(markdown, from: oldTitle, to: importedItems[index].title) - if updated != markdown { - try updated.write(to: newURL, atomically: true, encoding: .utf8) - } + noteText = retitledMarkdown } - if let cached = notesByItemID[newID] { - notesByItemID[newID] = retitledMarkdown(cached, from: oldTitle, to: importedItems[index].title) + if let cached = notesByItemID[replacementItemID] { + notesByItemID[replacementItemID] = self.retitledMarkdown(cached, from: oldTitle, to: newTitle) } + noteBackingContentDigestsByItemID[replacementItemID] = finalContentDigest courseDocumentSearchIndex.synchronize(allItems) - save() + guard save() else { + notebookRenameDraft = NotebookRenameDraft(itemID: replacementItemID, title: newTitle) + noteFileError = ui( + "文件已重命名,但课程状态尚未写入磁盘;恢复记录已保留,重启后会自动接回。", + "The file was renamed, but the course state has not been saved to disk. A recovery record was retained so it can be reconnected after restart." + ) + return + } + removePendingNotebookRenameJournal() notebookRenameDraft = nil + noteFileError = nil showTransientNoteStatus(ui("已重命名为:\(newURL.lastPathComponent)", "Renamed to: \(newURL.lastPathComponent)")) } catch { - noteFileError = ui("无法重命名笔记:\(error.localizedDescription)", "Could not rename note: \(error.localizedDescription)") + var restoredOldPath = oldURL.path == newURL.path + if movedFile { + do { + try notebookFileMover(newURL, oldURL) + restoredOldPath = true + } catch { + restoredOldPath = false + } + } else if oldURL.path != newURL.path { + let currentOldIdentity = importedFileIdentityResolver(oldURL) + restoredOldPath = Self.noteContentDigest(at: oldURL) == originalContentDigest + && (originalIdentity == nil || currentOldIdentity == originalIdentity) + } + + if restoredOldPath { + var restoredIdentity = importedFileIdentityResolver(oldURL) + var restoredDigest = Self.noteContentDigest(at: oldURL) + let recoveredApplicationOutput = willRewriteMarkdown + && verifiedApplicationOutput + && restoredDigest == expectedOutputDigest + if recoveredApplicationOutput, willRewriteMarkdown { + do { + try notebookMarkdownWriter(sourceMarkdown, oldURL) + restoredIdentity = importedFileIdentityResolver(oldURL) + restoredDigest = Self.noteContentDigest(at: oldURL) + } catch { + restoredIdentity = importedFileIdentityResolver(oldURL) + restoredDigest = Self.noteContentDigest(at: oldURL) + } + } + let restoredOriginalGeneration = restoredDigest == originalContentDigest + && (originalIdentity == nil || restoredIdentity == originalIdentity) + let restoredKnownApplicationCopy = recoveredApplicationOutput + && restoredDigest == sourceMarkdownDigest + let restoredFileIsTrusted = restoredOriginalGeneration || restoredKnownApplicationCopy + if restoredFileIsTrusted { + importedItems[index] = oldItem + importedItems[index].urlPath = oldURL.path + importedItems[index].importedFileLastKnownPath = oldURL.path + importedItems[index].importedFileIdentity = restoredIdentity + importedItems[index].importedFileBookmarkData = Self.makeImportedFileBookmark(for: oldURL) + ?? oldItem.importedFileBookmarkData + noteBackingContentDigestsByItemID[oldID] = restoredDigest + } else { + importedItems[index] = oldItem + importedItems[index].urlPath = nil + importedItems[index].importedFileLastKnownPath = oldURL.path + notesByItemID[oldID] = sourceMarkdown + pendingNoteWritesByItemID[oldID] = PendingNoteWriteState( + baselineContentDigest: originalContentDigest + ) + if wasActiveNotebook { + noteText = sourceMarkdown + } + } + } else if FileManager.default.fileExists(atPath: newURL.path) { + let currentIdentity = importedFileIdentityResolver(newURL) + let currentDigest = Self.noteContentDigest(at: newURL) + let currentFileIsMovedOriginal = currentDigest == originalContentDigest + && (originalIdentity == nil || currentIdentity == originalIdentity) + let currentFileIsKnownApplicationOutput = willRewriteMarkdown + && verifiedApplicationOutput + && currentDigest == expectedOutputDigest + guard currentFileIsMovedOriginal || currentFileIsKnownApplicationOutput else { + importedItems[index] = oldItem + importedItems[index].urlPath = nil + importedItems[index].importedFileLastKnownPath = oldURL.path + notesByItemID[oldID] = sourceMarkdown + pendingNoteWritesByItemID[oldID] = PendingNoteWriteState( + baselineContentDigest: originalContentDigest + ) + if wasActiveNotebook { + noteText = sourceMarkdown + } + courseDocumentSearchIndex.synchronize(allItems) + let savedRecovery = save() + if savedRecovery { removePendingNotebookRenameJournal() } + noteFileError = ui( + "无法重命名笔记:\(error.localizedDescription) 原关系和最新正文已保留,请重新定位文件。", + "Could not rename the note: \(error.localizedDescription) The original relationships and latest text were retained; relocate the file to continue." + ) + return + } + importedItems[index].title = newTitle + importedItems[index].subtitle = newURL.lastPathComponent + importedItems[index].urlPath = newURL.path + importedItems[index].importedFileIdentity = currentIdentity + importedItems[index].importedFileBookmarkData = Self.makeImportedFileBookmark(for: newURL) + ?? oldItem.importedFileBookmarkData + importedItems[index].importedFileLastKnownPath = newURL.path + noteBackingContentDigestsByItemID[oldID] = currentDigest + if currentFileIsKnownApplicationOutput, wasActiveNotebook { + noteText = retitledMarkdown + } + } else { + importedItems[index] = oldItem + importedItems[index].urlPath = nil + importedItems[index].importedFileLastKnownPath = oldURL.path + notesByItemID[oldID] = sourceMarkdown + pendingNoteWritesByItemID[oldID] = PendingNoteWriteState( + baselineContentDigest: originalContentDigest + ) + if wasActiveNotebook { + noteText = sourceMarkdown + } + } + courseDocumentSearchIndex.synchronize(allItems) + let recovery = restoredOldPath + ? ui("文件已恢复到原路径。", "The file was restored to its original path.") + : ui("原关系和最新正文已保留,请重新定位文件。", "The original relationships and latest text were retained; relocate the file to continue.") + noteFileError = ui( + "无法重命名笔记:\(error.localizedDescription) \(recovery)", + "Could not rename the note: \(error.localizedDescription) \(recovery)" + ) + let savedRecovery = save() + if savedRecovery { removePendingNotebookRenameJournal() } } } @@ -2720,6 +3085,7 @@ final class WorkspaceStore: ObservableObject { ) let markdown = defaultNotebookNote(title: item.title, sourceItem: sourceItem) try markdown.write(to: url, atomically: true, encoding: .utf8) + noteBackingContentDigestsByItemID[item.id] = Self.noteContentDigest(Data(markdown.utf8)) item.importedFileIdentity = importedFileIdentityResolver(url) item.importedFileBookmarkData = item.importedFileIdentity.flatMap { _ in Self.makeImportedFileBookmark(for: url) @@ -5035,61 +5401,196 @@ final class WorkspaceStore: ObservableObject { return "# \(newTitle)\n" + String(markdown.dropFirst(prefix.count)) } + private func writePendingNotebookRenameJournal(_ journal: PendingNotebookRenameJournal) throws { + let data = try JSONEncoder().encode(journal) + try data.write(to: notebookRenameJournalURL, options: [.atomic]) + } + + private func removePendingNotebookRenameJournal() { + try? FileManager.default.removeItem(at: notebookRenameJournalURL) + } + + @discardableResult + private func recoverPendingNotebookRenameIfNeeded() -> Bool { + guard let data = try? Data(contentsOf: notebookRenameJournalURL), + let journal = try? JSONDecoder().decode(PendingNotebookRenameJournal.self, from: data) else { + return false + } + guard let itemIndex = importedItems.firstIndex(where: { + $0.id == journal.oldItem.id || $0.id == journal.replacementItemID + }) else { + removePendingNotebookRenameJournal() + return false + } + + let oldURL = URL(fileURLWithPath: journal.oldPath).standardizedFileURL + let newURL = URL(fileURLWithPath: journal.newPath).standardizedFileURL + let newDigest = Self.noteContentDigest(at: newURL) + let newIdentity = importedFileIdentityResolver(newURL) + let newFileMatchesMovedOriginal = newDigest == journal.originalContentDigest + && (journal.oldItem.importedFileIdentity == nil + || newIdentity == journal.oldItem.importedFileIdentity) + let newFileMatchesApplicationOutput = newDigest == journal.retitledContentDigest + && (journal.retitledContentDigest != journal.originalContentDigest + || journal.oldItem.importedFileIdentity == nil + || newIdentity == journal.oldItem.importedFileIdentity) + + if newFileMatchesMovedOriginal || newFileMatchesApplicationOutput { + let previousID = importedItems[itemIndex].id + var recoveredItem = importedItems[itemIndex] + recoveredItem.id = journal.replacementItemID + recoveredItem.title = journal.newTitle + recoveredItem.subtitle = newURL.lastPathComponent + recoveredItem.urlPath = newURL.path + recoveredItem.importedFileIdentity = newIdentity ?? journal.oldItem.importedFileIdentity + recoveredItem.importedFileBookmarkData = Self.makeImportedFileBookmark(for: newURL) + ?? recoveredItem.importedFileBookmarkData + ?? journal.oldItem.importedFileBookmarkData + recoveredItem.importedFileLastKnownPath = newURL.path + recoveredItem.kind = StudyItemKind.detect(from: newURL) + importedItems[itemIndex] = recoveredItem + replaceItemIDEverywhere(previousID, with: journal.replacementItemID) + noteBackingContentDigestsByItemID[journal.replacementItemID] = newDigest + if activeNotebookItemID == journal.replacementItemID { + noteText = newFileMatchesApplicationOutput + ? journal.retitledMarkdown + : journal.sourceMarkdown + } + noteFileError = ui( + "已从上次未完成的保存中恢复笔记重命名。", + "Recovered a notebook rename from the previous incomplete save." + ) + return true + } + + let oldDigest = Self.noteContentDigest(at: oldURL) + let oldIdentity = importedFileIdentityResolver(oldURL) + let oldFileIsTrusted = oldDigest == journal.originalContentDigest + && (journal.oldItem.importedFileIdentity == nil + || oldIdentity == journal.oldItem.importedFileIdentity) + let previousID = importedItems[itemIndex].id + if previousID != journal.oldItem.id { + replaceItemIDEverywhere(previousID, with: journal.oldItem.id) + } + importedItems[itemIndex] = journal.oldItem + if oldFileIsTrusted { + importedItems[itemIndex].urlPath = oldURL.path + importedItems[itemIndex].importedFileIdentity = oldIdentity ?? journal.oldItem.importedFileIdentity + importedItems[itemIndex].importedFileBookmarkData = Self.makeImportedFileBookmark(for: oldURL) + ?? journal.oldItem.importedFileBookmarkData + importedItems[itemIndex].importedFileLastKnownPath = oldURL.path + noteBackingContentDigestsByItemID[journal.oldItem.id] = oldDigest + } else { + importedItems[itemIndex].urlPath = nil + importedItems[itemIndex].importedFileLastKnownPath = journal.oldPath + notesByItemID[journal.oldItem.id] = journal.sourceMarkdown + pendingNoteWritesByItemID[journal.oldItem.id] = PendingNoteWriteState( + baselineContentDigest: journal.originalContentDigest + ) + if activeNotebookItemID == journal.oldItem.id { + noteText = journal.sourceMarkdown + } + } + noteFileError = oldFileIsTrusted + ? ui( + "上次笔记重命名未完成,已恢复原文件。", + "The previous notebook rename did not finish, so the original file was restored." + ) + : ui( + "上次笔记重命名遇到文件冲突;原关系和最新正文均已保留。", + "The previous notebook rename encountered a file conflict. The original relationships and latest text were retained." + ) + return true + } + @discardableResult private func resolvePersistedImportedFileBookmarks() -> Bool { var changed = false for index in importedItems.indices { - guard let storedIdentity = importedItems[index].importedFileIdentity else { continue } - let currentURL = importedItems[index].urlPath - .map { URL(fileURLWithPath: $0).standardizedFileURL } - let currentPathIsValid = currentURL.map { - importedFileIdentityResolver($0) == storedIdentity - } ?? false - let bookmarkResolution = currentPathIsValid - ? nil - : importedItems[index].importedFileBookmarkData.flatMap(Self.resolveImportedFileBookmark) - let fallbackPath = importedItems[index].urlPath - ?? importedItems[index].importedFileLastKnownPath - let candidateURL = (currentPathIsValid ? currentURL : nil) - ?? bookmarkResolution?.url - ?? fallbackPath.map { URL(fileURLWithPath: $0).standardizedFileURL } - guard let candidateURL, - importedFileIdentityResolver(candidateURL) == storedIdentity else { - if let path = importedItems[index].urlPath { - importedItems[index].importedFileLastKnownPath = path - importedItems[index].urlPath = nil - changed = true - } - continue - } + let resolution = resolveTrackedImportedFile(at: index) + if resolution.changed { changed = true } + } + return changed + } - let nextPath = candidateURL.path - let nextTitle = candidateURL.deletingPathExtension().lastPathComponent - let nextSubtitle = candidateURL.lastPathComponent - let nextKind = StudyItemKind.detect(from: candidateURL) - if importedItems[index].urlPath != nextPath - || importedItems[index].importedFileLastKnownPath != nextPath - || importedItems[index].title != nextTitle - || importedItems[index].subtitle != nextSubtitle - || importedItems[index].kind != nextKind { - importedItems[index].urlPath = nextPath - importedItems[index].importedFileLastKnownPath = nextPath - importedItems[index].title = nextTitle - importedItems[index].subtitle = nextSubtitle - importedItems[index].kind = nextKind - changed = true + private func resolveTrackedImportedFile(at index: Int) -> (url: URL?, changed: Bool) { + guard importedItems.indices.contains(index) else { return (nil, false) } + guard let storedIdentity = importedItems[index].importedFileIdentity else { + guard let currentURL = importedItems[index].url, + importedFileIdentityResolver(currentURL) != nil else { + return (nil, false) } - let resolvedThroughFallback = !currentPathIsValid && bookmarkResolution == nil - if importedItems[index].importedFileBookmarkData == nil - || bookmarkResolution?.isStale == true - || resolvedThroughFallback, - let refreshedBookmark = Self.makeImportedFileBookmark(for: candidateURL), - importedItems[index].importedFileBookmarkData != refreshedBookmark { - importedItems[index].importedFileBookmarkData = refreshedBookmark + return (currentURL.standardizedFileURL, false) + } + + var changed = false + let currentURL = importedItems[index].urlPath + .map { URL(fileURLWithPath: $0).standardizedFileURL } + let currentPathIsValid = currentURL.map { + importedFileIdentityResolver($0) == storedIdentity + } ?? false + let bookmarkResolution = currentPathIsValid + ? nil + : importedItems[index].importedFileBookmarkData.flatMap(Self.resolveImportedFileBookmark) + let fallbackPath = importedItems[index].urlPath + ?? importedItems[index].importedFileLastKnownPath + let candidateURL = (currentPathIsValid ? currentURL : nil) + ?? bookmarkResolution?.url + ?? fallbackPath.map { URL(fileURLWithPath: $0).standardizedFileURL } + guard let candidateURL, + importedFileIdentityResolver(candidateURL) == storedIdentity else { + if let path = importedItems[index].urlPath { + importedItems[index].importedFileLastKnownPath = path + importedItems[index].urlPath = nil changed = true } + return (nil, changed) + } + + let nextPath = candidateURL.path + let nextTitle = candidateURL.deletingPathExtension().lastPathComponent + let nextSubtitle = candidateURL.lastPathComponent + let nextKind = StudyItemKind.detect(from: candidateURL) + if importedItems[index].urlPath != nextPath + || importedItems[index].importedFileLastKnownPath != nextPath + || importedItems[index].title != nextTitle + || importedItems[index].subtitle != nextSubtitle + || importedItems[index].kind != nextKind { + importedItems[index].urlPath = nextPath + importedItems[index].importedFileLastKnownPath = nextPath + importedItems[index].title = nextTitle + importedItems[index].subtitle = nextSubtitle + importedItems[index].kind = nextKind + changed = true } - return changed + let resolvedThroughFallback = !currentPathIsValid && bookmarkResolution == nil + if importedItems[index].importedFileBookmarkData == nil + || bookmarkResolution?.isStale == true + || resolvedThroughFallback, + let refreshedBookmark = Self.makeImportedFileBookmark(for: candidateURL), + importedItems[index].importedFileBookmarkData != refreshedBookmark { + importedItems[index].importedFileBookmarkData = refreshedBookmark + changed = true + } + return (candidateURL, changed) + } + + @discardableResult + private func refreshImportedFileTracking(itemID: String, url: URL) -> StudyItem? { + guard let index = importedItems.firstIndex(where: { $0.id == itemID }), + let identity = importedFileIdentityResolver(url) else { + return nil + } + let standardizedURL = url.standardizedFileURL + importedItems[index].urlPath = standardizedURL.path + importedItems[index].importedFileIdentity = identity + importedItems[index].importedFileBookmarkData = Self.makeImportedFileBookmark(for: standardizedURL) + ?? importedItems[index].importedFileBookmarkData + importedItems[index].importedFileLastKnownPath = standardizedURL.path + importedItems[index].title = standardizedURL.deletingPathExtension().lastPathComponent + importedItems[index].subtitle = standardizedURL.lastPathComponent + importedItems[index].kind = StudyItemKind.detect(from: standardizedURL) + return importedItems[index] } @discardableResult @@ -5098,7 +5599,8 @@ final class WorkspaceStore: ObservableObject { var canonicalIDByIdentity: [ImportedFileIdentity: String] = [:] for item in importedItems where item.importedFileIdentity != nil && !item.id.hasPrefix("file:") { - if let identity = item.importedFileIdentity { + if let identity = item.importedFileIdentity, + canonicalIDByIdentity[identity] == nil { canonicalIDByIdentity[identity] = item.id } } @@ -5127,8 +5629,21 @@ final class WorkspaceStore: ObservableObject { if let resolvedIdentity, let canonicalID = canonicalIDByIdentity[resolvedIdentity], canonicalID != item.id { - replaceItemIDEverywhere(item.id, with: canonicalID) - changed = true + let canonicalItem = migratedItems.first(where: { $0.id == canonicalID }) + ?? importedItems.first(where: { $0.id == canonicalID }) + if let canonicalItem, + canCoalesceDuplicateItem(item, into: canonicalItem) { + replaceItemIDEverywhere(item.id, with: canonicalID) + changed = true + continue + } + if item.id.hasPrefix("file:") { + let oldID = item.id + item.id = Self.makeImportedItemID() + replaceItemIDEverywhere(oldID, with: item.id) + changed = true + } + migratedItems.append(item) continue } @@ -5147,12 +5662,56 @@ final class WorkspaceStore: ObservableObject { return changed } + private func canCoalesceDuplicateItem(_ oldItem: StudyItem, into newItem: StudyItem) -> Bool { + let newID = newItem.id + guard oldItem.isNotebookNote == newItem.isNotebookNote, + oldItem.kind == newItem.kind, + oldItem.isSample == newItem.isSample, + valuesCanCoalesce(notesByItemID[oldItem.id], notesByItemID[newID]), + valuesCanCoalesce(pendingNoteWritesByItemID[oldItem.id], pendingNoteWritesByItemID[newID]), + valuesCanCoalesce(noteBackingContentDigestsByItemID[oldItem.id], noteBackingContentDigestsByItemID[newID]), + studyLocationsCanCoalesce(oldID: oldItem.id, newID: newID), + pendingPersistenceCanCoalesce(oldID: oldItem.id, newID: newID) else { + return false + } + return true + } + + private func valuesCanCoalesce<Value: Equatable>(_ oldValue: Value?, _ newValue: Value?) -> Bool { + oldValue == nil || newValue == nil || oldValue == newValue + } + + private func studyLocationsCanCoalesce(oldID: String, newID: String) -> Bool { + guard var oldLocation = studyLocationsByItemID[oldID], + let newLocation = studyLocationsByItemID[newID] else { + return true + } + oldLocation.itemID = newID + return oldLocation == newLocation + } + + private func pendingPersistenceCanCoalesce(oldID: String, newID: String) -> Bool { + guard let oldPending = pendingNotePersistenceByItemID[oldID], + let newPending = pendingNotePersistenceByItemID[newID] else { + return true + } + return oldPending.markdown == newPending.markdown + } + private func replaceItemIDEverywhere(_ oldID: String, with newID: String) { guard oldID != newID else { return } if let oldNote = notesByItemID.removeValue(forKey: oldID), notesByItemID[newID] == nil { notesByItemID[newID] = oldNote } + if let pendingWrite = pendingNoteWritesByItemID.removeValue(forKey: oldID), + pendingNoteWritesByItemID[newID] == nil { + pendingNoteWritesByItemID[newID] = pendingWrite + } + if let backingDigest = noteBackingContentDigestsByItemID.removeValue(forKey: oldID), + noteBackingContentDigestsByItemID[newID] == nil { + noteBackingContentDigestsByItemID[newID] = backingDigest + } if selectedItemID == oldID { selectedItemID = newID } if activeNotebookItemID == oldID { activeNotebookItemID = newID } if courseWorkspaceTargetItemID == oldID { courseWorkspaceTargetItemID = newID } @@ -5341,18 +5900,70 @@ final class WorkspaceStore: ObservableObject { """ } + private static func noteContentDigest(_ data: Data) -> String { + SHA256.hash(data: data).map { String(format: "%02x", $0) }.joined() + } + + nonisolated private static func readNotebookMarkdown(at url: URL) throws -> String { + let data = try Data(contentsOf: url) + guard let markdown = String(data: data, encoding: .utf8) else { + throw CocoaError(.fileReadInapplicableStringEncoding) + } + return markdown + } + + nonisolated private static func writeNotebookMarkdown(_ markdown: String, to url: URL) throws { + try markdown.write(to: url, atomically: true, encoding: .utf8) + } + + nonisolated private static func moveNotebookFile(from sourceURL: URL, to destinationURL: URL) throws { + try FileManager.default.moveItem(at: sourceURL, to: destinationURL) + } + + nonisolated private static func writeWorkspaceSnapshot(_ data: Data, to url: URL) throws { + try data.write(to: url, options: [.atomic]) + } + + private static func noteContentDigest(at url: URL) -> String? { + (try? Data(contentsOf: url)).map(noteContentDigest) + } + private func noteText(for item: StudyItem?) -> String { guard let item else { noteFileError = nil return defaultNote(for: nil) } + if let pendingWrite = pendingNoteWritesByItemID[item.id], + let cached = notesByItemID[item.id] { + let diskDigest = item.url.flatMap(Self.noteContentDigest) + if let diskDigest { + noteBackingContentDigestsByItemID[item.id] = diskDigest + } + let hasConflict = diskDigest != nil + && (pendingWrite.baselineContentDigest == nil || pendingWrite.baselineContentDigest != diskDigest) + noteFileError = hasConflict + ? ui( + "检测到笔记冲突:魏碑草稿和外部文件都已保留,请对照后再处理。", + "A note conflict was detected. Both the WeiBei draft and external file were kept for review." + ) + : ui( + "正在保留尚未写回原 Markdown 的最新编辑。", + "Keeping the latest edit that has not yet been written back to the original Markdown." + ) + return cleanLegacyPlaceholder(cached) + } guard item.editsBackingMarkdownFile, let url = item.url else { noteFileError = nil return cleanLegacyPlaceholder(notesByItemID[item.id] ?? defaultNote(for: item)) } do { + let data = try Data(contentsOf: url) + guard let markdown = String(data: data, encoding: .utf8) else { + throw CocoaError(.fileReadInapplicableStringEncoding) + } + noteBackingContentDigestsByItemID[item.id] = Self.noteContentDigest(data) noteFileError = nil - return cleanLegacyPlaceholder(try String(contentsOf: url, encoding: .utf8)) + return cleanLegacyPlaceholder(markdown) } catch { noteFileError = ui("无法读取原 Markdown:\(url.lastPathComponent)", "Could not read original Markdown: \(url.lastPathComponent)") return cleanLegacyPlaceholder(notesByItemID[item.id] ?? defaultNote(for: item)) @@ -5398,17 +6009,77 @@ final class WorkspaceStore: ObservableObject { pendingNotePersistenceTasks[itemID] = nil } + private func retainPendingNoteWrite(_ markdown: String, itemID: String, fallbackURL: URL?) { + let baseline: String? + if let existingPendingWrite = pendingNoteWritesByItemID[itemID] { + baseline = existingPendingWrite.baselineContentDigest + } else { + baseline = noteBackingContentDigestsByItemID[itemID] + ?? fallbackURL.flatMap(Self.noteContentDigest) + } + notesByItemID[itemID] = markdown + pendingNoteWritesByItemID[itemID] = PendingNoteWriteState( + baselineContentDigest: baseline + ) + } + private func persistNote(_ markdown: String, for item: StudyItem) { let noteItemID = item.id - if item.editsBackingMarkdownFile, let url = item.url { + if item.editsBackingMarkdownFile { + guard let index = importedItems.firstIndex(where: { $0.id == noteItemID }) else { + retainPendingNoteWrite(markdown, itemID: noteItemID, fallbackURL: item.url) + noteFileError = ui("无法确认原 Markdown 的课程身份。", "Could not resolve the original Markdown identity.") + save() + return + } + let resolution = resolveTrackedImportedFile(at: index) + guard let url = resolution.url else { + retainPendingNoteWrite(markdown, itemID: noteItemID, fallbackURL: item.url) + noteFileError = ui( + "原 Markdown 已移动或不可用,最新编辑已安全保留在课程中。", + "The original Markdown moved or is unavailable. The latest edit is safely retained in the course." + ) + save() + return + } + let pendingWrite = pendingNoteWritesByItemID[noteItemID] + let expectedDigest = pendingWrite == nil + ? noteBackingContentDigestsByItemID[noteItemID] + : pendingWrite?.baselineContentDigest + let currentDigest = Self.noteContentDigest(at: url) + let hasConflict: Bool + if pendingWrite != nil { + hasConflict = expectedDigest.flatMap { expected in + currentDigest.map { $0 != expected } + } ?? true + } else if let expectedDigest { + hasConflict = currentDigest.map { $0 != expectedDigest } ?? true + } else { + hasConflict = false + } + if hasConflict { + retainPendingNoteWrite(markdown, itemID: noteItemID, fallbackURL: url) + noteFileError = ui( + "检测到笔记冲突:没有覆盖外部文件,魏碑草稿也已保留。请对照两份内容后再处理。", + "A note conflict was detected. The external file was not overwritten, and the WeiBei draft was retained for review." + ) + save() + return + } do { try markdown.write(to: url, atomically: true, encoding: .utf8) notesByItemID.removeValue(forKey: noteItemID) + pendingNoteWritesByItemID.removeValue(forKey: noteItemID) + noteBackingContentDigestsByItemID[noteItemID] = Self.noteContentDigest(Data(markdown.utf8)) noteFileError = nil - courseDocumentSearchIndex.schedule([item]) + let refreshedItem = refreshImportedFileTracking(itemID: noteItemID, url: url) + ?? importedItems[index] + courseDocumentSearchIndex.schedule([refreshedItem]) + save() } catch { - notesByItemID[noteItemID] = markdown + retainPendingNoteWrite(markdown, itemID: noteItemID, fallbackURL: url) noteFileError = ui("无法写回原 Markdown:\(url.lastPathComponent)", "Could not write original Markdown: \(url.lastPathComponent)") + save() } return } @@ -5422,6 +6093,18 @@ final class WorkspaceStore: ObservableObject { } importedItems = snapshot.importedItems notesByItemID = snapshot.notesByItemID.mapValues(cleanLegacyPlaceholder) + if let persistedPendingNoteWrites = snapshot.pendingNoteWritesByItemID { + pendingNoteWritesByItemID = persistedPendingNoteWrites + } else { + pendingNoteWritesByItemID = [:] + for item in importedItems + where item.editsBackingMarkdownFile && notesByItemID[item.id] != nil { + pendingNoteWritesByItemID[item.id] = PendingNoteWriteState( + baselineContentDigest: nil + ) + } + } + noteBackingContentDigestsByItemID = snapshot.noteBackingContentDigestsByItemID ?? [:] selectedItemID = snapshot.selectedItemID activeNotebookItemID = snapshot.activeNotebookItemID noteSourceLinks = snapshot.noteSourceLinks ?? [] @@ -5513,6 +6196,8 @@ final class WorkspaceStore: ObservableObject { let snapshot = PersistedWorkspace( importedItems: importedItems, notesByItemID: notesByItemID, + pendingNoteWritesByItemID: pendingNoteWritesByItemID, + noteBackingContentDigestsByItemID: noteBackingContentDigestsByItemID, selectedItemID: selectedItemID, activeNotebookItemID: activeNotebookItemID, noteSourceLinks: noteSourceLinks, @@ -5539,7 +6224,7 @@ final class WorkspaceStore: ObservableObject { ) do { let data = try JSONEncoder().encode(snapshot) - try data.write(to: storageURL, options: [.atomic]) + try workspaceSnapshotWriter(data, storageURL) workspaceSaveError = nil return true } catch { diff --git a/Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift b/Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift index 34e786dd3..e34726ab9 100644 --- a/Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift +++ b/Sources/WeiBei/Support/ImportedIdentitySelfCheck.swift @@ -5,7 +5,19 @@ enum ImportedIdentitySelfCheck { @MainActor static func run() throws { try legacyPathSnapshotMigratesItsEntireRelationshipGraph() + try duplicateIdentityMigrationPreservesConflictingDrafts() + try offlineLegacyPathMigratesWhenItReturns() try sameVolumeMoveKeepsIdentityRelationsNavigationAndIndex() + try temporarilyUnavailableNoteRetainsLatestEdit() + try offlineLaunchNoteRetainsEditWhenFileReturns() + try inactiveQueuedDraftBlocksRenameWhenExternalChanged() + try renameRejectsChangedFileGeneration() + try activeRenameWriteFailureIsTransactional() + try inactiveRenameReadFailureIsTransactional() + try successfulButIncorrectRenameWriteIsRejected() + try initialRenameMoveFailureLeavesHealthyFileAttached() + try failedWorkspaceSaveRecoversRenameOnRestart() + try duplicateLegacyIdentityMigratesInOneLaunch() try replacedAndCrossVolumeFilesReceiveNewIdentities() } @@ -84,16 +96,188 @@ enum ImportedIdentitySelfCheck { try check(material.importedFileLastKnownPath == materialURL.path, "旧资料没有保留最后路径") try check(store.selectedItemID == material.id, "当前资料没有迁移到新身份") try check(store.activeNotebookItemID == note.id, "当前笔记没有迁移到新身份") + try check(store.noteText == "遗留缓存笔记", "升级后没有优先恢复旧版本未写回草稿") try check(store.linkedSourceIDs(for: note.id) == [material.id], "笔记资料关系没有随身份迁移") try check(store.studyLocation(for: material.id)?.itemID == material.id, "阅读位置没有随身份迁移") try check(Set(store.activeStudySession?.focusItemIDs ?? []) == Set([material.id, note.id]), "学习会话没有随身份迁移") + let diskTextBeforeConflict = try String(contentsOf: noteURL, encoding: .utf8) + store.select(itemID: "sample-pdf") + store.flushPendingNotePersistence() + let diskTextAfterConflict = try String(contentsOf: noteURL, encoding: .utf8) let persisted = try fixture.readSnapshot() try check(persisted.notesByItemID[note.id] == "遗留缓存笔记", "笔记缓存没有随身份迁移") try check(persisted.notesByItemID[legacyNoteID] == nil, "旧路径身份仍残留在笔记缓存") + try check(persisted.pendingNoteWritesByItemID?[note.id]?.baselineContentDigest == nil, "旧版本草稿没有迁移成未知基线待写状态") + try check(diskTextAfterConflict == diskTextBeforeConflict, "旧版本草稿在未知基线下覆盖了磁盘正文") try check(persisted.studyLocationsByItemID?[legacyMaterialID] == nil, "旧路径身份仍残留在阅读位置") } + @MainActor + private static func duplicateIdentityMigrationPreservesConflictingDrafts() throws { + let fixture = try WorkspaceFixture(name: "duplicate-identity-conflict") + defer { fixture.remove() } + + let noteURL = fixture.importsDirectory.appendingPathComponent("重复身份笔记.md") + try Data("# 重复身份笔记\n\n磁盘正文".utf8).write(to: noteURL) + let identity = ImportedFileIdentity( + volumeID: 50, + fileID: 500, + birthTimeSeconds: 5_000, + birthTimeNanoseconds: 50 + ) + let canonicalID = "imported:canonical-note" + let legacyID = "file:\(noteURL.path)" + let snapshot = PersistedWorkspace( + importedItems: [ + StudyItem( + id: canonicalID, + title: "重复身份笔记", + subtitle: noteURL.lastPathComponent, + kind: .markdown, + urlPath: noteURL.path, + importedFileIdentity: identity, + importedFileLastKnownPath: noteURL.path, + isSample: false, + isNotebookNote: true + ), + StudyItem( + id: legacyID, + title: "重复身份笔记旧项", + subtitle: noteURL.lastPathComponent, + kind: .markdown, + urlPath: noteURL.path, + importedFileIdentity: identity, + importedFileLastKnownPath: noteURL.path, + isSample: false, + isNotebookNote: true + ), + ], + notesByItemID: [ + canonicalID: "规范项草稿", + legacyID: "旧项不同草稿", + ], + pendingNoteWritesByItemID: [ + canonicalID: PendingNoteWriteState(baselineContentDigest: "canonical-baseline"), + legacyID: PendingNoteWriteState(baselineContentDigest: nil), + ], + noteBackingContentDigestsByItemID: [ + canonicalID: "canonical-digest", + legacyID: "legacy-digest", + ], + activeNotebookItemID: legacyID, + noteSourceLinksMigrationVersion: 1, + studyLocationsByItemID: [ + canonicalID: StudyLocation(itemID: canonicalID, itemTitle: "规范项", locationTitle: "规范位置"), + legacyID: StudyLocation(itemID: legacyID, itemTitle: "旧项", locationTitle: "旧位置"), + ] + ) + try fixture.write(snapshot) + + let store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: { url in url.path == noteURL.path ? identity : nil } + ) + let diskBytesBeforeMigration = try Data(contentsOf: noteURL) + store.flushPendingNotePersistence() + let persisted = try fixture.readSnapshot() + let preservedLegacyID = try require( + persisted.notesByItemID.first { $0.value == "旧项不同草稿" }?.key, + "同身份冲突迁移丢失了旧项草稿" + ) + try check(preservedLegacyID != canonicalID, "同身份冲突迁移把两份不同草稿折叠到一个身份") + try check(preservedLegacyID.hasPrefix("imported:"), "同身份冲突旧项仍停留在路径身份") + try check(store.importedItems.filter { $0.importedFileIdentity == identity }.count == 2, "同身份冲突迁移删除了其中一个可达项") + try check(persisted.notesByItemID[canonicalID] == "规范项草稿", "同身份冲突迁移丢失了规范项草稿") + try check(persisted.pendingNoteWritesByItemID?[canonicalID]?.baselineContentDigest == "canonical-baseline", "同身份冲突迁移破坏了规范项待写基线") + try check(persisted.pendingNoteWritesByItemID?[preservedLegacyID]?.baselineContentDigest == nil, "同身份冲突迁移破坏了旧项未知基线") + try check(persisted.noteBackingContentDigestsByItemID?[canonicalID] == "canonical-digest", "同身份冲突迁移破坏了规范项磁盘摘要") + try check(persisted.noteBackingContentDigestsByItemID?[preservedLegacyID] != nil, "同身份冲突迁移丢失了旧项磁盘摘要") + try check(persisted.studyLocationsByItemID?[canonicalID]?.locationTitle == "规范位置", "同身份冲突迁移破坏了规范项阅读位置") + try check(persisted.studyLocationsByItemID?[preservedLegacyID]?.locationTitle == "旧位置", "同身份冲突迁移丢失了旧项阅读位置") + try check(persisted.activeNotebookItemID == preservedLegacyID, "同身份冲突迁移没有保留旧项的活动笔记引用") + + let firstPassIDs = Set(store.importedItems.map(\.id)) + let reopenedStore = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: { url in url.path == noteURL.path ? identity : nil } + ) + reopenedStore.flushPendingNotePersistence() + let reopenedSnapshot = try fixture.readSnapshot() + let diskBytesAfterMigration = try Data(contentsOf: noteURL) + try check(Set(reopenedStore.importedItems.map(\.id)) == firstPassIDs, "同身份冲突迁移第二次启动又生成了新身份") + try check(reopenedSnapshot.notesByItemID[canonicalID] == "规范项草稿", "同身份冲突迁移第二次启动丢失规范项草稿") + try check(reopenedSnapshot.notesByItemID[preservedLegacyID] == "旧项不同草稿", "同身份冲突迁移第二次启动丢失旧项草稿") + try check(diskBytesAfterMigration == diskBytesBeforeMigration, "同身份冲突迁移修改了真实 Markdown 文件") + } + + @MainActor + private static func offlineLegacyPathMigratesWhenItReturns() throws { + let fixture = try WorkspaceFixture(name: "offline-legacy") + defer { fixture.remove() } + + let materialURL = fixture.importsDirectory.appendingPathComponent("离线资料.txt") + let noteURL = fixture.importsDirectory.appendingPathComponent("离线资料笔记.md") + try Data("# 离线资料笔记\n\n等待资料恢复".utf8).write(to: noteURL) + + let legacyMaterialID = "file:\(materialURL.path)" + let legacyNoteID = "file:\(noteURL.path)" + let snapshot = PersistedWorkspace( + importedItems: [ + StudyItem( + id: legacyMaterialID, + title: "离线资料", + subtitle: materialURL.lastPathComponent, + kind: .text, + urlPath: materialURL.path, + isSample: false + ), + StudyItem( + id: legacyNoteID, + title: "离线资料笔记", + subtitle: noteURL.lastPathComponent, + kind: .markdown, + urlPath: noteURL.path, + isSample: false, + isNotebookNote: true + ), + ], + selectedItemID: legacyMaterialID, + activeNotebookItemID: legacyNoteID, + noteSourceLinks: [ + NoteSourceLink(noteItemID: legacyNoteID, sourceItemID: legacyMaterialID), + ], + noteSourceLinksMigrationVersion: 1, + studyLocationsByItemID: [ + legacyMaterialID: StudyLocation(itemID: legacyMaterialID, itemTitle: "离线资料"), + ] + ) + try fixture.write(snapshot) + + var store: WorkspaceStore? = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + try check(store?.importedItems.contains { $0.id == legacyMaterialID } == true, "离线旧资料不应在升级时被删除") + let migratedNote = try require( + store?.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "在线旧笔记没有完成稳定身份迁移" + ) + + try Data("恢复后的离线资料".utf8).write(to: materialURL) + let restoredMaterial = try require( + store?.importFiles([materialURL], selectsFirstImportedItem: false).first, + "恢复后的旧资料无法重新导入" + ) + try check(restoredMaterial.id.hasPrefix("imported:"), "恢复后的旧资料仍使用路径身份") + try check(store?.importedItems.filter { $0.urlPath == materialURL.path }.count == 1, "恢复后的旧资料产生了重复项") + try check(store?.linkedSourceIDs(for: migratedNote.id) == [restoredMaterial.id], "恢复后的旧资料没有接回原笔记关系") + try check(store?.studyLocation(for: restoredMaterial.id)?.itemID == restoredMaterial.id, "恢复后的旧资料没有接回原阅读位置") + store?.flushPendingNotePersistence() + store = nil + + store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + try check(store?.importedItems.contains { $0.id == legacyMaterialID } == false, "重启后仍残留离线旧路径身份") + try check(store?.linkedSourceIDs(for: migratedNote.id) == [restoredMaterial.id], "重启后恢复资料的笔记关系丢失") + } + @MainActor private static func sameVolumeMoveKeepsIdentityRelationsNavigationAndIndex() throws { let fixture = try WorkspaceFixture(name: "same-volume-move") @@ -123,8 +307,15 @@ enum ImportedIdentitySelfCheck { store?.setLinkedSourceIDs([firstMaterial.id], for: note.id) store?.select(itemID: note.id) - store?.select(itemID: firstMaterial.id) + let editedNote = "# 第二讲笔记\n\nFinder 移动后继续编辑" + store?.updateNote(editedNote) + let movedNoteURL = fixture.importsDirectory.appendingPathComponent("第二讲笔记-已整理.md") + try FileManager.default.moveItem(at: noteURL, to: movedNoteURL) store?.flushPendingNotePersistence() + try check(!FileManager.default.fileExists(atPath: noteURL.path), "笔记移动后保存错误地在旧路径新建副本") + let persistedMovedNote = try String(contentsOf: movedNoteURL, encoding: .utf8) + try check(persistedMovedNote == editedNote, "笔记移动后最新正文没有写入真实文件") + store?.select(itemID: firstMaterial.id) let originalSessionID = store?.activeStudySessionID let searchIndex = CourseDocumentSearchIndex( @@ -145,6 +336,12 @@ enum ImportedIdentitySelfCheck { try check(renamedMaterial.id == firstMaterial.id, "同卷改名并重启后资料身份发生变化") try check(renamedMaterial.urlPath == renamedURL.path, "同卷改名后必须重新导入才能找到新路径") try check(store?.importedItems.filter { $0.id == firstMaterial.id }.count == 1, "同卷改名后出现重复资料") + let movedNote = try require( + store?.courseNotebookItems.first { $0.id == note.id }, + "重启后找不到移动中的活跃笔记" + ) + try check(movedNote.urlPath == movedNoteURL.path, "活跃笔记移动后必须重新导入才能找到新路径") + try check(store?.noteText == editedNote, "活跃笔记移动后重启没有从新路径加载正文") try check(store?.linkedSourceIDs(for: note.id) == [firstMaterial.id], "改名后笔记关系丢失") try check(store?.studyLocation(for: firstMaterial.id) != nil, "改名后阅读位置丢失") try check(store?.activeStudySessionID == originalSessionID, "改名后学习会话被替换") @@ -184,6 +381,663 @@ enum ImportedIdentitySelfCheck { try check(movedSearch[firstMaterial.id]?.text?.contains("期限结构理论") == true, "资料移动后全文索引没有沿用身份并刷新内容") try check(store?.linkedSourceIDs(for: note.id) == [firstMaterial.id], "再次重启后笔记关系丢失") + + let finderRenamedNoteURL = fixture.importsDirectory.appendingPathComponent("Finder刚移动的笔记.md") + try FileManager.default.moveItem(at: movedNoteURL, to: finderRenamedNoteURL) + store?.renameNotebookNote(itemID: note.id, to: "第二讲最终笔记") + let appRenamedNote = try require( + store?.courseNotebookItems.first { $0.id == note.id }, + "应用内重命名后找不到原笔记身份" + ) + try check(appRenamedNote.urlPath?.hasSuffix("第二讲最终笔记.md") == true, "应用内重命名没有更新笔记路径") + store?.flushPendingNotePersistence() + store = nil + store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + try check(store?.courseNotebookItems.first { $0.id == note.id }?.urlPath == appRenamedNote.urlPath, "应用内重命名后重启丢失笔记路径") + try check(store?.noteText.contains("Finder 移动后继续编辑") == true, "应用内重命名后重启丢失笔记正文") + try check(store?.linkedSourceIDs(for: note.id) == [firstMaterial.id], "应用内重命名后重启丢失笔记关系") + + let appRenamedNoteURL = try require(appRenamedNote.url, "应用内重命名后笔记没有真实路径") + let finalNoteURL = movedDirectory.appendingPathComponent("第二讲归档笔记.md") + try FileManager.default.moveItem(at: appRenamedNoteURL, to: finalNoteURL) + store = nil + store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + try check(store?.courseNotebookItems.first { $0.id == note.id }?.urlPath == finalNoteURL.path, "笔记只移动不编辑并重启后没有恢复新路径") + try check(store?.noteText.contains("Finder 移动后继续编辑") == true, "笔记只移动不编辑并重启后没有加载真实正文") + } + + @MainActor + private static func temporarilyUnavailableNoteRetainsLatestEdit() throws { + let fixture = try WorkspaceFixture(name: "temporarily-unavailable-note") + defer { fixture.remove() } + + let noteURL = fixture.importsDirectory.appendingPathComponent("暂时不可用笔记.md") + let diskText = "# 暂时不可用笔记\n\n磁盘旧正文" + let latestEdit = "# 暂时不可用笔记\n\n断开期间的最新编辑" + try Data(diskText.utf8).write(to: noteURL) + let fixedIdentity = ImportedFileIdentity( + volumeID: 20, + fileID: 200, + birthTimeSeconds: 2_000, + birthTimeNanoseconds: 20 + ) + var identityIsAvailable = true + let resolver: (URL) -> ImportedFileIdentity? = { url in + identityIsAvailable && url.path == noteURL.path ? fixedIdentity : nil + } + + var store: WorkspaceStore? = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + _ = store?.importFiles( + [noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let note = try require( + store?.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "暂时不可用场景无法导入笔记" + ) + store?.select(itemID: note.id) + identityIsAvailable = false + store?.updateNote(latestEdit) + store?.flushPendingNotePersistence() + let unavailableDiskText = try String(contentsOf: noteURL, encoding: .utf8) + try check(unavailableDiskText == diskText, "文件不可用时不应覆盖磁盘旧正文") + let cachedSnapshot = try fixture.readSnapshot() + try check(cachedSnapshot.notesByItemID[note.id] == latestEdit, "文件不可用时没有保存最新编辑缓存") + try check(cachedSnapshot.pendingNoteWritesByItemID?[note.id] != nil, "文件不可用时没有记录待写草稿的磁盘基线") + store = nil + + identityIsAvailable = true + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + try check(store?.noteText == latestEdit, "文件恢复后重启没有优先恢复最新编辑缓存") + store?.select(itemID: "sample-pdf") + store?.flushPendingNotePersistence() + let restoredDiskText = try String(contentsOf: noteURL, encoding: .utf8) + let restoredSnapshot = try fixture.readSnapshot() + try check(restoredDiskText == latestEdit, "文件恢复后没有把最新编辑写回真实文件") + try check(restoredSnapshot.notesByItemID[note.id] == nil, "最新编辑写回成功后仍残留待写缓存") + try check(restoredSnapshot.pendingNoteWritesByItemID?[note.id] == nil, "最新编辑写回成功后仍残留待写状态") + + store?.select(itemID: note.id) + let conflictedEdit = "# 暂时不可用笔记\n\n魏碑断开期间的第二份编辑" + identityIsAvailable = false + store?.updateNote(conflictedEdit) + store?.flushPendingNotePersistence() + store = nil + + identityIsAvailable = true + let externalEdit = "# 暂时不可用笔记\n\n外部编辑器的新正文" + let externalHandle = try FileHandle(forWritingTo: noteURL) + try externalHandle.truncate(atOffset: 0) + try externalHandle.write(contentsOf: Data(externalEdit.utf8)) + try externalHandle.synchronize() + try externalHandle.close() + + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + try check(store?.noteText == conflictedEdit, "磁盘冲突后没有保留魏碑待写草稿") + store?.select(itemID: "sample-pdf") + store?.flushPendingNotePersistence() + let conflictDiskText = try String(contentsOf: noteURL, encoding: .utf8) + let conflictSnapshot = try fixture.readSnapshot() + try check(conflictDiskText == externalEdit, "魏碑待写草稿静默覆盖了外部编辑") + try check(conflictSnapshot.notesByItemID[note.id] == conflictedEdit, "发生冲突后魏碑待写草稿没有继续保留") + try check(conflictSnapshot.pendingNoteWritesByItemID?[note.id] != nil, "发生冲突后待写草稿丢失磁盘基线") + try check(store?.noteFileError?.contains("冲突") == true, "发生冲突后没有向用户说明两份编辑需要处理") + } + + @MainActor + private static func offlineLaunchNoteRetainsEditWhenFileReturns() throws { + let fixture = try WorkspaceFixture(name: "offline-launch-note") + defer { fixture.remove() } + + let noteURL = fixture.importsDirectory.appendingPathComponent("启动前离线笔记.md") + let holdingURL = fixture.root.appendingPathComponent("离线保管中的笔记.md") + let originalText = "# 启动前离线笔记\n\n原始正文" + let knownBaselineEdit = "# 启动前离线笔记\n\n已知基线下的离线编辑" + let unknownBaselineEdit = "# 启动前离线笔记\n\n未知基线下的离线编辑" + try Data(originalText.utf8).write(to: noteURL) + let fixedIdentity = ImportedFileIdentity( + volumeID: 30, + fileID: 300, + birthTimeSeconds: 3_000, + birthTimeNanoseconds: 30 + ) + var identityIsAvailable = true + let resolver: (URL) -> ImportedFileIdentity? = { url in + identityIsAvailable && url.path == noteURL.path ? fixedIdentity : nil + } + + var store: WorkspaceStore? = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + _ = store?.importFiles( + [noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let note = try require( + store?.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "启动前离线场景无法导入笔记" + ) + store?.select(itemID: note.id) + store?.flushPendingNotePersistence() + store = nil + + try FileManager.default.moveItem(at: noteURL, to: holdingURL) + identityIsAvailable = false + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + try check(store?.courseNotebookItems.first { $0.id == note.id }?.urlPath == nil, "启动前离线的笔记仍错误保留可写路径") + store?.updateNote(knownBaselineEdit) + store?.flushPendingNotePersistence() + let offlineSnapshot = try fixture.readSnapshot() + try check(offlineSnapshot.pendingNoteWritesByItemID?[note.id] != nil, "启动前离线编辑没有建立待写状态") + store = nil + + try FileManager.default.moveItem(at: holdingURL, to: noteURL) + identityIsAvailable = true + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + try check(store?.noteText == knownBaselineEdit, "文件恢复后没有恢复启动前离线编辑") + store?.select(itemID: "sample-pdf") + store?.flushPendingNotePersistence() + let safelyRecoveredText = try String(contentsOf: noteURL, encoding: .utf8) + try check(safelyRecoveredText == knownBaselineEdit, "已知磁盘基线未变化时没有安全补写离线编辑") + store = nil + + var unknownBaselineSnapshot = try fixture.readSnapshot() + unknownBaselineSnapshot.noteBackingContentDigestsByItemID = [:] + try fixture.write(unknownBaselineSnapshot) + try FileManager.default.moveItem(at: noteURL, to: holdingURL) + identityIsAvailable = false + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + store?.updateNote(unknownBaselineEdit) + store?.flushPendingNotePersistence() + let pendingUnknownSnapshot = try fixture.readSnapshot() + try check(pendingUnknownSnapshot.pendingNoteWritesByItemID?[note.id]?.baselineContentDigest == nil, "未知磁盘基线被错误伪造成已知基线") + store = nil + + try FileManager.default.moveItem(at: holdingURL, to: noteURL) + identityIsAvailable = true + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: resolver + ) + try check(store?.noteText == unknownBaselineEdit, "未知基线的离线草稿没有恢复") + store?.select(itemID: "sample-pdf") + store?.flushPendingNotePersistence() + let unknownBaselineDiskText = try String(contentsOf: noteURL, encoding: .utf8) + let unknownConflictSnapshot = try fixture.readSnapshot() + try check(unknownBaselineDiskText == knownBaselineEdit, "未知基线的草稿错误覆盖了恢复文件") + try check(unknownConflictSnapshot.notesByItemID[note.id] == unknownBaselineEdit, "未知基线冲突后草稿没有保留") + try check(unknownConflictSnapshot.pendingNoteWritesByItemID?[note.id]?.baselineContentDigest == nil, "未知基线冲突后被错误回填为当前磁盘基线") + store?.renameNotebookNote(itemID: note.id, to: "冲突期间不应改名") + let noteStillExistsAfterBlockedRename = FileManager.default.fileExists(atPath: noteURL.path) + let postRenameConflictDiskText = noteStillExistsAfterBlockedRename + ? try String(contentsOf: noteURL, encoding: .utf8) + : "" + let postRenameConflictSnapshot = try fixture.readSnapshot() + try check(noteStillExistsAfterBlockedRename, "未知基线冲突期间仍执行了笔记重命名") + try check(postRenameConflictDiskText == knownBaselineEdit, "未知基线冲突期间重命名操作修改了外部文件") + try check(postRenameConflictSnapshot.pendingNoteWritesByItemID?[note.id]?.baselineContentDigest == nil, "未知基线冲突期间重命名绕过了待写保护") + } + + @MainActor + private static func inactiveQueuedDraftBlocksRenameWhenExternalChanged() throws { + let fixture = try WorkspaceFixture(name: "inactive-queued-rename") + defer { fixture.remove() } + + let noteAURL = fixture.importsDirectory.appendingPathComponent("A笔记.md") + let noteBURL = fixture.importsDirectory.appendingPathComponent("B笔记.md") + try Data("# A笔记\n\nA 原文".utf8).write(to: noteAURL) + try Data("# B笔记\n\nB 原文".utf8).write(to: noteBURL) + let store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + _ = store.importFiles( + [noteAURL, noteBURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteAURL.path, noteBURL.path] + ) + let noteA = try require( + store.courseNotebookItems.first { $0.urlPath == noteAURL.path }, + "迟到草稿场景找不到 A 笔记" + ) + let noteB = try require( + store.courseNotebookItems.first { $0.urlPath == noteBURL.path }, + "迟到草稿场景找不到 B 笔记" + ) + store.select(itemID: noteA.id) + store.select(itemID: noteB.id) + try check(store.activeNotebookItemID == noteB.id, "迟到草稿场景没有让 B 成为当前活动笔记") + + let lateDraft = "# A笔记\n\n魏碑迟到草稿" + let externalEdit = "# A笔记\n\n外部编辑器更新" + store.updateNote(lateDraft, for: noteA.id) + let externalHandle = try FileHandle(forWritingTo: noteAURL) + try externalHandle.truncate(atOffset: 0) + try externalHandle.write(contentsOf: Data(externalEdit.utf8)) + try externalHandle.synchronize() + try externalHandle.close() + + store.renameNotebookNote(itemID: noteA.id, to: "A笔记改名") + let originalPathStillExists = FileManager.default.fileExists(atPath: noteAURL.path) + let diskText = originalPathStillExists + ? try String(contentsOf: noteAURL, encoding: .utf8) + : "" + store.flushPendingNotePersistence() + let snapshot = try fixture.readSnapshot() + try check(originalPathStillExists, "非活动 A 笔记的迟到草稿未处理就执行了重命名") + try check(diskText == externalEdit, "非活动 A 笔记的迟到草稿覆盖了外部编辑") + try check(snapshot.notesByItemID[noteA.id] == lateDraft, "非活动 A 笔记的迟到草稿没有保留") + try check(snapshot.pendingNoteWritesByItemID?[noteA.id] != nil, "非活动 A 笔记的冲突没有建立待写状态") + } + + @MainActor + private static func renameRejectsChangedFileGeneration() throws { + let fixture = try WorkspaceFixture(name: "rename-generation-change") + defer { fixture.remove() } + + let noteURL = fixture.importsDirectory.appendingPathComponent("身份固定笔记.md") + let renamedURL = fixture.importsDirectory.appendingPathComponent("不应采用的新身份.md") + try Data("# 身份固定笔记\n\n原始内容".utf8).write(to: noteURL) + let originalIdentity = ImportedFileIdentity( + volumeID: 40, + fileID: 400, + birthTimeSeconds: 4_000, + birthTimeNanoseconds: 40 + ) + let swappedIdentity = ImportedFileIdentity( + volumeID: 40, + fileID: 401, + birthTimeSeconds: 4_001, + birthTimeNanoseconds: 41 + ) + var observedSwappedIdentity = false + let store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: { url in + if url.path == renamedURL.path { + observedSwappedIdentity = true + return swappedIdentity + } + if url.path == noteURL.path { + return observedSwappedIdentity ? swappedIdentity : originalIdentity + } + return nil + } + ) + _ = store.importFiles( + [noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let note = try require( + store.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "身份偷换场景无法导入笔记" + ) + store.select(itemID: note.id) + store.renameNotebookNote(itemID: note.id, to: "不应采用的新身份") + + let retained = try require( + store.courseNotebookItems.first { $0.id == note.id }, + "身份偷换后原笔记状态丢失" + ) + try check(FileManager.default.fileExists(atPath: noteURL.path), "重命名后身份变化时没有把原文件移回旧路径") + try check(!FileManager.default.fileExists(atPath: renamedURL.path), "重命名后身份变化时错误保留了新路径文件") + try check(retained.urlPath == nil, "重命名后陌生文件被错误接回原笔记关系") + try check(retained.importedFileIdentity == originalIdentity, "重命名后身份变化时新文件继承了原关系身份") + try check(store.noteFileError?.contains("身份") == true, "重命名后身份变化时没有向用户说明已中止") + let snapshot = try fixture.readSnapshot() + try check(snapshot.notesByItemID[note.id] != nil, "陌生身份回滚后没有保留原笔记正文") + try check(snapshot.pendingNoteWritesByItemID?[note.id] != nil, "陌生身份回滚后没有建立待写保护") + } + + @MainActor + private static func activeRenameWriteFailureIsTransactional() throws { + let fixture = try WorkspaceFixture(name: "active-rename-write-failure") + defer { fixture.remove() } + + let materialURL = fixture.importsDirectory.appendingPathComponent("关联资料.txt") + let noteURL = fixture.importsDirectory.appendingPathComponent("写入失败笔记.md") + let renamedURL = fixture.importsDirectory.appendingPathComponent("不应成功的改名.md") + let originalMarkdown = "# 写入失败笔记\n\n最新正文" + try Data("关联资料正文".utf8).write(to: materialURL) + try Data(originalMarkdown.utf8).write(to: noteURL) + + let store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + notebookMarkdownWriter: { markdown, url in + if url.path == renamedURL.path { + throw NSError( + domain: "WeiBei.ImportedIdentitySelfCheck", + code: 71, + userInfo: [NSLocalizedDescriptionKey: "injected rename write failure"] + ) + } + try markdown.write(to: url, atomically: true, encoding: .utf8) + } + ) + _ = store.importFiles( + [materialURL, noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let material = try require( + store.courseMaterials.first { $0.urlPath == materialURL.path }, + "写入失败场景无法导入资料" + ) + let note = try require( + store.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "写入失败场景无法导入笔记" + ) + store.setLinkedSourceIDs([material.id], for: note.id) + store.select(itemID: note.id) + store.renameNotebookNote(itemID: note.id, to: "不应成功的改名") + + let retained = try require( + store.courseNotebookItems.first { $0.id == note.id }, + "活动笔记写入失败后原身份丢失" + ) + try check(FileManager.default.fileExists(atPath: noteURL.path), "活动笔记标题写入失败后没有恢复原路径") + try check(!FileManager.default.fileExists(atPath: renamedURL.path), "活动笔记标题写入失败后仍保留了新路径") + try check(retained.urlPath == noteURL.path, "活动笔记标题写入失败后课程状态提前采用了新路径") + try check(store.linkedSourceIDs(for: note.id) == [material.id], "活动笔记标题写入失败后关系图被提前迁移") + let diskMarkdown = try String(contentsOf: noteURL, encoding: .utf8) + try check(diskMarkdown == originalMarkdown, "活动笔记标题写入失败后磁盘正文发生变化") + try check(store.noteFileError?.contains("无法重命名") == true, "活动笔记标题写入失败后仍显示成功") + } + + @MainActor + private static func inactiveRenameReadFailureIsTransactional() throws { + let fixture = try WorkspaceFixture(name: "inactive-rename-read-failure") + defer { fixture.remove() } + + let materialURL = fixture.importsDirectory.appendingPathComponent("当前资料.txt") + let noteURL = fixture.importsDirectory.appendingPathComponent("读取失败笔记.md") + let renamedURL = fixture.importsDirectory.appendingPathComponent("不应移动的笔记.md") + try Data("当前资料正文".utf8).write(to: materialURL) + try Data("# 读取失败笔记\n\n磁盘正文".utf8).write(to: noteURL) + + let store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + notebookMarkdownReader: { url in + if url.path == noteURL.path { + throw NSError( + domain: "WeiBei.ImportedIdentitySelfCheck", + code: 72, + userInfo: [NSLocalizedDescriptionKey: "injected rename read failure"] + ) + } + return try String(contentsOf: url, encoding: .utf8) + } + ) + _ = store.importFiles( + [materialURL, noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let material = try require( + store.courseMaterials.first { $0.urlPath == materialURL.path }, + "读取失败场景无法导入资料" + ) + let note = try require( + store.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "读取失败场景无法导入笔记" + ) + store.setLinkedSourceIDs([material.id], for: note.id) + store.select(itemID: material.id) + store.renameNotebookNote(itemID: note.id, to: "不应移动的笔记") + + let retained = try require( + store.courseNotebookItems.first { $0.id == note.id }, + "非活动笔记读取失败后原身份丢失" + ) + try check(FileManager.default.fileExists(atPath: noteURL.path), "非活动笔记读取失败后原文件消失") + try check(!FileManager.default.fileExists(atPath: renamedURL.path), "非活动笔记读取失败后仍移动了文件") + try check(retained.urlPath == noteURL.path, "非活动笔记读取失败后课程状态提前采用了新路径") + try check(store.linkedSourceIDs(for: note.id) == [material.id], "非活动笔记读取失败后关系图被提前迁移") + try check(store.noteFileError?.contains("无法重命名") == true, "非活动笔记读取失败后仍显示成功") + } + + @MainActor + private static func successfulButIncorrectRenameWriteIsRejected() throws { + let fixture = try WorkspaceFixture(name: "rename-writer-wrong-content") + defer { fixture.remove() } + + let noteURL = fixture.importsDirectory.appendingPathComponent("不能被覆盖的笔记.md") + let renamedURL = fixture.importsDirectory.appendingPathComponent("错误写入不应成功.md") + let originalMarkdown = "# 不能被覆盖的笔记\n\n用户正文" + try Data(originalMarkdown.utf8).write(to: noteURL) + + let store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + notebookMarkdownWriter: { markdown, url in + if url.path == renamedURL.path { + try "# 陌生正文\n\n不应接管关系".write(to: url, atomically: true, encoding: .utf8) + } else { + try markdown.write(to: url, atomically: true, encoding: .utf8) + } + } + ) + _ = store.importFiles( + [noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let note = try require( + store.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "错误写入场景无法导入笔记" + ) + store.select(itemID: note.id) + store.renameNotebookNote(itemID: note.id, to: "错误写入不应成功") + + let retained = try require( + store.courseNotebookItems.first { $0.id == note.id }, + "错误写入后原笔记身份丢失" + ) + let restoredMarkdown = try String(contentsOf: noteURL, encoding: .utf8) + let snapshot = try fixture.readSnapshot() + try check(FileManager.default.fileExists(atPath: noteURL.path), "错误写入返回成功后没有恢复原路径") + try check(!FileManager.default.fileExists(atPath: renamedURL.path), "错误写入返回成功后仍提交了新路径") + try check(retained.urlPath == nil, "错误写入返回成功后陌生磁盘内容仍接管原关系") + try check(restoredMarkdown.contains("陌生正文"), "错误写入返回成功后覆盖或删除了外部磁盘内容") + try check(snapshot.notesByItemID[note.id] == originalMarkdown, "错误写入返回成功后没有保留魏碑原正文") + try check(snapshot.pendingNoteWritesByItemID?[note.id] != nil, "错误写入返回成功后没有建立待写保护") + try check(store.noteFileError?.contains("无法重命名") == true, "错误写入返回成功后仍显示重命名成功") + } + + @MainActor + private static func initialRenameMoveFailureLeavesHealthyFileAttached() throws { + let fixture = try WorkspaceFixture(name: "rename-initial-move-failure") + defer { fixture.remove() } + + let noteURL = fixture.importsDirectory.appendingPathComponent("移动失败笔记.md") + let renamedURL = fixture.importsDirectory.appendingPathComponent("不应存在的新路径.md") + let originalMarkdown = "# 移动失败笔记\n\n仍然健康" + try Data(originalMarkdown.utf8).write(to: noteURL) + + let store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + notebookFileMover: { sourceURL, destinationURL in + if sourceURL.path == noteURL.path && destinationURL.path == renamedURL.path { + throw NSError( + domain: "WeiBei.ImportedIdentitySelfCheck", + code: 73, + userInfo: [NSLocalizedDescriptionKey: "injected initial move failure"] + ) + } + try FileManager.default.moveItem(at: sourceURL, to: destinationURL) + } + ) + _ = store.importFiles( + [noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let note = try require( + store.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "移动失败场景无法导入笔记" + ) + store.select(itemID: note.id) + store.renameNotebookNote(itemID: note.id, to: "不应存在的新路径") + + let retained = try require( + store.courseNotebookItems.first { $0.id == note.id }, + "首次移动失败后原笔记身份丢失" + ) + try check(FileManager.default.fileExists(atPath: noteURL.path), "首次移动失败后健康原文件消失") + try check(!FileManager.default.fileExists(atPath: renamedURL.path), "首次移动失败后产生了新路径") + try check(retained.urlPath == noteURL.path, "首次移动失败后健康原文件被错误标成不可用") + try check(retained.importedFileIdentity != nil, "首次移动失败后健康原文件身份丢失") + } + + @MainActor + private static func failedWorkspaceSaveRecoversRenameOnRestart() throws { + let fixture = try WorkspaceFixture(name: "rename-save-recovery") + defer { fixture.remove() } + + let materialURL = fixture.importsDirectory.appendingPathComponent("恢复关联资料.txt") + let noteURL = fixture.importsDirectory.appendingPathComponent("崩溃恢复笔记.md") + let renamedURL = fixture.importsDirectory.appendingPathComponent("已恢复改名.md") + try Data("恢复关联资料正文".utf8).write(to: materialURL) + try Data("# 崩溃恢复笔记\n\n恢复正文".utf8).write(to: noteURL) + + var rejectWorkspaceSave = false + var store: WorkspaceStore? = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + workspaceSnapshotWriter: { data, url in + let renameJournalExists = FileManager.default.fileExists( + atPath: fixture.workspaceDirectory.appendingPathComponent("pending-notebook-rename.json").path + ) + if rejectWorkspaceSave, renameJournalExists { + throw NSError( + domain: "WeiBei.ImportedIdentitySelfCheck", + code: 74, + userInfo: [NSLocalizedDescriptionKey: "injected workspace save failure"] + ) + } + try data.write(to: url, options: [.atomic]) + } + ) + _ = store?.importFiles( + [materialURL, noteURL], + selectsFirstImportedItem: false, + markdownNotePaths: [noteURL.path] + ) + let material = try require( + store?.courseMaterials.first { $0.urlPath == materialURL.path }, + "保存失败恢复场景无法导入资料" + ) + let note = try require( + store?.courseNotebookItems.first { $0.urlPath == noteURL.path }, + "保存失败恢复场景无法导入笔记" + ) + store?.setLinkedSourceIDs([material.id], for: note.id) + store?.select(itemID: note.id) + store?.flushPendingNotePersistence() + + rejectWorkspaceSave = true + store?.renameNotebookNote(itemID: note.id, to: "已恢复改名") + try check(FileManager.default.fileExists(atPath: renamedURL.path), "课程状态保存失败后真实文件没有完成改名") + try check(store?.workspaceSaveError != nil, "课程状态保存失败后没有暴露真实错误") + try check( + FileManager.default.fileExists(atPath: fixture.workspaceDirectory.appendingPathComponent("pending-notebook-rename.json").path), + "课程状态保存失败后没有留下重命名恢复记录" + ) + + store = nil + rejectWorkspaceSave = false + store = WorkspaceStore(workspaceDirectory: fixture.workspaceDirectory) + let recovered = try require( + store?.courseNotebookItems.first { $0.id == note.id }, + "重启后找不到需要恢复的笔记身份" + ) + let recoveredMarkdown = try String(contentsOf: renamedURL, encoding: .utf8) + try check(recovered.urlPath == renamedURL.path, "重启后没有从恢复记录接回真实新路径") + try check(recoveredMarkdown.hasPrefix("# 已恢复改名\n"), "重启后没有保留已写入的新标题") + try check(store?.linkedSourceIDs(for: note.id) == [material.id], "重启恢复改名后资料关系丢失") + try check( + !FileManager.default.fileExists(atPath: fixture.workspaceDirectory.appendingPathComponent("pending-notebook-rename.json").path), + "重启完成恢复后仍残留重命名恢复记录" + ) + } + + @MainActor + private static func duplicateLegacyIdentityMigratesInOneLaunch() throws { + let fixture = try WorkspaceFixture(name: "duplicate-legacy-single-launch") + defer { fixture.remove() } + + let firstURL = fixture.importsDirectory.appendingPathComponent("旧路径一.txt") + let secondURL = fixture.importsDirectory.appendingPathComponent("旧路径二.txt") + try Data("同一个真实文件".utf8).write(to: firstURL) + try FileManager.default.linkItem(at: firstURL, to: secondURL) + let sharedIdentity = ImportedFileIdentity( + volumeID: 60, + fileID: 600, + birthTimeSeconds: 6_000, + birthTimeNanoseconds: 60 + ) + let firstLegacyID = "file:\(firstURL.path)" + let secondLegacyID = "file:\(secondURL.path)" + try fixture.write( + PersistedWorkspace( + importedItems: [ + StudyItem( + id: firstLegacyID, + title: "旧路径一", + subtitle: firstURL.lastPathComponent, + kind: .text, + urlPath: firstURL.path, + isSample: false + ), + StudyItem( + id: secondLegacyID, + title: "旧路径二", + subtitle: secondURL.lastPathComponent, + kind: .text, + urlPath: secondURL.path, + isSample: false + ), + ], + selectedItemID: firstLegacyID, + noteSourceLinksMigrationVersion: 1 + ) + ) + + var store: WorkspaceStore? = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: { url in + [firstURL.path, secondURL.path].contains(url.path) ? sharedIdentity : nil + } + ) + try check(store?.importedItems.count == 1, "两个同身份旧路径项需要第二次启动才合并") + let firstLaunchSnapshot = try Data(contentsOf: fixture.workspaceDirectory.appendingPathComponent("workspace.json")) + store = nil + store = WorkspaceStore( + workspaceDirectory: fixture.workspaceDirectory, + importedFileIdentityResolver: { url in + [firstURL.path, secondURL.path].contains(url.path) ? sharedIdentity : nil + } + ) + let secondLaunchSnapshot = try Data(contentsOf: fixture.workspaceDirectory.appendingPathComponent("workspace.json")) + try check(store?.importedItems.count == 1, "两个同身份旧路径项重启后再次变化") + try check(firstLaunchSnapshot == secondLaunchSnapshot, "两个同身份旧路径项首次迁移不是幂等结果") } @MainActor diff --git a/Sources/WeiBeiCore/WorkspaceModels.swift b/Sources/WeiBeiCore/WorkspaceModels.swift index d9571077e..4ff2be426 100644 --- a/Sources/WeiBeiCore/WorkspaceModels.swift +++ b/Sources/WeiBeiCore/WorkspaceModels.swift @@ -811,7 +811,7 @@ public struct StudyItem: Identifiable, Codable, Hashable, Sendable { } public var editsBackingMarkdownFile: Bool { - isImportedMarkdownFile && isNotebookNote + !isSample && kind == .markdown && isNotebookNote } public var canBecomeNotebookNote: Bool { @@ -865,9 +865,19 @@ public struct AgentMessage: Identifiable, Codable, Hashable, Sendable { } } +public struct PendingNoteWriteState: Codable, Hashable, Sendable { + public var baselineContentDigest: String? + + public init(baselineContentDigest: String?) { + self.baselineContentDigest = baselineContentDigest + } +} + public struct PersistedWorkspace: Codable { public var importedItems: [StudyItem] public var notesByItemID: [String: String] + public var pendingNoteWritesByItemID: [String: PendingNoteWriteState]? + public var noteBackingContentDigestsByItemID: [String: String]? public var selectedItemID: String? public var activeNotebookItemID: String? public var noteSourceLinks: [NoteSourceLink]? @@ -892,9 +902,11 @@ public struct PersistedWorkspace: Codable { public var adaptImportedDocumentColors: Bool? public var interfaceLanguageRaw: String? - public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], selectedItemID: String? = nil, activeNotebookItemID: String? = nil, noteSourceLinks: [NoteSourceLink]? = nil, noteSourceLinksMigrationVersion: Int? = nil, studyLocationsByItemID: [String: StudyLocation]? = nil, learningMemoryEntries: [LearningMemoryEntry]? = nil, learningMemoryRevision: UInt64? = nil, studySessions: [StudySession]? = nil, activeStudySessionID: UUID? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { + public init(importedItems: [StudyItem] = [], notesByItemID: [String: String] = [:], pendingNoteWritesByItemID: [String: PendingNoteWriteState]? = nil, noteBackingContentDigestsByItemID: [String: String]? = nil, selectedItemID: String? = nil, activeNotebookItemID: String? = nil, noteSourceLinks: [NoteSourceLink]? = nil, noteSourceLinksMigrationVersion: Int? = nil, studyLocationsByItemID: [String: StudyLocation]? = nil, learningMemoryEntries: [LearningMemoryEntry]? = nil, learningMemoryRevision: UInt64? = nil, studySessions: [StudySession]? = nil, activeStudySessionID: UUID? = nil, modelName: String? = nil, workspaceLayout: WorkspaceLayout? = nil, threePaneOrder: [WorkspacePaneRole]? = nil, agentSurface: AgentSurface? = nil, noteRenderMode: NoteRenderMode? = nil, showLibrary: Bool? = nil, showReader: Bool? = nil, showAgent: Bool? = nil, showNotes: Bool? = nil, showRightPane: Bool? = nil, showDailyInspiration: Bool? = nil, appearanceModeRaw: String? = nil, adaptImportedDocumentColors: Bool? = nil, interfaceLanguageRaw: String? = nil) { self.importedItems = importedItems self.notesByItemID = notesByItemID + self.pendingNoteWritesByItemID = pendingNoteWritesByItemID + self.noteBackingContentDigestsByItemID = noteBackingContentDigestsByItemID self.selectedItemID = selectedItemID self.activeNotebookItemID = activeNotebookItemID self.noteSourceLinks = noteSourceLinks diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index d8cd0789a..2f80db4a0 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -2902,10 +2902,17 @@ expect(workspaceStoreSource.contains("func promptRenameNotebookNote(itemID: Stri && workspaceStoreSource.contains("func cancelRenameNotebookNote()") && workspaceStoreSource.contains("func confirmRenameNotebookNote()") && workspaceStoreSource.contains("func renameNotebookNote(itemID: String, to rawTitle: String)") - && workspaceStoreSource.contains("try FileManager.default.moveItem(at: oldURL, to: newURL)") + && workspaceStoreSource.contains("sourceMarkdown = wasActiveNotebook ? noteText : try notebookMarkdownReader(oldURL)") + && workspaceStoreSource.contains("try writePendingNotebookRenameJournal(renameJournal)") + && workspaceStoreSource.contains("try notebookFileMover(oldURL, newURL)") + && workspaceStoreSource.contains("let coordinator = NSFileCoordinator(filePresenter: nil)") + && workspaceStoreSource.contains("try notebookMarkdownWriter(retitledMarkdown, coordinatedURL)") + && workspaceStoreSource.contains("outputDigest == expectedOutputDigest") && workspaceStoreSource.contains("activeNotebookItemID = newID") - && workspaceStoreSource.contains("retitledMarkdown(noteText, from: oldTitle") + && workspaceStoreSource.contains("noteText = retitledMarkdown") && workspaceStoreSource.contains("replaceNavigationItemID(oldID, with: newID)") + && workspaceStoreSource.contains("guard save() else") + && workspaceStoreSource.contains("文件已重命名,但课程状态尚未写入磁盘") && workspaceStoreSource.contains("notebookRenameDraft = nil") && !workspaceStoreSource.contains("alert.messageText = ui(\"重命名笔记\""), "renaming a notebook note updates the local markdown file, active note identity, heading, and navigation snapshots without a system alert") expect(workspaceStoreSource.contains("let title = item.map(displayTitle) ?? ui(\"新笔记\"") @@ -2918,7 +2925,9 @@ expect(workspaceStoreSource.contains("let title = item.map(displayTitle) ?? ui(\ && !workspaceStoreSource.contains("## 待追问\n - ") && !workspaceStoreSource.contains("未命名材料"), "new note templates avoid fake source copy and empty bullets") expect(workspaceStoreSource.contains("return cleanLegacyPlaceholder(notesByItemID[item.id] ?? defaultNote(for: item))") - && workspaceStoreSource.contains("cleanLegacyPlaceholder(try String(contentsOf: url, encoding: .utf8))") + && workspaceStoreSource.contains("guard let markdown = String(data: data, encoding: .utf8)") + && workspaceStoreSource.contains("noteBackingContentDigestsByItemID[item.id] = Self.noteContentDigest(data)") + && workspaceStoreSource.contains("return cleanLegacyPlaceholder(markdown)") && workspaceStoreSource.contains("静默洞察|Agent 洞察") && workspaceStoreSource.contains("with: \"> [!note] 阅读线索\\n>\\n> $1\\n>\\n> 来源:$2\"") && workspaceStoreSource.contains(#"(?m)^> \[!note\] 阅读线索\n> ([^\n])"#) From 598d8f0b1f99e7b708f6dd0dff3a384c988a69af Mon Sep 17 00:00:00 2001 From: taekchef <taekchef@users.noreply.github.com> Date: Thu, 16 Jul 2026 02:05:57 +0800 Subject: [PATCH 36/36] fix: keep rapid note switches visible --- Sources/WeiBei/App/WeiBeiApp.swift | 13 +++++++--- Sources/WeiBei/Stores/WorkspaceStore.swift | 2 ++ .../WeiBei/Views/RichMarkdownEditorView.swift | 12 +++++++++- Sources/WeiBeiSelfCheck/main.swift | 24 ++++++++++++------- script/build_and_run.sh | 2 +- 5 files changed, 40 insertions(+), 13 deletions(-) diff --git a/Sources/WeiBei/App/WeiBeiApp.swift b/Sources/WeiBei/App/WeiBeiApp.swift index ae3f146b8..a4545a443 100644 --- a/Sources/WeiBei/App/WeiBeiApp.swift +++ b/Sources/WeiBei/App/WeiBeiApp.swift @@ -394,7 +394,14 @@ private struct WindowChromeConfigurator: NSViewRepresentable { Self.scheduledVerificationCaptures.insert(capturePath).inserted else { return } let scenario = environment["WEIBEI_VERIFY_SCENARIO"] ?? "" - if ["pi-learning-flow", "pi-course-memory-flow", "pane-toggle-continuity-flow", "reader-scroll-persistence-flow"].contains(scenario), + if [ + "pi-learning-flow", + "pi-course-memory-flow", + "pane-toggle-continuity-flow", + "reader-scroll-persistence-flow", + "course-workspace-overview-flow", + "course-workspace-workflow-flow", + ].contains(scenario), let workspaceDirectory = environment["WEIBEI_WORKSPACE_DIR"] { let stateURL = URL(fileURLWithPath: workspaceDirectory) .appendingPathComponent("verification-state.txt") @@ -420,7 +427,7 @@ private struct WindowChromeConfigurator: NSViewRepresentable { ) { let stages = (try? String(contentsOf: stateURL, encoding: .utf8)) ?? "" if stages.split(separator: "\n").contains("completed") { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { capture(window, to: capturePath) } return @@ -454,7 +461,7 @@ private struct WindowChromeConfigurator: NSViewRepresentable { composite.lockFocus() baseImage.draw(in: bounds) for overlay in overlays { - overlay.image.draw(in: overlay.rect, from: .zero, operation: .copy, fraction: 1) + overlay.image.draw(in: overlay.rect, from: .zero, operation: .sourceOver, fraction: 1) } composite.unlockFocus() guard let tiff = composite.tiffRepresentation, diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index 7d95f7ef0..6a2c74a8a 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -4346,6 +4346,7 @@ final class WorkspaceStore: ObservableObject { "courseWorkspacePresented": courseWorkspacePresented, ] ) + recordVerificationStage("completed") return } @@ -4461,6 +4462,7 @@ final class WorkspaceStore: ObservableObject { "paneDismantleCount": paneDismantleCount, ] ) + recordVerificationStage("completed") } private func writeCourseWorkspaceVerificationReport(name: String, payload: [String: Any]) { diff --git a/Sources/WeiBei/Views/RichMarkdownEditorView.swift b/Sources/WeiBei/Views/RichMarkdownEditorView.swift index 2cdbd11e9..7e5962a93 100644 --- a/Sources/WeiBei/Views/RichMarkdownEditorView.swift +++ b/Sources/WeiBei/Views/RichMarkdownEditorView.swift @@ -542,10 +542,20 @@ struct RichMarkdownEditorView: NSViewRepresentable { } func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { - guard messageMatchesDocument(message.body) else { return } + // The SwiftUI document can change while the WebView is still booting. + // Its one ready callback still belongs to this WebView and must be + // accepted so we can push the latest document into it. Every later + // callback remains scoped to the current document identity. + if message.name != "editorReady" { + guard messageMatchesDocument(message.body) else { return } + } switch message.name { case "editorReady": isReady = true + setDocumentID(documentID) + setMarkdownBaseURL(markdownBaseURLString) + setEditable(isEditable) + setInterfaceLanguage(interfaceLanguage) if let text = (message.body as? [String: Any])?["markdown"] as? String { webMarkdown = text if markdown.wrappedValue == text { diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 2f80db4a0..3ec52e76a 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -245,7 +245,7 @@ expect(runScript.contains("PDF_TEXT_WORKER_NAME=\"WeiBeiPDFTextWorker\"") expect(runScript.contains("kCGWindowOwnerName") && runScript.contains("\"$APP_DISPLAY_NAME\""), "run script verifies the visible app window by owner name") expect(runScript.contains("let isOnscreen = window[kCGWindowIsOnscreen as String] as? NSNumber") && runScript.contains("let visibleEnough = isOnscreen == nil || isOnscreen?.intValue != 0"), "run script tolerates missing onscreen metadata when the window is otherwise capturable") expect(!runScript.contains("pid=\"$(pgrep -x \"$PRODUCT_NAME\""), "run script window verification does not depend on pgrep") -expect(runScript.contains("visual_verify_window") && runScript.contains("--visual-verify") && runScript.contains("visual_non_black_ratio") && runScript.contains("visual_black_ratio") && runScript.contains("blackRatio > 0.12") && runScript.contains("nonBlackRatio < 0.02"), "run script rejects empty captures and black rendering blocks") +expect(runScript.contains("visual_verify_window") && runScript.contains("--visual-verify") && runScript.contains("visual_non_black_ratio") && runScript.contains("visual_black_ratio") && runScript.contains("visual_transparent_ratio") && runScript.contains("color.alphaComponent < 0.05") && runScript.contains("blackRatio > 0.12") && runScript.contains("transparentRatio > 0.005") && runScript.contains("nonBlackRatio < 0.02"), "run script rejects empty, fully transparent, and black rendering blocks without rejecting translucent titlebar material") expect(runScript.contains("weibei-visual-verify-latest.png") && runScript.contains("cp \"$capture_path\" \"$latest_capture_path\""), "visual verification leaves one latest screenshot path for review") expect(runScript.contains("weibei-visual-verify-$VERIFY_SCENARIO.png") && runScript.contains("visual_capture_path=$scenario_capture_path"), "visual verification preserves a separate screenshot for every empty-workspace theme and width scenario") @@ -2047,8 +2047,12 @@ expect(!richEditorSource.contains("nativeViewCache") expect( richEditorSource.contains("window.weiBeiDocumentID") && richEditorSource.contains("func setDocumentID(_ id: String)") - && richEditorSource.contains("guard messageMatchesDocument(message.body) else { return }"), - "rich editor rejects stale web callbacks from a previous document" + && richEditorSource.contains("if message.name != \"editorReady\" {") + && richEditorSource.contains("guard messageMatchesDocument(message.body) else { return }") + && richEditorSource.contains("case \"editorReady\":\n isReady = true\n setDocumentID(documentID)") + && richEditorSource.contains("setMarkdownBaseURL(markdownBaseURLString)") + && richEditorSource.contains("setEditable(isEditable)"), + "rich editor accepts a late ready callback, reapplies the current document, and rejects every other stale callback" ) expect(richEditorSource.contains("guard text == pendingExternalMarkdown else { return }"), "rich editor ignores stale markdown callbacks during document sync") expect(richEditorSource.contains("command && shift && !option && !control") && richEditorSource.contains("[\"a\", \"r\", \"e\", \"c\"].includes(key)"), "rich editor forwards command-shift agent shortcuts to Swift") @@ -2166,12 +2170,15 @@ expect(appSource.contains("environment[\"WEIBEI_VERIFY_CAPTURE_PATH\"]") && appSource.contains("cacheDisplay(in: bounds, to: bitmap)") && appSource.contains("visibleWebViews(in: contentView)") && appSource.contains("webView.takeSnapshot(with: nil)") - && appSource.contains("overlay.image.draw(in: overlay.rect") - && appSource.contains("let scenario = environment[\"WEIBEI_VERIFY_SCENARIO\"] ?? \"\"") - && appSource.contains("[\"pi-learning-flow\", \"pi-course-memory-flow\", \"pane-toggle-continuity-flow\", \"reader-scroll-persistence-flow\"].contains(scenario)") - && appSource.contains("remainingAttempts: scenario == \"pane-toggle-continuity-flow\" ? 1_800 : 600") + && appSource.contains("overlay.image.draw(in: overlay.rect, from: .zero, operation: .sourceOver, fraction: 1)") + && !appSource.contains("operation: .copy"), "isolated verification capture preserves the opaque window underneath transparent WebView snapshots") +expect(appSource.contains("let scenario = environment[\"WEIBEI_VERIFY_SCENARIO\"] ?? \"\"") + && appSource.contains("\"course-workspace-overview-flow\"") + && appSource.contains("\"course-workspace-workflow-flow\""), "course workspace verification scenarios opt into completion-aware capture") +expect(appSource.contains("remainingAttempts: scenario == \"pane-toggle-continuity-flow\" ? 1_800 : 600") && appSource.contains("waitForVerificationCompletion") - && appSource.contains("stages.split(separator: \"\\n\").contains(\"completed\")"), "isolated verification app captures completed PI and pane-continuity flows without Screen Recording permission") + && appSource.contains("stages.split(separator: \"\\n\").contains(\"completed\")") + && appSource.contains("DispatchQueue.main.asyncAfter(deadline: .now() + 1.5)"), "isolated verification capture waits for an explicit completion marker and settled rendering") expect(appSource.contains("sharedWorkspaceStore"), "main window and settings share one workspace store") expect(!appSource.contains("launchProbe"), "app launch path has no temporary probe logging") expect(appSource.contains("WeiBeiAppearanceTransition") @@ -2272,6 +2279,7 @@ expect(appSource.contains("init() {") let workspaceStoreSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Stores/WorkspaceStore.swift") let workspaceStoreSource = (try? String(contentsOf: workspaceStoreSourceURL, encoding: .utf8)) ?? "" +expect(workspaceStoreSource.components(separatedBy: "recordVerificationStage(\"completed\")").count >= 4, "verification scenarios record completion before capture") let linkedSourcesSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) .appendingPathComponent("Sources/WeiBei/Views/LinkedSourcesView.swift") let linkedSourcesSource = (try? String(contentsOf: linkedSourcesSourceURL, encoding: .utf8)) ?? "" diff --git a/script/build_and_run.sh b/script/build_and_run.sh index af0169744..1325f0119 100755 --- a/script/build_and_run.sh +++ b/script/build_and_run.sh @@ -341,7 +341,7 @@ visual_verify_window() { fi rm -f "$capture_error" fi - swift -target arm64-apple-macosx14.0 -e 'import AppKit; import Foundation; let path = CommandLine.arguments[1]; guard let image = NSImage(contentsOf: URL(fileURLWithPath: path)), let data = image.tiffRepresentation, let bitmap = NSBitmapImageRep(data: data) else { exit(2) }; let xStep = max(1, bitmap.pixelsWide / 80); let yStep = max(1, bitmap.pixelsHigh / 60); var sampled = 0; var visible = 0; var black = 0; for y in stride(from: 0, to: bitmap.pixelsHigh, by: yStep) { for x in stride(from: 0, to: bitmap.pixelsWide, by: xStep) { guard let color = bitmap.colorAt(x: x, y: y) else { continue }; if color.redComponent > 0.08 || color.greenComponent > 0.08 || color.blueComponent > 0.08 { visible += 1 }; if color.redComponent < 0.035 && color.greenComponent < 0.035 && color.blueComponent < 0.035 { black += 1 }; sampled += 1 } }; guard sampled > 0 else { exit(3) }; let nonBlackRatio = Double(visible) / Double(sampled); let blackRatio = Double(black) / Double(sampled); print("visual_non_black_ratio=\(nonBlackRatio)"); print("visual_black_ratio=\(blackRatio)"); if nonBlackRatio < 0.02 || blackRatio > 0.12 { fputs("visual verify failed: captured window is empty or contains black rendering blocks\n", stderr); exit(4) }' "$capture_path" + swift -target arm64-apple-macosx14.0 -e 'import AppKit; import Foundation; let path = CommandLine.arguments[1]; guard let image = NSImage(contentsOf: URL(fileURLWithPath: path)), let data = image.tiffRepresentation, let bitmap = NSBitmapImageRep(data: data) else { exit(2) }; let xStep = max(1, bitmap.pixelsWide / 80); let yStep = max(1, bitmap.pixelsHigh / 60); var sampled = 0; var visible = 0; var black = 0; var transparent = 0; for y in stride(from: 0, to: bitmap.pixelsHigh, by: yStep) { for x in stride(from: 0, to: bitmap.pixelsWide, by: xStep) { guard let color = bitmap.colorAt(x: x, y: y) else { continue }; if color.redComponent > 0.08 || color.greenComponent > 0.08 || color.blueComponent > 0.08 { visible += 1 }; if color.redComponent < 0.035 && color.greenComponent < 0.035 && color.blueComponent < 0.035 { black += 1 }; if color.alphaComponent < 0.05 { transparent += 1 }; sampled += 1 } }; guard sampled > 0 else { exit(3) }; let nonBlackRatio = Double(visible) / Double(sampled); let blackRatio = Double(black) / Double(sampled); let transparentRatio = Double(transparent) / Double(sampled); print("visual_non_black_ratio=\(nonBlackRatio)"); print("visual_black_ratio=\(blackRatio)"); print("visual_transparent_ratio=\(transparentRatio)"); if nonBlackRatio < 0.02 || blackRatio > 0.12 || transparentRatio > 0.005 { fputs("visual verify failed: captured window is empty, transparent, or contains black rendering blocks\n", stderr); exit(4) }' "$capture_path" local latest_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-latest.png" local scenario_capture_path="${TMPDIR:-/tmp}/weibei-visual-verify-$VERIFY_SCENARIO.png" cp "$capture_path" "$latest_capture_path"